Commit graph

272 commits

Author SHA1 Message Date
Apollinaire
06607e5e9a [Forms] Add currentDocument to clearForm
allows for the form fields to be correctly cleared when calling clearForm with `clearCurrentValues == true`
2018-08-10 14:46:49 +02:00
SachaG
497987d91e Export account helpers 2018-08-10 13:08:12 +09:00
SachaG
87ed3ea5ea Use UNSAFE_componentWillReceiveProps to compare old props and new props before resetting state when props change 2018-08-09 11:41:06 +09:00
SachaG
fe86f84870 Put currentDocument on state, too; use isEmptyValue to test for empty values (will catch [], '', and undefined as well as null) 2018-08-07 16:42:45 +09:00
SachaG
92a8ae8e75 Improve error handling in nested arrays and nested objects 2018-08-07 16:05:24 +09:00
SachaG
ae12907877 Merge branch 'devel' into feature/nested-schema 2018-08-07 10:16:40 +09:00
SachaG
2f4a0acb8e Get rid of merging to generate document; instead update currentDocument every time updateCurrentValues is called. Add support for { mode: 'merge'} in updateCurrentValues options. 2018-08-07 10:13:06 +09:00
SachaG
929e479f59 Do not pass down nestedInput prop in intlInput components to avoid treating them like Nested Objects components 2018-08-06 10:52:37 +09:00
SachaG
059d2651b9 Merge branch 'devel' into lbke-feature/nested-schema
# Conflicts:
#	packages/vulcan-forms/lib/components/Form.jsx
#	packages/vulcan-forms/lib/components/FormComponent.jsx
2018-08-06 10:46:40 +09:00
SachaG
a9d81cb747 Simplify getValue; do not merge in getValue anymore, instead get value from Form's getDocument() 2018-08-06 10:43:00 +09:00
SachaG
cdd59a1cbf When checking to update FormComponent when a field has been deleted, update parent component if child has been deleted. 2018-08-06 10:31:06 +09:00
SachaG
e1faef0d39 Add getFieldType, getNullValue form utils 2018-08-06 10:29:36 +09:00
SachaG
517fc97ade Change getDocument's merge function to allow array replacement (e.g. replace ['foo', 'bar', 'baz'] by ['foo', 'baz'] if 'bar' has been deleted) instead of always attempting to merge 2018-08-06 10:29:06 +09:00
SachaG
9b4d913fab Handle form deletions more explicitly (split into two cases); pass value down to FormNested; uniq -> uniqBy 2018-08-05 11:17:46 +09:00
SachaG
eb9a86ee47 uniq -> uniqBy 2018-08-05 10:30:56 +09:00
SachaG
96a396fd8c Merge branch 'feature/nested-schema' of https://github.com/lbke/Vulcan into lbke-feature/nested-schema 2018-08-03 11:44:20 +09:00
Eric Burel
e79b8a524f updated schema_utils and FormComponent to correctly detect nested objects 2018-07-27 17:27:44 +02:00
ochicf
d661e1a48b add opencrud field properties so they are passed to the form 2018-07-27 09:50:44 +02:00
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
25db5c04b8 load Components correctly in tests
Now `vulcan:ui-bootstrap` is explicitely loaded in the `vulcan:forms`
package. This avoid undefined `Components.Button` if the use did not
load a specific styling package
2018-07-26 16:39:40 +02:00
Eric Burel
d21dd5fcfa wrote passing tests and a failing test for nested objects 2018-07-25 18:03:43 +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
Eric Burel
474456148e setup tests 2018-07-24 18:13:34 +02:00
Eric Burel
f4ed4bffcf use meteortesting:mocha instead of TinyTest 2018-07-18 12:06:04 +02:00
Eric Burel
6deab6bb8f setup an example test with Tinytest and added Jest's expect to dependencies 2018-07-18 11:12:37 +02:00
SachaG
2eeb5af8a8 Add static text component to display simple text data in forms 2018-07-10 10:08:42 +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
cafa28fa90 retrieve nested values using path instead of name 2018-06-29 20:04:01 +02:00
ochicf
affd4d61f1 remove added props to remove complexity
this commit undoes some changes introduced in this PR that added more complexity than usefulness
2018-06-29 20:03:54 +02:00
ochicf
1433ca9629 rename context to errorContext to avoid confusion with React's 2018-06-29 19:26:06 +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
198d7f6e5d refactor mergeValue
- takes into account deletedValues
- only will merge simple objects. this prevents merging with different prototype such as `File`
2018-06-29 13:06:52 +02:00
ochicf
2e2c480b34 add getDeletedValues and getNestedDeletedValues functions 2018-06-29 13:04:35 +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
ea01b8ef10 add path utils module 2018-06-29 12:58:59 +02:00
ochicf
6f437f0284 remove shouldMergeValue function 2018-06-29 12:57:11 +02:00
ochicf
3f6a3f6731 return undefined to indiciate that the merge has not happened 2018-06-29 12:55:55 +02:00
ochicf
057896f0df remove shouldMergeValue prop 2018-06-29 12:55:03 +02:00
SachaG
2d2d1033b5 Enable required locale validation for individual locales; add support for intl: true on schema fields 2018-06-28 21:35:44 +02:00