UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,747 lines (1,746 loc) 341 kB
var Kn = Object.defineProperty; var Jn = (e, t, n) => t in e ? Kn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var q = (e, t, n) => Jn(e, typeof t != "symbol" ? t + "" : t, n); import { defineComponent as Ne, ref as w, computed as $, watch as we, onMounted as st, createVNode as I, Teleport as rn, createApp as qt, onUnmounted as Tt, Fragment as xt, onBeforeMount as Qn, Transition as ln, shallowRef as Zn, nextTick as Ct, render as $t, h as eo, cloneVNode as to, mergeProps as mt, inject as lt, reactive as rt, createTextVNode as gt, onBeforeUnmount as sn, withDirectives as no, resolveDirective as oo, provide as io, triggerRef as ao, isVNode as ro } from "vue"; import { isPlainObject as Qt, cloneDeep as ht, isUndefined as Zt } from "lodash-es"; import un from "../list-view/index.esm.js"; import cn from "../button-edit/index.esm.js"; import { resolveAppearance as lo, createPropsResolver as so } from "../dynamic-resolver/index.esm.js"; import { useDesignerComponent as dn, DgControl as en } from "../designer-canvas/index.esm.js"; import "bignumber.js"; import { useDateFormat as uo, useNumberFormat as co, resolveField as Ye, setFieldValue as Ht, getCustomClass as Lt, withInstall as fn, FormSchemaEntityField$Type as tn, FormSchemaEntityFieldType$Type as fo } from "../common/index.esm.js"; import { useResizeObserver as pn } from "@vueuse/core"; import { useIdentify as po, useGroupData as mo, useFilter as ho, useHierarchy as vo, useLoading as go, useDataView as yo, useSelection as bo, useSelectHierarchyItem as Co, useDataViewContainerStyle as wo, useCommandColumn as So, useColumn as _o, useSort as xo, useGroupColumn as To, useRow as Fo, useEdit as Io, useVisualDataBound as ko, useVisualDataCell as Eo, useVisualDataRow as Oo, useVisualData as Mo, useCellPosition as Bo, useSidebar as Vo, useVirtualScroll as Do, useFitColumn as No, useFilterHistory as Ro, useColumnFilter as Po, useDragColumn as $o, getColumnHeader as Lo, getSidebar as jo, getDisableMask as Ho, getHorizontalScrollbar as Wo, getVerticalScrollbar as Ao, getEmpty as Go } from "../data-view/index.esm.js"; import "../modal/index.esm.js"; import zo from "../transfer/index.esm.js"; import qo from "../tabs/index.esm.js"; import Uo from "../order/index.esm.js"; import "../condition/index.esm.js"; import Yo, { FCheckbox as Xo } from "../checkbox/index.esm.js"; import Ko from "../filter-bar/index.esm.js"; import nn from "../tooltip/index.esm.js"; import Jo from "../pagination/index.esm.js"; import Qo from "../button/index.esm.js"; import Zo from "../search-box/index.esm.js"; import ei from "../tags/index.esm.js"; import ti, { FDynamicFormGroup as ni, FDynamicFormInput as oi } from "../dynamic-form/index.esm.js"; import ii from "../binding-selector/index.esm.js"; import "../notify/index.esm.js"; import ai from "../accordion/index.esm.js"; import ri from "../avatar/index.esm.js"; import li from "../button-group/index.esm.js"; import si from "../calendar/index.esm.js"; import ui from "../capsule/index.esm.js"; import ci from "../color-picker/index.esm.js"; import Wt from "../combo-list/index.esm.js"; import di from "../content-container/index.esm.js"; import fi from "../data-grid/index.esm.js"; import pi from "../date-picker/index.esm.js"; import mi from "../dropdown/index.esm.js"; import "../external-container/index.esm.js"; import hi from "../events-editor/index.esm.js"; import vi from "../image-cropper/index.esm.js"; import gi from "../input-group/index.esm.js"; import yi from "../layout/index.esm.js"; import bi from "../list-nav/index.esm.js"; import Ci from "../lookup/index.esm.js"; import wi from "../nav/index.esm.js"; import Si from "../number-spinner/index.esm.js"; import _i from "../number-range/index.esm.js"; import xi from "../page-header/index.esm.js"; import Ti from "../page-footer/index.esm.js"; import Fi from "../progress/index.esm.js"; import Ii from "../query-solution/index.esm.js"; import ki from "../radio-group/index.esm.js"; import Ei from "../rate/index.esm.js"; import Oi from "../response-toolbar/index.esm.js"; import Mi from "../response-layout/index.esm.js"; import Bi from "../response-layout-editor/index.esm.js"; import Vi from "../section/index.esm.js"; import Di from "../smoke-detector/index.esm.js"; import Ni from "../splitter/index.esm.js"; import Ri from "../step/index.esm.js"; import Pi from "../switch/index.esm.js"; import $i from "../text/index.esm.js"; import Li from "../time-picker/index.esm.js"; import ji from "../tree-view/index.esm.js"; import Hi from "../uploader/index.esm.js"; import Wi from "../verify-detail/index.esm.js"; import Ai from "../component/index.esm.js"; import Gi from "../video/index.esm.js"; import zi from "../textarea/index.esm.js"; import qi from "../tree-grid/index.esm.js"; import Ui from "../fieldset/index.esm.js"; import Yi from "../drawer/index.esm.js"; import Xi from "../combo-tree/index.esm.js"; import Ki from "../field-selector/index.esm.js"; import Ji from "../mapping-editor/index.esm.js"; import Qi from "../schema-selector/index.esm.js"; import Zi from "../event-parameter/index.esm.js"; import ea from "../filter-condition-editor/index.esm.js"; import ta from "../sort-condition-editor/index.esm.js"; import na from "../menu-lookup/index.esm.js"; const mn = {}, hn = {}; function Ut(e) { const { properties: t, title: n, ignore: o } = e, i = o && Array.isArray(o), a = Object.keys(t).reduce((r, s) => ((!i || !o.find((u) => u === s)) && (r[s] = t[s].type === "object" && t[s].properties ? Ut(t[s]) : ht(t[s].default)), r), {}); if (n && (!i || !o.find((r) => r === "id"))) { const r = n.toLowerCase().replace(/-/g, "_"); a.id = `${r}_${Math.random().toString().slice(2, 6)}`; } return a; } function oa(e) { const { properties: t, title: n, required: o } = e; if (o && Array.isArray(o)) { const i = o.reduce((a, r) => (a[r] = t[r].type === "object" && t[r].properties ? Ut(t[r]) : ht(t[r].default), a), {}); if (n && o.find((a) => a === "id")) { const a = n.toLowerCase().replace(/-/g, "_"); i.id = `${a}_${Math.random().toString().slice(2, 6)}`; } return i; } return { type: n }; } function vn(e, t = {}, n) { const o = mn[e]; if (o) { let i = oa(o); const a = hn[e]; return i = a ? a({ getSchemaByType: vn }, i, t, n) : i, i; } return null; } function ia(e, t) { const n = Ut(t); return Object.keys(n).reduce((o, i) => (Object.prototype.hasOwnProperty.call(e, i) && (o[i] && Qt(o[i]) && Qt(e[i] || !e[i]) ? Object.assign(o[i], e[i] || {}) : o[i] = e[i]), o), n), n; } function gn(e, t) { return Object.keys(e).filter((o) => e[o] != null).reduce((o, i) => { if (t.has(i)) { const a = t.get(i); if (typeof a == "string") o[a] = e[i]; else { const r = a(i, e[i], e); Object.assign(o, r); } } else o[i] = e[i]; return o; }, {}); } function aa(e, t, n = /* @__PURE__ */ new Map()) { const o = ia(e, t); return gn(o, n); } function ra(e = {}) { function t(p, d, l, c) { if (typeof l == "number") return c[p].length === l; if (typeof l == "object") { const h = Object.keys(l)[0], v = l[h]; if (h === "not") return Number(c[p].length) !== Number(v); if (h === "moreThan") return Number(c[p].length) >= Number(v); if (h === "lessThan") return Number(c[p].length) <= Number(v); } return !1; } function n(p, d, l, c) { return c[p] && c[p].propertyValue && String(c[p].propertyValue.value) === String(l); } const o = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((p, d) => (p.set(d, e[d]), p), o); function i(p, d) { const l = p; return typeof d == "number" ? [{ target: l, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: l, operator: "getProperty", param: p, value: !!d }] : typeof d == "object" ? Object.keys(d).map((c) => { if (c === "length") return { target: l, operator: "length", param: null, value: d[c] }; const h = c, v = d[c]; return { target: l, operator: "getProperty", param: h, value: v }; }) : []; } function a(p) { return Object.keys(p).reduce((l, c) => { const h = i(c, p[c]); return l.push(...h), l; }, []); } function r(p, d) { if (o.has(p.operator)) { const l = o.get(p.operator); return l && l(p.target, p.param, p.value, d) || !1; } return !1; } function s(p, d) { return a(p).reduce((h, v) => h && r(v, d), !0); } function u(p, d) { const l = Object.keys(p), c = l.includes("allOf"), h = l.includes("anyOf"), v = c || h, m = (v ? p[v ? c ? "allOf" : "anyOf" : "allOf"] : [p]).map((x) => s(x, d)); return c ? !m.includes(!1) : m.includes(!0); } return { parseValueSchema: u }; } const le = { 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: "标签页工具栏按钮" }, "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: "抽屉" } }, la = {}, sa = {}; ra(); function ut(e, t, n = /* @__PURE__ */ new Map(), o = (r, s, u, p) => s, i = {}, a = (r) => r) { return mn[t.title] = t, hn[t.title] = o, la[t.title] = i, sa[t.title] = a, (r = {}, s = !0) => { if (!s) return gn(r, n); const u = aa(r, t, n), p = Object.keys(e).reduce((d, l) => (d[l] = e[l].default, d), {}); return Object.assign(p, u); }; } function Ft(e, t) { return { customClass: t.class, customStyle: t.style }; } function ua() { function e(t, n) { const { dataSource: o } = t || {}; return o === void 0 ? {} : {}; } return { resolve: e }; } function ca() { function e(t, n) { return t.selectItemById(n); } return { selectItemById: e }; } function da() { function e(t, n) { const { columns: o } = n; return t.updateColumns(o); } return { updateColumns: e }; } const fa = /* @__PURE__ */ new Map([ ["appearance", Ft] ]), pa = "https://json-schema.org/draft/2020-12/schema", ma = "https://farris-design.gitee.io/combo-list.schema.json", ha = "combo-list", va = "A Farris Input Component", ga = "object", ya = { id: { description: "The unique identifier for a combo list", type: "string" }, type: { description: "The type string of number combo list component", type: "string", default: "combo-list" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, binding: { description: "", type: "object", default: {} }, disabled: { description: "", type: "boolean", default: !1 }, enableClear: { description: "", type: "boolean", default: !1 }, editable: { description: "", type: "boolean", default: !1 }, enableLinkLabel: { description: "", type: "boolean", default: !1 }, label: { description: "", type: "string", default: "" }, lableWidth: { description: "", type: "number" }, placeholder: { description: "", type: "string", default: "请选择" }, idField: { description: "", type: "string", default: "id" }, valueField: { description: "", type: "string", default: "id" }, titleField: { description: "", type: "string", default: "name" }, textField: { description: "", type: "string", default: "name" }, dataSourceType: { description: "", type: "string", default: "static" }, data: { description: "", type: "array" }, remote: { description: "", type: "string" }, readonly: { description: "", type: "boolean", default: !1 }, required: { description: "", type: "boolean", default: !1 }, tabindex: { description: "", type: "number", default: -1 }, textAlign: { description: "", type: "string", enum: [ "left", "middle", "right" ], default: "left" }, multiSelect: { description: "", type: "boolean", default: !1 }, visible: { description: "", type: "boolean", default: !0 }, onBlur: { description: "", type: "string", default: "" }, onClickLinkLabel: { description: "", type: "sting", default: "" }, maxHeight: { description: "", type: "number", default: 350 }, minPanelWidth: { description: "", type: "number", default: 160 }, popupOnClick: { description: "", type: "boolean", default: !0 } }, ba = [ "type" ], Ca = [ "id", "appearance", "binding", "visible" ], wa = { $schema: pa, $id: ma, title: ha, description: va, type: ga, properties: ya, required: ba, ignore: Ca }; function Sa(e, t, n) { return t; } var _a = /* @__PURE__ */ ((e) => (e.Text = "text", e.Tag = "tag", e))(_a || {}), xa = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.auto = "auto", e))(xa || {}); const Yt = { /** * 组件标识 */ id: { type: String }, /** * 下拉数据源 */ data: { type: Array, default: [] }, /** * 可选,展示文本 * 默认为空字符串 -----内部需要根据value重新生成展示文本,此属性不生效 * displayText: { type: String, default: '' }, */ /** * 可选,是否禁用 * 默认为`false` */ disabled: { default: !1, type: Boolean }, /** * 可选,下拉图标 * 默认为'<span class="f-icon f-icon-arrow-60-down"></span>' */ dropDownIcon: { type: String, default: '<span class="f-icon f-icon-arrow-60-down"></span>' }, /** * 可选,是否可编辑 * 默认`false` */ editable: { default: !1, type: Boolean }, /** * 可选,是否启用清空 * 默认启用 */ enableClear: { default: !0, type: Boolean }, /** * 可选,启用搜索 * 默认为`false` */ enableSearch: { type: Boolean, default: !0 }, /** * 可选,鼠标悬停时是否显示控件值 * 默认显示 */ enableTitle: { default: !0, type: Boolean }, fitEditor: { default: !1, type: Boolean }, /** * 可选,强制显示占位符 * 默认`false` */ forcePlaceholder: { default: !1, type: Boolean }, /** * 可选,清空值时隐藏面板 * 默认`true` */ hidePanelOnClear: { default: !0, type: Boolean }, /** * 可选,数据源id字段 * 默认为`id` */ idField: { default: "id", type: String }, /** * 可选,字段映射 */ mapFields: { type: Object }, /** * 可选,最大高度 * 默认`350` */ maxHeight: { default: 350, type: Number }, /** * 最大输入长度 */ maxLength: { type: Number }, /** * 可选,是否支持多选 * 默认`false` */ multiSelect: { type: Boolean, default: !1 }, /** * 绑定值 */ modelValue: {}, /** * 占位符 */ placeholder: { type: String, default: "请选择" }, /** * 可选,下拉面板展示位置 * 默认为`auto` */ placement: { type: String, default: "auto" /* auto */ }, /** * 可选,是否只读 * 默认为`false` */ readonly: { default: !1, type: Boolean }, /** * 远端数据源信息 */ remote: { default: null, type: Object }, /** * 可选,是否支持远端过滤 * 默认`false` */ remoteSearch: { default: !1, type: Boolean }, /** * 可选,分隔符 * 默认`,` */ separator: { default: ",", type: String }, /** * tabIndex */ tabIndex: { type: Number, default: -1 }, /** * 可选,数据源显示字段 * 默认为`name` */ textField: { default: "name", type: String }, /** * 可选,数据源的title * 默认为`name` */ titleField: { default: "name", type: String }, /** * 可选,数据源值字段 * 默认为`id` */ valueField: { default: "id", type: String }, /** * 可选,启用多选下,下拉列表值在输入框中的展示方式 * 支持text | tag * 因为ButtonEdit内部处理类型只有在批量的情况下才会有展示类型区分 */ viewType: { default: "tag", type: String }, /** * 值变化事件 */ change: { type: Function, default: () => { } }, /** * 作为内嵌编辑器被创建后默认获得焦点 */ focusOnCreated: { type: Boolean, default: !1 }, /** * 作为内嵌编辑器被创建后默认选中文本 */ selectOnCreated: { type: Boolean, default: !1 }, /** * 此属性废弃 */ autoHeight: { type: Boolean, default: !0 }, /** * 打开前 */ beforeOpen: { type: Function, default: null }, searchOption: { type: [Boolean, Function], default: !1 }, // 搜索启用高亮 enableHighlightSearch: { type: Boolean, default: !0 }, minPanelWidth: { type: Number, default: 160 }, popupOnClick: { type: Boolean, default: !0 } }, Ta = Object.assign({}, Yt, { readonly: {} }), yn = ut(Yt, wa, fa, Sa), Fa = { dataSource: { type: Array, default: [] }, enableSearch: { type: Boolean, default: !1 }, idField: { type: String, default: "id" }, multiSelect: { type: Boolean, default: !1 }, selectedValues: { type: String, default: "" }, separator: { type: String, default: "," }, textField: { type: String, default: "name" }, titleField: { type: String, default: "name" }, width: { type: Number }, maxHeight: { type: Number }, valueField: { type: String, default: "id" }, /** 值变化事件 */ onSelectionChange: { type: Function, default: () => { } }, searchOption: { type: [Boolean, Function], default: !1 }, // 搜索启用高亮 enableHighlightSearch: { type: Boolean, default: !0 } }, Ia = /* @__PURE__ */ Ne({ name: "FComboListContainer", props: Fa, emits: ["selectionChange"], setup(e, t) { const n = w(), o = w(e.dataSource), i = w([]), a = w(e.separator), r = w(e.width), s = w(e.maxHeight), u = w(String(e.selectedValues).split(a.value)), p = $(() => e.multiSelect), d = $(() => ({ enableSelectRow: !0, multiSelect: e.multiSelect, multiSelectMode: "OnCheckAndClick", showCheckbox: p.value, showSelectAll: !1, showSelection: !0 })); we(e.dataSource, () => { o.value = e.dataSource; }), $(() => e.enableSearch ? "SearchBar" : "ContentHeader"); const l = $(() => { const C = {}; return r.value !== void 0 && (C.width = `${r.value}px`), s.value !== void 0 && s.value > 0 && (C.maxHeight = `${s.value}px`), C; }); function c(C) { n.value.search(C); } function h(C) { i.value = C.map((m) => Object.assign({}, m)), u.value = C.map((m) => m[e.idField]), t.emit("selectionChange", i.value); } function v(C) { if (e.enableHighlightSearch) return; let m = []; const { searchOption: y } = e; typeof y == "function" ? m = o.value.filter((x) => y(C, x)) : m = o.value.filter((x) => x[e.valueField].indexOf(C) > -1 || x[e.textField].indexOf(C) > -1), n.value.updateDataSource(m); } we([() => e.selectedValues], ([C]) => { u.value = C.split(a.value); }); function E(C) { n.value.activeRowById(C); } return st(() => { e.multiSelect || E(u.value[0]); }), t.expose({ search: c, activeRowById: E }), () => I("div", { class: "f-combo-list-container", style: l.value }, [I(un, { ref: n, size: "small", itemClass: "f-combo-list-item", itemContentClass: "text-truncate", header: "ContentHeader", headerClass: "f-combo-list-search-box", data: o.value, idField: e.idField, textField: e.textField, titleField: e.titleField, multiSelect: e.multiSelect, selection: d.value, enableHighlightSearch: e.enableHighlightSearch, selectionValues: u.value, onSelectionChange: h, onAfterSearch: v }, null)]); } }); function ka(e) { const t = w(""), n = w(e.modelValue), o = w(e.data || []), i = w(e.editable); function a(l) { const c = e.multiSelect ? String(l).split(e.separator) : [String(l)], h = c.map((C) => [C, !0]), v = new Map(h); return o.value.filter((C) => v.has(String(C[e.valueField]))).sort((C, m) => { const y = c.indexOf(C[e.valueField]), x = c.indexOf(m[e.valueField]); return y - x; }); } function r(l) { const c = a(l).map((h) => h[e.textField]).join(e.separator); t.value = i.value ? c || l : c; } function s(l) { const c = l.split(e.separator).map((v) => [v, !0]), h = new Map(c); return o.value.filter((v) => h.has(v[e.textField])); } function u(l) { const c = {}; return c[e.idField] = l, c[e.textField] = l, [c]; } function p(l) { let c = s(l); const h = c && c.length > 0; return i.value && !h && (c = u(l)), c; } function d() { const { url: l, method: c = "GET", headers: h = {}, body: v = null } = e.remote, E = c.toLowerCase() === "get" ? { method: c, headers: h } : { method: c, headers: h, body: v }; let C = !1; fetch(l, E).then((m) => { var x, g; if (m.status === 200) return C = !!((g = (x = m.headers) == null ? void 0 : x.get("content-type")) != null && g.includes("application/json")), C ? m.text() : m.json(); throw new Error(m.statusText); }).then((m) => { o.value = C ? JSON.parse(m) : m; }).catch((m) => { console.error(m); }); } return e.remote && d(), we(() => e.data, () => { o.value = e.data; }), we([o], ([l]) => { if (e.modelValue != null) { const c = l.find((h) => h[e.valueField] === e.modelValue); c && (t.value = c[e.textField]); } }), we(() => e.modelValue, (l) => { n.value = l, r(l); }), r(e.modelValue), { dataSource: o, displayText: t, editable: i, modelValue: n, getItemsByDisplayText: s, getItemsByValue: a, getSelectedItemsByDisplayText: p }; } const Ot = /* @__PURE__ */ Ne({ name: "FComboList", props: Yt, emits: ["clear", "update:modelValue", "change", "input"], setup(e, t) { const n = w(), o = w(), i = w(e.disabled), a = w(e.enableClear), r = w(e.enableSearch), s = w(e.readonly); let u = ""; const { dataSource: p, displayText: d, editable: l, modelValue: c, getSelectedItemsByDisplayText: h } = ka(e), v = $(() => e.multiSelect), E = $(() => o.value ? o.value.elementRef.getBoundingClientRect().width : 0); function C() { !v.value && o.value && o.value.hidePopup(); } function m(b) { d.value = b.map((_) => _[e.textField]).join(e.separator); let F = ""; b.length === 1 ? F = b[0][e.valueField] : F = b.map((_) => _[e.valueField]).join(e.separator), c.value !== F && (c.value = F, t.emit("update:modelValue", c.value), t.emit("change", b, c.value)); } function y() { const b = h(u); m(b); } function x() { s.value || (u = d.value); } function g(b) { c.value = "", n.value.activeRowById(""), t.emit("update:modelValue", ""), t.emit("clear"); } function T(b) { e.enableSearch ? (n.value.search(b), n.value.activeRowById(b)) : (c.value = b, d.value = b, t.emit("update:modelValue", c.value), t.emit("change", [b], b)); } function M() { return d.value; } function f(b) { T(b), t.emit("input", b); } function S() { o.value.hidePopup(); } return t.expose({ getDisplayText: M, hidePopup: S }), we([() => e.disabled, () => e.editable, () => e.enableClear, () => e.enableSearch, () => e.readonly], ([b, F, _, N, V]) => { i.value = b, l.value = F, a.value = _, r.value = N, s.value = V; }), () => I(cn, { ref: o, id: e.id, disable: i.value, readonly: s.value, forcePlaceholder: e.forcePlaceholder, editable: l.value, buttonContent: e.dropDownIcon, placeholder: e.placeholder, enableClear: a.value, maxLength: e.maxLength, tabIndex: e.tabIndex, enableTitle: e.enableTitle, multiSelect: e.multiSelect, inputType: e.multiSelect ? e.viewType : "text", modelValue: d.value, "onUpdate:modelValue": (b) => d.value = b, focusOnCreated: e.focusOnCreated, selectOnCreated: e.selectOnCreated, onClear: g, onClick: x, onBlur: y, onInput: f, beforeOpen: e.beforeOpen, placement: e.placement, popupMinWidth: e.minPanelWidth, popupClass: "f-combo-list-wrapper", popupOnClick: e.popupOnClick }, { default: () => [I(Ia, { ref: n, idField: e.idField, valueField: e.valueField, textField: e.textField, titleField: e.titleField, dataSource: p.value, selectedValues: c.value, multiSelect: e.multiSelect, enableSearch: r.value, maxHeight: e.maxHeight, enableHighlightSearch: e.enableHighlightSearch, width: e.fitEditor ? E.value : void 0, onSelectionChange: (b) => { m(b), C(); } }, null)] }); } }), Ea = /* @__PURE__ */ new Map([ ["appearance", lo] ]); function Oa(e, t, n) { return t; } const Ma = "https://json-schema.org/draft/2020-12/schema", Ba = "https://farris-design.gitee.io/button-edit.schema.json", Va = "button-edit", Da = "A Farris Input Component", Na = "object", Ra = { id: { description: "The unique identifier for a Input Group", type: "string" }, type: { description: "The type string of Input Group component", type: "string", default: "button-edit" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, binding: { description: "", type: "object", default: {} }, disable: { type: "string", default: !1 }, editable: { description: "", type: "boolean", default: !0 }, enableLinkLabel: { description: "", type: "boolean", default: !1 }, label: { description: "", type: "string", default: "" }, lableWidth: { description: "", type: "number" }, placeholder: { description: "", type: "string", default: "" }, forcePlaceholder: { description: "", type: "boolean", default: !1 }, readonly: { description: "", type: "boolean", default: !1 }, require: { description: "", type: "boolean", default: !1 }, tabindex: { description: "", type: "number", default: -1 }, textAlign: { description: "", type: "string", enum: [ "left", "middle", "right" ], default: "left" }, visible: { description: "", type: "boolean", default: !0 }, onBlur: { description: "", type: "string", default: "" }, onClickLinkLabel: { description: "", type: "sting", default: "" }, autoComplete: { description: "", type: "boolean", default: !1 }, buttonContent: { description: "", type: "string", default: "" }, enableClear: { description: "", type: "boolean", default: !0 }, inputType: { description: "", type: "string", enum: [ "text", "tag" ], default: "text" }, multiSelect: { description: "", type: "boolean", default: !1 }, popup: { description: "", type: "object", properties: { footerButtons: { type: "array", default: [] }, height: { type: "number", default: 600 }, dataMapping: { type: "object" }, contents: { type: "array", default: [] }, showMaxButton: { type: "boolean", default: !0 }, showCloseButton: { type: "boolean", default: !0 }, showFooter: { type: "boolean", default: !0 }, title: { type: "string", default: "" }, width: { type: "number", default: 800 } } }, popupClass: { description: "", type: "sting", default: "" }, separator: { type: "string", default: "," }, showButtonWhenDisabled: { description: "", type: "boolean", default: !1 }, wrapText: { type: "boolean", default: !1 }, onClear: { description: "", type: "string", default: "" } }, Pa = [ "id", "type" ], $a = { $schema: Ma, $id: Ba, title: Va, description: Da, type: Na, properties: Ra, required: Pa }, La = "buttonEdit", ja = "A Farris Component", Ha = "object", Wa = { basic: { description: "Basic Infomation", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "select", editor: { type: "waiting for modification", enum: [] } } } }, behavior: { description: "Basic Infomation", title: "行为", properties: { editable: { description: "", title: "允许编辑", type: "boolean" }, readonly: { description: "", title: "只读", type: "string" }, required: { description: "", title: "必填", type: "boolean" }, visible: { description: "", title: "可见", type: "boolean" }, placeholder: { description: "", title: "提示文本", type: "string" }, tabindex: { description: "", title: "tab索引", type: "number" }, textAlign: { description: "", title: "对齐方式", type: "enum", editor: { type: "combo-list", textField: "name", valueField: "value", data: [ { value: "left", name: "左对齐" }, { value: "center", name: "居中" }, { value: "right", name: "右对齐" } ] } } } } }, Aa = { title: La, description: ja, type: Ha, categories: Wa }, bn = { /** * 组件标识 */ 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" }, preventScroll: { type: Boolean, default: !1 } }; ut(bn, $a, Ea, Oa, Aa); const Ga = { popupContentPosition: { type: Object, default: { left: 0, top: 0 } }, host: { type: Object }, backgroundColor: { type: String, default: "" } }, za = /* @__PURE__ */ Ne({ name: "FOverlay", props: Ga, emits: ["click"], setup(e, t) { const n = w(e.popupContentPosition), o = w(e.host), i = $(() => ({ backgroundColor: e.backgroundColor || "", pointerEvents: "auto" })); function a(s) { t.emit("click"), s.preventDefault(), s.stopPropagation(); } $(() => { const s = o.value; if (s) { const u = s.getBoundingClientRect(), { left: p, top: d, height: l } = u; return { left: p, top: d + l }; } return n.value; }); const r = $(() => ({ // position: 'relative', // left: `${position.value.left}px`, // top: `${position.value.top}px` })); return () => I(rn, { to: "body" }, { default: () => { var s, u; return [I("div", { class: "overlay-container", onClick: (p) => a(p), style: i.value }, [I("div", { style: r.value }, [(u = (s = t.slots).default) == null ? void 0 : u.call(s)])])]; } }); } }); function qa(e) { if (e.content && e.content.render) return e.content.render; if (e.render && typeof e.render == "function") return e.render; } function Ua(e) { const t = document.createElement("div"); t.style.display = "contents"; let n; const o = e.onClickCallback || (() => { }), i = () => { o(), n && n.unmount(); }; return n = qt({ setup() { Tt(() => { document.body.removeChild(t); }); const a = qa(e); return () => I(za, { "popup-content-position": e.popupPosition, host: e.host, onClick: i, backgroundColor: e.backgroundColor }, { default: () => [a && a()] }); } }), document.body.appendChild(t), n.mount(t), n; } class Ya { static show(t) { return Ua(t); } } const Xa = { /** * 自定义类 */ class: { 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 }, /** * 是否展示头部 */ 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 Me { 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 i = parseInt(o[4], 10), a = parseInt(o[5], 10); return { x: i, y: a }; } return { x: 0, y: 0 }; } static fromEvent(t, n = null) { if (this.isMouseEvent(t)) return new Me(t.clientX, t.clientY); if (n === null || t.changedTouches.length === 1) return new Me(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 Me(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 Me(0, 0); if (window) { const o = window.getComputedStyle(t); if (o) { const i = parseInt(o.getPropertyValue("left"), 10), a = parseInt(o.getPropertyValue("top"), 10); n.x = isNaN(i) ? 0 : i, n.y = isNaN(a) ? 0 : a; } return n; } return null; } static copy(t) { return new Me(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 vt { constructor(t, n) { this.width = t, this.height = n; } static getCurrent(t) { const n = new vt(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 vt(0, 0).set(t); } set(t) { return this.width = t.width, this.height = t.height, this; } } function Ka(e, t) { const n = w(), o = w(), i = w(), a = w(), r = w(), s = w(), u = w(), p = w(), d = w(), l = w(), c = w(), h = w(), v = w(e.draggable), E = w(!1); function C() { const O = o.value || document.body, R = window.getComputedStyle(O); if (!R || !n.value) return; const W = Me.getTransformInfo(n.value), K = {}; u.value && (K.deltaL = n.value.offsetLeft - u.value.x, K.deltaT = n.value.offsetTop - u.value.y); const oe = R.getPropertyValue("position"); K.width = O.clientWidth, K.height = O.clientHeight, K.pr = parseInt(R.getPropertyValue("padding-right"), 10), K.pb = parseInt(R.getPropertyValue("padding-bottom"), 10), K.position = R.getPropertyValue("position"), oe === "static" && (O.style.position = "relative"), K.translateX = W.x, K.translateY = W.y, l.value = K; } function m(O) { if (n.value) { a.value = vt.getCurrent(n.value), r.value = Me.getCurrent(n.value), s.value = a.value ? vt.copy(a.value) : null, u.value = r.value ? Me.copy(r.value) : null, C(); const R = O.target.getAttribute("type") || ""; p.value = { n: !!R.match(/n/), s: !!R.match(/s/), w: !!R.match(/w/), e: !!R.match(/e/) }; } } function y() { var O, R, W, K; if (n.value) { const oe = n.value; p.value && ((p.value.n || p.value.s) && ((O = s.value) != null && O.height) && (oe.style.height = s.value.height + "px"), (p.value.w || p.value.e) && ((R = s.value) != null && R.width) && (oe.style.width = s.value.width + "px"), u.value && ((W = u.value) != null && W.x && (oe.style.left = u.value.x + "px"), (K = u.value) != null && K.y && (oe.style.top = u.value.y + "px"))); } } function x() { const O = e.minHeight ? e.minHeight : 1, R = e.minWidth ? e.minWidth : 1; s.value && u.value && p.value && a.value && (s.value.height < O && (s.value.height = O, p.value.n && r.value && (u.value.y = r.value.y + (a.value.height - O))), s.value.width < R && (s.value.width = R, p.value.w && r.value && (u.value.x = r.value.x + (a.value.width - R))), e.maxHeight && s.value.height > e.maxHeight && (s.value.height = e.maxHeight, r.value && p.value.n && (u.value.y = r.value.y + (a.value.height - e.maxHeight))), e.maxWidth && s.value.width > e.maxWidth && (s.value.width = e.maxWidth, p.value.w && r.value && (u.value.x = r.value.x + (a.value.width - e.maxWidth)))); } function g() { if (o.value) { const O = l.value; if (u.value && s.value && p.value && a.value) { const R = O.width - O.pr - O.deltaL - O.translateX - u.value.x, W = O.height - O.pb - O.deltaT - O.translateY - u.value.y; p.value.n && u.value.y + O.translateY < 0 && r.value && (u.value.y = -O.translateY, s.value.height = a.value.height + r.value.y + O.translateY), p.value.w && u.value.x + O.translateX < 0 && r.value && (u.value.x = -O.translateX, s.value.width = a.value.width + r.value.x + O.translateX), s.value.width > R && (s.value.width = R), s.value.height > W && (s.value.height = W); } } } function T(O) { if (!i.value || !a.value || !r.value || !p.value) return; O.subtract(i.value); const R = O.x, W = O.y; p.value.n ? (u.value.y = r.value.y + W, s.value.height = a.value.height - W) : p.value.s && (s.value.height = a.value.height + W), p.value.e ? s.value.width = a.value.width + R : p.value.w && (s.value.width = a.value.width - R, u.value.x = r.value.x + R), g(), x(), y(); } function M(O) { if (!d.value) return; const R = Me.fromEvent(O); R && T(R); } function f() { if (n.value) { const { width: O, height: R, x: W, y: K } = n.value.getBoundingClientRect(), oe = Me.getTransformInfo(n.value); return { size: { width: O, height: R }, position: { x: W - oe.x, y: K - oe.y } }; } return null; } function S(O) { if (n.value) { const R = f(); c.value = R; } i.value = void 0, a.value = null, r.value = null, s.value = null, u.value = null, p.value = null, d.value = null, document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", S); } function b() { document.addEventListener("mousemove", M), document.addEventListener("mouseup", S); } function F(O) { O instanceof MouseEvent && O.button === 2 || v.value && (document.body.click(), O.stopPropagation(), O.preventDefault(), i.value = Me.fromEvent(O), d.value = O.target, m(O), b()); } function _(O) { return n.value = O, I(xt, null, [I("div", { class: "fv-resizable-handle fv-resizable-n", type: "n", onMousedown: (R) => F(R) }, null), I("div", { class: "fv-resizable-handle fv-resizable-e", type: "e", onMousedown: (R) => F(R) }, null), I("div", { class: "fv-resizable-handle fv-resizable-s", type: "s", onMousedown: (R) => F(R) }, null), I("div", { class: "fv-resizable-handle fv-resizable-w", type: "w", onMousedown: (R) => F(R) }, null), I("div", { class: "fv-resizable-handle fv-resizable-ne", type: "ne", onMousedown: (R) => F(R) }, null), I("div", { class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal", type: "se", onMousedown: (R) => F(R) }, null), I("div", { class: "fv-resizable-handle fv-resizable-sw", type: "sw", onMousedown: (R) => F(R) }, null), I("div", { class: "fv-resizable-handle fv-resizable-nw", type: "nw", onMousedown: (R) => F(R) }, null)]); } function N(O = !0) { document.body.click(); const R = o.value || document.body, W = vt.getCurrent(R), K = n.value; O && K && (h.value = f(), h.value.transform = K.style.transform), W && K && (s.value = W, K.style.height = s.value.height - 14 + "px", K.style.width = s.value.width - 14 + "px", K.style.left = "7px", K.style.top = "7px", K.style.transform = "", c.value = { size: s.value, position: { x: 0, y: 0 } }, v.value = !1, E.value = !0); } function V() { var O, R; if (document.body.click(), h.value) { const W = { width: h.value.size.width || 0, height: h.value.size.height || 0 }, K = { x: (window.innerWidth - W.width) / 2, y: (window.innerHeight - W.height) / 2 }; (O = s.value) == null || O.set(W), (R = u.value) == null || R.set(K); const oe = n.value; oe.style.height = W.height + "px", oe.style.width = W.width + "px", oe.style.left = `${K.x}px`, oe.style.top = `${K.y}px`, oe.style.transform = "", c.value = { size: W, position: K }, v.value = e.draggable, E.value = !1; } } function D() { if (n.value) { const O = vt.getCurrent(n.value); if (O) { const { width: R, height: W } = O; n.value.style.left = `${(window.innerWidth - R) / 2}px`, n.value.style.top = `${(window.innerHeight - W) / 2}px`, n.value.style.transform = ""; } } } function k() { const O = () => { E.value ? N(!1) : D(), document.body.click(); }; return window.addEventListener("resize", O), () => { window.removeEventListener("resize", O); }; } const B = k(); return { renderResizeBar: _, boundingElement: o, resizedEventParam: c, maximize: N, restore: V, allowDrag: v, isMaximized: E, unWindowResizeHandle: B }; } function Ja(e, t, n) { const o = w(), i = w(e.draggable), a = w(e.lockAxis), r = w(), s = w(), u = w(!1), p = w(new Me(0, 0)), d = w(new Me(0, 0)), l = w(new Me(0, 0)), c = w(new Me(0, 0)); we(() => n.value, (f) => { r.value.style.cursor = f ? "move" : "default"; }); function h(f, S) { if (S.tagName === "BUTTON") return !1; if (S === f) return !0; for (const b in S.children) if (Object.prototype.hasOwnProperty.call(S.children, b) && h(f, S.children[b])) return !0; return !1; } function v() { var F, _; let f = l.value.x + d.value.x, S = l.value.y + d.value.y; a.value === "x" ? (f = ((F = p.value) == null ? void 0 : F.x) || 0, l.value.x = 0) : a.value === "y" && (S = ((_ = p.value) == null ? void 0 : _.y) || 0, l.value.y = 0); const b = `translate3d(${Math.round(f)}px, ${Math.round(S)}px, 0px)`; o.value && (o.value.style.transform = b), c.value.x = f, c.value.y = S; } function E() { if (!s.value || !o.value) return null; const f = s.value.getBoundingClientRect(), S = o.value.getBoundingClientRect(), b = { top: f.top < S.top, right: f.right > S.right, bottom: f.bottom > S.bottom, left: f.left < S.left }; return b.top || (l.value.y -= S.top - f.top), b.bottom || (l.value.y -= S.bottom - f.bottom), b.right || (l.value.x -= S.right - f.right), b.left || (l.value.x -= S.left - f.left), v(), b; } function C(f) { f && (p.value && f.subtract(p.value), l.value.set(f), v(), E()); } function m(f) { u.value && i.value && (f.stopPropagation(), f.preventDefault(), C(Me.fromEvent(f, r.value))); } function y() { var f; u.value && (u.value = !1, d.value.add(l.value), l.value.reset(), (f = o.value) == null || f.classList.remove("ng-dragging"), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", y)); } function x() { !u.value && r.value && (u.value = !0, r.value.classList.add("ng-dragging"), document.addEventListener("mousemove", m), document.addEventListener("mouseup", y)); } function g() { if (o.value) { const f = Me.getTransformInfo(o.value); d.value.set(f); return; }