2020-10-02 15:10:00 +00:00
|
|
|
var dom = require('../lib/dom');
|
|
|
|
var dispose = require('../lib/dispose');
|
|
|
|
var _ = require('underscore');
|
|
|
|
var kd = require('../lib/koDom');
|
|
|
|
var AbstractWidget = require('./AbstractWidget');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CheckBox - A bi-state CheckBox widget
|
|
|
|
*/
|
|
|
|
function CheckBox(field) {
|
2021-03-02 12:27:08 +00:00
|
|
|
AbstractWidget.call(this, field, {defaultTextColor: '#606060'});
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
dispose.makeDisposable(CheckBox);
|
|
|
|
_.extend(CheckBox.prototype, AbstractWidget.prototype);
|
|
|
|
|
|
|
|
CheckBox.prototype.buildConfigDom = function() {
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
|
|
|
|
CheckBox.prototype.buildDom = function(row) {
|
|
|
|
var value = row[this.field.colId()];
|
2022-08-08 13:32:50 +00:00
|
|
|
console.log(this);
|
2020-10-02 15:10:00 +00:00
|
|
|
return dom('div.field_clip',
|
|
|
|
dom('div.widget_checkbox',
|
|
|
|
dom.on('click', () => {
|
|
|
|
if (!this.field.column().isRealFormula()) {
|
|
|
|
value.setAndSave(!value.peek());
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
dom('div.widget_checkmark',
|
|
|
|
kd.show(value),
|
2022-08-08 13:32:50 +00:00
|
|
|
dom('div.checkmark_kick'),
|
|
|
|
dom('div.checkmark_stem')
|
2020-10-02 15:10:00 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = CheckBox;
|