UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

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