mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Support reordering conditional styles
Summary: Conditional style rules can now be reordered by dragging and dropping them. Test Plan: Browser test. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4251
This commit is contained in:
@@ -11,7 +11,7 @@ export interface RuleOwner {
|
||||
// If this field (or column) has a list of conditional styling rules.
|
||||
hasRules: ko.Computed<boolean>;
|
||||
// List of rules.
|
||||
rulesList: ko.Computed<[GristObjCode.List, ...number[]] | null>;
|
||||
rulesList: modelUtil.KoSaveableObservable<[GristObjCode.List, ...number[]] | null>;
|
||||
// List of columns that are used as rules for conditional styles.
|
||||
rulesCols: ko.Computed<ColumnRec[]>;
|
||||
// List of columns ids that are used as rules for conditional styles.
|
||||
|
||||
@@ -293,7 +293,10 @@ export function createViewFieldRec(this: ViewFieldRec, docModel: DocModel): void
|
||||
});
|
||||
|
||||
this.tableId = ko.pureComputed(() => this.column().table().tableId());
|
||||
this.rulesList = ko.pureComputed(() => this._fieldOrColumn().rules());
|
||||
this.rulesList = modelUtil.savingComputed({
|
||||
read: () => this._fieldOrColumn().rules(),
|
||||
write: (setter, val) => setter(this._fieldOrColumn().rules, val)
|
||||
});
|
||||
this.rulesCols = refListRecords(docModel.columns, ko.pureComputed(() => this._fieldOrColumn().rules()));
|
||||
this.rulesColsIds = ko.pureComputed(() => this.rulesCols().map(c => c.colId()));
|
||||
this.rulesStyles = modelUtil.fieldWithDefault(
|
||||
|
||||
@@ -824,6 +824,10 @@ export function createViewSectionRec(this: ViewSectionRec, docModel: DocModel):
|
||||
|
||||
this.tableId = this.autoDispose(ko.pureComputed(() => this.table().tableId()));
|
||||
const rawSection = this.autoDispose(ko.pureComputed(() => this.table().rawViewSection()));
|
||||
this.rulesList = modelUtil.savingComputed({
|
||||
read: () => rawSection().rules(),
|
||||
write: (setter, val) => setter(rawSection().rules, val)
|
||||
});
|
||||
this.rulesCols = refListRecords(docModel.columns, ko.pureComputed(() => rawSection().rules()));
|
||||
this.rulesColsIds = ko.pureComputed(() => this.rulesCols().map(c => c.colId()));
|
||||
this.rulesStyles = modelUtil.savingComputed({
|
||||
|
||||
Reference in New Issue
Block a user