UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,531 lines 202 kB
var bo = Object.defineProperty; var Co = (e, t, n) => t in e ? bo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var je = (e, t, n) => Co(e, typeof t != "symbol" ? t + "" : t, n); import { defineComponent as Xe, ref as b, computed as H, createVNode as p, Teleport as cn, createApp as Zt, onUnmounted as Ct, Fragment as lt, watch as me, nextTick as pt, onBeforeMount as wo, onMounted as it, Transition as dn, shallowRef as So, render as Xt, h as xo, cloneVNode as To, mergeProps as Lt, reactive as Ke, createTextVNode as ht, inject as kt, withDirectives as Bo, vShow as Fo, onUpdated as ko, onBeforeUnmount as Oo, isVNode as Mo, Comment as Eo, provide as Do } from "vue"; import { resolveAppearance as Ro, createPropsResolver as fn, getSchemaByTypeForDesigner as Io } from "../dynamic-resolver/index.esm.js"; import { useI18n as Kt } from "vue-i18n"; import { LocaleService as Vt } from "../locale/index.esm.js"; import { cloneDeep as Ht, isPlainObject as ln, isUndefined as ot, debounce as jo } 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 Po 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 $t, withInstall as en, FormSchemaEntityField$Type as rn, FormSchemaEntityFieldTypeName as sn, useGuid as No, useCommonUtils as Ho } from "../common/index.esm.js"; import { useResizeObserver as mn } from "@vueuse/core"; import { getHierarchyRow as $o, useIdentify as pn, useGroupData as vn, useFilter as gn, useHierarchy as yn, useLoading as hn, useDataView as bn, useSelection as Cn, useSelectHierarchyItem as Lo, usePagination as wn, useDataViewContainerStyle as Sn, useCommandColumn as xn, useSettingColumn as Tn, useColumn as Bn, useSort as Fn, useGroupColumn as kn, useRow as On, useEdit as Mn, useVisualDataBound as En, useVisualDataCell as Dn, useVisualDataRow as Rn, useVisualData as In, useCellPosition as jn, useSidebar as Pn, useVirtualScroll as Nn, useFitColumn as Hn, useFilterHistory as $n, useColumnFilter as Ln, useDragColumn as Vn, getColumnHeader as zn, getSidebar as An, getDisableMask as Gn, getHorizontalScrollbar as Wn, getVerticalScrollbar as _n, getEmpty as qn, getPagination as Un, getSummary as Xn, CellMode as Vo, useVisualGroupRow as zo, useVisualSummaryRow as Ao, useCellContentStyle as Go, getFilterPanel as Wo, getGroupPanel as _o, useNavigation as qo } from "../data-view/index.esm.js"; import "../property-panel/index.esm.js"; import "../notify/index.esm.js"; import Uo from "../popover/index.esm.js"; const Xo = { /** * 组件标识 */ 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 } }, Yo = { popupContentPosition: { type: Object, default: { left: 0, top: 0 } }, host: { type: Object }, backgroundColor: { type: String, default: "" } }, Jo = /* @__PURE__ */ Xe({ name: "FOverlay", props: Yo, emits: ["click"], setup(e, t) { const n = b(e.popupContentPosition), o = b(e.host), a = H(() => ({ backgroundColor: e.backgroundColor || "", pointerEvents: "auto" })); function i(u) { t.emit("click"), u.preventDefault(), u.stopPropagation(); } H(() => { const u = o.value; if (u) { const s = u.getBoundingClientRect(), { left: r, top: v, height: d } = s; return { left: r, top: v + d }; } return n.value; }); const l = H(() => ({ // position: 'relative', // left: `${position.value.left}px`, // top: `${position.value.top}px` })); return () => p(cn, { to: "body" }, { default: () => { var u, s; return [p("div", { class: "overlay-container", onClick: (r) => i(r), style: a.value }, [p("div", { style: l.value }, [(s = (u = t.slots).default) == null ? void 0 : s.call(u)])])]; } }); } }); function Qo(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Zo(e) { const t = document.createElement("div"); t.style.display = "contents"; let n; const o = e.onClickCallback || (() => { }), a = () => { o(), n && n.unmount(); }; return n = Zt({ setup() { Ct(() => { document.body.removeChild(t); }); const i = Qo(e); return () => p(Jo, { "popup-content-position": e.popupPosition, host: e.host, onClick: a, backgroundColor: e.backgroundColor }, { default: () => [i && i()] }); } }), document.body.appendChild(t), n.mount(t), n; } class Ko { static show(t) { return Zo(t); } } const ea = "https://json-schema.org/draft/2020-12/schema", ta = "https://farris-design.gitee.io/modal.schema.json", na = "modal", oa = "弹窗组件", aa = "object", la = { 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 } }, ia = [ "id", "type" ], ra = { onAccept: "确定事件", onCancel: "取消事件", beforeClose: "关闭前回调" }, sa = { $schema: ea, $id: ta, title: na, description: oa, type: aa, properties: la, required: ia, events: ra }, ua = /* @__PURE__ */ new Map([ ["appearance", Ro] ]); function ca(e, t, n) { return t; } function da() { function e(t, n) { const o = {}; return o.beforeClose = (a) => n.call("beforeClose", [a, t]), o; } return { resolve: e }; } const Yn = { /** * 允许点击遮罩关闭对话框 */ 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" } }, fa = fn(Yn, sa, ua, ca), ma = da(); class we { 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), i = parseInt(o[5], 10); return { x: a, y: i }; } return { x: 0, y: 0 }; } static fromEvent(t, n = null) { if (this.isMouseEvent(t)) return new we(t.clientX, t.clientY); if (n === null || t.changedTouches.length === 1) return new we(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 we(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 we(0, 0); if (window) { const o = window.getComputedStyle(t); if (o) { const a = parseInt(o.getPropertyValue("left"), 10), i = parseInt(o.getPropertyValue("top"), 10); n.x = isNaN(a) ? 0 : a, n.y = isNaN(i) ? 0 : i; } return n; } return null; } static copy(t) { return new we(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 mt { constructor(t, n) { this.width = t, this.height = n; } static getCurrent(t) { const n = new mt(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 mt(0, 0).set(t); } set(t) { return this.width = t.width, this.height = t.height, this; } } function pa(e, t) { const n = b(), o = b(), a = b(), i = b(), l = b(), u = b(), s = b(), r = b(), v = b(), d = b(), m = b(), f = b(e.resizeable), c = b(), h = b(e.draggable), k = b(!1); function I() { const F = o.value || document.body, E = window.getComputedStyle(F); if (!E || !n.value) return; const q = we.getTransformInfo(n.value), L = {}; s.value && (L.deltaL = n.value.offsetLeft - s.value.x, L.deltaT = n.value.offsetTop - s.value.y); const ee = E.getPropertyValue("position"); L.width = F.clientWidth, L.height = F.clientHeight, L.pr = parseInt(E.getPropertyValue("padding-right"), 10), L.pb = parseInt(E.getPropertyValue("padding-bottom"), 10), L.position = E.getPropertyValue("position"), ee === "static" && (F.style.position = "relative"), L.translateX = q.x, L.translateY = q.y, d.value = L; } function D(F) { if (n.value) { i.value = mt.getCurrent(n.value), l.value = we.getCurrent(n.value), u.value = i.value ? mt.copy(i.value) : null, s.value = l.value ? we.copy(l.value) : null, I(); const E = F.target.getAttribute("type") || ""; r.value = { n: !!E.match(/n/), s: !!E.match(/s/), w: !!E.match(/w/), e: !!E.match(/e/) }; } } function G() { var F, E, q, L; if (n.value) { const ee = n.value; r.value && ((r.value.n || r.value.s) && ((F = u.value) != null && F.height) && (ee.style.height = u.value.height + "px"), (r.value.w || r.value.e) && ((E = u.value) != null && E.width) && (ee.style.width = u.value.width + "px"), s.value && ((q = s.value) != null && q.x && (ee.style.left = s.value.x + "px"), (L = s.value) != null && L.y && (ee.style.top = s.value.y + "px"))); } } function w() { const F = e.minHeight ? e.minHeight : 1, E = e.minWidth ? e.minWidth : 1; u.value && s.value && r.value && i.value && (u.value.height < F && (u.value.height = F, r.value.n && l.value && (s.value.y = l.value.y + (i.value.height - F))), u.value.width < E && (u.value.width = E, r.value.w && l.value && (s.value.x = l.value.x + (i.value.width - E))), e.maxHeight && u.value.height > e.maxHeight && (u.value.height = e.maxHeight, l.value && r.value.n && (s.value.y = l.value.y + (i.value.height - e.maxHeight))), e.maxWidth && u.value.width > e.maxWidth && (u.value.width = e.maxWidth, r.value.w && l.value && (s.value.x = l.value.x + (i.value.width - e.maxWidth)))); } function C() { if (o.value) { const F = d.value; if (s.value && u.value && r.value && i.value) { const E = F.width - F.pr - F.deltaL - F.translateX - s.value.x, q = F.height - F.pb - F.deltaT - F.translateY - s.value.y; r.value.n && s.value.y + F.translateY < 0 && l.value && (s.value.y = -F.translateY, u.value.height = i.value.height + l.value.y + F.translateY), r.value.w && s.value.x + F.translateX < 0 && l.value && (s.value.x = -F.translateX, u.value.width = i.value.width + l.value.x + F.translateX), u.value.width > E && (u.value.width = E), u.value.height > q && (u.value.height = q); } } } function y(F) { if (!a.value || !i.value || !l.value || !r.value) return; F.subtract(a.value); const E = F.x, q = F.y; r.value.n ? (s.value.y = l.value.y + q, u.value.height = i.value.height - q) : r.value.s && (u.value.height = i.value.height + q), r.value.e ? u.value.width = i.value.width + E : r.value.w && (u.value.width = i.value.width - E, s.value.x = l.value.x + E), C(), w(), G(); } function B(F) { if (!v.value) return; const E = we.fromEvent(F); E && y(E); } function O() { if (n.value) { const { width: F, height: E, x: q, y: L } = n.value.getBoundingClientRect(), ee = we.getTransformInfo(n.value); return { size: { width: F, height: E }, position: { x: q - ee.x, y: L - ee.y } }; } return null; } function S(F) { if (n.value) { const E = O(); m.value = E; } a.value = void 0, i.value = null, l.value = null, u.value = null, s.value = null, r.value = null, v.value = null, document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", S); } function N() { document.addEventListener("mousemove", B), document.addEventListener("mouseup", S); } function g(F) { F instanceof MouseEvent && F.button === 2 || h.value && (document.body.click(), F.stopPropagation(), F.preventDefault(), a.value = we.fromEvent(F), v.value = F.target, D(F), N()); } function M(F) { return n.value = F, f.value && p(lt, null, [p("div", { class: "fv-resizable-handle fv-resizable-n", type: "n", onMousedown: (E) => g(E) }, null), p("div", { class: "fv-resizable-handle fv-resizable-e", type: "e", onMousedown: (E) => g(E) }, null), p("div", { class: "fv-resizable-handle fv-resizable-s", type: "s", onMousedown: (E) => g(E) }, null), p("div", { class: "fv-resizable-handle fv-resizable-w", type: "w", onMousedown: (E) => g(E) }, null), p("div", { class: "fv-resizable-handle fv-resizable-ne", type: "ne", onMousedown: (E) => g(E) }, null), p("div", { class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal", type: "se", onMousedown: (E) => g(E) }, null), p("div", { class: "fv-resizable-handle fv-resizable-sw", type: "sw", onMousedown: (E) => g(E) }, null), p("div", { class: "fv-resizable-handle fv-resizable-nw", type: "nw", onMousedown: (E) => g(E) }, null)]); } function R(F = !0) { document.body.click(); const E = o.value || document.body, q = mt.getCurrent(E), L = n.value; F && L && (c.value = O(), c.value.transform = L.style.transform), q && L && (u.value = q, u.value.height -= 14, u.value.width -= 14, L.style.height = u.value.height + "px", L.style.width = u.value.width + "px", L.style.left = "7px", L.style.top = "7px", L.style.transform = "", m.value = { size: u.value, position: { x: 0, y: 0 } }, h.value = !1, k.value = !0); } function j() { var F, E; if (document.body.click(), c.value) { const q = { width: c.value.size.width || 0, height: c.value.size.height || 0 }, L = { x: (window.innerWidth - q.width) / 2, y: (window.innerHeight - q.height) / 2 }; (F = u.value) == null || F.set(q), (E = s.value) == null || E.set(L); const ee = n.value; ee.style.height = q.height + "px", ee.style.width = q.width + "px", ee.style.left = `${L.x}px`, ee.style.top = `${L.y}px`, ee.style.transform = "", m.value = { size: q, position: L }, h.value = e.draggable, k.value = !1; } } function $() { if (n.value) { const F = mt.getCurrent(n.value); if (F) { const { width: E, height: q } = F; n.value.style.left = `${(window.innerWidth - E) / 2}px`, n.value.style.top = `${(window.innerHeight - q) / 2}px`, n.value.style.transform = ""; } } } function Y() { const F = () => { k.value ? R(!1) : $(), document.body.click(); }; return window.addEventListener("resize", F), () => { window.removeEventListener("resize", F); }; } const z = Y(); return { renderResizeBar: M, boundingElement: o, resizedEventParam: m, maximize: R, restore: j, allowDrag: h, isMaximized: k, unWindowResizeHandle: z, moveToCenter: $ }; } function va(e, t, n) { const o = b(), a = b(e.draggable), i = b(e.lockAxis), l = b(), u = b(), s = b(!1), r = b(new we(0, 0)), v = b(new we(0, 0)), d = b(new we(0, 0)), m = b(new we(0, 0)); me(() => n.value, (B) => { l.value.style.cursor = B ? "move" : "default"; }); function f(B, O) { if (O.tagName === "BUTTON") return !1; if (O === B) return !0; for (const S in O.children) if (Object.prototype.hasOwnProperty.call(O.children, S) && f(B, O.children[S])) return !0; return !1; } function c() { var N, g; let B = d.value.x + v.value.x, O = d.value.y + v.value.y; i.value === "x" ? (B = ((N = r.value) == null ? void 0 : N.x) || 0, d.value.x = 0) : i.value === "y" && (O = ((g = r.value) == null ? void 0 : g.y) || 0, d.value.y = 0); const S = `translate3d(${Math.round(B)}px, ${Math.round(O)}px, 0px)`; o.value && (o.value.style.transform = S), m.value.x = B, m.value.y = O; } function h() { if (!u.value || !o.value) return null; const B = u.value.getBoundingClientRect(), O = o.value.getBoundingClientRect(), S = { top: B.top < O.top, right: B.right > O.right, bottom: B.bottom > O.bottom, left: B.left < O.left }; return S.top || (d.value.y -= O.top - B.top), S.bottom || (d.value.y -= O.bottom - B.bottom), S.right || (d.value.x -= O.right - B.right), S.left || (d.value.x -= O.left - B.left), c(), S; } function k(B) { B && (r.value && B.subtract(r.value), d.value.set(B), c(), h()); } function I(B) { s.value && a.value && (B.stopPropagation(), B.preventDefault(), k(we.fromEvent(B, l.value))); } function D() { var B; s.value && (s.value = !1, v.value.add(d.value), d.value.reset(), (B = o.value) == null || B.classList.remove("ng-dragging"), t.emit("stopMove"), document.removeEventListener("mousemove", I), document.removeEventListener("mouseup", D)); } function G() { !s.value && l.value && (s.value = !0, l.value.classList.add("ng-dragging"), document.addEventListener("mousemove", I), document.addEventListener("mouseup", D)); } function w() { if (o.value) { const B = we.getTransformInfo(o.value); v.value.set(B); return; } v.value.reset(); } function C(B) { if (!n.value || B instanceof MouseEvent && B.button === 2) return; const O = B.target || B.srcElement; l.value !== void 0 && O && !f(O, l.value) || a.value !== !1 && (document.body.click(), B.stopPropagation(), B.preventDefault(), r.value = we.fromEvent(B, o.value), w(), G()); } function y(B, O, S) { if (a.value && O) { if (B) l.value = B; else if (e.dragHandle) { if (e.dragHandle instanceof HTMLElement) l.value = e.dragHandle; else if (typeof e.dragHandle == "string") { const N = O.querySelector(e.dragHandle); N && (l.value = N); } } o.value = O, u.value = S, l.value ? (l.value.classList.add("ng-draggable"), l.value.addEventListener("mousedown", C)) : a.value = !1; } } return { registerDraggle: y, resetTranslate: w }; } function Jn(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 ga(e, t) { const n = b(e.enableEsc); let o = null; return n.value ? (o = Jn("Escape", (a) => { t.emit("esc", { event: a.event, type: "esc" }); }), { remove: o }) : null; } function ya(e, t) { const n = b(e.enableEnter); let o = null; return n.value ? (o = Jn("Enter", (a) => { t.emit("enter", { event: a.event, type: "enter" }); }), { remove: o }) : null; } const vt = /* @__PURE__ */ Xe({ name: "FModal", props: Yn, 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), i = b(""), l = b(e.class), u = b(e.fitContent), s = b(e.showHeader), r = b(""), v = b(e.showCloseButton), d = b(e.showMaxButton), m = b(!1), f = b(e.dialogType), c = b(e.src), h = b(""), k = b(e.showButtons), I = b(e.title), D = b(e.containment || null), G = b(), { t: w } = Kt(); I.value === "错误提示" && (I.value = w("messageBox.errorTitle")); const C = b(!1); function y(P, ne) { const pe = ne ? "accept" : "cancel"; Promise.resolve().then(() => { var ge; return (ge = e.beforeClose) == null ? void 0 : ge.call(e, { closeType: pe }); }).then((ge) => { ge && (a.value = !1, t.emit("update:modelValue", !1), ne != null && t.emit(ne ? "accept" : "cancel"), t.emit("closed", P)); }); } const B = [{ name: "cancel", text: w("messageBox.cancel") || "取消", class: "btn btn-secondary", handle: (P) => { y(P, !1); } }, { name: "accept", text: w("messageBox.ok") || "确定", class: "btn btn-primary", handle: (P) => { y(P, !0); } }], O = b(e.buttons && e.buttons.length ? e.buttons : B), S = H(() => !!r.value), N = H(() => !!k.value && !!O.value), g = b(), M = b(), R = b(!1), { renderResizeBar: j, maximize: $, restore: Y, boundingElement: z, resizedEventParam: F, allowDrag: E, unWindowResizeHandle: q, moveToCenter: L } = pa(e), { registerDraggle: ee } = va(e, t, E); function le() { return !!document.querySelectorAll(".farris-modal").length && document.body.classList.contains("modal-open"); } function fe() { const P = document.querySelectorAll(".farris-modal").length; (!P || P - 1 <= 0) && document.body.classList.remove("modal-open"), G.value && G.value.classList.remove("show"); } me(() => e.title, (P, ne) => { P !== ne && (I.value = P); }), me(() => e.modelValue, (P, ne) => { P !== ne && (a.value = P, a.value && e.draggable && pt(() => { M.value && !D.value && (D.value = M.value.parentElement, z.value = D.value, ee(g.value, M.value, z.value), L()); }), P || (D.value && (D.value = null), fe())), a.value ? C.value = le() : (R.value = !1, E.value = e.draggable); }), me(() => e.showHeader, (P, ne) => { P !== ne && (s.value = P); }), me(() => e.showButtons, (P, ne) => { P !== ne && (k.value = P); }), me(() => F.value, (P, ne) => { const pe = P || {}, ge = ne || {}; JSON.stringify(pe) !== JSON.stringify(ge) && t.emit("resize", { newSize: P, oldSize: ne, isMaximized: R.value }); }); const Z = H(() => (a.value && document.body.classList.add("modal-open"), a.value)), ae = H(() => { var pe; const P = { modal: !0, "farris-modal": !0, fade: !0 }; P["f-modal-fitContent"] = !!u.value, P.show = !!Z.value; const ne = (pe = e.maskClass) == null ? void 0 : pe.split(" "); return ne == null || ne.reduce((ge, We) => (ge[We] = !0, ge), P), P; }), ye = H(() => { var pe; const P = { "modal-dialog": !0 }, ne = (pe = l.value) == null ? void 0 : pe.split(" "); return ne == null || ne.reduce((ge, We) => (ge[We] = !0, ge), P), P; }), oe = H(() => { const P = { 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 || (P.pointerEvents = "auto"), P; }), X = H(() => { const P = { display: "block" }; return e.mask || (P.pointerEvents = "none", P.backgroundColor = "transparent"), C.value && (P.backgroundColor = "transparent"), P; }), se = H(() => ({ "modal-content": !0, "modal-content-has-header": s.value })), Pe = H(() => { const P = { display: s.value ? "" : "none" }; return P["pointer-events"] = E.value ? "auto" : "none", P; }), De = H(() => ({ "f-icon": !0, modal_maximize: !0, modalrevert: R.value })), Oe = H(() => ({ "modal-body": !0, "f-utils-flex-column": f.value === "iframe", "f-utils-fill": !0 })); function Ye() { return { height: `${e.footerHeight || 60}px` }; } const Ue = H(() => { const P = { textAlgin: h.value }, ne = Ye(); return Object.assign(P, ne); }); function Ne(P) { if (P == null || P.stopPropagation(), R.value) { R.value = !1, Y(); return; } $(), R.value = !0; } async function he(P, ne) { P.handle && await P.handle(ne, P) && t.emit("closed", ne); } function et(P) { P.width && (n.value = P.width), P.height && (o.value = P.height), P.buttons && (O.value = P.buttons), P.title && (I.value = P.title); } let ce = null, ze = null; wo(() => { C.value = le(); }), it(() => { M.value && !D.value && (D.value = M.value.parentElement, z.value = D.value, ee(g.value, M.value, z.value)), Z.value && document.body.classList.add("modal-open"), ce = ga(e, t), ze = ya(e, t); }), Ct(() => { q && q(), ce && ce.remove(), ze && ze.remove(); }), t.expose({ modalElementRef: M, updateModalOptions: et, close: y, maxDialog: Ne, isMaximized: R }); function He() { return p("ul", null, [m.value && p("li", { class: "f-btn-icon f-bare" }, [p("span", { class: "f-icon modal_minimize" }, null)]), d.value && p("li", { onClick: Ne, class: "f-btn-icon f-bare", style: "pointer-events: auto;" }, [p("span", { class: De.value }, null)]), v.value && p("li", { class: "f-btn-icon f-bare", onClick: (P) => y(P, !1), style: "pointer-events: auto;" }, [p("span", { class: "f-icon modal_close" }, null)])]); } function $e() { return p("div", { class: "modal-footer", style: Ue.value }, [O.value && O.value.map((P) => { const ne = b(P.disabled); return p("button", { name: P.name, type: "button", disabled: ne.value, class: P.class + (P.iconClass ? " btn-icontext" : ""), onClick: (pe) => { he(P, pe); } }, [!!P.iconClass && p("i", { class: P.iconClass }, null), P.text]); })]); } function Ae() { return p("div", { ref: g, class: "modal-header", style: Pe.value }, [t.slots.headerTemplate ? t.slots.headerTemplate() : p("div", { class: "modal-title" }, [S.value && p("span", { class: r.value, style: "margin-right: 8px" }, null), p("span", { class: "modal-title-label" }, [I.value])]), p("div", { class: "actions" }, [He()])]); } function Fe() { return t.slots.footerTemplate ? t.slots.footerTemplate() : N.value && $e(); } function Le(P) { if (P.stopPropagation(), e.allowClickMaskToClose) { if (P.target !== G.value) return; y(P, !1); } } function Re() { var P, ne; return p("div", { id: i.value, class: ye.value, style: oe.value, ref: M }, [p("div", { class: se.value }, [s.value && Ae(), p("div", { class: Oe.value }, [(ne = (P = t.slots).default) == null ? void 0 : ne.call(P), f.value === "iframe" && p("iframe", { title: i.value, class: "f-utils-fill", width: "100%", frameborder: "0", src: c.value }, null)]), Fe()]), !u.value && M.value && !R.value && j(M.value)]); } function Ge(P) { return P || "body"; } return () => p(cn, { to: Ge(e.host) }, { default: () => [Z.value && p(dn, { name: "fade", appear: !0 }, { default: () => [p("div", { ref: G, class: ae.value, style: X.value, onClick: Le }, [Re()])] })] }); } }); function Qn(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function ha(e) { const t = document.createElement("div"); t.style.display = "contents"; const n = Zt({ setup(o, a) { Ct(() => { document.body.removeChild(t); }); const i = b(), l = b(e.class || ""), u = b(!!e.showButtons), s = b(!!e.showHeader), r = b(e.showCloseButton == null ? !0 : e.showCloseButton), v = b(!0), d = b(e.title || ""), m = e.acceptCallback || (() => { }), f = e.rejectCallback || (() => { }), c = e.closedCallback || ((G) => { }), h = e.resizeHandle || ((G) => { }), k = e.stopMoveHandle || ((G) => { }), I = Qn(e), D = (G) => { v.value = !1, n.unmount(), c(G); }; return it(() => { }), a.expose({ modalRef: i }), () => p(vt, { ref: i, class: l.value, modelValue: v.value, "onUpdate:modelValue": (G) => v.value = G, title: d.value, width: e.width, height: e.height, buttons: e.buttons, "show-header": s.value, "show-buttons": u.value, "show-close-button": r.value, "show-max-button": !1, onAccept: m, onCancel: f, fitContent: e.fitContent == null ? !0 : e.fitContent, onClosed: D, onResize: h, onStopMove: k }, { default: () => [I && I(n)] }); } }); return document.body.appendChild(t), n.use(Vt.i18n), n.mount(t), n; } class Zn { constructor(t) { je(this, "appContext", null); je(this, "modalRef", b()); je(this, "activeModalIndex", b(0)); je(this, "modalRefs", {}); je(this, "isUseEscCloseModal", b(!1)); je(this, "activeModalInstance", H(() => 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 ha(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 = So(Object.assign({ title: "", showButtons: !0, showHeader: !0 }, t)), a = b(!0), i = o.value.acceptCallback || (() => { }), l = o.value.rejectCallback || (() => { }), u = o.value.closedCallback || ((C, y) => { }), s = o.value.resizeHandle || ((C) => { }), r = t.stopMoveHandle || ((C) => { }); let v; const d = Qn(o.value), m = (C) => { var B; a.value = !1; const y = (B = C == null ? void 0 : C.target) == null ? void 0 : B.classList.contains("modal_close"); u(C, this.isUseEscCloseModal.value ? "esc" : y ? "icon" : "button"); }, f = (C) => { m(C), v && pt(() => { if (this.modalRefs[this.activeModalIndex.value] && delete this.modalRefs[this.activeModalIndex.value], Xt(null, n), v = null, this.modalRef.value = null, this.modalRefs) { const y = Object.keys(this.modalRefs).map((B) => Number(B)); y.length > 0 ? this.activeModalIndex.value = Math.max(...y) : this.activeModalIndex.value = 0; } this.isUseEscCloseModal.value = !1; }); }, c = (C) => { var y; this.isUseEscCloseModal.value = !0, this.activeModalInstance && ((y = this.activeModalInstance.value) == null || y.close(C == null ? void 0 : C.event)); }, { width: h, height: k } = o.value, I = this.adaptToWindow(h || 500, k || 320); Object.assign(o.value, I); const D = () => p(vt, Lt({ ref: this.modalRef, modelValue: a.value, "onUpdate:modelValue": (C) => a.value = C }, o.value, { onAccept: i, onCancel: l, onClosed: f, onResize: s, onEsc: c, onStopMove: r }), { default: () => [d && d(this.app)] }); return v = ((C) => { const y = xo(D, C); return y.appContext = this.appContext, Xt(y, n), y; })({ ...o.value // 'onUpdate:modelValue': onUpdateModelValue, }), this.activeModalIndex.value++, this.modalRefs[this.activeModalIndex.value] = this.modalRef.value, { update: (C) => { o.value = { ...o.value, ...C }, v && Xt(To(v, { ...o }), n); }, destroy: f, modalRef: this.activeModalInstance, close: () => this.close() }; } } function ba(e = {}) { function t(r, v, d, m) { if (typeof d == "number") return m[r].length === d; if (typeof d == "object") { const f = Object.keys(d)[0], c = d[f]; if (f === "not") return Number(m[r].length) !== Number(c); if (f === "moreThan") return Number(m[r].length) >= Number(c); if (f === "lessThan") return Number(m[r].length) <= Number(c); } return !1; } function n(r, v, d, m) { return m[r] && m[r].propertyValue && String(m[r].propertyValue.value) === String(d); } const o = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((r, v) => (r.set(v, e[v]), r), o); function a(r, v) { const d = r; return typeof v == "number" ? [{ target: d, operator: "length", param: null, value: Number(v) }] : typeof v == "boolean" ? [{ target: d, operator: "getProperty", param: r, value: !!v }] : typeof v == "object" ? Object.keys(v).map((m) => { if (m === "length") return { target: d, operator: "length", param: null, value: v[m] }; const f = m, c = v[m]; return { target: d, operator: "getProperty", param: f, value: c }; }) : []; } function i(r) { return Object.keys(r).reduce((d, m) => { const f = a(m, r[m]); return d.push(...f), d; }, []); } function l(r, v) { if (o.has(r.operator)) { const d = o.get(r.operator); return d && d(r.target, r.param, r.value, v) || !1; } return !1; } function u(r, v) { return i(r).reduce((f, c) => f && l(c, v), !0); } function s(r, v) { const d = Object.keys(r), m = d.includes("allOf"), f = d.includes("anyOf"), c = m || f, I = (c ? r[c ? m ? "allOf" : "anyOf" : "allOf"] : [r]).map((G) => u(G, v)); return m ? !I.includes(!1) : I.includes(!0); } return { parseValueSchema: s }; } const Ca = { convertTo: (e, t, n, o) => { e.appearance || (e.appearance = {}), e.appearance[t] = n; }, convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t] }, wa = { convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无" }, Sa = { 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] }, A = { 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: "多语输入框" } }, xa = { convertFrom: (e, t, n) => { var a; const o = e.editor && e.editor[t] ? e.editor[t] : e[t]; return ((a = A[o]) == null ? void 0 : a.name) || o; } }, Ta = { convertTo: (e, t, n, o) => { e[t] = e[t]; }, convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : "" }, Ba = { 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"; } }, Fa = { 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 : "" }, ka = { 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 ""; } }, Oa = { 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 : "" }, Ma = { 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; } } }, Ea = { convertFrom: (e, t) => e.binding ? e.binding.path : "