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