UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,511 lines 170 kB
var En = Object.defineProperty; var Rn = (e, t, n) => t in e ? En(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var he = (e, t, n) => Rn(e, typeof t != "symbol" ? t + "" : t, n); import { getCustomClass as Dt, withInstall as Jt, FormSchemaEntityField$Type as Gt, FormSchemaEntityFieldTypeName as Ut } from "../../components/common/index.esm.js"; import { resolveAppearance as Qt, createPropsResolver as It, getSchemaByTypeForDesigner as jn } from "../../components/dynamic-resolver/index.esm.js"; import Dn, { buttonEditProps as Pn } from "../../components/button-edit/index.esm.js"; import { defineComponent as Me, ref as g, computed as z, createVNode as w, Teleport as Zt, createApp as $t, onUnmounted as ut, Fragment as st, watch as Ce, nextTick as Ze, onBeforeMount as Nn, onMounted as et, Transition as Kt, shallowRef as In, render as jt, h as $n, cloneVNode as Hn, mergeProps as ht, reactive as He, createTextVNode as Ln, inject as Ht } from "vue"; import { useI18n as Lt } from "vue-i18n"; import { LocaleService as gt } from "../../components/locale/index.esm.js"; import { cloneDeep as Pt, isPlainObject as Xt, isUndefined as Ie } from "lodash-es"; import "../../components/accordion/index.esm.js"; import "../../components/avatar/index.esm.js"; import "../button-edit/index.esm.js"; import "../../components/button-group/index.esm.js"; import "../../components/calendar/index.esm.js"; import "../../components/capsule/index.esm.js"; import "../checkbox/index.esm.js"; import "../checkbox-group/index.esm.js"; import "../../components/combo-list/index.esm.js"; import "../../components/combo-tree/index.esm.js"; import "../../components/component/index.esm.js"; import "../../components/color-picker/index.esm.js"; import "../../components/content-container/index.esm.js"; import "../../components/date-picker/index.esm.js"; import "../data-grid/index.esm.js"; import "../../components/dropdown/index.esm.js"; import "../../components/dynamic-form/index.esm.js"; import "../../components/events-editor/index.esm.js"; import "../../components/filter-bar/index.esm.js"; import "../../components/field-selector/index.esm.js"; import "../../components/binding-selector/index.esm.js"; import "../../components/image-cropper/index.esm.js"; import "../input-group/index.esm.js"; import "../../components/layout/index.esm.js"; import "../../components/list-nav/index.esm.js"; import "../list-view/index.esm.js"; import "../../components/lookup/index.esm.js"; import "../../components/mapping-editor/index.esm.js"; import "../../components/nav/index.esm.js"; import "../../components/number-range/index.esm.js"; import "../../components/number-spinner/index.esm.js"; import "../../components/order/index.esm.js"; import "../../components/page-header/index.esm.js"; import "../../components/page-footer/index.esm.js"; import "../../components/pagination/index.esm.js"; import "../../components/progress/index.esm.js"; import "../../components/query-solution/index.esm.js"; import "../radio-group/index.esm.js"; import "../../components/rate/index.esm.js"; import "../../components/response-toolbar/index.esm.js"; import "../../components/response-layout/index.esm.js"; import "../../components/response-layout-editor/index.esm.js"; import "../../components/search-box/index.esm.js"; import "../../components/section/index.esm.js"; import "../../components/smoke-detector/index.esm.js"; import "../../components/splitter/index.esm.js"; import "../../components/step/index.esm.js"; import "../../components/switch/index.esm.js"; import "../../components/tabs/index.esm.js"; import "../../components/tags/index.esm.js"; import "../../components/text/index.esm.js"; import "../../components/time-picker/index.esm.js"; import "../../components/transfer/index.esm.js"; import "../../components/tree-view/index.esm.js"; import "../../components/uploader/index.esm.js"; import "../../components/verify-detail/index.esm.js"; import "../../components/video/index.esm.js"; import "../../components/textarea/index.esm.js"; import "../../components/schema-selector/index.esm.js"; import "../tree-grid/index.esm.js"; import "../../components/event-parameter/index.esm.js"; import "../../components/filter-condition-editor/index.esm.js"; import "../../components/fieldset/index.esm.js"; import "../../components/sort-condition-editor/index.esm.js"; import "../../components/menu-lookup/index.esm.js"; import "../drawer/index.esm.js"; import "../../components/json-editor/index.esm.js"; import "../../components/property-editor/index.esm.js"; import "../../components/expression-editor/index.esm.js"; import "../../components/code-editor/index.esm.js"; import "../../components/html-template/index.esm.js"; import "../../components/collection-property-editor/index.esm.js"; import "../../components/modal/index.esm.js"; import "../../components/external-container/index.esm.js"; import "../../components/language-textbox/index.esm.js"; import { useDesignerComponent as zn } from "../../components/designer-canvas/index.esm.js"; import { useResizeObserver as An } from "@vueuse/core"; import { getHierarchyRow as Vn, useIdentify as _n, useGroupData as qn, useFilter as Wn, useHierarchy as Gn, useLoading as Un, useDataView as Xn, useSelection as Yn, useSelectHierarchyItem as Jn, usePagination as Qn, useDataViewContainerStyle as Zn, useCommandColumn as Kn, useSettingColumn as eo, useColumn as to, useSort as no, useGroupColumn as oo, useRow as ro, useEdit as ao, useVisualDataBound as io, useVisualDataCell as lo, useVisualDataRow as so, useVisualData as uo, useCellPosition as co, useSidebar as fo, useVirtualScroll as po, useFitColumn as mo, useFilterHistory as vo, useColumnFilter as yo, useDragColumn as ho, getColumnHeader as go, getSidebar as bo, getDisableMask as wo, getHorizontalScrollbar as Co, getVerticalScrollbar as So, getEmpty as To, getPagination as xo, getSummary as Bo } from "../../components/data-view/index.esm.js"; import "../../components/property-panel/index.esm.js"; import "../../components/notify/index.esm.js"; const ko = { /** * 组件标识 */ 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 } }, Fo = { popupContentPosition: { type: Object, default: { left: 0, top: 0 } }, host: { type: Object }, backgroundColor: { type: String, default: "" } }, Oo = /* @__PURE__ */ Me({ name: "FOverlay", props: Fo, emits: ["click"], setup(e, t) { const n = g(e.popupContentPosition), o = g(e.host), r = z(() => ({ backgroundColor: e.backgroundColor || "", pointerEvents: "auto" })); function i(u) { t.emit("click"), u.preventDefault(), u.stopPropagation(); } z(() => { const u = o.value; if (u) { const d = u.getBoundingClientRect(), { left: l, top: m, height: c } = d; return { left: l, top: m + c }; } return n.value; }); const a = z(() => ({ // position: 'relative', // left: `${position.value.left}px`, // top: `${position.value.top}px` })); return () => w(Zt, { to: "body" }, { default: () => { var u, d; return [w("div", { class: "overlay-container", onClick: (l) => i(l), style: r.value }, [w("div", { style: a.value }, [(d = (u = t.slots).default) == null ? void 0 : d.call(u)])])]; } }); } }); function Mo(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Eo(e) { const t = document.createElement("div"); t.style.display = "contents"; let n; const o = e.onClickCallback || (() => { }), r = () => { o(), n && n.unmount(); }; return n = $t({ setup() { ut(() => { document.body.removeChild(t); }); const i = Mo(e); return () => w(Oo, { "popup-content-position": e.popupPosition, host: e.host, onClick: r, backgroundColor: e.backgroundColor }, { default: () => [i && i()] }); } }), document.body.appendChild(t), n.mount(t), n; } class Ro { static show(t) { return Eo(t); } } const jo = "https://json-schema.org/draft/2020-12/schema", Do = "https://farris-design.gitee.io/modal.schema.json", Po = "modal", No = "弹窗组件", Io = "object", $o = { 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 } }, Ho = [ "id", "type" ], Lo = { onAccept: "确定事件", onCancel: "取消事件", beforeClose: "关闭前回调" }, zo = { $schema: jo, $id: Do, title: Po, description: No, type: Io, properties: $o, required: Ho, events: Lo }, Ao = /* @__PURE__ */ new Map([ ["appearance", Qt] ]); function Vo(e, t, n) { return t; } function _o() { function e(t, n) { const o = {}; return o.beforeClose = (r) => n.call("beforeClose", [r, t]), o; } return { resolve: e }; } const en = { /** * 允许点击遮罩关闭对话框 */ 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" } }, qo = It(en, zo, Ao, Vo), Wo = _o(); class re { 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), i = parseInt(o[5], 10); return { x: r, y: i }; } return { x: 0, y: 0 }; } static fromEvent(t, n = null) { if (this.isMouseEvent(t)) return new re(t.clientX, t.clientY); if (n === null || t.changedTouches.length === 1) return new re(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 re(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 re(0, 0); if (window) { const o = window.getComputedStyle(t); if (o) { const r = parseInt(o.getPropertyValue("left"), 10), i = parseInt(o.getPropertyValue("top"), 10); n.x = isNaN(r) ? 0 : r, n.y = isNaN(i) ? 0 : i; } return n; } return null; } static copy(t) { return new re(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 Ge { constructor(t, n) { this.width = t, this.height = n; } static getCurrent(t) { const n = new Ge(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 Ge(0, 0).set(t); } set(t) { return this.width = t.width, this.height = t.height, this; } } function Go(e, t) { const n = g(), o = g(), r = g(), i = g(), a = g(), u = g(), d = g(), l = g(), m = g(), c = g(), p = g(), s = g(e.resizeable), f = g(), v = g(e.draggable), B = g(!1); function M() { const N = o.value || document.body, R = window.getComputedStyle(N); if (!R || !n.value) return; const U = re.getTransformInfo(n.value), A = {}; d.value && (A.deltaL = n.value.offsetLeft - d.value.x, A.deltaT = n.value.offsetTop - d.value.y); const ee = R.getPropertyValue("position"); A.width = N.clientWidth, A.height = N.clientHeight, A.pr = parseInt(R.getPropertyValue("padding-right"), 10), A.pb = parseInt(R.getPropertyValue("padding-bottom"), 10), A.position = R.getPropertyValue("position"), ee === "static" && (N.style.position = "relative"), A.translateX = U.x, A.translateY = U.y, c.value = A; } function j(N) { if (n.value) { i.value = Ge.getCurrent(n.value), a.value = re.getCurrent(n.value), u.value = i.value ? Ge.copy(i.value) : null, d.value = a.value ? re.copy(a.value) : null, M(); const R = N.target.getAttribute("type") || ""; l.value = { n: !!R.match(/n/), s: !!R.match(/s/), w: !!R.match(/w/), e: !!R.match(/e/) }; } } function _() { var N, R, U, A; if (n.value) { const ee = n.value; l.value && ((l.value.n || l.value.s) && ((N = u.value) != null && N.height) && (ee.style.height = u.value.height + "px"), (l.value.w || l.value.e) && ((R = u.value) != null && R.width) && (ee.style.width = u.value.width + "px"), d.value && ((U = d.value) != null && U.x && (ee.style.left = d.value.x + "px"), (A = d.value) != null && A.y && (ee.style.top = d.value.y + "px"))); } } function T() { const N = e.minHeight ? e.minHeight : 1, R = e.minWidth ? e.minWidth : 1; u.value && d.value && l.value && i.value && (u.value.height < N && (u.value.height = N, l.value.n && a.value && (d.value.y = a.value.y + (i.value.height - N))), u.value.width < R && (u.value.width = R, l.value.w && a.value && (d.value.x = a.value.x + (i.value.width - R))), e.maxHeight && u.value.height > e.maxHeight && (u.value.height = e.maxHeight, a.value && l.value.n && (d.value.y = a.value.y + (i.value.height - e.maxHeight))), e.maxWidth && u.value.width > e.maxWidth && (u.value.width = e.maxWidth, l.value.w && a.value && (d.value.x = a.value.x + (i.value.width - e.maxWidth)))); } function y() { if (o.value) { const N = c.value; if (d.value && u.value && l.value && i.value) { const R = N.width - N.pr - N.deltaL - N.translateX - d.value.x, U = N.height - N.pb - N.deltaT - N.translateY - d.value.y; l.value.n && d.value.y + N.translateY < 0 && a.value && (d.value.y = -N.translateY, u.value.height = i.value.height + a.value.y + N.translateY), l.value.w && d.value.x + N.translateX < 0 && a.value && (d.value.x = -N.translateX, u.value.width = i.value.width + a.value.x + N.translateX), u.value.width > R && (u.value.width = R), u.value.height > U && (u.value.height = U); } } } function h(N) { if (!r.value || !i.value || !a.value || !l.value) return; N.subtract(r.value); const R = N.x, U = N.y; l.value.n ? (d.value.y = a.value.y + U, u.value.height = i.value.height - U) : l.value.s && (u.value.height = i.value.height + U), l.value.e ? u.value.width = i.value.width + R : l.value.w && (u.value.width = i.value.width - R, d.value.x = a.value.x + R), y(), T(), _(); } function k(N) { if (!m.value) return; const R = re.fromEvent(N); R && h(R); } function x() { if (n.value) { const { width: N, height: R, x: U, y: A } = n.value.getBoundingClientRect(), ee = re.getTransformInfo(n.value); return { size: { width: N, height: R }, position: { x: U - ee.x, y: A - ee.y } }; } return null; } function S(N) { if (n.value) { const R = x(); p.value = R; } r.value = void 0, i.value = null, a.value = null, u.value = null, d.value = null, l.value = null, m.value = null, document.removeEventListener("mousemove", k), document.removeEventListener("mouseup", S); } function E() { document.addEventListener("mousemove", k), document.addEventListener("mouseup", S); } function C(N) { N instanceof MouseEvent && N.button === 2 || v.value && (document.body.click(), N.stopPropagation(), N.preventDefault(), r.value = re.fromEvent(N), m.value = N.target, j(N), E()); } function F(N) { return n.value = N, s.value && w(st, null, [w("div", { class: "fv-resizable-handle fv-resizable-n", type: "n", onMousedown: (R) => C(R) }, null), w("div", { class: "fv-resizable-handle fv-resizable-e", type: "e", onMousedown: (R) => C(R) }, null), w("div", { class: "fv-resizable-handle fv-resizable-s", type: "s", onMousedown: (R) => C(R) }, null), w("div", { class: "fv-resizable-handle fv-resizable-w", type: "w", onMousedown: (R) => C(R) }, null), w("div", { class: "fv-resizable-handle fv-resizable-ne", type: "ne", onMousedown: (R) => C(R) }, null), w("div", { class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal", type: "se", onMousedown: (R) => C(R) }, null), w("div", { class: "fv-resizable-handle fv-resizable-sw", type: "sw", onMousedown: (R) => C(R) }, null), w("div", { class: "fv-resizable-handle fv-resizable-nw", type: "nw", onMousedown: (R) => C(R) }, null)]); } function D(N = !0) { document.body.click(); const R = o.value || document.body, U = Ge.getCurrent(R), A = n.value; N && A && (f.value = x(), f.value.transform = A.style.transform), U && A && (u.value = U, u.value.height -= 14, u.value.width -= 14, A.style.height = u.value.height + "px", A.style.width = u.value.width + "px", A.style.left = "7px", A.style.top = "7px", A.style.transform = "", p.value = { size: u.value, position: { x: 0, y: 0 } }, v.value = !1, B.value = !0); } function P() { var N, R; if (document.body.click(), f.value) { const U = { width: f.value.size.width || 0, height: f.value.size.height || 0 }, A = { x: (window.innerWidth - U.width) / 2, y: (window.innerHeight - U.height) / 2 }; (N = u.value) == null || N.set(U), (R = d.value) == null || R.set(A); const ee = n.value; ee.style.height = U.height + "px", ee.style.width = U.width + "px", ee.style.left = `${A.x}px`, ee.style.top = `${A.y}px`, ee.style.transform = "", p.value = { size: U, position: A }, v.value = e.draggable, B.value = !1; } } function H() { if (n.value) { const N = Ge.getCurrent(n.value); if (N) { const { width: R, height: U } = N; n.value.style.left = `${(window.innerWidth - R) / 2}px`, n.value.style.top = `${(window.innerHeight - U) / 2}px`, n.value.style.transform = ""; } } } function G() { const N = () => { B.value ? D(!1) : H(), document.body.click(); }; return window.addEventListener("resize", N), () => { window.removeEventListener("resize", N); }; } const K = G(); return { renderResizeBar: F, boundingElement: o, resizedEventParam: p, maximize: D, restore: P, allowDrag: v, isMaximized: B, unWindowResizeHandle: K, moveToCenter: H }; } function Uo(e, t, n) { const o = g(), r = g(e.draggable), i = g(e.lockAxis), a = g(), u = g(), d = g(!1), l = g(new re(0, 0)), m = g(new re(0, 0)), c = g(new re(0, 0)), p = g(new re(0, 0)); Ce(() => n.value, (k) => { a.value.style.cursor = k ? "move" : "default"; }); function s(k, x) { if (x.tagName === "BUTTON") return !1; if (x === k) return !0; for (const S in x.children) if (Object.prototype.hasOwnProperty.call(x.children, S) && s(k, x.children[S])) return !0; return !1; } function f() { var E, C; let k = c.value.x + m.value.x, x = c.value.y + m.value.y; i.value === "x" ? (k = ((E = l.value) == null ? void 0 : E.x) || 0, c.value.x = 0) : i.value === "y" && (x = ((C = l.value) == null ? void 0 : C.y) || 0, c.value.y = 0); const S = `translate3d(${Math.round(k)}px, ${Math.round(x)}px, 0px)`; o.value && (o.value.style.transform = S), p.value.x = k, p.value.y = x; } function v() { if (!u.value || !o.value) return null; const k = u.value.getBoundingClientRect(), x = o.value.getBoundingClientRect(), S = { top: k.top < x.top, right: k.right > x.right, bottom: k.bottom > x.bottom, left: k.left < x.left }; return S.top || (c.value.y -= x.top - k.top), S.bottom || (c.value.y -= x.bottom - k.bottom), S.right || (c.value.x -= x.right - k.right), S.left || (c.value.x -= x.left - k.left), f(), S; } function B(k) { k && (l.value && k.subtract(l.value), c.value.set(k), f(), v()); } function M(k) { d.value && r.value && (k.stopPropagation(), k.preventDefault(), B(re.fromEvent(k, a.value))); } function j() { var k; d.value && (d.value = !1, m.value.add(c.value), c.value.reset(), (k = o.value) == null || k.classList.remove("ng-dragging"), t.emit("stopMove"), document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", j)); } function _() { !d.value && a.value && (d.value = !0, a.value.classList.add("ng-dragging"), document.addEventListener("mousemove", M), document.addEventListener("mouseup", j)); } function T() { if (o.value) { const k = re.getTransformInfo(o.value); m.value.set(k); return; } m.value.reset(); } function y(k) { if (!n.value || k instanceof MouseEvent && k.button === 2) return; const x = k.target || k.srcElement; a.value !== void 0 && x && !s(x, a.value) || r.value !== !1 && (document.body.click(), k.stopPropagation(), k.preventDefault(), l.value = re.fromEvent(k, o.value), T(), _()); } function h(k, x, S) { if (r.value && x) { if (k) a.value = k; else if (e.dragHandle) { if (e.dragHandle instanceof HTMLElement) a.value = e.dragHandle; else if (typeof e.dragHandle == "string") { const E = x.querySelector(e.dragHandle); E && (a.value = E); } } o.value = x, u.value = S, a.value ? (a.value.classList.add("ng-draggable"), a.value.addEventListener("mousedown", y)) : r.value = !1; } } return { registerDraggle: h, resetTranslate: T }; } function tn(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 Xo(e, t) { const n = g(e.enableEsc); let o = null; return n.value ? (o = tn("Escape", (r) => { t.emit("esc", { event: r.event, type: "esc" }); }), { remove: o }) : null; } function Yo(e, t) { const n = g(e.enableEnter); let o = null; return n.value ? (o = tn("Enter", (r) => { t.emit("enter", { event: r.event, type: "enter" }); }), { remove: o }) : null; } const Ue = /* @__PURE__ */ Me({ name: "FModal", props: en, emits: ["update:modelValue", "accept", "cancel", "closed", "resize", "esc", "enter", "stopMove"], setup(e, t) { const n = g(e.width || 300), o = g(e.height || 200), r = g(e.modelValue), i = g(""), a = g(e.class), u = g(e.fitContent), d = g(e.showHeader), l = g(""), m = g(e.showCloseButton), c = g(e.showMaxButton), p = g(!1), s = g(e.dialogType), f = g(e.src), v = g(""), B = g(e.showButtons), M = g(e.title), j = g(e.containment || null), _ = g(), { t: T } = Lt(); M.value === "错误提示" && (M.value = T("messageBox.errorTitle")); const y = g(!1); function h(O, J) { const ae = J ? "accept" : "cancel"; Promise.resolve().then(() => { var ie; return (ie = e.beforeClose) == null ? void 0 : ie.call(e, { closeType: ae }); }).then((ie) => { ie && (r.value = !1, t.emit("update:modelValue", !1), J != null && t.emit(J ? "accept" : "cancel"), t.emit("closed", O)); }); } const k = [{ name: "cancel", text: T("messageBox.cancel") || "取消", class: "btn btn-secondary", handle: (O) => { h(O, !1); } }, { name: "accept", text: T("messageBox.ok") || "确定", class: "btn btn-primary", handle: (O) => { h(O, !0); } }], x = g(e.buttons && e.buttons.length ? e.buttons : k), S = z(() => !!l.value), E = z(() => !!B.value && !!x.value), C = g(), F = g(), D = g(!1), { renderResizeBar: P, maximize: H, restore: G, boundingElement: K, resizedEventParam: N, allowDrag: R, unWindowResizeHandle: U, moveToCenter: A } = Go(e), { registerDraggle: ee } = Uo(e, t, R); function me() { return !!document.querySelectorAll(".farris-modal").length && document.body.classList.contains("modal-open"); } function ve() { const O = document.querySelectorAll(".farris-modal").length; (!O || O - 1 <= 0) && document.body.classList.remove("modal-open"), _.value && _.value.classList.remove("show"); } Ce(() => e.title, (O, J) => { O !== J && (M.value = O); }), Ce(() => e.modelValue, (O, J) => { O !== J && (r.value = O, r.value && e.draggable && Ze(() => { F.value && !j.value && (j.value = F.value.parentElement, K.value = j.value, ee(C.value, F.value, K.value), A()); }), O || (j.value && (j.value = null), ve())), r.value ? y.value = me() : (D.value = !1, R.value = e.draggable); }), Ce(() => e.showHeader, (O, J) => { O !== J && (d.value = O); }), Ce(() => e.showButtons, (O, J) => { O !== J && (B.value = O); }), Ce(() => N.value, (O, J) => { const ae = O || {}, ie = J || {}; JSON.stringify(ae) !== JSON.stringify(ie) && t.emit("resize", { newSize: O, oldSize: J, isMaximized: D.value }); }); const Y = z(() => (r.value && document.body.classList.add("modal-open"), r.value)), oe = z(() => { var ae; const O = { modal: !0, "farris-modal": !0, fade: !0 }; O["f-modal-fitContent"] = !!u.value, O.show = !!Y.value; const J = (ae = e.maskClass) == null ? void 0 : ae.split(" "); return J == null || J.reduce((ie, Ne) => (ie[Ne] = !0, ie), O), O; }), le = z(() => { var ae; const O = { "modal-dialog": !0 }, J = (ae = a.value) == null ? void 0 : ae.split(" "); return J == null || J.reduce((ie, Ne) => (ie[Ne] = !0, ie), O), O; }), te = z(() => { const O = { position: "absolute", top: `${(window.innerHeight - o.value) / 2}px`, left: `${(window.innerWidth - n.value) / 2}px`, width: `${n.value}px`, height: u.value ? "auto" : `${o.value}px` }; return e.mask || (O.pointerEvents = "auto"), O; }), q = z(() => { const O = { display: "block" }; return e.mask || (O.pointerEvents = "none", O.backgroundColor = "transparent"), y.value && (O.backgroundColor = "transparent"), O; }), ne = z(() => ({ "modal-content": !0, "modal-content-has-header": d.value })), Le = z(() => { const O = { display: d.value ? "" : "none" }; return O["pointer-events"] = R.value ? "auto" : "none", O; }), Ee = z(() => ({ "f-icon": !0, modal_maximize: !0, modalrevert: D.value })), Te = z(() => ({ "modal-body": !0, "f-utils-flex-column": s.value === "iframe", "f-utils-fill": !0 })); function Xe() { return { height: `${e.footerHeight || 60}px` }; } const ze = z(() => { const O = { textAlgin: v.value }, J = Xe(); return Object.assign(O, J); }); function Ae(O) { if (O == null || O.stopPropagation(), D.value) { D.value = !1, G(); return; } H(), D.value = !0; } async function se(O, J) { O.handle && await O.handle(J, O) && t.emit("closed", J); } function tt(O) { O.width && (n.value = O.width), O.height && (o.value = O.height), O.buttons && (x.value = O.buttons), O.title && (M.value = O.title); } let xe = null, Re = null; Nn(() => { y.value = me(); }), et(() => { F.value && !j.value && (j.value = F.value.parentElement, K.value = j.value, ee(C.value, F.value, K.value)), Y.value && document.body.classList.add("modal-open"), xe = Xo(e, t), Re = Yo(e, t); }), ut(() => { U && U(), xe && xe.remove(), Re && Re.remove(); }), t.expose({ modalElementRef: F, updateModalOptions: tt, close: h, maxDialog: Ae, isMaximized: D }); 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: (O) => h(O, !1), style: "pointer-events: auto;" }, [w("span", { class: "f-icon modal_close" }, null)])]); } function De() { return w("div", { class: "modal-footer", style: ze.value }, [x.value && x.value.map((O) => { const J = g(O.disabled); return w("button", { name: O.name, type: "button", disabled: J.value, class: O.class + (O.iconClass ? " btn-icontext" : ""), onClick: (ae) => { se(O, ae); } }, [!!O.iconClass && w("i", { class: O.iconClass }, null), O.text]); })]); } function nt() { return w("div", { ref: C, class: "modal-header", style: Le.value }, [t.slots.headerTemplate ? t.slots.headerTemplate() : w("div", { class: "modal-title" }, [S.value && w("span", { class: l.value, style: "margin-right: 8px" }, null), w("span", { class: "modal-title-label" }, [M.value])]), w("div", { class: "actions" }, [je()])]); } function Ve() { return t.slots.footerTemplate ? t.slots.footerTemplate() : E.value && De(); } function Oe(O) { if (O.stopPropagation(), e.allowClickMaskToClose) { if (O.target !== _.value) return; h(O, !1); } } function Pe() { var O, J; return w("div", { id: i.value, class: le.value, style: te.value, ref: F }, [w("div", { class: ne.value }, [d.value && nt(), w("div", { class: Te.value }, [(J = (O = t.slots).default) == null ? void 0 : J.call(O), s.value === "iframe" && w("iframe", { title: i.value, class: "f-utils-fill", width: "100%", frameborder: "0", src: f.value }, null)]), Ve()]), !u.value && F.value && !D.value && P(F.value)]); } function Ye(O) { return O || "body"; } return () => w(Zt, { to: Ye(e.host) }, { default: () => [Y.value && w(Kt, { name: "fade", appear: !0 }, { default: () => [w("div", { ref: _, class: oe.value, style: q.value, onClick: Oe }, [Pe()])] })] }); } }); function nn(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Jo(e) { const t = document.createElement("div"); t.style.display = "contents"; const n = $t({ setup(o, r) { ut(() => { document.body.removeChild(t); }); const i = g(), a = g(e.class || ""), u = g(!!e.showButtons), d = g(!!e.showHeader), l = g(e.showCloseButton == null ? !0 : e.showCloseButton), m = g(!0), c = g(e.title || ""), p = e.acceptCallback || (() => { }), s = e.rejectCallback || (() => { }), f = e.closedCallback || ((_) => { }), v = e.resizeHandle || ((_) => { }), B = e.stopMoveHandle || ((_) => { }), M = nn(e), j = (_) => { m.value = !1, n.unmount(), f(_); }; return et(() => { }), r.expose({ modalRef: i }), () => w(Ue, { ref: i, class: a.value, modelValue: m.value, "onUpdate:modelValue": (_) => m.value = _, title: c.value, width: e.width, height: e.height, buttons: e.buttons, "show-header": d.value, "show-buttons": u.value, "show-close-button": l.value, "show-max-button": !1, onAccept: p, onCancel: s, fitContent: e.fitContent == null ? !0 : e.fitContent, onClosed: j, onResize: v, onStopMove: B }, { default: () => [M && M(n)] }); } }); return document.body.appendChild(t), n.use(gt.i18n), n.mount(t), n; } class on { constructor(t) { he(this, "appContext", null); he(this, "modalRef", g()); he(this, "activeModalIndex", g(0)); he(this, "modalRefs", {}); he(this, "isUseEscCloseModal", g(!1)); he(this, "activeModalInstance", z(() => 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: 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 Jo(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 = In(Object.assign({ title: "", showButtons: !0, showHeader: !0 }, t)), r = g(!0), i = o.value.acceptCallback || (() => { }), a = o.value.rejectCallback || (() => { }), u = o.value.closedCallback || ((y, h) => { }), d = o.value.resizeHandle || ((y) => { }), l = t.stopMoveHandle || ((y) => { }); let m; const c = nn(o.value), p = (y) => { var k; r.value = !1; const h = (k = y == null ? void 0 : y.target) == null ? void 0 : k.classList.contains("modal_close"); u(y, this.isUseEscCloseModal.value ? "esc" : h ? "icon" : "button"); }, s = (y) => { p(y), m && Ze(() => { if (this.modalRefs[this.activeModalIndex.value] && delete this.modalRefs[this.activeModalIndex.value], jt(null, n), m = null, this.modalRef.value = null, this.modalRefs) { const h = Object.keys(this.modalRefs).map((k) => Number(k)); h.length > 0 ? this.activeModalIndex.value = Math.max(...h) : this.activeModalIndex.value = 0; } this.isUseEscCloseModal.value = !1; }); }, f = (y) => { var h; this.isUseEscCloseModal.value = !0, this.activeModalInstance && ((h = this.activeModalInstance.value) == null || h.close(y == null ? void 0 : y.event)); }, { width: v, height: B } = o.value, M = this.adaptToWindow(v || 500, B || 320); Object.assign(o.value, M); const j = () => w(Ue, ht({ ref: this.modalRef, modelValue: r.value, "onUpdate:modelValue": (y) => r.value = y }, o.value, { onAccept: i, onCancel: a, onClosed: s, onResize: d, onEsc: f, onStopMove: l }), { default: () => [c && c(this.app)] }); return m = ((y) => { const h = $n(j, y); return h.appContext = this.appContext, jt(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 && jt(Hn(m, { ...o }), n); }, destroy: s, modalRef: this.activeModalInstance, close: () => this.close() }; } } function Qo(e = {}) { function t(l, m, c, p) { if (typeof c == "number") return p[l].length === c; if (typeof c == "object") { const s = Object.keys(c)[0], f = c[s]; if (s === "not") return Number(p[l].length) !== Number(f); if (s === "moreThan") return Number(p[l].length) >= Number(f); if (s === "lessThan") return Number(p[l].length) <= Number(f); } return !1; } function n(l, m, c, p) { return p[l] && p[l].propertyValue && String(p[l].propertyValue.value) === String(c); } const o = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((l, m) => (l.set(m, e[m]), l), o); function r(l, m) { const c = l; return typeof m == "number" ? [{ target: c, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: c, operator: "getProperty", param: l, value: !!m }] : typeof m == "object" ? Object.keys(m).map((p) => { if (p === "length") return { target: c, operator: "length", param: null, value: m[p] }; const s = p, f = m[p]; return { target: c, operator: "getProperty", param: s, value: f }; }) : []; } function i(l) { return Object.keys(l).reduce((c, p) => { const s = r(p, l[p]); return c.push(...s), c; }, []); } function a(l, m) { if (o.has(l.operator)) { const c = o.get(l.operator); return c && c(l.target, l.param, l.value, m) || !1; } return !1; } function u(l, m) { return i(l).reduce((s, f) => s && a(f, m), !0); } function d(l, m) { const c = Object.keys(l), p = c.includes("allOf"), s = c.includes("anyOf"), f = p || s, M = (f ? l[f ? p ? "allOf" : "anyOf" : "allOf"] : [l]).map((_) => u(_, m)); return p ? !M.includes(!1) : M.includes(!0); } return { parseValueSchema: d }; } const Zo = { convertTo: (e, t, n, o) => { e.appearance || (e.appearance = {}), e.appearance[t] = n; }, convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t] }, Ko = { convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, er = { 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: "多语输入框" } }, tr = { convertFrom: (e, t, n) => { var r; const o = e.editor && e.editor[t] ? e.editor[t] : e[t]; return ((r = $[o]) == null ? void 0 : r.name) || o; } }, nr = { convertTo: (e, t, n, o) => { e[t] = e[t]; }, convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : "" }, or = { 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"; } }, rr = { 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 : "" }, ar = { 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 ""; } }, ir = { 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.summa