- Massive docs overhaul (Issues #14, #48, #62).
- Destroyed element templates are now removed from the validation context (Issue #87).
- Add missing namespace export to package.js.
- Address issue #76.
- A
fieldhelper is now available informContextas well as in the custom form block helpers. This reactively gets the value of any given form field (even nested ones).- Example:
{{#with formContext}}{{field 'name.first'}}{{/with}}.
- Example:
- A
- Add missing
onDestroyhook for elements (Issue #73). - Fix SimpleSchema support (Issues #69, #84).
- Fix global
contexthelper and rename it toformContext(Issue #64).- Add several missing properties to the helper object.
- This is the only breaking change to the public API in this release.
- Convert codebase to JavaScript as part of a transition to ES2015 classes.
- Refactor code, package structure, and improve comments.
- Update SimpleSchema dependency to latest version.
- Adjust internal
isObjectfunction to fail for Date objects and regular expressions.
- Fix regression (Issue #38) where
_idfails to show up in the data context of theactionfunction. - Address issue #55.
- Calling
reset(true)now resetschangedandvalidstates on individual elements.
- Calling
- Major update that addresses issues #28, #55, and #56.
- Nested schemas are now supported.
- An
onDataChangehook can now be passed into a form block via a template helper.- This has access to several useful methods that allow fine-grained control over what
happens when reactive initial data is changed.
this.reset()calls the same method ascallbacks.reset()in the action function.this.refresh()will cause every Element to refresh itself with the new initial data. If the user made changes to an Element, that Element's value won't be updated in the DOM, but it will have a new original value.this.changed()causes the form to take on thechangedstate (as if a user had made changes to the form).
- This has access to several useful methods that allow fine-grained control over what
happens when reactive initial data is changed.
- The
changedargument to the action function now only contains fields that have actually changed from the initial data (compared to before, where any user-modified fields would exist). - Added new template helpers for Elements, which should make dealing with initial data easier.
{{originalValue}}shows the original value of this field where initial data is present.{{uniqueValue}}is a boolean for whether the current value of a field is unique from the original value.
- Address issues #51 and #54.
- Refactor to fix errors.
- Fix
contexthelper by adding extra checks. - Fix resetting functionality.
- By default,
callbacks.reset()now clears all states exceptsuccessorfailedand related messages. This provides a nice default experience for users that doesn't jar them away from the last session without some idea of what happened (the states clear on the next form change automatically). - To clear all states and messages, perform a hard reset with
callbacks.reset(true).
- By default,
- Fix regression where
{{valid}}was incorrectly set.
- Fix incorrect var name in previous update.
- Allow element validation to be immediately cancelled and/or called manually in async fashion with
return this.stopandthis.validate(val). - Improve support for parent/child elements.
- Elements now check their parent template context (up to 5 levels) to determine where the
form block context is, rather than assuming it's one level up. When the parent is an element,
the sub-element will take the parent element's
fieldas its own. - Elements now support
standalone=trueexplicit standalone mode in the template invocation. createElementnow supportspassThroughDataoption--elements with this option settruewill accept remote data changes without waiting for a user's action. This is useful for elements receiving data from a join (for example, a checklist of related documents).
- Elements now check their parent template context (up to 5 levels) to determine where the
form block context is, rather than assuming it's one level up. When the parent is an element,
the sub-element will take the parent element's
- Switch from Blaze.ReactiveVar to non-namespaced ReactiveVar and add dependency.
- Address issues #50, #51, #52, and #53.
- Allow for custom success and failed messages:
- Messages can be easily added in callbacks, like
callbacks.success('...message...'). failedMessageandsuccessMessagetemplate helpers now exist for form blocks.
- Messages can be easily added in callbacks, like
- Add official support for resetting a form.
- Elements can now specify a
resetmethod increateElementconfig. - A
callbacks.reset()clears all element data using theresetmethods, and clears form data context in a form block.
- Elements can now specify a
- Add support for an array of events in
validationEvent. {{valid}}reactivity should now registerchangedwhen the element's field is invalidated in SimpleSchema from the outside.
- Allow for custom success and failed messages:
- Revisit issue #27.
- Rewrite validation so that optional fields are only checked if they exist.
- Address issue #47.
- The reactive data context and
valueDepsfor an Element now exist at the Form Block level, which allows all element templates with the same field in that form to share the same value- dependent states. Hopefully this also addresses lingering concerns from #31. - Validation is now triggered whenever data is changed, meaning validation happens after data is set, rather than before. This doesn't mean anything to the end-user, because submission won't run unless the data is valid (provided a schema exists). It would be preferred to ensure that only valid data reaches the form-level data context, however.
- The reactive data context and
- Refactor.
- Address issue #46.
- Clearly differentiate between changes enacted by the user (from event handlers) and changes from other sources.
- Only trigger
changedstate on user-enacted changes to the form.
- Fix
setStatefunction.
- Remove leftover console log.
- Major update with many improvements.
- Addresses issues #40, #41, #42, #43, #44, and #45. Fixes regression from issue #37.
- Add robust support for dealing with reactively changing form data.
- Remote changes to data being actively edited in a form can now be elegantly revealed to
the user in real-time, using the
{{remoteValueChange}}and{{newRemoteValue}}template helpers. There are also two template instance methods to hook into from event handlers. - Fix handling of initial data and how it bypasses the
changedstate. - On nested Element templates that don't actually provide data to the form, avoid running
duplicate initial validation in the
renderedcallback. ReactiveForms.namespacenow allows programmatic access to whatever internal namespace the package uses in template instances.- Update docs with a chapter on working with remote data.
- Refactor and clean up code/comments.
- Address issue #39.
- Add
unchangedandunsubmittedhelpers.
- Add
- Fix typo in docs.
- Address issue #38.
- If initial data has an
_idfield, pass that through to the form data context. - Allows easier updates using the
actionfunction.
- If initial data has an
- Address issue #37.
- Throttle
validationEventhandler.
- Throttle
- Revisit issue #31.
- Improve nested Element templates example in docs.
- Update to support simple-schema
v1.3.0.
- Address issue #31.
- Update docs to include a section on working with nested Element templates.
- Address issues #27 and #32.
- Provide more helpful error messages in Form Block field validation.
- Address issue #34.
- Form Blocks now accept falsey initial data.
- The same form block can now be more easily used for inserts and updates.
- Fix typo in 1.10.1.
- Address issue #33.
validationEventis now optional, and the event handler will only be added to an element template if it exists.- This allows easier creation of nested elements and wrapped elements.
- Address issue #8.
- Allow access to all schema properties in Element templates.
- Reorganize files.
- Add missing
lib/init.coffeefile topackage.js. - Fixes problem with
defaultFormBlockfrom issue #15.
- Address issues #20 and #21.
- Support custom
createdrenderedanddestroyedcallbacks on both Form Blocks and Elements. - Namespace component data.
- Support custom
- Automatically register
defaultFormBlock.
- Transitional release before
v2.0.0. - Address issues #13, #15, #16, #17 and #18.
- The
changedargument in the action function is nowundefinedif no initial data was provided. - Consolidate helpers passed into
UI.contentBlockinto onecontextargument. Log deprecation warning when helpers are passed in individually. - The container div in the
basicInputexample has been removed. - The endpoint to create a form block is now called
createFormBlock. Use ofcreateFormwill log a deprecation warning. - Minor update to
basicInputandbasicFormcode. - Change
basicFormtemplate name tobasicFormBlock(but keepbasicFormfor compatibility). - Add
defaultFormBlockblock helper that supports using form block helpers directly. - Add global
contexthelper to allow direct access to form-level helpers in a form block'sUI.contentBlock. This keeps reactivity normal (#17) and enablesdefaultFormBlock-style usage (#15).
- The
- Docs update:
- Capitalize component names throughout; more clearly distinguish between these components and HTML elements of the same name.
- Sync up examples.
- Move thanks to @steph643 for issue contributions out of here and into the docs.
- Address issues #12 and #13.
- The
changedargument in the action function now contains any fields that have changed, not just fields that were originally present in the initial data. - Support the optional
optionsobject to Simple Schema'scleanfunction invalidationValue.
- The
- Address issues #9 and #11.
- Initial data now supports objects with prototype methods.
- If initial data was provided, an object containing only the changed fields is passed into the action function.
- Refactor to allow form fields to have falsey values.
- Address issues #5, #6, and #7.
- Update docs:
- Describe the
fieldproperty on elements and how it connects them to form blocks. - Correct description of
invalidhelper (form blocks).
- Describe the
- Fix
package.jsto supportinstructionsfield on client and server-side SimpleSchemas.
- Update docs:
- Elements inside a form block now validate against the form-level data context.
- Fixes a bug with custom validation in SimpleSchema.
- All form-level helpers inside elements (
submitted,success,loading) now default tofalsewhen the element is being used standalone. - Individual helpers can now be overridden on elements if they're specified on the element template's invocation.
- Add
isChildhelper to elements. - Remove
failedhelper (added in v1.4.0) from element scope.- Submission failure should be handled outside this scope.
- As
failedandsuccessare mutually exclusive states, you can handle submission failure using{{#if submitted}} {{#unless success}}anyway.
basicInputexample now supports passed-in (default) data with thevaluehelper.
- Revisit change from v1.5.0 where setting the
changedstate totruechangessubmittedandsuccessstates tofalse.- Only change
submittedstate to false ifsuccessstate is also true at the timechangedis set to true. This better serves the original use case, and hopefully avoids unexpected functionality.
- Only change
- Internal comparisons are now made with Underscore's
_.isEqualmethod, for full type support.
- Improve default internal logic.
- Setting
changedstate on a form block instance totrueby necessity changessuccessandsubmittedstates tofalse. - Fix
setValidatedValuemethod in form blocks, so that now it checks if the field has been added to the form's data context before it checks if the field was in passed-in data. This allows the method to runchangedon field updates even if they contain the same value that the passed-in data had. The focus is now on unique from the last value.
- Setting
- Elements now have access to
failedandsuccesshelpers. - This seemed important, particularly as
successis useful for element cleanup after submission.
- Add
submittedhelper to form blocks.
- Add
changedhelpers on both form blocks and elements.- Starts
false, sets totruewhenvalidationEventis triggered and data passes validation. - Initial data is validated on render, but
changedisn't called during that time.
- Starts
- Fix typo. Action function had
callbacks.faliedinstead ofcallbacks.failed.
- Refactor.
- Use jQuery's
.val()as the default way to get an element's value, instead of.value. - Add
validationValueoption to ReactiveForms.createElement. - Add ability to pass in initial data for form elements, at the form or element level.
- Create form-level data context.
- Store last validated value for all elements in the form block.
- Context is unique to every form block template instance.
- Bind action function to the form-level data context when it's called.
- Integrated with SimpleSchema.
- Tested in a local project.
ReactiveForms.createFormandReactiveForms.createElementworking.- Form states are mutually exclusive, making it easy to display messages in one place.
- Action function grabs all
.reactive-elementelements in the form. - Both types of templates can be used together or standalone.