UNPKG

eapp-amis-theme-editor

Version:

amis主题编辑器

324 lines (321 loc) 11.6 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 { ToastComponent, toast } from 'amis'; import { registerComponent } from './index.js'; import { i18n } from 'i18n-runtime'; var ThemeToastCommon = function (props) { var title = props.title, edit = props.edit, body = props.body, activeId = props.activeId; 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-content-steps', activeId === edit.path && 'theme-component-content--active'), onClick: function () { handleEdit(); } }, body))); }; var ThemeToast = function (props) { return { title: '轻提示 Toast', body: [{ title: i18n("e1371d733ff347664655629011b4130f"), body: [{ title: i18n("e1371d733ff347664655629011b4130f"), body: function (onEdit) { return React__default.createElement(ThemeToastCommon, { activeId: props.activeId, onEdit: onEdit, title: "\u57FA\u7840\u6837\u5F0F", edit: { title: i18n("2f1448085b4bec952ffdb627d136cf78"), path: 'component.toast.base.body', body: getSchemaTpl('collapseGroup', [{ title: i18n("4092ed98e9035652d4c9ca9441701ed7"), body: [{ type: 'amis-theme-wrapper', label: false, title: 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: i18n("0103eb2d3dca70270d1a74e9ec987ac9"), body: [{ mode: 'default', type: 'amis-theme-radius', disableBorder: true, name: 'border' }] }] }, { title: i18n("37ae4f181d4f139be90fb80cae3fc493"), body: [{ type: 'amis-theme-wrapper', label: false, title: i18n("c8339fd2a85af4ba66084d28df808de4"), body: [{ type: 'amis-theme-select', name: 'icon-size', label: false, options: '${sizesOptions}' }] }] }]) }, body: render({ type: 'page', body: [React__default.createElement(ToastComponent, null), { label: i18n("02d9819ddaaaeb1b7b22b12608c7e5ca"), type: 'button', onClick: function () { toast.success('这是个提示', { closeButton: true }); } }] }) }); } }] }, { title: '不同类型的消息提示', body: [{ title: i18n("e1371d733ff347664655629011b4130f"), body: function (onEdit) { return React__default.createElement(ThemeToastCommon, { activeId: props.activeId, onEdit: onEdit, title: "\u666E\u901A\u6D88\u606F\u63D0\u793A", edit: { title: i18n("2f1448085b4bec952ffdb627d136cf78"), path: 'component.toast.info.body', body: getSchemaTpl('collapseGroup', [{ title: i18n("4092ed98e9035652d4c9ca9441701ed7"), body: [{ type: 'amis-theme-font-editor', label: false, title: i18n("f345f09f14a525226197090b86d769b3"), hasSenior: false, hideLineHeight: true, hideFontFamily: true, name: 'font' }, { type: 'amis-theme-wrapper', label: false, title: i18n("961534b4ea37e4e88aada736b299d063"), body: [{ mode: 'default', type: 'amis-theme-border', name: 'border' }] }, { type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bgColor', options: '${colorOptions}' }] }]) }, body: render({ type: 'page', body: [React__default.createElement(ToastComponent, null), { label: i18n("02d9819ddaaaeb1b7b22b12608c7e5ca"), type: 'button', onClick: function () { toast.info('这是个提示', { closeButton: true }); } }] }) }); } }, { title: i18n("e1371d733ff347664655629011b4130f"), body: function (onEdit) { return React__default.createElement(ThemeToastCommon, { activeId: props.activeId, onEdit: onEdit, title: "\u6210\u529F\u6D88\u606F\u63D0\u793A", edit: { title: i18n("2f1448085b4bec952ffdb627d136cf78"), path: 'component.toast.success.body', body: getSchemaTpl('collapseGroup', [{ title: i18n("4092ed98e9035652d4c9ca9441701ed7"), body: [{ type: 'amis-theme-font-editor', label: false, title: i18n("f345f09f14a525226197090b86d769b3"), hasSenior: false, hideLineHeight: true, hideFontFamily: true, name: 'font' }, { type: 'amis-theme-wrapper', label: false, title: i18n("961534b4ea37e4e88aada736b299d063"), body: [{ mode: 'default', type: 'amis-theme-border', name: 'border' }] }, { type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bgColor', options: '${colorOptions}' }] }]) }, body: render({ type: 'page', body: [React__default.createElement(ToastComponent, null), { label: i18n("02d9819ddaaaeb1b7b22b12608c7e5ca"), type: 'button', onClick: function () { toast.success('这是个提示', { closeButton: true }); } }] }) }); } }, { title: i18n("e1371d733ff347664655629011b4130f"), body: function (onEdit) { return React__default.createElement(ThemeToastCommon, { activeId: props.activeId, onEdit: onEdit, title: "\u9519\u8BEF\u6D88\u606F\u63D0\u793A", edit: { title: i18n("2f1448085b4bec952ffdb627d136cf78"), path: 'component.toast.danger.body', body: getSchemaTpl('collapseGroup', [{ title: i18n("4092ed98e9035652d4c9ca9441701ed7"), body: [{ type: 'amis-theme-font-editor', label: false, title: i18n("f345f09f14a525226197090b86d769b3"), hasSenior: false, hideLineHeight: true, hideFontFamily: true, name: 'font' }, { type: 'amis-theme-wrapper', label: false, title: i18n("961534b4ea37e4e88aada736b299d063"), body: [{ mode: 'default', type: 'amis-theme-border', name: 'border' }] }, { type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bgColor', options: '${colorOptions}' }] }]) }, body: render({ type: 'page', body: [React__default.createElement(ToastComponent, null), { label: i18n("02d9819ddaaaeb1b7b22b12608c7e5ca"), type: 'button', onClick: function () { toast.error('这是个提示', { closeButton: true }); } }] }) }); } }, { title: i18n("e1371d733ff347664655629011b4130f"), body: function (onEdit) { return React__default.createElement(ThemeToastCommon, { activeId: props.activeId, onEdit: onEdit, title: "\u8B66\u544A\u6D88\u606F\u63D0\u793A", edit: { title: i18n("2f1448085b4bec952ffdb627d136cf78"), path: 'component.toast.warning.body', body: getSchemaTpl('collapseGroup', [{ title: i18n("4092ed98e9035652d4c9ca9441701ed7"), body: [{ type: 'amis-theme-font-editor', label: false, title: i18n("f345f09f14a525226197090b86d769b3"), hasSenior: false, hideLineHeight: true, hideFontFamily: true, name: 'font' }, { type: 'amis-theme-wrapper', label: false, title: i18n("961534b4ea37e4e88aada736b299d063"), body: [{ mode: 'default', type: 'amis-theme-border', name: 'border' }] }, { type: 'amis-theme-color-picker', label: i18n("8e1b944f4389bdaab6f11d5bc83190c8"), labelMode: 'input', name: 'bgColor', options: '${colorOptions}' }] }]) }, body: render({ type: 'page', body: [React__default.createElement(ToastComponent, null), { label: i18n("02d9819ddaaaeb1b7b22b12608c7e5ca"), type: 'button', onClick: function () { toast.warning('这是个提示', { closeButton: true }); } }] }) }); } }] }] }; }; registerComponent('toast', { type: 'feedback', label: '轻提示', key: 'toast', component: function () { return ThemeToast; } });