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