mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
1654a2681f
Summary: This moves all client code to core, and makes minimal fix-ups to get grist and grist-core to compile correctly. The client works in core, but I'm leaving clean-up around the build and bundles to follow-up. Test Plan: existing tests pass; server-dev bundle looks sane Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2627
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
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) {
|
|
AbstractWidget.call(this, field);
|
|
}
|
|
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()];
|
|
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),
|
|
dom('div.checkmark_kick',
|
|
kd.style('background-color', this.field.textColor),
|
|
kd.style('border-color', this.field.textColor)
|
|
),
|
|
dom('div.checkmark_stem',
|
|
kd.style('background-color', this.field.textColor),
|
|
kd.style('border-color', this.field.textColor)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
};
|
|
|
|
module.exports = CheckBox;
|