UNPKG

@finos/legend-studio

Version:
38 lines 2.96 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { observer } from 'mobx-react-lite'; import { BlankPanelContent, LockIcon } from '@finos/legend-art'; import { UnsupportedElementEditorState } from '../../../stores/editor-state/UnsupportedElementEditorState.js'; import { flowResult } from 'mobx'; import { useEditorStore } from '../EditorStoreProvider.js'; import { useApplicationStore } from '@finos/legend-application'; export const UnsupportedEditorPanel = observer((props) => { const { text, isReadOnly } = props; const editorStore = useEditorStore(); const applicationStore = useApplicationStore(); const handleTextModeClick = applicationStore.guardUnhandledError(() => flowResult(editorStore.toggleTextMode())); return (_jsx(BlankPanelContent, { children: _jsxs("div", { className: "unsupported-element-editor__main", children: [_jsx("div", { className: "unsupported-element-editor__summary", children: text }), !isReadOnly && (_jsx("button", { className: "btn--dark unsupported-element-editor__to-text-mode__btn", onClick: handleTextModeClick, children: "Edit in text mode" }))] }) })); }); // NOTE: this editor can be used for any element supported via text mode but no editor has been built export const UnsupportedElementEditor = observer(() => { const editorStore = useEditorStore(); const unsupportedElementEditorState = editorStore.getCurrentEditorState(UnsupportedElementEditorState); const element = unsupportedElementEditorState.element; const isReadOnly = unsupportedElementEditorState.isReadOnly; return (_jsx("div", { className: "unsupported-element-editor", children: _jsxs("div", { className: "panel", children: [_jsx("div", { className: "panel__header", children: _jsxs("div", { className: "panel__header__title", children: [isReadOnly && (_jsx("div", { className: "uml-element-editor__header__lock", children: _jsx(LockIcon, {}) })), _jsx("div", { className: "panel__header__title__label", children: "element" }), _jsx("div", { className: "panel__header__title__content", children: element.name })] }) }), _jsx("div", { className: "panel__content unsupported-element-editor__content", children: _jsx(UnsupportedEditorPanel, { text: `Can't display this element in form-mode`, isReadOnly: isReadOnly }) })] }) })); }); //# sourceMappingURL=UnsupportedElementEditor.js.map