UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,538 lines (1,537 loc) 292 kB
var Nn = Object.defineProperty; var Rn = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var X = (e, t, n) => Rn(e, typeof t != "symbol" ? t + "" : t, n); import { ref as S, computed as H, watch as Se, defineComponent as Ye, onBeforeUnmount as en, withDirectives as $n, createVNode as I, resolveDirective as Pn, Fragment as _t, reactive as at, createApp as tn, onUnmounted as It, onMounted as gt, Transition as nn, mergeProps as pt, createTextVNode as mt, nextTick as At, inject as yt, provide as jn, triggerRef as Ln, isVNode as Hn, onBeforeMount as Wn, Teleport as An, shallowRef as zn, render as Nt, h as Gn, cloneVNode as qn } from "vue"; import Un, { FDynamicFormGroup as Yn, FDynamicFormInput as Xn } from "../dynamic-form/index.esm.js"; import { cloneDeep as dt, isPlainObject as Yt, isUndefined as Xt } from "lodash-es"; import "../designer-canvas/index.esm.js"; import { useResizeObserver as on } from "@vueuse/core"; import { useIdentify as Kn, useGroupData as Qn, useFilter as Jn, useHierarchy as Zn, useLoading as eo, useDataView as to, useSelection as no, useSelectHierarchyItem as oo, useDataViewContainerStyle as ro, useCommandColumn as io, useColumn as ao, useSort as lo, useGroupColumn as so, useRow as uo, useEdit as co, useVisualDataBound as fo, useVisualDataCell as po, useVisualDataRow as mo, useVisualData as vo, useCellPosition as ho, useSidebar as go, useVirtualScroll as yo, useFitColumn as bo, useFilterHistory as Co, useColumnFilter as wo, useDragColumn as _o, getColumnHeader as So, getSidebar as xo, getDisableMask as To, getHorizontalScrollbar as Fo, getVerticalScrollbar as ko, getEmpty as Eo } from "../data-view/index.esm.js"; import "../modal/index.esm.js"; import Oo from "../transfer/index.esm.js"; import Io from "../tabs/index.esm.js"; import Mo from "../order/index.esm.js"; import "../condition/index.esm.js"; import Bo, { FCheckbox as Vo } from "../checkbox/index.esm.js"; import Do from "../filter-bar/index.esm.js"; import Kt from "../tooltip/index.esm.js"; import No from "../pagination/index.esm.js"; import Ro from "../button/index.esm.js"; import $o from "../search-box/index.esm.js"; import Po from "../tags/index.esm.js"; import { useDateFormat as jo, useNumberFormat as Lo, resolveField as Ue, setFieldValue as Pt, getCustomClass as Rt, withInstall as Ho } from "../common/index.esm.js"; import Wo from "../accordion/index.esm.js"; import Ao from "../avatar/index.esm.js"; import zo from "../button-edit/index.esm.js"; import Go from "../button-group/index.esm.js"; import qo from "../calendar/index.esm.js"; import Uo from "../capsule/index.esm.js"; import Yo from "../color-picker/index.esm.js"; import jt from "../combo-list/index.esm.js"; import Xo from "../content-container/index.esm.js"; import Ko from "../data-grid/index.esm.js"; import Qo from "../date-picker/index.esm.js"; import Jo from "../dropdown/index.esm.js"; import "../external-container/index.esm.js"; import Zo from "../events-editor/index.esm.js"; import er from "../image-cropper/index.esm.js"; import tr from "../input-group/index.esm.js"; import nr from "../layout/index.esm.js"; import or from "../list-nav/index.esm.js"; import rr from "../list-view/index.esm.js"; import ir from "../lookup/index.esm.js"; import ar from "../nav/index.esm.js"; import lr from "../number-spinner/index.esm.js"; import sr from "../number-range/index.esm.js"; import ur from "../page-header/index.esm.js"; import cr from "../page-footer/index.esm.js"; import dr from "../progress/index.esm.js"; import fr from "../query-solution/index.esm.js"; import pr from "../radio-group/index.esm.js"; import mr from "../rate/index.esm.js"; import vr from "../response-toolbar/index.esm.js"; import hr from "../response-layout/index.esm.js"; import gr from "../response-layout-editor/index.esm.js"; import yr from "../section/index.esm.js"; import br from "../smoke-detector/index.esm.js"; import Cr from "../splitter/index.esm.js"; import wr from "../step/index.esm.js"; import _r from "../switch/index.esm.js"; import Sr from "../text/index.esm.js"; import xr from "../time-picker/index.esm.js"; import Tr from "../tree-view/index.esm.js"; import Fr from "../uploader/index.esm.js"; import kr from "../verify-detail/index.esm.js"; import Er from "../component/index.esm.js"; import Or from "../video/index.esm.js"; import Ir from "../textarea/index.esm.js"; import Mr from "../tree-grid/index.esm.js"; import Br from "../fieldset/index.esm.js"; import Vr from "../drawer/index.esm.js"; import Dr from "../binding-selector/index.esm.js"; import "../notify/index.esm.js"; import Nr from "../combo-tree/index.esm.js"; import Rr from "../field-selector/index.esm.js"; import $r from "../mapping-editor/index.esm.js"; import Pr from "../schema-selector/index.esm.js"; import jr from "../event-parameter/index.esm.js"; import Lr from "../filter-condition-editor/index.esm.js"; import Hr from "../sort-condition-editor/index.esm.js"; import Wr from "../menu-lookup/index.esm.js"; import { createPropsResolver as Ar } from "../dynamic-resolver/index.esm.js"; const rn = { conditions: { type: Array, default: [] }, fields: { type: Array, default: [] }, key: { type: String, default: "" }, /** * 控间标签同行展示 */ isControlInline: { type: Boolean, default: !0 } }; class an { constructor(t = { value: [] }) { X(this, "editorType", "check-box"); X(this, "value"); X(this, "valueType", "boolean"); const o = (Array.isArray(t.value) ? t.value : typeof t.value == "string" ? t.value.split(",") : []).map((r) => JSON.parse(r)); this.value = o; } clear() { this.value = []; } setValue(t) { this.value = t; } getValue() { return this.value; } getDisplayText() { return this.value.map((t) => t ? "是" : "否").join(","); } isEmpty() { return this.value.length === 0; } } class ln { constructor(t = { textValue: "", value: "", valueField: "" }) { X(this, "editorType", "combo-lookup"); X(this, "textValue"); X(this, "value"); X(this, "valueField"); X(this, "valueType", "text"); this.textValue = t.textValue, this.value = t.value, this.valueField = t.valueField; } clear() { this.value = "", this.valueField = "", this.textValue = ""; } getPropValue(t, n) { if (n.length > 1) { const o = n.shift(); return t[o] ? this.getPropValue(t[o], n) : null; } return t[n[0]]; } getTextValue(t) { const n = t.split("."), o = this.value.split(",").map((r) => this.getPropValue(r, dt(n))); return o && o.length ? o.join(",") : ""; } getValue() { const t = this.valueField.split("."), n = this.value.split(",").map((o) => this.getPropValue(o, dt(t))); return n && n.length ? n.join(",") : ""; } getDisplayText() { return this.getValue(); } setValue(t) { throw new Error("Method not implemented."); } isEmpty() { return !this.valueField; } } class sn { constructor(t = { value: "", displayFormat: "", valueFormat: "" }) { X(this, "editorType", "date-picker"); X(this, "value"); X(this, "valueType", "datetime"); X(this, "displayFormat", ""); X(this, "valueFormat", ""); this.value = t.value, this.displayFormat = t.displayFormat, this.valueFormat = t.valueFormat; } setValue(t) { this.value = t.formatted; } getValue() { return this.value; } getDisplayText() { return this.getValue(); } isEmpty() { return !this.value; } clear() { this.value = void 0; } } class kt { constructor(t = { begin: "", end: "" }) { X(this, "editorType", "date-range"); X(this, "begin", ""); X(this, "end", ""); X(this, "valueType", "datetime"); this.begin = t.begin, this.end = t.end; } clear() { this.begin = "", this.end = ""; } getValue() { return !this.begin || !this.end ? "" : `${this.begin}~${this.end}`; } getDisplayText() { return this.getValue(); } setValue(t) { t.dataRange ? (this.begin = t.dataRange.split(t.delimiter)[0], this.end = t.dataRange.split(t.delimiter)[1]) : this.clear(); } isEmpty() { return !this.begin || !this.end; } } class un { constructor(t = { value: "" }) { X(this, "editorType", "datetime-picker"); X(this, "value"); X(this, "valueType", "datetime"); this.value = t.value; } clear() { this.value = void 0; } getValue() { return this.value; } getDisplayText() { return this.getValue(); } setValue(t) { this.value = t.formatted; } isEmpty() { return !this.value; } } class cn { constructor(t = { value: "", valueList: [] }) { X(this, "editorType", "combo-list"); X(this, "value"); X(this, "valueType", "enum"); X(this, "valueList", []); this.value = t.value, this.valueList = t.valueList; } clear() { this.value = "", this.valueList = []; } getValue() { return this.value; } getDisplayText() { var r, a; const t = typeof this.value; let n = "", o = []; switch (t) { case "string": o = this.value.split(",") || [], n = this.valueList.filter((i) => o.indexOf(i.value) > -1).map((i) => i.name).join(","); break; case "boolean": n = ((r = this.valueList.find((i) => i.value === this.value)) == null ? void 0 : r.name) || ""; break; case "number": n = ((a = this.valueList.find((i) => i.value === this.value)) == null ? void 0 : a.name) || ""; break; } return n; } // setValue(data: { value: string; displayText: string }) { // // this.displayText = data.dispalyText; // const enumValues = getEnumValues(data); // this.value = enumValues; // return this.displayText; // } setValue(t) { this.value = t.value; } isEmpty() { return !this.value && this.value !== !1 && this.value !== 0; } } class zr { constructor(t = { value: "", displayText: "", displayField: "", isInputText: !1 }) { X(this, "editorType", "input-group"); // 通过弹窗返回的若干个值对象构成的数组 X(this, "value"); X(this, "valueType", "text"); // 控件内显示的值 X(this, "displayText"); // 弹窗模式下,取列表中哪个字段的值映射到当前字段 X(this, "valueField"); // 是否是手动输入的值 X(this, "isInputText"); this.value = t.value, this.displayText = t.displayText, this.valueField = t.displayField, this.isInputText = t.isInputText; } clear() { this.value = "", this.displayText = "", this.valueField = ""; } getPropValue(t, n) { if (n.length > 1) { const o = n.shift(); return t[o] ? this.getPropValue(t[o], n) : ""; } return t[n[0]]; } getTextValue(t) { const n = t.split("."), o = this.value.map((r) => this.getPropValue(r, dt(n))); return o && o.length ? o.join(",") : ""; } getValue() { return this.value; } getDisplayText() { return this.getValue(); } setValue(t) { throw new Error("Method not implemented."); } isEmpty() { return !this.displayText && !this.value.length; } } class dn { constructor(t = { mapFields: [], value: "", valueField: "", isInputText: !1, helpId: "" }) { X(this, "editorType", "lookup"); X(this, "idValue"); X(this, "helpId"); X(this, "mapFields"); X(this, "value"); X(this, "valueField"); X(this, "valueType", "text"); // 帮助的值是否为手动输入的任意值,对应帮助的任意输入属性nosearch X(this, "isInputText"); this.value = t.value, this.valueField = t.valueField, this.mapFields = t.mapFields, this.idValue = t.mapFields.map((n) => n.id).join(","), this.isInputText = t.isInputText, this.helpId = t.helpId; } clear() { this.value = "", this.idValue = "", this.mapFields = []; } getValue() { return this.mapFields.map((t) => t[this.valueField || "id"]).join(","); } getDisplayText() { return this.getValue(); } setValue(t) { throw new Error("Method not implemented."); } isEmpty() { return !this.mapFields.length; } } class fn { constructor(t = { value: "" }) { X(this, "editorType", "month-picker"); X(this, "value"); X(this, "valueType", "datetime"); this.value = t.value; } setValue(t) { this.value = t.formatted; } getValue() { return this.value; } getDisplayText() { return this.getValue(); } clear() { this.value = void 0; } isEmpty() { return !this.value; } } class pn { constructor(t = { begin: "", end: "" }) { X(this, "editorType", "month-range"); X(this, "begin"); X(this, "end"); X(this, "valueType", "datetime"); this.begin = t.begin, this.end = t.end; } clear() { this.begin = "", this.end = ""; } getValue() { return !this.begin || !this.end ? "" : `${this.begin}~${this.end}`; } getDisplayText() { return this.getValue(); } setValue(t) { t.dataRange ? (this.begin = t.dataRange.split(t.delimiter)[0], this.end = t.dataRange.split(t.delimiter)[1]) : this.clear(); } isEmpty() { return !this.begin || !this.end; } } class mn { constructor(t = { begin: null, end: null }) { X(this, "editorType", "number-range"); X(this, "begin"); X(this, "end"); X(this, "valueType", "number"); this.begin = t.begin == null ? null : parseFloat(t.begin), this.end = t.end == null ? null : parseFloat(t.end); } clear() { this.begin = null, this.end = null; } getValue() { return { begin: this.begin, end: this.end }; } getDisplayText() { return this.getValue(); } setValue(t) { this.begin = t.begin == null ? null : parseFloat(t.begin), this.end = t.end == null ? null : parseFloat(t.end); } isEmpty() { return this.begin == null && this.end == null; } } class vn { constructor(t = { value: "" }) { X(this, "editorType", "number-spinner"); X(this, "value"); X(this, "valueType", "number"); this.value = t.value == null ? null : parseFloat(t.value); } clear() { this.value = null; } getValue() { return this.value; } getDisplayText() { return this.getValue(); } setValue(t) { this.value = isNaN(parseFloat(t)) ? null : t; } isEmpty() { return this.value == null || isNaN(this.value); } } class hn { constructor(t = { value: null, valueList: [] }) { X(this, "editorType", "radio-group"); X(this, "value"); X(this, "valueType", "enum"); X(this, "valueList", []); this.value = t.value, this.valueList = t.valueList; } clear() { this.value = void 0, this.valueList = []; } getValue() { return this.value; } getDisplayText() { var t; return ((t = this.valueList.find((n) => n.value === this.value)) == null ? void 0 : t.name) || ""; } setValue(t) { this.value = t; } isEmpty() { return !this.value && this.value !== 0 && this.value !== !1; } } class Et { constructor(t = { value: "" }) { X(this, "editorType", "text"); X(this, "value"); X(this, "valueType", "text"); this.value = t.value; } clear() { this.value = void 0; } getValue() { return this.value; } getDisplayText() { return this.getValue(); } setValue(t) { this.value = t; } isEmpty() { return !this.value; } } function gn() { function e(t, n) { switch (t) { case "check-box": return new an(n); case "combo-list": return new cn(n); case "combo-lookup": return new ln(n); case "input-group": return new zr(n); case "date-picker": return new sn(n); case "date-range": return new kt(n); case "datetime-picker": return new un(n); case "datetime-range": return new kt(n); case "lookup": return new dn(n); case "month-picker": return new fn(n); case "month-range": return new pn(n); case "number-range": return new mn(n); case "number-spinner": return new vn(n); case "radio-group": return new hn(n); default: return new Et(n); } } return { createConditionValue: e }; } function yn(e, t) { const n = S(e.fields), o = S([]), r = /* @__PURE__ */ new Map(), { createConditionValue: a } = gn(); function i(d) { switch (d.editor ? d.editor.type : "input-group") { case "date-range": d.editor.type = "date-picker"; break; case "datetime-range": d.editor.type = "datetime-picker"; break; case "number-range": d.editor.type = "number-spinner"; break; } return d.editor; } function u(d) { return d.map((f) => Object.assign({}, f)).map((f) => (f.editor = i(f), f)); } function s(d = !0) { n.value.reduce((c, f) => (d || (f.editor = i(f)), c.set(f.labelCode, f), c), r); } function p(d) { return d.forEach((c) => { if (c) { const f = r.get(c.fieldCode); c.value = a(f.editor.type, c.value); } }), d; } return { convertToSingleControl: u, fields: n, fieldMap: r, fieldConditions: o, loadFieldConfigs: s, initialConditionValue: p }; } function Gr(e, t, n) { const o = S(null), r = S(n), a = S(0); function i(d, c) { let f = null; return function() { const y = arguments; f ? (clearTimeout(f), f = setTimeout(() => { f = null, d(...y); }, 200)) : (d(...y), f = setTimeout(() => { f = null; }, 200)); }; } function u() { r.value && (o.value = new ResizeObserver(i((d) => { const c = d[0]; a.value = c.contentRect.width; })), o.value.observe(r.value)); } function s(d) { let f = "col-12"; return d > 250 * 6 ? f = "col-2" : d > 250 * 4 ? f = "col-3" : d > 250 * 3 ? f = "col-4" : d > 250 * 2 && (f = "col-6"), f; } const p = H(() => s(a.value)); return Se([n], ([d]) => { r.value = d, u(); }), { conditionClass: p, resizeObserver: o }; } const Qt = /* @__PURE__ */ Ye({ name: "FConditionFields", props: rn, emits: ["valueChange", "blur", "focus", "click", "input"], setup(e, t) { const n = S(), o = S(e.key); S(e.isControlInline); const r = S(e.conditions), a = yn(e), { initialConditionValue: i, fieldMap: u, loadFieldConfigs: s } = a, p = Gr(e, t, n), { conditionClass: d, resizeObserver: c } = p; s(!0), i(r.value), en(() => { var F; (F = c.value) == null || F.unobserve(n.value); }), Se(() => e.conditions, () => { r.value = e.conditions, i(r.value); }); const f = H(() => ({ // row: true, "f-utils-flex-row-wrap": !0, "farris-form": !0, "condition-div": !0, "farris-form-controls-inline": e.isControlInline })), y = H(() => "col-12 col-md-6 col-xl-3 col-el-2 "); function w(F, m, h, x) { F.value.editorType === "combo-list" && x.newValue ? F.value.valueList = x.newValue.map((v) => ({ name: v.name, value: v.value })) : F.value.editorType === "radio-group" && (F.value.valueList = [h.data.find((v) => v.value === m)]), t.emit("valueChange", m, F); } function R() { return r.value.map((F) => { var v, _, O, l, g; const m = (v = u.get(F.fieldCode)) == null ? void 0 : v.editor, h = (_ = u.get(F.fieldCode)) == null ? void 0 : _.id; let x = !0; return ((O = F.value) == null ? void 0 : O.editorType) === "lookup" && m ? (m.idValue = F.value.idValue, m.onClear = () => { F.value.idValue = "", F.value.mapFields = [], w(F, ""); }, m["onUpdate:dataMapping"] = (C) => { F.value.mapFields = C.items, w(F, F.value.getValue()); }, x = !1) : ((l = F.value) == null ? void 0 : l.editorType) === "number-range" && m && (m.beginValue = F.value.begin, m.onBeginValueChange = (C) => { F.value.begin = C, w(F, C); }, m.endValue = F.value.end, m.onEndValueChange = (C) => { F.value.end = C, w(F, C); }, x = !1), I(Yn, { id: h, customClass: ((g = m == null ? void 0 : m.appearance) == null ? void 0 : g.class) || y.value, label: (m == null ? void 0 : m.showLabel) === !1 ? " " : F.fieldName, editor: m, required: m == null ? void 0 : m.required, modelValue: F.value.value, "onUpdate:modelValue": (C) => F.value.value = C, onChange: (C, T) => { x && w(F, C, m, T); } }, null); }); } return () => $n(I("div", { class: f.value, key: o.value, ref: n }, [R()]), [[Pn("area-response")]]); } }), bn = {}, Cn = {}; function zt(e) { const { properties: t, title: n, ignore: o } = e, r = o && Array.isArray(o), a = Object.keys(t).reduce((i, u) => ((!r || !o.find((s) => s === u)) && (i[u] = t[u].type === "object" && t[u].properties ? zt(t[u]) : dt(t[u].default)), i), {}); if (n && (!r || !o.find((i) => i === "id"))) { const i = n.toLowerCase().replace(/-/g, "_"); a.id = `${i}_${Math.random().toString().slice(2, 6)}`; } return a; } function qr(e) { const { properties: t, title: n, required: o } = e; if (o && Array.isArray(o)) { const r = o.reduce((a, i) => (a[i] = t[i].type === "object" && t[i].properties ? zt(t[i]) : dt(t[i].default), a), {}); if (n && o.find((a) => a === "id")) { const a = n.toLowerCase().replace(/-/g, "_"); r.id = `${a}_${Math.random().toString().slice(2, 6)}`; } return r; } return { type: n }; } function wn(e, t = {}, n) { const o = bn[e]; if (o) { let r = qr(o); const a = Cn[e]; return r = a ? a({ getSchemaByType: wn }, r, t, n) : r, r; } return null; } function Ur(e, t) { const n = zt(t); return Object.keys(n).reduce((o, r) => (Object.prototype.hasOwnProperty.call(e, r) && (o[r] && Yt(o[r]) && Yt(e[r] || !e[r]) ? Object.assign(o[r], e[r] || {}) : o[r] = e[r]), o), n), n; } function _n(e, t) { return Object.keys(e).filter((o) => e[o] != null).reduce((o, r) => { if (t.has(r)) { const a = t.get(r); if (typeof a == "string") o[a] = e[r]; else { const i = a(r, e[r], e); Object.assign(o, i); } } else o[r] = e[r]; return o; }, {}); } function Yr(e, t, n = /* @__PURE__ */ new Map()) { const o = Ur(e, t); return _n(o, n); } function Xr(e = {}) { function t(p, d, c, f) { if (typeof c == "number") return f[p].length === c; if (typeof c == "object") { const y = Object.keys(c)[0], w = c[y]; if (y === "not") return Number(f[p].length) !== Number(w); if (y === "moreThan") return Number(f[p].length) >= Number(w); if (y === "lessThan") return Number(f[p].length) <= Number(w); } return !1; } function n(p, d, c, f) { return f[p] && f[p].propertyValue && String(f[p].propertyValue.value) === String(c); } const o = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((p, d) => (p.set(d, e[d]), p), o); function r(p, d) { const c = p; return typeof d == "number" ? [{ target: c, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: c, operator: "getProperty", param: p, value: !!d }] : typeof d == "object" ? Object.keys(d).map((f) => { if (f === "length") return { target: c, operator: "length", param: null, value: d[f] }; const y = f, w = d[f]; return { target: c, operator: "getProperty", param: y, value: w }; }) : []; } function a(p) { return Object.keys(p).reduce((c, f) => { const y = r(f, p[f]); return c.push(...y), c; }, []); } function i(p, d) { if (o.has(p.operator)) { const c = o.get(p.operator); return c && c(p.target, p.param, p.value, d) || !1; } return !1; } function u(p, d) { return a(p).reduce((y, w) => y && i(w, d), !0); } function s(p, d) { const c = Object.keys(p), f = c.includes("allOf"), y = c.includes("anyOf"), w = f || y, m = (w ? p[w ? f ? "allOf" : "anyOf" : "allOf"] : [p]).map((x) => u(x, d)); return f ? !m.includes(!1) : m.includes(!0); } return { parseValueSchema: s }; } const le = { button: { type: "button", name: "按钮" }, "response-toolbar": { type: "response-toolbar", name: "工具栏" }, "response-toolbar-item": { type: "response-toolbar-item", name: "按钮" }, "content-container": { type: "content-container", name: "容器" }, "input-group": { type: "input-group", name: "文本" }, textarea: { type: "textarea", name: "多行文本" }, lookup: { type: "lookup", name: "帮助" }, "number-spinner": { type: "number-spinner", name: "数值" }, "date-picker": { type: "date-picker", name: "日期" }, switch: { type: "switch", name: "开关" }, "radio-group": { type: "radio-group", name: "单选组" }, "check-box": { type: "check-box", name: "复选框" }, "check-group": { type: "check-group", name: "复选框组" }, "combo-list": { type: "combo-list", name: "下拉列表" }, "response-form": { type: "response-form", name: "卡片面板" }, "response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" }, "response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" }, "tree-grid": { type: "tree-grid", name: "树表格" }, "tree-grid-column": { type: "tree-grid-column", name: "树表格列" }, "data-grid": { type: "data-grid", name: "表格" }, "data-grid-column": { type: "data-grid-column", name: "表格列" }, module: { type: "Module", name: "模块" }, component: { type: "component", name: "组件" }, tabs: { type: "tabs", name: "标签页" }, "tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" }, "tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" }, "time-picker": { type: "time-picker", name: "时间选择" }, section: { type: "section", name: "分组面板" }, "section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" }, "section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" }, splitter: { type: "splitter", name: "分栏面板" }, "splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" }, "component-ref": { type: "component-ref", name: "组件引用节点" }, uploader: { type: "uploader", name: "附件上传" }, "page-header": { type: "page-header", name: "页头" }, "page-footer": { type: "page-footer", name: "页脚" }, "tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" }, fieldset: { type: "fieldset", name: "分组" }, "query-solution": { type: "query-solution", name: "筛选方案" }, drawer: { type: "drawer", name: "抽屉" } }, Kr = {}, Qr = {}; Xr(); function vt(e, t, n = /* @__PURE__ */ new Map(), o = (i, u, s, p) => u, r = {}, a = (i) => i) { return bn[t.title] = t, Cn[t.title] = o, Kr[t.title] = r, Qr[t.title] = a, (i = {}, u = !0) => { if (!u) return _n(i, n); const s = Yr(i, t, n), p = Object.keys(e).reduce((d, c) => (d[c] = e[c].default, d), {}); return Object.assign(p, s); }; } function Mt(e, t) { return { customClass: t.class, customStyle: t.style }; } function Jr() { function e(t, n) { const { dataSource: o } = t || {}; return o === void 0 ? {} : {}; } return { resolve: e }; } function Zr() { function e(t, n) { return t.selectItemById(n); } return { selectItemById: e }; } function ei() { function e(t, n) { const { columns: o } = n; return t.updateColumns(o); } return { updateColumns: e }; } const Gt = /* @__PURE__ */ new Map([ ["appearance", Mt] ]), ti = /* @__PURE__ */ new Map([]); var Lt = /* @__PURE__ */ ((e) => (e.String = "String", e.DateTime = "DateTime", e.Date = "Date", e.Enum = "Enum", e.Boolean = "Boolean", e.Number = "Number", e.Text = "Text", e.BigNumber = "BigNumber", e))(Lt || {}); const ni = "root-viewmodel"; class oi { constructor(t, n) { X(this, "formSchemaUtils"); X(this, "controlCreatorUtils"); X(this, "designViewModelUtils"); this.resolver = t, this.designerHostService = n, this.formSchemaUtils = this.designerHostService.formSchemaUtils, this.controlCreatorUtils = this.designerHostService.controlCreatorUtils, this.designViewModelUtils = this.designerHostService.designViewModelUtils; } createComponent(t) { const n = this.createComponentRefNode(t), o = this.createComponentNode(t), r = this.createViewModeNode(t), a = this.formSchemaUtils.getFormSchema(); return a.module.viewmodels.push(r), a.module.components.push(o), this.designViewModelUtils.assembleDesignViewModel(), n; } createComponentRefNode(t) { const n = this.resolver.getSchemaByType("component-ref"); return Object.assign(n, { id: `${t.componentId}-component-ref`, component: `${t.componentId}-component` }), n; } createComponentNode(t) { const n = this.resolver.getSchemaByType("component"), o = this.createFormComponentContents(t); return Object.assign(n, { id: `${t.componentId}-component`, viewModel: `${t.componentId}-component-viewmodel`, componentType: t.componentType, appearance: { class: this.getFormComponentClass() }, formColumns: t.formColumns, contents: o }), n; } /** * 获取卡片组件层级的class样式 */ getFormComponentClass() { const { templateId: t } = this.formSchemaUtils.getFormSchema().module; return t === "double-list-in-tab-template" ? "f-struct-wrapper f-utils-fill-flex-column" : "f-struct-wrapper"; } createFormComponentContents(t) { const n = this.resolver.getSchemaByType("section"); Object.assign(n, { id: t.componentId + "-form-section", appearance: { class: "f-section-form f-section-in-mainsubcard" }, mainTitle: t.componentName }); const o = this.resolver.getSchemaByType("response-form"), r = []; Object.assign(o, { id: t.componentId + "-form", appearance: { class: "f-form-layout farris-form farris-form-controls-inline" }, contents: r }), n.contents = [o]; const { selectedFields: a } = t; a == null || a.forEach((u) => { const s = dt(u), p = this.resolveControlClassByFormColumns(t), d = this.controlCreatorUtils.setFormFieldProperty(s, "", p); d && r.push(d); }); const { templateId: i } = this.formSchemaUtils.getFormSchema().module; return i === "double-list-in-tab-template" && (n.appearance.class = "f-section-grid f-section-in-main px-0 pt-0", n.fill = !0), [n]; } resolveControlClassByFormColumns(t) { let n = ""; switch (t.formColumns) { case 1: { n = "col-12"; break; } case 2: { n = "col-12 col-md-6 col-xl-6 col-el-6"; break; } case 3: { n = "col-12 col-md-6 col-xl-4 col-el-4"; break; } case 4: { n = "col-12 col-md-6 col-xl-3 col-el-2"; break; } } return n; } /** * 添加viewModel节点 */ createViewModeNode(t) { return { id: `${t.componentId}-component-viewmodel`, code: `${t.componentId}-component-viewmodel`, name: t.componentName, bindTo: t.bindTo, parent: ni, fields: this.assembleViewModelFields(t), commands: [], states: [], enableValidation: !0 }; } /** * 组装viewModel fields 节点 */ assembleViewModelFields(t) { const n = [], { selectedFields: o } = t; return o == null || o.forEach((r) => { let a = "blur"; const i = r.type.name; (i === Lt.Enum || i === Lt.Boolean) && (a = "change"), n.push({ type: "Form", id: r.id, fieldName: r.bindingField, groupId: null, groupName: null, updateOn: a, fieldSchema: {} }); }), n; } } function ri(e, t, n, o) { var a, i, u, s, p, d; const r = n.parentComponentInstance; if (r && o) { const c = (a = r.schema) == null ? void 0 : a.type, y = { componentId: `form-${Math.random().toString(36).slice(2, 6)}`, componentName: ((i = n.bindingSourceContext) == null ? void 0 : i.entityTitle) || ((s = (u = n.bindingSourceContext) == null ? void 0 : u.bindingEntity) == null ? void 0 : s.name) || "标题", componentType: "form", formColumns: c === "splitter-pane" ? 1 : 4, parentContainerId: r.schema.id, bindTo: ((p = n.bindingSourceContext) == null ? void 0 : p.bindTo) || "/", selectedFields: (d = n.bindingSourceContext) == null ? void 0 : d.bindingEntityFields }; return new oi(e, o).createComponent(y); } else return t; } function ii(e, t, n) { return t; } const ai = "https://json-schema.org/draft/2020-12/schema", li = "https://farris-design.gitee.io/response-form.schema.json", si = "response-form", ui = "A Farris Data Collection Component", ci = "object", di = { id: { description: "The unique identifier for a form group", type: "string" }, type: { description: "The type string of form group component", type: "string", default: "response-form" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, contents: { description: "", type: "array", default: [] } }, fi = [ "id", "type", "contents" ], pi = { $schema: ai, $id: li, title: si, description: ui, type: ci, properties: di, required: fi }, mi = { customClass: { type: String, default: "" }, customStyle: { type: String, defaut: "" } }; vt(mi, pi, Gt, ri); const vi = "https://json-schema.org/draft/2020-12/schema", hi = "https://farris-design.gitee.io/form-group.schema.json", gi = "form-group", yi = "A Farris Input Component", bi = "object", Ci = { id: { description: "The unique identifier for a form group", type: "string" }, type: { description: "The type string of form group component", type: "string", default: "form-group" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, enableLinkLabel: { description: "", type: "boolean", default: !1 }, editor: { description: "", type: "obejct", default: null }, label: { description: "", type: "string", default: "" }, lableWidth: { description: "", type: "number" }, binding: { description: "", type: "object", default: {} } }, wi = [ "id", "type", "editor" ], Sn = { $schema: vi, $id: hi, title: gi, description: yi, type: bi, properties: Ci, required: wi }, xn = { id: { type: String, default: "" }, customClass: { type: String, default: "" }, customStyle: { type: String, default: "" }, /** 筛选组件配置器,具体配置项可查看各组件文档 */ editor: { type: Object, default: {} }, label: { type: String, default: "" }, /** 组件值 */ modelValue: { type: [String, Boolean, Array, Number], default: "" }, // readonly: { type: Boolean, default: false }, visible: { type: Boolean, default: !0 }, required: { type: Boolean, default: !1 }, showLabel: { type: Boolean, default: !0 }, type: { type: String, default: "input-group" }, componentId: { type: String, default: "" } }; vt( xn, Sn, Gt, void 0 ); function _i(e, t, n) { var O; const o = n && n.getStyles && n.getStyles() || "", r = n && n.getDesignerClass && n.getDesignerClass() || "", a = S(); function i() { return (t == null ? void 0 : t.schema.componentType) === "frame" ? !1 : n && n.checkCanMoveComponent ? n.checkCanMoveComponent() : !0; } function u() { return !1; } function s() { return (t == null ? void 0 : t.schema.componentType) === "frame" ? !1 : n && n.checkCanDeleteComponent ? n.checkCanDeleteComponent() : !0; } function p() { return (t == null ? void 0 : t.schema.componentType) === "frame" ? !0 : n && n.hideNestedPaddingInDesginerView ? n.hideNestedPaddingInDesginerView() : !1; } function d(l) { if (!l || !l.value) return null; if (l.value.schema && l.value.schema.type === "component") return l.value; const g = S(l == null ? void 0 : l.value.parent), C = d(g); return C || null; } function c(l = t) { var b; if (n != null && n.getDraggableDesignItemElement) return n.getDraggableDesignItemElement(l); const { componentInstance: g, designerItemElementRef: C } = l; if (!g || !g.value) return null; const { getCustomButtons: T } = g.value; return g.value.canMove || T && ((b = T()) != null && b.length) ? C : c(l.parent); } function f(l) { return !!n && n.canAccepts(l); } function y() { return (t == null ? void 0 : t.schema.label) || (t == null ? void 0 : t.schema.title) || (t == null ? void 0 : t.schema.name); } function w() { } function R(l, g) { var C; !l || !g || (n != null && n.onAcceptMovedChildElement && n.onAcceptMovedChildElement(l, g), (C = t == null ? void 0 : t.setupContext) == null || C.emit("dragEnd")); } function F(l, g) { const { componentType: C } = l; let T = wn(C, l, g); n && n.onResolveNewComponentSchema && (T = n.onResolveNewComponentSchema(l, T)); const b = C.toLowerCase().replace(/-/g, "_"); return T && !T.id && T.type === C && (T.id = `${b}_${Math.random().toString().slice(2, 6)}`), T; } function m(l) { l && n != null && n.onChildElementMovedOut && n.onChildElementMovedOut(l); } function h(...l) { if (n && n.getPropsConfig) return n.getPropsConfig(...l); } function x() { n && n.onRemoveComponent && n.onRemoveComponent(), t != null && t.schema.contents && t.schema.contents.map((l) => { let g = l.id; l.type === "component-ref" && (g = l.component); const C = e.value.querySelectorAll(`#${g}-design-item`); C != null && C.length && Array.from(C).map((T) => { var b; (b = T == null ? void 0 : T.componentInstance) != null && b.value.onRemoveComponent && T.componentInstance.value.onRemoveComponent(); }); }); } function v() { if (n && n.getCustomButtons) return n.getCustomButtons(); } function _(l) { if (n && n.onPropertyChanged) return n.onPropertyChanged(l); } return a.value = { canMove: i(), canSelectParent: u(), canDelete: s(), canNested: !p(), contents: t == null ? void 0 : t.schema.contents, elementRef: e, parent: (O = t == null ? void 0 : t.parent) == null ? void 0 : O.componentInstance, schema: t == null ? void 0 : t.schema, styles: o, designerClass: r, canAccepts: f, getBelongedComponentInstance: d, getDraggableDesignItemElement: c, getDraggingDisplayText: y, getPropConfig: h, getDragScopeElement: w, onAcceptMovedChildElement: R, onChildElementMovedOut: m, addNewChildComponentSchema: F, triggerBelongedComponentToMoveWhenMoved: !!n && n.triggerBelongedComponentToMoveWhenMoved || S(!1), triggerBelongedComponentToDeleteWhenDeleted: !!n && n.triggerBelongedComponentToDeleteWhenDeleted || S(!1), onRemoveComponent: x, getCustomButtons: v, onPropertyChanged: _ }, a; } const Si = S(0); function xi() { Si.value++; } const xt = S(0); function Ti(e, t) { const n = t.getBoundingClientRect(), o = e.getBoundingClientRect(), r = o.top >= n.top, a = o.top <= n.bottom; return r && a; } function Fi(e) { const t = e.querySelector(".component-btn-group"); if (!t) return; t.style.display = ""; const n = t.getBoundingClientRect(); if (!(n.top === 0 && n.left === 0)) { const o = t.querySelector("div"); if (o) { const r = o.getBoundingClientRect(); o.style.top = n.top + "px"; let a = n.left - r.width; const i = document.querySelector(".editorDiv"); if (i) { const u = i.getBoundingClientRect(); a < u.left && ({ left: a } = e.getBoundingClientRect()); } o.style.left = a + "px"; } } } function ki(e) { if (!window.scrollContainerList) return; const t = Array.from(window.scrollContainerList); if (t.length && t.length === 1) { const n = t[0], o = document.querySelector(`[id=${n}]`); if (o && o.contains(e)) return o; } } function Tn(e) { if (!e) return; const t = e.getBoundingClientRect(); if (t.width === 0 && t.height === 0) return; const n = e.querySelector(".component-btn-group"); if (n) { let o = !0; const r = ki(e); if (r && (o = Ti(e, r)), !o) { n.style.display = "none"; return; } Fi(e); } } function Ei(e) { if (!e) return; let t; e.className.includes("dgComponentSelected") ? t = e : t = e.querySelector(".dgComponentSelected"), t && Tn(t); } class Oi { constructor(t, n) { X(this, "componentId"); X(this, "viewModelId"); X(this, "eventsEditorUtils"); X(this, "formSchemaUtils"); X(this, "formMetadataConverter"); X(this, "designViewModelUtils"); X(this, "designViewModelField"); X(this, "controlCreatorUtils"); X(this, "designerHostService"); X(this, "schemaService", null); X(this, "metadataService", null); X(this, "propertyConfig", { type: "object", categories: {} }); var o; this.componentId = t, this.designerHostService = n, this.eventsEditorUtils = n.eventsEditorUtils, this.formSchemaUtils = n.formSchemaUtils, this.formMetadataConverter = n.formMetadataConverter, this.viewModelId = ((o = this.formSchemaUtils) == null ? void 0 : o.getViewModelIdByComponentId(t)) || "", this.designViewModelUtils = n.designViewModelUtils, this.controlCreatorUtils = n.controlCreatorUtils, this.metadataService = n.metadataService, this.schemaService = n.schemaService; } getTableInfo() { var t; return (t = this.schemaService) == null ? void 0 : t.getTableInfoByViewModelId(this.viewModelId); } setDesignViewModelField(t) { var o; const n = t.binding && t.binding.type === "Form" && t.binding.field; if (n) { if (!this.designViewModelField) { const r = this.designViewModelUtils.getDgViewModel(this.viewModelId); this.designViewModelField = r.fields.find((a) => a.id === n); } t.updateOn = (o = this.designViewModelField) == null ? void 0 : o.updateOn; } } getBasicPropConfig(t) { return { description: "Basic Information", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "select", editor: { type: "combo-list", textField: "name", valueField: "value", editable: !1, data: [{ value: t.type, name: le[t.type].name }] } } } }; } getAppearanceConfig(t = null) { return { title: "外观", description: "Appearance", properties: { class: { title: "class样式", type: "string", description: "组件的CSS样式", $converter: "/converter/appearance.converter" }, style: { title: "style样式", type: "string", description: "组件的样式", $converter: "/converter/appearance.converter" } }, setPropertyRelates(n, o) { if (n) switch (n && n.propertyID) { case "class": case "style": { xt.value++; break; } } } }; } /** * * @param propertyId * @param componentInstance * @returns */ updateElementByParentContainer(t, n) { const o = n && n.parent && n.parent.schema; if (!o) return; const r = o.contents.findIndex((i) => i.id === t), a = dt(o.contents[r]); o.contents.splice(r, 1), o.contents.splice(r, 0, a), xi(); } } var ut = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function St(e) { throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var Ii = { exports: {} }; (function(e, t) { (function(n) { e.exports = n(); })(function() { return (/* @__PURE__ */ function() { function n(o, r, a) { function i(p, d) { if (!r[p]) { if (!o[p]) { var c = typeof St == "function" && St; if (!d && c) return c(p, !0); if (u) return u(p, !0); var f = new Error("Cannot find module '" + p + "'"); throw f.code = "MODULE_NOT_FOUND", f; } var y = r[p] = { exports: {} }; o[p][0].call(y.exports, function(w) { var R = o[p][1][w]; return i(R || w); }, y, y.exports, n, o, r, a); } return r[p].exports; } for (var u = typeof St == "function" && St, s = 0; s < a.length; s++) i(a[s]); return i; } return n; }())({ 1: [function(n, o, r) { var a = {}, i = "(?:^|\\s)", u = "(?:\\s|$)"; function s(c) { var f = a[c]; return f ? f.lastIndex = 0 : a[c] = f = new RegExp(i + c + u, "g"), f; } function p(c, f) { var y = c.className; y.length ? s(f).test(y) || (c.className += " " + f) : c.className = f; } function d(c, f) { c.className = c.className.replace(s(f), " ").trim(); } o.exports = { add: p, rm: d }; }, {}], 2: [function(n, o, r) { (function(a) { var i = n("contra/emitter"), u = n("crossvent"), s = n("./classes"), p = document, d = p.documentElement; function c(b, D) { var B = arguments.length; B === 1 && Array.isArray(b) === !1 && (D = b, b = []); var V, k, M, E, N, W, K, oe, te, pe = null, L, j, A = !1, U = 0, J, Y = D || {}; Y.moves === void 0 && (Y.moves = h), Y.accepts === void 0 && (Y.accepts = h), Y.invalid === void 0 && (Y.invalid = rt), Y.containers === void 0 && (Y.containers = b || []), Y.isContainer === void 0 && (Y.isContainer = m), Y.copy === void 0 && (Y.copy = !1), Y.copySortSource === void 0 && (Y.copySortSource = !1), Y.revertOnSpill === void 0 && (Y.revertOnSpill = !1), Y.removeOnSpill === void 0 && (Y.removeOnSpill = !1), Y.direction === void 0 && (Y.direction = "vertical"), Y.ignoreInputTextSelection === void 0 && (Y.ignoreInputTextSelection = !0), Y.mirrorContainer === void 0 && (Y.mirrorContainer = p.body); var $ = i({ containers: Y.containers, start: ze, end: ne, cancel: it, remove: ke, destroy: xe, canMove: Ie, dragging: !1 }); return Y.removeOnSpill === !0 && $.on("over", me).on("out", he), ie(), $; function G(P) { return $.containers.indexOf(P) !== -1 || Y.isContainer(P); } function ie(P) { var Q = P ? "remove" : "add"; w(d, Q, "mousedown", Te), w(d, Q, "mouseup", Ee); } function Z(P) { var Q = P ? "remove" : "add"; w(d, Q, "mousemove", Le); } function ee(P) { var Q = P ? "remove" : "add"; u[Q](d, "selectstart", Fe), u[Q](d, "click", Fe); } function xe() { ie(!0), Ee({}); } function Fe(P) { L && P.preventDefault(); } function Te(P) { E = P.clientX, N = P.clientY; var Q = R(P) !== 1 || P.metaKey || P.ctrlKey; if (!Q) { var q = P.target, ce = Ne(q); ce && (L = ce, Z(), P.type === "mousedown" && (O(q) ? q.focus() : P.preventDefault())); } } function Le(P) { if (L) { if (R(P) === 0) { Ee({}); return; } if (!(P.clientX !== void 0 && Math.abs(P.clientX - E) <= (Y.slideFactorX || 0) && P.clientY !== void 0 && Math.abs(P.clientY - N) <= (Y.slideFactorY || 0))) { if (Y.ignoreInputTextSelection) { var Q = T("clientX", P) || 0, q = T("clientY", P) || 0, ce = p.elementFromPoint(Q, q); if (O(ce)) return; } var ge = L; Z(!0), ee(), ne(), We(ge), s.add(oe || M, "gu-transit"), Oe(), _e(), U = 0, Ge(P); } } } function Ne(P) { if (!($.dragging && V) && !G(P)) { for (var Q = P; _(P) && G(_(P)) === !1; ) if (Y.invalid(P, Q) || (P = _(P), !P)) return; var q = _(P); if (q && !Y.invalid(P, Q)) { var ce = Y.moves(P, q, Q, g(P)); if (ce) return { item: P, source: q }; } } } function Ie(P) { return !!Ne(P); } function ze(P) { var Q = Ne(P); Q && We(Q); } function We(P) { $e(P.item, P.source) && (oe = P.item.cloneNode(!0), $.emit("cloned", oe, P.item, "copy")), k = P.source, M = P.item, W = K = g(P.item), $.dragging = !0, $.emit("drag", M, k); } function rt() { return !1; } function ne() { if ($.dragging) { var P = oe || M; Ve(P, _(P)); } } function be() { L = !1, Z(!0), ee(!0); }