UNPKG

eapp-amis-theme-editor

Version:

amis主题编辑器

175 lines (169 loc) 6.53 kB
/** * amis-theme-editor v2.0.11-beta.2 * Copyright 2018-2023 @fex */ 'use strict'; var React = require('react'); var amisCore = require('amis-core'); var tpl = require('../tpl.js'); var cx = require('classnames'); var index = require('./index.js'); var i18nRuntime = require('i18n-runtime'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx); var ThemeConditionBuilderCommon = 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["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", { className: "theme-component" }, React__default["default"].createElement("div", { className: "theme-component-title" }, title), React__default["default"].createElement("div", { className: cx__default["default"]('theme-component-content', 'theme-component-content-steps', activeId === edit.path && 'theme-component-content--active'), onClick: function () { handleEdit(); } }, refreshToken === edit.path ? null : body))); }; var ThemeConditionBuilder = function (props) { return { title: '条件组合 ConditionBuilder', body: [{ title: i18nRuntime.i18n("e1371d733ff347664655629011b4130f"), body: [{ title: i18nRuntime.i18n("e1371d733ff347664655629011b4130f"), body: function (onEdit) { return React__default["default"].createElement(ThemeConditionBuilderCommon, { activeId: props.activeId, onEdit: onEdit, title: "\u57FA\u7840\u6837\u5F0F", edit: { title: i18nRuntime.i18n("2f1448085b4bec952ffdb627d136cf78"), path: 'component.conditionBuilder.base.body', body: tpl.getSchemaTpl('collapseGroup', [{ title: '左侧工具', body: [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("c8339fd2a85af4ba66084d28df808de4"), body: [{ type: 'amis-theme-size-editor', name: 'toolbar-size', hideMinWidth: true, label: false }] }, { type: 'amis-theme-font-editor', label: false, title: i18nRuntime.i18n("ca746b1ff10193a3ce20878dec04a733"), hasSenior: false, hideLineHeight: true, hideFontFamily: true, name: 'toolbar-font' }, { type: 'amis-theme-font-editor', label: false, title: i18nRuntime.i18n("c0b513c835e841fbdbb0a117e8769161"), hasSenior: false, hideLineHeight: true, hideFontFamily: true, name: 'toolbar-hover-font' }, { type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"), body: [{ type: 'amis-theme-color-picker', label: i18nRuntime.i18n("22b777e6fcb613b8ba83ced9594cd07e"), labelMode: 'input', name: 'toolbar-bg-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("062d0b688adb10f3af5ebc2fd2667f1c"), labelMode: 'input', name: 'toolbar-hover-bg-color', options: '${colorOptions}' }] }, { type: 'amis-theme-wrapper', label: false, title: '竖线', body: [{ type: 'amis-theme-select', name: 'line-width', label: i18nRuntime.i18n("c28479019e24e0e4745f4948e9e97ee7"), options: '${sizesOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'line-bg-color', options: '${colorOptions}' }] }] }, { title: i18nRuntime.i18n("cd6f79e7bff1337c12c86a15ceedd6da"), body: [{ type: 'amis-theme-wrapper', label: false, title: false, body: [{ type: 'amis-theme-color-picker', label: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'body-bg-color', options: '${colorOptions}' }] }, { type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("841d77223f0ec8cd0b530ed8e0775b20"), body: [{ mode: 'default', type: 'amis-theme-padding-and-margin', name: 'body-padding-and-margin', hideMargin: true, source: '${sizesOptions}' }] }] }]) }, body: amisCore.render({ type: 'condition-builder', name: 'base', fields: [{ label: '文本', type: 'text', name: 'text' }, { label: i18nRuntime.i18n("55d4790c5d819cd0462cbe89561b0dd4"), type: 'number', name: 'number' }, { label: '布尔', type: 'boolean', name: 'boolean' }] }) }); } }] }] }; }; index.registerComponent('condition-builder', { type: 'data-entry', label: '条件组合', key: 'condition-builder', component: function () { return ThemeConditionBuilder; } });