@ajf/material 18.4.1 → 18.5.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.
- package/README.md +167 -2
- package/audio/src/audio-module.d.ts +7 -6
- package/esm2022/audio/src/audio-module.mjs +22 -4
- package/esm2022/audio/src/audio.mjs +6 -6
- package/esm2022/barcode/barcode.mjs +3 -3
- package/esm2022/calendar/calendar.mjs +2 -2
- package/esm2022/checkbox-group/checkbox-group-item.mjs +3 -3
- package/esm2022/form-builder/form-builder-service.mjs +121 -32
- package/esm2022/form-builder/form-builder-utils.mjs +25 -1
- package/esm2022/form-builder/node-entry.mjs +18 -4
- package/esm2022/form-builder/node-properties.mjs +11 -17
- package/esm2022/forms/boolean-field.mjs +6 -5
- package/esm2022/forms/current-slide.mjs +92 -0
- package/esm2022/forms/date-input-field.mjs +7 -9
- package/esm2022/forms/display-field.mjs +2 -2
- package/esm2022/forms/empty-field.mjs +3 -3
- package/esm2022/forms/field-row.mjs +117 -0
- package/esm2022/forms/field.mjs +2 -2
- package/esm2022/forms/form.mjs +107 -13
- package/esm2022/forms/forms-module.mjs +26 -3
- package/esm2022/forms/input-field.mjs +6 -8
- package/esm2022/forms/multiple-choice-field.mjs +45 -10
- package/esm2022/forms/public_api.mjs +6 -1
- package/esm2022/forms/range-field.mjs +5 -6
- package/esm2022/forms/rep-strip.mjs +61 -0
- package/esm2022/forms/single-choice-field.mjs +26 -11
- package/esm2022/forms/slide-header.mjs +68 -0
- package/esm2022/forms/slide-stats.mjs +148 -0
- package/esm2022/forms/table-field.mjs +2 -2
- package/esm2022/forms/text-field.mjs +2 -2
- package/esm2022/forms/video-url-field.mjs +6 -8
- package/esm2022/geolocation/geolocation.mjs +4 -6
- package/esm2022/node-icon/node-icon.mjs +4 -1
- package/esm2022/page-slider/page-slider.mjs +3 -3
- package/esm2022/signature/signature.mjs +5 -6
- package/esm2022/time/time-module.mjs +22 -4
- package/esm2022/time/time.mjs +4 -4
- package/fesm2022/ajf-material-audio.mjs +27 -9
- package/fesm2022/ajf-material-audio.mjs.map +1 -1
- package/fesm2022/ajf-material-barcode.mjs +2 -2
- package/fesm2022/ajf-material-barcode.mjs.map +1 -1
- package/fesm2022/ajf-material-calendar.mjs +2 -2
- package/fesm2022/ajf-material-calendar.mjs.map +1 -1
- package/fesm2022/ajf-material-checkbox-group.mjs +2 -2
- package/fesm2022/ajf-material-checkbox-group.mjs.map +1 -1
- package/fesm2022/ajf-material-form-builder.mjs +168 -49
- package/fesm2022/ajf-material-form-builder.mjs.map +1 -1
- package/fesm2022/ajf-material-forms.mjs +712 -99
- package/fesm2022/ajf-material-forms.mjs.map +1 -1
- package/fesm2022/ajf-material-geolocation.mjs +5 -7
- package/fesm2022/ajf-material-geolocation.mjs.map +1 -1
- package/fesm2022/ajf-material-node-icon.mjs +3 -0
- package/fesm2022/ajf-material-node-icon.mjs.map +1 -1
- package/fesm2022/ajf-material-page-slider.mjs +2 -2
- package/fesm2022/ajf-material-page-slider.mjs.map +1 -1
- package/fesm2022/ajf-material-signature.mjs +7 -8
- package/fesm2022/ajf-material-signature.mjs.map +1 -1
- package/fesm2022/ajf-material-time.mjs +24 -6
- package/fesm2022/ajf-material-time.mjs.map +1 -1
- package/form-builder/form-builder-service.d.ts +23 -0
- package/form-builder/form-builder-utils.d.ts +8 -0
- package/form-builder/node-entry.d.ts +10 -0
- package/form-builder/node-properties.d.ts +5 -1
- package/forms/_theming.scss +142 -0
- package/forms/current-slide.d.ts +61 -0
- package/forms/field-row.d.ts +63 -0
- package/forms/form.d.ts +40 -3
- package/forms/forms-module.d.ts +57 -51
- package/forms/multiple-choice-field.d.ts +15 -1
- package/forms/public_api.d.ts +5 -0
- package/forms/rep-strip.d.ts +52 -0
- package/forms/single-choice-field.d.ts +7 -0
- package/forms/slide-header.d.ts +61 -0
- package/forms/slide-stats.d.ts +76 -0
- package/package.json +2 -2
- package/time/time-module.d.ts +4 -3
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* If not, see http://www.gnu.org/licenses/.
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
+
import { AjfNode } from '@ajf/core/forms';
|
|
22
23
|
import { CdkDrag, CdkDragDrop } from '@angular/cdk/drag-drop';
|
|
23
24
|
import { AjfFormBuilderNode, AjfFormBuilderNodeEntry, AjfFormBuilderNodeTypeEntry, AjfFormBuilderService } from './form-builder-service';
|
|
24
25
|
/**
|
|
@@ -29,6 +30,13 @@ import { AjfFormBuilderNode, AjfFormBuilderNodeEntry, AjfFormBuilderNodeTypeEntr
|
|
|
29
30
|
* @param content True if the current nodeEntry contains other nodeEntries.
|
|
30
31
|
*/
|
|
31
32
|
export declare function onDropProcess(event: CdkDragDrop<AjfFormBuilderNodeEntry> | CdkDragDrop<AjfFormBuilderNodeTypeEntry>, fbService: AjfFormBuilderService, nodeEntry: AjfFormBuilderNode | null, content?: boolean): void;
|
|
33
|
+
/**
|
|
34
|
+
* Tells whether the dragged item can be dropped among the content of the
|
|
35
|
+
* container: a slide takes fields and groups, a group takes fields only.
|
|
36
|
+
* @param item The dragged item, either a palette entry or a node of the form.
|
|
37
|
+
* @param container The container node owning the drop list.
|
|
38
|
+
*/
|
|
39
|
+
export declare function canDropInContainer(item: CdkDrag<AjfFormBuilderNodeTypeEntry | AjfFormBuilderNodeEntry>, container: AjfNode): boolean;
|
|
32
40
|
/**
|
|
33
41
|
* Disables the drag&drop of Slide items.
|
|
34
42
|
* @param item The dragged item.
|
|
@@ -63,6 +63,11 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
|
|
|
63
63
|
set firstBranchColor(firstBranchColor: string);
|
|
64
64
|
private _currentEditedNode;
|
|
65
65
|
get currentEditedNode(): Observable<AjfFormBuilderNodeEntry | null>;
|
|
66
|
+
/**
|
|
67
|
+
* The ids of the drop lists an item dragged from the content of this node can
|
|
68
|
+
* be moved into, the lists of the groups first.
|
|
69
|
+
*/
|
|
70
|
+
get connectedDropLists(): Observable<string[]>;
|
|
66
71
|
private _branchLinesSubscription;
|
|
67
72
|
private _childEntriesSubscription;
|
|
68
73
|
constructor(_service: AjfFormBuilderService);
|
|
@@ -86,6 +91,11 @@ export declare class AjfFbNodeEntry implements AfterViewInit, OnDestroy {
|
|
|
86
91
|
* @param empty True if the list is marked as empty.
|
|
87
92
|
*/
|
|
88
93
|
assignId(empty?: boolean): string;
|
|
94
|
+
/**
|
|
95
|
+
* The enter predicate of the drop lists holding the content of this node.
|
|
96
|
+
* An arrow function, since the CDK calls it with no `this`.
|
|
97
|
+
*/
|
|
98
|
+
contentDropPredicate: (item: CdkDrag) => boolean;
|
|
89
99
|
disableSlideDrop(item: CdkDrag<AjfFormBuilderNodeTypeEntry>): boolean;
|
|
90
100
|
disableFieldDrop(item: CdkDrag<AjfFormBuilderNodeTypeEntry>): boolean;
|
|
91
101
|
emptyAreaDropPredicate(): (item: CdkDrag, _drop: CdkDropList) => boolean;
|
|
@@ -77,7 +77,11 @@ export declare class AjfFbNodeProperties implements OnDestroy, OnInit {
|
|
|
77
77
|
get nextSlideCondition(): string | undefined;
|
|
78
78
|
private _triggerConditions;
|
|
79
79
|
get triggerConditions(): string[];
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* True for a repeating slide. A group is a repeating container node too, but
|
|
82
|
+
* the renderer never repeats it, so it gets no repetitions to edit.
|
|
83
|
+
*/
|
|
84
|
+
isRepeatingSlide: (nodeEntry: AjfFormBuilderNodeEntry | null) => boolean;
|
|
81
85
|
private _visibilityOptSub;
|
|
82
86
|
private _visibilitySub;
|
|
83
87
|
private _conditionalBranchesSub;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// Public theming API of the AJF form renderer.
|
|
2
|
+
//
|
|
3
|
+
// The renderer paints itself from a set of `--ajf-*` custom properties. Their
|
|
4
|
+
// defaults already follow Angular Material's M3 system variables where a host
|
|
5
|
+
// publishes them, so an application themed with `use-system-variables: true`
|
|
6
|
+
// needs nothing from this file.
|
|
7
|
+
//
|
|
8
|
+
// Everything else -- an M2 theme, a prebuilt theme, or an M3 theme without
|
|
9
|
+
// system variables -- has a theme object but no system variables, and that is
|
|
10
|
+
// what this mixin is for:
|
|
11
|
+
//
|
|
12
|
+
// @use '@angular/material' as mat;
|
|
13
|
+
// @use '@ajf/material/forms/theming' as ajf-forms;
|
|
14
|
+
//
|
|
15
|
+
// $theme: mat.define-light-theme(...); // or mat.define-theme(...)
|
|
16
|
+
//
|
|
17
|
+
// :root {
|
|
18
|
+
// @include mat.all-component-themes($theme);
|
|
19
|
+
// @include ajf-forms.theme($theme);
|
|
20
|
+
// }
|
|
21
|
+
//
|
|
22
|
+
// For a light and a dark theme, include it once per selector -- the renderer's
|
|
23
|
+
// own `.ajf-dark` / `.ajf-light` classes and its `prefers-color-scheme` block
|
|
24
|
+
// only carry the built-in palette, so once you hand it your own colours you also
|
|
25
|
+
// own the switch:
|
|
26
|
+
//
|
|
27
|
+
// .my-dark-theme {
|
|
28
|
+
// @include mat.all-component-colors($dark-theme);
|
|
29
|
+
// @include ajf-forms.theme($dark-theme);
|
|
30
|
+
// }
|
|
31
|
+
//
|
|
32
|
+
// This file emits custom properties only -- no selectors, no component styles --
|
|
33
|
+
// so including it more than once costs nothing but the declarations.
|
|
34
|
+
|
|
35
|
+
@use 'sass:list';
|
|
36
|
+
@use '@angular/material' as mat;
|
|
37
|
+
|
|
38
|
+
/// The M3 colour role behind each token.
|
|
39
|
+
$_m3-roles: (
|
|
40
|
+
bg: surface-container-low,
|
|
41
|
+
surface: surface,
|
|
42
|
+
band: surface-container,
|
|
43
|
+
border: outline-variant,
|
|
44
|
+
border-strong: outline,
|
|
45
|
+
accent: primary,
|
|
46
|
+
accent-fg: on-primary,
|
|
47
|
+
accent-soft: primary-container,
|
|
48
|
+
accent-ink: on-primary-container,
|
|
49
|
+
text: on-surface,
|
|
50
|
+
text-muted: on-surface-variant,
|
|
51
|
+
danger: error,
|
|
52
|
+
danger-bg: error-container,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
/// The M2 palette/hue pair behind each token. M2 has no container roles, so the
|
|
56
|
+
/// soft surfaces are taken from the theme's background palette and the tinted
|
|
57
|
+
/// ones are mixed from the accent at include time.
|
|
58
|
+
$_m2-colors: (
|
|
59
|
+
bg: (background, background),
|
|
60
|
+
surface: (background, card),
|
|
61
|
+
band: (background, app-bar),
|
|
62
|
+
border: (foreground, divider),
|
|
63
|
+
accent: (primary, default),
|
|
64
|
+
accent-fg: (primary, default-contrast),
|
|
65
|
+
text: (foreground, text),
|
|
66
|
+
text-muted: (foreground, secondary-text),
|
|
67
|
+
danger: (warn, default),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
/// M2's dividers are far too faint to draw a control box with, so the border a
|
|
71
|
+
/// control carries is mixed from the theme's own text colour instead.
|
|
72
|
+
$_m2-control-border-mix: 32%;
|
|
73
|
+
|
|
74
|
+
@mixin _m3($theme) {
|
|
75
|
+
@each $name, $role in $_m3-roles {
|
|
76
|
+
--ajf-#{$name}: #{mat.get-theme-color($theme, $role)};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
$primary: mat.get-theme-color($theme, primary);
|
|
80
|
+
$on-primary: mat.get-theme-color($theme, on-primary);
|
|
81
|
+
|
|
82
|
+
--ajf-text-faint: color-mix(
|
|
83
|
+
in srgb,
|
|
84
|
+
#{mat.get-theme-color($theme, on-surface-variant)} 70%,
|
|
85
|
+
transparent
|
|
86
|
+
);
|
|
87
|
+
--ajf-accent-hover: color-mix(in srgb, #{$primary} 85%, #{$on-primary});
|
|
88
|
+
// Sits on the filled accent, so it is tinted with the accent's own contrast.
|
|
89
|
+
--ajf-kbd-bg: color-mix(in srgb, #{$on-primary} 22%, transparent);
|
|
90
|
+
// What a filled button falls back to once disabled: the accent gone, a flat
|
|
91
|
+
// neutral in its place, and the ordinary text colour on top -- readable on
|
|
92
|
+
// either palette, where the accent's contrast colour is not.
|
|
93
|
+
--ajf-disabled-bg: color-mix(
|
|
94
|
+
in srgb,
|
|
95
|
+
#{mat.get-theme-color($theme, on-surface)} 12%,
|
|
96
|
+
#{mat.get-theme-color($theme, surface)}
|
|
97
|
+
);
|
|
98
|
+
--ajf-disabled-fg: color-mix(
|
|
99
|
+
in srgb,
|
|
100
|
+
#{mat.get-theme-color($theme, on-surface)} 65%,
|
|
101
|
+
#{mat.get-theme-color($theme, surface)}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@mixin _m2($theme) {
|
|
106
|
+
@each $name, $color in $_m2-colors {
|
|
107
|
+
--ajf-#{$name}: #{mat.get-theme-color($theme, list.nth($color, 1), list.nth($color, 2))};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
$primary: mat.get-theme-color($theme, primary, default);
|
|
111
|
+
$on-primary: mat.get-theme-color($theme, primary, default-contrast);
|
|
112
|
+
$warn: mat.get-theme-color($theme, warn, default);
|
|
113
|
+
$card: mat.get-theme-color($theme, background, card);
|
|
114
|
+
$text: mat.get-theme-color($theme, foreground, text);
|
|
115
|
+
$secondary: mat.get-theme-color($theme, foreground, secondary-text);
|
|
116
|
+
|
|
117
|
+
--ajf-border-strong: color-mix(in srgb, #{$text} #{$_m2-control-border-mix}, #{$card});
|
|
118
|
+
--ajf-accent-soft: color-mix(in srgb, #{$primary} 12%, #{$card});
|
|
119
|
+
--ajf-accent-ink: color-mix(in srgb, #{$primary} 80%, #{$secondary});
|
|
120
|
+
--ajf-accent-hover: color-mix(in srgb, #{$primary} 85%, #{$secondary});
|
|
121
|
+
--ajf-danger-bg: color-mix(in srgb, #{$warn} 10%, #{$card});
|
|
122
|
+
--ajf-text-faint: color-mix(in srgb, #{$secondary} 70%, transparent);
|
|
123
|
+
--ajf-kbd-bg: color-mix(in srgb, #{$on-primary} 22%, transparent);
|
|
124
|
+
// See the M3 branch: disabled, a filled button goes flat neutral and keeps
|
|
125
|
+
// the ordinary text colour.
|
|
126
|
+
--ajf-disabled-bg: color-mix(in srgb, #{$text} 12%, #{$card});
|
|
127
|
+
--ajf-disabled-fg: color-mix(in srgb, #{$text} 65%, #{$card});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// Map an Angular Material theme onto the AJF form tokens.
|
|
131
|
+
/// Accepts both an M2 theme (`define-light-theme`, `define-dark-theme`, the
|
|
132
|
+
/// prebuilt themes) and an M3 one (`define-theme`).
|
|
133
|
+
@mixin theme($theme) {
|
|
134
|
+
$version: mat.get-theme-version($theme);
|
|
135
|
+
@if $version == 0 {
|
|
136
|
+
@include _m2($theme);
|
|
137
|
+
} @else if $version == 1 {
|
|
138
|
+
@include _m3($theme);
|
|
139
|
+
} @else {
|
|
140
|
+
@error 'Unsupported Angular Material theme version: #{$version}.';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { AjfSlideInstance } from '@ajf/core/forms';
|
|
23
|
+
import { PipeTransform } from '@angular/core';
|
|
24
|
+
import * as i0 from "@angular/core";
|
|
25
|
+
/** Which slide the page slider is currently showing, and where it sits. */
|
|
26
|
+
export interface AjfCurrentSlide {
|
|
27
|
+
/** Null while a start or end message page is on screen. */
|
|
28
|
+
slide: AjfSlideInstance | null;
|
|
29
|
+
/** The repetition on screen, zero based; 0 for a non-repeating slide. */
|
|
30
|
+
repIndex: number;
|
|
31
|
+
/** How many repetitions the slide has; 0 when it does not repeat. */
|
|
32
|
+
reps: number;
|
|
33
|
+
/** The slide's ordinal among the visible ones, for the header badge. */
|
|
34
|
+
displayNumber: number;
|
|
35
|
+
/** How many visible slides the form has. */
|
|
36
|
+
total: number;
|
|
37
|
+
/**
|
|
38
|
+
* How many pages the slider holds: one per visible slide, one per repetition
|
|
39
|
+
* of a repeating slide, plus the start and end message pages. Nothing to
|
|
40
|
+
* navigate to when this is 1.
|
|
41
|
+
*/
|
|
42
|
+
pages: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the page slider's current page into a slide.
|
|
46
|
+
*
|
|
47
|
+
* The renderer lays out one page per slide, and one page per repetition of a
|
|
48
|
+
* repeating slide, optionally preceded by a start message page -- the same
|
|
49
|
+
* arithmetic the error navigation in `AjfFormRenderer` performs.
|
|
50
|
+
*
|
|
51
|
+
* Impure, because slide visibility and repetition counts are mutated in place.
|
|
52
|
+
* The result is memoized so that the pipe keeps handing back the same object
|
|
53
|
+
* while nothing has moved: returning a fresh one on every check would trip
|
|
54
|
+
* Angular's "expression has changed after it was checked" guard.
|
|
55
|
+
*/
|
|
56
|
+
export declare class AjfCurrentSlidePipe implements PipeTransform {
|
|
57
|
+
private _last;
|
|
58
|
+
transform(slides: AjfSlideInstance[] | null, currentPage: number, hasStartMessage: boolean, hasEndMessage?: boolean): AjfCurrentSlide;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AjfCurrentSlidePipe, never>;
|
|
60
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<AjfCurrentSlidePipe, "ajfCurrentSlide", false>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { AjfFieldInstance } from '@ajf/core/forms';
|
|
23
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
24
|
+
import { ChangeDetectorRef, OnDestroy } from '@angular/core';
|
|
25
|
+
import * as i0 from "@angular/core";
|
|
26
|
+
/**
|
|
27
|
+
* One field of a slide, laid out as a row: type badge, label, control, and a
|
|
28
|
+
* right-hand column carrying either the field description or its validation
|
|
29
|
+
* error.
|
|
30
|
+
*
|
|
31
|
+
* Both the plain and the repeating slide branches of the renderer render through
|
|
32
|
+
* this component, so the row layout is defined in exactly one place.
|
|
33
|
+
*/
|
|
34
|
+
export declare class AjfFieldRow implements OnDestroy {
|
|
35
|
+
private _cdr;
|
|
36
|
+
set instance(instance: AjfFieldInstance);
|
|
37
|
+
get instance(): AjfFieldInstance;
|
|
38
|
+
private _instance;
|
|
39
|
+
private _instanceSub;
|
|
40
|
+
constructor(_cdr: ChangeDetectorRef);
|
|
41
|
+
ngOnDestroy(): void;
|
|
42
|
+
set readonly(readonly: boolean);
|
|
43
|
+
get readonly(): boolean;
|
|
44
|
+
private _readonly;
|
|
45
|
+
/**
|
|
46
|
+
* Rows drop out on the host element rather than inside it, so that a hidden
|
|
47
|
+
* field leaves no empty cell behind when rows are laid out in columns.
|
|
48
|
+
*
|
|
49
|
+
* Three kinds of node carry no information of their own and are kept out of
|
|
50
|
+
* the layout: a container node, which is only a bracket around the fields it
|
|
51
|
+
* holds and has no fieldType to render; a formula field with no label, which
|
|
52
|
+
* only feeds other fields; and a note with no body -- the renderer synthesises
|
|
53
|
+
* one of those to carry a node group's label, and a group is meant to show
|
|
54
|
+
* nothing of itself.
|
|
55
|
+
*/
|
|
56
|
+
get hidden(): boolean;
|
|
57
|
+
/** Notes render their own block and never get a control border around it. */
|
|
58
|
+
get isNote(): boolean;
|
|
59
|
+
get required(): boolean;
|
|
60
|
+
static ngAcceptInputType_readonly: BooleanInput;
|
|
61
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AjfFieldRow, never>;
|
|
62
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AjfFieldRow, "ajf-field-row", never, { "instance": { "alias": "instance"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; }, {}, never, never, false, never>;
|
|
63
|
+
}
|
package/forms/form.d.ts
CHANGED
|
@@ -19,16 +19,53 @@
|
|
|
19
19
|
* If not, see http://www.gnu.org/licenses/.
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
import { AjfFormRenderer as CoreFormRenderer, AjfFormRendererService,
|
|
22
|
+
import { AjfFieldInstance, AjfFormRenderer as CoreFormRenderer, AjfFormRendererService, AjfSlideInstance } from '@ajf/core/forms';
|
|
23
23
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
24
|
-
import { ChangeDetectorRef } from '@angular/core';
|
|
24
|
+
import { AfterViewChecked, ChangeDetectorRef, OnDestroy } from '@angular/core';
|
|
25
25
|
import * as i0 from "@angular/core";
|
|
26
|
-
export declare class AjfFormRenderer extends CoreFormRenderer {
|
|
26
|
+
export declare class AjfFormRenderer extends CoreFormRenderer implements AfterViewChecked, OnDestroy {
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated The slide strip has been replaced by the jump menu in the slide
|
|
29
|
+
* header, which is always available. Kept so that existing templates still
|
|
30
|
+
* compile.
|
|
31
|
+
*/
|
|
27
32
|
topBar: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Field rows align their labels and controls on a shared grid, so
|
|
35
|
+
* there is nothing left to centre.
|
|
36
|
+
*/
|
|
28
37
|
centeredFieldsContent: boolean;
|
|
38
|
+
/** How many field rows sit side by side. */
|
|
29
39
|
maxColumns: 1 | 2 | 3;
|
|
40
|
+
/**
|
|
41
|
+
* The page the slider is showing. The slide header is rendered once, above the
|
|
42
|
+
* slider, so it needs to know which slide is on screen; the page slider only
|
|
43
|
+
* reports that imperatively, hence the mirrored property.
|
|
44
|
+
*/
|
|
45
|
+
currentPage: number;
|
|
46
|
+
private _slideList;
|
|
47
|
+
private _validitySubscription;
|
|
48
|
+
private _slidesSubscription;
|
|
49
|
+
private _valueSubscription;
|
|
50
|
+
private _pageSubscription;
|
|
51
|
+
private _pageInit;
|
|
30
52
|
constructor(rendererService: AjfFormRendererService, changeDetectorRef: ChangeDetectorRef);
|
|
53
|
+
ngAfterViewChecked(): void;
|
|
54
|
+
ngOnDestroy(): void;
|
|
31
55
|
fieldStyle(field: AjfFieldInstance): any;
|
|
56
|
+
/** Page to the first page of a slide, from the header's jump menu. */
|
|
57
|
+
goToSlide(slide: AjfSlideInstance): void;
|
|
58
|
+
/** Page to one repetition of the repeating slide currently on screen. */
|
|
59
|
+
goToRep(slide: AjfSlideInstance, repIndex: number): void;
|
|
60
|
+
goToPrevSlide(): void;
|
|
61
|
+
goToNextSlide(): void;
|
|
62
|
+
/**
|
|
63
|
+
* The slider page a slide starts on. `AjfSlideInstance.position` cannot be
|
|
64
|
+
* used directly here: it does not account for a start message page, and this
|
|
65
|
+
* has to agree with the page arithmetic used by `ajfCurrentSlide`.
|
|
66
|
+
*/
|
|
67
|
+
private _pageOf;
|
|
68
|
+
private _slideTo;
|
|
32
69
|
static ngAcceptInputType_fixedOrientation: BooleanInput;
|
|
33
70
|
static ngAcceptInputType_hasEndMessage: BooleanInput;
|
|
34
71
|
static ngAcceptInputType_hasStartMessage: BooleanInput;
|
package/forms/forms-module.d.ts
CHANGED
|
@@ -1,59 +1,65 @@
|
|
|
1
1
|
import { ModuleWithProviders } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
import * as i1 from "./audio-field";
|
|
4
|
-
import * as i2 from "./
|
|
5
|
-
import * as i3 from "./
|
|
6
|
-
import * as i4 from "./
|
|
7
|
-
import * as i5 from "./date-
|
|
8
|
-
import * as i6 from "./
|
|
9
|
-
import * as i7 from "./field
|
|
10
|
-
import * as i8 from "./field";
|
|
11
|
-
import * as i9 from "./
|
|
12
|
-
import * as i10 from "./
|
|
13
|
-
import * as i11 from "./
|
|
14
|
-
import * as i12 from "./
|
|
15
|
-
import * as i13 from "./
|
|
16
|
-
import * as i14 from "./
|
|
17
|
-
import * as i15 from "./
|
|
18
|
-
import * as i16 from "./
|
|
19
|
-
import * as i17 from "./
|
|
20
|
-
import * as i18 from "./
|
|
21
|
-
import * as i19 from "./
|
|
22
|
-
import * as i20 from "./
|
|
23
|
-
import * as i21 from "
|
|
24
|
-
import * as i22 from "
|
|
25
|
-
import * as i23 from "
|
|
26
|
-
import * as i24 from "
|
|
27
|
-
import * as i25 from "
|
|
28
|
-
import * as i26 from "@ajf/material/
|
|
29
|
-
import * as i27 from "@ajf/material/
|
|
30
|
-
import * as i28 from "@ajf/material/
|
|
31
|
-
import * as i29 from "@ajf/
|
|
32
|
-
import * as i30 from "@ajf/
|
|
33
|
-
import * as i31 from "@
|
|
34
|
-
import * as i32 from "@ajf/
|
|
35
|
-
import * as i33 from "@
|
|
36
|
-
import * as i34 from "@
|
|
37
|
-
import * as i35 from "@
|
|
38
|
-
import * as i36 from "@angular/
|
|
39
|
-
import * as i37 from "@
|
|
40
|
-
import * as i38 from "@angular/material/
|
|
41
|
-
import * as i39 from "@angular/material/
|
|
42
|
-
import * as i40 from "@angular/material/
|
|
43
|
-
import * as i41 from "@angular/material/
|
|
44
|
-
import * as i42 from "@angular/material/
|
|
45
|
-
import * as i43 from "@angular/material/
|
|
46
|
-
import * as i44 from "@angular/material/
|
|
47
|
-
import * as i45 from "@angular/material/
|
|
48
|
-
import * as i46 from "@angular/material/
|
|
49
|
-
import * as i47 from "@angular/
|
|
50
|
-
import * as i48 from "@angular/
|
|
51
|
-
import * as i49 from "@angular/material/
|
|
52
|
-
import * as i50 from "
|
|
53
|
-
import * as i51 from "
|
|
4
|
+
import * as i2 from "./current-slide";
|
|
5
|
+
import * as i3 from "./barcode-field";
|
|
6
|
+
import * as i4 from "./boolean-field";
|
|
7
|
+
import * as i5 from "./date-field";
|
|
8
|
+
import * as i6 from "./date-input-field";
|
|
9
|
+
import * as i7 from "./empty-field";
|
|
10
|
+
import * as i8 from "./field-row";
|
|
11
|
+
import * as i9 from "./field-warning-dialog";
|
|
12
|
+
import * as i10 from "./field";
|
|
13
|
+
import * as i11 from "./slide-stats";
|
|
14
|
+
import * as i12 from "./form";
|
|
15
|
+
import * as i13 from "./geolocation-field";
|
|
16
|
+
import * as i14 from "./input-field";
|
|
17
|
+
import * as i15 from "./multiple-choice-field";
|
|
18
|
+
import * as i16 from "./range-field";
|
|
19
|
+
import * as i17 from "./rep-strip";
|
|
20
|
+
import * as i18 from "./signature-field";
|
|
21
|
+
import * as i19 from "./single-choice-field";
|
|
22
|
+
import * as i20 from "./slide-header";
|
|
23
|
+
import * as i21 from "./table-field";
|
|
24
|
+
import * as i22 from "./text-field";
|
|
25
|
+
import * as i23 from "./time-field";
|
|
26
|
+
import * as i24 from "./video-url-field";
|
|
27
|
+
import * as i25 from "./display-field";
|
|
28
|
+
import * as i26 from "@ajf/material/audio";
|
|
29
|
+
import * as i27 from "@ajf/material/barcode";
|
|
30
|
+
import * as i28 from "@ajf/material/calendar";
|
|
31
|
+
import * as i29 from "@ajf/core/common";
|
|
32
|
+
import * as i30 from "@ajf/material/checkbox-group";
|
|
33
|
+
import * as i31 from "@ajf/material/geolocation";
|
|
34
|
+
import * as i32 from "@ajf/material/page-slider";
|
|
35
|
+
import * as i33 from "@ajf/material/signature";
|
|
36
|
+
import * as i34 from "@ajf/material/time";
|
|
37
|
+
import * as i35 from "@ajf/core/transloco";
|
|
38
|
+
import * as i36 from "@angular/common";
|
|
39
|
+
import * as i37 from "@ajf/core/forms";
|
|
40
|
+
import * as i38 from "@angular/material/button";
|
|
41
|
+
import * as i39 from "@angular/material/button-toggle";
|
|
42
|
+
import * as i40 from "@angular/material/card";
|
|
43
|
+
import * as i41 from "@angular/material/datepicker";
|
|
44
|
+
import * as i42 from "@angular/material/dialog";
|
|
45
|
+
import * as i43 from "@angular/material/form-field";
|
|
46
|
+
import * as i44 from "@angular/material/icon";
|
|
47
|
+
import * as i45 from "@angular/material/input";
|
|
48
|
+
import * as i46 from "@angular/material/menu";
|
|
49
|
+
import * as i47 from "@angular/material/core";
|
|
50
|
+
import * as i48 from "@angular/material/radio";
|
|
51
|
+
import * as i49 from "@angular/material/select";
|
|
52
|
+
import * as i50 from "@angular/material/slide-toggle";
|
|
53
|
+
import * as i51 from "@angular/material/toolbar";
|
|
54
|
+
import * as i52 from "@angular/material/tooltip";
|
|
55
|
+
import * as i53 from "@angular/forms";
|
|
56
|
+
import * as i54 from "@angular/cdk/text-field";
|
|
57
|
+
import * as i55 from "@angular/material/slider";
|
|
58
|
+
import * as i56 from "ngx-mat-select-search";
|
|
59
|
+
import * as i57 from "ngx-quill";
|
|
54
60
|
export declare class AjfFormsModule {
|
|
55
61
|
static forRoot(): ModuleWithProviders<AjfFormsModule>;
|
|
56
62
|
static ɵfac: i0.ɵɵFactoryDeclaration<AjfFormsModule, never>;
|
|
57
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<AjfFormsModule, [typeof i1.AjfAudioFieldComponent, typeof i2.
|
|
63
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AjfFormsModule, [typeof i1.AjfAudioFieldComponent, typeof i2.AjfCurrentSlidePipe, typeof i3.AjfBarcodeFieldComponent, typeof i4.AjfBooleanFieldComponent, typeof i5.AjfDateFieldComponent, typeof i6.AjfDateInputFieldComponent, typeof i7.AjfEmptyFieldComponent, typeof i8.AjfFieldRow, typeof i9.AjfFieldWarningDialog, typeof i10.AjfFormField, typeof i11.AjfFormIssuesPipe, typeof i12.AjfFormRenderer, typeof i13.AjfGeolocationFieldComponent, typeof i14.AjfInputFieldComponent, typeof i15.AjfMultipleChoiceFieldComponent, typeof i16.AjfRangeFieldComponent, typeof i17.AjfRepStrip, typeof i18.AjfSignatureFieldComponent, typeof i19.AjfSingleChoiceFieldComponent, typeof i11.AjfSlideCompletionPipe, typeof i20.AjfSlideHeader, typeof i11.AjfSlideIssuesPipe, typeof i21.AjfTableFieldComponent, typeof i22.AjfTextFieldComponent, typeof i23.AjfTimeFieldComponent, typeof i24.AjfVideoUrlFieldComponent, typeof i25.AjfDisplayFieldComponent], [typeof i26.AjfAudioModule, typeof i27.AjfBarcodeModule, typeof i28.AjfCalendarModule, typeof i29.AjfCommonModule, typeof i30.AjfCheckboxGroupModule, typeof i31.AjfGeolocationModule, typeof i32.AjfPageSliderModule, typeof i33.AjfSignatureModule, typeof i34.AjfTimeModule, typeof i35.AjfTranslocoModule, typeof i36.CommonModule, typeof i37.AjfFormsModule, typeof i38.MatButtonModule, typeof i39.MatButtonToggleModule, typeof i40.MatCardModule, typeof i41.MatDatepickerModule, typeof i42.MatDialogModule, typeof i43.MatFormFieldModule, typeof i44.MatIconModule, typeof i45.MatInputModule, typeof i46.MatMenuModule, typeof i47.MatNativeDateModule, typeof i48.MatRadioModule, typeof i49.MatSelectModule, typeof i50.MatSlideToggleModule, typeof i51.MatToolbarModule, typeof i52.MatTooltipModule, typeof i53.ReactiveFormsModule, typeof i54.TextFieldModule, typeof i55.MatSliderModule, typeof i56.NgxMatSelectSearchModule, typeof i57.QuillModule], [typeof i8.AjfFieldRow, typeof i10.AjfFormField, typeof i12.AjfFormRenderer, typeof i17.AjfRepStrip, typeof i20.AjfSlideHeader]>;
|
|
58
64
|
static ɵinj: i0.ɵɵInjectorDeclaration<AjfFormsModule>;
|
|
59
65
|
}
|
|
@@ -21,17 +21,31 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { AjfChoice, AjfFieldWithChoicesComponent, AjfFormRendererService } from '@ajf/core/forms';
|
|
23
23
|
import { ChangeDetectorRef, OnDestroy } from '@angular/core';
|
|
24
|
-
import { FormControl } from '@angular/forms';
|
|
24
|
+
import { FormControl, UntypedFormControl } from '@angular/forms';
|
|
25
25
|
import { Observable } from 'rxjs';
|
|
26
26
|
import { AjfWarningAlertService } from './warning-alert-service';
|
|
27
27
|
import * as i0 from "@angular/core";
|
|
28
28
|
export declare class AjfMultipleChoiceFieldComponent<T> extends AjfFieldWithChoicesComponent<T> implements OnDestroy {
|
|
29
29
|
readonly expandThreshold: number;
|
|
30
30
|
readonly searchFilterCtrl: FormControl<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the choices collapse into a searchable dropdown. Below the search
|
|
33
|
+
* threshold they are laid out as buttons instead, which reads faster for a
|
|
34
|
+
* short list. `forceExpanded` wins over `forceNarrow`, so a schema can pin
|
|
35
|
+
* either presentation regardless of how many choices there are.
|
|
36
|
+
*/
|
|
37
|
+
get isNarrow(): boolean;
|
|
31
38
|
filteredChoices$: Observable<AjfChoice<any>[]>;
|
|
32
39
|
private readonly _choicesUpdate$;
|
|
33
40
|
private _instanceUpdateForChoicesSub;
|
|
34
41
|
constructor(cdr: ChangeDetectorRef, service: AjfFormRendererService, was: AjfWarningAlertService, searchThreshold: number);
|
|
42
|
+
/** The label shown on a selection chip. */
|
|
43
|
+
labelFor(value: any): string;
|
|
44
|
+
/**
|
|
45
|
+
* Drop one value from the selection, from the chip's own button. The click has
|
|
46
|
+
* to be stopped from reaching the trigger, which would reopen the panel.
|
|
47
|
+
*/
|
|
48
|
+
removeValue(ctrl: UntypedFormControl, value: any, event: Event): void;
|
|
35
49
|
protected _onInstanceChange(): void;
|
|
36
50
|
ngOnDestroy(): void;
|
|
37
51
|
static ɵfac: i0.ɵɵFactoryDeclaration<AjfMultipleChoiceFieldComponent<any>, [null, null, null, { optional: true; }]>;
|
package/forms/public_api.d.ts
CHANGED
|
@@ -20,17 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
22
|
export * from './boolean-field';
|
|
23
|
+
export * from './current-slide';
|
|
23
24
|
export * from './date-field';
|
|
24
25
|
export * from './date-input-field';
|
|
25
26
|
export * from './empty-field';
|
|
26
27
|
export * from './field';
|
|
28
|
+
export * from './field-row';
|
|
27
29
|
export * from './field-service';
|
|
28
30
|
export * from './field-warning-dialog';
|
|
29
31
|
export * from './input-field';
|
|
30
32
|
export * from './form';
|
|
31
33
|
export * from './forms-module';
|
|
32
34
|
export * from './multiple-choice-field';
|
|
35
|
+
export * from './rep-strip';
|
|
33
36
|
export * from './single-choice-field';
|
|
37
|
+
export * from './slide-header';
|
|
38
|
+
export * from './slide-stats';
|
|
34
39
|
export * from './table-field';
|
|
35
40
|
export * from './time-field';
|
|
36
41
|
export * from './warning-alert-service';
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { AjfRepeatingSlideInstance } from '@ajf/core/forms';
|
|
23
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
24
|
+
import { EventEmitter } from '@angular/core';
|
|
25
|
+
import * as i0 from "@angular/core";
|
|
26
|
+
/**
|
|
27
|
+
* The pager for a repeating slide: one button per repetition plus add and remove
|
|
28
|
+
* actions. The renderer keeps one page per repetition, so picking a number here
|
|
29
|
+
* is a page change, which the renderer performs.
|
|
30
|
+
*/
|
|
31
|
+
export declare class AjfRepStrip {
|
|
32
|
+
slide: AjfRepeatingSlideInstance;
|
|
33
|
+
/** The repetition currently on screen, zero based. */
|
|
34
|
+
current: number;
|
|
35
|
+
set readonly(readonly: boolean);
|
|
36
|
+
get readonly(): boolean;
|
|
37
|
+
private _readonly;
|
|
38
|
+
readonly goTo: EventEmitter<number>;
|
|
39
|
+
readonly add: EventEmitter<void>;
|
|
40
|
+
readonly remove: EventEmitter<void>;
|
|
41
|
+
/**
|
|
42
|
+
* A repetition count driven by a formula is not the reader's to change:
|
|
43
|
+
* `AjfFormRendererService.addGroup` and `removeGroup` both refuse the call
|
|
44
|
+
* outright, so without this the buttons would sit enabled and do nothing.
|
|
45
|
+
*/
|
|
46
|
+
private get manualReps();
|
|
47
|
+
get canAdd(): boolean;
|
|
48
|
+
get canRemove(): boolean;
|
|
49
|
+
static ngAcceptInputType_readonly: BooleanInput;
|
|
50
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AjfRepStrip, never>;
|
|
51
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AjfRepStrip, "ajf-rep-strip", never, { "slide": { "alias": "slide"; "required": false; }; "current": { "alias": "current"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; }, { "goTo": "goTo"; "add": "add"; "remove": "remove"; }, never, never, false, never>;
|
|
52
|
+
}
|
|
@@ -28,6 +28,13 @@ import * as i0 from "@angular/core";
|
|
|
28
28
|
export declare class AjfSingleChoiceFieldComponent<T> extends AjfFieldWithChoicesComponent<T> implements OnDestroy {
|
|
29
29
|
readonly expandThreshold: number;
|
|
30
30
|
readonly searchFilterCtrl: FormControl<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the choices collapse into a searchable dropdown. Below the search
|
|
33
|
+
* threshold they are laid out as buttons instead, which reads faster for a
|
|
34
|
+
* short list. `forceExpanded` wins over `forceNarrow`, so a schema can pin
|
|
35
|
+
* either presentation regardless of how many choices there are.
|
|
36
|
+
*/
|
|
37
|
+
get isNarrow(): boolean;
|
|
31
38
|
filteredChoices$: Observable<AjfChoice<any>[]>;
|
|
32
39
|
private readonly _choicesUpdate$;
|
|
33
40
|
private _instanceUpdateForChoicesSub;
|