UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,536 lines (1,535 loc) 172 kB
var Mn = Object.defineProperty; var On = (e, t, n) => t in e ? Mn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var ye = (e, t, n) => On(e, typeof t != "symbol" ? t + "" : t, n); import { defineComponent as Oe, ref as b, computed as N, createVNode as w, Teleport as Ut, createApp as Nt, onUnmounted as ut, Fragment as Ye, watch as fe, nextTick as et, onBeforeMount as En, onMounted as Je, Transition as Xt, shallowRef as Rn, render as Rt, h as jn, cloneVNode as Pn, mergeProps as ht, reactive as Le, createTextVNode as Yt, inject as Jt, withDirectives as Dn, vShow as Nn, onUpdated as In, onBeforeUnmount as Hn } from "vue"; import { resolveAppearance as Ln, createPropsResolver as Qt, getSchemaByTypeForDesigner as $n } from "../dynamic-resolver/index.esm.js"; import { useI18n as It } from "vue-i18n"; import { LocaleService as gt } from "../locale/index.esm.js"; import { cloneDeep as jt, isPlainObject as _t, isUndefined as Ie, debounce as zn } from "lodash-es"; import "../accordion/index.esm.js"; import "../avatar/index.esm.js"; import "../../designer/button-edit/index.esm.js"; import "../button-group/index.esm.js"; import "../calendar/index.esm.js"; import "../capsule/index.esm.js"; import "../../designer/checkbox/index.esm.js"; import "../../designer/checkbox-group/index.esm.js"; import "../combo-list/index.esm.js"; import "../combo-tree/index.esm.js"; import "../component/index.esm.js"; import "../color-picker/index.esm.js"; import "../content-container/index.esm.js"; import "../date-picker/index.esm.js"; import "../../designer/data-grid/index.esm.js"; import "../dropdown/index.esm.js"; import "../dynamic-form/index.esm.js"; import "../events-editor/index.esm.js"; import "../filter-bar/index.esm.js"; import "../field-selector/index.esm.js"; import "../binding-selector/index.esm.js"; import "../image-cropper/index.esm.js"; import "../../designer/input-group/index.esm.js"; import "../layout/index.esm.js"; import "../list-nav/index.esm.js"; import "../../designer/list-view/index.esm.js"; import "../lookup/index.esm.js"; import "../mapping-editor/index.esm.js"; import "../nav/index.esm.js"; import "../number-range/index.esm.js"; import "../number-spinner/index.esm.js"; import "../order/index.esm.js"; import "../page-header/index.esm.js"; import "../page-footer/index.esm.js"; import "../pagination/index.esm.js"; import "../progress/index.esm.js"; import "../query-solution/index.esm.js"; import "../../designer/radio-group/index.esm.js"; import "../rate/index.esm.js"; import "../response-toolbar/index.esm.js"; import "../response-layout/index.esm.js"; import "../response-layout-editor/index.esm.js"; import "../search-box/index.esm.js"; import "../section/index.esm.js"; import "../smoke-detector/index.esm.js"; import "../splitter/index.esm.js"; import "../step/index.esm.js"; import "../switch/index.esm.js"; import "../tabs/index.esm.js"; import An from "../tags/index.esm.js"; import "../text/index.esm.js"; import "../time-picker/index.esm.js"; import "../transfer/index.esm.js"; import "../tree-view/index.esm.js"; import "../uploader/index.esm.js"; import "../verify-detail/index.esm.js"; import "../video/index.esm.js"; import "../textarea/index.esm.js"; import "../schema-selector/index.esm.js"; import "../../designer/tree-grid/index.esm.js"; import "../event-parameter/index.esm.js"; import "../filter-condition-editor/index.esm.js"; import "../fieldset/index.esm.js"; import "../sort-condition-editor/index.esm.js"; import "../menu-lookup/index.esm.js"; import "../../designer/drawer/index.esm.js"; import "../json-editor/index.esm.js"; import "../property-editor/index.esm.js"; import "../expression-editor/index.esm.js"; import "../code-editor/index.esm.js"; import "../html-template/index.esm.js"; import "../collection-property-editor/index.esm.js"; import "../modal/index.esm.js"; import "../external-container/index.esm.js"; import "../language-textbox/index.esm.js"; import "../designer-canvas/index.esm.js"; import { getCustomClass as Pt, withInstall as Zt, FormSchemaEntityField$Type as Wt, FormSchemaEntityFieldTypeName as qt, useGuid as Vn } from "../common/index.esm.js"; import { useResizeObserver as _n } from "@vueuse/core"; import { getHierarchyRow as Wn, useIdentify as qn, useGroupData as Gn, useFilter as Un, useHierarchy as Xn, useLoading as Yn, useDataView as Jn, useSelection as Qn, useSelectHierarchyItem as Zn, usePagination as Kn, useDataViewContainerStyle as eo, useCommandColumn as to, useSettingColumn as no, useColumn as oo, useSort as ao, useGroupColumn as ro, useRow as lo, useEdit as io, useVisualDataBound as so, useVisualDataCell as uo, useVisualDataRow as co, useVisualData as fo, useCellPosition as po, useSidebar as mo, useVirtualScroll as vo, useFitColumn as ho, useFilterHistory as go, useColumnFilter as yo, useDragColumn as bo, getColumnHeader as wo, getSidebar as Co, getDisableMask as xo, getHorizontalScrollbar as So, getVerticalScrollbar as To, getEmpty as Bo, getPagination as ko, getSummary as Fo } from "../data-view/index.esm.js"; import "../property-panel/index.esm.js"; import "../notify/index.esm.js"; import Mo from "../popover/index.esm.js"; const Oo = { /** * 组件标识 */ id: { type: String, default: "" }, /** * 扩展按钮显示内容,这是一段现在扩展按钮中的html标签 */ buttonContent: { type: String, default: '<i class="f-icon f-icon-lookup"></i>' }, buttonBehavior: { type: String, default: "Popup" }, /** * 启用输入框自动完成功能 */ autoComplete: { type: Boolean, default: !1 }, /** * 组件自定义样式 */ customClass: { type: String, default: "" }, /** * 禁用组件,既不允许在输入框中录入,也不允许点击扩展按钮。 */ disable: { type: Boolean, default: !1 }, /** * 允许在输入框中录入文本。 */ editable: { type: Boolean, default: !0 }, /** * 显示清空文本按钮 */ enableClear: { type: Boolean, default: !1 }, /** * 组件值 */ modelValue: { type: String, default: "" }, /** * 将组件设置为只读,既不允许在输入框中录入,也不允许点击扩展按钮,但是允许复制输入框中的内容。 */ readonly: { type: Boolean, default: !1 }, /** * 禁用组件时,是否显示扩展按钮 */ showButtonWhenDisabled: { type: Boolean, default: !1 }, /** * 鼠标悬停在组件上时显示文本框内容。 */ enableTitle: { type: Boolean, default: !1 }, /** * 输入框类型 */ inputType: { type: String, default: "text" }, /** * 显示输入框提示信息 */ forcePlaceholder: { type: Boolean, default: !1 }, /** * 输入框提示文本 */ placeholder: { type: String, default: "" }, /** * 输入框最小长度 */ minLength: Number, /** * 输入框最大长度 */ maxLength: { type: Number }, /** * 输入框Tab键索引 */ tabIndex: Number, popupHost: { type: Object }, popupRightBoundary: { type: Object }, popupOffsetX: { type: Object }, popupOnInput: { type: Boolean, default: !1 }, popupOnFocus: { type: Boolean, default: !1 }, popupOnClick: { type: Boolean, default: !1 }, /** * 样式追加到弹出窗口 */ popupClass: { type: String, default: "" }, popupMinWidth: { type: Number, default: 160 }, modalOptions: { type: Object, default: {} }, wrapText: { type: Boolean, default: !1 }, /** * 可选,是否支持多选 * 默认`false` */ multiSelect: { type: Boolean, default: !1 }, /** * 可选,分隔符 * 默认`,` */ separator: { type: String, default: "," }, /** 对齐方式 */ textAlign: { type: String, default: "left" }, /** * 废弃 */ beforeClickButton: { type: Function, default: null }, /** * 作为内嵌编辑器被创建后默认获得焦点 */ focusOnCreated: { type: Boolean, default: !1 }, /** * 作为内嵌编辑器被创建后默认选中文本 */ selectOnCreated: { type: Boolean, default: !1 }, /** * 打开前 */ beforeOpen: { type: Function, default: null }, /** 更新方式 blur | change */ updateOn: { type: String, default: "change" }, keepWidthWithReference: { type: Boolean, default: !0 }, placement: { type: String, default: "bottom-left" }, /** * 根据空间大小重新调整,原下拉面板内容指定的高度 */ limitContentBySpace: { type: Boolean, default: !1 } }, Eo = { popupContentPosition: { type: Object, default: { left: 0, top: 0 } }, host: { type: Object }, backgroundColor: { type: String, default: "" } }, Ro = /* @__PURE__ */ Oe({ name: "FOverlay", props: Eo, emits: ["click"], setup(e, t) { const n = b(e.popupContentPosition), o = b(e.host), a = N(() => ({ backgroundColor: e.backgroundColor || "", pointerEvents: "auto" })); function l(s) { t.emit("click"), s.preventDefault(), s.stopPropagation(); } N(() => { const s = o.value; if (s) { const f = s.getBoundingClientRect(), { left: i, top: m, height: c } = f; return { left: i, top: m + c }; } return n.value; }); const r = N(() => ({ // position: 'relative', // left: `${position.value.left}px`, // top: `${position.value.top}px` })); return () => w(Ut, { to: "body" }, { default: () => { var s, f; return [w("div", { class: "overlay-container", onClick: (i) => l(i), style: a.value }, [w("div", { style: r.value }, [(f = (s = t.slots).default) == null ? void 0 : f.call(s)])])]; } }); } }); function jo(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Po(e) { const t = document.createElement("div"); t.style.display = "contents"; let n; const o = e.onClickCallback || (() => { }), a = () => { o(), n && n.unmount(); }; return n = Nt({ setup() { ut(() => { document.body.removeChild(t); }); const l = jo(e); return () => w(Ro, { "popup-content-position": e.popupPosition, host: e.host, onClick: a, backgroundColor: e.backgroundColor }, { default: () => [l && l()] }); } }), document.body.appendChild(t), n.mount(t), n; } class Do { static show(t) { return Po(t); } } const No = "https://json-schema.org/draft/2020-12/schema", Io = "https://farris-design.gitee.io/modal.schema.json", Ho = "modal", Lo = "弹窗组件", $o = "object", zo = { id: { description: "组件唯一标识", type: "string" }, type: { description: "组件类型", type: "string", default: "modal" }, appearance: { description: "组件外观", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, name: { description: "名称", type: "string", default: null }, title: { description: "标题", type: "string" }, width: { description: "窗口宽度", type: "number", default: 900 }, height: { description: "窗口高度", type: "number", default: 600 }, contents: { description: "弹窗子组件集合", type: "array", default: [] }, modelValue: { description: "是否显示", type: "boolean", default: !1 }, showCloseButton: { description: "显示关闭按钮", type: "boolean", default: !0 }, showMaxButton: { description: "显示最大化按钮", type: "boolean", default: !0 }, enableEsc: { description: "允许ESC关闭", type: "boolean", default: !0 }, resizeable: { description: "允许调整窗口尺寸", type: "boolean", default: !0 }, fitContent: { description: "是否自适应", type: "boolean", default: !1 }, showButtons: { description: "是否显示底部按钮", type: "boolean", default: !0 }, mask: { description: "是否模态", type: "boolean", default: !0 }, draggable: { description: "是否允许拖拽调整位置", type: "boolean", default: !0 }, onAccept: { description: "确定事件", type: "object", default: null }, onCancel: { description: "取消事件", type: "object", default: null }, beforeClose: { description: "关闭前回调", type: "object", default: null } }, Ao = [ "id", "type" ], Vo = { onAccept: "确定事件", onCancel: "取消事件", beforeClose: "关闭前回调" }, _o = { $schema: No, $id: Io, title: Ho, description: Lo, type: $o, properties: zo, required: Ao, events: Vo }, Wo = /* @__PURE__ */ new Map([ ["appearance", Ln] ]); function qo(e, t, n) { return t; } function Go() { function e(t, n) { const o = {}; return o.beforeClose = (a) => n.call("beforeClose", [a, t]), o; } return { resolve: e }; } const Kt = { /** * 允许点击遮罩关闭对话框 */ allowClickMaskToClose: { type: Boolean, default: !1 }, /** * 关闭对话框前事件, 是个函数,返回true或者false */ beforeClose: { type: Function, default: () => !0 }, /** * 自定义类 */ class: { type: String, default: "" }, /** * 自定义遮罩类 */ maskClass: { type: String, default: "" }, /** * 模态框标题 */ title: { type: String, default: "" }, /** * 模态框宽度 */ width: { type: Number, default: 500 }, /** * 模态框高度 */ height: { type: Number, default: 320 }, /** * 自定义按钮列表 */ buttons: { type: Array, default: [] }, /** * 是否展示模态框 */ modelValue: { type: Boolean, default: !1 }, /** * 是否模态 */ mask: { type: Boolean, default: !0 }, /** * 是否展示头部 */ showHeader: { type: Boolean, default: !0 }, /** * 是否展示默认按钮 */ showButtons: { type: Boolean, default: !0 }, /** * 是否启用自适应样式 */ fitContent: { type: Boolean, default: !0 }, /** * 是否展示右上角按钮 */ showCloseButton: { type: Boolean, default: !0 }, showMaxButton: { type: Boolean, default: !1 }, minHeight: { type: Number }, maxHeight: { type: Number }, minWidth: { type: Number }, maxWidth: { type: Number }, containment: { type: Object, default: null }, resizeable: { type: Boolean, default: !1 }, draggable: { type: Boolean, default: !1 }, dragHandle: { type: Object, default: null }, closedCallback: { type: Function, default: null }, resizeHandle: { type: Function, default: null }, 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: "" }, footerHeight: { type: Number, default: 60 }, host: { type: Object, default: "body" } }, Uo = Qt(Kt, _o, Wo, qo), Xo = Go(); class ae { 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 a = parseInt(o[4], 10), l = parseInt(o[5], 10); return { x: a, y: l }; } return { x: 0, y: 0 }; } static fromEvent(t, n = null) { if (this.isMouseEvent(t)) return new ae(t.clientX, t.clientY); if (n === null || t.changedTouches.length === 1) return new ae(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 ae(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 ae(0, 0); if (window) { const o = window.getComputedStyle(t); if (o) { const a = parseInt(o.getPropertyValue("left"), 10), l = parseInt(o.getPropertyValue("top"), 10); n.x = isNaN(a) ? 0 : a, n.y = isNaN(l) ? 0 : l; } return n; } return null; } static copy(t) { return new ae(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 Ue { constructor(t, n) { this.width = t, this.height = n; } static getCurrent(t) { const n = new Ue(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 Ue(0, 0).set(t); } set(t) { return this.width = t.width, this.height = t.height, this; } } function Yo(e, t) { const n = b(), o = b(), a = b(), l = b(), r = b(), s = b(), f = b(), i = b(), m = b(), c = b(), p = b(), d = b(e.resizeable), u = b(), g = b(e.draggable), S = b(!1); function O() { const I = o.value || document.body, D = window.getComputedStyle(I); if (!D || !n.value) return; const U = ae.getTransformInfo(n.value), V = {}; f.value && (V.deltaL = n.value.offsetLeft - f.value.x, V.deltaT = n.value.offsetTop - f.value.y); const ee = D.getPropertyValue("position"); V.width = I.clientWidth, V.height = I.clientHeight, V.pr = parseInt(D.getPropertyValue("padding-right"), 10), V.pb = parseInt(D.getPropertyValue("padding-bottom"), 10), V.position = D.getPropertyValue("position"), ee === "static" && (I.style.position = "relative"), V.translateX = U.x, V.translateY = U.y, c.value = V; } function R(I) { if (n.value) { l.value = Ue.getCurrent(n.value), r.value = ae.getCurrent(n.value), s.value = l.value ? Ue.copy(l.value) : null, f.value = r.value ? ae.copy(r.value) : null, O(); const D = I.target.getAttribute("type") || ""; i.value = { n: !!D.match(/n/), s: !!D.match(/s/), w: !!D.match(/w/), e: !!D.match(/e/) }; } } function A() { var I, D, U, V; if (n.value) { const ee = n.value; i.value && ((i.value.n || i.value.s) && ((I = s.value) != null && I.height) && (ee.style.height = s.value.height + "px"), (i.value.w || i.value.e) && ((D = s.value) != null && D.width) && (ee.style.width = s.value.width + "px"), f.value && ((U = f.value) != null && U.x && (ee.style.left = f.value.x + "px"), (V = f.value) != null && V.y && (ee.style.top = f.value.y + "px"))); } } function T() { const I = e.minHeight ? e.minHeight : 1, D = e.minWidth ? e.minWidth : 1; s.value && f.value && i.value && l.value && (s.value.height < I && (s.value.height = I, i.value.n && r.value && (f.value.y = r.value.y + (l.value.height - I))), s.value.width < D && (s.value.width = D, i.value.w && r.value && (f.value.x = r.value.x + (l.value.width - D))), e.maxHeight && s.value.height > e.maxHeight && (s.value.height = e.maxHeight, r.value && i.value.n && (f.value.y = r.value.y + (l.value.height - e.maxHeight))), e.maxWidth && s.value.width > e.maxWidth && (s.value.width = e.maxWidth, i.value.w && r.value && (f.value.x = r.value.x + (l.value.width - e.maxWidth)))); } function y() { if (o.value) { const I = c.value; if (f.value && s.value && i.value && l.value) { const D = I.width - I.pr - I.deltaL - I.translateX - f.value.x, U = I.height - I.pb - I.deltaT - I.translateY - f.value.y; i.value.n && f.value.y + I.translateY < 0 && r.value && (f.value.y = -I.translateY, s.value.height = l.value.height + r.value.y + I.translateY), i.value.w && f.value.x + I.translateX < 0 && r.value && (f.value.x = -I.translateX, s.value.width = l.value.width + r.value.x + I.translateX), s.value.width > D && (s.value.width = D), s.value.height > U && (s.value.height = U); } } } function h(I) { if (!a.value || !l.value || !r.value || !i.value) return; I.subtract(a.value); const D = I.x, U = I.y; i.value.n ? (f.value.y = r.value.y + U, s.value.height = l.value.height - U) : i.value.s && (s.value.height = l.value.height + U), i.value.e ? s.value.width = l.value.width + D : i.value.w && (s.value.width = l.value.width - D, f.value.x = r.value.x + D), y(), T(), A(); } function F(I) { if (!m.value) return; const D = ae.fromEvent(I); D && h(D); } function k() { if (n.value) { const { width: I, height: D, x: U, y: V } = n.value.getBoundingClientRect(), ee = ae.getTransformInfo(n.value); return { size: { width: I, height: D }, position: { x: U - ee.x, y: V - ee.y } }; } return null; } function x(I) { if (n.value) { const D = k(); p.value = D; } a.value = void 0, l.value = null, r.value = null, s.value = null, f.value = null, i.value = null, m.value = null, document.removeEventListener("mousemove", F), document.removeEventListener("mouseup", x); } function P() { document.addEventListener("mousemove", F), document.addEventListener("mouseup", x); } function v(I) { I instanceof MouseEvent && I.button === 2 || g.value && (document.body.click(), I.stopPropagation(), I.preventDefault(), a.value = ae.fromEvent(I), m.value = I.target, R(I), P()); } function B(I) { return n.value = I, d.value && w(Ye, null, [w("div", { class: "fv-resizable-handle fv-resizable-n", type: "n", onMousedown: (D) => v(D) }, null), w("div", { class: "fv-resizable-handle fv-resizable-e", type: "e", onMousedown: (D) => v(D) }, null), w("div", { class: "fv-resizable-handle fv-resizable-s", type: "s", onMousedown: (D) => v(D) }, null), w("div", { class: "fv-resizable-handle fv-resizable-w", type: "w", onMousedown: (D) => v(D) }, null), w("div", { class: "fv-resizable-handle fv-resizable-ne", type: "ne", onMousedown: (D) => v(D) }, null), w("div", { class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal", type: "se", onMousedown: (D) => v(D) }, null), w("div", { class: "fv-resizable-handle fv-resizable-sw", type: "sw", onMousedown: (D) => v(D) }, null), w("div", { class: "fv-resizable-handle fv-resizable-nw", type: "nw", onMousedown: (D) => v(D) }, null)]); } function M(I = !0) { document.body.click(); const D = o.value || document.body, U = Ue.getCurrent(D), V = n.value; I && V && (u.value = k(), u.value.transform = V.style.transform), U && V && (s.value = U, s.value.height -= 14, s.value.width -= 14, V.style.height = s.value.height + "px", V.style.width = s.value.width + "px", V.style.left = "7px", V.style.top = "7px", V.style.transform = "", p.value = { size: s.value, position: { x: 0, y: 0 } }, g.value = !1, S.value = !0); } function E() { var I, D; if (document.body.click(), u.value) { const U = { width: u.value.size.width || 0, height: u.value.size.height || 0 }, V = { x: (window.innerWidth - U.width) / 2, y: (window.innerHeight - U.height) / 2 }; (I = s.value) == null || I.set(U), (D = f.value) == null || D.set(V); const ee = n.value; ee.style.height = U.height + "px", ee.style.width = U.width + "px", ee.style.left = `${V.x}px`, ee.style.top = `${V.y}px`, ee.style.transform = "", p.value = { size: U, position: V }, g.value = e.draggable, S.value = !1; } } function L() { if (n.value) { const I = Ue.getCurrent(n.value); if (I) { const { width: D, height: U } = I; n.value.style.left = `${(window.innerWidth - D) / 2}px`, n.value.style.top = `${(window.innerHeight - U) / 2}px`, n.value.style.transform = ""; } } } function G() { const I = () => { S.value ? M(!1) : L(), document.body.click(); }; return window.addEventListener("resize", I), () => { window.removeEventListener("resize", I); }; } const K = G(); return { renderResizeBar: B, boundingElement: o, resizedEventParam: p, maximize: M, restore: E, allowDrag: g, isMaximized: S, unWindowResizeHandle: K, moveToCenter: L }; } function Jo(e, t, n) { const o = b(), a = b(e.draggable), l = b(e.lockAxis), r = b(), s = b(), f = b(!1), i = b(new ae(0, 0)), m = b(new ae(0, 0)), c = b(new ae(0, 0)), p = b(new ae(0, 0)); fe(() => n.value, (F) => { r.value.style.cursor = F ? "move" : "default"; }); function d(F, k) { if (k.tagName === "BUTTON") return !1; if (k === F) return !0; for (const x in k.children) if (Object.prototype.hasOwnProperty.call(k.children, x) && d(F, k.children[x])) return !0; return !1; } function u() { var P, v; let F = c.value.x + m.value.x, k = c.value.y + m.value.y; l.value === "x" ? (F = ((P = i.value) == null ? void 0 : P.x) || 0, c.value.x = 0) : l.value === "y" && (k = ((v = i.value) == null ? void 0 : v.y) || 0, c.value.y = 0); const x = `translate3d(${Math.round(F)}px, ${Math.round(k)}px, 0px)`; o.value && (o.value.style.transform = x), p.value.x = F, p.value.y = k; } function g() { if (!s.value || !o.value) return null; const F = s.value.getBoundingClientRect(), k = o.value.getBoundingClientRect(), x = { top: F.top < k.top, right: F.right > k.right, bottom: F.bottom > k.bottom, left: F.left < k.left }; return x.top || (c.value.y -= k.top - F.top), x.bottom || (c.value.y -= k.bottom - F.bottom), x.right || (c.value.x -= k.right - F.right), x.left || (c.value.x -= k.left - F.left), u(), x; } function S(F) { F && (i.value && F.subtract(i.value), c.value.set(F), u(), g()); } function O(F) { f.value && a.value && (F.stopPropagation(), F.preventDefault(), S(ae.fromEvent(F, r.value))); } function R() { var F; f.value && (f.value = !1, m.value.add(c.value), c.value.reset(), (F = o.value) == null || F.classList.remove("ng-dragging"), t.emit("stopMove"), document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", R)); } function A() { !f.value && r.value && (f.value = !0, r.value.classList.add("ng-dragging"), document.addEventListener("mousemove", O), document.addEventListener("mouseup", R)); } function T() { if (o.value) { const F = ae.getTransformInfo(o.value); m.value.set(F); return; } m.value.reset(); } function y(F) { if (!n.value || F instanceof MouseEvent && F.button === 2) return; const k = F.target || F.srcElement; r.value !== void 0 && k && !d(k, r.value) || a.value !== !1 && (document.body.click(), F.stopPropagation(), F.preventDefault(), i.value = ae.fromEvent(F, o.value), T(), A()); } function h(F, k, x) { if (a.value && k) { if (F) r.value = F; else if (e.dragHandle) { if (e.dragHandle instanceof HTMLElement) r.value = e.dragHandle; else if (typeof e.dragHandle == "string") { const P = k.querySelector(e.dragHandle); P && (r.value = P); } } o.value = k, s.value = x, r.value ? (r.value.classList.add("ng-draggable"), r.value.addEventListener("mousedown", y)) : a.value = !1; } } return { registerDraggle: h, resetTranslate: T }; } function en(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 Qo(e, t) { const n = b(e.enableEsc); let o = null; return n.value ? (o = en("Escape", (a) => { t.emit("esc", { event: a.event, type: "esc" }); }), { remove: o }) : null; } function Zo(e, t) { const n = b(e.enableEnter); let o = null; return n.value ? (o = en("Enter", (a) => { t.emit("enter", { event: a.event, type: "enter" }); }), { remove: o }) : null; } const Xe = /* @__PURE__ */ Oe({ name: "FModal", props: Kt, emits: ["update:modelValue", "accept", "cancel", "closed", "resize", "esc", "enter", "stopMove"], setup(e, t) { const n = b(e.width || 300), o = b(e.height || 200), a = b(e.modelValue), l = b(""), r = b(e.class), s = b(e.fitContent), f = b(e.showHeader), i = b(""), m = b(e.showCloseButton), c = b(e.showMaxButton), p = b(!1), d = b(e.dialogType), u = b(e.src), g = b(""), S = b(e.showButtons), O = b(e.title), R = b(e.containment || null), A = b(), { t: T } = It(); O.value === "错误提示" && (O.value = T("messageBox.errorTitle")); const y = b(!1); function h(j, J) { const re = J ? "accept" : "cancel"; Promise.resolve().then(() => { var le; return (le = e.beforeClose) == null ? void 0 : le.call(e, { closeType: re }); }).then((le) => { le && (a.value = !1, t.emit("update:modelValue", !1), J != null && t.emit(J ? "accept" : "cancel"), t.emit("closed", j)); }); } const F = [{ name: "cancel", text: T("messageBox.cancel") || "取消", class: "btn btn-secondary", handle: (j) => { h(j, !1); } }, { name: "accept", text: T("messageBox.ok") || "确定", class: "btn btn-primary", handle: (j) => { h(j, !0); } }], k = b(e.buttons && e.buttons.length ? e.buttons : F), x = N(() => !!i.value), P = N(() => !!S.value && !!k.value), v = b(), B = b(), M = b(!1), { renderResizeBar: E, maximize: L, restore: G, boundingElement: K, resizedEventParam: I, allowDrag: D, unWindowResizeHandle: U, moveToCenter: V } = Yo(e), { registerDraggle: ee } = Jo(e, t, D); function ve() { return !!document.querySelectorAll(".farris-modal").length && document.body.classList.contains("modal-open"); } function he() { const j = document.querySelectorAll(".farris-modal").length; (!j || j - 1 <= 0) && document.body.classList.remove("modal-open"), A.value && A.value.classList.remove("show"); } fe(() => e.title, (j, J) => { j !== J && (O.value = j); }), fe(() => e.modelValue, (j, J) => { j !== J && (a.value = j, a.value && e.draggable && et(() => { B.value && !R.value && (R.value = B.value.parentElement, K.value = R.value, ee(v.value, B.value, K.value), V()); }), j || (R.value && (R.value = null), he())), a.value ? y.value = ve() : (M.value = !1, D.value = e.draggable); }), fe(() => e.showHeader, (j, J) => { j !== J && (f.value = j); }), fe(() => e.showButtons, (j, J) => { j !== J && (S.value = j); }), fe(() => I.value, (j, J) => { const re = j || {}, le = J || {}; JSON.stringify(re) !== JSON.stringify(le) && t.emit("resize", { newSize: j, oldSize: J, isMaximized: M.value }); }); const Y = N(() => (a.value && document.body.classList.add("modal-open"), a.value)), oe = N(() => { var re; const j = { modal: !0, "farris-modal": !0, fade: !0 }; j["f-modal-fitContent"] = !!s.value, j.show = !!Y.value; const J = (re = e.maskClass) == null ? void 0 : re.split(" "); return J == null || J.reduce((le, Ne) => (le[Ne] = !0, le), j), j; }), ie = N(() => { var re; const j = { "modal-dialog": !0 }, J = (re = r.value) == null ? void 0 : re.split(" "); return J == null || J.reduce((le, Ne) => (le[Ne] = !0, le), j), j; }), te = N(() => { const j = { position: "absolute", top: `${(window.innerHeight - o.value) / 2}px`, left: `${(window.innerWidth - n.value) / 2}px`, width: `${n.value}px`, height: s.value ? "auto" : `${o.value}px` }; return e.mask || (j.pointerEvents = "auto"), j; }), W = N(() => { const j = { display: "block" }; return e.mask || (j.pointerEvents = "none", j.backgroundColor = "transparent"), y.value && (j.backgroundColor = "transparent"), j; }), ne = N(() => ({ "modal-content": !0, "modal-content-has-header": f.value })), $e = N(() => { const j = { display: f.value ? "" : "none" }; return j["pointer-events"] = D.value ? "auto" : "none", j; }), Ee = N(() => ({ "f-icon": !0, modal_maximize: !0, modalrevert: M.value })), Se = N(() => ({ "modal-body": !0, "f-utils-flex-column": d.value === "iframe", "f-utils-fill": !0 })); function Qe() { return { height: `${e.footerHeight || 60}px` }; } const ze = N(() => { const j = { textAlgin: g.value }, J = Qe(); return Object.assign(j, J); }); function Ae(j) { if (j == null || j.stopPropagation(), M.value) { M.value = !1, G(); return; } L(), M.value = !0; } async function se(j, J) { j.handle && await j.handle(J, j) && t.emit("closed", J); } function nt(j) { j.width && (n.value = j.width), j.height && (o.value = j.height), j.buttons && (k.value = j.buttons), j.title && (O.value = j.title); } let Te = null, Re = null; En(() => { y.value = ve(); }), Je(() => { B.value && !R.value && (R.value = B.value.parentElement, K.value = R.value, ee(v.value, B.value, K.value)), Y.value && document.body.classList.add("modal-open"), Te = Qo(e, t), Re = Zo(e, t); }), ut(() => { U && U(), Te && Te.remove(), Re && Re.remove(); }), t.expose({ modalElementRef: B, updateModalOptions: nt, close: h, maxDialog: Ae, isMaximized: M }); function je() { return w("ul", null, [p.value && w("li", { class: "f-btn-icon f-bare" }, [w("span", { class: "f-icon modal_minimize" }, null)]), c.value && w("li", { onClick: Ae, class: "f-btn-icon f-bare", style: "pointer-events: auto;" }, [w("span", { class: Ee.value }, null)]), m.value && w("li", { class: "f-btn-icon f-bare", onClick: (j) => h(j, !1), style: "pointer-events: auto;" }, [w("span", { class: "f-icon modal_close" }, null)])]); } function Pe() { return w("div", { class: "modal-footer", style: ze.value }, [k.value && k.value.map((j) => { const J = b(j.disabled); return w("button", { name: j.name, type: "button", disabled: J.value, class: j.class + (j.iconClass ? " btn-icontext" : ""), onClick: (re) => { se(j, re); } }, [!!j.iconClass && w("i", { class: j.iconClass }, null), j.text]); })]); } function ot() { return w("div", { ref: v, class: "modal-header", style: $e.value }, [t.slots.headerTemplate ? t.slots.headerTemplate() : w("div", { class: "modal-title" }, [x.value && w("span", { class: i.value, style: "margin-right: 8px" }, null), w("span", { class: "modal-title-label" }, [O.value])]), w("div", { class: "actions" }, [je()])]); } function Ve() { return t.slots.footerTemplate ? t.slots.footerTemplate() : P.value && Pe(); } function Me(j) { if (j.stopPropagation(), e.allowClickMaskToClose) { if (j.target !== A.value) return; h(j, !1); } } function De() { var j, J; return w("div", { id: l.value, class: ie.value, style: te.value, ref: B }, [w("div", { class: ne.value }, [f.value && ot(), w("div", { class: Se.value }, [(J = (j = t.slots).default) == null ? void 0 : J.call(j), d.value === "iframe" && w("iframe", { title: l.value, class: "f-utils-fill", width: "100%", frameborder: "0", src: u.value }, null)]), Ve()]), !s.value && B.value && !M.value && E(B.value)]); } function Ze(j) { return j || "body"; } return () => w(Ut, { to: Ze(e.host) }, { default: () => [Y.value && w(Xt, { name: "fade", appear: !0 }, { default: () => [w("div", { ref: A, class: oe.value, style: W.value, onClick: Me }, [De()])] })] }); } }); function tn(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Ko(e) { const t = document.createElement("div"); t.style.display = "contents"; const n = Nt({ setup(o, a) { ut(() => { document.body.removeChild(t); }); const l = b(), r = b(e.class || ""), s = b(!!e.showButtons), f = b(!!e.showHeader), i = b(e.showCloseButton == null ? !0 : e.showCloseButton), m = b(!0), c = b(e.title || ""), p = e.acceptCallback || (() => { }), d = e.rejectCallback || (() => { }), u = e.closedCallback || ((A) => { }), g = e.resizeHandle || ((A) => { }), S = e.stopMoveHandle || ((A) => { }), O = tn(e), R = (A) => { m.value = !1, n.unmount(), u(A); }; return Je(() => { }), a.expose({ modalRef: l }), () => w(Xe, { ref: l, class: r.value, modelValue: m.value, "onUpdate:modelValue": (A) => m.value = A, title: c.value, width: e.width, height: e.height, buttons: e.buttons, "show-header": f.value, "show-buttons": s.value, "show-close-button": i.value, "show-max-button": !1, onAccept: p, onCancel: d, fitContent: e.fitContent == null ? !0 : e.fitContent, onClosed: R, onResize: g, onStopMove: S }, { default: () => [O && O(n)] }); } }); return document.body.appendChild(t), n.use(gt.i18n), n.mount(t), n; } class nn { constructor(t) { ye(this, "appContext", null); ye(this, "modalRef", b()); ye(this, "activeModalIndex", b(0)); ye(this, "modalRefs", {}); ye(this, "isUseEscCloseModal", b(!1)); ye(this, "activeModalInstance", N(() => this.modalRefs[this.activeModalIndex.value])); this.app = t, this.appContext = t ? t._context : null; } getCurrentModal() { return this.activeModalInstance.value; } adaptToWindow(t, n) { const { width: o, height: a } = { width: window.innerWidth, height: window.innerHeight }; return o < t && (t = o - 14), a < n && (n = a - 14), { width: t, height: n }; } static show(t) { const n = Object.assign({ title: "", showButtons: !0, showHeader: !0 }, t); return Ko(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 = Rn(Object.assign({ title: "", showButtons: !0, showHeader: !0 }, t)), a = b(!0), l = o.value.acceptCallback || (() => { }), r = o.value.rejectCallback || (() => { }), s = o.value.closedCallback || ((y, h) => { }), f = o.value.resizeHandle || ((y) => { }), i = t.stopMoveHandle || ((y) => { }); let m; const c = tn(o.value), p = (y) => { var F; a.value = !1; const h = (F = y == null ? void 0 : y.target) == null ? void 0 : F.classList.contains("modal_close"); s(y, this.isUseEscCloseModal.value ? "esc" : h ? "icon" : "button"); }, d = (y) => { p(y), m && et(() => { if (this.modalRefs[this.activeModalIndex.value] && delete this.modalRefs[this.activeModalIndex.value], Rt(null, n), m = null, this.modalRef.value = null, this.modalRefs) { const h = Object.keys(this.modalRefs).map((F) => Number(F)); h.length > 0 ? this.activeModalIndex.value = Math.max(...h) : this.activeModalIndex.value = 0; } this.isUseEscCloseModal.value = !1; }); }, u = (y) => { var h; this.isUseEscCloseModal.value = !0, this.activeModalInstance && ((h = this.activeModalInstance.value) == null || h.close(y == null ? void 0 : y.event)); }, { width: g, height: S } = o.value, O = this.adaptToWindow(g || 500, S || 320); Object.assign(o.value, O); const R = () => w(Xe, ht({ ref: this.modalRef, modelValue: a.value, "onUpdate:modelValue": (y) => a.value = y }, o.value, { onAccept: l, onCancel: r, onClosed: d, onResize: f, onEsc: u, onStopMove: i }), { default: () => [c && c(this.app)] }); return m = ((y) => { const h = jn(R, y); return h.appContext = this.appContext, Rt(h, n), h; })({ ...o.value // 'onUpdate:modelValue': onUpdateModelValue, }), this.activeModalIndex.value++, this.modalRefs[this.activeModalIndex.value] = this.modalRef.value, { update: (y) => { o.value = { ...o.value, ...y }, m && Rt(Pn(m, { ...o }), n); }, destroy: d, modalRef: this.activeModalInstance, close: () => this.close() }; } } function ea(e = {}) { function t(i, m, c, p) { if (typeof c == "number") return p[i].length === c; if (typeof c == "object") { const d = Object.keys(c)[0], u = c[d]; if (d === "not") return Number(p[i].length) !== Number(u); if (d === "moreThan") return Number(p[i].length) >= Number(u); if (d === "lessThan") return Number(p[i].length) <= Number(u); } return !1; } function n(i, m, c, p) { return p[i] && p[i].propertyValue && String(p[i].propertyValue.value) === String(c); } const o = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((i, m) => (i.set(m, e[m]), i), o); function a(i, m) { const c = i; return typeof m == "number" ? [{ target: c, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: c, operator: "getProperty", param: i, value: !!m }] : typeof m == "object" ? Object.keys(m).map((p) => { if (p === "length") return { target: c, operator: "length", param: null, value: m[p] }; const d = p, u = m[p]; return { target: c, operator: "getProperty", param: d, value: u }; }) : []; } function l(i) { return Object.keys(i).reduce((c, p) => { const d = a(p, i[p]); return c.push(...d), c; }, []); } function r(i, m) { if (o.has(i.operator)) { const c = o.get(i.operator); return c && c(i.target, i.param, i.value, m) || !1; } return !1; } function s(i, m) { return l(i).reduce((d, u) => d && r(u, m), !0); } function f(i, m) { const c = Object.keys(i), p = c.includes("allOf"), d = c.includes("anyOf"), u = p || d, O = (u ? i[u ? p ? "allOf" : "anyOf" : "allOf"] : [i]).map((A) => s(A, m)); return p ? !O.includes(!1) : O.includes(!0); } return { parseValueSchema: f }; } const ta = { convertTo: (e, t, n, o) => { e.appearance || (e.appearance = {}), e.appearance[t] = n; }, convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t] }, na = { convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, oa = { 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] }, $ = { button: { type: "button", name: "按钮" }, "response-toolbar": { type: "response-toolbar", name: "工具栏" }, "response-toolbar-item": { type: "response-toolbar-item", name: "按钮" }, "content-container": { type: "content-container", 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: "标签页工具栏按钮" }, "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: "标签页工具栏" }, 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: "列表导航" }, "list-view": { type: "list-view", name: "列表" }, "filter-bar": { type: "filter-bar", name: "筛选条" }, "language-textbox": { type: "language-textbox", name: "多语输入框" } }, aa = { convertFrom: (e, t, n) => { var a; const o = e.editor && e.editor[t] ? e.editor[t] : e[t]; return ((a = $[o]) == null ? void 0 : a.name) || o; } }, ra = { convertTo: (e, t, n, o) => { e[t] = e[t]; }, convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : "" }, la = { 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 === "tempDateFormat") return e.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : e.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : e.formatter.tempDateFormat || e.formatter.dateFormat || "yyyy-MM-dd"; if (t === "customFormat") return e.formatter.customFormat; if (t === "type") return e.formatter.type || "none"; } return "none"; } }, ia = { convertTo: (e, t, n, o) => { e.command ? e.command[t] = n : e.command = { [t]: n }, t === "enable" && n && (e.command.commands || (e.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ])); }, convertFrom: (e, t, n) => e.command && t === "enable" ? e.command.enable : "" }, sa = { convertTo: (e, t, n, o) => { e.column ? e.column[t] = n : e.column = { [t]: n }, t === "fitColumns" && n && (e.column.fitMode || (e.column.fitMode = "average")); }, convertFrom: (e, t, n) => { if (e.column) { if (t === "fitColumns") return e.column.fitColumns; if (t === "fitMode") return e.column.fitMode; } return ""; } }, ua = { 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) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : "" }, ca = { convertTo: (e, t, n, o) => { e.group ? e.group[t] = n : e.group = { [t]: n }, t === "enable" && n && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = { enable: n, groupFields: [], showSummary: !1 }); }, convertFrom: (e, t, n) => { if (e.group) { if (t === "enable") return e.group.enable; if (t === "showSummary") return e.group.showSummary; } } }, da = { convertFrom: (e, t) => e.binding ? e.binding.path : "", convertTo: (e, t, n) => { if (n && n.length > 0) { const o = n[0]; e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = o.bindingField, e.binding.field = o.id, e.binding.fullPath = o.path, e.path = o.bindingPath;