mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Label editor for Choice/ChoiceList column editor
Summary: Allowing a user to change labels' in Choice/ChoiceList entry editor. For updated entries, renaming those values in all cells in the column. Test Plan: Updated tests Reviewers: alexmojaki Reviewed By: alexmojaki Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3057
This commit is contained in:
@@ -73,13 +73,7 @@ export class ChoiceTextBox extends NTextBox {
|
||||
ChoiceListEntry,
|
||||
this._choiceValues,
|
||||
this._choiceOptionsByName,
|
||||
(choices, choiceOptions) => {
|
||||
return this.options.setAndSave({
|
||||
...this.options.peek(),
|
||||
choices,
|
||||
choiceOptions: toObject(choiceOptions)
|
||||
});
|
||||
}
|
||||
this.save.bind(this)
|
||||
)
|
||||
)
|
||||
];
|
||||
@@ -96,6 +90,15 @@ export class ChoiceTextBox extends NTextBox {
|
||||
protected getChoiceOptions(): Computed<ChoiceOptionsByName> {
|
||||
return this._choiceOptionsByName;
|
||||
}
|
||||
|
||||
protected save(choices: string[], choiceOptions: ChoiceOptionsByName, renames: Record<string, string>) {
|
||||
const options = {
|
||||
...this.options.peek(),
|
||||
choices,
|
||||
choiceOptions: toObject(choiceOptions)
|
||||
};
|
||||
return this.field.updateChoices(renames, options);
|
||||
}
|
||||
}
|
||||
|
||||
// Converts a POJO containing choice options to an ES6 Map
|
||||
|
||||
Reference in New Issue
Block a user