2022-10-28 16:11:08 +00:00
|
|
|
import {makeT} from 'app/client/lib/localization';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {menuItem, menuSubHeader} from 'app/client/ui2018/menus';
|
2022-02-07 14:02:26 +00:00
|
|
|
import {dom} from 'grainjs';
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
interface IFieldOptions {
|
|
|
|
useSeparate: () => void;
|
|
|
|
saveAsCommon: () => void;
|
|
|
|
revertToCommon: () => void;
|
|
|
|
}
|
|
|
|
|
2022-10-28 16:11:08 +00:00
|
|
|
const t = makeT('FieldMenus');
|
|
|
|
|
2022-02-07 14:02:26 +00:00
|
|
|
export function FieldSettingsMenu(useColOptions: boolean, disableSeparate: boolean, actions: IFieldOptions) {
|
|
|
|
useColOptions = useColOptions || disableSeparate;
|
2020-10-02 15:10:00 +00:00
|
|
|
return [
|
2022-10-28 16:11:08 +00:00
|
|
|
menuSubHeader(t('UsingSettings', {context: useColOptions ? 'common' : 'separate'})),
|
|
|
|
useColOptions ? menuItem(actions.useSeparate, t('Settings', {context: 'useseparate'}), dom.cls('disabled', disableSeparate)) : [
|
|
|
|
menuItem(actions.saveAsCommon, t('Settings', {context: 'savecommon'})),
|
|
|
|
menuItem(actions.revertToCommon, t('Settings', {context: 'revertcommon'})),
|
2020-10-02 15:10:00 +00:00
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|