amis-theme-editor
Version:
amis主题编辑器
520 lines (514 loc) • 16.9 kB
JavaScript
/**
* amis-theme-editor v2.0.22-beta.2
* Copyright 2018-2023 @fex
*/
'use strict';
var React = require('react');
var amisCore = require('amis-core');
var index = require('./index.js');
var cx = require('classnames');
var tpl = require('../tpl.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 ThemeTransferCommon = 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-transfer', activeId === edit.path && 'theme-component-content--active'),
onClick: function () {
handleEdit();
}
}, refreshToken === edit.path ? null : body)));
};
var transferBaseEdit = {
title: i18nRuntime.i18n("b6453aea1848b65a9a76cccca94715ec"),
path: 'component.transfer1.base.body',
body: tpl.getSchemaTpl('collapseGroup', [{
title: i18nRuntime.i18n("030c8cb75e9707285b28c4931bfeddc5"),
body: [{
type: 'amis-theme-font-editor',
label: false,
hasSenior: false,
hideFontFamily: true,
name: 'title-font'
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("8e1b944f4389bdaab6f11d5bc83190c8"),
body: [{
type: 'amis-theme-color-picker',
label: i18nRuntime.i18n("6b36c6f7ec834692ec6c8e3816349fdd"),
labelMode: 'input',
name: 'title-bg',
options: '${colorOptions}'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("0944fb3e88fb7d76f63022d6f0d20f5e"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'header-padding-and-margin',
hideMargin: true
}]
}]
}, {
title: i18nRuntime.i18n("132a78bdf68d6d17bde00aa807bbf032"),
body: [{
type: 'amis-theme-font-editor',
label: false,
hasSenior: false,
hideFontFamily: true,
name: 'content-font'
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("726c627e165f3b0d7b593be23ccc7045"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'body-padding-and-margin',
hideMargin: true
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("1ef2788efa657b7e203a477711c8ff2e"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'option-padding-and-margin'
}]
}]
}, {
title: i18nRuntime.i18n("0d98c74797e49d00bcc4c17c9d557a2b"),
body: [{
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("961534b4ea37e4e88aada736b299d063"),
body: [{
mode: 'default',
type: 'amis-theme-border',
name: 'border'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("0103eb2d3dca70270d1a74e9ec987ac9"),
body: [{
mode: 'default',
type: 'amis-theme-radius',
name: 'border'
}]
}, {
type: 'amis-theme-shadow-editor',
name: 'shadow',
label: false,
hasSenior: false
}]
}])
};
var transferSearchEdit = {
title: i18nRuntime.i18n("c3e817974de836e80c95cc6ce5718eff"),
path: 'component.transfer1.search.body',
body: tpl.getSchemaTpl('normal', [{
type: 'amis-theme-font-editor',
label: false,
hasSenior: false,
hideFontFamily: true,
name: 'font'
}, {
type: 'amis-theme-wrapper',
label: false,
title: false,
body: [{
type: 'amis-theme-color-picker',
label: i18nRuntime.i18n("9b14c9051067bef2dd9a15683201dd18"),
labelMode: 'input',
name: 'placeholder-font-color',
options: '${colorOptions}'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("961534b4ea37e4e88aada736b299d063"),
body: [{
mode: 'default',
type: 'amis-theme-border',
name: 'border'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: false,
body: [{
type: 'amis-theme-color-picker',
label: i18nRuntime.i18n("9fc1105215d759d88e70ac45bc7cfbe8"),
labelMode: 'input',
name: 'border-hover-color',
options: '${colorOptions}'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: false,
body: [{
type: 'amis-theme-color-picker',
label: i18nRuntime.i18n("34fec318e4dafe2381b500ce680693dd"),
labelMode: 'input',
name: 'border-active-color',
options: '${colorOptions}'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("0103eb2d3dca70270d1a74e9ec987ac9"),
body: [{
mode: 'default',
type: 'amis-theme-radius',
name: 'border'
}]
}, {
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
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("7ffe332f455aaf2ff90f588da624bc67"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'input-padding-and-margin',
hideMargin: true
}]
}, {
type: 'amis-theme-shadow-editor',
name: 'shadow',
label: false,
hasSenior: false
}])
};
var transferGroupEdit = {
title: i18nRuntime.i18n("829abe5a8dcd0579a340d20636b59276"),
path: 'component.transfer1.group.body',
body: tpl.getSchemaTpl('normal', [{
type: 'amis-theme-font-editor',
label: false,
title: i18nRuntime.i18n("35944c2aca6853bfa9f9cf58e4f52071"),
hasSenior: false,
hideFontFamily: true,
name: 'font'
}])
};
var transferTableEdit = {
title: i18nRuntime.i18n("d58ba4b5e94680fcb08300e176502fb8"),
path: 'component.transfer1.table.body',
body: tpl.getSchemaTpl('normal', [{
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("341c4671a75e4b5ebf7b78e811ecf7bd"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'header-padding-and-margin',
hideMargin: true
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("531436df7353051ba62b33d52458c9f6"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'option-padding-and-margin',
hideMargin: true
}, {
type: 'amis-theme-select',
name: 'last-paddingRight',
label: i18nRuntime.i18n("a74700f0b7c1025e1c3b9a305121967f"),
options: '${sizesOptions}'
}]
}])
};
var transferTreeEdit = {
title: i18nRuntime.i18n("5a650643929151fbb27bae1dad436b9a"),
path: 'component.transfer1.tree.body',
body: tpl.getSchemaTpl('normal', [{
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("38fd93ebb74fd6c8e464550def36952b"),
body: [{
type: 'amis-theme-color-picker',
label: i18nRuntime.i18n("062d0b688adb10f3af5ebc2fd2667f1c"),
labelMode: 'input',
name: 'bg-hover-color',
options: '${colorOptions}'
}, {
type: 'amis-theme-color-picker',
label: i18nRuntime.i18n("fad7c8a21fe3d7b3eb1db3d8a3212503"),
labelMode: 'input',
name: 'bg-active-color',
options: '${colorOptions}'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("0103eb2d3dca70270d1a74e9ec987ac9"),
body: [{
mode: 'default',
type: 'amis-theme-radius',
name: 'border'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("e8ed49e9fde0bb778e2185876c2d2697"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'padding-and-margin'
}]
}, {
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("2f01247ddd9c425f1bad555a9a8b062e"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'option-padding-and-margin'
}]
}])
};
var transferChainedEdit = {
title: i18nRuntime.i18n("d2fedacfc0f313fcc5d0a24d4d6d81db"),
path: 'component.transfer1.chained.body',
body: tpl.getSchemaTpl('normal', [{
type: 'amis-theme-wrapper',
label: false,
title: i18nRuntime.i18n("e8ed49e9fde0bb778e2185876c2d2697"),
body: [{
mode: 'default',
type: 'amis-theme-padding-and-margin',
name: 'padding-and-margin'
}]
}])
};
var ThemeTransfer = function (props) {
return {
title: i18nRuntime.i18n("255da7aa3f139351703714476d427cb5"),
body: [{
title: i18nRuntime.i18n("0aeca07a02601a8e701a46d1a8b5ce43"),
body: function (onEdit) {
return React__default["default"].createElement(ThemeTransferCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: i18nRuntime.i18n("18c63459a2c069022c7790430f761214"),
edit: transferBaseEdit,
body: React__default["default"].createElement("div", null, amisCore.render({
type: 'transfer',
label: '',
name: 'transfer1',
options: [{
label: i18nRuntime.i18n("04903192ff663cd0069ed6cd284d33ce"),
value: 'test1'
}, {
label: i18nRuntime.i18n("67763f8a91ba5cbb4cdf9b5758ea14a3"),
value: 'test2'
}, {
label: i18nRuntime.i18n("716b1ad4cb45e166cc9f1e283f7026b9"),
value: 'test3'
}]
}))
});
}
}, {
title: i18nRuntime.i18n("d1445892f0486effddf33eb81e68daae"),
body: [{
title: i18nRuntime.i18n("c3e817974de836e80c95cc6ce5718eff"),
body: function (onEdit) {
return React__default["default"].createElement(ThemeTransferCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: i18nRuntime.i18n("29f92d09e59e0d30d5e61ecd375ec586"),
edit: transferSearchEdit,
body: React__default["default"].createElement("div", null, amisCore.render({
type: 'transfer',
label: '',
name: 'transfer2',
searchable: true,
resultSearchable: true,
options: [{
label: i18nRuntime.i18n("04903192ff663cd0069ed6cd284d33ce"),
value: 'test1'
}, {
label: i18nRuntime.i18n("67763f8a91ba5cbb4cdf9b5758ea14a3"),
value: 'test2'
}, {
label: i18nRuntime.i18n("716b1ad4cb45e166cc9f1e283f7026b9"),
value: 'test3'
}]
}))
});
}
}, {
title: i18nRuntime.i18n("829abe5a8dcd0579a340d20636b59276"),
body: function (onEdit) {
return React__default["default"].createElement(ThemeTransferCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: i18nRuntime.i18n("829abe5a8dcd0579a340d20636b59276"),
edit: transferGroupEdit,
body: React__default["default"].createElement("div", null, amisCore.render({
type: 'transfer',
label: '',
name: 'transfer3',
options: [{
label: i18nRuntime.i18n("365a28f752cf3ab62be9ccc8db0d9b16"),
children: [{
label: i18nRuntime.i18n("04903192ff663cd0069ed6cd284d33ce"),
value: 'test1'
}, {
label: i18nRuntime.i18n("67763f8a91ba5cbb4cdf9b5758ea14a3"),
value: 'test2'
}]
}, {
label: i18nRuntime.i18n("52b79e6e219197901dfbd50b41c2cf1b"),
children: [{
label: i18nRuntime.i18n("716b1ad4cb45e166cc9f1e283f7026b9"),
value: 'test3'
}]
}]
}))
});
}
}, {
title: i18nRuntime.i18n("d58ba4b5e94680fcb08300e176502fb8"),
body: function (onEdit) {
return React__default["default"].createElement(ThemeTransferCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: i18nRuntime.i18n("d58ba4b5e94680fcb08300e176502fb8"),
edit: transferTableEdit,
body: React__default["default"].createElement("div", null, amisCore.render({
type: 'transfer',
label: '',
name: 'transfer4',
selectMode: 'table',
resultListModeFollowSelect: true,
columns: [{
name: 'label',
label: i18nRuntime.i18n("d7ec2d3fea4756bc1642e0f10c180cf5")
}, {
name: 'value',
label: i18nRuntime.i18n("fe7509e0ed085b86f07e3e9975cc5b3d")
}],
options: [{
label: i18nRuntime.i18n("04903192ff663cd0069ed6cd284d33ce"),
value: 'test1'
}, {
label: i18nRuntime.i18n("67763f8a91ba5cbb4cdf9b5758ea14a3"),
value: 'test2'
}, {
label: i18nRuntime.i18n("716b1ad4cb45e166cc9f1e283f7026b9"),
value: 'test3'
}]
}))
});
}
}, {
title: i18nRuntime.i18n("5a650643929151fbb27bae1dad436b9a"),
body: function (onEdit) {
return React__default["default"].createElement(ThemeTransferCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: i18nRuntime.i18n("5a650643929151fbb27bae1dad436b9a"),
edit: transferTreeEdit,
body: React__default["default"].createElement("div", null, amisCore.render({
type: 'transfer',
label: '',
name: 'transfer5',
selectMode: 'tree',
resultListModeFollowSelect: true,
options: [{
label: i18nRuntime.i18n("365a28f752cf3ab62be9ccc8db0d9b16"),
children: [{
label: i18nRuntime.i18n("04903192ff663cd0069ed6cd284d33ce"),
value: 'test1'
}, {
label: i18nRuntime.i18n("67763f8a91ba5cbb4cdf9b5758ea14a3"),
value: 'test2'
}]
}, {
label: i18nRuntime.i18n("52b79e6e219197901dfbd50b41c2cf1b"),
children: [{
label: i18nRuntime.i18n("716b1ad4cb45e166cc9f1e283f7026b9"),
value: 'test3'
}]
}]
}))
});
}
}, {
title: i18nRuntime.i18n("d2fedacfc0f313fcc5d0a24d4d6d81db"),
body: function (onEdit) {
return React__default["default"].createElement(ThemeTransferCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: i18nRuntime.i18n("d2fedacfc0f313fcc5d0a24d4d6d81db"),
edit: transferChainedEdit,
body: React__default["default"].createElement("div", null, amisCore.render({
type: 'transfer',
label: '',
name: 'transfer6',
selectMode: 'chained',
options: [{
label: i18nRuntime.i18n("365a28f752cf3ab62be9ccc8db0d9b16"),
children: [{
label: i18nRuntime.i18n("04903192ff663cd0069ed6cd284d33ce"),
value: 'test1'
}, {
label: i18nRuntime.i18n("67763f8a91ba5cbb4cdf9b5758ea14a3"),
value: 'test2'
}]
}, {
label: i18nRuntime.i18n("52b79e6e219197901dfbd50b41c2cf1b"),
children: [{
label: i18nRuntime.i18n("716b1ad4cb45e166cc9f1e283f7026b9"),
value: 'test3'
}]
}]
}))
});
}
}]
}]
};
};
index.registerComponent('transfer', {
type: 'data-entry',
label: i18nRuntime.i18n("f410776cb3c2ae88c0366bc8713423af"),
key: 'transfer',
component: function () {
return ThemeTransfer;
}
});