ngx-t-forms-types 0.0.28 → 0.0.30

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.
@@ -29,7 +29,9 @@ export declare enum FunctionTypes {
29
29
  /** Group items into buckets keyed by one or more paths. Returns a record of arrays. Terminal. */
30
30
  GroupBy = "groupBy",
31
31
  /** Aggregate items into a scalar or summary object (sum/avg/min/max/count/first/last/join). Terminal. */
32
- Reduce = "reduce"
32
+ Reduce = "reduce",
33
+ /** Add derived fields to each item via an arithmetic expression (`alias = a * b`, child aggregates, `round`). Returns an array. */
34
+ Compute = "compute"
33
35
  }
34
36
  /**
35
37
  * A single declarative array-transform step.
@@ -31,5 +31,7 @@ export var FunctionTypes;
31
31
  FunctionTypes["GroupBy"] = "groupBy";
32
32
  /** Aggregate items into a scalar or summary object (sum/avg/min/max/count/first/last/join). Terminal. */
33
33
  FunctionTypes["Reduce"] = "reduce";
34
+ /** Add derived fields to each item via an arithmetic expression (`alias = a * b`, child aggregates, `round`). Returns an array. */
35
+ FunctionTypes["Compute"] = "compute";
34
36
  // Add more function types here as needed
35
37
  })(FunctionTypes || (FunctionTypes = {}));
@@ -43,6 +43,20 @@ export declare enum ElementEditorTypes {
43
43
  HeaderTemplate = "headerTemplate",
44
44
  /** JSON query-parameter template ({@link QueryTemplate}) for a value/options fetch (GET and POST alike). */
45
45
  QueryTemplate = "queryTemplate",
46
+ /**
47
+ * Single-line text carrying `{{token}}` references, with the `$`-trigger
48
+ * picker over the form's inputs.
49
+ *
50
+ * The same gesture the JSON template editors offer — type `$`, pick a field,
51
+ * get its `{{token}}` inserted — but over plain text rather than JSON. Use it
52
+ * wherever an author writes a short string that should interpolate document
53
+ * values: an email subject, a generated title, a reference format.
54
+ *
55
+ * NOT {@link ElementEditorTypes.Input}: that renders a bare `matInput` with no
56
+ * `$` affordance at all, so an element using it cannot offer the picker no
57
+ * matter what bindings are available.
58
+ */
59
+ TokenTextInput = "tokenTextInput",
46
60
  /**
47
61
  * Composite editor owning a whole `matOptions.fetch.<slot>` API config:
48
62
  * endpoint selection, query parameters, headers, body mapping/template and
@@ -50,7 +64,17 @@ export declare enum ElementEditorTypes {
50
64
  * default config; the individual editTypes above remain renderable for
51
65
  * host-supplied custom `editorSections`.
52
66
  */
53
- ApiEndpointConfig = "apiEndpointConfig"
67
+ ApiEndpointConfig = "apiEndpointConfig",
68
+ /**
69
+ * Composite editor owning the WHOLE `mscoaConfig` object: accounting basis,
70
+ * account value label, the accrual and cash segment sets, the dual-basis
71
+ * cash-exclusion rules and the counter-account extensions.
72
+ *
73
+ * Replaced eight separate rows that each bound one key. Those keys are still
74
+ * the storage shape — only the authoring surface was unified, into a summary
75
+ * card plus a guided setup dialog.
76
+ */
77
+ MscoaConfig = "mscoaConfigSetup"
54
78
  }
55
79
  export interface ElementEditorConfigInterface {
56
80
  editorSections: Array<ElementEditorConfigSectionInterface>;
@@ -97,6 +121,36 @@ export interface ElementEditorInnerSectionElementInterface {
97
121
  label: string;
98
122
  value: any;
99
123
  }>;
124
+ /**
125
+ * Insertable entries for the `$`-trigger token picker on
126
+ * {@link ElementEditorTypes.TokenTextInput} and
127
+ * {@link ElementEditorTypes.RichTextEditor} elements.
128
+ *
129
+ * INJECTED AT RUNTIME by the host, the same way picker `options` are: the
130
+ * workflow step editor passes `formInputs: []` to `lib-t-dynamic-data-edit`
131
+ * and resolves every picker's option pool onto the element config instead
132
+ * (`ngx-t-workflows/.../workflowDiagramSelectors.ts`, `stepEditorSections$`).
133
+ * When present and non-empty this list wins over anything derived from
134
+ * `formInputs`; when absent the editor falls back to that derivation, which
135
+ * is what the form builder (which DOES pass real `formInputs`) relies on.
136
+ *
137
+ * Structurally identical to the editor components' `EditorBinding` — declared
138
+ * here rather than imported because this package cannot depend on the lib.
139
+ */
140
+ bindings?: ReadonlyArray<{
141
+ /** Human label shown in the menu — never the raw id. */
142
+ label: string;
143
+ /** Exact text inserted at the caret, e.g. `"{{contractType}}"`. */
144
+ insert: string;
145
+ /** Text matched against the `$`-filter; defaults to `label`. */
146
+ searchText?: string;
147
+ /** Optional Material icon name. */
148
+ icon?: string;
149
+ /** Muted second line (field kind, owning step). */
150
+ detail?: string;
151
+ /** Other token contents recognised as this field. */
152
+ aliases?: readonly string[];
153
+ }>;
100
154
  computedErrors?: ValidationError[];
101
155
  min?: number;
102
156
  max?: number;
@@ -37,6 +37,20 @@ export var ElementEditorTypes;
37
37
  ElementEditorTypes["HeaderTemplate"] = "headerTemplate";
38
38
  /** JSON query-parameter template ({@link QueryTemplate}) for a value/options fetch (GET and POST alike). */
39
39
  ElementEditorTypes["QueryTemplate"] = "queryTemplate";
40
+ /**
41
+ * Single-line text carrying `{{token}}` references, with the `$`-trigger
42
+ * picker over the form's inputs.
43
+ *
44
+ * The same gesture the JSON template editors offer — type `$`, pick a field,
45
+ * get its `{{token}}` inserted — but over plain text rather than JSON. Use it
46
+ * wherever an author writes a short string that should interpolate document
47
+ * values: an email subject, a generated title, a reference format.
48
+ *
49
+ * NOT {@link ElementEditorTypes.Input}: that renders a bare `matInput` with no
50
+ * `$` affordance at all, so an element using it cannot offer the picker no
51
+ * matter what bindings are available.
52
+ */
53
+ ElementEditorTypes["TokenTextInput"] = "tokenTextInput";
40
54
  /**
41
55
  * Composite editor owning a whole `matOptions.fetch.<slot>` API config:
42
56
  * endpoint selection, query parameters, headers, body mapping/template and
@@ -45,6 +59,16 @@ export var ElementEditorTypes;
45
59
  * host-supplied custom `editorSections`.
46
60
  */
47
61
  ElementEditorTypes["ApiEndpointConfig"] = "apiEndpointConfig";
62
+ /**
63
+ * Composite editor owning the WHOLE `mscoaConfig` object: accounting basis,
64
+ * account value label, the accrual and cash segment sets, the dual-basis
65
+ * cash-exclusion rules and the counter-account extensions.
66
+ *
67
+ * Replaced eight separate rows that each bound one key. Those keys are still
68
+ * the storage shape — only the authoring surface was unified, into a summary
69
+ * card plus a guided setup dialog.
70
+ */
71
+ ElementEditorTypes["MscoaConfig"] = "mscoaConfigSetup";
48
72
  })(ElementEditorTypes || (ElementEditorTypes = {}));
49
73
  // interface TStringExpressionValidationTest{
50
74
  // expression: string;
@@ -1,6 +1,6 @@
1
1
  import { DefaultInputConfig, defaultInputs } from "./DefaultEelement.js";
2
2
  import { DefaultInputConfigInterface } from "./DefaultInputConfigInterface.js";
3
- import { getElementEditorConfig } from "./inputConfig/ElementEditConfig.js";
3
+ import { getElementEditorConfig, MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS, MSCOA_DUAL_CASH_EXCLUSION_RULE_EDITOR } from "./inputConfig/ElementEditConfig.js";
4
4
  import { AllFormInputPrimaryKeys, FormInputKeys, SpecialElementKeys } from "./FormInputKeys.js";
5
5
  import { BlurHandleTypes, ConfigurationValidTestInterface, ElementEditorConfigSectionInterface, ElementEditorInnerSectionElementInterface, ElementEditorTypes } from "./elementEditor.js";
6
6
  import { IWorkflowOption } from "./workflowSelectionConfig.js";
@@ -8,4 +8,4 @@ import { FormBuilderFunctions } from "./FormBuilderCallBackFunctions.js";
8
8
  import { IGetPostmanCollections, IPostmanCollectionConfig } from "./postmanCollection.js";
9
9
  import { DataSources } from "../formInput/APIDataFetchingConfigurationInterface.js";
10
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, };
11
+ export { DefaultInputConfigInterface, BlurHandleTypes, FormInputKeys, ElementEditorTypes, ConfigurationValidTestInterface, ElementEditorInnerSectionElementInterface, SpecialElementKeys, AllFormInputPrimaryKeys, DefaultInputConfig, defaultInputs, getElementEditorConfig, MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS, MSCOA_DUAL_CASH_EXCLUSION_RULE_EDITOR, IWorkflowOption, FormBuilderFunctions, IGetPostmanCollections, IPostmanCollectionConfig, DataSources, ElementEditorConfigSectionInterface, IScoaAccount, };
@@ -1,6 +1,6 @@
1
1
  import { DefaultInputConfig, defaultInputs } from "./DefaultEelement.js";
2
- import { getElementEditorConfig } from "./inputConfig/ElementEditConfig.js";
2
+ import { getElementEditorConfig, MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS, MSCOA_DUAL_CASH_EXCLUSION_RULE_EDITOR } 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, MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS, MSCOA_DUAL_CASH_EXCLUSION_RULE_EDITOR, DataSources, };
@@ -1,3 +1,24 @@
1
- import { ElementEditorConfigInterface } from "../elementEditor.js";
1
+ import { ElementEditorConfigInterface, ElementEditorConfigSectionInterface } from "../elementEditor.js";
2
+ /**
3
+ * Fields an MSCOA account can be displayed by. Chosen once per input and used
4
+ * for every account the picker renders, so an administrator reads the same
5
+ * identifier in the chart that the account carries in the chart of accounts.
6
+ *
7
+ * Exported because the unified MSCOA setup editor renders this list itself;
8
+ * it is the option pool for the `accountValueLabel` picker.
9
+ */
10
+ export declare const MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS: Array<{
11
+ label: string;
12
+ value: string;
13
+ }>;
14
+ /**
15
+ * Per-record editor for one cash-exclusion regex rule
16
+ * (`IDualCashExclusionRule`), rendered by the unified MSCOA setup editor's
17
+ * "Cash rules" panel (Dual basis only).
18
+ *
19
+ * Exported because that editor builds the record-list element around it and
20
+ * fills the segment row's options from the input's own accrual segments.
21
+ */
22
+ export declare const MSCOA_DUAL_CASH_EXCLUSION_RULE_EDITOR: () => Array<ElementEditorConfigSectionInterface>;
2
23
  export declare var ElementConfig: ElementEditorConfigInterface;
3
24
  export declare const getElementEditorConfig: ElementEditorConfigInterface;
@@ -4,7 +4,6 @@ import { AdjudicationSteps, ElementTypes, InputDataTypes, InputPipeTypes, InputT
4
4
  import { DataSources } from "../../formInput/APIDataFetchingConfigurationInterface.js";
5
5
  import { OptionSelectTypes } from "../../formInput/BasicFormInputInterface.js";
6
6
  import { InputFileType } from "../../formInput/FileUploadInputInterface.js";
7
- import { AccountingBasis } from "../../formInput/IMscoaAccount.js";
8
7
  import { MultipleInputAvailableOperations } from "../../formInput/MultipleInterface.js";
9
8
  import { RichTextEditorType } from "../../formInput/RichTextEditorInput.js";
10
9
  import { LabelPosition } from "../../formInput/ToggleInputInterface.js";
@@ -30,20 +29,214 @@ const DOCUMENT_PICKER_FILTER_VALUE_SOURCE_LABELS = {
30
29
  input: 'From another input',
31
30
  };
32
31
  /**
32
+
33
33
  * Shows a row only while the filter is NOT input-bound.
34
+
34
35
  *
36
+
35
37
  * Deliberately written as `!== input` rather than `=== fixed`: `valueSource` is
38
+
36
39
  * absent on every filter saved before the switch existed and on a brand-new
40
+
37
41
  * record, and `testAgainstItem` resolves an absent deep-bound key to `undefined`.
42
+
38
43
  * `undefined !== 'input'` is true, so the fixed-value rows stay visible for those
44
+
39
45
  * records instead of silently becoming uneditable.
46
+
40
47
  */
41
48
  const DOCUMENT_PICKER_FILTER_IS_FIXED_TEST = `valueSource !== input`;
42
49
  /** Shows a row only once the administrator has explicitly chosen the input source. */
43
50
  const DOCUMENT_PICKER_FILTER_IS_INPUT_TEST = `valueSource === input`;
44
51
  /**
52
+ * Fields an MSCOA account can be displayed by. Chosen once per input and used
53
+ * for every account the picker renders, so an administrator reads the same
54
+ * identifier in the chart that the account carries in the chart of accounts.
55
+ *
56
+ * Exported because the unified MSCOA setup editor renders this list itself;
57
+ * it is the option pool for the `accountValueLabel` picker.
58
+ */
59
+ export const MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS = [{
60
+ "label": "SCOA ID",
61
+ "value": "SCOAid"
62
+ }, {
63
+ "label": "Full Account Number",
64
+ "value": "AccountNumber"
65
+ }, {
66
+ "label": "Account Number",
67
+ "value": "AccountNumberShortened"
68
+ }, {
69
+ "label": "Short Description",
70
+ "value": "ShortDescription"
71
+ }, {
72
+ "label": "Definition Description",
73
+ "value": "DefinitionDescription"
74
+ }, {
75
+ "label": "SCOA Account",
76
+ "value": "SCOAAccount"
77
+ }, {
78
+ "label": "Account Prefix",
79
+ "value": "AccountNumberPrefix"
80
+ }, {
81
+ "label": "Applicable To",
82
+ "value": "ApplicableTo"
83
+ }, {
84
+ "label": "BreakDown Allowed",
85
+ "value": "BreakDownAllowed"
86
+ }, {
87
+ "label": "Parent SCOA ID",
88
+ "value": "ParentSCOAId"
89
+ }, {
90
+ "label": "Posting Level",
91
+ "value": "PostingLevel"
92
+ }, {
93
+ "label": "Principle",
94
+ "value": "Principle"
95
+ }, {
96
+ "label": "SCOA File",
97
+ "value": "SCOAFile"
98
+ }, {
99
+ "label": "SCOA Level",
100
+ "value": "SCOALevel"
101
+ }, {
102
+ "label": "VAT Status",
103
+ "value": "VATStatus"
104
+ }, {
105
+ "label": "A2A",
106
+ "value": "A2A"
107
+ }, {
108
+ "label": "A4",
109
+ "value": "A4"
110
+ }, {
111
+ "label": "A4F",
112
+ "value": "A4F"
113
+ }, {
114
+ "label": "A5",
115
+ "value": "A5"
116
+ }, {
117
+ "label": "A6",
118
+ "value": "A6"
119
+ }, {
120
+ "label": "A6F",
121
+ "value": "A6F"
122
+ }, {
123
+ "label": "A7",
124
+ "value": "A7"
125
+ }, {
126
+ "label": "A8",
127
+ "value": "A8"
128
+ }, {
129
+ "label": "A9",
130
+ "value": "A9"
131
+ }, {
132
+ "label": "IUDF",
133
+ "value": "IUDF"
134
+ }, {
135
+ "label": "MTSF",
136
+ "value": "MTSF"
137
+ }, {
138
+ "label": "NATGRANT",
139
+ "value": "NATGRANT"
140
+ }, {
141
+ "label": "SA1",
142
+ "value": "SA1"
143
+ }, {
144
+ "label": "SA3",
145
+ "value": "SA3"
146
+ }, {
147
+ "label": "SA30",
148
+ "value": "SA30"
149
+ }, {
150
+ "label": "SA34A",
151
+ "value": "SA34A"
152
+ }, {
153
+ "label": "SA34B",
154
+ "value": "SA34B"
155
+ }, {
156
+ "label": "SA34C",
157
+ "value": "SA34C"
158
+ }, {
159
+ "label": "SA34D",
160
+ "value": "SA34D"
161
+ }, {
162
+ "label": "SA34E",
163
+ "value": "SA34E"
164
+ }, {
165
+ "label": "Created At",
166
+ "value": "createdAt"
167
+ }, {
168
+ "label": "Updated At",
169
+ "value": "updatedAt"
170
+ }, {
171
+ "label": "Select",
172
+ "value": "selection"
173
+ }];
174
+ /**
175
+ * Per-record editor for one cash-exclusion regex rule
176
+ * (`IDualCashExclusionRule`), rendered by the unified MSCOA setup editor's
177
+ * "Cash rules" panel (Dual basis only).
178
+ *
179
+ * Exported because that editor builds the record-list element around it and
180
+ * fills the segment row's options from the input's own accrual segments.
181
+ */
182
+ export const MSCOA_DUAL_CASH_EXCLUSION_RULE_EDITOR = () => [
183
+ {
184
+ label: 'Condition',
185
+ id: "8c4f2d1a-6b3e-4a90-b7d5-1e8a9c62f430",
186
+ elements: [
187
+ {
188
+ name: SpecialElementKeys.Default,
189
+ deepBind: ['pattern'],
190
+ editType: ElementEditorTypes.Input,
191
+ label: 'Regular expression',
192
+ required: true,
193
+ placeholder: '^Expenditure:Depreciation',
194
+ hint: `A JavaScript regular expression (without the surrounding slashes). It is tested against each selected accrual account's SCOA account value and against the configured account value label field. An invalid expression never matches, so it can never suppress cash by accident.`,
195
+ id: "3b7e9f52-0d84-4c16-a2e8-7f5c1d90b364"
196
+ },
197
+ {
198
+ name: SpecialElementKeys.Default,
199
+ deepBind: ['flags'],
200
+ editType: ElementEditorTypes.Input,
201
+ label: 'Expression flags',
202
+ placeholder: 'i',
203
+ hint: `Optional regular-expression flags, e.g. "i" for a case-insensitive match. Leave empty for an exact-case match.`,
204
+ id: "6a1c8e40-935f-4d27-b8e3-0c4d7f26a591"
205
+ },
206
+ {
207
+ name: SpecialElementKeys.Default,
208
+ deepBind: ['segment'],
209
+ editType: ElementEditorTypes.ChipSelect,
210
+ label: 'Limit to segment',
211
+ // The real option list is filled in at runtime by the MSCOA setup
212
+ // editor, which knows the input's configured accrual segments — this
213
+ // package never sees the input being edited. The single entry below is
214
+ // the fallback AND the semantic default: no scope = every segment. NO
215
+ // `defaultValue`, so opening a saved rule never stamps a scope onto it.
216
+ options: [
217
+ { label: 'Every accrual segment', value: '' },
218
+ ],
219
+ hint: `Optional. When set, the expression is only tested against the accounts selected for that accrual segment. Leave it on 'Every accrual segment' to test them all. Only segments you have configured under 'Configure MScoa Accrual segments' can be chosen — a scope that no longer exists can never match.`,
220
+ id: "e5d20b73-4816-4f9a-8c62-9b3a5e14d087"
221
+ },
222
+ {
223
+ name: SpecialElementKeys.Default,
224
+ deepBind: ['description'],
225
+ editType: ElementEditorTypes.Input,
226
+ label: 'Description',
227
+ placeholder: 'Non-cash items never require a cash leg',
228
+ hint: `Optional note explaining the business intent of this condition.`,
229
+ id: "1f6b4c92-7a05-4e38-9d17-c8e2a0b5f643"
230
+ },
231
+ ],
232
+ },
233
+ ];
234
+ /**
235
+
45
236
  * Per-record editor for one preset filter (`IDocumentPickerFilter`) inside the
237
+
46
238
  * document picker's "Preset filters" list.
239
+
47
240
  */
48
241
  const DOCUMENT_PICKER_FILTER_EDITOR = () => [
49
242
  {
@@ -344,203 +537,20 @@ export var ElementConfig = {
344
537
  },
345
538
  {
346
539
  name: AllFormInputPrimaryKeys.MscoaConfig,
347
- deepBind: ['mscoaConfig', 'accountingBasis'],
348
- editType: ElementEditorTypes.ChipSelect,
349
- label: 'Select Budget Accounting Basis',
350
- options: [
351
- {
352
- label: 'Performance (Accrual)',
353
- value: AccountingBasis.Accrual
354
- },
355
- {
356
- label: 'Liquidity (Cash)',
357
- value: AccountingBasis.Cash
358
- },
359
- {
360
- label: 'Dual (Both)',
361
- value: AccountingBasis.Dual
362
- }
363
- ],
364
- clearOnChange: [
365
- [AllFormInputPrimaryKeys.MscoaConfig, 'segments'],
366
- [AllFormInputPrimaryKeys.MscoaConfig, 'cashSegments'],
367
- [AllFormInputPrimaryKeys.MscoaConfig, 'showAllSegments']
368
- ],
369
- hint: "This choice dictates when funds are recognized: 'Accrual' impacts budgets based on commitments and invoices; 'Cash' restricts budget impact to actual bank movements; 'Dual' tracks both simultaneously for comprehensive reporting.",
370
- id: "d9ea60b9-653f-4d9c-88bd-f603a589cce0"
371
- },
372
- {
373
- name: AllFormInputPrimaryKeys.MscoaConfig,
374
- deepBind: ['mscoaConfig', 'accountValueLabel'],
375
- editType: ElementEditorTypes.ChipSelect,
376
- label: 'Account value label',
377
- hint: "Defines the label used to represent account values within the SCOA input, enhancing clarity in financial selections.",
378
- id: "1f29ce07-4f68-49d8-bb81-b1ab0fc08455",
379
- options: [{
380
- "label": "SCOA ID",
381
- "value": "SCOAid"
382
- }, {
383
- "label": "Full Account Number",
384
- "value": "AccountNumber"
385
- }, {
386
- "label": "Account Number",
387
- "value": "AccountNumberShortened"
388
- }, {
389
- "label": "Short Description",
390
- "value": "ShortDescription"
391
- }, {
392
- "label": "Definition Description",
393
- "value": "DefinitionDescription"
394
- }, {
395
- "label": "SCOA Account",
396
- "value": "SCOAAccount"
397
- }, {
398
- "label": "Account Prefix",
399
- "value": "AccountNumberPrefix"
400
- }, {
401
- "label": "Applicable To",
402
- "value": "ApplicableTo"
403
- }, {
404
- "label": "BreakDown Allowed",
405
- "value": "BreakDownAllowed"
406
- }, {
407
- "label": "Parent SCOA ID",
408
- "value": "ParentSCOAId"
409
- }, {
410
- "label": "Posting Level",
411
- "value": "PostingLevel"
412
- }, {
413
- "label": "Principle",
414
- "value": "Principle"
415
- }, {
416
- "label": "SCOA File",
417
- "value": "SCOAFile"
418
- }, {
419
- "label": "SCOA Level",
420
- "value": "SCOALevel"
421
- }, {
422
- "label": "VAT Status",
423
- "value": "VATStatus"
424
- }, {
425
- "label": "A2A",
426
- "value": "A2A"
427
- }, {
428
- "label": "A4",
429
- "value": "A4"
430
- }, {
431
- "label": "A4F",
432
- "value": "A4F"
433
- }, {
434
- "label": "A5",
435
- "value": "A5"
436
- }, {
437
- "label": "A6",
438
- "value": "A6"
439
- }, {
440
- "label": "A6F",
441
- "value": "A6F"
442
- }, {
443
- "label": "A7",
444
- "value": "A7"
445
- }, {
446
- "label": "A8",
447
- "value": "A8"
448
- }, {
449
- "label": "A9",
450
- "value": "A9"
451
- }, {
452
- "label": "IUDF",
453
- "value": "IUDF"
454
- }, {
455
- "label": "MTSF",
456
- "value": "MTSF"
457
- }, {
458
- "label": "NATGRANT",
459
- "value": "NATGRANT"
460
- }, {
461
- "label": "SA1",
462
- "value": "SA1"
463
- }, {
464
- "label": "SA3",
465
- "value": "SA3"
466
- }, {
467
- "label": "SA30",
468
- "value": "SA30"
469
- }, {
470
- "label": "SA34A",
471
- "value": "SA34A"
472
- }, {
473
- "label": "SA34B",
474
- "value": "SA34B"
475
- }, {
476
- "label": "SA34C",
477
- "value": "SA34C"
478
- }, {
479
- "label": "SA34D",
480
- "value": "SA34D"
481
- }, {
482
- "label": "SA34E",
483
- "value": "SA34E"
484
- }, {
485
- "label": "Created At",
486
- "value": "createdAt"
487
- }, {
488
- "label": "Updated At",
489
- "value": "updatedAt"
490
- }, {
491
- "label": "Select",
492
- "value": "selection"
493
- }]
494
- },
495
- {
496
- name: AllFormInputPrimaryKeys.MscoaConfig,
497
- editType: ElementEditorTypes.Toggle,
498
- label: 'Allow selection of all SCOA segments',
499
- deepBind: ['mscoaConfig', 'showAllSegments'],
500
- clearOnChange: [
501
- [AllFormInputPrimaryKeys.MscoaConfig, 'segments'],
502
- [AllFormInputPrimaryKeys.MscoaConfig, 'cashSegments'],
503
- ],
504
- hint: 'When enabled, allows selection from all Standard Chart of Accounts (SCOA) segments. Disable to limit available segments.',
505
- id: "0f78efcc-5477-4202-916a-8a7cf459c017"
506
- },
507
- {
508
- name: AllFormInputPrimaryKeys.MscoaConfig,
509
- deepBind: ['mscoaConfig', 'segments'],
510
- editType: ElementEditorTypes.ConfigMscoaSegments,
511
- label: 'Configure MScoa Accrual segments',
512
- defaultValue: false,
513
- fetchOptions: ['mscoaConfig', 'showAllSegments'],
514
- hint: "Configure SCOA segments to be used in the input",
515
- id: "ba1a5b79-b071-44a6-b39a-bf1c2fafcda5"
516
- },
517
- {
518
- name: AllFormInputPrimaryKeys.MscoaConfig,
519
- deepBind: ['mscoaConfig', 'cashSegments'],
520
- editType: ElementEditorTypes.ConfigMscoaSegments,
521
- label: 'Configure MScoa Cash segments',
522
- fetchOptions: ['mscoaConfig', 'showAllSegments'],
523
- additionalTest: [
524
- {
525
- // Show the cash-segments editor ONLY for an explicit Cash/Dual basis.
526
- // A positive whitelist (not `!== Accrual`) also hides it for the
527
- // unset/`undefined` default of a freshly-added input — `!== Accrual`
528
- // is true for `undefined`, which left it always visible.
529
- expression: `accountingBasis === ${AccountingBasis.Cash} || accountingBasis === ${AccountingBasis.Dual}`,
530
- deepBind: ['mscoaConfig', 'accountingBasis'],
531
- },
532
- ],
533
- hint: "Configure SCOA segments to be When mapping the Cash accounts",
534
- id: "f1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b"
535
- },
536
- {
537
- name: AllFormInputPrimaryKeys.MscoaConfig,
538
- deepBind: ['mscoaConfig', 'extensionAccountsForSegments'],
539
- editType: ElementEditorTypes.ChipOptionsCreator,
540
- label: 'Additional account selection options',
541
- fetchOptions: ['mscoaConfig'],
542
- hint: "Config scoa segments counter account options for segments",
543
- id: "634b3c1a-f250-4b1a-8771-999b34882515"
540
+ deepBind: ['mscoaConfig'],
541
+ editType: ElementEditorTypes.MscoaConfig,
542
+ label: 'MSCOA account setup',
543
+ hint: `Everything this account picker asks the user for: which accounting basis it captures, the SCOA segments they pick from, how each account is labelled, and — for a dual basis — when the cash side is actually required. Opens a guided setup.`,
544
+ // The whole `mscoaConfig` object is edited by one composite editor
545
+ // (`ElementEditorTypes.MscoaConfig`), which replaced eight separate rows:
546
+ // accountingBasis, accountValueLabel, showAllSegments, segments,
547
+ // cashSegments, dualCashExclusion.rules, dualCashExclusion.matchMode and
548
+ // extensionAccountsForSegments. Clearing dependent keys when the basis
549
+ // changes is owned by that editor now, not by `clearOnChange` — the row no
550
+ // longer binds a single key, so a path-based clear has nothing to key off.
551
+ options: MSCOA_ACCOUNT_VALUE_LABEL_OPTIONS,
552
+ secondaryElementEditorConfig: MSCOA_DUAL_CASH_EXCLUSION_RULE_EDITOR(),
553
+ id: "0b6f3a91-8c47-4d52-9e3a-7f10c4b28d65"
544
554
  },
545
555
  // {
546
556
  // name: AllFormInputPrimaryKeys.MscoaConfig,
@@ -668,8 +678,8 @@ export var ElementConfig = {
668
678
  }
669
679
  ],
670
680
  label: 'Adjudication point types',
671
- hint: `Configure adjudication point types for this input.
672
- This allows grouping or filtering points based on specific criteria, such as 'Functional', 'Financial'.
681
+ hint: `Configure adjudication point types for this input.
682
+ This allows grouping or filtering points based on specific criteria, such as 'Functional', 'Financial'.
673
683
  .`,
674
684
  id: "88e9e85c-66d8-4df3-9742-eba1f7e47a01"
675
685
  },
@@ -684,8 +694,8 @@ export var ElementConfig = {
684
694
  }
685
695
  ],
686
696
  label: 'Submission review Notes template',
687
- hint: `
688
- This helps the adjudicator to provide feedback on the submission. Add $bidderName, $bidderCode, $responseDate, $responsePreferenceCalculation to the template to dynamically insert values.
697
+ hint: `
698
+ This helps the adjudicator to provide feedback on the submission. Add $bidderName, $bidderCode, $responseDate, $responsePreferenceCalculation to the template to dynamically insert values.
689
699
  .`,
690
700
  id: "3907f723-b62b-4387-8f8f-133481ada45b"
691
701
  },
@@ -108,5 +108,16 @@ export interface IStoreFunctions {
108
108
  columnMapping: AdjResponseReviewColumnMapping;
109
109
  scoreSheet?: WorkflowAdjudicationScoreSheetValue[];
110
110
  adjudicationPricePreferenceCalculationFormula?: string;
111
+ /**
112
+ * "Rand value" of the procurement per PPR 2022 reg 1: the total
113
+ * estimated value of the contract in Rand, calculated at the time of
114
+ * the tender invitation (all applicable taxes included). Used by the
115
+ * library to auto-select the 80/20 vs 90/10 preference point system
116
+ * (≤ R50 million → 80/20; > R50 million → 90/10, regs 4(1)/5(1)) and
117
+ * as a reference for abnormally-low-tender flagging. Optional: when
118
+ * absent, the system is selected from the lowest acceptable tender
119
+ * received, per reg 3(b).
120
+ */
121
+ estimatedProcurementValue?: number;
111
122
  }>;
112
123
  }
@@ -121,6 +121,51 @@ export interface IIncludedSegmentConfig {
121
121
  segmentExtension: boolean;
122
122
  id: string;
123
123
  }
124
+ /**
125
+ * How the {@link IDualCashExclusionConfig.rules} combine into one verdict.
126
+ * - `'any'`: cash is suppressed when AT LEAST ONE rule matches (default).
127
+ * - `'all'`: cash is suppressed only when EVERY rule matches.
128
+ */
129
+ export type DualCashExclusionMatchMode = 'any' | 'all';
130
+ /**
131
+ * One regex condition evaluated against the selected ACCRUAL account values of
132
+ * a Dual-basis MSCOA input. A rule "matches" when its pattern matches at least
133
+ * one selected accrual account value in its segment scope.
134
+ *
135
+ * The pattern is tested against the account's `SCOAAccount` value AND the value
136
+ * of the field named by {@link IScoaInputConfig.accountValueLabel} (what the
137
+ * user sees selected in the chart). An invalid pattern never matches — it can
138
+ * therefore never suppress the cash requirement by accident.
139
+ */
140
+ export interface IDualCashExclusionRule {
141
+ /** Stable record id (stamped by the builder's record-list editor). */
142
+ id?: string;
143
+ /** JavaScript regular-expression source, without delimiters (e.g. `^1[0-9]{3}`). */
144
+ pattern: string;
145
+ /** Optional regex flags (e.g. `i`). Invalid flags make the rule evaluate as not matched. */
146
+ flags?: string;
147
+ /**
148
+ * Optional segment scope (matched case-insensitively against the accrual
149
+ * segment key, e.g. `ITEM`). Empty/absent = every accrual segment.
150
+ */
151
+ segment?: string;
152
+ /** Admin note describing the business intent of the rule. */
153
+ description?: string;
154
+ }
155
+ /**
156
+ * Dual-basis-only refinement of the "both bases required" rule. When the rules
157
+ * evaluate to a match (per {@link DualCashExclusionMatchMode}) against the
158
+ * selected accrual accounts, the cash side is suppressed: the cash table is
159
+ * hidden, cash account values are cleared from the input value, and validation
160
+ * requires the accrual side only. With no (usable) rules configured, the
161
+ * default Dual behaviour — cash AND accrual both required — is enforced.
162
+ */
163
+ export interface IDualCashExclusionConfig {
164
+ /** Regex conditions evaluated against the selected accrual account values. */
165
+ rules?: IDualCashExclusionRule[];
166
+ /** How the rules combine; defaults to `'any'` when absent. */
167
+ matchMode?: DualCashExclusionMatchMode;
168
+ }
124
169
  export interface IScoaInputConfig {
125
170
  inputs: ScoaInnerInput[];
126
171
  label: string;
@@ -131,6 +176,12 @@ export interface IScoaInputConfig {
131
176
  cashSegments: IIncludedSegmentConfig[] | undefined;
132
177
  accountValueLabel: string;
133
178
  showAllSegments: boolean;
179
+ /**
180
+ * Optional Dual-basis refinement: regex conditions under which the cash side
181
+ * is NOT required (see {@link IDualCashExclusionConfig}). Ignored for
182
+ * non-Dual accounting bases.
183
+ */
184
+ dualCashExclusion?: IDualCashExclusionConfig;
134
185
  }
135
186
  export interface IGetTreeResponse {
136
187
  message: string;
@@ -13,6 +13,17 @@ export interface AdjResponseReviewColumnMapping {
13
13
  respondentCodeKey: string;
14
14
  responsePreferenceCalculationKey?: string;
15
15
  responseDateKey?: string;
16
+ /**
17
+ * Form key on each submission row holding the tendered price ("price" per
18
+ * PPR 2022 reg 1: all applicable taxes included, less unconditional
19
+ * discounts). When present, the library's submission-review step computes
20
+ * the PPPFA price preference points itself (organically, per the
21
+ * Preferential Procurement Regulations 2022, regs 3–5) instead of relying
22
+ * on host-stamped scores. Falls back to `'totalBidPrice'` when omitted;
23
+ * if no row carries a usable price under that key either, the library
24
+ * keeps whatever score the host stamped onto the rows.
25
+ */
26
+ responsePriceKey?: string;
16
27
  }
17
28
  export interface WorkflowAdjudicationMicroFlowReviewValue {
18
29
  id: string;
@@ -9,7 +9,7 @@ import { AllDocumentFileExtensions, AllImageFileExtensions, FileUploadInputValue
9
9
  import { DraftFormControlCustomValidator, FormControlCustomValidatorsInterface, InputObservedForChange } from "./FormControlCustomValidatorsInterface.js";
10
10
  import { IFormValidationOverride } from "./FormValidationOverride.js";
11
11
  import { FormInputBasicOptionInterface } from "./FormInputBasicOptionInterface.js";
12
- import { AccountingBasis, IAccountSegmentTreeKeys, IGetTreeResponse, IIncludedSegmentConfig, IScoaAccount, IScoaInput, IScoaInputConfig, ITableScoaSelectionRow, ScoaAccountTree, ScoaInterface, ScoaSegmentValue, ScoaSegmentValueBag } from "./IMscoaAccount.js";
12
+ import { AccountingBasis, DualCashExclusionMatchMode, IAccountSegmentTreeKeys, IDualCashExclusionConfig, IDualCashExclusionRule, IGetTreeResponse, IIncludedSegmentConfig, IScoaAccount, IScoaInput, IScoaInputConfig, ITableScoaSelectionRow, ScoaAccountTree, ScoaInterface, ScoaSegmentValue, ScoaSegmentValueBag } from "./IMscoaAccount.js";
13
13
  import { ISelectInputInterface } from "./ISelectInputInterface.js";
14
14
  import { MatDataOptionsInterface } from "./MatDataOptionsInterface.js";
15
15
  import { IMatrixInput } from "./MatrixInputInterface.js";
@@ -26,4 +26,4 @@ import { CalculationFunctions, calculationVariableInterface } from "./calculatio
26
26
  import { IRichTextEditor, RichTextEditorType } from "./RichTextEditorInput.js";
27
27
  import { ValidationError, ValidationOptions } from "./schema.js";
28
28
  import { IUserSignature } from "./userSignature.js";
29
- export { ElementTypes, InputTypes, InputPipeTypes, AutocapitalizeOptions, AutocompleteOptions, InputDataTypes, MinInputTypes, IFormElementTemplate, IBasicFormInput, IFileUploadInput, ConditionalInputRule, IDateRangePickerInput, ITextareaProperties, IToggleInput, IMatrixInput, IMultiple, IMultipleInputCal, IScoaInput, TableConfigurationsInterface, TableColumnConfigInterface, FormControlCustomValidatorsInterface, InputObservedForChange, DraftFormControlCustomValidator, IFormValidationOverride, MinimumInputRequiredInterface, MinInputMapInput, CalculatedFieldRules, calculationVariableInterface, APIDataFetchingConfigurationInterface, PayloadTemplate, PayloadTemplateValue, RequestBodyMode, HeaderTemplate, HeaderTemplateValue, QueryTemplate, QueryTemplateValue, 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, IWorkflowDocumentStepFilter, IDocumentPickerFilter, IDocumentPage, IDocumentQueryRequest, IDocumentReference, DocumentPickerFilterOperator, DocumentPickerFilterValueSource, DocumentPickerFilterValueType, DOCUMENT_PICKER_FILTER_OPERATORS, DOCUMENT_PICKER_FILTER_VALUE_SOURCES, DOCUMENT_PICKER_FILTER_VALUE_TYPES, workflowStepStatus, IWorkflowDocListCols, IWorkflowStepOption, JsDataTypes, AdjudicationSteps, IWorkflowAdjudicationInput, WorkflowAdjudicationScoreSheetValue, WorkflowAdjudicationMicroFlowReviewValue, WorkflowAdjudicationResponseElectedSupplierSelectionValue, ScoreSheetItem, AdjResponseReviewColumnMapping, OptionSelectTypes, ISelectInputInterface, MultipleInputAvailableOperations, RichTextEditorType, IRichTextEditor, };
29
+ export { ElementTypes, InputTypes, InputPipeTypes, AutocapitalizeOptions, AutocompleteOptions, InputDataTypes, MinInputTypes, IFormElementTemplate, IBasicFormInput, IFileUploadInput, ConditionalInputRule, IDateRangePickerInput, ITextareaProperties, IToggleInput, IMatrixInput, IMultiple, IMultipleInputCal, IScoaInput, TableConfigurationsInterface, TableColumnConfigInterface, FormControlCustomValidatorsInterface, InputObservedForChange, DraftFormControlCustomValidator, IFormValidationOverride, MinimumInputRequiredInterface, MinInputMapInput, CalculatedFieldRules, calculationVariableInterface, APIDataFetchingConfigurationInterface, PayloadTemplate, PayloadTemplateValue, RequestBodyMode, HeaderTemplate, HeaderTemplateValue, QueryTemplate, QueryTemplateValue, IGetTreeResponse, CalculationFunctions, TreeNode, IPostmanCollection, IFolderItem, FileUploadInputValueInterface, AllDocumentFileExtensions, AllImageFileExtensions, UploadTypes, InputFileType, IScoaAccount, IScoaInputConfig, ITableScoaSelectionRow, ScoaSegmentValue, ScoaSegmentValueBag, IIncludedSegmentConfig, AccountingBasis, DualCashExclusionMatchMode, IDualCashExclusionConfig, IDualCashExclusionRule, ScoaAccountTree, IUserSignature, ValidationOptions, ValidationError, MatDataOptionsInterface, MongoDbPipeLineConfigInterface, InputAPIDataId, FormInputBasicOptionInterface, ScoaInterface, ScoaInnerInput, IAccountSegmentTreeKeys, IWorkflowDocumentPicker, IWorkflowDocumentPickerConfig, IWorkflowDocumentStepFilter, IDocumentPickerFilter, IDocumentPage, IDocumentQueryRequest, IDocumentReference, DocumentPickerFilterOperator, DocumentPickerFilterValueSource, DocumentPickerFilterValueType, DOCUMENT_PICKER_FILTER_OPERATORS, DOCUMENT_PICKER_FILTER_VALUE_SOURCES, DOCUMENT_PICKER_FILTER_VALUE_TYPES, workflowStepStatus, IWorkflowDocListCols, IWorkflowStepOption, JsDataTypes, AdjudicationSteps, IWorkflowAdjudicationInput, WorkflowAdjudicationScoreSheetValue, WorkflowAdjudicationMicroFlowReviewValue, WorkflowAdjudicationResponseElectedSupplierSelectionValue, ScoreSheetItem, AdjResponseReviewColumnMapping, OptionSelectTypes, ISelectInputInterface, MultipleInputAvailableOperations, RichTextEditorType, IRichTextEditor, };
@@ -1,5 +1,7 @@
1
1
  import Joi from 'joi';
2
2
  export declare const IncludedSegmentConfigSchema: Joi.ObjectSchema<any>;
3
+ export declare const DualCashExclusionRuleSchema: Joi.ObjectSchema<any>;
4
+ export declare const DualCashExclusionConfigSchema: Joi.ObjectSchema<any>;
3
5
  export declare const MscoaInputConfigSchema: Joi.ObjectSchema<any>;
4
6
  export declare function validateMscoaInputConfig(value: any): {
5
7
  error: Joi.ValidationError | undefined;
@@ -12,6 +12,17 @@ export const IncludedSegmentConfigSchema = Joi.object({
12
12
  segmentExtension: Joi.boolean().required(),
13
13
  id: Joi.string().required()
14
14
  });
15
+ export const DualCashExclusionRuleSchema = Joi.object({
16
+ id: Joi.string().optional(),
17
+ pattern: Joi.string().required(),
18
+ flags: Joi.string().allow('').optional(),
19
+ segment: Joi.string().allow('').optional(),
20
+ description: Joi.string().allow('').optional()
21
+ });
22
+ export const DualCashExclusionConfigSchema = Joi.object({
23
+ rules: Joi.array().items(DualCashExclusionRuleSchema).optional(),
24
+ matchMode: Joi.string().valid('any', 'all').optional()
25
+ });
15
26
  export const MscoaInputConfigSchema = Joi.object({
16
27
  inputs: Joi.array().items(Joi.object().pattern(/./, Joi.any())).required(),
17
28
  segments: Joi.array().items(IncludedSegmentConfigSchema).min(1).required(),
@@ -19,7 +30,8 @@ export const MscoaInputConfigSchema = Joi.object({
19
30
  accountValueLabel: Joi.string().required(),
20
31
  accountingBasis: Joi.string().valid(...Object.values(AccountingBasis)).optional(),
21
32
  extensionAccountsForSegments: Joi.array().items(Joi.string()).optional(),
22
- showAllSegments: Joi.boolean().required()
33
+ showAllSegments: Joi.boolean().required(),
34
+ dualCashExclusion: DualCashExclusionConfigSchema.optional()
23
35
  });
24
36
  export function validateMscoaInputConfig(value) {
25
37
  const { error, value: validatedValue } = MscoaInputConfigSchema.validate(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-t-forms-types",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Typings and interfaces for the ngx-t-forms library for dynamic forms.",
5
5
  "keywords": [
6
6
  "typings",