react-json-schema-editor-antd
Version:
Json Schema Editor
62 lines • 2.08 kB
JavaScript
import { Button, Flex, Tooltip } from 'antd';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
import IconFont from "../../../../../components/IconFont";
var RefPropertyActions = function RefPropertyActions(props) {
var _useTranslation = useTranslation(),
t = _useTranslation.t;
var isUnLinkDataModelItems = props.isUnLinkDataModelItems,
linkRefProperty = props.linkRefProperty,
hiddenRefProperty = props.hiddenRefProperty,
namePath = props.namePath,
schema = props.schema,
isHidden = props.isHidden;
return /*#__PURE__*/React.createElement(Flex, {
gap: 4,
align: "center",
className: "ref-property-actions"
}, isUnLinkDataModelItems ? /*#__PURE__*/React.createElement(Tooltip, {
title: t('restore_link')
}, /*#__PURE__*/React.createElement(Button, {
className: "schema-btn-ref-link",
type: 'text',
size: 'small',
icon: /*#__PURE__*/React.createElement(IconFont, {
style: {
color: 'var(--color-primary,#1677ff)'
},
type: "icon-link"
}),
onClick: function onClick() {
if (linkRefProperty) {
linkRefProperty(namePath, schema, true);
}
}
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
onClick: function onClick() {
if (linkRefProperty) {
linkRefProperty(namePath, schema, false);
}
},
type: "primary",
icon: /*#__PURE__*/React.createElement(IconFont, {
type: "icon-disconnected"
}),
size: 'small'
}, t('un_link')), /*#__PURE__*/React.createElement(Button, {
onClick: function onClick() {
if (hiddenRefProperty) {
hiddenRefProperty(namePath, !isHidden);
}
},
type: "primary",
icon: /*#__PURE__*/React.createElement(IconFont, {
style: {
color: 'inherit'
},
type: isHidden ? 'icon-preview' : 'icon-not-show'
}),
size: 'small'
}, isHidden ? t('display_field') : t('hidden_field'))));
};
export default /*#__PURE__*/memo(RefPropertyActions);