Releases: green3g/spectre-canjs
Modal api - flexible sizing and class names
Simpler modal/confirm api
Confirming and displaying modal data is much easier now. Methods have been removed from modal in favor of stateful properties for controlling display of modals.
simple confirm function using modal dialog:
import ConfirmDialog from 'spectre-canjs/sp-confirm/sp-confirm';
function confirm(content, viewModel = {}, scope = {}) {
viewModel.active = true;
const confirm = new ConfirmDialog({
content,
viewModel,
scope: {
},
});
document.body.appendChild(confirm.element);
return confirm.viewModel.promise.then((outcome) => {
document.body.removeChild(confirm.element);
return confirm.viewModel;
});
}
Usage:
const {outcome} = await confirm('<h1>Are you sure about this????</h1>', {
// viewmodel properties
title: 'A dangerous action'
});
if(outcome.state === 'accepted'){
// do dangerous things
} else if(outcome.state === 'rejected'){
// user cancelled or closed the dialog
}
Can-query compatibility
Updates to sp-admin component to use can-query parameters and can-query compatibility.
CanJS for...of updates
can-stache support for using {{#for(object of objects)}}
in all components. Requires 4.11 version of can-stache.
Breaking changes
- all components use new for of tags in can-stache.
- table components no longer use
../object
for rows and columns. Instead,object[field.name]
works. (see docs for details)
SP-File-List Drag n' drop enhancements
CanJS 5.0
Cascading select dropdowns
Clear Value button helper on text input
CanJS 4.0 Compatibility
Breaking Changes
-
CanJS 4.0 - All packages must use canjs 4 compatible packages in order to use v2.0
-
Remove deprecated components
- sp-file-field: replaced with sp-dropzone-field
- sp-date-field: use
onInsert
in field config instead to initialize a datepicker or something - sp-menu: use sp-tab-container instead
-
Other changes:
-
sp-confirm: no longer exports a promise, just use events to register accept/reject
-
Using fields in
sp-form
is more customizable. Either passeditTag
(string) to the field prop, oreditComponent
(stache function) tosp-form.fields
to have field templates rendered.
Enhancements
- New Components:
- sp-dropdzone-field: a file upload field using Dropzone
- sp-file-list: A file list that can display images and provides a slot for "actions" on the files.
Filter and Sort Enhancements
This version brings several useful enhancements to the data-admin.
- Fade effect when data is in loading state
- Lots of minor non-breaking code cleanups
Sorting enhancements
- Sorting can now be cleared using the small "x" icon that appears
- Sorting can be disabled on columns using
sort: false
in the field properties
Filtering enhancements
- Filters can be created on views, but not visible to the user using
visible: false
in the field properties - Filters can be pinned, to allow modifying values, but not allowing them to be removed