UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,434 lines 328 kB
var ga = Object.defineProperty; var ha = (e, t, n) => t in e ? ga(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var Ce = (e, t, n) => ha(e, typeof t != "symbol" ? t + "" : t, n); import { ref as b, computed as I, defineComponent as ie, provide as Sn, createVNode as C, watch as ee, inject as Te, onMounted as ve, onBeforeUnmount as Fn, nextTick as Ve, createTextVNode as vt, withDirectives as Tn, vModelText as ba, Teleport as xn, createApp as Zt, onUnmounted as bt, Fragment as tt, onBeforeMount as Ca, Transition as On, shallowRef as wa, render as _t, h as ka, cloneVNode as Sa, mergeProps as Et, reactive as Ae, vShow as Fa, onUpdated as Ta } from "vue"; import { cloneDeep as lt, isPlainObject as fn, isUndefined as Pe, debounce as xa } from "lodash-es"; import { getCustomClass as Mt, getCustomStyle as Oa, FormSchemaEntityFieldType$Type as Ma, withInstall as Mn, FormSchemaEntityField$Type as pn, FormSchemaEntityFieldTypeName as mn, useGuid as Ba } from "../common/index.esm.js"; import { getSchemaByTypeForDesigner as Da, resolveAppearance as Bn, createPropsResolver as Kt } from "../dynamic-resolver/index.esm.js"; import { useI18n as Ct } from "vue-i18n"; import Ea, { FButtonEdit as Dn } from "../button-edit/index.esm.js"; import Pa from "../list-view/index.esm.js"; import ja from "../../designer/button-edit/index.esm.js"; import { useDesignerComponent as Na } from "../designer-canvas/index.esm.js"; import { InputBaseProperty as Ia } from "../property-panel/index.esm.js"; import Ra from "../tree-view/index.esm.js"; import { LocaleService as Pt } from "../locale/index.esm.js"; import "../accordion/index.esm.js"; import "../avatar/index.esm.js"; import "../button-group/index.esm.js"; import "../calendar/index.esm.js"; import "../capsule/index.esm.js"; import "../../designer/checkbox/index.esm.js"; import "../../designer/checkbox-group/index.esm.js"; import "../combo-list/index.esm.js"; import "../combo-tree/index.esm.js"; import "../component/index.esm.js"; import "../color-picker/index.esm.js"; import "../content-container/index.esm.js"; import "../date-picker/index.esm.js"; import "../../designer/data-grid/index.esm.js"; import "../dropdown/index.esm.js"; import "../dynamic-form/index.esm.js"; import "../events-editor/index.esm.js"; import "../filter-bar/index.esm.js"; import "../field-selector/index.esm.js"; import "../binding-selector/index.esm.js"; import "../image-cropper/index.esm.js"; import "../../designer/input-group/index.esm.js"; import "../layout/index.esm.js"; import "../list-nav/index.esm.js"; import "../../designer/list-view/index.esm.js"; import "../lookup/index.esm.js"; import "../mapping-editor/index.esm.js"; import "../nav/index.esm.js"; import "../number-range/index.esm.js"; import "../number-spinner/index.esm.js"; import "../order/index.esm.js"; import "../page-header/index.esm.js"; import "../page-footer/index.esm.js"; import "../pagination/index.esm.js"; import "../progress/index.esm.js"; import "../query-solution/index.esm.js"; import "../../designer/radio-group/index.esm.js"; import "../rate/index.esm.js"; import "../response-toolbar/index.esm.js"; import "../response-layout/index.esm.js"; import "../response-layout-editor/index.esm.js"; import "../search-box/index.esm.js"; import "../section/index.esm.js"; import "../smoke-detector/index.esm.js"; import "../splitter/index.esm.js"; import "../step/index.esm.js"; import "../switch/index.esm.js"; import "../tabs/index.esm.js"; import La from "../tags/index.esm.js"; import "../text/index.esm.js"; import "../time-picker/index.esm.js"; import "../transfer/index.esm.js"; import "../uploader/index.esm.js"; import "../verify-detail/index.esm.js"; import "../video/index.esm.js"; import "../textarea/index.esm.js"; import "../schema-selector/index.esm.js"; import "../../designer/tree-grid/index.esm.js"; import "../event-parameter/index.esm.js"; import "../filter-condition-editor/index.esm.js"; import "../fieldset/index.esm.js"; import "../sort-condition-editor/index.esm.js"; import "../menu-lookup/index.esm.js"; import "../../designer/drawer/index.esm.js"; import "../json-editor/index.esm.js"; import "../property-editor/index.esm.js"; import "../expression-editor/index.esm.js"; import "../code-editor/index.esm.js"; import "../html-template/index.esm.js"; import "../collection-property-editor/index.esm.js"; import "../modal/index.esm.js"; import "../external-container/index.esm.js"; import "../language-textbox/index.esm.js"; import { useResizeObserver as $a } from "@vueuse/core"; import { getHierarchyRow as za, useIdentify as Ha, useGroupData as Aa, useFilter as Va, useHierarchy as Wa, useLoading as qa, useDataView as Ga, useSelection as _a, useSelectHierarchyItem as Ya, usePagination as Ua, useDataViewContainerStyle as Xa, useCommandColumn as Ja, useSettingColumn as Qa, useColumn as Za, useSort as Ka, useGroupColumn as eo, useRow as to, useEdit as no, useVisualDataBound as ao, useVisualDataCell as oo, useVisualDataRow as io, useVisualData as ro, useCellPosition as lo, useSidebar as so, useVirtualScroll as uo, useFitColumn as co, useFilterHistory as fo, useColumnFilter as po, useDragColumn as mo, getColumnHeader as yo, getSidebar as vo, getDisableMask as go, getHorizontalScrollbar as ho, getVerticalScrollbar as bo, getEmpty as Co, getPagination as wo, getSummary as ko } from "../data-view/index.esm.js"; import "../notify/index.esm.js"; import So from "../popover/index.esm.js"; const Fo = { modelValue: { type: String, default: "" }, singleExpand: { type: Boolean, default: !0 }, entities: { type: Array, default: [] }, variables: { type: Array, default: [] }, disabledFunctions: { type: Object, default: null }, esprimaPath: { type: String, default: "assets/esprima-config.json" }, showMessage: { type: Boolean, default: !1 }, validateMessage: { type: String, default: "" }, messageType: { type: String, default: "info" }, showMessageType: { type: Boolean, default: !1 }, showDataPanel: { type: Boolean, default: !0 }, isServerSide: { type: Boolean, default: !1 } }; function En(e, t) { let n; function a(d) { const { properties: c, title: m, ignore: v } = d, h = v && Array.isArray(v), g = Object.keys(c).reduce((k, S) => ((!h || !v.find((E) => E === S)) && (k[S] = c[S].type === "object" && c[S].properties ? a(c[S]) : lt(c[S].default)), k), {}); if (m && (!h || !v.find((k) => k === "id"))) { const k = m.toLowerCase().replace(/-/g, "_"); g.id = `${k}_${Math.random().toString().slice(2, 6)}`; } return g; } function o(d) { const { properties: c, title: m, required: v } = d; if (v && Array.isArray(v)) { const h = v.reduce((g, k) => (g[k] = c[k].type === "object" && c[k].properties ? a(c[k]) : lt(c[k].default), g), {}); if (m && v.find((g) => g === "id")) { const g = m.toLowerCase().replace(/-/g, "_"); h.id = `${g}_${Math.random().toString().slice(2, 6)}`; } return h; } return { type: m }; } function i(d, c = {}, m) { const v = e[d]; if (v) { let h = o(v); const g = t[d]; return h = g ? g({ getSchemaByType: i }, h, c, m) : h, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(h), h; } return null; } function r(d, c) { const m = a(c); return Object.keys(m).reduce((v, h) => (Object.prototype.hasOwnProperty.call(d, h) && (v[h] && fn(v[h]) && fn(d[h] || !d[h]) ? Object.assign(v[h], d[h] || {}) : v[h] = d[h]), v), m), m; } function l(d, c) { return Object.keys(d).filter((v) => d[v] != null).reduce((v, h) => { if (c.has(h)) { const g = c.get(h); if (typeof g == "string") v[g] = d[h]; else { const k = g(h, d[h], d); Object.assign(v, k); } } else v[h] = d[h]; return v; }, {}); } function u(d, c, m = /* @__PURE__ */ new Map()) { const v = r(d, c); return l(v, m); } function s(d) { var m; const c = d.type; if (c) { const v = e[c]; if (!v) return d; const h = r(d, v), g = ((m = d.editor) == null ? void 0 : m.type) || ""; if (g) { const k = e[g], S = r(d.editor, k); h.editor = S; } return h; } return d; } function y(d) { n = d; } return { getSchemaByType: i, resolveSchemaWithDefaultValue: s, resolveSchemaToProps: u, mappingSchemaToProps: l, setDesignerContext: y }; } const Pn = {}, jn = {}, { getSchemaByType: Lc, resolveSchemaWithDefaultValue: To, resolveSchemaToProps: xo, mappingSchemaToProps: Oo, setDesignerContext: $c } = En(Pn, jn); function Mo(e = {}) { function t(s, y, d, c) { if (typeof d == "number") return c[s].length === d; if (typeof d == "object") { const m = Object.keys(d)[0], v = d[m]; if (m === "not") return Number(c[s].length) !== Number(v); if (m === "moreThan") return Number(c[s].length) >= Number(v); if (m === "lessThan") return Number(c[s].length) <= Number(v); } return !1; } function n(s, y, d, c) { return c[s] && c[s].propertyValue && String(c[s].propertyValue.value) === String(d); } const a = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((s, y) => (s.set(y, e[y]), s), a); function o(s, y) { const d = s; return typeof y == "number" ? [{ target: d, operator: "length", param: null, value: Number(y) }] : typeof y == "boolean" ? [{ target: d, operator: "getProperty", param: s, value: !!y }] : typeof y == "object" ? Object.keys(y).map((c) => { if (c === "length") return { target: d, operator: "length", param: null, value: y[c] }; const m = c, v = y[c]; return { target: d, operator: "getProperty", param: m, value: v }; }) : []; } function i(s) { return Object.keys(s).reduce((d, c) => { const m = o(c, s[c]); return d.push(...m), d; }, []); } function r(s, y) { if (a.has(s.operator)) { const d = a.get(s.operator); return d && d(s.target, s.param, s.value, y) || !1; } return !1; } function l(s, y) { return i(s).reduce((m, v) => m && r(v, y), !0); } function u(s, y) { const d = Object.keys(s), c = d.includes("allOf"), m = d.includes("anyOf"), v = c || m, k = (v ? s[v ? c ? "allOf" : "anyOf" : "allOf"] : [s]).map((E) => l(E, y)); return c ? !k.includes(!1) : k.includes(!0); } return { parseValueSchema: u }; } const Bo = { convertTo: (e, t, n, a) => { e.appearance || (e.appearance = {}), e.appearance[t] = n; }, convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t] }, Do = { convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, Eo = { convertTo: (e, t, n, a) => { e.editor && (e.editor[t] = n); }, convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t] }, L = { 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: "标签页工具栏按钮" }, "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: "标签页工具栏" }, 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: "多语输入框" } }, Po = { convertFrom: (e, t, n) => { var o; const a = e.editor && e.editor[t] ? e.editor[t] : e[t]; return ((o = L[a]) == null ? void 0 : o.name) || a; } }, jo = { convertTo: (e, t, n, a) => { e[t] = e[t]; }, convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : "" }, No = { convertTo: (e, t, n, a) => { (e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = n : e.formatter = { [t]: n }); }, convertFrom: (e, t, n) => { if (e.formatter) { if (t === "trueText") return e.formatter.trueText; if (t === "falseText") return e.formatter.falseText; if (t === "prefix") return e.formatter.prefix; if (t === "suffix") return e.formatter.suffix; if (t === "precision") return e.formatter.precision; if (t === "decimal") return e.formatter.decimal; if (t === "thousand") return e.formatter.thousand; if (t === "tempDateFormat") return e.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : e.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : e.formatter.tempDateFormat || e.formatter.dateFormat || "yyyy-MM-dd"; if (t === "customFormat") return e.formatter.customFormat; if (t === "type") return e.formatter.type || "none"; } return "none"; } }, Io = { convertTo: (e, t, n, a) => { e.command ? e.command[t] = n : e.command = { [t]: n }, t === "enable" && n && (e.command.commands || (e.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ])); }, convertFrom: (e, t, n) => e.command && t === "enable" ? e.command.enable : "" }, Ro = { convertTo: (e, t, n, a) => { e.column ? e.column[t] = n : e.column = { [t]: n }, t === "fitColumns" && n && (e.column.fitMode || (e.column.fitMode = "average")); }, convertFrom: (e, t, n) => { if (e.column) { if (t === "fitColumns") return e.column.fitColumns; if (t === "fitMode") return e.column.fitMode; } return ""; } }, Lo = { convertTo: (e, t, n, a) => { e.summary ? e.summary[t] = n : e.summary = { [t]: n }, t === "enable" && n && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = { enable: n, groupFields: [] }); }, convertFrom: (e, t, n) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : "" }, $o = { convertTo: (e, t, n, a) => { e.group ? e.group[t] = n : e.group = { [t]: n }, t === "enable" && n && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = { enable: n, groupFields: [], showSummary: !1 }); }, convertFrom: (e, t, n) => { if (e.group) { if (t === "enable") return e.group.enable; if (t === "showSummary") return e.group.showSummary; } } }, zo = { convertFrom: (e, t) => e.binding ? e.binding.path : "", convertTo: (e, t, n) => { if (n && n.length > 0) { const a = n[0]; e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = a.bindingField, e.binding.field = a.id, e.binding.fullPath = a.path, e.path = a.bindingPath; } } }, Ho = { convertTo: (e, t, n, a) => { e.pagination || (e.pagination = {}), e.pagination[t] = n; }, convertFrom: (e, t, n) => e.pagination ? e.pagination[t] : e[t] }, Ao = { convertTo: (e, t, n, a) => { e.rowNumber || (e.rowNumber = {}), e.rowNumber[t] = n; }, convertFrom: (e, t, n) => e.rowNumber ? e.rowNumber[t] : e[t] }, Vo = { convertTo: (e, t, n, a) => { e.selection || (e.selection = {}), e.selection[t] = n; }, convertFrom: (e, t, n) => e.selection ? e.selection[t] : e[t] }, Wo = { convertFrom: (e, t, n) => e[t] && e[t].length ? `共 ${e[t].length} 项` : "" }, qo = { convertFrom: (e, t) => e[t] || "", convertTo: (e, t, n) => { e[t] = n; } }, Go = { convertTo: (e, t, n, a) => { e.size || (e.size = {}), e.size[t] = n; }, convertFrom: (e, t, n) => e.size ? e.size[t] : e[t] }, _o = { convertFrom: (e, t, n) => { var a, o; return (a = e.formatter) != null && a.data && t === "formatterEnumData" && !e.formatterEnumData ? (o = e.formatter) == null ? void 0 : o.data : e.formatterEnumData; } }, Yo = { convertTo: (e, t, n, a) => { e.sort || (e.sort = {}), e.sort[t] = n; }, convertFrom: (e, t, n) => { var a, o; if (t === "mode") return ((a = e.sort) == null ? void 0 : a.mode) || "client"; if (t === "multiSort") return !!((o = e.sort) != null && o.multiSort); } }, Uo = { convertTo: (e, t, n, a) => { e.filter || (e.filter = {}), e.filter[t] = n; }, convertFrom: (e, t, n) => { var a; if (t === "mode") return ((a = e.filter) == null ? void 0 : a.mode) || "client"; } }, Xo = { convertTo: (e, t, n, a) => { e.rowOption ? e.rowOption[t] = n : e.rowOption = { [t]: n }; }, convertFrom: (e, t, n) => { if (e.rowOption) { if (t === "customRowStyle") return e.rowOption.customRowStyle; if (t === "customCellStyle") return e.rowOption.customCellStyle; } return ""; } }; function Nn(e, t, n) { const a = /* @__PURE__ */ new Map([ ["/converter/appearance.converter", Bo], ["/converter/buttons.converter", Do], ["/converter/property-editor.converter", Eo], ["/converter/items-count.converter", Wo], ["/converter/type.converter", Po], ["/converter/change-editor.converter", jo], ["/converter/change-formatter.converter", No], ["/converter/column-command.converter", Io], ["/converter/column-option.converter", Ro], ["/converter/summary.converter", Lo], ["/converter/group.converter", $o], ["/converter/form-group-label.converter", qo], ["/converter/field-selector.converter", zo], ["/converter/pagination.converter", Ho], ["/converter/row-number.converter", Ao], ["/converter/grid-selection.converter", Vo], ["/converter/size.converter", Go], ["/converter/change-formatter-enum.converter", _o], ["/converter/grid-sort.converter", Yo], ["/converter/grid-filter.converter", Uo], ["/converter/row-option.converter", Xo] ]), o = /* @__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 }] ]), i = Mo(); function r(v, h) { return () => i.parseValueSchema(v, h); } function l(v, h, g) { return v.includes("visible") && h.visible !== void 0 ? typeof h.visible == "boolean" ? () => !!h.visible : h.visible === void 0 ? !0 : r(h.visible, g) : () => !0; } function u(v, h, g) { return v.includes("readonly") && h.readonly !== void 0 ? typeof h.readonly == "boolean" ? () => !!h.readonly : r(h.readonly, g) : () => !1; } function s(v, h) { const g = v.$converter || h; return typeof g == "string" && g && a.has(g) ? a.get(g) || null : g || null; } function y(v, h, g, k, S, E = "", F = "") { return Object.keys(v).map((p) => { const M = b(1), B = p, D = v[p], j = Object.keys(D), T = D.title, x = D.type, w = o.get(x) || { type: "input-group", enableClear: !1 }, O = D.editor ? Object.assign({}, w, D.editor) : Object.assign({}, w), N = l(j, D, h), V = u(j, D, h); O.readonly = O.readonly === void 0 ? V() : O.readonly; const Q = D.type === "cascade" ? y(D.properties, h, g, k, S, E, F) : [], z = !0; let $ = s(D, F); const Y = I({ get() { if (M.value) { if (["class", "style"].find((ue) => ue === B) && !$ && ($ = a.get("/converter/appearance.converter") || null), $ && $.convertFrom) return $.convertFrom(g, p, S, E); const oe = g[p]; return Object.prototype.hasOwnProperty.call(D, "defaultValue") && (oe === void 0 || typeof oe == "string" && oe === "") ? D.type === "boolean" ? D.defaultValue : D.defaultValue || "" : oe; } return null; }, set(oe) { M.value += 1, $ && $.convertTo ? ($.convertTo(k, p, oe, S, E), $.convertTo(g, p, oe, S, E)) : (k[p] = oe, g[p] = oe); } }), { refreshPanelAfterChanged: W, description: te, isExpand: ge, parentPropertyID: he } = D, X = { propertyID: B, propertyName: T, propertyType: x, propertyValue: Y, editor: O, visible: N, readonly: V, cascadeConfig: Q, hideCascadeTitle: z, refreshPanelAfterChanged: W, description: te, isExpand: ge, parentPropertyID: he }; return h[B] = X, X; }); } function d(v, h, g = {}) { const k = {}, S = e[v]; return S && S.categories ? Object.keys(S.categories).map((F) => { const f = S.categories[F], p = f == null ? void 0 : f.title, M = y(f.properties || {}, k, {}, g, h); return { categoryId: F, categoryName: p, properties: M }; }) : []; } function c(v, h, g, k, S = "") { const E = h.$ref.schema, F = h.$ref.converter, f = g[E], p = f.type, M = n(f), B = {}, D = e[p]; if (D && D.categories) { const j = D.categories[v], T = j == null ? void 0 : j.title; F && Object.keys(j.properties).forEach((O) => { j.properties[O].$converter = F; }); const x = (j == null ? void 0 : j.properties) || {}, w = y(x, B, M, f, k, S); return { categoryId: v, categoryName: T, properties: w }; } return { categoryId: v, categoryName: "", properties: [] }; } function m(v, h, g, k, S) { const E = v.type, F = n(v), f = {}; let p = S || e[E]; if (p && Object.keys(p).length === 0 && g && g.getPropConfig && (p = g.getPropConfig(k)), p && p.categories) { const M = []; return Object.keys(p.categories).map((B) => { const D = p.categories[B]; if (D.$ref) { M.push(c(B, D, v, h, k)); return; } const j = D == null ? void 0 : D.title, T = D == null ? void 0 : D.tabId, x = D == null ? void 0 : D.tabName, w = D == null ? void 0 : D.hide, O = D == null ? void 0 : D.hideTitle, N = y(D.properties || {}, f, F, v, h, k, D.$converter), { setPropertyRelates: V } = D, Q = D == null ? void 0 : D.parentPropertyID; M.push({ categoryId: B, categoryName: j, tabId: T, tabName: x, hide: w, properties: N, hideTitle: O, setPropertyRelates: V, parentPropertyID: Q }); }), M; } return []; } return { getPropertyConfigBySchema: m, getPropertyConfigByType: d, propertyConverterMap: a }; } const In = {}, Rn = {}; Nn(In, Rn, To); const Ln = {}, $n = {}, { getSchemaByType: zc, resolveSchemaWithDefaultValue: Jo, resolveSchemaToProps: Hc, mappingSchemaToProps: Ac, setDesignerContext: Vc } = En(Ln, $n), zn = {}, Hn = {}; Nn(zn, Hn, Jo); function nt(e, t, n = /* @__PURE__ */ new Map(), a = (r, l, u, s) => l, o = {}, i = (r) => r) { return Pn[t.title] = t, jn[t.title] = a, In[t.title] = o, Rn[t.title] = i, Ln[t.title] = t, $n[t.title] = a, zn[t.title] = o, Hn[t.title] = i, (r = {}, l = !0) => { if (!l) return Oo(r, n); const u = xo(r, t, n), s = Object.keys(e).reduce((y, d) => (y[d] = e[d].default, y), {}); return Object.assign(s, u); }; } function en(e, t) { return { customClass: t.class, customStyle: t.style }; } const An = /* @__PURE__ */ new Map([ ["appearance", en] ]); function Vn(e, t, n) { return t; } const Qo = "https://json-schema.org/draft/2020-12/schema", Zo = "https://farris-design.gitee.io/layout.schema.json", Ko = "layout", ei = "A Farris Container Component", ti = "object", ni = { id: { description: "The unique identifier for layout component", type: "string" }, type: { description: "The type string of layout component", type: "string", default: "layout" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, contents: { description: "", type: "array", default: [] }, collapsable: { description: "", type: "boolean", default: !1 }, resizable: { description: "", type: "boolean", default: !0 }, visible: { description: "", type: "boolean", default: !0 } }, ai = [ "id", "type", "contents" ], oi = { $schema: Qo, $id: Zo, title: Ko, description: ei, type: ti, properties: ni, required: ai }, ii = "layout", ri = "A Farris Component", li = "object", si = { basic: { description: "Basic Infomation", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "类型", title: "类型", type: "string", readonly: !0 } } }, behavior: { description: "Basic Infomation", title: "行为", properties: { collapsable: { description: "", title: "可收折", type: "boolean" }, resizable: { description: "", title: "可调整尺寸", type: "boolean" } } } }, ui = { title: ii, description: ri, type: li, categories: si }, tn = { customStyle: { type: String, defaut: "" }, customClass: { type: String, defaut: "" } }, Wn = nt(tn, oi, An, Vn, ui); function qn(e) { const t = b(-1), n = b(-1), a = b(0), o = b(0), i = b(!1), r = b(!1), l = I(() => ({ display: i.value ? "block" : "none", left: `${a.value}px`, cursor: "e-resize" })), u = I(() => ({ display: r.value ? "block" : "none", top: `${o.value}px`, cursor: "n-resize" })), s = I(() => { const g = { display: r.value || i.value ? "block" : "none" }; return o.value > 0 && (g.cursor = "n-resize"), g; }); function y(g, k, S, E) { const F = e.value; if (F) { const { left: f, right: p, width: M } = F.getBoundingClientRect(); let B = g.clientX - f; E === "right" && (B = p - g.clientX), B > k && (B = k), B < S && (B = S), E === "right" && (B = M - B), a.value = B; } } function d(g, k, S, E) { const F = e.value; if (F) { const { top: f, bottom: p, height: M } = F.getBoundingClientRect(); let B = g.clientY - f; E === "bottom" && (B = p - g.clientY), B > k && (B = k), B < S && (B = S), E === "bottom" && (B = M - B), o.value = B; } } function c() { const g = e.value; if (g) { const { width: k, height: S } = g.getBoundingClientRect(); return { width: k, height: S }; } return null; } function m() { const g = e.value; return g ? Array.from(g.querySelectorAll("[data-position]")).reduce((k, S) => { const E = S.getAttribute("data-position"); return k = Object.assign(k, { [E]: S }), k; }, {}) : null; } function v(g, k) { const S = c(), E = m(); if (S && E) { const F = E == null ? void 0 : E.right, f = E == null ? void 0 : E.left; if (g === "left" && f) return F ? S.width - F.clientWidth - k : S.width - k; if (g === "right" && F) return f ? S.width - f.clientWidth - k : S.width - k; } } function h(g, k) { const S = c(), E = m(); if (S && E) { const F = E == null ? void 0 : E.bottom, f = E == null ? void 0 : E.top; if (g === "top" && f) return F ? S.height - F.clientHeight - k : S.height - k; if (g === "bottom" && F) return f ? S.height - f.clientHeight - k : S.height - k; } } return { horizontalResizeHandleStyle: l, verticalResizeHandleStyle: u, resizeOverlayStyle: s, showHorizontalResizeHandle: i, showVerticalResizeHandle: r, horizontalResizeBarPosition: t, verticalResizeBarPosition: n, verticalResizeHandleOffset: o, horizontalResizeHandleOffset: a, draggingHorizontalResizeHandle: y, draggingVerticalResizeHandle: d, getPanelMaxHeight: h, getPanelMaxWidth: v }; } const We = /* @__PURE__ */ ie({ name: "FLayout", props: tn, emits: [], setup(e, t) { const n = b(), a = qn(n), { horizontalResizeHandleStyle: o, verticalResizeHandleStyle: i, resizeOverlayStyle: r } = a; Sn("layout", { useResizeHandleComposition: a }); const l = I(() => Mt({ "f-layout": !0 }, e == null ? void 0 : e.customClass)), u = I(() => Oa({}, e == null ? void 0 : e.customStyle)); return () => C("div", { class: l.value, style: u.value, ref: n }, [t.slots.default && t.slots.default(), C("div", { class: "f-layout-resize-overlay", style: r.value }, null), C("div", { class: "f-layout-horizontal-resize-proxy", style: o.value }, null), C("div", { class: "f-layout-vertical-resize-proxy", style: i.value }, null)]); } }), ci = "https://json-schema.org/draft/2020-12/schema", di = "https://farris-design.gitee.io/layout-pane.schema.json", fi = "layout-pane", pi = "A Farris Container Component", mi = "object", yi = { id: { description: "The unique identifier for a layout pane", type: "string" }, type: { description: "The type string of layout paney", type: "string", default: "layout-pane" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, collapsable: { description: "", type: "boolean", default: !1 }, contents: { description: "", type: "array", default: [] }, height: { description: "", type: "number" }, position: { description: "", type: "string", default: "left", enum: [ "left", "center", "right", "top", "bottom" ] }, resizeable: { description: "", type: "boolean", default: !0 }, width: { description: "", type: "number" }, visible: { description: "", type: "number", default: !0 } }, vi = [ "id", "type", "contents" ], gi = { $schema: ci, $id: di, title: fi, description: pi, type: mi, properties: yi, required: vi }, hi = "layout-pane", bi = "A Farris Container Component", Ci = "object", wi = { basic: { description: "Basic Infomation", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "enum" }, width: { description: "", type: "number", title: "宽度" }, height: { description: "", type: "number", title: "高度" } } }, appearance: { title: "样式", description: "Appearance", properties: { class: { title: "class样式", type: "string", description: "" }, style: { title: "style", type: "string", description: "" } } }, behavior: { description: "", title: "行为", properties: { collapsable: { description: "", type: "boolean", title: "允许收折" }, position: { description: "", type: "enum", title: "位置", editor: { type: "combo-list", data: [ { id: "left", name: "左侧" }, { id: "center", name: "居中" }, { id: "right", name: "右侧" }, { id: "top", name: "顶部" }, { id: "bottom", name: "底部" } ] } }, resizeable: { description: "", type: "boolean", title: "允许调整尺寸" }, visible: { description: "运行时组件是否可见", type: "boolean", title: "是否可见" } } } }, ki = { title: hi, description: bi, type: Ci, categories: wi }, nn = { customClass: { type: String, defaut: "" }, customStyle: { type: String, defaut: "" }, /** 记录原始定义宽度 */ width: { type: Number, default: -1 }, /** 记录原始定义高度 */ height: { type: Number, default: -1 }, /** 面板位置 */ position: { type: String, default: "left" }, /** 是否显示 */ visible: { type: Boolean, default: !0 }, /** True to allow the pane can be resized. */ resizable: { type: Boolean, default: !0 }, /** True to allow the pane can be collapsed. */ collapsable: { type: Boolean, default: !1 }, /** 面板最小宽度 */ minWidth: { type: Number, default: 100 }, /** 面板最小高度 */ minHeight: { type: Number, default: 100 } }, Gn = nt(nn, gi, An, Vn, ki); function _n(e, t, n, a, o) { const { horizontalResizeBarPosition: i, horizontalResizeHandleOffset: r, showHorizontalResizeHandle: l, showVerticalResizeHandle: u, verticalResizeBarPosition: s, verticalResizeHandleOffset: y, draggingHorizontalResizeHandle: d, draggingVerticalResizeHandle: c, getPanelMaxHeight: m, getPanelMaxWidth: v } = o; let h = "", g, k, S; function E(p) { if ((h === "left" || h === "right") && k) { const { left: M } = k.getBoundingClientRect(), { width: B } = g.getBoundingClientRect(), D = p.clientX - M; let j = h === "left" ? (B || 0) + (D - i.value) : (B || 0) - (D - i.value); j = n.value > 0 ? Math.max(n.value, j) : j; const T = v(h, n.value); T != null && (j = T > j ? j : T), e.value = j; } if ((h === "top" || h === "bottom") && k) { const { top: M } = k.getBoundingClientRect(), { height: B } = g.getBoundingClientRect(), D = p.clientY - M; let j = h === "top" ? (B || 0) + (D - s.value) : (B || 0) - (D - s.value); j = a.value > 0 ? Math.max(a.value, j) : j; const T = m(h, a.value); T != null && (j = T > j ? j : T), t.value = j; } r.value = 0, y.value = 0, i.value = -1, s.value = -1, l.value = !1, u.value = !1, document.removeEventListener("mousemove", S), document.removeEventListener("mouseup", E), document.body.style.userSelect = "", h = "", g = null, k = null; } function F(p, M, B) { if (h = M, g = B, l.value = !0, k = p.composedPath().find((j) => (j.className || "").split(" ")[0] === "f-layout"), k) { const { left: j } = k.getBoundingClientRect(), T = p.clientX - j; r.value = T, i.value = T; const x = v(h, n.value) || 0; S = (w) => d(w, x, n.value, h), document.addEventListener("mousemove", S), document.addEventListener("mouseup", E), document.body.style.userSelect = "none"; } } function f(p, M, B) { if (h = M, g = B, u.value = !0, k = p.composedPath().find((j) => (j.className || "").split(" ")[0] === "f-layout"), k) { const { top: j } = k.getBoundingClientRect(); y.value = p.clientY - j, s.value = p.clientY - j; const T = m(h, a.value) || 0; S = (x) => c(x, T, a.value, h), document.addEventListener("mousemove", S), document.addEventListener("mouseup", E), document.body.style.userSelect = "none"; } } return { onClickHorizontalResizeBar: F, onClickVerticalResizeBar: f }; } const je = /* @__PURE__ */ ie({ name: "FLayoutPane", props: nn, emits: [], setup(e, t) { const n = b(e.minHeight <= 0 ? 100 : e.minHeight), a = b(e.minWidth <= 0 ? 100 : e.minWidth), o = b(e.width <= 0 ? 100 : e.width), i = b(e.height <= 0 ? 100 : e.height), r = b(Math.max(n.value, i.value)), l = b(Math.max(a.value, o.value)), u = b(), s = b(e.position), y = b(e.resizable); ee(() => e.resizable, (f) => { y.value = f; }); const d = Te("layout"), { useResizeHandleComposition: c } = d, m = _n(l, r, a, n, c), { onClickHorizontalResizeBar: v, onClickVerticalResizeBar: h } = m, g = I(() => ({ "f-layout-resize-bar": !0, "f-layout-resize-bar-e": s.value === "left", "f-layout-resize-bar-n": s.value === "bottom", "f-layout-resize-bar-s": s.value === "top", "f-layout-resize-bar-w": s.value === "right" })), k = I(() => s.value !== "center" && y.value); function S(f, p) { (p === "left" || p === "right") && v(f, p, u.value), (p === "top" || p === "bottom") && h(f, p, u.value); } const E = I(() => { const f = { "f-layout-pane": !0, "f-page-content-nav": s.value === "left" || s.value === "right", "f-page-content-main": s.value === "center" }; return e.customClass && String(e.customClass).split(" ").reduce((p, M) => (p[M] = !0, p), f), f; }), F = I(() => { const f = {}; return (l.value && s.value === "left" || s.value === "right") && (f.width = `${l.value}px`), (r.value && s.value === "bottom" || s.value === "top") && (f.height = `${r.value}px`), e.visible || (f.display = "none"), f; }); return () => C("div", { ref: u, class: E.value, style: F.value, "data-position": s.value }, [t.slots.default && t.slots.default(), k.value && C("span", { class: g.value, onMousedown: (f) => S(f, s.value) }, null)]); } }); function Si(e, t) { function n() { return !1; } return { canAccepts: n }; } function an(e, t, n) { var T; const a = n && n.getStyles && n.getStyles() || "", o = n && n.getDesignerClass && n.getDesignerClass() || "", i = b(); let r; function l() { 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 y() { return (t == null ? void 0 : t.schema.componentType) === "frame" ? !0 : n && n.hideNestedPaddingInDesginerView ? n.hideNestedPaddingInDesginerView() : !1; } function d(x) { if (!x || !x.value) return null; if (x.value.schema && x.value.schema.type === "component") return x.value; const w = b(x == null ? void 0 : x.value.parent), O = d(w); return O || null; } function c(x = t) { var V; if (n != null && n.getDraggableDesignItemElement) return n.getDraggableDesignItemElement(x); const { componentInstance: w, designerItemElementRef: O } = x; if (!w || !w.value) return null; const { getCustomButtons: N } = w.value; return w.value.canMove || N && ((V = N()) != null && V.length) ? O : c(x.parent); } function m(x) { return !!n && n.canAccepts(x); } function v() { return (t == null ? void 0 : t.schema.label) || (t == null ? void 0 : t.schema.title) || (t == null ? void 0 : t.schema.name); } function h() { } function g(x, w) { var O; !x || !w || (n != null && n.onAcceptMovedChildElement && n.onAcceptMovedChildElement(x, w), (O = t == null ? void 0 : t.setupContext) == null || O.emit("dragEnd")); } function k(x, w) { const { componentType: O } = x; let N = Da(O, x, w); n && n.onResolveNewComponentSchema && (N = n.onResolveNewComponentSchema(x, N)); const V = O.toLowerCase().replace(/-/g, "_"); return N && !N.id && N.type === O && (N.id = `${V}_${Math.random().toString().slice(2, 6)}`), N; } function S(x) { x && n != null && n.onChildElementMovedOut && n.onChildElementMovedOut(x); } function E(...x) { if (n && n.getPropsConfig) return n.getPropsConfig(...x); } function F(x) { if (!x) return; const w = t == null ? void 0 : t.schema, { formSchemaUtils: O } = x; if (w && O.getExpressions().length) { const N = O.getExpressions().findIndex((V) => V.target === w.id); N > -1 && O.getExpressions().splice(N, 1); } } function f(x) { if (!x || !(t != null && t.schema)) return; const w = t.schema, { formSchemaUtils: O } = x; O.removeCommunicationInComponent(w); } function p(x) { n && n.onRemoveComponent && n.onRemoveComponent(), F(x), f(x), t != null && t.schema.contents && t.schema.contents.map((w) => { let O = w.id; w.type === "component-ref" && (O = w.component); const N = e.value.querySelectorAll(`#${O}-design-item`); N != null && N.length && Array.from(N).map((V) => { var Q; (Q = V == null ? void 0 : V.componentInstance) != null && Q.value.onRemoveComponent && V.componentInstance.value.onRemoveComponent(x); }); }); } function M() { if (n && n.getCustomButtons) return n.getCustomButtons(); } function B(x) { var O, N; if (!((O = t == null ? void 0 : t.schema) != null && O.id)) return; if (!r && x && (r = x.formSchemaUtils), n != null && n.setComponentBasicInfoMap) { n.setComponentBasicInfoMap(); return; } let w = ""; if (n != null && n.getComponentTitle) w = n.getComponentTitle(); else { const { text: V, title: Q, label: z, mainTitle: $, name: Y, type: W } = t.schema; w = V || Q || z || $ || Y || ((N = L[W]) == null ? void 0 : N.name); } w && r.getControlBasicInfoMap().set(t.schema.id, { componentTitle: w, parentPathName: w }); } function D(x) { var V; const { changeObject: w } = x, { propertyID: O, propertyValue: N } = w; if (["text", "title", "label", "name", "mainTitle"].includes((V = x == null ? void 0 : x.changeObject) == null ? void 0 : V.propertyID) && O && N && (B(), r)) { const Q = r.getControlBasicInfoMap(), z = Q.keys().toArray().filter(($) => { var Y, W; return ((Y = Q.get($)) == null ? void 0 : Y.reliedComponentId) === ((W = t == null ? void 0 : t.schema) == null ? void 0 : W.id); }); z != null && z.length && z.forEach(($) => { const Y = Q.get($).parentPathName.split(" > "); Y[0] = N, Q.get($).parentPathName = Y.join(" > "); }); } } function j(x) { if (D(x), n && n.onPropertyChanged) return n.onPropertyChanged(x); } return i.value = { canMove: l(), canSelectParent: u(), canDelete: s(), canNested: !y(), contents: t == null ? void 0 : t.schema.contents, elementRef: e, parent: (T = t == null ? void 0 : t.parent) == null ? void 0 : T.componentInstance, schema: t == null ? void 0 : t.schema, styles: a, designerClass: o, canAccepts: m, getBelongedComponentInstance: d, getDraggableDesignItemElement: c, getDraggingDisplayText: v, getPropConfig: E, getDragScopeElement: h, onAcceptMovedChildElement: g, onChildElementMovedOut: S, addNewChildComponentSchema: k, triggerBelongedComponentToMoveWhenMoved: !!n && n.triggerBelongedComponentToMoveWhenMoved || b(!1), triggerBelongedComponentToDeleteWhenDeleted: !!n && n.triggerBelongedComponentToDeleteWhenDeleted || b(!1), onRemoveComponent: p, getCustomButtons: M, onPropertyChanged: j, setComponentBasicInfoMap: B, updateContextSchema: t == null ? void 0 : t.updateContextSchema }, i; } const Fi = /* @__PURE__ */ ie({ name: "FLayoutDesign", props: tn, emits: [], setup(e, t) { var y; const n = b(), a = Te("design-item-context"), o = Si(a.schema, (y = a.parent) == null ? void 0 : y.schema), i = an(n, a, o); i.value.canNested = !1; const r = qn(n), { horizontalResizeHandleStyle: l, verticalResizeHandleStyle: u, resizeOverlayStyle: s } = r; return Sn("layout", { useResizeHandleComposition: r }), ve(() => { n.value.componentInstance = i; }), t.expose(i.value), () => C("div", { class: "f-layout f-page-content", ref: n }, [t.slots.default && t.slots.default(), C("div", { class: "f-layout-resize-overlay", style: s.value }, null), C("div", { class: "f-layout-horizontal-resize-proxy", style: l.value }, null), C("div", { class: "f-layout-vertical-resize-proxy", style: u.value }, null)]); } }); function Ti() { function e(t, n) { var r; if (!t) return !1; const a = ((r = t.targetContainer) == null ? void 0 : r.componentInstance) && t.targetContainer.componentInstance.value; if (!a) return !1; const o = a.schema.type, i = n == null ? void 0 : n.formSchemaUtils.getComponentById(a.belongedComponentId); return !((t.componentCategory === "input" || t.componentType === "form-group") && ![L["response-layout-item"].type, L["response-form"].type, L.fieldset.type].includes(o) || (t.componentType === L.tabs.type || t.componentType === L.section.type) && ((i == null ? void 0 : i.componentType) !== "frame" || ![L["content-container"].type, L["splitter-pane"].type, L["response-layout-item"].type].includes(o)) || [L["query-solution"].type, L["filter-bar"].type].includes(t.componentType) || t.componentType === L.fieldset.type && o !== L["response-form"].type); } return { basalDragulaRuleForContainer: e }; } function xi(e, t) { const n = e.schema; function a(i) { return !!Ti().basalDragulaRuleForContainer(i); } function o() { const i = ["f-layout-pane"]; return (n.position === "left" || n.position === "right") && i.push("f-page-content-nav"), n.position === "center" && i.push("f-page-content-main"), i.join(" "); } return { canAccepts: a, getDesignerClass: o }; } const Oi = /* @__PURE__ */ ie({ name: "FLayoutPaneDesign", props: nn, emits: [], setup(e, t) { const n = b(), a = b(); Te("designer-host-service"); const o = Te("design-item-context"), i = xi(o), r = an(a, o, i); r.value.canNested = !1, r.value.canMove = !1, r.value.canDelete = !1, ve(() => { a.value.componentInstance = r; }), t.expose(r.value); const l = b(Math.max(e.minHeight, e.height)), u = b(Math.max(e.minWidth, e.width)), s = b(e.minHeight), y = b(e.minWidth), d = b(e.position), c = Te("layout"), { useResizeHandleComposition: m } = c, v = _n(u, l, y, s, m), { onClickHorizontalResizeBar: h, onClickVerticalResizeBar: g } = v, k = I(() => ({ "f-layout-resize-bar": !0, "f-layout-resize-bar-e": d.value === "left", "f-layout-resize-bar-n": d.value === "bottom", "f-layout-resize-bar-s": d.value === "top", "f-layout-resize-bar-w": d.value === "right" })); function S(f, p) { (p === "left" || p === "right") && h(f, p, n.value), (p === "top" || p === "bottom") && g(f, p, n.value); } const E = I(() => { const f = { "f-layout-pane": !0, "f-page-content-nav": d.value === "left" || d.value === "right", "f-page-content-main": d.value === "center" }; return e.customClass && String(e.customClass).split(" ").reduce((p, M) => (p[M] = !0, p), f), f; }), F = I(() => { const f = { flex: "1" }; return (u.value && d.value === "left" || d.value === "right") && (f.width = `${u.value}px`), (l.value && d.value === "bottom" || d.value === "top") && (f.height = `${l.value}px`), f; }); return () => C("div", { ref: n, class: E.value, style: F.value }, [C("div", { ref: a, class: "drag-container", "data-dragref": `${o.schema.id}-container` }, [t.slots.default && t.slots.default()]), C("span", { class: k.value, onMousedown: (f) => S(f, d.value) }, null)]); }