mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
34708cd348
Summary: Redesigning color picker: - Single color palette (no light/dark switch) - Ability to remove color (new empty button) New font options in the color picker. Font options are available on: - Default cell style - Conditional rules styles - Choice/ChoiceList editor and token field - Filters for Choice/ChoiceList columns Design document: https://www.figma.com/file/bRTsb47VIOVBfJPj0qF3C9/Grist-Updates?node-id=415%3A8135 Test Plan: new and updated tests Reviewers: georgegevoian, alexmojaki Reviewed By: georgegevoian, alexmojaki Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3335
49 lines
1.6 KiB
JavaScript
49 lines
1.6 KiB
JavaScript
var dispose = require('../lib/dispose');
|
|
const {CellStyle} = require('app/client/widgets/CellStyle');
|
|
const {dom} = require('grainjs');
|
|
|
|
/**
|
|
* AbstractWidget - The base of the inheritance tree for widgets.
|
|
* @param {Function} field - The RowModel for this view field.
|
|
* @param {string|undefined} options.defaultTextColor - A hex value to set the default text color
|
|
* for the widget. Omit defaults to '#000000'.
|
|
*/
|
|
function AbstractWidget(field, opts = {}) {
|
|
this.field = field;
|
|
this.options = field.widgetOptionsJson;
|
|
const {defaultTextColor = '#000000'} = opts;
|
|
this.defaultTextColor = defaultTextColor;
|
|
this.valueFormatter = this.field.visibleColFormatter;
|
|
this.defaultTextColor = opts.defaultTextColor || '#000000';
|
|
}
|
|
dispose.makeDisposable(AbstractWidget);
|
|
|
|
/**
|
|
* Builds the DOM showing configuration buttons and fields in the sidebar.
|
|
*/
|
|
AbstractWidget.prototype.buildConfigDom = function() {
|
|
throw new Error("Not Implemented");
|
|
};
|
|
|
|
/**
|
|
* Builds the transform prompt config DOM in the few cases where it is necessary.
|
|
* Child classes need not override this function if they do not require transform config options.
|
|
*/
|
|
AbstractWidget.prototype.buildTransformConfigDom = function() {
|
|
return null;
|
|
};
|
|
|
|
/**
|
|
* Builds the data cell DOM.
|
|
* @param {DataRowModel} row - The rowModel object.
|
|
*/
|
|
AbstractWidget.prototype.buildDom = function(row) {
|
|
throw new Error("Not Implemented");
|
|
};
|
|
|
|
AbstractWidget.prototype.buildColorConfigDom = function(gristDoc) {
|
|
return dom.create(CellStyle, this.field, gristDoc, this.defaultTextColor);
|
|
};
|
|
|
|
module.exports = AbstractWidget;
|