UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,400 lines 221 kB
var Vn = Object.defineProperty; var qn = (e, t, n) => t in e ? Vn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var He = (e, t, n) => qn(e, typeof t != "symbol" ? t + "" : t, n); import { ref as w, createVNode as y, Fragment as yt, watch as Te, defineComponent as Me, computed as ve, nextTick as Ge, onBeforeMount as dn, onMounted as Qe, onUnmounted as fn, watchEffect as Wn, Teleport as Xn, Transition as Yn, shallowRef as Jn, render as Tt, h as gt, cloneVNode as Gn, createApp as Qn, mergeProps as $t, createTextVNode as Re, reactive as Zn, withDirectives as pn, resolveDirective as Kn, inject as Ue, vModelText as eo, onBeforeUnmount as mn, provide as tt } from "vue"; import { LocaleService as ct } from "../locale/index.esm.js"; import { isMobilePhone as Rt, getMaxZIndex as Ut, useThirdComponent as to } from "../common/index.esm.js"; import "../property-panel/index.esm.js"; import no from "../button/index.esm.js"; import oo from "../field-selector/index.esm.js"; import "../collection-property-editor/index.esm.js/src/use-button-items.designer"; import { isPlainObject as Ht, cloneDeep as vt, debounce as ro } from "lodash-es"; import io from "../accordion/index.esm.js"; import so from "../../designer/avatar/index.esm.js"; import ao from "../../designer/approval-logs/index.esm.js"; import lo from "../../designer/button-edit/index.esm.js"; import uo from "../button-group/index.esm.js"; import co from "../calendar/index.esm.js"; import fo from "../../designer/capsule/index.esm.js"; import Vt from "../../designer/checkbox/index.esm.js"; import qt from "../../designer/checkbox-group/index.esm.js"; import po from "../combo-list/index.esm.js"; import mo from "../combo-tree/index.esm.js"; import vo from "../component/index.esm.js"; import ho from "../color-picker/index.esm.js"; import yo from "../content-container/index.esm.js"; import go from "../table/index.esm.js"; import bo from "../../designer/date-picker/index.esm.js"; import Co from "../../designer/data-grid/index.esm.js"; import wo from "../dropdown/index.esm.js"; import xo from "../../designer/dynamic-form/index.esm.js"; import So from "../events-editor/index.esm.js"; import Po from "../filter-bar/index.esm.js"; import Eo from "../binding-selector/index.esm.js"; import Fo from "../image-cropper/index.esm.js"; import To from "../../designer/input-group/index.esm.js"; import ko from "../layout/index.esm.js"; import Oo from "../list-nav/index.esm.js"; import No from "../../designer/list-view/index.esm.js"; import Ro from "../lookup/index.esm.js"; import Mo from "../mapping-editor/index.esm.js"; import Bo from "../../designer/nav/index.esm.js"; import Ao from "../number-range/index.esm.js"; import Io from "../../designer/number-spinner/index.esm.js"; import Lo from "../order/index.esm.js"; import $o from "../page-header/index.esm.js"; import jo from "../page-footer/index.esm.js"; import zo from "../pagination/index.esm.js"; import Do from "../progress/index.esm.js"; import _o from "../query-solution/index.esm.js"; import Uo from "../../designer/radio-group/index.esm.js"; import Ho from "../../designer/rate/index.esm.js"; import Vo from "../../designer/response-toolbar/index.esm.js"; import qo from "../response-layout/index.esm.js"; import Wo from "../../designer/response-layout-editor/index.esm.js"; import Xo from "../search-box/index.esm.js"; import Yo from "../../designer/section/index.esm.js"; import Jo from "../smoke-detector/index.esm.js"; import Go from "../splitter/index.esm.js"; import Qo from "../step/index.esm.js"; import Zo from "../../designer/switch/index.esm.js"; import Ko from "../../designer/tabs/index.esm.js"; import er from "../../designer/tags/index.esm.js"; import tr from "../text/index.esm.js"; import nr from "../../designer/time-picker/index.esm.js"; import or from "../transfer/index.esm.js"; import rr from "../tree-view/index.esm.js"; import ir from "../uploader/index.esm.js"; import sr from "../verify-detail/index.esm.js"; import ar from "../video/index.esm.js"; import lr from "../../designer/textarea/index.esm.js"; import ur from "../schema-selector/index.esm.js"; import cr from "../../designer/tree-grid/index.esm.js"; import dr from "../event-parameter/index.esm.js"; import fr from "../filter-condition-editor/index.esm.js"; import pr from "../fieldset/index.esm.js"; import mr from "../sort-condition-editor/index.esm.js"; import vr from "../menu-lookup/index.esm.js"; import hr from "../../designer/drawer/index.esm.js"; import yr from "../json-editor/index.esm.js"; import gr from "../property-editor/index.esm.js"; import br from "../expression-editor/index.esm.js"; import Cr from "../code-editor/index.esm.js"; import wr from "../html-template/index.esm.js"; import xr from "../collection-property-editor/index.esm.js"; import Sr from "../../designer/modal/index.esm.js"; import Pr from "../external-container/index.esm.js"; import Er from "../language-textbox/index.esm.js"; import Fr from "../image/index.esm.js"; import Tr from "../comment/index.esm.js"; import kr from "../../designer/wizard/index.esm.js"; import { schemaResolverMap as Or, propertyEffectMap as Nr, propertyConfigSchemaMap as Rr, schemaMap as Mr, createPropsResolver as Br, propertyConfigSchemaMapForDesigner as Ar, propertyEffectMapForDesigner as Ir } from "../dynamic-resolver/index.esm.js"; import Lr from "../tooltip/index.esm.js"; import { DgControl as R } from "../designer-canvas/index.esm.js"; const $r = { /** * 允许点击蒙层关闭对话框 * @default false */ allowClickMaskToClose: { type: Boolean, default: !1 }, /** * 关闭前事件 * @default () => { return true; } */ beforeClose: { type: Function, default: () => !0 }, /** * 自定义样式,类名以空格隔开 * @default '' */ class: { type: String, default: "" }, /** * 自定义蒙层样式,类名以空格隔开 * @default '' */ maskClass: { type: String, default: "" }, /** * 窗口标题 */ title: { type: String, default: "" }, /** * 窗口宽度 * @default 500 */ width: { type: Number, default: 500 }, /** * 窗口高度 * @default 320 */ height: { type: Number, default: 320 }, /** * 底部按钮 */ buttons: { type: Array, default: [] }, /** * 双向绑定属性是否显示窗口 * @default false */ modelValue: { type: Boolean, default: !1 }, /** * 是否模态 * @default true */ mask: { type: Boolean, default: !0 }, /** * 展示头部 * @default true */ showHeader: { type: Boolean, default: !0 }, /** * 展示默认按钮 * @default true */ showButtons: { type: Boolean, default: !0 }, /** * 自适应尺寸 * @default true */ fitContent: { type: Boolean, default: !0 }, /** * 展示右上角关闭弹窗按钮 * @default true */ showCloseButton: { type: Boolean, default: !0 }, /** * 是否在窗口右上角展示浮动关闭按钮 */ showFloatingClose: { type: Boolean, default: !1 }, /** * 展示右上角最大化按钮 * @default false */ showMaxButton: { type: Boolean, default: !1 }, minHeight: { type: Number }, maxHeight: { type: Number }, minWidth: { type: Number }, maxWidth: { type: Number }, containment: { type: Object, default: null }, /** * 可调整窗口尺寸 * @default false */ resizeable: { type: Boolean, default: !1 }, /** * 可拖拽窗口 * @default false */ draggable: { type: Boolean, default: !1 }, /** * 拖拽抓手,赋值css选择器 */ dragHandle: { type: Object, default: null }, /** * 命令式调用属性,默认关闭按钮回调事件 */ closedCallback: { type: Function, default: null }, openedCallback: { type: Function, default: null }, // 窗口打开后的回调函数 resizeHandle: { type: Function, default: null }, /** * 命令式调用属性,默认插槽,返回VNode */ render: { type: Function, default: null }, /** * 命令式调用属性,底部默认确定按钮回调事件 */ acceptCallback: { type: Function, default: null }, /** * 命令式调用属性,底部默认取消按钮回调事件 */ rejectCallback: { type: Function, default: null }, enableEsc: { type: Boolean, default: !0 }, enableEnter: { type: Boolean, default: !1 }, dialogType: { type: String, default: "" }, src: { type: String, default: "" }, /** * 底部区域高度,如果设置为0,则不显示底部区域 * @default 60 */ footerHeight: { type: Number, default: 60 }, position: { type: String, default: "center" }, host: { type: Object, default: "body" }, isMessager: { type: Boolean, default: !1 }, fullscreen: { type: Boolean, default: !1 }, maximized: { type: Boolean, default: !1 }, useTransform: { type: Boolean, default: !0 } }; class Ne { constructor(t, n) { this.x = t, this.y = n; } static getTransformInfo(t) { const o = window.getComputedStyle(t).getPropertyValue("transform").replace(/[^-\d,]/g, "").split(","); if (o.length >= 6) { const r = parseInt(o[4], 10), s = parseInt(o[5], 10); return { x: r, y: s }; } return { x: 0, y: 0 }; } static fromEvent(t, n = null) { if (this.isMouseEvent(t)) return new Ne(t.clientX, t.clientY); if (n === null || t.changedTouches.length === 1) return new Ne(t.changedTouches[0].clientX, t.changedTouches[0].clientY); for (let o = 0; o < t.changedTouches.length; o++) if (t.changedTouches[o].target === n) return new Ne(t.changedTouches[o].clientX, t.changedTouches[o].clientY); } static isMouseEvent(t) { return Object.prototype.toString.apply(t).indexOf("MouseEvent") === 8; } static isIPosition(t) { return !!t && "x" in t && "y" in t; } static getCurrent(t) { const n = new Ne(0, 0); if (window) { const o = window.getComputedStyle(t); if (o) { const r = parseInt(o.getPropertyValue("left"), 10), s = parseInt(o.getPropertyValue("top"), 10); n.x = isNaN(r) ? 0 : r, n.y = isNaN(s) ? 0 : s; } return n; } return null; } static copy(t) { return new Ne(0, 0).set(t); } get value() { return { x: this.x, y: this.y }; } add(t) { return this.x += t.x, this.y += t.y, this; } subtract(t) { return this.x -= t.x, this.y -= t.y, this; } multiply(t) { this.x *= t, this.y *= t; } divide(t) { this.x /= t, this.y /= t; } reset() { return this.x = 0, this.y = 0, this; } set(t) { return this.x = t.x, this.y = t.y, this; } } class Ve { constructor(t, n) { this.width = t, this.height = n; } static getCurrent(t) { const n = new Ve(0, 0); if (window) { const o = window.getComputedStyle(t); return o && (n.width = parseInt(o.getPropertyValue("width"), 10), n.height = parseInt(o.getPropertyValue("height"), 10)), n; } return null; } static copy(t) { return new Ve(0, 0).set(t); } set(t) { return this.width = t.width, this.height = t.height, this; } } function jr(e, t) { const n = w(), o = w(), r = w(), s = w(), i = w(), a = w(), m = w(), u = w(), c = w(), d = w(), C = w(), b = w(e.resizeable), l = w(), g = w(e.draggable), h = w(!1); function T() { const L = o.value || document.body, z = window.getComputedStyle(L); if (!z || !n.value) return; const ue = Ne.getTransformInfo(n.value), ne = {}; m.value && (ne.deltaL = n.value.offsetLeft - m.value.x, ne.deltaT = n.value.offsetTop - m.value.y); const fe = z.getPropertyValue("position"); ne.width = L.clientWidth, ne.height = L.clientHeight, ne.pr = parseInt(z.getPropertyValue("padding-right"), 10), ne.pb = parseInt(z.getPropertyValue("padding-bottom"), 10), ne.position = z.getPropertyValue("position"), fe === "static" && (L.style.position = "relative"), ne.translateX = ue.x, ne.translateY = ue.y, d.value = ne; } function M(L) { if (n.value) { s.value = Ve.getCurrent(n.value), i.value = Ne.getCurrent(n.value), a.value = s.value ? Ve.copy(s.value) : null, m.value = i.value ? Ne.copy(i.value) : null, T(); const z = L.target.getAttribute("type") || ""; u.value = { n: !!z.match(/n/), s: !!z.match(/s/), w: !!z.match(/w/), e: !!z.match(/e/) }; } } function _() { var L, z, ue, ne; if (n.value) { const fe = n.value; u.value && ((u.value.n || u.value.s) && ((L = a.value) != null && L.height) && (fe.style.height = a.value.height + "px"), (u.value.w || u.value.e) && ((z = a.value) != null && z.width) && (fe.style.width = a.value.width + "px"), m.value && ((ue = m.value) != null && ue.x && (fe.style.left = m.value.x + "px"), (ne = m.value) != null && ne.y && (fe.style.top = m.value.y + "px"))); } } function G() { const L = e.minHeight ? e.minHeight : 1, z = e.minWidth ? e.minWidth : 1; a.value && m.value && u.value && s.value && (a.value.height < L && (a.value.height = L, u.value.n && i.value && (m.value.y = i.value.y + (s.value.height - L))), a.value.width < z && (a.value.width = z, u.value.w && i.value && (m.value.x = i.value.x + (s.value.width - z))), e.maxHeight && a.value.height > e.maxHeight && (a.value.height = e.maxHeight, i.value && u.value.n && (m.value.y = i.value.y + (s.value.height - e.maxHeight))), e.maxWidth && a.value.width > e.maxWidth && (a.value.width = e.maxWidth, u.value.w && i.value && (m.value.x = i.value.x + (s.value.width - e.maxWidth)))); } function ie() { if (o.value) { const L = d.value; if (m.value && a.value && u.value && s.value) { const z = L.width - L.pr - L.deltaL - L.translateX - m.value.x, ue = L.height - L.pb - L.deltaT - L.translateY - m.value.y; u.value.n && m.value.y + L.translateY < 0 && i.value && (m.value.y = -L.translateY, a.value.height = s.value.height + i.value.y + L.translateY), u.value.w && m.value.x + L.translateX < 0 && i.value && (m.value.x = -L.translateX, a.value.width = s.value.width + i.value.x + L.translateX), a.value.width > z && (a.value.width = z), a.value.height > ue && (a.value.height = ue); } } } function Z(L) { if (!r.value || !s.value || !i.value || !u.value) return; L.subtract(r.value); const z = L.x, ue = L.y; u.value.n ? (m.value.y = i.value.y + ue, a.value.height = s.value.height - ue) : u.value.s && (a.value.height = s.value.height + ue), u.value.e ? a.value.width = s.value.width + z : u.value.w && (a.value.width = s.value.width - z, m.value.x = i.value.x + z), ie(), G(), _(); } function F(L) { if (!c.value) return; const z = Ne.fromEvent(L); z && Z(z); } function N() { if (n.value) { const { width: L, height: z, x: ue, y: ne } = n.value.getBoundingClientRect(), fe = Ne.getTransformInfo(n.value); return { size: { width: L, height: z }, position: { x: ue - fe.x, y: ne - fe.y } }; } return null; } function V(L) { if (n.value) { const z = N(); C.value = z; } r.value = void 0, s.value = null, i.value = null, a.value = null, m.value = null, u.value = null, c.value = null, document.removeEventListener("mousemove", F), document.removeEventListener("mouseup", V); } function W() { document.addEventListener("mousemove", F), document.addEventListener("mouseup", V); } function X(L) { L instanceof MouseEvent && L.button === 2 || g.value && (document.body.click(), L.stopPropagation(), L.preventDefault(), r.value = Ne.fromEvent(L), c.value = L.target, M(L), W()); } function Q(L) { return n.value = L, b.value && y(yt, null, [y("div", { class: "fv-resizable-handle fv-resizable-n", type: "n", onMousedown: (z) => X(z) }, null), y("div", { class: "fv-resizable-handle fv-resizable-e", type: "e", onMousedown: (z) => X(z) }, null), y("div", { class: "fv-resizable-handle fv-resizable-s", type: "s", onMousedown: (z) => X(z) }, null), y("div", { class: "fv-resizable-handle fv-resizable-w", type: "w", onMousedown: (z) => X(z) }, null), y("div", { class: "fv-resizable-handle fv-resizable-ne", type: "ne", onMousedown: (z) => X(z) }, null), y("div", { class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal", type: "se", onMousedown: (z) => X(z) }, null), y("div", { class: "fv-resizable-handle fv-resizable-sw", type: "sw", onMousedown: (z) => X(z) }, null), y("div", { class: "fv-resizable-handle fv-resizable-nw", type: "nw", onMousedown: (z) => X(z) }, null)]); } function A(L = !0) { document.body.click(); const z = o.value || document.body, ue = Ve.getCurrent(z), ne = n.value; L && ne && (l.value = N(), l.value.transform = ne.style.transform), ue && ne && (a.value = ue, a.value.height -= 14, a.value.width -= 14, ne.style.height = a.value.height + "px", ne.style.width = a.value.width + "px", ne.style.left = "7px", ne.style.top = "7px", ne.style.transform = "", C.value = { size: a.value, position: { x: 0, y: 0 } }, g.value = !1, h.value = !0); } function Y() { var L, z; if (document.body.click(), l.value) { const ue = { width: l.value.size.width || 0, height: l.value.size.height || 0 }, ne = { x: (window.innerWidth - ue.width) / 2, y: (window.innerHeight - ue.height) / 2 }; (L = a.value) == null || L.set(ue), (z = m.value) == null || z.set(ne); const fe = n.value; fe.style.height = ue.height + "px", fe.style.width = ue.width + "px", fe.style.left = `${ne.x}px`, fe.style.top = `${ne.y}px`, fe.style.transform = "", C.value = { size: ue, position: ne }, g.value = e.draggable, h.value = !1; } } function K() { if (n.value) { const L = Ve.getCurrent(n.value); if (L) { const { width: z, height: ue } = L; n.value.style.left = `${(window.innerWidth - z) / 2}px`, n.value.style.top = `${(window.innerHeight - ue) / 2}px`, n.value.style.transform = ""; } } } function ae() { const L = () => { h.value ? A(!1) : K(), document.body.click(); }; return window.addEventListener("resize", L), () => { window.removeEventListener("resize", L); }; } const ye = ae(); return { renderResizeBar: Q, boundingElement: o, resizedEventParam: C, maximize: A, restore: Y, allowDrag: g, isMaximized: h, unWindowResizeHandle: ye, moveToCenter: K }; } function zr(e, t, n) { const o = w(), r = w(e.draggable), s = w(e.lockAxis), i = w(), a = w(), m = w(!1), u = w(new Ne(0, 0)), c = w(new Ne(0, 0)), d = w(new Ne(0, 0)), C = w(new Ne(0, 0)); Te(() => n.value, (F) => { i.value.style.cursor = F ? "move" : "default"; }); function b(F, N) { if (N.tagName === "BUTTON") return !1; if (N === F) return !0; for (const V in N.children) if (Object.prototype.hasOwnProperty.call(N.children, V) && b(F, N.children[V])) return !0; return !1; } function l() { var W, X; let F = d.value.x + c.value.x, N = d.value.y + c.value.y; s.value === "x" ? (F = ((W = u.value) == null ? void 0 : W.x) || 0, d.value.x = 0) : s.value === "y" && (N = ((X = u.value) == null ? void 0 : X.y) || 0, d.value.y = 0); const V = `translate3d(${Math.round(F)}px, ${Math.round(N)}px, 0px)`; o.value && (o.value.style.transform = V), C.value.x = F, C.value.y = N; } function g() { if (!a.value || !o.value) return null; const F = a.value.getBoundingClientRect(), N = o.value.getBoundingClientRect(), V = { top: F.top < N.top, right: F.right > N.right, bottom: F.bottom > N.bottom, left: F.left < N.left }; return V.top || (d.value.y -= N.top - F.top), V.bottom || (d.value.y -= N.bottom - F.bottom), V.right || (d.value.x -= N.right - F.right), V.left || (d.value.x -= N.left - F.left), l(), V; } function h(F) { F && (u.value && F.subtract(u.value), d.value.set(F), l(), g()); } function T(F) { m.value && r.value && (F.stopPropagation(), F.preventDefault(), h(Ne.fromEvent(F, i.value))); } function M() { var F; if (m.value) { if (m.value = !1, c.value.add(d.value), d.value.reset(), (F = o.value) == null || F.classList.remove("ng-dragging"), !e.useTransform && o.value) { const { left: N, top: V } = o.value.getBoundingClientRect(); o.value.style.left = Math.ceil(N) + "px", o.value.style.top = Math.ceil(V) + "px", o.value.style.transform = "none"; } t.emit("stopMove"), document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", M); } } function _() { !m.value && i.value && (m.value = !0, i.value.classList.add("ng-dragging"), document.addEventListener("mousemove", T), document.addEventListener("mouseup", M)); } function G() { if (o.value) { const F = Ne.getTransformInfo(o.value); c.value.set(F); return; } c.value.reset(); } function ie(F) { if (!n.value || F instanceof MouseEvent && F.button === 2) return; const N = F.target || F.srcElement; i.value !== void 0 && N && !b(N, i.value) || r.value !== !1 && (document.body.click(), F.stopPropagation(), F.preventDefault(), u.value = Ne.fromEvent(F, o.value), G(), _()); } function Z(F, N, V) { if (r.value && N) { if (F) i.value = F; else if (e.dragHandle) { if (e.dragHandle instanceof HTMLElement) i.value = e.dragHandle; else if (typeof e.dragHandle == "string") { const W = N.querySelector(e.dragHandle); W && (i.value = W); } } o.value = N, a.value = V, i.value ? (i.value.classList.add("ng-draggable"), i.value.addEventListener("mousedown", ie)) : r.value = !1; } } return { registerDraggle: Z, resetTranslate: G }; } function vn(e, t) { if (e) { const n = (o) => { o.key.toLowerCase() === e.toLowerCase() && t({ event: o, key: e }); }; return document.addEventListener("keydown", n), () => { document.removeEventListener("keydown", n); }; } } function Dr(e, t) { const n = w(e.enableEsc); let o = null; return n.value ? (o = vn("Escape", (r) => { t.emit("esc", { event: r.event, type: "esc" }); }), { remove: o }) : null; } function _r(e, t) { const n = w(e.enableEnter); let o = null; return n.value ? (o = vn("Enter", (r) => { t.emit("enter", { event: r.event, type: "enter" }); }), { remove: o }) : null; } const Je = /* @__PURE__ */ Me({ name: "FModal", props: $r, emits: ["update:modelValue", "accept", "cancel", "closed", "resize", "esc", "enter", "stopMove", "buttonClick"], setup(e, t) { const n = w(e.width || 300), o = w(e.height || 200), r = w(e.modelValue), s = w(""), i = w(e.class), a = w(e.fitContent), m = w(e.showHeader), u = w(""), c = w(e.showCloseButton), d = w(e.showMaxButton), C = w(!1), b = w(e.dialogType), l = w(e.src), g = w(""), h = w(e.showButtons), T = w(e.title), M = w(e.containment || null), _ = w(); T.value === "错误提示" && (T.value = ct.getLocaleValue("messageBox.errorTitle")); const G = w(!1); function ie() { const f = document.querySelectorAll(".farris-modal").length; (!f || f - 1 <= 0) && _.value === document.querySelectorAll(".farris-modal")[0] && document.body.classList.remove("modal-open"), _.value && _.value.classList.remove("show"); } function Z(f, I) { const le = I ? "accept" : "cancel"; Promise.resolve().then(() => { var ce; return (ce = e.beforeClose) == null ? void 0 : ce.call(e, { closeType: le }); }).then((ce) => { ce && (r.value = !1, t.emit("update:modelValue", !1), I != null && t.emit(I ? "accept" : "cancel"), t.emit("closed", f), ie()); }); } const F = [{ name: "cancel", text: ct.getLocaleValue("messageBox.cancel") || "取消", class: "btn btn-secondary", handle: (f) => { Z(f, !1); } }, { name: "accept", text: ct.getLocaleValue("messageBox.ok") || "确定", class: "btn btn-primary", handle: (f) => { Z(f, !0); } }], N = w(e.buttons && e.buttons.length ? e.buttons : F), V = ve(() => !!u.value), W = ve(() => !!h.value && !!N.value), X = w(), Q = w(), A = w(e.maximized || !1), { renderResizeBar: Y, maximize: K, restore: ae, boundingElement: ye, resizedEventParam: L, allowDrag: z, unWindowResizeHandle: ue, moveToCenter: ne } = jr(e), { registerDraggle: fe } = zr(e, t, z); function ke() { return !!document.querySelectorAll(".farris-modal").length && document.body.classList.contains("modal-open"); } Te(() => e.title, (f, I) => { f !== I && (T.value = f); }), Te(() => e.modelValue, (f, I) => { f !== I && (r.value = f, r.value && e.draggable && Ge(() => { Q.value && !M.value && (M.value = Q.value.parentElement, ye.value = M.value, fe(X.value, Q.value, ye.value), ne()); }), f || (M.value && (M.value = null), ie())), r.value ? G.value = ke() : (A.value = !1, z.value = e.draggable); }), Te(() => e.showHeader, (f, I) => { f !== I && (m.value = f); }), Te(() => e.showButtons, (f, I) => { f !== I && (h.value = f); }), Te(() => L.value, (f, I) => { const le = f || {}, ce = I || {}; JSON.stringify(le) !== JSON.stringify(ce) && t.emit("resize", { newSize: f, oldSize: I, isMaximized: A.value }); }), Te([() => e.width, () => e.height], (f, I) => { (f[0] !== I[0] || f[1] !== I[1]) && (n.value = f[0] || 500, o.value = f[1] || 600); }), Te(() => e.class, (f, I) => { i.value = f; }); const Se = ve(() => (r.value && document.body.classList.add("modal-open"), r.value)), v = ve(() => { var le; const f = { modal: !0, "farris-modal": !0, fade: !0, "fe-cmp-page-modal": !!e.showFloatingClose }; f["f-modal-fitContent"] = !!a.value, f.show = !!Se.value; const I = (le = e.maskClass) == null ? void 0 : le.split(" "); return I == null || I.reduce((ce, Fe) => (ce[Fe] = !0, ce), f), f; }), p = ve(() => { var le; const f = { "modal-dialog": !0 }, I = (le = i.value) == null ? void 0 : le.split(" "); return I == null || I.reduce((ce, Fe) => (ce[Fe] = !0, ce), f), f; }), P = () => Rt() && !e.isMessager || !!e.fullscreen, B = ve(() => { const f = document.documentElement.clientWidth, I = document.documentElement.clientHeight; if (A.value) return { position: "fixed", top: "0px", left: "0px", width: "100vw", height: "100vh", margin: "0" }; const le = Math.min(n.value, f), ce = e.position === "right" ? "100%" : a.value ? "auto" : `${Math.min(o.value, I - 10)}px`, Fe = `${(window.innerHeight - (ce === "100%" || ce === "auto" ? 0 : parseInt(ce))) / 2}px`, je = e.position === "right" ? `${window.innerWidth - le}px` : `${(window.innerWidth - le) / 2}px`, Ie = { position: "absolute", top: Fe, left: je, width: Rt() ? "auto" : `${le}px`, height: ce }; return e.mask || (Ie.pointerEvents = "auto"), Ie; }), k = w(Ut() || 1050), S = ve(() => { const f = { display: "block", overflow: "hidden" }; return e.mask || (f.pointerEvents = "none", f.backgroundColor = "transparent"), G.value && (f.backgroundColor = "transparent"), f.zIndex = k.value, f; }), re = ve(() => ({ "modal-content": !0, "modal-content-has-header": m.value, "is-mobile": P() })), ee = ve(() => { const f = { display: m.value ? "" : "none" }; return f["pointer-events"] = z.value ? "auto" : "none", f; }), be = ve(() => ({ "f-icon": !0, modal_maximize: !0, modalrevert: A.value })), xe = ve(() => ({ "modal-body": !0, "f-utils-flex-column": b.value === "iframe", "f-utils-fill": !0 })); function ge() { return { height: `${e.footerHeight || 60}px` }; } const Pe = ve(() => { const f = { textAlgin: g.value }, I = ge(); return Object.assign(f, I); }); function se(f) { if (f == null || f.stopPropagation(), A.value) { A.value = !1, ae(); return; } K(), A.value = !0; } async function he(f, I) { f.handle ? await f.handle(I, f) && t.emit("closed", I) : t.emit("buttonClick", { button: f, $event: I }); } function Oe(f) { f.width && (n.value = f.width), f.height && (o.value = f.height), f.buttons && (N.value = f.buttons), f.title && (T.value = f.title); } let me = null, te = null; dn(() => { G.value = ke(); }), Qe(() => { Q.value && !M.value && (M.value = Q.value.parentElement, ye.value = M.value, fe(X.value, Q.value, ye.value)), Se.value && document.body.classList.add("modal-open"), me = Dr(e, t), te = _r(e, t); }), fn(() => { ue && ue(), me && me.remove(), te && te.remove(); }), t.expose({ modalElementRef: Q, updateModalOptions: Oe, close: Z, maxDialog: se, isMaximized: A, disableButtons: (f, I = !0) => { N.value.forEach((le) => { le.name && f.includes(le.name) && (le.disabled = I); }); } }); function q() { return y("div", { class: "action-wrapper", onClick: (f) => Z(f, !1) }, [y("span", { class: "close-icon" }, [y("i", { class: "f-icon f-icon-close" }, null)])]); } function U() { return y("ul", null, [C.value && y("li", { class: "f-btn-icon f-bare" }, [y("span", { class: "f-icon modal_minimize" }, null)]), d.value && y("li", { onClick: se, class: "f-btn-icon f-bare", style: "pointer-events: auto;" }, [y("span", { class: be.value }, null)]), c.value && y("li", { class: "f-btn-icon f-bare", onClick: (f) => Z(f, !1), style: "pointer-events: auto;" }, [y("span", { class: "f-icon modal_close" }, null)])]); } const J = (f) => { f.preventDefault(); const I = f.currentTarget, le = f.deltaY * 0.5; I.scrollLeft += le; }; function oe() { return y("div", { class: "modal-footer", style: Pe.value }, [N.value && y("div", { class: "buttons", onWheel: J }, [N.value.map((f) => { var ce; const I = w(f.disabled), le = f.class || ((ce = f.appearance) == null ? void 0 : ce.class); return y("button", { name: f.name, style: f.styles, type: "button", disabled: I.value, class: le + (f.iconClass ? " btn-icontext" : "") + (f.visible === !1 ? "d-none" : ""), onClick: (Fe) => { he(f, Fe); } }, [!!f.iconClass && y("i", { class: f.iconClass }, null), f.text]); })])]); } function de(f) { d.value && se(); } function Ce() { return y(yt, null, [A.value && y("div", { class: "modal-header", style: "position: absolute;background: transparent;height: 45px;width: 100%;", onDblclick: (f) => de() }, null), y("div", { ref: X, class: "modal-header", style: ee.value, onDblclick: (f) => de() }, [t.slots.headerTemplate ? t.slots.headerTemplate() : y("div", { class: "modal-title" }, [V.value && y("span", { class: u.value, style: "margin-right: 8px" }, null), y("span", { class: "modal-title-label" }, [T.value])]), y("div", { class: "actions" }, [U()])])]); } function Ee() { return t.slots.footerTemplate ? t.slots.footerTemplate() : W.value && oe(); } function Ae(f) { if (f.stopPropagation(), e.allowClickMaskToClose) { if (f.target !== _.value) return; Z(f, !1); } } function E() { var f, I; return y("div", { id: s.value, class: p.value, style: B.value, ref: Q }, [e.showFloatingClose && q(), y("div", { class: re.value }, [m.value && Ce(), y("div", { class: xe.value }, [(I = (f = t.slots).default) == null ? void 0 : I.call(f), b.value === "iframe" && y("iframe", { title: s.value, class: "f-utils-fill", width: "100%", frameborder: "0", src: l.value }, null)]), Ee()]), !a.value && Q.value && !A.value && Y(Q.value)]); } function O(f) { return f || "body"; } return Wn(() => { Se.value && (k.value = Ut() || 1050); }), () => y(Xn, { to: O(e.host) }, { default: () => [Se.value && y(Yn, { name: "fade", appear: !0 }, { default: () => [y("div", { ref: _, class: v.value, style: S.value, onClick: Ae }, [E()])] })] }); } }); function hn(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Ur(e) { const t = document.createElement("div"); t.style.display = "contents"; const n = Qn({ setup(o, r) { fn(() => { document.body.removeChild(t); }); const s = w(), i = w(e.class || ""), a = w(!!e.showButtons), m = w(!!e.showHeader), u = w(e.showCloseButton == null ? !0 : e.showCloseButton), c = w(!!e.showFloatingClose), d = w(!0), C = w(e.title || ""), b = e.acceptCallback || (() => { }), l = e.rejectCallback || (() => { }), g = e.closedCallback || ((G) => { }), h = e.resizeHandle || ((G) => { }), T = e.stopMoveHandle || ((G) => { }), M = hn(e), _ = (G) => { d.value = !1, n.unmount(), g(G); }; return Qe(() => { }), r.expose({ modalRef: s }), () => y(Je, { ref: s, class: i.value, modelValue: d.value, "onUpdate:modelValue": (G) => d.value = G, title: C.value, width: e.width, height: e.height, buttons: e.buttons, "show-header": m.value, "show-buttons": a.value, "show-close-button": u.value, "show-max-button": !1, showFloatingClose: c.value, onAccept: b, onCancel: l, fitContent: e.fitContent == null ? !0 : e.fitContent, onClosed: _, onResize: h, onStopMove: T }, { default: () => [M && M(n)] }); } }); return document.body.appendChild(t), n.use(ct.i18n), n.mount(t), n; } class Hr { // private activeModalInstance = computed(() => { // return this.modalRefs[this.activeModalIndex.value]; // }); constructor(t) { He(this, "appContext", null); He(this, "modalRef", w()); He(this, "activeModalIndex", w(0)); He(this, "modalRefs", {}); He(this, "isUseEscCloseModal", w(!1)); this.app = t, this.appContext = t ? t._context : null; } getCurrentModal() { return this.modalRefs[this.activeModalIndex.value]; } adaptToWindow(t, n) { const { width: o, height: r } = { width: window.innerWidth, height: window.innerHeight }; return o < t && (t = o - 14), r < n && (n = r - 14), { width: t, height: n }; } static show(t) { const n = Object.assign({ title: "", showButtons: !0, showHeader: !0 }, t); return Ur(n); } close(t) { var n, o; t ? (o = t.value) == null || o.close() : (n = this.getCurrentModal()) == null || n.close(); } open(t) { const n = document.createDocumentFragment(); t.showMaxButton && t.fitContent && (t.showMaxButton = !1); const o = Jn(Object.assign({ title: "", showButtons: !0, showHeader: !0, maximized: !1 }, t)), r = w(!0), s = o.value.acceptCallback || (() => { }), i = o.value.rejectCallback || (() => { }), a = o.value.closedCallback || ((N, V) => { }), m = o.value.openedCallback || ((N) => { }), u = o.value.resizeHandle || ((N) => { }), c = t.stopMoveHandle || ((N) => { }); let d; const C = hn(o.value), b = (N) => { var W; r.value = !1; const V = (W = N == null ? void 0 : N.target) == null ? void 0 : W.classList.contains("modal_close"); a(N, this.isUseEscCloseModal.value ? "esc" : V ? "icon" : "button"); }, l = (N) => { b(N), d && Ge(() => { if (this.modalRefs[this.activeModalIndex.value] && delete this.modalRefs[this.activeModalIndex.value], Tt(null, n), d = null, this.modalRef.value = null, this.modalRefs) { const V = Object.keys(this.modalRefs).map((W) => Number(W)); V.length > 0 ? this.activeModalIndex.value = Math.max(...V) : this.activeModalIndex.value = 0, this.modalRefs[this.activeModalIndex.value] && (this.modalRef.value = this.modalRefs[this.activeModalIndex.value]); } this.isUseEscCloseModal.value = !1; }); }, g = (N) => { var V; this.isUseEscCloseModal.value = !0, (V = this.getCurrentModal()) == null || V.close(N == null ? void 0 : N.event); }, { width: h, height: T } = o.value, M = this.adaptToWindow(h || 500, T || 320); Object.assign(o.value, M); const _ = w(), G = () => y(Je, $t({ ref: _, modelValue: r.value, "onUpdate:modelValue": (N) => r.value = N }, o.value, { isMessager: o.value.class && o.value.class.indexOf("modal-message") > -1, onAccept: s, onCancel: i, onClosed: l, onResize: u, onEsc: g, onStopMove: c, maximized: o.value.maximized }), { default: () => [C && C(this.app)] }); d = ((N) => { const V = gt(G, N); return V.appContext = this.appContext, Tt(V, n), V; })({ ...o.value // 'onUpdate:modelValue': onUpdateModelValue, }), this.activeModalIndex.value++; const Z = this.activeModalIndex.value; this.modalRefs[Z] = _.value; const F = (N) => { o.value = { ...o.value, ...N }, d && Tt(Gn(d, { ...o }), n); }; return Ge(() => { this.modalRefs[Z] = _.value, this.modalRef.value = _.value, m(new Event("opened")); }), { update: F, destroy: l, modalRef: _, close: () => { var N; (N = _.value) == null || N.close(); }, disableButtons: (N, V = !0) => { var W; (W = _.value) == null || W.disableButtons(N, V); } }; } } const Vr = Symbol("FModalService"); Je.install = (e) => { e.component(Je.name, Je); const t = new Hr(e); e.provide(Vr, t), e.provide("FModalService", t); }; const qr = { width: { type: String, default: "300px" }, height: { type: Number, default: 10 }, isWidePanel: { type: Boolean, default: !1 }, /** 是否启用搜索 */ enableSearch: { type: Boolean, default: !0 }, /** 使用模式 */ mode: { type: String, default: "panel" }, /** 是否持有面板的隐藏显示状态 */ isPersitOpenState: { type: Boolean, default: !1 }, /** isPersitOpenState=true时,控制面板是否隐藏显示 */ isShowPanel: { type: Boolean, default: !1 }, /** 属性名 */ propertyName: { type: String, default: "" }, /** 属性类型 */ propertyConfig: { type: Array }, /** 属性值 */ propertyData: { type: Object, default: {} }, /** 是否展示关闭按钮 */ showCloseBtn: { type: Boolean, default: !1 }, /** 当前选中的标签页id */ selectedTabId: { type: String, default: "" }, /** 是否是白色主题 */ isWhiteTheme: { type: Boolean, default: !0 }, /** dom结构 */ schema: { type: Object, default: {} }, /** 属性变更后事件 */ propertyChanged: { type: Function }, /** 允许折叠面板 */ allowCollapse: { type: Boolean, default: !0 } }; function Wr(e = {}) { function t(u, c, d, C) { if (typeof d == "number") return C[u].length === d; if (typeof d == "object") { const b = Object.keys(d)[0], l = d[b]; if (b === "not") return Number(C[u].length) !== Number(l); if (b === "moreThan") return Number(C[u].length) >= Number(l); if (b === "lessThan") return Number(C[u].length) <= Number(l); } return !1; } function n(u, c, d, C) { return C[u] && C[u].propertyValue && String(C[u].propertyValue.value) === String(d); } const o = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((u, c) => (u.set(c, e[c]), u), o); function r(u, c) { const d = u; return typeof c == "number" ? [{ target: d, operator: "length", param: null, value: Number(c) }] : typeof c == "boolean" ? [{ target: d, operator: "getProperty", param: u, value: !!c }] : typeof c == "object" ? Object.keys(c).map((C) => { if (C === "length") return { target: d, operator: "length", param: null, value: c[C] }; const b = C, l = c[C]; return { target: d, operator: "getProperty", param: b, value: l }; }) : []; } function s(u) { return Object.keys(u).reduce((d, C) => { const b = r(C, u[C]); return d.push(...b), d; }, []); } function i(u, c) { if (o.has(u.operator)) { const d = o.get(u.operator); return d && d(u.target, u.param, u.value, c) || !1; } return !1; } function a(u, c) { return s(u).reduce((b, l) => b && i(l, c), !0); } function m(u, c) { const d = Object.keys(u), C = d.includes("allOf"), b = d.includes("anyOf"), l = C || b, T = (l ? u[l ? C ? "allOf" : "anyOf" : "allOf"] : [u]).map((_) => a(_, c)); return C ? !T.includes(!1) : T.includes(!0); } return { parseValueSchema: m }; } const Xr = { convertTo: (e, t, n, o) => { e.appearance || (e.appearance = {}), e.appearance[t] = n; }, convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t] }, Yr = { convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, Jr = { convertTo: (e, t, n, o) => { e.editor && (e.editor[t] = n); }, convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t] }, Gr = { button: { type: "button", name: "按钮" }, "response-toolbar": { type: "response-toolbar", name: "工具栏" }, "response-toolbar-item": { type: "response-toolbar-item", name: "按钮" }, "content-container": { type: "content-container", name: "容器" }, table: { type: "table", name: "表格布局" }, "table-td": { type: "table-td", name: "单元格" }, "input-group": { type: "input-group", name: "文本" }, textarea: { type: "textarea", name: "多行文本" }, lookup: { type: "lookup", name: "帮助" }, "number-spinner": { type: "number-spinner", name: "数值" }, "date-picker": { type: "date-picker", name: "日期" }, switch: { type: "switch", name: "开关" }, "radio-group": { type: "radio-group", name: "单选组" }, "check-box": { type: "check-box", name: "复选框" }, "check-group": { type: "check-group", name: "复选框组" }, "combo-list": { type: "combo-list", name: "下拉列表" }, "response-form": { type: "response-form", name: "卡片面板" }, "response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" }, "response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" }, "tree-grid": { type: "tree-grid", name: "树表格" }, "tree-grid-column": { type: "tree-grid-column", name: "树表格列" }, "data-grid": { type: "data-grid", name: "表格" }, "data-grid-column": { type: "data-grid-column", name: "表格列" }, module: { type: "Module", name: "模块" }, component: { type: "component", name: "组件" }, tabs: { type: "tabs", name: "标签页" }, "tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" }, "tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" }, "drawer-toolbar-item": { type: "drawer-toolbar-item", name: "抽屉工具栏按钮" }, "html-template": { type: "html-template", name: "模板容器" }, "time-picker": { type: "time-picker", name: "时间选择" }, section: { type: "section", name: "分组面板" }, "section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" }, "section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" }, splitter: { type: "splitter", name: "分栏面板" }, "splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" }, "component-ref": { type: "component-ref", name: "组件引用节点" }, uploader: { type: "uploader", name: "附件上传" }, "page-header": { type: "page-header", name: "页头" }, "page-footer": { type: "page-footer", name: "页脚" }, "tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" }, "drawer-toolbar": { type: "drawer-toolbar", name: "抽屉工具栏" }, fieldset: { type: "fieldset", name: "分组" }, "query-solution": { type: "query-solution", name: "筛选方案" }, drawer: { type: "drawer", name: "抽屉" }, "external-container": { type: "external-container", name: "外部容器", icon: "content-container" }, "list-nav": { type: "list-nav", name: "列表导航" }, nav: { type: "nav", name: "标签类导航" }, "list-view": { type: "list-view", name: "列表" }, "filter-bar": { type: "filter-bar", name: "筛选条" }, "language-textbox": { type: "language-textbox", name: "多语输入框" }, image: { type: "image", name: "图像" }, avatar: { type: "avatar", name: "头像" }, "discussion-editor": { type: "discussion-editor", name: "评论编辑区" }, "discussion-list": { type: "discussion-list", name: "评论列表" }, comment: { type: "comment", name: "评论区" }, "approval-logs": { type: "approval-logs", name: "审批记录" }, "rich-text-editor": { type: "rich-text-editor", name: "富文本", icon: "rich-text-box" }, calendar: { type: "calendar", name: "日历", icon: "date-picker" }, wizard: { type: "wizard", name: "向导", icon: "wizard" }, "wizard-page": { type: "wizard-page", name: "向导页", icon: "wizard" }, "wizard-page-detail": { type: "wizard-page-detail", name: "向导详情", icon: "wizard" }, step: { type: "step", name: "步骤条", icon: "step" }, "dynamic-form": { type: "dynamic-form", name: "动态表单" } }, Qr = { convertFrom: (e, t, n) => { var r; const o = e.editor && e.editor[t] ? e.editor[t] : e[t]; return ((r = Gr[o]) == null ? void 0 : r.name) || o; } }, Zr = { convertTo: (e, t, n, o) => { e[t] = e[t]; }, convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : "" }, Kr = { convertTo: (e, t, n, o) => { (e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = n : e.formatter = { [t]: n }); }, convertFrom: (e, t, n) => { if (e.formatter) { if (t === "trueText") return e.formatter.trueText; if (t === "falseText") return e.formatter.falseText; if (t === "prefix") return e.formatter.prefix; if (t === "suffix") return e.formatter.suffix; if (t === "precision") return e.formatter.precision; if (t === "decimal") return e.formatter.decimal; if (t === "thousand") return e.formatter.thousand; if (t === "dateFormat") return e.formatter.dateFormat || "yyyy-MM-dd"; if (t === "customFormat") return e.formatter.customFormat; if (t === "type") return e.formatter.type || "none"; } return "none"; } }, ei = { convertTo: (e, t, n, o) => { e.command ? e.command[t] = n : e.command = { [t]: n }, t === "enableType" && n === "default" && (e.command.enable = !0, e.command.formatter = "", e.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ]), t === "enableType" && n === "custom" && (e.command.enable = !0, e.command.commands = [ { value: "add", text: "增加", type: "link" }, { value: "edit", text: "编辑", type: "link" }, { value: "remove", text: "删除", type: "link" } ]), t === "enableType" && n === "unable" && (e.command.enable = !1, e.command.formatter = ""); }, convertFrom: (e, t, n) => { var o, r; if (e.command) { if (t === "enableType") { if (e.command.enableType) return e.command.enableType; const s = (r = (o = e.command) == null ? void 0 : o.commands) == null ? void 0 : r.find((i) => i.command === "edit" && i.type === "primary"); return e.command.enable ? s ? "default" : "custom" : "unable"; } if (t === "commands") return e.command.enableType === "custom" ? e.command.commands : []; if (t === "formatter") return e.command.formatter; if (t === "count") return e.command.count; if (t === "columnWidth") return e.command.columnWidth || 200; } return ""; } }, ti = { convertTo: (e, t, n, o) => { if (e.column || (e.column = {}), t === "fitMode") { n && n !== "none" ? (e.column.fitColumns = !0, e.column.fitMode = n) : (e.column.fitColumns = !1, e.column.fitMode = "average"); return; } if (t === "fitColumns") { e.column.fitColumns = n, n && !e.column.fitMode && (e.column.fitMode = "average"); return; } e.column[t] = n; }, convertFrom: (e, t, n) => { if (e.column) { if (t === "fitMode") return e.column.fitColumns ? e.column.fitMode || "average" : "none"; if (t === "fitColumns") return e.column.fitColumns; } return t === "fitMode" ? "none" : ""; } }, ni = { convertTo: (e, t, n, o) => { e.summary ? e.summary[t] = n : e.summary = { [t]: n }, t === "enable" && n && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = { enable: n, groupFields: [] }); }, convertFrom: (e, t, n) => { var o, r; return t === "customSummaryStyle" ? e.summary.customSummaryStyle : t === "position" ? ((o = e.summary) == null ? void 0 : o[t]) || "bottom" : t === "customRender" ? ((r = e.summary) == null ? void 0 : r[t]) || "" : e.summary && t === "enable" ? e.summary.enable : e.type === "d