@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
795 lines (794 loc) • 27.4 kB
JavaScript
var ue = Object.defineProperty;
var fe = (e, t, a) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
var q = (e, t, a) => fe(e, typeof t != "symbol" ? t + "" : t, a);
import { defineComponent as K, ref as b, computed as N, watch as me, createVNode as u, Fragment as oe, reactive as pe, createApp as ge, onUnmounted as ye, onMounted as se, Transition as he, mergeProps as be, onBeforeMount as ve, createTextVNode as U } from "vue";
import Fe from "../button-edit/index.esm.js";
import Se from "../tree-grid/index.esm.js";
import Te from "../radio-group/index.esm.js";
import { FormSchemaEntityField$Type as re, FormSchemaEntityFieldTypeName as J } from "../common/index.esm.js";
import { createPropsResolver as we } from "../dynamic-resolver/index.esm.js";
import { LocaleService as Q } from "../locale/index.esm.js";
import { FormBindingType as W, SchemaDOMMapping as Ce } from "../property-panel/index.esm.js";
import { merge as ie } from "lodash-es";
import { FNotifyService as xe } from "../notify/index.esm.js";
const Pe = "https://json-schema.org/draft/2020-12/schema", Ne = "https://farris-design.gitee.io/binding-selector.schema.json", Ve = "binding-selector", Be = "字段绑定选择器", Ie = "object", Oe = {
disabled: {
description: "",
type: "boolean",
default: !1
},
readonly: {
description: "",
type: "boolean",
default: !1
},
bindingType: {
description: "",
type: "object",
default: {}
},
idField: {
description: "",
type: "string",
default: "id"
},
title: {
description: "",
type: "string",
default: "字段选择器"
},
modalWidth: {
description: "",
type: "number",
default: 800
},
modalHeight: {
description: "",
type: "number",
default: 600
},
separator: {
description: "",
type: "string",
default: ","
},
bindingData: {
description: "",
type: "array",
default: []
},
textField: {
description: "",
type: "string",
default: "code"
},
editorParams: {
description: "",
type: "object",
default: {}
}
}, Me = {
$schema: Pe,
$id: Ne,
title: Ve,
description: Be,
type: Ie,
properties: Oe
}, ae = [
{ field: "name", title: "名称" },
{ field: "bindingField", title: "绑定字段" },
{ field: "fieldType", title: "字段类型" }
], le = [
{ field: "name", title: "名称" },
{ field: "code", title: "编号" },
{ field: "displayTypeName", title: "变量类型" }
], Ee = [
{ value: "Form", text: "绑定字段" },
{ value: "LocaleVariable", text: "绑定组件变量" },
{ value: "RemoteVariable", text: "绑定表单变量" }
], D = {
disabled: { type: Boolean, default: !1 },
readonly: { type: Boolean, default: !1 },
modelValue: { type: Object, default: null },
bindingType: {
type: Object,
default: {
enable: !0,
value: "Form",
textField: "text",
valueField: "value"
}
},
data: { type: Array, default: [] },
idField: { type: String, default: "id" },
title: { type: String, default: "字段选择器" },
modalWidth: { type: Number, default: 800 },
modalHeight: { type: Number, default: 600 },
multiSelect: { type: Boolean, default: !1 },
/**
* 可选,分隔符
* 默认`,`
*/
separator: { type: String, default: "," },
bindingData: { type: Array, default: [] },
textField: { type: String, default: "code" },
beforeOpenDialog: { type: Function, default: null },
editorParams: { type: Object, default: null },
onFieldSelected: { type: Function, default: null },
/** 是否显示自定义的底部按钮区域 */
showCustomFooter: { type: Boolean, default: !1 }
}, Re = we(D, Me), ke = {
showCloseButton: { type: Boolean, default: !0 },
position: { type: String, default: "top-center" },
timeout: { type: Number, default: 3e3 },
theme: { type: String, default: "bootstrap" },
left: { type: Number },
right: { type: Number },
top: { type: Number },
bottom: { type: Number },
id: { type: String },
animate: { type: String, default: "fadeIn" },
options: { type: Object },
safeHtml: { type: Boolean, default: !0 }
}, Le = {
showCloseButton: { type: Boolean, default: !0 },
animate: { type: String, default: "fadeIn" },
options: { type: Object }
}, X = /* @__PURE__ */ K({
name: "Toast",
props: Le,
emits: ["close", "click"],
setup: (e, t) => {
const a = b(e.animate), l = "fadeOut", i = N(() => e.options), c = b(!1), m = N(() => i.value.title && i.value.message), f = N(() => !i.value.title && i.value.message), T = N(() => {
const y = {
animated: c.value,
toast: !0,
"toast--only-content": !m.value
};
return y[e.animate] = !1, y[l] = c.value, y["toasty-type-" + i.value.type] = !0, i.value.theme && (y[i.value.theme] = !0), y;
}), h = N(() => {
const S = `f-icon-${i.value && i.value.type ? i.value.type.replace("toasty-type-", "") : "default"}`, E = {
"f-icon": !0
};
return E[S] = !0, E;
}), P = N(() => i.value.title || i.value.message), V = N(() => e.showCloseButton), w = N(() => !!i.value.buttons || !!t.slots.default), C = N(() => Q.getLocale() === "en" ? {
wordBreak: "keep-all",
overflowWrap: "break-word"
} : {});
function x(y) {
y.stopPropagation(), y.preventDefault(), c.value = !1, setTimeout(() => {
t.emit("close", i.value);
}, 200);
}
function $(y, I) {
}
function k(y) {
return `f-preten-link ${y.customClass ? y.customClass : ""}`;
}
me(a, () => {
a.value;
});
const R = () => {
var y;
return u(oe, null, [u("div", {
class: "after-toast-msg text-right"
}, [!t.slots.default && ((y = i.value.buttons) == null ? void 0 : y.map((I) => u("span", {
class: k(I),
onClick: (S) => void 0
}, [I.text]))), t.slots.default && t.slots.default()])]);
};
return () => u("div", {
class: T.value,
style: "min-height:44px"
}, [V.value && u("button", {
title: Q.getLocaleValue("messageBox.close"),
class: "toast-close f-btn-icon f-bare",
onClick: x
}, [u("span", {
class: "f-icon modal_close"
}, null)]), P.value && u("section", {
class: "modal-tips"
}, [!m.value && u("div", {
class: "float-left modal-tips-iconwrap"
}, [u("span", {
class: h.value
}, null)]), u("div", {
class: "modal-tips-content"
}, [m.value && u(oe, null, [u("h5", {
class: "toast-title modal-tips-title",
innerHTML: i.value.title
}, null), u("p", {
class: "toast-msg",
innerHTML: i.value.message,
style: C.value
}, null), w.value && R()]), f.value && (i.value.buttons ? u("div", {
class: "toast-title-btns-wrapper d-flex"
}, [u("h5", {
class: "toast-title modal-tips-title only-toast-msg",
style: C.value,
innerHTML: i.value.message
}, null), u("div", {
class: "after-toast-title text-right ml-auto"
}, [R()])]) : u("h5", {
class: "toast-title modal-tips-title only-toast-msg",
style: C.value,
innerHTML: i.value.message
}, null))])])]);
}
}), G = /* @__PURE__ */ K({
name: "Notify",
props: ke,
emits: ["close", "empty"],
setup(e, t) {
const a = N(() => ({
"farris-notify": !0
})), l = {
left: 12,
right: 12,
top: 20,
bottom: 12
}, i = b(), c = b(e.options), m = b(e.showCloseButton), f = N(() => e.position || "bottom-right"), T = N(() => e.timeout != null ? e.timeout : 3e3), h = N(() => {
const w = e.bottom ? e.bottom : l.bottom, C = e.top ? e.top : l.top, x = {
transition: "all 0.2s ease",
left: f.value.indexOf("left") > -1 ? `${e.left ? e.left : l.left}px` : "",
right: f.value.indexOf("right") > -1 ? `${e.right ? e.right : l.right}px` : "",
top: f.value.indexOf("top") > -1 ? `${C}px` : "",
bottom: f.value.indexOf("bottom") > -1 ? `${w}px` : ""
};
return f.value.indexOf("center") > -1 && (x.left = "50%", x.marginLeft = "calc(-24rem / 2)", f.value === "center-center" && (x.top = "50%", x.transform = "translate(-50%, -50%)")), x;
});
function P(w) {
t.emit("close");
}
T.value && setTimeout(() => {
P();
}, T.value), t.expose({
closeToast: P,
container: i,
notifyPosition: f
});
function V(w, C) {
P();
}
return () => u("div", {
class: a.value,
style: h.value,
ref: i
}, [u(X, {
options: c.value,
showCloseButton: m.value,
animate: e.animate,
onClose: (w) => V(w, c.value)
}, null)]);
}
});
class de {
constructor() {
q(this, "notifyRefs", []);
q(this, "globalConfig", pe({}));
}
escapeAllHtml(t) {
if (typeof t != "string" || !t)
return "";
const a = document.createElement("div");
return a.textContent = t || "", a.innerHTML.replace(/\\n/g, "<br>").replace(/\\t/g, " ").replace(/\\r/g, "");
}
createNotifyInstance(t) {
const a = this, i = Object.assign({
timeout: 3e3,
position: "bottom-right",
showCloseButton: !0,
safeHtml: !0
}, this.globalConfig, {
...t
}), c = document.createElement("div");
c.style.display = "contents";
const m = ge({
setup() {
var h;
const f = b();
function T() {
f.value.container.style.transform = "scale(0)", setTimeout(() => {
a.updateNotifyPositionForClose(i, f), m.unmount();
}, 220);
}
if (i.position.indexOf("top") > -1) {
const P = a.getNotifyInstances(i.position), V = P[P.length - 1];
if (V) {
const w = V.value.container.getBoundingClientRect();
i.top = w.bottom;
}
}
return i.safeHtml && ((h = i.options) != null && h.message) && (i.options.message = a.escapeAllHtml(i.options.message)), ye(() => {
document.body.removeChild(c);
}), se(() => {
a.updateNotifyPositionForCreate(i, f);
}), () => u(he, {
mode: "out-in",
name: "fade",
appear: !0
}, {
default: () => [u(G, be({
ref: f
}, i, {
onClose: T
}), null)]
});
}
});
return m.provide("NotifyService", this), document.body.appendChild(c), m.use(Q.i18n), m.mount(c), m;
}
getNotifyInstances(t) {
return this.notifyRefs.filter((a) => a.value.notifyPosition === t);
}
updateNotifyPositionForCreate(t, a) {
if (this.notifyRefs && this.notifyRefs.length) {
const l = window.innerHeight;
t.position.indexOf("bottom") > -1 && this.getNotifyInstances(t.position).forEach((i) => {
const c = i.value.container.getBoundingClientRect();
i.value.container.style.bottom = c.height + l - c.bottom + "px";
});
}
this.notifyRefs = [...this.notifyRefs, a];
}
updateNotifyPositionForClose(t, a) {
const l = this.notifyRefs.indexOf(a);
if (t.position.indexOf("top") > -1) {
const i = this.getNotifyInstances(t.position), c = i.indexOf(a);
i.slice(c + 1).forEach((m) => {
m.value.container.style.top = m.value.container.offsetTop - m.value.container.offsetHeight + "px";
});
}
l > -1 && this.notifyRefs.splice(l, 1);
}
show(t) {
return this.createNotifyInstance(t);
}
buildNotifyProps(t, a) {
let l = "", i = "", c, m, f;
typeof a == "string" ? l = a : a && (l = a.message || "", i = a.title || "", m = a.position || null, f = a.showCloseButton != null ? a.showCloseButton : null, c = a.timeout != null ? a.timeout : null);
const h = {
options: {
type: t,
message: l,
title: i
}
};
return m != null && (h.position = m), f != null && (h.showCloseButton = f), c != null && (h.timeout = c), h;
}
info(t) {
const a = this.buildNotifyProps("info", t);
return this.show(a);
}
success(t) {
const a = this.buildNotifyProps("success", t);
return this.show(a);
}
warning(t) {
const a = this.buildNotifyProps("warning", t);
return this.show(a);
}
error(t) {
const a = this.buildNotifyProps("error", t);
return this.show(a);
}
close(t) {
t && t.unmount();
}
closeAll() {
this.notifyRefs.forEach((t) => {
t == null || t.value.closeToast();
}), this.notifyRefs.length = 0;
}
}
const $e = Symbol("NOTIFY_SERVICE_TOKEN");
G.install = (e) => {
e.component(G.name, G), e.component(X.name, X);
const t = new de();
e.provide($e, t), e.provide("FNotifyService", t);
};
function ce(e) {
const { designViewModelUtils: t, schemaService: a, formSchemaUtils: l, designerContext: i } = e.editorParams.designerHostService, { viewModelId: c } = e.editorParams;
let m = [], f = [], T = [];
const h = new de();
h.globalConfig = { position: "top-center" };
function P(o) {
switch (o) {
case "LocaleVariable":
return f;
case "RemoteVariable":
return T;
default:
return m;
}
}
function V() {
m = t.getAllFields2TreeByVMId(c);
}
function w() {
const o = l.getViewModelById(c);
if (o.parent) {
const r = l.getLocaleVariablesByViewModelId(o.parent);
r && r.length && (r[0].data.name = "根组件", f = f.concat(r));
}
const s = l.getLocaleVariablesByViewModelId(c);
f = f.concat(s);
}
function C() {
T = l.getRemoteVariables();
}
function x(o) {
var d, g, v, F;
const s = ie({}, o.rawData, { groupId: null, groupName: null }), r = (d = e.editorParams.componentSchema) == null ? void 0 : d.binding, p = (g = e.editorParams.componentSchema) == null ? void 0 : g.label, n = t.getDgViewModel(c);
if (r != null && r.field) {
const O = n.fields.find((M) => M.id === r.field);
if (n.removeField([r.field]), O) {
const { groupId: M, groupName: L, editor: B } = O;
ie(s, { editor: B, groupId: M, groupName: L });
}
}
n.addField(s), (F = (v = e.editorParams.componentSchema) == null ? void 0 : v.editor) != null && F.type && n.changeField(s.id, { editor: s.editor }), p && n.changeField(s.id, { name: p });
}
function $(o) {
var n;
const s = (n = e.editorParams.componentSchema) == null ? void 0 : n.binding, r = t.getDgViewModel(c), p = {
type: "Variable",
id: o.id,
fieldName: o.code,
groupId: "",
groupName: ""
};
if (s != null && s.field) {
const d = l.getViewModelById(c), g = d == null ? void 0 : d.fields.find((v) => v.id === (s == null ? void 0 : s.field));
g && (p.groupName = g.groupName, p.groupId = g.groupId), r.removeField([s == null ? void 0 : s.field]);
}
l.addViewModelField(c, p);
}
function k(o, s) {
if (!e.editorParams.needSyncToViewModel || !e.editorParams.viewModelId || !e.editorParams.designerHostService)
return;
const r = e.editorParams.componentSchema.binding;
r && r.field === o.id || (s === "Form" ? x(o) : $(o));
}
function R(o) {
if (!e.editorParams.needSyncToViewModel || !e.editorParams.viewModelId || !e.editorParams.designerHostService)
return;
const s = e.editorParams.componentSchema.binding;
if (!(!s || s.field === o.id) && l.getExpressions().length) {
const { componentSchema: r } = e.editorParams, p = l.getExpressions().findIndex((n) => n.target === s.field);
p > -1 && (l.getExpressions().splice(p, 1), h.warning("切换绑定后,请重新配置表达式"), Object.keys(r).forEach((n) => {
r[n] && r[n].type === "Expression" && (r[n].expressionId = ""), r.editor && Object.keys(r.editor).forEach((d) => {
r.editor[d] && r.editor[d].type === "Expression" && (r.editor[d].expressionId = "");
});
}));
}
}
function y(o) {
var r;
[J.Number, J.String, J.Text].includes(o.type.name) && ((r = o.type) == null ? void 0 : r.length) && e.editorParams.componentSchema.editor && !Object.prototype.hasOwnProperty.call(e.editorParams.componentSchema.editor, "maxLength") && (e.editorParams.componentSchema.editor.maxLength = o.type.length);
}
function I(o, s) {
if (e.editorParams.componentSchema) {
switch (e.editorParams.componentSchema.binding || (e.editorParams.componentSchema.binding = {}), s) {
case "Form": {
e.editorParams.componentSchema.binding.path = o.bindingField, e.editorParams.componentSchema.binding.field = o.id, e.editorParams.componentSchema.binding.fullPath = o.path;
break;
}
case "LocaleVariable": {
e.editorParams.componentSchema.binding.path = o.viewModelId === c ? o.code : "root-component." + o.code, e.editorParams.componentSchema.binding.field = o.id, e.editorParams.componentSchema.binding.fullPath = o.code;
break;
}
case "RemoteVariable": {
e.editorParams.componentSchema.binding.path = "root-component." + o.code, e.editorParams.componentSchema.binding.field = o.id, e.editorParams.componentSchema.binding.fullPath = o.code;
break;
}
}
return e.editorParams.componentSchema.binding.type = s, e.editorParams.componentSchema.path = o.bindingPath, y(o), e.editorParams.componentSchema.binding;
}
}
function S(o) {
const s = o == null ? void 0 : o.field, r = /* @__PURE__ */ new Set(), p = l.getFormSchema().module, n = l.getViewModelById(c), d = p.components.find((F) => F.viewModel === c), g = l.checkComponentExistInDrawer(d.id);
let v = d.componentType;
return (v === "frame" || v === "table") && (v = "form"), p.viewmodels.forEach((F) => {
if (!F.fields || F.fields.length === 0)
return;
const O = p.components.find((B) => B.viewModel === F.id);
let { componentType: M } = O;
if ((M === "frame" || M === "table") && (M = "form"), M !== v || F.bindTo !== n.bindTo)
return;
const L = l.checkComponentExistInDrawer(O.id);
g && L && F.fields.forEach((B) => {
B.id !== s && r.add(B.id);
}), !g && !L && F.fields.forEach((B) => {
B.id !== s && r.add(B.id);
});
}), r;
}
function E(o) {
if (!o)
return [];
const s = {}, r = i && i.schemaDOMMapping ? i.schemaDOMMapping : Ce, { fieldControlTypeMapping: p } = r;
for (const n in p) {
const d = p[n];
!d || !d.length || d.forEach((g) => {
s[g.key] = s[g.key] || [], s[g.key].push(n);
});
}
return s["language-textbox"] = ["multiLanguage"], s[o];
}
function Y() {
V(), w(), C();
}
function j(o, s) {
if (o.multiLanguage)
return { fieldType: "multiLanguage", fieldTypeName: "多语言" };
const r = s === W.Form ? o.type.name : o.type, p = s === W.Form ? o.type.displayName : o.displayTypeName;
return { fieldType: r, fieldTypeName: p };
}
function A() {
var n;
const o = (n = e.editorParams) == null ? void 0 : n.componentSchema, s = o == null ? void 0 : o.binding;
if (!s)
return { originalFieldType: "", isOriginalBindComplexField: !1 };
let r, p = !1;
if (s.type === W.Form) {
const d = a.getFieldByID(s.field);
d && (r = j(d, W.Form).fieldType, d.$type === re.ComplexField && (p = !0));
} else {
const d = l.getVariableById(s.field);
d && (r = d.type);
}
return { originalFieldType: r, isOriginalBindComplexField: p };
}
function z(o, s) {
var B, ee, te, ne;
if (!(o != null && o.length))
return h.warning({ message: "请先选择数据" }), !1;
const r = (B = e.editorParams) == null ? void 0 : B.componentSchema;
if (!(r == null ? void 0 : r.binding))
return !0;
let n = !0;
const { originalFieldType: d, isOriginalBindComplexField: g } = A(), v = o[0], { fieldType: F, fieldTypeName: O } = j(v, s), M = "不可以切换成", L = "类型字段,请重新选择!";
if (g || !d) {
const _ = E((ne = (te = (ee = e.editorParams) == null ? void 0 : ee.componentSchema) == null ? void 0 : te.editor) == null ? void 0 : ne.type);
return _ != null && _.length && !_.includes(F) && (h.warning(`${M}${O}${L}`), n = !1), n;
}
return d && d !== F ? e.editorParams.canChangeFieldType ? !0 : (h.warning(`${M}${O}${L}`), !1) : n;
}
return {
initTreeData: Y,
getTreeDataSource: P,
updateViewModel: k,
updateComponentSchema: I,
resolveOccupiedFields: S,
resolveFieldTypesByEditorType: E,
checkFieldValiation: z,
clearExpresssionConfig: R,
getOriginalFieldType: A
};
}
const Z = /* @__PURE__ */ K({
name: "FBindingSelectorContainer",
props: D,
emits: ["selected", "bindingTypeChange", "cancel", "submit", "skip"],
setup(e, t) {
var s, r, p;
const a = b(e.data), l = b(((s = e.modelValue) == null ? void 0 : s.type) || "Form"), i = b(e.bindingData), c = b(), m = b(), f = b(), {
getTreeDataSource: T,
initTreeData: h,
resolveOccupiedFields: P,
resolveFieldTypesByEditorType: V,
getOriginalFieldType: w
} = ce(e), C = b([]), {
originalFieldType: x,
isOriginalBindComplexField: $
} = w();
ve(() => {
var n, d, g, v, F, O;
h(), a.value = T(l.value), (n = e.editorParams) != null && n.disableOccupiedFields && (m.value = P((g = (d = e.editorParams) == null ? void 0 : d.componentSchema) == null ? void 0 : g.binding)), f.value = V((O = (F = (v = e.editorParams) == null ? void 0 : v.componentSchema) == null ? void 0 : F.editor) == null ? void 0 : O.type), C.value = l.value === "Form" ? ae : le;
}), se(() => {
var d, g, v;
const n = (v = (g = (d = e.editorParams) == null ? void 0 : d.componentSchema) == null ? void 0 : g.binding) == null ? void 0 : v.field;
n && c.value.selectRowById(n);
});
const k = {
"f-utils-fill": !0,
"m-2": (r = e.bindingType) == null ? void 0 : r.enable,
"mx-2": !((p = e.bindingType) != null && p.enable),
border: !0
};
function R(n) {
C.value = n === "Form" ? ae : le, c.value.updateColumns(C.value), a.value = T(n), c.value.updateDataSource(a.value), c.value.clearSelection(), i.value = [], t.emit("selected", []), t.emit("bindingTypeChange", n);
}
function y(n) {
i.value = n, t.emit("selected", n);
}
function I() {
return u("div", {
class: "px-3"
}, [u(Te, {
name: "bindingType",
textField: e.bindingType.textField || "text",
valueField: e.bindingType.valueField || "value",
data: Ee,
modelValue: l.value,
"onUpdate:modelValue": (n) => l.value = n,
onChangeValue: R
}, null)]);
}
function S(n) {
var d;
return n.raw.multiLanguage ? "multiLanguage" : l.value === "Form" ? (d = n.raw.type) == null ? void 0 : d.name : n.raw.type;
}
const E = {
customRowStatus: (n) => {
var g;
if (n.raw.$type && n.raw.$type !== re.SimpleField || m.value && m.value.has(n.raw.id))
return n.disabled = !0, n;
const d = S(n);
if ($ || !x) {
if (d && ((g = f.value) != null && g.length) && !f.value.includes(d))
return n.disabled = !0, n;
} else if (x && x !== d)
return n.disabled = !0, n;
return n.disabled = !1, n;
}
};
function Y() {
return u(Se, {
ref: c,
fit: !0,
data: a.value,
idField: e.idField,
columns: C.value,
rowNumber: {
enable: !1
},
columnOption: {
fitColumns: !0
},
onSelectionChange: y,
"row-option": E
}, null);
}
function j() {
t.emit("cancel");
}
function A() {
if (!i.value || !i.value.length) {
const n = new xe();
return n.globalConfig = {
position: "top-center"
}, n.warning({
message: "请先选择数据"
}), !1;
}
return !0;
}
function z() {
A() && t.emit("submit", {
selectedData: i.value[0],
bindingType: l.value
});
}
function o() {
t.emit("skip");
}
return () => u("div", {
class: "h-100 d-flex flex-column"
}, [e.bindingType.enable && I(), u("div", {
class: k,
style: "position:relative;border-radius:10px;"
}, [U(" "), Y()]), e.showCustomFooter ? u("div", {
class: "modal-footer"
}, [u("button", {
type: "button",
class: "btn btn-secondary",
onClick: j
}, [U("取消")]), u("button", {
type: "button",
class: "btn btn-secondary",
onClick: o
}, [U("跳过绑定")]), u("button", {
type: "button",
class: "btn btn-primary",
onClick: z
}, [U("确定")])]) : ""]);
}
}), H = /* @__PURE__ */ K({
name: "FBindingSelector",
props: D,
emits: ["selected", "bindingTypeChanged"],
setup(e, t) {
var y, I;
const a = '<i class="f-icon f-icon-lookup"></i>', l = b(e.bindingData), i = b(e.data), c = b(), m = b(((y = e.modelValue) == null ? void 0 : y.type) || "Form"), f = b((I = e.modelValue) == null ? void 0 : I.path), {
updateViewModel: T,
updateComponentSchema: h,
checkFieldValiation: P,
clearExpresssionConfig: V
} = ce(e);
function w(S) {
l.value = S;
}
function C(S) {
m.value = S;
}
function x(S) {
f.value = S.path;
}
function $() {
return u(Z, {
ref: c,
data: i.value,
onSelected: w,
modelValue: e.modelValue,
idField: e.idField,
bindingData: l.value,
onBindingTypeChange: C,
editorParams: e.editorParams,
bindingType: e.bindingType,
showCustomFooter: !1
}, null);
}
function k() {
return !!P(l.value, m.value);
}
const R = {
title: e.title,
fitContent: !1,
height: e.modalHeight,
width: e.modalWidth,
buttons: [{
name: "cancel",
text: "取消",
class: "btn btn-secondary",
handle: (S) => (l.value = [], !0)
}, {
name: "accept",
text: "确定",
class: "btn btn-primary",
handle: (S) => {
if (!k())
return !1;
T(l.value[0], m.value), V(l.value[0]);
const E = h(l.value[0], m.value);
return x(E), e.onFieldSelected && typeof e.onFieldSelected == "function" && e.onFieldSelected(E, void 0, l.value[0]), !0;
}
}],
resizeable: !1,
draggable: !0
};
return () => u(Fe, {
modelValue: f.value,
"onUpdate:modelValue": (S) => f.value = S,
editable: !1,
disabled: e.disabled,
readonly: e.readonly,
inputType: "text",
enableClear: !1,
buttonContent: a,
buttonBehavior: "Modal",
modalOptions: R
}, {
default: () => [u("div", {
class: "h-100 d-flex flex-column"
}, [$()])]
});
}
});
H.install = (e) => {
e.component(H.name, H), e.component(Z.name, Z);
};
H.register = (e, t, a, l) => {
e["binding-selector"] = H, t["binding-selector"] = Re;
};
export {
H as BindingSelector,
Z as FBindingSelectorContainer,
D as bindingSelectorProps,
Ee as bindingTypes,
H as default,
ae as fieldColumns,
Re as propsResolver,
le as variableColumns
};