mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Making cells colors effective also in Card and Card List views
Summary: . Makes cell color work well in comparison mode . Do not apply cell color to the add new row . Allow to change color for all widget (including changing color for the checkbox and the switch widget) . Fix an issue that was setting color to black when opening the picker . Do not apply color to invalid cell Test Plan: . Added nbrowser/CellColor Reviewers: paulfitz, dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2720
This commit is contained in:
@@ -128,11 +128,13 @@ export class FieldBuilder extends Disposable {
|
||||
write(widget) {
|
||||
// Reset the entire JSON, so that all options revert to their defaults.
|
||||
|
||||
const previous = this.options.peek();
|
||||
this.options.setAndSave({
|
||||
widget,
|
||||
// persists color settings across widgets
|
||||
fillColor: field.fillColor.peek(),
|
||||
textColor: field.textColor.peek()
|
||||
// Persists color settings across widgets (note: we cannot use `field.fillColor` to get the
|
||||
// current value because it returns a default value for `undefined`. Same for `field.textColor`.
|
||||
fillColor: previous.fillColor,
|
||||
textColor: previous.textColor,
|
||||
}).catch(reportError);
|
||||
}
|
||||
});
|
||||
@@ -418,7 +420,9 @@ export class FieldBuilder extends Disposable {
|
||||
kd.scope(widgetObs, (widget: NewAbstractWidget) => {
|
||||
if (this.isDisposed()) { return null; } // Work around JS errors during field removal.
|
||||
const cellDom = widget ? widget.buildDom(row) : buildErrorDom(row, this.field);
|
||||
return dom(cellDom, kd.toggleClass('has_cursor', isActive));
|
||||
return dom(cellDom, kd.toggleClass('has_cursor', isActive),
|
||||
kd.style('--grist-cell-color', this.field.textColor),
|
||||
kd.style('--grist-cell-background-color', this.field.fillColor));
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user