Commit graph

91 commits

Author SHA1 Message Date
Eric Burel
b5e54ead17 Splitted FormNested between objects an arrays
Nested form is much simpler for objects than for arrays.
2018-07-26 17:25:33 +02:00
Eric Burel
56eb3ab4b6 fixed nested form generation
Schema must be passed explicitely to the field retrieval methods
(otherwise the main schema will be used instead of the nested schemas)
2018-07-24 20:33:43 +02:00
Eric Burel
4d6e87cbca pass the nested schema to the field retrieval methods 2018-07-24 18:29:27 +02:00
SachaG
b34f0a25ce Add support for new addFields form props to force adding unmutable "static" (disabled) fields 2018-07-10 10:02:08 +02:00
SachaG
8a446680cf Minor fixes to form, mutators; query, and payments 2018-07-07 18:49:04 +02:00
SachaG
a55ef866b0 Clear all current values 2018-07-04 11:25:44 +02:00
SachaG
e0b540eeb1 Use callback ref; fix withMutation; handle errors with no path 2018-07-04 10:59:10 +02:00
SachaG
861980b468 Internationalize field labels in forms and form errors 2018-07-02 16:59:29 +02:00
SachaG
35c811e791 Fix form error labels to work with intl fields 2018-06-30 11:48:37 +02:00
SachaG
bb80001056 Fix eslint issues 2018-06-30 11:34:17 +02:00
Sacha Greif
5230f3ae06
Merge pull request #2011 from OrigenStudio/field-value-merge
FormComponent value handling improvements
2018-06-30 09:35:42 +02:00
SachaG
da98a6bd53 Merge branch 'form-errors' of https://github.com/OrigenStudio/Vulcan into OrigenStudio-form-errors
# Conflicts:
#	packages/vulcan-lib/lib/modules/validation.js
2018-06-30 09:26:26 +02:00
SachaG
7a10103590 Pass down disabled prop explicitely 2018-06-30 09:23:49 +02:00
ochicf
7d4a1685d4 add missing import 2018-06-29 13:22:46 +02:00
ochicf
f7b949b86c use getDeletedValues to apply DRY 2018-06-29 13:22:21 +02:00
ochicf
59965f9614 fix: properly retrieve parent path when current path is of an array elem
Example: for path `fieldArray[0]`, parent path was `fieldArray[0`, now is `fieldArray`.
2018-06-29 13:01:56 +02:00
ochicf
8031e9e17b Merge branch 'devel' into form-errors 2018-06-28 10:32:09 +02:00
ochicf
c8ae445720 pass getLabel as child context 2018-06-27 19:53:21 +02:00
SachaG
973b2bfce3 Pass document to form.reset() to avoid resetting it to pre-submission values 2018-06-21 10:29:00 +09:00
SachaG
b4ac2d23af Revert formsy/formsy-react-component update 2018-06-21 10:28:34 +09:00
SachaG
eea1a1dadb Update for new formsy-react & formsy-react-component 2018-06-20 10:23:54 +09:00
SachaG
55f3e10581 Re-enable form on submission success 2018-06-13 18:28:01 +09:00
Erik Schannen
373857131a SubSchema Fields
- Added support for fields that have their own subschema
- The code flattens the subschema fields, so the path for `address: { street }`` becomes `'address.street'`
- Several places needed to be changed to properly support paths, so `currentValues[path]` becomes `get(currentValues, path)`
- In Form.getData(), replaced underscore's `pick` with lodash's `pick` which properly supports paths and returns a new object
- Fixed a bug in collection.getParameters that made it impossible to specify a `limit` with addView or addDefaultView
2018-05-23 16:02:36 -04:00
SachaG
9865eb5f63 Use field.nestedInput instead of type="nested" 2018-05-23 22:04:32 +09:00
SachaG
2edebcf551 Do not apply compact when object is not an array 2018-05-23 17:09:32 +09:00
Apollinaire
f82efb1803 Popup warning on page closing for SmartForm unsaved changes 2018-05-22 09:51:36 +02:00
SachaG
d378cd9654 Small migration improvements 2018-05-22 08:43:27 +09:00
SachaG
2b0f8cdd88 Change data structure of translations in db to match MongoDB standards 2018-05-21 09:42:08 +09:00
SachaG
b10d8bdb5c Formatting 2018-05-11 09:52:04 +09:00
SachaG
ab674a1163 Merge branch 'devel' into i18n2
# Conflicts:
#	packages/vulcan-forms/lib/components/Form.jsx
#	packages/vulcan-forms/lib/components/FormComponent.jsx
2018-05-11 09:48:34 +09:00
SachaG
f320b3363b Move registerSetting to index 2018-05-10 10:18:55 +09:00
Erik Schannen
c3f33cb7e0 Changes to SmartForm behaviour
- Moved UI portions of FormComponent to FormComponentInner.jsx in vulcan-ui-bootstrap

 - Added user alert when the user navigates to another route while there are unsaved changed in the form (disabled by default)

 - Added setting forms.warnUnsavedChanges and SmartForm property warnUnsavedChanges to enable user alert

 - Added optional Revert button in FormSubmits to allow the user to discard any changes to the form; this is activated by passing a "revertCallback" property to SmartForm (which can be empty: () => {})

 - Added two functions that form components can access in the child context: refetchForm() to refetch the document from the database (in case it was updated by a background process), isChanged() to determine if there are any unsaved changes

 - For any phrases I have added to en_US.js I also added it to es_ES.js and fr_FR.js with the comment // TODO: translate

 - Updated Form.clearForm and Form.mutationSuccessCallback so that the user can continue working on the document after submitting it

 - The form now scrolls the flash message into view when a submit results in errors

 - Fixed bugs in FormComponent.shouldComponentUpdate() and Form.getDocument()

 - Fixed bug in FormComponent.handleChange() - number fields could not be cleared, only set to 0

 - Fixed a bug in FormComponent.getValue() - it returned the initial value of a checkbox even after it was set to false, and a number even after it was set to 0
2018-05-08 20:09:42 -04:00
SachaG
5b5884d33c Move intl logic to vulcan:lib (keep vulcan:i18n with same API as react-i18n); add isIntlField helper; add IntlString type 2018-05-08 12:23:42 +09:00
SachaG
55800a9b30 Add support for intl fields to API and SmartForm 2018-05-07 17:41:22 +09:00
Bernardo Dias
087e5db923 Revert catch callback of removeMutation 2018-05-02 13:39:52 -03:00
Bernardo Dias
37200ec9ae Add document attributes to error catch of editMutation and removeMutation 2018-05-02 13:17:12 -03:00
Bernardo Dias
f099e6557d Include document prop in mutationErrorCallback method 2018-05-02 13:17:12 -03:00
SachaG
7b1c66cb43 Factor out error handling code; clean up form props; pass currentUser down to FormComponent 2018-04-28 10:54:03 +09:00
Justin Reynolds
30e340d8af Fix Form props 2018-04-23 13:00:08 -05:00
SachaG
299d83df98 Merge branch 'devel' of https://github.com/VulcanJS/Vulcan into devel 2018-04-21 17:58:29 +09:00
SachaG
fae7b5a032 Improve error handling 2018-04-21 17:57:53 +09:00
Apollinaire
6e9da3fbb7 formInput -> input 2018-04-20 16:25:11 +02:00
SachaG
45d508ca89 control -> input; forn -> inputProperties 2018-04-14 18:09:35 +09:00
SachaG
bef525eea8 Improve upload error handling; add clearFieldErrors; 2018-04-14 17:21:10 +09:00
SachaG
e37704a94c handle default values properly 2018-04-10 17:23:23 +09:00
SachaG
cc97d1a473 Improve form error handling; fix control css class 2018-04-09 13:10:42 +09:00
SachaG
9b3b545219 Avoid error when no arguments are passed 2018-04-07 11:53:40 +09:00
SachaG
8073af7d11 Add option to keep/exclude hidden fields 2018-04-07 10:09:38 +09:00
SachaG
7c33b37004 Clean up form props/context 2018-04-06 17:56:25 +09:00
Apollinaire
6e39058e51 use this.getCollection() instead of props.collection 2018-03-29 12:15:21 +02:00