import {ColumnRec, DocModel, IRowModel, refListRecords, refRecord, ViewSectionRec} from 'app/client/models/DocModel'; import {formatterForRec} from 'app/client/models/entities/ColumnRec'; import * as modelUtil from 'app/client/models/modelUtil'; import {removeRule, RuleOwner} from 'app/client/models/RuleOwner'; import { HeaderStyle, Style } from 'app/client/models/Styles'; import {ViewFieldConfig} from 'app/client/models/ViewFieldConfig'; import * as UserType from 'app/client/widgets/UserType'; import {DocumentSettings} from 'app/common/DocumentSettings'; import {BaseFormatter} from 'app/common/ValueFormatter'; import {createParser} from 'app/common/ValueParser'; import * as ko from 'knockout'; // Represents a page entry in the tree of pages. export interface ViewFieldRec extends IRowModel<"_grist_Views_section_field">, RuleOwner { viewSection: ko.Computed; widthDef: modelUtil.KoSaveableObservable; widthPx: ko.Computed; column: ko.Computed; origCol: ko.Computed; colId: ko.Computed; label: ko.Computed; description: modelUtil.KoSaveableObservable; // displayLabel displays label by default but switches to the more helpful colId whenever a // formula field in the view is being edited. displayLabel: modelUtil.KoSaveableObservable; // The field knows when we are editing a formula, so that all rows can reflect that. editingFormula: ko.Computed; // CSS class to add to formula cells, incl. to show that we are editing field's formula. formulaCssClass: ko.Computed; // The fields's display column _displayColModel: ko.Computed; // Whether field uses column's widgetOptions (true) or its own (false). // During transform, use the transform column's options (which should be initialized to match // field or column when the transform starts TODO). useColOptions: ko.Computed; // Helper that returns the RowModel for either field or its column, depending on // useColOptions. Field and Column have a few identical fields: // .widgetOptions() // JSON string of options // .saveDisplayFormula() // Method to save the display formula // .displayCol() // Reference to an optional associated display column. _fieldOrColumn: ko.Computed; // Display col ref to use for the field, defaulting to the plain column itself. displayColRef: ko.Computed; visibleColRef: modelUtil.KoSaveableObservable; // The display column to use for the field, or the column itself when no displayCol is set. displayColModel: ko.Computed; visibleColModel: ko.Computed; // The widgetOptions to read and write: either the column's or the field's own. _widgetOptionsStr: modelUtil.KoSaveableObservable; // Observable for the object with the current options, either for the field or for the column, // which takes into account the default options for column's type. widgetOptionsJson: modelUtil.SaveableObjObservable; disableModify: ko.Computed; disableEditData: ko.Computed; // Whether lines should wrap in a cell. wrap: modelUtil.KoSaveableObservable; widget: modelUtil.KoSaveableObservable; textColor: modelUtil.KoSaveableObservable; fillColor: modelUtil.KoSaveableObservable; fontBold: modelUtil.KoSaveableObservable; fontUnderline: modelUtil.KoSaveableObservable; fontItalic: modelUtil.KoSaveableObservable; fontStrikethrough: modelUtil.KoSaveableObservable; headerTextColor: modelUtil.KoSaveableObservable; headerFillColor: modelUtil.KoSaveableObservable; headerFontBold: modelUtil.KoSaveableObservable; headerFontUnderline: modelUtil.KoSaveableObservable; headerFontItalic: modelUtil.KoSaveableObservable; headerFontStrikethrough: modelUtil.KoSaveableObservable; // Helper computed to change style of a cell and headerStyle without saving it. style: ko.PureComputed