@mtna/web-form-angular 0.0.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.
Files changed (170) hide show
  1. package/_index.scss +25 -0
  2. package/bundles/mtna-web-form-angular.umd.js +4982 -0
  3. package/bundles/mtna-web-form-angular.umd.js.map +1 -0
  4. package/esm2015/lib/core/animations.js +8 -0
  5. package/esm2015/lib/core/api-config.js +3 -0
  6. package/esm2015/lib/core/index.js +7 -0
  7. package/esm2015/lib/core/pipes/coerce-date-item.pipe.js +23 -0
  8. package/esm2015/lib/core/pipes/coerce-form-group.pipe.js +35 -0
  9. package/esm2015/lib/core/pipes/date-quarter.pipe.js +43 -0
  10. package/esm2015/lib/core/pipes/get-auto-complete.pipe.js +42 -0
  11. package/esm2015/lib/core/pipes/get-available-quarters.pipe.js +29 -0
  12. package/esm2015/lib/core/pipes/get-form-control-error.pipe.js +20 -0
  13. package/esm2015/lib/core/pipes/get-list-icon.pipe.js +53 -0
  14. package/esm2015/lib/core/pipes/get-object-type.pipe.js +17 -0
  15. package/esm2015/lib/core/pipes/get-selected-option.pipe.js +20 -0
  16. package/esm2015/lib/core/pipes/index.js +71 -0
  17. package/esm2015/lib/core/pipes/items-with-value.pipe.js +30 -0
  18. package/esm2015/lib/core/pipes/sanitize-html.pipe.js +23 -0
  19. package/esm2015/lib/core/services/api.service.js +67 -0
  20. package/esm2015/lib/core/services/form-manager.service.js +465 -0
  21. package/esm2015/lib/core/services/index.js +5 -0
  22. package/esm2015/lib/core/services/ng-form.service.js +150 -0
  23. package/esm2015/lib/core/services/ui.service.js +333 -0
  24. package/esm2015/lib/core/utilities/find-form-control.js +29 -0
  25. package/esm2015/lib/core/utilities/find-form-item.js +25 -0
  26. package/esm2015/lib/core/utilities/flatten-steps.js +10 -0
  27. package/esm2015/lib/core/utilities/generate-form-steps.js +25 -0
  28. package/esm2015/lib/core/utilities/index.js +9 -0
  29. package/esm2015/lib/core/utilities/is-form-group.js +6 -0
  30. package/esm2015/lib/core/utilities/serializer-util.js +358 -0
  31. package/esm2015/lib/core/utilities/update-step-status.js +38 -0
  32. package/esm2015/lib/core/validators/index.js +3 -0
  33. package/esm2015/lib/core/validators/instant-validation-result-error-state-matcher.js +23 -0
  34. package/esm2015/lib/core/validators/validation-result-validator.js +19 -0
  35. package/esm2015/lib/file-upload/file-upload.component.js +66 -0
  36. package/esm2015/lib/file-upload/index.js +2 -0
  37. package/esm2015/lib/form/base-form-item.model.js +2 -0
  38. package/esm2015/lib/form/form-disabler.component.js +38 -0
  39. package/esm2015/lib/form/form-item.directive.js +22 -0
  40. package/esm2015/lib/form/form.component.js +250 -0
  41. package/esm2015/lib/form/form.module.js +214 -0
  42. package/esm2015/lib/form/index.js +5 -0
  43. package/esm2015/lib/form/white-list.model.js +11 -0
  44. package/esm2015/lib/form-item-controls/base-form-item-control.directive.js +58 -0
  45. package/esm2015/lib/form-item-controls/base-parent-item-control.directive.js +42 -0
  46. package/esm2015/lib/form-item-controls/base-single-selection-parent.directive.js +53 -0
  47. package/esm2015/lib/form-item-controls/date-range.component.js +84 -0
  48. package/esm2015/lib/form-item-controls/date.component.js +134 -0
  49. package/esm2015/lib/form-item-controls/dropdown.component.js +109 -0
  50. package/esm2015/lib/form-item-controls/index.js +8 -0
  51. package/esm2015/lib/form-item-controls/input.component.js +149 -0
  52. package/esm2015/lib/form-item-controls/year-quarter-range.component.js +75 -0
  53. package/esm2015/lib/form-item-controls/year-quarter.component.js +228 -0
  54. package/esm2015/lib/form-stepper/form-step-group.component.js +95 -0
  55. package/esm2015/lib/form-stepper/form-step-group.pipe.js +20 -0
  56. package/esm2015/lib/form-stepper/form-step.component.js +110 -0
  57. package/esm2015/lib/form-stepper/form-step.util.js +28 -0
  58. package/esm2015/lib/form-stepper/form-stepper.component.js +115 -0
  59. package/esm2015/lib/form-stepper/form-stepper.module.js +53 -0
  60. package/esm2015/lib/form-stepper/index.js +8 -0
  61. package/esm2015/lib/form-stepper/models/base-form-step.model.js +6 -0
  62. package/esm2015/lib/form-stepper/models/form-step-group.model.js +13 -0
  63. package/esm2015/lib/form-stepper/models/form-step.model.js +12 -0
  64. package/esm2015/lib/form-stepper/models/index.js +4 -0
  65. package/esm2015/lib/groups/form-item-dialog-data.model.js +14 -0
  66. package/esm2015/lib/groups/group-components.js +646 -0
  67. package/esm2015/lib/groups/index.js +3 -0
  68. package/esm2015/lib/groups/repeatable-item.component.js +23 -0
  69. package/esm2015/lib/item-header/index.js +2 -0
  70. package/esm2015/lib/item-header/item-header.component.js +108 -0
  71. package/esm2015/lib/static-form-items/index.js +3 -0
  72. package/esm2015/lib/static-form-items/ordered-list-item.js +50 -0
  73. package/esm2015/lib/static-form-items/unordered-list-item.js +52 -0
  74. package/esm2015/lib/step-card/index.js +2 -0
  75. package/esm2015/lib/step-card/step-card.component.js +53 -0
  76. package/esm2015/mtna-web-form-angular.js +5 -0
  77. package/esm2015/public-api.js +10 -0
  78. package/fesm2015/mtna-web-form-angular.js +4614 -0
  79. package/fesm2015/mtna-web-form-angular.js.map +1 -0
  80. package/lib/_index.scss +25 -0
  81. package/lib/core/_all-color.scss +25 -0
  82. package/lib/core/_all-theme.scss +28 -0
  83. package/lib/core/_all-typography.scss +25 -0
  84. package/lib/core/_core-theme.scss +43 -0
  85. package/lib/core/animations.d.ts +2 -0
  86. package/lib/core/api-config.d.ts +5 -0
  87. package/lib/core/index.d.ts +6 -0
  88. package/lib/core/pipes/coerce-date-item.pipe.d.ts +11 -0
  89. package/lib/core/pipes/coerce-form-group.pipe.d.ts +23 -0
  90. package/lib/core/pipes/date-quarter.pipe.d.ts +7 -0
  91. package/lib/core/pipes/get-auto-complete.pipe.d.ts +7 -0
  92. package/lib/core/pipes/get-available-quarters.pipe.d.ts +8 -0
  93. package/lib/core/pipes/get-form-control-error.pipe.d.ts +14 -0
  94. package/lib/core/pipes/get-list-icon.pipe.d.ts +7 -0
  95. package/lib/core/pipes/get-object-type.pipe.d.ts +7 -0
  96. package/lib/core/pipes/get-selected-option.pipe.d.ts +8 -0
  97. package/lib/core/pipes/index.d.ts +28 -0
  98. package/lib/core/pipes/items-with-value.pipe.d.ts +13 -0
  99. package/lib/core/pipes/sanitize-html.pipe.d.ts +10 -0
  100. package/lib/core/services/api.service.d.ts +41 -0
  101. package/lib/core/services/form-manager.service.d.ts +184 -0
  102. package/lib/core/services/index.d.ts +4 -0
  103. package/lib/core/services/ng-form.service.d.ts +76 -0
  104. package/lib/core/services/ui.service.d.ts +123 -0
  105. package/lib/core/utilities/find-form-control.d.ts +11 -0
  106. package/lib/core/utilities/find-form-item.d.ts +10 -0
  107. package/lib/core/utilities/flatten-steps.d.ts +7 -0
  108. package/lib/core/utilities/generate-form-steps.d.ts +3 -0
  109. package/lib/core/utilities/index.d.ts +8 -0
  110. package/lib/core/utilities/is-form-group.d.ts +3 -0
  111. package/lib/core/utilities/serializer-util.d.ts +81 -0
  112. package/lib/core/utilities/update-step-status.d.ts +14 -0
  113. package/lib/core/validators/index.d.ts +2 -0
  114. package/lib/core/validators/instant-validation-result-error-state-matcher.d.ts +13 -0
  115. package/lib/core/validators/validation-result-validator.d.ts +12 -0
  116. package/lib/file-upload/file-upload.component.d.ts +23 -0
  117. package/lib/file-upload/index.d.ts +1 -0
  118. package/lib/form/base-form-item.model.d.ts +15 -0
  119. package/lib/form/form-disabler.component.d.ts +6 -0
  120. package/lib/form/form-item.directive.d.ts +13 -0
  121. package/lib/form/form.component.d.ts +89 -0
  122. package/lib/form/form.module.d.ts +52 -0
  123. package/lib/form/index.d.ts +4 -0
  124. package/lib/form/white-list.model.d.ts +6 -0
  125. package/lib/form-item-controls/_date-item-theme.scss +29 -0
  126. package/lib/form-item-controls/_form-control-theme.scss +28 -0
  127. package/lib/form-item-controls/_year-quarter-item-theme.scss +28 -0
  128. package/lib/form-item-controls/base-form-item-control.directive.d.ts +26 -0
  129. package/lib/form-item-controls/base-parent-item-control.directive.d.ts +19 -0
  130. package/lib/form-item-controls/base-single-selection-parent.directive.d.ts +26 -0
  131. package/lib/form-item-controls/date-range.component.d.ts +12 -0
  132. package/lib/form-item-controls/date.component.d.ts +24 -0
  133. package/lib/form-item-controls/dropdown.component.d.ts +9 -0
  134. package/lib/form-item-controls/index.d.ts +7 -0
  135. package/lib/form-item-controls/input.component.d.ts +14 -0
  136. package/lib/form-item-controls/year-quarter-range.component.d.ts +9 -0
  137. package/lib/form-item-controls/year-quarter.component.d.ts +33 -0
  138. package/lib/form-stepper/_form-step-group-theme.scss +43 -0
  139. package/lib/form-stepper/_form-stepper-theme.scss +72 -0
  140. package/lib/form-stepper/form-step-group.component.d.ts +23 -0
  141. package/lib/form-stepper/form-step-group.pipe.d.ts +11 -0
  142. package/lib/form-stepper/form-step.component.d.ts +27 -0
  143. package/lib/form-stepper/form-step.util.d.ts +27 -0
  144. package/lib/form-stepper/form-stepper.component.d.ts +35 -0
  145. package/lib/form-stepper/form-stepper.module.d.ts +18 -0
  146. package/lib/form-stepper/index.d.ts +7 -0
  147. package/lib/form-stepper/models/base-form-step.model.d.ts +4 -0
  148. package/lib/form-stepper/models/form-step-group.model.d.ts +8 -0
  149. package/lib/form-stepper/models/form-step.model.d.ts +11 -0
  150. package/lib/form-stepper/models/index.d.ts +3 -0
  151. package/lib/groups/_checkbox-theme.scss +62 -0
  152. package/lib/groups/_form-group-theme.scss +32 -0
  153. package/lib/groups/_multiple-choice-theme.scss +65 -0
  154. package/lib/groups/_repeatable-item-theme.scss +28 -0
  155. package/lib/groups/form-item-dialog-data.model.d.ts +13 -0
  156. package/lib/groups/group-components.d.ts +221 -0
  157. package/lib/groups/index.d.ts +2 -0
  158. package/lib/groups/repeatable-item.component.d.ts +5 -0
  159. package/lib/item-header/_item-header-theme.scss +28 -0
  160. package/lib/item-header/index.d.ts +1 -0
  161. package/lib/item-header/item-header.component.d.ts +35 -0
  162. package/lib/static-form-items/index.d.ts +2 -0
  163. package/lib/static-form-items/ordered-list-item.d.ts +11 -0
  164. package/lib/static-form-items/unordered-list-item.d.ts +11 -0
  165. package/lib/step-card/_step-card-theme.scss +42 -0
  166. package/lib/step-card/index.d.ts +1 -0
  167. package/lib/step-card/step-card.component.d.ts +21 -0
  168. package/mtna-web-form-angular.d.ts +5 -0
  169. package/package.json +43 -0
  170. package/public-api.d.ts +9 -0
@@ -0,0 +1,123 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { ValidationErrors } from '@angular/forms';
3
+ import { MatDialog } from '@angular/material/dialog';
4
+ import { AnnotatableNumberMap } from '@mtna/pojo-social-angular';
5
+ import { FormItemImpl } from '@mtna/web-form-ts';
6
+ import type { MtnaWfFormItemComponent } from '../../groups/group-components';
7
+ import * as i0 from "@angular/core";
8
+ /** Registry of custom error messages for a specific form item. A custom error can also
9
+ * be a function returning a string. The FormItem object is passed to any ValidationErrors
10
+ * that are functions, so item specific information can be provided.
11
+ * @example {
12
+ * max: `This field's value must be less.`,
13
+ * min: (item: FormItemImpl<any>) => instanceofWholeNumberItem(item)
14
+ * ? `This field's value must be greater than ${item.minValue}.`
15
+ * : `This field's value must be greater.`
16
+ * }
17
+ */
18
+ export declare type CustomErrors = {
19
+ [id: string]: ValidationErrors;
20
+ };
21
+ /** List of default error messages to display */
22
+ export declare const DEFAULT_ERROR_MESSAGES: ValidationErrors;
23
+ export declare const WEB_FORM_CUSTOM_ERRORS: InjectionToken<CustomErrors>;
24
+ export declare class MtnaWfUIService {
25
+ private dialog;
26
+ /** Map of annotation counts for each annotatable item */
27
+ private annotations;
28
+ /** Map of components in the MtnaForm */
29
+ private components;
30
+ /** Map of item.disabled values that have changed */
31
+ private disabledState;
32
+ /** Map of toggler ID's for components that have multiple togglers */
33
+ private multipleEnablers;
34
+ private errors;
35
+ constructor(dialog: MatDialog, errors?: any);
36
+ getDisabledStates(): {
37
+ [x: string]: boolean;
38
+ };
39
+ /**
40
+ * Returns an error message matching the error id
41
+ * @param errorId Id of the error, to find the associated error message
42
+ * @param item FormItem to pass to ValidationErrors that are functions. For instance,
43
+ * this is useful for 'min' & 'max' value limits to display more helpful messages
44
+ */
45
+ getError(errorId: string, item?: FormItemImpl<unknown>): string;
46
+ /**
47
+ * Get a registered component by intance id.
48
+ * @param id the instanceId
49
+ * @returns the {@link FormItemComponent} that represents that ID or undefined if not registered.
50
+ */
51
+ getItem(id: string): MtnaWfFormItemComponent | undefined;
52
+ /**
53
+ * Sets the initial map of annotation counts, and/or pushes the new count onto the component observable stream
54
+ * @param map AnnotatableNumberMap of counts mapped to their annotatableIds
55
+ */
56
+ registerAnnotations(map: AnnotatableNumberMap): void;
57
+ /**
58
+ * Maps a component to its items instanceId.
59
+ * @param component component calling this method, i.e. 'this'
60
+ */
61
+ registerSelf(component: MtnaWfFormItemComponent): void;
62
+ /**
63
+ * Toggles a FormItem's visiblity and enable/disable state
64
+ *
65
+ * @param enabledItemIds array of component IDs for enabled items.
66
+ * @param disabledItemIds array of component IDs for disabled items.
67
+ * @param enabled Whether the enabledItemIds are enabled.
68
+ * @param callerId instanceId of the item invoking this function
69
+ * @param reset Whether to reset the multiple enabler map of the toggled item
70
+ */
71
+ toggleFormItems(enabledItemIds: Array<string>, disabledItemIds: Array<string>, enabled: boolean, callerId: string, reset?: boolean): void;
72
+ /**
73
+ * Generates map of all IDs currently influencing an item.
74
+ * @param toggledItem item being toggled
75
+ */
76
+ private _registerCurrentEnablers;
77
+ /**
78
+ * Resets the map of components. This should be called by the form when
79
+ * it is destroyed.
80
+ */
81
+ resetComponentMap(): void;
82
+ /**
83
+ * Determines if an influencer is currently toggling the specified toggledItemId.
84
+ * @param influencer Item to check whether it's currently influencing the toggledItemId
85
+ * @param toggledId InstanceId of the item being toggled
86
+ * @returns Whether the influencer is currently toggling the toggled item
87
+ */
88
+ private _isCurrentlyToggling;
89
+ /**
90
+ * Handles component visibility for a FormItem with multiple enablers in its condition
91
+ * @param component FormItemComponent being toggled
92
+ * @param enabled Whether the component is being enabled
93
+ * @param callerId ID of the caller toggling this component
94
+ */
95
+ private _handleMultipleEnablers;
96
+ /**
97
+ * Enables or disables the control on a FormItemComponent
98
+ * @param component FormItemComponent to enable or disable its control
99
+ * @param enabled whether to enable the control
100
+ */
101
+ private _toggleControlState;
102
+ /**
103
+ * Toggles both the component visiblity and the control's enable/disable status
104
+ * @param component FormItemComponent to show or hide and enable or disable
105
+ * @param enabled whether to show the component and whether to enable the component
106
+ */
107
+ private _toggleDisabledStateAndControl;
108
+ /**
109
+ * Enables controls individually using recursion.
110
+ * FormGroups should only exist for items with 'items' arrays, or
111
+ * if the component is a BaseParentItemControl
112
+ * @param comp FormItemComponent
113
+ */
114
+ private _enableIndividualControls;
115
+ /**
116
+ * Determines if a component is disabled. Prioritizes the disabledState value,
117
+ * if it exists, otherwise returns the item's previous disabled value
118
+ * @param item item to check for its disabled state
119
+ */
120
+ private _isDisabled;
121
+ static ɵfac: i0.ɵɵFactoryDeclaration<MtnaWfUIService, [null, { optional: true; }]>;
122
+ static ɵprov: i0.ɵɵInjectableDeclaration<MtnaWfUIService>;
123
+ }
@@ -0,0 +1,11 @@
1
+ import { AbstractControl, FormGroup } from '@angular/forms';
2
+ /**
3
+ * Recursively find a form control by name in a form group.
4
+ * Depth first search down the tree of form groups to find a control.
5
+ *
6
+ * @note This will only work if the entire form has unique form control names.
7
+ * @param name The unique name of the form cotrol to find.
8
+ * @param group The {@link FormGroup} to search through.
9
+ * @returns the found control or null
10
+ */
11
+ export declare function findFormControl(name: string, group: FormGroup): AbstractControl | null;
@@ -0,0 +1,10 @@
1
+ import { Form, FormItem, FormItemGroup } from '@mtna/web-form-ts';
2
+ /**
3
+ * Recursively find a {@link FormItem} by instanceId in a {@link Form}.
4
+ * Depth first search down the tree of {@link FormItemGroup} to find an item.
5
+ *
6
+ * @param instanceId The unique ID of the {@link FormItem} to find.
7
+ * @param group The {@link Form} or {@link FormItemGroup} to search through.
8
+ * @returns the found {@link FormItem} or `null`
9
+ */
10
+ export declare function findFormItem(instanceId: string, group: Form | FormItemGroup): FormItem | null;
@@ -0,0 +1,7 @@
1
+ import { FormStep, FormStepGroup } from '../../form-stepper/models';
2
+ /**
3
+ * Flattens formStepGroup.steps and combines all steps into single array
4
+ * @param steps Array<FormStep | FormStepGroup>
5
+ * @returns FormStep[] array of the steps and children of step groups
6
+ */
7
+ export declare function flattenSteps(steps: Array<FormStep | FormStepGroup>): Array<FormStep>;
@@ -0,0 +1,3 @@
1
+ import { FormItem } from '@mtna/web-form-ts';
2
+ import { FormStep, FormStepGroup } from '../../form-stepper/models';
3
+ export declare function generateFormSteps(items: Array<FormItem>): Array<FormStep | FormStepGroup>;
@@ -0,0 +1,8 @@
1
+ import * as MtnaWfSerializer from './serializer-util';
2
+ export { MtnaWfSerializer };
3
+ export * from './find-form-control';
4
+ export * from './find-form-item';
5
+ export * from './flatten-steps';
6
+ export * from './generate-form-steps';
7
+ export * from './is-form-group';
8
+ export * from './update-step-status';
@@ -0,0 +1,3 @@
1
+ import { FormGroup } from '@angular/forms';
2
+ /** Typeguard for {@link FormGroup}. Determines if something is a FormGroup. */
3
+ export declare function isFormGroup(something: unknown): something is FormGroup;
@@ -0,0 +1,81 @@
1
+ import { AbstractControl, FormGroup } from '@angular/forms';
2
+ import { DateRange, Form as WebForm, FormItem, FormItemGroup, FormItemImpl, Option, OptionGroupItemImpl, RepeatableItem, TableItem, ValueItem, YearQuarter } from '@mtna/web-form-ts';
3
+ import { MtnaWfManagerService } from '../services/form-manager.service';
4
+ /** Types of Validators that can be set on a FormControl */
5
+ export declare type ValidatorType = 'required' | 'requiredTrue' | 'email';
6
+ export declare type ValidatorWithNumberType = 'minLength' | 'maxLength' | 'min' | 'max';
7
+ /**
8
+ * Generates a new FormGroup with FormControls & possible nested FormGroups
9
+ * @param formItem WebForm, Section, Group, or RepeatableItem used to create a FormGroup
10
+ * @param customFormItemConditional boolean function for any custom FormItems
11
+ * @param customControlGenerator FormControl generator function for any custom FormItems
12
+ */
13
+ export declare function serializeFormItems(formItem: WebForm | FormItemGroup | RepeatableItem, managerService: MtnaWfManagerService, customFormItemConditional?: (item: FormItem) => boolean, customControlGenerator?: (item: FormItem) => AbstractControl | null): FormGroup;
14
+ /**
15
+ * Returns a tailored FormControl with validators for a FormItem
16
+ * @param formItem The FormItem requesting a tailored FormControl
17
+ * @internal Creating the form control and then calling setValidators force a validation pass,
18
+ * see https://github.com/angular/angular/issues/19622#issuecomment-341547884
19
+ * Better to gather the validators and put them in the constructor of the form control.
20
+ */
21
+ export declare function serializeFormItem(formItem: FormItemImpl<unknown>, managerService: MtnaWfManagerService): AbstractControl;
22
+ /**
23
+ * Builds controls for any form items nested inside a parent items options
24
+ * @param formItem The FormItem with an 'options' property
25
+ * @param customFormItemConditional conditional function from parent 'serializeFormItems' function
26
+ * @param customControlGenerator FormControl generator from parent 'serializeFormItems' function
27
+ */
28
+ export declare function serializeNestedOptionFormItems(formItem: OptionGroupItemImpl<Option<unknown>>, managerService: MtnaWfManagerService, customFormItemConditional?: (item: FormItem) => boolean, customControlGenerator?: (item: FormItem) => AbstractControl | null): FormGroup;
29
+ /**
30
+ * Build FormControls for a TableItem
31
+ * @param item TableItem requiring FormControls
32
+ * @param customFormItemConditional Conditional function for custom any FormItems
33
+ * @param customControlGenerator FormControl generator for custom any FormItems
34
+ */
35
+ export declare function serializeTableItem(item: TableItem, managerService: MtnaWfManagerService, customFormItemConditional?: (item: FormItem) => boolean, customControlGenerator?: (item: FormItem) => AbstractControl | null): FormGroup;
36
+ /**
37
+ * Returns the appropriate function for the caller to use.
38
+ *
39
+ * @param formItem FormItem requiring serialization
40
+ * @param customFormItemConditional Conditional for a custom FormItem
41
+ * @param customControlGenerator Serializer for a custom FormItem
42
+ */
43
+ export declare function determineSerializeFunctionToUse(formItem: FormItemImpl<unknown> | WebForm, managerService: MtnaWfManagerService, customFormItemConditional?: (item: FormItem) => boolean, customControlGenerator?: (item: FormItem) => AbstractControl | null): AbstractControl | null;
44
+ /**
45
+ * Builds a FormGroup for a range item
46
+ * @param formItem FormItem for a DateRange of Date | YearQuarter
47
+ */
48
+ export declare function serializeRangeItem(formItem: FormItemImpl<DateRange<Date | YearQuarter>>): FormGroup;
49
+ /**
50
+ * Returns an array of Formitems with new values inserted.
51
+ *
52
+ * @param section The old Form or Form Section
53
+ * @param ngFormValue ngForm JSON values
54
+ * @param customFormItemConditional boolean function for any custom FormItems
55
+ * @param customFormItemBuilder function to handle custom FormItems
56
+ * @returns new FormItem array
57
+ */
58
+ export declare function insertFormItemValues(section: WebForm | FormItemGroup | RepeatableItem, ngFormValue: Record<string, unknown>, disabledState: {
59
+ [instanceId: string]: boolean;
60
+ }, customFormItemConditional?: (item: FormItem) => boolean, customFormItemBuilder?: (section: WebForm | FormItemGroup | RepeatableItem | undefined, item: FormItem, rfValue: unknown, disabledState: {
61
+ [instanceId: string]: boolean;
62
+ }) => ValueItem<unknown> | null): Array<FormItem>;
63
+ /**
64
+ * Returns a copied TableItem, with each row FormItem having new inserted values.
65
+ * @param item TableItem to insert values
66
+ * @param ngFormValue ngForm value of the TableItem
67
+ * @param customFormItemConditional boolean function for any custom FormItem
68
+ * @param customFormItemBuilder function to handle custom FormItem value insertion
69
+ */
70
+ export declare function insertTableItemValues(item: TableItem, ngFormValue: Record<string, unknown>, disabledState: {
71
+ [instanceId: string]: boolean;
72
+ }, customFormItemConditional?: (item: FormItem) => boolean, customFormItemBuilder?: (section: WebForm | FormItemGroup | RepeatableItem | undefined, item: FormItem, rfValue: unknown, disabledState: {
73
+ [instanceId: string]: boolean;
74
+ }) => ValueItem<unknown> | null): TableItem;
75
+ /**
76
+ * Determines if a FormItem has an OptionItemMap with at least 1 item, which require their own FormControl(s)
77
+ * @param formItem FormItem to check
78
+ */
79
+ export declare function hasNestedFormItems(formItem: unknown): formItem is {
80
+ optionItemMap: Record<string, unknown>;
81
+ };
@@ -0,0 +1,14 @@
1
+ import { CircleStatus } from '@mtna/core-angular';
2
+ import { Form } from '@mtna/web-form-ts';
3
+ import { FormStep } from '../../form-stepper/models/form-step.model';
4
+ /**
5
+ * Update a {@link FormStep}'s `status`.
6
+ * The server side form validation errors will trump the provided `status`.
7
+ *
8
+ * @param instanceId the instanceId of the step to update, otherwise return the original step
9
+ * @param step the step to check
10
+ * @param status the new status to apply to the step
11
+ * @param form the containing form
12
+ * @returns an updated step with the correct status
13
+ */
14
+ export declare function updateStepStatus(instanceId: string, step: FormStep, status: CircleStatus, form?: Form): FormStep;
@@ -0,0 +1,2 @@
1
+ export * from './instant-validation-result-error-state-matcher';
2
+ export * from './validation-result-validator';
@@ -0,0 +1,13 @@
1
+ import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
2
+ import { ErrorStateMatcher } from '@angular/material/core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Custom {@link ErrorStateMatcher} that will immediately show {@link FormValidationResult} errors.
6
+ * Theses errors are calcualted on the server and need to always show.
7
+ * Regular form validation will use the default error matcher strategy.
8
+ */
9
+ export declare class MtnaWfInstantValidationResultErrorStateMatcher extends ErrorStateMatcher {
10
+ isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<MtnaWfInstantValidationResultErrorStateMatcher, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<MtnaWfInstantValidationResultErrorStateMatcher>;
13
+ }
@@ -0,0 +1,12 @@
1
+ import { ValidatorFn } from '@angular/forms';
2
+ import { MtnaWfManagerService } from '../services/form-manager.service';
3
+ export declare const MTNA_WF_FORM_ITEM_VALIDATION_RESULT_ERROR_NAME = "formItemValidationResult";
4
+ /**
5
+ * Valitator function that will check the root level {@link FormValidationResult} on
6
+ * the MTNA {@link Form} and see if there are any errors for a particular control.
7
+ *
8
+ * @param instanceId The instanceId of the form item for a particular control
9
+ * @param managerService The manager service that holds a reference to the MTNA {@link Form} and it's {@link FormValidationResult}
10
+ * @returns A validator function that will throw an error if there is a matching {@link FormItemValidationResult} for the specified item.
11
+ */
12
+ export declare function validationResultValidator(instanceId: string, managerService: MtnaWfManagerService): ValidatorFn;
@@ -0,0 +1,23 @@
1
+ import { EventEmitter, OnInit, TemplateRef } from '@angular/core';
2
+ import { FileInformation } from '@mtna/file-manager-ts';
3
+ import { FileService } from '@mtna/file-manager-angular';
4
+ import { AnnotationIndicatorStatus, IndicatorStatusRepeater } from '@mtna/pojo-social-angular';
5
+ import { FileUploadItem } from '@mtna/web-form-ts';
6
+ import * as i0 from "@angular/core";
7
+ export declare class MtnaWfFileUploadComponent implements IndicatorStatusRepeater, OnInit {
8
+ private fileService;
9
+ header: TemplateRef<unknown> | null;
10
+ indicatorStatus: AnnotationIndicatorStatus;
11
+ item: FileUploadItem | undefined | null;
12
+ readonly: boolean;
13
+ file: EventEmitter<FileInformation | undefined>;
14
+ fileInfo?: FileInformation;
15
+ loading: boolean;
16
+ constructor(fileService: FileService);
17
+ fileToUpload(file: FileList): void;
18
+ handleDownload(template: FileInformation): void;
19
+ ngOnInit(): void;
20
+ removeFile(): void;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<MtnaWfFileUploadComponent, never>;
22
+ static ɵcmp: i0.ɵɵComponentDeclaration<MtnaWfFileUploadComponent, "mtna-wf-file-upload-item", never, { "header": "header"; "indicatorStatus": "indicatorStatus"; "item": "item"; "readonly": "readonly"; }, { "file": "file"; }, never, never>;
23
+ }
@@ -0,0 +1 @@
1
+ export * from './file-upload.component';
@@ -0,0 +1,15 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { FormItem } from '@mtna/web-form-ts';
3
+ /**
4
+ * The Basic setup for a FormItem. Any dynamic components to be rendered should
5
+ * implement this interface to ensure they contain the necessary inputs.
6
+ *
7
+ * @prop control - AbstractControl | null | undefined;
8
+ * @prop item - FormItem
9
+ * @prop readonly - boolean
10
+ */
11
+ export interface BaseFormItem {
12
+ control: AbstractControl | null | undefined;
13
+ item: FormItem;
14
+ readonly: boolean;
15
+ }
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class MtnaWfFormDisablerComponent {
3
+ formDisabled: boolean;
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<MtnaWfFormDisablerComponent, never>;
5
+ static ɵcmp: i0.ɵɵComponentDeclaration<MtnaWfFormDisablerComponent, "[formDisabled]", never, { "formDisabled": "formDisabled"; }, {}, never, ["*"]>;
6
+ }
@@ -0,0 +1,13 @@
1
+ import { ViewContainerRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Used to retrieve the host container for a dynamically rendered component.
5
+ *
6
+ * @export
7
+ */
8
+ export declare class MtnaWfFormItemDirective {
9
+ viewContainerRef: ViewContainerRef;
10
+ constructor(viewContainerRef: ViewContainerRef);
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<MtnaWfFormItemDirective, never>;
12
+ static ɵdir: i0.ɵɵDirectiveDeclaration<MtnaWfFormItemDirective, "[formItemHost]", never, {}, {}, never>;
13
+ }
@@ -0,0 +1,89 @@
1
+ import { BooleanInput } from '@angular/cdk/coercion';
2
+ import { AfterViewInit, EventEmitter, OnDestroy } from '@angular/core';
3
+ import { FormGroup } from '@angular/forms';
4
+ import { CanDestroyNotify } from '@mtna/core-angular';
5
+ import { AnnotatableNumberMap } from '@mtna/pojo-social-angular';
6
+ import { Form, FormControlStatus, FormItem } from '@mtna/web-form-ts';
7
+ import { MtnaWfManagerService, MtnaWfNgFormService, MtnaWfUIService } from '../core/services';
8
+ import { FormStep } from '../form-stepper/models/form-step.model';
9
+ import * as i0 from "@angular/core";
10
+ declare const MtnaWfFormComponent_base: import("@mtna/core-angular").CanDestroyNotifyCtor & {
11
+ new (): {};
12
+ };
13
+ export declare class MtnaWfFormComponent extends MtnaWfFormComponent_base implements AfterViewInit, CanDestroyNotify, OnDestroy {
14
+ private mtnaFormManager;
15
+ private ngFormService;
16
+ private uiService;
17
+ static ngAcceptInputType_emitStatusOnMtnaFormChange: BooleanInput;
18
+ static ngAcceptInputTypes_readonly: BooleanInput;
19
+ set annotations(map: AnnotatableNumberMap);
20
+ /** Whether to emit the status of each step each time the {@link mtnaForm} is set to a new value. Defaults to false.*/
21
+ get emitStatusOnMtnaFormChange(): boolean;
22
+ set emitStatusOnMtnaFormChange(emitStatusOnMtnaFormChange: boolean);
23
+ private _emitStatusOnMtnaFormChange;
24
+ get mtnaForm(): Form | null | undefined;
25
+ set mtnaForm(form: Form | null | undefined);
26
+ private _mtnaForm;
27
+ /**
28
+ * The form can contain sections not included in the steps.
29
+ * To avoid misalignment of steps-to-sections, we map each step to
30
+ * its instanceId
31
+ */
32
+ set steps(newSteps: Array<FormStep> | null | undefined);
33
+ get readonly(): boolean;
34
+ set readonly(r: boolean);
35
+ private readonly$;
36
+ /**
37
+ * Emitted every time a form control's validation status changes.
38
+ * The `id` is the form control's name and the `status` is the new validation status for the control.
39
+ */
40
+ status: EventEmitter<{
41
+ id: string;
42
+ status: FormControlStatus;
43
+ }>;
44
+ focusedSection: EventEmitter<FormStep>;
45
+ mtnaFormChange: EventEmitter<Form>;
46
+ ngForm: FormGroup | undefined;
47
+ componentIds: never[];
48
+ _steps: {
49
+ [id: string]: FormStep;
50
+ } | undefined;
51
+ private _constructionDate;
52
+ private _hasPreviousForm;
53
+ private _ngFormStatusChangeSub?;
54
+ private _mtnaFormItemChangeSub?;
55
+ private _initialStatusEmitted;
56
+ constructor(mtnaFormManager: MtnaWfManagerService, ngFormService: MtnaWfNgFormService, uiService: MtnaWfUIService);
57
+ ngAfterViewInit(): void;
58
+ ngOnDestroy(): void;
59
+ _trackByInstanceId(index: number, formItem: FormItem): string;
60
+ /** Subscribe and emit form status changes for the steps. */
61
+ private _checkAndSubscribeToFormStatus;
62
+ /**
63
+ * Find a form control with the given name, then emit it's status.
64
+ *
65
+ * @param name — The unique name of the form cotrol to find and emit the status for.
66
+ */
67
+ private _emitFormControlStatus;
68
+ /**
69
+ * @param emitInitialValues Whether to emit initial step values or just listen for future changes
70
+ */
71
+ private _emitInitialStepsStatusAndSubscribeToChanges;
72
+ /**
73
+ * Observes input changes for readOnly, in order to handle internal change subscriptions.
74
+ * When the form is not readonly, we subscribe to form status & form item changes, so we can emit them.
75
+ * When the form is readonly, we do not want to emit any changes, so we unsubscribe.
76
+ */
77
+ private _subscribeAndEmitMtnaFormChanges;
78
+ private _handleFormSerialization;
79
+ /**
80
+ * Adds or removes a FormItem whenever a new MtnaWfFormItemChange occurs,
81
+ * and emits a new MtnaForm.
82
+ */
83
+ private _subscribeToMtnaFormItemChanges;
84
+ private _unsubscribeFromNgFormChanges;
85
+ private _unsubscribeFromMtnaFormChanges;
86
+ static ɵfac: i0.ɵɵFactoryDeclaration<MtnaWfFormComponent, never>;
87
+ static ɵcmp: i0.ɵɵComponentDeclaration<MtnaWfFormComponent, "mtna-form", never, { "annotations": "annotations"; "emitStatusOnMtnaFormChange": "emitStatusOnMtnaFormChange"; "mtnaForm": "mtnaForm"; "steps": "steps"; "readonly": "readonly"; }, { "status": "status"; "focusedSection": "focusedSection"; "mtnaFormChange": "mtnaFormChange"; }, never, never>;
88
+ }
89
+ export {};
@@ -0,0 +1,52 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "../item-header/item-header.component";
3
+ import * as i2 from "../groups/group-components";
4
+ import * as i3 from "../form-item-controls/date.component";
5
+ import * as i4 from "../form-item-controls/date-range.component";
6
+ import * as i5 from "../form-item-controls/dropdown.component";
7
+ import * as i6 from "../file-upload/file-upload.component";
8
+ import * as i7 from "./form.component";
9
+ import * as i8 from "./form-disabler.component";
10
+ import * as i9 from "./form-item.directive";
11
+ import * as i10 from "../form-item-controls/input.component";
12
+ import * as i11 from "../static-form-items/ordered-list-item";
13
+ import * as i12 from "../step-card/step-card.component";
14
+ import * as i13 from "../static-form-items/unordered-list-item";
15
+ import * as i14 from "../form-item-controls/year-quarter.component";
16
+ import * as i15 from "../form-item-controls/year-quarter-range.component";
17
+ import * as i16 from "../groups/repeatable-item.component";
18
+ import * as i17 from "@angular/cdk/a11y";
19
+ import * as i18 from "@angular/common";
20
+ import * as i19 from "@angular/flex-layout";
21
+ import * as i20 from "@angular/forms";
22
+ import * as i21 from "@angular/material/autocomplete";
23
+ import * as i22 from "@angular/material/button";
24
+ import * as i23 from "@angular/material/card";
25
+ import * as i24 from "@angular/material/checkbox";
26
+ import * as i25 from "@angular/material/chips";
27
+ import * as i26 from "@angular/material/datepicker";
28
+ import * as i27 from "@angular/material/dialog";
29
+ import * as i28 from "@angular/material/divider";
30
+ import * as i29 from "@angular/material/form-field";
31
+ import * as i30 from "@angular/material/icon";
32
+ import * as i31 from "@angular/material/input";
33
+ import * as i32 from "@angular/material/list";
34
+ import * as i33 from "@angular/material-moment-adapter";
35
+ import * as i34 from "@angular/material/core";
36
+ import * as i35 from "@angular/material/progress-spinner";
37
+ import * as i36 from "@angular/material/radio";
38
+ import * as i37 from "@angular/material/select";
39
+ import * as i38 from "@angular/material/slide-toggle";
40
+ import * as i39 from "@angular/material/table";
41
+ import * as i40 from "@angular/material/tooltip";
42
+ import * as i41 from "@mtna/pojo-social-angular";
43
+ import * as i42 from "@mtna/file-manager-angular";
44
+ import * as i43 from "@mtna/core-angular";
45
+ import * as i44 from "../form-stepper/form-stepper.module";
46
+ import * as i45 from "../core/pipes/index";
47
+ import * as i46 from "../form-stepper/form-stepper.component";
48
+ export declare class MtnaFormModule {
49
+ static ɵfac: i0.ɵɵFactoryDeclaration<MtnaFormModule, never>;
50
+ static ɵmod: i0.ɵɵNgModuleDeclaration<MtnaFormModule, [typeof i1.ItemHeaderComponent, typeof i2.MtnaWfAcknowledgeDialogComponent, typeof i2.MtnaWfBooleanComponent, typeof i2.MtnaWfCheckboxComponent, typeof i3.MtnaWfDateComponent, typeof i4.MtnaWfDateRangeComponent, typeof i5.MtnaWfDropdownComponent, typeof i6.MtnaWfFileUploadComponent, typeof i7.MtnaWfFormComponent, typeof i8.MtnaWfFormDisablerComponent, typeof i2.MtnaWfFormGroupComponent, typeof i2.MtnaWfFormItemComponent, typeof i2.MtnaWfFormItemDialogComponent, typeof i9.MtnaWfFormItemDirective, typeof i2.MtnaWfFormSectionComponent, typeof i10.MtnaWfInputComponent, typeof i2.MtnaWfMultipleChoiceComponent, typeof i11.MtnaWfOrderedListItemComponent, typeof i12.MtnaWfStepCardComponent, typeof i2.MtnaWfTableFormItemComponent, typeof i13.MtnaWfUnorderedListItemComponent, typeof i14.MtnaWfYearQuarterComponent, typeof i15.MtnaWfYearQuarterRangeComponent, typeof i16.RepeatableItemComponent, typeof i2.RepeatableItemContainerComponent, typeof i2.ValueItemComponent], [typeof i17.A11yModule, typeof i18.CommonModule, typeof i19.FlexLayoutModule, typeof i20.FormsModule, typeof i21.MatAutocompleteModule, typeof i22.MatButtonModule, typeof i23.MatCardModule, typeof i24.MatCheckboxModule, typeof i25.MatChipsModule, typeof i26.MatDatepickerModule, typeof i27.MatDialogModule, typeof i28.MatDividerModule, typeof i29.MatFormFieldModule, typeof i30.MatIconModule, typeof i31.MatInputModule, typeof i32.MatListModule, typeof i33.MatMomentDateModule, typeof i34.MatOptionModule, typeof i35.MatProgressSpinnerModule, typeof i36.MatRadioModule, typeof i34.MatRippleModule, typeof i37.MatSelectModule, typeof i38.MatSlideToggleModule, typeof i39.MatTableModule, typeof i40.MatTooltipModule, typeof i41.MtnaAnnotationsIndicatorModule, typeof i42.MtnaFileDownloadModule, typeof i42.MtnaFileUploadModule, typeof i43.MtnaHighlightModule, typeof i43.MtnaStatusCircleModule, typeof i43.MtnaStatusCircleModule, typeof i43.MtnaTrackByPropertyPipeModule, typeof i44.MtnaWfFormStepperModule, typeof i45.PipesModule, typeof i20.ReactiveFormsModule], [typeof i12.MtnaWfStepCardComponent, typeof i46.MtnaWfFormStepperComponent, typeof i7.MtnaWfFormComponent, typeof i45.PipesModule]>;
51
+ static ɵinj: i0.ɵɵInjectorDeclaration<MtnaFormModule>;
52
+ }
@@ -0,0 +1,4 @@
1
+ export * from './base-form-item.model';
2
+ export * from './form.component';
3
+ export * from './form.module';
4
+ export * from './white-list.model';
@@ -0,0 +1,6 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ export interface MtnaWfItemWhiteList {
3
+ itemTypes: Array<string>;
4
+ }
5
+ export declare const MTNA_WF_ITEM_WHITELIST: InjectionToken<MtnaWfItemWhiteList>;
6
+ export declare function MTNA_WF_ITEM_WHITELIST_FACTORY(): MtnaWfItemWhiteList;
@@ -0,0 +1,29 @@
1
+ @use 'sass:map';
2
+ @use '~@angular/material' as mat;
3
+
4
+ @mixin color($theme) {
5
+ $config: mat.get-color-config($theme);
6
+ $foreground: map.get($config, foreground);
7
+
8
+ mtna-wf-date-item.read-only {
9
+ .mat-input-element:disabled,
10
+ .mat-form-field-type-mat-native-select.mat-form-field-disabled .mat-form-field-infix::after {
11
+ color: mat.get-color-from-palette($foreground, text);
12
+ }
13
+ }
14
+ }
15
+
16
+ @mixin typography($theme) {
17
+ }
18
+
19
+ @mixin theme($theme) {
20
+ $config: mat.get-color-config($theme);
21
+ @if $config != null {
22
+ @include color($theme);
23
+ }
24
+
25
+ $typography-config: mat.get-typography-config($theme);
26
+ @if $typography-config != null {
27
+ @include typography($theme);
28
+ }
29
+ }
@@ -0,0 +1,28 @@
1
+ @use 'sass:map';
2
+ @use '~@angular/material' as mat;
3
+
4
+ @mixin color($theme) {
5
+ $config: mat.get-color-config($theme);
6
+ $foreground: map.get($config, foreground);
7
+
8
+ .mtna-wf-control-item {
9
+ .mat-list-icon {
10
+ color: mat.get-color-from-palette($foreground, secondary-text);
11
+ }
12
+ }
13
+ }
14
+
15
+ @mixin typography($theme) {
16
+ }
17
+
18
+ @mixin theme($theme) {
19
+ $config: mat.get-color-config($theme);
20
+ @if $config != null {
21
+ @include color($theme);
22
+ }
23
+
24
+ $typography-config: mat.get-typography-config($theme);
25
+ @if $typography-config != null {
26
+ @include typography($theme);
27
+ }
28
+ }
@@ -0,0 +1,28 @@
1
+ @use 'sass:map';
2
+ @use '~@angular/material' as mat;
3
+
4
+ @mixin color($theme) {
5
+ $config: mat.get-color-config($theme);
6
+ $foreground: map.get($config, foreground);
7
+
8
+ mtna-wf-year-quarter-item.read-only {
9
+ .mat-select-disabled .mat-select-value {
10
+ color: mat.get-color-from-palette($foreground, text);
11
+ }
12
+ }
13
+ }
14
+
15
+ @mixin typography($theme) {
16
+ }
17
+
18
+ @mixin theme($theme) {
19
+ $config: mat.get-color-config($theme);
20
+ @if $config != null {
21
+ @include color($theme);
22
+ }
23
+
24
+ $typography-config: mat.get-typography-config($theme);
25
+ @if $typography-config != null {
26
+ @include typography($theme);
27
+ }
28
+ }
@@ -0,0 +1,26 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import { AbstractControl } from '@angular/forms';
3
+ import { AnnotationIndicatorStatus, IndicatorStatusRepeater } from '@mtna/pojo-social-angular';
4
+ import { FormOptionSelector, Option, ValueItem } from '@mtna/web-form-ts';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Base control class for a ValueItem.
8
+ * If a FormItem can have value, its component class should extend this class.
9
+ */
10
+ export declare abstract class BaseFormItemControl<I extends ValueItem<unknown>, C extends AbstractControl = AbstractControl> implements IndicatorStatusRepeater {
11
+ formControlClass: boolean;
12
+ get control(): C | null | undefined;
13
+ set control(control: C | null | undefined);
14
+ protected _control: C | null | undefined;
15
+ header: TemplateRef<unknown> | null;
16
+ inList: boolean;
17
+ indicatorStatus: AnnotationIndicatorStatus;
18
+ get item(): I;
19
+ set item(item: I);
20
+ protected _item: I;
21
+ readonly: boolean;
22
+ get hasItemHeader(): boolean;
23
+ _trackByOptionId(index: number, option: FormOptionSelector<Option<unknown>>): string;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormItemControl<any, any>, never>;
25
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormItemControl<any, any>, never, never, { "control": "control"; "header": "header"; "inList": "inList"; "indicatorStatus": "indicatorStatus"; "item": "item"; "readonly": "readonly"; }, {}, never>;
26
+ }