ngx-t-forms-types 0.0.20 → 0.0.22

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 (37) hide show
  1. package/dist/interfaces/Form/ArrayFunctions.d.ts +43 -1
  2. package/dist/interfaces/Form/ArrayFunctions.js +28 -0
  3. package/dist/interfaces/Form/FormInClassUtils.d.ts +6 -4
  4. package/dist/interfaces/Form/formInterface.d.ts +6 -1
  5. package/dist/interfaces/Form/index.d.ts +3 -2
  6. package/dist/interfaces/Form/index.js +4 -0
  7. package/dist/interfaces/FormBuilder/DefaultEelement.js +1 -1
  8. package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.d.ts +30 -19
  9. package/dist/interfaces/FormBuilder/FormBuilderCallBackFunctions.d.ts +9 -1
  10. package/dist/interfaces/FormBuilder/elementEditor.d.ts +2 -1
  11. package/dist/interfaces/FormBuilder/elementEditor.js +1 -0
  12. package/dist/interfaces/FormBuilder/index.d.ts +2 -1
  13. package/dist/interfaces/FormBuilder/index.js +1 -1
  14. package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.js +7 -3
  15. package/dist/interfaces/Import/ImportProgress.d.ts +4 -2
  16. package/dist/interfaces/Import/ImportRowState.d.ts +23 -5
  17. package/dist/interfaces/formInput/FileUploadInputInterface.d.ts +6 -1
  18. package/dist/interfaces/formInput/FormControlCustomValidatorsInterface.d.ts +38 -4
  19. package/dist/interfaces/formInput/FormValidationOverride.d.ts +48 -0
  20. package/dist/interfaces/formInput/FormValidationOverride.js +1 -0
  21. package/dist/interfaces/formInput/IMscoaAccount.d.ts +31 -6
  22. package/dist/interfaces/formInput/MscoaInput.d.ts +7 -0
  23. package/dist/interfaces/formInput/RichTextEditorInput.d.ts +16 -2
  24. package/dist/interfaces/formInput/RichTextEditorInput.js +11 -1
  25. package/dist/interfaces/formInput/WorkflowAdjudication.d.ts +15 -3
  26. package/dist/interfaces/formInput/calculationVariableInterface.d.ts +3 -1
  27. package/dist/interfaces/formInput/calculationVariableInterface.js +2 -0
  28. package/dist/interfaces/formInput/index.d.ts +4 -3
  29. package/dist/interfaces/formInput/index.js +5 -0
  30. package/dist/interfaces/formInput/schema.d.ts +11 -2
  31. package/dist/interfaces/upgradeFunctions/interfaces/init-form.d.ts +13 -0
  32. package/dist/schemas/MatOptionsSchema.js +14 -0
  33. package/dist/schemas/customValidationSchema.js +5 -1
  34. package/dist/schemas/tests/CustomValidationSchema.spec.d.ts +1 -0
  35. package/dist/schemas/tests/CustomValidationSchema.spec.js +92 -0
  36. package/dist/schemas/tests/FormInputValidator.spec.js +0 -5
  37. package/package.json +83 -74
@@ -1,11 +1,53 @@
1
+ /**
2
+ * Declarative array-transform operations applied by the `ngx-t-forms`
3
+ * array-access engine (`arrayAccessFunctions`). Each member is the string a
4
+ * config author places in {@link IArrayFunction.function}; the matching
5
+ * `expression` is interpreted differently per operation (see the
6
+ * "Array Transform Rules" doc shipped with the library).
7
+ *
8
+ * The first three members (`Filter`, `Find`, `Map`) are the original surface
9
+ * and are unchanged. The remaining members are **additive** - existing configs
10
+ * keep working untouched.
11
+ *
12
+ * @public
13
+ */
1
14
  export declare enum FunctionTypes {
15
+ /** Keep only the items whose predicate expression evaluates truthy. Returns an array. */
2
16
  Filter = "filter",
17
+ /** Return the first item whose predicate expression evaluates truthy (or `undefined`). Terminal. */
3
18
  Find = "find",
4
- Map = "map"
19
+ /** Reshape each item using a projection expression. Returns an array of new objects. */
20
+ Map = "map",
21
+ /** Order items by one or more `path asc|desc` keys. Returns an array. */
22
+ Sort = "sort",
23
+ /** Take a window of items (`start:end`, a single limit, or `start,count`). Returns an array. */
24
+ Slice = "slice",
25
+ /** Drop duplicate items, keyed by whole-item identity or one/more paths. Returns an array. */
26
+ Unique = "unique",
27
+ /** Flatten nested arrays one level, or flat-map by a child array path. Returns an array. */
28
+ Flatten = "flatten",
29
+ /** Group items into buckets keyed by one or more paths. Returns a record of arrays. Terminal. */
30
+ GroupBy = "groupBy",
31
+ /** Aggregate items into a scalar or summary object (sum/avg/min/max/count/first/last/join). Terminal. */
32
+ Reduce = "reduce"
5
33
  }
34
+ /**
35
+ * A single declarative array-transform step.
36
+ *
37
+ * Configs supply an **ordered** `IArrayFunction[]`; the engine folds them
38
+ * left-to-right (see {@link FunctionTypes} for per-operation `expression`
39
+ * grammar). Only `function` and `expression` affect runtime behaviour;
40
+ * `id` and `inEdit` are UI bookkeeping.
41
+ *
42
+ * @public
43
+ */
6
44
  export interface IArrayFunction {
45
+ /** Which transform to apply. */
7
46
  function: FunctionTypes;
47
+ /** Operation-specific expression (predicate, projection, sort keys, etc.). */
8
48
  expression: string;
49
+ /** Stable identity for editing UIs. */
9
50
  id: string;
51
+ /** UI-only flag marking the step as currently being edited. */
10
52
  inEdit?: boolean;
11
53
  }
@@ -1,7 +1,35 @@
1
+ /**
2
+ * Declarative array-transform operations applied by the `ngx-t-forms`
3
+ * array-access engine (`arrayAccessFunctions`). Each member is the string a
4
+ * config author places in {@link IArrayFunction.function}; the matching
5
+ * `expression` is interpreted differently per operation (see the
6
+ * "Array Transform Rules" doc shipped with the library).
7
+ *
8
+ * The first three members (`Filter`, `Find`, `Map`) are the original surface
9
+ * and are unchanged. The remaining members are **additive** - existing configs
10
+ * keep working untouched.
11
+ *
12
+ * @public
13
+ */
1
14
  export var FunctionTypes;
2
15
  (function (FunctionTypes) {
16
+ /** Keep only the items whose predicate expression evaluates truthy. Returns an array. */
3
17
  FunctionTypes["Filter"] = "filter";
18
+ /** Return the first item whose predicate expression evaluates truthy (or `undefined`). Terminal. */
4
19
  FunctionTypes["Find"] = "find";
20
+ /** Reshape each item using a projection expression. Returns an array of new objects. */
5
21
  FunctionTypes["Map"] = "map";
22
+ /** Order items by one or more `path asc|desc` keys. Returns an array. */
23
+ FunctionTypes["Sort"] = "sort";
24
+ /** Take a window of items (`start:end`, a single limit, or `start,count`). Returns an array. */
25
+ FunctionTypes["Slice"] = "slice";
26
+ /** Drop duplicate items, keyed by whole-item identity or one/more paths. Returns an array. */
27
+ FunctionTypes["Unique"] = "unique";
28
+ /** Flatten nested arrays one level, or flat-map by a child array path. Returns an array. */
29
+ FunctionTypes["Flatten"] = "flatten";
30
+ /** Group items into buckets keyed by one or more paths. Returns a record of arrays. Terminal. */
31
+ FunctionTypes["GroupBy"] = "groupBy";
32
+ /** Aggregate items into a scalar or summary object (sum/avg/min/max/count/first/last/join). Terminal. */
33
+ FunctionTypes["Reduce"] = "reduce";
6
34
  // Add more function types here as needed
7
35
  })(FunctionTypes || (FunctionTypes = {}));
@@ -11,20 +11,22 @@ export interface InClassFormUtilsInterface {
11
11
  /**
12
12
  * Function to perform an HTTP GET request.
13
13
  * @param url - The URL to send the request to.
14
+ * @param options - Implementation-defined request options (consumer narrows).
14
15
  * @returns A promise that resolves to the response data.
15
16
  */
16
- httpGetDataFunction: (url: string, options: any) => Observable<any>;
17
+ httpGetDataFunction: (url: string, options: unknown) => Observable<unknown>;
17
18
  /**
18
19
  * Function to perform an HTTP POST request.
19
20
  * @param url - The URL to send the request to.
20
21
  * @param data - The data to send in the request body.
22
+ * @param options - Implementation-defined request options (consumer narrows).
21
23
  * @returns A promise that resolves to the response data.
22
24
  */
23
- httpPostDataFunction: (url: string, data: any, options: any) => Observable<any>;
25
+ httpPostDataFunction: (url: string, data: unknown, options: unknown) => Observable<unknown>;
24
26
  submitForm: () => Observable<void>;
25
27
  saveFormData: () => Observable<void>;
26
- runPipeLine: (pipeline: any, workflowId: string) => Observable<{
27
- results: any;
28
+ runPipeLine: (pipeline: unknown, workflowId: string) => Observable<{
29
+ results: unknown;
28
30
  message: string;
29
31
  }>;
30
32
  fileUpload: FileUploadFn;
@@ -2,7 +2,12 @@ import { FormSlideInterface } from "../FormSlide/formSlideInterface.js";
2
2
  import { FormSubmissionHandleInterface } from "./formSubmissionHandleInterface.js";
3
3
  export interface FormInterface {
4
4
  slides: Array<FormSlideInterface>;
5
- submissionHandle: FormSubmissionHandleInterface;
5
+ /**
6
+ * Optional submission target. Empty-form factories (e.g. `createEmptyForm()`)
7
+ * legitimately have none until the consumer configures one; downstream
8
+ * consumers guard before reading.
9
+ */
10
+ submissionHandle?: FormSubmissionHandleInterface;
6
11
  formId: string | any;
7
12
  formTitle: string;
8
13
  submissionMessage?: string;
@@ -1,6 +1,6 @@
1
1
  import { NgxTFormsConfig } from "../environment/environment.js";
2
2
  import { FormColumnInputs } from "../formInput/BasicFormInputInterface.js";
3
- import { IAllInputs, OLD_FormInterface } from "../upgradeFunctions/interfaces/init-form.js";
3
+ import { FormInterfaceMigration, IAllInputs, OLD_FormInterface } from "../upgradeFunctions/interfaces/init-form.js";
4
4
  import { IArrayFunction } from "./ArrayFunctions.js";
5
5
  import { CustomConfigInterface } from "./CustomeConfigInter.js";
6
6
  import { FileData, FileUploadFn } from "./FileUploadFn.js";
@@ -9,4 +9,5 @@ import { IFormActions, InClassFormUtilsInterface, InClassFormUtilsWithSectionsIn
9
9
  import { FormInterface, DatabaseFormInterface, MainFormInterface } from "./formInterface.js";
10
10
  import { FormSubmissionHandleInterface, IReportDataSources } from "./formSubmissionHandleInterface.js";
11
11
  import { FormListSection, FormStateErrors, IFormsInitStateInterface, LocalFormStateSelectorInterface } from "./IFormsInitStateInterface.js";
12
- export { CustomConfigInterface, InClassFormUtilsInterface, InClassFormUtilsWithSectionsInterface, FormInterface, MainFormInterface, DatabaseFormInterface, FormSubmissionHandleInterface, FormColumnInputs, IFormActions, NgxTFormsConfig, FileUploadFn, FileData, FormListSection, LocalFormStateSelectorInterface, IFormsInitStateInterface, FormStateErrors, IArrayFunction, OLD_FormInterface, IAllInputs, IFormChangeHistory, IReportDataSources };
12
+ export { CustomConfigInterface, InClassFormUtilsInterface, InClassFormUtilsWithSectionsInterface, FormInterface, MainFormInterface, DatabaseFormInterface, FormSubmissionHandleInterface, FormColumnInputs, IFormActions, NgxTFormsConfig, FileUploadFn, FileData, FormListSection, LocalFormStateSelectorInterface, IFormsInitStateInterface, FormStateErrors, IArrayFunction, OLD_FormInterface, FormInterfaceMigration, IAllInputs, IFormChangeHistory, IReportDataSources };
13
+ export { FunctionTypes } from "./ArrayFunctions.js";
@@ -1,2 +1,6 @@
1
1
  import { FormListSection, FormStateErrors } from "./IFormsInitStateInterface.js";
2
2
  export { FormListSection, FormStateErrors };
3
+ // Array-access transform operations (filter/find/map/sort/slice/unique/flatten/
4
+ // groupBy/reduce) - exported as a value enum so config authors can reference
5
+ // `FunctionTypes.Sort` etc. when authoring `IArrayFunction[]` access rules.
6
+ export { FunctionTypes } from "./ArrayFunctions.js";
@@ -780,7 +780,7 @@ export const DefaultInputConfig = {
780
780
  validators: [],
781
781
  appearance: 'outline',
782
782
  isCalculatedField: false,
783
- richTextEditorLibrary: RichTextEditorType.EditorJS,
783
+ richTextEditorLibrary: RichTextEditorType.Quill,
784
784
  },
785
785
  },
786
786
  [ElementTypes.MscoaSelection]: {
@@ -4,8 +4,19 @@ import { IPaginatedSelectionTableInputInterface, ISelectInputInterface } from ".
4
4
  import { IRichTextEditor } from "../formInput/RichTextEditorInput.js";
5
5
  import { IWorkflowDocumentPicker } from "../formInput/WorkflowDocumentPicker.js";
6
6
  import { AllFormInputPrimaryKeys, FormInputKeys, SpecialElementKeys } from "./FormInputKeys.js";
7
+ /**
8
+ * Configuration map for the form-builder's default element templates.
9
+ *
10
+ * NOTE (H-014): All members are optional. Several `ElementTypes` members
11
+ * (`QrCodeScanner`, `QrCodeGenerator`, `OcrInput`, `MatrixTable`) are currently
12
+ * commented out of the enum itself, and a few populated entries are still in
13
+ * flight — making every key optional lets consumers safely look up by element
14
+ * with `defaultInputs[input.element]?.requiredProperties` without `as any`
15
+ * casts. When the enum re-introduces those members, the matching shapes can be
16
+ * un-commented below.
17
+ */
7
18
  export interface DefaultInputConfigInterface {
8
- [ElementTypes.Input]: {
19
+ [ElementTypes.Input]?: {
9
20
  label: string;
10
21
  disabled: boolean;
11
22
  illustration: string;
@@ -13,7 +24,7 @@ export interface DefaultInputConfigInterface {
13
24
  elementTemplate: IFormElementTemplate;
14
25
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
15
26
  };
16
- [ElementTypes.Location]: {
27
+ [ElementTypes.Location]?: {
17
28
  label: string;
18
29
  disabled: boolean;
19
30
  illustration: string;
@@ -21,7 +32,7 @@ export interface DefaultInputConfigInterface {
21
32
  elementTemplate: IFormElementTemplate;
22
33
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
23
34
  };
24
- [ElementTypes.AutoCompleteInput]: {
35
+ [ElementTypes.AutoCompleteInput]?: {
25
36
  label: string;
26
37
  disabled: boolean;
27
38
  illustration: string;
@@ -29,7 +40,7 @@ export interface DefaultInputConfigInterface {
29
40
  elementTemplate: IFormElementTemplate;
30
41
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
31
42
  };
32
- [ElementTypes.Toggle]: {
43
+ [ElementTypes.Toggle]?: {
33
44
  label: string;
34
45
  disabled: boolean;
35
46
  illustration: string;
@@ -37,7 +48,7 @@ export interface DefaultInputConfigInterface {
37
48
  elementTemplate: IToggleInput;
38
49
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
39
50
  };
40
- [ElementTypes.Select]: {
51
+ [ElementTypes.Select]?: {
41
52
  label: string;
42
53
  disabled: boolean;
43
54
  illustration: string;
@@ -45,7 +56,7 @@ export interface DefaultInputConfigInterface {
45
56
  elementTemplate: ISelectInputInterface;
46
57
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
47
58
  };
48
- [ElementTypes.PaginatedSelectionTable]: {
59
+ [ElementTypes.PaginatedSelectionTable]?: {
49
60
  label: string;
50
61
  disabled: boolean;
51
62
  illustration: string;
@@ -53,7 +64,7 @@ export interface DefaultInputConfigInterface {
53
64
  elementTemplate: IPaginatedSelectionTableInputInterface;
54
65
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
55
66
  };
56
- [ElementTypes.IconSelect]: {
67
+ [ElementTypes.IconSelect]?: {
57
68
  label: string;
58
69
  illustration: string;
59
70
  properties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
@@ -61,7 +72,7 @@ export interface DefaultInputConfigInterface {
61
72
  disabled: boolean;
62
73
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
63
74
  };
64
- [ElementTypes.Textarea]: {
75
+ [ElementTypes.Textarea]?: {
65
76
  label: string;
66
77
  disabled: boolean;
67
78
  illustration: string;
@@ -69,7 +80,7 @@ export interface DefaultInputConfigInterface {
69
80
  elementTemplate: ITextareaProperties;
70
81
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
71
82
  };
72
- [ElementTypes.DatePicker]: {
83
+ [ElementTypes.DatePicker]?: {
73
84
  label: string;
74
85
  disabled: boolean;
75
86
  illustration: string;
@@ -77,7 +88,7 @@ export interface DefaultInputConfigInterface {
77
88
  elementTemplate: IFormElementTemplate;
78
89
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
79
90
  };
80
- [ElementTypes.DateRangePicker]: {
91
+ [ElementTypes.DateRangePicker]?: {
81
92
  label: string;
82
93
  disabled: boolean;
83
94
  illustration: string;
@@ -85,7 +96,7 @@ export interface DefaultInputConfigInterface {
85
96
  elementTemplate: IDateRangePickerInput;
86
97
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
87
98
  };
88
- [ElementTypes.FileUpload]: {
99
+ [ElementTypes.FileUpload]?: {
89
100
  label: string;
90
101
  disabled: boolean;
91
102
  illustration: string;
@@ -93,7 +104,7 @@ export interface DefaultInputConfigInterface {
93
104
  elementTemplate: IFileUploadInput;
94
105
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
95
106
  };
96
- [ElementTypes.Signature]: {
107
+ [ElementTypes.Signature]?: {
97
108
  label: string;
98
109
  disabled: boolean;
99
110
  illustration: string;
@@ -101,7 +112,7 @@ export interface DefaultInputConfigInterface {
101
112
  elementTemplate: IFormElementTemplate;
102
113
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
103
114
  };
104
- [ElementTypes.ImageCapture]: {
115
+ [ElementTypes.ImageCapture]?: {
105
116
  label: string;
106
117
  disabled: boolean;
107
118
  illustration: string;
@@ -109,7 +120,7 @@ export interface DefaultInputConfigInterface {
109
120
  elementTemplate: IFormElementTemplate;
110
121
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
111
122
  };
112
- [ElementTypes.SectionTitle]: {
123
+ [ElementTypes.SectionTitle]?: {
113
124
  label: string;
114
125
  disabled: boolean;
115
126
  illustration: string;
@@ -117,7 +128,7 @@ export interface DefaultInputConfigInterface {
117
128
  elementTemplate: IFormElementTemplate;
118
129
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
119
130
  };
120
- [ElementTypes.MultipleInput]: {
131
+ [ElementTypes.MultipleInput]?: {
121
132
  label: string;
122
133
  disabled: boolean;
123
134
  illustration: string;
@@ -125,7 +136,7 @@ export interface DefaultInputConfigInterface {
125
136
  elementTemplate: IMultiple;
126
137
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
127
138
  };
128
- [ElementTypes.Editor]: {
139
+ [ElementTypes.Editor]?: {
129
140
  label: string;
130
141
  disabled: boolean;
131
142
  illustration: string;
@@ -133,7 +144,7 @@ export interface DefaultInputConfigInterface {
133
144
  elementTemplate: IRichTextEditor;
134
145
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
135
146
  };
136
- [ElementTypes.MscoaSelection]: {
147
+ [ElementTypes.MscoaSelection]?: {
137
148
  label: string;
138
149
  disabled: boolean;
139
150
  illustration: string;
@@ -141,7 +152,7 @@ export interface DefaultInputConfigInterface {
141
152
  elementTemplate: IScoaInput;
142
153
  requiredProperties: Array<FormInputKeys | SpecialElementKeys | AllFormInputPrimaryKeys>;
143
154
  };
144
- [ElementTypes.WorkflowDocumentPicker]: {
155
+ [ElementTypes.WorkflowDocumentPicker]?: {
145
156
  label: string;
146
157
  disabled: boolean;
147
158
  illustration: string;
@@ -149,7 +160,7 @@ export interface DefaultInputConfigInterface {
149
160
  elementTemplate: IWorkflowDocumentPicker;
150
161
  requiredProperties: Array<FormInputKeys | AllFormInputPrimaryKeys>;
151
162
  };
152
- [ElementTypes.WorkflowAdjudication]: {
163
+ [ElementTypes.WorkflowAdjudication]?: {
153
164
  label: string;
154
165
  disabled: boolean;
155
166
  illustration: string;
@@ -15,5 +15,13 @@ export interface FormBuilderFunctions {
15
15
  getSCOAAccount: (SCOAAccount: string) => Observable<{
16
16
  accounts: IScoaAccount[];
17
17
  }>;
18
- reorderItems: (event: CdkDragDrop<FormColumnInputs[], any, any>, multipleInputId: string) => void;
18
+ /**
19
+ * Reorders items within a multiple-input column list.
20
+ *
21
+ * Generic `T` covers any row shape assignable to `FormColumnInputs` so consumers
22
+ * can pass narrower row types (e.g. `ITowerStepColumn[]`) without casting.
23
+ * The container/data/predicate generic slots on `CdkDragDrop` are kept as
24
+ * `unknown` — the runtime payload is opaque to this contract; consumers narrow.
25
+ */
26
+ reorderItems: <T extends FormColumnInputs = FormColumnInputs>(event: CdkDragDrop<T[], unknown, unknown>, multipleInputId: string) => void;
19
27
  }
@@ -35,7 +35,8 @@ export declare enum ElementEditorTypes {
35
35
  ListLabelConfigEditor = "listLabelConfigEditor",
36
36
  DecisionGateSettings = "decisionGateSettings",
37
37
  RecordListManager = "recordListManager",
38
- MapMatOptionsKeys = "mapMatOptionsKeys"
38
+ MapMatOptionsKeys = "mapMatOptionsKeys",
39
+ FormPayloadProjection = "formPayloadProjection"
39
40
  }
40
41
  export interface ElementEditorConfigInterface {
41
42
  editorSections: Array<ElementEditorConfigSectionInterface>;
@@ -30,6 +30,7 @@ export var ElementEditorTypes;
30
30
  ElementEditorTypes["DecisionGateSettings"] = "decisionGateSettings";
31
31
  ElementEditorTypes["RecordListManager"] = "recordListManager";
32
32
  ElementEditorTypes["MapMatOptionsKeys"] = "mapMatOptionsKeys";
33
+ ElementEditorTypes["FormPayloadProjection"] = "formPayloadProjection";
33
34
  })(ElementEditorTypes || (ElementEditorTypes = {}));
34
35
  // interface TStringExpressionValidationTest{
35
36
  // expression: string;
@@ -7,4 +7,5 @@ import { IWorkflowOption } from "./workflowSelectionConfig.js";
7
7
  import { FormBuilderFunctions } from "./FormBuilderCallBackFunctions.js";
8
8
  import { IGetPostmanCollections, IPostmanCollectionConfig } from "./postmanCollection.js";
9
9
  import { DataSources } from "../formInput/APIDataFetchingConfigurationInterface.js";
10
- export { DefaultInputConfigInterface, BlurHandleTypes, FormInputKeys, ElementEditorTypes, ConfigurationValidTestInterface, ElementEditorInnerSectionElementInterface, SpecialElementKeys, AllFormInputPrimaryKeys, DefaultInputConfig, defaultInputs, getElementEditorConfig, IWorkflowOption, FormBuilderFunctions, IGetPostmanCollections, IPostmanCollectionConfig, DataSources, ElementEditorConfigSectionInterface };
10
+ import { IScoaAccount } from "../formInput/IMscoaAccount.js";
11
+ export { DefaultInputConfigInterface, BlurHandleTypes, FormInputKeys, ElementEditorTypes, ConfigurationValidTestInterface, ElementEditorInnerSectionElementInterface, SpecialElementKeys, AllFormInputPrimaryKeys, DefaultInputConfig, defaultInputs, getElementEditorConfig, IWorkflowOption, FormBuilderFunctions, IGetPostmanCollections, IPostmanCollectionConfig, DataSources, ElementEditorConfigSectionInterface, IScoaAccount, };
@@ -3,4 +3,4 @@ import { getElementEditorConfig } from "./inputConfig/ElementEditConfig.js";
3
3
  import { AllFormInputPrimaryKeys, FormInputKeys, SpecialElementKeys } from "./FormInputKeys.js";
4
4
  import { BlurHandleTypes, ElementEditorTypes } from "./elementEditor.js";
5
5
  import { DataSources } from "../formInput/APIDataFetchingConfigurationInterface.js";
6
- export { BlurHandleTypes, FormInputKeys, ElementEditorTypes, SpecialElementKeys, AllFormInputPrimaryKeys, DefaultInputConfig, defaultInputs, getElementEditorConfig, DataSources };
6
+ export { BlurHandleTypes, FormInputKeys, ElementEditorTypes, SpecialElementKeys, AllFormInputPrimaryKeys, DefaultInputConfig, defaultInputs, getElementEditorConfig, DataSources, };
@@ -369,12 +369,16 @@ export var ElementConfig = {
369
369
  fetchOptions: ['mscoaConfig', 'showAllSegments'],
370
370
  additionalTest: [
371
371
  {
372
- expression: `accountingBasis !== ${AccountingBasis.Accrual}`,
372
+ // Show the cash-segments editor ONLY for an explicit Cash/Dual basis.
373
+ // A positive whitelist (not `!== Accrual`) also hides it for the
374
+ // unset/`undefined` default of a freshly-added input — `!== Accrual`
375
+ // is true for `undefined`, which left it always visible.
376
+ expression: `accountingBasis === ${AccountingBasis.Cash} || accountingBasis === ${AccountingBasis.Dual}`,
373
377
  deepBind: ['mscoaConfig', 'accountingBasis'],
374
378
  },
375
379
  ],
376
380
  hint: "Configure SCOA segments to be When mapping the Cash accounts",
377
- id: "d9ea60b9-653f-4d9c-88bd-f603a589cce0"
381
+ id: "f1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b"
378
382
  },
379
383
  {
380
384
  name: AllFormInputPrimaryKeys.MscoaConfig,
@@ -450,7 +454,7 @@ export var ElementConfig = {
450
454
  value: 'default'
451
455
  },
452
456
  { label: 'Postman API', value: DataSources.Api },
453
- { label: 'Data Pipeline', value: DataSources.MongoDb },
457
+ // { label: 'Data Pipeline', value: DataSources.MongoDb },
454
458
  ],
455
459
  id: "f04cc297-9b22-403a-afe4-4fb2e84fa503"
456
460
  },
@@ -14,11 +14,13 @@ export interface ImportProgress {
14
14
  pending: number;
15
15
  /** Rows currently processing. */
16
16
  processing: number;
17
- /** `valid` + `invalid` — i.e. rows that fully settled (regardless of validity). */
17
+ /** `valid` + `overridable` + `invalid` — i.e. rows that fully settled (regardless of validity). */
18
18
  complete: number;
19
19
  /** Rows that settled with no errors. */
20
20
  valid: number;
21
- /** Rows that settled with at least one error. */
21
+ /** Rows that settled with only overridable (motivatable) errors — no blocking errors. */
22
+ overridable: number;
23
+ /** Rows that settled with at least one blocking error. */
22
24
  invalid: number;
23
25
  /** Rows that threw before settling. */
24
26
  error: number;
@@ -4,15 +4,21 @@
4
4
  *
5
5
  * - `pending` — queued, tower not yet created.
6
6
  * - `processing` — tower is initialising / preprocessing / awaiting settle.
7
- * - `valid` — settled with no validator errors.
8
- * - `invalid` — settled but at least one validator error or pre-process error.
9
- * - `error` — `_processRow` threw before settle (tower init failure, etc.).
7
+ * - `valid` — settled with no validator errors.
8
+ * - `overridable` — settled with NO blocking errors, but at least one
9
+ * overridable (`canOverride === true`) custom-validator error remains. The
10
+ * row is not strictly valid, yet it could be submitted once each overridable
11
+ * validation is motivated (see {@link ImportRowState.overridableErrors}).
12
+ * - `invalid` — settled with at least one blocking validator error or
13
+ * pre-process error (a row carrying both blocking and overridable errors is
14
+ * `invalid`, not `overridable`).
15
+ * - `error` — `_processRow` threw before settle (tower init failure, etc.).
10
16
  *
11
17
  * Upstreamed from `ngx-t-forms` per DECISIONS.md D-016.
12
18
  *
13
19
  * @public
14
20
  */
15
- export type ImportRowStatus = 'pending' | 'processing' | 'valid' | 'invalid' | 'error';
21
+ export type ImportRowStatus = 'pending' | 'processing' | 'valid' | 'overridable' | 'invalid' | 'error';
16
22
  /**
17
23
  * Per-row state recorded throughout an import session.
18
24
  *
@@ -33,8 +39,20 @@ export interface ImportRowState {
33
39
  * `valid` or `invalid`.
34
40
  */
35
41
  settledValue?: Record<string, unknown>;
36
- /** `true` when no validation/column errors were collected. */
42
+ /**
43
+ * `true` when no validation/column errors were collected at all (status
44
+ * `valid`). An `overridable` row reports `false` here — it is bypassable,
45
+ * not strictly valid.
46
+ */
37
47
  isValid?: boolean;
48
+ /**
49
+ * inputId → array of overridable (`canOverride === true`) custom-validator
50
+ * messages that remain on the settled row. Present (non-empty) when
51
+ * `status === 'overridable'`; consumers use it to render a motivation
52
+ * prompt per failing input. Blocking errors are NOT included here — see
53
+ * {@link ImportRowState.validationErrors}.
54
+ */
55
+ overridableErrors?: Record<string, string[]>;
38
56
  /** inputId → array of Angular validator error keys (e.g. `['required', 'minlength']`). */
39
57
  validationErrors?: Record<string, string[]>;
40
58
  /**
@@ -37,7 +37,12 @@ export declare enum InputFileType {
37
37
  }
38
38
  export interface FileUploadInputValueInterface {
39
39
  fileName: string;
40
- type: InputFileType | undefined;
40
+ /**
41
+ * Either an `InputFileType` enum member or a raw MIME type string
42
+ * (e.g. `'image/png'`). The enum was never enforced on the value side; some
43
+ * factories (e.g. base64-derived uploads) carry the MIME directly.
44
+ */
45
+ type: InputFileType | string | undefined;
41
46
  base64: string | ArrayBuffer | null;
42
47
  blob: Blob;
43
48
  fileExtension: string;
@@ -1,10 +1,44 @@
1
+ import { CalculationFunctions } from "./calculationVariableInterface.js";
2
+ /**
3
+ * A single dependency the validator expression observes.
4
+ *
5
+ * `inputId` is the input whose value is read; `variable` is the name the
6
+ * expression references it by.
7
+ *
8
+ * ### Multiple-input (list) bindings
9
+ * When the bound input lives inside a repeatable "multiple input" group, the
10
+ * value is an array of rows rather than a scalar:
11
+ * - `parentInputId` — the id of the multiple-input container whose value is the
12
+ * row array. Present for any binding to a list sub-item.
13
+ * - `function` — the aggregate applied to reduce the list column to a single
14
+ * value (sum/avg/min/max/count). Required when the validator lives on a
15
+ * primary-form input and references a list sub-item (the array must be
16
+ * reduced to a scalar). Omitted when the validator lives on a sub-item of the
17
+ * *same* group, where peers resolve to the current row's value directly.
18
+ */
19
+ export interface InputObservedForChange {
20
+ inputId: string;
21
+ variable: string;
22
+ /** Multiple-input container id whose value is the row array (list bindings only). */
23
+ parentInputId?: string;
24
+ /** Aggregate applied to reduce a list column to a single value. */
25
+ function?: CalculationFunctions;
26
+ }
1
27
  export interface FormControlCustomValidatorsInterface {
2
28
  id: string;
3
29
  message: string;
4
30
  expression: string;
5
31
  canOverride: boolean;
6
- inputsObservedForChanges: {
7
- inputId: string;
8
- variable: string;
9
- }[];
32
+ inputsObservedForChanges: InputObservedForChange[];
10
33
  }
34
+ /**
35
+ * Draft variant of {@link FormControlCustomValidatorsInterface} used while a
36
+ * new validator is being authored in the UI. The `id` is assigned on save
37
+ * (e.g. via `uuidv4()`), so the in-flight draft is intentionally id-less.
38
+ *
39
+ * Use the union `DraftFormControlCustomValidator | FormControlCustomValidatorsInterface`
40
+ * in builder/editor APIs that accept either an unsaved draft or a persisted record.
41
+ */
42
+ export type DraftFormControlCustomValidator = Omit<FormControlCustomValidatorsInterface, 'id'> & {
43
+ id?: string;
44
+ };
@@ -0,0 +1,48 @@
1
+ import { FileData } from "../Form/FileUploadFn.js";
2
+ /**
3
+ * A single bypassed (overridden) validation captured at submission time.
4
+ *
5
+ * A custom validator declared with {@link FormControlCustomValidatorsInterface.canOverride}
6
+ * `=== true` does NOT block submission outright: when every blocking
7
+ * (`canOverride === false`) validation on the form is resolved, the user may
8
+ * submit by motivating each still-failing overridable validation. Each such
9
+ * motivation is recorded as one entry of this shape and carried on the
10
+ * submission payload (under the `_validationOverrides` key) so the bypass is
11
+ * durable and auditable.
12
+ *
13
+ * @example
14
+ * {
15
+ * formControlName: 'invoiceTotal',
16
+ * validationMessage: 'Total exceeds the approved budget',
17
+ * comment: 'Approved verbally by the finance lead — see attached email.',
18
+ * attachment: { base64: '…', fileName: 'approval.pdf', type: 'application/pdf', id: '…', fileExtension: 'pdf' },
19
+ * }
20
+ *
21
+ * @public
22
+ */
23
+ export interface IFormValidationOverride {
24
+ /**
25
+ * `formControlName` of the input whose overridable validation was bypassed.
26
+ * Mirrors {@link FormColumnInputs.formControlName} so consumers can map the
27
+ * override back to a field.
28
+ */
29
+ formControlName: string;
30
+ /**
31
+ * The overridden validator's human-readable message, taken verbatim from
32
+ * {@link FormControlCustomValidatorsInterface.message}. The captured
33
+ * motivation must correspond to this specific validation.
34
+ */
35
+ validationMessage: string;
36
+ /**
37
+ * User-supplied motivation for bypassing the validation. A non-empty,
38
+ * non-whitespace value is REQUIRED for the override to count — the form
39
+ * cannot be submitted while any overridable validation lacks a comment.
40
+ */
41
+ comment: string;
42
+ /**
43
+ * Optional supporting file backing the motivation. Carried as
44
+ * {@link FileData} (base64) so the submission upload pass resolves it to a
45
+ * `{ url }` exactly like a file-upload input value.
46
+ */
47
+ attachment?: FileData;
48
+ }
@@ -63,19 +63,44 @@ export interface ScoaInterface extends IScoaInputConfig {
63
63
  validationErrors: MscoaValuetValidationErrors;
64
64
  getTreeResponse: IGetTreeResponse | null;
65
65
  }
66
+ /**
67
+ * Per-segment value bag stored under `ScoaSegmentValue[segmentKey]` and
68
+ * surfaced on row models (e.g. `ITableScoaSelectionRow.segmentValue`).
69
+ *
70
+ * Holds the debit/credit account pair plus optional metadata flags such as
71
+ * `vatApplicableTo`. UI consumers read the bag by column key
72
+ * (`'debit' | 'credit'`); selectors also stamp dynamic counter-account keys
73
+ * (e.g. `${name}Credit` / `${name}Debit`) onto the row at runtime.
74
+ */
75
+ export interface ScoaSegmentValueBag {
76
+ debit?: IScoaAccount | undefined;
77
+ credit?: IScoaAccount | undefined;
78
+ vatApplicableTo?: string;
79
+ /**
80
+ * Segment-scoped custom-input values, written as siblings of `debit`/`credit`
81
+ * (e.g. `budgetValue`, `department`) and keyed by the custom input's
82
+ * `formControlName`. Typed `unknown` because a custom input may carry any
83
+ * dynamic-input value (number, string, boolean, date, object); narrow at the
84
+ * read site. The reserved keys above (`debit`/`credit`/`vatApplicableTo`, plus
85
+ * the runtime-derived `vat`) retain their precise types.
86
+ */
87
+ [customKey: string]: unknown;
88
+ }
66
89
  export interface ScoaSegmentValue {
67
- [key: string]: {
68
- debit: IScoaAccount | undefined;
69
- credit: IScoaAccount | undefined;
70
- vatApplicableTo?: string;
71
- };
90
+ [key: string]: ScoaSegmentValueBag;
72
91
  }
73
92
  export type ScoaAccountTree = {
74
93
  [key: string]: ScoaAccountTree;
75
94
  };
76
95
  export interface ITableScoaSelectionRow extends IIncludedSegmentConfig {
77
96
  segmentTree: ScoaAccountTree;
78
- segmentValue: IScoaAccount | undefined;
97
+ /**
98
+ * Runtime shape: a per-column bag of debit/credit accounts with optional
99
+ * VAT metadata. Historically declared as `IScoaAccount | undefined`, which
100
+ * never matched the value the selector pipeline writes; widened to a union
101
+ * so legacy readers keep narrowing while new callers can read the bag.
102
+ */
103
+ segmentValue: ScoaSegmentValueBag | undefined;
79
104
  debit: string;
80
105
  credit: string;
81
106
  }
@@ -11,6 +11,13 @@ export interface IMscoaFormInput extends IBasicFormInput {
11
11
  };
12
12
  }
13
13
  export interface ScoaInnerInput extends FormColumnInputs {
14
+ /**
15
+ * Id of the `IIncludedSegmentConfig` this custom input is attached to
16
+ * (i.e. `IIncludedSegmentConfig.id`). When set, the input renders inside that
17
+ * segment's row and its value is projected into
18
+ * `segmentValues[basis][SEGMENT][formControlName]` as a sibling of
19
+ * debit/credit. Empty/absent means the input is a standalone segment row.
20
+ */
14
21
  linkedSegmentId: string;
15
22
  }
16
23
  export interface ScoreSheetItem {
@@ -1,8 +1,22 @@
1
1
  import { IBasicFormInput } from ".";
2
+ /**
3
+ * Identifies the rich text editor library to render for a {@link IRichTextEditor} form input.
4
+ */
2
5
  export declare enum RichTextEditorType {
3
- EditorJS = "EditorJS",
4
- CkEditor = "CkEditor"
6
+ /** The Quill rich text editor. */
7
+ Quill = "Quill",
8
+ /**
9
+ * The EditorJS block-style editor.
10
+ *
11
+ * @deprecated EditorJS is no longer supported and will be removed in a future
12
+ * release. Use {@link RichTextEditorType.Quill} instead.
13
+ */
14
+ EditorJS = "EditorJS"
5
15
  }
16
+ /**
17
+ * A form input backed by a rich text editor.
18
+ */
6
19
  export interface IRichTextEditor extends IBasicFormInput {
20
+ /** The rich text editor library used to render this input. */
7
21
  richTextEditorLibrary: RichTextEditorType;
8
22
  }
@@ -1,5 +1,15 @@
1
+ /**
2
+ * Identifies the rich text editor library to render for a {@link IRichTextEditor} form input.
3
+ */
1
4
  export var RichTextEditorType;
2
5
  (function (RichTextEditorType) {
6
+ /** The Quill rich text editor. */
7
+ RichTextEditorType["Quill"] = "Quill";
8
+ /**
9
+ * The EditorJS block-style editor.
10
+ *
11
+ * @deprecated EditorJS is no longer supported and will be removed in a future
12
+ * release. Use {@link RichTextEditorType.Quill} instead.
13
+ */
3
14
  RichTextEditorType["EditorJS"] = "EditorJS";
4
- RichTextEditorType["CkEditor"] = "CkEditor";
5
15
  })(RichTextEditorType || (RichTextEditorType = {}));
@@ -16,11 +16,23 @@ export interface AdjResponseReviewColumnMapping {
16
16
  }
17
17
  export interface WorkflowAdjudicationMicroFlowReviewValue {
18
18
  id: string;
19
- adj_microFlow_review: boolean;
19
+ /**
20
+ * Reviewer's compliance verdict for this micro-flow submission.
21
+ * Optional: `undefined` represents "not yet reviewed".
22
+ */
23
+ adj_microFlow_review?: 'compliant' | 'non-compliant';
24
+ /**
25
+ * Optional reviewer notes for this submission. Stored as a structured payload
26
+ * (e.g. EditorJS `OutputData`) or a plain string depending on the consumer renderer;
27
+ * typed as `unknown` here so the shared interface stays renderer-agnostic.
28
+ */
29
+ adj_microFlow_review_notes?: unknown;
20
30
  nameOfBidder: string;
21
31
  supplierNumber: string;
22
- createdAt: Date;
23
- updatedAt: Date;
32
+ /** Optional — populated from the underlying submission row when available. */
33
+ createdAt?: Date;
34
+ /** Optional — populated from the underlying submission row when available. */
35
+ updatedAt?: Date;
24
36
  adjudicationPricePreferenceCalculation: number;
25
37
  reference: string;
26
38
  }
@@ -17,5 +17,7 @@ export declare enum CalculationFunctions {
17
17
  Avg = "avg",
18
18
  Sum = "sum",
19
19
  Max = "max",
20
- Min = "min"
20
+ Min = "min",
21
+ /** Number of rows in the list (does not require a numeric column). */
22
+ Count = "count"
21
23
  }
@@ -4,4 +4,6 @@ export var CalculationFunctions;
4
4
  CalculationFunctions["Sum"] = "sum";
5
5
  CalculationFunctions["Max"] = "max";
6
6
  CalculationFunctions["Min"] = "min";
7
+ /** Number of rows in the list (does not require a numeric column). */
8
+ CalculationFunctions["Count"] = "count";
7
9
  })(CalculationFunctions || (CalculationFunctions = {}));
@@ -5,9 +5,10 @@ import { APIDataFetchingConfigurationInterface, InputAPIDataId, MongoDbPipeLineC
5
5
  import { AutocapitalizeOptions, AutocompleteOptions, ElementTypes, IBasicFormInput, IFormElementTemplate, InputDataTypes, InputPipeTypes, InputTypes, OptionSelectTypes } from "./BasicFormInputInterface.js";
6
6
  import { IDateRangePickerInput } from "./DateRangePickerInput.js";
7
7
  import { AllDocumentFileExtensions, AllImageFileExtensions, FileUploadInputValueInterface, IFileUploadInput, InputFileType, UploadTypes } from "./FileUploadInputInterface.js";
8
- import { FormControlCustomValidatorsInterface } from "./FormControlCustomValidatorsInterface.js";
8
+ import { DraftFormControlCustomValidator, FormControlCustomValidatorsInterface, InputObservedForChange } from "./FormControlCustomValidatorsInterface.js";
9
+ import { IFormValidationOverride } from "./FormValidationOverride.js";
9
10
  import { FormInputBasicOptionInterface } from "./FormInputBasicOptionInterface.js";
10
- import { AccountingBasis, IAccountSegmentTreeKeys, IGetTreeResponse, IIncludedSegmentConfig, IScoaAccount, IScoaInput, IScoaInputConfig, ITableScoaSelectionRow, ScoaAccountTree, ScoaInterface, ScoaSegmentValue } from "./IMscoaAccount.js";
11
+ import { AccountingBasis, IAccountSegmentTreeKeys, IGetTreeResponse, IIncludedSegmentConfig, IScoaAccount, IScoaInput, IScoaInputConfig, ITableScoaSelectionRow, ScoaAccountTree, ScoaInterface, ScoaSegmentValue, ScoaSegmentValueBag } from "./IMscoaAccount.js";
11
12
  import { ISelectInputInterface } from "./ISelectInputInterface.js";
12
13
  import { MatDataOptionsInterface } from "./MatDataOptionsInterface.js";
13
14
  import { IMatrixInput } from "./MatrixInputInterface.js";
@@ -24,4 +25,4 @@ import { CalculationFunctions, calculationVariableInterface } from "./calculatio
24
25
  import { IRichTextEditor, RichTextEditorType } from "./RichTextEditorInput.js";
25
26
  import { ValidationError, ValidationOptions } from "./schema.js";
26
27
  import { IUserSignature } from "./userSignature.js";
27
- export { ElementTypes, InputTypes, InputPipeTypes, AutocapitalizeOptions, AutocompleteOptions, InputDataTypes, MinInputTypes, IFormElementTemplate, IBasicFormInput, IFileUploadInput, IDateRangePickerInput, ITextareaProperties, IToggleInput, IMatrixInput, IMultiple, IMultipleInputCal, IScoaInput, TableConfigurationsInterface, TableColumnConfigInterface, FormControlCustomValidatorsInterface, MinimumInputRequiredInterface, MinInputMapInput, CalculatedFieldRules, calculationVariableInterface, APIDataFetchingConfigurationInterface, IGetTreeResponse, CalculationFunctions, TreeNode, IPostmanCollection, IFolderItem, FileUploadInputValueInterface, AllDocumentFileExtensions, AllImageFileExtensions, UploadTypes, InputFileType, IScoaAccount, IScoaInputConfig, ITableScoaSelectionRow, ScoaSegmentValue, IIncludedSegmentConfig, AccountingBasis, ScoaAccountTree, IUserSignature, ValidationOptions, ValidationError, MatDataOptionsInterface, MongoDbPipeLineConfigInterface, InputAPIDataId, FormInputBasicOptionInterface, ScoaInterface, ScoaInnerInput, IAccountSegmentTreeKeys, IWorkflowDocumentPicker, IWorkflowDocumentPickerConfig, workflowStepStatus, IWorkflowDocListCols, JsDataTypes, AdjudicationSteps, IWorkflowAdjudicationInput, WorkflowAdjudicationScoreSheetValue, WorkflowAdjudicationMicroFlowReviewValue, WorkflowAdjudicationResponseElectedSupplierSelectionValue, ScoreSheetItem, AdjResponseReviewColumnMapping, OptionSelectTypes, ISelectInputInterface, MultipleInputAvailableOperations, RichTextEditorType, IRichTextEditor, };
28
+ export { ElementTypes, InputTypes, InputPipeTypes, AutocapitalizeOptions, AutocompleteOptions, InputDataTypes, MinInputTypes, IFormElementTemplate, IBasicFormInput, IFileUploadInput, IDateRangePickerInput, ITextareaProperties, IToggleInput, IMatrixInput, IMultiple, IMultipleInputCal, IScoaInput, TableConfigurationsInterface, TableColumnConfigInterface, FormControlCustomValidatorsInterface, InputObservedForChange, DraftFormControlCustomValidator, IFormValidationOverride, MinimumInputRequiredInterface, MinInputMapInput, CalculatedFieldRules, calculationVariableInterface, APIDataFetchingConfigurationInterface, IGetTreeResponse, CalculationFunctions, TreeNode, IPostmanCollection, IFolderItem, FileUploadInputValueInterface, AllDocumentFileExtensions, AllImageFileExtensions, UploadTypes, InputFileType, IScoaAccount, IScoaInputConfig, ITableScoaSelectionRow, ScoaSegmentValue, ScoaSegmentValueBag, IIncludedSegmentConfig, AccountingBasis, ScoaAccountTree, IUserSignature, ValidationOptions, ValidationError, MatDataOptionsInterface, MongoDbPipeLineConfigInterface, InputAPIDataId, FormInputBasicOptionInterface, ScoaInterface, ScoaInnerInput, IAccountSegmentTreeKeys, IWorkflowDocumentPicker, IWorkflowDocumentPickerConfig, workflowStepStatus, IWorkflowDocListCols, JsDataTypes, AdjudicationSteps, IWorkflowAdjudicationInput, WorkflowAdjudicationScoreSheetValue, WorkflowAdjudicationMicroFlowReviewValue, WorkflowAdjudicationResponseElectedSupplierSelectionValue, ScoreSheetItem, AdjResponseReviewColumnMapping, OptionSelectTypes, ISelectInputInterface, MultipleInputAvailableOperations, RichTextEditorType, IRichTextEditor, };
@@ -7,6 +7,11 @@ import { AdjudicationSteps } from "./WorkflowAdjudication.js";
7
7
  import { workflowStepStatus } from "./WorkflowDocumentPicker.js";
8
8
  import { CalculationFunctions } from "./calculationVariableInterface.js";
9
9
  import { RichTextEditorType } from "./RichTextEditorInput.js";
10
+ // H-018b (Worker T-C): `OLD_FormInterface` and `FormInterfaceMigration` are
11
+ // surfaced through the `Form` barrel (and thereby the top-level
12
+ // `ngx-t-forms-types` entry). They are intentionally NOT re-exported from this
13
+ // formInput barrel as well, because the wildcard merge in `src/index.ts`
14
+ // would otherwise trigger TS2300 "Duplicate identifier".
10
15
  export {
11
16
  ///ENUMS
12
17
  ElementTypes, InputTypes, InputPipeTypes, AutocapitalizeOptions, AutocompleteOptions, InputDataTypes, MinInputTypes, CalculationFunctions, AllDocumentFileExtensions, AllImageFileExtensions, UploadTypes, InputFileType, AccountingBasis, workflowStepStatus, JsDataTypes, AdjudicationSteps, OptionSelectTypes, MultipleInputAvailableOperations, RichTextEditorType, };
@@ -1,7 +1,16 @@
1
- import { AllFormInputPrimaryKeys, FormInputKeys } from "../FormBuilder/index.js";
1
+ import { AllFormInputPrimaryKeys, FormInputKeys, SpecialElementKeys } from "../FormBuilder/index.js";
2
2
  export interface ValidationOptions {
3
3
  data: Record<string, unknown>;
4
- requiredKeys: Array<FormInputKeys | AllFormInputPrimaryKeys>;
4
+ /**
5
+ * Keys that must be present on `data` for the form-column input to be valid.
6
+ *
7
+ * Widened (H-014) to include {@link SpecialElementKeys} so consumers can pass
8
+ * the `requiredProperties` of a `DefaultInputConfig` entry directly — some
9
+ * entries (e.g. `MscoaSelection`) legitimately list `SpecialElementKeys.*`
10
+ * alongside the primary keys. The runtime validator already string-compares,
11
+ * so the wider type only relaxes the compile-time check.
12
+ */
13
+ requiredKeys: Array<FormInputKeys | AllFormInputPrimaryKeys | SpecialElementKeys>;
5
14
  }
6
15
  export interface ValidationError {
7
16
  key: string;
@@ -261,4 +261,17 @@ interface FecthLocalStateData {
261
261
  param: string;
262
262
  passFunction?: string;
263
263
  }
264
+ /**
265
+ * Migration-bridge union for legacy → V2 form payloads.
266
+ *
267
+ * `initFormConfigToV2` (lib helper) accepts either the legacy `OLD_FormInterface`
268
+ * shape (with `submisionHandle`, `formSectionSteps`, `activeSlideNumber`) or the
269
+ * current `FormInterface`. Consumers that wrap that helper should type the
270
+ * argument as `FormInterfaceMigration` rather than reaching for `any`.
271
+ *
272
+ * Defined here (not in `Form/index.ts`) to avoid a circular module dependency
273
+ * between the legacy interface and the current one.
274
+ */
275
+ import type { FormInterface as _CurrentFormInterface } from "../../Form/formInterface.js";
276
+ export type FormInterfaceMigration = OLD_FormInterface | _CurrentFormInterface;
264
277
  export { OLD_FormInterface, IAllInputs };
@@ -9,6 +9,7 @@ const FormInputBasicOptionSchema = Joi.object({
9
9
  const MinInputMapInputSchema = Joi.object({
10
10
  formControlName: Joi.string().required(),
11
11
  dataType: Joi.string().valid(...Object.values(InputDataTypes)).required(),
12
+ inputId: Joi.string().required(),
12
13
  element: Joi.string().valid(...Object.values(ElementTypes)).required()
13
14
  });
14
15
  const minimumInputRequiredSchema = Joi.object({
@@ -28,6 +29,19 @@ const APIDataFetchingConfigurationSchema = Joi.object({
28
29
  inputSourceId: Joi.string().optional(),
29
30
  httpMethod: Joi.string().valid('GET', 'POST', 'PUT', 'DELETE').required(),
30
31
  postFormData: Joi.boolean().required(),
32
+ // httpHeaderOptions mirrors Angular's HttpClient options. Live Angular code may pass
33
+ // HttpHeaders/HttpContext/HttpParams class instances, but anything persisted/transmitted (and
34
+ // thus what this schema validates) is a plain object, so we validate the serializable shape.
35
+ httpHeaderOptions: Joi.object({
36
+ headers: Joi.object().pattern(Joi.string(), Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.string()))).optional(),
37
+ context: Joi.object().optional(),
38
+ observe: Joi.string().valid('body').optional(),
39
+ params: Joi.object().pattern(Joi.string(), Joi.alternatives().try(Joi.string(), Joi.number(), Joi.boolean(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.number(), Joi.boolean())))).optional(),
40
+ reportProgress: Joi.boolean().optional(),
41
+ responseType: Joi.string().valid('json').optional(),
42
+ withCredentials: Joi.boolean().optional(),
43
+ transferCache: Joi.alternatives().try(Joi.object({ includeHeaders: Joi.array().items(Joi.string()).optional() }), Joi.boolean()).optional()
44
+ }).optional(),
31
45
  backEndConfig: Joi.object({
32
46
  minimumInputRequired: Joi.array().items(minimumInputRequiredSchema).required()
33
47
  }).optional(),
@@ -1,7 +1,11 @@
1
1
  import Joi from 'joi';
2
+ import { CalculationFunctions } from '../interfaces/formInput/calculationVariableInterface.js';
2
3
  export const inputsObservedForChangesSchema = Joi.object({
3
4
  inputId: Joi.string(),
4
- variable: Joi.string()
5
+ variable: Joi.string(),
6
+ // Multiple-input (list) bindings — see InputObservedForChange.
7
+ parentInputId: Joi.string().optional(),
8
+ function: Joi.string().valid(...Object.values(CalculationFunctions)).optional()
5
9
  });
6
10
  export const formControlCustomValidatorSchema = Joi.object({
7
11
  id: Joi.string().required(),
@@ -0,0 +1,92 @@
1
+ import { CalculationFunctions } from '../../interfaces/formInput/calculationVariableInterface.js';
2
+ import { formControlCustomValidatorSchema, inputsObservedForChangesSchema, } from '../customValidationSchema.js';
3
+ // ng test ngx-t-forms --include='projects/ngx-t-forms/src/lib/schemas/tests/CustomValidationSchema.spec.ts'
4
+ /**
5
+ * Behavioural coverage for the custom-validation Joi schemas.
6
+ *
7
+ * These tests describe what a valid custom validator looks like and what the
8
+ * schema must reject, so that future schema changes that alter validation
9
+ * behaviour fail loudly.
10
+ */
11
+ describe('formControlCustomValidatorSchema', () => {
12
+ /** A minimal, fully-valid custom validator. */
13
+ const validValidator = () => ({
14
+ id: 'validator-1',
15
+ message: 'Value must be greater than the minimum',
16
+ expression: 'amount > minimum',
17
+ canOverride: false,
18
+ inputsObservedForChanges: [
19
+ { inputId: 'amount-input', variable: 'amount' },
20
+ { inputId: 'minimum-input', variable: 'minimum' },
21
+ ],
22
+ });
23
+ it('accepts a fully-specified custom validator', () => {
24
+ const result = formControlCustomValidatorSchema.validate(validValidator());
25
+ expect(result.error).toBeUndefined();
26
+ });
27
+ it('accepts an empty list of observed inputs (a constant expression)', () => {
28
+ const validator = { ...validValidator(), inputsObservedForChanges: [] };
29
+ const result = formControlCustomValidatorSchema.validate(validator);
30
+ expect(result.error).toBeUndefined();
31
+ });
32
+ ['id', 'message', 'expression', 'canOverride', 'inputsObservedForChanges'].forEach((field) => {
33
+ it(`rejects a validator missing the required "${field}" field`, () => {
34
+ const validator = validValidator();
35
+ delete validator[field];
36
+ const result = formControlCustomValidatorSchema.validate(validator);
37
+ expect(result.error).toBeDefined();
38
+ expect(result.error?.details[0].path).toContain(field);
39
+ });
40
+ });
41
+ it('rejects a non-boolean canOverride', () => {
42
+ const validator = { ...validValidator(), canOverride: 'yes' };
43
+ const result = formControlCustomValidatorSchema.validate(validator);
44
+ expect(result.error).toBeDefined();
45
+ });
46
+ it('rejects an observed input that is missing or malformed', () => {
47
+ const validator = {
48
+ ...validValidator(),
49
+ inputsObservedForChanges: [{ inputId: 123, variable: 'amount' }],
50
+ };
51
+ const result = formControlCustomValidatorSchema.validate(validator);
52
+ expect(result.error).toBeDefined();
53
+ });
54
+ });
55
+ describe('inputsObservedForChangesSchema', () => {
56
+ it('accepts a scalar binding (inputId + variable only)', () => {
57
+ const result = inputsObservedForChangesSchema.validate({
58
+ inputId: 'amount-input',
59
+ variable: 'amount',
60
+ });
61
+ expect(result.error).toBeUndefined();
62
+ });
63
+ it('accepts a list binding with parentInputId and an aggregate function', () => {
64
+ const result = inputsObservedForChangesSchema.validate({
65
+ inputId: 'line-amount',
66
+ variable: 'lineTotal',
67
+ parentInputId: 'line-items',
68
+ function: CalculationFunctions.Sum,
69
+ });
70
+ expect(result.error).toBeUndefined();
71
+ });
72
+ it('accepts every supported aggregate function', () => {
73
+ Object.values(CalculationFunctions).forEach((fn) => {
74
+ const result = inputsObservedForChangesSchema.validate({
75
+ inputId: 'line-amount',
76
+ variable: 'lineTotal',
77
+ parentInputId: 'line-items',
78
+ function: fn,
79
+ });
80
+ expect(result.error).withContext(`function "${fn}"`).toBeUndefined();
81
+ });
82
+ });
83
+ it('rejects an unknown aggregate function', () => {
84
+ const result = inputsObservedForChangesSchema.validate({
85
+ inputId: 'line-amount',
86
+ variable: 'lineTotal',
87
+ parentInputId: 'line-items',
88
+ function: 'median',
89
+ });
90
+ expect(result.error).toBeDefined();
91
+ });
92
+ });
@@ -1,12 +1,8 @@
1
- import { TestBed } from '@angular/core/testing';
2
1
  import { AllFormInputPrimaryKeys, } from '../../interfaces/FormBuilder/index.js';
3
2
  import { ElementTypes, InputDataTypes, InputPipeTypes, InputTypes } from '../../interfaces/formInput/index.js';
4
3
  import { formColumnInputsSchema } from '../FormInputSchema.js';
5
4
  //ng test ngx-t-forms --include='projects/ngx-t-forms/src/lib/schemas/tests/FormInputValidator.spec.ts'
6
5
  describe('FormInputValidator', () => {
7
- beforeEach(() => {
8
- TestBed.configureTestingModule({});
9
- });
10
6
  it('should validate a valid form input configuration', () => {
11
7
  const validInput = {
12
8
  [AllFormInputPrimaryKeys.Element]: ElementTypes.Input,
@@ -48,7 +44,6 @@ describe('FormInputValidator', () => {
48
44
  }
49
45
  };
50
46
  const result = formColumnInputsSchema.validate(inputWithOptionals);
51
- console.warn(result, "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy");
52
47
  expect(result.error).toBeUndefined();
53
48
  });
54
49
  it('should fail validation for invalid enum values', () => {
package/package.json CHANGED
@@ -1,74 +1,83 @@
1
- {
2
- "name": "ngx-t-forms-types",
3
- "version": "0.0.20",
4
- "description": "Typings and interfaces for the ngx-t-forms library for dynamic forms.",
5
- "keywords": [
6
- "typings",
7
- "typescript"
8
- ],
9
- "homepage": "https://github.com/mashegoTerrence/ngx-t-forms-typings#readme",
10
- "bugs": {
11
- "url": "https://github.com/mashegoTerrence/ngx-t-forms-typings/issues"
12
- },
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/mashegoTerrence/ngx-t-forms-typings.git"
19
- },
20
- "license": "ISC",
21
- "author": "mashegoterrence@gmail.com",
22
- "type": "module",
23
- "main": "dist/index.js",
24
- "types": "dist/index.d.ts",
25
- "files": [
26
- "dist"
27
- ],
28
- "scripts": {
29
- "test": "karma start",
30
- "clean": "rimraf dist",
31
- "typecheck": "tsc --noEmit",
32
- "build": "npm run clean && tsc && node scripts/add-js-extensions.mjs",
33
- "build:prod": "npm run clean && tsc -p tsconfig.prod.json",
34
- "prepublishOnly": "npm run build",
35
- "dev": "npm run build --watch"
36
- },
37
- "peerDependencies": {
38
- "@angular/cdk": "^21.0.0",
39
- "@angular/common": "^21.0.0",
40
- "@angular/core": "^21.0.0",
41
- "@angular/forms": "^21.0.0",
42
- "@angular/material": "^21.0.0",
43
- "@angular/router": "^21.0.0",
44
- "moment": "^2.30.1",
45
- "ngx-ui-tour-md-menu": "^16.0.0",
46
- "rxjs": "~7.8.0"
47
- },
48
- "devDependencies": {
49
- "@angular/cdk": "^21.2.10",
50
- "@angular/common": "^21.2.12",
51
- "@angular/core": "^21.2.12",
52
- "@angular/forms": "^21.2.12",
53
- "@angular/material": "^21.2.10",
54
- "@angular/router": "^21.2.12",
55
- "@types/jasmine": "^5.1.7",
56
- "@types/joi": "^17.2.2",
57
- "@types/node": "^22.13.9",
58
- "jasmine-core": "^5.6.0",
59
- "karma": "^6.4.4",
60
- "karma-chrome-launcher": "^3.2.0",
61
- "karma-jasmine": "^5.1.0",
62
- "karma-webpack": "^5.0.1",
63
- "moment": "^2.30.1",
64
- "mongoose": "^8.23.0",
65
- "ngx-ui-tour-md-menu": "^16.0.0",
66
- "rimraf": "^6.0.1",
67
- "rxjs": "~7.8.0",
68
- "signature_pad": "^5.0.4",
69
- "ts-loader": "^9.5.2",
70
- "typescript": "^5.0.0",
71
- "webpack": "^5.98.0",
72
- "webpack-dev-server": "^5.2.0"
73
- }
74
- }
1
+ {
2
+ "name": "ngx-t-forms-types",
3
+ "version": "0.0.22",
4
+ "description": "Typings and interfaces for the ngx-t-forms library for dynamic forms.",
5
+ "keywords": [
6
+ "typings",
7
+ "typescript"
8
+ ],
9
+ "homepage": "https://github.com/mashegoTerrence/ngx-t-forms-typings#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/mashegoTerrence/ngx-t-forms-typings/issues"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/mashegoTerrence/ngx-t-forms-typings.git"
19
+ },
20
+ "license": "ISC",
21
+ "author": "mashegoterrence@gmail.com",
22
+ "type": "module",
23
+ "main": "dist/index.js",
24
+ "types": "dist/index.d.ts",
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "scripts": {
29
+ "test": "karma start karma.conf.cjs",
30
+ "clean": "rimraf dist",
31
+ "typecheck": "tsc --noEmit",
32
+ "build": "npm run clean && tsc && node scripts/add-js-extensions.mjs",
33
+ "build:prod": "npm run clean && tsc -p tsconfig.prod.json",
34
+ "prepublishOnly": "npm run build",
35
+ "dev": "npm run build --watch"
36
+ },
37
+ "dependencies": {
38
+ "joi": "^18.2.1"
39
+ },
40
+ "peerDependencies": {
41
+ "@angular/cdk": "^21.0.0",
42
+ "@angular/common": "^21.0.0",
43
+ "@angular/core": "^21.0.0",
44
+ "@angular/forms": "^21.0.0",
45
+ "@angular/material": "^21.0.0",
46
+ "@angular/router": "^21.0.0",
47
+ "mongoose": "^8.23.0",
48
+ "moment": "^2.30.1",
49
+ "ngx-ui-tour-md-menu": "^16.0.0",
50
+ "rxjs": "~7.8.0",
51
+ "signature_pad": "^5.1.3"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "mongoose": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "devDependencies": {
59
+ "@angular/cdk": "^21.2.12",
60
+ "@angular/common": "^21.2.12",
61
+ "@angular/core": "^21.2.12",
62
+ "@angular/forms": "^21.2.12",
63
+ "@angular/material": "^21.2.12",
64
+ "@angular/router": "^21.2.12",
65
+ "@types/jasmine": "^5.1.7",
66
+ "@types/node": "^22.13.9",
67
+ "jasmine-core": "^5.6.0",
68
+ "karma": "^6.4.4",
69
+ "karma-chrome-launcher": "^3.2.0",
70
+ "karma-jasmine": "^5.1.0",
71
+ "karma-webpack": "^5.0.1",
72
+ "moment": "^2.30.1",
73
+ "mongoose": "^8.23.0",
74
+ "ngx-ui-tour-md-menu": "^16.0.0",
75
+ "rimraf": "^6.0.1",
76
+ "rxjs": "~7.8.0",
77
+ "signature_pad": "^5.1.3",
78
+ "ts-loader": "^9.5.2",
79
+ "typescript": "~5.9.2",
80
+ "webpack": "^5.98.0",
81
+ "webpack-dev-server": "^5.2.0"
82
+ }
83
+ }