UNPKG

amis-theme-editor

Version:

amis主题编辑器

181 lines (178 loc) 6.22 kB
/** * amis-theme-editor v2.0.22-beta.2 * Copyright 2018-2023 @fex */ import React__default from 'react'; import { render } from 'amis-core'; import { getSchemaTpl } from '../tpl.js'; import cx from 'classnames'; import { registerComponent } from './index.js'; import { i18n } from 'i18n-runtime'; var ThemeComboCommon = function (props) { var title = props.title, edit = props.edit, body = props.body, activeId = props.activeId, refreshToken = props.refreshToken; function handleEdit() { props.onEdit(edit); } return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", { className: "theme-component" }, React__default.createElement("div", { className: "theme-component-title" }, title), React__default.createElement("div", { className: cx('theme-component-content', 'theme-component-collapse-content', activeId === edit.path && 'theme-component-content--active'), onClick: function () { handleEdit(); } }, refreshToken === edit.path ? null : body))); }; var ThemeCombo = function (props) { return { title: i18n("bfc11572b8e9040c30a819a719b13dc0"), body: [{ title: i18n("e1371d733ff347664655629011b4130f"), body: [{ title: i18n("18c63459a2c069022c7790430f761214"), body: function (onEdit) { return React__default.createElement(ThemeComboCommon, { activeId: props.activeId, onEdit: onEdit, title: i18n("18c63459a2c069022c7790430f761214"), edit: { title: i18n("c51efb736b7b9d54241ab06fd71e68b4"), path: 'component.combo.base.body', body: getSchemaTpl('normal', [{ type: 'amis-theme-wrapper', label: false, title: false, body: [{ type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bg-color', options: '${colorOptions}' }] }, { type: 'amis-theme-wrapper', label: false, title: i18n("961534b4ea37e4e88aada736b299d063"), body: [{ mode: 'default', type: 'amis-theme-border', name: 'vertical-border' }] }, { type: 'amis-theme-wrapper', label: false, title: i18n("9fc1105215d759d88e70ac45bc7cfbe8"), body: [{ mode: 'default', type: 'amis-theme-border', name: 'vertical-hover-border' }] }, { type: 'amis-theme-wrapper', label: false, title: i18n("0103eb2d3dca70270d1a74e9ec987ac9"), body: [{ mode: 'default', type: 'amis-theme-radius', disableBorder: true, name: 'vertical-border' }] }, { type: 'amis-theme-wrapper', label: false, title: i18n("841d77223f0ec8cd0b530ed8e0775b20"), body: [{ mode: 'default', type: 'amis-theme-padding-and-margin', name: 'vertical-padding-and-margin', source: '${sizesOptions}', hideMargin: true }] }]) }, body: render({ type: 'combo', name: 'combo1', label: false, multiLine: true, items: [{ name: 'text', label: i18n("97d07614380da93d257f9fbf81aa56fb"), type: 'input-text' }, { name: 'select', label: i18n("ea15ae2b7fba76c83eec6d0986d15197"), type: 'select', options: ['a', 'b', 'c'] }] }) }); } }, { title: i18n("93dee976f68681ec6950380d757d8c18"), body: function (onEdit) { return React__default.createElement(ThemeComboCommon, { activeId: props.activeId, refreshToken: props.refreshToken, onEdit: onEdit, title: i18n("93dee976f68681ec6950380d757d8c18"), edit: { title: i18n("5f912a0a8e501c948fd42da54201d664"), path: 'component.combo.multi.body', body: getSchemaTpl('collapseGroup', [{ title: i18n("a3a36a013c7e5e647062a8467940b618"), body: [{ type: 'amis-theme-wrapper', label: false, title: false, body: [{ type: 'amis-theme-color-picker', label: i18n("6b36c6f7ec834692ec6c8e3816349fdd"), labelMode: 'input', name: 'delBtn-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18n("062d0b688adb10f3af5ebc2fd2667f1c"), labelMode: 'input', name: 'delBtn-hover-color', options: '${colorOptions}' }] }] }]) }, body: render({ type: 'combo', name: 'combo2', label: false, multiple: true, items: [{ name: 'text', label: i18n("97d07614380da93d257f9fbf81aa56fb"), type: 'input-text' }, { name: 'select', label: i18n("ea15ae2b7fba76c83eec6d0986d15197"), type: 'select', options: ['a', 'b', 'c'] }] }) }); } }] }] }; }; registerComponent('combo', { type: 'data-entry', label: i18n("254bb8aa6b92d588d957a383df24db1e"), key: 'combo', component: function () { return ThemeCombo; } });