LT-67: Creating checkbox component
This commit is contained in:
1 parent
4e70e62b7b
commit
18516b47f0
6 files changed
+45
-5
No files matched your search
@@ -10,6 +10,7 @@ import './mixins/formItem.js';
|
||||
import './mixins/group.js';
|
||||
import './mixins/groupRadio.js';
|
||||
import './mixins/input.js';
|
||||
import './mixins/checkbox.js';
|
||||
import './mixins/schemaData.js';
|
||||
import './mixins/select.js';
|
||||
import './mixins/select2.js';
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
/*
|
||||
* inputCheckbox: controls a checkbox input
|
||||
*/
|
||||
OHIF.mixins.checkbox = new OHIF.Mixin({
|
||||
dependencies: 'input',
|
||||
composition: {
|
||||
onCreated() {
|
||||
const instance = Template.instance();
|
||||
const component = instance.component;
|
||||
|
||||
// Get or set the checked state using jQuery's prop method
|
||||
component.value = value => {
|
||||
const isGet = _.isUndefined(value);
|
||||
if (isGet) {
|
||||
return component.$element.is(':checked');
|
||||
}
|
||||
|
||||
component.$element.prop('checked', value);
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user