eapp-amis-theme-editor
Version:
amis主题编辑器
190 lines (187 loc) • 6.44 kB
JavaScript
/**
* 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 ThemeSpinnerCommon = 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 ThemeSpinner = function (props) {
return {
title: i18n("5578cb0a3bbcddee19497debcf900ab2"),
body: [{
title: i18n("e1371d733ff347664655629011b4130f"),
body: [{
title: i18n("e1371d733ff347664655629011b4130f"),
body: function (onEdit) {
return React__default.createElement(ThemeSpinnerCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: "\u57FA\u7840\u6837\u5F0F",
edit: {
title: i18n("2f1448085b4bec952ffdb627d136cf78"),
path: 'component.spinner.base.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("7d721088a016eac0c59388d1fda68e72"),
body: [{
type: 'amis-theme-select',
name: 'tip-size',
label: i18n("3ec2bba02a859a90b023ee793a2381d5"),
options: '${sizesOptions}'
}]
}]
}])
},
body: render({
type: 'spinner',
value: 1,
tip: i18n("26b5bd4947df8be257c59dde927b400c")
})
});
}
}]
}, {
title: i18n("c8339fd2a85af4ba66084d28df808de4"),
body: [{
title: i18n("e1371d733ff347664655629011b4130f"),
body: function (onEdit) {
return React__default.createElement(ThemeSpinnerCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: "small",
edit: {
title: i18n("2f1448085b4bec952ffdb627d136cf78"),
path: 'component.spinner.small.body',
body: getSchemaTpl('collapseGroup', [{
title: i18n("37ae4f181d4f139be90fb80cae3fc493"),
body: [{
type: 'amis-theme-wrapper',
label: false,
title: i18n("c8339fd2a85af4ba66084d28df808de4"),
body: [{
type: 'amis-theme-select',
name: 'size',
label: false,
options: '${sizesOptions}'
}]
}]
}])
},
body: React__default.createElement("div", {
className: "theme-component-content-wrap"
}, render({
type: 'spinner',
size: 'sm'
}))
});
}
}, {
title: i18n("e1371d733ff347664655629011b4130f"),
body: function (onEdit) {
return React__default.createElement(ThemeSpinnerCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: "normal",
edit: {
title: i18n("2f1448085b4bec952ffdb627d136cf78"),
path: 'component.spinner.normal.body',
body: getSchemaTpl('collapseGroup', [{
title: i18n("37ae4f181d4f139be90fb80cae3fc493"),
body: [{
type: 'amis-theme-wrapper',
label: false,
title: i18n("c8339fd2a85af4ba66084d28df808de4"),
body: [{
type: 'amis-theme-select',
name: 'size',
label: false,
options: '${sizesOptions}'
}]
}]
}])
},
body: React__default.createElement("div", {
className: "theme-component-content-wrap"
}, render({
type: 'spinner'
}))
});
}
}, {
title: i18n("e1371d733ff347664655629011b4130f"),
body: function (onEdit) {
return React__default.createElement(ThemeSpinnerCommon, {
activeId: props.activeId,
onEdit: onEdit,
title: "large",
edit: {
title: i18n("2f1448085b4bec952ffdb627d136cf78"),
path: 'component.spinner.large.body',
body: getSchemaTpl('collapseGroup', [{
title: i18n("37ae4f181d4f139be90fb80cae3fc493"),
body: [{
type: 'amis-theme-wrapper',
label: false,
title: i18n("c8339fd2a85af4ba66084d28df808de4"),
body: [{
type: 'amis-theme-select',
name: 'size',
label: false,
options: '${sizesOptions}'
}]
}]
}])
},
body: React__default.createElement("div", {
className: "theme-component-content-wrap"
}, render({
type: 'spinner',
size: 'lg'
}))
});
}
}]
}]
};
};
registerComponent('spinner', {
type: 'feedback',
label: '加载中',
key: 'spinner',
component: function () {
return ThemeSpinner;
}
});