@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
177 lines (176 loc) • 7.28 kB
TypeScript
import { CSSProperties } from 'react';
import { AdaptableColumn } from '../../AdaptableState/Common/AdaptableColumn';
import { AdaptableColumnMenuItemName, AdaptableContextMenuItemName, AdaptableMenuItem, ContextMenuContext } from '../../AdaptableState/Common/Menu';
import { AdaptableModule } from '../../AdaptableState/Common/Types';
import { TeamSharingImportInfo } from '../../AdaptableState/TeamSharingState';
import { AdaptableObject } from '../../AdaptableState/Common/AdaptableObject';
import { AccessLevel } from '../../AdaptableState/Common/Entitlement';
import { CalculatedColumn } from '../../AdaptableState/CalculatedColumnState';
import { FreeTextColumn } from '../../AdaptableState/FreeTextColumnState';
import { AdaptableOnePageWizardProps } from '../../View/Wizard/Interface/IAdaptableWizard';
import * as Redux from 'redux';
import { AdaptableSystemIconName, SuspendableObject } from '../../../types';
import { StatusBarPanelProps } from '../../View/StatusBar/StatusBarPanel';
import { StrictExtract } from '../../Utilities/Extensions/TypeExtensions';
export interface ModuleInfo {
ModuleName: AdaptableModule;
FriendlyName: string;
Glyph: AdaptableSystemIconName;
Popup: string;
Description: string;
HelpPage: string;
}
export type TeamSharingReferences = TeamSharingReference[];
export type TeamSharingReference = {
Module: StrictExtract<AdaptableModule, 'CalculatedColumn' | 'FreeTextColumn' | 'NamedQuery' | 'Alert' | 'CustomSort' | 'FlashingCell' | 'FormatColumn' | 'PlusMinus' | 'Shortcut' | 'Schedule' | 'StyledColumn'>;
Reference: AdaptableObject;
};
export interface AdaptableObjectItemView {
/**
* Should match property in wizard.
* Used to Link to wizard edit step.
*/
name?: string;
/**
* Custom name for the property name
*/
label?: string | React.FunctionComponent<React.PropsWithChildren<{
data: AdaptableObject | SuspendableObject;
}>>;
/**
* True is the item label should be displayed in the same container as the value.
*/
isLabelInline?: boolean;
/**
* How the item is rendered.
* Defaults to tags.
* Important to be a component so react can detect if it is the same component.
*/
view?: React.FunctionComponent<React.PropsWithChildren<{
data: AdaptableObject | SuspendableObject;
module?: IModule;
}>> | React.ReactElement;
viewAfter?: React.FunctionComponent<React.PropsWithChildren<{
data: AdaptableObject | SuspendableObject;
module?: IModule;
}>> | React.ReactElement;
/**
* Values used for the component.
* Could be later extended to include an 'onChange' prop.
*/
values?: (string | number)[];
}
export interface AdaptableObjectView {
/**
* Represents a description row for each adaptable object property.
*/
items: AdaptableObjectItemView[];
/**
* Used to render expanded content
*/
expand?: React.FunctionComponent<React.PropsWithChildren<unknown>>;
/**
* Reference to the underling object.
*/
abObject: AdaptableObject;
/**
* Style added on the item wrapper.
*/
style?: CSSProperties;
/**
* ClassName added on the item wrapper.
*/
className?: string;
}
export interface AdaptableObjectCompactView {
item: AdaptableObjectItemView;
abObject: AdaptableObject;
}
export type AdaptableModuleViewAction = React.FunctionComponent<React.PropsWithChildren<{
data: AdaptableObject;
accessLevel: AccessLevel;
}>>;
export interface AdaptableModuleView {
/**
* List of actions.
* Allows to add custom actions.
*/
actions?: AdaptableModuleViewAction[];
onMount?: () => void;
HeaderComponent?: React.FunctionComponent;
onOpenEditPopup?: (abObject?: AdaptableObject) => void;
getDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
getCompactDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
getSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
getUnSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
getCompactSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
getCompactUnSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
getEditAction?: (abObject: AdaptableObject) => Redux.Action;
getSuspendAllAction?: () => Redux.Action;
getUnSuspendAllAction?: () => Redux.Action;
getDeleteAllAction?: () => Redux.Action;
emptyView?: React.FunctionComponent<React.PropsWithChildren<{
module: IModule;
}>> | string;
newTooltipText?: string;
hideNewButton?: boolean;
/**
* Specifieds the types of objects the module manages.
* When specified the new button will have these options.
* This is used for creating diffrent types of entites from the same module.
* E.g. Schedule
*/
abObjectTypes?: {
name: string;
label?: string;
accessLevel?: AccessLevel;
}[];
getEditWizard?(abObject?: AdaptableObject): React.FunctionComponent<React.PropsWithChildren<AdaptableOnePageWizardProps<AdaptableObject>>>;
/**
* Specify status panel props.
* Can be extended to include custom rendereres.
*/
getStatusBarPanelProps?(): StatusBarPanelProps;
}
/**
* This is the interface that all Moduless implement (as well as all deriving from AdaptableModulesBase).
* Each Module is responsible for creating popup and context menu items, providing an entitlement ( the default is 'Default') and initialising with Redux
* Most Modules map to their own Reducer (e.g. QuickSearchModules => QuickSearchReducer)
* However these Moduless DONT store any State:
* Application
* GridInfo
* StateManagement
* TeamSharing
*/
export interface IModule {
moduleInfo: ModuleInfo;
AccessLevel: AccessLevel;
createModuleMenuItem(source: 'ModuleMenu' | 'ModuleButton'): AdaptableMenuItem | undefined;
createColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem<AdaptableColumnMenuItemName>[] | undefined;
createContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem<AdaptableContextMenuItemName>[] | undefined;
setModuleEntitlement(): void;
isModuleAvailable(): boolean;
isModuleEditable(): boolean;
isModuleObjectsShareable(): boolean;
getTeamSharingAction(): TeamSharingImportInfo<AdaptableObject> | undefined;
getModuleAdaptableObjects(): AdaptableObject[];
getTeamSharingReferences(adaptableObject: AdaptableObject): TeamSharingReferences;
getModuleNamedQueryReferences(): string[];
getModuleCalculatedColumnReferences(): CalculatedColumn[];
getModuleFreeTextColumnReferences(): FreeTextColumn[];
getPopupMaxWidth(): number | undefined;
canBeAssociatedWithLayouts(): boolean;
/**
* The following view options are used to render adaptable objects and
* module general views.
*/
toView?: (abObject: AdaptableObject) => AdaptableObjectView;
toViewAll?: () => AdaptableObjectView[];
toViewCompact?: (abObject: AdaptableObject) => AdaptableObjectCompactView;
getViewProperties?: () => AdaptableModuleView;
}
/**
* A Wrapper around the Modules
*/
export interface IModuleCollection extends Map<AdaptableModule, IModule> {
}