@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,525 lines • 599 kB
JavaScript
var Jo = Object.defineProperty;
var Zo = (e, n, t) => n in e ? Jo(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
var V = (e, n, t) => Zo(e, typeof n != "symbol" ? n + "" : n, t);
import { defineComponent as Te, ref as k, computed as B, createVNode as F, Teleport as Sa, createApp as Hn, onUnmounted as sn, Fragment as Qt, watch as ye, nextTick as Tt, onBeforeMount as ei, onMounted as Je, Transition as Ta, shallowRef as ti, render as En, h as ni, cloneVNode as ai, mergeProps as Ct, inject as Ye, withDirectives as An, vShow as oi, onBeforeUnmount as Fn, reactive as St, createTextVNode as je, resolveDirective as ii, provide as zn, triggerRef as ri, isVNode as li, vModelText as si, onUpdated as Ma } from "vue";
import { isPlainObject as ia, cloneDeep as dt, isUndefined as ct, throttle as ui } from "lodash-es";
import Ea from "../tags/index.esm.js";
import ci from "../popover/index.esm.js";
import Oa from "../list-view/index.esm.js";
import _a, { FButtonEdit as Da } from "../button-edit/index.esm.js";
import Ia from "../../designer/button-edit/index.esm.js";
import { useGuid as di, resolveField as lt, FormSchemaEntityFieldTypeName as ra, useCommonUtils as fi, useDateFormat as pi, useNumberFormat as mi, setFieldValue as Nn, getCustomClass as fn, withInstall as Sn, FormSchemaEntityField$Type as la, FormSchemaEntityFieldType$Type as Pa, getCustomStyle as hi } from "../common/index.esm.js";
import { DgControl as sa, useDesignerComponent as yi } from "../designer-canvas/index.esm.js";
import { useResizeObserver as Ba } from "@vueuse/core";
import { useIdentify as vi, useGroupData as gi, useFilter as bi, useHierarchy as wi, useLoading as Ci, useDataView as xi, useSelection as ki, useSelectHierarchyItem as Fi, useDataViewContainerStyle as Si, useCommandColumn as Ti, useColumn as Mi, useSort as Ei, useGroupColumn as Oi, useRow as _i, useEdit as Di, useVisualDataBound as Ii, useVisualDataCell as Pi, useVisualDataRow as Bi, useVisualData as Vi, useCellPosition as Ni, useSidebar as Ri, useVirtualScroll as ji, useFitColumn as Li, useFilterHistory as $i, useColumnFilter as Wi, useDragColumn as Hi, getColumnHeader as Ai, getSidebar as zi, getDisableMask as qi, getHorizontalScrollbar as Gi, getVerticalScrollbar as Yi, getEmpty as Ui } from "../data-view/index.esm.js";
import "../modal/index.esm.js";
import Xi from "../transfer/index.esm.js";
import Qi from "../tabs/index.esm.js";
import Ki from "../order/index.esm.js";
import "../condition/index.esm.js";
import { FCheckbox as Ji } from "../checkbox/index.esm.js";
import Zi from "../filter-bar/index.esm.js";
import ua from "../tooltip/index.esm.js";
import er from "../pagination/index.esm.js";
import tr from "../button/index.esm.js";
import nr from "../search-box/index.esm.js";
import ar, { FDynamicFormGroup as or, FDynamicFormInput as ir } from "../dynamic-form/index.esm.js";
import { createPropsResolver as rr } from "../dynamic-resolver/index.esm.js";
import "../property-panel/index.esm.js";
import lr from "../accordion/index.esm.js";
import sr from "../avatar/index.esm.js";
import ur from "../button-group/index.esm.js";
import cr from "../calendar/index.esm.js";
import dr from "../capsule/index.esm.js";
import ca from "../../designer/checkbox/index.esm.js";
import da from "../../designer/checkbox-group/index.esm.js";
import Rn from "../combo-list/index.esm.js";
import fr from "../combo-tree/index.esm.js";
import pr from "../component/index.esm.js";
import mr from "../color-picker/index.esm.js";
import hr from "../content-container/index.esm.js";
import yr from "../date-picker/index.esm.js";
import vr from "../../designer/data-grid/index.esm.js";
import gr from "../dropdown/index.esm.js";
import br from "../events-editor/index.esm.js";
import wr from "../field-selector/index.esm.js";
import Cr from "../binding-selector/index.esm.js";
import xr from "../image-cropper/index.esm.js";
import kr from "../../designer/input-group/index.esm.js";
import Fr from "../layout/index.esm.js";
import Sr from "../list-nav/index.esm.js";
import Tr from "../lookup/index.esm.js";
import Mr from "../mapping-editor/index.esm.js";
import Er from "../nav/index.esm.js";
import Or from "../number-range/index.esm.js";
import _r from "../number-spinner/index.esm.js";
import Dr from "../page-header/index.esm.js";
import Ir from "../page-footer/index.esm.js";
import Pr from "../progress/index.esm.js";
import Br from "../query-solution/index.esm.js";
import Vr from "../../designer/radio-group/index.esm.js";
import Nr from "../rate/index.esm.js";
import Rr from "../response-toolbar/index.esm.js";
import jr from "../response-layout/index.esm.js";
import Lr from "../response-layout-editor/index.esm.js";
import $r from "../section/index.esm.js";
import Wr from "../smoke-detector/index.esm.js";
import Hr from "../splitter/index.esm.js";
import Ar from "../step/index.esm.js";
import zr from "../switch/index.esm.js";
import qr from "../text/index.esm.js";
import Gr from "../time-picker/index.esm.js";
import qn from "../tree-view/index.esm.js";
import Yr from "../uploader/index.esm.js";
import Ur from "../verify-detail/index.esm.js";
import Xr from "../video/index.esm.js";
import Qr from "../textarea/index.esm.js";
import Kr from "../schema-selector/index.esm.js";
import Jr from "../tree-grid/index.esm.js";
import Va from "../event-parameter/index.esm.js";
import Zr from "../filter-condition-editor/index.esm.js";
import el from "../fieldset/index.esm.js";
import tl from "../sort-condition-editor/index.esm.js";
import nl from "../menu-lookup/index.esm.js";
import al from "../drawer/index.esm.js";
import ol from "../json-editor/index.esm.js";
import il from "../property-editor/index.esm.js";
import rl from "../expression-editor/index.esm.js";
import ll from "../code-editor/index.esm.js";
import sl from "../html-template/index.esm.js";
import "../external-container/index.esm.js";
import "../notify/index.esm.js";
const Na = {}, Ra = {};
function Gn(e) {
const { properties: n, title: t, ignore: a } = e, o = a && Array.isArray(a), i = Object.keys(n).reduce((r, l) => ((!o || !a.find((u) => u === l)) && (r[l] = n[l].type === "object" && n[l].properties ? Gn(n[l]) : dt(n[l].default)), r), {});
if (t && (!o || !a.find((r) => r === "id"))) {
const r = t.toLowerCase().replace(/-/g, "_");
i.id = `${r}_${Math.random().toString().slice(2, 6)}`;
}
return i;
}
function ul(e) {
const { properties: n, title: t, required: a } = e;
if (a && Array.isArray(a)) {
const o = a.reduce((i, r) => (i[r] = n[r].type === "object" && n[r].properties ? Gn(n[r]) : dt(n[r].default), i), {});
if (t && a.find((i) => i === "id")) {
const i = t.toLowerCase().replace(/-/g, "_");
o.id = `${i}_${Math.random().toString().slice(2, 6)}`;
}
return o;
}
return {
type: t
};
}
function ja(e, n = {}, t) {
const a = Na[e];
if (a) {
let o = ul(a);
const i = Ra[e];
return o = i ? i({ getSchemaByType: ja }, o, n, t) : o, o;
}
return null;
}
function cl(e, n) {
const t = Gn(n);
return Object.keys(t).reduce((a, o) => (Object.prototype.hasOwnProperty.call(e, o) && (a[o] && ia(a[o]) && ia(e[o] || !e[o]) ? Object.assign(a[o], e[o] || {}) : a[o] = e[o]), a), t), t;
}
function La(e, n) {
return Object.keys(e).filter((a) => e[a] != null).reduce((a, o) => {
if (n.has(o)) {
const i = n.get(o);
if (typeof i == "string")
a[i] = e[o];
else {
const r = i(o, e[o], e);
Object.assign(a, r);
}
} else
a[o] = e[o];
return a;
}, {});
}
function dl(e, n, t = /* @__PURE__ */ new Map()) {
const a = cl(e, n);
return La(a, t);
}
function fl(e = {}) {
function n(c, f, s, d) {
if (typeof s == "number")
return d[c].length === s;
if (typeof s == "object") {
const p = Object.keys(s)[0], m = s[p];
if (p === "not")
return Number(d[c].length) !== Number(m);
if (p === "moreThan")
return Number(d[c].length) >= Number(m);
if (p === "lessThan")
return Number(d[c].length) <= Number(m);
}
return !1;
}
function t(c, f, s, d) {
return d[c] && d[c].propertyValue && String(d[c].propertyValue.value) === String(s);
}
const a = /* @__PURE__ */ new Map([
["length", n],
["getProperty", t]
]);
Object.keys(e).reduce((c, f) => (c.set(f, e[f]), c), a);
function o(c, f) {
const s = c;
return typeof f == "number" ? [{ target: s, operator: "length", param: null, value: Number(f) }] : typeof f == "boolean" ? [{ target: s, operator: "getProperty", param: c, value: !!f }] : typeof f == "object" ? Object.keys(f).map((d) => {
if (d === "length")
return { target: s, operator: "length", param: null, value: f[d] };
const p = d, m = f[d];
return { target: s, operator: "getProperty", param: p, value: m };
}) : [];
}
function i(c) {
return Object.keys(c).reduce((s, d) => {
const p = o(d, c[d]);
return s.push(...p), s;
}, []);
}
function r(c, f) {
if (a.has(c.operator)) {
const s = a.get(c.operator);
return s && s(c.target, c.param, c.value, f) || !1;
}
return !1;
}
function l(c, f) {
return i(c).reduce((p, m) => p && r(m, f), !0);
}
function u(c, f) {
const s = Object.keys(c), d = s.includes("allOf"), p = s.includes("anyOf"), m = d || p, h = (m ? c[m ? d ? "allOf" : "anyOf" : "allOf"] : [c]).map((g) => l(g, f));
return d ? !h.includes(!1) : h.includes(!0);
}
return { parseValueSchema: u };
}
const re = {
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: "列表导航" },
"filter-bar": { type: "filter-bar", name: "筛选条" }
}, pl = {}, ml = {};
fl();
function st(e, n, t = /* @__PURE__ */ new Map(), a = (r, l, u, c) => l, o = {}, i = (r) => r) {
return Na[n.title] = n, Ra[n.title] = a, pl[n.title] = o, ml[n.title] = i, (r = {}, l = !0) => {
if (!l)
return La(r, t);
const u = dl(r, n, t), c = Object.keys(e).reduce((f, s) => (f[s] = e[s].default, f), {});
return Object.assign(c, u);
};
}
function Jt(e, n) {
return { customClass: n.class, customStyle: n.style };
}
function hl() {
function e(n, t) {
const { dataSource: a } = n || {};
return a === void 0 ? {} : {};
}
return {
resolve: e
};
}
function yl() {
function e(n, t) {
return n.selectItemById(t);
}
return {
selectItemById: e
};
}
function vl() {
function e(n, t) {
const { columns: a } = t;
return n.updateColumns(a);
}
return {
updateColumns: e
};
}
const gl = "https://json-schema.org/draft/2020-12/schema", bl = "https://farris-design.gitee.io/field-selector.schema.json", wl = "field-selector", Cl = "A Farris Input Component", xl = "object", kl = {
disabled: {
description: "",
type: "boolean",
default: !1
},
readonly: {
description: "",
type: "boolean",
default: !1
},
modelValue: {
description: "",
type: "string",
default: ""
},
repositoryToken: {
description: "",
type: "object",
default: null
},
fields: {
description: "",
type: "array",
default: null
},
editorParams: {
type: "object",
default: null
},
displayText: {
description: "",
type: "string",
default: ""
},
enableClear: {
description: "",
type: "boolean",
default: !0
},
beforeOpen: {
description: "",
type: "function",
default: null
},
onSubmitModal: {
description: "",
type: "function",
default: null
}
}, Fl = {
$schema: gl,
$id: bl,
title: wl,
description: Cl,
type: xl,
properties: kl
}, $a = {
disabled: {
type: Boolean,
default: !1
},
readonly: {
type: Boolean,
default: !1
},
enableClear: {
type: Boolean,
default: !0
},
displayText: {
type: String,
default: ""
},
enableExpress: {
type: Boolean,
default: !1
},
modelValue: {
type: String,
default: ""
},
insertType: {
type: String,
default: "below"
// 'above'|'below'
},
fields: {
type: Array,
default: []
},
repositoryToken: {
type: Object,
default: null
},
editorParams: {
type: Object,
default: null
},
onSubmitModal: {
type: Function,
default: null
},
beforeOpen: {
type: Function,
default: null
}
}, Sl = st($a, Fl), Tl = {
/**
* 组件标识
*/
id: String,
/**
* 扩展按钮显示内容,这是一段现在扩展按钮中的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: 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" }
}, Ml = {
popupContentPosition: { type: Object, default: { left: 0, top: 0 } },
host: { type: Object },
backgroundColor: { type: String, default: "" }
}, El = /* @__PURE__ */ Te({
name: "FOverlay",
props: Ml,
emits: ["click"],
setup(e, n) {
const t = k(e.popupContentPosition), a = k(e.host), o = B(() => ({
backgroundColor: e.backgroundColor || "",
pointerEvents: "auto"
}));
function i(l) {
n.emit("click"), l.preventDefault(), l.stopPropagation();
}
B(() => {
const l = a.value;
if (l) {
const u = l.getBoundingClientRect(), {
left: c,
top: f,
height: s
} = u;
return {
left: c,
top: f + s
};
}
return t.value;
});
const r = B(() => ({
// position: 'relative',
// left: `${position.value.left}px`,
// top: `${position.value.top}px`
}));
return () => F(Sa, {
to: "body"
}, {
default: () => {
var l, u;
return [F("div", {
class: "overlay-container",
onClick: (c) => i(c),
style: o.value
}, [F("div", {
style: r.value
}, [(u = (l = n.slots).default) == null ? void 0 : u.call(l)])])];
}
});
}
});
function Ol(e) {
if (e.content && e.content.render)
return e.content.render;
if (e.render && typeof e.render == "function")
return e.render;
}
function _l(e) {
const n = document.createElement("div");
n.style.display = "contents";
let t;
const a = e.onClickCallback || (() => {
}), o = () => {
a(), t && t.unmount();
};
return t = Hn({
setup() {
sn(() => {
document.body.removeChild(n);
});
const i = Ol(e);
return () => F(El, {
"popup-content-position": e.popupPosition,
host: e.host,
onClick: o,
backgroundColor: e.backgroundColor
}, {
default: () => [i && i()]
});
}
}), document.body.appendChild(n), t.mount(n), t;
}
class Dl {
static show(n) {
return _l(n);
}
}
const Il = {
/**
* 允许点击遮罩关闭对话框
*/
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 }
};
class Xe {
constructor(n, t) {
this.x = n, this.y = t;
}
static getTransformInfo(n) {
const a = window.getComputedStyle(n).getPropertyValue("transform").replace(/[^-\d,]/g, "").split(",");
if (a.length >= 6) {
const o = parseInt(a[4], 10), i = parseInt(a[5], 10);
return { x: o, y: i };
}
return { x: 0, y: 0 };
}
static fromEvent(n, t = null) {
if (this.isMouseEvent(n))
return new Xe(n.clientX, n.clientY);
if (t === null || n.changedTouches.length === 1)
return new Xe(n.changedTouches[0].clientX, n.changedTouches[0].clientY);
for (let a = 0; a < n.changedTouches.length; a++)
if (n.changedTouches[a].target === t)
return new Xe(n.changedTouches[a].clientX, n.changedTouches[a].clientY);
}
static isMouseEvent(n) {
return Object.prototype.toString.apply(n).indexOf("MouseEvent") === 8;
}
static isIPosition(n) {
return !!n && "x" in n && "y" in n;
}
static getCurrent(n) {
const t = new Xe(0, 0);
if (window) {
const a = window.getComputedStyle(n);
if (a) {
const o = parseInt(a.getPropertyValue("left"), 10), i = parseInt(a.getPropertyValue("top"), 10);
t.x = isNaN(o) ? 0 : o, t.y = isNaN(i) ? 0 : i;
}
return t;
}
return null;
}
static copy(n) {
return new Xe(0, 0).set(n);
}
get value() {
return { x: this.x, y: this.y };
}
add(n) {
return this.x += n.x, this.y += n.y, this;
}
subtract(n) {
return this.x -= n.x, this.y -= n.y, this;
}
multiply(n) {
this.x *= n, this.y *= n;
}
divide(n) {
this.x /= n, this.y /= n;
}
reset() {
return this.x = 0, this.y = 0, this;
}
set(n) {
return this.x = n.x, this.y = n.y, this;
}
}
class zt {
constructor(n, t) {
this.width = n, this.height = t;
}
static getCurrent(n) {
const t = new zt(0, 0);
if (window) {
const a = window.getComputedStyle(n);
return a && (t.width = parseInt(a.getPropertyValue("width"), 10), t.height = parseInt(a.getPropertyValue("height"), 10)), t;
}
return null;
}
static copy(n) {
return new zt(0, 0).set(n);
}
set(n) {
return this.width = n.width, this.height = n.height, this;
}
}
function Pl(e, n) {
const t = k(), a = k(), o = k(), i = k(), r = k(), l = k(), u = k(), c = k(), f = k(), s = k(), d = k(), p = k(e.resizeable), m = k(), T = k(e.draggable), y = k(!1);
function h() {
const L = a.value || document.body, N = window.getComputedStyle(L);
if (!N || !t.value)
return;
const Q = Xe.getTransformInfo(t.value), j = {};
u.value && (j.deltaL = t.value.offsetLeft - u.value.x, j.deltaT = t.value.offsetTop - u.value.y);
const R = N.getPropertyValue("position");
j.width = L.clientWidth, j.height = L.clientHeight, j.pr = parseInt(N.getPropertyValue("padding-right"), 10), j.pb = parseInt(N.getPropertyValue("padding-bottom"), 10), j.position = N.getPropertyValue("position"), R === "static" && (L.style.position = "relative"), j.translateX = Q.x, j.translateY = Q.y, s.value = j;
}
function C(L) {
if (t.value) {
i.value = zt.getCurrent(t.value), r.value = Xe.getCurrent(t.value), l.value = i.value ? zt.copy(i.value) : null, u.value = r.value ? Xe.copy(r.value) : null, h();
const N = L.target.getAttribute("type") || "";
c.value = {
n: !!N.match(/n/),
s: !!N.match(/s/),
w: !!N.match(/w/),
e: !!N.match(/e/)
};
}
}
function g() {
var L, N, Q, j;
if (t.value) {
const R = t.value;
c.value && ((c.value.n || c.value.s) && ((L = l.value) != null && L.height) && (R.style.height = l.value.height + "px"), (c.value.w || c.value.e) && ((N = l.value) != null && N.width) && (R.style.width = l.value.width + "px"), u.value && ((Q = u.value) != null && Q.x && (R.style.left = u.value.x + "px"), (j = u.value) != null && j.y && (R.style.top = u.value.y + "px")));
}
}
function S() {
const L = e.minHeight ? e.minHeight : 1, N = e.minWidth ? e.minWidth : 1;
l.value && u.value && c.value && i.value && (l.value.height < L && (l.value.height = L, c.value.n && r.value && (u.value.y = r.value.y + (i.value.height - L))), l.value.width < N && (l.value.width = N, c.value.w && r.value && (u.value.x = r.value.x + (i.value.width - N))), e.maxHeight && l.value.height > e.maxHeight && (l.value.height = e.maxHeight, r.value && c.value.n && (u.value.y = r.value.y + (i.value.height - e.maxHeight))), e.maxWidth && l.value.width > e.maxWidth && (l.value.width = e.maxWidth, c.value.w && r.value && (u.value.x = r.value.x + (i.value.width - e.maxWidth))));
}
function w() {
if (a.value) {
const L = s.value;
if (u.value && l.value && c.value && i.value) {
const N = L.width - L.pr - L.deltaL - L.translateX - u.value.x, Q = L.height - L.pb - L.deltaT - L.translateY - u.value.y;
c.value.n && u.value.y + L.translateY < 0 && r.value && (u.value.y = -L.translateY, l.value.height = i.value.height + r.value.y + L.translateY), c.value.w && u.value.x + L.translateX < 0 && r.value && (u.value.x = -L.translateX, l.value.width = i.value.width + r.value.x + L.translateX), l.value.width > N && (l.value.width = N), l.value.height > Q && (l.value.height = Q);
}
}
}
function b(L) {
if (!o.value || !i.value || !r.value || !c.value)
return;
L.subtract(o.value);
const N = L.x, Q = L.y;
c.value.n ? (u.value.y = r.value.y + Q, l.value.height = i.value.height - Q) : c.value.s && (l.value.height = i.value.height + Q), c.value.e ? l.value.width = i.value.width + N : c.value.w && (l.value.width = i.value.width - N, u.value.x = r.value.x + N), w(), S(), g();
}
function v(L) {
if (!f.value)
return;
const N = Xe.fromEvent(L);
N && b(N);
}
function M() {
if (t.value) {
const {
width: L,
height: N,
x: Q,
y: j
} = t.value.getBoundingClientRect(), R = Xe.getTransformInfo(t.value);
return {
size: {
width: L,
height: N
},
position: {
x: Q - R.x,
y: j - R.y
}
};
}
return null;
}
function O(L) {
if (t.value) {
const N = M();
d.value = N;
}
o.value = void 0, i.value = null, r.value = null, l.value = null, u.value = null, c.value = null, f.value = null, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", O);
}
function E() {
document.addEventListener("mousemove", v), document.addEventListener("mouseup", O);
}
function x(L) {
L instanceof MouseEvent && L.button === 2 || T.value && (document.body.click(), L.stopPropagation(), L.preventDefault(), o.value = Xe.fromEvent(L), f.value = L.target, C(L), E());
}
function I(L) {
return t.value = L, p.value && F(Qt, null, [F("div", {
class: "fv-resizable-handle fv-resizable-n",
type: "n",
onMousedown: (N) => x(N)
}, null), F("div", {
class: "fv-resizable-handle fv-resizable-e",
type: "e",
onMousedown: (N) => x(N)
}, null), F("div", {
class: "fv-resizable-handle fv-resizable-s",
type: "s",
onMousedown: (N) => x(N)
}, null), F("div", {
class: "fv-resizable-handle fv-resizable-w",
type: "w",
onMousedown: (N) => x(N)
}, null), F("div", {
class: "fv-resizable-handle fv-resizable-ne",
type: "ne",
onMousedown: (N) => x(N)
}, null), F("div", {
class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal",
type: "se",
onMousedown: (N) => x(N)
}, null), F("div", {
class: "fv-resizable-handle fv-resizable-sw",
type: "sw",
onMousedown: (N) => x(N)
}, null), F("div", {
class: "fv-resizable-handle fv-resizable-nw",
type: "nw",
onMousedown: (N) => x(N)
}, null)]);
}
function D(L = !0) {
document.body.click();
const N = a.value || document.body, Q = zt.getCurrent(N), j = t.value;
L && j && (m.value = M(), m.value.transform = j.style.transform), Q && j && (l.value = Q, l.value.height -= 14, l.value.width -= 14, j.style.height = l.value.height + "px", j.style.width = l.value.width + "px", j.style.left = "7px", j.style.top = "7px", j.style.transform = "", d.value = {
size: l.value,
position: {
x: 0,
y: 0
}
}, T.value = !1, y.value = !0);
}
function _() {
var L, N;
if (document.body.click(), m.value) {
const Q = {
width: m.value.size.width || 0,
height: m.value.size.height || 0
}, j = {
x: (window.innerWidth - Q.width) / 2,
y: (window.innerHeight - Q.height) / 2
};
(L = l.value) == null || L.set(Q), (N = u.value) == null || N.set(j);
const R = t.value;
R.style.height = Q.height + "px", R.style.width = Q.width + "px", R.style.left = `${j.x}px`, R.style.top = `${j.y}px`, R.style.transform = "", d.value = {
size: Q,
position: j
}, T.value = e.draggable, y.value = !1;
}
}
function P() {
if (t.value) {
const L = zt.getCurrent(t.value);
if (L) {
const {
width: N,
height: Q
} = L;
t.value.style.left = `${(window.innerWidth - N) / 2}px`, t.value.style.top = `${(window.innerHeight - Q) / 2}px`, t.value.style.transform = "";
}
}
}
function z() {
const L = () => {
y.value ? D(!1) : P(), document.body.click();
};
return window.addEventListener("resize", L), () => {
window.removeEventListener("resize", L);
};
}
const H = z();
return {
renderResizeBar: I,
boundingElement: a,
resizedEventParam: d,
maximize: D,
restore: _,
allowDrag: T,
isMaximized: y,
unWindowResizeHandle: H
};
}
function Bl(e, n, t) {
const a = k(), o = k(e.draggable), i = k(e.lockAxis), r = k(), l = k(), u = k(!1), c = k(new Xe(0, 0)), f = k(new Xe(0, 0)), s = k(new Xe(0, 0)), d = k(new Xe(0, 0));
ye(() => t.value, (v) => {
r.value.style.cursor = v ? "move" : "default";
});
function p(v, M) {
if (M.tagName === "BUTTON")
return !1;
if (M === v)
return !0;
for (const O in M.children)
if (Object.prototype.hasOwnProperty.call(M.children, O) && p(v, M.children[O]))
return !0;
return !1;
}
function m() {
var E, x;
let v = s.value.x + f.value.x, M = s.value.y + f.value.y;
i.value === "x" ? (v = ((E = c.value) == null ? void 0 : E.x) || 0, s.value.x = 0) : i.value === "y" && (M = ((x = c.value) == null ? void 0 : x.y) || 0, s.value.y = 0);
const O = `translate3d(${Math.round(v)}px, ${Math.round(M)}px, 0px)`;
a.value && (a.value.style.transform = O), d.value.x = v, d.value.y = M;
}
function T() {
if (!l.value || !a.value)
return null;
const v = l.value.getBoundingClientRect(), M = a.value.getBoundingClientRect(), O = {
top: v.top < M.top,
right: v.right > M.right,
bottom: v.bottom > M.bottom,
left: v.left < M.left
};
return O.top || (s.value.y -= M.top - v.top), O.bottom || (s.value.y -= M.bottom - v.bottom), O.right || (s.value.x -= M.right - v.right), O.left || (s.value.x -= M.left - v.left), m(), O;
}
function y(v) {
v && (c.value && v.subtract(c.value), s.value.set(v), m(), T());
}
function h(v) {
u.value && o.value && (v.stopPropagation(), v.preventDefault(), y(Xe.fromEvent(v, r.value)));
}
function C() {
var v;
u.value && (u.value = !1, f.value.add(s.value), s.value.reset(), (v = a.value) == null || v.classList.remove("ng-dragging"), n.emit("stopMove"), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", C));
}
function g() {
!u.value && r.value && (u.value = !0, r.value.classList.add("ng-dragging"), document.addEventListener("mousemove", h), document.addEventListener("mouseup", C));
}
function S() {
if (a.value) {
const v = Xe.getTransformInfo(a.value);
f.value.set(v);
return;
}
f.value.reset();
}
function w(v) {
if (!t.value || v instanceof MouseEvent && v.button === 2)
return;
const M = v.target || v.srcElement;
r.value !== void 0 && M && !p(M, r.value) || o.value !== !1 && (document.body.click(), v.stopPropagation(), v.preventDefault(), c.value = Xe.fromEvent(v, a.value), S(), g());
}
function b(v, M, O) {
if (o.value && M) {
if (v)
r.value = v;
else if (e.dragHandle) {
if (e.dragHandle instanceof HTMLElement)
r.value = e.dragHandle;
else if (typeof e.dragHandle == "string") {
const E = M.querySelector(e.dragHandle);
E && (r.value = E);
}
}
a.value = M, l.value = O, r.value ? (r.value.classList.add("ng-draggable"), r.value.addEventListener("mousedown", w)) : o.value = !1;
}
}
return {
registerDraggle: b,
resetTranslate: S
};
}
function Wa(e, n) {
if (e) {
const t = (a) => {
a.key.toLowerCase() === e.toLowerCase() && n({ event: a, key: e });
};
return document.addEventListener("keydown", t), () => {
document.removeEventListener("keydown", t);
};
}
}
function Vl(e, n) {
const t = k(e.enableEsc);
let a = null;
return t.value ? (a = Wa("Escape", (o) => {
n.emit("esc", { event: o.event, type: "esc" });
}), {
remove: a
}) : null;
}
function Nl(e, n) {
const t = k(e.enableEnter);
let a = null;
return t.value ? (a = Wa("Enter", (o) => {
n.emit("enter", { event: o.event, type: "enter" });
}), {
remove: a
}) : null;
}
const an = /* @__PURE__ */ Te({
name: "FModal",
props: Il,
emits: ["update:modelValue", "accept", "cancel", "closed", "resize", "esc", "enter", "stopMove"],
setup(e, n) {
const t = k(e.width || 300), a = k(e.height || 200), o = k(e.modelValue), i = k(""), r = k(e.class), l = k(e.fitContent), u = k(e.showHeader), c = k(""), f = k(e.showCloseButton), s = k(e.showMaxButton), d = k(!1), p = k(e.dialogType), m = k(e.src), T = k(""), y = k(e.showButtons), h = k(e.title), C = k(e.containment || null), g = k(), S = k(!1);
function w(J, Se) {
Promise.resolve().then(() => {
var Ie;
return (Ie = e.beforeClose) == null ? void 0 : Ie.call(e);
}).then((Ie) => {
Ie && (o.value = !1, n.emit("update:modelValue", !1), Se != null && n.emit(Se ? "accept" : "cancel"), n.emit("closed", J));
});
}
const b = [{
name: "cancel",
text: "取消",
class: "btn btn-secondary",
handle: (J) => {
w(J, !1);
}
}, {
name: "accept",
text: "确定",
class: "btn btn-primary",
handle: (J) => {
w(J, !0);
}
}], v = k(e.buttons && e.buttons.length ? e.buttons : b), M = B(() => !!c.value), O = B(() => !!y.value && !!v.value), E = k(), x = k(), I = k(!1), {
renderResizeBar: D,
maximize: _,
restore: P,
boundingElement: z,
resizedEventParam: H,
allowDrag: L,
unWindowResizeHandle: N
} = Pl(e), {
registerDraggle: Q
} = Bl(e, n, L);
function j() {
return !!document.querySelectorAll(".farris-modal").length && document.body.classList.contains("modal-open");
}
function R() {
const J = document.querySelectorAll(".farris-modal").length;
(!J || J - 1 <= 0) && document.body.classList.remove("modal-open"), g.value && g.value.classList.remove("show");
}
ye(() => e.title, (J, Se) => {
J !== Se && (h.value = J);
}), ye(() => e.modelValue, (J, Se) => {
J !== Se && (o.value = J, o.value && e.draggable && Tt(() => {
x.value && !C.value && (C.value = x.value.parentElement, z.value = C.value, Q(E.value, x.value, z.value));
}), J || (C.value && (C.value = null), R())), o.value && (S.value = j());
}), ye(() => e.showHeader, (J, Se) => {
J !== Se && (u.value = J);
}), ye(() => e.showButtons, (J, Se) => {
J !== Se && (y.value = J);
}), ye(() => H.value, (J, Se) => {
const Ie = J || {}, Ge = Se || {};
JSON.stringify(Ie) !== JSON.stringify(Ge) && n.emit("resize", {
newSize: J,
oldSize: Se,
isMaximized: I.value
});
});
const X = B(() => (o.value && document.body.classList.add("modal-open"), o.value)), A = B(() => {
var Ie;
const J = {
modal: !0,
"farris-modal": !0,
fade: !0
};
J["f-modal-fitContent"] = !!l.value, J.show = !!X.value;
const Se = (Ie = e.maskClass) == null ? void 0 : Ie.split(" ");
return Se == null || Se.reduce((Ge, Re) => (Ge[Re] = !0, Ge), J), J;
}), W = B(() => {
var Ie;
const J = {
"modal-dialog": !0
}, Se = (Ie = r.value) == null ? void 0 : Ie.split(" ");
return Se == null || Se.reduce((Ge, Re) => (Ge[Re] = !0, Ge), J), J;
}), G = B(() => {
const J = {
position: "absolute",
top: `${(window.innerHeight - a.value) / 2}px`,
left: `${(window.innerWidth - t.value) / 2}px`,
width: `${t.value}px`,
height: l.value ? "auto" : `${a.value}px`
};
return e.mask || (J.pointerEvents = "auto"), J;
}), K = B(() => {
const J = {
display: "block"
};
return e.mask || (J.pointerEvents = "none", J.backgroundColor = "transparent"), S.value && (J.backgroundColor = "transparent"), J;
}), ie = B(() => ({
"modal-content": !0,
"modal-content-has-header": u.value
})), Z = B(() => {
const J = {
display: u.value ? "" : "none"
};
return J["pointer-events"] = L.value ? "auto" : "none", J;
}), fe = B(() => ({
"f-icon": !0,
modal_maximize: !0,
modalrevert: I.value
})), ve = B(() => ({
"modal-body": !0,
"f-utils-flex-column": p.value === "iframe",
"f-utils-fill": !0
}));
function Fe() {
return {
height: `${e.footerHeight || 60}px`
};
}
const Be = B(() => {
const J = {
textAlgin: T.value
}, Se = Fe();
return Object.assign(J, Se);
});
function Le(J) {
if (J.stopPropagation(), I.value) {
I.value = !1, P();
return;
}
_(), I.value = !0;
}
async function Y(J, Se) {
J.handle && await J.handle(Se, J) && n.emit("closed", Se);
}
function de(J) {
J.width && (t.value = J.width), J.height && (a.value = J.height), J.buttons && (v.value = J.buttons), J.title && (h.value = J.title);
}
let q = null, te = null;
ei(() => {
S.value = j();
}), Je(() => {
x.value && !C.value && (C.value = x.value.parentElement, z.value = C.value, Q(E.value, x.value, z.value)), X.value && document.body.classList.add("modal-open"), q = Vl(e, n), te = Nl(e, n);
}), sn(() => {
N && N(), q && q.remove(), te && te.remove();
}), n.expose({
modalElementRef: x,
updateModalOptions: de,
close: w,
maxDialog: Le,
isMaximized: I
});
function we() {
return F("ul", null, [d.value && F("li", {
class: "f-btn-icon f-bare"
}, [F("span", {
class: "f-icon modal_minimize"
}, null)]), s.value && F("li", {
onClick: Le,
class: "f-btn-icon f-bare",
style: "pointer-events: auto;"
}, [F("span", {
class: fe.value
}, null)]), f.value && F("li", {
class: "f-btn-icon f-bare",
onClick: (J) => w(J, !1),
style: "pointer-events: auto;"
}, [F("span", {
class: "f-icon modal_close"
}, null)])]);
}
function Ee() {
return F("div", {
class: "modal-footer",
style: Be.value
}, [v.value && v.value.map((J) => {
const Se = k(J.disabled);
return F("button", {
name: J.name,
type: "button",
disabled: Se.value,
class: J.class + (J.iconClass ? " btn-icontext" : ""),
onClick: (Ie) => {
Y(J, Ie);
}
}, [!!J.iconClass && F("i", {
class: J.iconClass
}, null), J.text]);
})]);
}
function Pe() {
return F("div", {
ref: E,
class: "modal-header",
style: Z.value
}, [n.slots.headerTemplate ? n.slots.headerTemplate() : F("div", {
class: "modal-title"
}, [M.value && F("span", {
class: c.value,
style: "margin-right: 8px"
}, null), F("span", {
class: "modal-title-label"
}, [h.value])]), F("div", {
class: "actions"
}, [we()])]);
}
function rt() {
return n.slots.footerTemplate ? n.slots.footerTemplate() : O.value && Ee();
}
function xt(J) {
if (J.stopPropagation(), e.allowClickMaskToClose) {
if (J.target !== g.value)
return;
w(J, !1);
}
}
function ht() {
var J, Se;
return F("div", {
id: i.value,
class: W.value,
style: G.value,
ref: x
}, [F("div", {
class: ie.value
}, [u.value && Pe(), F("div", {
class: ve.value
}, [(Se = (J = n.slots).default) == null ? void 0 : Se.call(J), p.value === "iframe" && F("iframe", {
title: i.value,
class: "f-utils-fill",
width: "100%",
frameborder: "0",
src: m.value
}, null)]), rt()]), !l.value && x.value && !I.value && D(x.value)]);
}
return () => F(Sa, {
to: "body"
}, {
default: () => [X.value && F(Ta, {
name: "fade",
appear: !0
}, {
default: () => [F("div", {
ref: g,
class: A.value,
style: K.value,
onClick: xt
}, [ht()])]
})]
});
}
});
function Ha(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 n = document.createElement("div");
n.style.display = "contents";
const t = Hn({
setup(a, o) {
sn(() => {
document.body.removeChild(n);
});
const i = k(), r = k(e.class || ""), l = k(!!e.showButtons), u = k(!!e.showHeader), c = k(e.showCloseButton == null ? !0 : e.showCloseButton), f = k(!0), s = k(e.title || ""), d = e.acceptCallback || (() => {
}), p = e.rejectCallback || (() => {
}), m = e.closedCallback || ((g) => {
}), T = e.resizeHandle || ((g) => {
}), y = e.stopMoveHandle || ((g) => {
}), h = Ha(e), C = (g) => {
f.value = !1, t.unmount(), m(g);
};
return Je(() => {
}), o.expose({
modalRef: i
}), () => F(an, {
ref: i,
class: r.value,
modelValue: f.value,
"onUpdate:modelValue": (g) => f.value = g,
title: s.value,
width: e.width,
height: e.height,
buttons: e.buttons,
"show-header": u.value,
"show-buttons": l.value,
"show-close-button": c.value,
"show-max-button": !1,
onAccept: d,
onCancel: p,
fitContent: e.fitContent == null ? !0 : e.fitContent,
onClosed: C,
onResize: T,
onStopMove: y
}, {
default: () => [h && h(t)]
});
}
});
return document.body.appendChild(n), t.mount(n), t;
}
class Aa {
constructor(n) {
V(this, "appContext", null);
V(this, "modalRef", k());
V(this, "activeModalIndex", k(0));
V(this, "modalRefs", {});
V(this, "isUseEscCloseModal", k(!1));
V(this, "activeModalInstance", B(() => this.modalRefs[this.activeModalIndex.value]));
this.app = n, this.appContext = n ? n._context : null;
}
getCurrentModal() {
return this.activeModalInstance.value;
}
adaptToWindow(n, t) {
const {
width: a,
height: o
} = {
width: window.innerWidth,
height: window.innerHeight
};
return a < n && (n = a - 14), o < t && (t = o - 14), {
width: n,
height: t
};
}
static show(n) {
const t = Object.assign({
title: "",
showButtons: !0,
showHeader: !0
}, n);
return Rl(t);
}
close(n) {
var t, a;
n ? (a = n.value) == null || a.close() : (t = this.getCurrentModal()) == null || t.close();
}
open(n) {
const t = document.createDocumentFragment();
n.showMaxButton && n.fitContent && (n.showMaxButton = !1);
const a = ti(Object.assign({
title: "",
showButtons: !0,
showHeader: !0
}, n)), o = k(!0), i = a.value.acceptCallback || (() => {
}), r = a.value.rejectCallback || (() => {
}), l = a.value.closedCallback || ((w, b) => {
}), u = a.value.resizeHandle || ((w) => {
}), c = n.stopMoveHandle || ((w) => {
});
let f;
const s = Ha(a.value), d = (w) => {
var v;
o.value = !1;
const b = (v = w == null ? void 0 : w.target) == null ? void 0 : v.classList.contains("modal_close");
l(w, this.isUseEscCloseModal.value ? "esc" : b ? "icon" : "button");
}, p = (w) => {
d(w), f && Tt(() => {
if (this.modalRefs[this.activeModalIndex.value] && delete this.modalRefs[this.activeModalIndex.value], En(null, t), f = null, this.modalRef.value = null, this.modalRefs) {
const b = Object.keys(this.modalRefs).map((v) => Number(v));
b.length > 0 ? this.activeModalIndex.value = Math.max(...b) : this.activeModalIndex.value = 0;
}
this.isUseEscCloseModal.value = !1;
});
}, m = (w) => {
var b;
this.isUseEscCloseModal.value = !0, this.activeModalInstance && ((b = this.activeModalInstance.value) == null || b.close(w == null ? void 0 : w.event));
}, {
width: T,
height: y
} = a.value, h = this.adaptToWindow(T || 500, y || 320);
Object.assign(a.value, h);
const C = () => F(an, Ct({
ref: this.modalRef,
modelValue: o.value,
"onUpdate:modelValue": (w) => o.value = w
}, a.value, {
onAccept: i,
onCancel: r,
onClosed: p,
onResize: u,
onEsc: m,
onStopMove: c
}), {
default: () => [s && s(this.app)]
});
return f = ((w) => {
const b = ni(C, w);
return b.appContext = this.appContext, En(b, t), b;
})({
...a.value
// 'onUpdate:modelValue': onUpdateModelValue,
}), this.activeModalIndex.value++, this.modalRefs[this.activeModalIndex.value] = this.modalRef.value, {
update: (w) => {
a.value = {
...a.value,
...w
}, f && En(ai(f, {
...a
}), t);
},
destroy: p,
modalRef: this.activeModalInstance,
close: this.close
};
}
}
const za = Symbol("FModalService");
an.install = (e) => {
e.component(an.name, an);
const n = new Aa(e);
e.provide(za, n), e.provide("FModalService", n);
};
function qa(e, n) {
function t() {
const a = e.beforeOpen || e.beforeClickButton || null;
let o = Promise.resolve(!0);
if (a) {
const i = a(n.value);
if (typeof i > "u")
return o;
typeof i == "boolean" ? o = Promise.resolve(i) : o = i;
}
return o;
}
return { judgeCanOpen: t };
}
function jl(e, n, t, a, o) {
const i = k(e.buttonBehavior), r = k(e.popupOnInput), l = B(() => ({
"input-group-append": !0,
"append-force-show": e.showButtonWhenDisabled && (e.readonly || e.disable)
})), { judgeCanOpen: u } = qa(e, o), c = B(() => e.showButtonWhenDisabled || (!e.editable || !e.readonly) && !e.disable), f = Ye(za, null), s = k();
async function d(T) {
if (await u() && c.value) {
const y = !!n.slots.default;
if (i.value === "Modal") {
const h = e.modalOptions, C = f == null ? void 0 : f.open({
...h,
render: () => n.slots.default && n.slots.default()
});
s.value = C == null ? void 0 : C.modalRef;
}
i.value === "Overlay" && Dl.show({
// host: buttonEditRef.value,
host: document.body,
backgroundColor: "rgba(0,0,0,.15)",
render: () => n.slots.default && n.slots.default()
}), y && i.value === "Popup" && a.togglePopup(!0), y && r.value && a.hidePopup(), n.emit("clickButton", { origin: T, value: e.modelValue });
}
}
function p(T) {
n.emit("mouseEnterIcon", T);
}
function m(T) {
n.emit("mouseLeaveIcon", T);
}
return {
buttonGroupClass: l,
onClickButton: d,
onMouseEnterButton: p,
onMouseLeaveButton: m,
modalRef: s
};
}
function Ll(e, n, t, a, o, i) {
const r = k(!1), l = B(() => e.enableClear && !e.readonly && !e.disable), { changeTextBoxValue: u, hasClearClass: c } = i;
function f(m) {
r.value = m, c.value = m;
}
ye(o, () => {
f(!!o.value);
});
fun