@ovine/editor
Version:
Ovine json editor.
1,471 lines (1,469 loc) • 1.12 MB
JavaScript
/* eslint-disable */
/* tslint-disable */
// ovine: rplaceholder: "" => placeholder: ""
// = > =>
// t. defalut => t.defult
;(() => {
var e = {
7528 : (e, t, a) => {
a.r(t),
a.d(t, {
default:
() => o
});
var n, l = a(6689);
function i() {
return i = Object.assign ||
function(e) {
for (var t = 1; t < arguments.length; t++) {
var a = arguments[t];
for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
},
i.apply(this, arguments)
}
const o = function(e) {
return l.createElement("svg", i({
viewBox: "0 0 1024 1024",
xmlns: "http://www.w3.org/2000/svg",
width: 200,
height: 200
},
e), n || (n = l.createElement("path", {
d: "M810.667 853.333H213.333a42.667 42.667 0 000 85.334h597.334a42.667 42.667 0 000-85.334zm-328.96-97.706a42.667 42.667 0 0014.08 8.96 40.107 40.107 0 0032.426 0 42.667 42.667 0 0014.08-8.96L712.96 584.96a42.667 42.667 0 00-60.587-60.587l-97.706 98.134V128a42.667 42.667 0 00-85.334 0v494.507l-97.706-98.134a42.667 42.667 0 10-60.587 60.587z"
})))
}
},
3248 : (e, t, a) => {
a.r(t),
a.d(t, {
default:
() => o
});
var n, l = a(6689);
function i() {
return i = Object.assign ||
function(e) {
for (var t = 1; t < arguments.length; t++) {
var a = arguments[t];
for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
},
i.apply(this, arguments)
}
const o = function(e) {
return l.createElement("svg", i({
viewBox: "0 0 1024 1024",
xmlns: "http://www.w3.org/2000/svg"
},
e), n || (n = l.createElement("path", {
d: "M755.627 481.707L584.96 311.04a42.667 42.667 0 10-60.587 60.587l98.134 97.706H128a42.667 42.667 0 000 85.334h494.507l-98.134 97.706a42.667 42.667 0 000 60.587 42.667 42.667 0 0060.587 0l170.667-170.667a42.667 42.667 0 008.96-14.08 42.667 42.667 0 000-32.426 42.667 42.667 0 00-8.96-14.08zM896 170.667a42.667 42.667 0 00-42.667 42.666v597.334a42.667 42.667 0 0085.334 0V213.333A42.667 42.667 0 00896 170.667z"
})))
}
},
2078 : (e, t, a) => {
a.r(t),
a.d(t, {
default:
() => o
});
var n, l = a(6689);
function i() {
return i = Object.assign ||
function(e) {
for (var t = 1; t < arguments.length; t++) {
var a = arguments[t];
for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
},
i.apply(this, arguments)
}
const o = function(e) {
return l.createElement("svg", i({
viewBox: "0 0 1024 1024",
xmlns: "http://www.w3.org/2000/svg",
width: 200,
height: 200
},
e), n || (n = l.createElement("path", {
d: "M896 469.333H401.493l98.134-97.706a42.667 42.667 0 10-60.587-60.587L268.373 481.707a42.667 42.667 0 00-8.96 14.08 42.667 42.667 0 000 32.426 42.667 42.667 0 008.96 14.08L439.04 712.96a42.667 42.667 0 0060.587 0 42.667 42.667 0 000-60.587l-98.134-97.706H896a42.667 42.667 0 000-85.334zM128 128a42.667 42.667 0 00-42.667 42.667v682.666a42.667 42.667 0 0085.334 0V170.667A42.667 42.667 0 00128 128z"
})))
}
},
8983 : (e, t, a) => {
a.r(t),
a.d(t, {
default:
() => o
});
var n, l = a(6689);
function i() {
return i = Object.assign ||
function(e) {
for (var t = 1; t < arguments.length; t++) {
var a = arguments[t];
for (var n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
},
i.apply(this, arguments)
}
const o = function(e) {
return l.createElement("svg", i({
viewBox: "0 0 1024 1024",
xmlns: "http://www.w3.org/2000/svg",
width: 200,
height: 200
},
e), n || (n = l.createElement("path", {
d: "M542.293 268.373a42.667 42.667 0 00-14.08-8.96 42.667 42.667 0 00-32.426 0 42.667 42.667 0 00-14.08 8.96L311.04 439.04a42.667 42.667 0 1060.587 60.587l97.706-98.134V896a42.667 42.667 0 0085.334 0V401.493l97.706 98.134a42.667 42.667 0 0060.587 0 42.667 42.667 0 000-60.587zm268.374-183.04H213.333a42.667 42.667 0 000 85.334h597.334a42.667 42.667 0 000-85.334z"
})))
}
},
9672 : (e, t, a) => {
Object.defineProperty(t, "__esModule", {
value: !0
}),
t.BasicEditor = t.RendererEditor = void 0;
var n = a(752),
l = a(9756),
i = a(9933);
t.RendererEditor = function(e, t) {
return function(a) { (0, l.registerEditorPlugin)(function(a) {
function l(n) {
var l = a.call(this, n) || this;
return l.rendererName = e,
l.name = l.tipName || t.name,
l.description = t.description,
l.scaffold = t.scaffold || {
type: t.type
},
l.previewSchema = t.previewSchema || l.scaffold,
l.settingsSchema && (l.panelTitle = l.settingsSchema.title, l.panelControls = l.settingsSchema.body),
l
}
return (0, n.__extends)(l, a),
l
} (a))
}
};
var o = function(e) {
function t() {
return null !== e && e.apply(this, arguments) || this
}
return (0, n.__extends)(t, e),
t
} (i.BasePlugin);
t.BasicEditor = o
},
9797 : (e, t, a) => {
Object.defineProperty(t, "__esModule", {
value: !0
}),
t.AvailableRenderersPanel = void 0;
var n = a(752),
l = a(1502),
i = a(2062),
o = (0, n.__importDefault)(a(6689)),
r = (0, n.__importDefault)(a(9003)),
s = a(3570),
d = function(e) {
function t() {
return null !== e && e.apply(this, arguments) || this
}
return (0, n.__extends)(t, e),
t.prototype.handleRegionFilterClick = function(e) {
var t = e.currentTarget.getAttribute("data-value"),
a = this.props,
n = a.store,
l = a.manager;
t = t === n.subRendererRegion ? "": t,
l.switchToRegion(t)
},
t.prototype.handleDragStart = function(e) {
var t = e.currentTarget.getAttribute("data-id");
e.dataTransfer.setData('dnd-dom/[data-id="' + t + '"]', "")
},
t.prototype.renderThumb = function(e) {
var t = this.props.manager;
return e ? (0, l.render)(e, {
onAction: s.noop
},
t.env) : o.
default.createElement("p", null, "没有预览图")
},
t.prototype.render = function() {
var e = this,
t = this.props.store,
a = t.groupedSubRenderers,
n = Object.keys(a),
i = t.getNodeById(t.activeContainerId);
return o.
default.createElement("div", {
className: "ae-RendererList"
},
o.
default.createElement("div", {
className: "p-l p-r m-b-xs"
},
o.
default.createElement(l.InputBox, {
value: t.subRenderersKeywords,
onChange: t.changeSubRenderersKeywords,
placeholder: "输入关键字可过滤组件",
clearable: !1
},
t.subRenderersKeywords ? o.
default.createElement("a", {
onClick: t.resetSubRenderersKeywords
},
o.
default.createElement(l.Icon, {
icon: "close",
className: "icon"
})) : o.
default.createElement(l.Icon, {
icon: "search",
className: "icon"
}))), o.
default.createElement("div", {
className: "ae-RendererList-tip"
},
"请选择以下组件拖入「", null == i ? void 0 : i.label, "」中"), o.
default.createElement("div", {
className: "ae-RendererList-groupWrap"
},
n.length ? n.map((function(n, i) {
var s = a[n];
return s && s.length ? o.
default.createElement("div", {
key: n,
className: "ae-RendererList-group"
},
o.
default.createElement("div", {
className: "ae-RendererList-groupLabel"
},
n), s.map((function(a) {
var n = i + "_" + a.id;
return o.
default.createElement("div", {
onDragStart: e.handleDragStart,
"data-id": n,
"data-dnd-type": "subrenderer",
"data-dnd-id": a.id,
"data-dnd-data": JSON.stringify(a.scaffold || {
type: a.type
}),
key: n,
draggable: !0,
className: "ae-RendererList-item"
},
o.
default.createElement("i", {
className: (0, r.
default)("fa-fw", a.icon || "fa fa-circle-thin")
}), o.
default.createElement("div", {
className: "ae-RendererList-itemLabel"
},
a.name), o.
default.createElement("div", {
className: "ae-RendererList-itemInfo"
},
o.
default.createElement(l.TooltipWrapper, {
tooltipClassName: "ae-RendererThumb",
trigger: "click",
rootClose: !0,
placement: "right",
tooltip: {
dom: o.
default.createElement("div", {
className: "ae-RendererInfo"
},
a.description || a.docLink ? o.
default.createElement(o.
default.Fragment, null, o.
default.createElement("div", null, o.
default.createElement(l.Html, {
html: a.description
}), a.docLink ? o.
default.createElement("a", {
target: "_blank",
href: t.amisDocHost + a.docLink
},
" 详情 ") : null), o.
default.createElement("div", {
className: "ae-RendererDiv"
})) : null, o.
default.createElement("div", {
className: "ae-RendererPreview"
},
e.renderThumb(a.previewSchema)))
}
},
o.
default.createElement("a", {
className: "ae-RendererIcon",
"data-position": "bottom"
},
o.
default.createElement(l.Icon, {
icon: "info",
className: "icon"
})))))
}))) : null
})) : o.
default.createElement("span", null, "没有可用组件,也许你该切换容器试试。")))
},
(0, n.__decorate)([s.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", [Object]), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "handleRegionFilterClick", null),
(0, n.__decorate)([i.observer], t)
} (o.
default.Component);
t.AvailableRenderersPanel = d
},
3164 : (e, t, a) => {
Object.defineProperty(t, "__esModule", {
value: !0
});
var n = a(752),
l = (0, n.__importDefault)(a(6689)),
i = a(2062),
o = a(3570),
r = function(e) {
function t() {
return null !== e && e.apply(this, arguments) || this
}
return (0, n.__extends)(t, e),
t.prototype.handleClick = function(e) {
var t, a = e.currentTarget,
n = a.getAttribute("data-node-id"),
l = a.getAttribute("data-node-region"),
i = this.props.store,
o = this.props.manager,
r = i.getNodeById(n); ! 1 !== (null === (t = null == r ? void 0 : r.info) || void 0 === t ? void 0 : t.editable) && (l ? o.showInsertPanel(l, n) : i.setActiveId(n))
},
t.prototype.handleMouseEnter = function(e) {
var t = e.currentTarget,
a = t.getAttribute("data-node-id"),
n = t.getAttribute("data-node-region");
this.props.store.setHoverId(a, n)
},
t.prototype.render = function() {
var e = this,
t = this.props.store.bcn;
return l.
default.createElement("div", {
className: "ae-Breadcrumb"
},
l.
default.createElement("span", null, "组件路径:"), t.length ? l.
default.createElement("ul", null, t.map((function(t, a) {
var n, i = null === (n = t.parent) || void 0 === n ? void 0 : n.uniqueChildren;
return l.
default.createElement("li", {
key: a
},
l.
default.createElement("a", {
"data-node-id": t.id,
"data-node-region": t.region,
onClick: e.handleClick,
onMouseEnter: e.handleMouseEnter
},
t.label), (null == i ? void 0 : i.length) > 1 ? l.
default.createElement("ul", null, i.map((function(a) {
return l.
default.createElement("li", {
key: a.id + "-" + a.region
},
l.
default.createElement("a", {
"data-node-id": a.id,
"data-node-region": a.region,
onClick: e.handleClick,
onMouseEnter: e.handleMouseEnter,
className: a.id === t.id && a.region === t.region ? "is-active": ""
},
a.label))
}))) : null)
}))) : l.
default.createElement("span", null, "点选组件开始编辑"))
},
(0, n.__decorate)([o.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", [Object]), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "handleClick", null),
(0, n.__decorate)([o.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", [Object]), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "handleMouseEnter", null),
(0, n.__decorate)([i.observer], t)
} (l.
default.Component);
t.default = r
},
425 : (e, t, a) => {
Object.defineProperty(t, "__esModule", {
value: !0
}),
t.ClassNameControl = void 0;
var n = a(752),
l = a(1502),
i = (0, n.__importDefault)(a(6689)),
o = a(6405),
r = [{
label: "外边距",
children: [{
label: "整体",
children: [{
label: "极小",
value: "m-xs"
},
{
label: "小",
value: "m-sm"
},
{
label: "正常",
value: "m"
},
{
label: "中",
value: "m-md"
},
{
label: "大",
value: "m-lg"
}]
},
{
label: "上边距",
children: [{
label: "极小",
value: "m-t-xs"
},
{
label: "小",
value: "m-t-sm"
},
{
label: "正常",
value: "m-t"
},
{
label: "中",
value: "m-t-md"
},
{
label: "大",
value: "m-t-lg"
}]
},
{
label: "右边距",
children: [{
label: "极小",
value: "m-r-xs"
},
{
label: "小",
value: "m-r-sm"
},
{
label: "正常",
value: "m-r"
},
{
label: "中",
value: "m-r-md"
},
{
label: "大",
value: "m-r-lg"
}]
},
{
label: "下边距",
children: [{
label: "极小",
value: "m-b-xs"
},
{
label: "小",
value: "m-b-sm"
},
{
label: "正常",
value: "m-b"
},
{
label: "中",
value: "m-b-md"
},
{
label: "大",
value: "m-b-lg"
}]
},
{
label: "左边距",
children: [{
label: "极小",
value: "m-l-xs"
},
{
label: "小",
value: "m-l-sm"
},
{
label: "正常",
value: "m-l"
},
{
label: "中",
value: "m-l-md"
},
{
label: "大",
value: "m-l-lg"
}]
},
{
label: "置无",
children: [{
label: "全部",
value: "m-none"
},
"|", {
label: "上",
value: "m-t-none"
},
{
label: "右",
value: "m-r-none"
},
{
label: "下",
value: "m-b-none"
},
{
label: "左",
value: "m-l-none"
}]
}]
},
{
label: "内边距",
children: [{
label: "整体",
children: [{
label: "极小",
value: "p-xs"
},
{
label: "小",
value: "p-sm"
},
{
label: "正常",
value: "p"
},
{
label: "中",
value: "p-md"
},
{
label: "大",
value: "p-lg"
}]
},
{
label: "上边距",
children: [{
label: "极小",
value: "p-t-xs"
},
{
label: "小",
value: "p-t-sm"
},
{
label: "正常",
value: "p-t"
},
{
label: "中",
value: "p-t-md"
},
{
label: "大",
value: "p-t-lg"
}]
},
{
label: "右边距",
children: [{
label: "极小",
value: "p-r-xs"
},
{
label: "小",
value: "p-r-sm"
},
{
label: "正常",
value: "p-r"
},
{
label: "中",
value: "p-r-md"
},
{
label: "大",
value: "p-r-lg"
}]
},
{
label: "下边距",
children: [{
label: "极小",
value: "p-b-xs"
},
{
label: "小",
value: "p-b-sm"
},
{
label: "正常",
value: "p-b"
},
{
label: "中",
value: "p-b-md"
},
{
label: "大",
value: "p-b-lg"
}]
},
{
label: "左边距",
children: [{
label: "极小",
value: "p-l-xs"
},
{
label: "小",
value: "p-l-sm"
},
{
label: "正常",
value: "p-l"
},
{
label: "中",
value: "p-l-md"
},
{
label: "大",
value: "p-l-lg"
}]
},
{
label: "置无",
children: [{
label: "全部",
value: "p-none"
},
"|", {
label: "上",
value: "p-t-none"
},
{
label: "右",
value: "p-r-none"
},
{
label: "下",
value: "p-b-none"
},
{
label: "左",
value: "p-l-none"
}]
}]
},
{
label: "边框",
className: "w2x",
children: [{
label: "位置",
children: [{
label: "全部",
value: "b-a"
},
"|", {
label: "上",
value: "b-t"
},
{
label: "右",
value: "b-r"
},
{
label: "下",
value: "b-b"
},
{
label: "左",
value: "b-l"
},
"|", {
label: "置无",
value: "no-border"
}]
},
{
label: "大小",
children: [{
label: "2x",
value: "b-2x"
},
{
label: "3x",
value: "b-3x"
},
{
label: "4x",
value: "b-4x"
},
{
label: "5x",
value: "b-5x"
}]
},
{
label: "颜色",
children: [{
label: "主色",
value: "b-primary",
className: "bg-primary"
},
{
label: "信息",
value: "b-info",
className: "bg-info"
},
{
label: "警告",
value: "b-warning",
className: "bg-warning"
},
{
label: "危险",
value: "b-danger",
className: "bg-danger"
},
{
label: "成功",
value: "b-success",
className: "bg-success"
},
{
label: "白色",
value: "b-white",
className: "bg-white"
},
{
label: "暗色",
value: "b-dark",
className: "bg-dark"
},
{
label: "浅色",
value: "b-light",
className: "bg-light"
}]
}]
},
{
label: "其他",
className: "w2x",
children: [{
label: "圆角",
children: [{
label: "全部",
value: "r"
},
"|", {
label: "上",
value: "r-t"
},
{
label: "右",
value: "r-r"
},
{
label: "下",
value: "r-b"
},
{
label: "左",
value: "r-l"
},
"|", {
label: "2x",
value: "r-2x"
},
{
label: "3x",
value: "r-3x"
}]
},
{
label: "字体",
children: [{
label: "正常",
value: "font-normal"
},
{
label: "细",
value: "font-thin"
},
{
label: "粗",
value: "font-bold"
},
"|", {
label: "极小",
value: "text-xs"
},
{
label: "小",
value: "text-sm"
},
{
label: "正常",
value: "text-base"
},
{
label: "中",
value: "text-md"
},
{
label: "大",
value: "text-lg"
}]
},
{
label: "颜色",
children: [{
label: "主色",
value: "text-primary",
className: "text-primary"
},
{
label: "信息",
value: "text-info",
className: "text-info"
},
{
label: "警告",
value: "text-warning",
className: "text-warning"
},
{
label: "危险",
value: "text-danger",
className: "text-danger"
},
{
label: "成功",
value: "text-success",
className: "text-success"
},
{
label: "白色",
value: "text-white",
className: "text-white bg-dark"
},
{
label: "暗色",
value: "text-dark",
className: "text-dark"
},
{
label: "淡色",
value: "text-muted",
className: "text-muted"
}]
},
{
label: "背景",
children: [{
label: "主色",
value: "bg-primary",
className: "bg-primary"
},
{
label: "信息",
value: "bg-info",
className: "bg-info"
},
{
label: "警告",
value: "bg-warning",
className: "bg-warning"
},
{
label: "危险",
value: "bg-danger",
className: "bg-danger"
},
{
label: "成功",
value: "bg-success",
className: "bg-success"
},
{
label: "白色",
value: "bg-white",
className: "bg-white"
},
{
label: "暗色",
value: "bg-dark",
className: "bg-dark"
},
{
label: "浅色",
value: "bg-light",
className: "bg-light"
},
"|", {
label: "置无",
value: "no-bg"
}]
},
{
label: "宽度",
children: [{
label: "特小",
value: "w-xxs"
},
{
label: "极小",
value: "w-xs"
},
{
label: "小",
value: "w-sm"
},
{
label: "正常",
value: "w"
},
{
label: "中",
value: "w-md"
},
{
label: "大",
value: "w-lg"
},
{
label: "加大",
value: "w-xl"
},
{
label: "特大",
value: "w-xxl"
},
{
label: "占满",
value: "w-full"
}]
}]
}],
s = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.state = {
isFocused: !1,
isOpened: !1
},
t.values = [],
t
}
return (0, n.__extends)(t, e),
t.prototype.open = function() {
this.setState({
isOpened: !0
})
},
t.prototype.close = function() {
this.setState({
isOpened: !1
})
},
t.prototype.toggle = function() {
this.setState({
isOpened: !this.state.isOpened
})
},
t.prototype.handleFocus = function(e) {
this.setState({
isFocused: !0
}),
this.props.onFocus && this.props.onFocus(e)
},
t.prototype.handleBlur = function(e) {
this.setState({
isFocused: !1
}),
this.props.onBlur && this.props.onBlur(e)
},
t.prototype.handleChange = function(e) { (0, this.props.onChange)(e.currentTarget.value)
},
t.prototype.getParent = function() {
return (0, o.findDOMNode)(this)
},
t.prototype.getTarget = function() {
return (0, o.findDOMNode)(this)
},
t.prototype.handlePopOverChange = function(e) {
var t = this.props.value || "",
a = t.replace(/\s+/g, " ").split(/\s+/),
n = a.indexOf(e.value),
l = this.props.onChange;
if (~n) a.splice(n, 1),
t = a.join(" ");
else {
if (/(?:^|\s)(m|p)\-(t|r|b|l)(?:\-(?:xs|sm|md|lg))?(?:$|\s)/.test(e.value)) {
var i = new RegExp("(?:^|\\s)" + RegExp.$1 + "\\-" + RegExp.$2 + "(?:\\-(?:xs|sm|md|lg))?(?=(\\s|$))", "ig");
t = t.replace(i, "")
} else / ( ? :^|\s)(m | p)( ? :\ - (xs | sm | md | lg)) ? ( ? :$ | \s) / .test(e.value) ? (i = new RegExp("(?:^|\\s)" + RegExp.$1 + "(?:\\-(?:xs|sm|md|lg))?(?=(\\s|$))", "ig"), t = t.replace(i, "")) : /(?:^|\s)(m|p)(?:\-(t|r|b|l))?\-none(?:$|\s)/.test(e.value) ? (i = new RegExp(RegExp.$2 ? "(?:^|\\s)" + RegExp.$1 + "(?:(?:\\-" + RegExp.$2 + "(?:\\-(?:xs|sm|md|lg)))|\\-none)?(?=(\\s|$))": "(?:^|\\s)" + RegExp.$1 + "(?:[^\\s$]+)?(?=(\\s|$))", "ig"), t = t.replace(i, "$1")) : /(?:^|\s)w(?:\-\w+)?(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)w(?:\-\w+)?(?=(\s|$))/g, "") : "b-a" === e.value ? t = (t = t.replace(/(?:^|\s)b\-(?:t|r|b|l)(?=(\s|$))/g, "")).replace(/(?:^|\s)no\-border(?=(\s|$))/g, "") : /(?:^|\s)b\-(?:t|r|b|l)?(?:$|\s)/.test(e.value) ? t = (t = t.replace(/(?:^|\s)b\-a(?=(\s|$))/g, "")).replace(/(?:^|\s)no\-border(?=(\s|$))/g, "") : /(?:^|\s)b\-\dx(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)b\-\dx(?=(\s|$))/g, "") : "no-border" === e.value ? t = t.replace(/(?:^|\s)b\-(?:\dx|\w+)(?=(\s|$))/g, "") : /(?:^|\s)b\-(?:primary|info|warning|danger|success|white|dark|light)(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)b\-(?:primary|info|warning|danger|success|white|dark|light)(?=(\s|$))/g, "") : "r" === e.value ? t = t.replace(/(?:^|\s)r\-(?:t|r|b|l)(?=(\s|$))/g, "") : /(?:^|\s)r\-(?:t|r|b|l)?(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)r(?=(\s|$))/g, "") : /(?:^|\s)r\-\dx(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)r\-\dx(?=(\s|$))/g, "") : /(?:^|\s)text\-(?:xs|sm|base|md|lg)(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)text\-(?:xs|sm|base|md|lg)(?=(\s|$))/g, "") : /(?:^|\s)font\-(?:normal|thin|bold)(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)font\-(?:normal|thin|bold)(?=(\s|$))/g, "") : /(?:^|\s)text\-(?:primary|info|warning|danger|success|white|dark|light)(?:$|\s)/.test(e.value) ? t = t.replace(/(?:^|\s)text\-(?:primary|info|warning|danger|success|white|dark|light)(?=(\s|$))/g, "") : /(?:^|\s)bg\-(?:primary|info|warning|danger|success|white|dark|light)(?:$|\s)/.test(e.value) ? t = (t = t.replace(/(?:^|\s)bg\-(?:primary|info|warning|danger|success|white|dark|light)(?=(\s|$))/g, "")).replace(/(?:^|\s)no\-bg(?=(\s|$))/g, "") : "no-bg" === e.value && (t = t.replace(/(?:^|\s)bg\-(?:primary|info|warning|danger|success|white|dark|light)(?=(\s|$))/g, ""));
t = t.replace(/\s+/g, " ").trim(),
t += (t ? " ": "") + e.value
}
l(t)
},
t.prototype.renderGroup = function(e, t) {
var a = this,
n = this.props.classnames;
return i.
default.createElement("div", {
key: t,
className: n("ae-ClassNameControl-group", e.className)
},
i.
default.createElement("label", {
className: n("ae-ClassNameControl-groupLabel", e.labelClassName)
},
e.label), e.children && e.children.length ? e.children[0].value ? this.renderOptions(e.children, t) : e.children.map((function(e, t) {
return a.renderGroup(e, t)
})) : null)
},
t.prototype.renderOptions = function(e, t) {
var a = this,
n = this.props.classnames;
return function(e) {
for (var t = [], a = t[0] = [], n = 0, l = e.length; n < l; n++) {
var i = e[n];
"|" === i ? (a = [], t.push(a)) : a.push(i)
}
return t
} (e).map((function(e, t) {
return i.
default.createElement("div", {
className: n("ButtonGroup"),
key: t
},
e.map((function(e, t) {
return i.
default.createElement("div", {
key: t,
onClick: function() {
return a.handlePopOverChange(e)
},
className: n("Button Button--xs", e.className, ~a.values.indexOf(e.value) ? "Button--primary": "Button--default")
},
e.label)
})))
}))
},
t.prototype.renderPopover = function() {
var e = this,
t = this.props.value;
return this.values = t ? t.split(" ") : [],
i.
default.createElement("div", null, r.map((function(t, a) {
return e.renderGroup(t, a)
})))
},
t.prototype.render = function() {
var e, t = this.props,
a = t.classnames,
n = t.readOnly,
o = t.disabled,
r = t.value,
s = t.className,
d = t.name,
p = t.popOverContainer;
return i.
default.createElement("div", {
className: a(s, "TextControl", (e = {},
e["TextControl--withAddOn"] = !0, e["is-focused"] = this.state.isFocused, e["is-disabled"] = o, e))
},
i.
default.createElement("div", {
className: a("TextControl-input")
},
i.
default.createElement("input", {
name: d,
placeholder: "请输入 css 类名",
disabled: o,
readOnly: n,
type: "text",
autoComplete: "off",
onChange: this.handleChange,
onFocus: this.handleFocus,
onBlur: this.handleBlur,
value: null == r ? "": "string" == typeof r ? r: JSON.stringify(r)
})), i.
default.createElement("div", {
className: a("TextControl-button")
},
i.
default.createElement(l.Button, {
onClick: this.toggle
},
i.
default.createElement("i", {
className: "fa fa-cog"
}))), i.
default.createElement(l.Overlay, {
placement: "right-bottom-right-top right-top-right-bottom right-bottom-right-top",
target: this.getTarget,
container: p || this.getParent,
rootClose: !1,
show: this.state.isOpened,
watchTargetSizeChange: !1
},
i.
default.createElement(l.PopOver, {
className: "ae-ClassNamePicker-popover",
onHide: this.close,
overlay: !0
},
this.renderPopover())))
},
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", []), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "open", null),
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", []), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "close", null),
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", []), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "toggle", null),
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", [Object]), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "handleFocus", null),
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", [Object]), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "handleBlur", null),
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", [Object]), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "handleChange", null),
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", []), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "getParent", null),
(0, n.__decorate)([l.utils.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", []), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "getTarget", null),
(0, n.__decorate)([(0, l.FormItem)({
type: "ae-classname"
})], t)
} (i.
default.Component);
t.ClassNameControl = s
},
498 : (e, t, a) => {
Object.defineProperty(t, "__esModule", {
value: !0
});
var n = a(752),
l = (0, n.__importDefault)(a(6689)),
i = (0, n.__importDefault)(a(3541)),
o = a(3570),
r = (0, n.__importDefault)(a(9003)),
s = a(1502),
d = a(3908),
p = a(8425),
u = a(5720),
c = (0, n.__importDefault)(a(5452)),
m = /^\/schemas\/(.*).json$/,
h = d((function(e) {
s.toast.warning("代码有误,错误的地方是\n " + e.toString().split("\n")[1])
}), 1e3),
f = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.state = {
wrongSchema: "",
value: t.props.value,
contents: t.obj2str(t.props.value, t.props)
},
t.toDispose = [],
t.uri = "isuda://schema/" + (0, o.guid)() + ".json",
t.emitChange = d((function() {
var e = t.props,
a = e.onChange,
n = e.value,
l = t.str2obj(t.state.contents);
if (l && (0, c.
default)(l)) {
t.setState({
wrongSchema:
""
}),
delete l.$schema,
l = (0, o.filterSchemaForConfig)(l, t.props.value);
var i = (0, o.diff)(t.lastResult || n, l);
t.lastResult = l,
a(l, i)
} else t.setState({
wrongSchema: t.state.contents
})
}), 250, {
trailing: !0,
leading: !1
}),
t.editorFactory = function(e, a, l) {
var i = a.Uri.parse(t.uri);
return t.model = a.editor.createModel(t.state.contents, "json", i),
a.editor.create(e, (0, n.__assign)((0, n.__assign)({
autoIndent: !0,
formatOnType: !0,
formatOnPaste: !0,
selectOnLineNumbers: !0,
scrollBeyondLastLine: !1,
folding: !0,
scrollbar: {
alwaysConsumeMouseWheel: !1
},
minimap: {
enabled: !1
}
},
l), {
model: t.model
}))
},
t.editorDidMount = function(e, a) {
t.editor = e,
t.monaco = a,
t.changeJsonOptions(t.props),
t.props.onPaste && t.toDispose.push(t.editor.onDidPaste(t.props.onPaste).dispose)
},
t.editorWillUnmount = function(e, a) {
t.toDispose.forEach((function(e) {
return e()
})),
t.toDispose = []
},
t.handleChange = function(e) {
t.setState({
contents: e
},
t.emitChange)
},
t.handleBlur = function() {
return (0, n.__awaiter)(t, void 0, void 0, (function() {
var e, t, a;
return (0, n.__generator)(this, (function(n) {
switch (n.label) {
case 0:
return e = this.state,
t = e.wrongSchema,
a = e.value,
t ? [4, (0, s.prompt)([{
className: "w-full",
type: "tpl",
label: !1,
tpl: "当前有部分已更改数据因为格式不正确尚未保存,您确认要丢弃这部分更改吗?"
},
{
type: "switch",
label: !1,
option: "查看更改",
name: "diff",
value: !1
},
{
visibleOn: "this.diff",
label: !1,
type: "diff-editor",
allowFullscreen: !0,
disabled: !0,
name: "newValue",
size: "xxl",
language: "json",
diffValue: "${oldValue}"
}], {
oldValue: a,
newValue: t
},
"请确认")] : [2];
case 1:
return n.sent() ? this.setState({
wrongSchema: "",
contents: JSON.stringify(a)
}) : this.editor.focus(),
[2]
}
}))
}))
},
t
}
return (0, n.__extends)(t, e),
t.prototype.componentDidUpdate = function(e) {
var t = this.props;
e.$schema !== t.$schema && this.monaco && this.changeJsonOptions(t),
(0, o.isObjectShallowModified)(t.value, e.value) && (0, o.isObjectShallowModified)(t.value, this.lastResult) && (this.lastResult = null, this.setState({
value: t.value,
contents: this.obj2str(t.value, t)
}))
},
t.prototype.obj2str = function(e, t) {
var a;
return e = (0, o.filterSchemaForConfig)(e),
!(e = (0, n.__assign)({
type: null == e ? void 0 : e.type
},
e)).type && (null === (a = t.$schema) || void 0 === a ? void 0 : a.match(/PageSchema/i)) ? e.type = "page": e.type || delete e.type,
delete e.$schema,
(0, u.stringify)(e)
},
t.prototype.str2obj = function(e) {
try {
return "" === e ? {}: (0, u.parse)(e)
} catch(e) {
return h(e),
null
}
},
t.prototype.changeJsonOptions = function(e) {
var t;
void 0 === e && (e = this.props);
var a = this.monaco,
n = e.$schemaUrl || window.location.protocol + "//" + window.location.host + "/schema.json";
0 === n.indexOf("/") && (n = window.location.protocol + "//" + window.location.host + n);
var l = function(e, t, a, n) {
var l = Array.isArray(n) ? n.concat() : [];
if (m.test(t)) {
var i = RegExp.$1,
o = e.replace(/^(\w+\:\/\/[^\/]+)\/.*$/, "$1") + "/schemas/" + i + ".json",
r = p(l, (function(e) {
var t;
return (null === (t = e.fileMatch) || void 0 === t ? void 0 : t[0]) === a
}));~r && l.splice(r, 1),
l.push({
uri: o,
fileMatch: [a],
schema: {
$schema: "http://json-schema.org/draft-07/schema#",
$ref: e + "#/definitions/" + i
}
})
}
return l
} (n, e.$schema, a.Uri.parse(this.uri).toString(), null === (t = a.languages.json) || void 0 === t ? void 0 : t.jsonDefaults.diagnosticsOptions.schemas);
a.languages.json.jsonDefaults.setDiagnosticsOptions({
schemas: l,
validate: !0,
enableSchemaRequest: !0,
allowComments: !0
})
},
t.prototype.render = function() {
var e = this.props,
t = e.disabled,
a = e.className,
n = e.theme;
return l.
default.createElement(i.
default, {
className: (0, r.
default)("amis-code-editor", a),
value: this.state.contents,
onChange: this.handleChange,
onBlur: this.handleBlur,
language: "json",
theme: n,
editorFactory: this.editorFactory,
editorDidMount: this.editorDidMount,
editorWillUnmount: this.editorWillUnmount,
options: {
automaticLayout: !0,
lineNumbers: "off",
glyphMargin: !1,
tabSize: 2,
wordWrap: "on",
lineDecorationsWidth: 0,
lineNumbersMinChars: 0,
selectOnLineNumbers: !0,
scrollBeyondLastLine: !1,
folding: !0,
minimap: {
enabled: !1
},
readOnly: t
}
})
},
t
} (l.
default.Component);
t.default = f
},
8680 : (e, t, a) => {
Object.defineProperty(t, "__esModule", {
value: !0
}),
t.CodeEditorPanel = void 0;
var n = a(752),
l = (0, n.__importDefault)(a(6689)),
i = a(3570),
o = (0, n.__importDefault)(a(498)),
r = function(e) {
function t() {
return null !== e && e.apply(this, arguments) || this
}
return (0, n.__extends)(t, e),
t.prototype.handleResizeMouseDown = function(e) {
3 == e.nativeEvent.which || (this.codeWrap = e.currentTarget.parentElement, document.addEventListener("mousemove", this.handleResizeMouseMove), document.addEventListener("mouseup", this.handleResizeMouseUp), this.startX = e.clientX, this.startWidth = this.codeWrap.offsetWidth)
},
t.prototype.handleResizeMouseMove = function(e) {
var t = e.clientX - this.startX;
this.codeWrap.style.cssText += "width: " + Math.max(this.startWidth + t, 300) + "px"
},
t.prototype.handleResizeMouseUp = function() {
document.removeEventListener("mousemove", this.handleResizeMouseMove),
document.removeEventListener("mouseup", this.handleResizeMouseUp)
},
t.prototype.handleCodePaste = function() {
var e = this;
setTimeout((function() {
e.props.manager.patchSchema(!0)
}), 500)
},
t.prototype.render = function() {
var e = this.props,
t = (e.value, e.onChange),
a = (e.info, e.manager),
n = e.store;
return l.
default.createElement(l.
default.Fragment, null, l.
default.createElement(o.
default, {
value: n.valueWithoutHiddenProps,
onChange: t,
$schema: n.jsonSchemaUri,
$schemaUrl: a.config.$schemaUrl,
onPaste: this.handleCodePaste
}), l.
default.createElement("div", {
onMouseDown: this.handleResizeMouseDown,
className: "ae-Editor-codeResizor"
}))
},
(0, n.__decorate)([i.autobind, (0, n.__metadata)("design:type", Function), (0, n.__metadata)("design:paramtypes", [Object]), (0, n.__metadata)("design:returntype", void 0)], t.prototype, "handleResizeMouseDown", null),
(0, n.__decorate)([i.autobi