@bolttech/form-engine 0.11.1 → 0.11.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.11.3](http://bitbucket.org/gofrank/bolttech-frontend/compare/form-engine-0.11.2...form-engine-0.11.3) (2024-02-21)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * react hook adapter ([02ae862](http://bitbucket.org/gofrank/bolttech-frontend/commit/02ae86208394e939d741e5622013e78af773257c))
11
+
12
+ ## [0.11.2](http://bitbucket.org/gofrank/bolttech-frontend/compare/form-engine-0.11.1...form-engine-0.11.2) (2024-02-21)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **handler:** add defaultClearFields prop on clearFields handler ([b5865f6](http://bitbucket.org/gofrank/bolttech-frontend/commit/b5865f66e2cb61f5a811bfab0d67fb9101bb3046))
18
+ * **handler:** updating readme ([99b2ac8](http://bitbucket.org/gofrank/bolttech-frontend/commit/99b2ac8902f0b8834dd96d84a2fb44641a2c86d0))
19
+
5
20
  ## [0.11.1](http://bitbucket.org/gofrank/bolttech-frontend/compare/form-engine-0.11.0...form-engine-0.11.1) (2024-02-19)
6
21
 
7
22
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Achieve form logic re-usage with forms expressed in json format.
4
4
 
5
- > stable version 0.11.1
5
+ > stable version 0.11.3
6
6
 
7
7
  ---
8
8
 
@@ -995,6 +995,30 @@ Each prop will be changed using the respective field. For example, if I have `fi
995
995
  I can send it as `clearedProps: [{ label: 'value' }]` or `clearedProps: { label: 'value' }`. And only input props will be changed.
996
996
  It's useful when we have some API calls whose response will be used as a prop value in the component.
997
997
 
998
+ ```json
999
+ {
1000
+ "clearFields": {
1001
+ "ON_FIELD_CHANGE": [
1002
+ {
1003
+ "validations": {
1004
+ "value": "Yes"
1005
+ },
1006
+ "field": "targetValue",
1007
+ "clearedValue": false,
1008
+ "defaultClearedValue": true,
1009
+ "defaultClearedProps": {
1010
+ "disabled": false,
1011
+ }
1012
+ }
1013
+ ]
1014
+ }
1015
+ }
1016
+ ```
1017
+
1018
+ If you want to set a value when the validation passes you can set `defaultClearedValue` prop on the event to set a value on the cleared field.
1019
+ Useful after an API call to set a default response value or a value stored earlier.
1020
+ You can also set a `defaultClearedProps` attribute to change the props of the component if the validation passes.
1021
+
998
1022
  For definition clearValues runs validations on the target field and not on the field it is declaring.
999
1023
  Therefore, you can set `useCurrentFieldValidation` prop with true if you want validations to be performed on the current field.
1000
1024
 
@@ -1654,6 +1678,7 @@ You can use the following arguments to tho hook
1654
1678
  | id | string | The id of the form you want to connect to |
1655
1679
  | ids | array of string | A range of ids of the each form you want to connect to |
1656
1680
  | onValid | callback | Called whenever form validation changes |
1681
+ | onClick | callback | Called whenever field has clicked |
1657
1682
  | onData | callback | Called whenever data changes |
1658
1683
  | onSubmit | callback | Called whenever form is submitted |
1659
1684
 
@@ -1711,10 +1736,11 @@ Similar to `useForm`
1711
1736
  You can use the following arguments to tho hook
1712
1737
 
1713
1738
  | Prop | Type | Description |
1714
- | -------- | --------------- | --------------------------------------------------------- |
1739
+ | -------- | --------------- |-----------------------------------------------------------|
1715
1740
  | ids | array of string | The ids we want to listen to |
1716
1741
  | group | string | A string to identify the form group we want to connect to |
1717
1742
  | onValid | callback | Called whenever form validation changes |
1743
+ | onClick | callback | Called whenever field has clicked |
1718
1744
  | onData | callback | Called whenever data changes |
1719
1745
  | onSubmit | callback | Called whenever form is submitted |
1720
1746
 
@@ -1778,12 +1804,12 @@ Allows you to add separate components from a standard form engine form schema. T
1778
1804
 
1779
1805
  You can use the following arguments declare a component as a form field
1780
1806
 
1781
- | Prop | Type | Description |
1782
- |----------|--------------------------|-------------------------------------------------------------------|
1783
- | Comp | React Function Component | The component to be used as form field. |
1784
- | onSubmit | TPropsMapping | Link for the TPropsMapping likely props mapper from default form. |
1807
+ | Prop | Type | Description |
1808
+ |---------------|--------------------------|-----------------------------------------------------------------------------|
1809
+ | Comp | React Function Component | The component to be used as form field. |
1810
+ | propsMapping | TComponentPropsMapping | Link for the TComponentPropsMapping likely props mapper from default form. |
1785
1811
 
1786
- And it will provide you the following
1812
+ And this will give you the following properties in addition to the native ones of your component
1787
1813
 
1788
1814
  | Prop | Type | Description |
1789
1815
  |----------------------|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|