gristlabs_grist-core/app/client/ui/FieldContextMenu.ts
George Gevoian caf830db08 (core) Record Cards
Summary:
Adds a new Record Card view section to each non-summary table, which can be from opened from various parts of the Grist UI to view and edit records in a popup card view.

Work is still ongoing, so the feature is locked away behind a flag; follow-up work is planned to finish up the implementation and add end-to-end tests.

Test Plan: Python and server tests. Browser tests will be included in a follow-up.

Reviewers: jarek, paulfitz

Reviewed By: jarek

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4114
2023-11-19 20:12:37 -05:00

27 lines
1.0 KiB
TypeScript

import {allCommands} from 'app/client/components/commands';
import {makeT} from 'app/client/lib/localization';
import {menuDivider, menuItemCmd} from 'app/client/ui2018/menus';
import {dom} from 'grainjs';
const t = makeT('FieldContextMenu');
export interface IFieldContextMenu {
disableModify: boolean;
isReadonly: boolean;
}
export function FieldContextMenu(fieldOptions: IFieldContextMenu) {
const {disableModify, isReadonly} = fieldOptions;
const disableForReadonlyColumn = dom.cls('disabled', disableModify || isReadonly);
return [
menuItemCmd(allCommands.contextMenuCut, t('Cut'), disableForReadonlyColumn),
menuItemCmd(allCommands.contextMenuCopy, t('Copy')),
menuItemCmd(allCommands.contextMenuPaste, t('Paste'), disableForReadonlyColumn),
menuDivider(),
menuItemCmd(allCommands.clearCardFields, t('Clear field'), disableForReadonlyColumn),
menuItemCmd(allCommands.hideCardFields, t('Hide field')),
menuDivider(),
menuItemCmd(allCommands.copyLink, t('Copy anchor link')),
];
}