ngx-t-forms-types 0.0.27 → 0.0.29

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.
@@ -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
  },
@@ -818,21 +828,26 @@ export var ElementConfig = {
818
828
  id: "865658d5-6ba4-4402-952f-731cfaeefb76"
819
829
  },
820
830
  {
831
+ // The composite endpoint editor owns the WHOLE fetch slot:
832
+ // endpoint pick, query params, headers, body mapping/template
833
+ // and response mapping in one card. It replaced the seven
834
+ // per-slice rows (ApiCall, Header/Query templates, body-mode
835
+ // chip, RequiredInputs, PayloadTemplate, ApiValueAccessRules);
836
+ // those editTypes stay renderable for host-supplied custom
837
+ // editorSections. NO clearOnChange — the composite emits
838
+ // complete slot values and manages endpoint switching itself.
821
839
  name: SpecialElementKeys.Default,
822
840
  deepBind: ['matOptions', 'fetch', 'value'],
823
- editType: ElementEditorTypes.ApiCall,
841
+ editType: ElementEditorTypes.ApiEndpointConfig,
824
842
  additionalTest: [
825
843
  {
826
844
  expression: `source === ${DataSources.Api}`,
827
845
  deepBind: ['matOptions', 'fetch', 'value', 'source'],
828
846
  },
829
847
  ],
830
- clearOnChange: [
831
- ['matOptions', 'fetch', 'value'],
832
- ],
833
- hint: `Select an API endpoint from your Postman collection to fetch values. Configure headers, payload format, and response mapping as needed.`,
834
- label: 'Select API endpoint',
835
- id: "95724e64-9d5b-4260-866c-4ada95670b46"
848
+ hint: `Select the API endpoint and configure the whole request in one place: query parameters, headers, body and response mapping.`,
849
+ label: 'API endpoint',
850
+ id: "c9e2f7a4-1b58-4d03-9a6e-2f84c1b0d597"
836
851
  },
837
852
  {
838
853
  name: SpecialElementKeys.Default,
@@ -848,122 +863,6 @@ export var ElementConfig = {
848
863
  label: 'Configure MongoDB pipeline',
849
864
  id: "7b2989ae-2f54-4849-93d0-aff56ac12ef2"
850
865
  },
851
- {
852
- name: SpecialElementKeys.Default,
853
- deepBind: ['matOptions', 'fetch', 'value', 'headerTemplate'],
854
- additionalTest: [
855
- {
856
- // Headers are a transport concern — offered for GET and POST
857
- // alike, but only once an API endpoint has been selected.
858
- expression: `source === ${DataSources.Api}`,
859
- deepBind: ['matOptions', 'fetch', 'value', 'source'],
860
- },
861
- {
862
- testType: 'exists',
863
- deepBind: ['matOptions', 'fetch', 'value', 'httpEndPoint'],
864
- },
865
- ],
866
- hint: `Author the request headers as JSON. Type $ to bind a header to a live field value; every other literal is a fixed default. The fetch waits until every bound field has a value.`,
867
- editType: ElementEditorTypes.HeaderTemplate,
868
- label: 'Request headers',
869
- id: "f4b1c8d2-6e35-4a71-9f08-3c7d2b6a5e14"
870
- },
871
- {
872
- name: SpecialElementKeys.Default,
873
- deepBind: ['matOptions', 'fetch', 'value', 'backEndConfig', 'requestBodyMode'],
874
- additionalTest: [
875
- {
876
- // Only once an API endpoint is configured for the value.
877
- testType: 'exists',
878
- deepBind: ['matOptions', 'fetch', 'value'],
879
- },
880
- ],
881
- editType: ElementEditorTypes.ChipSelect,
882
- label: 'Request body configuration',
883
- hint: 'Choose how the POST body is built: map required inputs, or author a JSON payload template. Only one is used.',
884
- defaultValue: 'mappedInputs',
885
- // NO clearOnChange. Both configurations are kept side by side —
886
- // `requestBodyMode` alone decides which one the runtime uses, and the
887
- // two editors below are shown/hidden by their `additionalTest`. Clearing
888
- // here destroyed the author's work on every mode toggle, and — because
889
- // the editor emits `defaultValue` on init when the bound key is absent —
890
- // wiped `minimumInputRequired` merely on OPENING an existing POST fetch.
891
- // A fetch left with no `minimumInputRequired` key then crashed
892
- // `getAllFunctionTypes`, silently disabling the whole input.
893
- options: [
894
- { label: 'Map inputs', value: 'mappedInputs' },
895
- { label: 'JSON template', value: 'template' },
896
- ],
897
- id: "a1d2f3e4-5b6c-4d7e-8f90-1a2b3c4d5e6f"
898
- },
899
- {
900
- name: SpecialElementKeys.Default,
901
- deepBind: [
902
- 'matOptions',
903
- 'fetch',
904
- 'value',
905
- 'backEndConfig',
906
- 'minimumInputRequired',
907
- ],
908
- additionalTest: [
909
- {
910
- testType: 'exists',
911
- deepBind: [
912
- 'matOptions',
913
- 'fetch',
914
- 'value',
915
- 'backEndConfig',
916
- 'minimumInputRequired',
917
- ],
918
- },
919
- {
920
- // Hidden while the author is using a payload template instead.
921
- expression: 'requestBodyMode !== template',
922
- deepBind: ['matOptions', 'fetch', 'value', 'backEndConfig', 'requestBodyMode'],
923
- },
924
- ],
925
- hint: `These are payload fields that are required to be filled in order to fetch data from the selected source`,
926
- editType: ElementEditorTypes.RequiredInputs,
927
- label: 'Set up required inputs',
928
- id: "2d0f1e18-897b-4c28-97bc-3078be09f8ee"
929
- },
930
- {
931
- name: SpecialElementKeys.Default,
932
- deepBind: [
933
- 'matOptions',
934
- 'fetch',
935
- 'value',
936
- 'backEndConfig',
937
- 'payloadTemplate',
938
- ],
939
- additionalTest: [
940
- {
941
- // Shown only when the author has chosen template mode.
942
- expression: 'requestBodyMode === template',
943
- deepBind: ['matOptions', 'fetch', 'value', 'backEndConfig', 'requestBodyMode'],
944
- },
945
- ],
946
- hint: `Author the POST request body as JSON. Type $ to insert a field as {{inputId}}; every other literal is a fixed default. This supersedes the required-input mapping.`,
947
- editType: ElementEditorTypes.PayloadTemplate,
948
- label: 'Payload template',
949
- id: "b3f6a1c2-7d8e-4a90-8c11-2e5f0a9b7c34"
950
- },
951
- {
952
- name: SpecialElementKeys.Default,
953
- deepBind: ['matOptions', 'fetch', 'value', 'valueAccessRules'],
954
- hint: `Map the fetched data to the input value. This is useful when the fetched data is an object and you want to map a specific field to the input value.It also allow data transformation before setting the value`,
955
- fetchOptions: ['matOptions', 'fetch', 'value', '_id'],
956
- additionalTest: [
957
- {
958
- testType: 'exists',
959
- // Because only Api calls have value access rules
960
- deepBind: ['matOptions', 'fetch', 'value'],
961
- },
962
- ],
963
- editType: ElementEditorTypes.ApiValueAccessRules,
964
- label: 'Map value to fetched data',
965
- id: "26939f46-e8ed-404c-886e-2838495d56e6"
966
- },
967
866
  ]
968
867
  },
969
868
  {
@@ -1043,123 +942,20 @@ export var ElementConfig = {
1043
942
  id: "4e31a786-ec96-4b42-8156-31357958c032"
1044
943
  },
1045
944
  {
945
+ // Composite endpoint editor — see the value-slot twin above.
1046
946
  name: SpecialElementKeys.Default,
1047
947
  deepBind: ['matOptions', 'fetch', 'options'],
948
+ editType: ElementEditorTypes.ApiEndpointConfig,
1048
949
  additionalTest: [
1049
950
  {
1050
951
  expression: "source === api",
1051
952
  deepBind: ['matOptions', 'fetch', 'options', 'source'],
1052
953
  },
1053
954
  ],
1054
- editType: ElementEditorTypes.ApiCall,
1055
- label: 'Select API to fetch data from',
955
+ hint: `Select the API endpoint and configure the whole request in one place: query parameters, headers, body and response mapping.`,
956
+ label: 'API endpoint',
1056
957
  id: "df9e2a34-7bf5-411e-a265-14ca4f85166d"
1057
958
  },
1058
- {
1059
- name: SpecialElementKeys.Default,
1060
- deepBind: ['matOptions', 'fetch', 'options', 'headerTemplate'],
1061
- additionalTest: [
1062
- {
1063
- // Headers are a transport concern — offered for GET and POST
1064
- // alike, but only once an API endpoint has been selected.
1065
- expression: `source === ${DataSources.Api}`,
1066
- deepBind: ['matOptions', 'fetch', 'options', 'source'],
1067
- },
1068
- {
1069
- testType: 'exists',
1070
- deepBind: ['matOptions', 'fetch', 'options', 'httpEndPoint'],
1071
- },
1072
- ],
1073
- hint: `Author the request headers as JSON. Type $ to bind a header to a live field value; every other literal is a fixed default. The fetch waits until every bound field has a value.`,
1074
- editType: ElementEditorTypes.HeaderTemplate,
1075
- label: 'Request headers',
1076
- id: "9a5e7c30-2d84-4b16-8e5f-6b0c4d1a7f92"
1077
- },
1078
- {
1079
- name: SpecialElementKeys.Default,
1080
- deepBind: ['matOptions', 'fetch', 'options', 'backEndConfig', 'requestBodyMode'],
1081
- additionalTest: [
1082
- {
1083
- testType: 'exists',
1084
- deepBind: ['matOptions', 'fetch', 'options'],
1085
- },
1086
- ],
1087
- editType: ElementEditorTypes.ChipSelect,
1088
- label: 'Request body configuration',
1089
- hint: 'Choose how the POST body is built: map required inputs, or author a JSON payload template. Only one is used.',
1090
- defaultValue: 'mappedInputs',
1091
- // NO clearOnChange — see the value-slot twin above. This one cleared
1092
- // ['matOptions','fetch','options'], i.e. the ENTIRE options fetch config
1093
- // (endpoint, method, source and all), on the editor's init emit.
1094
- options: [
1095
- { label: 'Map required inputs', value: 'mappedInputs' },
1096
- { label: 'Payload template (JSON)', value: 'template' },
1097
- ],
1098
- id: "e2c4a6b8-1d3f-4a5b-9c7e-0f1a2b3c4d5e"
1099
- },
1100
- {
1101
- name: SpecialElementKeys.Default,
1102
- deepBind: [
1103
- 'matOptions',
1104
- 'fetch',
1105
- 'options',
1106
- 'backEndConfig',
1107
- 'minimumInputRequired',
1108
- ],
1109
- additionalTest: [
1110
- {
1111
- testType: 'exists',
1112
- deepBind: [
1113
- 'matOptions',
1114
- 'fetch',
1115
- 'options',
1116
- 'backEndConfig',
1117
- 'minimumInputRequired',
1118
- ],
1119
- },
1120
- {
1121
- expression: 'requestBodyMode !== template',
1122
- deepBind: ['matOptions', 'fetch', 'options', 'backEndConfig', 'requestBodyMode'],
1123
- },
1124
- ],
1125
- editType: ElementEditorTypes.RequiredInputs,
1126
- label: 'Set up required inputs',
1127
- id: "ce8f3b42-340d-4f3e-8d6a-13c93251173f"
1128
- },
1129
- {
1130
- name: SpecialElementKeys.Default,
1131
- deepBind: [
1132
- 'matOptions',
1133
- 'fetch',
1134
- 'options',
1135
- 'backEndConfig',
1136
- 'payloadTemplate',
1137
- ],
1138
- additionalTest: [
1139
- {
1140
- expression: 'requestBodyMode === template',
1141
- deepBind: ['matOptions', 'fetch', 'options', 'backEndConfig', 'requestBodyMode'],
1142
- },
1143
- ],
1144
- hint: `Author the POST request body as JSON. Type $ to insert a field as {{inputId}}; every other literal is a fixed default. This supersedes the required-input mapping.`,
1145
- editType: ElementEditorTypes.PayloadTemplate,
1146
- label: 'Payload template',
1147
- id: "c7a2e4d1-9b0f-4e63-a5d8-71f3b2c6e089"
1148
- },
1149
- {
1150
- name: SpecialElementKeys.Default,
1151
- deepBind: ['matOptions', 'fetch', 'options', 'valueAccessRules'],
1152
- fetchOptions: ['matOptions', 'fetch', 'options', '_id'],
1153
- additionalTest: [
1154
- {
1155
- testType: 'exists',
1156
- deepBind: ['matOptions', 'fetch', 'options'],
1157
- },
1158
- ],
1159
- editType: ElementEditorTypes.ApiValueAccessRules,
1160
- label: 'Map option value to fetched data',
1161
- id: "e24ce283-4cea-497e-b692-feeb4f3afbed"
1162
- },
1163
959
  ]
1164
960
  },
1165
961
  {
@@ -1273,6 +1069,13 @@ export var ElementConfig = {
1273
1069
  deepBind: ['validators'],
1274
1070
  id: "babd1b19-aa49-41b6-bd06-1c34ea2b9fe0"
1275
1071
  },
1072
+ {
1073
+ name: AllFormInputPrimaryKeys.ConditionalInputConfig,
1074
+ editType: ElementEditorTypes.ConditionalInputConfig,
1075
+ label: 'Conditional display',
1076
+ deepBind: ['conditionalInputConfig'],
1077
+ id: "3f2b1c74-9d6e-4a58-9b2f-27c5a1e4d803"
1078
+ },
1276
1079
  ],
1277
1080
  },
1278
1081
  ],