@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,976 lines • 125 kB
JavaScript
var at = Object.defineProperty;
var it = (t, e, l) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[e] = l;
var T = (t, e, l) => it(t, typeof e != "symbol" ? e + "" : e, l);
import { ref as f, createVNode as h, createTextVNode as X, computed as P, defineComponent as _, Fragment as ae, watch as D, inject as Fe, onMounted as te, Teleport as xe, createApp as Te, onUnmounted as pe, onBeforeMount as ot, Transition as rt, shallowRef as ut, nextTick as ne, render as se, h as st, cloneVNode as ct, mergeProps as ke, withDirectives as dt, vShow as pt } from "vue";
import { isPlainObject as be, cloneDeep as A } from "lodash-es";
import { CompareType as W, RelationType as H, ValueType as G } from "../query-solution/index.esm.js/src/composition/types";
import { FDrawer as ft } from "../drawer/index.esm.js";
import { FConditionFields as vt } from "../condition/index.esm.js";
import { FDynamicFormGroup as mt } from "../dynamic-form/index.esm.js";
import { FPropertyPanel as yt } from "../property-panel/index.esm.js";
import { LookupSchemaRepositoryToken as ht } from "../lookup/index.esm.js";
import { FieldSelectorRepositoryToken as ce } from "../field-selector/index.esm.js";
import gt from "../transfer/index.esm.js/src/transfer.component";
import { resolveAppearance as bt } from "../dynamic-resolver/index.esm.js";
import Ct from "../tags/index.esm.js";
import wt from "../popover/index.esm.js";
const Me = {}, Be = {};
function fe(t) {
const { properties: e, title: l, ignore: n } = t, r = n && Array.isArray(n), d = Object.keys(e).reduce((p, s) => ((!r || !n.find((u) => u === s)) && (p[s] = e[s].type === "object" && e[s].properties ? fe(e[s]) : A(e[s].default)), p), {});
if (l && (!r || !n.find((p) => p === "id"))) {
const p = l.toLowerCase().replace(/-/g, "_");
d.id = `${p}_${Math.random().toString().slice(2, 6)}`;
}
return d;
}
function Ft(t) {
const { properties: e, title: l, required: n } = t;
if (n && Array.isArray(n)) {
const r = n.reduce((d, p) => (d[p] = e[p].type === "object" && e[p].properties ? fe(e[p]) : A(e[p].default), d), {});
if (l && n.find((d) => d === "id")) {
const d = l.toLowerCase().replace(/-/g, "_");
r.id = `${d}_${Math.random().toString().slice(2, 6)}`;
}
return r;
}
return {
type: l
};
}
function Ee(t, e = {}, l) {
const n = Me[t];
if (n) {
let r = Ft(n);
const d = Be[t];
return r = d ? d({ getSchemaByType: Ee }, r, e, l) : r, r;
}
return null;
}
function xt(t, e) {
const l = fe(e);
return Object.keys(l).reduce((n, r) => (Object.prototype.hasOwnProperty.call(t, r) && (n[r] && be(n[r]) && be(t[r] || !t[r]) ? Object.assign(n[r], t[r] || {}) : n[r] = t[r]), n), l), l;
}
function Ve(t, e) {
return Object.keys(t).filter((n) => t[n] != null).reduce((n, r) => {
if (e.has(r)) {
const d = e.get(r);
if (typeof d == "string")
n[d] = t[r];
else {
const p = d(r, t[r], t);
Object.assign(n, p);
}
} else
n[r] = t[r];
return n;
}, {});
}
function Tt(t, e, l = /* @__PURE__ */ new Map()) {
const n = xt(t, e);
return Ve(n, l);
}
function kt(t = {}) {
function e(i, m, a, o) {
if (typeof a == "number")
return o[i].length === a;
if (typeof a == "object") {
const c = Object.keys(a)[0], v = a[c];
if (c === "not")
return Number(o[i].length) !== Number(v);
if (c === "moreThan")
return Number(o[i].length) >= Number(v);
if (c === "lessThan")
return Number(o[i].length) <= Number(v);
}
return !1;
}
function l(i, m, a, o) {
return o[i] && o[i].propertyValue && String(o[i].propertyValue.value) === String(a);
}
const n = /* @__PURE__ */ new Map([
["length", e],
["getProperty", l]
]);
Object.keys(t).reduce((i, m) => (i.set(m, t[m]), i), n);
function r(i, m) {
const a = i;
return typeof m == "number" ? [{ target: a, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: a, operator: "getProperty", param: i, value: !!m }] : typeof m == "object" ? Object.keys(m).map((o) => {
if (o === "length")
return { target: a, operator: "length", param: null, value: m[o] };
const c = o, v = m[o];
return { target: a, operator: "getProperty", param: c, value: v };
}) : [];
}
function d(i) {
return Object.keys(i).reduce((a, o) => {
const c = r(o, i[o]);
return a.push(...c), a;
}, []);
}
function p(i, m) {
if (n.has(i.operator)) {
const a = n.get(i.operator);
return a && a(i.target, i.param, i.value, m) || !1;
}
return !1;
}
function s(i, m) {
return d(i).reduce((c, v) => c && p(v, m), !0);
}
function u(i, m) {
const a = Object.keys(i), o = a.includes("allOf"), c = a.includes("anyOf"), v = o || c, M = (v ? i[v ? o ? "allOf" : "anyOf" : "allOf"] : [i]).map((O) => s(O, m));
return o ? !M.includes(!1) : M.includes(!0);
}
return { parseValueSchema: u };
}
const Mt = {}, Bt = {};
kt();
function ie(t, e, l = /* @__PURE__ */ new Map(), n = (p, s, u, i) => s, r = {}, d = (p) => p) {
return Me[e.title] = e, Be[e.title] = n, Mt[e.title] = r, Bt[e.title] = d, (p = {}, s = !0) => {
if (!s)
return Ve(p, l);
const u = Tt(p, e, l), i = Object.keys(t).reduce((m, a) => (m[a] = t[a].default, m), {});
return Object.assign(i, u);
};
}
function ve(t, e) {
return { customClass: e.class, customStyle: e.style };
}
const Et = /* @__PURE__ */ new Map([
["appearance", ve]
]);
function Vt(t, e, l) {
return e;
}
const St = "https://json-schema.org/draft/2020-12/schema", Pt = "https://farris-design.gitee.io/filter-bar.schema.json", Rt = "filter-bar", Ot = "A Farris Component", It = "object", Lt = {
id: {
description: "The unique identifier for filter-bar",
type: "string"
},
type: {
description: "The type string of filter-bar",
type: "string",
default: "filter-bar"
},
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
}
}, $t = [
"id",
"type"
], jt = {
$schema: St,
$id: Pt,
title: Rt,
description: Ot,
type: It,
properties: Lt,
required: $t
}, qt = "filter-bar", At = "A Farris Component", zt = "object", Nt = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
},
controlSource: {
description: "筛选方式",
title: "筛选方式",
type: "select",
editor: {
type: "combo-list",
data: [
{
value: "normal",
name: "常规筛选"
},
{
value: "light",
name: "轻量筛选"
}
],
valueField: "value",
textField: "name",
idField: "value"
}
}
}
},
appearance: {
description: "",
title: "外观",
properties: {
showReminder: {
description: "启用提示",
type: "boolean",
title: "启用提示",
visible: {
anyOf: [
{
controlSource: {
equal: "light"
}
}
]
}
},
showExtendInSidebar: {
description: "启用侧边栏收折",
type: "boolean",
title: "启用侧边栏收折",
visible: {
anyOf: [
{
controlSource: {
equal: "light"
}
}
]
}
},
clearSelectedText: {
description: "按钮“清空已选”的文本",
type: "string",
title: "按钮“清空已选”的文本",
visible: {
anyOf: [
{
controlSource: {
equal: "light"
}
}
]
}
},
alLeft: {
description: "表单左对齐",
type: "boolean",
title: "表单左对齐",
visible: {
anyOf: [
{
controlSource: {
equal: "normal"
}
}
]
}
},
autoWidth: {
description: "自动列宽",
type: "boolean",
title: "自动列宽",
visible: {
anyOf: [
{
controlSource: {
equal: "normal"
}
}
]
}
},
filterClass: {
description: "筛选样式",
type: "string",
title: "筛选样式",
visible: {
anyOf: [
{
controlSource: {
equal: "normal"
}
}
]
}
},
autoLabel: {
description: "自适应标签宽度",
type: "string",
title: "自适应标签宽度",
visible: {
anyOf: [
{
controlSource: {
equal: "normal"
}
}
]
}
}
}
},
behavior: {
description: "Basic Infomation",
title: "行为",
properties: {
visible: {
description: "是否可见",
type: "boolean",
title: "是否可见"
},
disable: {
description: "是否禁用",
type: "boolean",
title: "是否禁用"
},
fields: {
description: "筛选条字段设置",
title: "筛选条字段",
type: "",
$converter: "",
editor: {
type: "filter-bar-config",
source: "filter-bar"
}
},
liveSearch: {
description: "实时搜索",
type: "boolean",
title: "实时搜索",
visible: {
anyOf: [
{
controlSource: {
equal: "normal"
}
}
]
}
},
defaultEmptyValueSearch: {
description: "默认值为空时是否过滤数据",
type: "boolean",
title: "默认值为空时是否过滤数据"
}
}
}
}, Ht = {
title: qt,
description: At,
type: zt,
categories: Nt
}, me = {
/** 被绑定数据 */
data: {
type: Array,
default: [{
id: "name",
fieldCode: "name",
fieldName: "名称",
compareType: "0",
valueType: 0,
value: "示例1",
relation: "1"
}]
},
/** 筛选分类 */
fields: {
type: Array,
default: [
{ id: "name", code: "name", labelCode: "name", name: "名称", editor: { type: "text" } }
]
},
/** 是否可选择 */
mode: { type: String, default: "editable" },
/** 清空值文字 */
resetText: { type: String, default: "清空" },
/** 是否显示重置 */
showReset: { type: Boolean, default: !1 }
}, Ce = ie(me, jt, Et, Vt, Ht);
class Dt {
constructor(e = { value: [] }) {
T(this, "editorType", "check-box");
T(this, "value");
T(this, "valueType", "boolean");
const n = (Array.isArray(e.value) ? e.value : typeof e.value == "string" ? e.value.split(",") : []).map((r) => JSON.parse(r));
this.value = n;
}
clear() {
this.value = [];
}
setValue(e) {
this.value = e;
}
getValue() {
return this.value;
}
getDisplayText() {
return this.value.map((e) => e ? "是" : "否").join(",");
}
isEmpty() {
return this.value.length === 0;
}
}
class Wt {
constructor(e = { textValue: "", value: "", valueField: "" }) {
T(this, "editorType", "combo-lookup");
T(this, "textValue");
T(this, "value");
T(this, "valueField");
T(this, "valueType", "text");
this.textValue = e.textValue, this.value = e.value, this.valueField = e.valueField;
}
clear() {
this.value = "", this.valueField = "", this.textValue = "";
}
getPropValue(e, l) {
if (l.length > 1) {
const n = l.shift();
return e[n] ? this.getPropValue(e[n], l) : null;
}
return e[l[0]];
}
getTextValue(e) {
const l = e.split("."), n = this.value.split(",").map((r) => this.getPropValue(r, A(l)));
return n && n.length ? n.join(",") : "";
}
getValue() {
const e = this.valueField.split("."), l = this.value.split(",").map((n) => this.getPropValue(n, A(e)));
return l && l.length ? l.join(",") : "";
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
throw new Error("Method not implemented.");
}
isEmpty() {
return !this.valueField;
}
}
class Ut {
constructor(e = { value: "", displayFormat: "", valueFormat: "" }) {
T(this, "editorType", "date-picker");
T(this, "value");
T(this, "valueType", "datetime");
T(this, "displayFormat", "");
T(this, "valueFormat", "");
this.value = e.value, this.displayFormat = e.displayFormat, this.valueFormat = e.valueFormat;
}
setValue(e) {
this.value = e.formatted;
}
getValue() {
return this.value;
}
getDisplayText() {
return this.getValue();
}
isEmpty() {
return !this.value;
}
clear() {
this.value = void 0;
}
}
class we {
constructor(e = { begin: "", end: "" }) {
T(this, "editorType", "date-range");
T(this, "begin", "");
T(this, "end", "");
T(this, "valueType", "datetime");
this.begin = e.begin, this.end = e.end;
}
clear() {
this.begin = "", this.end = "";
}
getValue() {
return !this.begin || !this.end ? "" : `${this.begin}~${this.end}`;
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
e.dataRange ? (this.begin = e.dataRange.split(e.delimiter)[0], this.end = e.dataRange.split(e.delimiter)[1]) : this.clear();
}
isEmpty() {
return !this.begin || !this.end;
}
}
class Gt {
constructor(e = { value: "" }) {
T(this, "editorType", "datetime-picker");
T(this, "value");
T(this, "valueType", "datetime");
this.value = e.value;
}
clear() {
this.value = void 0;
}
getValue() {
return this.value;
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
this.value = e.formatted;
}
isEmpty() {
return !this.value;
}
}
class Xt {
constructor(e = { value: "", valueList: [] }) {
T(this, "editorType", "combo-list");
T(this, "value");
T(this, "valueType", "enum");
T(this, "valueList", []);
this.value = e.value, this.valueList = e.valueList;
}
clear() {
this.value = "", this.valueList = [];
}
getValue() {
return this.value;
}
getDisplayText() {
var r, d;
const e = typeof this.value;
let l = "", n = [];
switch (e) {
case "string":
n = this.value.split(",") || [], l = this.valueList.filter((p) => n.indexOf(p.value) > -1).map((p) => p.name).join(",");
break;
case "boolean":
l = ((r = this.valueList.find((p) => p.value === this.value)) == null ? void 0 : r.name) || "";
break;
case "number":
l = ((d = this.valueList.find((p) => p.value === this.value)) == null ? void 0 : d.name) || "";
break;
}
return l;
}
// setValue(data: { value: string; displayText: string }) {
// // this.displayText = data.dispalyText;
// const enumValues = getEnumValues(data);
// this.value = enumValues;
// return this.displayText;
// }
setValue(e) {
this.value = e.value;
}
isEmpty() {
return !this.value && this.value !== !1 && this.value !== 0;
}
}
class _t {
constructor(e = { value: "", displayText: "", displayField: "", isInputText: !1 }) {
T(this, "editorType", "input-group");
// 通过弹窗返回的若干个值对象构成的数组
T(this, "value");
T(this, "valueType", "text");
// 控件内显示的值
T(this, "displayText");
// 弹窗模式下,取列表中哪个字段的值映射到当前字段
T(this, "valueField");
// 是否是手动输入的值
T(this, "isInputText");
this.value = e.value, this.displayText = e.displayText, this.valueField = e.displayField, this.isInputText = e.isInputText;
}
clear() {
this.value = "", this.displayText = "", this.valueField = "";
}
getPropValue(e, l) {
if (l.length > 1) {
const n = l.shift();
return e[n] ? this.getPropValue(e[n], l) : "";
}
return e[l[0]];
}
getTextValue(e) {
const l = e.split("."), n = this.value.map((r) => this.getPropValue(r, A(l)));
return n && n.length ? n.join(",") : "";
}
getValue() {
return this.value;
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
throw new Error("Method not implemented.");
}
isEmpty() {
return !this.displayText && !this.value.length;
}
}
class Yt {
constructor(e = { mapFields: [], value: "", valueField: "", isInputText: !1, helpId: "" }) {
T(this, "editorType", "lookup");
T(this, "idValue");
T(this, "helpId");
T(this, "mapFields");
T(this, "value");
T(this, "valueField");
T(this, "valueType", "text");
// 帮助的值是否为手动输入的任意值,对应帮助的任意输入属性nosearch
T(this, "isInputText");
this.value = e.value, this.valueField = e.valueField, this.mapFields = e.mapFields, this.idValue = e.mapFields.map((l) => l.id).join(","), this.isInputText = e.isInputText, this.helpId = e.helpId;
}
clear() {
this.value = "", this.idValue = "", this.mapFields = [];
}
getValue() {
return this.mapFields.map((e) => e[this.valueField || "id"]).join(",");
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
throw new Error("Method not implemented.");
}
isEmpty() {
return !this.mapFields.length;
}
}
class Qt {
constructor(e = { value: "" }) {
T(this, "editorType", "month-picker");
T(this, "value");
T(this, "valueType", "datetime");
this.value = e.value;
}
setValue(e) {
this.value = e.formatted;
}
getValue() {
return this.value;
}
getDisplayText() {
return this.getValue();
}
clear() {
this.value = void 0;
}
isEmpty() {
return !this.value;
}
}
class Jt {
constructor(e = { begin: "", end: "" }) {
T(this, "editorType", "month-range");
T(this, "begin");
T(this, "end");
T(this, "valueType", "datetime");
this.begin = e.begin, this.end = e.end;
}
clear() {
this.begin = "", this.end = "";
}
getValue() {
return !this.begin || !this.end ? "" : `${this.begin}~${this.end}`;
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
e.dataRange ? (this.begin = e.dataRange.split(e.delimiter)[0], this.end = e.dataRange.split(e.delimiter)[1]) : this.clear();
}
isEmpty() {
return !this.begin || !this.end;
}
}
class Zt {
constructor(e = { begin: null, end: null }) {
T(this, "editorType", "number-range");
T(this, "begin");
T(this, "end");
T(this, "valueType", "number");
this.begin = e.begin == null ? null : parseFloat(e.begin), this.end = e.end == null ? null : parseFloat(e.end);
}
clear() {
this.begin = null, this.end = null;
}
getValue() {
return {
begin: this.begin,
end: this.end
};
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
this.begin = e.begin == null ? null : parseFloat(e.begin), this.end = e.end == null ? null : parseFloat(e.end);
}
isEmpty() {
return this.begin == null && this.end == null;
}
}
class Kt {
constructor(e = { value: "" }) {
T(this, "editorType", "number-spinner");
T(this, "value");
T(this, "valueType", "number");
this.value = e.value == null ? null : parseFloat(e.value);
}
clear() {
this.value = null;
}
getValue() {
return this.value;
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
this.value = isNaN(parseFloat(e)) ? null : e;
}
isEmpty() {
return this.value == null || isNaN(this.value);
}
}
class el {
constructor(e = { value: null, valueList: [] }) {
T(this, "editorType", "radio-group");
T(this, "value");
T(this, "valueType", "enum");
T(this, "valueList", []);
this.value = e.value, this.valueList = e.valueList;
}
clear() {
this.value = void 0, this.valueList = [];
}
getValue() {
return this.value;
}
getDisplayText() {
var e;
return ((e = this.valueList.find((l) => l.value === this.value)) == null ? void 0 : e.name) || "";
}
setValue(e) {
this.value = e;
}
isEmpty() {
return !this.value && this.value !== 0 && this.value !== !1;
}
}
class tl {
constructor(e = { value: "" }) {
T(this, "editorType", "text");
T(this, "value");
T(this, "valueType", "text");
this.value = e.value;
}
clear() {
this.value = void 0;
}
getValue() {
return this.value;
}
getDisplayText() {
return this.getValue();
}
setValue(e) {
this.value = e;
}
isEmpty() {
return !this.value;
}
}
function ll() {
function t(e, l) {
switch (e) {
case "check-box":
return new Dt(l);
case "combo-list":
return new Xt(l);
case "combo-lookup":
return new Wt(l);
case "input-group":
return new _t(l);
case "date-picker":
return new Ut(l);
case "date-range":
return new we(l);
case "datetime-picker":
return new Gt(l);
case "datetime-range":
return new we(l);
case "lookup":
return new Yt(l);
case "month-picker":
return new Qt(l);
case "month-range":
return new Jt(l);
case "number-range":
return new Zt(l);
case "number-spinner":
return new Kt(l);
case "radio-group":
return new el(l);
default:
return new tl(l);
}
}
return { createConditionValue: t };
}
function nl(t, e) {
function l(a) {
const o = a.value, c = [];
return c.push({
FilterField: a.fieldCode,
Compare: a.compareType || a.compareType === 0 ? a.compareType : W.Like,
Value: o.value,
Relation: a.relation || a.relation === 0 ? a.relation : H.And,
Expresstype: G.Value,
Lbracket: a.Lbracket || null,
Rbracket: a.Rbracket || null
}), c;
}
function n(a) {
const o = a.value.getValue();
return [{
FilterField: a.fieldCode,
Compare: a.compareType || a.compareType === 0 ? a.compareType : W.Equal,
Value: o,
Relation: a.relation || a.relation === 0 ? a.relation : H.And,
Expresstype: G.Value,
Lbracket: a.Lbracket || null,
Rbracket: a.Rbracket || null
}];
}
function r(a) {
const o = [], c = a.value.getValue();
return c.begin != null && o.push({
FilterField: a.fieldCode,
Compare: W.GreaterOrEqual,
Value: c.begin,
Relation: H.And,
Expresstype: G.Value
}), c.end != null && o.push({
FilterField: a.fieldCode,
Compare: W.LessOrEqual,
Value: c.end,
Relation: H.And,
Expresstype: G.Value
}), o;
}
function d(a) {
const o = [], c = a.value.getValue();
return c === "" ? [] : (c.split(",").forEach((v) => {
v && o.push({
FilterField: a.fieldCode,
Compare: a.compareType || a.compareType === 0 ? a.compareType : W.Equal,
Value: v,
Relation: a.compareType === W.NotEqual ? H.And : H.Or,
Expresstype: G.Value
});
}), o.length > 0 ? (o[0].Lbracket = a.Lbracket ? a.Lbracket + "(" : "(", o[o.length - 1].Rbracket = a.Rbracket ? a.Rbracket + ")" : ")", o[o.length - 1].Relation = a.relation || a.relation === 0 ? a.relation : H.And, o) : []);
}
function p(a) {
const o = [], c = a.value.getValue();
return o.push({
FilterField: a.fieldCode,
Compare: a.compareType || a.compareType === 0 ? a.compareType : W.Equal,
Value: c,
Relation: a.relation || a.relation === 0 ? a.relation : H.And,
Expresstype: G.Value,
Lbracket: a.Lbracket || null,
Rbracket: a.Rbracket || null
}), o;
}
function s(a, o) {
const c = [], v = a.value.getValue();
return o.editor.enumValueType === "string" ? (v.split(",").forEach((g) => {
c.push({
FilterField: a.fieldCode,
Compare: a.compareType || a.compareType === 0 ? a.compareType : W.Equal,
Value: g,
Relation: a.compareType === W.NotEqual ? H.And : H.Or,
Expresstype: G.Value
});
}), c[0].Lbracket = a.Lbracket ? a.Lbracket + "(" : "(", c[c.length - 1].Rbracket = a.Rbracket ? a.Rbracket + ")" : ")", c[c.length - 1].Relation = a.relation || a.relation === 0 ? a.relation : H.And) : (o.editor.enumValueType === "int" || o.editor.enumValueType === "boolean") && c.push({
FilterField: a.fieldCode,
Compare: a.compareType || a.compareType === 0 ? a.compareType : W.Equal,
Value: v,
Relation: H.And,
Expresstype: G.Value
}), c;
}
function u(a) {
const o = a.value.getValue();
return [{
FilterField: a.fieldCode,
Compare: a.compareType || a.compareType === 0 ? a.compareType : W.Equal,
Value: o,
Relation: a.relation || a.relation === 0 ? a.relation : H.And,
Expresstype: G.Value,
Lbracket: a.Lbracket || null,
Rbracket: a.Rbracket || null
}];
}
function i(a, o) {
let c = [];
switch (a.value.editorType) {
case "input-group":
c = l(a);
break;
case "number-spinner":
c = n(a);
break;
case "number-range":
c = r(a);
break;
case "lookup":
c = d(a);
break;
case "date-picker":
c = p(a);
break;
case "combo-list":
c = s(a, o);
break;
case "radio-group":
c = u(a);
break;
default:
c = [];
}
return c;
}
function m(a, o) {
const c = [];
return a.forEach((v) => {
if (!v.value.isEmpty()) {
const g = o.find((M) => M.id === v.id), k = i(v, g);
c.push(...k);
}
}), c;
}
return {
getFilterConditions: m
};
}
function Se(t, e) {
const l = f([]), n = f([]), r = f([]), d = f(""), p = f(!1), s = f(t.mode), u = /* @__PURE__ */ new Map(), i = ll(), m = nl(), { getFilterConditions: a } = m;
function o(b) {
return !p.value && s.value === "display-only" && !b.value.isEmpty() && !!b.value.getDisplayText();
}
function c(b) {
const y = {
id: b.id,
fieldCode: b.labelCode,
fieldName: b.name,
required: b.editor.required,
editor: b.editor,
value: i.createConditionValue(b.controlType || "text")
};
return b.controlType === "lookup" && (y.value.valueField = b.editor.valueField), y;
}
function v(b) {
n.value = t.fields.map((y) => {
const x = A(y);
return x.editor.type || (x.editor.type = y.controlType), (x.editor.type === "number-spinner" || x.editor.type === "number-range") && (x.editor.showZero = !0, x.editor.nullable = !0), x.editor.type === "combo-list" && (x.editor.enableClear = !0), x;
}), n.value.reduce((y, x) => y, u);
}
function g(b) {
r.value = n.value.map((y) => c(y));
}
function k(b, y) {
v(t.fields), g(t.data);
}
function M(b) {
r.value = r.value.filter((y) => y.id !== b.id), l.value = l.value.filter((y) => y.fieldCode !== b.fieldCode), n.value = n.value.filter((y) => y.id !== b.id), e.emit("remove", b.fieldCode);
}
function S(b) {
b.value.clear(), l.value = l.value.filter((y) => y.fieldCode !== b.fieldCode), e.emit("clear", b.fieldCode);
}
function O() {
r.value.forEach((b) => b.value.clear());
}
function C() {
r.value.forEach((b) => {
b.value.clear();
}), e.emit("reset");
}
k(t.fields, t.data);
function V() {
var x;
const b = (x = r.value) == null ? void 0 : x.filter((R) => {
var F;
return !((F = R.value) != null && F.isEmpty());
});
return a(b, n.value);
}
return {
clearAll: O,
clearFilterItem: S,
currentFilterId: d,
filterFields: n,
filterItems: r,
loadFilterItems: k,
removeFilterItem: M,
reset: C,
shouldShowClearButtonInFilterItem: o,
handleQuery: V
};
}
function Pe(t, e) {
function l() {
}
return () => h("div", {
class: "f-filter-list-ellipsis",
onClick: (n) => void 0
}, [X("...")]);
}
function al(t, e, l, n, r) {
const {
filterFields: d,
handleQuery: p
} = r, s = f(A(n.value));
function u() {
l.value = !1, s.value = A(n.value);
}
function i() {
l.value = !1, n.value.forEach((o) => {
const c = s.value.find((v) => v.id === o.id);
c != null && c.value && (o.value = c.value);
});
const a = p();
e.emit("conditionChange", a);
}
function m() {
return h("div", null, [h("div", null, [X("更多筛选")]), h(vt, {
fields: d.value,
conditions: s.value
}, null), h("div", null, [h("button", {
class: "btn btn-secondary",
onClick: u
}, [X("取消")]), h("button", {
class: "btn btn-primary",
onClick: i
}, [X("确定")])])]);
}
return () => h(ft, {
modelValue: l.value,
"onUpdate:modelValue": (a) => l.value = a,
showClose: !1,
width: 480,
closeByMask: !1
}, {
content: m
});
}
function Re(t, e, l) {
const n = f([]), r = f(!0), d = f("更多"), p = f(t.resetText), s = f(t.showReset), u = f(!1), {
clearAll: i,
reset: m,
filterItems: a,
filterFields: o
} = l;
function c() {
n.value = a.value.filter((O) => O.editor.isExtend);
}
c();
const v = P(() => r.value && n.value && n.value.length > 0), g = P(() => s.value);
function k(O) {
u.value = !0;
}
function M(O) {
t.mode === "display-only" ? i() : m();
}
const S = al(t, e, u, n, l);
return () => h("div", {
class: "f-filter-toolbars"
}, [v.value && h("button", {
class: "btn btn-link",
onClick: (O) => k()
}, [d.value]), g.value && h("button", {
class: "btn btn-link",
onClick: (O) => M()
}, [p.value]), S()]);
}
const il = {
filterItem: { type: Object, default: null },
position: { type: Object, default: null }
}, ol = /* @__PURE__ */ _({
name: "FFilterBarItem",
props: il,
emits: ["cancel", "confirm"],
setup(t, e) {
const l = f(A(t.filterItem)), n = f(t.position), r = {
left: n.value.left + "px",
top: n.value.top + n.value.height + "px"
};
function d(i, m, a) {
i.value.editorType === "combo-list" && a.newValue ? i.value.valueList = a.newValue.map((o) => ({
name: o[i.editor.textField || "name"],
value: o[i.editor.valueField || "value"]
})) : i.value.editorType === "radio-group" && (i.value.valueList = [i.editor.data.find((o) => o.value === m)]);
}
function p() {
var a, o;
const {
editor: i
} = l.value, m = l.value;
return ((a = m.value) == null ? void 0 : a.editorType) === "lookup" && i ? (i.idValue = m.value.idValue, i.onClear = () => {
m.value.idValue = "", m.value.mapFields = [];
}, i["onUpdate:dataMapping"] = (c) => {
m.value.mapFields = c.items;
}) : ((o = m.value) == null ? void 0 : o.editorType) === "number-range" && i && (i.beginValue = m.value.begin, i.onBeginValueChange = (c) => {
m.value.begin = c;
}, i.endValue = m.value.end, i.onEndValueChange = (c) => {
m.value.end = c;
}), h(mt, {
label: l.value.fieldName,
editor: i,
required: i == null ? void 0 : i.required,
modelValue: m.value.value,
"onUpdate:modelValue": (c) => m.value.value = c,
onChange: (c, v) => d(m, c, v)
}, null);
}
function s(i) {
e.emit("cancel");
}
function u(i) {
i.stopPropagation(), e.emit("confirm", l.value);
}
return () => h("div", {
class: "f-filter-panel-wrapper can-close",
onClick: s
}, [h("div", {
class: "f-filter-panel",
style: r
}, [h("div", {
class: "f-filter-panel-inner",
onClick: (i) => i.stopPropagation()
}, [h("div", {
class: "f-filter-panel-arrow",
style: {
left: 26,
right: "auto"
}
}, null), p(), h("div", null, [h("button", {
class: "btn btn-secondary can-close",
onClick: s
}, [X("取消")]), h("button", {
class: "btn btn-primary",
onClick: u
}, [X("确定")])])])])]);
}
}), rl = {
filterItem: { type: Object, default: null },
useFilterItemsComposition: { type: Object, default: null },
disabled: { type: Boolean, default: !1 }
}, Oe = /* @__PURE__ */ _({
name: "FFilterBarItem",
props: rl,
emits: ["confirm"],
setup(t, e) {
const l = f(t.filterItem), {
clearFilterItem: n,
currentFilterId: r,
removeFilterItem: d,
shouldShowClearButtonInFilterItem: p
} = t.useFilterItemsComposition, s = f(t.disabled), u = f(null), i = f(!1), m = function() {
return {
"f-filter-item": !0,
"f-filter-item-actived": !l.value.value.isEmpty(),
// 'f-filter-item-last': index === filterItems.value.length - 1,
"f-filter-item-edit": l.value.id === r.value
};
};
P(() => !s.value && t.mode === "editable");
function a(g) {
t.mode === "display-only" ? d(l.value) : n(l.value);
}
function o(g) {
var k;
u.value = (k = g.currentTarget) == null ? void 0 : k.getBoundingClientRect(), i.value = !0;
}
function c() {
i.value = !1;
}
function v(g) {
i.value = !1, l.value.value = g.value, e.emit("confirm", g);
}
return () => h("div", {
key: l.value.id,
id: l.value.id,
class: m()
}, [h("div", {
class: "f-filter-item-inner",
onClick: (g) => o(g)
}, [l.value.editor.required && h("span", {
class: "f-filter-item-required text-danger"
}, [X("*")]), h("span", {
class: "f-filter-item-text"
}, [l.value.fieldName]), l.value.value.getDisplayText() && h(ae, null, [h("span", {
class: "f-filter-item-tip"
}, [X(":")]), h("span", {
class: "f-filter-item-content"
}, [l.value.value.getDisplayText()])]), !s.value && h("span", {
class: "f-filter-item-arrow f-icon f-icon-arrow-chevron-down"
}, null)]), p(l.value) && h("span", {
class: "f-filter-item-clear",
onClick: (g) => a()
}, [h("span", {
class: "f-icon f-icon-close-circle"
}, null)]), i.value && h(ol, {
position: u.value,
filterItem: l.value,
onConfirm: v,
onCancel: c
}, null)]);
}
}), de = /* @__PURE__ */ _({
name: "FFilterBar",
props: me,
emits: ["clear", "remove", "reset", "conditionChange", "change"],
setup(t, e) {
const l = f(!1), n = f(!1), r = f(!1), d = f(!1), p = Se(t, e), {
filterFields: s,
filterItems: u,
loadFilterItems: i,
handleQuery: m
} = p, a = P(() => ({
display: s.value && s.value.length ? "" : "none"
}));
D([() => t.data, () => t.fields], ([V, b]) => {
i(b, V);
});
const o = P(() => n.value && l.value), c = P(() => ({
"f-filter-list": !0,
"f-filter-list-extend": o.value
})), v = P(() => u.value.length > 0);
function g(V) {
e.emit("change", V);
const b = m();
e.emit("conditionChange", b);
}
function k() {
return h("div", {
class: c.value
}, [u.value.map((V, b) => !V.editor.isExtend && h(Oe, {
filterItem: V,
useFilterItemsComposition: p,
onConfirm: g
}, null))]);
}
const M = P(() => r.value && !n.value && d.value), S = Pe(), O = P(() => !n.value), C = Re(t, e, p);
return () => h("div", {
class: "f-filter-wrapper",
style: a.value
}, [h("div", {
class: "f-filter-wrapper-inner f-utils-fill"
}, [h("div", {
class: "f-filter-main f-utils-fill"
}, [h("div", {
class: "f-filter-list-wrapper d-flex"
}, [v.value && k(), M.value && S(), O.value && C()])])])]);
}
});
function ul(t, e, l) {
var b;
const n = "", r = "", d = f();
function p() {
return (e == null ? void 0 : e.schema.componentType) !== "frame";
}
function s() {
return !1;
}
function u() {
return (e == null ? void 0 : e.schema.componentType) !== "frame";
}
function i() {
return (e == null ? void 0 : e.schema.componentType) === "frame";
}
function m(y) {
if (!y || !y.value)
return null;
if (y.value.schema && y.value.schema.type === "component")
return y.value;
const x = f(y == null ? void 0 : y.value.parent), R = m(x);
return R || null;
}
function a(y = e) {
var L;
const { componentInstance: x, designerItemElementRef: R } = y;
if (!x || !x.value)
return null;
const { getCustomButtons: F } = x.value;
return x.value.canMove || F && ((L = F()) != null && L.length) ? R : a(y.parent);
}
function o(y) {
return !!l;
}
function c() {
return (e == null ? void 0 : e.schema.label) || (e == null ? void 0 : e.schema.title) || (e == null ? void 0 : e.schema.name);
}
function v() {
}
function g(y, x) {
var R;
!y || !x || (R = e == null ? void 0 : e.setupContext) == null || R.emit("dragEnd");
}
function k(y, x) {
const { componentType: R } = y;
let F = Ee(R, y, x);
const L = R.toLowerCase().replace(/-/g, "_");
return F && !F.id && F.type === R && (F.id = `${L}_${Math.random().toString().slice(2, 6)}`), F;
}
function M(y) {
}
function S(...y) {
}
function O() {
e != null && e.schema.contents && e.schema.contents.map((y) => {
let x = y.id;
y.type === "component-ref" && (x = y.component);
const R = t.value.querySelectorAll(`#${x}-design-item`);
R != null && R.length && Array.from(R).map((F) => {
var L;
(L = F == null ? void 0 : F.componentInstance) != null && L.value.onRemoveComponent && F.componentInstance.value.onRemoveComponent();
});
});
}
function C() {
}
function V(y) {
}
return d.value = {
canMove: p(),
canSelectParent: s(),
canDelete: u(),
canNested: !i(),
contents: e == null ? void 0 : e.schema.contents,
elementRef: t,
parent: (b = e == null ? void 0 : e.parent) == null ? void 0 : b.componentInstance,
schema: e == null ? void 0 : e.schema,
styles: n,
designerClass: r,
canAccepts: o,
getBelongedComponentInstance: m,
getDraggableDesignItemElement: a,
getDraggingDisplayText: c,
getPropConfig: S,
getDragScopeElement: v,
onAcceptMovedChildElement: g,
onChildElementMovedOut: M,
addNewChildComponentSchema: k,
triggerBelongedComponentToMoveWhenMoved: f(!1),
triggerBelongedComponentToDeleteWhenDeleted: f(!1),
onRemoveComponent: O,
getCustomButtons: C,
onPropertyChanged: V
}, d;
}
const sl = /* @__PURE__ */ _({
name: "FFilterBarDesign",
props: me,
emits: ["Clear", "Remove", "Reset"],
setup(t, e) {
const l = f(!1), n = f(!1), r = f(!1), d = f(!1), p = Se(t, e), {
filterFields: s,
filterItems: u,
loadFilterItems: i
} = p, m = P(() => ({
display: s.value && s.value.length ? "" : "none"
})), a = f(), o = Fe("design-item-context"), c = ul(a, o);
te(() => {
a.value.componentInstance = c;
}), e.expose(c.value), D([() => t.data, () => t.fields], ([b, y]) => {
i(y, b);
});
const v = P(() => n.value && l.value), g = P(() => ({
"f-filter-list": !0,
"f-filter-list-extend": v.value
})), k = P(() => u.value.length > 0);
function M() {
return h("div", {
class: g.value
}, [u.value.map((b, y) => h(Oe, {
filterItem: b,
useFilterItemsComposition: p
}, null))]);
}
const S = P(() => r.value && !n.value && d.value), O = Pe(), C = P(() => !n.value), V = Re(t, e, p);
return () => h("div", {
ref: a,
class: "f-filter-wrapper",
style: m.value
}, [h("div", {
class: "f-filter-wrapper-inner f-utils-fill"
}, [h("div", {
class: "f-filter-main f-utils-fill"
}, [h("div", {
class: "f-filter-list-wrapper"
}, [k.value && M(), S.value && O(), C.value && V()])])])]);
}
}), cl = "https://json-schema.org/draft/2020-12/schema", dl = "https://farris-design.gitee.io/query-solution-config.schema.json", pl = "query-solution-config", fl = "A Farris Container Component", vl = {
fieldsConfig: {
description: "所有字段(树结构)",
type: "array"
},
flatAllFields: {
description: "所有字段(扁平化)",
type: "array"
},
designViewModelUtils: {
description: "",
type: "object"
},
formSchemaUtils: {
description: "",
type: "object"
},
metadataService: {
description: "",
type: "object"
},
viewModelId: {
description: "",
type: "array"
},
eventsEditorUtils: {
description: "",
type: "object"
}
}, ml = {
$schema: cl,
$id: dl,
title: pl,
description: fl,
properties: vl
}, yl = /* @__PURE__ */ new Map([
["appearance", ve]
// ['preset', resolvePreset]
]);
function hl(t, e, l) {
return e;
}
const Ie = {
fieldsConfig: { type: Array, default: [] },
flatAllFields: { type: Array, default: [] },
modelValue: { type: Array, default: [] },
source: { type: String, default: "query-solution" },
onFieldsChanged: { type: Function, default: null },
formSchemaUtils: { type: Object, default: {} },
metadataService: { type: Object, default: {} },
designViewModelUtils: { type: Object, default: {} },
eventsEditorUtils: { type: Object, default: {} },
viewModelId: { type: String, default: "" }
};
ie(Ie, ml, yl, hl);
const gl = {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
helpId: {
description: "帮助元数据ID",
title: "帮助元数据ID",
type: "string"
},
displayName: {
description: "帮助元数据名称",
title: "帮助元数据名称",
type: "string",
readonly: !0
},
uri: {
description: "uri",
title: "uri",
type: "string",
readonly: !0
},
textField: {
description: "文本字段",
title: "文本字段",
type: "string"
},
valueField: {
description: "值字段",
title: "值字段",
type: "string"
},
idField: {
description: "标识字段",
title: "标识字段",
type: "string",
readonly: !0
},
displayType: {
description: "类型: 树列表、列表、双列表、左树右列表",
title: "展示类型",
type: "string",
editor: {
type: "combo-list",
editable: !1,
disabled: !0,
data: [
{
text: "列表",
value: "List"
},
{
text: "树列表",
value: "TreeList"
},
{
text: "双列表",
value: "NavList"
},
{
text: "左树右列表",
value: "NavTreeList"
}
],
textField: "text",
idField: "value",
valueField: "value"
}
},
mapFields: {
description: "映射",
title: "映射",
type: "string"
}
}, bl = {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
returnFormat: {
description: "查询格式",
title: "查询格式",
type: "string"
},
format: {
description: "显示格式",
title: "显示格式",
type: "string"
}
}, Cl = {
"input-group": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
}
},
"number-spinner": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
precision: {
description: "精度",
title: "精度",
type: "number"
},
max: {
description: "最大值",
title: "最大值",
type: "number",
editor: {
type: "number-spinner",
nullable: !0
}
},
min: {
description: "最小值",
title: "最小值",
type: "number",
editor: {
type: "number-spinner",
nullable: !0
}
}
},
"number-range": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
precision: {
description: "精度",
title: "精度",
type: "number"
},
max: {
description: "最大值",
title: "最大值",
type: "number",
editor: {
type: "number-spinner",
nullable: !0
}
},
min: {
description: "最小值",
title: "最小值",
type: "number",
editor: {
type: "number-spinner",
nullable: !0
}
}
},
"combo-list": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
enumValueType: {
description: "值类型",
title: "值类型",
type: "select",
editor: {
type: "combo-list",
data: [
{
value: "int",
name: "整型"
},
{
value: "string",
name: "字符串"
},
{
value: "boolean",
name: "布尔"
}
],
valueField: "value",
textField: "name",
idField: "value"
}
}
},
lookup: gl,
"combo-lookup": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
helpId: {
description: "帮助元数据",
title: "帮助元数据",
type: "string"
},
uri: {
description: "uri",
title: "uri",
type: "string"
},
textField: {
description: "文本字段",
title: "文本字段",
type: "string"
},
valueField: {
description: "值字段",
title: "值字段",
type: "string"
},
idField: {
description: "标识字段",
title: "标识字段",
type: "string"
},
mapFields: {
description: "映射",
title: "映射",
type: "string"
},
multiSelect: {
description: "是否多选",
title: "是否多选",
type: "boolean"
},
editable: {
description: "允许编辑",
title: "允许编辑",
type: "boolean"
},
nosearch: {
description: "任意输入",
title: "任意输入",
type: "boolean"
},
displayFields: {
description: "展示字段",
title: "展示字段",
type: "string"
},
clearFields: {
description: "值变化时清空字段",
title: "值变化时清空字段",
type: "string"
},
dialogTitle: {
description: "面板标题",
title: "面板标题",
type: "string"
},
enableMultiFieldSearch: {
description: "多字段查询",
title: "多字段查询",
type: "boolean"
}
},
"date-range": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
returnFormat: {
description: "查询格式",
title: "查询格式",
type: "string"
},
format: {
description: "显示格式",
title: "显示格式",
type: "string"
}
},
"date-picker": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
valueFormat: {
description: "查询格式",
title: "查询格式",
type: "enum",
editor: {
data: [
{
name: "yyyy-MM-dd",
id: "yyyy-MM-dd"
},
{
name: "yyyy/MM/dd",
id: "yyyy/MM/dd"
},
{
name: "yyyyMMdd",
id: "yyyyMMdd"
},
{
name: "MM/dd/yyyy",
id: "MM/dd/yyyy"
}
]
}
},
displayFormat: {
description: "显示格式",
title: "显示格式",
type: "enum",
editor: {
data: [
{
name: "yyyy-MM-dd",
id: "yyyy-MM-dd"
},
{
name: "yyyy/MM/dd",
id: "yyyy/MM/dd"
},
{
name: "yyyyMMdd",
id: "yyyyMMdd"
},
{
name: "MM/dd/yyyy",
id: "MM/dd/yyyy"
},
{
name: "yyyy年MM月dd日",
id: "yyyy年MM月dd日"
}
]
}
}
},
"date-time": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
returnFormat: {
description: "查询格式",
title: "查询格式",
type: "string"
},
format: {
description: "显示格式",
title: "显示格式",
type: "string"
}
},
"single-date-time": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
returnFormat: {
description: "查询格式",
title: "查询格式",
type: "string"
},
format: {
description: "显示格式",
title: "显示格式",
type: "string"
}
},
month: bl,
"single-year": {
class: {
description: "样式",
title: "样式",
type: "string"
},
required: {
description: "必填",
title: "是否必填",
type: "boolean"
},
returnFormat: {
description: "查询格式",
title: "查询格式",
type: "string"
},
format: {
description: "显示格式",
title: "显示格式",
type: "string"
}
},
"radio-group": {
cla