@tuoyuan/web-plus-dev
Version:
基于arco-design的配置化表格表单组件
1,396 lines • 196 kB
JavaScript
var Yn = Object.defineProperty;
var Xn = (e, o, t) => o in e ? Yn(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
var Gt = (e, o, t) => Xn(e, typeof o != "symbol" ? o + "" : o, t);
import { ref as L, onMounted as gt, onBeforeUnmount as vn, defineComponent as Se, mergeModels as Ve, useSlots as Pt, useAttrs as bo, useModel as Pe, reactive as Ye, resolveComponent as M, openBlock as m, createBlock as B, mergeProps as He, unref as c, withCtx as y, createVNode as P, createElementBlock as H, Fragment as ye, renderList as Ce, normalizeStyle as Oe, normalizeProps as ro, createSlots as it, renderSlot as A, resolveDynamicComponent as $t, createTextVNode as de, toDisplayString as ne, createCommentVNode as V, createElementVNode as Z, normalizeClass as mt, computed as ce, getCurrentInstance as go, watch as It, toRefs as Gn, h as yn, onUnmounted as qn, nextTick as Et, isRef as eo, withModifiers as to, withDirectives as wn, vShow as Jn, useCssVars as Kn, resolveDirective as Zn } from "vue";
import { Editor as Qn, Toolbar as el } from "@wangeditor/editor-for-vue";
import "@wangeditor/editor/dist/css/style.css";
import { Boot as tl } from "@wangeditor/editor";
import { DomEditor as Bi } from "@wangeditor/editor";
import { Modal as ol } from "@arco-design/web-vue";
import { getPrefixCls as nl } from "@arco-design/web-vue/es/_utils/global-config";
import ll from "json-editor-vue";
const kn = /* @__PURE__ */ new WeakMap(), Ko = new ResizeObserver((e) => {
for (const o of e) {
const t = kn.get(o.target);
t && t({
width: o.borderBoxSize[0].inlineSize,
height: o.borderBoxSize[0].blockSize
});
}
}), al = {
install(e) {
e.directive("resize", {
//在创建自定义名称时不要带v-,使用时再携带
mounted(o, t) {
kn.set(o, t.value), Ko.observe(o);
},
unmounted(o) {
Ko.unobserve(o);
}
});
}
};
function il(e, o) {
let t;
return function(...n) {
clearTimeout(t), t = setTimeout(() => {
e.apply(this, n);
}, o);
};
}
function Di(e, o = 300) {
const t = L(window.innerWidth), n = L(window.innerHeight), i = il(() => {
t.value = window.innerWidth, n.value = window.innerHeight, e && e({ width: t.value, height: n.value });
}, o);
return gt(() => {
i(), window.addEventListener("resize", i);
}), vn(() => {
window.removeEventListener("resize", i);
}), { width: t, height: n };
}
function Ei(e, o, t) {
gt(() => {
const [n, a] = o.value, i = t.context[n], l = a.split(".");
e.value = l.reduce((s, u) => s && s[u], i), e.addEventListener("input", (s) => {
const u = s.target.value;
l.reduce((p, f, r) => {
if (r === l.length - 1)
p[f] = u;
else
return p[f] || t.context.$set(p, f, {}), p[f];
}, i);
});
});
}
const rl = (e) => {
const o = L(e), t = L({});
function n(f) {
o.value = f;
}
function a(f, r) {
Reflect.set(o.value, f, r);
}
function i() {
o.value.columns = [];
}
function l(f, r) {
r ? o.value.columns.splice(r, 0, f) : o.value.columns.push(f);
}
function s(f) {
o.value.columns.splice(f, 1);
}
function u(f, r, w) {
const { found: k, config: $ } = p(f, o.value);
if (k)
Reflect.set($, r, w);
else
throw new Error("字段不存在");
}
function p(f, r) {
const w = r.columns.find((k) => k.field === f);
if (w)
return {
found: !0,
config: w
};
if (!r.groups)
return {
found: !1,
config: null
};
for (const k of r.groups ?? []) {
const $ = k.columns.find((z) => z.field === f);
if ($)
return {
found: !0,
config: $,
group: k.label
// 可选:返回所属分组的标签
};
}
return {
found: !1,
config: null
};
}
return {
option: o,
formData: t,
setColumn: u,
addColumn: l,
clearColumn: i,
setOptionConfig: a,
setOption: n,
delColumn: s
};
}, et = (e) => (e.install = (o) => {
const t = e.name || e.__name;
o.component(t, e);
}, e);
function We(e) {
return e == null;
}
function je(e) {
if (typeof e != "object" || e === null)
return e;
let o = Array.isArray(e) ? [] : {};
for (let t in e)
e.hasOwnProperty(t) && (o[t] = je(e[t]));
return o;
}
let sl = { a: 1, b: { c: 2 } };
je(sl);
const ul = (e, o) => {
const t = {};
if ((o.type === "input" || o.type === void 0) && (t.allowClear = !0, t.placeholder = `请输入${o.label}`), o.type === "input-password") {
const n = je(o);
return delete n.type, { ...t, ...n, msg: null };
}
return o.type === "input-number" && (t.placeholder = `请输入${o.label}`), o.type === "textarea" && (t.allowClear = !0, t.showWordLimit = o.showWordLimit ?? !0, t.placeholder = `请输入${o.label}`), o.type === "select" && (t.allowClear = !0, t.placeholder = `请选择${o.label}`, t.options = [], t.options = e[o.field] || o.dicData), o.type === "cascader" && (t.allowClear = !0, t.placeholder = `请选择${o.label}`, t.options = e[o.field] || o.dicData), o.type === "radio" && (t.options = e[o.field] || o.dicData), o.type === "radio-group" && (t.options = e[o.field] || o.dicData), o.type === "checkbox-group" && (t.options = e[o.field] || o.dicData), o.type === "checkbox" && (t.options = e[o.field] || o.dicData), o.type === "date-picker" && (t.placeholder = "请选择日期"), o.type === "time-picker" && (t.allowClear = !0, t.placeholder = "请选择时间"), { ...t, ...o, msg: null, field: null, type: null, onChange: (...n) => {
o.onChange && o.onChange(...n);
} };
}, Zo = /* @__PURE__ */ new Set();
function Oo() {
let e;
do
e = `${Date.now()}${Math.floor(Math.random() * 1e6)}`;
while (Zo.has(e));
return Zo.add(e), e;
}
const Po = {
colGap: 1,
rowGap: 1,
span: 8,
marginTop: "10px",
autoLabelWidth: !0,
scrollToFirstError: !0,
layout: "horizontal",
gutter: 10,
size: "medium",
labelAlign: "right",
columns: [],
justify: "start",
align: "start",
wrap: !0,
submitBtn: !0,
resetBtn: !0,
menuBtn: !0,
menu: !0,
submitBtnText: "提交",
resetBtnText: "重置"
}, dl = {
key: 0,
class: "form-plus-left-bot"
}, pl = /* @__PURE__ */ Se({
name: "aFormPlus",
__name: "main",
props: /* @__PURE__ */ Ve({
menuRight: { type: Boolean, default: !1 },
option: {}
}, {
modelValue: {},
modelModifiers: {}
}),
emits: /* @__PURE__ */ Ve(["submit", "reset", "form-change"], ["update:modelValue"]),
setup(e, { expose: o, emit: t }) {
const n = Pt(), a = bo(), i = e, l = Po, s = Pe(e, "modelValue"), u = L(null), p = t, f = Ye({}), r = Ye({
submit: !1,
reset: !1
});
function w() {
r.submit = !1;
}
const k = ({ values: b, errors: T }) => {
T === void 0 && (r.submit = !0, p("submit", b, w));
};
function $() {
u.value.resetFields(), u.value.clearValidate(), p("reset");
}
function z(b) {
return i.option.disabled ?? b ?? !1;
}
function Y(b, T) {
p("form-change", b, T, w);
}
o(new Proxy({}, {
get(b, T) {
var C;
return T === "reset" ? $ : T === "done" ? w : (C = u.value) == null ? void 0 : C[T];
},
has(b, T) {
return T === "reset" || T === "done" || T in u.value;
}
}));
function N(b) {
return We(b.bind) ? Reflect.get(s.value, b.field) : K(s.value, b.bind);
}
function te(b, T) {
We(b.bind) ? Reflect.set(s.value, b.field, T) : (s[b.field] = T, le(s.value, b.bind, T));
}
const K = (b, T) => T.split(".").reduce((C, E) => C && C[E], b), le = (b, T, C) => {
const E = T.split("."), D = E.pop(), U = E.reduce((d, v) => d[v] = d[v] || {}, b);
U[D] = C;
}, Q = (b, T) => {
const C = {};
if ((T.type === "input" || T.type === void 0) && (C.allowClear = !0, C.placeholder = `请入${T.label}`), T.type === "input-password") {
const E = je(T);
return delete E.type, { ...C, ...E, msg: null };
}
return T.type === "input-number" && (C.placeholder = `请输入${T.label}`), T.type === "textarea" && (C.allowClear = !0, C.showWordLimit = T.showWordLimit ?? !0, C.placeholder = `请输入${T.label}`), T.type === "select" && (C.allowClear = !0, C.placeholder = `请选择${T.label}`, C.options = [], C.options = b[T.field] || T.dicData), T.type === "cascader" && (C.allowClear = !0, C.placeholder = `请选择${T.label}`, C.options = b[T.field] || T.dicData), T.type === "radio" && (C.options = b[T.field] || T.dicData), T.type === "radio-group" && (C.options = b[T.field] || T.dicData), T.type === "checkbox-group" && (C.options = b[T.field] || T.dicData), T.type === "checkbox" && (C.options = b[T.field] || T.dicData), T.type === "date-picker" && (C.placeholder = "请选择日期"), T.type === "time-picker" && (C.allowClear = !0, C.placeholder = "请选择时间"), { ...C, ...T, msg: null, field: null, type: null };
};
return (b, T) => {
const C = M("icon-question-circle-fill"), E = M("a-tooltip"), D = M("a-form-item"), U = M("a-col"), d = M("a-button"), v = M("icon-refresh"), O = M("a-row"), X = M("a-space"), ie = M("a-form");
return m(), B(ie, He({
ref_key: "formRef",
ref: u,
"auto-label-width": b.option.autoLabelWidth ?? c(l).autoLabelWidth,
layout: b.option.layout ?? c(l).layout ?? "horizontal",
scrollToFirstError: b.option.scrollToFirstError ?? c(l).scrollToFirstError,
size: b.option.size ?? c(l).size,
"label-align": b.option.labelAlign ?? c(l).labelAlign,
model: s.value,
onSubmit: k,
disabled: !0
}, c(a)), {
default: y(() => [
P(O, {
class: "form-row__container",
justify: b.option.justify ?? c(l).justify,
align: b.option.align ?? c(l).align,
wrap: b.option.wrap ?? c(l).wrap,
cols: 24,
gutter: b.option.gutter || c(l).gutter,
colGap: b.option.colGap ?? c(l).colGap,
rowGap: b.option.rowGap ?? c(l).rowGap
}, {
default: y(() => [
(m(!0), H(ye, null, Ce(b.option.columns, (g) => (m(), H(ye, {
key: g.field
}, [
g.display ?? !0 ? (m(), B(U, {
key: 0,
style: Oe({ marginTop: b.option.marginTop ?? c(l).marginTop }),
span: g.span ?? b.option.span ?? c(l).span,
offset: g.offset ?? 0,
order: g.order ?? 0
}, {
default: y(() => [
P(D, ro({
[(r.submit ? "" : "disabled") || ""]: z(g.disabled),
label: g.label,
tooltip: g.tooltip,
help: g.help,
extra: g.extra,
"label-component": g.labelComponent,
"hide-label": g.hideLabel,
"hide-asterisk": g.hideAsterisk,
"content-flex": g.contentFlex,
feedback: g.feedback,
field: g.bind ?? g.field,
rules: g.rules
}), it({
default: y(() => [
c(n)[g.field] ? A(b.$slots, g.field, {
key: 0,
item: g,
size: b.option.size ?? c(l).size
}, void 0, !0) : (m(), B($t(g.component ? g.component : `a-${g.type || "input"}`), He({
key: 1,
style: { width: g.type === "switch" ? "" : "100%" },
size: b.option.size ?? c(l).size,
disabled: b.option.detail ?? g.disabled ?? !1,
modelValue: N(g),
"onUpdate:modelValue": (h) => te(g, h),
visibility: g.visibility,
"onUpdate:visibility": (h) => g.visibility = h,
ref_for: !0
}, Q(f, g), {
onChange: (h) => Y(h, g)
}), null, 16, ["style", "size", "disabled", "modelValue", "onUpdate:modelValue", "visibility", "onUpdate:visibility", "onChange"]))
]),
_: 2
}, [
c(n)[g.field + "Label"] ? {
name: "label",
fn: y(() => [
A(b.$slots, g.field + "Label", {}, void 0, !0)
]),
key: "0"
} : void 0,
c(n)[g.field + "Label"] ? void 0 : {
name: "label",
fn: y(() => [
de(ne(g.label) + " ", 1),
g.helpIconText ? (m(), B(E, {
key: 0,
content: g.helpIconText
}, {
default: y(() => [
P(C, {
size: b.option.size ?? c(l).size
}, null, 8, ["size"])
]),
_: 2
}, 1032, ["content"])) : V("", !0)
]),
key: "1"
},
c(n)[g.field + "Help"] || g.help ? {
name: "help",
fn: y(() => [
A(b.$slots, g.field + "Help", {}, void 0, !0),
Z("span", null, ne(g.help), 1)
]),
key: "2"
} : void 0,
c(n)[g.field + "Extra"] || g.extra ? {
name: "extra",
fn: y(() => [
A(b.$slots, g.field + "Extra", {}, void 0, !0),
Z("span", null, ne(g.extra), 1)
]),
key: "3"
} : void 0
]), 1040, ["label", "tooltip", "help", "extra", "label-component", "hide-label", "hide-asterisk", "content-flex", "feedback", "field", "rules"])
]),
_: 2
}, 1032, ["style", "span", "offset", "order"])) : V("", !0)
], 64))), 128)),
b.option.search === !0 && (i == null ? void 0 : i.menuRight) !== !0 ? (m(), B(U, {
key: 0,
order: 11,
span: b.option.searchMenuSpan ?? 8,
style: Oe({
textAlign: b.option.searchMenuAlign ?? "left",
marginTop: b.option.searchMenuMargintop ?? "10px"
})
}, {
default: y(() => [
c(n).menu ? A(b.$slots, "menu", {
key: 0,
size: b.option.size ?? c(l).size,
loading: r.submit
}, void 0, !0) : V("", !0),
A(b.$slots, "menuLeft", {
size: b.option.size ?? c(l).size,
loading: r.submit
}, void 0, !0),
A(b.$slots, "suffix", {
loading: r.submit
}, () => [
b.option.menuBtn ?? b.option.submitBtn ?? c(l).submitBtn ? (m(), B(d, {
key: 0,
size: b.option.size ?? c(l).size,
type: "primary",
loading: r.submit,
"html-type": "submit"
}, {
default: y(() => [
de(ne(b.option.submitBtnText ?? c(l).submitBtnText), 1)
]),
_: 1
}, 8, ["size", "loading"])) : V("", !0),
b.option.menuBtn ?? b.option.resetBtn ?? c(l).resetBtn ? (m(), B(d, {
key: 1,
type: "text",
size: b.option.size ?? c(l).size,
onClick: T[0] || (T[0] = (g) => $())
}, {
icon: y(() => [
P(v, { rotate: 180 })
]),
_: 1
}, 8, ["size"])) : V("", !0)
], !0),
A(b.$slots, "menuright", {
size: b.option.size ?? c(l).size,
loading: r.submit
}, void 0, !0)
]),
_: 3
}, 8, ["span", "style"])) : V("", !0)
]),
_: 3
}, 8, ["justify", "align", "wrap", "gutter", "colGap", "rowGap"]),
(m(!0), H(ye, null, Ce(b.option.groups, (g) => (m(), H(ye, null, [
(g.display, m(), B(O, {
key: 0,
style: Oe(b.option.groupContainerStyle ?? {})
}, {
default: y(() => [
P(U, { span: 24 }, {
default: y(() => [
!c(n)[g.field + "GroupHeader"] && !c(We)(g.label) ? (m(), H("div", dl, ne(g.label), 1)) : A(b.$slots, g.field + "GroupHeader", {
key: 1,
label: g.label,
record: g
}, void 0, !0)
]),
_: 2
}, 1024),
(m(!0), H(ye, null, Ce(g.columns, (h) => (m(), H(ye, {
key: h.field
}, [
h.display ?? !0 ? (m(), B(U, {
key: 0,
span: h.span ?? b.option.span ?? c(l).span,
offset: h.offset ?? 0,
order: h.order ?? 100
}, {
default: y(() => [
P(D, ro({
"label-col-style": {
width: "100px"
},
[(r.submit ? "" : "disabled") || ""]: z(h.disabled),
label: h.label,
tooltip: h.tooltip,
help: h.help,
extra: h.extra,
"label-component": h.labelComponent,
"hide-label": h.hideLabel,
"hide-asterisk": h.hideAsterisk,
"content-flex": h.contentFlex,
feedback: h.feedback,
field: h.field,
rules: h.rules
}), it({
default: y(() => [
c(n)[h.field] ? A(b.$slots, h.field, {
key: 0,
item: h,
size: b.option.size ?? c(l).size
}, void 0, !0) : (m(), B($t(h.component ? h.component : `a-${h.type || "input"}`), He({
key: 1,
style: { width: h.type === "switch" ? "" : "100%" },
size: b.option.size ?? c(l).size,
disabled: b.option.detail ?? h.disabled ?? !1,
modelValue: N(h),
"onUpdate:modelValue": (G) => te(h, G),
visibility: h.visibility,
"onUpdate:visibility": (G) => h.visibility = G,
ref_for: !0
}, Q(f, h), {
onChange: (G) => Y(G, h)
}), null, 16, ["style", "size", "disabled", "modelValue", "onUpdate:modelValue", "visibility", "onUpdate:visibility", "onChange"]))
]),
_: 2
}, [
c(n)[h.field + "Label"] ? {
name: "label",
fn: y(() => [
A(b.$slots, h.field + "Label", {}, void 0, !0)
]),
key: "0"
} : void 0,
c(n)[h.field + "Label"] ? void 0 : {
name: "label",
fn: y(() => [
de(ne(h.label) + " ", 1),
h.helpIconText ? (m(), B(E, {
key: 0,
content: h.helpIconText
}, {
default: y(() => [
P(C, {
size: b.option.size ?? c(l).size
}, null, 8, ["size"])
]),
_: 2
}, 1032, ["content"])) : V("", !0)
]),
key: "1"
},
c(n)[h.field + "Help"] || h.help ? {
name: "help",
fn: y(() => [
A(b.$slots, h.field + "Help", {}, void 0, !0),
Z("span", null, ne(h.help), 1)
]),
key: "2"
} : void 0,
c(n)[h.field + "Extra"] || h.extra ? {
name: "extra",
fn: y(() => [
A(b.$slots, h.field + "Extra", {}, void 0, !0),
Z("span", null, ne(h.extra), 1)
]),
key: "3"
} : void 0
]), 1040, ["label", "tooltip", "help", "extra", "label-component", "hide-label", "hide-asterisk", "content-flex", "feedback", "field", "rules"])
]),
_: 2
}, 1032, ["span", "offset", "order"])) : V("", !0)
], 64))), 128))
]),
_: 2
}, 1032, ["style"]))
], 64))), 256)),
!b.option.search && b.option.detail !== !0 ? (m(), B(O, {
key: 0,
class: mt({ formMenuContainer: b.option.menu ?? !b.option.detail ?? !0 })
}, {
default: y(() => [
b.option.menu ?? !b.option.detail ?? !0 ? (m(), B(U, {
key: 0,
order: 1e4,
span: b.option.menuSpan ?? 24,
style: Oe({
textAlign: b.option.menuAlign ?? "center"
})
}, {
default: y(() => [
c(n).menu ? A(b.$slots, "menu", {
key: 0,
size: b.option.size ?? c(l).size,
loading: r.submit
}, void 0, !0) : V("", !0),
P(X, { wrap: "" }, {
default: y(() => [
A(b.$slots, "menuLeft", {
size: b.option.size ?? c(l).size,
loading: r.submit
}, void 0, !0),
A(b.$slots, "suffix", {
loading: r.submit
}, () => [
b.option.menuBtn ?? b.option.submitBtn ?? !0 ? (m(), B(d, {
key: 0,
size: b.option.size ?? c(l).size,
type: "primary",
loading: r.submit,
"html-type": "submit"
}, {
default: y(() => [
de(ne(b.option.submitBtnText ?? c(l).submitBtnText), 1)
]),
_: 1
}, 8, ["size", "loading"])) : V("", !0),
b.option.menuBtn ?? b.option.resetBtn ?? !0 ? (m(), B(d, {
key: 1,
size: b.option.size ?? c(l).size,
onClick: T[1] || (T[1] = (g) => $())
}, {
default: y(() => [
de(ne(b.option.resetBtnText ?? c(l).resetBtnText), 1)
]),
_: 1
}, 8, ["size"])) : V("", !0)
], !0),
A(b.$slots, "menuright", {
size: b.option.size ?? c(l).size,
loading: r.submit
}, void 0, !0)
]),
_: 3
})
]),
_: 3
}, 8, ["span", "style"])) : V("", !0)
]),
_: 3
}, 8, ["class"])) : V("", !0)
]),
_: 3
}, 16, ["auto-label-width", "layout", "scrollToFirstError", "size", "label-align", "model"]);
};
}
}), tt = (e, o) => {
const t = e.__vccOpts || e;
for (const [n, a] of o)
t[n] = a;
return t;
}, Ao = /* @__PURE__ */ tt(pl, [["__scopeId", "data-v-66da9cf6"]]), cl = et(Ao), fl = /* @__PURE__ */ Se({
__name: "FormModel",
props: /* @__PURE__ */ Ve({
title: {
type: String,
default: ""
},
option: {
type: Object,
default: () => ({})
}
}, {
visible: {
default: !1
},
visibleModifiers: {}
}),
emits: ["update:visible"],
setup(e) {
const o = L({}), t = e, n = Pe(e, "visible"), a = ce(() => Object.assign({}, t.option, {}));
function i(l, s) {
s();
}
return (l, s) => {
const u = M("aFormPlus"), p = M("a-modal");
return m(), B(p, {
visible: n.value,
"onUpdate:visible": s[1] || (s[1] = (f) => n.value = f),
title: t.title,
footer: !1,
width: "60vw",
"render-to-body": !1,
"popup-container": "form-create-render"
}, {
default: y(() => [
P(u, {
modelValue: o.value,
"onUpdate:modelValue": s[0] || (s[0] = (f) => o.value = f),
option: a.value,
onSubmit: i
}, null, 8, ["modelValue", "option"])
]),
_: 1
}, 8, ["visible", "title"]);
};
}
}), hl = { style: { height: "60vh" } }, bl = /* @__PURE__ */ Se({
__name: "JsonModel",
props: /* @__PURE__ */ Ve({
title: {
type: String,
default: ""
},
type: {
type: String,
default: ""
},
option: {
type: Object,
default: () => ({})
}
}, {
visible: {
default: !1
},
visibleModifiers: {}
}),
emits: /* @__PURE__ */ Ve(["importJson"], ["update:visible"]),
setup(e, { emit: o }) {
const t = e;
gt(() => {
t.type === "export" && (i.value = t.option);
});
const n = o, a = ce(() => t.type === "export"), i = L({}), l = Pe(e, "visible");
function s() {
l.value = !1, n("importJson", i.value);
}
return (u, p) => {
const f = M("a-modal");
return m(), B(f, {
visible: l.value,
"onUpdate:visible": p[1] || (p[1] = (r) => l.value = r),
title: a.value ? "生成Json" : "导入Json",
footer: !a.value,
width: "60vw",
"hide-cancel": !0,
onOk: s,
"render-to-body": a.value,
"popup-container": "form-create-render"
}, {
default: y(() => [
Z("div", hl, [
P(c(Hn), {
style: { height: "60vh" },
modelValue: i.value,
"onUpdate:modelValue": p[0] || (p[0] = (r) => i.value = r)
}, null, 8, ["modelValue"])
])
]),
_: 1
}, 8, ["visible", "title", "footer", "render-to-body"]);
};
}
}), gl = [
{
label: "基础组件",
list: [
{
label: "输入框",
icon: "biaodanzujian-shurukuang",
type: "input"
},
{
label: "数字输入框",
icon: "shuzishurukuang",
type: "input-number"
},
{
label: "验证码",
icon: "shuzishurukuang",
type: "verification-code"
},
{
label: "标签输入框",
icon: "shuzishurukuang",
type: "input-tag"
},
{
label: "多行输入框",
icon: "duohangshurukuang",
type: "textarea"
},
{
label: "下拉框",
icon: "jilian",
type: "select"
},
{
label: "单选",
icon: "danxuankuang-xuanzhong",
type: "radio-group"
},
{
label: "评分",
icon: "pingfen",
type: "rate"
}
]
},
{
label: "时间组件",
list: [
{
label: "日期选择",
icon: "shijianxuanzeqi1",
type: "date-picker"
},
{
label: "日期范围",
icon: "shijianfanweixuanze",
type: "range-picker"
},
{
label: "时间选择",
icon: "shijianxuanzeqi1",
type: "time-picker"
},
{
label: "周",
icon: "shijianxuanzeqi1",
type: "week-picker"
},
{
label: "月份",
icon: "shijianxuanzeqi1",
type: "month-picker"
},
{
label: "年份",
icon: "shijianxuanzeqi1",
type: "year-picker"
},
{
label: "季度",
icon: "shijianxuanzeqi1",
type: "quarter-picker"
}
]
},
{
label: "高级组件",
list: [
{
label: "文件上传",
icon: "fujianshangchuan",
type: "upload"
},
{
label: "颜色选择器",
icon: "yansexuanzeqi",
type: "color-picker"
}
]
}
// {
// label:"时间范围",
// icon:'kaifazujian',
// type:"time-picker"
// },
// {
// label:"日期选择",
// icon:'kaifazujian',
// type:"date-picker"
// },
], ml = {
input: {
label: "输入框"
},
"verification-code": {
label: "验证码",
span: 24
},
"radio-group": {
dicData: [
{
label: "选项1",
value: "1"
},
{
label: "选项2",
value: "2"
}
]
}
};
function Qo(e) {
return ml[e] ?? {};
}
var vl = Object.defineProperty, so = Object.getOwnPropertySymbols, Cn = Object.prototype.hasOwnProperty, _n = Object.prototype.propertyIsEnumerable, en = (e, o, t) => o in e ? vl(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, ct = (e, o) => {
for (var t in o || (o = {}))
Cn.call(o, t) && en(e, t, o[t]);
if (so)
for (var t of so(o))
_n.call(o, t) && en(e, t, o[t]);
return e;
}, zn = (e, o) => {
var t = {};
for (var n in e)
Cn.call(e, n) && o.indexOf(n) < 0 && (t[n] = e[n]);
if (e != null && so)
for (var n of so(e))
o.indexOf(n) < 0 && _n.call(e, n) && (t[n] = e[n]);
return t;
};
function tn(e, o, t) {
return t >= 0 && t < e.length && e.splice(t, 0, e.splice(o, 1)[0]), e;
}
function yl(e) {
return e.replace(/-(\w)/g, (o, t) => t ? t.toUpperCase() : "");
}
function wl(e) {
return Object.keys(e).reduce((o, t) => (typeof e[t] < "u" && (o[yl(t)] = e[t]), o), {});
}
function on(e, o) {
return Array.isArray(e) && e.splice(o, 1), e;
}
function nn(e, o, t) {
return Array.isArray(e) && e.splice(o, 0, t), e;
}
function kl(e) {
return typeof e > "u";
}
function Cl(e) {
return typeof e == "string";
}
function ln(e, o, t) {
const n = e.children[t];
e.insertBefore(o, n);
}
function wo(e) {
e.parentNode && e.parentNode.removeChild(e);
}
function _l(e, o = document) {
var t;
let n = null;
return typeof (o == null ? void 0 : o.querySelector) == "function" ? n = (t = o == null ? void 0 : o.querySelector) == null ? void 0 : t.call(o, e) : n = document.querySelector(e), n || (`${e}`, void 0), n;
}
function zl(e, o, t = null) {
return function(...n) {
return e.apply(t, n), o.apply(t, n);
};
}
function Sl(e, o) {
const t = ct({}, e);
return Object.keys(o).forEach((n) => {
t[n] ? t[n] = zl(e[n], o[n]) : t[n] = o[n];
}), t;
}
function Tl(e) {
return e instanceof HTMLElement;
}
function an(e, o) {
Object.keys(e).forEach((t) => {
o(t, e[t]);
});
}
function Dl(e) {
return e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && // uppercase letter
(e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97);
}
const El = Object.assign;
/**!
* Sortable 1.15.2
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
function rn(e, o) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
o && (n = n.filter(function(a) {
return Object.getOwnPropertyDescriptor(e, a).enumerable;
})), t.push.apply(t, n);
}
return t;
}
function Fe(e) {
for (var o = 1; o < arguments.length; o++) {
var t = arguments[o] != null ? arguments[o] : {};
o % 2 ? rn(Object(t), !0).forEach(function(n) {
xl(e, n, t[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : rn(Object(t)).forEach(function(n) {
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n));
});
}
return e;
}
function oo(e) {
"@babel/helpers - typeof";
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? oo = function(o) {
return typeof o;
} : oo = function(o) {
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, oo(e);
}
function xl(e, o, t) {
return o in e ? Object.defineProperty(e, o, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[o] = t, e;
}
function Xe() {
return Xe = Object.assign || function(e) {
for (var o = 1; o < arguments.length; o++) {
var t = arguments[o];
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}
return e;
}, Xe.apply(this, arguments);
}
function Ol(e, o) {
if (e == null)
return {};
var t = {}, n = Object.keys(e), a, i;
for (i = 0; i < n.length; i++)
a = n[i], !(o.indexOf(a) >= 0) && (t[a] = e[a]);
return t;
}
function Vl(e, o) {
if (e == null)
return {};
var t = Ol(e, o), n, a;
if (Object.getOwnPropertySymbols) {
var i = Object.getOwnPropertySymbols(e);
for (a = 0; a < i.length; a++)
n = i[a], !(o.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (t[n] = e[n]);
}
return t;
}
var Bl = "1.15.2";
function Ue(e) {
if (typeof window < "u" && window.navigator)
return !!/* @__PURE__ */ navigator.userAgent.match(e);
}
var Ge = Ue(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), At = Ue(/Edge/i), sn = Ue(/firefox/i), xt = Ue(/safari/i) && !Ue(/chrome/i) && !Ue(/android/i), Sn = Ue(/iP(ad|od|hone)/i), Tn = Ue(/chrome/i) && Ue(/android/i), Dn = {
capture: !1,
passive: !1
};
function oe(e, o, t) {
e.addEventListener(o, t, !Ge && Dn);
}
function ee(e, o, t) {
e.removeEventListener(o, t, !Ge && Dn);
}
function uo(e, o) {
if (o) {
if (o[0] === ">" && (o = o.substring(1)), e)
try {
if (e.matches)
return e.matches(o);
if (e.msMatchesSelector)
return e.msMatchesSelector(o);
if (e.webkitMatchesSelector)
return e.webkitMatchesSelector(o);
} catch {
return !1;
}
return !1;
}
}
function Ml(e) {
return e.host && e !== document && e.host.nodeType ? e.host : e.parentNode;
}
function Ie(e, o, t, n) {
if (e) {
t = t || document;
do {
if (o != null && (o[0] === ">" ? e.parentNode === t && uo(e, o) : uo(e, o)) || n && e === t)
return e;
if (e === t)
break;
} while (e = Ml(e));
}
return null;
}
var un = /\s+/g;
function Te(e, o, t) {
if (e && o)
if (e.classList)
e.classList[t ? "add" : "remove"](o);
else {
var n = (" " + e.className + " ").replace(un, " ").replace(" " + o + " ", " ");
e.className = (n + (t ? " " + o : "")).replace(un, " ");
}
}
function j(e, o, t) {
var n = e && e.style;
if (n) {
if (t === void 0)
return document.defaultView && document.defaultView.getComputedStyle ? t = document.defaultView.getComputedStyle(e, "") : e.currentStyle && (t = e.currentStyle), o === void 0 ? t : t[o];
!(o in n) && o.indexOf("webkit") === -1 && (o = "-webkit-" + o), n[o] = t + (typeof t == "string" ? "" : "px");
}
}
function ht(e, o) {
var t = "";
if (typeof e == "string")
t = e;
else
do {
var n = j(e, "transform");
n && n !== "none" && (t = n + " " + t);
} while (!o && (e = e.parentNode));
var a = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
return a && new a(t);
}
function En(e, o, t) {
if (e) {
var n = e.getElementsByTagName(o), a = 0, i = n.length;
if (t)
for (; a < i; a++)
t(n[a], a);
return n;
}
return [];
}
function Ne() {
var e = document.scrollingElement;
return e || document.documentElement;
}
function be(e, o, t, n, a) {
if (!(!e.getBoundingClientRect && e !== window)) {
var i, l, s, u, p, f, r;
if (e !== window && e.parentNode && e !== Ne() ? (i = e.getBoundingClientRect(), l = i.top, s = i.left, u = i.bottom, p = i.right, f = i.height, r = i.width) : (l = 0, s = 0, u = window.innerHeight, p = window.innerWidth, f = window.innerHeight, r = window.innerWidth), (o || t) && e !== window && (a = a || e.parentNode, !Ge))
do
if (a && a.getBoundingClientRect && (j(a, "transform") !== "none" || t && j(a, "position") !== "static")) {
var w = a.getBoundingClientRect();
l -= w.top + parseInt(j(a, "border-top-width")), s -= w.left + parseInt(j(a, "border-left-width")), u = l + i.height, p = s + i.width;
break;
}
while (a = a.parentNode);
if (n && e !== window) {
var k = ht(a || e), $ = k && k.a, z = k && k.d;
k && (l /= z, s /= $, r /= $, f /= z, u = l + f, p = s + r);
}
return {
top: l,
left: s,
bottom: u,
right: p,
width: r,
height: f
};
}
}
function dn(e, o, t) {
for (var n = Qe(e, !0), a = be(e)[o]; n; ) {
var i = be(n)[t], l = void 0;
if (l = a >= i, !l)
return n;
if (n === Ne())
break;
n = Qe(n, !1);
}
return !1;
}
function bt(e, o, t, n) {
for (var a = 0, i = 0, l = e.children; i < l.length; ) {
if (l[i].style.display !== "none" && l[i] !== F.ghost && (n || l[i] !== F.dragged) && Ie(l[i], t.draggable, e, !1)) {
if (a === o)
return l[i];
a++;
}
i++;
}
return null;
}
function Ro(e, o) {
for (var t = e.lastElementChild; t && (t === F.ghost || j(t, "display") === "none" || o && !uo(t, o)); )
t = t.previousElementSibling;
return t || null;
}
function xe(e, o) {
var t = 0;
if (!e || !e.parentNode)
return -1;
for (; e = e.previousElementSibling; )
e.nodeName.toUpperCase() !== "TEMPLATE" && e !== F.clone && (!o || uo(e, o)) && t++;
return t;
}
function pn(e) {
var o = 0, t = 0, n = Ne();
if (e)
do {
var a = ht(e), i = a.a, l = a.d;
o += e.scrollLeft * i, t += e.scrollTop * l;
} while (e !== n && (e = e.parentNode));
return [o, t];
}
function $l(e, o) {
for (var t in e)
if (e.hasOwnProperty(t)) {
for (var n in o)
if (o.hasOwnProperty(n) && o[n] === e[t][n])
return Number(t);
}
return -1;
}
function Qe(e, o) {
if (!e || !e.getBoundingClientRect)
return Ne();
var t = e, n = !1;
do
if (t.clientWidth < t.scrollWidth || t.clientHeight < t.scrollHeight) {
var a = j(t);
if (t.clientWidth < t.scrollWidth && (a.overflowX == "auto" || a.overflowX == "scroll") || t.clientHeight < t.scrollHeight && (a.overflowY == "auto" || a.overflowY == "scroll")) {
if (!t.getBoundingClientRect || t === document.body)
return Ne();
if (n || o)
return t;
n = !0;
}
}
while (t = t.parentNode);
return Ne();
}
function Il(e, o) {
if (e && o)
for (var t in o)
o.hasOwnProperty(t) && (e[t] = o[t]);
return e;
}
function ko(e, o) {
return Math.round(e.top) === Math.round(o.top) && Math.round(e.left) === Math.round(o.left) && Math.round(e.height) === Math.round(o.height) && Math.round(e.width) === Math.round(o.width);
}
var Ot;
function xn(e, o) {
return function() {
if (!Ot) {
var t = arguments, n = this;
t.length === 1 ? e.call(n, t[0]) : e.apply(n, t), Ot = setTimeout(function() {
Ot = void 0;
}, o);
}
};
}
function Pl() {
clearTimeout(Ot), Ot = void 0;
}
function On(e, o, t) {
e.scrollLeft += o, e.scrollTop += t;
}
function Vn(e) {
var o = window.Polymer, t = window.jQuery || window.Zepto;
return o && o.dom ? o.dom(e).cloneNode(!0) : t ? t(e).clone(!0)[0] : e.cloneNode(!0);
}
function Bn(e, o, t) {
var n = {};
return Array.from(e.children).forEach(function(a) {
var i, l, s, u;
if (!(!Ie(a, o.draggable, e, !1) || a.animated || a === t)) {
var p = be(a);
n.left = Math.min((i = n.left) !== null && i !== void 0 ? i : 1 / 0, p.left), n.top = Math.min((l = n.top) !== null && l !== void 0 ? l : 1 / 0, p.top), n.right = Math.max((s = n.right) !== null && s !== void 0 ? s : -1 / 0, p.right), n.bottom = Math.max((u = n.bottom) !== null && u !== void 0 ? u : -1 / 0, p.bottom);
}
}), n.width = n.right - n.left, n.height = n.bottom - n.top, n.x = n.left, n.y = n.top, n;
}
var Ee = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
function Al() {
var e = [], o;
return {
captureAnimationState: function() {
if (e = [], !!this.options.animation) {
var t = [].slice.call(this.el.children);
t.forEach(function(n) {
if (!(j(n, "display") === "none" || n === F.ghost)) {
e.push({
target: n,
rect: be(n)
});
var a = Fe({}, e[e.length - 1].rect);
if (n.thisAnimationDuration) {
var i = ht(n, !0);
i && (a.top -= i.f, a.left -= i.e);
}
n.fromRect = a;
}
});
}
},
addAnimationState: function(t) {
e.push(t);
},
removeAnimationState: function(t) {
e.splice($l(e, {
target: t
}), 1);
},
animateAll: function(t) {
var n = this;
if (!this.options.animation) {
clearTimeout(o), typeof t == "function" && t();
return;
}
var a = !1, i = 0;
e.forEach(function(l) {
var s = 0, u = l.target, p = u.fromRect, f = be(u), r = u.prevFromRect, w = u.prevToRect, k = l.rect, $ = ht(u, !0);
$ && (f.top -= $.f, f.left -= $.e), u.toRect = f, u.thisAnimationDuration && ko(r, f) && !ko(p, f) && // Make sure animatingRect is on line between toRect & fromRect
(k.top - f.top) / (k.left - f.left) === (p.top - f.top) / (p.left - f.left) && (s = Nl(k, r, w, n.options)), ko(f, p) || (u.prevFromRect = p, u.prevToRect = f, s || (s = n.options.animation), n.animate(u, k, f, s)), s && (a = !0, i = Math.max(i, s), clearTimeout(u.animationResetTimer), u.animationResetTimer = setTimeout(function() {
u.animationTime = 0, u.prevFromRect = null, u.fromRect = null, u.prevToRect = null, u.thisAnimationDuration = null;
}, s), u.thisAnimationDuration = s);
}), clearTimeout(o), a ? o = setTimeout(function() {
typeof t == "function" && t();
}, i) : typeof t == "function" && t(), e = [];
},
animate: function(t, n, a, i) {
if (i) {
j(t, "transition", ""), j(t, "transform", "");
var l = ht(this.el), s = l && l.a, u = l && l.d, p = (n.left - a.left) / (s || 1), f = (n.top - a.top) / (u || 1);
t.animatingX = !!p, t.animatingY = !!f, j(t, "transform", "translate3d(" + p + "px," + f + "px,0)"), this.forRepaintDummy = Rl(t), j(t, "transition", "transform " + i + "ms" + (this.options.easing ? " " + this.options.easing : "")), j(t, "transform", "translate3d(0,0,0)"), typeof t.animated == "number" && clearTimeout(t.animated), t.animated = setTimeout(function() {
j(t, "transition", ""), j(t, "transform", ""), t.animated = !1, t.animatingX = !1, t.animatingY = !1;
}, i);
}
}
};
}
function Rl(e) {
return e.offsetWidth;
}
function Nl(e, o, t, n) {
return Math.sqrt(Math.pow(o.top - e.top, 2) + Math.pow(o.left - e.left, 2)) / Math.sqrt(Math.pow(o.top - t.top, 2) + Math.pow(o.left - t.left, 2)) * n.animation;
}
var ut = [], Co = {
initializeByDefault: !0
}, Rt = {
mount: function(e) {
for (var o in Co)
Co.hasOwnProperty(o) && !(o in e) && (e[o] = Co[o]);
ut.forEach(function(t) {
if (t.pluginName === e.pluginName)
throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
}), ut.push(e);
},
pluginEvent: function(e, o, t) {
var n = this;
this.eventCanceled = !1, t.cancel = function() {
n.eventCanceled = !0;
};
var a = e + "Global";
ut.forEach(function(i) {
o[i.pluginName] && (o[i.pluginName][a] && o[i.pluginName][a](Fe({
sortable: o
}, t)), o.options[i.pluginName] && o[i.pluginName][e] && o[i.pluginName][e](Fe({
sortable: o
}, t)));
});
},
initializePlugins: function(e, o, t, n) {
ut.forEach(function(l) {
var s = l.pluginName;
if (!(!e.options[s] && !l.initializeByDefault)) {
var u = new l(e, o, e.options);
u.sortable = e, u.options = e.options, e[s] = u, Xe(t, u.defaults);
}
});
for (var a in e.options)
if (e.options.hasOwnProperty(a)) {
var i = this.modifyOption(e, a, e.options[a]);
typeof i < "u" && (e.options[a] = i);
}
},
getEventProperties: function(e, o) {
var t = {};
return ut.forEach(function(n) {
typeof n.eventProperties == "function" && Xe(t, n.eventProperties.call(o[n.pluginName], e));
}), t;
},
modifyOption: function(e, o, t) {
var n;
return ut.forEach(function(a) {
e[a.pluginName] && a.optionListeners && typeof a.optionListeners[o] == "function" && (n = a.optionListeners[o].call(e[a.pluginName], t));
}), n;
}
};
function jl(e) {
var o = e.sortable, t = e.rootEl, n = e.name, a = e.targetEl, i = e.cloneEl, l = e.toEl, s = e.fromEl, u = e.oldIndex, p = e.newIndex, f = e.oldDraggableIndex, r = e.newDraggableIndex, w = e.originalEvent, k = e.putSortable, $ = e.extraEventProperties;
if (o = o || t && t[Ee], !!o) {
var z, Y = o.options, N = "on" + n.charAt(0).toUpperCase() + n.substr(1);
window.CustomEvent && !Ge && !At ? z = new CustomEvent(n, {
bubbles: !0,
cancelable: !0
}) : (z = document.createEvent("Event"), z.initEvent(n, !0, !0)), z.to = l || t, z.from = s || t, z.item = a || t, z.clone = i, z.oldIndex = u, z.newIndex = p, z.oldDraggableIndex = f, z.newDraggableIndex = r, z.originalEvent = w, z.pullMode = k ? k.lastPutMode : void 0;
var te = Fe(Fe({}, $), Rt.getEventProperties(n, o));
for (var K in te)
z[K] = te[K];
t && t.dispatchEvent(z), Y[N] && Y[N].call(o, z);
}
}
var Fl = ["evt"], ze = function(e, o) {
var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = t.evt, a = Vl(t, Fl);
Rt.pluginEvent.bind(F)(e, o, Fe({
dragEl: _,
parentEl: ue,
ghostEl: W,
rootEl: re,
nextEl: at,
lastDownEl: no,
cloneEl: se,
cloneHidden: Ze,
dragStarted: St,
putSortable: ve,
activeSortable: F.active,
originalEvent: n,
oldIndex: ft,
oldDraggableIndex: Vt,
newIndex: De,
newDraggableIndex: Ke,
hideGhostForTarget: Pn,
unhideGhostForTarget: An,
cloneNowHidden: function() {
Ze = !0;
},
cloneNowShown: function() {
Ze = !1;
},
dispatchSortableEvent: function(i) {
ke({
sortable: o,
name: i,
originalEvent: n
});
}
}, a));
};
function ke(e) {
jl(Fe({
putSortable: ve,
cloneEl: se,
targetEl: _,
rootEl: re,
oldIndex: ft,
oldDraggableIndex: Vt,
newIndex: De,
newDraggableIndex: Ke
}, e));
}
var _, ue, W, re, at, no, se, Ze, ft, De, Vt, Ke, qt, ve, pt = !1, po = !1, co = [], nt, $e, _o, zo, cn, fn, St, dt, Bt, Mt = !1, Jt = !1, lo, we, So = [], Vo = !1, fo = [], mo = typeof document < "u", Kt = Sn, hn = At || Ge ? "cssFloat" : "float", Ll = mo && !Tn && !Sn && "draggable" in document.createElement("div"), Mn = function() {
if (mo) {
if (Ge)
return !1;
var e = document.createElement("x");
return e.style.cssText = "pointer-events:a