UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,641 lines 307 kB
var zn = Object.defineProperty; var Un = (e, t, n) => t in e ? zn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var pe = (e, t, n) => Un(e, typeof t != "symbol" ? t + "" : t, n); import { createVNode as h, Fragment as ze, createTextVNode as Ee, defineComponent as re, ref as V, inject as ae, computed as O, onMounted as Fe, watch as _, reactive as Se, toRaw as jn, nextTick as qe, withDirectives as Ue, vModelCheckbox as Gt, onUnmounted as Re, vModelText as Jt, resolveDirective as Kt, mergeProps as mt, vModelSelect as _n, watchEffect as Hn, isVNode as He, provide as Pe } from "vue"; import Qt from "../../designer/button-edit/index.esm.js"; import { useDesignerComponent as Yt, DgControl as Rt, canvasChanged as Wn, refreshCanvas as Gn } from "../designer-canvas/index.esm.js"; import { resolveAppearance as Xt, createPropsResolver as Zt, getPropsResolverGenerator as en } from "../dynamic-resolver/index.esm.js"; import { InputBaseProperty as tn, ExpressionProperty as Jn } from "../property-panel/index.esm.js"; import { FieldSelectorRepositoryToken as ut } from "../field-selector/index.esm.js"; import { isNil as Kn, isNaN as Qn, flatten as nn, cloneDeep as Ye, debounce as vt, get as $e, isUndefined as Yn, isEmpty as Xn } from "lodash-es"; import { FNotifyService as Zn, F_NOTIFY_SERVICE_TOKEN as It } from "../notify/index.esm.js"; import { EVENT_PROPERTY_TAB_IDS as Lt, resolveField as ke, encrypt as ea, useNumberFormat as ta, useDateFormat as na, useResizeObserver as aa, useTouchMomentum as la, useTouch as ia, useCommonUtils as gt, useBem as Ie, useFarrisConfig as oa, FormSchemaEntityFieldType$Type as rt, withInstall as an, useTextBox as sa, useClear as ra, isMobilePhone as Me } from "../common/index.esm.js"; import { F_MODAL_SERVICE_TOKEN as ln } from "../modal/index.esm.js"; import ua, { FButtonEdit as kt } from "../button-edit/index.esm.js"; import { FLayout as ca, FLayoutPane as $t } from "../layout/index.esm.js"; import { FDataGrid as yt } from "../data-grid/index.esm.js"; import { LocaleService as Ne } from "../locale/index.esm.js"; import { FTreeGrid as Pt } from "../tree-grid/index.esm.js"; import { FComboList as on } from "../combo-list/index.esm.js"; import da from "../list-view/index.esm.js"; import "bignumber.js"; import { useNumber as fa, useFormat as pa, useSpinner as ha, useTextBox as ma, getSpinnerRender as va, getNumberTextBoxRender as ga, FNumberSpinner as Ct } from "../number-spinner/index.esm.js"; import { useInputExpand as ya } from "../common/index.esm.js/text-box/use-input-expand"; import { FSwitch as ba } from "../switch/index.esm.js"; import { FDatePicker as qt } from "../components/index.esm.js"; import { FRadioGroup as Sa } from "../radio-group/index.esm.js"; import { FCheckboxGroup as Ca } from "../checkbox-group/index.esm.js"; import { SearchRelation as Ta, SearchComparisonOperator as Fa } from "../field-search-box/index.esm.js"; import xa from "../popover/index.esm.js"; import sn from "../checkbox/index.esm.js"; import wa from "../capsule/index.esm.js"; import We from "../scroll-list/index.esm.js"; import Ia from "../drawer/index.esm.js"; function zt(e) { return typeof e == "string" && e.startsWith("{") && e.endsWith("}") ? (e = e.replace(/'/g, '"'), { mappingFields: JSON.parse(e) }) : { mappingFields: e }; } const rn = /* @__PURE__ */ new Map([ ["appearance", Xt], ["mappingFields", (e, t, n) => { if (t) return zt(t); const { mappingFields: a } = n; return zt(a); }], ["uri", (e, t, n) => { var a; return t ? { uri: t } : { uri: (a = n == null ? void 0 : n.dataSource) == null ? void 0 : a.uri }; }], ["idField", (e, t, n) => { var l; const a = (l = n == null ? void 0 : n.dataSource) == null ? void 0 : l.idField; return a ? { idField: a } : { idField: t || "id" }; }] ]), La = "https://json-schema.org/draft/2020-12/schema", ka = "https://farris-design.gitee.io/lookup.schema.json", Pa = "lookup", Ea = "A Farris Input Component", Va = "object", Da = { 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 }, enableMultiFieldSearch: { type: "boolean", default: !1 }, 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 }, onClearMapping: { type: "string", default: "" }, customFormatter: { type: "object", default: null }, customNavFormatter: { type: "object", default: null }, enableTips: { type: "boolean", default: !1 }, tipsContent: { type: "string", default: "" }, expandable: { description: "", type: "boolean", default: !1 }, expandMode: { description: "", type: "string", default: "text" }, expandContent: { description: "", type: "string", default: "" }, expandDisabled: { description: "", type: "boolean", default: !1 }, loader: { type: "object", default: null }, selectFirstNavItem: { type: "boolean", default: !1 }, onExpandClick: { description: "", type: "string", default: "" }, userDataKey: { type: "string", default: "" } }, Ba = [ "type" ], Ma = [ "appearance", "binding", "visible" ], Na = { dictPicking: "帮助前事件", dictPicked: "帮助后事件", beforeSelectData: "数据选择确认前事件", beforeLoadData: "数据加载前事件", clear: "清空事件" }, un = { $schema: La, $id: ka, title: Pa, description: Ea, type: Va, properties: Da, required: Ba, ignore: Ma, events: Na }; function cn(e, t, n) { return t; } var dn = /* @__PURE__ */ ((e) => (e.Both = "both", e.Up = "up", e.Down = "down", e.Disable = "disable", e))(dn || {}); const Tt = [ { value: "both", text: "同步选择" }, { value: "up", text: "包含上级" }, { value: "down", text: "包含下级" }, { value: "disable", text: "仅选择自身" } ], fn = ""; var xe = /* @__PURE__ */ ((e) => (e.List = "LIST", e.Tree = "TREELIST", e.ListList = "NAVLIST", e.TreeList = "NAVTREELIST", e.ListTree = "NAVLISTTREE", e))(xe || {}), Ve = /* @__PURE__ */ ((e) => (e.default = "default", e.all = "all", e.async = "async", e))(Ve || {}); const et = "__lookup_active_tab__", Bo = "__lookup_user_data_id__"; var Te = /* @__PURE__ */ ((e) => (e.dataList = "datalist", e.favorite = "favorite", e))(Te || {}); const pn = { showPageInfo: !0, enable: !1, showLimits: !0, sizeLimits: [10, 20, 30, 50, 100], size: 20, index: 1, total: 0, mode: "server", showGoto: !1 }, hn = Symbol("f_lookup-http-service_token"); var ct = /* @__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))(ct || {}), dt = /* @__PURE__ */ ((e) => (e[e.Empty = 0] = "Empty", e[e.And = 1] = "And", e[e.Or = 2] = "Or", e))(dt || {}), Oa = /* @__PURE__ */ ((e) => (e[e.Value = 0] = "Value", e[e.Expression = 1] = "Expression", e.FrontExpress = "frontExpress", e))(Oa || {}); const Aa = { showCloseButton: !0, showMaxButton: !0, draggable: !0, resizeable: !0, enableEsc: !0, rememberSize: !0 }; function Ra() { function e(t, n, a) { const l = {}; return l.dictPicking = (i) => n.call("dictPicking", t, [i, t], a), l.beforeLoadData = (i) => n.call("beforeLoadData", t, [i, t], a), l.beforeSelectData = (i) => n.call("beforeSelectData", t, [i, t], a), l.dictPicked = (i) => n.call("dictPicked", t, [i, t], a), l; } return { resolve: e }; } const tt = { id: { type: String, require: !0 }, uri: { type: String, default: "" }, title: { 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: xe.List }, dialog: { type: Object, default: { title: "" } }, multiSelect: { type: Boolean, default: !1 }, showSelections: { type: Boolean, default: !0 }, separator: { type: String, default: "," }, pagination: { type: Object, default: pn }, 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 }, showNavSearchBar: { type: Boolean, default: !0 }, showIncludeChildNodes: { type: Boolean, default: !0 }, selectFirstNavItem: { type: Boolean, default: !1 }, navDefaultQueryValue: { type: Object, default: null }, includeChildNodesValue: { type: Boolean, default: !0 }, enableMultiFieldSearch: { type: Boolean, default: !1 }, treeToList: { type: Boolean, default: !1 }, navTreeToList: { type: Boolean, default: !1 }, loadTreeDataType: { type: String, default: Ve.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 }, togglePopupOnClickInput: { type: Boolean, default: !1 }, customFormatter: { type: Object, default: null }, customNavFormatter: { type: Object, default: null }, textAlign: { type: String, default: "left" }, /** 是否可扩展 */ expandable: { type: Boolean, default: !1 }, /** 扩展模式 text | button */ expandMode: { type: String, default: "text" }, /** 扩展文本内容 */ expandContent: { type: String, default: "" }, /** 扩展按钮是否禁用 */ expandDisabled: { type: Boolean, default: !1 } }, Mo = Zt(tt, un, rn, cn), $a = Ra(), mn = en( tt, un, rn, cn ); function pt(e) { let t = [10, 20, 30, 50, 100]; return e && (typeof e == "string" && (t = e.replaceAll("[", "").replaceAll("]", "").replaceAll(" ", "").split(",")), Array.isArray(e) && (t = e)), t.map((n) => ({ value: parseInt(n, 10) })).sort((n, a) => n.value - a.value); } const se = { convertFrom: (e, t) => { const n = e.editor ? e.editor : e; return t === "multiSelect" || t === "enableTitle" ? !!n[t] : t === "separator" ? n[t] || "," : t === "onlySelectLeaf" ? n[t] == null ? !1 : n[t] : t === "loadTreeDataType" ? n[t] || "default" : t === "placeholder" ? Kn(n[t]) ? "请选择" : n[t] : t === "openType" ? n[t] || "Modal" : n[t]; }, convertTo: (e, t, n) => { const a = e.editor ? e.editor : e; if (a[t] = n, t === "multiSelect" && !n && (a.enableCascade = !1), t === "openType") { if (n === "Popup") a.showSelections = !1, a.enableCascade = !1; else if (a.dialog) { const { width: l } = a.dialog, { displayType: i } = a; i && i.toUpperCase().indexOf("NAV") > -1 && (!l || l < 520) && (a.dialog.width = 960); } } a.multiSelect && a.openType === "Popup" && (a.editable = !1, a.allowFreeInput = !1); } }; function qa(e) { let t = "form_group_" + Date.now(); return e && (t = e.replace(/-/g, "_").replace(/\./g, "_")), "lookup." + t; } function za(e, t) { const { enablePager: n, pageSize: a, pageList: l } = t; e.pagination = e.pagination || {}, Object.assign(e.pagination, { enable: n, sizeLimits: pt(l).map((i) => i.value), size: a, showLimits: !0, showGoto: !1, mode: "server" }); } const vn = { convertFrom: (e, t) => { var a; return (a = (e.editor ? e.editor : e).dataSource) == null ? void 0 : a.displayName; }, convertTo: (e, t, n) => { if (n && n.length > 0) { const a = e.editor ? e.editor : e, l = n[0], { name: i, id: o, metadataContent: c, code: s } = l; a.dataSource || (a.dataSource = {}), a.dataSource.displayName = `${i}(${s})`, a.helpId = o; const { displayType: r, idField: d, textField: u } = c; a.displayType = r, a.dataSource.idField = d, a.textField = u, a.dataSource.type = "ViewObject", a.enableEqualSearch = !1; const { pageInfo: p } = c.dataSource; za(a, p); const { treeInfo: S } = r.toUpperCase() === "NAVTREELIST" ? c.navigation : c.dataSource; if (S) { const { onlySelectLeaf: m, loadDataType: w } = S; a.loadTreeDataType = "default", a.onlySelectLeaf = m ?? !1; } if (a.dataSource.uri || (a.dataSource.uri = qa(e.id)), a.dialog) { const { width: m } = a.dialog; r && r.toUpperCase().indexOf("NAV") > -1 && (!m || m < 520) && (a.dialog.width = 960); } } } }, Ua = { convertFrom: (e, t) => { var n; return (n = e.editor.dataSource) == null ? void 0 : n.idField; }, convertTo: (e, t, n) => { if (n && n.length > 0) { const a = n[0]; e.editor.dataSource.idField = a == null ? void 0 : a.bindingPath; } } }, ja = { convertFrom: (e, t) => { var n; return (n = e.editor) == null ? void 0 : n.textField; }, convertTo: (e, t, n) => { if (n && n.length > 0) { const a = n[0]; e.editor.textField = a == null ? void 0 : a.bindingPath; } } }, _a = { convertFrom: (e, t) => e.editor.displayType ? e.editor.displayType.toUpperCase() : "LIST", convertTo: (e, t, n) => { e.editor.displayType = n; } }, Be = { convertFrom: (e, t) => { var i; let n = e.editor ? e.editor.dialog : e.dialog; const a = e.editor ? e.editor.openType : e.openType; if (n || (n = {}), t === "title") return n[t] || fn; if (!a || a === "Modal") { if (t === "width") return (i = n.displayType) != null && i.toUpperCase().startsWith("NAV") ? n[t] || 960 : n[t] || 590; if (t === "height") return n[t] || 620; if (t === "navigatorWidth") return n[t] || 320; } else { if (t === "width") return n[t] || 460; if (t === "height") return n[t] || 380; } if (t === "draggable") return !0; if (["showMaxButton", "showCloseButton", "resizeable", "enableEsc", "rememberSize"].includes(t)) return n[t] == null ? !0 : n[t]; }, convertTo: (e, t, n) => { const a = e.editor ? e.editor : e; a.dialog = a.dialog || {}, a.dialog[t] = n; } }, Ha = { convertFrom: (e, t) => { const n = e.editor ? e.editor : e; if (n.pagination = n.pagination || {}, t === "enable" || t === "showLimits") return n.pagination[t] == null ? !1 : n.pagination[t]; if (t === "sizeLimits") { const a = n.pagination[t]; return pt(a); } if (t === "size") return n.pagination[t] || 20; }, convertTo: (e, t, n) => { var l; const a = e.editor ? e.editor || {} : e; if (a.pagination = a.pagination || {}, t === "sizeLimits") { const i = n.map((c) => c.value); a.pagination[t] = i; const o = ((l = a.pagination) == null ? void 0 : l.size) ?? 20; i.includes(o) || (a.pagination.size = i[0]); return; } a.pagination[t] = n; } }, Wa = [ { label: "clear", name: "清空事件" }, { label: "dictPicking", name: "帮助前事件" }, { label: "beforeLoadData", name: "数据加载前事件" }, { label: "beforeSelectData", name: "选择数据确认前事件" }, { label: "dictPicked", name: "帮助后事件" } ], Ga = [ { label: "dictPicking", name: "帮助前事件" }, { label: "beforeLoadData", name: "数据加载前事件" }, { label: "beforeSelectData", name: "选择数据确认前事件" }, { label: "dictPicked", name: "帮助后事件" } ], Ja = `{ "name": ({rowData, column}) => { return rowData.name; }, "rowStyler": ({rowData}) => { return { style: { color: 'red' }, class: { 'bg-red': true } } }, "cellStyler": ({rowData, column}) => { return { style: { backgroundColor: 'red' }, class: { 'bg-red': true } } } }`, Ut = (e) => h(ze, null, [h("h5", { style: "display: flex;justify-content: space-between;align-items: center;" }, [Ee("示例代码:"), h("button", { class: "btn btn-link align-items-center d-flex", onClick: () => e.value.setValue(Ja) }, [h("span", { class: "f-icon f-icon-source-code mr-1" }, null), Ee("应用代码")])]), h("pre", { style: "height: calc(100% - 35px);margin: 0;" }, [`{ // 列表字段自定义数据,rowData: 行数据, column: 列信息; // 返回字符串. name为字段名称。其他字段可根据需求自定义。 "name": ({rowData, column}) => { return rowData.name; }, // 行样式,rowData: 行数据; // 返回格式 { style?: { [key]: string }, class?: { [key]: boolean } } "rowStyler": ({rowData}) => { return { style: { color: 'red' }, class: { 'bg-red': true } } }, // 单元格样式,rowData: 行数据, column: 列信息; // 返回格式 { style?: { [key]: string }, class?: { [key]: boolean } } "cellStyler": ({rowData, column}) => { return { style: { backgroundColor: 'red' }, class: { 'bg-red': true } } } }`])]), Ka = Symbol("schema_repository_token"); function Qa(e, t) { const n = /* @__PURE__ */ new Map(); t.forEach((l) => { n.set(l.id, l.title); }); const a = (l) => { var i; if (!(!l || l.length === 0)) for (const o of l) { const c = (i = o.data) == null ? void 0 : i.id; c && n.has(c) && (o.data.name = n.get(c)), o.children && o.children.length > 0 && a(o.children); } }; a(e); } function Ya(e, t) { const n = (a) => a && a.length ? a.map((l) => `${l.name}[${l.bindingPath}]`).join(",") : ""; return { dataSourceEditor: { type: "schema-selector", title: "选择数据源", editorParams: { propertyData: e, formBasicInfo: t.formSchemaUtils.getFormMetadataBasicInfo() }, viewOptions: ["PC_RTC", "PC_NoCode"].includes(t.formSchemaUtils.designerMode) ? [ { id: "total", title: "全部", type: "List", dataSource: "Total" } ] : [ { id: "recommend", title: "推荐", type: "List", dataSource: "Recommand", enableGroup: !0, groupField: "category", groupFormatter: (a, l) => `${a === "local" ? "本地元数据" : "最近使用"}` }, { id: "total", title: "全部", type: "List", dataSource: "Total" } ], repositoryToken: Ka }, dataSourceConverter: vn, defaultConverter: se, idFieldEditor: { type: "field-selector", textField: "bindingPath", idField: "bindingPath", disabled: !1, editorParams: { propertyData: e, formBasicInfo: t.formSchemaUtils.getFormMetadataBasicInfo() }, columns: [ { field: "name", title: "名称" }, { field: "code", title: "编号" }, { field: "bindingPath", title: "绑定字段" } ], repositoryToken: ut }, textFieldEditor: { type: "field-selector", textField: "bindingPath", idField: "bindingPath", editorParams: { propertyData: e, formBasicInfo: t.formSchemaUtils.getFormMetadataBasicInfo() }, columns: [ { field: "name", title: "名称" }, { field: "code", title: "编号" }, { field: "bindingPath", title: "绑定字段" } ], repositoryToken: ut }, mappingFieldsEditor: { type: "mapping-editor", modalWidth: 800, modalHeight: 600, editable: !1, editorParams: { propertyData: e, formBasicInfo: t.formSchemaUtils.getFormMetadataBasicInfo() }, fromData: { editable: !0, formatter: (a, l) => `${l.raw.name} [${l.raw.bindingPath}]`, idField: "bindingPath", textField: "name", valueField: "bindingPath", searchFields: ["name", "bindingPath"], repositoryToken: ut, displayFormatter: n }, toData: { editable: !1, idField: "bindingPath", textField: "name", valueField: "bindingPath", searchFields: ["name", "bindingPath"], dataSource: () => { const a = t.designViewModelUtils.getAllFields2TreeByVMId(t.viewModelId); if (t.formRule) { const i = t.formRule.fields.map((o) => ({ id: o.binding.field, title: o.label })); Qa(a, i); } const l = t.schemaService.getPrimaryField(); return l ? a.filter((i) => i.data.bindingPath !== l) : a; }, formatter: (a, l) => `${l.raw.name} [${l.raw.bindingPath}]`, displayFormatter: n } } }; } function Xa(e) { var i; const t = { type: "combo-list", enableClear: !1, editable: !1 }, n = { type: "number-spinner", useThousands: !1 }, a = () => e.displayType ? e.displayType.toUpperCase() : "", l = () => a().startsWith("NAV") ? e.showNavigation === void 0 ? !0 : !!e.showNavigation : !1; return { openType: { description: "窗口展示方式:弹出窗口、下拉面板", title: "打开方式", type: "string", refreshPanelAfterChanged: !0, $converter: se, editor: { ...t, 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: Be }, width: { description: "窗口宽度,单位:px,最小值:300px", title: "宽度", type: "number", editor: { ...n, min: l() ? 520 : 300, needValid: !0 }, $converter: Be }, height: { description: "窗口高度,单位:px,最小值:200px", title: "高度", type: "number", editor: { ...n, min: 200, needValid: !0 }, $converter: Be }, resizeable: { description: "允许鼠标拖拽窗口边缘调整尺寸", title: "允许调整窗口尺寸", type: "boolean", visible: e.openType !== "Popup", $converter: Be }, rememberSize: { description: "记录窗口尺寸", title: "记录窗口尺寸", type: "boolean", visible: !!e.enableUserData && (((i = e == null ? void 0 : e.dialog) == null ? void 0 : i.resizeable) ?? !0) && e.openType !== "Popup", $converter: Be }, enableEsc: { description: "允许ESC关闭", title: "允许ESC关闭", type: "boolean", visible: e.openType !== "Popup", $converter: Be }, showMaxButton: { description: "显示最大化按钮", title: "显示最大化按钮", type: "boolean", visible: e.openType !== "Popup", $converter: Be }, showCloseButton: { description: "显示关闭按钮", title: "显示关闭按钮", type: "boolean", visible: e.openType !== "Popup", $converter: Be } }; } function Za(e, t = !0) { var i, o, c, s; const n = !((i = e.pagination) != null && i.enable), a = () => e.displayType ? e.displayType.toUpperCase() : "", l = (r, d) => { const u = a() !== "TREELIST" || r.treeToList; return d && u ? r.pagination && r.pagination[d] : u; }; return { hide: !l(e) || n, description: "分页配置", title: "分页", parentPropertyID: "pagination", $converter: Ha, properties: { // enable: { // description: "启用分页", // title: "启用分页", // type: "boolean", // refreshPanelAfterChanged: true, // $converter: lookupPaginationConverter // }, showLimits: { description: "显示每页条数选择器", title: "显示条数选择器", type: "boolean", refreshPanelAfterChanged: t, visible: l(e) }, sizeLimits: { description: "每页可显示条数", title: "每页显示条数", type: "array", refreshPanelAfterChanged: t, visible: l(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: pt((o = e.pagination) == null ? void 0 : o.sizeLimits), beforeSubmit: ({ notifyService: r, data: d }) => !d || !d.length ? (r == null || r.warning({ message: "每页显示条数不能为空!" }), !1) : new Set(d.map((p) => parseInt(p.value, 10))).size === d.length ? !0 : (r == null || r.warning({ message: "每页显示条数不能重复!" }), !1) } }, size: { description: "默认显示条数", title: "默认显示条数", type: "number", visible: l(e), editor: { type: "combo-list", enableClear: !1, editable: !1, data: pt((c = e.pagination) == null ? void 0 : c.sizeLimits), textField: "value", idField: "value", valueField: "value", modelValue: (s = e.pagination) == null ? void 0 : s.size } } } }; } class gn extends tn { constructor() { super(...arguments); pe(this, "comboListEditor", { type: "combo-list", enableClear: !1, editable: !1 }); pe(this, "numberEditor", { type: "number-spinner", useThousands: !1 }); pe(this, "readonlyEditor", { ...this.comboListEditor, editable: !0 }); pe(this, "visibleEditor", { ...this.comboListEditor, editable: !1 }); pe(this, "requiredEditor", { ...this.comboListEditor, editable: !1 }); pe(this, "freeInputEditor", { ...this.comboListEditor, editable: !1 }); } getExpressionConfig(n, a) { const l = ["validate"]; return n.type === "form-group" && l.push("dataPicking"), this.expressionProperty.getExpressionConfig(n, "Field", l); } getPropertyConfig(n, a, l = "Card") { var C; const i = (C = n.binding) != null && C.field ? [] : ["Const", "Variable", "StateMachine"]; this.readonlyEditor = this.getPropertyEditorParams(n, i, "readonly"), this.visibleEditor = this.getPropertyEditorParams(n, i, "visible"), this.requiredEditor = this.getPropertyEditorParams(n, i, "required"), this.freeInputEditor = this.getPropertyEditorParams(n, ["Const", "Variable"], "allowFreeInput"), this.readonlyEditor.propertyTypes.push("Custom"), this.visibleEditor.propertyTypes.push("Custom"), this.requiredEditor.propertyTypes.push("Custom"); const o = this.getBasicProperties(n, a, l), c = this.getBehaviorConfig(n, l), s = this.getAppearanceProperties(n, a), r = this.getLookupConfig(n), d = this.getEventPropConfig(n), u = this.getDialogPropertyConfig(n), p = this.getPageConfig(n.editor), S = this.getTreePropConfig(n.editor), m = this.getSearchConfig(n), w = this.getExpandProperties(n, l), x = this.getNavigatorConfig(n), f = this.getExpressionConfig(n, "Field"), v = { basic: o, appearance: s, behavior: c, expandConfig: w, lookup: r, navigatiorConfig: x, treeConfig: S, dialog: u, pager: p, searchConfig: m, expressions: f }; return n.type === "form-group" && (v.eventsEditor = d), { type: "object", categories: v }; } getGridFieldEdtiorPropConfig(n) { return this.getPropertyConfig(n, null, "Grid").categories; } flattenTreeNodes(n) { return n.reduce((a, l) => { var i; return a.push(l), (i = l.children) != null && i.length && a.push(...this.flattenTreeNodes(l.children)), a; }, []); } isSimpleStringField() { var c; const n = ((c = this.designViewModelField) == null ? void 0 : c.path) || ""; if (!n || !n.includes(".")) return !0; const a = n.split("."), l = this.designViewModelUtils.getAllFields2TreeByVMId(this.viewModelId); if (!(l != null && l.length)) return !1; const i = l.find((s) => s.data.code === a[0]); if (!i) return !1; const o = [i, ...this.flattenTreeNodes(i.children)]; return !a.reduce( (s, r, d) => [...s, d ? `${s[d - 1]}.${r}` : r], [] ).some( (s) => { var r, d, u; return ((u = (d = (r = o.find((p) => p.data.path === s)) == null ? void 0 : r.data) == null ? void 0 : d.type) == null ? void 0 : u.$type) === "EntityType"; } ); } getBehaviorConfig(n, a = "Card") { const l = a === "Card" ? this.getTipsConfig(n) : {}; return { description: "Basic Infomation", title: "行为", properties: { visible: { description: "运行时组件是否可见", title: "是否可见", type: "boolean", editor: this.visibleEditor }, ...l }, setPropertyRelates: (i, o) => { this.afterMutilEditorChanged(o, i); } }; } // 绑定字段更新后,处理lookup 的相关属性 changeBindingField(n, a) { super.changeBindingField(n, a), n.editor.multiSelect = !1; } getDisplayType(n) { return n.displayType ? n.displayType.toUpperCase() : ""; } mapFieldsDisplayFormatter(n) { return n && n.length ? n.map((a) => `${a.name}[${a.bindingPath}]`).join(",") : ""; } getSearchConfig(n) { const a = () => { var i; return n.editor.openType !== "Popup" && (((i = n.editor) == null ? void 0 : i.enableSearchBar) ?? !0) !== !1 && (this.getDisplayType(n.editor) !== "TREELIST" || n.editor.treeToList === !0) && !n.editor.enableMultiFieldSearch; }; return { description: "Lookup Search Infomation", title: "搜索", parentPropertyID: "editor", properties: { enableSearchBar: { $converter: se, description: "是否启用搜索栏", refreshPanelAfterChanged: !0, title: "启用搜索栏", type: "boolean", visible: !1 }, enableMultiFieldSearch: { $converter: se, refreshPanelAfterChanged: !0, description: "是否启用多字段搜索", title: "启用多字段查询", type: "boolean", visible: !1 }, searchAnyField: { description: "显示所有列", $converter: se, title: "允许查询所有列", type: "boolean", visible: n.editor.openType !== "Popup" && n.editor.enableSearchBar == null ? !n.editor.enableMultiFieldSearch : !!n.editor.enableSearchBar }, enableEqualSearch: { $converter: se, description: "是否启用等于搜索", title: "启用精确搜索", type: "boolean", visible: a() } }, hide: n.editor.openType === "Popup" }; } getNavigatorConfig(n) { var l; const a = n.editor; return { description: "自定义左侧导航数据格式化、样式", title: "导航栏", properties: { showNavigation: { description: "显示导航栏", $converter: se, refreshPanelAfterChanged: !0, title: "显示导航栏", type: "boolean", visible: this.getDisplayType(a).includes("NAV") && a.openType !== "Popup" }, navigatorWidth: { description: "导航栏宽度,最小200px, 最大为窗口宽度减去200px", title: "导航栏宽度", type: "number", visible: this.showNavigatiorWidth(a) && a.openType !== "Popup", editor: { ...this.numberEditor, min: 200, max: (((l = a == null ? void 0 : a.dialog) == null ? void 0 : l.width) ?? 960) - 200, needValid: !0 }, $converter: Be }, selectFirstNavItem: { $converter: se, description: "是否默认选中首条导航数据,开启后,打开弹窗后,会自动选中导航第1条数据", title: "默认选中首条导航数据", type: "boolean", visible: this.showNavigatiorWidth(a) && a.openType !== "Popup" }, customNavFormatter: { description: "自定义左侧导航数据格式化、样式", title: "左侧导航格式化", type: "string", $converter: se, editor: { type: "code-editor", language: "javascript", leftTemplate: Ut }, visible: this.showNavigatiorWidth(a) && a.openType !== "Popup" } }, hide: !this.getDisplayType(a).startsWith("NAV") || a.openType === "Popup" }; } getLookupConfig(n) { var r, d; const a = n.editor, l = () => { const u = this.formSchemaUtils.getFormSchema().module.entity[0].id, p = this.formSchemaUtils.getFormMetadataBasicInfo(); return { propertyData: a, formBasicInfo: p, viewModelId: u, dataSourceId: a.helpId }; }, { dataSourceEditor: i, idFieldEditor: o, textFieldEditor: c, mappingFieldsEditor: s } = Ya(a, this); return { description: "Basic Infomation", title: "编辑器", setPropertyRelates: (u, p) => { if (u) switch (u.propertyID) { case "readonly": case "required": this.afterMutilEditorChanged(p, u); 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, visible: !!((r = n.binding) != null && r.field) && ((d = n.binding) == null ? void 0 : d.type) === "Form" }, placeholder: { description: "当控件没有值时在输入框中显示的文本", title: "提示文本", type: "string", $converter: se }, enableClear: { description: "是否显示清除按钮", title: "启用清除按钮", type: "boolean", $converter: se }, enableTitle: { description: "鼠标悬停显示文本内容", title: "悬停提示", type: "boolean", $converter: se, editor: this.comboListEditor }, editable: { description: "", title: "允许编辑", type: "boolean", $converter: se, refreshPanelAfterChanged: !0, editor: this.comboListEditor, visible: !(a.multiSelect && a.openType === "Popup") }, allowFreeInput: { description: "", title: "任意输入", type: "boolean", $converter: se, editor: this.freeInputEditor, visible: !!a.editable && this.isSimpleStringField() }, dataSource: { description: "数据源", title: "数据源", type: "string", refreshPanelAfterChanged: !0, editor: { ...i, displayFormatter: (u) => u && u.length ? u.map((p) => `${p.name}(${p.code})`).join(",") : "", validateFunction: async (u) => this.formSchemaUtils.designerMode !== "PC_RTC" ? !0 : this.checkSameBESource(u, n), onSubmitModal: (u) => { if (u) { delete a.mappingFields; const p = this.formSchemaUtils.getFormMetadataBasicInfo(); return this.metadataService.getPickMetadata(p.relativePath, u[0].data).then((S) => JSON.parse(S == null ? void 0 : S.metadata.content)); } } }, $converter: vn }, filterConditions: { descriptions: "帮助过滤条件", title: "过滤条件", type: "string", $converter: se, editor: { type: "filter-condition-editor", editable: !1, displayText: "点击配置", enableClear: !1, enableExpression: !0, editorParams: { propertyData: a, formBasicInfo: this.formSchemaUtils.getFormMetadataBasicInfo(), viewModelId: this.formSchemaUtils.getFormSchema().module.entity[0].id }, idField: "path", repositoryToken: ut, beforeOpen: async ({ repository: u, notifyService: p }) => { var v; if (!(a == null ? void 0 : a.helpId)) return p == null || p.warning({ message: "请先配置数据源!" }), !1; const m = l(), x = new Jn(this.formSchemaUtils).getEntitiesAndVariables(); let f = {}; if (u) { const C = await u.getData(m), g = await u.getLookupConditions(m); f = { fieldList: C, conditionList: g }; } return (v = x.variables) != null && v.forms && (x.variables.forms.items = x.variables.forms.items.filter((C) => C.category === "remote")), { ...f, ...x, isServerSide: !0 }; }, onSubmitModal: async ({ loadingService: u, repository: p, conditions: S, originalConditions: m, FMessageBoxService: w }) => { if (p) try { const x = l(), f = await p.getLookupConditions(x) || []; return JSON.stringify(f) !== JSON.stringify(m.value) ? (u == null || u.clearAll(), w.question("视图对象中的帮助过滤条件已更改,请点击确定同步过滤数据", "", () => { S.value = f, m.value = JSON.parse(JSON.stringify(S.value)); }, () => { }), !1) : (JSON.stringify(S.value) === JSON.stringify(m.value) || await p.saveFilterCondition(S.value, x, this.formSchemaUtils.getFormMetadataBasicInfo()), !0); } catch { return w == null || w.error("保存失败", ""), !1; } finally { u == null || u.clearAll(); } } }, visible: !!a.helpId }, displayType: { description: "类型: 树列表、列表、双列表、左树右列表", title: "展示类型", type: "string", $converter: _a, 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: { ...o }, $converter: Ua }, textField: { description: "显示文本字段", title: "文本字段", type: "string", $converter: ja, editor: c }, mappingFields: { description: "字段映射", title: "字段映射", type: "string", $converter: se, editor: { ...s } }, textAlign: { description: "文本对齐方式", title: "文本对齐方式", type: "string", $converter: se, editor: { type: "combo-list", editable: !1, data: [ { text: "左对齐", value: "left" }, { text: "居中对齐", value: "center" }, { text: "右对齐", value: "right" } ], textField: "text", idField: "value", valueField: "value" } }, customFormatter: { description: "自定义数据格式化、样式", title: "格式化", type: "string", $converter: se, editor: { type: "code-editor", language: "javascript", leftTemplate: Ut } }, enableToSelect: { description: "数据加载后是否选中现有值", $converter: se, title: "选中已选值", type: "boolean", editor: this.comboListEditor }, multiSelect: { description: "启用多选", $converter: se, title: "启用多选", type: "boolean", editor: this.comboListEditor, refreshPanelAfterChanged: !0, visible: this.isSimpleStringField() }, showSelections: { description: "显示已选记录", $converter: se, title: "显示已选记录", type: "boolean", visible: !!a.multiSelect && a.openType !== "Popup" }, separator: { description: "多选分隔符", $converter: se, 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: !!a.multiSelect }, enableSearchBar: { description: "显示搜索工具条", $converter: se, refreshPanelAfterChanged: !0, title: "启用搜索框", type: "boolean", visible: !1 }, enableFavorite: { description: "启用收藏夹", $converter: se, title: "启用收藏夹", type: "boolean", visible: a.openType !== "Popup" }, enableUserData: { description: "保存界面状态", $converter: se, refreshPanelAfterChanged: !0, title: "保存界面状态", type: "boolean", visible: a.openType !== "Popup" } } }; } showNavigatiorWidth(n) { return this.getDisplayType(n).startsWith("NAV") && n.openType !== "Popup" ? n.showNavigation === void 0 ? !0 : !!n.showNavigation : !1; } getDialogPropertyConfig(n) { const a = Xa(n.editor); return a.openType.$converter = se, { description: "帮助窗口尺寸配置", title: "帮助窗口", parentPropertyID: "dialog", $converter: Be, properties: a }; } showPagerProperty(n, a) { const l = this.getDisplayType(n) !== "TREELIST" || n.treeToList; return a && l ? n.pagination && n.pagination[a] : l; } /** * 获取页配置 * @param editorOptions * @returns */ getPageConfig(n) { return Za(n); } showLoadType(n) { const a = this.getDisplayType(n); return (a === "TREELIST" || a === "NAVTREELIST") && !n.treeToList && !n.navTreeToList; } isTree(n) { return this.getDisplayType(n) === "TREELIST" && !n.treeToList; } getTreePropConfig(n) { return { hide: this.getDisplayType(n) !== "TREELIST" && this.getDisplayType(n) !== "NAVTREELIST", description: "树形数据配置", title: "树形数据配置", parentPropertyID: "editor", properties: { treeToList: { description: "以列表的形式展示树结构数据", $converter: se, refreshPanelAfterChanged: !0, title: "以列表形式展示", type: "boolean", visible: this.getDisplayType(n) === "TREELIST" }, navTreeToList: { description: "以列表的形式展示树结构数据", $converter: se, refreshPanelAfterChanged: !0, title: "以列表形式展示", type: "boolean", visible: this.getDisplayType(n) === "NAVTREELIST" }, loadTreeDataType: { description: "树形数据加载方式", $converter: se, title: "数据加载方式", type: "string", editor: { ...this.comboListEditor, data: [ { value: "default", text: "默认" }, { value: "all", text: "全部加载" }, { value: "async", text: "分层加载" } ], textField: "text", valueField: "value" }, visible: this.showLoadType(n) }, enableFullTree: { description: "启用构造完整树", $converter: se, title: "构造完整树", type: "boolean", visible: this.showLoadType(n) }, onlySelectLeaf: { description: "仅选择叶子节点", $converter: se, title: "仅选择叶子节点", type: "boolean", visible: this.isTree(n) }, enableCascade: { description: "启用级联选择", $converter: se, refreshPanelAfterChanged: !0, title: "启用级联选择", type: "boolean", visible: this.isTree(n) && !!n.multiSelect && n.openType !== "Popup" }, showCascadeControl: { descript