UNPKG

eapp-amis-theme-editor

Version:

amis主题编辑器

261 lines (258 loc) 9.28 kB
/** * amis-theme-editor v2.0.11-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: '组合 Combo', body: [{ title: i18n("e1371d733ff347664655629011b4130f"), body: [{ title: i18n("18c63459a2c069022c7790430f761214"), body: function (onEdit) { return React__default.createElement(ThemeComboCommon, { activeId: props.activeId, onEdit: onEdit, title: "\u9ED8\u8BA4", 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: '边框悬浮', 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: '文本', type: 'input-text' }, { name: 'select', label: i18n("ea15ae2b7fba76c83eec6d0986d15197"), type: 'select', options: ['a', 'b', 'c'] }] }) }); } }, { title: '多选模式', body: function (onEdit) { return React__default.createElement(ThemeComboCommon, { activeId: props.activeId, refreshToken: props.refreshToken, onEdit: onEdit, title: "\u591A\u9009\u6A21\u5F0F", edit: { title: '多选模式配置', path: 'component.combo.multi.body', body: getSchemaTpl('collapseGroup', [{ title: '新增按钮', body: [{ type: 'amis-theme-wrapper', label: false, title: false, body: [{ type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'addBtn-bg-color', options: '${colorOptions}' }, { type: 'amis-theme-select', name: 'addBtn-height', label: i18n("c1df04eec5fa0857bc0df2d68d8e953c"), options: '${sizesOptions}' }] }, { type: 'amis-theme-font-editor', label: false, hasSenior: false, hideFontFamily: true, name: 'addBtn-font' }, { type: 'amis-theme-wrapper', label: false, title: i18n("0103eb2d3dca70270d1a74e9ec987ac9"), body: [{ mode: 'default', type: 'amis-theme-radius', disableBorder: true, name: 'addBtn-border' }] }, { type: 'amis-theme-wrapper', label: false, title: i18n("841d77223f0ec8cd0b530ed8e0775b20"), body: [{ mode: 'default', type: 'amis-theme-padding-and-margin', name: 'addBtn-padding-and-margin', source: '${sizesOptions}', hideMargin: true }] }, { type: 'amis-theme-wrapper', label: false, title: i18n("062d0b688adb10f3af5ebc2fd2667f1c"), body: [{ type: 'amis-theme-color-picker', label: i18n("ca746b1ff10193a3ce20878dec04a733"), labelMode: 'input', name: 'addBtn-hover-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'addBtn-hover-bg-color', options: '${colorOptions}' }] }, { type: 'amis-theme-wrapper', label: false, title: i18n("4363c17ebb346b646af55bd8c8075915"), body: [{ type: 'amis-theme-color-picker', label: i18n("ca746b1ff10193a3ce20878dec04a733"), labelMode: 'input', name: 'addBtn-active-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'addBtn-active-bg-color', options: '${colorOptions}' }] }] }, { 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: '文本', type: 'input-text' }, { name: 'select', label: i18n("ea15ae2b7fba76c83eec6d0986d15197"), type: 'select', options: ['a', 'b', 'c'] }] }) }); } }] }] }; }; registerComponent('combo', { type: 'data-entry', label: '组合', key: 'combo', component: function () { return ThemeCombo; } });