@bolttech/form-engine 3.1.0-beta.9 → 3.1.1-beta.0
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 +14 -0
- package/index.esm.js +84 -53
- package/package.json +2 -2
- package/src/context/FormGroupContext.type.d.ts +3 -3
- package/src/helpers/mapper.d.ts +2 -1
- package/src/types/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ This is an adapter to be used with the bolttech form engine. Compatible with Nex
|
|
|
25
25
|
- 6.7 [resetValues](#resetvalues)
|
|
26
26
|
- 6.8 [visibilityConditions](#visibilityconditions)
|
|
27
27
|
- 6.9 [resetPropertyValues](#resetpropertyvalues)
|
|
28
|
+
- 6.10 [visibility](#visibility)
|
|
29
|
+
- 6.11 [persistValue](#persistValue)
|
|
28
30
|
|
|
29
31
|
7. [templating](#templating)
|
|
30
32
|
|
|
@@ -1003,6 +1005,18 @@ resetPropertyValues: [
|
|
|
1003
1005
|
],
|
|
1004
1006
|
```
|
|
1005
1007
|
|
|
1008
|
+
<a id="visibility">
|
|
1009
|
+
|
|
1010
|
+
## **visibility**
|
|
1011
|
+
|
|
1012
|
+
visibility prop is used to initiate the component with an initial visibility flag, before visibilityConditions take place, used on SSR
|
|
1013
|
+
|
|
1014
|
+
<a id="persistValue">
|
|
1015
|
+
|
|
1016
|
+
## **persistValue**
|
|
1017
|
+
|
|
1018
|
+
persistValue is a flag that deremines if the field gets hidden, the moment it comes back visible, it will hold the previous value or not
|
|
1019
|
+
|
|
1006
1020
|
<a id="templating"></a>
|
|
1007
1021
|
|
|
1008
1022
|
## **templating**
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { createContext, useContext, useRef, useEffect, useState, useMemo, useCallback, Suspense } from 'react';
|
|
3
|
-
import { FormGroup,
|
|
3
|
+
import { FormGroup, FormField } from '@bolttech/form-engine-core';
|
|
4
4
|
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
6
|
|
|
@@ -88,7 +88,7 @@ var check = function (it) {
|
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
91
|
-
var
|
|
91
|
+
var globalThis_1 =
|
|
92
92
|
// eslint-disable-next-line es/no-global-this -- safe
|
|
93
93
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
94
94
|
check(typeof window == 'object' && window) ||
|
|
@@ -101,30 +101,30 @@ var global$b =
|
|
|
101
101
|
|
|
102
102
|
var sharedStore = {exports: {}};
|
|
103
103
|
|
|
104
|
-
var
|
|
104
|
+
var globalThis$c = globalThis_1;
|
|
105
105
|
|
|
106
106
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
107
107
|
var defineProperty$5 = Object.defineProperty;
|
|
108
108
|
|
|
109
109
|
var defineGlobalProperty$3 = function (key, value) {
|
|
110
110
|
try {
|
|
111
|
-
defineProperty$5(
|
|
111
|
+
defineProperty$5(globalThis$c, key, { value: value, configurable: true, writable: true });
|
|
112
112
|
} catch (error) {
|
|
113
|
-
|
|
113
|
+
globalThis$c[key] = value;
|
|
114
114
|
} return value;
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
var globalThis$
|
|
117
|
+
var globalThis$b = globalThis_1;
|
|
118
118
|
var defineGlobalProperty$2 = defineGlobalProperty$3;
|
|
119
119
|
|
|
120
120
|
var SHARED = '__core-js_shared__';
|
|
121
|
-
var store$3 = sharedStore.exports = globalThis$
|
|
121
|
+
var store$3 = sharedStore.exports = globalThis$b[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
122
122
|
|
|
123
123
|
(store$3.versions || (store$3.versions = [])).push({
|
|
124
|
-
version: '3.
|
|
124
|
+
version: '3.39.0',
|
|
125
125
|
mode: 'global',
|
|
126
126
|
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
127
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
127
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE',
|
|
128
128
|
source: 'https://github.com/zloirock/core-js'
|
|
129
129
|
});
|
|
130
130
|
|
|
@@ -166,13 +166,18 @@ var uid$2 = function (key) {
|
|
|
166
166
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
var
|
|
169
|
+
var globalThis$a = globalThis_1;
|
|
170
170
|
|
|
171
|
-
var
|
|
172
|
-
var userAgent =
|
|
171
|
+
var navigator = globalThis$a.navigator;
|
|
172
|
+
var userAgent$1 = navigator && navigator.userAgent;
|
|
173
173
|
|
|
174
|
-
var
|
|
175
|
-
|
|
174
|
+
var environmentUserAgent = userAgent$1 ? String(userAgent$1) : '';
|
|
175
|
+
|
|
176
|
+
var globalThis$9 = globalThis_1;
|
|
177
|
+
var userAgent = environmentUserAgent;
|
|
178
|
+
|
|
179
|
+
var process = globalThis$9.process;
|
|
180
|
+
var Deno = globalThis$9.Deno;
|
|
176
181
|
var versions = process && process.versions || Deno && Deno.version;
|
|
177
182
|
var v8 = versions && versions.v8;
|
|
178
183
|
var match, version;
|
|
@@ -194,14 +199,14 @@ if (!version && userAgent) {
|
|
|
194
199
|
}
|
|
195
200
|
}
|
|
196
201
|
|
|
197
|
-
var
|
|
202
|
+
var environmentV8Version = version;
|
|
198
203
|
|
|
199
204
|
/* eslint-disable es/no-symbol -- required for testing */
|
|
200
|
-
var V8_VERSION =
|
|
205
|
+
var V8_VERSION = environmentV8Version;
|
|
201
206
|
var fails$8 = fails$b;
|
|
202
|
-
var
|
|
207
|
+
var globalThis$8 = globalThis_1;
|
|
203
208
|
|
|
204
|
-
var $String$4 =
|
|
209
|
+
var $String$4 = globalThis$8.String;
|
|
205
210
|
|
|
206
211
|
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
207
212
|
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$8(function () {
|
|
@@ -218,18 +223,18 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$8(func
|
|
|
218
223
|
/* eslint-disable es/no-symbol -- required for testing */
|
|
219
224
|
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
220
225
|
|
|
221
|
-
var useSymbolAsUid = NATIVE_SYMBOL$1
|
|
222
|
-
|
|
223
|
-
|
|
226
|
+
var useSymbolAsUid = NATIVE_SYMBOL$1 &&
|
|
227
|
+
!Symbol.sham &&
|
|
228
|
+
typeof Symbol.iterator == 'symbol';
|
|
224
229
|
|
|
225
|
-
var
|
|
230
|
+
var globalThis$7 = globalThis_1;
|
|
226
231
|
var shared$2 = shared$3;
|
|
227
232
|
var hasOwn$8 = hasOwnProperty_1;
|
|
228
233
|
var uid$1 = uid$2;
|
|
229
234
|
var NATIVE_SYMBOL = symbolConstructorDetection;
|
|
230
235
|
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
|
231
236
|
|
|
232
|
-
var Symbol$1 =
|
|
237
|
+
var Symbol$1 = globalThis$7.Symbol;
|
|
233
238
|
var WellKnownSymbolsStore = shared$2('wks');
|
|
234
239
|
var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
|
|
235
240
|
|
|
@@ -295,10 +300,10 @@ var v8PrototypeDefineBug = DESCRIPTORS$9 && fails$6(function () {
|
|
|
295
300
|
|
|
296
301
|
var objectDefineProperty = {};
|
|
297
302
|
|
|
298
|
-
var
|
|
303
|
+
var globalThis$6 = globalThis_1;
|
|
299
304
|
var isObject$6 = isObject$8;
|
|
300
305
|
|
|
301
|
-
var document$1 =
|
|
306
|
+
var document$1 = globalThis$6.document;
|
|
302
307
|
// typeof document.createElement is 'object' in old IE
|
|
303
308
|
var EXISTS$1 = isObject$6(document$1) && isObject$6(document$1.createElement);
|
|
304
309
|
|
|
@@ -326,7 +331,7 @@ var functionCall = NATIVE_BIND ? call$5.bind(call$5) : function () {
|
|
|
326
331
|
return call$5.apply(call$5, arguments);
|
|
327
332
|
};
|
|
328
333
|
|
|
329
|
-
var
|
|
334
|
+
var globalThis$5 = globalThis_1;
|
|
330
335
|
var isCallable$b = isCallable$d;
|
|
331
336
|
|
|
332
337
|
var aFunction = function (argument) {
|
|
@@ -334,7 +339,7 @@ var aFunction = function (argument) {
|
|
|
334
339
|
};
|
|
335
340
|
|
|
336
341
|
var getBuiltIn$3 = function (namespace, method) {
|
|
337
|
-
return arguments.length < 2 ? aFunction(
|
|
342
|
+
return arguments.length < 2 ? aFunction(globalThis$5[namespace]) : globalThis$5[namespace] && globalThis$5[namespace][method];
|
|
338
343
|
};
|
|
339
344
|
|
|
340
345
|
var uncurryThis$6 = functionUncurryThis;
|
|
@@ -673,7 +678,8 @@ var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
|
673
678
|
activeXDocument.write(scriptTag(''));
|
|
674
679
|
activeXDocument.close();
|
|
675
680
|
var temp = activeXDocument.parentWindow.Object;
|
|
676
|
-
|
|
681
|
+
// eslint-disable-next-line no-useless-assignment -- avoid memory leak
|
|
682
|
+
activeXDocument = null;
|
|
677
683
|
return temp;
|
|
678
684
|
};
|
|
679
685
|
|
|
@@ -754,10 +760,10 @@ var addToUnscopables$1 = function (key) {
|
|
|
754
760
|
|
|
755
761
|
var iterators = {};
|
|
756
762
|
|
|
757
|
-
var
|
|
763
|
+
var globalThis$4 = globalThis_1;
|
|
758
764
|
var isCallable$7 = isCallable$d;
|
|
759
765
|
|
|
760
|
-
var WeakMap$1 =
|
|
766
|
+
var WeakMap$1 = globalThis$4.WeakMap;
|
|
761
767
|
|
|
762
768
|
var weakMapBasicDetection = isCallable$7(WeakMap$1) && /native code/.test(String(WeakMap$1));
|
|
763
769
|
|
|
@@ -782,7 +788,7 @@ var createNonEnumerableProperty$4 = DESCRIPTORS$5 ? function (object, key, value
|
|
|
782
788
|
};
|
|
783
789
|
|
|
784
790
|
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
785
|
-
var
|
|
791
|
+
var globalThis$3 = globalThis_1;
|
|
786
792
|
var isObject$3 = isObject$8;
|
|
787
793
|
var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
|
|
788
794
|
var hasOwn$6 = hasOwnProperty_1;
|
|
@@ -791,8 +797,8 @@ var sharedKey$1 = sharedKey$3;
|
|
|
791
797
|
var hiddenKeys$1 = hiddenKeys$4;
|
|
792
798
|
|
|
793
799
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
794
|
-
var TypeError$1 =
|
|
795
|
-
var WeakMap =
|
|
800
|
+
var TypeError$1 = globalThis$3.TypeError;
|
|
801
|
+
var WeakMap = globalThis$3.WeakMap;
|
|
796
802
|
var set, get, has;
|
|
797
803
|
|
|
798
804
|
var enforce = function (it) {
|
|
@@ -1085,7 +1091,7 @@ var POLYFILL = isForced$1.POLYFILL = 'P';
|
|
|
1085
1091
|
|
|
1086
1092
|
var isForced_1 = isForced$1;
|
|
1087
1093
|
|
|
1088
|
-
var
|
|
1094
|
+
var globalThis$2 = globalThis_1;
|
|
1089
1095
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
1090
1096
|
var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
|
|
1091
1097
|
var defineBuiltIn$2 = defineBuiltIn$3;
|
|
@@ -1114,11 +1120,11 @@ var _export = function (options, source) {
|
|
|
1114
1120
|
var STATIC = options.stat;
|
|
1115
1121
|
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
1116
1122
|
if (GLOBAL) {
|
|
1117
|
-
target =
|
|
1123
|
+
target = globalThis$2;
|
|
1118
1124
|
} else if (STATIC) {
|
|
1119
|
-
target =
|
|
1125
|
+
target = globalThis$2[TARGET] || defineGlobalProperty(TARGET, {});
|
|
1120
1126
|
} else {
|
|
1121
|
-
target =
|
|
1127
|
+
target = globalThis$2[TARGET] && globalThis$2[TARGET].prototype;
|
|
1122
1128
|
}
|
|
1123
1129
|
if (target) for (key in source) {
|
|
1124
1130
|
sourceProperty = source[key];
|
|
@@ -1444,7 +1450,7 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
|
|
|
1444
1450
|
var target = state.target;
|
|
1445
1451
|
var index = state.index++;
|
|
1446
1452
|
if (!target || index >= target.length) {
|
|
1447
|
-
state.target =
|
|
1453
|
+
state.target = null;
|
|
1448
1454
|
return createIterResultObject(undefined, true);
|
|
1449
1455
|
}
|
|
1450
1456
|
switch (state.kind) {
|
|
@@ -1512,7 +1518,7 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
|
|
|
1512
1518
|
|
|
1513
1519
|
var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
|
|
1514
1520
|
|
|
1515
|
-
var
|
|
1521
|
+
var globalThis$1 = globalThis_1;
|
|
1516
1522
|
var DOMIterables = domIterables;
|
|
1517
1523
|
var DOMTokenListPrototype = domTokenListPrototype;
|
|
1518
1524
|
var ArrayIteratorMethods = es_array_iterator;
|
|
@@ -1544,7 +1550,7 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
|
|
|
1544
1550
|
};
|
|
1545
1551
|
|
|
1546
1552
|
for (var COLLECTION_NAME in DOMIterables) {
|
|
1547
|
-
handlePrototype(
|
|
1553
|
+
handlePrototype(globalThis$1[COLLECTION_NAME] && globalThis$1[COLLECTION_NAME].prototype, COLLECTION_NAME);
|
|
1548
1554
|
}
|
|
1549
1555
|
|
|
1550
1556
|
handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
|
|
@@ -1656,6 +1662,7 @@ const IsolatedContext = ({
|
|
|
1656
1662
|
const formGroupInstance = useRef(new FormGroup({
|
|
1657
1663
|
config
|
|
1658
1664
|
}));
|
|
1665
|
+
const formGroupContextMountRef = useRef(false);
|
|
1659
1666
|
const addFormWithIndex = index => {
|
|
1660
1667
|
formGroupInstance.current.createFormWithIndex({
|
|
1661
1668
|
index,
|
|
@@ -1664,11 +1671,11 @@ const IsolatedContext = ({
|
|
|
1664
1671
|
};
|
|
1665
1672
|
const addForm = ({
|
|
1666
1673
|
key,
|
|
1667
|
-
|
|
1674
|
+
params
|
|
1668
1675
|
}) => {
|
|
1669
1676
|
formGroupInstance.current.addForm({
|
|
1670
1677
|
key,
|
|
1671
|
-
|
|
1678
|
+
params
|
|
1672
1679
|
});
|
|
1673
1680
|
};
|
|
1674
1681
|
const removeForm = ({
|
|
@@ -1686,9 +1693,23 @@ const IsolatedContext = ({
|
|
|
1686
1693
|
const printFormGroupInstance = () => {
|
|
1687
1694
|
console.log(formGroupInstance.current.printFormGroupInstance());
|
|
1688
1695
|
};
|
|
1689
|
-
function submitMultipleFormsByIndex(indexes) {
|
|
1690
|
-
return formGroupInstance.current.submitMultipleFormsByIndex(indexes);
|
|
1696
|
+
function submitMultipleFormsByIndex(indexes, callback) {
|
|
1697
|
+
return formGroupInstance.current.submitMultipleFormsByIndex(indexes, callback);
|
|
1691
1698
|
}
|
|
1699
|
+
useEffect(() => {
|
|
1700
|
+
return () => {
|
|
1701
|
+
if (formGroupContextMountRef.current) {
|
|
1702
|
+
// strictMode made me do this, Beato Carlo Acutis please forgive me
|
|
1703
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1704
|
+
formGroupInstance.current.destroy();
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
}, []);
|
|
1708
|
+
useEffect(() => {
|
|
1709
|
+
return () => {
|
|
1710
|
+
formGroupContextMountRef.current = true;
|
|
1711
|
+
};
|
|
1712
|
+
}, []);
|
|
1692
1713
|
return {
|
|
1693
1714
|
addFormWithIndex,
|
|
1694
1715
|
addForm,
|
|
@@ -1791,8 +1812,10 @@ const eventsMapping = {
|
|
|
1791
1812
|
ON_FIELD_KEYDOWN: 'onKeyDown',
|
|
1792
1813
|
ON_FIELD_KEYUP: 'onKeyUp',
|
|
1793
1814
|
ON_FIELD_MOUNT: 'onMount',
|
|
1815
|
+
ON_API_FIELD_REQUEST: 'onApiRequest',
|
|
1794
1816
|
ON_API_FIELD_RESPONSE: 'onApiResponse',
|
|
1795
|
-
ON_FIELD_CLICK: 'onClick'
|
|
1817
|
+
ON_FIELD_CLICK: 'onClick',
|
|
1818
|
+
ON_FIELD_CLEARED: 'onFieldCleared'
|
|
1796
1819
|
};
|
|
1797
1820
|
|
|
1798
1821
|
/**
|
|
@@ -1939,7 +1962,7 @@ function Form({
|
|
|
1939
1962
|
if (mountedRef.current) return;
|
|
1940
1963
|
formGroupInstance.addForm({
|
|
1941
1964
|
key: schemaIndex,
|
|
1942
|
-
|
|
1965
|
+
params: {
|
|
1943
1966
|
schema,
|
|
1944
1967
|
initialValues: initialValues || (schema === null || schema === void 0 ? void 0 : schema.initialValues),
|
|
1945
1968
|
iVars: iVars || (schema === null || schema === void 0 ? void 0 : schema.iVars),
|
|
@@ -1948,7 +1971,7 @@ function Form({
|
|
|
1948
1971
|
index: schemaIndex,
|
|
1949
1972
|
mappers,
|
|
1950
1973
|
config: config || formGroupInstance.config
|
|
1951
|
-
}
|
|
1974
|
+
}
|
|
1952
1975
|
});
|
|
1953
1976
|
setMounted(true);
|
|
1954
1977
|
mountedRef.current = true;
|
|
@@ -2142,12 +2165,11 @@ const FieldWrapper = ({
|
|
|
2142
2165
|
visibility: typeof visibility === 'boolean' ? visibility : true,
|
|
2143
2166
|
props: filteredProps
|
|
2144
2167
|
});
|
|
2145
|
-
const mountedRef = useRef(false);
|
|
2146
2168
|
/**
|
|
2147
2169
|
* handles the mounting and unmounting logic onto the field instance
|
|
2148
2170
|
*/
|
|
2149
2171
|
useEffect(() => {
|
|
2150
|
-
if (!fieldInstance ||
|
|
2172
|
+
if (!fieldInstance || (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mounted)) return;
|
|
2151
2173
|
fieldInstance.mountField({
|
|
2152
2174
|
valueSubscription: value => {
|
|
2153
2175
|
setValueState(value);
|
|
@@ -2164,14 +2186,13 @@ const FieldWrapper = ({
|
|
|
2164
2186
|
}));
|
|
2165
2187
|
}
|
|
2166
2188
|
});
|
|
2167
|
-
mountedRef.current = true;
|
|
2168
2189
|
}, [fieldInstance]);
|
|
2169
2190
|
/**
|
|
2170
2191
|
* recycle effect to remove the field Subscriptions due to memory leaks
|
|
2171
2192
|
*/
|
|
2172
2193
|
useEffect(() => {
|
|
2173
2194
|
return () => {
|
|
2174
|
-
|
|
2195
|
+
(fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mounted) && (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.destroyField());
|
|
2175
2196
|
};
|
|
2176
2197
|
}, []);
|
|
2177
2198
|
/**
|
|
@@ -2397,6 +2418,11 @@ const checkedChangeEvent = event => {
|
|
|
2397
2418
|
const valueChangeEvent = event => {
|
|
2398
2419
|
return event.target.value;
|
|
2399
2420
|
};
|
|
2421
|
+
const numberInputChangeEvent = number => {
|
|
2422
|
+
if (number) {
|
|
2423
|
+
return Number(number);
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2400
2426
|
const datepickerChangeEvent = event => event;
|
|
2401
2427
|
const dropdownChangeEvent = (event, opts) => {
|
|
2402
2428
|
if (typeof event === 'object' && event !== null && 'value' in event && 'id' in event) {
|
|
@@ -2404,7 +2430,7 @@ const dropdownChangeEvent = (event, opts) => {
|
|
|
2404
2430
|
_value: event === null || event === void 0 ? void 0 : event.id,
|
|
2405
2431
|
_metadata: event
|
|
2406
2432
|
};
|
|
2407
|
-
} else if (typeof event === 'string' && typeof opts === 'object' && 'props' in opts && typeof opts.props === 'object' && 'optionList' in opts.props && Array.isArray(opts.props.optionList)) {
|
|
2433
|
+
} else if ((typeof event === 'string' || typeof event === 'number') && typeof opts === 'object' && 'props' in opts && typeof opts.props === 'object' && 'optionList' in opts.props && Array.isArray(opts.props.optionList)) {
|
|
2408
2434
|
const option = opts.props.optionList.find(el => el.value === event);
|
|
2409
2435
|
if (option) {
|
|
2410
2436
|
return {
|
|
@@ -2417,7 +2443,12 @@ const dropdownChangeEvent = (event, opts) => {
|
|
|
2417
2443
|
_metadata: event
|
|
2418
2444
|
};
|
|
2419
2445
|
}
|
|
2446
|
+
} else {
|
|
2447
|
+
return {
|
|
2448
|
+
_value: event,
|
|
2449
|
+
_metadata: event
|
|
2450
|
+
};
|
|
2420
2451
|
}
|
|
2421
2452
|
};
|
|
2422
2453
|
|
|
2423
|
-
export { AsFormField, AsFormFieldBuilder, Form, FormGroupContext, FormGroupContextProvider, checkedChangeEvent, datepickerChangeEvent, defaultChangeEvent, dropdownChangeEvent, useForm, useFormGroup, useFormGroupContext, valueChangeEvent };
|
|
2454
|
+
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.
|
|
3
|
+
"version": "3.1.1-beta.0",
|
|
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.
|
|
9
|
+
"@bolttech/form-engine-core": "1.0.1-beta.0",
|
|
10
10
|
"react": "18.2.0"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormCore,
|
|
1
|
+
import { FormCore, TFormEntry, TFormGroup, TFormValues, TMapper, TSchemaFormConfig } from '@bolttech/form-engine-core';
|
|
2
2
|
import { ElementType } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Represents the context for managing forms within a form group.
|
|
@@ -18,7 +18,7 @@ type TFormContext = {
|
|
|
18
18
|
addFormWithIndex: (index: string) => void;
|
|
19
19
|
addForm: (payload: {
|
|
20
20
|
key: string;
|
|
21
|
-
|
|
21
|
+
params: TFormEntry;
|
|
22
22
|
}) => void;
|
|
23
23
|
getForm: (payload: {
|
|
24
24
|
key: string;
|
|
@@ -29,7 +29,7 @@ type TFormContext = {
|
|
|
29
29
|
formGroupInstance: TFormGroup;
|
|
30
30
|
mappers?: TMapper<ElementType>[];
|
|
31
31
|
printFormGroupInstance: () => void;
|
|
32
|
-
submitMultipleFormsByIndex: (indexes: string[]) => void;
|
|
32
|
+
submitMultipleFormsByIndex: <T>(indexes: string[], callback?: (payload: TFormValues<T>) => void) => void;
|
|
33
33
|
debugMode: boolean;
|
|
34
34
|
active: boolean;
|
|
35
35
|
config?: TSchemaFormConfig;
|
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
|
*/
|