ngx-t-forms-types 0.0.35 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interfaces/Form/formInterface.d.ts +18 -0
- package/dist/interfaces/Form/index.d.ts +2 -2
- package/dist/interfaces/FormBuilder/DefaultEelement.js +2 -2
- package/dist/interfaces/FormBuilder/FormInputKeys.d.ts +2 -0
- package/dist/interfaces/FormBuilder/FormInputKeys.js +2 -0
- package/dist/interfaces/FormBuilder/elementEditor.d.ts +8 -0
- package/dist/interfaces/FormBuilder/elementEditor.js +8 -0
- package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.js +25 -3
- package/dist/interfaces/Import/ImportIdentity.d.ts +132 -1
- package/dist/interfaces/Import/ImportRecipe.d.ts +423 -0
- package/dist/interfaces/Import/ImportRecipe.js +19 -0
- package/dist/interfaces/Import/ImportRowState.d.ts +84 -7
- package/dist/interfaces/Import/index.d.ts +4 -2
- package/dist/interfaces/Import/index.js +1 -1
- package/dist/interfaces/Tower/ITowerFormSteps.d.ts +19 -0
- package/dist/interfaces/Tower/index.d.ts +2 -1
- package/dist/interfaces/environment/IStoreFunctions.d.ts +42 -2
- package/dist/interfaces/environment/environment.d.ts +203 -0
- package/dist/interfaces/environment/environment.js +12 -1
- package/dist/interfaces/environment/index.d.ts +2 -2
- package/dist/interfaces/environment/index.js +2 -1
- package/dist/interfaces/formInput/APIDataFetchingConfigurationInterface.d.ts +10 -2
- package/dist/interfaces/formInput/BasicFormInputInterface.d.ts +15 -0
- package/dist/interfaces/formInput/MinimumInputRequiredInterface.d.ts +14 -0
- package/dist/interfaces/formInput/MinimumInputRequiredInterface.js +14 -0
- package/dist/interfaces/formInput/calculatedFieldRules.d.ts +31 -1
- package/dist/interfaces/formInput/calculatedFieldRules.js +16 -1
- package/dist/interfaces/formInput/index.d.ts +2 -2
- package/dist/interfaces/formInput/index.js +2 -1
- package/dist/interfaces/workflow/DocumentSectionConfigurationsInterface.d.ts +22 -1
- package/dist/interfaces/workflow/DocumentSectionConfigurationsInterface.js +6 -0
- package/dist/interfaces/workflow/index.d.ts +2 -2
- package/dist/schemas/CalculatedFieldRulesSchema.js +2 -1
- package/dist/schemas/FormInputSchema.js +9 -1
- package/dist/schemas/FormSchema.d.ts +35 -0
- package/dist/schemas/FormSchema.js +57 -0
- package/dist/schemas/index.d.ts +3 -2
- package/dist/schemas/index.js +2 -2
- package/dist/schemas/tests/FormInputValidator.spec.js +27 -0
- package/dist/skillet/extra-members.d.ts +1 -1
- package/dist/skillet/input-members.d.ts +2 -2
- package/dist/skillet/input-members.js +2 -1
- package/dist/skillet/members/calculated-field.d.ts +4 -4
- package/dist/skillet/members/calculated-field.js +6 -5
- package/dist/skillet/members/table.d.ts +1 -1
- package/dist/skillet/shared-types.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,39 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
1
2
|
import { IStoreFunctions } from "./IStoreFunctions.js";
|
|
2
3
|
import { Moment } from 'moment';
|
|
3
4
|
import type { FormSubmissionHandleInterface } from "../Form/formSubmissionHandleInterface.js";
|
|
5
|
+
import type { RoundingMode } from "../formInput/calculatedFieldRules.js";
|
|
6
|
+
/**
|
|
7
|
+
* Anything that yields a JavaScript `Date` — a Moment, a Day.js instance, or any
|
|
8
|
+
* object with a `toDate()` method. The library calls `toDate()` once and keeps
|
|
9
|
+
* the `Date` it returns; an invalid date (`NaN` time) counts as no value.
|
|
10
|
+
*/
|
|
11
|
+
export interface DateLike {
|
|
12
|
+
toDate(): Date;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One value the application injects as a system input. Only scalars and dates:
|
|
16
|
+
* a system input is a form control the engine renders, so there is nothing a
|
|
17
|
+
* nested object or an array could become. `null` and `undefined` mean "no value"
|
|
18
|
+
* and the input is not injected at all.
|
|
19
|
+
*/
|
|
20
|
+
export type GlobalVariableValue = string | number | boolean | Date | DateLike | null | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Values the application injects into every form as read-only system inputs,
|
|
23
|
+
* keyed by control name. See `IStoreFunctions.getGlobalVariables` for the rules
|
|
24
|
+
* the keys and values follow and for how each entry becomes an input.
|
|
25
|
+
*/
|
|
26
|
+
export type GlobalVariables = Readonly<Record<string, GlobalVariableValue>>;
|
|
27
|
+
/**
|
|
28
|
+
* The financial-cycle variables the first consuming application injects.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated Since the `getGlobalVariables` contract the library no longer
|
|
31
|
+
* reads these keys by name: they are ordinary global variables like any other,
|
|
32
|
+
* and this shape is kept only so an application that still builds its
|
|
33
|
+
* financial-cycle bundle can type it. It is assignable to `GlobalVariables`
|
|
34
|
+
* (a `Moment` is a `DateLike`), so `getGlobalVariables` may return it as-is or
|
|
35
|
+
* spread it together with any other variables.
|
|
36
|
+
*/
|
|
4
37
|
export interface IFinancialCycles {
|
|
5
38
|
CURRENT_FINANCIAL_CYCLE: string;
|
|
6
39
|
CURRENT_FINANCIAL_CYCLE_START_DATE: Moment;
|
|
@@ -14,6 +47,121 @@ export interface IFinancialCycles {
|
|
|
14
47
|
PREVIOUS_FINANCIAL_CYCLE_START_DATE: Moment;
|
|
15
48
|
PREVIOUS_FINANCIAL_CYCLE_END_DATE: Moment;
|
|
16
49
|
}
|
|
50
|
+
/** Days a calendar week may start on, named the way the organisation schema names them. */
|
|
51
|
+
export declare const FORMS_WEEK_DAYS: readonly ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
52
|
+
/** One of {@link FORMS_WEEK_DAYS}. */
|
|
53
|
+
export type FormsWeekDay = (typeof FORMS_WEEK_DAYS)[number];
|
|
54
|
+
/**
|
|
55
|
+
* How a plain date is written wherever the library prints one — a table cell, a
|
|
56
|
+
* document-picker column, a printout, the calendar input. `locale` keeps each
|
|
57
|
+
* surface's own locale-appropriate default; the patterns are Angular date formats.
|
|
58
|
+
*/
|
|
59
|
+
export declare const FORMS_DATE_FORMATS: readonly ["locale", "dd/MM/yyyy", "MM/dd/yyyy", "yyyy-MM-dd", "d MMM yyyy"];
|
|
60
|
+
/** One of {@link FORMS_DATE_FORMATS}. */
|
|
61
|
+
export type FormsDateFormat = (typeof FORMS_DATE_FORMATS)[number];
|
|
62
|
+
/** The clock a time of day is written in. `locale` lets the locale decide. */
|
|
63
|
+
export declare const FORMS_TIME_FORMATS: readonly ["locale", "24h", "12h"];
|
|
64
|
+
/** One of {@link FORMS_TIME_FORMATS}. */
|
|
65
|
+
export type FormsTimeFormat = (typeof FORMS_TIME_FORMATS)[number];
|
|
66
|
+
/** How a currency is named next to an amount: its symbol (`R`), the narrow symbol, or the code (`ZAR`). */
|
|
67
|
+
export declare const FORMS_CURRENCY_DISPLAYS: readonly ["symbol", "narrowSymbol", "code"];
|
|
68
|
+
/** One of {@link FORMS_CURRENCY_DISPLAYS}. */
|
|
69
|
+
export type FormsCurrencyDisplay = (typeof FORMS_CURRENCY_DISPLAYS)[number];
|
|
70
|
+
/** Money, as the consuming application keeps it. See {@link NgxTFormsLocalization.currency}. */
|
|
71
|
+
export interface NgxTFormsCurrencyLocalization {
|
|
72
|
+
/**
|
|
73
|
+
* ISO 4217 code, upper case, e.g. `ZAR`. The builder writes it into `pipe.param`
|
|
74
|
+
* the moment an author sets a number's format to currency (the form schema
|
|
75
|
+
* requires a code), so the column is in the organisation's money without a
|
|
76
|
+
* further pick; the author can still choose another currency. It is also the
|
|
77
|
+
* code every amount is formatted in when a stored column names none. Default `ZAR`.
|
|
78
|
+
*/
|
|
79
|
+
code?: string;
|
|
80
|
+
/** How the currency is written next to the amount. Default `symbol`. */
|
|
81
|
+
display?: FormsCurrencyDisplay;
|
|
82
|
+
/**
|
|
83
|
+
* Fraction digits amounts in `code` are kept and shown at, 0–4. Unset → the
|
|
84
|
+
* currency's minor unit (`ZAR` 2, `JPY` 0, read from `Intl`). Applies to a column
|
|
85
|
+
* in this currency only; a column whose author picked another currency keeps that
|
|
86
|
+
* currency's minor unit. A column's own calculated-field precision still wins.
|
|
87
|
+
*/
|
|
88
|
+
decimals?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Rounding strategy for a currency column whose author chose none. Default
|
|
91
|
+
* `HALF_EVEN` (banker's). The organisation schema's `halfExpand` is `ROUND` here.
|
|
92
|
+
*/
|
|
93
|
+
rounding?: RoundingMode;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Regional rules the library presents and keeps values under. Codes are the
|
|
97
|
+
* platform standards (`Intl` accepts them as-is). Every member is optional and an
|
|
98
|
+
* unreadable value falls back to the library default, so a half-typed admin setting
|
|
99
|
+
* never breaks a form.
|
|
100
|
+
*/
|
|
101
|
+
export interface NgxTFormsLocalization {
|
|
102
|
+
/**
|
|
103
|
+
* BCP 47 tag, e.g. `en-ZA` — digit grouping, decimal mark, month names and the
|
|
104
|
+
* calendar input's own format. Default `en-ZA`. Angular ships only English data:
|
|
105
|
+
* register anything else with `registerLocaleData`, or amounts format as `en-US`.
|
|
106
|
+
*/
|
|
107
|
+
locale?: string;
|
|
108
|
+
/**
|
|
109
|
+
* IANA zone, e.g. `Africa/Johannesburg`, that times of day are displayed in.
|
|
110
|
+
* Unset → the browser's zone. Calendar days are never moved: a date-only value
|
|
111
|
+
* prints as the day it was captured whatever the zone.
|
|
112
|
+
*/
|
|
113
|
+
timeZone?: string;
|
|
114
|
+
/** The day the calendar grid starts on. Unset → the locale's own. */
|
|
115
|
+
firstDayOfWeek?: FormsWeekDay;
|
|
116
|
+
/** How plain dates are written. Default `locale`. */
|
|
117
|
+
dateFormat?: FormsDateFormat;
|
|
118
|
+
/** The clock times of day are written in. Default `locale`. */
|
|
119
|
+
timeFormat?: FormsTimeFormat;
|
|
120
|
+
/** Money. */
|
|
121
|
+
currency?: NgxTFormsCurrencyLocalization;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Either a fixed localization or a stream of it. An application whose organisation
|
|
125
|
+
* loads after bootstrap, or can be switched, hands the library the stream; the
|
|
126
|
+
* library follows every emission and uses its defaults until the first one.
|
|
127
|
+
*/
|
|
128
|
+
export type NgxTFormsLocalizationSource = NgxTFormsLocalization | Observable<NgxTFormsLocalization>;
|
|
129
|
+
/**
|
|
130
|
+
* One classification a form can be filed under — see `NgxTFormsConfig.formClassifications`.
|
|
131
|
+
*/
|
|
132
|
+
export interface FormClassificationOption {
|
|
133
|
+
/** Stable identifier stored on the form (`FormInterface.formClassifications`). Never rename it once forms use it. */
|
|
134
|
+
value: string;
|
|
135
|
+
/** What the form builder shows. */
|
|
136
|
+
label: string;
|
|
137
|
+
/**
|
|
138
|
+
* Optional heading the option is listed under, e.g. `Industry` or `Module`, so one
|
|
139
|
+
* list can classify along several axes. Options without a group are listed first.
|
|
140
|
+
*/
|
|
141
|
+
group?: string;
|
|
142
|
+
/** Optional one-line hint shown under the label in the picker. */
|
|
143
|
+
description?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Pre-select this option on every NEW form. Applies only to a form that has not
|
|
146
|
+
* been saved and whose classifications the author has not touched; stored forms
|
|
147
|
+
* keep what they have, and an author can clear a default and have that stick.
|
|
148
|
+
*/
|
|
149
|
+
isDefault?: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Either a fixed classification list or a stream of it, for an application whose
|
|
153
|
+
* list depends on the signed-in organisation. The library follows every emission.
|
|
154
|
+
*/
|
|
155
|
+
export type FormClassificationsSource = ReadonlyArray<FormClassificationOption> | Observable<ReadonlyArray<FormClassificationOption>>;
|
|
156
|
+
/** Tuning for the spreadsheet import template — see `NgxTFormsConfig.importTemplate`. */
|
|
157
|
+
export interface ImportTemplateConfig {
|
|
158
|
+
/**
|
|
159
|
+
* The most options the template lists for one choice input — a select's options, a table's
|
|
160
|
+
* rows, a document picker's transactions (most recent first). A longer list is cut to this
|
|
161
|
+
* many and marked partial; the import still accepts anything the form offers. Default 500.
|
|
162
|
+
*/
|
|
163
|
+
maxOptionsPerInput?: number;
|
|
164
|
+
}
|
|
17
165
|
export interface NgxTFormsConfig {
|
|
18
166
|
base_url?: string;
|
|
19
167
|
formBuilder: IStoreFunctions;
|
|
@@ -49,5 +197,60 @@ export interface NgxTFormsConfig {
|
|
|
49
197
|
* })
|
|
50
198
|
*/
|
|
51
199
|
defaultSubmissionHandle?: FormSubmissionHandleInterface;
|
|
200
|
+
/**
|
|
201
|
+
* Tuning for the spreadsheet import template `TFormImportController.buildFormImportTemplate`
|
|
202
|
+
* builds. Omit it for the defaults.
|
|
203
|
+
*/
|
|
204
|
+
importTemplate?: ImportTemplateConfig;
|
|
205
|
+
/**
|
|
206
|
+
* Regional rules the library presents and keeps values under: the currency a
|
|
207
|
+
* money column defaults to (and is pre-selected with in the builder), the locale
|
|
208
|
+
* amounts and dates are written in, the zone times of day are shown in, the day the
|
|
209
|
+
* calendar starts on, and the date and time formats. Omit it for the library
|
|
210
|
+
* defaults — `en-ZA`, `ZAR`, the browser's zone — which are exactly what the
|
|
211
|
+
* library did before this member existed.
|
|
212
|
+
*
|
|
213
|
+
* Pass an `Observable` when the values come from the signed-in organisation: the
|
|
214
|
+
* token is bound once at bootstrap, long before the organisation is known.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* provideNgxTForms({
|
|
218
|
+
* formBuilder: myStoreFunctions,
|
|
219
|
+
* localization: orgSettings$.pipe(map(({ localization, currencyFormat }) => ({
|
|
220
|
+
* locale: localization.locale,
|
|
221
|
+
* timeZone: localization.timeZone,
|
|
222
|
+
* firstDayOfWeek: localization.firstDayOfWeek,
|
|
223
|
+
* dateFormat: localization.dateFormat,
|
|
224
|
+
* timeFormat: localization.timeFormat,
|
|
225
|
+
* currency: {
|
|
226
|
+
* code: currencyFormat.currencyCode,
|
|
227
|
+
* display: currencyFormat.display,
|
|
228
|
+
* decimals: currencyFormat.decimals,
|
|
229
|
+
* rounding: currencyFormat.rounding === 'halfExpand' ? 'ROUND' : 'HALF_EVEN',
|
|
230
|
+
* },
|
|
231
|
+
* }))),
|
|
232
|
+
* })
|
|
233
|
+
*/
|
|
234
|
+
localization?: NgxTFormsLocalizationSource;
|
|
235
|
+
/**
|
|
236
|
+
* The classifications a form builder can file a form under — industries, modules,
|
|
237
|
+
* use cases, whatever the application groups its forms by. The builder offers them
|
|
238
|
+
* as a multi-select and stores the chosen `value`s on
|
|
239
|
+
* `FormInterface.formClassifications`. Options marked `isDefault` are pre-selected
|
|
240
|
+
* on new forms. Omit it (or supply an empty list) and the builder hides the picker.
|
|
241
|
+
*
|
|
242
|
+
* Pass an `Observable` when the list belongs to the signed-in organisation.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* provideNgxTForms({
|
|
246
|
+
* formBuilder: myStoreFunctions,
|
|
247
|
+
* formClassifications: [
|
|
248
|
+
* { value: 'construction', label: 'Construction', group: 'Industry' },
|
|
249
|
+
* { value: 'procurement', label: 'Procurement', group: 'Module', isDefault: true },
|
|
250
|
+
* { value: 'onboarding', label: 'Supplier onboarding', group: 'Use case' },
|
|
251
|
+
* ],
|
|
252
|
+
* })
|
|
253
|
+
*/
|
|
254
|
+
formClassifications?: FormClassificationsSource;
|
|
52
255
|
[key: string]: string | Object | undefined;
|
|
53
256
|
}
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/** Days a calendar week may start on, named the way the organisation schema names them. */
|
|
2
|
+
export const FORMS_WEEK_DAYS = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
|
3
|
+
/**
|
|
4
|
+
* How a plain date is written wherever the library prints one — a table cell, a
|
|
5
|
+
* document-picker column, a printout, the calendar input. `locale` keeps each
|
|
6
|
+
* surface's own locale-appropriate default; the patterns are Angular date formats.
|
|
7
|
+
*/
|
|
8
|
+
export const FORMS_DATE_FORMATS = ['locale', 'dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd', 'd MMM yyyy'];
|
|
9
|
+
/** The clock a time of day is written in. `locale` lets the locale decide. */
|
|
10
|
+
export const FORMS_TIME_FORMATS = ['locale', '24h', '12h'];
|
|
11
|
+
/** How a currency is named next to an amount: its symbol (`R`), the narrow symbol, or the code (`ZAR`). */
|
|
12
|
+
export const FORMS_CURRENCY_DISPLAYS = ['symbol', 'narrowSymbol', 'code'];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ActionButton, BasisValidationError, DialogConfig, IStoreFunctions, MscoaValuetValidationErrors } from "./IStoreFunctions.js";
|
|
2
|
-
import { IFinancialCycles } from "./environment.js";
|
|
3
|
-
export { IStoreFunctions, ActionButton, DialogConfig, IFinancialCycles, MscoaValuetValidationErrors, BasisValidationError, };
|
|
2
|
+
import { DateLike, FORMS_CURRENCY_DISPLAYS, FORMS_DATE_FORMATS, FORMS_TIME_FORMATS, FORMS_WEEK_DAYS, FormsCurrencyDisplay, FormsDateFormat, FormsTimeFormat, FormsWeekDay, GlobalVariables, GlobalVariableValue, IFinancialCycles, NgxTFormsCurrencyLocalization, NgxTFormsLocalization, NgxTFormsLocalizationSource, FormClassificationOption, FormClassificationsSource } from "./environment.js";
|
|
3
|
+
export { IStoreFunctions, FORMS_CURRENCY_DISPLAYS, FORMS_DATE_FORMATS, FORMS_TIME_FORMATS, FORMS_WEEK_DAYS, FormsCurrencyDisplay, FormsDateFormat, FormsTimeFormat, FormsWeekDay, NgxTFormsCurrencyLocalization, NgxTFormsLocalization, NgxTFormsLocalizationSource, FormClassificationOption, FormClassificationsSource, ActionButton, DialogConfig, IFinancialCycles, DateLike, GlobalVariables, GlobalVariableValue, MscoaValuetValidationErrors, BasisValidationError, };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { FORMS_CURRENCY_DISPLAYS, FORMS_DATE_FORMATS, FORMS_TIME_FORMATS, FORMS_WEEK_DAYS, } from "./environment.js";
|
|
2
|
+
export { FORMS_CURRENCY_DISPLAYS, FORMS_DATE_FORMATS, FORMS_TIME_FORMATS, FORMS_WEEK_DAYS, };
|
|
@@ -23,6 +23,9 @@ export interface DataFetchingBaseConfig {
|
|
|
23
23
|
* string (`"prefix-{{x}}"`).
|
|
24
24
|
* - Objects and arrays nest arbitrarily; object keys are literal, so Mongo-style
|
|
25
25
|
* dotted keys such as `"form.contractType"` are preserved as authored.
|
|
26
|
+
* - The reserved `"{{@search}}"` token (options fetches only) is the text typed
|
|
27
|
+
* into the field's own search box. It never holds the fetch idle: an empty
|
|
28
|
+
* search resolves to `''`.
|
|
26
29
|
*/
|
|
27
30
|
export type PayloadTemplateValue = string | number | boolean | null | PayloadTemplateValue[] | {
|
|
28
31
|
[key: string]: PayloadTemplateValue;
|
|
@@ -91,7 +94,9 @@ export type HeaderTemplateValue = string | number | boolean;
|
|
|
91
94
|
* Like a payload template, a token that resolves empty keeps the fetch **idle**:
|
|
92
95
|
* a request that would go out without its `Authorization`/tenant header is a
|
|
93
96
|
* request that fails, so the engine waits for the bound field instead of issuing
|
|
94
|
-
* a doomed call.
|
|
97
|
+
* a doomed call. The reserved `{{@search}}` token (options fetches only) is the
|
|
98
|
+
* exception: it binds the field's own search box and never holds the fetch idle
|
|
99
|
+
* — an exact `{{@search}}` value is simply left out while the search box is empty.
|
|
95
100
|
*
|
|
96
101
|
* @example
|
|
97
102
|
* headerTemplate: {
|
|
@@ -130,12 +135,15 @@ export type QueryTemplateValue = string | number | boolean;
|
|
|
130
135
|
*
|
|
131
136
|
* Like a header template, a token that resolves empty keeps the fetch **idle**:
|
|
132
137
|
* a request missing a bound parameter would return the wrong data, so the
|
|
133
|
-
* engine waits for the bound field instead.
|
|
138
|
+
* engine waits for the bound field instead. The reserved `{{@search}}` token
|
|
139
|
+
* (options fetches only) binds the field's own search box and never idles —
|
|
140
|
+
* an exact `{{@search}}` parameter is left out while the search box is empty.
|
|
134
141
|
*
|
|
135
142
|
* @example
|
|
136
143
|
* queryTemplate: {
|
|
137
144
|
* financialYear: '{{financialYear}}',
|
|
138
145
|
* department: '{{departmentId}}',
|
|
146
|
+
* search: '{{@search}}',
|
|
139
147
|
* pageSize: 50,
|
|
140
148
|
* }
|
|
141
149
|
*/
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export type MatFormFieldAppearance = 'fill' | 'outline';
|
|
7
7
|
import { IFileUploadInput, IMatrixInput, IScoaInput, IMultiple, IToggleInput, IWorkflowAdjudicationInput } from ".";
|
|
8
8
|
import { ConditionalInputRule } from "./ConditionalInputRule.js";
|
|
9
|
+
import type { RoundingMode } from "./calculatedFieldRules.js";
|
|
9
10
|
import { IDateRangePickerInput } from "./DateRangePickerInput.js";
|
|
10
11
|
import { FormControlCustomValidatorsInterface } from "./FormControlCustomValidatorsInterface.js";
|
|
11
12
|
import { MatDataOptionsInterface } from "./MatDataOptionsInterface.js";
|
|
@@ -121,9 +122,23 @@ export interface IBasicFormInput extends IFormElementTemplate {
|
|
|
121
122
|
readonly?: boolean;
|
|
122
123
|
id: string;
|
|
123
124
|
sectionId: string;
|
|
125
|
+
/**
|
|
126
|
+
* Number / date presentation, and for the numeric formats the precision the
|
|
127
|
+
* value is kept at.
|
|
128
|
+
*
|
|
129
|
+
* `currency`, `decimal` and `integer` round the value itself — typed,
|
|
130
|
+
* imported, seeded or calculated — to their precision, so what is saved is
|
|
131
|
+
* what is shown: currency to the currency's minor unit (2 for ZAR) with
|
|
132
|
+
* `HALF_EVEN` unless `rounding` says otherwise; `decimal` to `param`
|
|
133
|
+
* places (a plain integer such as `"2"`); `integer` to none. Every other
|
|
134
|
+
* pipe type is presentation only and leaves the stored value unchanged.
|
|
135
|
+
*/
|
|
124
136
|
pipe?: {
|
|
125
137
|
pipeType: InputPipeTypes;
|
|
138
|
+
/** Currency code for `currency`, decimal places for `decimal`, date format for `date` / `time`. */
|
|
126
139
|
param: string;
|
|
140
|
+
/** Rounding strategy for the numeric formats. Unset → `HALF_EVEN` for `currency`, `ROUND` otherwise. */
|
|
141
|
+
rounding?: RoundingMode;
|
|
127
142
|
};
|
|
128
143
|
hintLabel?: string;
|
|
129
144
|
temporaryHint?: string;
|
|
@@ -3,6 +3,20 @@ export declare enum MinInputTypes {
|
|
|
3
3
|
Default = "default",
|
|
4
4
|
MapTo = "mapto",
|
|
5
5
|
MapDocFilter = "mapDocFilter",
|
|
6
|
+
/**
|
|
7
|
+
* Resolves to the text the user types into the field's own search box (the
|
|
8
|
+
* dropdown's panel search or the selection table's search field). Only
|
|
9
|
+
* meaningful on an **options** fetch: every change of the search text re-fires
|
|
10
|
+
* the fetch with the new term, so the API does the filtering instead of the
|
|
11
|
+
* browser.
|
|
12
|
+
*
|
|
13
|
+
* Never gates the fetch — an empty search box sends `''`, which the endpoint
|
|
14
|
+
* should read as "no filter". Carries no `mapTo`/`defaultValue`.
|
|
15
|
+
*
|
|
16
|
+
* The template equivalent is the reserved `{{@search}}` token, accepted by
|
|
17
|
+
* `payloadTemplate`, `queryTemplate` and `headerTemplate`.
|
|
18
|
+
*/
|
|
19
|
+
SearchTerm = "searchTerm",
|
|
6
20
|
/**
|
|
7
21
|
* @deprecated Never implemented. No editor offers it, no runtime handles it —
|
|
8
22
|
* a `bind` entry leaves its fetch permanently idle. The runtime now surfaces a
|
|
@@ -3,6 +3,20 @@ export var MinInputTypes;
|
|
|
3
3
|
MinInputTypes["Default"] = "default";
|
|
4
4
|
MinInputTypes["MapTo"] = "mapto";
|
|
5
5
|
MinInputTypes["MapDocFilter"] = "mapDocFilter";
|
|
6
|
+
/**
|
|
7
|
+
* Resolves to the text the user types into the field's own search box (the
|
|
8
|
+
* dropdown's panel search or the selection table's search field). Only
|
|
9
|
+
* meaningful on an **options** fetch: every change of the search text re-fires
|
|
10
|
+
* the fetch with the new term, so the API does the filtering instead of the
|
|
11
|
+
* browser.
|
|
12
|
+
*
|
|
13
|
+
* Never gates the fetch — an empty search box sends `''`, which the endpoint
|
|
14
|
+
* should read as "no filter". Carries no `mapTo`/`defaultValue`.
|
|
15
|
+
*
|
|
16
|
+
* The template equivalent is the reserved `{{@search}}` token, accepted by
|
|
17
|
+
* `payloadTemplate`, `queryTemplate` and `headerTemplate`.
|
|
18
|
+
*/
|
|
19
|
+
MinInputTypes["SearchTerm"] = "searchTerm";
|
|
6
20
|
/**
|
|
7
21
|
* @deprecated Never implemented. No editor offers it, no runtime handles it —
|
|
8
22
|
* a `bind` entry leaves its fetch permanently idle. The runtime now surfaces a
|
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
import { calculationVariableInterface } from "./calculationVariableInterface.js";
|
|
2
|
+
/**
|
|
3
|
+
* Every rounding strategy the library understands, in the order the editors
|
|
4
|
+
* list them.
|
|
5
|
+
*
|
|
6
|
+
* One list backs the {@link RoundingMode} type, the Joi schemas, the Skillet
|
|
7
|
+
* enumeration and both editors (the calculated-field rules editor and the
|
|
8
|
+
* number pipe), so a strategy added here reaches every surface at once.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ROUNDING_MODES: readonly ["ROUND", "FLOOR", "CEIL", "HALF_EVEN"];
|
|
11
|
+
/**
|
|
12
|
+
* How a numeric value is rounded at its precision.
|
|
13
|
+
*
|
|
14
|
+
* - `ROUND` — nearest; a tie (…5) rounds away from zero: 2.345 → 2.35, −2.345 → −2.35.
|
|
15
|
+
* - `FLOOR` — down, toward −∞: 2.349 → 2.34, −2.341 → −2.35.
|
|
16
|
+
* - `CEIL` — up, toward +∞: 2.341 → 2.35, −2.349 → −2.34.
|
|
17
|
+
* - `HALF_EVEN` — banker's rounding (IEEE 754 roundTiesToEven); a tie rounds to
|
|
18
|
+
* the even neighbour: 2.345 → 2.34, 2.355 → 2.36. The default for currency,
|
|
19
|
+
* because it does not drift a column of totals upward.
|
|
20
|
+
*/
|
|
21
|
+
export type RoundingMode = (typeof ROUNDING_MODES)[number];
|
|
22
|
+
/** Editor label for each {@link RoundingMode}. */
|
|
23
|
+
export declare const ROUNDING_MODE_LABELS: Record<RoundingMode, string>;
|
|
2
24
|
export interface CalculatedFieldRules {
|
|
3
25
|
formula: string;
|
|
4
26
|
variables: calculationVariableInterface[];
|
|
27
|
+
/**
|
|
28
|
+
* Decimal places the result is rounded to. Unset → the column's number format
|
|
29
|
+
* (`pipe`) decides; with neither, the result is not rounded.
|
|
30
|
+
*/
|
|
5
31
|
decimalPlaces?: number;
|
|
6
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Rounding strategy at `decimalPlaces`. Unset → `HALF_EVEN` for a column whose
|
|
34
|
+
* number format is currency, `ROUND` otherwise.
|
|
35
|
+
*/
|
|
36
|
+
roundingMode?: RoundingMode;
|
|
7
37
|
getFormulaFromAFormInput?: boolean;
|
|
8
38
|
formControlWithFormula?: string;
|
|
9
39
|
}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Every rounding strategy the library understands, in the order the editors
|
|
3
|
+
* list them.
|
|
4
|
+
*
|
|
5
|
+
* One list backs the {@link RoundingMode} type, the Joi schemas, the Skillet
|
|
6
|
+
* enumeration and both editors (the calculated-field rules editor and the
|
|
7
|
+
* number pipe), so a strategy added here reaches every surface at once.
|
|
8
|
+
*/
|
|
9
|
+
export const ROUNDING_MODES = ['ROUND', 'FLOOR', 'CEIL', 'HALF_EVEN'];
|
|
10
|
+
/** Editor label for each {@link RoundingMode}. */
|
|
11
|
+
export const ROUNDING_MODE_LABELS = {
|
|
12
|
+
ROUND: 'Nearest',
|
|
13
|
+
FLOOR: 'Round down',
|
|
14
|
+
CEIL: 'Round up',
|
|
15
|
+
HALF_EVEN: "Banker's (half to even)",
|
|
16
|
+
};
|
|
@@ -21,9 +21,9 @@ import { ITextareaProperties } from "./TextAreaInput.js";
|
|
|
21
21
|
import { IToggleInput } from "./ToggleInputInterface.js";
|
|
22
22
|
import { AdjResponseReviewColumnMapping, AdjudicationSteps, IWorkflowAdjudicationInput, WorkflowAdjudicationMicroFlowReviewValue, WorkflowAdjudicationResponseElectedSupplierSelectionValue, WorkflowAdjudicationScoreSheetValue } from "./WorkflowAdjudication.js";
|
|
23
23
|
import { DOCUMENT_PICKER_FILTER_OPERATORS, DOCUMENT_PICKER_FILTER_VALUE_SOURCES, DOCUMENT_PICKER_FILTER_VALUE_TYPES, DocumentPickerFilterOperator, DocumentPickerFilterValueSource, DocumentPickerFilterValueType, IDocumentPage, IDocumentPickerFilter, IDocumentQueryRequest, IDocumentReference, IWorkflowDocumentPicker, IWorkflowDocumentPickerConfig, IWorkflowDocumentStepFilter, workflowStepStatus } from "./WorkflowDocumentPicker.js";
|
|
24
|
-
import { CalculatedFieldRules } from "./calculatedFieldRules.js";
|
|
24
|
+
import { CalculatedFieldRules, ROUNDING_MODES, ROUNDING_MODE_LABELS, RoundingMode } from "./calculatedFieldRules.js";
|
|
25
25
|
import { CalculationFunctions, calculationVariableInterface } from "./calculationVariableInterface.js";
|
|
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, 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, };
|
|
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, ROUNDING_MODES, ROUNDING_MODE_LABELS, RoundingMode, 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, };
|
|
@@ -5,6 +5,7 @@ import { JsDataTypes, MinInputTypes } from "./MinimumInputRequiredInterface.js";
|
|
|
5
5
|
import { MultipleInputAvailableOperations } from "./MultipleInterface.js";
|
|
6
6
|
import { AdjudicationSteps } from "./WorkflowAdjudication.js";
|
|
7
7
|
import { DOCUMENT_PICKER_FILTER_OPERATORS, DOCUMENT_PICKER_FILTER_VALUE_SOURCES, DOCUMENT_PICKER_FILTER_VALUE_TYPES, workflowStepStatus, } from "./WorkflowDocumentPicker.js";
|
|
8
|
+
import { ROUNDING_MODES, ROUNDING_MODE_LABELS } from "./calculatedFieldRules.js";
|
|
8
9
|
import { CalculationFunctions } from "./calculationVariableInterface.js";
|
|
9
10
|
import { RichTextEditorType } from "./RichTextEditorInput.js";
|
|
10
11
|
// H-018b (Worker T-C): `OLD_FormInterface` and `FormInterfaceMigration` are
|
|
@@ -14,4 +15,4 @@ import { RichTextEditorType } from "./RichTextEditorInput.js";
|
|
|
14
15
|
// would otherwise trigger TS2300 "Duplicate identifier".
|
|
15
16
|
export {
|
|
16
17
|
///ENUMS
|
|
17
|
-
ElementTypes, InputTypes, InputPipeTypes, AutocapitalizeOptions, AutocompleteOptions, InputDataTypes, MinInputTypes, CalculationFunctions, AllDocumentFileExtensions, AllImageFileExtensions, UploadTypes, InputFileType, AccountingBasis, DOCUMENT_PICKER_FILTER_OPERATORS, DOCUMENT_PICKER_FILTER_VALUE_SOURCES, DOCUMENT_PICKER_FILTER_VALUE_TYPES, workflowStepStatus, JsDataTypes, AdjudicationSteps, OptionSelectTypes, MultipleInputAvailableOperations, RichTextEditorType, };
|
|
18
|
+
ElementTypes, InputTypes, InputPipeTypes, AutocapitalizeOptions, AutocompleteOptions, InputDataTypes, MinInputTypes, ROUNDING_MODES, ROUNDING_MODE_LABELS, CalculationFunctions, AllDocumentFileExtensions, AllImageFileExtensions, UploadTypes, InputFileType, AccountingBasis, DOCUMENT_PICKER_FILTER_OPERATORS, DOCUMENT_PICKER_FILTER_VALUE_SOURCES, DOCUMENT_PICKER_FILTER_VALUE_TYPES, workflowStepStatus, JsDataTypes, AdjudicationSteps, OptionSelectTypes, MultipleInputAvailableOperations, RichTextEditorType, };
|
|
@@ -39,7 +39,27 @@ export declare enum ReportTypes {
|
|
|
39
39
|
Sum = "sum",
|
|
40
40
|
Lowest = "lowest",
|
|
41
41
|
Highest = "highest",
|
|
42
|
-
Category = "category"
|
|
42
|
+
Category = "category",
|
|
43
|
+
/** Middle value of a currency/number field; money is right-skewed, so it can deserve the headline. */
|
|
44
|
+
Median = "median",
|
|
45
|
+
/** Opts a date/daysAgo field in as a time axis (volume, seasonality, lead time). */
|
|
46
|
+
Trend = "trend",
|
|
47
|
+
/** Opts a string/systemReference field in as an entity (unique count, Pareto) — suppliers, customers, assets. */
|
|
48
|
+
Distinct = "distinct"
|
|
49
|
+
}
|
|
50
|
+
/** Whether a rise in a measure is good news, bad news, or neither. */
|
|
51
|
+
export type ReportPolarity = 'higherIsBetter' | 'lowerIsBetter' | 'neutral';
|
|
52
|
+
/**
|
|
53
|
+
* Optional qualifiers on a reportable field. None is required: absent, the report engine
|
|
54
|
+
* picks the first measure/dimension as primary, never judges direction, and bands by quartile.
|
|
55
|
+
*/
|
|
56
|
+
export interface ReportHintsInterface {
|
|
57
|
+
/** Picks the hero KPI (measure) or the default "by" grouping (dimension). */
|
|
58
|
+
primary?: boolean;
|
|
59
|
+
/** Lets insights say "improved"/"worsened" instead of "rose"/"fell". */
|
|
60
|
+
polarity?: ReportPolarity;
|
|
61
|
+
/** Ascending value edges for concentration insights, e.g. [100000, 500000]. */
|
|
62
|
+
bands?: number[];
|
|
43
63
|
}
|
|
44
64
|
export interface DocumentLitsLabelConfigInterface {
|
|
45
65
|
label: string;
|
|
@@ -48,6 +68,7 @@ export interface DocumentLitsLabelConfigInterface {
|
|
|
48
68
|
stepName: string | null;
|
|
49
69
|
valueType: DocumentLitsLabelConfigInterfaceValueType;
|
|
50
70
|
reportType?: ReportTypes[];
|
|
71
|
+
reportHints?: ReportHintsInterface;
|
|
51
72
|
}
|
|
52
73
|
export interface GridListLabelConfigInterface {
|
|
53
74
|
labelConfiguration: DocumentLitsLabelConfigInterface[];
|
|
@@ -25,4 +25,10 @@ export var ReportTypes;
|
|
|
25
25
|
ReportTypes["Lowest"] = "lowest";
|
|
26
26
|
ReportTypes["Highest"] = "highest";
|
|
27
27
|
ReportTypes["Category"] = "category";
|
|
28
|
+
/** Middle value of a currency/number field; money is right-skewed, so it can deserve the headline. */
|
|
29
|
+
ReportTypes["Median"] = "median";
|
|
30
|
+
/** Opts a date/daysAgo field in as a time axis (volume, seasonality, lead time). */
|
|
31
|
+
ReportTypes["Trend"] = "trend";
|
|
32
|
+
/** Opts a string/systemReference field in as an entity (unique count, Pareto) — suppliers, customers, assets. */
|
|
33
|
+
ReportTypes["Distinct"] = "distinct";
|
|
28
34
|
})(ReportTypes || (ReportTypes = {}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DocumentLitsLabelConfigInterface, DocumentLitsLabelConfigInterfaceValueType, ReportTypes } from "./DocumentSectionConfigurationsInterface.js";
|
|
1
|
+
import { DocumentLitsLabelConfigInterface, DocumentLitsLabelConfigInterfaceValueType, ReportHintsInterface, ReportPolarity, ReportTypes } from "./DocumentSectionConfigurationsInterface.js";
|
|
2
2
|
import { WorkflowFunctionTypes } from "./WorkflowFunctionTypes.js";
|
|
3
|
-
export { DocumentLitsLabelConfigInterface, DocumentLitsLabelConfigInterfaceValueType, ReportTypes, WorkflowFunctionTypes };
|
|
3
|
+
export { DocumentLitsLabelConfigInterface, DocumentLitsLabelConfigInterfaceValueType, ReportHintsInterface, ReportPolarity, ReportTypes, WorkflowFunctionTypes };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
|
+
import { ROUNDING_MODES } from '../interfaces/formInput/calculatedFieldRules.js';
|
|
2
3
|
const calculationVariableSchema = Joi.object({
|
|
3
4
|
formControlName: Joi.string().required(),
|
|
4
5
|
label: Joi.string().required(),
|
|
@@ -19,7 +20,7 @@ export const calculatedFieldRulesSchema = Joi.object({
|
|
|
19
20
|
variables: Joi.array().items(calculationVariableSchema).required(),
|
|
20
21
|
getFormulaFromAFormInput: Joi.boolean().optional(),
|
|
21
22
|
decimalPlaces: Joi.number().optional(),
|
|
22
|
-
roundingMode: Joi.string().valid(
|
|
23
|
+
roundingMode: Joi.string().valid(...ROUNDING_MODES).optional(),
|
|
23
24
|
formControlWithFormula: Joi.string().optional()
|
|
24
25
|
});
|
|
25
26
|
export function validateCalculatedFieldRules(value) {
|
|
@@ -7,6 +7,7 @@ import { AdjudicationSteps, AutocapitalizeOptions, AutocompleteOptions, ElementT
|
|
|
7
7
|
// import { calculatedFieldRulesSchema } from './CalculatedFieldRulesSchema.js';
|
|
8
8
|
// import { MatDataOptionsSchema } from './MatOptionsSchema.js';
|
|
9
9
|
import { formControlCustomValidatorSchema } from './customValidationSchema.js';
|
|
10
|
+
import { ROUNDING_MODES } from '../interfaces/formInput/calculatedFieldRules.js';
|
|
10
11
|
import { InputFileType } from '../interfaces/formInput/FileUploadInputInterface.js';
|
|
11
12
|
import { LabelPosition } from '../interfaces/formInput/ToggleInputInterface.js';
|
|
12
13
|
import { calculatedFieldRulesSchema } from './CalculatedFieldRulesSchema.js';
|
|
@@ -103,7 +104,8 @@ export const baseFormColumnInputsSchema = Joi.object({
|
|
|
103
104
|
[AllFormInputPrimaryKeys.Pipe]: Joi.object({
|
|
104
105
|
_id: Joi.string().optional(),
|
|
105
106
|
pipeType: Joi.string().valid(...Object.values(InputPipeTypes)).required(),
|
|
106
|
-
param: Joi.string().required()
|
|
107
|
+
param: Joi.string().required(),
|
|
108
|
+
rounding: Joi.string().valid(...ROUNDING_MODES).optional()
|
|
107
109
|
}).optional(),
|
|
108
110
|
[AllFormInputPrimaryKeys.Script]: Joi.object().optional(),
|
|
109
111
|
[AllFormInputPrimaryKeys.Validators]: Joi.array().items(Joi.alternatives().try(Joi.string(), formControlCustomValidatorSchema)).optional(),
|
|
@@ -136,6 +138,12 @@ export const baseFormColumnInputsSchema = Joi.object({
|
|
|
136
138
|
emit: Joi.function().required(),
|
|
137
139
|
canReload: Joi.boolean().required()
|
|
138
140
|
}).optional(),
|
|
141
|
+
// Runtime-only: present only on inputs whose options fetch is bound to the search box.
|
|
142
|
+
[AllFormInputPrimaryKeys.OptionsSearch]: Joi.object({
|
|
143
|
+
search: Joi.function().required(),
|
|
144
|
+
term: Joi.function().required(),
|
|
145
|
+
isSearching: Joi.function().required()
|
|
146
|
+
}).optional(),
|
|
139
147
|
[AllFormInputPrimaryKeys.GroupBy]: Joi.array().items(Joi.string()),
|
|
140
148
|
[AllFormInputPrimaryKeys.ConditionalInputConfig]: Joi.any().optional(),
|
|
141
149
|
[SpecialElementKeys.MultipleInputAvailableOperations]: Joi.array().items(Joi.string().valid(...Object.values(MultipleInputAvailableOperations))).optional(),
|
|
@@ -3,6 +3,41 @@ import { FormInterface } from "../interfaces/Form/index.js";
|
|
|
3
3
|
export declare const FormSlideSchema: Joi.ObjectSchema<any>;
|
|
4
4
|
export declare const FormSubmissionHandleSchema: Joi.ObjectSchema<any>;
|
|
5
5
|
export declare const FormSchema: Joi.ObjectSchema<any>;
|
|
6
|
+
/**
|
|
7
|
+
* Fewest words a form description may have — one full sentence — see
|
|
8
|
+
* `validateFormDescription`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FORM_DESCRIPTION_MIN_WORDS = 10;
|
|
11
|
+
/** Most paragraphs a form description may have — see `validateFormDescription`. */
|
|
12
|
+
export declare const FORM_DESCRIPTION_MAX_PARAGRAPHS = 2;
|
|
13
|
+
/** Word and paragraph counts of a form description, as `validateFormDescription` counts them. */
|
|
14
|
+
export interface FormDescriptionMeasure {
|
|
15
|
+
/** Whitespace-separated words. */
|
|
16
|
+
words: number;
|
|
17
|
+
/** Non-empty blocks separated by at least one blank line. A single line break does not start a paragraph. */
|
|
18
|
+
paragraphs: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Counts the words and paragraphs of a form description. Paragraphs are separated
|
|
22
|
+
* by a blank line (whitespace-only lines count as blank); a single line break stays
|
|
23
|
+
* inside its paragraph.
|
|
24
|
+
*
|
|
25
|
+
* @param text The description; `undefined`/`null` count as empty.
|
|
26
|
+
* @returns The counts — both `0` for blank text.
|
|
27
|
+
*/
|
|
28
|
+
export declare function measureFormDescription(text: string | null | undefined): FormDescriptionMeasure;
|
|
29
|
+
/**
|
|
30
|
+
* The rule a form description must pass before the builder saves the form: present,
|
|
31
|
+
* at least `FORM_DESCRIPTION_MIN_WORDS` words, at most `FORM_DESCRIPTION_MAX_PARAGRAPHS`
|
|
32
|
+
* paragraphs.
|
|
33
|
+
*
|
|
34
|
+
* @param text The description; `undefined`/`null` count as missing.
|
|
35
|
+
* @returns One entry per broken rule, keyed `formDescription`; empty when it passes.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateFormDescription(text: string | null | undefined): {
|
|
38
|
+
key: string;
|
|
39
|
+
message: string;
|
|
40
|
+
}[];
|
|
6
41
|
export declare const DatabaseFormSchema: Joi.ObjectSchema<any>;
|
|
7
42
|
export declare function validateFormSlide(data: any): {
|
|
8
43
|
key: string;
|