UNPKG

amis-theme-editor

Version:

amis主题编辑器

413 lines (407 loc) 16.3 kB
/** * amis-theme-editor v2.0.22-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 ThemeAlertCommon = function (props) { var title = props.title, edit = props.edit, body = props.body, activeId = props.activeId; 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-collapse-content', activeId === edit.path && 'theme-component-content--active'), style: { display: 'flex' }, onClick: function () { handleEdit(); } }, body))); }; var ThemeAlert = function (props) { return { title: i18nRuntime.i18n("de9ab361daa6ad98a25275abfb43ce82"), body: [{ title: i18nRuntime.i18n("e1371d733ff347664655629011b4130f"), body: [{ title: i18nRuntime.i18n("18c63459a2c069022c7790430f761214"), body: function (onEdit) { return React__default["default"].createElement(ThemeAlertCommon, { activeId: props.activeId, onEdit: onEdit, title: i18nRuntime.i18n("18c63459a2c069022c7790430f761214"), edit: { title: i18nRuntime.i18n("c51efb736b7b9d54241ab06fd71e68b4"), path: 'component.alert.base.body', body: tpl.getSchemaTpl('collapseGroup', [{ title: i18nRuntime.i18n("4092ed98e9035652d4c9ca9441701ed7"), body: [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("e8ed49e9fde0bb778e2185876c2d2697"), body: [{ mode: 'default', type: 'amis-theme-padding-and-margin', name: 'padding-and-margin', hideMargin: true, source: '${sizesOptions}' }] }, { type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("0103eb2d3dca70270d1a74e9ec987ac9"), body: [{ mode: 'default', type: 'amis-theme-radius', disableBorder: true, name: 'border' }] }, { type: 'amis-theme-font-editor', label: false, hasSenior: false, hideColor: true, hideLineHeight: true, hideFontFamily: true, name: 'font' }, { type: 'amis-theme-shadow-editor', name: 'shadow', label: false, hasSenior: false }] }, { title: i18nRuntime.i18n("2f1ef751e729716cf08735cbbf745479"), body: [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("e8ed49e9fde0bb778e2185876c2d2697"), body: [{ mode: 'default', type: 'amis-theme-padding-and-margin', name: 'title-padding-and-margin', hideMargin: true, source: '${sizesOptions}' }] }, { type: 'amis-theme-font-editor', label: false, hasSenior: false, hideLineHeight: true, hideFontFamily: true, name: 'title-font', title: i18nRuntime.i18n("eded9ed93a453c3f790126e30b776a22") }, { type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("abc9f7586d510eda0f71bab744c02132"), body: [{ type: 'amis-theme-select', name: 'title-margin-bottom', label: i18nRuntime.i18n("3ec2bba02a859a90b023ee793a2381d5"), extraUnit: ['px'], options: '${sizesOptions}' }] }] }]) }, body: React__default["default"].createElement("div", { style: { width: '750px' } }, amisCore.render({ type: 'alert', body: i18nRuntime.i18n("6f2b01db04cbf7e460b5c6f4e37a5e76") }), amisCore.render({ type: 'alert', title: i18nRuntime.i18n("dc19704991f1476fa4dcbb80c50bedd6"), body: i18nRuntime.i18n("6f2b01db04cbf7e460b5c6f4e37a5e76") })) }); } }, { title: i18nRuntime.i18n("5ef69f62dc668c1a3e68b51c50a2530a"), body: function (onEdit) { return React__default["default"].createElement(ThemeAlertCommon, { activeId: props.activeId, onEdit: onEdit, title: i18nRuntime.i18n("5ef69f62dc668c1a3e68b51c50a2530a"), edit: { title: i18nRuntime.i18n("774b2bcaca8a64f46c84b510cec89109"), path: 'component.alert.icon.body', body: tpl.getSchemaTpl('normal', [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("5ef69f62dc668c1a3e68b51c50a2530a"), body: [{ type: 'amis-theme-select', name: 'size', label: i18nRuntime.i18n("58f966670529f4753fb3c5a0647606be"), options: '${sizesOptions}' }, { type: 'amis-theme-select', name: 'margin-right', label: i18nRuntime.i18n("31e3752986d64c8b36897c8641c8628d"), options: '${sizesOptions}' }] }]) }, body: React__default["default"].createElement("div", { style: { width: '750px' } }, amisCore.render({ type: 'alert', body: i18nRuntime.i18n("6f2b01db04cbf7e460b5c6f4e37a5e76"), showIcon: true }), amisCore.render({ type: 'alert', title: i18nRuntime.i18n("dc19704991f1476fa4dcbb80c50bedd6"), body: i18nRuntime.i18n("6f2b01db04cbf7e460b5c6f4e37a5e76"), showIcon: true })) }); } }] }, { title: i18nRuntime.i18n("226b0912184333c81babf2f1894ec0c1"), body: [{ title: i18nRuntime.i18n("816092589b5295a35df51ad6ae320bbb"), body: function (onEdit) { return React__default["default"].createElement(ThemeAlertCommon, { activeId: props.activeId, onEdit: onEdit, title: i18nRuntime.i18n("816092589b5295a35df51ad6ae320bbb"), edit: { title: i18nRuntime.i18n("adc3746ea8c20dcaf4c5c99bf9c33e4c"), path: 'component.alert.level.info.body', body: tpl.getSchemaTpl('normal', [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("6b36c6f7ec834692ec6c8e3816349fdd"), body: [{ type: 'amis-theme-color-picker', label: i18nRuntime.i18n("ca746b1ff10193a3ce20878dec04a733"), labelMode: 'input', name: 'color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bg-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("5ef69f62dc668c1a3e68b51c50a2530a"), labelMode: 'input', name: 'icon-color', options: '${colorOptions}' }] }]) }, body: React__default["default"].createElement("div", { style: { width: '750px' } }, amisCore.render({ type: 'alert', body: i18nRuntime.i18n("6f2b01db04cbf7e460b5c6f4e37a5e76"), showIcon: true, level: 'info' }), amisCore.render({ type: 'alert', title: i18nRuntime.i18n("dc19704991f1476fa4dcbb80c50bedd6"), body: i18nRuntime.i18n("6f2b01db04cbf7e460b5c6f4e37a5e76"), showIcon: true, level: 'info' })) }); } }, { title: i18nRuntime.i18n("db192abe6a437b8112323ffa69e4f755"), body: function (onEdit) { return React__default["default"].createElement(ThemeAlertCommon, { activeId: props.activeId, onEdit: onEdit, title: i18nRuntime.i18n("db192abe6a437b8112323ffa69e4f755"), edit: { title: i18nRuntime.i18n("29886af7b705d873e5dc6c9581e18421"), path: 'component.alert.level.success.body', body: tpl.getSchemaTpl('normal', [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("6b36c6f7ec834692ec6c8e3816349fdd"), body: [{ type: 'amis-theme-color-picker', label: i18nRuntime.i18n("ca746b1ff10193a3ce20878dec04a733"), labelMode: 'input', name: 'color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bg-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("5ef69f62dc668c1a3e68b51c50a2530a"), labelMode: 'input', name: 'icon-color', options: '${colorOptions}' }] }]) }, body: React__default["default"].createElement("div", { style: { width: '750px' } }, amisCore.render({ type: 'alert', body: i18nRuntime.i18n("1355fe575eb18dba13fe01d56982f6e9"), showIcon: true, level: 'success' }), amisCore.render({ type: 'alert', title: i18nRuntime.i18n("8e7f1838341541a554672e5edb570397"), body: i18nRuntime.i18n("1355fe575eb18dba13fe01d56982f6e9"), showIcon: true, level: 'success' })) }); } }, { title: i18nRuntime.i18n("ba158c0d9039a3b64335dd90885a2874"), body: function (onEdit) { return React__default["default"].createElement(ThemeAlertCommon, { activeId: props.activeId, onEdit: onEdit, title: i18nRuntime.i18n("ba158c0d9039a3b64335dd90885a2874"), edit: { title: i18nRuntime.i18n("f3febbf03c21f90fcaaefdeeb43cccc6"), path: 'component.alert.level.warning.body', body: tpl.getSchemaTpl('normal', [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("6b36c6f7ec834692ec6c8e3816349fdd"), body: [{ type: 'amis-theme-color-picker', label: i18nRuntime.i18n("ca746b1ff10193a3ce20878dec04a733"), labelMode: 'input', name: 'color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bg-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("5ef69f62dc668c1a3e68b51c50a2530a"), labelMode: 'input', name: 'icon-color', options: '${colorOptions}' }] }]) }, body: React__default["default"].createElement("div", { style: { width: '750px' } }, amisCore.render({ type: 'alert', body: i18nRuntime.i18n("10cdf98bfecd1a891288c375fcd6e1fe"), showIcon: true, level: 'warning' }), amisCore.render({ type: 'alert', title: i18nRuntime.i18n("efd0e8d635968ee53e9dcc6840c5a132"), body: i18nRuntime.i18n("10cdf98bfecd1a891288c375fcd6e1fe"), showIcon: true, level: 'warning' })) }); } }, { title: i18nRuntime.i18n("bbc4ff0ef76fe3519e8bc205f18f8862"), body: function (onEdit) { return React__default["default"].createElement(ThemeAlertCommon, { activeId: props.activeId, onEdit: onEdit, title: i18nRuntime.i18n("bbc4ff0ef76fe3519e8bc205f18f8862"), edit: { title: i18nRuntime.i18n("a1b4ced0e723cb2e044798ffbb266340"), path: 'component.alert.level.danger.body', body: tpl.getSchemaTpl('normal', [{ type: 'amis-theme-wrapper', label: false, title: i18nRuntime.i18n("6b36c6f7ec834692ec6c8e3816349fdd"), body: [{ type: 'amis-theme-color-picker', label: i18nRuntime.i18n("ca746b1ff10193a3ce20878dec04a733"), labelMode: 'input', name: 'color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bg-color', options: '${colorOptions}' }, { type: 'amis-theme-color-picker', label: i18nRuntime.i18n("5ef69f62dc668c1a3e68b51c50a2530a"), labelMode: 'input', name: 'icon-color', options: '${colorOptions}' }] }]) }, body: React__default["default"].createElement("div", { style: { width: '750px' } }, amisCore.render({ type: 'alert', body: i18nRuntime.i18n("6b907b3ff77c788b7455851ef9dee2d8"), showIcon: true, level: 'danger' }), amisCore.render({ type: 'alert', title: i18nRuntime.i18n("476ef8a2a97f93123c4c17ca3b2e14b4"), body: i18nRuntime.i18n("6b907b3ff77c788b7455851ef9dee2d8"), showIcon: true, level: 'danger' })) }); } }] }] }; }; index.registerComponent('alert', { type: 'feedback', label: i18nRuntime.i18n("02d9819ddaaaeb1b7b22b12608c7e5ca"), key: 'alert', component: function () { return ThemeAlert; } });