@form-create/vant
Version:
Vant 版本(移动端)低代码表单 | FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。
1,455 lines (1,454 loc) • 167 kB
JavaScript
/*!
* FormCreate 低代码表单渲染器
* @form-create/vant v3.3.0
* (c) 2018-2026 xaboy
* Github https://github.com/xaboy/form-create
* Site https://form-create.com/
* Released under the MIT License.
*/
(function(){"use strict";try{if(typeof document!="undefined"){var r=document.createElement("style");r.appendChild(document.createTextNode('.form-create-m{width:100%}.form-create-m.is-preview .fc-clock,.form-create-m .fc-none{display:none!important}.form-create-m .fc-form-item:after{content:" "!important;display:block!important}.form-create-m .fc-form-item .van-cell:not(.fc-form-item):after{display:none!important}.form-create-m .fc-form-item .van-cell:not(.fc-form-item){padding:0}.form-create-m .fc-form-item .fc-form-item{padding-left:0;padding-right:0;--van-padding-md: 0}.form-create-m .fc-reset-btn{margin-top:12px}.form-create-m .fc-form-title{display:inline-flex;align-items:center}.form-create-m.is-preview .van-field__label--required:before{display:none}._fc-m-group{display:flex;align-items:flex-end;min-height:38px;justify-content:center;flex-direction:column;width:100%}._fc-m-group-disabled ._fc-m-group-btn,._fc-m-group-disabled ._fc-m-group-add{cursor:not-allowed}._fc-m-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff;transform:scale(1.1)}._fc-m-group-btn{cursor:pointer}._fc-m-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-m-group-handle ._fc-m-group-btn+._fc-m-group-btn{margin-left:7px}._fc-m-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;border-radius:5px;margin-bottom:25px;padding:5px 5px 25px;width:100%;box-sizing:border-box}._fc-m-group-arrow{position:relative;width:20px;height:20px}._fc-m-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-m-group-arrow:before{transform:rotate(45deg)}._fc-m-group-arrow._fc-m-group-down{transform:rotate(180deg)}._fc-m-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-m-group-plus-minus:before,._fc-m-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-m-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-m-group-plus-minus._fc-m-group-minus:before{display:none}._fc-m-group-plus-minus._fc-m-group-minus:after{background-color:#f56c6c}._fc-m-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px;transform:scale(1.1)}._fc-m-group-add._fc-m-group-plus-minus:before,._fc-m-group-add._fc-m-group-plus-minus:after{width:50%}._fc-m-group._fc-m-group-card{display:flex;flex-direction:column;width:100%;gap:16px}._fc-m-group._fc-m-group-card._fc-m-group-disabled ._fc-m-group-btn,._fc-m-group._fc-m-group-card._fc-m-group-disabled ._fc-m-group-add{cursor:not-allowed;opacity:.5}._fc-m-group._fc-m-group-card ._fc-m-group-container{position:relative;background:#fff;border:1px solid #f0f0f0;border-radius:6px;overflow:hidden;display:flex;flex-direction:column;padding:0;margin:0}._fc-m-group._fc-m-group-card ._fc-m-group-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 12px;border-bottom:1px solid #f0f0f0;background:#fafafa}._fc-m-group._fc-m-group-card ._fc-m-group-idx{display:flex;align-items:center;justify-content:center;width:24px;height:24px;background:#f0f0f0;color:#666;border-radius:6px;font-size:12px;font-weight:500;margin-right:12px;flex-shrink:0;position:static;border:1px solid #e0e0e0}._fc-m-group._fc-m-group-card ._fc-m-group-title{flex:1;font-size:14px;font-weight:500;color:#000000d9;line-height:1.5715;text-align:left}._fc-m-group._fc-m-group-card ._fc-m-group-handle{display:flex;align-items:center;gap:4px;margin-left:12px;flex-shrink:0;position:static;bottom:auto;right:auto;border-radius:0;border:none;padding:0;background-color:transparent;flex-direction:row;transform:none}._fc-m-group._fc-m-group-card ._fc-m-group-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#00000073;position:relative}._fc-m-group._fc-m-group-card ._fc-m-group-btn:hover{color:#1890ff;border-color:#1890ff;background:#f0f8ff}._fc-m-group._fc-m-group-card ._fc-m-group-btn:active{color:#096dd9;border-color:#096dd9}._fc-m-group._fc-m-group-card ._fc-m-group-arrow{position:relative}._fc-m-group._fc-m-group-card ._fc-m-group-arrow:before{content:"";position:absolute;top:50%;left:50%;width:5px;height:5px;border-left:1px solid currentColor;border-top:1px solid currentColor;transform:translate(-50%,-50%) rotate(45deg)}._fc-m-group._fc-m-group-card ._fc-m-group-arrow._fc-m-group-down{transform:rotate(180deg)}._fc-m-group._fc-m-group-card ._fc-m-group-sort{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;height:24px}._fc-m-group._fc-m-group-card ._fc-m-group-sort:before,._fc-m-group._fc-m-group-card ._fc-m-group-sort:after{content:"";position:absolute;left:50%;width:4px;height:4px;border-left:1px solid currentColor;border-top:1px solid currentColor;transform:translate(-50%)}._fc-m-group._fc-m-group-card ._fc-m-group-sort:before{top:6px;transform:translate(-50%) rotate(45deg)}._fc-m-group._fc-m-group-card ._fc-m-group-sort:after{bottom:6px;transform:translate(-50%) rotate(225deg)}._fc-m-group._fc-m-group-card ._fc-m-group-sort-up,._fc-m-group._fc-m-group-card ._fc-m-group-sort-down{position:absolute;left:0;right:0;height:12px;cursor:pointer;z-index:1}._fc-m-group._fc-m-group-card ._fc-m-group-sort-up{top:0}._fc-m-group._fc-m-group-card ._fc-m-group-sort-down{bottom:0}._fc-m-group._fc-m-group-card ._fc-m-group-sort-up:hover,._fc-m-group._fc-m-group-card ._fc-m-group-sort-down:hover{background:#1890ff1a}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus{position:relative;background:#409eff;border-color:#409eff;color:#fff;width:24px;height:24px;border-radius:4px}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:before,._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:8px;height:1px;background-color:currentColor;transform:translate(-50%,-50%)}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus._fc-m-group-minus{background:#f56c6c;border-color:#f56c6c}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus._fc-m-group-minus:hover{background:#f78989;border-color:#f78989}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus._fc-m-group-minus:before{display:none}._fc-m-group._fc-m-group-card ._fc-m-group-content{padding:20px}._fc-m-group._fc-m-group-card ._fc-m-group-add{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#00000073;position:relative;transform:none}._fc-m-group._fc-m-group-card ._fc-m-group-add:hover{color:#409eff;border-color:#409eff;background:#f0f8ff}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus{width:24px;height:24px;background:#409eff;border-color:#409eff;color:#fff}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:before,._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:8px;height:1px;background-color:currentColor;transform:translate(-50%,-50%)}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-m-group._fc-m-group-card ._fc-m-group-empty{text-align:center;padding:40px 20px;color:#00000073;font-size:14px}@media (max-width: 768px){._fc-m-group._fc-m-group-card ._fc-m-group-container{margin:0 -8px;border-radius:0;border-left:none;border-right:none}._fc-m-group._fc-m-group-card ._fc-m-group-header{padding:12px 16px 8px}._fc-m-group._fc-m-group-card ._fc-m-group-content{padding:16px}._fc-m-group._fc-m-group-card ._fc-m-group-handle{gap:2px}._fc-m-group._fc-m-group-card ._fc-m-group-btn{width:22px;height:22px}}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
var ir = Object.defineProperty, sr = Object.defineProperties;
var or = Object.getOwnPropertyDescriptors;
var ot = Object.getOwnPropertySymbols;
var ar = Object.prototype.hasOwnProperty, lr = Object.prototype.propertyIsEnumerable;
var at = (t, e, r) => e in t ? ir(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, v = (t, e) => {
for (var r in e || (e = {}))
ar.call(e, r) && at(t, r, e[r]);
if (ot)
for (var r of ot(e))
lr.call(e, r) && at(t, r, e[r]);
return t;
}, x = (t, e) => sr(t, or(e));
import { defineComponent as W, createVNode as _, nextTick as j, markRaw as ae, reactive as Y, resolveComponent as k, mergeProps as z, ref as ne, toRef as P, watch as B, computed as q, isVNode as Xe, openBlock as ur, createElementBlock as fr, createElementVNode as cr, getCurrentInstance as He, provide as dr, inject as hr, toRefs as lt, onBeforeMount as pr, watchEffect as mr, onMounted as gr, onBeforeUnmount as yr, onUpdated as br, withDirectives as $r, resolveDirective as vr, createApp as _r, h as Cr } from "vue";
import ve from "dayjs";
import { showNotify as wr, Field as ut } from "vant";
const Sr = "fcSubForm", Vr = /* @__PURE__ */ W({
name: Sr,
props: {
rule: Array,
options: {
type: Object,
default: () => Y({
submitBtn: !1,
resetBtn: !1
})
},
modelValue: {
type: Object,
default: () => ({})
},
disabled: {
type: Boolean,
default: !1
},
syncDisabled: {
type: Boolean,
default: !0
},
formCreateInject: Object
},
data() {
return {
cacheValue: {},
subApi: {},
form: ae(this.formCreateInject.form.$form())
};
},
emits: ["fc:subform", "update:modelValue", "change", "itemMounted"],
watch: {
modelValue(t) {
this.setValue(t);
}
},
methods: {
formData(t) {
this.cacheValue = JSON.stringify(t), this.$emit("update:modelValue", t), this.$emit("change", t);
},
setValue(t) {
const e = JSON.stringify(t);
this.cacheValue !== e && (this.cacheValue = e, this.subApi.coverValue(t || {}));
},
add$f(t) {
this.subApi = t, j(() => {
this.$emit("itemMounted", t);
});
}
},
render() {
const t = this.form;
return _(t, {
disabled: this.disabled,
"onUpdate:modelValue": this.formData,
modelValue: this.modelValue,
"onUpdate:api": this.add$f,
rule: this.rule,
option: this.options,
extendOption: !0
}, null);
}
}), m = {
type(t, e) {
return Object.prototype.toString.call(t) === "[object " + e + "]";
},
Undef(t) {
return t == null;
},
Element(t) {
return typeof t == "object" && t !== null && t.nodeType === 1 && !m.Object(t);
},
trueArray(t) {
return Array.isArray(t) && t.length > 0;
},
Function(t) {
const e = this.getType(t);
return e === "Function" || e === "AsyncFunction";
},
getType(t) {
const e = Object.prototype.toString.call(t);
return /^\[object (.*)\]$/.exec(e)[1];
},
empty(t) {
return t == null || Array.isArray(t) && Array.isArray(t) && !t.length ? !0 : typeof t == "string" && !t;
}
};
["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((t) => {
m[t] = function(e) {
return m.type(e, t);
};
});
function E(t, e) {
return {}.hasOwnProperty.call(t, e);
}
const Or = "fcCalendar", Fr = /* @__PURE__ */ W({
name: Or,
inheritAttrs: !1,
props: {
placeholder: String,
formCreateInject: Object,
disabled: Boolean,
clearable: Boolean,
type: String,
modelValue: [String, Array],
minDate: [String, Date],
maxDate: [String, Date]
},
emits: ["update:modelValue", "change", "fc.el"],
setup(t, e) {
const r = ne(!1), n = P(t, "modelValue"), s = P(t, "formCreateInject"), i = ne(n.value);
B(() => n.value, (d) => {
i.value = d;
});
const o = (d) => ve(d).format("YYYY-MM-DD"), a = (d) => ve(d).toDate(), l = q(() => {
const d = n.value;
return Array.isArray(d) ? d.map(a) : d ? a(d) : null;
}), u = q(() => ({
minDate: t.minDate ? ve(t.minDate).toDate() : void 0,
maxDate: t.maxDate ? ve(t.maxDate).toDate() : void 0
})), f = (d) => {
Array.isArray(d) ? i.value = d.map(o) : d ? i.value = o(d) : i.value = d;
}, h = () => {
e.emit("update:modelValue", i.value), e.emit("change", i.value);
}, p = {
range() {
return i.value.length ? i.value.join(" - ") : "";
},
multiple() {
return i.value.length ? s.value.t("selectedData", {
length: i.value.length
}) || `选择了 ${i.value.length} 个日期` : "";
}
};
return {
show: r,
inputValue: i,
defaultDate: l,
dateRange: u,
open() {
t.disabled || (r.value = !0);
},
confirm(d) {
f(d), r.value = !1, h();
},
getStrValue() {
return i.value ? E(p, t.type) ? p[t.type]() : i.value || "" : "";
},
clear(d) {
d.stopPropagation();
const $ = Array.isArray(i.value) ? [] : "";
f($), h();
}
};
},
render() {
const t = () => this.$props.clearable && !m.empty(this.inputValue) ? _("i", {
class: "van-badge__wrapper van-icon van-icon-clear van-field__clear",
onClick: this.clear
}, null) : void 0;
return _("div", {
class: "_fc-calendar"
}, [_(k("van-field"), {
ref: "el",
placeholder: this.placeholder,
readonly: !0,
disabled: this.$props.disabled,
onClick: this.open,
"model-value": this.getStrValue(),
isLink: !0,
border: !1
}, {
"right-icon": t
}), _(k("van-calendar"), z(v(v({}, this.$attrs), this.dateRange), {
show: this.show,
"onUpdate:show": (e) => this.show = e,
type: this.type,
onConfirm: this.confirm,
defaultDate: this.defaultDate
}), null)]);
},
mounted() {
this.$emit("fc.el", this.$refs.el);
}
}), Ye = (t) => !t || !Array.isArray(t) ? [] : t.map((e) => {
const r = v({}, e);
return r.label !== void 0 && r.text === void 0 && (r.text = r.label), r.children && Array.isArray(r.children) && (r.children = Ye(r.children)), r;
}), Dr = "fcCascader", Er = /* @__PURE__ */ W({
name: Dr,
inheritAttrs: !1,
props: {
placeholder: String,
disabled: Boolean,
clearable: Boolean,
fieldNames: Object,
modelValue: [String, Number],
options: Array,
minDate: [String, Date],
maxDate: [String, Date]
},
emits: ["update:modelValue", "fc.el", "change"],
setup(t, e) {
const r = ne(!1), n = P(t, "modelValue"), s = P(t, "fieldNames", {}), i = q(() => {
var f;
return (f = s == null ? void 0 : s.value) != null && f.text ? t.options || [] : Ye(t.options || []);
}), o = (f, h, p) => {
for (let d = 0; d < f.length; d++) {
if (f[d][s.value.value || "value"] === h)
return [...p, f[d]];
if (f[d][s.value.children || "children"]) {
const $ = o(f[d][s.value.children || "children"], h, [...p, f[d]]);
if ($)
return $;
}
}
}, a = (f) => {
if (f == null || f === "")
return "";
const h = o(i.value, f, []);
return h ? h.map((p) => p[s.value.text || "text"]).join(" / ") : f;
}, l = ne(a(n.value));
B(() => n.value, (f) => {
l.value = a(f);
}), B(() => i.value, () => {
n.value != null && n.value !== "" && (l.value = a(n.value));
}, {
deep: !0
});
const u = (f) => {
e.emit("update:modelValue", f), e.emit("change", f);
};
return {
show: r,
inputValue: l,
options: i,
open() {
t.disabled || (r.value = !0);
},
confirm({
selectedOptions: f,
value: h
}) {
l.value = f.map((p) => p[s.value.text || "text"]).join(" / "), r.value = !1, u(h);
},
clear(f) {
f.stopPropagation(), l.value = "", u("");
}
};
},
render() {
const t = () => this.$props.clearable && this.inputValue ? _("i", {
class: "van-badge__wrapper van-icon van-icon-clear van-field__clear",
onClick: this.clear
}, null) : void 0;
return _("div", {
class: "_fc-cascader"
}, [_(k("van-field"), {
ref: "el",
placeholder: this.placeholder,
readonly: !0,
disabled: this.$props.disabled,
onClick: this.open,
"model-value": this.inputValue,
border: !1,
isLink: !0
}, {
"right-icon": t
}), _(k("van-popup"), {
show: this.show,
"onUpdate:show": (e) => this.show = e,
round: !0,
position: "bottom"
}, {
default: () => [_(k("van-cascader"), z(this.$attrs, {
modelValue: this.modelValue,
fieldNames: this.fieldNames,
options: this.options,
onClose: () => this.show = !1,
onFinish: this.confirm
}), null)]
})]);
},
mounted() {
this.$emit("fc.el", this.$refs.el);
}
});
function Rr(t) {
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Xe(t);
}
const Ar = "fcCheckbox", jr = /* @__PURE__ */ W({
name: Ar,
inheritAttrs: !1,
props: {
modelValue: Array,
options: Array
},
emits: ["update:modelValue", "change"],
setup(t, e) {
const r = P(t, "modelValue", []);
return {
options: P(t, "options"),
modelValue: r,
onInput(s) {
e.emit("update:modelValue", s), e.emit("change", s);
}
};
},
render() {
let t;
return _(k("van-checkbox-group"), z({
direction: "horizontal"
}, this.$attrs, {
modelValue: Array.isArray(this.modelValue) ? this.modelValue : [],
"onUpdate:modelValue": this.onInput
}), Rr(t = (this.options || []).map((e) => {
const r = v({}, e), {
text: n,
value: s
} = e;
return delete r.text, delete r.value, _(k("van-checkbox"), z({
name: s,
shape: "square"
}, r), {
default: () => [n || e.label || s]
});
})) ? t : {
default: () => [t]
});
}
}), kr = "fcSelect", Pr = /* @__PURE__ */ W({
name: kr,
inheritAttrs: !1,
props: {
disabled: Boolean,
placeholder: String,
columnsFieldNames: Object,
modelValue: [String, Number, Boolean],
options: Array
},
emits: ["update:modelValue", "fc.el", "change"],
setup(t, e) {
const r = ne(!1), n = P(t, "modelValue"), s = P(t, "columnsFieldNames", {}), i = q(() => {
var l;
return (l = s == null ? void 0 : s.value) != null && l.text ? t.options || [] : Ye(t.options || []);
}), o = q(() => {
if (n.value == null || n.value === "")
return "";
for (let l = 0; l < (i.value || []).length; l++)
if (i.value[l][s.value.value || "value"] === n.value)
return i.value[l][s.value.text || "text"];
return n.value;
}), a = (l) => {
e.emit("update:modelValue", l), e.emit("change", l);
};
return {
show: r,
inputValue: o,
options: i,
open() {
t.disabled || (r.value = !0);
},
confirm({
selectedValues: l
}) {
a(l[0]), r.value = !1;
}
};
},
render() {
return _("div", {
class: "_fc-select"
}, [_(k("van-field"), {
ref: "el",
placeholder: this.placeholder,
readonly: !0,
disabled: this.$props.disabled,
onClick: this.open,
"model-value": this.inputValue,
isLink: !0
}, null), _(k("van-popup"), {
show: this.show,
"onUpdate:show": (t) => this.show = t,
round: !0,
position: "bottom"
}, {
default: () => [_(k("van-picker"), z(this.$attrs, {
modelValue: [this.modelValue],
columnsFieldNames: this.columnsFieldNames,
columns: this.options,
onCancel: () => this.show = !1,
onConfirm: this.confirm
}), null)]
})]);
},
mounted() {
this.$emit("fc.el", this.$refs.el);
}
});
function be(t) {
return Array.isArray(t) ? t : [null, void 0, ""].indexOf(t) > -1 ? [] : [t];
}
const Ir = "fcUploader";
function ft(t, e) {
return typeof t == "object" ? t : {
url: t,
is_string: !0,
name: Br(t),
uid: e
};
}
function ct(t) {
return x(v({}, t), {
file: t,
value: t
});
}
function Br(t) {
return ("" + t).split("/").pop();
}
const Nr = /* @__PURE__ */ W({
name: Ir,
inheritAttrs: !1,
props: {
formCreateInject: Object,
modelValue: [Array, String, Object],
afterRead: Function,
action: String,
headers: Object,
method: String,
data: Object,
uploadName: String,
onSuccess: Function,
onError: Function,
maxCount: Number
},
emits: ["update:modelValue", "delete"],
setup(t, e) {
const r = P(t, "afterRead"), n = P(t, "modelValue", []), s = ne(be(n.value).map(ft).map(ct));
B(() => n.value, (a) => {
s.value = be(a).map(ft).map(ct);
});
const i = () => {
let a = s.value.map((l) => l.is_string ? l.url : l.value || l.url).filter((l) => l !== void 0);
e.emit("update:modelValue", t.maxCount === 1 ? a[0] || "" : a);
}, o = (a, l) => {
if (a.status = "uploading", r.value)
return r.value(a);
{
const u = v({}, t.data || {});
u[t.uploadName || "file"] = a.file, t.formCreateInject.api.fetch({
action: t.action,
dataType: "formData",
source: "upload",
headers: t.headers || {},
method: t.method || "post",
data: u
}).then((f) => {
a.status = "success", t.onSuccess && t.onSuccess(f, a), l(!0);
}).catch((f) => {
l(!1), a.status = "failed", a.message = t.formCreateInject.t("uploadFail") || "上传失败", t.onError && t.onError(f, a);
});
}
};
return {
fileList: s,
modelValue: n,
onDelete(a) {
i(), e.emit("delete", a);
},
uploadFiles(a) {
const l = Array.isArray(a) ? a : [a];
Promise.all(l.map((u) => new Promise((f) => {
o(u, f);
}))).then((u) => {
u.filter((f) => !!f).length > 0 && i();
});
},
uploadFile: o
};
},
render() {
return _(k("van-uploader"), z(this.$attrs, {
"model-value": this.fileList,
maxCount: this.maxCount,
"onUpdate:model-value": (t) => this.fileList = t,
afterRead: this.uploadFiles,
onDelete: this.onDelete
}), this.$slots);
}
});
function Tr(t) {
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Xe(t);
}
const Lr = "fcRadio", Mr = /* @__PURE__ */ W({
name: Lr,
inheritAttrs: !1,
props: {
modelValue: [String, Number, Boolean],
options: Array
},
emits: ["update:modelValue", "change"],
setup(t, e) {
const r = P(t, "modelValue", []);
return {
options: P(t, "options"),
modelValue: r,
onInput(s) {
e.emit("update:modelValue", s), e.emit("change", s);
}
};
},
render() {
let t;
return _(k("van-radio-group"), z({
direction: "horizontal"
}, this.$attrs, {
modelValue: this.modelValue,
"onUpdate:modelValue": this.onInput
}), Tr(t = (this.options || []).map((e) => {
const r = v({}, e), {
text: n,
value: s
} = e;
return delete r.text, delete r.value, _(k("van-radio"), z({
name: s
}, r), {
default: () => [n || e.label || s]
});
})) ? t : {
default: () => [t]
});
}
}), Ur = "fcDatePicker", qr = /* @__PURE__ */ W({
name: Ur,
inheritAttrs: !1,
props: {
disabled: Boolean,
clearable: Boolean,
placeholder: String,
modelValue: [String, Number],
minDate: [String, Date],
maxDate: [String, Date]
},
emits: ["update:modelValue", "fc.el", "change"],
setup(t, e) {
const r = ne(!1), n = P(t, "modelValue"), s = q(() => n.value == null || n.value === "" ? [] : n.value.split("-")), i = q(() => ({
minDate: t.minDate ? ve(t.minDate).toDate() : void 0,
maxDate: t.maxDate ? ve(t.maxDate).toDate() : void 0
})), o = (a) => {
e.emit("update:modelValue", a), e.emit("change", a);
};
return {
show: r,
formValue: s,
dateRange: i,
open() {
t.disabled || (r.value = !0);
},
confirm({
selectedValues: a
}) {
o(a.join("-")), r.value = !1;
},
clear(a) {
a.stopPropagation(), o("");
}
};
},
render() {
const t = () => this.$props.clearable && this.modelValue ? _("i", {
class: "van-badge__wrapper van-icon van-icon-clear van-field__clear",
onClick: this.clear
}, null) : void 0;
return _("div", {
class: "_fc-date-picker"
}, [_(k("van-field"), {
ref: "el",
placeholder: this.placeholder,
readonly: !0,
disabled: this.$props.disabled,
onClick: this.open,
"model-value": this.modelValue,
border: !1,
isLink: !0
}, {
"right-icon": t
}), _(k("van-popup"), {
show: this.show,
"onUpdate:show": (e) => this.show = e,
round: !0,
position: "bottom"
}, {
default: () => [_(k("van-date-picker"), z({
columnsType: ["year", "month", "day"]
}, v(v({}, this.$attrs), this.dateRange), {
modelValue: this.formValue,
onConfirm: this.confirm,
onCancel: () => this.show = !1
}), null)]
})]);
},
mounted() {
this.$emit("fc.el", this.$refs.el);
}
}), Gr = "fcTimePicker", xr = /* @__PURE__ */ W({
name: Gr,
inheritAttrs: !1,
props: {
disabled: Boolean,
clearable: Boolean,
placeholder: String,
modelValue: [String, Number]
},
emits: ["update:modelValue", "fc.el", "change"],
setup(t, e) {
const r = ne(!1), n = P(t, "modelValue"), s = q(() => n.value == null || n.value === "" ? [] : n.value.split(":")), i = (o) => {
e.emit("update:modelValue", o), e.emit("change", o);
};
return {
show: r,
formValue: s,
open() {
t.disabled || (r.value = !0);
},
confirm({
selectedValues: o
}) {
i(o.join(":")), r.value = !1;
},
clear(o) {
o.stopPropagation(), i("");
}
};
},
render() {
const t = () => this.$props.clearable && this.modelValue ? _("i", {
class: "van-badge__wrapper van-icon van-icon-clear van-field__clear",
onClick: this.clear
}, null) : void 0;
return _("div", {
class: "_fc-time-picker"
}, [_(k("van-field"), {
ref: "el",
placeholder: this.placeholder,
readonly: !0,
disabled: this.$props.disabled,
onClick: this.open,
"model-value": this.modelValue,
border: !1,
isLink: !0
}, {
"right-icon": t
}), _(k("van-popup"), {
show: this.show,
"onUpdate:show": (e) => this.show = e,
round: !0,
position: "bottom"
}, {
default: () => [_(k("van-time-picker"), z({
columnsType: ["hour", "minute"]
}, this.$attrs, {
modelValue: this.formValue,
onConfirm: this.confirm,
onCancel: () => this.show = !1
}), null)]
})]);
},
mounted() {
this.$emit("fc.el", this.$refs.el);
}
});
function J(t, e, r) {
t[e] = r;
}
function ge(t, e) {
delete t[e];
}
function Oe(t, e = {}, r) {
let n = !1;
for (let s in e)
if (Object.prototype.hasOwnProperty.call(e, s)) {
let i = e[s];
if ((n = Array.isArray(i)) || m.Object(i)) {
let o = t[s] === void 0;
if (n)
n = !1, o && J(t, s, []);
else if (i._clone && r !== void 0)
if (r)
i = i.getRule(), o && J(t, s, {});
else {
J(t, s, i._clone());
continue;
}
else
o && J(t, s, {});
t[s] = Oe(t[s], i, r);
} else
J(t, s, i), m.Undef(i) || (m.Undef(i.__json) || (t[s].__json = i.__json), m.Undef(i.__origin) || (t[s].__origin = i.__origin));
}
return r !== void 0 && Array.isArray(t) ? t.filter((s) => !s || !s.__ctrl) : t;
}
function Z(t) {
return Oe({}, { value: t }).value;
}
const Hr = Object.assign || function(t) {
for (let e, r = 1; r < arguments.length; r++)
for (let n in e = arguments[r], e)
Object.prototype.hasOwnProperty.call(e, n) && J(t, n, e[n]);
return t;
};
function C() {
return Hr.apply(this, arguments);
}
function Je(t) {
return typeof t != "object" || t === null ? t : t instanceof Array ? [...t] : v({}, t);
}
function le(t, e) {
var r = null;
return function(...n) {
r !== null && clearTimeout(r), r = setTimeout(() => t.call(this, ...n), e);
};
}
function Jr(t) {
return t == null ? "" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t);
}
function zr(t) {
return t && typeof t == "object" && typeof t.then == "function";
}
function Ie(t) {
return zr(t) ? t : Promise.resolve(t);
}
function Se(t) {
let e = t.replace(/([A-Z])/g, "-$1").toLocaleLowerCase();
return e.indexOf("-") === 0 && (e = e.substr(1)), e;
}
function Ot(t) {
return t.replace(t[0], t[0].toLocaleUpperCase());
}
function Ft(t, e, r) {
return `[form-create ${t}]: ${e}`;
}
function Ze(t, e) {
console.error(Ft("err", t));
}
function Wr(t) {
Ze(t.toString()), console.error(t);
}
const ze = "[[FORM-CREATE-PREFIX-", We = "-FORM-CREATE-SUFFIX]]";
function Ve(t, e) {
return JSON.stringify(Oe(Array.isArray(t) ? [] : {}, t, !0), function(r, n) {
if (!(n && n._isVue === !0)) {
if (typeof n != "function")
return n;
if (n.__json)
return n.__json;
if (n.__origin && (n = n.__origin), !n.__emit)
return ze + n + We;
}
}, e);
}
function Ue(t) {
return new Function("return " + t)();
}
function Q(t, e) {
if (t && m.String(t) && t.length > 4) {
let r = t.trim(), n = !1;
try {
if (r.indexOf(We) > 0 && r.indexOf(ze) === 0)
r = r.replace(We, "").replace(ze, ""), n = !0;
else if (r.indexOf("$FN:") === 0)
r = r.substring(4), n = !0;
else if (r.indexOf("$EXEC:") === 0)
r = r.substring(6), n = !0;
else if (r.indexOf("$GLOBAL:") === 0) {
const i = r.substring(8);
return r = function(...o) {
const a = o[0].api.getGlobalEvent(i);
if (a)
return a.call(this, ...o);
}, r.__json = t, r.__inject = !0, r;
} else {
if (r.indexOf("$FNX:") === 0)
return r = Ue(`function($inject){
` + r.substring(5) + `
}`), r.__json = t, r.__inject = !0, r;
(!e && r.indexOf("function ") === 0 && r !== "function " || !e && r.indexOf("function(") === 0 && r !== "function(") && (n = !0);
}
if (!n) return t;
let s;
try {
s = Ue(r);
} catch (i) {
s = Ue("function " + r);
}
return s.__json = t, s;
} catch (s) {
Ze(`解析失败:${r}
err: ${s}`);
return;
}
}
return t;
}
function Dt(t, e) {
return JSON.parse(t, function(r, n) {
return m.Undef(n) || !n.indexOf ? n : Q(n, e);
});
}
let Kr = 0;
function Be() {
const t = 370 + ++Kr;
return "F" + Math.random().toString(36).substr(3, 3) + (+`${Date.now()}`).toString(36) + t.toString(36) + "c";
}
function fe(t, e, r) {
let n = t, s;
return (e || "").split(".").forEach((i) => {
s && ((!n[s] || typeof n[s] != "object") && (n[s] = {}), n = n[s]), s = i;
}), n[s] = r, n;
}
const Xr = "fcGroup", Yr = /* @__PURE__ */ W({
name: Xr,
props: {
field: String,
rule: Array,
expand: Number,
options: Object,
button: {
type: Boolean,
default: !0
},
max: {
type: Number,
default: 0
},
min: {
type: Number,
default: 0
},
modelValue: {
type: Array,
default: () => []
},
defaultValue: Object,
sortBtn: {
type: Boolean,
default: !1
},
disabled: {
type: Boolean,
default: void 0
},
title: {
type: [String, Function],
default: null
},
type: {
type: String,
default: "default"
},
onBeforeRemove: {
type: Function,
default: () => {
}
},
onBeforeAdd: {
type: Function,
default: () => {
}
},
formCreateInject: Object,
parse: Function
},
data() {
return {
len: 0,
cacheRule: {},
cacheValue: {},
sort: [],
form: ae(this.formCreateInject.form.$form())
};
},
emits: ["update:modelValue", "change", "itemMounted", "remove", "add"],
watch: {
rule: {
handler(t, e) {
Object.keys(this.cacheRule).forEach((r) => {
const n = this.cacheRule[r];
if (n.$f) {
const s = n.$f.formData();
if (t === e)
n.$f.deferSyncValue(() => {
Oe(n.rule, t), n.$f.setValue(s);
}, !0);
else {
const i = n.$f.formData();
n.$f.once("reloading", () => {
n.$f.setValue(i);
}), n.rule = Z(t);
}
}
});
},
deep: !0
},
expand(t) {
let e = t - this.modelValue.length;
e > 0 && this.expandRule(e);
},
modelValue: {
handler(t) {
t = t || [];
let e = this.sort, r = e.length, n = r - t.length;
if (n < 0) {
for (let s = n; s < 0; s++)
this.addRule(t.length + s, !0);
for (let s = 0; s < r; s++)
this.setValue(e[s], t[s]);
} else {
if (n > 0)
for (let s = 0; s < n; s++)
this.removeRule(e[r - s - 1]);
t.forEach((s, i) => {
this.setValue(e[i], t[i]);
});
}
},
deep: !0
}
},
methods: {
_value(t) {
return t && E(t, this.field) ? t[this.field] : t;
},
cache(t, e) {
this.cacheValue[t] = JSON.stringify(e);
},
input(t) {
this.$emit("update:modelValue", t), this.$emit("change", t);
},
formData(t, e) {
const r = this.cacheRule, n = this.sort;
if (n.filter((i) => r[i] && r[i].$f).length !== n.length)
return;
const s = n.map((i) => {
const o = t === i ? e : v({}, this.cacheRule[i].$f.form), a = this.field ? m.Undef(o[this.field]) ? null : o[this.field] : o;
return this.cache(i, a), a;
});
this.input(s);
},
setValue(t, e) {
const r = this.field;
r && (e = {
[r]: this._value(e)
}), this.cacheValue[t] !== JSON.stringify(r ? e[r] : e) && (this.cacheRule[t].$f && this.cacheRule[t].$f.coverValue(e), this.cache(t, e));
},
addRule(t, e) {
const r = this.formCreateInject.form.copyRules(this.rule || []), n = this.options ? v({}, this.options) : {
submitBtn: !1,
resetBtn: !1
};
if (this.defaultValue) {
n.formData || (n.formData = {});
const s = Z(this.defaultValue);
C(n.formData, this.field ? {
[this.field]: s
} : s);
}
this.parse && this.parse({
rule: r,
options: n,
index: this.sort.length
}), this.cacheRule[++this.len] = {
rule: r,
options: n
}, this.sort = Object.keys(this.cacheRule), e && j(() => this.$emit("add", r, Object.keys(this.cacheRule).length - 1));
},
add$f(t, e, r) {
this.cacheRule[e].$f = r, j(() => {
this.$emit("itemMounted", r, Object.keys(this.cacheRule).indexOf(e));
});
},
removeRule(t, e) {
const r = Object.keys(this.cacheRule).indexOf(t);
delete this.cacheRule[t], delete this.cacheValue[t], this.sort = Object.keys(this.cacheRule), e && j(() => this.$emit("remove", r));
},
add(t) {
if (this.disabled || this.onBeforeAdd(this.modelValue) === !1)
return;
const e = [...this.modelValue];
e.push(this.defaultValue ? Z(this.defaultValue) : this.field ? null : {}), this.input(e);
},
del(t, e) {
if (this.disabled)
return;
const r = () => {
this.removeRule(e, !0);
const n = [...this.modelValue];
n.splice(t, 1), this.input(n);
};
Ie(this.onBeforeRemove(this.modelValue, t)).then((n) => {
n !== !1 && r();
});
},
addIcon(t) {
return _("div", {
class: "_fc-m-group-btn _fc-m-group-plus-minus",
onClick: this.add
}, null);
},
delIcon(t, e) {
return _("div", {
class: "_fc-m-group-btn _fc-m-group-plus-minus _fc-m-group-minus",
onClick: () => this.del(t, e)
}, null);
},
sortUpIcon(t) {
return _("div", {
class: "_fc-m-group-btn _fc-m-group-arrow _fc-m-group-up",
onClick: () => this.changeSort(t, -1)
}, null);
},
sortDownIcon(t) {
return _("div", {
class: "_fc-m-group-btn _fc-m-group-arrow _fc-m-group-down",
onClick: () => this.changeSort(t, 1)
}, null);
},
changeSort(t, e) {
const r = this.sort[t];
this.sort[t] = this.sort[t + e], this.sort[t + e] = r, this.formCreateInject.subForm(this.sort.map((n) => this.cacheRule[n].$f)), this.formData(0);
},
sortIcon(t, e) {
const r = t > 0, n = t < e - 1, s = [];
return !r && !n ? s : this.type === "card" && r && n ? (s.push(_("div", {
class: "_fc-group-btn _fc-group-sort"
}, [_("div", {
class: " _fc-group-sort-up",
onClick: () => this.changeSort(t, -1)
}, null), _("div", {
class: " _fc-group-sort-down",
onClick: () => this.changeSort(t, 1)
}, null)])), s) : (r && s.push(this.sortUpIcon(t)), n && s.push(this.sortDownIcon(t)), s);
},
makeIcon(t, e, r) {
if (this.$slots.button)
return this.$slots.button({
total: t,
index: e,
vm: this,
key: r,
del: () => this.del(e, r),
add: this.add
});
const n = [];
if ((!this.max || t < this.max) && t === e + 1 && n.push(this.addIcon(r)), t > this.min && n.push(this.delIcon(e, r)), this.sortBtn) {
const s = this.sortIcon(e, t);
s && n.push(...s);
}
return n;
},
expandRule(t) {
for (let e = 0; e < t; e++)
this.modelValue.push(this.field ? null : {});
this.input([...this.modelValue]);
},
getTitle(t, e) {
return typeof this.title == "function" ? this.title(t, this.modelValue[t], e) : typeof this.title == "string" ? this.title.replace("{index}", t + 1) : !1;
}
},
created() {
const t = (this.expand || 0) - this.modelValue.length;
for (let e = 0; e < this.modelValue.length; e++)
this.addRule(e);
t > 0 && this.expandRule(t);
},
render() {
const t = this.sort, e = this.button, r = this.form, n = this.disabled, s = this.type === "card", i = t.length === 0 ? this.$slots.default ? this.$slots.default({
vm: this,
add: this.add
}) : _("div", {
key: "a_def",
class: "_fc-m-group-plus-minus _fc-m-group-add fc-clock",
onClick: this.add
}, null) : t.map((o, a) => {
const {
rule: l,
options: u
} = this.cacheRule[o], f = e && !n ? this.makeIcon(t.length, a, o) : [], h = this.getTitle(a, o);
return s ? _("div", {
class: "_fc-m-group-container",
key: o
}, [_("div", {
class: "_fc-m-group-header"
}, [h === !1 ? _("div", {
class: "_fc-m-group-idx"
}, [a + 1]) : null, h !== !1 ? _("div", {
class: "_fc-m-group-title"
}, [h]) : null, _("div", {
class: "_fc-m-group-handle fc-clock"
}, [f.length ? f : null])]), _("div", {
class: "_fc-m-group-content"
}, [_(r, z({
key: o
}, {
disabled: n,
"onUpdate:modelValue": (p) => this.formData(o, p),
"onUpdate:api": (p) => this.add$f(a, o, p),
inFor: !0,
modelValue: this.field ? {
[this.field]: this._value(this.modelValue[a])
} : this.modelValue[a],
rule: l,
option: u,
extendOption: !0
}), null)])]) : _("div", {
class: "_fc-m-group-container",
key: o
}, [_(r, z({
key: o
}, {
disabled: n,
"onUpdate:modelValue": (p) => this.formData(o, p),
"onUpdate:api": (p) => this.add$f(a, o, p),
inFor: !0,
modelValue: this.field ? {
[this.field]: this._value(this.modelValue[a])
} : this.modelValue[a],
rule: l,
option: u,
extendOption: !0
}), null), _("div", {
class: "_fc-m-group-idx"
}, [a + 1]), f.length ? _("div", {
class: "_fc-m-group-handle fc-clock"
}, [f]) : null]);
});
return _("div", {
key: "con",
class: "_fc-m-group " + (n ? "_fc-m-group-disabled" : "") + (s ? " _fc-m-group-card" : "")
}, [i]);
}
}), Zr = (t, e) => {
const r = t.__vccOpts || t;
for (const [n, s] of e)
r[n] = s;
return r;
}, Qr = {
name: "IconWarning"
}, en = {
class: "icon",
viewBox: "0 0 1024 1024",
xmlns: "http://www.w3.org/2000/svg"
};
function tn(t, e, r, n, s, i) {
return ur(), fr("svg", en, [...e[0] || (e[0] = [
cr("path", {
fill: "currentColor",
d: "M512 64a448 448 0 110 896 448 448 0 010-896zm0 832a384 384 0 000-768 384 384 0 000 768zm48-176a48 48 0 11-96 0 48 48 0 0196 0zm-48-464a32 32 0 0132 32v288a32 32 0 01-64 0V288a32 32 0 0132-32z"
}, null, -1)
])]);
}
const rn = /* @__PURE__ */ Zr(Qr, [["render", tn]]), nn = [
Vr,
rn,
Fr,
Er,
jr,
Mr,
Pr,
qr,
xr,
Yr,
Nr
], Et = ["props"], Rt = ["class", "style", "directives"], At = ["on", "hook"], ue = (t, e = {}, r = {}) => {
const n = [...Et, ...r.normal || []], s = [...Rt, ...r.array || []], i = [...At, ...r.functional || []], o = r.props || [];
return t.reduce((a, l) => {
for (const u in l)
if (a[u])
if (o.indexOf(u) > -1)
a[u] = ue([l[u]], a[u]);
else if (n.indexOf(u) > -1)
a[u] = v(v({}, a[u]), l[u]);
else if (s.indexOf(u) > -1) {
const f = a[u] instanceof Array ? a[u] : [a[u]], h = l[u] instanceof Array ? l[u] : [l[u]];
a[u] = [...f, ...h];
} else if (i.indexOf(u) > -1)
for (const f in l[u])
if (a[u][f]) {
const h = a[u][f] instanceof Array ? a[u][f] : [a[u][f]], p = l[u][f] instanceof Array ? l[u][f] : [l[u][f]];
a[u][f] = [...h, ...p];
} else
a[u][f] = l[u][f];
else if (u === "hook")
for (let f in l[u])
a[u][f] ? a[u][f] = sn(a[u][f], l[u][f]) : a[u][f] = l[u][f];
else
a[u] = l[u];
else
n.indexOf(u) > -1 || i.indexOf(u) > -1 || o.indexOf(u) > -1 ? a[u] = v({}, l[u]) : s.indexOf(u) > -1 ? a[u] = l[u] instanceof Array ? [...l[u]] : typeof l[u] == "object" ? v({}, l[u]) : l[u] : a[u] = l[u];
return a;
}, e);
}, sn = (t, e) => function() {
t && t.apply(this, arguments), e && e.apply(this, arguments);
}, jt = ["type", "slot", "ignore", "emitPrefix", "value", "name", "native", "hidden", "display", "inject", "options", "emit", "link", "prefix", "suffix", "update", "sync", "optionsTo", "key", "slotUpdate", "computed", "preview", "component", "cache", "modelEmit"], Qe = ["validate", "children", "control"], et = ["effect", "deep", "renderSlots"];
function kt() {
return [...jt, ...Et, ...Rt, ...At, ...Qe, ...et];
}
function G(t) {
const e = t.replace(/(-[a-z])/g, function(r) {
return r.replace("-", "").toLocaleUpperCase();
});
return Pt(e);
}
function Pt(t) {
return t.replace(t[0], t[0].toLowerCase());
}
function Ke(t, e) {
return {
value: t,
enumerable: !1,
configurable: !1,
writable: !0
};
}
function It(t, e) {
return Bt([t], e || !1)[0];
}
function Bt(t, e) {
return Oe([], [...t], e || !1);
}
function re(t, e) {
return ue(Array.isArray(e) ? e : [e], t, { array: Qe, normal: et }), t;
}
function dt(t) {
const e = m.Function(t.getRule) ? t.getRule() : t;
return e.type || (e.type = "input"), e;
}
function on(t, e) {
return t ? (Object.keys(e || {}).forEach((r) => {
e[r] && (t[r] = re(t[r] || {}, e[r]));
}), t) : e;
}
function Nt(t, e) {
Object.defineProperties(t, Object.keys(e).reduce((r, n) => (r[n] = {
get() {
return e[n]();
}
}, r), {}));
}
function X(t) {
return t.__fc__ || (t.__origin__ ? t.__origin__.__fc__ : null);
}
function V(t, e) {
try {
e = t();
} catch (r) {
Wr(r);
}
return e;
}
function je() {
const t = {}, e = (r) => r || "default";
return {
setSlot(r, n) {
r = e(r), !(!n || Array.isArray(n) && n.length) && (t[r] || (t[r] = []), t[r].push(n));
},
getSlot(r, n) {
r = e(r);
const s = [];
return (t[r] || []).forEach((i) => {
if (Array.isArray(i))
s.push(...i);
else if (m.Function(i)) {
const o = i(...n || []);
Array.isArray(o) ? s.push(...o) : s.push(o);
} else m.Undef(i) || s.push(i);
}), s;
},
getSlots() {
const r = {};
return Object.keys(t).forEach((n) => {
r[n] = (...s) => this.getSlot(n, s);
}), r;
},
slotLen(r) {
return r = e(r), t[r] ? t[r].length : 0;
},
mergeBag(r) {
if (!r) return this;
const n = m.Function(r.getSlots) ? r.getSlots() : r;
return Array.isArray(r) || Xe(r) ? this.setSlot(void 0, () => r) : Object.keys(n).forEach((s) => {
this.setSlot(s, n[s]);
}), this;
}
};
}
function ht(t) {
const e = v({}, t.props || {});
return Object.keys(t.on || {}).forEach((r) => {
r.indexOf("-") > 0 && (r = G(r));
const n = `on${Ot(r)}`;
Array.isArray(e[n]) ? e[n] = [...e[n], t.on[r]] : e[n] ? e[n] = [e[n], t.on[r]] : e[n] = t.on[r];
}), e.key = t.key, e.ref = t.ref, e.class = t.class, e.id = t.id, e.style = t.style, e.slot && delete e.slot, e;
}
function ke(t, e) {
return Object.setPrototypeOf(t, e), t;
}
const pt = (t, e) => typeof t == "string" ? String(e) : typeof t == "number" ? Number(e) : e, ye = {
"==": (t, e) => JSON.stringify(t) === JSON.stringify(pt(t, e)),
"!=": (t, e) => !ye["=="](t, e),
">": (t, e) => t > e,
">=": (t, e) => t >= e,
"<": (t, e) => t < e,
"<=": (t, e) => t <= e,
on(t, e) {
return t && t.indexOf && t.indexOf(pt(t[0], e)) > -1;
},
notOn(t, e) {
return !ye.on(t, e);
},
in(t, e) {
return e && e.indexOf && e.indexOf(t) > -1;
},
notIn(t, e) {
return !ye.in(t, e);
},
between(t, e) {
return t > e[0] && t < e[1];
},
notBetween(t, e) {
return t < e[0] || t > e[1];
},
empty(t) {
return m.empty(t);
},
notEmpty(t) {
return !m.empty(t);
},
pattern(t, e) {
return new RegExp(e, "g").test(t);
}
};
function L(t, e) {
return (Array.isArray(e) ? e : (e || "").split(".")).forEach((r) => {
t != null && (t = t[r]);
}), t;
}
function an(t) {
const e = /{{\s*(.*?)\s*}}/g;
let r;
const n = {};
for (; (r = e.exec(t)) !== null; )
r[1] && (n[r[1]] = !0);
return Object.keys(n);
}
function mt(t) {
let e = t.split("."), r = [], n = "";
return e.forEach((s, i) => {
i === 0 ? n = s : n += "." + s, r.push(n);
}), r.join(" && ");
}
function Tt(t) {
const e = [];
let r = "", n = 0;
for (let s = 0; s < t.length; s++) {
const i = t[s];
i === "[" ? (n === 0 && r && (e.push({ type: "key", value: r }), r = ""), n++, r += i) : i === "]" ? (n--, r += i, n === 0 && (e.push({
type: "bracket",
value: Tt(r.slice(1, -1))
}), r = "")) : i === "." && n === 0 ? r && (e.push({ type: "key", value: r }), r = "") : r += i;
}
return r && e.push({ type: "key", value: r }), e.map((s) => s.type === "key" ? { key: s.value } : { children: s.value });
}
const Pe = (t, e) => {
if (!(!t || t === e)) {
if (t.props.formCreateInject)
return t.props.formCreateInject;
if (t.parent)
return Pe(t.parent, e);
}
};
function ln(t, e, r) {
return W({
name: "FormCreate" + (t.isMobile ? "Mobile" : ""),
components: e,
directives: r,
props: {
rule: {
type: Array,
required: !0,
default: () => []
},
option: {
type: Object,
default: () => ({})
},
extendOption: Boolean,
driver: [String, Object],
modelValue: Object,
disabled: {
type: Boolean,
default: void 0
},
preview: {
type: Boolean,
default: void 0
},
index: [String, Number],
api: Object,
locale: [String, Object],
t: Function,
name: String,
subForm: {
type: Boolean,
default: !0
},
inFor: Boolean
},
emits: ["update:api", "update:modelValue", "mounted", "beforeUnmount", "submit", "reset", "change", "emit-event", "control", "remove-rule", "remove-field", "sync", "reload", "repeat-field", "update", "validate-field-fail", "validate-fail", "created"],
render() {
return this.fc.render();
},
setup(n) {
const s = He();
dr("parentFC", s);
const i = hr("parentFC", null);
let o = i;
if (