@xrenders/xflow
Version:
一款功能强大、易用灵活的流程编辑器框架,帮助你轻松构建复杂的工作流和流程产品
41 lines • 2.13 kB
JavaScript
import React, { memo, useContext } from 'react';
// import UndoRedo from '../header/undo-redo'
import Control from './Control';
import UndoRedo from './UndoRedo';
import ZoomInOut from './ZoomInOut';
import { useTemporalStore } from '../hooks/useTemporalStore';
import { ConfigContext } from '../models/context';
import "./index.css";
var Operator = function Operator(_ref) {
var addNode = _ref.addNode,
xflowRef = _ref.xflowRef;
var _a, _b, _c, _d, _e, _f;
var _useTemporalStore = useTemporalStore(),
undo = _useTemporalStore.undo,
redo = _useTemporalStore.redo,
pastStates = _useTemporalStore.pastStates,
futureStates = _useTemporalStore.futureStates;
var _useContext = useContext(ConfigContext),
globalConfig = _useContext.globalConfig;
var hideUndoRedoBtns = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.controls) === null || _a === void 0 ? void 0 : _a.hideUndoRedoBtns) !== null && _b !== void 0 ? _b : false;
var hideZoomInOutBtns = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.controls) === null || _c === void 0 ? void 0 : _c.hideZoomInOutBtns) !== null && _d !== void 0 ? _d : false;
var hideControlBtns = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.controls) === null || _e === void 0 ? void 0 : _e.hideControlBtns) !== null && _f !== void 0 ? _f : false;
return /*#__PURE__*/React.createElement("div", {
className: "fai-reactflow-operator"
}, /*#__PURE__*/React.createElement("div", {
className: "operator-section"
}, !Boolean(hideZoomInOutBtns) && /*#__PURE__*/React.createElement(ZoomInOut, null), !Boolean(hideUndoRedoBtns) && (/*#__PURE__*/React.createElement(UndoRedo, {
handleUndo: function handleUndo() {
return undo();
},
handleRedo: function handleRedo() {
return redo();
},
pastStates: pastStates,
futureStates: futureStates
})), !Boolean(hideControlBtns) && /*#__PURE__*/React.createElement(Control, {
addNode: addNode,
xflowRef: xflowRef
})));
};
export default /*#__PURE__*/memo(Operator);