Skip to content

Commit

Permalink
Merge pull request #12 from simomosi/dev
Browse files Browse the repository at this point in the history
Added newlines before lists in docs because the material theme is broken
  • Loading branch information
simomosi committed May 1, 2023
2 parents 64bb0f9 + fad30d0 commit b72b218
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
22 changes: 22 additions & 0 deletions docs/configurations/fields-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,23 @@ Default value: `change`.
Function to fetch the html element's value. Useful for custom html elements.

Parameters

- {`node | NodeList`} `htmlElement`: the html node

Returns

- {`string`} the field content

### `set (htmlElement)`
Function to set the html element's value. Useful for custom html elements.

Parameters

- {`node | NodeList`} `htmlElement`: the html node
- {`mixed`} `value`: the field's new value

Returns

- {`void`}

## `fetch`*
Expand All @@ -96,9 +100,11 @@ A function to generate the url to make the remote call to.
*required*

Parameters

- {`JSON`} `data`: data obtained from additionalData and externalData functions in Update Rule Config

Returns

- {`string`} The remote call url

### `makeBody (data)`
Expand All @@ -107,9 +113,11 @@ A function to generate the remote call body in the desired method (e.g. JSON.str
It's not necessary if the remote call uses the GET request method (parameters need to be placed in the url).

Parameters

- {`JSON`} `data`: data obtained from additionalData and externalData functions in Update Rule Config

Returns

- {`object`} The remote call body

### `fullFetchConfig (data)`
Expand All @@ -118,9 +126,11 @@ A function to generate the complete Fetch configuration for remote calls.
If this function is defined, the updateStatus default function will ignore *fetch.method* property and *fetch.makeBody* function.

Parameters

- {`JSON`} `data`: data obtained from additionalData and externalData functions in Update Rule Config

Returns

- {`object`} The complete Fetch configuration

## `behavior`
Expand All @@ -130,9 +140,11 @@ Object which groups properties related to field behavior.
Function to unset the field's current value. Sometimes it is used to clear the field from its content (for input and dropdown types).

Parameters

- {`node | NodeList`} `htmlElement`: the html node

Returns

- {`void`}


Expand All @@ -142,11 +154,13 @@ Method called before triggering the field's status update. If return value is *f
Default behavior: nothing. For **DynamicDropdown** elements it clear the field content if *clearOnParentVoid* conditions are satisfied.

Parameters

- {`node | NodeList`} `htmlElement`: the html node
- {`JSON`} `data`: data obtained from additionalData and externalData functions in Update Rule Config
- {`string`}: `subjectName`: the name of the subject who triggered the update. It can be null if the update is triggered manually

Returns

- {`boolean`} *false* to abort the update, *true* otherwise

### `updateStatus (htmlElement, data, subjectName)`
Expand All @@ -155,22 +169,26 @@ Method to update the field status. It is useful to update the field's attributes
Default behavior: nothing. For **DynamicDropdown** elements it makes a remote call (using *fetch*), retrieves new date and saves it as *select* new content (*option*).

Parameters

- {`node | NodeList`} `htmlElement`: the html node
- {`JSON`} `data`: data obtained from additionalData and externalData functions in Update Rule Config
- {`string`}: `subjectName`: the name of the subject who triggered the update. It can be null if the update is triggered manually

Returns

- {`void`}

### `afterUpdate (htmlElement, data, subjectName)`
Method called after triggering the field's status update.

Parameters

- {`node | NodeList`} `htmlElement`: the html node
- {`JSON`} `data`: data obtained from additionalData and externalData functions in Update Rule Config
- {`string`}: `subjectName`: the name of the subject who triggered the update. It can be null if the update is triggered manually

Returns

- {`boolean`} (currently) unused

## `dropdown`
Expand All @@ -180,10 +198,12 @@ Object which groups properties related to select-option elements.
Function to process data retrieved by remote call. It is useful for filtering/ordering data.

Parameters

- {`node | NodeList`} `htmlElement`: the html node
- {`JSON | object[]`} `data`: data retrieved from the remote call

Returns

- {`JSON | object[]`} post-processed data

### `saveData (htmlElement, data)`
Expand All @@ -192,10 +212,12 @@ Function to phisically save (post-processed) data retrieved by a remote call as
Default behavior: saves data as *option* html elements using *value* and *test* properties.

Parameters

- {`node | NodeList`} `htmlElement`: the html node where data will be saved
- {`JSON | object[]`} `data`: data retrieved from the remote call

Returns

- {`JSON | object[]`} post-processed data (not used)

### `clearOnParentVoid`
Expand Down
8 changes: 7 additions & 1 deletion docs/configurations/form-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ Method called after a subject registers an update, but before triggering the upd
Useful to show a loader during the fields update.

Parameters

- {`string | null`} `subjectName`: the name of the subject who triggered the update. It can be null if the update is triggered manually

Returns

- {`bool`} *false* to abort the update, *true* otherwise

### `afterUpdate (subjectName)`
Expand All @@ -58,17 +60,20 @@ Method called after the form update, and in particular after all involved form's
Useful to hide a loader after the fields update.

Parameters

- {`string | null`} `subjectName`: the name of the subject who triggered the update. It can be null if the update is triggered manually

Returns

- {`void`}
-

### `beforeInit () `
Method executed before the form initialisation.

Useful to show a loader before all fields are initialised.

Returns

- {`void`}

### `afterInit () `
Expand All @@ -77,6 +82,7 @@ Method executed after the form initialisation.
Useful to hide any loader after the form is ready.

Returns

- {`void`}

## `fields`
Expand Down
4 changes: 4 additions & 0 deletions docs/dynamic-forms-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ const form = dynamicForms.makeForm(formConfiguration);
Istantiates a DynamicForm.

Parameters

- {`object`} `formConfiguration`: the form configuration

Returns

- {`DynamicForm`} a DynamicForm instance

### `getForm (id)`
Returns a DynamicForm instance corresponding to the form id, if it exists.

Parameters

- {`string`} `id`: the form id

Returns

- {`DynamicForm | null`} the DynamicForm instance or null if it does not exists

0 comments on commit b72b218

Please sign in to comment.