@bolttech/form-engine 3.1.0-beta.11 → 3.1.0-beta.12
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/index.esm.js +11 -6
- package/package.json +2 -2
- package/src/helpers/mapper.d.ts +2 -1
- package/src/types/index.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1791,8 +1791,10 @@ const eventsMapping = {
|
|
|
1791
1791
|
ON_FIELD_KEYDOWN: 'onKeyDown',
|
|
1792
1792
|
ON_FIELD_KEYUP: 'onKeyUp',
|
|
1793
1793
|
ON_FIELD_MOUNT: 'onMount',
|
|
1794
|
+
ON_API_FIELD_REQUEST: 'onApiRequest',
|
|
1794
1795
|
ON_API_FIELD_RESPONSE: 'onApiResponse',
|
|
1795
|
-
ON_FIELD_CLICK: 'onClick'
|
|
1796
|
+
ON_FIELD_CLICK: 'onClick',
|
|
1797
|
+
ON_FIELD_CLEARED: 'onFieldCleared'
|
|
1796
1798
|
};
|
|
1797
1799
|
|
|
1798
1800
|
/**
|
|
@@ -2142,12 +2144,11 @@ const FieldWrapper = ({
|
|
|
2142
2144
|
visibility: typeof visibility === 'boolean' ? visibility : true,
|
|
2143
2145
|
props: filteredProps
|
|
2144
2146
|
});
|
|
2145
|
-
const mountedRef = useRef(false);
|
|
2146
2147
|
/**
|
|
2147
2148
|
* handles the mounting and unmounting logic onto the field instance
|
|
2148
2149
|
*/
|
|
2149
2150
|
useEffect(() => {
|
|
2150
|
-
if (!fieldInstance ||
|
|
2151
|
+
if (!fieldInstance || (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mounted)) return;
|
|
2151
2152
|
fieldInstance.mountField({
|
|
2152
2153
|
valueSubscription: value => {
|
|
2153
2154
|
setValueState(value);
|
|
@@ -2164,14 +2165,13 @@ const FieldWrapper = ({
|
|
|
2164
2165
|
}));
|
|
2165
2166
|
}
|
|
2166
2167
|
});
|
|
2167
|
-
mountedRef.current = true;
|
|
2168
2168
|
}, [fieldInstance]);
|
|
2169
2169
|
/**
|
|
2170
2170
|
* recycle effect to remove the field Subscriptions due to memory leaks
|
|
2171
2171
|
*/
|
|
2172
2172
|
useEffect(() => {
|
|
2173
2173
|
return () => {
|
|
2174
|
-
|
|
2174
|
+
(fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mounted) && (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.destroyField());
|
|
2175
2175
|
};
|
|
2176
2176
|
}, []);
|
|
2177
2177
|
/**
|
|
@@ -2397,6 +2397,11 @@ const checkedChangeEvent = event => {
|
|
|
2397
2397
|
const valueChangeEvent = event => {
|
|
2398
2398
|
return event.target.value;
|
|
2399
2399
|
};
|
|
2400
|
+
const numberInputChangeEvent = number => {
|
|
2401
|
+
if (number) {
|
|
2402
|
+
return Number(number);
|
|
2403
|
+
}
|
|
2404
|
+
};
|
|
2400
2405
|
const datepickerChangeEvent = event => event;
|
|
2401
2406
|
const dropdownChangeEvent = (event, opts) => {
|
|
2402
2407
|
if (typeof event === 'object' && event !== null && 'value' in event && 'id' in event) {
|
|
@@ -2420,4 +2425,4 @@ const dropdownChangeEvent = (event, opts) => {
|
|
|
2420
2425
|
}
|
|
2421
2426
|
};
|
|
2422
2427
|
|
|
2423
|
-
export { AsFormField, AsFormFieldBuilder, Form, FormGroupContext, FormGroupContextProvider, checkedChangeEvent, datepickerChangeEvent, defaultChangeEvent, dropdownChangeEvent, useForm, useFormGroup, useFormGroupContext, valueChangeEvent };
|
|
2428
|
+
export { AsFormField, AsFormFieldBuilder, Form, FormGroupContext, FormGroupContextProvider, checkedChangeEvent, datepickerChangeEvent, defaultChangeEvent, dropdownChangeEvent, numberInputChangeEvent, useForm, useFormGroup, useFormGroupContext, valueChangeEvent };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolttech/form-engine",
|
|
3
|
-
"version": "3.1.0-beta.
|
|
3
|
+
"version": "3.1.0-beta.12",
|
|
4
4
|
"description": "A react adapter for bolttech form engine",
|
|
5
5
|
"module": "./index.esm.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.esm.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@bolttech/form-engine-core": "1.0.0-beta.
|
|
9
|
+
"@bolttech/form-engine-core": "1.0.0-beta.12",
|
|
10
10
|
"react": "18.2.0"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {}
|
package/src/helpers/mapper.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { TValueChangeEvent } from '@bolttech/form-engine-core';
|
|
|
2
2
|
declare const defaultChangeEvent: TValueChangeEvent;
|
|
3
3
|
declare const checkedChangeEvent: TValueChangeEvent;
|
|
4
4
|
declare const valueChangeEvent: TValueChangeEvent;
|
|
5
|
+
declare const numberInputChangeEvent: TValueChangeEvent;
|
|
5
6
|
declare const datepickerChangeEvent: TValueChangeEvent;
|
|
6
7
|
declare const dropdownChangeEvent: TValueChangeEvent;
|
|
7
|
-
export { defaultChangeEvent, checkedChangeEvent, valueChangeEvent, datepickerChangeEvent, dropdownChangeEvent, };
|
|
8
|
+
export { defaultChangeEvent, checkedChangeEvent, valueChangeEvent, numberInputChangeEvent, datepickerChangeEvent, dropdownChangeEvent, };
|
package/src/types/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ type TFieldWrapper = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents the possible event properties for form fields callbacks.
|
|
14
14
|
*/
|
|
15
|
-
type TEventProps = 'onChange' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'onMount' | 'onApiResponse' | 'onClick';
|
|
15
|
+
type TEventProps = 'onChange' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onKeyUp' | 'onMount' | 'onApiResponse' | 'onApiRequest' | 'onClick' | 'onFieldCleared';
|
|
16
16
|
/**
|
|
17
17
|
* Represents the content inside onData payload action.
|
|
18
18
|
*/
|