UNPKG

amis-theme-editor

Version:

amis主题编辑器

91 lines (87 loc) 3.54 kB
/** * amis-theme-editor v2.0.22-beta.2 * Copyright 2018-2023 @fex */ import React__default from 'react'; import { render } from 'amis-core'; import '../icons/index.js'; import cx from 'classnames'; import { i18n } from 'i18n-runtime'; import { Icon } from 'amis'; var BaseContent = function (props) { var config = props.config, handleSetConfig = props.handleSetConfig; var editButton = function (config) { var EditButton = render({ type: 'button', level: 'link', label: i18n("95b351c86267f3aedf89520959bce689"), size: 'xs', tooltip: config.tooltip, tooltipPlacement: 'top', onClick: function () { handleSetConfig(config); } }); return EditButton; }; var colorEditButton = function (colorEditButton) { var EditButton = render(colorEditButton); return EditButton; }; var addButton = function (dialog) { var AddButton = render({ type: 'button', className: 'theme-icon', icon: React__default.createElement(Icon, { icon: "add-button", className: "theme-icon-svg" }), level: 'link', actionType: 'dialog', dialog: dialog }); return AddButton; }; return React__default.createElement("div", { className: cx('ThemeEditor-body-center', config.className) }, React__default.createElement("div", { className: "ThemeEditor-body-header" }, React__default.createElement("div", { className: "ThemeEditor-body-title" }, config.title), React__default.createElement("div", { className: "ThemeEditor-body-description" }, config.description)), React__default.createElement("div", { className: "ThemeEditor-body-content" }, config.body.map(function (item, i) { var _a, _b, _c, _d; return React__default.createElement("div", { className: "ThemeEditor-body-content-item", key: i }, React__default.createElement("div", { className: "ThemeEditor-body-content-item-title" }, item.title, item.subtitle, ((_a = item === null || item === void 0 ? void 0 : item.action) === null || _a === void 0 ? void 0 : _a.editButton) ? editButton(item.action.editButton) : null, ((_b = item === null || item === void 0 ? void 0 : item.action) === null || _b === void 0 ? void 0 : _b.colorEditButton) ? colorEditButton(item.action.colorEditButton) : null, ((_c = item === null || item === void 0 ? void 0 : item.action) === null || _c === void 0 ? void 0 : _c.configButton) ? item.action.configButton : null, ((_d = item === null || item === void 0 ? void 0 : item.action) === null || _d === void 0 ? void 0 : _d.addButton) ? addButton(item.action.addButton) : null), Array.isArray(item.body) ? item.body.map(function (ele, j) { return React__default.createElement("div", { className: cx('', { 'ThemeEditor-body-content-item-content': !(config === null || config === void 0 ? void 0 : config.emptyContentClass) }), key: j }, ele.body(function (config) { handleSetConfig(config); })); }) : React__default.createElement("div", { className: cx('', { 'ThemeEditor-body-content-item-content': !(config === null || config === void 0 ? void 0 : config.emptyContentClass) }) }, item.body(function (config) { handleSetConfig(config); }))); }))); }; var baseContent = function (config, handleSetConfig) { return React__default.createElement(BaseContent, { config: config, handleSetConfig: handleSetConfig }); }; export { baseContent as default };