UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,645 lines 150 kB
var Tt = Object.defineProperty; var wt = (e, a, t) => a in e ? Tt(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t; var oe = (e, a, t) => wt(e, typeof a != "symbol" ? a + "" : a, t); import { defineComponent as ge, ref as D, inject as Y, computed as J, onMounted as Ce, createVNode as x, watch as W, reactive as me, toRaw as Ft, nextTick as je, withDirectives as qe, vModelCheckbox as et, onUnmounted as Oe, isVNode as It, Fragment as kt, resolveDirective as Pt, provide as he, mergeProps as tt } from "vue"; import xt from "../../designer/button-edit/index.esm.js"; import { useDesignerComponent as Lt } from "../designer-canvas/index.esm.js"; import { resolveAppearance as Et, createPropsResolver as Vt } from "../dynamic-resolver/index.esm.js"; import { InputBaseProperty as Mt, ExpressionProperty as Xe } from "../property-panel/index.esm.js"; import { FieldSelectorRepositoryToken as Le } from "../field-selector/index.esm.js"; import { FNotifyService as Nt, F_NOTIFY_SERVICE_TOKEN as nt } from "../notify/index.esm.js"; import { F_MODAL_SERVICE_TOKEN as Dt } from "../modal/index.esm.js"; import { FButtonEdit as at } from "../button-edit/index.esm.js"; import { FLayout as Ot, FLayoutPane as Ye } from "../layout/index.esm.js"; import { FDataGrid as Be } from "../data-grid/index.esm.js"; import { flatten as Bt, isNaN as At, cloneDeep as Ie, throttle as Rt, get as ye, debounce as it, isEmpty as Ut } from "lodash-es"; import { resolveField as Ee, encrypt as zt } from "../common/index.esm.js"; import { useI18n as _t } from "vue-i18n"; import { FTreeGrid as We } from "../tree-grid/index.esm.js"; import { FComboList as ot } from "../combo-list/index.esm.js"; import $t from "../popover/index.esm.js"; function Ze(e) { return typeof e == "string" && e.startsWith("{") && e.endsWith("}") ? (e = e.replace(/'/g, '"'), { mappingFields: JSON.parse(e) }) : { mappingFields: e }; } const jt = /* @__PURE__ */ new Map([ ["appearance", Et], ["mappingFields", (e, a, t) => { if (a) return Ze(a); const { mappingFields: n } = t; return Ze(n); }], ["uri", (e, a, t) => { var n; return a ? { uri: a } : { uri: (n = t == null ? void 0 : t.dataSource) == null ? void 0 : n.uri }; }], ["idField", (e, a, t) => { var n; return a ? { idField: a } : { idField: (n = t == null ? void 0 : t.dataSource) == null ? void 0 : n.idField }; }] ]), qt = "https://json-schema.org/draft/2020-12/schema", Wt = "https://farris-design.gitee.io/lookup.schema.json", Gt = "lookup", Ht = "A Farris Input Component", Jt = "object", Qt = { id: { description: "The unique identifier for a combo list", type: "string" }, type: { description: "The type string of number combo list component", type: "string", default: "lookup" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, binding: { description: "", type: "object", default: {} }, editable: { description: "", type: "boolean", default: !1 }, enableLinkLabel: { description: "", type: "boolean", default: !1 }, label: { description: "", type: "string", default: "帮助" }, lableWidth: { description: "", type: "number" }, placeholder: { description: "", type: "string", default: "请选择" }, readonly: { description: "", type: "boolean", default: !1 }, required: { description: "", type: "boolean", default: !1 }, tabindex: { description: "", type: "number", default: -1 }, textAlign: { description: "", type: "string", enum: [ "left", "middle", "right" ], default: "left" }, visible: { description: "", type: "boolean", default: !0 }, textField: { description: "帮助显示文本字段", type: "string", default: "" }, mappingFields: { description: "帮助字段映射", type: "object", default: {} }, uri: { type: "string", default: "" }, dataSource: { type: "object", default: null }, displayType: { type: "string", default: "list" }, "onUpdate:dataMapping": { type: "object", default: null }, onClear: { type: "object", default: null }, context: { type: "object", default: null }, enableToSelect: { type: "boolean", default: !0 }, idValue: { type: "string", default: "" }, multiSelect: { type: "boolean", default: !1 }, separator: { type: "string", default: "," }, fitColumns: { type: "boolean", default: !0 }, enableFavorite: { type: "boolean", default: !1 }, enableUserData: { type: "boolean", default: !1 }, showSelections: { type: "boolean", default: !0 }, treeToList: { type: "boolean", default: !1 }, navTreeToList: { type: "boolean", default: !1 }, showNavigation: { type: "boolean", default: !0 }, dictPicking: { type: "object", default: null }, dictPicked: { type: "object", default: null }, enableSearchBar: { type: "boolean", default: !0 }, searchAnyField: { type: "boolean", default: !0 }, dialog: { type: "object", default: null }, idField: { type: "string", default: "id" }, pagination: { type: "object", default: null }, allowFreeInput: { type: "boolean", default: !1 }, loadTreeDataType: { type: "string", default: "default" }, onlySelectLeaf: { type: "boolean", default: !1 }, enableFullTree: { type: "boolean", default: !0 }, beforeLoadData: { type: "object", default: null }, beforeSelectData: { type: "object", default: null }, enableCascade: { type: "boolean", default: !1 }, showCascadeControl: { type: "boolean", default: !0 }, cascadeItems: { type: "object", default: { both: !0, up: !0, down: !0, disable: !0 } }, cascadeValue: { type: "string", default: "both" }, expandLevel: { type: "number", default: 0 }, enableClear: { type: "boolean", default: !0 }, openType: { type: "string", default: "Modal" }, enableTitle: { type: "boolean", default: !1 }, showIncludeChildNodes: { type: "boolean", default: !0 }, includeChildNodesValue: { type: "boolean", default: !0 }, enableEqualSearch: { type: "boolean", default: !1 } }, Xt = [ "type" ], Yt = [ "appearance", "binding", "visible" ], Zt = { dictPicking: "帮助前事件", dictPicked: "帮助后事件", beforeSelectData: "数据选择确认前事件", beforeLoadData: "数据加载前事件", clear: "清空事件" }, Kt = { $schema: qt, $id: Wt, title: Gt, description: Ht, type: Jt, properties: Qt, required: Xt, ignore: Yt, events: Zt }; function en(e, a, t) { return a; } var lt = /* @__PURE__ */ ((e) => (e.Both = "both", e.Up = "up", e.Down = "down", e.Disable = "disable", e))(lt || {}); const $e = [ { value: "both", text: "同步选择" }, { value: "up", text: "包含上级" }, { value: "down", text: "包含下级" }, { value: "disable", text: "仅选择自身" } ], st = ""; var fe = /* @__PURE__ */ ((e) => (e.List = "LIST", e.Tree = "TREELIST", e.ListList = "NAVLIST", e.TreeList = "NAVTREELIST", e.ListTree = "NAVLISTTREE", e))(fe || {}), be = /* @__PURE__ */ ((e) => (e.default = "default", e.all = "all", e.async = "async", e))(be || {}); const Pe = "__lookup_active_tab__", ga = "__lookup_user_data_id__"; var ue = /* @__PURE__ */ ((e) => (e.dataList = "datalist", e.favorite = "favorite", e))(ue || {}); const rt = { showPageInfo: !0, enable: !1, showLimits: !0, sizeLimits: [10, 20, 30, 50, 100], size: 20, index: 1, total: 0, mode: "server", showGoto: !1 }, tn = Symbol("f_lookup-http-service_token"); var Ve = /* @__PURE__ */ ((e) => (e[e.Equal = 0] = "Equal", e[e.NotEqual = 1] = "NotEqual", e[e.Greater = 2] = "Greater", e[e.GreaterOrEqual = 3] = "GreaterOrEqual", e[e.Less = 4] = "Less", e[e.LessOrEqual = 5] = "LessOrEqual", e[e.Like = 6] = "Like", e[e.LikeStartWith = 7] = "LikeStartWith", e[e.LikeEndWith = 8] = "LikeEndWith", e[e.NotLike = 9] = "NotLike", e[e.NotLikeStartWith = 10] = "NotLikeStartWith", e[e.NotLikeEndWith = 11] = "NotLikeEndWith", e[e.Is = 12] = "Is", e[e.IsNot = 13] = "IsNot", e[e.In = 14] = "In", e[e.NotIn = 15] = "NotIn", e))(Ve || {}), Me = /* @__PURE__ */ ((e) => (e[e.Empty = 0] = "Empty", e[e.And = 1] = "And", e[e.Or = 2] = "Or", e))(Me || {}), nn = /* @__PURE__ */ ((e) => (e[e.Value = 0] = "Value", e[e.Expression = 1] = "Expression", e.FrontExpress = "frontExpress", e))(nn || {}); const an = { showCloseButton: !0, showMaxButton: !0, draggable: !0, resizeable: !0, enableEsc: !0, rememberSize: !0 }; function on() { function e(a, t) { const n = {}; return n.dictPicking = (i) => t.call("dictPicking", [i, a]), n.beforeLoadData = (i) => t.call("beforeLoadData", [i, a]), n.beforeSelectData = (i) => t.call("beforeSelectData", [i, a]), n.dictPicked = (i) => t.call("dictPicked", [i, a]), n; } return { resolve: e }; } const Ae = { id: { type: String, require: !0 }, uri: { type: String, default: "" }, readonly: { type: Boolean, default: !1 }, disabled: { type: Boolean, default: !1 }, editable: { type: Boolean, default: !1 }, enableFavorite: { type: Boolean, default: !1 }, mappingFields: { type: Object, default: null }, fitColumns: { type: Boolean, default: !0 }, columns: { type: Array, default: [] }, idField: { type: String, default: "id" }, textField: { type: String, defalut: "name" }, data: { type: Array, default: [] }, displayType: { type: String, default: fe.List }, dialog: { type: Object, default: { title: "" } }, multiSelect: { type: Boolean, default: !1 }, showSelections: { type: Boolean, default: !0 }, separator: { type: String, default: "," }, pagination: { type: Object, default: rt }, enableClear: { type: Boolean, default: !0 }, inputType: { type: String, default: "text" }, idValue: { type: String, default: "" }, dictPicking: { type: Function, default: null }, dictPicked: { type: Function, default: null }, beforeSelectData: { type: Function, default: null }, beforeLoadData: { type: Function, default: null }, enableSearchBar: { type: Boolean, default: !0 }, searchFields: { type: Array, default: [] }, searchAnyField: { type: Boolean, default: !0 }, navigation: { type: Object, default: null }, textChangeType: { type: String, default: "any" }, showNavigation: { type: Boolean, default: !0 }, showIncludeChildNodes: { type: Boolean, default: !0 }, includeChildNodesValue: { type: Boolean, default: !0 }, enableMultiFieldSearch: { type: Boolean, default: !1 }, treeToList: { type: Boolean, default: !1 }, navTreeToList: { type: Boolean, default: !1 }, loadTreeDataType: { type: String, default: be.default }, enableToSelect: { type: Boolean, default: !0 }, customData: { type: Object, default: null }, modelValue: { type: String, default: "" }, enableUserData: { type: Boolean, default: !1 }, userDataKey: { type: String, default: "" }, onReady: { type: Function, default: null }, context: { type: Object, default: {} }, placeholder: { type: String, default: "" }, loader: { type: Function, default: null }, allowFreeInput: { type: Boolean, default: !1 }, onlySelectLeaf: { type: Boolean, default: !1 }, enableFullTree: { type: Boolean, default: !0 }, enableCascade: { type: Boolean, default: !1 }, showCascadeControl: { type: Boolean, default: !0 }, cascadeItems: { type: Object, default: { both: !0, up: !0, down: !0, disable: !0 } }, cascadeValue: { type: String, default: "both" }, /** 0: 不展开; -1: 全部展开;>0: 展开到指定级数 */ expandLevel: { type: Number, default: 0 }, openType: { type: String, default: "Modal" }, enableTitle: { type: Boolean, default: !1 }, /** 是否启用等于搜索功能 */ enableEqualSearch: { type: Boolean, default: !1 } }, ut = Vt(Ae, Kt, jt, en), ln = on(); function Ne(e) { let a = [10, 20, 30, 50, 100]; return e && (typeof e == "string" && (a = e.replaceAll("[", "").replaceAll("]", "").replaceAll(" ", "").split(",")), Array.isArray(e) && (a = e)), a.map((t) => ({ value: parseInt(t, 10) })).sort((t, n) => t.value - n.value); } const ne = { convertFrom: (e, a) => { const t = e.editor ? e.editor : e; return a === "multiSelect" || a === "enableTitle" ? !!t[a] : a === "separator" ? t[a] || "," : a === "onlySelectLeaf" ? t[a] == null ? !1 : t[a] : a === "loadTreeDataType" ? t[a] || "default" : a === "placeholder" ? t.placeholder || "请选择" : a === "openType" ? t[a] || "Modal" : t[a]; }, convertTo: (e, a, t) => { const n = e.editor ? e.editor : e; if (n[a] = t, a === "multiSelect" && !t && (n.enableCascade = !1), a === "openType") { if (t === "Popup") n.showSelections = !1, n.enableCascade = !1; else if (n.dialog) { const { width: i } = n.dialog, { displayType: o } = n; o && o.toUpperCase().indexOf("NAV") > -1 && (!i || i < 520) && (n.dialog.width = 960); } } } }; function sn(e) { let a = "form_group_" + Date.now(); return e && (a = e.replaceAll("-", "_").replaceAll(".", "_")), "lookup." + a; } function rn(e, a) { const { enablePager: t, pageSize: n, pageList: i } = a; e.pagination = e.pagination || {}, Object.assign(e.pagination, { enable: t, sizeLimits: Ne(i).map((o) => o.value), size: n, showLimits: !0, showGoto: !1, mode: "server" }); } const ct = { convertFrom: (e, a) => { var n; return (n = (e.editor ? e.editor : e).dataSource) == null ? void 0 : n.displayName; }, convertTo: (e, a, t) => { if (t && t.length > 0) { const n = e.editor ? e.editor : e, i = t[0], { name: o, id: s, metadataContent: u, code: l } = i; n.dataSource || (n.dataSource = {}), n.dataSource.displayName = `${o}(${l})`, n.helpId = s; const { displayType: r, idField: d, textField: f } = u; n.displayType = r, n.dataSource.idField = d, n.textField = f, n.dataSource.type = "ViewObject"; const { pageInfo: T } = u.dataSource; rn(n, T); const { treeInfo: I } = r.toUpperCase() === "NAVTREELIST" ? u.navigation : u.dataSource; if (I) { const { onlySelectLeaf: b, loadDataType: p } = I; n.loadTreeDataType = "default", n.onlySelectLeaf = b ?? !1; } if (n.dataSource.uri || (n.dataSource.uri = sn(e.id)), n.dialog) { const { width: b } = n.dialog; r && r.toUpperCase().indexOf("NAV") > -1 && (!b || b < 520) && (n.dialog.width = 960); } } } }, un = { convertFrom: (e, a) => { var t; return (t = e.editor.dataSource) == null ? void 0 : t.idField; }, convertTo: (e, a, t) => { if (t && t.length > 0) { const n = t[0]; e.editor.dataSource.idField = n == null ? void 0 : n.bindingPath; } } }, cn = { convertFrom: (e, a) => { var t; return (t = e.editor) == null ? void 0 : t.textField; }, convertTo: (e, a, t) => { if (t && t.length > 0) { const n = t[0]; e.editor.textField = n == null ? void 0 : n.bindingPath; } } }, dn = { convertFrom: (e, a) => e.editor.displayType ? e.editor.displayType.toUpperCase() : "LIST", convertTo: (e, a, t) => { e.editor.displayType = t; } }, pe = { convertFrom: (e, a) => { var i; let t = e.editor ? e.editor.dialog : e.dialog; if (t || (t = {}), a === "title") return t[a] || st; if (t.openType === "Modal") { if (a === "width") return (i = t.displayType) != null && i.toUpperCase().startsWith("NAV") ? t[a] || 960 : t[a] || 590; if (a === "height") return t[a] || 620; if (a === "navigatorWidth") return t[a] || 320; } else { if (a === "width") return t[a] || 460; if (a === "height") return t[a] || 380; } if (a === "draggable") return !0; if (["showMaxButton", "showCloseButton", "resizeable", "enableEsc", "rememberSize"].includes(a)) return t[a] == null ? !0 : t[a]; }, convertTo: (e, a, t) => { const n = e.editor ? e.editor : e; n.dialog = n.dialog || {}, n.dialog[a] = t; } }, fn = { convertFrom: (e, a) => { const t = e.editor ? e.editor : e; if (t.pagination = t.pagination || {}, a === "enable" || a === "showLimits") return t.pagination[a] == null ? !1 : t.pagination[a]; if (a === "sizeLimits") { const n = t.pagination[a]; return Ne(n); } if (a === "size") return t.pagination[a] || 20; }, convertTo: (e, a, t) => { var i; const n = e.editor ? e.editor.pagination || {} : e; if (n.pagination = n.pagination || {}, a === "sizeLimits") { const o = t.map((u) => u.value); n.pagination[a] = o; const s = ((i = n.pagination) == null ? void 0 : i.size) ?? 20; o.includes(s) || (n.pagination.size = o[0]); return; } n.pagination[a] = t; } }, pn = [ { label: "clear", name: "清空事件" }, { label: "dictPicking", name: "帮助前事件" }, { label: "beforeLoadData", name: "数据加载前事件" }, { label: "beforeSelectData", name: "选择数据确认前事件" }, { label: "dictPicked", name: "帮助后事件" } ], hn = [ { label: "dictPicking", name: "帮助前事件" }, { label: "beforeLoadData", name: "数据加载前事件" }, { label: "beforeSelectData", name: "选择数据确认前事件" }, { label: "dictPicked", name: "帮助后事件" } ], gn = Symbol("schema_repository_token"); function mn(e, a) { const t = (n) => n && n.length ? n.map((i) => `${i.name}[${i.bindingPath}]`).join(",") : ""; return { dataSourceEditor: { type: "schema-selector", title: "选择数据源", editorParams: { propertyData: e, formBasicInfo: a.formSchemaUtils.getFormMetadataBasicInfo() }, viewOptions: a.formSchemaUtils.designerMode === "PC_RTC" ? [ { id: "total", title: "全部", type: "List", dataSource: "Total" } ] : [ { id: "recommend", title: "推荐", type: "List", dataSource: "Recommand", enableGroup: !0, groupField: "category", groupFormatter: (n, i) => `${n === "local" ? "本地元数据" : "最近使用"}` }, { id: "total", title: "全部", type: "List", dataSource: "Total" } ], repositoryToken: gn }, dataSourceConverter: ct, idFieldEditor: { type: "field-selector", textField: "bindingPath", idField: "bindingPath", disabled: !0, editorParams: { propertyData: e, formBasicInfo: a.formSchemaUtils.getFormMetadataBasicInfo() }, columns: [ { field: "name", title: "名称" }, { field: "code", title: "编号" }, { field: "bindingPath", title: "绑定字段" } ], repositoryToken: Le }, textFieldEditor: { type: "field-selector", textField: "bindingPath", idField: "bindingPath", editorParams: { propertyData: e, formBasicInfo: a.formSchemaUtils.getFormMetadataBasicInfo() }, columns: [ { field: "name", title: "名称" }, { field: "code", title: "编号" }, { field: "bindingPath", title: "绑定字段" } ], repositoryToken: Le }, mappingFieldsEditor: { type: "mapping-editor", modalWidth: 800, modalHeight: 600, editable: !1, editorParams: { propertyData: e, formBasicInfo: a.formSchemaUtils.getFormMetadataBasicInfo() }, fromData: { editable: !0, formatter: (n, i) => `${i.raw.name} [${i.raw.bindingPath}]`, idField: "bindingPath", textField: "name", valueField: "bindingPath", searchFields: ["name", "bindingPath"], repositoryToken: Le, displayFormatter: t }, toData: { editable: !1, idField: "bindingPath", textField: "name", valueField: "bindingPath", searchFields: ["name", "bindingPath"], dataSource: () => { const n = a.designViewModelUtils.getAllFields2TreeByVMId(a.viewModelId), i = a.schemaService.getPrimaryField(); return i ? n.filter((o) => o.data.bindingPath !== i) : n; }, formatter: (n, i) => `${i.raw.name} [${i.raw.bindingPath}]`, displayFormatter: t } } }; } function vn(e) { var o, s; const a = { type: "combo-list", enableClear: !1, editable: !1 }, t = { type: "number-spinner", useThousands: !1 }, n = () => e.displayType ? e.displayType.toUpperCase() : "", i = () => n().startsWith("NAV") ? e.showNavigation === void 0 ? !0 : !!e.showNavigation : !1; return { openType: { description: "窗口展示方式:弹出窗口、下拉面板", title: "打开方式", type: "string", refreshPanelAfterChanged: !0, $converter: ne, editor: { ...a, data: [ { text: "弹出窗口", value: "Modal" }, { text: "下拉面板", value: "Popup" } ], valueField: "value", textField: "text", idField: "value" }, visible: !0, defaultValue: "Modal" }, title: { description: "帮助标题", title: "标题", type: "string", visible: e.openType !== "Popup", $converter: pe }, width: { description: "窗口宽度,最小值:300px", title: "宽度", type: "number", editor: { ...t, min: i() ? 520 : 300 }, $converter: pe }, height: { description: "窗口高度,最小值:200px", title: "高度", type: "number", editor: { ...t, min: 200 }, $converter: pe }, showNavigation: { description: "显示导航栏", $converter: ne, refreshPanelAfterChanged: !0, title: "显示导航栏", type: "boolean", visible: n().includes("NAV") && e.openType !== "Popup" }, navigatorWidth: { description: "导航栏宽度,最小200px, 最大为窗口宽度减去200px", title: "导航栏宽度", type: "number", visible: i() && e.openType !== "Popup", editor: { ...t, min: 200, max: (((o = e == null ? void 0 : e.dialog) == null ? void 0 : o.width) ?? 960) - 200 }, $converter: pe }, resizeable: { description: "允许鼠标拖拽窗口边缘调整尺寸", title: "允许调整窗口尺寸", type: "boolean", visible: e.openType !== "Popup", $converter: pe }, rememberSize: { description: "记录窗口尺寸", title: "记录窗口尺寸", type: "boolean", visible: !!e.enableUserData && (((s = e == null ? void 0 : e.dialog) == null ? void 0 : s.resizeable) ?? !0) && e.openType !== "Popup", $converter: pe }, enableEsc: { description: "允许ESC关闭", title: "允许ESC关闭", type: "boolean", visible: e.openType !== "Popup", $converter: pe }, showMaxButton: { description: "显示最大化按钮", title: "显示最大化按钮", type: "boolean", visible: e.openType !== "Popup", $converter: pe }, showCloseButton: { description: "显示关闭按钮", title: "显示关闭按钮", type: "boolean", visible: e.openType !== "Popup", $converter: pe } }; } function bn(e, a = !0) { var o, s, u, l; const t = !((o = e.pagination) != null && o.enable), n = () => e.displayType ? e.displayType.toUpperCase() : "", i = (r, d) => { const f = n() !== "TREELIST" || r.treeToList; return d && f ? r.pagination && r.pagination[d] : f; }; return { hide: n() === "TREELIST" || !e.helpId || t, description: "分页配置", title: "分页", parentPropertyID: "pagination", $converter: fn, properties: { // enable: { // description: "启用分页", // title: "启用分页", // type: "boolean", // refreshPanelAfterChanged: true, // $converter: lookupPaginationConverter // }, showLimits: { description: "显示每页条数选择器", title: "显示条数选择器", type: "boolean", refreshPanelAfterChanged: a, visible: i(e) }, sizeLimits: { description: "每页可显示条数", title: "每页显示条数", type: "array", refreshPanelAfterChanged: a, visible: i(e, "showLimits"), editor: { columns: [ { field: "value", title: "显示条数", dataType: "number", editor: { type: "number-spinner", useThousands: !1, min: 10, max: 1e4 } } ], title: "每页显示条数编辑器", modalWidth: 400, modalHeight: 500, type: "item-collection-editor", valueField: "value", nameField: "value", requiredFields: ["value"], uniqueFields: ["value"], modelValue: Ne((s = e.pagination) == null ? void 0 : s.sizeLimits), beforeSubmit: ({ notifyService: r, data: d }) => !d || !d.length ? (r == null || r.warning({ message: "每页显示条数不能为空!" }), !1) : new Set(d.map((T) => parseInt(T.value, 10))).size === d.length ? !0 : (r == null || r.warning({ message: "每页显示条数不能重复!" }), !1) } }, size: { description: "默认显示条数", title: "默认显示条数", type: "number", visible: i(e), editor: { type: "number-spinner", useThousands: !1, data: Ne((u = e.pagination) == null ? void 0 : u.sizeLimits), textField: "value", idField: "value", valueField: "value", modelValue: (l = e.pagination) == null ? void 0 : l.size } } } }; } class dt extends Mt { constructor() { super(...arguments); oe(this, "comboListEditor", { type: "combo-list", enableClear: !1, editable: !1 }); oe(this, "numberEditor", { type: "number-spinner", useThousands: !1 }); oe(this, "readonlyEditor", { ...this.comboListEditor, editable: !0 }); oe(this, "visibleEditor", { ...this.comboListEditor, editable: !1 }); oe(this, "requiredEditor", { ...this.comboListEditor, editable: !1 }); oe(this, "freeInputEditor", { ...this.comboListEditor, editable: !1 }); } getExpressionConfig(t, n) { const i = ["validate"]; return t.type === "form-group" && i.push("dataPicking"), new Xe(this.formSchemaUtils).getExpressionConfig(t, "Field", i); } getPropertyConfig(t, n, i = "Card") { var c; const o = (c = t.binding) != null && c.field ? [] : ["Const", "Variable", "StateMachine"]; this.readonlyEditor = this.getPropertyEditorParams(t, o, "readonly"), this.visibleEditor = this.getPropertyEditorParams(t, o, "visible"), this.requiredEditor = this.getPropertyEditorParams(t, o, "required"), this.freeInputEditor = this.getPropertyEditorParams(t, ["Const", "Variable"], "allowFreeInput"); const s = this.getBasicProperties(t, n, i), u = this.getBehaviorConfig(t), l = this.getAppearanceProperties(t, n), r = this.getLookupConfig(t), d = this.getEventPropConfig(t), f = this.getDialogPropertyConfig(t), T = this.getPageConfig(t.editor), I = this.getTreePropConfig(t.editor), b = this.getSearchConfig(t), p = this.getExpressionConfig(t, "Field"), h = { basic: s, appearance: l, behavior: u, lookup: r, treeConfig: I, dialog: f, pager: T, searchConfig: b, expressions: p }; return t.type === "form-group" && (h.eventsEditor = d), { type: "object", categories: h }; } getGridFieldEdtiorPropConfig(t) { return this.getPropertyConfig(t, null, "Grid").categories; } flattenTreeNodes(t) { return t.reduce((n, i) => { var o; return n.push(i), (o = i.children) != null && o.length && n.push(...this.flattenTreeNodes(i.children)), n; }, []); } isSimpleStringField() { var u; const t = ((u = this.designViewModelField) == null ? void 0 : u.path) || ""; if (!t || !t.includes(".")) return !0; const n = t.split("."), i = this.designViewModelUtils.getAllFields2TreeByVMId(this.viewModelId); if (!(i != null && i.length)) return !1; const o = i.find((l) => l.data.code === n[0]); if (!o) return !1; const s = [o, ...this.flattenTreeNodes(o.children)]; return !n.reduce( (l, r, d) => [...l, d ? `${l[d - 1]}.${r}` : r], [] ).some( (l) => { var r, d, f; return ((f = (d = (r = s.find((T) => T.data.path === l)) == null ? void 0 : r.data) == null ? void 0 : d.type) == null ? void 0 : f.$type) === "EntityType"; } ); } getBehaviorConfig(t) { return { description: "Basic Infomation", title: "行为", properties: { visible: { description: "运行时组件是否可见", title: "是否可见", type: "boolean", editor: this.visibleEditor } }, setPropertyRelates: (n, i) => { this.afterMutilEditorChanged(i, n); } }; } // 绑定字段更新后,处理lookup 的相关属性 changeBindingField(t, n) { super.changeBindingField(t, n), t.editor.multiSelect = !1; } getDisplayType(t) { return t.displayType ? t.displayType.toUpperCase() : ""; } mapFieldsDisplayFormatter(t) { return t && t.length ? t.map((n) => `${n.name}[${n.bindingPath}]`).join(",") : ""; } getSearchConfig(t) { var n; return { description: "Lookup Search Infomation", title: "搜索", parentPropertyID: "editor", properties: { enableSearchBar: { $converter: ne, description: "是否启用搜索栏", refreshPanelAfterChanged: !0, title: "启用搜索栏", type: "boolean" }, searchAnyField: { description: "显示所有列", $converter: ne, title: "允许查询所有列", type: "boolean", visible: t.editor.openType !== "Popup" && t.editor.enableSearchBar == null ? !0 : !!t.editor.enableSearchBar }, enableEqualSearch: { $converter: ne, description: "是否启用等于搜索", title: "启用精确搜索", type: "boolean", visible: t.editor.openType !== "Popup" && (((n = t.editor) == null ? void 0 : n.enableSearchBar) ?? !0) !== !1 } }, hide: t.editor.openType === "Popup" }; } getLookupConfig(t) { const n = t.editor, i = () => { const r = this.formSchemaUtils.getFormSchema().module.entity[0].id, d = this.formSchemaUtils.getFormMetadataBasicInfo(); return { propertyData: n, formBasicInfo: d, viewModelId: r, dataSourceId: n.helpId }; }, { dataSourceEditor: o, idFieldEditor: s, textFieldEditor: u, mappingFieldsEditor: l } = mn(n, this); return { description: "Basic Infomation", title: "编辑器", setPropertyRelates: (r, d) => { if (r) switch (r.propertyID) { case "readonly": case "required": this.afterMutilEditorChanged(d, r); break; } }, parentPropertyID: "editor", properties: { readonly: { description: "", title: "只读", type: "boolean", $converter: "/converter/property-editor.converter", editor: this.readonlyEditor }, required: { description: "", title: "必填", type: "boolean", $converter: "/converter/property-editor.converter", editor: this.requiredEditor }, placeholder: { description: "当控件没有值时在输入框中显示的文本", title: "提示文本", type: "string", $converter: ne }, enableTitle: { description: "鼠标悬停显示文本内容", title: "悬停提示", type: "boolean", $converter: ne, editor: this.comboListEditor }, editable: { description: "", title: "允许编辑", type: "boolean", $converter: ne, refreshPanelAfterChanged: !0, editor: this.comboListEditor, visible: !(n.multiSelect && n.openType === "Popup") }, allowFreeInput: { description: "", title: "任意输入", type: "boolean", $converter: ne, editor: this.freeInputEditor, visible: !!n.editable && this.isSimpleStringField() }, enableClear: { title: "启用清除按钮", type: "boolean", $converter: ne }, dataSource: { description: "数据源", title: "数据源", type: "string", refreshPanelAfterChanged: !0, editor: { ...o, displayFormatter: (r) => r && r.length ? r.map((d) => `${d.name}(${d.code})`).join(",") : "", validateFunction: async (r) => this.formSchemaUtils.designerMode !== "PC_RTC" ? !0 : this.checkSameBESource(r, t), onSubmitModal: (r) => { if (r) { delete n.mappingFields; const d = this.formSchemaUtils.getFormMetadataBasicInfo(); return this.metadataService.getPickMetadata(d.relativePath, r[0].data).then((f) => JSON.parse(f == null ? void 0 : f.metadata.content)); } } }, $converter: ct }, filterConditions: { descriptions: "帮助过滤条件", title: "过滤条件", type: "string", $converter: ne, editor: { type: "filter-condition-editor", editable: !1, displayText: "点击配置", enableClear: !1, enableExpression: !0, editorParams: { propertyData: n, formBasicInfo: this.formSchemaUtils.getFormMetadataBasicInfo(), viewModelId: this.formSchemaUtils.getFormSchema().module.entity[0].id }, idField: "path", repositoryToken: Le, beforeOpen: async ({ repository: r, notifyService: d }) => { var h; if (!(n == null ? void 0 : n.helpId)) return d == null || d.warning({ message: "请先配置数据源!" }), !1; const T = i(), b = new Xe(this.formSchemaUtils).getEntitiesAndVariables(); let p = {}; if (r) { const c = await r.getData(T), v = await r.getLookupConditions(T); p = { fieldList: c, conditionList: v }; } return (h = b.variables) != null && h.forms && (b.variables.forms.items = b.variables.forms.items.filter((c) => c.category === "remote")), { ...p, ...b, isServerSide: !0 }; }, onSubmitModal: async ({ loadingService: r, repository: d, conditions: f, originalConditions: T, FMessageBoxService: I }) => { if (d) try { const b = i(), p = await d.getLookupConditions(b) || []; return JSON.stringify(p) !== JSON.stringify(T.value) ? (r == null || r.clearAll(), I.question("视图对象中的帮助过滤条件已更改,请点击确定同步过滤数据", "", () => { f.value = p, T.value = JSON.parse(JSON.stringify(f.value)); }, () => { }), !1) : (JSON.stringify(f.value) === JSON.stringify(T.value) || await d.saveFilterCondition(f.value, b, this.formSchemaUtils.getFormMetadataBasicInfo()), !0); } catch { return I == null || I.error("保存失败", ""), !1; } finally { r == null || r.clearAll(); } } }, visible: !!n.helpId }, displayType: { description: "类型: 树列表、列表、双列表、左树右列表", title: "展示类型", type: "string", $converter: dn, editor: { type: "combo-list", editable: !1, disabled: !0, data: [ { text: "列表", value: "LIST" }, { text: "树列表", value: "TREELIST" }, { text: "双列表", value: "NAVLIST" }, { text: "左树右列表", value: "NAVTREELIST" } ], textField: "text", idField: "value", valueField: "value" } }, idField: { description: "数据源标识字段", title: "标识字段", type: "string", editor: { ...s }, $converter: un }, textField: { description: "显示文本字段", title: "文本字段", type: "string", $converter: cn, editor: u }, mappingFields: { description: "字段映射", title: "字段映射", type: "string", $converter: ne, editor: { ...l } }, enableToSelect: { description: "数据加载后是否选中现有值", $converter: ne, title: "选中已选值", type: "boolean", editor: this.comboListEditor }, multiSelect: { description: "启用多选", $converter: ne, title: "启用多选", type: "boolean", editor: this.comboListEditor, refreshPanelAfterChanged: !0, visible: this.isSimpleStringField() }, showSelections: { description: "显示已选记录", $converter: ne, title: "显示已选记录", type: "boolean", visible: !!n.multiSelect && n.openType !== "Popup" }, separator: { description: "多选分隔符", $converter: ne, title: "多选分隔符", type: "string", editor: { type: "combo-list", editable: !1, disabled: !1, data: [ { text: ",", value: "," }, { text: "|", value: "|" }, { text: "#", value: "#" } ], textField: "text", idField: "value", valueField: "value", separator: "@" }, visible: !!n.multiSelect }, enableSearchBar: { description: "显示搜索工具条", $converter: ne, refreshPanelAfterChanged: !0, title: "启用搜索框", type: "boolean", visible: !1 }, enableFavorite: { description: "启用收藏夹", $converter: ne, title: "启用收藏夹", type: "boolean", visible: n.openType !== "Popup" }, enableUserData: { description: "保存界面状态", $converter: ne, refreshPanelAfterChanged: !0, title: "保存界面状态", type: "boolean", visible: n.openType !== "Popup" } } }; } showNavigatiorWidth(t) { return this.getDisplayType(t).startsWith("NAV") && t.openType !== "Popup" ? t.showNavigation === void 0 ? !0 : !!t.showNavigation : !1; } getDialogPropertyConfig(t) { const n = vn(t.editor); return n.openType.$converter = ne, { description: "帮助窗口尺寸配置", title: "帮助窗口", parentPropertyID: "dialog", $converter: pe, properties: n }; } showPagerProperty(t, n) { const i = this.getDisplayType(t) !== "TREELIST" || t.treeToList; return n && i ? t.pagination && t.pagination[n] : i; } /** * 获取页配置 * @param editorOptions * @returns */ getPageConfig(t) { return bn(t); } showLoadType(t) { const n = this.getDisplayType(t); return (n === "TREELIST" || n === "NAVTREELIST") && !t.treeToList && !t.navTreeToList; } isTree(t) { return this.getDisplayType(t) === "TREELIST" && !t.treeToList; } getTreePropConfig(t) { return { hide: this.getDisplayType(t) !== "TREELIST" && this.getDisplayType(t) !== "NAVTREELIST", description: "树形数据配置", title: "树形数据配置", parentPropertyID: "editor", properties: { treeToList: { description: "以列表的形式展示树结构数据", $converter: ne, refreshPanelAfterChanged: !0, title: "以列表形式展示", type: "boolean", visible: this.getDisplayType(t) === "TREELIST" }, navTreeToList: { description: "以列表的形式展示树结构数据", $converter: ne, refreshPanelAfterChanged: !0, title: "以列表形式展示", type: "boolean", visible: this.getDisplayType(t) === "NAVTREELIST" }, loadTreeDataType: { description: "树形数据加载方式", $converter: ne, title: "数据加载方式", type: "string", editor: { ...this.comboListEditor, data: [ { value: "default", text: "默认" }, { value: "all", text: "全部加载" }, { value: "async", text: "分层加载" } ], textField: "text", valueField: "value" }, visible: this.showLoadType(t) }, enableFullTree: { description: "启用构造完整树", $converter: ne, title: "构造完整树", type: "boolean", visible: this.showLoadType(t) }, onlySelectLeaf: { description: "仅选择叶子节点", $converter: ne, title: "仅选择叶子节点", type: "boolean", visible: this.isTree(t) }, enableCascade: { description: "启用级联选择", $converter: ne, refreshPanelAfterChanged: !0, title: "启用级联选择", type: "boolean", visible: this.isTree(t) && !!t.multiSelect && t.openType !== "Popup" }, showCascadeControl: { description: "是否在界面中显示级联状态", $converter: ne, title: "显示级联状态", type: "boolean", visible: !!t.enableCascade && this.isTree(t) }, cascadeValue: { description: "缺省级联选择模式", $converter: ne, title: "缺省级联选择模式", type: "string", visible: !!t.enableCascade && this.isTree(t), editor: { ...this.comboListEditor, data: $e, textField: "text", valueField: "value" } }, expandLevel: { description: "默认展开层级: 0: 不展开; -1: 全部展开;>0: 展开到指定级数 ", $converter: ne, title: "默认展开层级", type: "number", visible: this.showLoadType(t), editor: { ...this.numberEditor, min: -1, max: 99 } } } }; } getEventPropConfig(t) { const n = this; let i = pn; t.editor.openType === "Popup" && (i = i.filter((u) => u.label !== "beforeSelectData")); const o = n.eventsEditorUtils.formProperties(t, n.viewModelId, i); return { title: "事件", hideTitle: !0, properties: n.createBaseEventProperty(o), // 这个属性,标记当属性变更得时候触发重新更新属性 refreshPanelAfterChanged: !0, tabId: "commands", tabName: "交互", setPropertyRelates(u, l) { const r = u.propertyValue; delete l[n.viewModelId], r && n.eventsEditorUtils.saveRelatedParameters(l, n.viewModelId, r.events, r); const d = n.designViewModelUtils.getDgViewModel(n.viewModelId); d && n.designViewModelField && d.changeField(n.designViewModelField.id, { valueChanging: l.fieldValueChanging, valueChanged: l.fieldValueChanged }); } }; } /** * 运行时定制:校验帮助是否绑定同一be(目前不限制通过vo创建的帮助元数据) * @param newHelpDataSource 新选的帮助 */ async checkSameBESource(t, n) { var i, o, s, u, l; if (t && ((i = n == null ? void 0 : n.editor) != null && i.helpId) && !n.isRtcControl) { if (t.data.id === n.editor.helpId) return !0; const r = await this.metadataService.getPickMetadata("", t.data).then((p) => { var h; if ((h = p == null ? void 0 : p.metadata) != null && h.content) return JSON.parse(p.metadata.content); }), d = await this.metadataService.getPickMetadata("", { id: n.editor.helpId }).then((p) => { var h; if ((h = p == null ? void 0 : p.metadata) != null && h.content) return JSON.parse(p.metadata.content); }), f = (o = r == null ? void 0 : r.dataSource) == null ? void 0 : o.sourceType, T = (s = d.dataSource) == null ? void 0 : s.sourceType, I = (u = r == null ? void 0 : r.dataSource) == null ? void 0 : u.sourceId, b = (l = d == null ? void 0 : d.dataSource) == null ? void 0 : l.sourceId; if (f === "BE" && T === "BE" && I !== b) return new Nt().error({ message: "只允许更换同数据源的帮助元数据", position: "top-center" }), !1; } return !0; } } function yn(e, a) { function t(n, i) { const o = e.schema; return new dt(n, a).getPropertyConfig(o, i); } return { getPropsConfig: t }; } const Cn = /* @__PURE__ */ ge({ name: "FLookupDesign", props: Ae, emits: [], setup(e, a) { const t = D(), n = Y("design-item-context"), i = Y("designer-host-service"), o = yn(n, i), s = Lt(t, n, o), u = '<i class="f-icon f-icon-lookup"></i>', l = '<i class="f-icon f-icon-arrow-chevron-down"></i>', r = J(() => e.openType === "Popup" ? "Popup" : "Modal"), d = J(() => r.value === "Popup" ? l : u); return Ce(() => { t.value.componentInstance = s; }), a.expose(s.value), () => x("div", { class: "f-lookup-design", ref: t }, [x(xt, { ref: t, buttonContent: d.value, readonly: !0, editable: !1, placeholder: e.placeholder }, null)]); } }); function Se(e, a) { const { lookupOptions: t } = a; function n(p) { return { ...rt, ...p }; } function i() { return { enableSelectRow: !0, multiSelect: t.multiSelect, showCheckbox: t.multiSelect, multiSelectMode: "OnCheckAndClick" }; } function o() { return { fitColumns: e.fitColumns, fitMode: "percentage", resizeColumn: !0 }; } function s() { const { displayType: p } = a.lookupOptions; return typeof p == "string" && p in fe ? !1 : p.toLowerCase().startsWith("nav"); } function u() { const { displayType: p, treeToList: h } = a.lookupOptions; return (p.toLowerCase() === fe.Tree.toLowerCase() || p.toLowerCase() === fe.ListTree.toLowerCase()) && !h; } function l() { const { displayType: p, navTreeToList: h } = a.lookupOptions; return p.toLowerCase() === fe.TreeList.toLowerCase() && !h; } function r() { const { displayType: p, navTreeToList: h } = a.lookupOptions, c = p.toLowerCase(); return c === fe.ListList.toLowerCase() || c === fe.ListTree.toLowerCase() || h; } function d() { var c; return t.dialog ? { width: ((c = t.dialog) == null ? void 0 : c.navigatorWidth) || 320, minWidth: 200 } : { width: 320, minWidth: 200 }; } function f(p) { const { loadTreeDataType: h } = t; return h === be.all || h === "default" && (p == null ? void 0 : p.loadDataType) === "all"; } function T(p) { return (p == null ? void 0 : p.layerType) === "pathcode"; } function I() { return t.enableCascade && t.multiSelect; } function b() { return e.openType === "Popup"; } return { checkPaination: n, checkMultiSelect: i, checkColumnOptions: o, isDoubleList: s, getNavigationSize: d, isTreeList: u, navIsTreeList: l, navIsList: r, isLoadAll: f, isPathCodeTree: T, isEnableCascadeCheck: I, isDropdownMode: b }; } function ft(e, a, t) { var o; const n = D(e.searchFields || []), i = D(((o = e.navigation) == null ? void 0 : o.searchFields) || []); return W(() => a == null ? void 0 : a.searchFields, (s) => { n.value = s; }), W(() => t == null ? void 0 : t.searchFields, (s) => { i.value = s; }), { searchFieldItems: n, navSearchFieldItems: i }; } function Sn(e) { const a = me({}), t = me({}), n = me({}), i = me({}), o = me({}), s = D([]), u = D(), l = me({}), r = D(!1), d = [ "displayType", "treeToList", "navTreeToList", "showSelections", "showNavigation", "multiSelect", "mappingFields", "loader", "idField", "textField", "userDataKey", "dialog", "expandLevel", "treeInfo", "navTreeInfo", "onlySelectLeaf", "loadTreeDataType", "uri", "enableFullTree", "cascadeValue", "showCascadeControl", "enableCascade" ]; function f() { d.forEach((T) => { l[T] = e[T]; }); } return f(), { pageInfoState: a, lookupState: t, navigationState: n, queryState: i, searchState: o, selectionState: s, unSelectDataId: u, lookupOptions: l, searchValueChanged: r }; } const ke = D(), ve = "F_LOOKUP_HTTP_COMPOSITION_TOKEN"; function Tn(e, a) { const t = Y("FLoadingService"), n = Y(tn), i = Sn(e), { pageInfoState: o, lookupState: s, navigationState: u, lookupOptions: l, searchValueChanged: r } = i, { searchFieldItems: d, navSearchFieldItems: f } = ft(e, s, u), T = D(e.idValue), I = D(!1), b = () => { var k; const g = (k = l.displayType) == null ? void 0 : k.toUpperCase(); return g === fe.Tree || g === fe.TreeList; }, p = (g, k = !1) => { if (g) { const { layerType: N, dataField: U, parentField: ee, pathField: te, layerField: j, isDetailField: G, loadDataType: V } = g, X = { layerType: N, dataField: U, parentField: ee, pathField: te, layerField: j, isDetailField: G, loadDataType: V }, { onlySelectLeaf: F, loadTreeDataType: S } = l; X.onlySelectLeaf = F, X.loadDataType = S, k ? l.navTreeInfo = Object.assign(l.navTreeInfo || {}, X) : l.treeInfo = Object.assign(l.treeInfo || {}, X); } }; function h(g, k, N = "like") { if (k == null || !k.trim()) return []; const U = Array.from(new Set(k.trim().split(" ").filter((V) => V.trim()))); if (!g || !U.length) return []; const te = N === "equal" ? Ve.Equal : Ve.Like, j = (g || []).map((V, X) => { const F = U.map((S, M) => ({ filterField: V.value, valu