UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,280 lines 107 kB
var De = Object.defineProperty; var We = (e, n, t) => n in e ? De(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t; var V = (e, n, t) => We(e, typeof n != "symbol" ? n + "" : n, t); import { ref as T, computed as z, defineComponent as ne, watch as Y, createVNode as w, createTextVNode as xe, mergeProps as ze, reactive as _e, withDirectives as Pe, resolveDirective as Xe, Fragment as ke, inject as he, onMounted as ye, onBeforeMount as Je, vModelText as Qe, nextTick as Te } from "vue"; import { isPlainObject as be, cloneDeep as me, debounce as He } from "lodash-es"; import Ye from "../accordion/index.esm.js"; import Ze from "../avatar/index.esm.js"; import Ke from "../../designer/button-edit/index.esm.js"; import et from "../button-group/index.esm.js"; import tt from "../calendar/index.esm.js"; import nt from "../../designer/capsule/index.esm.js"; import Ce from "../../designer/checkbox/index.esm.js"; import Fe from "../../designer/checkbox-group/index.esm.js"; import it from "../combo-list/index.esm.js"; import rt from "../combo-tree/index.esm.js"; import ot from "../component/index.esm.js"; import st from "../color-picker/index.esm.js"; import at from "../content-container/index.esm.js"; import lt from "../../designer/date-picker/index.esm.js"; import dt from "../../designer/data-grid/index.esm.js"; import ut from "../dropdown/index.esm.js"; import ct from "../../designer/dynamic-form/index.esm.js"; import pt from "../events-editor/index.esm.js"; import ft from "../filter-bar/index.esm.js"; import mt from "../field-selector/index.esm.js"; import gt from "../binding-selector/index.esm.js"; import vt from "../image-cropper/index.esm.js"; import ht from "../../designer/input-group/index.esm.js"; import yt from "../layout/index.esm.js"; import bt from "../list-nav/index.esm.js"; import Ct from "../../designer/list-view/index.esm.js"; import Ft from "../lookup/index.esm.js"; import wt from "../mapping-editor/index.esm.js"; import Et from "../nav/index.esm.js"; import St from "../number-range/index.esm.js"; import xt from "../../designer/number-spinner/index.esm.js"; import Pt from "../order/index.esm.js"; import kt from "../page-header/index.esm.js"; import Tt from "../page-footer/index.esm.js"; import It from "../pagination/index.esm.js"; import Vt from "../progress/index.esm.js"; import Mt from "../query-solution/index.esm.js"; import Lt from "../../designer/radio-group/index.esm.js"; import Bt from "../../designer/rate/index.esm.js"; import Nt from "../../designer/response-toolbar/index.esm.js"; import Ot from "../response-layout/index.esm.js"; import Rt from "../../designer/response-layout-editor/index.esm.js"; import $t from "../search-box/index.esm.js"; import Ut from "../../designer/section/index.esm.js"; import At from "../smoke-detector/index.esm.js"; import qt from "../splitter/index.esm.js"; import jt from "../step/index.esm.js"; import Gt from "../../designer/switch/index.esm.js"; import Dt from "../../designer/tabs/index.esm.js"; import Wt from "../../designer/tags/index.esm.js"; import zt from "../text/index.esm.js"; import _t from "../../designer/time-picker/index.esm.js"; import Xt from "../transfer/index.esm.js"; import Jt from "../tree-view/index.esm.js"; import Qt from "../uploader/index.esm.js"; import Ht from "../verify-detail/index.esm.js"; import Yt from "../video/index.esm.js"; import Zt from "../../designer/textarea/index.esm.js"; import Kt from "../schema-selector/index.esm.js"; import en from "../../designer/tree-grid/index.esm.js"; import tn from "../event-parameter/index.esm.js"; import nn from "../filter-condition-editor/index.esm.js"; import rn from "../fieldset/index.esm.js"; import on from "../sort-condition-editor/index.esm.js"; import sn from "../menu-lookup/index.esm.js"; import an from "../../designer/drawer/index.esm.js"; import ln from "../json-editor/index.esm.js"; import dn from "../property-editor/index.esm.js"; import un from "../expression-editor/index.esm.js"; import cn from "../code-editor/index.esm.js"; import pn from "../html-template/index.esm.js"; import fn from "../collection-property-editor/index.esm.js"; import mn from "../../designer/modal/index.esm.js"; import gn from "../external-container/index.esm.js"; import vn from "../language-textbox/index.esm.js"; import hn from "../image/index.esm.js"; import yn from "../comment/index.esm.js"; import { schemaResolverMap as bn, propertyEffectMap as Cn, propertyConfigSchemaMap as Fn, schemaMap as wn, createPropsResolver as En } from "../dynamic-resolver/index.esm.js"; import { useThirdComponent as Sn, isMobilePhone as xn, FormSchemaEntityField$Type as we, FormSchemaEntityFieldType$Type as Pn } from "../common/index.esm.js"; import { DgControl as v, canvasChanged as ue, refreshCanvas as kn } from "../designer-canvas/index.esm.js"; const Tn = { width: { type: String, default: "300px" }, height: { type: Number, default: 10 }, isWidePanel: { type: Boolean, default: !1 }, /** 是否启用搜索 */ enableSearch: { type: Boolean, default: !0 }, /** 使用模式 */ mode: { type: String, default: "panel" }, /** 是否持有面板的隐藏显示状态 */ isPersitOpenState: { type: Boolean, default: !1 }, /** isPersitOpenState=true时,控制面板是否隐藏显示 */ isShowPanel: { type: Boolean, default: !1 }, /** 属性名 */ propertyName: { type: String, default: "" }, /** 属性类型 */ propertyConfig: { type: Array }, /** 属性值 */ propertyData: { type: Object, default: {} }, /** 是否展示关闭按钮 */ showCloseBtn: { type: Boolean, default: !1 }, /** 当前选中的标签页id */ selectedTabId: { type: String, default: "" }, /** 是否是白色主题 */ isWhiteTheme: { type: Boolean, default: !0 }, /** dom结构 */ schema: { type: Object, default: {} }, /** 属性变更后事件 */ propertyChanged: { type: Function } }; function In(e = {}) { function n(f, m, o, d) { if (typeof o == "number") return d[f].length === o; if (typeof o == "object") { const p = Object.keys(o)[0], l = o[p]; if (p === "not") return Number(d[f].length) !== Number(l); if (p === "moreThan") return Number(d[f].length) >= Number(l); if (p === "lessThan") return Number(d[f].length) <= Number(l); } return !1; } function t(f, m, o, d) { return d[f] && d[f].propertyValue && String(d[f].propertyValue.value) === String(o); } const i = /* @__PURE__ */ new Map([ ["length", n], ["getProperty", t] ]); Object.keys(e).reduce((f, m) => (f.set(m, e[m]), f), i); function r(f, m) { const o = f; return typeof m == "number" ? [{ target: o, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: o, operator: "getProperty", param: f, value: !!m }] : typeof m == "object" ? Object.keys(m).map((d) => { if (d === "length") return { target: o, operator: "length", param: null, value: m[d] }; const p = d, l = m[d]; return { target: o, operator: "getProperty", param: p, value: l }; }) : []; } function s(f) { return Object.keys(f).reduce((o, d) => { const p = r(d, f[d]); return o.push(...p), o; }, []); } function a(f, m) { if (i.has(f.operator)) { const o = i.get(f.operator); return o && o(f.target, f.param, f.value, m) || !1; } return !1; } function g(f, m) { return s(f).reduce((p, l) => p && a(l, m), !0); } function c(f, m) { const o = Object.keys(f), d = o.includes("allOf"), p = o.includes("anyOf"), l = d || p, S = (l ? f[l ? d ? "allOf" : "anyOf" : "allOf"] : [f]).map((U) => g(U, m)); return d ? !S.includes(!1) : S.includes(!0); } return { parseValueSchema: c }; } const Vn = { convertTo: (e, n, t, i) => { e.appearance || (e.appearance = {}), e.appearance[n] = t; }, convertFrom: (e, n, t) => e.appearance ? e.appearance[n] : e[n] }, Mn = { convertFrom: (e, n, t) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, Ln = { convertTo: (e, n, t, i) => { e.editor && (e.editor[n] = t); }, convertFrom: (e, n, t) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, n) ? e.editor[n] : e[n] }, Bn = { 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: "标签页工具栏按钮" }, "drawer-toolbar-item": { type: "drawer-toolbar-item", name: "抽屉工具栏按钮" }, "html-template": { type: "html-template", 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: "标签页工具栏" }, "drawer-toolbar": { type: "drawer-toolbar", name: "抽屉工具栏" }, fieldset: { type: "fieldset", name: "分组" }, "query-solution": { type: "query-solution", name: "筛选方案" }, drawer: { type: "drawer", name: "抽屉" }, "external-container": { type: "external-container", name: "外部容器", icon: "content-container" }, "list-nav": { type: "list-nav", name: "列表导航" }, "list-view": { type: "list-view", name: "列表" }, "filter-bar": { type: "filter-bar", name: "筛选条" }, "language-textbox": { type: "language-textbox", name: "多语输入框" }, image: { type: "image", name: "图像" }, "discussion-editor": { type: "discussion-editor", name: "评论编辑区" }, "discussion-list": { type: "discussion-list", name: "评论列表" }, comment: { type: "comment", name: "评论区" }, "rich-text-editor": { type: "rich-text-editor", name: "富文本", icon: "rich-text-box" }, calendar: { type: "calendar", name: "日历", icon: "date-picker" }, wizard: { type: "wizard", name: "向导", icon: "wizard" }, "wizard-page": { type: "wizard-page", name: "向导页", icon: "wizard" }, "wizard-page-detail": { type: "wizard-page-detail", name: "向导详情", icon: "wizard" }, step: { type: "step", name: "步骤条", icon: "step" }, "dynamic-form": { type: "dynamic-form", name: "动态表单" } }, Nn = { convertFrom: (e, n, t) => { var r; const i = e.editor && e.editor[n] ? e.editor[n] : e[n]; return ((r = Bn[i]) == null ? void 0 : r.name) || i; } }, On = { convertTo: (e, n, t, i) => { e[n] = e[n]; }, convertFrom: (e, n, t) => e.editor ? t.getRealEditorType(e.editor.type) : "" }, Rn = { convertTo: (e, n, t, i) => { (e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[n] = t : e.formatter = { [n]: t }); }, convertFrom: (e, n, t) => { if (e.formatter) { if (n === "trueText") return e.formatter.trueText; if (n === "falseText") return e.formatter.falseText; if (n === "prefix") return e.formatter.prefix; if (n === "suffix") return e.formatter.suffix; if (n === "precision") return e.formatter.precision; if (n === "decimal") return e.formatter.decimal; if (n === "thousand") return e.formatter.thousand; if (n === "dateFormat") return e.formatter.dateFormat || "yyyy-MM-dd"; if (n === "customFormat") return e.formatter.customFormat; if (n === "type") return e.formatter.type || "none"; if (n === "customFormat") return e.formmater.customFormat; } return "none"; } }, $n = { convertTo: (e, n, t, i) => { e.command ? e.command[n] = t : e.command = { [n]: t }, n === "enableType" && t === "default" && (e.command.enable = !0, e.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ]), n === "enableType" && t === "custom" && (e.command.enable = !0, e.command.commands = [ { value: "add", text: "增加", type: "link" }, { value: "edit", text: "编辑", type: "danger" }, { value: "remove", text: "删除", type: "remove" } ]), n === "enableType" && t === "unable" && (e.command.enable = !1); }, convertFrom: (e, n, t) => { var i, r; if (e.command) { if (n === "enableType") { const s = (r = (i = e.command) == null ? void 0 : i.commands) == null ? void 0 : r.find((a) => a.command === "edit" && a.type === "primary"); return e.command.enable ? s ? "default" : "custom" : "unable"; } if (n === "commands") return e.command.enableType === "custom" ? e.command.commands : []; if (n === "formatter") return e.command.formatter; if (n === "count") return e.command.count; if (n === "columnWidth") return e.command.columnWidth || 200; } return ""; } }, Un = { convertTo: (e, n, t, i) => { e.column ? e.column[n] = t : e.column = { [n]: t }, n === "fitColumns" && t && (e.column.fitMode || (e.column.fitMode = "average")); }, convertFrom: (e, n, t) => { if (e.column) { if (n === "fitColumns") return e.column.fitColumns; if (n === "fitMode") return e.column.fitMode; } return ""; } }, An = { convertTo: (e, n, t, i) => { e.summary ? e.summary[n] = t : e.summary = { [n]: t }, n === "enable" && t && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = { enable: t, groupFields: [] }); }, convertFrom: (e, n, t) => { var i, r; return n === "customSummaryStyle" ? e.summary.customSummaryStyle : n === "position" ? ((i = e.summary) == null ? void 0 : i[n]) || "bottom" : n === "customRender" ? ((r = e.summary) == null ? void 0 : r[n]) || "" : e.summary && n === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : ""; } }, qn = { convertTo: (e, n, t, i) => { e.group ? e.group[n] = t : e.group = { [n]: t }, n === "enable" && t && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = { enable: t, groupFields: [], showSummary: !1, customRender: "" }); }, convertFrom: (e, n, t) => { if (e.group) { if (n === "enable") return e.group.enable; if (n === "showSummary") return e.group.showSummary; if (n === "customRender") return e.group.customRender; if (n === "groupFields") return e.group.groupFields; } } }, jn = { convertFrom: (e, n) => e.binding ? e.binding.path : "", convertTo: (e, n, t) => { if (t && t.length > 0) { const i = t[0]; e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = i.bindingField, e.binding.field = i.id, e.binding.fullPath = i.path, e.path = i.bindingPath; } } }, Gn = { convertTo: (e, n, t, i) => { e.pagination || (e.pagination = {}), n === "sizeLimits" ? e.pagination.sizeLimits = t.split(",") : e.pagination[n] = t; }, convertFrom: (e, n, t) => e.pagination ? n === "sizeLimits" ? e.pagination.sizeLimits.join(",") : e.pagination[n] : e[n] }, Dn = { convertTo: (e, n, t, i) => { e.rowNumber || (e.rowNumber = {}), e.rowNumber[n] = t; }, convertFrom: (e, n, t) => e.rowNumber ? e.rowNumber[n] : e[n] }, Wn = { convertTo: (e, n, t, i) => { e.selection || (e.selection = {}), e.selection[n] = t; }, convertFrom: (e, n, t) => { var i, r; return n === "showCheckbox" ? (i = e.selection) != null && i.multiSelect ? !0 : (r = e.selection) == null ? void 0 : r.showCheckbox : e.selection ? e.selection[n] : e[n]; } }, zn = { convertFrom: (e, n, t) => e[n] && e[n].length ? `共 ${e[n].length} 项` : "" }, _n = { convertFrom: (e, n) => e[n] || "", convertTo: (e, n, t) => { e[n] = t; } }, Xn = { convertTo: (e, n, t, i) => { e.size || (e.size = {}), e.size[n] = t; }, convertFrom: (e, n, t) => e.size ? e.size[n] : e[n] }, Jn = { convertFrom: (e, n, t) => { var i, r; return (i = e.formatter) != null && i.data && n === "formatterEnumData" && !e.formatterEnumData ? (r = e.formatter) == null ? void 0 : r.data : e.formatterEnumData; } }, Qn = { convertTo: (e, n, t, i) => { e.sort || (e.sort = {}), e.sort[n] = t; }, convertFrom: (e, n, t) => { var i, r; if (n === "mode") return ((i = e.sort) == null ? void 0 : i.mode) || "client"; if (n === "multiSort") return !!((r = e.sort) != null && r.multiSort); } }, Hn = { convertTo: (e, n, t, i) => { e.filter || (e.filter = {}), e.filter[n] = t; }, convertFrom: (e, n, t) => { var i; if (n === "mode") return ((i = e.filter) == null ? void 0 : i.mode) || "client"; } }, Yn = { convertTo: (e, n, t, i) => { e.rowOption ? e.rowOption[n] = t : e.rowOption = { [n]: t }; }, convertFrom: (e, n, t) => { if (e.rowOption) { if (n === "customRowStyle") return e.rowOption.customRowStyle; if (n === "customCellStyle") return e.rowOption.customCellStyle; if (n === "height") return e.rowOption.height; } return ""; } }, Zn = { convertTo: (e, n, t, i) => { (e.type === "data-grid-column" || e.type === "tree-grid-column") && (e[n] = t, n === "columnTemplateType" && t === "hyperlink" && (e.onClickLinkCommand ? e.columnTemplate = ` <span class="f-pretend-link f-cursor-pointer" @click="(ctx)=>viewModel.current.${e.onClickLinkCommand || ""}({id: rowData.id,context: ctx})"> {{rowData.${e.field}}} </span>` : e.columnTemplate = ` <span class="f-pretend-link f-cursor-pointer"> {{rowData.${e.field}}} </span>`), n === "columnTemplateType" && t === "default" && (e.columnTemplate = ""), n === "columnTemplateType" && t === "custom" && (e.columnTemplate = "")); }, convertFrom: (e, n, t) => n === "columnTemplate" ? e.columnTemplate : n === "columnTemplateType" ? e.columnTemplateType ? e.columnTemplateType || "default" : e.columnTemplate && !e.onClickLinkCommand ? "custom" : e.columnTemplate && e.onClickLinkCommand ? "hyperlink" : "default" : "" }; function Kn(e, n, t) { const i = /* @__PURE__ */ new Map([ ["/converter/appearance.converter", Vn], ["/converter/buttons.converter", Mn], ["/converter/property-editor.converter", Ln], ["/converter/items-count.converter", zn], ["/converter/type.converter", Nn], ["/converter/change-editor.converter", On], ["/converter/change-formatter.converter", Rn], ["/converter/column-command.converter", $n], ["/converter/column-option.converter", Un], ["/converter/summary.converter", An], ["/converter/group.converter", qn], ["/converter/form-group-label.converter", _n], ["/converter/field-selector.converter", jn], ["/converter/pagination.converter", Gn], ["/converter/row-number.converter", Dn], ["/converter/grid-selection.converter", Wn], ["/converter/size.converter", Xn], ["/converter/change-formatter-enum.converter", Jn], ["/converter/grid-sort.converter", Qn], ["/converter/grid-filter.converter", Hn], ["/converter/row-option.converter", Yn], ["/converter/change-formatter-type.converter", Zn] ]), r = /* @__PURE__ */ new Map([ ["string", { type: "input-group", enableClear: !1 }], ["boolean", { type: "combo-list", textField: "name", valueField: "value", idField: "value", enableClear: !1, editable: !1, data: [ { value: !0, name: "是" }, { value: !1, name: "否" } ] }], ["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }], ["array", { type: "button-edit" }], ["number", { type: "number-spinner", placeholder: "" }], ["events-editor", { type: "events-editor", hide: !0 }], ["multiLanguage", { type: "language-textbox" }] ]), s = In(); function a(l, u) { return () => s.parseValueSchema(l, u); } function g(l, u, h) { return l.includes("visible") && u.visible !== void 0 ? typeof u.visible == "boolean" ? () => !!u.visible : u.visible === void 0 ? !0 : a(u.visible, h) : () => !0; } function c(l, u, h) { return l.includes("readonly") && u.readonly !== void 0 ? typeof u.readonly == "boolean" ? () => !!u.readonly : a(u.readonly, h) : () => !1; } function f(l, u) { const h = l.$converter || u; return typeof h == "string" && h && i.has(h) ? i.get(h) || null : h || null; } function m(l, u, h, S, I, U = "", A = "") { return Object.keys(l).map((N) => { const L = T(1), G = N, O = l[N], k = Object.keys(O), Z = O.title, _ = O.type, X = r.get(_) || { type: "input-group", enableClear: !1 }, B = O.editor ? Object.assign({}, X, O.editor) : Object.assign({}, X), j = g(k, O, u), R = c(k, O, u); B.readonly = B.readonly === void 0 ? R() : B.readonly; const D = O.type === "cascade" ? m(O.properties, u, h, S, I, U, A) : [], J = !0; let W = f(O, A); const ie = z({ get() { if (L.value) { if (["class", "style"].find((pe) => pe === G) && !W && (W = i.get("/converter/appearance.converter") || null), W && W.convertFrom) return W.convertFrom(h, N, I, U); const Q = h[N]; return Object.prototype.hasOwnProperty.call(O, "defaultValue") && (Q === void 0 || typeof Q == "string" && Q === "") ? O.type === "boolean" ? O.defaultValue : O.defaultValue || "" : Q; } return null; }, set(Q) { L.value += 1, W && W.convertTo ? (W.convertTo(S, N, Q, I, U), W.convertTo(h, N, Q, I, U)) : (S[N] = Q, h[N] = Q); } }), { refreshPanelAfterChanged: re, description: ee, isExpand: oe, parentPropertyID: H } = O, se = { propertyID: G, propertyName: Z, propertyType: _, propertyValue: ie, editor: B, visible: j, readonly: R, cascadeConfig: D, hideCascadeTitle: J, refreshPanelAfterChanged: re, description: ee, isExpand: oe, parentPropertyID: H }; return u[G] = se, se; }); } function o(l, u, h = {}) { const S = {}, I = e[l]; return I && I.categories ? Object.keys(I.categories).map((A) => { const $ = I.categories[A], N = $ == null ? void 0 : $.title, L = m($.properties || {}, S, {}, h, u); return { categoryId: A, categoryName: N, properties: L }; }) : []; } function d(l, u, h, S, I = "") { const U = u.$ref.schema, A = u.$ref.converter, $ = h[U], N = $.type, L = t($), G = {}, O = e[N]; if (O && O.categories) { const k = O.categories[l], Z = k == null ? void 0 : k.title; A && Object.keys(k.properties).forEach((B) => { k.properties[B].$converter = A; }); const _ = (k == null ? void 0 : k.properties) || {}, X = m(_, G, L, $, S, I); return { categoryId: l, categoryName: Z, properties: X }; } return { categoryId: l, categoryName: "", properties: [] }; } function p(l, u, h, S, I) { const U = l.type, A = t(l), $ = {}; let N = I || e[U]; if (!(N && Object.keys(N).length > 0) && h && h.getPropConfig && (N = h.getPropConfig(S)), N && N.categories) { const G = []; return Object.keys(N.categories).map((O) => { const k = N.categories[O]; if (k.$ref) { G.push(d(O, k, l, u, S)); return; } const Z = k == null ? void 0 : k.title, _ = k == null ? void 0 : k.tabId, X = k == null ? void 0 : k.tabName, B = k == null ? void 0 : k.hide, j = k == null ? void 0 : k.hideTitle, R = m(k.properties || {}, $, A, l, u, S, k.$converter), { setPropertyRelates: D } = k, J = k == null ? void 0 : k.parentPropertyID; G.push({ categoryId: O, categoryName: Z, tabId: _, tabName: X, hide: B, properties: R, hideTitle: j, setPropertyRelates: D, parentPropertyID: J }); }), G; } return []; } return { getPropertyConfigBySchema: p, getPropertyConfigByType: o, propertyConverterMap: i }; } function ei(e, n) { let t; function i(o) { const { properties: d, title: p, ignore: l } = o, u = l && Array.isArray(l), h = Object.keys(d).reduce((S, I) => ((!u || !l.find((U) => U === I)) && (S[I] = d[I].type === "object" && d[I].properties ? i(d[I]) : me(d[I].default)), S), {}); if (p && (!u || !l.find((S) => S === "id"))) { const S = p.toLowerCase().replace(/-/g, "_"); h.id = `${S}_${Math.random().toString().slice(2, 6)}`; } return h; } function r(o) { const { properties: d, title: p, required: l } = o; if (l && Array.isArray(l)) { const u = l.reduce((h, S) => (h[S] = d[S].type === "object" && d[S].properties ? i(d[S]) : me(d[S].default), h), {}); if (p && l.find((h) => h === "id")) { const h = p.toLowerCase().replace(/-/g, "_"); u.id = `${h}_${Math.random().toString().slice(2, 6)}`; } return u; } return { type: p }; } function s(o, d = {}, p) { const l = e[o]; if (l) { let u = r(l); const h = n[o]; return u = h ? h({ getSchemaByType: s }, u, d, p) : u, t != null && t.appendIdentifyForNewControl && t.appendIdentifyForNewControl(u), u; } return null; } function a(o, d) { const p = i(d); return Object.keys(p).reduce((l, u) => (Object.prototype.hasOwnProperty.call(o, u) && (l[u] && be(l[u]) && be(o[u] || !o[u]) ? Object.assign(l[u], o[u] || {}) : l[u] = o[u]), l), p), p; } function g(o, d) { return Object.keys(o).filter((l) => o[l] != null).reduce((l, u) => { if (d.has(u)) { const h = d.get(u); if (typeof h == "string") l[h] = o[u]; else { const S = h(u, o[u], o); Object.assign(l, S); } } else l[u] = o[u]; return l; }, {}); } function c(o, d, p = /* @__PURE__ */ new Map()) { const l = a(o, d); return g(l, p); } function f(o) { var p; const d = o.type; if (d) { const l = e[d]; if (!l) return o; const u = a(o, l), h = ((p = o.editor) == null ? void 0 : p.type) || ""; if (h) { const S = e[h], I = a(o.editor, S); u.editor = I; } return u; } return o; } function m(o) { t = o; } return { getSchemaByType: s, resolveSchemaWithDefaultValue: f, resolveSchemaToProps: c, mappingSchemaToProps: g, setDesignerContext: m }; } const ti = {}, ni = {}, { resolveSchemaWithDefaultValue: ii } = ei(ti, ni), ri = {}, oi = {}, { getPropertyConfigBySchema: fe } = Kn(ri, oi, ii), si = { /** 某一分类下的属性配置 */ // as PropType<ElementPropertyConfig> category: { type: Object, default: {} }, categoryKey: { type: String }, /** 属性值 */ propertyData: { type: Object, default: {} }, valueChanged: { type: Function }, triggerRefreshPanel: { type: Function } }, ai = { elementConfig: { type: Object, default: {} }, category: { type: Object, default: {} } }, li = { id: { type: String, default: "" }, customClass: { type: String, default: "" }, customStyle: { type: String, default: "" }, /** 筛选组件配置器,具体配置项可查看各组件文档 */ editor: { type: Object, default: {} }, label: { type: String, default: "" }, /** value is uncertain because type is uncertain, default value should not be set */ modelValue: { type: [String, Boolean, Array, Number], default: null }, // readonly: { type: Boolean, default: false }, visible: { type: Boolean, default: !0 }, required: { type: Boolean, default: !1 }, showLabel: { type: Boolean, default: !0 }, /** * visible相当于showLabel为true,none相当于showLabel为false */ showLabelType: { type: String, default: "visible" }, type: { type: String, default: "input-group" }, componentId: { type: String, default: "" }, errors: { type: Object, default: null }, fill: { type: Boolean, default: !1 }, linkLabel: { type: String, default: !1 } }, di = { id: { type: String }, required: { type: Boolean, default: !1 }, text: { type: String, default: "" }, title: { type: String }, valid: { type: Boolean, default: !0 }, inValidTip: { type: String, default: "" }, /** * 实际支持 'visible'可见 | 'reserve-space' 占位不显示 */ showType: { type: String, default: "visible" }, isLink: { type: Boolean, default: !1 } }, ui = /* @__PURE__ */ ne({ name: "FDynamicFormLabel", props: di, emits: ["clickLabel"], setup(e, n) { T(e.title || e.text); const t = T(e.required), i = T(e.text), r = T(e.valid), s = T(e.inValidTip); Y(() => e.text, () => { i.value = e.text; }), Y(() => e.required, (d, p) => { d !== p && (t.value = d); }), Y([() => e.valid, () => e.inValidTip], ([d, p]) => { r.value = d, s.value = p; }); const a = z(() => r.value ? i.value : s.value), g = z(() => r.value ? "" : "color:red"), c = z(() => ({ "col-form-label": !0, // 指定必填,当显示模式是隐藏或者没有指定标签名时,宽度不限定 "f-width-auto": t.value && (e.showType === "none" || !i.value) })), f = z(() => e.showType === "force-none" ? !1 : e.showType === "reserve-space" || t.value || !!i.value && e.showType !== "none"), m = () => { e.showType !== "reserve-space" && n.emit("clickLabel"); }, o = z(() => ({ "farris-label-text": !0, "f-pretend-link": !!e.isLink && e.showType !== "reserve-space" })); return () => f.value && w("label", { class: c.value, title: a.value, style: g.value }, [!r.value && w("span", { class: "f-icon f-icon-warning mr-1", style: "color: red; min-width: 16px;", title: s.value }, null), w("span", { class: o.value, onClick: m }, [t.value && w("span", { class: "farris-label-info text-danger" }, [xe("*")]), e.showType === "visible" && i.value])]); } }), { globalStorageKey: ci } = Sn(), y = {}, b = {}, C = {}, F = {}; async function pi() { { const e = { schemaMap: wn, propertyConfigSchemaMap: Fn, propertyEffectMap: Cn, schemaResolverMap: bn }; Ze.register(y, b, C, F), Ye.register(y, b, C, F), Ke.register(y, b, C, F), et.register(y, b, C, F), tt.register(y, b, C, F, e), nt.register(y, b, C, F), Ce.register(y, b, C, F, e), Fe.register(y, b, C, F, e), Ce.register(y, b, C, F, e), Fe.register(y, b, C, F, e), it.register(y, b, C, F, e), rt.register(y, b, C, F), ot.register(y, b, C, F), at.register(y, b, C, F, e), st.register(y, b, C, F), lt.register(y, b, C, F, e), dt.register(y, b, C, F, e), ut.register(y, b, C, F), ct.register(y, b, C, F, e), pt.register(y, b, C, F), un.register(y, b, C, F), ft.register(y, b, C, F), mt.register(y, b, C, F), nn.register(y, b, C, F), vt.register(y, b, C, F), ht.register(y, b, C, F, e), yt.register(y, b, C, F, e), Ct.register(y, b, C, F, e), bt.register(y, b, C, F), Ft.register(y, b, C, F, e), wt.register(y, b, C, F), Et.register(y, b, C, F), St.register(y, b, C, F), xt.register(y, b, C, F, e), Pt.register(y, b, C, F), kt.register(y, b, C, F, e), Tt.register(y, b, C, F), It.register(y, b, C, F), Vt.register(y, b, C, F), Mt.register(y, b, C, F, e), Lt.register(y, b, C, F, e), Bt.register(y, b, C, F), Ot.register(y, b, C, F, e), Rt.register(y, b, C, F), Nt.register(y, b, C, F), Kt.register(y, b, C), $t.register(y, b, C, F), Ut.register(y, b, C, F, e), At.register(y, b, C, F), qt.register(y, b, C, F), jt.register(y, b, C, F), Gt.register(y, b, C, F, e), on.register(y, b, C, F), Dt.register(y, b, C, F, e), Wt.register(y, b, C, F), zt.register(y, b, C, F), _t.register(y, b, C, F, e), Xt.register(y, b, C, F), Jt.register(y, b, C, F), Ht.register(y, b, C, F), Qt.register(y, b, C, F), Yt.register(y, b, C, F), Zt.register(y, b, C, F, e), en.register(y, b, C, F), gt.register(y, b, C, F), tn.register(y, b, C, F), rn.register(y, b, C, F, e), sn.register(y, b, C, F), an.register(y, b, C, F), ln.register(y, b, C, F), dn.register(y, b, C, F), cn.register(y, b, C, F), pn.register(y, b, C, F, e), fn.register(y, b, C, F), mn.register(y, b, C, F), gn.register(y, b, C, F), vn.register(y, b, C, F, e), hn.register(y, b, C, F, e), yn.register(y, b, C, F); const n = window[ci]; if (n) for (const t in n) n[t].createPropsResolver = En, n[t].register(y, b, C); } } function fi() { pi(); function e(a) { const g = y[a]; if (!g) throw new Error(`Could not find the editor of type '${a}'`); return g; } function n(a, g) { const c = b[a]; return c ? c(g) : {}; } function t(a) { switch (a) { case "check-box": return "onChangeValue"; case "switch": return "onModelValueChanged"; case "check-group": return "onChangeValue"; case "combo-list": case "combo-tree": return "onChange"; case "combo-lookup": return ""; case "year-range": case "year-picker": case "month-range": case "month-picker": case "date-range": case "datetime-range": case "datetime-picker": return "onDatePicked"; case "date-picker": return "onUpdate:modelValue"; case "time-picker": return "onValueChange"; case "input-group": return "onChange"; case "lookup": case "sort-condition-editor": case "filter-condition-editor": case "code-editor": case "language-textbox": case "rich-text-editor": return "onUpdate:modelValue"; case "number-range": return "onValueChange"; case "number-spinner": return "onValueChange"; case "radio-group": return "onChangeValue"; case "text": return ""; case "events-editor": return "onSavedCommandListChanged"; case "grid-field-editor": case "item-collection-editor": case "response-form-layout-setting": case "response-layout-editor-setting": case "response-layout-splitter": case "menu-lookup": case "json-editor": return "onChange"; case "field-selector": case "binding-selector": return "onFieldSelected"; case "schema-selector": return "onSchemaSelected"; case "mapping-editor": return "onMappingFieldsChanged"; case "textarea": return "onChange"; case "query-solution-config": case "solution-preset": case "filter-bar-config": return "onFieldsChanged"; case "property-editor": return "onValueChange"; case "expression-editor": return "onExpressionChanged"; case "collection-property-editor": return "onValueChange"; default: return "onUpdate:modelValue"; } } function i(a) { switch (a) { case "combo-list": case "input-group": case "textarea": return "onClear"; } } function r(a) { switch (a) { case "input-group": case "textarea": return "onMousedownEvent"; } } function s(a) { switch (a) { case "input-group": case "textarea": return "onMouseupEvent"; } } return { resolveEditorProps: n, resolveEditorType: e, getChangeFunctionName: t, getClearFunctionName: i, getMousedownFunctionName: r, getMouseupFunctionName: s }; } const mi = { /** * 显示的错误信息 */ errors: { type: Object, default: null } }, gi = /* @__PURE__ */ ne({ name: "FValidationMessage", props: mi, emits: [], setup(e, n) { const t = T(e.errors); Y(() => e.errors, (s) => { t.value = s; }); const i = T(!0), r = z(() => { if (t.value) { const s = Object.keys(t.value).map((a) => { var g; return (g = t.value[a]) == null ? void 0 : g.name; }); return s.length ? s.join(" ") : ""; } return ""; }); return () => r.value && w("div", { class: "farris-feedback f-state-invalid", onClick: () => i.value = !i.value }, [!i.value && w("span", { class: "f-icon f-icon-message_warning f-feedback-icon" }, null), i.value && w("span", { class: "f-feedback-message" }, [r.value])]); } }), vi = /* @__PURE__ */ ne({ name: "FDynamicFormGroup", props: li, emits: ["change", "update:modelValue", "clickLabel"], setup(e, n) { var X; const t = T(e.id), i = T(e.customClass), r = T(e.editor), s = T(e.label), a = T(e.modelValue), g = T(e.readonly), c = T(((X = e.editor) == null ? void 0 : X.required) || e.required), f = T(e.showLabel), m = T(e.visible); T(e.type); const o = T(), d = T(e.errors), p = xn(), l = T(e.editor.type || "input-group"), u = z(() => f.value ? e.showLabelType : "none"), { resolveEditorProps: h, resolveEditorType: S, getChangeFunctionName: I, getClearFunctionName: U } = fi(), A = z(() => { const B = { "form-group": !0, "farris-form-group": !0, "common-group": !0, "q-state-readonly": g.value, "form-group--in-mobile": p }; return B["form-group--has-" + l.value] = !0, B; }), $ = z(() => { if (e.fill) return { maxWidth: "none" }; }); function N(B, j, R) { a.value = j !== void 0 ? j : B, n.emit("update:modelValue", a.value), n.emit("change", a.value, { newValue: B, newModelValue: j, parameters: R }); } function L() { n.emit("update:modelValue", ""); } function G(B) { return (...j) => { L(), typeof B == "function" && B(...j); }; } function O(B) { return (j, R, D) => { N(j, R, D), typeof B == "function" && B(j, R, D); }; } const k = z(() => { const B = r.value.type || "input-group", j = S(B), R = h(B, r.value), D = I(B), J = U(r.value.type); return J && (R[J] = G(R[J])), D && (R[D] = O(R[D])), (R.id == null || R.id === "") && (R.id = t.value), B === "number-range" && r.value.onBeginValueChange && typeof r.value.onBeginValueChange == "function" ? (r.value.onBeginValueChange && typeof r.value.onBeginValueChange == "function" && (R.onBeginValueChange = r.value.onBeginValueChange), r.value.onEndValueChange && typeof r.value.onEndValueChange == "function" && (R.onEndValueChange = r.value.onEndValueChange)) : B === "lookup" && r.value["onUpdate:idValue"] && typeof r.value["onUpdate:idValue"] == "function" ? (R["onUpdate:idValue"] = r.value["onUpdate:idValue"], R.id = t.value) : B === "collection-property-editor" && r.value.onSelectionChange && typeof r.value.onSelectionChange == "function" ? R.onSelectionChange = r.value.onSelectionChange : B === "property-editor" && (R.onBeforeOpenVariables = r.value.onBeforeOpenVariables), () => w(j, ze({ ref: o }, R, { modelValue: a.value, "onUpdate:modelValue": (W) => a.value = W }), n.slots); }); function Z() { return w(gi, { id: `${t.value}-validation-message`, errors: d.value }, null); } Y([() => e.id, () => e.customClass, () => e.editor, () => e.label, () => e.modelValue, () => e.readonly, () => e.required, () => e.showLabel, () => e.visible, () => e.errors], ([B, j, R, D, J, W, ie, re, ee, oe]) => { var H; t.value = B, i.value = j, r.value = R, s.value = D, a.value = J, g.value = W, c.value = ((H = r.value) == null ? void 0 : H.required) || ie, f.value = re, m.value = ee, d.value = oe; }); function _(B) { n.emit("clickLabel", B); } return n.expose({ editorRef: o }), () => m.value && w("div", { id: `${t.value}-form-group`, class: i.value, style: e.customStyle }, [w("div", { class: "farris-group-wrap", style: $.value }, [w("div", { class: A.value }, [w(ui, { id: `${t.value}-lable`, showType: u.value, required: c.value, text: s.value, title: s.value, isLink: !!e.linkLabel, onClickLabel: _ }, null), w("div", { class: "farris-input-wrap" }, [k.value(), Z()])])])]); } }), hi = /* @__PURE__ */ ne({ name: "FPropertyPanelItem", props: ai, emits: ["propertyChange", "triggerRefreshPanel"], setup(e, n) { var o; const t = T((o = e.category) == null ? void 0 : o.categoryId), i = T(e.elementConfig.propertyID), r = T(e.elementConfig.propertyName); T(e.elementConfig.editor); const s = T(e.elementConfig.propertyValue), a = z(() => { const d = e.elementConfig.visible; return { "farris-group-wrap": !0, "property-item": !0, "d-none": !(typeof d == "boolean" ? d : d === void 0 ? !0 : d()) }; }); Y(() => { var d; return (d = e.elementConfig) == null ? void 0 : d.propertyValue; }, (d) => { s.value = d; }), Y(() => { var d; return (d = e.elementConfig) == null ? void 0 : d.propertyName; }, (d) => { r.value = d; }); function g(d, p) { const { parameters: l } = p; e.elementConfig.propertyValue = d; const u = { propertyID: e.elementConfig.propertyID, propertyValue: d }; n.emit("propertyChange", u, l, e.elementConfig.refreshPanelAfterChanged); } const c = e.elementConfig.description ? `<div style="color: gray; "> 描述 :${e.elementConfig.description}</div>` : "", f = _e({ content: ` <div> <div style="color: black; ">${e.elementConfig.propertyName}</div> <div style="color: gray; ">ID:${e.elementConfig.propertyID}</div> ${c} </div>`, placement: "left" }), m = T(""); return m.value = `${t.value}-${i.value}`, () => w("div", { class: a.value }, [e.elementConfig.propertyName && Pe(w("label", { class: `col-form-label ${m.value}` }, [w("span", { class: "farris-label-text" }, [r.value])]), [[Xe("tooltip"), f]]), w(vi, { id: m.value, showLabel: !1, editor: e.elementConfig.editor, modelValue: s.value, onChange: g, editorParams: e.elementConfig.editorParams }, null)]); } }), yi = /* @__PURE__ */ ne({ name: "FPropertyPanelItemList", props: si, emits: ["valueChanged", "submitModal", "triggerRefreshPanel"], setup(e, n) { const t = T(e.category); function i(p) { if (!p.hideCascadeTitle) return w("div", { class: "farris-input-wrap" }, [w("input", { title: "summary", type: "input", class: "form-control form-control-sm", value: p.cascadeSummary, readonly: !0 }, null)]); } function r(p, l) { l.isExpand = !l.isExpand; } function s(p) { return w("div", { class: "landscape" }, [w("button", { title: "expand-button", class: ["btn f-btn-collapse-expand f-btn-mx px-1", { "f-state-expand": p.isExpand }], onClick: (l) => r(l, p) }, [w("span", null, null)])]); } function a(p) { return w("div", { class: `f-section-formgroup-legend ${t.value.categoryId}-${p.propertyID}` }, [w("div", { class: "f-header px-0 my-0 col-form-label", style: "font-size: inherit;" }, [w("div", { class: "wrap" }, [w("span", { class: ["f-icon mr-1", { "f-icon-arrow-60-right": !p.isExpand, "f-icon-arrow-60-down": p.isExpand }] }, null), w("span", { class: "farris-label-text" }, [p.propertyName])])])]); } function g(p) { return `${e.categoryKey}_${p.propertyID}`; } async function c(p, l, u) { p.categoryId = t.value.categoryId, t.value.enableCascade && (p.propertyPath = t.value.parentPropertyID), t.value.setPropertyRelates && await t.value.setPropertyRelates(p, e.propertyData, l), n.emit("valueChanged", { changeObject: p }), u && n.emit("triggerRefreshPanel"); } function f() { n.emit("triggerRefreshPanel"); } function m(p) { return w("div", { class: "px-2 mb-2" }, [w(hi, { key: g(p), elementConfig: p, category: t.value, onPropertyChange: c, onTriggerRefreshPanel: f }, null)]); } function o(p) { var l; return w("div", { class: "propertyCascadeItem farris-panel px-2 mb-2" }, [w("div", { class: ["farris-panel-item card", { hidden: !p.isExpand }] }, [w("div", { class: "card-header", onClick: (u) => r(u, p) }, [w("div", { class: "panel-item-title" }, [w("div", { class: "form-group farris-form-group line-item" }, [a(p), i(p), s(p)])])]), w("div", { class: ["card-body", { hidden: !p.isExpand }] }, [(l = p.cascadeConfig) == null ? void 0 : l.map((u) => m(u))])])]); } Y(() => e.category, () => { t.value = e.category; }); function d(p) { return p.propertyType === "cascade" ? o : m; } return () => w(ke, null, [t.value.properties.map((p) => d(p)(p))]); } }), Ee = /* @__PURE__ */ ne({ name: "FPropertyPanel", props: Tn, emits: ["propertyChanged"], setup(e, n) { const t = T(e.width), i = T(e.isWidePanel), r = T(e.enableSearch), s = T(e.mode), a = T(e.isPersitOpenState), g = T(e.isShowPanel), c = T(), f = T(), m = T(e.showCloseBtn), o = T(e.selectedTabId), d = T(!0), p = T(e.isWhiteTheme); let l = [], u = []; const h = T(""), S = T(), I = T(), U = he("SchemaService"); let A = [], $ = null, N = ""; const L = T(), G = T(0), O = z(() => l.map((x) => !x.hide).length === 1), k = he("designerContext"); function Z() { u = [], L.value && L.value.categoryList && Array.isArray(L.value.categoryList) && L.value.categoryList.length > 0 && L.value.categoryList.forEach((P) => { if (P.properties && Array.isArray(P.properties) && P.properties.length > 0) { const E = P.properties.map((M) => (M.category = P, M.propertyType === "cascade" && M.cascadeConfig && M.cascadeConfig.map((q) => { q.category = P, q.cascadeParent = M, u = u.concat(q); }), M)); u = u.concat(E); } }); } function _(x) { let P = x.offsetTop, E = x.offsetParent; for (; E !== null; ) P += E.offsetTop, E = E.offsetParent; return P; } function X(x, P) { x && P && Object.keys(P).length > 0 && Object.keys(P).forEach((E) => { var q; const M = P[E]; (q = x.style) == null || q.setProperty(E, M); }); } function B() { return u.filter((P) => { if (typeof P.visible == "function" && !P.visible() || typeof P.visible == "boolean" && !P.visible) return !1; const E = P.propertyID.toLowerCase(), M = P.propertyName.toLowerCase(); return !!(E && E.includes(h.value.toLowerCase()) || M && M.includes(h.value.toLowerCase())); }); } function j(x, P, E) { if (x === 0) { const M = _(P), le = _(E) - M - 5; P == null || P.scroll({ top: le, behavior: "smooth" }); } } function R(x) { A && A.length > 0 && (A.forEach((E) => { E.style.cssText = ""; }), A = []); const P = I.value; if (!h.value) S.value && P && (P.scrollTop = 0); else if (Z(), u && u.length > 0) { const E = B(); E && E.length > 0 && setTimeout(() => { let M = null, q = -1, le = !1; E.forEach((K, je) => { const Ge = K.propertyType === "cascade" ? `.${K.category.categoryId}-${K.propertyID} .farris-label-text` : `.property-item .${K.category.categoryId}-${K.propertyID}.col-form-label`, de = document.querySelector(Ge); de && (K.category.status !== "open" && (K.category.status = "open", le = q < 0), K.cascadeParent && (K.cascadeParent.isExpand = !0), q < 0 && (M = de, q = je), X(de, { color: "#5B89FE" }), A.push(de)); }), q > -1 && (le ? Te(() => { j(q, P, M); }) : j(q, P, M)); }, 50); } } function D(x) { R(); } const J = He(D, 200); function W(x) { const { value: P } = x.target; J(P); } function ie(x) { D(h.value); } function re() { a.value || (d.value = !1), n.emit("closePropertyPanel"); } function ee(x) { h.value = "", R(); } function oe(x) { !x.status || x.status === "open" ? x.