1.0.0Components for building user interfaces
A virtical navigation accordion component
Extends sp-tab-container
<sp-accordion />
An accordion page
Extends sp-tab-page
<sp-accordion-page />
A confirm dialog box with options for accepting or rejecting
<sp-confirm />
A <sp-confirm /> component's ViewModel
Extends sp-modal.ViewModel
The text to display in the accept confirmation button. The default is 'Ok'
The text to display in the reject confirmation button. The default is 'Cancel'
A promise resolved or rejected when the modal is confirmed or rejected.
Called when the accept button is clicked. Resolves the actionPromise.
In addition, the accept event is dispatched on the component element.
Called when the reject button is clicked. Rejects the actionPromise.
In addition, the reject event is dispatched on the component element.
Inserts a dropdown toggle button into the page. Consider using spectre.css css-only dropdowns instead
<sp-dropdown />
Dropdown View Model
The icon class to display next to the dropdown.
The default is a font-awesome caret fa fa-fw fa-caret-down
iconClass:from="'fa fa-fw fa-table'"
The text to display in the dropdown button
The current state of the dropdown menu
The button class to apply to the button dropdown. The default is btn btn-link.
See the spectre.css styles for details on more button classes available
An array of buttons to display next to the dropdown button. This creates a split dropdown menu button group
Whether or not to align this dropdown menu on the right hand side of the button.
toggles the display of a sp-dropdown component
(Event)
(event) the click event to cancel
(Boolean)
optional - whether or not to display the menu,
if undefined the dropdown will toggle the current visibility
Boolean:
always returns false to prevent page navigation from occuring
Queries the dom for other sp-dropdown components and hides them. This is used when a dropdown component is visible and another one is clicked, any others will be made invisible
When a primary button is clicked, this function dispatches the primaryclick
event with the button that was clicked as its argument.
(ButtonObject)
the button that was clicked
(MouseEvent)
The mouse click event on the button that we should prevent default
Boolean:
returns false to prevent event from changing page route
A formatted list of files with slots for actions. Images are displayed if available.
<sp-file-list />
A <sp-file-list /> component's ViewModel
A modal dialog
<sp-modal />
A <sp-modal /> component's ViewModel
Whether or not this modal is currently active. The default is false
Whether or not to use a custom body content for the modal. The default is false.
This overrides the title property and modal-body divs displayed by displaying
only the content passed to the <sp-modal></sp-modal> component
Flag to make this modal a small (modal-sm) modal. The default is false
Whether or not to display this modals backdrop. The default is true.
Shows this modal
Hides this modal
A paginate ui component
<sp-paginate />
A <sp-paginate /> component's ViewModel
The number of pages to show in the widget
The active page index
The number of pages to show on either side of the currently selected page. The default is 3. For example, if the selected page is 5, the visible pages should be 2,3,4,5,6,7,8.
A virtual property used by the template to indicate whether or not there is a next page
A virtual property used by the template to indicate whether or not there is a previous page
The array of currently shown pages in the widget
The array of numbers 0 through number of pages. This is a helper for the visiblePages getter
Hides the first button
Hides the last button
Hides the previous button
Hides the next button
Hides the list of pages
Tab page component used in the sp-tab-container for navigation
<sp-tab-page />
A <sp-tab-page /> component's ViewModel
The display state of the page. If true, the page content will be shown
Add custom classes to the navigation containers nav tab.
The label to display in the memberof container tab
Whether or not this page is currently loading
A unique id to identify this page. The default is automatically provided.
The parent containers view model
A navigation container for navigating between tabbed pages
<sp-tab-container />
A <sp-tab-container /> component's ViewModel
An array of pages currently displayed in this sp-tab-container
The currently active page
The id of the page that is currently active. This value should be set to change the activePage
When a <sp-tab-page> element is inserted into the document, it calls this
method to add the page's scope to thepages array.
(sp-tab-page.ViewModel)
the page view model that was added
When a <page> element is removed from the document, it calls this
method to remove the page's scope from the pages array.
(sp-tab-page.ViewModel)
the page view model to remove
Sets a page to the currently selected/active page
(sp-tab-page.ViewModel)
The page to set as the active page
Used by nav containers that might need to toggle pages, rather than just activate them (accordion)
(sp-tab-page.ViewModel)
the page to toggle
The content displayed in the toast. The default is an empty string.
A hideable notification component
A <sp-toast /> component's ViewModel
whether or not to fade the sp-toast out using animate.css
the time to autohide this sp-toast. Set to 0 to disable auto hide
Whether or not to use the content tag, that will display whatever
is inside the <sp-toast></sp-toast> tags. This overrides the
body property of this sp-toast
The class that gives the sp-toast context. Must be either info, success, warning, or danger.
Marks the sp-toast as dismissable, which adds a "close" icon to the sp-toast. The default is true
Displays a helpful icon next to the toast text
Set to null or empty string to exclude icon completely. The default is
icon icon-error_outline
Toggles visiblity of the sp-toast. The default is false.
Optional. The title of the sp-toast. The default is an empty string.
Time in miliseconds to fade out this sp-toast
Hide this sp-toast
A controller that adds and removes toasts from the dom
<sp-toast-container />
A <sp-toast-container /> component's ViewModel
An array of alert toasts
adds a new toast
(sp-toast.ViewModel)
the toast options or toast object to add
Removes a toast
(sp-toast.ViewModel)
the toast object to remove
Components for managing and viewing data
A filter component for creating complex filters
<sp-filter />
A component for allowing users to create complex filters
<sp-filter-builder />
Creates a new filter
A value to filter on. Can be any primitive type. If the
[sp-filter-builder.Filter.props.field field] property
is set, the field.type property will be used to coerce the value.
The name of the field to filter on
The operator to filter with. The default is like.
A field object that defines the available operator options and properties.
This is used to create the dropdown choice for each filter in the sp-filter-builder.
This field is generated automatically. If the
[sp-filter-builder.Filter.props.field field] property is set,
the field.type property will be used to filter the operator options.
A property to show or hide this filter in the picker. The default is true
A property to disable this filter's remove button. This filter will not
be removable. In addition, the operator field will be fixed. The default
is false.
A virtual property to provide the field alias. If the
[sp-filter-builder.Filter.props.field field] property is set, this alias
will match the field.alias
A field object that defines the value field properties.
This is used to create the value field for each filter in the sp-filter-builder.
If the [sp-filter-builder.Filter.props.field field] property is set, the
valueField will be a customized field based off of the set field.
The field object used to initialize this filter. When this value is provided, the custom field will be used in place of the regular text field. This allows the user to interract with a different type of field, like a checkbox when setting filters.
A virtual property that creates a dummmy form object for use with the field template
a setter for the value field for use with the field template
(util/field/Field)
the field object
(domElement)
the input element
(Object)
the view model scope
(any)
the object with the value set on the form
Creates a new filter list
A <sp-filter-builder /> component's ViewModel.
Disabled the add new form if true
A string referencing a field type that will exclude that field from this classes fields. The default is 'list'.
A list of filterObjects currently used in this widget
The field properties for the field name dropdown
An array of field options to display for the field selection dropdown.
The selected field dropdown value
Adds a new filter or set of filters to the list of filters in this widget.
TODO: A filterFactory may be defined on the field which may return one filter or an array of
filters.
(string)
the array of arguments from the fieldchange event
Boolean:
returns false to prevent event propagation from links
A table to hold an array of objects - one object per row
<sp-list-table />
A <sp-list-table /> component's ViewModel.
A string referencing a field type that will exclude that field from this classes fields. The default is 'list'.
Optional promise or deferred object that will resolve to an object. Once the promise resolves, the objects list will be replaced with the promise result
A list of objects to display. These objects should generally be can.Model objects but may be an javascript object.
A virtual type that retrieves this table's first object
Id type name for the rows of objects. The default is id. This value
is used to determine whether objects are selected or not. For a built in
unique ID, _cid may be used. _cid is automatically generatted by can-define
and should be guaranteed to be unique accross all DefineMaps
Whether rows can be selectable using a checkbox
A list of the currently selected objects in the table
An array of ids for the selected objects. This is a virtual type and cannot be set.
A virtual type that helps the template determine whether all objects are selected
The current sort field
Selects or unselects all of the objects in the table
A two column table for displaying Field:value object pairs
<sp-property-table />
A <sp-property-table /> component's ViewModel. This viewmodel
extends the [util/field/ ]'s properties
A string referencing a field property that will exclude that field from this classes fields. The default is 'detail'.
A flag to allow editing (Not yet implemented) TODO: implement editing
A flag to allow deleting (Not yet implemented) TODO: implement deleting
The ID value of the object that should be retrieved. This value along with the connection object will be used to retrieve an object from a RESTful service
The connection object that should be used to retrieve an object. This value along with the objectId value will be used to retrieve an object from a RESTful service
A generic object to display in a tabular format. This can be used instead of providing a connection and objectId property
A promise that resolves to the object. Used to determine state of current fetching operations
Asynchronously fetches an object using a can-connect model and an id
(can-connect)
The connection object to an api resource. The model must have a
get(id)
method.
(Number)
The id number of the object to retrieve
Promise:
A promise that is resolved once the object is retreived
Field components for modifying and creating data. Use with sp-form.
A form component useful for validation, data updating, and dirty checking
<sp-dropdown />
Form View Model
A string referencing a field type that will exclude that field
from this classes fields. The default is 'edit'.
Whether or not to show the saving icon when the submit button is clickered.
Whether or not this form should be an inline (horizontal) form
The connection info for this form's data. If this is provided, the object will be fetched using the objectId type
The object id of the item to retrieve. If this and [sp-form.ViewModel.connection] is provided, a request will be made to the connection object with the specified id.
The pending promise if the object is being retrieved or null
An object representing the current state of the values passed to the form. If the fields have changed, this object will be updated when the submit button is pressed and the validations have passed. To capture current state of the form, use [sp-form.ViewModel.dirtyObject].
An object set with current form values
An object consisting of validation error strings
{
field: 'error message',
otherfield: 'another error message'
}
Whether or not this form is valid and can be submitted. If this is
false, the form will not dispatch the submit event when it is submitted.
Instead, it will dispatch a submit-fail event
This type is set to true when the save button is clicked. It sets the save button to a loading state
A boolean field that can be used as a switch or a checkbox
<sp-check-field />
A select dropdown
<sp-select-field />
A fieldset to display a set of fields in a nested pattern
<sp-subform-field />
A
Extends Field
A basic text field configureable to be formatted as different HTML5 input types or HTML textarea elements
<sp-text-field />
A <sp-text-field /> component's ViewModel
Extends Field
The type of input to create. The default is 'text'
textType="number"
Checks for the enter keypress and triggers a change event on the input The enter key press triggers a submit event on the form, but before the submit event, we need to trigger a change on the field value
(domElement)
The form input element
(KeyDownEvent)
The form submit event
Boolean:
Utility functions and classes
Constructs a new field
The name of the type on the object, this field's name
A friendly name for the field used to display to the user The default is to capitalize the name and remove underscores
The field error string
The current field value
Includes this field in the list view in the data-admin
Includes this field in the details view in the data-admin
Includes this field in the edit view in the data-admin
Includes this field in the filter widget's fields.
Includes this field in the sorting capability
A boolean flag to display form field inline with others and hide labels
Text to display when the field is empty (like a textbox). Doesn't apply to some fields, like select or date fields.
Adds css classes to the table cells and headings. Selectors should use
th.classname and td.classname
If field component implements this method, it will be called when the component is inserted, with the input element It can be used to customize the input, like adding a date picker
Validates a type and returns a string if the field is invalid
(ValidationObject)
A special object consisting of information about the current value and dirty state of the form object
(String | falsey):
a string error message if the value is not valid or undefined if there is no error message
Converts an array of strings or field json objects into Field objects
Array<Field>:
The array of fields
Formats the field by replacing underscores with spaces and capitalizing the first letter
(String)
The name of the field
String:
The formatted field string. Example:
my_field_name
will become
My field name
.
Converts a DefineMap to an array of Field objects using the property definitions property or the keys
(Constructor)
The extended map/constructor to parse
Array<util/field/Field>:
The array of fields