| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- /*!
- * FormCreate 低代码表单渲染器
- * @form-create/component-subform v2.6.2
- * (c) 2018-2024 xaboy
- * Github https://github.com/xaboy/form-create
- * Site https://form-create.com/
- * Released under the MIT License.
- */
- var d = Object.defineProperty;
- var o = Object.getOwnPropertySymbols;
- var m = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
- var u = (r, e, n) => e in r ? d(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, l = (r, e) => {
- for (var n in e || (e = {}))
- m.call(e, n) && u(r, n, e[n]);
- if (o)
- for (var n of o(e))
- y.call(e, n) && u(r, n, e[n]);
- return r;
- };
- function g(r) {
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
- }
- function a() {
- return a = Object.assign ? Object.assign.bind() : function(r) {
- for (var e, n = 1; n < arguments.length; n++) for (var t in e = arguments[n], e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = e[t]);
- return r;
- }, a.apply(this, arguments);
- }
- var v = ["attrs", "props", "domProps"], O = ["class", "style", "directives"], j = ["on", "nativeOn"], $ = function(r) {
- return r.reduce(function(e, n) {
- for (var t in n) if (!e[t]) e[t] = n[t];
- else if (v.indexOf(t) !== -1) e[t] = a({}, e[t], n[t]);
- else if (O.indexOf(t) !== -1) {
- var h = e[t] instanceof Array ? e[t] : [e[t]], c = n[t] instanceof Array ? n[t] : [n[t]];
- e[t] = [].concat(h, c);
- } else if (j.indexOf(t) !== -1)
- for (var s in n[t]) if (e[t][s]) {
- var f = e[t][s] instanceof Array ? e[t][s] : [e[t][s]], p = n[t][s] instanceof Array ? n[t][s] : [n[t][s]];
- e[t][s] = [].concat(f, p);
- } else e[t][s] = n[t][s];
- else if (t === "hook") for (var i in n[t]) e[t][i] = e[t][i] ? A(e[t][i], n[t][i]) : n[t][i];
- else e[t] = n[t];
- return e;
- }, {});
- }, A = function(r, e) {
- return function() {
- r && r.apply(this, arguments), e && e.apply(this, arguments);
- };
- }, R = $;
- const V = /* @__PURE__ */ g(R), M = "fcSubForm", D = {
- name: M,
- props: {
- rule: Array,
- options: Object,
- formCreateInject: {
- type: Object,
- required: !0
- },
- value: {
- type: Object,
- default: () => ({})
- },
- disabled: {
- type: Boolean,
- default: !1
- },
- syncDisabled: {
- type: Boolean,
- default: !0
- }
- },
- data() {
- return {
- cacheRule: {},
- cacheValue: {},
- type: void 0
- };
- },
- watch: {
- value(r) {
- this.setValue(r);
- }
- },
- methods: {
- formData(r) {
- this.cacheValue = JSON.stringify(r), this.$emit("input", r), this.$emit("change", r);
- },
- setValue(r) {
- const e = JSON.stringify(r);
- this.cacheValue !== e && (this.cacheValue = e, this.cacheRule.$f.coverValue(r || {}));
- },
- addRule() {
- const r = this.options ? this.options : {
- submitBtn: !1,
- resetBtn: !1
- };
- r.formData = l({}, this.value || {}), this.cacheRule = {
- rule: this.rule,
- options: r
- };
- },
- add$f(r) {
- this.cacheRule.$f = r, this.$nextTick(() => {
- this.$emit("itemMounted", r);
- });
- },
- emitEvent(r, ...e) {
- this.$emit(r, ...e);
- }
- },
- created() {
- this.addRule(), this.type = this.formCreateInject.form.$form();
- },
- render() {
- const r = arguments[0], {
- rule: e,
- options: n
- } = this.cacheRule, t = this.type;
- return r(t, V([{}, {
- on: {
- "update:value": this.formData,
- "emit-event": this.emitEvent,
- input: this.add$f
- }
- }, {}, {
- props: {
- rule: e,
- option: n,
- disabled: this.disabled,
- extendOption: !0
- }
- }]));
- }
- };
- export {
- D as default
- };
|