import React from 'react' import {$do, connect, useWidgetOperations} from '@tesler-ui/core' import {Dispatch} from 'redux' import {Operation, OperationGroup} from '@tesler-ui/core/interfaces/operation' import {WidgetMeta} from '@tesler-ui/core/interfaces/widget' import {Button, Dropdown, Icon, Menu} from 'antd' import { AppState } from '../../interfaces/storeSlices' import styles from './Operations.module.css' import cn from 'classnames' export interface OperationsOwnProps { bcName: string, widgetMeta: WidgetMeta, operations: Array, hiddenGroups?: string[], formStyle?: boolean, screenName?: string, } export interface OperationsProps extends OperationsOwnProps { metaInProgress: boolean, onClick: (bcName: string, operationType: string, widgetName: string) => void, } export function Operations(props: OperationsProps) { const operations = useWidgetOperations(props.operations, props.widgetMeta) .filter(item => item.type !== 'file-upload-save') const removeRecordOperation = props.widgetMeta.type === 'List' return
{(props.metaInProgress) ? return group.actions.length ? element.parentElement as HTMLElement} > {trigger} : trigger } const ungroupedOperation = (item as Operation) return (removeRecordOperation && ungroupedOperation.scope === 'record') ? null : }) }
} function mapStateToProps(store: AppState, ownProps: OperationsOwnProps) { return { metaInProgress: !!store.view.metaInProgress[ownProps.bcName], screenName: store.screen.screenName, } } function mapDispatchToProps(dispatch: Dispatch) { return { onClick: (bcName: string, operationType: string, widgetName: string) => { dispatch($do.sendOperation({ bcName, operationType, widgetName })) } } } export default connect(mapStateToProps, mapDispatchToProps)(Operations)