@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,619 lines • 100 kB
JavaScript
var Ke = Object.defineProperty;
var Ye = (e, a, t) => a in e ? Ke(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
var se = (e, a, t) => Ye(e, typeof a != "symbol" ? a + "" : a, t);
import { defineComponent as ie, ref as P, inject as j, onMounted as ue, createVNode as F, watch as U, reactive as ne, toRaw as Ze, computed as H, onUnmounted as Ie, isVNode as et, Fragment as tt, withDirectives as Me, createTextVNode as oe, resolveDirective as at, vModelCheckbox as nt, provide as ce, mergeProps as it } from "vue";
import ot from "../../designer/button-edit/index.esm.js";
import { useDesignerComponent as lt } from "../designer-canvas/index.esm.js";
import { resolveAppearance as st, createPropsResolver as rt } from "../dynamic-resolver/index.esm.js";
import { InputBaseProperty as ut, ExpressionProperty as De } from "../property-panel/index.esm.js";
import { FieldSelectorRepositoryToken as he } from "../field-selector/index.esm.js";
import { F_MODAL_SERVICE_TOKEN as dt } from "../modal/index.esm.js";
import { FButtonEdit as Be } from "../button-edit/index.esm.js";
import { FLayout as ct, FLayoutPane as Oe } from "../layout/index.esm.js";
import { FDataGrid as be } from "../data-grid/index.esm.js";
import { flatten as ft, isNaN as pt, cloneDeep as Ve, throttle as ht, isEmpty as Ce } from "lodash-es";
import { resolveField as ge, encrypt as gt } from "../common/index.esm.js";
import { F_NOTIFY_SERVICE_TOKEN as ze } from "../notify/index.esm.js";
import { FTreeGrid as we } from "../tree-grid/index.esm.js";
import { FComboList as Ae } from "../combo-list/index.esm.js";
import vt from "../popover/index.esm.js";
function Ne(e) {
return typeof e == "string" && e.startsWith("{") && e.endsWith("}") ? (e = e.replace(/'/g, '"'), { mappingFields: JSON.parse(e) }) : { mappingFields: e };
}
const mt = /* @__PURE__ */ new Map([
["appearance", st],
["mappingFields", (e, a, t) => {
if (a)
return Ne(a);
const { mappingFields: n } = t;
return Ne(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 };
}]
]), bt = "https://json-schema.org/draft/2020-12/schema", yt = "https://farris-design.gitee.io/lookup.schema.json", St = "lookup", Ct = "A Farris Input Component", Ft = "object", Tt = {
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: "all"
},
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: !1
},
cascadeItems: {
type: "object",
default: {
both: !0,
up: !0,
down: !0,
disable: !0
}
},
cascadeStatus: {
type: "string",
default: "both"
},
expandLevel: {
type: "number",
default: 0
},
enableClear: {
type: "boolean",
default: !0
},
enableTitle: {
type: "boolean",
default: !1
}
}, Lt = [
"type"
], It = [
"id",
"appearance",
"binding",
"visible"
], wt = {
dictPicking: "帮助前事件",
dictPicked: "帮助后事件",
beforeSelectData: "数据选择确认前事件",
beforeLoadData: "数据加载前事件",
clear: "清空事件"
}, kt = {
$schema: bt,
$id: yt,
title: St,
description: Ct,
type: Ft,
properties: Tt,
required: Lt,
ignore: It,
events: wt
};
function Pt(e, a, t) {
return a;
}
const Re = [
{ value: "both", text: "同步选择" },
{ value: "up", text: "包含上级" },
{ value: "down", text: "包含下级" },
{ value: "disable", text: "仅选择自身" }
], Ue = "";
var ee = /* @__PURE__ */ ((e) => (e.List = "LIST", e.Tree = "TREELIST", e.ListList = "NAVLIST", e.TreeList = "NAVTREELIST", e.ListTree = "NAVLISTTREE", e))(ee || {}), ke = /* @__PURE__ */ ((e) => (e.all = "all", e.async = "async", e))(ke || {});
const fe = "__lookup_active_tab__", Da = "__lookup_user_data_id__";
var Q = /* @__PURE__ */ ((e) => (e.dataList = "datalist", e.favorite = "favorite", e))(Q || {});
const xt = Symbol("f_lookup-http-service_token");
var _e = /* @__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))(_e || {}), Te = /* @__PURE__ */ ((e) => (e[e.Empty = 0] = "Empty", e[e.And = 1] = "And", e[e.Or = 2] = "Or", e))(Te || {}), Et = /* @__PURE__ */ ((e) => (e[e.Value = 0] = "Value", e[e.Expression = 1] = "Expression", e.FrontExpress = "frontExpress", e))(Et || {});
const Dt = {
showCloseButton: !0,
showMaxButton: !0,
draggable: !0,
resizeable: !0,
enableEsc: !0,
rememberSize: !0
};
function Ot() {
function e(a, t) {
const n = {};
return n.dictPicking = (o) => t.call("dictPicking", [o, a]), n.beforeLoadData = (o) => t.call("beforeLoadData", [o, a]), n.beforeSelectData = (o) => t.call("beforeSelectData", [o, a]), n.dictPicked = (o) => t.call("dictPicked", [o, a]), n;
}
return {
resolve: e
};
}
const ye = {
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: ee.List },
dialog: {
type: Object,
default: {
title: ""
}
},
multiSelect: { type: Boolean, default: !1 },
showSelections: { type: Boolean, default: !0 },
separator: { type: String, default: "," },
pagination: { type: Object, default: {
enable: !1,
showLimits: !0,
sizeLimits: [10, 20, 30, 50, 100],
size: 20,
index: 1,
total: 0,
mode: "server",
showGoto: !1
} },
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: ke.all },
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: !1 },
cascadeItems: { type: Object, default: {
both: !0,
up: !0,
down: !0,
disable: !0
} },
cascadeStatus: { type: String, default: "both" },
/** 0: 不展开; -1: 全部展开;>0: 展开到指定级数 */
expandLevel: { type: Number, default: 0 },
enableTitle: { type: Boolean, default: !1 }
}, $e = rt(ye, kt, mt, Pt), Nt = Ot();
function ve(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 J = {
convertFrom: (e, a) => a === "multiSelect" || a === "enableTitle" ? !!e.editor[a] : a === "separator" ? e.editor[a] || "," : a === "onlySelectLeaf" ? e.editor[a] == null ? !1 : e.editor[a] : a === "loadTreeDataType" ? e.editor[a] || "all" : e.editor[a],
convertTo: (e, a, t) => {
e.editor[a] = t;
}
};
function Mt(e) {
let a = "form_group_" + Date.now();
return e && (a = e.replaceAll("-", "_").replaceAll(".", "_")), "lookup." + a;
}
function Bt(e, a) {
const { enablePager: t, pageSize: n, pageList: o } = a;
e.pagination = e.pagination || {}, Object.assign(e.pagination, {
enable: t,
sizeLimits: ve(o).map((s) => s.value),
size: n,
showLimits: !0,
showGoto: !1,
mode: "server"
});
}
const Vt = {
convertFrom: (e, a) => {
var t;
return (t = e.editor[a]) == null ? void 0 : t.displayName;
},
convertTo: (e, a, t) => {
if (t && t.length > 0) {
const n = t[0], { name: o, id: s, metadataContent: i, code: d } = n;
e.editor.dataSource || (e.editor.dataSource = {}), e.editor.dataSource.displayName = `${o}(${d})`, e.editor.helpId = s;
const { displayType: l, idField: m, textField: v } = i;
e.editor.displayType = l, e.editor.dataSource.idField = m, e.editor.textField = v, e.editor.dataSource.type = "ViewObject";
const { pageInfo: g, treeInfo: x } = i.dataSource;
if (Bt(e.editor, g), x) {
const { onlySelectLeaf: T, loadDataType: r } = x;
e.editor.loadTreeDataType = r || "all", e.editor.onlySelectLeaf = T ?? !1;
}
e.editor.dataSource.uri || (e.editor.dataSource.uri = Mt(e.id));
}
}
}, zt = {
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;
}
}
}, At = {
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;
}
}
}, Rt = {
convertFrom: (e, a) => e.editor.displayType ? e.editor.displayType.toUpperCase() : "LIST",
convertTo: (e, a, t) => {
e.editor.displayType = t;
}
}, ae = {
convertFrom: (e, a) => {
var o;
const t = e.editor.dialog || {};
if (a === "title")
return t[a] || Ue;
if (a === "width")
return (o = e.editor.displayType) != null && o.toUpperCase().startsWith("NAV") ? t[a] || 960 : t[a] || 590;
if (a === "height")
return t[a] || 620;
if (a === "navigatorWidth")
return t[a] || 320;
if (a === "draggable")
return !0;
if (["showMaxButton", "showCloseButton", "resizeable", "enableEsc", "rememberSize"].includes(a))
return t[a] == null ? !0 : t[a];
},
convertTo: (e, a, t) => {
e.editor.dialog = e.editor.dialog || {}, e.editor.dialog[a] = t;
}
}, Fe = {
convertFrom: (e, a) => {
const t = e.editor.pagination || {};
if (a === "enable" || a === "showLimits")
return t[a] == null ? !1 : t[a];
if (a === "sizeLimits") {
const n = t[a];
return ve(n);
}
if (a === "size")
return t[a] || 20;
},
convertTo: (e, a, t) => {
var n, o;
if (e.editor.pagination = e.editor.pagination || {}, a === "sizeLimits") {
const s = t.map((d) => d.value);
e.editor.pagination[a] = s;
const i = ((o = (n = e.editor) == null ? void 0 : n.pagination) == null ? void 0 : o.size) ?? 20;
s.includes(i) || (e.editor.pagination.size = s[0]);
return;
}
e.editor.pagination[a] = t;
}
}, Ut = [
{
label: "clear",
name: "清空事件"
},
{
label: "dictPicking",
name: "帮助前事件"
},
{
label: "beforeLoadData",
name: "数据加载前事件"
},
{
label: "beforeSelectData",
name: "选择数据确认前事件"
},
{
label: "dictPicked",
name: "帮助后事件"
}
], _t = Symbol("schema_repository_token");
class $t extends ut {
constructor() {
super(...arguments);
se(this, "comboListEditor", {
type: "combo-list",
enableClear: !1,
editable: !1
});
se(this, "numberEditor", {
type: "number-spinner",
useThousands: !1
});
se(this, "readonlyEditor", { ...this.comboListEditor, editable: !0 });
se(this, "visibleEditor", { ...this.comboListEditor, editable: !1 });
se(this, "requiredEditor", { ...this.comboListEditor, editable: !1 });
se(this, "freeInputEditor", { ...this.comboListEditor, editable: !1 });
}
getExpressionConfig(t, n) {
const o = ["validate"];
return t.type === "form-group" && o.push("dataPicking"), new De(this.formSchemaUtils).getExpressionConfig(t, "Field", o);
}
getPropertyConfig(t, n) {
this.readonlyEditor = this.getPropertyEditorParams(t, [], "readonly"), this.visibleEditor = this.getPropertyEditorParams(t, [], "visible"), this.requiredEditor = this.getPropertyEditorParams(t, ["Const", "Variable", "StateMachine", "Expression"], "required"), this.freeInputEditor = this.getPropertyEditorParams(t, ["Const", "Variable"], "allowFreeInput");
const o = this.getBasicProperties(t, n), s = this.getBehaviorConfig(t), i = this.getAppearanceProperties(t, n), d = this.getLookupConfig(t), l = this.getEventPropConfig(t), m = this.getDialogPropertyConfig(t), v = this.getPageConfig(t.editor), g = this.getTreePropConfig(t.editor), x = this.getExpressionConfig(t, "Field"), T = {
basic: o,
appearance: i,
behavior: s,
lookup: d,
treeConfig: g,
dialog: m,
pager: v,
expressons: x
};
return t.type === "form-group" && (T.eventsEditor = l), {
type: "object",
categories: T
};
}
getGridFieldEdtiorPropConfig(t) {
return this.getPropertyConfig(t, null).categories;
}
flattenTreeNodes(t) {
return t.reduce((n, o) => {
var s;
return n.push(o), (s = o.children) != null && s.length && n.push(...this.flattenTreeNodes(o.children)), n;
}, []);
}
isSimpleStringField() {
var d;
const t = ((d = this.designViewModelField) == null ? void 0 : d.path) || "";
if (!t || !t.includes("."))
return !0;
const n = t.split("."), o = this.designViewModelUtils.getAllFields2TreeByVMId(this.viewModelId);
if (!(o != null && o.length))
return !1;
const s = o.find((l) => l.data.code === n[0]);
if (!s)
return !1;
const i = [s, ...this.flattenTreeNodes(s.children)];
return !n.reduce(
(l, m, v) => [...l, v ? `${l[v - 1]}.${m}` : m],
[]
).some(
(l) => {
var m, v, g;
return ((g = (v = (m = i.find((x) => x.data.path === l)) == null ? void 0 : m.data) == null ? void 0 : v.type) == null ? void 0 : g.$type) === "EntityType";
}
);
}
getBehaviorConfig(t) {
return {
description: "Basic Infomation",
title: "行为",
properties: {
visible: {
description: "运行时组件是否可见",
title: "是否可见",
type: "boolean",
editor: this.visibleEditor
}
},
setPropertyRelates: (n, o) => {
this.afterMutilEditorChanged(o, n);
}
};
}
// 绑定字段更新后,处理lookup 的相关属性
changeBindingField(t, n) {
super.changeBindingField(t, n), t.editor.multiSelect = !1;
}
getDisplayType(t) {
return t.displayType ? t.displayType.toUpperCase() : "";
}
getLookupConfig(t) {
const n = t.editor, o = () => {
const s = this.formSchemaUtils.getFormSchema().module.entity[0].id, i = this.formSchemaUtils.getFormMetadataBasicInfo();
return { propertyData: n, formBasicInfo: i, viewModelId: s, dataSourceId: n.helpId };
};
return {
description: "Basic Infomation",
title: "编辑器",
setPropertyRelates: (s, i) => {
if (s)
switch (s.propertyID) {
case "readonly":
case "required":
this.afterMutilEditorChanged(i, s);
break;
}
},
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: J
},
enableTitle: {
description: "鼠标悬停显示文本内容",
title: "悬停提示",
type: "boolean",
$converter: J,
editor: this.comboListEditor
},
editable: {
description: "",
title: "允许编辑",
type: "boolean",
$converter: J,
refreshPanelAfterChanged: !0,
editor: this.comboListEditor
},
allowFreeInput: {
description: "",
title: "任意输入",
type: "boolean",
$converter: J,
editor: this.freeInputEditor,
visible: !1
// !!editorOptions.editable
},
enableClear: {
title: "启用清除按钮",
type: "boolean",
$converter: J
},
dataSource: {
description: "数据源",
title: "数据源",
type: "string",
refreshPanelAfterChanged: !0,
editor: {
type: "schema-selector",
title: "选择数据源",
editorParams: {
propertyData: n,
formBasicInfo: this.formSchemaUtils.getFormMetadataBasicInfo()
},
displayFormatter: (s) => s && s.length ? s.map((i) => `${i.name}(${i.code})`).join(",") : "",
viewOptions: [
{
id: "recommend",
title: "推荐",
type: "List",
dataSource: "Recommand",
enableGroup: !0,
groupField: "category",
groupFormatter: (s, i) => `${s === "local" ? "本地元数据" : "最近使用"}`
},
{ id: "total", title: "全部", type: "List", dataSource: "Total" }
],
repositoryToken: _t,
onSubmitModal: (s) => {
if (s) {
delete n.mappingFields;
const i = this.formSchemaUtils.getFormMetadataBasicInfo();
return this.metadataService.getPickMetadata(i.relativePath, s[0].data).then((d) => JSON.parse(d == null ? void 0 : d.metadata.content));
}
}
},
$converter: Vt
},
filterConditions: {
descriptions: "帮助过滤条件",
title: "过滤条件",
type: "string",
$converter: J,
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: he,
beforeOpen: async ({ repository: s, notifyService: i }) => {
var x;
if (!(n == null ? void 0 : n.helpId))
return i == null || i.warning({ message: "请先配置数据源!" }), !1;
const l = o(), v = new De(this.formSchemaUtils).getEntitiesAndVariables();
let g = {};
if (s) {
const T = await s.getData(l), r = await s.getLookupConditions(l);
g = { fieldList: T, conditionList: r };
}
return (x = v.variables) != null && x.forms && (v.variables.forms.items = v.variables.forms.items.filter((T) => T.category === "remote")), { ...g, ...v };
},
onSubmitModal: async ({ loadingService: s, repository: i, conditions: d, originalConditions: l, FMessageBoxService: m }) => {
if (i)
try {
const v = o(), g = await i.getLookupConditions(v) || [];
return JSON.stringify(g) !== JSON.stringify(l.value) ? (s == null || s.clearAll(), m.question("视图对象中的帮助过滤条件已更改,请点击确定同步过滤数据", "", () => {
d.value = g, l.value = JSON.parse(JSON.stringify(d.value));
}, () => {
}), !1) : (JSON.stringify(d.value) === JSON.stringify(l.value) || await i.saveFilterCondition(d.value, v), !0);
} catch {
return m == null || m.error("保存失败", ""), !1;
} finally {
s == null || s.clearAll();
}
}
},
visible: !!n.helpId
},
displayType: {
description: "类型: 树列表、列表、双列表、左树右列表",
title: "展示类型",
type: "string",
$converter: Rt,
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: {
type: "field-selector",
textField: "bindingPath",
idField: "bindingPath",
editorParams: {
propertyData: n,
formBasicInfo: this.formSchemaUtils.getFormMetadataBasicInfo()
},
columns: [
{ field: "name", title: "名称" },
{ field: "code", title: "编号" },
{ field: "bindingPath", title: "绑定字段" }
],
repositoryToken: he
},
$converter: zt,
visible: !1
},
textField: {
description: "显示文本字段",
title: "文本字段",
type: "string",
$converter: At,
editor: {
type: "field-selector",
textField: "bindingPath",
idField: "bindingPath",
editorParams: {
propertyData: n,
formBasicInfo: this.formSchemaUtils.getFormMetadataBasicInfo()
},
columns: [
{ field: "name", title: "名称" },
{ field: "code", title: "编号" },
{ field: "bindingPath", title: "绑定字段" }
],
repositoryToken: he
}
},
mappingFields: {
description: "字段映射",
title: "字段映射",
type: "string",
$converter: J,
editor: {
type: "mapping-editor",
modalWidth: 800,
modalHeight: 600,
editable: !1,
editorParams: {
propertyData: n,
formBasicInfo: this.formSchemaUtils.getFormMetadataBasicInfo()
},
fromData: {
editable: !1,
formatter: (s, i) => `${i.raw.name} [${i.raw.bindingPath}]`,
idField: "bindingPath",
textField: "bindingPath",
valueField: "bindingPath",
repositoryToken: he
},
toData: {
idField: "bindingPath",
textField: "bindingPath",
valueField: "bindingPath",
dataSource: () => this.designViewModelUtils.getAllFields2TreeByVMId(this.viewModelId),
formatter: (s, i) => `${i.raw.name} [${i.raw.bindingPath}]`
}
}
},
enableToSelect: {
description: "数据加载后是否选中现有值",
$converter: J,
title: "选中已选值",
type: "boolean",
editor: this.comboListEditor
},
multiSelect: {
description: "启用多选",
$converter: J,
title: "启用多选",
type: "boolean",
editor: this.comboListEditor,
refreshPanelAfterChanged: !0,
visible: this.isSimpleStringField()
},
showSelections: {
description: "显示已选记录",
$converter: J,
title: "显示已选记录",
type: "boolean",
visible: !!n.multiSelect
},
separator: {
description: "多选分隔符",
$converter: J,
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: J,
refreshPanelAfterChanged: !0,
title: "启用搜索框",
type: "boolean",
visible: !1
},
searchAnyField: {
description: "显示所有列",
$converter: J,
title: "允许查询所有列",
type: "boolean",
visible: n.enableSearchBar == null ? !0 : !!n.enableSearchBar
},
enableFavorite: {
description: "启用收藏夹",
$converter: J,
title: "启用收藏夹",
type: "boolean"
},
enableUserData: {
description: "保存界面状态",
$converter: J,
refreshPanelAfterChanged: !0,
title: "保存界面状态",
type: "boolean",
visible: !0
}
}
};
}
showNavigatiorWidth(t) {
return this.getDisplayType(t).startsWith("NAV") ? t.showNavigation === void 0 ? !0 : !!t.showNavigation : !1;
}
getDialogPropertyConfig(t) {
var n, o, s, i;
return {
description: "帮助窗口尺寸配置",
title: "帮助窗口",
properties: {
title: {
description: "帮助标题",
title: "帮助标题",
type: "string",
$converter: ae
},
width: {
description: "窗口宽度,最小值:300px",
title: "宽度",
type: "number",
refreshPanelAfterChanged: !0,
$converter: ae,
editor: {
...this.numberEditor,
min: this.showNavigatiorWidth(t.editor) ? 520 : 300
}
},
height: {
description: "窗口高度,最小值:200px",
title: "高度",
type: "number",
$converter: ae,
editor: {
...this.numberEditor,
min: 200
}
},
showNavigation: {
description: "显示导航栏",
$converter: J,
refreshPanelAfterChanged: !0,
title: "显示导航栏",
type: "boolean",
visible: this.getDisplayType(t.editor).includes("NAV")
},
navigatorWidth: {
description: "导航栏宽度,最小200px, 最大为窗口宽度减去200px",
title: "导航栏宽度",
type: "number",
$converter: ae,
visible: this.showNavigatiorWidth(t.editor),
editor: {
...this.numberEditor,
min: 200,
max: (((o = (n = t.editor) == null ? void 0 : n.dialog) == null ? void 0 : o.width) ?? 960) - 200
}
},
resizeable: {
description: "允许鼠标拖拽窗口边缘调整尺寸",
title: "允许调整窗口尺寸",
type: "boolean",
$converter: ae,
refreshPanelAfterChanged: !0
},
rememberSize: {
description: "记录窗口尺寸",
title: "记录窗口尺寸",
type: "boolean",
$converter: ae,
visible: !!t.editor.enableUserData && (((i = (s = t.editor) == null ? void 0 : s.dialog) == null ? void 0 : i.resizeable) ?? !0)
},
enableEsc: {
description: "允许ESC关闭",
title: "允许ESC关闭",
type: "boolean",
$converter: ae
},
showMaxButton: {
description: "显示最大化按钮",
title: "显示最大化按钮",
type: "boolean",
$converter: ae
},
showCloseButton: {
description: "显示关闭按钮",
title: "显示关闭按钮",
type: "boolean",
$converter: ae
}
}
};
}
showPagerProperty(t, n) {
const o = this.getDisplayType(t) !== "TREELIST" || t.treeToList;
return n && o ? t.pagination && t.pagination[n] : o;
}
getPageConfig(t) {
var o, s, i, d;
const n = !((o = t.pagination) != null && o.enable);
return {
hide: this.getDisplayType(t) === "TREELIST" || !t.helpId || n,
description: "分页配置",
title: "分页",
properties: {
// enable: {
// description: "启用分页",
// title: "启用分页",
// type: "boolean",
// refreshPanelAfterChanged: true,
// $converter: lookupPaginationConverter
// },
showLimits: {
description: "显示每页条数选择器",
title: "显示条数选择器",
type: "boolean",
refreshPanelAfterChanged: !0,
$converter: Fe,
visible: this.showPagerProperty(t)
},
sizeLimits: {
description: "每页可显示条数",
title: "每页显示条数",
type: "array",
$converter: Fe,
refreshPanelAfterChanged: !0,
visible: this.showPagerProperty(t, "showLimits"),
editor: {
columns: [
{
field: "value",
title: "显示条数",
dataType: "number",
editor: {
...this.numberEditor,
min: 10,
max: 1e4
}
}
],
title: "每页显示条数编辑器",
modalWidth: 400,
modalHeight: 500,
type: "item-collection-editor",
valueField: "value",
nameField: "value",
requiredFields: ["value"],
uniqueFields: ["value"],
modelValue: ve((s = t.pagination) == null ? void 0 : s.sizeLimits),
beforeSubmit: ({ notifyService: l, data: m }) => !m || !m.length ? (l == null || l.warning({ message: "每页显示条数不能为空!" }), !1) : new Set(m.map((g) => parseInt(g.value, 10))).size === m.length ? !0 : (l == null || l.warning({ message: "每页显示条数不能重复!" }), !1)
}
},
size: {
description: "默认显示条数",
title: "默认显示条数",
type: "number",
visible: this.showPagerProperty(t),
$converter: Fe,
editor: {
...this.comboListEditor,
data: ve((i = t.pagination) == null ? void 0 : i.sizeLimits),
textField: "value",
idField: "value",
valueField: "value",
modelValue: (d = t.pagination) == null ? void 0 : d.size
}
}
}
};
}
showLoadType(t) {
const n = this.getDisplayType(t);
return (n === "TREELIST" || n === "NAVTREELIST") && !t.treeToList && !t.navTreeToList;
}
showOnlySelectLeaf(t) {
return this.getDisplayType(t) === "TREELIST" && !t.treeToList;
}
getTreePropConfig(t) {
return {
hide: this.getDisplayType(t) !== "TREELIST" && this.getDisplayType(t) !== "NAVTREELIST",
description: "树形数据配置",
title: "树形数据配置",
properties: {
treeToList: {
description: "以列表的形式展示树结构数据",
$converter: J,
refreshPanelAfterChanged: !0,
title: "以列表形式展示",
type: "boolean",
visible: this.getDisplayType(t) === "TREELIST"
},
navTreeToList: {
description: "以列表的形式展示树结构数据",
$converter: J,
refreshPanelAfterChanged: !0,
title: "以列表形式展示",
type: "boolean",
visible: this.getDisplayType(t) === "NAVTREELIST"
},
loadTreeDataType: {
description: "树形数据加载方式",
$converter: J,
title: "数据加载方式",
type: "string",
editor: {
...this.comboListEditor,
data: [
{ value: "all", text: "全部加载" },
{ value: "async", text: "分层加载" }
],
textField: "text",
valueField: "value"
},
visible: !1
// this.showLoadType(editorOptions)
},
enableFullTree: {
description: "启用构造完整树",
$converter: J,
title: "构造完整树",
type: "boolean",
visible: this.showLoadType(t)
},
onlySelectLeaf: {
description: "仅选择叶子节点",
$converter: J,
title: "仅选择叶子节点",
type: "boolean",
visible: this.showOnlySelectLeaf(t)
},
enableCascade: {
description: "启用级联选择",
$converter: J,
refreshPanelAfterChanged: !0,
title: "启用级联选择",
type: "boolean",
visible: !1
// this.showOnlySelectLeaf(editorOptions) && !!editorOptions.multiSelect
},
showCascadeControl: {
description: "显示级联选择控件",
$converter: J,
title: "显示级联选择控件",
type: "boolean",
visible: !1
// !!editorOptions.enableCascade && this.showOnlySelectLeaf(editorOptions)
},
cascadeStatus: {
description: "级联选择默认状态",
$converter: J,
title: "级联状态",
type: "string",
visible: !1,
// !!editorOptions.enableCascade && this.showOnlySelectLeaf(editorOptions),
editor: {
...this.comboListEditor,
data: Re,
textField: "text",
valueField: "value"
}
},
expandLevel: {
description: "默认展开层级: 0: 不展开; -1: 全部展开;>0: 展开到指定级数 ",
$converter: J,
title: "默认展开层级",
type: "number",
visible: this.showLoadType(t),
editor: {
...this.numberEditor,
min: -1,
max: 99
}
}
}
};
}
getEventPropConfig(t) {
const n = this, o = Ut, s = n.eventsEditorUtils.formProperties(t, n.viewModelId, o), i = {};
return i[n.viewModelId] = {
type: "events-editor",
editor: {
initialData: s
}
}, {
title: "事件",
hideTitle: !0,
properties: i,
// 这个属性,标记当属性变更得时候触发重新更新属性
refreshPanelAfterChanged: !0,
tabId: "commands",
tabName: "交互",
setPropertyRelates(d, l) {
const m = d.propertyValue;
delete l[n.viewModelId], m && n.eventsEditorUtils.saveRelatedParameters(l, n.viewModelId, m.events, m);
const v = n.designViewModelUtils.getDgViewModel(n.viewModelId);
v && n.designViewModelField && v.changeField(n.designViewModelField.id, { valueChanging: l.fieldValueChanging, valueChanged: l.fieldValueChanged });
}
};
}
}
function jt(e, a) {
function t(n, o) {
const s = e.schema;
return new $t(n, a).getPropertyConfig(s, o);
}
return { getPropsConfig: t };
}
const qt = /* @__PURE__ */ ie({
name: "FLookupDesign",
props: ye,
emits: [],
setup(e, a) {
const t = P(), n = j("design-item-context"), o = j("designer-host-service"), s = jt(n, o), i = lt(t, n, s);
return ue(() => {
t.value.componentInstance = i;
}), a.expose(i.value), () => F("div", {
class: "f-lookup-design",
ref: t
}, [F(ot, {
ref: t,
readonly: !0,
editable: !1,
placeholder: e.placeholder
}, null)]);
}
});
function de(e, a) {
const { lookupOptions: t } = a, n = {
enable: !0,
sizeLimits: [10, 20, 30, 50, 100],
size: 20,
index: 1,
total: 0,
mode: "server"
};
function o(r) {
return { ...n, ...r };
}
function s() {
return {
enableSelectRow: !0,
multiSelect: t.multiSelect,
showCheckbox: t.multiSelect,
multiSelectMode: "OnCheckAndClick"
};
}
function i() {
return {
fitColumns: e.fitColumns,
fitMode: "percentage",
resizeColumn: !0
};
}
function d() {
const { displayType: r } = a.lookupOptions;
return typeof r == "string" && r in ee ? !1 : r.toLowerCase().startsWith("nav");
}
function l() {
const { displayType: r, treeToList: h } = a.lookupOptions;
return (r.toLowerCase() === ee.Tree.toLowerCase() || r.toLowerCase() === ee.ListTree.toLowerCase()) && !h;
}
function m() {
const { displayType: r, navTreeToList: h } = a.lookupOptions;
return r.toLowerCase() === ee.TreeList.toLowerCase() && !h;
}
function v() {
const { displayType: r, navTreeToList: h } = a.lookupOptions, y = r.toLowerCase();
return y === ee.ListList.toLowerCase() || y === ee.ListTree.toLowerCase() || h;
}
function g() {
var y;
return t.dialog ? {
width: ((y = t.dialog) == null ? void 0 : y.navigatorWidth) || 320,
minWidth: 200
} : {
width: 320,
minWidth: 200
};
}
function x(r) {
const { loadTreeDataType: h } = t;
return h === ke.all || h === "default" && (r == null ? void 0 : r.loadDataType) === "all";
}
function T(r) {
return (r == null ? void 0 : r.layerType) === "pathcode";
}
return {
checkPaination: o,
checkMultiSelect: s,
checkColumnOptions: i,
isDoubleList: d,
getNavigationSize: g,
isTreeList: l,
navIsTreeList: m,
navIsList: v,
isLoadAll: x,
isPathCodeTree: T
};
}
function je(e, a, t) {
var s;
const n = P(e.searchFields || []), o = P(((s = e.navigation) == null ? void 0 : s.searchFields) || []);
return U(() => a == null ? void 0 : a.searchFields, (i) => {
n.value = i;
}), U(() => t == null ? void 0 : t.searchFields, (i) => {
o.value = i;
}), {
searchFieldItems: n,
navSearchFieldItems: o
};
}
function Wt(e) {
const a = ne({}), t = ne({}), n = ne({}), o = ne({}), s = ne({}), i = P([]), d = P(), l = ne({}), m = [
"displayType",
"treeToList",
"navTreeToList",
"showSelections",
"showNavigation",
"multiSelect",
"mappingFields",
"loader",
"idField",
"textField",
"userDataKey",
"dialog",
"expandLevel",
"treeInfo",
"navTreeInfo",
"onlySelectLeaf",
"loadTreeDataType"
];
function v() {
m.forEach((g) => {
l[g] = e[g];
});
}
return v(), {
pageInfoState: a,
lookupState: t,
navigationState: n,
queryState: o,
searchState: s,
selectionState: i,
unSelectDataId: d,
lookupOptions: l
};
}
const Le = P(), le = "F_LOOKUP_HTTP_COMPOSITION_TOKEN";
function Gt(e, a) {
const t = j("FLoadingService"), n = j(xt), o = Wt(e), { pageInfoState: s, lookupState: i, navigationState: d, lookupOptions: l } = o, { searchFieldItems: m, navSearchFieldItems: v } = je(e, i, d), g = P(e.uri), x = P(e.idValue), T = P(!1), r = () => {
var C;
const u = (C = l.displayType) == null ? void 0 : C.toUpperCase();
return u === ee.Tree || u === ee.TreeList;
}, h = (u, C = !1) => {
if (u) {
const {
layerType: f,
dataField: k,
parentField: N,
pathField: p,
layerField: b,
isDetailField: D,
loadDataType: S
} = u, B = {
layerType: f,
dataField: k,
parentField: N,
pathField: p,
layerField: b,
isDetailField: D,
loadDataType: S
}, { onlySelectLeaf: _, loadTreeDataType: Y } = l;
B.onlySelectLeaf = _, B.loadDataType = Y, C ? l.navTreeInfo = Object.assign(l.navTreeInfo || {}, B) : l.treeInfo = Object.assign(l.treeInfo || {}, B);
}
};
function y(u, C) {
if (C == null || !C.trim())
return [];
const f = Array.from(new Set(C.trim().split(" ").filter((p) => p.trim())));
if (!u || !f.length)
return [];
const k = (u || []).map((p, b) => {
const D = f.map((S, B) => ({
filterField: p.value,
value: S,
lbracket: "",
rbracket: "",
relation: Te.And,
compare: _e.Like
}));
return D.length && (D.length > 1 && (D[0].lbracket = "(", D[D.length - 1].rbracket = ")"), D[D.length - 1].relation = Te.Or), D;
}).filter((p) => p.length);
let N = [];
return k && k.length && (N = ft(k), N.length > 1 && (N[0].lbracket += "(", N[N.length - 1].rbracket += ")"), N[N.length - 1].relation = 0), N;
}
function V() {
let { expandLevel: u } = l;
return u && !pt(u) && (u = u < -1 ? -1 : u), u;
}
function M(u, C) {
const f = {};
f.category = C;
let k = null, N = null;
if (u != null && u.search) {
const { field: p, value: b, isNavigation: D, type: S } = u.search, B = S || "like";
if (b && (f.searchValue = b.trim()), f.searchField = p ? p.trim() : "*", f.searchType = B, D && (f.category = "navsearch"), !e.enableMultiFieldSearch && f.searchField === "*") {
const _ = D ? v.value : m.value, Y = y(_, b);
Y && Y.length && (D ? k = Y : N = Y), b === "" && f.category === "search" && !N && !k && (f.category = "all");
}
}
return r() && (f.layerNum = V()), {
searchParam: f,
navSearchConditions: k,
searchConditions: N
};
}
function z(u) {
var f, k;
if (u === "fav")
return {
pageIndex: 1,
pageSize: 500
};
let C = "default";
return u === "navsearch" && (C = "navigation"), {
pageIndex: ((f = s[C]) == null ? void 0 : f.index) || 1,
pageSize: ((k = s[C]) == null ? void 0 : k.size) || 20
};
}
function I(u) {
const C = {}, f = (u == null ? void 0 : u.action) || "all", { searchParam: k, navSearchConditions: N, searchConditions: p } = M(u, f);
p && (C.searchConditions = p), N && (C.navSearchConditions = N), C.enableFullTree = e.enableFullTree, C.searchValue = JSON.stringify(k);
const { pageIndex: b, pageSize: D } = z(f);
return C.pageIndex = b, C.pageSize = D, C.treeToList = e.treeToList, C.navTreeToList = e.navTreeToList, C.loadTreeDataType = l.loadTreeDataType, u != null && u.relationFilter && (C.relationFilter = [...u.relationFilter]), u != null && u.navNodePathCode && (C.navPathCode = u.navNodePathCode), u.selectedInfo && (C.selectedInfo = u.selectedInfo), C.customData = Ze(Le.value), C;
}
function R(u) {
return u == null ? void 0 : u.map((C) => (C.resizable = !0, C));
}
function c(u, C) {
return u.map((f) => {
const k = C == null ? void 0 : C.find((N) => N.field.toLowerCase() === f.value.toLowerCase());
return k && (f.label = k.title), f;
});
}
function L(u) {
u.columns && (u.columns = R(u.columns), u.searchFields && (u.searchFields = c(u.searchFields, u.columns))), u.navigation && u.navigation.columns && (u.navigation.columns = R(u.navigation.columns), u.navigation.searchFields && (u.navigation.searchFields = c(u.navigation.searchFields, u.navigation.columns)));
}
function $() {
return l.loader || n && n.getData.bind(n);
}
function W(u) {
const C = $();
return g.value && C ? C(g.value, u).then((f) => (L(f), f)) : new Promise((f, k) => {
f({
columns: [...e.columns],
items: [...e.data],
searchFields: [...e.searchFields],
navigation: { ...e.navigation }
});
});
}
function q(u) {
const C = V();
return C === -1 ? !0 : C === 0 ? !1 : u <= C;
}
function E(u, C = !1, f = "layer") {
u.forEach((k) => {
var N;
k.collapse = C ? !1 : l.loadTreeDataType === "all" ? !q(ge(k.data, f)) : !(k.expanded ?? !0), (N = k.children) != null && N.length && E(k.children, C, f);
});
}
async function w(u, C) {
var N;
const f = I(u), k = t == null ? void 0 : t.show();
try {
let p = await W(f);
if (r()) {
const { items: b, treeInfo: D } = p.navigation || p;
if (b != null && b.length && D) {
const { dataField: S, layerField: B } = D;
E(b, !1, `${S}.${B}`);
}
}
e.beforeLoadData && (p = await e.beforeLoadData({ data: p })), C(p);
} finally {
(N = k == null ? void 0 : k.value) == null || N.close();
}
}
function G(u) {
T.value = u;
}
function A(u, C) {
const { dataField: f, pathField: k } = C;
return k ? f ? u[f][k] : ge(u, k) : "";
}
function O(u) {
const C = [];
return (u.selectable || u.selectable === void 0) && C.push(u), u.children && u.children.length && u.children.forEach((f) => {
C.push(...O(f));
}), C;
}
function X(u, C = !1) {
var p;
if (!(u != null && u.length))
return u;
const f = C ? (p = l.navigation) == null ? void 0 : p.treeInfo : l.treeInfo, { dataField: k, layerField: N } = f || {};
return k && N && E(u, !0, `${k}.${N}`), u;
}
function K() {
try {
const u = x.value;
return u !== "" && u != null ? u : "";
} catch (u) {
return console.error("Error in getIdValues:", u), "";
}
}
function Z() {
let u = K() || [];
return Array.isArray(u) || (u = ("" + u).split(e.separator)), { selectedIds: u, selected: !0 };
}
return {
includeChilds: T,
updateIncludeChilds: G,
idValues: x,
getData: W,
loadData: w,
updateSearchFieldTitle: c,
getPathCode: A,
getChildNodes: O,
lookupStates: o,
httpService: n,
lookupRequest: $,
expandAllNodes: X,
getIdQueryParams: Z,
setTreeInfo: h,
getFieldValue: ge
};
}
function qe(e, a) {
U(() => e.pagination, (n) => {
a.default = n;
}), U(() => {
var n;
return (n = e.navigation) == null ? void 0 : n.pagination;
}, (n) => {
a.navigation = n;
});
function t(n, o = !1) {
n && (o ? a.navigation = { ...a.navigation, ...n } : a.default = { ...a.default, ...n });
}
return {
updatePageInfo: t
};
}
const Pe = "F_LOOKUP_USER_DATA_SERVICE";
function Ht(e, a) {
const t = j("FLoadingService", null), { lookupStates: n, lookupRequest: o, httpService: s } = a, { lookup