ku4es-react

kodmunki™ Utilities for ECMAScript React

Usage no npm install needed!

<script type="module">
  import ku4esReact from 'https://cdn.skypack.dev/ku4es-react';
</script>

README

Classes

AbstractAnalytics
GoogleAnalyticsAbstractAnalytics
Action
Dispatcher
FormValidator
Payload
ConfigurableViewReadPolicyAbstractSpecification
ConfigurableViewWritePolicyAbstractSpecification
ReadWriteSettingsViewStrategyAbstractStrategy
Service
StoreEventEmitter
WebStoreStore
AbstractSecureViewFeatureView
AbstractViewReact.Component
ConfigurableViewAbstractView
FeatureViewConfigurableView
AbstractFormView
ConfigurableFieldView
FormView
OptionConfigurableField
SelectConfigurableField
AbstractRouteAbstractView
AbstractSecureRouteFeatureRoute
ConfigurableRouteConfigurableView
FeatureRouteConfigurableRoute
RouteAbstractSecureRoute
SettingsViewFeatureView
ViewAbstractSecureView

Functions

$upsertItem(key, value)Store

Safely add an item to this Store. This operation is the same as running $setState({ key: value})

$removeItem(key)

Safely remove an item from this Store

AbstractAnalytics

Kind: global abstract class

new AbstractAnalytics(dispatcher)

AbstractAnalytics from which all analytics classes should subclass.

Param Type
dispatcher ApplicationDispatcher

GoogleAnalytics ⇐ AbstractAnalytics

Kind: global class
Extends: AbstractAnalytics

new GoogleAnalytics(dispatcher)

Base GoogleAnalytics class from which all Google Analytics classes should subclass.

Param Type
dispatcher ApplicationDispatcher

googleAnalytics.$event(category, action, label, value, fields)

Sends an event to Google Analytics

Kind: instance method of GoogleAnalytics
Access: protected

Param Type
category String
action String
label String
value String
fields String

googleAnalytics.$pageView(url)

Sends a pageView event to Google Analytics

Kind: instance method of GoogleAnalytics
Access: protected

Param Type
url String

Action

Kind: global class

new Action(type, [payload], [meta], [error])

The object that should be returned for any Service Promise fulfillment or rejection.

Param Type Default Description
type String Unique identifier to distinguish different events.
[payload] Object {} Payload data.
[meta] Object {} Meta data.
[error] Error an Error describing the error if there is one.

action.isType(type) ⇒ boolean

Type checking method that will return true if this._type === type

Kind: instance method of Action
Access: public

Param Type Description
type String an action type.

Action.isError ⇒ boolean

Returns true if this._error exists.

Kind: static property of Action
Access: public

Dispatcher

Kind: global class

new Dispatcher()

An abstraction of the Flux Observer.

dispatcher.register(callback) ⇒ DispatchToken

Kind: instance method of Dispatcher
Access: public

Param Type
callback function

dispatcher.unregister(registrationToken) ⇒ Dispatcher

Kind: instance method of Dispatcher
Access: public

Param Type
registrationToken String

dispatcher.dispatch([payload]) ⇒ Dispatcher

Kind: instance method of Dispatcher
Access: public

Param Type
[payload] Object

FormValidator

Kind: global class

new FormValidator([rules])

Form validation manager

Param Type Default
[rules] Object {}

formValidator.rule(name) ⇒ *

Returns a validation rule for the specified name

Kind: instance method of FormValidator
Access: public

Param
name

formValidator.validate(values) ⇒ FormValidator

Validates the passed values against this validator's rules

Kind: instance method of FormValidator
Access: public

Param
values

Payload

Kind: global class

new Payload(data)

Payload to be used as a value for the payload member of an Action

Param
data

Payload.data ⇒ *

Returns the data associated with this Payload

Kind: static property of Payload
Access: public

Payload.success([response]) ⇒ Payload

Create a success Payload

Kind: static method of Payload
Access: public

Param Type Default
[response] Object {}

Payload.error([error]) ⇒ Payload

Create an error Payload

Kind: static method of Payload
Access: public

Param Type Default
[error] Object {}

ConfigurableViewReadPolicy ⇐ AbstractSpecification

Kind: global class
Extends: AbstractSpecification

configurableViewReadPolicy.isSatisfiedBy(cid, configuration) ⇒ void | * | boolean

Returns true if the configuration value for this cid is 'read'

Kind: instance method of ConfigurableViewReadPolicy
Access: public

Param
cid
configuration

ConfigurableViewWritePolicy ⇐ AbstractSpecification

Kind: global class
Extends: AbstractSpecification

configurableViewWritePolicy.isSatisfiedBy(cid, configuration) ⇒ boolean

Returns true if the configuration value for this cid is 'read'

Kind: instance method of ConfigurableViewWritePolicy
Access: public

Param Type
cid String
configuration Object

ReadWriteSettingsViewStrategy ⇐ AbstractStrategy

Kind: global class
Extends: AbstractStrategy

ReadWriteSettingsViewStrategy.execute(component, setting)

Updates a the readable or writable state of a ConfigurableView per the current readable or writable state and the value of the setting argument.

Kind: static method of ReadWriteSettingsViewStrategy

Param Type Description
component ConfigurableView = the component delegating behavior to this strategy.
setting boolean = true indicates that readable or writable should remain so.

Service

Kind: global class

new Service(dispatcher, [config])

Service abstraction

Param Type Default Description
dispatcher Dispatcher
[config] Object {} Additional configurations to set for all calls. See axios documentation for list of available values.

service.$dispatch(action) ⇒ Service

Dispatches an action to observers

Kind: instance method of Service
Access: protected

Param Type
action Action

Store ⇐ EventEmitter

Kind: global class
Extends: EventEmitter

new Store([persistenceKey], [maxRegistrants])

Base store from which all application stores should subclass.

Param Type Default Description
dispatcher. Dispatcher
[persistenceKey] String a unique key to be used for identifying the store's values when persisting to persistent storage.
[maxRegistrants] Number 10 maximum number of registrants allowed before a Possible Memory Leak warning is thrown.

store.$on(actionType, method) ⇒ Store

Subscribe to an event

Kind: instance method of Store
Access: protected

Param
actionType
method

store.$notify()

Protected method to notify state changes. This method should only be invoked by subclasses.

Kind: instance method of Store
Access: protected

store.$setState(state) ⇒ Store

Safely set this store's state

Kind: instance method of Store
Access: protected

Param Type
state Object

store.init([state]) ⇒ Store

Initialize this store with state

Kind: instance method of Store
Access: public

Param Type Default
[state] Object {}

store.read() ⇒ * | Object

Read the data in this store.

Kind: instance method of Store
Access: public

store.clear() ⇒ *

Clear the in-memory data for this store.

Kind: instance method of Store
Access: public

store.register(callback, event) ⇒ Store

Register a view to monitor state changes of this store. This method should not be overridden by subclasses.

Kind: instance method of Store
Returns: Store - - a reference to self for fluid interface method chaining.
Access: public

Param Type Default Description
callback function a Function to be called every time the state of this store changes.
event String state_change name of the event to subscribe to

store.unregister([callback], event) ⇒ Store

Unregister a view from monitoring state changes of this store. This method should not be overridden by subclasses.

Kind: instance method of Store
Returns: Store - - a reference to self for fluid interface method chaining.
Access: public

Param Type Default Description
[callback] function the original registered callback to be unregistered.
event String state_change name of the event to unsubscribe from

WebStore ⇐ Store

Kind: global class
Extends: Store

new WebStore([persistenceKey], [maxRegistrants])

Base store from which all application stores should subclass.

Param Type Default Description
dispatcher. Dispatcher
[persistenceKey] String a unique key to be used for identifying the store's values when persisting to localStorage.
[maxRegistrants] Number 10 maximum number of registrants allowed before a Possible Memory Leak warning is thrown.

webStore.save() ⇒ WebStore

Save this store to localStorage at the key indicated by the persistenceKey member of this class instance.

Kind: instance method of WebStore
Access: public

webStore.saveAs(persistenceKey) ⇒ WebStore

Save this store to localStorage at the key indicated by the persistenceKey.

Kind: instance method of WebStore
Access: public

Param Type
persistenceKey String

webStore.load([persistenceKey]) ⇒ WebStore

Initialize this store with data persisted in localStorage at the key indicated by the persistenceKey.

Kind: instance method of WebStore
Access: public

Param Type
[persistenceKey] String

webStore.drop() ⇒ WebStore

Drop the localStorage persisted data for this store.

Kind: instance method of WebStore
Access: public

webStore.$on(actionType, method) ⇒ Store

Subscribe to an event

Kind: instance method of WebStore
Access: protected

Param
actionType
method

webStore.$notify()

Protected method to notify state changes. This method should only be invoked by subclasses.

Kind: instance method of WebStore
Access: protected

webStore.$setState(state) ⇒ Store

Safely set this store's state

Kind: instance method of WebStore
Access: protected

Param Type
state Object

webStore.init([state]) ⇒ Store

Initialize this store with state

Kind: instance method of WebStore
Access: public

Param Type Default
[state] Object {}

webStore.read() ⇒ * | Object

Read the data in this store.

Kind: instance method of WebStore
Access: public

webStore.clear() ⇒ *

Clear the in-memory data for this store.

Kind: instance method of WebStore
Access: public

webStore.register(callback, event) ⇒ Store

Register a view to monitor state changes of this store. This method should not be overridden by subclasses.

Kind: instance method of WebStore
Returns: Store - - a reference to self for fluid interface method chaining.
Access: public

Param Type Default Description
callback function a Function to be called every time the state of this store changes.
event String state_change name of the event to subscribe to

webStore.unregister([callback], event) ⇒ Store

Unregister a view from monitoring state changes of this store. This method should not be overridden by subclasses.

Kind: instance method of WebStore
Returns: Store - - a reference to self for fluid interface method chaining.
Access: public

Param Type Default Description
[callback] function the original registered callback to be unregistered.
event String state_change name of the event to unsubscribe from

AbstractSecureView ⇐ FeatureView

Kind: global class
Extends: FeatureView

new AbstractSecureView(props)

SecureView extends FeatureView and enables all extending classes to be readable or writable per both its feature configuration and the satisfaction of its security or authorization policy

Param Type
props Object

abstractSecureView.$isWritable : boolean

Indicates that the component is writable. Writable components can be updated throughout their life. The can be rendered and re-rendered. A component that is writable is always also readable.

Kind: instance property of AbstractSecureView
Default: false
Overrides: $isWritable
Access: protected

abstractSecureView.$isReadable : boolean

Indicates that the component is readable. Readable components can NOT be updated throughout their life. They are rendered once to the screen and cannot be rendered again during their life. Neither the system nor a user can update readable components such that they are re-rendered to the screen. A component that is readable may or may not be writable.

Kind: instance property of AbstractSecureView
Default: false
Overrides: $isReadable
Access: protected

abstractSecureView.$state ⇒ Object

Returns a safe copy of this view's state. This enables safe passing of state from this view to children.

Kind: instance property of AbstractSecureView
Access: protected

abstractSecureView.dom ⇒ *

Returns a reference to the DOM node of this component

Kind: instance property of AbstractSecureView
Access: public

abstractSecureView.$isAuthorized()

This method must be implemented and return a boolean value that indicates whether or not a user is authorized to use this view. This boolean value should be calculated using the extending classes $policy and object(s) containing the values necessary to calculate the satisfaction of the policy.

Kind: instance method of AbstractSecureView
Access: protected

abstractSecureView.$configure()

This method can be used to override the default configuration rules whereby the ConfigurableView is set to be readable or writable per explicit property values or a passed configuration. If there are further rules or configurations that must be made prior to rendering these can be set by overriding this protected 'virtual' method.

Kind: instance method of AbstractSecureView
Overrides: $configure
Access: protected

abstractSecureView.$initState(...state)

Safely initialize state so as to not overwrite state of a parent class;

Kind: instance abstract method of AbstractSecureView
Access: protected

Param Type
...state Object

abstractSecureView.$setProps(props)

Set and update $props

Kind: instance abstract method of AbstractSecureView
Access: protected

Param Type
props Object

abstractSecureView.$pruneProps()

Use this method to prune $props of all extraneous $props. It can and should be called in all classes where there are props passed that should not be used as pass-through props. That is, for those props that only intended for the defining class. -- It is intended that $props will be used as pass-through props and this mechanism enables a component to be instantiated with props that only it cares about, and then prune out these props before sending the remaining pass-through props to child elements.

Kind: instance abstract method of AbstractSecureView
Access: protected

abstractSecureView.$init()

Implement this method in a child class to set up initial state that CANNOT be initialized in the constructor before the component renders. Favor the constructor! This method should only be used for those occasions where the initialization of the target member(s) simply CANNOT occur in the constructor.

Kind: instance abstract method of AbstractSecureView
Access: protected

abstractSecureView.$bind()

Use this method to bind all of your local member member methods and handlers using the this.$member$ = () => this._member idiom.

Kind: instance abstract method of AbstractSecureView
Access: protected

abstractSecureView.$mount()

Implement this method in a child class to register to any dispatchers or other object that extend EventEmitter. These registrations should unregistered in $unmount to prevent any memory leaks.

Kind: instance abstract method of AbstractSecureView
Access: protected

abstractSecureView.$unmount()

Implement this method in a child class to unregister from any dispatchers or other object that extend EventEmitter. These unregistrations should unregister any registrations that occur in $mount to prevent any memory leaks.

Kind: instance abstract method of AbstractSecureView
Access: protected

abstractSecureView.$preRender(props)

This method will be called before any post-mount render. This will allow you to update the Component state via setState() with any new prop data received from a parent class or dependent class before this component is rendered.

Kind: instance abstract method of AbstractSecureView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

abstractSecureView.$postRender(props)

This method will be called after any post-mount render. This will allow you to update the DOM. You cannot call setState() or any derivative thereof in this method.

Kind: instance abstract method of AbstractSecureView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

abstractSecureView.$error(error, info)

This method is called for any lifecycle error in an extending component.

Kind: instance method of AbstractSecureView
Access: protected

Param Type
error Error
info String

abstractSecureView.setStateOnce(state)

Will setState of the property and then remove the property from state after setting so that this property is only applied for one round of rendering.

Kind: instance method of AbstractSecureView
Access: protected

Param Type
state Object

abstractSecureView.destroy()

It is unlikely that there will be any reason to call this method outside of the scope of unit testing.

Kind: instance method of AbstractSecureView
Access: public

AbstractView ⇐ React.Component

Kind: global abstract class
Extends: React.Component

new AbstractView(props)

This AbstractView wires a component to the Application State to give all child classes access to the application components: stores and controllers. It also abstract the React Component Lifecycle to better express the intention of the role of this process as it relates to the development.md of a react-application. All views, i.e. Components in a react-application extend this class.

Param Type
props Object

abstractView.$state ⇒ Object

Returns a safe copy of this view's state. This enables safe passing of state from this view to children.

Kind: instance property of AbstractView
Access: protected

abstractView.dom ⇒ *

Returns a reference to the DOM node of this component

Kind: instance property of AbstractView
Access: public

abstractView.$initState(...state)

Safely initialize state so as to not overwrite state of a parent class;

Kind: instance abstract method of AbstractView
Access: protected

Param Type
...state Object

abstractView.$setProps(props)

Set and update $props

Kind: instance abstract method of AbstractView
Access: protected

Param Type
props Object

abstractView.$pruneProps()

Use this method to prune $props of all extraneous $props. It can and should be called in all classes where there are props passed that should not be used as pass-through props. That is, for those props that only intended for the defining class. -- It is intended that $props will be used as pass-through props and this mechanism enables a component to be instantiated with props that only it cares about, and then prune out these props before sending the remaining pass-through props to child elements.

Kind: instance abstract method of AbstractView
Access: protected

abstractView.$init()

Implement this method in a child class to set up initial state that CANNOT be initialized in the constructor before the component renders. Favor the constructor! This method should only be used for those occasions where the initialization of the target member(s) simply CANNOT occur in the constructor.

Kind: instance abstract method of AbstractView
Access: protected

abstractView.$bind()

Use this method to bind all of your local member member methods and handlers using the this.$member$ = () => this._member idiom.

Kind: instance abstract method of AbstractView
Access: protected

abstractView.$mount()

Implement this method in a child class to register to any dispatchers or other object that extend EventEmitter. These registrations should unregistered in $unmount to prevent any memory leaks.

Kind: instance abstract method of AbstractView
Access: protected

abstractView.$unmount()

Implement this method in a child class to unregister from any dispatchers or other object that extend EventEmitter. These unregistrations should unregister any registrations that occur in $mount to prevent any memory leaks.

Kind: instance abstract method of AbstractView
Access: protected

abstractView.$preRender(props)

This method will be called before any post-mount render. This will allow you to update the Component state via setState() with any new prop data received from a parent class or dependent class before this component is rendered.

Kind: instance abstract method of AbstractView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

abstractView.$postRender(props)

This method will be called after any post-mount render. This will allow you to update the DOM. You cannot call setState() or any derivative thereof in this method.

Kind: instance abstract method of AbstractView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

abstractView.$error(error, info)

This method is called for any lifecycle error in an extending component.

Kind: instance method of AbstractView
Access: protected

Param Type
error Error
info String

abstractView.setStateOnce(state)

Will setState of the property and then remove the property from state after setting so that this property is only applied for one round of rendering.

Kind: instance method of AbstractView
Access: protected

Param Type
state Object

abstractView.destroy()

It is unlikely that there will be any reason to call this method outside of the scope of unit testing.

Kind: instance method of AbstractView
Access: public

ConfigurableView ⇐ AbstractView

Kind: global class
Extends: AbstractView

new ConfigurableView(props)

ConfigurableView is an abstract class that enables any extending class to understand how it should be configured per the configuration values it receives as arguments via properties. These configurations can be in the form of an object literal configuration read by a configurationPolicy via its configurationId or more simply by passing a boolean value for a readable or writable attribute. Extending classes can use this protected member data to determine how it should behave per this arguments.

Param Type
props Object

configurableView.$isWritable : boolean

Indicates that the component is writable. Writable components can be updated throughout their life. The can be rendered and re-rendered. A component that is writable is always also readable.

Kind: instance property of ConfigurableView
Default: false
Access: protected

configurableView.$isReadable : boolean

Indicates that the component is readable. Readable components can NOT be updated throughout their life. They are rendered once to the screen and cannot be rendered again during their life. Neither the system nor a user can update readable components such that they are re-rendered to the screen. A component that is readable may or may not be writable.

Kind: instance property of ConfigurableView
Default: false
Access: protected

configurableView.$state ⇒ Object

Returns a safe copy of this view's state. This enables safe passing of state from this view to children.

Kind: instance property of ConfigurableView
Access: protected

configurableView.dom ⇒ *

Returns a reference to the DOM node of this component

Kind: instance property of ConfigurableView
Access: public

configurableView.$configure()

This method can be used to override the default configuration rules whereby the ConfigurableView is set to be readable or writable per explicit property values or a passed configuration. If there are further rules or configurations that must be made prior to rendering these can be set by overriding this protected 'virtual' method.

Kind: instance abstract method of ConfigurableView
Access: protected

configurableView.$initState(...state)

Safely initialize state so as to not overwrite state of a parent class;

Kind: instance abstract method of ConfigurableView
Access: protected

Param Type
...state Object

configurableView.$setProps(props)

Set and update $props

Kind: instance abstract method of ConfigurableView
Access: protected

Param Type
props Object

configurableView.$pruneProps()

Use this method to prune $props of all extraneous $props. It can and should be called in all classes where there are props passed that should not be used as pass-through props. That is, for those props that only intended for the defining class. -- It is intended that $props will be used as pass-through props and this mechanism enables a component to be instantiated with props that only it cares about, and then prune out these props before sending the remaining pass-through props to child elements.

Kind: instance abstract method of ConfigurableView
Access: protected

configurableView.$init()

Implement this method in a child class to set up initial state that CANNOT be initialized in the constructor before the component renders. Favor the constructor! This method should only be used for those occasions where the initialization of the target member(s) simply CANNOT occur in the constructor.

Kind: instance abstract method of ConfigurableView
Access: protected

configurableView.$bind()

Use this method to bind all of your local member member methods and handlers using the this.$member$ = () => this._member idiom.

Kind: instance abstract method of ConfigurableView
Access: protected

configurableView.$mount()

Implement this method in a child class to register to any dispatchers or other object that extend EventEmitter. These registrations should unregistered in $unmount to prevent any memory leaks.

Kind: instance abstract method of ConfigurableView
Access: protected

configurableView.$unmount()

Implement this method in a child class to unregister from any dispatchers or other object that extend EventEmitter. These unregistrations should unregister any registrations that occur in $mount to prevent any memory leaks.

Kind: instance abstract method of ConfigurableView
Access: protected

configurableView.$preRender(props)

This method will be called before any post-mount render. This will allow you to update the Component state via setState() with any new prop data received from a parent class or dependent class before this component is rendered.

Kind: instance abstract method of ConfigurableView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

configurableView.$postRender(props)

This method will be called after any post-mount render. This will allow you to update the DOM. You cannot call setState() or any derivative thereof in this method.

Kind: instance abstract method of ConfigurableView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

configurableView.$error(error, info)

This method is called for any lifecycle error in an extending component.

Kind: instance method of ConfigurableView
Access: protected

Param Type
error Error
info String

configurableView.setStateOnce(state)

Will setState of the property and then remove the property from state after setting so that this property is only applied for one round of rendering.

Kind: instance method of ConfigurableView
Access: protected

Param Type
state Object

configurableView.destroy()

It is unlikely that there will be any reason to call this method outside of the scope of unit testing.

Kind: instance method of ConfigurableView
Access: public

FeatureView ⇐ ConfigurableView

Kind: global class
Extends: ConfigurableView

new FeatureView(props)

FeatureView is an AbstractView class that enables an extending view to determine it's render-ability per the feature configuration defined in the Application State. Features are assumed ON by default and must explicitly be set to a false value in the config to be turned off.

Param Type
props Object

featureView.$isWritable : boolean

Indicates that the component is writable. Writable components can be updated throughout their life. The can be rendered and re-rendered. A component that is writable is always also readable.

Kind: instance property of FeatureView
Default: false
Access: protected

featureView.$isReadable : boolean

Indicates that the component is readable. Readable components can NOT be updated throughout their life. They are rendered once to the screen and cannot be rendered again during their life. Neither the system nor a user can update readable components such that they are re-rendered to the screen. A component that is readable may or may not be writable.

Kind: instance property of FeatureView
Default: false
Access: protected

featureView.$state ⇒ Object

Returns a safe copy of this view's state. This enables safe passing of state from this view to children.

Kind: instance property of FeatureView
Access: protected

featureView.dom ⇒ *

Returns a reference to the DOM node of this component

Kind: instance property of FeatureView
Access: public

featureView.$configure()

This method can be used to override the default configuration rules whereby the ConfigurableView is set to be readable or writable per explicit property values or a passed configuration. If there are further rules or configurations that must be made prior to rendering these can be set by overriding this protected 'virtual' method.

Kind: instance abstract method of FeatureView
Access: protected

featureView.$initState(...state)

Safely initialize state so as to not overwrite state of a parent class;

Kind: instance abstract method of FeatureView
Access: protected

Param Type
...state Object

featureView.$setProps(props)

Set and update $props

Kind: instance abstract method of FeatureView
Access: protected

Param Type
props Object

featureView.$pruneProps()

Use this method to prune $props of all extraneous $props. It can and should be called in all classes where there are props passed that should not be used as pass-through props. That is, for those props that only intended for the defining class. -- It is intended that $props will be used as pass-through props and this mechanism enables a component to be instantiated with props that only it cares about, and then prune out these props before sending the remaining pass-through props to child elements.

Kind: instance abstract method of FeatureView
Access: protected

featureView.$init()

Implement this method in a child class to set up initial state that CANNOT be initialized in the constructor before the component renders. Favor the constructor! This method should only be used for those occasions where the initialization of the target member(s) simply CANNOT occur in the constructor.

Kind: instance abstract method of FeatureView
Access: protected

featureView.$bind()

Use this method to bind all of your local member member methods and handlers using the this.$member$ = () => this._member idiom.

Kind: instance abstract method of FeatureView
Access: protected

featureView.$mount()

Implement this method in a child class to register to any dispatchers or other object that extend EventEmitter. These registrations should unregistered in $unmount to prevent any memory leaks.

Kind: instance abstract method of FeatureView
Access: protected

featureView.$unmount()

Implement this method in a child class to unregister from any dispatchers or other object that extend EventEmitter. These unregistrations should unregister any registrations that occur in $mount to prevent any memory leaks.

Kind: instance abstract method of FeatureView
Access: protected

featureView.$preRender(props)

This method will be called before any post-mount render. This will allow you to update the Component state via setState() with any new prop data received from a parent class or dependent class before this component is rendered.

Kind: instance abstract method of FeatureView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

featureView.$postRender(props)

This method will be called after any post-mount render. This will allow you to update the DOM. You cannot call setState() or any derivative thereof in this method.

Kind: instance abstract method of FeatureView
Access: protected

Param Type Description
props Object Properties received from a dependent class.

featureView.$error(error, info)

This method is called for any lifecycle error in an extending component.

Kind: instance method of FeatureView
Access: protected

Param Type
error Error
info String

featureView.setStateOnce(state)

Will setState of the property and then remove the property from state after setting so that this property is only applied for one round of rendering.

Kind: instance method of FeatureView
Access: protected

Param Type
state Object

featureView.destroy()

It is unlikely that there will be any reason to call this method outside of the scope of unit testing.

Kind: instance method of FeatureView
Access: public

AbstractForm ⇐ View

Kind: global abstract class
Extends: View

new AbstractForm(props)

AbstractForm should be implemented as the base class for all form implementations. It will expose a stateful form with all expected form behaviors: read, write, clear, and field value reads. Subclasses should take care to not override this.state, instead augmenting this.state by leveraging object assignments; this.state = Object.assign(this.state, { <augments> })

Param Type
props Object

abstractForm.$isWritable : boolean

Indicates that the component is writable. Writable components can be updated throughout their life. The can be rendered and re-rendered. A component that is writable is always also readable.

Kind: instance property of AbstractForm
Default: false
Access: protected

abstractForm.$isReadable : boolean

Indicates that the component is readable. Readable components can NOT be updated throughout their life. They are rendered once to the screen and cannot be rendered again during their life. Neither the system nor a user can update readable components such that they are re-rendered to the screen. A component that is readable may or may not be writable.

Kind: instance property of AbstractForm
Default: false
Access: protected

abstractForm.$state ⇒ Object

Returns a safe copy of this view's state. This enables safe passing of state from this view to children.

Kind: instance property of AbstractForm
Access: protected

abstractForm.dom ⇒ *

Returns a reference to the DOM node of this component

Kind: instance property of AbstractForm
Access: public

abstractForm.$onChange(e)

Protected method to be implemented by each child field class as the value for their onChange attribute as follows: onChange={ (e) => { this.$onChange(e); } } doing this will wire the field into the state updates such that the target field will have it's value added to this form's values per the target fields name attribute value. That is, the value for the target field can be accessed via this.read() and this.value(<fieldName>)

Kind: instance abstract method of AbstractForm
Access: protected

Param Type Description
e Event = event

abstractForm.write(values) ⇒ AbstractForm

Write to a value programmatically.

Kind: instance method of AbstractForm
Access: public

Param Type Description
values Object = key is the value of the target field's name attribute, and the value is the intended value of the target field.

abstractForm.clear(fieldName) ⇒ AbstractForm

Clear a specific child field programmatically by passing the value of the name attribute for the target field, e.g. name=value.

Kind: instance method of AbstractForm
Access: public

Param Type Description
fieldName String = value of the name attribute of the target field.

abstractForm.value(name) ⇒ *

Retrieve the value of a target name field whose name attribute value is the argument name.

Kind: instance method of AbstractForm
Access: public

Param Type Description
name String = value of the name attribute of the target field.

abstractForm.read() ⇒ AbstractForm.state.values | Object

Retrieve the value of all field values of this form as an object literal of key:value pairs where key=target input name and value=the value of the target input.

Kind: instance method of AbstractForm
Access: public

abstractForm.$isAuthorized()

This method must be implemented and return a boolean value that indicates whether or not a user is authorized to use this view. This boolean value should be calculated using the extending classes $policy and object(s) containing the values necessary to calculate the satisfaction of the policy.

Kind: instance method of AbstractForm
Access: protected

abstractForm.$configure()

This method can be used to override the default configuration rules whereby the ConfigurableView is set to be readable or writable per explicit property values or a passed configuration. If there are further rules or configurations that must be made prior to rendering these can be set by overriding this protected 'virtual' method.

Kind: instance method of AbstractForm
Access: protected

abstractForm.$initState(...state)

Safely initialize state so as to not overwrite state of a parent class;

Kind: instance abstract method of AbstractForm
Access: protected

Param Type
...state Object

abstractForm.$setProps(props)

Set and update $props

Kind: instance abstract method of AbstractForm
Access: protected

Param Type
props Object

abstractForm.$pruneProps()

Use this method to prune $props of all extraneous $props. It can and should be called in all classes where there are props passed that should not be used as pass-through props. That is, for those props that only intended for the defining class. -- It is intended that $props will be used as pass-through props and this mechanism enables a component to be instantiated with props that only it cares about, and then prune out these props before sending the remaining pass-through props to child elements.

Kind: instance abstract method of AbstractForm
Access: protected

abstractForm.$init()

Implement this method in a child class to set up initial state that CANNOT be initialized in the constructor before the component