UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,530 lines 368 kB
var Pa = Object.defineProperty; var ja = (e, t, n) => t in e ? Pa(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var ke = (e, t, n) => ja(e, typeof t != "symbol" ? t + "" : t, n); import { defineComponent as ae, ref as C, computed as N, createVNode as m, Teleport as Dn, createApp as on, onUnmounted as kt, Fragment as lt, watch as Z, nextTick as _e, onBeforeMount as Na, onMounted as ve, Transition as En, shallowRef as Ia, render as Zt, h as Ra, cloneVNode as La, mergeProps as St, reactive as Ge, createTextVNode as ie, inject as Ce, withDirectives as Pn, vShow as Va, onUpdated as ln, onBeforeUnmount as jn, provide as Nn, vModelText as $a } from "vue"; import { resolveAppearance as In, createPropsResolver as rn, getSchemaByTypeForDesigner as Aa } from "../dynamic-resolver/index.esm.js"; import { useI18n as Ft } from "vue-i18n"; import { LocaleService as It } from "../locale/index.esm.js"; import { cloneDeep as Re, isPlainObject as bn, isUndefined as je, debounce as Rn } from "lodash-es"; import "../accordion/index.esm.js"; import "../avatar/index.esm.js"; import Ha from "../../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 za from "../tags/index.esm.js"; import "../text/index.esm.js"; import "../time-picker/index.esm.js"; import "../transfer/index.esm.js"; import Ln from "../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 Wa from "../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 { useDesignerComponent as qa } from "../designer-canvas/index.esm.js"; import { getCustomClass as Pt, withInstall as Rt, FormSchemaEntityField$Type as Cn, FormSchemaEntityFieldTypeName as wn, useGuid as Ga, FormSchemaEntityFieldType$Type as _a, getCustomStyle as Ua } from "../common/index.esm.js"; import { useResizeObserver as Ya } from "@vueuse/core"; import { getHierarchyRow as Xa, useIdentify as Ja, useGroupData as Qa, useFilter as Za, useHierarchy as Ka, useLoading as eo, useDataView as to, useSelection as no, useSelectHierarchyItem as ao, usePagination as oo, useDataViewContainerStyle as lo, useCommandColumn as io, useSettingColumn as ro, useColumn as so, useSort as uo, useGroupColumn as co, useRow as fo, useEdit as po, useVisualDataBound as mo, useVisualDataCell as yo, useVisualDataRow as vo, useVisualData as ho, useCellPosition as go, useSidebar as bo, useVirtualScroll as Co, useFitColumn as wo, useFilterHistory as ko, useColumnFilter as So, useDragColumn as Fo, getColumnHeader as xo, getSidebar as To, getDisableMask as Oo, getHorizontalScrollbar as Bo, getVerticalScrollbar as Mo, getEmpty as Do, getPagination as Eo, getSummary as Po } from "../data-view/index.esm.js"; import { InputBaseProperty as jo } from "../property-panel/index.esm.js"; import "../notify/index.esm.js"; import No from "../popover/index.esm.js"; import Vn, { FButtonEdit as $n } from "../button-edit/index.esm.js"; import Io from "../list-view/index.esm.js"; import { FInputGroup as Ro } from "../input-group/index.esm.js"; const Lo = { /** * 组件标识 */ 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 } }, Vo = { popupContentPosition: { type: Object, default: { left: 0, top: 0 } }, host: { type: Object }, backgroundColor: { type: String, default: "" } }, $o = /* @__PURE__ */ ae({ name: "FOverlay", props: Vo, emits: ["click"], setup(e, t) { const n = C(e.popupContentPosition), a = C(e.host), o = N(() => ({ backgroundColor: e.backgroundColor || "", pointerEvents: "auto" })); function l(u) { t.emit("click"), u.preventDefault(), u.stopPropagation(); } N(() => { const u = a.value; if (u) { const d = u.getBoundingClientRect(), { left: c, top: g, height: s } = d; return { left: c, top: g + s }; } return n.value; }); const i = N(() => ({ // position: 'relative', // left: `${position.value.left}px`, // top: `${position.value.top}px` })); return () => m(Dn, { to: "body" }, { default: () => { var u, d; return [m("div", { class: "overlay-container", onClick: (c) => l(c), style: o.value }, [m("div", { style: i.value }, [(d = (u = t.slots).default) == null ? void 0 : d.call(u)])])]; } }); } }); function Ao(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Ho(e) { const t = document.createElement("div"); t.style.display = "contents"; let n; const a = e.onClickCallback || (() => { }), o = () => { a(), n && n.unmount(); }; return n = on({ setup() { kt(() => { document.body.removeChild(t); }); const l = Ao(e); return () => m($o, { "popup-content-position": e.popupPosition, host: e.host, onClick: o, backgroundColor: e.backgroundColor }, { default: () => [l && l()] }); } }), document.body.appendChild(t), n.mount(t), n; } class zo { static show(t) { return Ho(t); } } const Wo = "https://json-schema.org/draft/2020-12/schema", qo = "https://farris-design.gitee.io/modal.schema.json", Go = "modal", _o = "弹窗组件", Uo = "object", Yo = { 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 } }, Xo = [ "id", "type" ], Jo = { onAccept: "确定事件", onCancel: "取消事件", beforeClose: "关闭前回调" }, Qo = { $schema: Wo, $id: qo, title: Go, description: _o, type: Uo, properties: Yo, required: Xo, events: Jo }, Zo = /* @__PURE__ */ new Map([ ["appearance", In] ]); function Ko(e, t, n) { return t; } function el() { function e(t, n) { const a = {}; return a.beforeClose = (o) => n.call("beforeClose", [o, t]), a; } return { resolve: e }; } const An = { /** * 允许点击遮罩关闭对话框 */ 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" } }, tl = rn(An, Qo, Zo, Ko), nl = el(); class re { constructor(t, n) { this.x = t, this.y = n; } static getTransformInfo(t) { const a = window.getComputedStyle(t).getPropertyValue("transform").replace(/[^-\d,]/g, "").split(","); if (a.length >= 6) { const o = parseInt(a[4], 10), l = parseInt(a[5], 10); return { x: o, y: l }; } 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 a = 0; a < t.changedTouches.length; a++) if (t.changedTouches[a].target === n) return new re(t.changedTouches[a].clientX, t.changedTouches[a].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 a = window.getComputedStyle(t); if (a) { const o = parseInt(a.getPropertyValue("left"), 10), l = parseInt(a.getPropertyValue("top"), 10); n.x = isNaN(o) ? 0 : o, n.y = isNaN(l) ? 0 : l; } 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 at { constructor(t, n) { this.width = t, this.height = n; } static getCurrent(t) { const n = new at(0, 0); if (window) { const a = window.getComputedStyle(t); return a && (n.width = parseInt(a.getPropertyValue("width"), 10), n.height = parseInt(a.getPropertyValue("height"), 10)), n; } return null; } static copy(t) { return new at(0, 0).set(t); } set(t) { return this.width = t.width, this.height = t.height, this; } } function al(e, t) { const n = C(), a = C(), o = C(), l = C(), i = C(), u = C(), d = C(), c = C(), g = C(), s = C(), r = C(), f = C(e.resizeable), v = C(), b = C(e.draggable), y = C(!1); function w() { const $ = a.value || document.body, R = window.getComputedStyle($); if (!R || !n.value) return; const G = re.getTransformInfo(n.value), z = {}; d.value && (z.deltaL = n.value.offsetLeft - d.value.x, z.deltaT = n.value.offsetTop - d.value.y); const ee = R.getPropertyValue("position"); z.width = $.clientWidth, z.height = $.clientHeight, z.pr = parseInt(R.getPropertyValue("padding-right"), 10), z.pb = parseInt(R.getPropertyValue("padding-bottom"), 10), z.position = R.getPropertyValue("position"), ee === "static" && ($.style.position = "relative"), z.translateX = G.x, z.translateY = G.y, s.value = z; } function k($) { if (n.value) { l.value = at.getCurrent(n.value), i.value = re.getCurrent(n.value), u.value = l.value ? at.copy(l.value) : null, d.value = i.value ? re.copy(i.value) : null, w(); const R = $.target.getAttribute("type") || ""; c.value = { n: !!R.match(/n/), s: !!R.match(/s/), w: !!R.match(/w/), e: !!R.match(/e/) }; } } function M() { var $, R, G, z; if (n.value) { const ee = n.value; c.value && ((c.value.n || c.value.s) && (($ = u.value) != null && $.height) && (ee.style.height = u.value.height + "px"), (c.value.w || c.value.e) && ((R = u.value) != null && R.width) && (ee.style.width = u.value.width + "px"), d.value && ((G = d.value) != null && G.x && (ee.style.left = d.value.x + "px"), (z = d.value) != null && z.y && (ee.style.top = d.value.y + "px"))); } } function F() { const $ = e.minHeight ? e.minHeight : 1, R = e.minWidth ? e.minWidth : 1; u.value && d.value && c.value && l.value && (u.value.height < $ && (u.value.height = $, c.value.n && i.value && (d.value.y = i.value.y + (l.value.height - $))), u.value.width < R && (u.value.width = R, c.value.w && i.value && (d.value.x = i.value.x + (l.value.width - R))), e.maxHeight && u.value.height > e.maxHeight && (u.value.height = e.maxHeight, i.value && c.value.n && (d.value.y = i.value.y + (l.value.height - e.maxHeight))), e.maxWidth && u.value.width > e.maxWidth && (u.value.width = e.maxWidth, c.value.w && i.value && (d.value.x = i.value.x + (l.value.width - e.maxWidth)))); } function h() { if (a.value) { const $ = s.value; if (d.value && u.value && c.value && l.value) { const R = $.width - $.pr - $.deltaL - $.translateX - d.value.x, G = $.height - $.pb - $.deltaT - $.translateY - d.value.y; c.value.n && d.value.y + $.translateY < 0 && i.value && (d.value.y = -$.translateY, u.value.height = l.value.height + i.value.y + $.translateY), c.value.w && d.value.x + $.translateX < 0 && i.value && (d.value.x = -$.translateX, u.value.width = l.value.width + i.value.x + $.translateX), u.value.width > R && (u.value.width = R), u.value.height > G && (u.value.height = G); } } } function p($) { if (!o.value || !l.value || !i.value || !c.value) return; $.subtract(o.value); const R = $.x, G = $.y; c.value.n ? (d.value.y = i.value.y + G, u.value.height = l.value.height - G) : c.value.s && (u.value.height = l.value.height + G), c.value.e ? u.value.width = l.value.width + R : c.value.w && (u.value.width = l.value.width - R, d.value.x = i.value.x + R), h(), F(), M(); } function x($) { if (!g.value) return; const R = re.fromEvent($); R && p(R); } function B() { if (n.value) { const { width: $, height: R, x: G, y: z } = n.value.getBoundingClientRect(), ee = re.getTransformInfo(n.value); return { size: { width: $, height: R }, position: { x: G - ee.x, y: z - ee.y } }; } return null; } function E($) { if (n.value) { const R = B(); r.value = R; } o.value = void 0, l.value = null, i.value = null, u.value = null, d.value = null, c.value = null, g.value = null, document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", E); } function P() { document.addEventListener("mousemove", x), document.addEventListener("mouseup", E); } function T($) { $ instanceof MouseEvent && $.button === 2 || b.value && (document.body.click(), $.stopPropagation(), $.preventDefault(), o.value = re.fromEvent($), g.value = $.target, k($), P()); } function O($) { return n.value = $, f.value && m(lt, null, [m("div", { class: "fv-resizable-handle fv-resizable-n", type: "n", onMousedown: (R) => T(R) }, null), m("div", { class: "fv-resizable-handle fv-resizable-e", type: "e", onMousedown: (R) => T(R) }, null), m("div", { class: "fv-resizable-handle fv-resizable-s", type: "s", onMousedown: (R) => T(R) }, null), m("div", { class: "fv-resizable-handle fv-resizable-w", type: "w", onMousedown: (R) => T(R) }, null), m("div", { class: "fv-resizable-handle fv-resizable-ne", type: "ne", onMousedown: (R) => T(R) }, null), m("div", { class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal", type: "se", onMousedown: (R) => T(R) }, null), m("div", { class: "fv-resizable-handle fv-resizable-sw", type: "sw", onMousedown: (R) => T(R) }, null), m("div", { class: "fv-resizable-handle fv-resizable-nw", type: "nw", onMousedown: (R) => T(R) }, null)]); } function S($ = !0) { document.body.click(); const R = a.value || document.body, G = at.getCurrent(R), z = n.value; $ && z && (v.value = B(), v.value.transform = z.style.transform), G && z && (u.value = G, u.value.height -= 14, u.value.width -= 14, z.style.height = u.value.height + "px", z.style.width = u.value.width + "px", z.style.left = "7px", z.style.top = "7px", z.style.transform = "", r.value = { size: u.value, position: { x: 0, y: 0 } }, b.value = !1, y.value = !0); } function D() { var $, R; if (document.body.click(), v.value) { const G = { width: v.value.size.width || 0, height: v.value.size.height || 0 }, z = { x: (window.innerWidth - G.width) / 2, y: (window.innerHeight - G.height) / 2 }; ($ = u.value) == null || $.set(G), (R = d.value) == null || R.set(z); const ee = n.value; ee.style.height = G.height + "px", ee.style.width = G.width + "px", ee.style.left = `${z.x}px`, ee.style.top = `${z.y}px`, ee.style.transform = "", r.value = { size: G, position: z }, b.value = e.draggable, y.value = !1; } } function I() { if (n.value) { const $ = at.getCurrent(n.value); if ($) { const { width: R, height: G } = $; n.value.style.left = `${(window.innerWidth - R) / 2}px`, n.value.style.top = `${(window.innerHeight - G) / 2}px`, n.value.style.transform = ""; } } } function W() { const $ = () => { y.value ? S(!1) : I(), document.body.click(); }; return window.addEventListener("resize", $), () => { window.removeEventListener("resize", $); }; } const J = W(); return { renderResizeBar: O, boundingElement: a, resizedEventParam: r, maximize: S, restore: D, allowDrag: b, isMaximized: y, unWindowResizeHandle: J, moveToCenter: I }; } function ol(e, t, n) { const a = C(), o = C(e.draggable), l = C(e.lockAxis), i = C(), u = C(), d = C(!1), c = C(new re(0, 0)), g = C(new re(0, 0)), s = C(new re(0, 0)), r = C(new re(0, 0)); Z(() => n.value, (x) => { i.value.style.cursor = x ? "move" : "default"; }); function f(x, B) { if (B.tagName === "BUTTON") return !1; if (B === x) return !0; for (const E in B.children) if (Object.prototype.hasOwnProperty.call(B.children, E) && f(x, B.children[E])) return !0; return !1; } function v() { var P, T; let x = s.value.x + g.value.x, B = s.value.y + g.value.y; l.value === "x" ? (x = ((P = c.value) == null ? void 0 : P.x) || 0, s.value.x = 0) : l.value === "y" && (B = ((T = c.value) == null ? void 0 : T.y) || 0, s.value.y = 0); const E = `translate3d(${Math.round(x)}px, ${Math.round(B)}px, 0px)`; a.value && (a.value.style.transform = E), r.value.x = x, r.value.y = B; } function b() { if (!u.value || !a.value) return null; const x = u.value.getBoundingClientRect(), B = a.value.getBoundingClientRect(), E = { top: x.top < B.top, right: x.right > B.right, bottom: x.bottom > B.bottom, left: x.left < B.left }; return E.top || (s.value.y -= B.top - x.top), E.bottom || (s.value.y -= B.bottom - x.bottom), E.right || (s.value.x -= B.right - x.right), E.left || (s.value.x -= B.left - x.left), v(), E; } function y(x) { x && (c.value && x.subtract(c.value), s.value.set(x), v(), b()); } function w(x) { d.value && o.value && (x.stopPropagation(), x.preventDefault(), y(re.fromEvent(x, i.value))); } function k() { var x; d.value && (d.value = !1, g.value.add(s.value), s.value.reset(), (x = a.value) == null || x.classList.remove("ng-dragging"), t.emit("stopMove"), document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", k)); } function M() { !d.value && i.value && (d.value = !0, i.value.classList.add("ng-dragging"), document.addEventListener("mousemove", w), document.addEventListener("mouseup", k)); } function F() { if (a.value) { const x = re.getTransformInfo(a.value); g.value.set(x); return; } g.value.reset(); } function h(x) { if (!n.value || x instanceof MouseEvent && x.button === 2) return; const B = x.target || x.srcElement; i.value !== void 0 && B && !f(B, i.value) || o.value !== !1 && (document.body.click(), x.stopPropagation(), x.preventDefault(), c.value = re.fromEvent(x, a.value), F(), M()); } function p(x, B, E) { if (o.value && B) { if (x) i.value = x; else if (e.dragHandle) { if (e.dragHandle instanceof HTMLElement) i.value = e.dragHandle; else if (typeof e.dragHandle == "string") { const P = B.querySelector(e.dragHandle); P && (i.value = P); } } a.value = B, u.value = E, i.value ? (i.value.classList.add("ng-draggable"), i.value.addEventListener("mousedown", h)) : o.value = !1; } } return { registerDraggle: p, resetTranslate: F }; } function Hn(e, t) { if (e) { const n = (a) => { a.key.toLowerCase() === e.toLowerCase() && t({ event: a, key: e }); }; return document.addEventListener("keydown", n), () => { document.removeEventListener("keydown", n); }; } } function ll(e, t) { const n = C(e.enableEsc); let a = null; return n.value ? (a = Hn("Escape", (o) => { t.emit("esc", { event: o.event, type: "esc" }); }), { remove: a }) : null; } function il(e, t) { const n = C(e.enableEnter); let a = null; return n.value ? (a = Hn("Enter", (o) => { t.emit("enter", { event: o.event, type: "enter" }); }), { remove: a }) : null; } const ot = /* @__PURE__ */ ae({ name: "FModal", props: An, emits: ["update:modelValue", "accept", "cancel", "closed", "resize", "esc", "enter", "stopMove"], setup(e, t) { const n = C(e.width || 300), a = C(e.height || 200), o = C(e.modelValue), l = C(""), i = C(e.class), u = C(e.fitContent), d = C(e.showHeader), c = C(""), g = C(e.showCloseButton), s = C(e.showMaxButton), r = C(!1), f = C(e.dialogType), v = C(e.src), b = C(""), y = C(e.showButtons), w = C(e.title), k = C(e.containment || null), M = C(), { t: F } = Ft(); w.value === "错误提示" && (w.value = F("messageBox.errorTitle")); const h = C(!1); function p(L, Q) { const se = Q ? "accept" : "cancel"; Promise.resolve().then(() => { var ue; return (ue = e.beforeClose) == null ? void 0 : ue.call(e, { closeType: se }); }).then((ue) => { ue && (o.value = !1, t.emit("update:modelValue", !1), Q != null && t.emit(Q ? "accept" : "cancel"), t.emit("closed", L)); }); } const x = [{ name: "cancel", text: F("messageBox.cancel") || "取消", class: "btn btn-secondary", handle: (L) => { p(L, !1); } }, { name: "accept", text: F("messageBox.ok") || "确定", class: "btn btn-primary", handle: (L) => { p(L, !0); } }], B = C(e.buttons && e.buttons.length ? e.buttons : x), E = N(() => !!c.value), P = N(() => !!y.value && !!B.value), T = C(), O = C(), S = C(!1), { renderResizeBar: D, maximize: I, restore: W, boundingElement: J, resizedEventParam: $, allowDrag: R, unWindowResizeHandle: G, moveToCenter: z } = al(e), { registerDraggle: ee } = ol(e, t, R); function ce() { return !!document.querySelectorAll(".farris-modal").length && document.body.classList.contains("modal-open"); } function he() { const L = document.querySelectorAll(".farris-modal").length; (!L || L - 1 <= 0) && document.body.classList.remove("modal-open"), M.value && M.value.classList.remove("show"); } Z(() => e.title, (L, Q) => { L !== Q && (w.value = L); }), Z(() => e.modelValue, (L, Q) => { L !== Q && (o.value = L, o.value && e.draggable && _e(() => { O.value && !k.value && (k.value = O.value.parentElement, J.value = k.value, ee(T.value, O.value, J.value), z()); }), L || (k.value && (k.value = null), he())), o.value ? h.value = ce() : (S.value = !1, R.value = e.draggable); }), Z(() => e.showHeader, (L, Q) => { L !== Q && (d.value = L); }), Z(() => e.showButtons, (L, Q) => { L !== Q && (y.value = L); }), Z(() => $.value, (L, Q) => { const se = L || {}, ue = Q || {}; JSON.stringify(se) !== JSON.stringify(ue) && t.emit("resize", { newSize: L, oldSize: Q, isMaximized: S.value }); }); const Y = N(() => (o.value && document.body.classList.add("modal-open"), o.value)), le = N(() => { var se; const L = { modal: !0, "farris-modal": !0, fade: !0 }; L["f-modal-fitContent"] = !!u.value, L.show = !!Y.value; const Q = (se = e.maskClass) == null ? void 0 : se.split(" "); return Q == null || Q.reduce((ue, We) => (ue[We] = !0, ue), L), L; }), de = N(() => { var se; const L = { "modal-dialog": !0 }, Q = (se = i.value) == null ? void 0 : se.split(" "); return Q == null || Q.reduce((ue, We) => (ue[We] = !0, ue), L), L; }), ne = N(() => { const L = { position: "absolute", top: `${(window.innerHeight - a.value) / 2}px`, left: `${(window.innerWidth - n.value) / 2}px`, width: `${n.value}px`, height: u.value ? "auto" : `${a.value}px` }; return e.mask || (L.pointerEvents = "auto"), L; }), _ = N(() => { const L = { display: "block" }; return e.mask || (L.pointerEvents = "none", L.backgroundColor = "transparent"), h.value && (L.backgroundColor = "transparent"), L; }), oe = N(() => ({ "modal-content": !0, "modal-content-has-header": d.value })), Xe = N(() => { const L = { display: d.value ? "" : "none" }; return L["pointer-events"] = R.value ? "auto" : "none", L; }), Ve = N(() => ({ "f-icon": !0, modal_maximize: !0, modalrevert: S.value })), Oe = N(() => ({ "modal-body": !0, "f-utils-flex-column": f.value === "iframe", "f-utils-fill": !0 })); function rt() { return { height: `${e.footerHeight || 60}px` }; } const Je = N(() => { const L = { textAlgin: b.value }, Q = rt(); return Object.assign(L, Q); }); function Qe(L) { if (L == null || L.stopPropagation(), S.value) { S.value = !1, W(); return; } I(), S.value = !0; } async function fe(L, Q) { L.handle && await L.handle(Q, L) && t.emit("closed", Q); } function pt(L) { L.width && (n.value = L.width), L.height && (a.value = L.height), L.buttons && (B.value = L.buttons), L.title && (w.value = L.title); } let Be = null, $e = null; Na(() => { h.value = ce(); }), ve(() => { O.value && !k.value && (k.value = O.value.parentElement, J.value = k.value, ee(T.value, O.value, J.value)), Y.value && document.body.classList.add("modal-open"), Be = ll(e, t), $e = il(e, t); }), kt(() => { G && G(), Be && Be.remove(), $e && $e.remove(); }), t.expose({ modalElementRef: O, updateModalOptions: pt, close: p, maxDialog: Qe, isMaximized: S }); function Ae() { return m("ul", null, [r.value && m("li", { class: "f-btn-icon f-bare" }, [m("span", { class: "f-icon modal_minimize" }, null)]), s.value && m("li", { onClick: Qe, class: "f-btn-icon f-bare", style: "pointer-events: auto;" }, [m("span", { class: Ve.value }, null)]), g.value && m("li", { class: "f-btn-icon f-bare", onClick: (L) => p(L, !1), style: "pointer-events: auto;" }, [m("span", { class: "f-icon modal_close" }, null)])]); } function He() { return m("div", { class: "modal-footer", style: Je.value }, [B.value && B.value.map((L) => { const Q = C(L.disabled); return m("button", { name: L.name, type: "button", disabled: Q.value, class: L.class + (L.iconClass ? " btn-icontext" : ""), onClick: (se) => { fe(L, se); } }, [!!L.iconClass && m("i", { class: L.iconClass }, null), L.text]); })]); } function mt() { return m("div", { ref: T, class: "modal-header", style: Xe.value }, [t.slots.headerTemplate ? t.slots.headerTemplate() : m("div", { class: "modal-title" }, [E.value && m("span", { class: c.value, style: "margin-right: 8px" }, null), m("span", { class: "modal-title-label" }, [w.value])]), m("div", { class: "actions" }, [Ae()])]); } function Ze() { return t.slots.footerTemplate ? t.slots.footerTemplate() : P.value && He(); } function Pe(L) { if (L.stopPropagation(), e.allowClickMaskToClose) { if (L.target !== M.value) return; p(L, !1); } } function ze() { var L, Q; return m("div", { id: l.value, class: de.value, style: ne.value, ref: O }, [m("div", { class: oe.value }, [d.value && mt(), m("div", { class: Oe.value }, [(Q = (L = t.slots).default) == null ? void 0 : Q.call(L), f.value === "iframe" && m("iframe", { title: l.value, class: "f-utils-fill", width: "100%", frameborder: "0", src: v.value }, null)]), Ze()]), !u.value && O.value && !S.value && D(O.value)]); } function st(L) { return L || "body"; } return () => m(Dn, { to: st(e.host) }, { default: () => [Y.value && m(En, { name: "fade", appear: !0 }, { default: () => [m("div", { ref: M, class: le.value, style: _.value, onClick: Pe }, [ze()])] })] }); } }); function zn(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function rl(e) { const t = document.createElement("div"); t.style.display = "contents"; const n = on({ setup(a, o) { kt(() => { document.body.removeChild(t); }); const l = C(), i = C(e.class || ""), u = C(!!e.showButtons), d = C(!!e.showHeader), c = C(e.showCloseButton == null ? !0 : e.showCloseButton), g = C(!0), s = C(e.title || ""), r = e.acceptCallback || (() => { }), f = e.rejectCallback || (() => { }), v = e.closedCallback || ((M) => { }), b = e.resizeHandle || ((M) => { }), y = e.stopMoveHandle || ((M) => { }), w = zn(e), k = (M) => { g.value = !1, n.unmount(), v(M); }; return ve(() => { }), o.expose({ modalRef: l }), () => m(ot, { ref: l, class: i.value, modelValue: g.value, "onUpdate:modelValue": (M) => g.value = M, title: s.value, width: e.width, height: e.height, buttons: e.buttons, "show-header": d.value, "show-buttons": u.value, "show-close-button": c.value, "show-max-button": !1, onAccept: r, onCancel: f, fitContent: e.fitContent == null ? !0 : e.fitContent, onClosed: k, onResize: b, onStopMove: y }, { default: () => [w && w(n)] }); } }); return document.body.appendChild(t), n.use(It.i18n), n.mount(t), n; } class Wn { constructor(t) { ke(this, "appContext", null); ke(this, "modalRef", C()); ke(this, "activeModalIndex", C(0)); ke(this, "modalRefs", {}); ke(this, "isUseEscCloseModal", C(!1)); ke(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: a, height: o } = { width: window.innerWidth, height: window.innerHeight }; return a < t && (t = a - 14), o < n && (n = o - 14), { width: t, height: n }; } static show(t) { const n = Object.assign({ title: "", showButtons: !0, showHeader: !0 }, t); return rl(n); } close(t) { var n, a; t ? (a = t.value) == null || a.close() : (n = this.getCurrentModal()) == null || n.close(); } open(t) { const n = document.createDocumentFragment(); t.showMaxButton && t.fitContent && (t.showMaxButton = !1); const a = Ia(Object.assign({ title: "", showButtons: !0, showHeader: !0 }, t)), o = C(!0), l = a.value.acceptCallback || (() => { }), i = a.value.rejectCallback || (() => { }), u = a.value.closedCallback || ((h, p) => { }), d = a.value.resizeHandle || ((h) => { }), c = t.stopMoveHandle || ((h) => { }); let g; const s = zn(a.value), r = (h) => { var x; o.value = !1; const p = (x = h == null ? void 0 : h.target) == null ? void 0 : x.classList.contains("modal_close"); u(h, this.isUseEscCloseModal.value ? "esc" : p ? "icon" : "button"); }, f = (h) => { r(h), g && _e(() => { if (this.modalRefs[this.activeModalIndex.value] && delete this.modalRefs[this.activeModalIndex.value], Zt(null, n), g = null, this.modalRef.value = null, this.modalRefs) { const p = Object.keys(this.modalRefs).map((x) => Number(x)); p.length > 0 ? this.activeModalIndex.value = Math.max(...p) : this.activeModalIndex.value = 0; } this.isUseEscCloseModal.value = !1; }); }, v = (h) => { var p; this.isUseEscCloseModal.value = !0, this.activeModalInstance && ((p = this.activeModalInstance.value) == null || p.close(h == null ? void 0 : h.event)); }, { width: b, height: y } = a.value, w = this.adaptToWindow(b || 500, y || 320); Object.assign(a.value, w); const k = () => m(ot, St({ ref: this.modalRef, modelValue: o.value, "onUpdate:modelValue": (h) => o.value = h }, a.value, { onAccept: l, onCancel: i, onClosed: f, onResize: d, onEsc: v, onStopMove: c }), { default: () => [s && s(this.app)] }); return g = ((h) => { const p = Ra(k, h); return p.appContext = this.appContext, Zt(p, n), p; })({ ...a.value // 'onUpdate:modelValue': onUpdateModelValue, }), this.activeModalIndex.value++, this.modalRefs[this.activeModalIndex.value] = this.modalRef.value, { update: (h) => { a.value = { ...a.value, ...h }, g && Zt(La(g, { ...a }), n); }, destroy: f, modalRef: this.activeModalInstance, close: () => this.close() }; } } function sl(e = {}) { function t(c, g, s, r) { if (typeof s == "number") return r[c].length === s; if (typeof s == "object") { const f = Object.keys(s)[0], v = s[f]; if (f === "not") return Number(r[c].length) !== Number(v); if (f === "moreThan") return Number(r[c].length) >= Number(v); if (f === "lessThan") return Number(r[c].length) <= Number(v); } return !1; } function n(c, g, s, r) { return r[c] && r[c].propertyValue && String(r[c].propertyValue.value) === String(s); } const a = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((c, g) => (c.set(g, e[g]), c), a); function o(c, g) { const s = c; return typeof g == "number" ? [{ target: s, operator: "length", param: null, value: Number(g) }] : typeof g == "boolean" ? [{ target: s, operator: "getProperty", param: c, value: !!g }] : typeof g == "object" ? Object.keys(g).map((r) => { if (r === "length") return { target: s, operator: "length", param: null, value: g[r] }; const f = r, v = g[r]; return { target: s, operator: "getProperty", param: f, value: v }; }) : []; } function l(c) { return Object.keys(c).reduce((s, r) => { const f = o(r, c[r]); return s.push(...f), s; }, []); } function i(c, g) { if (a.has(c.operator)) { const s = a.get(c.operator); return s && s(c.target, c.param, c.value, g) || !1; } return !1; } function u(c, g) { return l(c).reduce((f, v) => f && i(v, g), !0); } function d(c, g) { const s = Object.keys(c), r = s.includes("allOf"), f = s.includes("anyOf"), v = r || f, w = (v ? c[v ? r ? "allOf" : "anyOf" : "allOf"] : [c]).map((M) => u(M, g)); return r ? !w.includes(!1) : w.includes(!0); } return { parseValueSchema: d }; } const ul = { convertTo: (e, t, n, a) => { e.appearance || (e.appearance = {}), e.appearance[t] = n; }, convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t] }, cl = { convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, dl = { convertTo: (e, t, n, a) => { e.editor && (e.editor[t] = n); }, convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t] }, V = { 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: "多语输入框" } }, fl = { convertFrom: (e, t, n) => { var o; const a = e.editor && e.editor[t] ? e.editor[t] : e[t]; return ((o = V[a]) == null ? void 0 : o.name) || a; } }, pl = { convertTo: (e, t, n, a) => { e[t] = e[t]; }, convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : "" }, ml = { convertTo: (e, t, n, a) => { (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"; } }, yl = { convertTo: (e, t, n, a) => { 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 : "" }, vl = { convertTo: (e, t, n, a) => { 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 ""; } }, hl = { convertTo: (e, t, n, a) => { 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 : "" }, gl = { convertTo: (e, t, n, a) => { 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") ret