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-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 [
|
|
|
|
menuSubHeader(`Using ${useColOptions ? 'common' : 'separate'} settings`),
|
2022-02-07 14:02:26 +00:00
|
|
|
useColOptions ? menuItem(actions.useSeparate, 'Use separate settings', dom.cls('disabled', disableSeparate)) : [
|
2020-10-02 15:10:00 +00:00
|
|
|
menuItem(actions.saveAsCommon, 'Save as common settings'),
|
|
|
|
menuItem(actions.revertToCommon, 'Revert to common settings'),
|
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|