@bolttech/form-engine 0.14.3 → 3.0.0-beta.2
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/README.md +2 -1628
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1683 -0
- package/package.json +15 -16
- package/src/components/AsFormField/AsFormField.d.ts +4 -0
- package/src/components/FieldWrapper/FieldWrapper.d.ts +4 -0
- package/src/components/Form/Form.d.ts +4 -0
- package/src/components/index.d.ts +2 -0
- package/src/context/FormGroupContext.d.ts +27 -0
- package/src/generators/formBuilder.d.ts +11 -0
- package/src/index.d.ts +3 -3
- package/src/types/index.d.ts +47 -0
- package/CHANGELOG.md +0 -529
- package/asFormField-3108e669.js +0 -2
- package/asFormField-3108e669.js.map +0 -1
- package/index.js +0 -2
- package/index.js.map +0 -1
- package/react.js +0 -2
- package/react.js.map +0 -1
- package/src/adapters/react/Field.d.ts +0 -4
- package/src/adapters/react/Form.d.ts +0 -5
- package/src/adapters/react/Submit.d.ts +0 -3
- package/src/adapters/react/asFormField.d.ts +0 -4
- package/src/adapters/react/context.d.ts +0 -5
- package/src/adapters/react/index.d.ts +0 -7
- package/src/adapters/react/types.d.ts +0 -326
- package/src/adapters/react/useForceUpdate.d.ts +0 -3
- package/src/adapters/react/useForm.d.ts +0 -12
- package/src/adapters/react/useFormGroup.d.ts +0 -3
- package/src/core/apis/formatters.d.ts +0 -16
- package/src/core/apis/index.d.ts +0 -4
- package/src/core/apis/masks.d.ts +0 -3
- package/src/core/apis/validations.d.ts +0 -11
- package/src/core/apis/varOps.d.ts +0 -4
- package/src/core/constants/events.d.ts +0 -32
- package/src/core/constants/index.d.ts +0 -5
- package/src/core/constants/observer.d.ts +0 -7
- package/src/core/events/ObserverError.d.ts +0 -7
- package/src/core/events/events.types.d.ts +0 -27
- package/src/core/events/index.d.ts +0 -2
- package/src/core/handlers/common/templating.d.ts +0 -2
- package/src/core/handlers/field/api.d.ts +0 -4
- package/src/core/handlers/field/blur.d.ts +0 -2
- package/src/core/handlers/field/change.d.ts +0 -2
- package/src/core/handlers/field/clearFields.d.ts +0 -4
- package/src/core/handlers/field/data.d.ts +0 -3
- package/src/core/handlers/field/filter.d.ts +0 -2
- package/src/core/handlers/field/focus.d.ts +0 -2
- package/src/core/handlers/field/formatters.d.ts +0 -4
- package/src/core/handlers/field/htmlEventParser.d.ts +0 -6
- package/src/core/handlers/field/keydown.d.ts +0 -2
- package/src/core/handlers/field/keyup.d.ts +0 -2
- package/src/core/handlers/field/masks.d.ts +0 -4
- package/src/core/handlers/field/mount.d.ts +0 -2
- package/src/core/handlers/field/validations.d.ts +0 -4
- package/src/core/handlers/field/visibilityConditions.d.ts +0 -4
- package/src/core/handlers/flows.d.ts +0 -47
- package/src/core/handlers/form/bindFields.d.ts +0 -3
- package/src/core/handlers/form/hooks.d.ts +0 -3
- package/src/core/handlers/form/steps.d.ts +0 -2
- package/src/core/handlers/form/templating.d.ts +0 -2
- package/src/core/handlers/form/validate.d.ts +0 -2
- package/src/core/handlers/form/visibilityConditions.d.ts +0 -4
- package/src/core/index.d.ts +0 -3
- package/src/core/managers/Base.d.ts +0 -19
- package/src/core/managers/Factory.d.ts +0 -52
- package/src/core/managers/Field.d.ts +0 -33
- package/src/core/managers/Form.d.ts +0 -28
- package/src/core/managers/Scope.d.ts +0 -12
- package/src/core/managers/index.d.ts +0 -1
- package/src/core/types/index.d.ts +0 -937
- package/src/core/utils/common.d.ts +0 -9
- package/src/core/utils/credit-card.d.ts +0 -16
- package/src/core/utils/index.d.ts +0 -6
- package/src/core/utils/object.d.ts +0 -27
- package/src/core/utils/string.d.ts +0 -3
- package/src/core/utils/value.d.ts +0 -2
- package/types.js +0 -2
- package/types.js.map +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { TAsFormFieldProps, TDecoratorProps } from '../react/types';
|
|
3
|
-
declare const asFormField: <OriginalComponentProps>({ Comp, propsMapping }: TAsFormFieldProps) => ({ name, validations, errorMessages, masks, clearFields, api, filter, formatters, visibilityConditions, formId, visibility, value, disabled, optionList, onSelected, ...props }: TDecoratorProps<OriginalComponentProps>) => ReactElement;
|
|
4
|
-
export default asFormField;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
import * as T from '@adapters/react';
|
|
3
|
-
declare const FormContext: React.Context<T.TContext>;
|
|
4
|
-
declare const FormProvider: ({ children, mapper, propsMapping, }: T.TProvider) => ReactElement;
|
|
5
|
-
export { FormContext, FormProvider };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import Form from './Form';
|
|
2
|
-
import useForm from './useForm';
|
|
3
|
-
import { useFormGroup } from './useFormGroup';
|
|
4
|
-
import asFormField from './asFormField';
|
|
5
|
-
export type { TChildWrapperProps, TContext, TFormProps, TFormRefActions, TMapper, TProvider, } from './types';
|
|
6
|
-
export { FormProvider } from './context';
|
|
7
|
-
export { Form, useForm, useFormGroup, asFormField };
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from 'react';
|
|
2
|
-
import { TComponent, TErrorMessages, TSchemaValidation, TSchemaValidations, TSchema, THooks, TIVars, TFormValues, TField, TChildrenOptions, TPropsMapping, TComponentPropsMapping, TScope } from '../../core/types';
|
|
3
|
-
import { TLoggingEvent } from '@core/events/events.types';
|
|
4
|
-
declare type TFormProps = {
|
|
5
|
-
/**
|
|
6
|
-
* Allow to set the form as read only mode.
|
|
7
|
-
*
|
|
8
|
-
* This will prevent any interaction with the form whatsoever
|
|
9
|
-
*/
|
|
10
|
-
disable?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Allow to specify a logical group across several forms so that we can get data with useFormGroup
|
|
13
|
-
*/
|
|
14
|
-
group?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Hooks to run on some life-cycles
|
|
17
|
-
*/
|
|
18
|
-
hooks?: THooks;
|
|
19
|
-
/**
|
|
20
|
-
* Form id. Will default to a internal one in case not given
|
|
21
|
-
*/
|
|
22
|
-
id?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Internal variables. This object will be used in the global scope
|
|
25
|
-
* namespace
|
|
26
|
-
*/
|
|
27
|
-
iVars?: TIVars;
|
|
28
|
-
/**
|
|
29
|
-
* Form initial values. This must map into form known fields
|
|
30
|
-
*/
|
|
31
|
-
initialValues?: Record<string, unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* Form schema that should contain form definition
|
|
34
|
-
*/
|
|
35
|
-
schema?: TSchema;
|
|
36
|
-
/**
|
|
37
|
-
* HTML autocomplete form prop
|
|
38
|
-
*/
|
|
39
|
-
autoComplete?: string;
|
|
40
|
-
/**
|
|
41
|
-
* ClassName in case you want to style form
|
|
42
|
-
*/
|
|
43
|
-
className?: string;
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* Callback function that will run on each submit.
|
|
47
|
-
*
|
|
48
|
-
* NOTE: By default this function only runs if the form has no errors. If you
|
|
49
|
-
* want different behaviour, use submitOnValidOnly and set to false
|
|
50
|
-
*
|
|
51
|
-
* @param form - HTML original event
|
|
52
|
-
* @param values - Form generated value. Refer to its type
|
|
53
|
-
*/
|
|
54
|
-
onSubmit?(form: React.FormEvent<HTMLFormElement>, values: TFormValues): Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* Callback function that runs on each data change.
|
|
58
|
-
*
|
|
59
|
-
* You can who changed the data accessing to the arguments
|
|
60
|
-
*
|
|
61
|
-
* @param values - Form generated values
|
|
62
|
-
* @param component - The component configuration of the field that changed
|
|
63
|
-
* @param field - The current state of the changing field
|
|
64
|
-
*/
|
|
65
|
-
onData?(values: TFormValues, component?: TComponent, field?: TField): void;
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* Callback function that runs on each blur.
|
|
69
|
-
*
|
|
70
|
-
* You can what field was blurred accessing to the arguments
|
|
71
|
-
*
|
|
72
|
-
* @param values - Form generated values
|
|
73
|
-
* @param component - The component configuration of the field that was blurred
|
|
74
|
-
* @param field - The current state of the blurred field
|
|
75
|
-
*/
|
|
76
|
-
onBlur?(values: TFormValues, component?: TComponent, field?: TField): void;
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* Callback function that runs on each focus.
|
|
80
|
-
*
|
|
81
|
-
* You can what field was focused accessing to the arguments
|
|
82
|
-
*
|
|
83
|
-
* @param values - Form generated values
|
|
84
|
-
* @param component - The component configuration of the field that was focused
|
|
85
|
-
* @param field - The current state of the focused field
|
|
86
|
-
*/
|
|
87
|
-
onFocus?(values: TFormValues, component?: TComponent, field?: TField): void;
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
* Callback that tells you when a given field was mounted
|
|
91
|
-
*
|
|
92
|
-
* @param values - Form generated values
|
|
93
|
-
* @param component - The component configuration of the field that was mounted
|
|
94
|
-
* @param field - The current state of the mounted field
|
|
95
|
-
*/
|
|
96
|
-
onFieldMount?(values: TFormValues, component?: TComponent, field?: TField): void;
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
* This callback will be fired in each step change
|
|
100
|
-
*
|
|
101
|
-
* @param values - Form generated values
|
|
102
|
-
*/
|
|
103
|
-
onStep?(values: TFormValues): void;
|
|
104
|
-
/**
|
|
105
|
-
* Enables you to see what is happening under the hood. Subscribing the callback will enable logging
|
|
106
|
-
*
|
|
107
|
-
* @param log - Logging event
|
|
108
|
-
*/
|
|
109
|
-
onLog?(log: TLoggingEvent): void;
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
112
|
-
* Notifies you about each form scope change and about who changed it
|
|
113
|
-
*
|
|
114
|
-
* @param scope - Form current scope with the update
|
|
115
|
-
* @param namespace - The namespace that was updated
|
|
116
|
-
* @param key - The key responsible for the update
|
|
117
|
-
*/
|
|
118
|
-
onScopeChange?(scope: TScope, namespace: string, key: string): void;
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
* When a given field is rehydrated, this callback will be called
|
|
122
|
-
*
|
|
123
|
-
* @param values - Form generated values
|
|
124
|
-
* @param component - The component configuration of the field that was mounted
|
|
125
|
-
* @param field - The current state of the mounted field
|
|
126
|
-
*/
|
|
127
|
-
onFieldRehydrate?(values: TFormValues, component: TComponent, field: TField): void;
|
|
128
|
-
/**
|
|
129
|
-
* Allows you to pass a JSX so that the form shows it before rendering your schema
|
|
130
|
-
*
|
|
131
|
-
* @returns JSX
|
|
132
|
-
*/
|
|
133
|
-
renderLoading?(): ReactElement;
|
|
134
|
-
/**
|
|
135
|
-
* Called when the form was mounted
|
|
136
|
-
*
|
|
137
|
-
* @param values - Form generated values
|
|
138
|
-
*/
|
|
139
|
-
onFormMount?(values: TFormValues): void;
|
|
140
|
-
children?: ReactElement | ReactElement[];
|
|
141
|
-
/**
|
|
142
|
-
* Object to be used if you want to control the default values of the form.
|
|
143
|
-
*
|
|
144
|
-
* InitialValues will take precedence over this
|
|
145
|
-
*/
|
|
146
|
-
formattedDataDefaults?: Record<string, unknown>;
|
|
147
|
-
/**
|
|
148
|
-
* Override the default form behaviour witch is to prevent submit when there is an error
|
|
149
|
-
*/
|
|
150
|
-
submitOnValidOnly?: boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Allows to insert a wrapper for each field or replace the field rendering
|
|
153
|
-
*/
|
|
154
|
-
renderFieldWrapper?(component: TComponent, children: ReactElement[]): ReactElement;
|
|
155
|
-
/**
|
|
156
|
-
*
|
|
157
|
-
* Callback function that runs on each component click.
|
|
158
|
-
*
|
|
159
|
-
* You can what field was clicked accessing to the arguments
|
|
160
|
-
*
|
|
161
|
-
* @param values - Form generated values
|
|
162
|
-
* @param field - The current state of the blurred field
|
|
163
|
-
*/
|
|
164
|
-
onClick?(values: TFormValues, field?: TField): void;
|
|
165
|
-
/**
|
|
166
|
-
*
|
|
167
|
-
* Callback function that runs on each component after api call.
|
|
168
|
-
*
|
|
169
|
-
* You can capture the data after an api call and also perform validations or formatting in the field after it.
|
|
170
|
-
*
|
|
171
|
-
* @param values - Form generated values
|
|
172
|
-
* @param component - The component configuration of the field that was focused
|
|
173
|
-
* @param field - The current state of the focused field
|
|
174
|
-
*/
|
|
175
|
-
afterApiCall?(values: TFormValues, component?: TComponent, field?: TField): void;
|
|
176
|
-
};
|
|
177
|
-
declare type TMapper = Record<string, Record<string, unknown>>;
|
|
178
|
-
declare type TProvider = {
|
|
179
|
-
children?: ReactElement | ReactElement[] | string;
|
|
180
|
-
mapper: TMapper;
|
|
181
|
-
propsMapping: TPropsMapping;
|
|
182
|
-
};
|
|
183
|
-
declare type TContext = {
|
|
184
|
-
mapper: TMapper;
|
|
185
|
-
propsMapping: TPropsMapping;
|
|
186
|
-
};
|
|
187
|
-
declare type TChildWrapperProps = {
|
|
188
|
-
children: ReactElement | ReactElement[];
|
|
189
|
-
component: TComponent;
|
|
190
|
-
wrapper: new () => React.Component;
|
|
191
|
-
propsMapping: TComponentPropsMapping;
|
|
192
|
-
formId?: string;
|
|
193
|
-
onMount(values: TField): void;
|
|
194
|
-
onChange(values: TField): void;
|
|
195
|
-
onRehydrate(values: TField): void;
|
|
196
|
-
onFocus(values: TField): void;
|
|
197
|
-
onClick(values: TField): void;
|
|
198
|
-
afterApiCall(values: TField): void;
|
|
199
|
-
onBlur(values: TField): void;
|
|
200
|
-
};
|
|
201
|
-
declare type TFormRefActions = {
|
|
202
|
-
submit(): void;
|
|
203
|
-
step(index: number | string): TFormValues;
|
|
204
|
-
stepForward(index?: number | string): TFormValues;
|
|
205
|
-
stepBack(index?: number | string): TFormValues;
|
|
206
|
-
validateForm(opts?: TChildrenOptions): TFormValues;
|
|
207
|
-
values(opts: Pick<TChildrenOptions, 'scopeBlurredChildren' | 'scopeChangedChildren' | 'childrenScope'>): TFormValues;
|
|
208
|
-
};
|
|
209
|
-
declare type TUseFormProps = {
|
|
210
|
-
/**
|
|
211
|
-
* The if of the form you want to connect to
|
|
212
|
-
*/
|
|
213
|
-
id?: string;
|
|
214
|
-
/**
|
|
215
|
-
* And array of ids of forms you want to connect to
|
|
216
|
-
*/
|
|
217
|
-
ids?: string[];
|
|
218
|
-
/**
|
|
219
|
-
* Callback to be called when form validity toggled
|
|
220
|
-
* @param data All the available form data
|
|
221
|
-
* @param field
|
|
222
|
-
*/
|
|
223
|
-
onValid?(data: TFormValues | Record<string, TFormValues>, field: TField): void;
|
|
224
|
-
/**
|
|
225
|
-
* Callback to be called when the form generates some new data
|
|
226
|
-
* @param data All the available form data
|
|
227
|
-
*/
|
|
228
|
-
onData?(data: TFormValues | Record<string, TFormValues>): void;
|
|
229
|
-
/**
|
|
230
|
-
* Callback to be called when the form generates some new data
|
|
231
|
-
* @param data All the available form data
|
|
232
|
-
*/
|
|
233
|
-
onClick?(data: TFormValues | Record<string, TFormValues>): void;
|
|
234
|
-
/**
|
|
235
|
-
* Callback to be called when the form submits
|
|
236
|
-
* @param data All the available form data
|
|
237
|
-
*/
|
|
238
|
-
onSubmit?(data: TFormValues | Record<string, TFormValues>): void;
|
|
239
|
-
};
|
|
240
|
-
declare type TUseFormGroupProps = {
|
|
241
|
-
/**
|
|
242
|
-
* And array of ids of forms you want to connect to
|
|
243
|
-
*/
|
|
244
|
-
ids?: string[];
|
|
245
|
-
/**
|
|
246
|
-
* The if of the form group you want to merge
|
|
247
|
-
*/
|
|
248
|
-
group?: string;
|
|
249
|
-
/**
|
|
250
|
-
* Callback to be called when the form generates some new data
|
|
251
|
-
* @param data All the available form data
|
|
252
|
-
*/
|
|
253
|
-
onData?(data: Record<string, TFormValues>): void;
|
|
254
|
-
/**
|
|
255
|
-
* Callback to be called when the form generates some new data
|
|
256
|
-
* @param data All the available form data
|
|
257
|
-
*/
|
|
258
|
-
onClick?(data: TFormValues): void;
|
|
259
|
-
/**
|
|
260
|
-
* Callback to be called when the form submits
|
|
261
|
-
* @param data All the available form data
|
|
262
|
-
*/
|
|
263
|
-
onSubmit?(data: Record<string, TFormValues>): void;
|
|
264
|
-
};
|
|
265
|
-
declare type THookReturn = {
|
|
266
|
-
/**
|
|
267
|
-
* A function that lets you start the form submission
|
|
268
|
-
*/
|
|
269
|
-
submitForm(): void;
|
|
270
|
-
/**
|
|
271
|
-
* You can call this function to get all the updated form data.
|
|
272
|
-
*
|
|
273
|
-
* @param opts Options to configure your form data. The aggregate prop is only available on useFormGroup.
|
|
274
|
-
*/
|
|
275
|
-
formData(opts?: TChildrenOptions & TGroupOption): TFormValues | Record<string, TFormValues>;
|
|
276
|
-
};
|
|
277
|
-
declare type TGroupOption = {
|
|
278
|
-
aggregate?: boolean;
|
|
279
|
-
};
|
|
280
|
-
interface TAsFormFieldProps {
|
|
281
|
-
/**
|
|
282
|
-
* The component to be used as form field.
|
|
283
|
-
*/
|
|
284
|
-
Comp: (new () => React.Component) | any;
|
|
285
|
-
/**
|
|
286
|
-
* Link for the TComponentPropsMapping likely props mapper from default form.
|
|
287
|
-
*/
|
|
288
|
-
propsMapping: TComponentPropsMapping;
|
|
289
|
-
}
|
|
290
|
-
declare type TDecorator = {
|
|
291
|
-
/**
|
|
292
|
-
* Form id that you need to create and integrate the field.
|
|
293
|
-
*/
|
|
294
|
-
formId?: string;
|
|
295
|
-
/**
|
|
296
|
-
* It's a prop that you can use to hide the component and control this state outside the component.
|
|
297
|
-
*/
|
|
298
|
-
visibility?: boolean;
|
|
299
|
-
/**
|
|
300
|
-
* Name of the component similar to name prop name on TComponent type.
|
|
301
|
-
* This name will be used later to correlate the field with the value, and you will be able to read it.
|
|
302
|
-
*/
|
|
303
|
-
name: string;
|
|
304
|
-
/**
|
|
305
|
-
* The value of the field that you can control outside the component.
|
|
306
|
-
*/
|
|
307
|
-
value?: any;
|
|
308
|
-
/**
|
|
309
|
-
* The disabled of the field that you can control outside the component.
|
|
310
|
-
*/
|
|
311
|
-
disabled?: boolean;
|
|
312
|
-
/**
|
|
313
|
-
* The optionList of the field that you can control outside the component.
|
|
314
|
-
* This optionList will be used to manipulated a list of elements. For example, Dropdown optionList.
|
|
315
|
-
*/
|
|
316
|
-
optionList?: any[];
|
|
317
|
-
/**
|
|
318
|
-
* The onSelected of the field you can control outside the component by calling a custom function.
|
|
319
|
-
* onSelected makes the data available (TField) for manipulation.
|
|
320
|
-
* It is called when you mount and rehydrate the component at the first moment.
|
|
321
|
-
* Also, it is called every time the component changes (onChange).
|
|
322
|
-
*/
|
|
323
|
-
onSelected?: (data: TField) => void;
|
|
324
|
-
};
|
|
325
|
-
declare type TDecoratorProps<OriginalComponentProps = Record<string, unknown>> = OriginalComponentProps & Pick<TComponent, 'validations' | 'masks' | 'clearFields' | 'api' | 'errorMessages' | 'filter' | 'formatters' | 'visibilityConditions'> & TDecorator;
|
|
326
|
-
export type { TComponent, TMapper, TChildrenOptions, TFormValues, TFormRefActions, TChildWrapperProps, TContext, TFormProps, TProvider, TErrorMessages, TSchemaValidation, TSchemaValidations, TUseFormProps, TUseFormGroupProps, THookReturn, TAsFormFieldProps, TDecoratorProps, TGroupOption, };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { THookReturn, TUseFormProps } from '../react/types';
|
|
2
|
-
/**
|
|
3
|
-
* This hooks lets you connect to your form/s in anywhere in your application. Even if you are outside the <FormProvider />
|
|
4
|
-
*
|
|
5
|
-
* You can connect to:
|
|
6
|
-
* - A specific form
|
|
7
|
-
* - Several forms identified by their id's
|
|
8
|
-
* - A group of forms
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
declare const useForm: ({ onValid, onData, onClick, onSubmit, id, ids, }: TUseFormProps) => THookReturn;
|
|
12
|
-
export default useForm;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* This file will allow to expose functions to be used as formatters in schema and HOC
|
|
4
|
-
*
|
|
5
|
-
* Since it is a formatter, you can also expose its "undo" function that will allow form to make logic on the value without the
|
|
6
|
-
* formatter applied
|
|
7
|
-
*
|
|
8
|
-
* EG:
|
|
9
|
-
* splitter -> 22/33/4444
|
|
10
|
-
* undo_splitter -> 22334444
|
|
11
|
-
*
|
|
12
|
-
* This undo will be called when the form is filtering the data on the input if it has formatters configured
|
|
13
|
-
*/
|
|
14
|
-
import { TSchemaFormatters } from '@core/types';
|
|
15
|
-
declare const run: (value: any, componentFormatters: TSchemaFormatters, undo?: boolean) => string | number;
|
|
16
|
-
export { run };
|
package/src/core/apis/index.d.ts
DELETED
package/src/core/apis/masks.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TErrorMessages, TErrors, TFieldData, TVAvailableValidations } from '@core/types';
|
|
2
|
-
declare type TRuleValue = string | number | boolean | undefined;
|
|
3
|
-
export interface ICustomValidationValue {
|
|
4
|
-
from: number;
|
|
5
|
-
to: number;
|
|
6
|
-
validations: Record<string, any>;
|
|
7
|
-
}
|
|
8
|
-
declare const run: (value: TRuleValue, rules: TVAvailableValidations, errorMessages?: TErrorMessages, formData?: TFieldData) => TErrors;
|
|
9
|
-
declare const generateCustomError: (name: string, message: string) => TErrors;
|
|
10
|
-
declare const hasError: (errors?: TErrors) => boolean;
|
|
11
|
-
export { generateCustomError, hasError, run };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const concatenate: (a: any, b: any) => any;
|
|
2
|
-
export declare const add: (a: any, b: any) => string;
|
|
3
|
-
export declare const subtract: (a: any, b: any) => number;
|
|
4
|
-
export declare const replaceAll: (value: string, searchValue: string, replaceValue: string) => string;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { TEventsKeys } from '@core/types';
|
|
2
|
-
export declare const enum EEVents {
|
|
3
|
-
ON_FIELD_VALIDATION_TOGGLE = "ON_FIELD_VALIDATION_TOGGLE",
|
|
4
|
-
ON_FIELD_MOUNT = "ON_FIELD_MOUNT",
|
|
5
|
-
ON_FIELD_CHANGE = "ON_FIELD_CHANGE",
|
|
6
|
-
ON_FIELD_BLUR = "ON_FIELD_BLUR",
|
|
7
|
-
ON_FIELD_FOCUS = "ON_FIELD_FOCUS",
|
|
8
|
-
ON_FIELD_REHYDRATE = "ON_FIELD_REHYDRATE",
|
|
9
|
-
ON_FIELD_CLEARED = "ON_FIELD_CLEARED",
|
|
10
|
-
ON_FIELD_CLICK = "ON_FIELD_CLICK",
|
|
11
|
-
ON_FIELD_KEYUP = "ON_FIELD_KEYUP",
|
|
12
|
-
ON_FIELD_KEYDOWN = "ON_FIELD_KEYDOWN",
|
|
13
|
-
ON_FIELD_BINDED = "ON_FIELD_BINDED",
|
|
14
|
-
AFTER_FIELD_API_CALL = "AFTER_FIELD_API_CALL",
|
|
15
|
-
RUN_FIELD_VALIDATIONS = "RUN_FIELD_VALIDATIONS",
|
|
16
|
-
RUN_FIELD_MASKS = "RUN_FIELD_MASKS",
|
|
17
|
-
RUN_FIELD_FORMATTERS = "RUN_FIELD_FORMATTERS",
|
|
18
|
-
ON_SCOPE_CHANGE = "ON_SCOPE_CHANGE",
|
|
19
|
-
ON_FORM_REHYDRATE = "ON_FORM_REHYDRATE",
|
|
20
|
-
ON_FORM_SUBMIT = "ON_FORM_SUBMIT",
|
|
21
|
-
ON_FORM_MOUNT = "ON_FORM_MOUNT",
|
|
22
|
-
ON_FORM_UN_MOUNT = "ON_FORM_UN_MOUNT",
|
|
23
|
-
ON_FORM_DATA = "ON_FORM_DATA",
|
|
24
|
-
ON_FORM_DESTROY_FIELD = "ON_FORM_DESTROY_FIELD",
|
|
25
|
-
NAVIGATE_STEP = "NAVIGATE_STEP",
|
|
26
|
-
NAVIGATE_STEP_FORWARD = "NAVIGATE_STEP_FORWARD",
|
|
27
|
-
NAVIGATE_STEP_BACK = "NAVIGATE_STEP_BACK",
|
|
28
|
-
VALIDATE_FORM = "VALIDATE_FORM",
|
|
29
|
-
BIND_FIELDS = "BIND_FIELDS",
|
|
30
|
-
LOG = "LOG"
|
|
31
|
-
}
|
|
32
|
-
export declare const CoreEvents: Record<TEventsKeys, TEventsKeys>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare const DEFAULT_FORM_ID = "default_form_id";
|
|
2
|
-
declare const DEFAULT_FORM_HOOK_ID = "default_form_hook_id";
|
|
3
|
-
export { ALL_NAMESPACE_EVENTS, BUILD_EVENT, EXTRACT_EVENT_NAMESPACE, EXTRACT_CORE_NAMESPACE, } from '@core/constants/observer';
|
|
4
|
-
export { CoreEvents, EEVents } from '@core/constants/events';
|
|
5
|
-
export { DEFAULT_FORM_ID, DEFAULT_FORM_HOOK_ID };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TEventsKeys } from '@core';
|
|
2
|
-
import { EEVents } from '@core/constants';
|
|
3
|
-
declare const EXTRACT_EVENT_NAMESPACE: (event: TEventsKeys) => EEVents;
|
|
4
|
-
declare const BUILD_EVENT: (event: EEVents, namespace?: string, key?: string) => EEVents;
|
|
5
|
-
declare const ALL_NAMESPACE_EVENTS: (event: TEventsKeys) => EEVents;
|
|
6
|
-
declare const EXTRACT_CORE_NAMESPACE: (event: TEventsKeys) => EEVents;
|
|
7
|
-
export { ALL_NAMESPACE_EVENTS, BUILD_EVENT, EXTRACT_EVENT_NAMESPACE, EXTRACT_CORE_NAMESPACE, };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import Field from '@core/managers/Field';
|
|
2
|
-
import { Form } from '@core/managers/Form';
|
|
3
|
-
import { TEventReducedSchema, TEventsKeys, TFormEventDirectives, TObserverData } from '@core/types';
|
|
4
|
-
export declare type TEventPublishPayload = {
|
|
5
|
-
checksum?: string;
|
|
6
|
-
} & {
|
|
7
|
-
[key in string]?: unknown;
|
|
8
|
-
};
|
|
9
|
-
export declare type TEventInformation<T> = TObserverData<T> & {
|
|
10
|
-
eventReducedSchema: TEventReducedSchema;
|
|
11
|
-
formEventDirectives: TFormEventDirectives;
|
|
12
|
-
form: Form;
|
|
13
|
-
field: Field;
|
|
14
|
-
coreEvent: TEventsKeys;
|
|
15
|
-
};
|
|
16
|
-
export declare enum EFlowLogging {
|
|
17
|
-
OBSERVER = "OBSERVER",
|
|
18
|
-
REACT_FIELD_ADAPTER = "REACT FIELD ADAPTER",
|
|
19
|
-
FIELD_HANDLER = "FIELD HANDLER"
|
|
20
|
-
}
|
|
21
|
-
export declare type TLoggingEvent = {
|
|
22
|
-
level: 'error' | 'info';
|
|
23
|
-
data?: any;
|
|
24
|
-
flow: EFlowLogging;
|
|
25
|
-
action: string;
|
|
26
|
-
error?: any;
|
|
27
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TComponent } from '@core';
|
|
2
|
-
import * as Events from '@core/events';
|
|
3
|
-
export declare const handler: ({ field, form, eventReducedSchema: { api }, }: Pick<Events.TEventInformation<unknown>, 'form' | 'field' | 'eventReducedSchema'>) => void;
|
|
4
|
-
export declare const events: (component: TComponent) => string[];
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import * as Events from '@core/events';
|
|
2
|
-
import { TComponent } from '@core';
|
|
3
|
-
export declare const handler: ({ field, form, eventReducedSchema, }: Pick<Events.TEventInformation<unknown>, 'form' | 'eventReducedSchema' | 'field'>) => void;
|
|
4
|
-
export declare const events: (component: TComponent) => string[];
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TComponent } from '@core';
|
|
2
|
-
import { TEventInformation } from '@core/events';
|
|
3
|
-
export declare const handler: ({ data, field, eventReducedSchema: { formatters }, }: TEventInformation<unknown>) => void;
|
|
4
|
-
export declare const events: (component: TComponent) => string[];
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TComponent } from '@core';
|
|
2
|
-
import * as Events from '@core/events';
|
|
3
|
-
export declare const handler: ({ field, eventReducedSchema: { validations }, form, }: Pick<Events.TEventInformation<unknown>, 'field' | 'eventReducedSchema' | 'form'>) => void;
|
|
4
|
-
export declare const events: (component: TComponent) => string[];
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TComponent } from '@core';
|
|
2
|
-
import * as Events from '@core/events';
|
|
3
|
-
export declare const handler: ({ form, field, eventReducedSchema, }: Pick<Events.TEventInformation<unknown>, 'form' | 'field' | 'eventReducedSchema'>) => void;
|
|
4
|
-
export declare const events: (component: TComponent) => string[];
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { TSchema } from '@core';
|
|
2
|
-
import * as Events from '@core/events';
|
|
3
|
-
import * as change from '@core/handlers/field/change';
|
|
4
|
-
import * as mount from '@core/handlers/field/mount';
|
|
5
|
-
import * as blur from '@core/handlers/field/blur';
|
|
6
|
-
import * as focus from '@core/handlers/field/focus';
|
|
7
|
-
import * as templating from './common/templating';
|
|
8
|
-
import * as api from '@core/handlers/field/api';
|
|
9
|
-
import * as data from '@core/handlers/field/data';
|
|
10
|
-
import * as filter from '@core/handlers/field/filter';
|
|
11
|
-
import * as validations from '@core/handlers/field/validations';
|
|
12
|
-
import * as hooks from '@core/handlers/form/hooks';
|
|
13
|
-
import * as steps from '@core/handlers/form/steps';
|
|
14
|
-
import * as validate from '@core/handlers/form/validate';
|
|
15
|
-
import * as bindFields from '@core/handlers/form/bindFields';
|
|
16
|
-
import * as formLevelVisibilityConditions from '@core/handlers/form/visibilityConditions';
|
|
17
|
-
import * as formTemplating from '@core/handlers/form/templating';
|
|
18
|
-
declare const register: (observer: Events.Observer, flows: any, component?: any | TSchema) => void;
|
|
19
|
-
declare const fieldFlows: () => {
|
|
20
|
-
ON_FIELD_MOUNT: (typeof mount)[];
|
|
21
|
-
ON_FIELD_CHANGE: (typeof change | typeof api | typeof data)[];
|
|
22
|
-
ON_FIELD_KEYUP: (typeof filter)[];
|
|
23
|
-
ON_FIELD_KEYDOWN: (typeof filter)[];
|
|
24
|
-
ON_FIELD_REHYDRATE: (typeof validations)[];
|
|
25
|
-
ON_FIELD_CLEARED: (typeof filter)[];
|
|
26
|
-
ON_FIELD_BINDED: (typeof filter)[];
|
|
27
|
-
ON_FIELD_CLICK: (typeof api)[];
|
|
28
|
-
ON_FIELD_BLUR: (typeof blur | typeof data)[];
|
|
29
|
-
ON_FIELD_FOCUS: (typeof focus)[];
|
|
30
|
-
AFTER_FIELD_API_CALL: (typeof filter)[];
|
|
31
|
-
};
|
|
32
|
-
declare const formFlows: () => {
|
|
33
|
-
[x: string]: (typeof formTemplating)[];
|
|
34
|
-
ON_SCOPE_CHANGE: (typeof formTemplating)[];
|
|
35
|
-
ON_FORM_MOUNT: (typeof templating | typeof steps | typeof formLevelVisibilityConditions)[];
|
|
36
|
-
VALIDATE_FORM: (typeof validate)[];
|
|
37
|
-
ON_FORM_SUBMIT: (typeof hooks)[];
|
|
38
|
-
ON_FORM_UN_MOUNT: (typeof hooks)[];
|
|
39
|
-
NAVIGATE_STEP: (typeof steps)[];
|
|
40
|
-
NAVIGATE_STEP_BACK: (typeof steps)[];
|
|
41
|
-
NAVIGATE_STEP_FORWARD: (typeof steps)[];
|
|
42
|
-
ON_FORM_REHYDRATE: (typeof formLevelVisibilityConditions)[];
|
|
43
|
-
ON_FIELD_CHANGE: (typeof formLevelVisibilityConditions)[];
|
|
44
|
-
BIND_FIELDS: (typeof bindFields)[];
|
|
45
|
-
ON_FORM_DESTROY_FIELD: (typeof data)[];
|
|
46
|
-
};
|
|
47
|
-
export { register, fieldFlows, formFlows };
|