@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,784 lines (1,783 loc) • 373 kB
JavaScript
var wo = Object.defineProperty;
var So = (e, t, n) => t in e ? wo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var U = (e, t, n) => So(e, typeof t != "symbol" ? t + "" : t, n);
import { ref as w, computed as N, createVNode as F, Fragment as ht, watch as we, withModifiers as _o, withDirectives as pn, vModelText as xo, defineComponent as ke, onMounted as lt, Teleport as mn, createApp as Xt, onUnmounted as Tt, onBeforeMount as Fo, Transition as hn, shallowRef as To, nextTick as St, render as jt, h as Io, cloneVNode as ko, mergeProps as mt, inject as at, reactive as ut, createTextVNode as yt, onBeforeUnmount as vn, resolveDirective as Oo, provide as Mo, triggerRef as Eo, isVNode as Bo } from "vue";
import { isPlainObject as nn, cloneDeep as vt, isUndefined as on } from "lodash-es";
import { useFilter as gn, useIdentify as yn, useHierarchy as bn, useGroupData as Cn, useDataView as wn, useSelection as Sn, useRow as _n, useEdit as xn, useVisualDataBound as Fn, useVisualDataCell as Tn, useVisualDataRow as In, useVisualGroupRow as Vo, useVisualSummaryRow as Do, useVisualData as kn, useLoading as Ro, useSelectHierarchyItem as $o, useDataViewContainerStyle as No, useCommandColumn as Po, useColumn as Lo, useSort as jo, useGroupColumn as Ho, useCellPosition as Ao, useSidebar as Wo, useVirtualScroll as Go, useFitColumn as zo, useFilterHistory as qo, useColumnFilter as Uo, useDragColumn as Yo, getColumnHeader as Xo, getSidebar as Ko, getDisableMask as Jo, getHorizontalScrollbar as Qo, getVerticalScrollbar as Zo, getEmpty as ei } from "../data-view/index.esm.js";
import ti, { FCheckbox as $t } from "../checkbox/index.esm.js";
import On from "../list-view/index.esm.js";
import Mn from "../button-edit/index.esm.js";
import { resolveAppearance as ni, createPropsResolver as oi } from "../dynamic-resolver/index.esm.js";
import { useDesignerComponent as En, DgControl as an } from "../designer-canvas/index.esm.js";
import "bignumber.js";
import { useDateFormat as ii, useNumberFormat as ai, resolveField as Ye, setFieldValue as Gt, getCustomClass as Ht, withInstall as Bn, FormSchemaEntityField$Type as ln, FormSchemaEntityFieldType$Type as li } from "../common/index.esm.js";
import { useResizeObserver as Vn } from "@vueuse/core";
import "../modal/index.esm.js";
import ri from "../transfer/index.esm.js";
import si from "../tabs/index.esm.js";
import ui from "../order/index.esm.js";
import "../condition/index.esm.js";
import ci from "../filter-bar/index.esm.js";
import rn from "../tooltip/index.esm.js";
import di from "../pagination/index.esm.js";
import fi from "../button/index.esm.js";
import pi from "../search-box/index.esm.js";
import mi from "../tags/index.esm.js";
import hi, { FDynamicFormGroup as vi, FDynamicFormInput as gi } from "../dynamic-form/index.esm.js";
import yi from "../binding-selector/index.esm.js";
import "../notify/index.esm.js";
import bi from "../accordion/index.esm.js";
import Ci from "../avatar/index.esm.js";
import wi from "../button-group/index.esm.js";
import Si from "../calendar/index.esm.js";
import _i from "../capsule/index.esm.js";
import xi from "../color-picker/index.esm.js";
import zt from "../combo-list/index.esm.js";
import Fi from "../content-container/index.esm.js";
import Ti from "../data-grid/index.esm.js";
import Ii from "../date-picker/index.esm.js";
import ki from "../dropdown/index.esm.js";
import "../external-container/index.esm.js";
import Oi from "../events-editor/index.esm.js";
import Mi from "../image-cropper/index.esm.js";
import Ei from "../input-group/index.esm.js";
import Bi from "../layout/index.esm.js";
import Vi from "../list-nav/index.esm.js";
import Di from "../lookup/index.esm.js";
import Ri from "../nav/index.esm.js";
import $i from "../number-spinner/index.esm.js";
import Ni from "../number-range/index.esm.js";
import Pi from "../page-header/index.esm.js";
import Li from "../page-footer/index.esm.js";
import ji from "../progress/index.esm.js";
import Hi from "../query-solution/index.esm.js";
import Ai from "../radio-group/index.esm.js";
import Wi from "../rate/index.esm.js";
import Gi from "../response-toolbar/index.esm.js";
import zi from "../response-layout/index.esm.js";
import qi from "../response-layout-editor/index.esm.js";
import Ui from "../section/index.esm.js";
import Yi from "../smoke-detector/index.esm.js";
import Xi from "../splitter/index.esm.js";
import Ki from "../step/index.esm.js";
import Ji from "../switch/index.esm.js";
import Qi from "../text/index.esm.js";
import Zi from "../time-picker/index.esm.js";
import ea from "../tree-view/index.esm.js";
import ta from "../uploader/index.esm.js";
import na from "../verify-detail/index.esm.js";
import oa from "../component/index.esm.js";
import ia from "../video/index.esm.js";
import aa from "../textarea/index.esm.js";
import la from "../tree-grid/index.esm.js";
import ra from "../fieldset/index.esm.js";
import sa from "../drawer/index.esm.js";
import ua from "../combo-tree/index.esm.js";
import ca from "../field-selector/index.esm.js";
import da from "../mapping-editor/index.esm.js";
import fa from "../schema-selector/index.esm.js";
import pa from "../event-parameter/index.esm.js";
import ma from "../filter-condition-editor/index.esm.js";
import ha from "../sort-condition-editor/index.esm.js";
import va from "../menu-lookup/index.esm.js";
const Dn = {}, Rn = {};
function Kt(e) {
const { properties: t, title: n, ignore: o } = e, i = o && Array.isArray(o), a = Object.keys(t).reduce((l, s) => ((!i || !o.find((c) => c === s)) && (l[s] = t[s].type === "object" && t[s].properties ? Kt(t[s]) : vt(t[s].default)), l), {});
if (n && (!i || !o.find((l) => l === "id"))) {
const l = n.toLowerCase().replace(/-/g, "_");
a.id = `${l}_${Math.random().toString().slice(2, 6)}`;
}
return a;
}
function ga(e) {
const { properties: t, title: n, required: o } = e;
if (o && Array.isArray(o)) {
const i = o.reduce((a, l) => (a[l] = t[l].type === "object" && t[l].properties ? Kt(t[l]) : vt(t[l].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 $n(e, t = {}, n) {
const o = Dn[e];
if (o) {
let i = ga(o);
const a = Rn[e];
return i = a ? a({ getSchemaByType: $n }, i, t, n) : i, i;
}
return null;
}
function ya(e, t) {
const n = Kt(t);
return Object.keys(n).reduce((o, i) => (Object.prototype.hasOwnProperty.call(e, i) && (o[i] && nn(o[i]) && nn(e[i] || !e[i]) ? Object.assign(o[i], e[i] || {}) : o[i] = e[i]), o), n), n;
}
function Nn(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 l = a(i, e[i], e);
Object.assign(o, l);
}
} else
o[i] = e[i];
return o;
}, {});
}
function ba(e, t, n = /* @__PURE__ */ new Map()) {
const o = ya(e, t);
return Nn(o, n);
}
function Ca(e = {}) {
function t(m, d, r, u) {
if (typeof r == "number")
return u[m].length === r;
if (typeof r == "object") {
const h = Object.keys(r)[0], y = r[h];
if (h === "not")
return Number(u[m].length) !== Number(y);
if (h === "moreThan")
return Number(u[m].length) >= Number(y);
if (h === "lessThan")
return Number(u[m].length) <= Number(y);
}
return !1;
}
function n(m, d, r, u) {
return u[m] && u[m].propertyValue && String(u[m].propertyValue.value) === String(r);
}
const o = /* @__PURE__ */ new Map([
["length", t],
["getProperty", n]
]);
Object.keys(e).reduce((m, d) => (m.set(d, e[d]), m), o);
function i(m, d) {
const r = m;
return typeof d == "number" ? [{ target: r, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: r, operator: "getProperty", param: m, value: !!d }] : typeof d == "object" ? Object.keys(d).map((u) => {
if (u === "length")
return { target: r, operator: "length", param: null, value: d[u] };
const h = u, y = d[u];
return { target: r, operator: "getProperty", param: h, value: y };
}) : [];
}
function a(m) {
return Object.keys(m).reduce((r, u) => {
const h = i(u, m[u]);
return r.push(...h), r;
}, []);
}
function l(m, d) {
if (o.has(m.operator)) {
const r = o.get(m.operator);
return r && r(m.target, m.param, m.value, d) || !1;
}
return !1;
}
function s(m, d) {
return a(m).reduce((h, y) => h && l(y, d), !0);
}
function c(m, d) {
const r = Object.keys(m), u = r.includes("allOf"), h = r.includes("anyOf"), y = u || h, p = (y ? m[y ? u ? "allOf" : "anyOf" : "allOf"] : [m]).map((_) => s(_, d));
return u ? !p.includes(!1) : p.includes(!0);
}
return { parseValueSchema: c };
}
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: "标签页工具栏按钮" },
"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: "抽屉" }
}, wa = {}, Sa = {};
Ca();
function Ze(e, t, n = /* @__PURE__ */ new Map(), o = (l, s, c, m) => s, i = {}, a = (l) => l) {
return Dn[t.title] = t, Rn[t.title] = o, wa[t.title] = i, Sa[t.title] = a, (l = {}, s = !0) => {
if (!s)
return Nn(l, n);
const c = ba(l, t, n), m = Object.keys(e).reduce((d, r) => (d[r] = e[r].default, d), {});
return Object.assign(m, c);
};
}
function Ct(e, t) {
return { customClass: t.class, customStyle: t.style };
}
function _a() {
function e(t, n) {
const { dataSource: o } = t || {};
return o === void 0 ? {} : {};
}
return {
resolve: e
};
}
function xa() {
function e(t, n) {
return t.selectItemById(n);
}
return {
selectItemById: e
};
}
function Fa() {
function e(t, n) {
const { columns: o } = n;
return t.updateColumns(o);
}
return {
updateColumns: e
};
}
const Ta = /* @__PURE__ */ new Map([
["appearance", Ct]
]), Ia = "https://json-schema.org/draft/2020-12/schema", ka = "https://farris-design.gitee.io/order.schema.json", Oa = "order", Ma = "A Farris Component", Ea = "object", Ba = {
id: {
description: "The unique identifier for a order",
type: "string"
},
type: {
description: "The type string of order component",
type: "string",
default: "order"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
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: ""
},
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"
},
visible: {
description: "",
type: "boolean",
default: !0
},
onBlur: {
description: "",
type: "string",
default: ""
},
onClickLinkLabel: {
description: "",
type: "sting",
default: ""
}
}, Va = [
"id",
"type"
], Da = {
$schema: Ia,
$id: ka,
title: Oa,
description: Ma,
type: Ea,
properties: Ba,
required: Va
};
function Ra(e, t, n) {
return t;
}
const $a = "order", Na = "A Farris Component", Pa = "object", La = {
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: "右对齐"
}
]
}
}
}
}
}, ja = {
title: $a,
description: Na,
type: Pa,
categories: La
}, Jt = {
dataSource: {
type: Array,
default: [
{ id: "1", name: "发票类型" },
{ id: "2", name: "发票代码" },
{ id: "3", name: "开票日期" },
{ id: "4", name: "票价(燃油附加费)" },
{ id: "5", name: "税收分类编号" }
]
},
items: {
type: Array,
default: [
{ id: "1", name: "发票类型", order: "asc" },
{ id: "2", name: "发票代码", order: "desc" },
{ id: "3", name: "开票日期", order: "asc" }
]
}
}, sn = Ze(Jt, Da, Ta, Ra, ja), Ha = /* @__PURE__ */ new Map([
["appearance", Ct]
]);
function Aa(e, t, n) {
return t;
}
const Wa = "https://json-schema.org/draft/2020-12/schema", Ga = "https://farris-design.gitee.io/list-view.schema.json", za = "list-view", qa = "A Farris Component", Ua = "object", Ya = {
id: {
description: "The unique identifier for list-view",
type: "string"
},
type: {
description: "The type string of list-view",
type: "string",
default: "list-view"
},
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
},
placeholder: {
description: "",
type: "string",
default: ""
},
readonly: {
description: "",
type: "boolean",
default: !1
},
require: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, Xa = [
"id",
"type"
], Ka = {
$schema: Wa,
$id: Ga,
title: za,
description: qa,
type: Ua,
properties: Ya,
required: Xa
}, Ja = "list-view", Qa = "A Farris Component", Za = "object", el = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
}
}, tl = {
title: Ja,
description: Qa,
type: Za,
categories: el
}, Pn = {
/** 列集合 */
columns: {
type: Array,
default: [
{ field: "name", title: "", dataType: "string" }
]
},
data: { type: Array, default: [] },
draggable: { type: Boolean, default: !1 },
multiSelect: { Type: Boolean, default: !1 },
multiSelectMode: { Type: String, default: "OnCheck" },
idField: { Type: String, default: "id" },
valueField: { Type: String, default: "id" },
textField: { Type: String, default: "name" },
titleField: { Type: String, default: "name" },
view: { Type: String, default: "ContentView" },
size: { Type: String, default: "default" },
placeholder: { type: String, default: "" },
header: { Type: String, default: "ContentHeader" },
headerClass: { Type: String, default: "" },
itemClass: { Type: String, default: "" },
itemContentClass: { Type: String, default: "" },
selectionValues: { type: Array, default: [] },
/** 分组配置 */
group: { type: Object },
/** 选择配置 */
selection: {
type: Object,
default: {
enableSelectRow: !0,
multiSelect: !1,
multiSelectMode: "DependOnCheck",
showCheckbox: !1,
showSelectAll: !1,
showSelection: !0
}
},
keepOrder: { type: Boolean, default: !1 },
disableField: { type: String, default: "disabled" },
// 搜索启用高亮
enableHighlightSearch: { type: Boolean, default: !0 },
/** 虚拟化渲染数据 */
virtualized: { type: Boolean, default: !0 }
};
Ze(Pn, Ka, Ha, Aa, tl);
function nl(e, t) {
function n(a) {
const l = [];
let s = a.nextNode();
for (; s; )
l.push(s), s = a.nextNode();
return l;
}
function o(a, l) {
const s = document.createTreeWalker(a, NodeFilter.SHOW_TEXT);
return n(s).map((r) => ({ textNode: r, text: (r.textContent || "").toLocaleLowerCase() })).map(({ textNode: r, text: u }) => {
const h = [];
let y = 0;
for (; y < u.length; ) {
const M = u.indexOf(l, y);
if (M === -1)
break;
h.push(M), y = M + l.length;
}
return h.map((M) => {
const g = new Range();
return g.setStart(r, M), g.setEnd(r, M + l.length), g;
});
}).flat();
}
function i(a) {
if (!CSS.highlights || (CSS.highlights.clear(), !a || !t))
return;
const l = o(t.value, a.toLocaleLowerCase()), s = new Highlight(...l);
CSS.highlights.set("search-result", s);
}
return { search: i };
}
function un(e, t, n, o, i, a, l, s, c, m) {
const d = w(e.size), r = w(e.textField), u = w(e.titleField), h = w(e.disableField), y = N(() => {
var S, v;
return ((S = e.selection) == null ? void 0 : S.multiSelect) && ((v = e.selection) == null ? void 0 : v.showCheckbox);
}), {
onMouseenterItem: M,
onMouseoverItem: g,
onMouseoutItem: p
} = a, {
getKey: C,
listViewItemClass: _,
onCheckItem: b,
onClickItem: T
} = l, I = N(() => e.itemClass ? {} : {
margin: d.value === "small" ? "0.25rem 0" : "8px 0"
});
function f(S, v, k) {
return S.checked = s.findIndexInSelectedItems(S) > -1, F("li", {
class: _(S, v),
id: C(S, v),
key: C(S, v),
onClick: (x) => T(x, S, v),
onMouseenter: (x) => M(x, S, v),
onMouseover: (x) => g(x, S, v),
onMouseout: (x) => p(x, S, v)
}, [y.value && F("div", {
class: "f-list-select",
onClick: (x) => x.stopPropagation()
}, [F($t, {
id: "list-" + C(S, v),
customClass: "listview-checkbox",
disabled: S[h.value],
checked: S.checked,
"onUpdate:checked": (x) => S.checked = x,
onChange: (x) => {
b(S, v, !x.checked);
}
}, null)]), F("div", {
class: "f-list-content"
}, [F("div", {
class: e.itemContentClass,
style: I.value,
title: S.raw[u.value] || S.raw[r.value]
}, [S.raw[r.value]])])]);
}
return {
renderItem: f
};
}
function ol(e, t, n, o, i, a, l, s, c, m) {
const d = w(e.multiSelect), r = w(e.disableField), u = w(e.textField), {
onMouseenterItem: h,
onMouseoverItem: y,
onMouseoutItem: M
} = a, {
getKey: g,
listViewItemClass: p,
onCheckItem: C,
onClickItem: _
} = l;
function b(I, f, S) {
return t.slots.content ? F(ht, null, [t.slots.content && t.slots.content({
item: I.raw,
index: f,
selectedItem: S
})]) : F("div", {
style: "margin: 10px 0;"
}, [I.raw[u.value || "name"]]);
}
function T(I, f, S) {
return F("li", {
class: p(I, f),
id: g(I, f),
key: g(I, f),
onClick: (v) => _(v, I, f),
onMouseenter: (v) => h(v, I, f),
onMouseover: (v) => y(v, I, f),
onMouseout: (v) => M(v, I, f)
}, [d.value && F("div", {
class: "f-list-select",
onClick: (v) => v.stopPropagation()
}, [F($t, {
id: "list-" + g(I, f),
customClass: "listview-checkbox",
disabled: I[r.value] || !I.checked,
checked: I.checked,
"onUpdate:checked": (v) => I.checked = v,
onChange: (v) => C(I, f, !v.checked)
}, null)]), F("div", {
class: "f-list-content"
}, [b(I, f, S)])]);
}
return {
renderItem: T
};
}
function il(e, t, n, o, i, a, l, s, c, m) {
const d = w(e.multiSelect), r = w(e.disableField), u = w(e.textField), {
onMouseenterItem: h,
onMouseoverItem: y,
onMouseoutItem: M
} = a, {
getKey: g,
listViewItemClass: p,
onCheckItem: C,
onClickItem: _
} = l, {
dragstart: b,
dragenter: T,
dragover: I,
dragend: f
} = o, {
removeItem: S
} = c, v = N(() => ({
margin: d.value ? "10px 0" : "10px 0px 10px 14px"
}));
function k(O, E = "") {
const B = O.target;
B.title = B.scrollWidth > B.clientWidth ? E : "";
}
function x(O) {
return F("div", {
style: v.value,
onMouseenter: (E) => k(E, O.raw[u.value || "name"])
}, [O.raw[u.value || "name"]]);
}
function $() {
return t.slots.itemContent ? t.slots.itemContent : x;
}
const R = $();
function V(O, E, B) {
return F("li", {
class: p(O, E),
id: g(O, E),
key: g(O, E),
onClick: (D) => _(D, O, E),
onMouseenter: (D) => h(D, O, E),
onMouseover: (D) => y(D, O, E),
onMouseout: (D) => M(D, O, E),
draggable: "true",
onDragstart: (D) => b(D, O, E),
onDragenter: (D) => T(D, E),
onDragend: (D) => f(D, O),
onDragover: (D) => I(D)
}, [d.value && F("div", {
class: "f-list-select",
onClick: (D) => D.stopPropagation()
}, [F($t, {
id: "list-" + g(O, E),
customClass: "listview-checkbox",
disabled: O[r.value] || !O.checked,
checked: O.checked,
"onUpdate:checked": (D) => O.checked = D,
onChange: (D) => C(O, E, !D.checked)
}, null)]), F("div", {
class: "f-list-content"
}, [R(O)]), F("div", {
class: "f-list-remove",
onClick: (D) => S(E)
}, [F("div", {
class: "f-list-remove-icon"
}, [F("i", {
class: "f-icon f-icon-remove_face"
}, null)])]), F("div", {
class: "f-list-handle"
}, [F("div", null, [F("i", {
class: "f-icon f-icon-drag-vertical"
}, null)])])]);
}
return {
renderItem: V
};
}
function al(e, t, n, o, i, a, l, s, c, m) {
var M;
const d = w(((M = e.group) == null ? void 0 : M.groupFields) || []), {
collpaseGroupIconClass: r
} = i, {
toggleGroupRow: u
} = m;
function h(g, p) {
p.collapse = !p.collapse, n.value = u(p.collapse ? "collapse" : "expand", p, n.value);
}
function y(g, p, C) {
return g.layer > -1 && F("div", {
class: "f-navlookup-recentHeader",
onClick: (_) => h(_, g)
}, [F("div", {
class: "fv-grid-group-row-icon"
}, [F("span", {
class: r(g)
}, null)]), F("div", {
class: "f-navlookup-recommandLabel"
}, [g.raw[d.value[g.layer]]])]);
}
return {
renderItem: y
};
}
function ll(e, t, n, o) {
const { dataView: i } = n, { updateSelectedItems: a } = o;
function l(s) {
if (s > -1 && s < i.value.length) {
const c = i.value.splice(s, 1);
a(), t.emit("removeItem", c[0]);
}
}
return { removeItem: l };
}
function rl(e, t, n, o, i, a, l, s, c, m) {
const d = w(e.view), r = w(e.view === "CardView"), u = w({}), h = w("暂无数据"), y = ll(e, t, o, c), M = N(() => ({
"f-list-view-group": !0,
"f-list-view-group-multiselect": e.multiSelect,
"d-flex": r.value,
"flex-wrap": r.value
})), g = N(() => !!n.value && n.value.length > 0), p = N(() => n.value.length === 0);
N(() => p.value && !t.slots.empty);
function C() {
return d.value === "SingleView" ? un : d.value === "DraggableView" ? il : (d.value === "ContentView" || d.value === "CardView") && t.slots.content ? ol : un;
}
const _ = C(), {
renderItem: b
} = _(e, t, n, m, i, a, c, l, y, s), {
renderItem: T
} = al(e, t, n, m, i, a, c, l, y, s), I = [b, T];
function f() {
return n.value.filter((k) => k.visible !== !1).map((k, x) => I[k.type](k, x, u));
}
function S() {
return F("div", {
class: "f-list-view-emptydata"
}, [F("p", {
class: "f-empty-title"
}, [t.slots.empty ? t.slots.empty() : h.value])]);
}
function v() {
return F("ul", {
class: M.value,
style: "list-style: none;"
}, [g.value && f(), p.value && S()]);
}
return {
renderListArea: v
};
}
function sl(e, t, n) {
function o() {
return t.slots.header && F("div", {
class: "f-list-view-header"
}, [t.slots.header()]);
}
return {
renderHeader: o
};
}
function cn(e, t, n) {
const o = w(e.headerClass), i = w(e.placeholder), a = w(""), l = N(() => !a.value), s = N(() => !!a.value);
function c(u) {
a.value = "";
}
we(a, (u) => {
e.enableHighlightSearch && n.search(u), t.emit("afterSearch", u);
});
const m = N(() => {
const u = {
"form-group": !0,
"farris-form-group": !0
};
return o.value && o.value.split(" ").reduce((y, M) => (y[M] = !0, y), u), u;
});
function d(u) {
}
function r() {
return F("div", {
class: "f-list-view-header",
onClick: _o(() => d, ["prevent", "stop"])
}, [F("div", {
class: m.value
}, [F("div", {
class: "farris-input-wrap"
}, [F("div", {
class: "f-cmp-inputgroup"
}, [F("div", {
class: "input-group f-state-editable"
}, [pn(F("input", {
class: "form-control f-utils-fill text-left",
"onUpdate:modelValue": (u) => a.value = u,
name: "input-group-value",
type: "text",
placeholder: i.value,
autocomplete: "off"
}, null), [[xo, a.value]]), F("div", {
class: "input-group-append"
}, [s.value && F("span", {
class: "input-group-text input-group-clear",
onClick: (u) => c()
}, [F("i", {
class: "f-icon f-icon-close-circle"
}, null)]), l.value && F("span", {
class: "input-group-text"
}, [F("span", {
class: "f-icon f-icon-search"
}, null)])])])])])])]);
}
return {
renderHeader: r
};
}
function ul() {
const e = w(""), t = w(-1), n = w(""), o = w(-1), i = w(!1);
function a(r, u, h) {
o.value = h;
}
function l(r, u, h) {
i.value || (o.value = h);
}
function s(r, u, h) {
o.value = -1;
}
function c() {
i.value = !0;
}
function m() {
i.value = !1;
}
function d() {
t.value = -1, e.value = "";
}
return {
activeIndex: t,
focusedItemId: n,
hoverIndex: o,
clearActiveItem: d,
onMouseenterItem: a,
onMouseoverItem: l,
onMouseoutItem: s,
resumeHover: m,
suspendHover: c
};
}
function cl(e, t, n, o) {
const i = w(e.idField), { dataView: a } = n, l = w(-1), s = w(!1), { activeIndex: c, focusedItemId: m, hoverIndex: d, resumeHover: r, suspendHover: u } = o;
let h, y = 0, M = 0;
function g(I, f) {
const S = I - y, v = f - M;
h.style.left = parseInt(h.style.left) + S + "px", h.style.top = parseInt(h.style.top) + v + "px", y = I, M = f;
}
function p(I) {
const { left: f, top: S } = I.getBoundingClientRect(), v = I.cloneNode(!0);
return v.style.cssText = `
position:absolute;
left:${f}px;
top:${S}px;
z-index: 999999;
border: 1px solid #e2e3e5;
pointer-events: none;
background-color: #edf5ff;
border-radius: 10px;
margin: 4px 2px;
display: flex;
align-items: center;
float: none;
text-align: initial;
width:${getComputedStyle(I).width};
height:${getComputedStyle(I).height};
`, v.children[0].style.cssText = "flex: 1 1 auto;width: 100%;", v.children[1].style.cssText = "width: 30px;color: #f4625f;padding: 0 14px 0 0", v.children[2].style.cssText = "padding: 0 14px 0 0;", document.body.appendChild(v), v;
}
function C(I, f, S) {
if (I.stopPropagation(), u(), f) {
if (h = p(I.target), I.dataTransfer) {
const v = new Image();
v.src = "", I.dataTransfer.setDragImage(v, 0, 0);
}
y = I.pageX, M = I.pageY, setTimeout(() => {
l.value = S, s.value = !0, f.moving = !0;
});
}
}
function _(I, f) {
if (I.preventDefault(), l.value !== f) {
const S = a.value[l.value], v = a.value;
v.splice(l.value, 1), v.splice(f, 0, S), l.value = f, g(I.pageX, I.pageY);
}
}
function b(I) {
I.preventDefault(), I.dataTransfer && (I.dataTransfer.dropEffect = "move"), g(I.pageX, I.pageY);
}
function T(I, f) {
f && (f.moving = !1, h && (document.body.removeChild(h), h = null)), a.value.forEach((S, v) => {
S.__fv_index__ = v;
}), s.value = !1, r(), d.value = f.raw.__fv_index__, c.value = f.raw.__fv_index__, m.value = f.raw[i.value], t.emit("change", a.value), t.emit("activeChange", [f.raw]);
}
return {
dragstart: C,
dragenter: _,
dragover: b,
dragend: T,
isDragging: s
};
}
function dl(e, t, n, o, i, a) {
const l = w(e.idField), s = w(e.disableField), c = w(e.draggable), m = w(e.itemClass), d = w(e.selection.multiSelect ?? !1), r = w(e.selection.multiSelectMode), { isDragging: u } = o, { activeIndex: h, focusedItemId: y, hoverIndex: M } = i, { clearSelection: g, getSelectedItems: p, toggleSelectItem: C, currentSelectedDataId: _ } = a, b = w(p()), T = (V) => b.value.length === 0 ? !1 : b.value.some((O) => {
let E = "";
return O.data ? E = O.data[l.value] : E = O[l.value], E === V;
});
function I() {
b.value = p();
}
function f(V, O) {
return V.raw[l.value] != null ? V.raw[l.value] : "";
}
function S(V, O) {
const E = {
"f-list-view-group-item": !0,
"f-list-view-draggable-item": c.value,
"f-un-click": !V.checked,
"f-un-select": !!V.raw[s.value],
"f-listview-active": (
// 多选
d.value && T(f(V)) || // 单选
V.raw[l.value] === _.value
),
"f-listview-hover": !u.value && O === M.value,
moving: !!V.moving
};
return m.value.split(" ").reduce((D, A) => (D[A] = !0, D), E), E;
}
const v = N(() => !d.value);
function k(V, O, E) {
V.checked = E, !V.raw[s.value] && (v.value && (y.value = V.raw[l.value]), C(V));
}
const x = N(() => d.value && r.value === "OnCheckClearByClick"), $ = N(() => !d.value || d.value && (r.value === "OnCheckAndClick" || r.value === "OnClick"));
function R(V, O, E) {
if (O.raw[s.value]) {
V.preventDefault(), V.stopPropagation();
return;
}
y.value = O.raw[l.value], h.value = E, x.value && g(), $.value && (C(O), I()), t.emit("clickItem", { data: b.value, index: E }), t.emit("activeChange", b.value);
}
return {
getKey: f,
selectedItems: b,
listViewItemClass: S,
updateSelectedItems: I,
onCheckItem: k,
onClickItem: R
};
}
const Ln = /* @__PURE__ */ ke({
name: "FListView",
props: Pn,
emits: ["afterSearch", "checkValuesChange", "clickItem", "selectionChange", "removeItem", "change", "activeChange"],
setup(e, t) {
const n = w(), o = w(!0), i = w(!1), a = w([]), l = 0, s = w(e.columns), c = gn(), m = yn(e), d = bn(e), r = Cn(e, m), u = wn(e, /* @__PURE__ */ new Map(), c, d, m), h = Sn(e, u, m, a, t), y = nl(e, n), M = N(() => u.dataView.value.length), g = _n(e, t, h, m), p = xn(e, t, m, g), C = Fn(e), _ = Tn(e, {}, C), b = In(e, u, p, d, m, C, _), T = Vo(e, m, _, b), I = Do(e, m, _, b), f = kn(e, s, u, M, l, b, T, I), {
getVisualData: S
} = f;
a.value = S(0, M.value + l - 1);
const v = N(() => {
const W = {
"f-list-view": !0,
"f-list-view-multiple": e.multiSelect
};
return e.size !== "default" && (W[`${e.size}-item`] = !0), W;
}), k = N(() => !!t.slots.footer || o.value);
function x() {
return e.header === "SearchBar" ? cn : e.header === "ContentHeader" ? sl : cn;
}
const $ = x(), {
renderHeader: R
} = $(e, t, y), V = ul(), O = cl(e, t, u, V), E = dl(e, t, a, O, V, h), {
renderListArea: B
} = rl(e, t, a, u, r, V, h, f, E, O);
function D(W) {
y.search(W);
}
function A(W) {
W && (u.load(W), a.value = S(0, M.value + l - 1));
}
function K() {
h.clearSelection(), V.clearActiveItem();
}
function oe() {
return E.selectedItems.value;
}
function J() {
return E.selectedItems.value.map((W) => W[m.idField.value]);
}
function pe(W) {
h.selectedValues.value = W, E.updateSelectedItems();
}
function H() {
return h.currentSelectedDataId.value;
}
function j(W) {
g.activeRowById(W);
}
t.expose({
search: D,
updateDataSource: A,
clearSelection: K,
getSelections: oe,
updateSelectionByIds: pe,
getSelectionIds: J,
activeRowById: j,
getCurrentRowId: H
});
function G(W) {
e.multiSelect && (W.preventDefault(), W.stopPropagation());
}
return () => F("div", {
class: v.value,
onClick: G
}, [R(), F("div", {
ref: n,
class: "f-list-view-content",
onMouseover: () => {
i.value = !0;
},
onMouseleave: () => {
i.value = !1;
}
}, [B()]), k.value && F("div", {
class: "f-list-view-footer"
}, [t.slots.footer && t.slots.footer()])]);
}
}), fl = {
/**
* 组件标识
*/
id: String,
/**
* 设置按钮类型
*/
type: { type: String, default: "primary" },
/**
* 是否禁用
*/
disabled: { type: Boolean, default: !1 },
/**
* 按钮尺寸
*/
size: { type: String, default: "middle" },
/**
* 按钮图标
*/
icon: { type: String },
/**
* 自定义class
*/
customClass: { type: Object, default: {} }
};
function pl(e, t) {
function n(o) {
o.stopPropagation(), e.disabled || t.emit("click", o);
}
return {
onClickButton: n
};
}
function ml(e) {
const t = N(() => {
const o = {
"f-icon": !0
};
if (e.icon) {
const i = e.icon.trim().split(" ");
i && i.length && i.reduce((a, l) => (a[l] = !0, a), o);
}
return o;
}), n = N(() => !!(e.icon && e.icon.trim()));
return { iconClass: t, shouldShowIcon: n };
}
const jn = /* @__PURE__ */ ke({
name: "FButton",
props: fl,
emits: ["click"],
setup(e, t) {
const {
onClickButton: n
} = pl(e, t), {
iconClass: o,
shouldShowIcon: i
} = ml(e), a = N(() => {
const l = {
btn: !0,
"btn-lg": e.size === "large",
"btn-md": e.size !== "large" && e.size !== "small",
"btn-sm": e.size === "small",
"btn-icontext": i.value
};
return l[`btn-${e.type}`] = !0, e.customClass && Object.keys(e.customClass).reduce((s, c) => (s[c] = e.customClass[c], s), l), l;
});
return () => F("button", {
class: a.value,
disabled: e.disabled,
onClick: (l) => n(l)
}, [i.value && F("i", {
class: o.value
}, null), t.slots.default && t.slots.default()]);
}
}), hl = /* @__PURE__ */ new Map([
["appearance", Ct]
]), vl = "https://json-schema.org/draft/2020-12/schema", gl = "https://farris-design.gitee.io/combo-list.schema.json", yl = "combo-list", bl = "A Farris Input Component", Cl = "object", wl = {
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
}
}, Sl = [
"type"
], _l = [
"id",
"appearance",
"binding",
"visible"
], xl = {
$schema: vl,
$id: gl,
title: yl,
description: bl,
type: Cl,
properties: wl,
required: Sl,
ignore: _l
};
function Fl(e, t, n) {
return t;
}
const Qt = {
/**
* 组件标识
*/
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 }
}, Tl = Object.assign({}, Qt, {
readonly: {}
}), Hn = Ze(Qt, xl, hl, Fl), Il = {
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 }
}, kl = /* @__PURE__ */ ke({
name: "FComboListContainer",
props: Il,
emits: ["selectionChange"],
setup(e, t) {
const n = w(), o = w(e.dataSource), i = w([]), a = w(e.separator), l = w(e.width), s = w(e.maxHeight), c = w(String(e.selectedValues).split(a.value)), m = N(() => e.multiSelect), d = N(() => ({
enableSelectRow: !0,
multiSelect: e.multiSelect,
multiSelectMode: "OnCheckAndClick",
showCheckbox: m.value,
showSelectAll: !1,
showSelection: !0
}));
we(e.dataSource, () => {
o.value = e.dataSource;
}), N(() => e.enableSearch ? "SearchBar" : "ContentHeader");
const r = N(() => {
const g = {};
return l.value !== void 0 && (g.width = `${l.value}px`), s.value !== void 0 && s.value > 0 && (g.maxHeight = `${s.value}px`), g;
});
function u(g) {
n.value.search(g);
}
function h(g) {
i.value = g.map((p) => Object.assign({}, p)), c.value = g.map((p) => p[e.idField]), t.emit("selectionChange", i.value);
}
function y(g) {
if (e.enableHighlightSearch)
return;
let p = [];
const {
searchOption: C
} = e;
typeof C == "function" ? p = o.value.filter((_) => C(g, _)) : p = o.value.filter((_) => _[e.valueField].indexOf(g) > -1 || _[e.textField].indexOf(g) > -1), n.value.updateDataSource(p);
}
we([() => e.selectedValues], ([g]) => {
c.value = g.split(a.value);
});
function M(g) {
n.value.activeRowById(g);
}
return lt(() => {
e.multiSelect || M(c.value[0]);
}), t.expose({
search: u,
activeRowById: M
}), () => F("div", {
class: "f-combo-list-container",
style: r.value
}, [F(On, {
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: c.value,
onSelectionChange: h,
onAfterSearch: y
}, null)]);
}
});
function Ol(e) {
const t = w(""), n = w(e.modelValue), o = w(e.data || []), i = w(e.editable);
function a(r) {
const u = e.multiSelect ? String(r).split(e.separator) : [String(r)], h = u.map((g) => [g, !0]), y = new Map(h);
return o.value.filter((g) => y.has(String(g[e.valueField]))).sort((g, p) => {
const C = u.indexOf(g[e.valueField]), _ = u.indexOf(p[e.valueField]);
return C - _;
});
}
function l(r) {
const u = a(r).map((h) => h[e.textField]).join(e.separator);
t.value = i.value ? u || r : u;
}
function s(r) {
const u = r.split(e.separator).map((y) => [y, !0]), h = new Map(u);
return o.value.filter((y) => h.has(y[e.textField]));
}
function c(r) {
const u = {};
return u[e.idField] = r, u[e.textField] = r, [u];
}
function m(r) {
let u = s(r);
const h = u && u.length > 0;
return i.value && !h && (u = c(r)), u;
}
function d() {
const { url: r, method: u = "GET", headers: h = {}, body: y = null } = e.remote, M = u.toLowerCase() === "get" ? { method: u, headers: h } : { method: u, headers: h, body: y };
let g = !1;
fetch(r, M).then((p) => {
var _, b;
if (p.status === 200)
return g = !!((b = (_ = p.headers) == null ? void 0 : _.get("content-type")) != null && b.includes("application/json")), g ? p.text() : p.json();
throw new Error(p.statusText);
}).then((p) => {
o.value = g ? JSON.parse(p) : p;
}).catch((p) => {
console.error(p);
});
}
return e.remote && d(), we(() => e.data, () => {
o.value = e.data;
}), we([o], ([r]) => {
if (e.modelValue != null) {
const u = r.find((h) => h[e.valueField] === e.modelValue);
u && (t.value = u[e.textField]);
}
}), we(() => e.modelValue, (r) => {
n.value = r, l(r);
}), l(e.modelValue), { dataSource: o, displayText: t, editable: i, modelValue: n, getItemsByDisplayText: s, getItemsByValue: a, getSelectedItemsByDisplayText: m };
}
const Mt = /* @__PURE__ */ ke({
name: "FComboList",
props: Qt,
emits: ["clear", "update:modelValue", "change", "input"],
setup(e, t) {
const n = w(), o = w(), i = w(e.disabled), a = w(e.enableClear), l = w(e.enableSearch), s = w(e.readonly);
let c = "";
const {
dataSource: m,
displayText: d,
editable: r,
modelValue: u,
getSelectedItemsByDisplayText: h
} = Ol(e), y = N(() => e.multiSelect), M = N(() => o.value ? o.value.elementRef.getBoundingClientRect().width : 0);
function g() {
!y.value && o.value && o.value.hidePopup();
}
function p(v) {
d.value = v.map((x) => x[e.textField]).join(e.separator);
let k = "";
v.length === 1 ? k = v[0][e.valueField] : k = v.map((x) => x[e.valueField]).join(e.separator), u.value !== k && (u.value = k, t.emit("update:modelValue", u.value), t.emit("change", v, u.value));
}
function C() {
const v = h(c);