@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
78 lines (76 loc) • 2.62 kB
TypeScript
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { AllItemActions, DetailedItem } from '../models/Item';
import { ContextMenuOption } from '../components/ContextMenu';
import { EditFilePayload } from '../state/actions/misc';
import { IntlFormatters, MessageDescriptor } from 'react-intl';
import React from 'react';
import { Clipboard } from '../models/GlobalState';
import { Dispatch } from 'redux';
import SystemType from '../models/SystemType';
import StandardAction from '../models/StandardAction';
export type ContextMenuOptionDescriptor<ID extends string = string> = {
id: ID;
label: MessageDescriptor;
values?: any;
};
export declare const allItemActions: string[];
export declare function toContextMenuOptionsLookup<Keys extends string = AllItemActions>(
menuOptionDescriptors: Record<Keys, ContextMenuOptionDescriptor>,
formatMessage: IntlFormatters['formatMessage']
): Record<Keys, ContextMenuOption>;
export declare function generateSingleItemOptions(
item: DetailedItem,
formatMessage: IntlFormatters['formatMessage'],
options?: Partial<{
hasClipboard: boolean;
includeOnly: AllItemActions[];
}>
): ContextMenuOption[][];
export declare function generateMultipleItemOptions(
items: DetailedItem[],
formatMessage: IntlFormatters['formatMessage'],
options?: {
includeOnly: AllItemActions[];
}
): ContextMenuOption[];
export declare const itemActionDispatcher: ({
site,
item: itemOrItems,
option,
authoringBase,
dispatch,
formatMessage,
clipboard,
onActionSuccess,
event,
extraPayload
}: {
site: string;
item: DetailedItem | DetailedItem[];
option: AllItemActions;
authoringBase: string;
dispatch: Dispatch;
formatMessage;
clipboard?: Clipboard;
onActionSuccess?: any;
event?: React.MouseEvent<Element, MouseEvent>;
extraPayload?: any;
}) => void;
export declare function editControllerActionCreator(
systemType: SystemType,
contentTypeId: string
): StandardAction<EditFilePayload>;