mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Improving experience when editing group-by column.
Summary: Improving experience when editing group-by column: - Disable column rename - Allow changing most widget properties: - Color/Background - Number format - Date/DateTime format (but not the timezone) - All toggle options (for toggle column) - Remove Edit button on Choice Edit - Changing the underlying column should reset all those options back to the original column. Test Plan: nbrowser Reviewers: alexmojaki Reviewed By: alexmojaki Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3216
This commit is contained in:
@@ -18,6 +18,7 @@ export interface ACSelectItem extends ACItem {
|
||||
export function buildACSelect(
|
||||
owner: IDisposableOwner,
|
||||
options: {
|
||||
disabled?: Observable<boolean>,
|
||||
acIndex: ACIndex<ACSelectItem>,
|
||||
valueObs: Observable<string>,
|
||||
save: (value: string, item: ACSelectItem|undefined) => Promise<void>|void
|
||||
@@ -55,6 +56,9 @@ export function buildACSelect(
|
||||
|
||||
const onMouseDown = (ev: MouseEvent) => {
|
||||
ev.preventDefault(); // Don't let it affect focus, since we focus/blur manually.
|
||||
if (options.disabled?.get()) {
|
||||
return;
|
||||
}
|
||||
if (!isOpen()) { textInput.focus(); }
|
||||
openOrCommit();
|
||||
};
|
||||
@@ -73,6 +77,7 @@ export function buildACSelect(
|
||||
dom.prop('value', valueObs),
|
||||
dom.on('focus', (ev, elem) => elem.select()),
|
||||
dom.on('blur', commitOrRevert),
|
||||
dom.prop("disabled", (use) => options.disabled ? use(options.disabled) : false),
|
||||
dom.onKeyDown({
|
||||
Escape: revert,
|
||||
Enter: openOrCommit,
|
||||
|
||||
Reference in New Issue
Block a user