UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,434 lines 154 kB
var bt = Object.defineProperty; var Ft = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var y = (e, t, n) => Ft(e, typeof t != "symbol" ? t + "" : t, n); import { ref as j, computed as _, watch as K, defineComponent as te, createVNode as F, createTextVNode as Ve, onBeforeUnmount as Ke, withDirectives as Ce, resolveDirective as Te, Fragment as Me, mergeProps as he, onMounted as Re, reactive as Ue, inject as ge } from "vue"; import { FDynamicFormGroup as Ge, dynamicFormGroupProps as Ct, FDynamicFormLabel as Tt } from "../dynamic-form/index.esm.js"; import { cloneDeep as pe, isUndefined as kt, mergeWith as xt, merge as Vt, isPlainObject as ze } from "lodash-es"; import { useDateFormat as we, resolveField as wt, useNumberFormat as et, isMobilePhone as tt, getCustomClass as Se, FormSchemaEntityField$Type as We, FormSchemaEntityFieldTypeName as Ze, useThirdComponent as nt, EVENT_PROPERTY_TAB_IDS as St, useTextBoxDesign as Et, areaResponseDirective as Pt } from "../common/index.esm.js"; import { LocaleService as be } from "../locale/index.esm.js"; import ot from "../lookup/index.esm.js"; import { resolveAppearance as Ot, createPropsResolver as $e, schemaResolverMap as It, propertyEffectMap as Lt, propertyConfigSchemaMap as Mt, schemaMap as Nt, propertyConfigSchemaMapForDesigner as Bt } from "../dynamic-resolver/index.esm.js"; import { loadRegister as jt, useComponentManager as Rt, useEntityState as $t, useDynamicViewUtils as At, componentMap as Ie, resolverMap as qt, componentPropsConverter as Ut } from "../dynamic-view/index.esm.js"; import Gt from "../section/index.esm.js"; import zt from "../accordion/index.esm.js"; import Wt from "../../designer/avatar/index.esm.js"; import Zt from "../../designer/approval-logs/index.esm.js"; import Ht from "../../designer/button-edit/index.esm.js"; import _t from "../button-group/index.esm.js"; import Jt from "../button/index.esm.js"; import Qt from "../calendar/index.esm.js"; import Yt from "../../designer/capsule/index.esm.js"; import He from "../../designer/checkbox/index.esm.js"; import _e from "../../designer/checkbox-group/index.esm.js"; import Ne from "../combo-list/index.esm.js"; import Xt from "../combo-tree/index.esm.js"; import Dt from "../component/index.esm.js"; import Kt from "../color-picker/index.esm.js"; import en from "../content-container/index.esm.js"; import tn from "../../designer/date-picker/index.esm.js"; import nn from "../../designer/data-grid/index.esm.js"; import on from "../dropdown/index.esm.js"; import rn from "../../designer/dynamic-form/index.esm.js"; import ln from "../events-editor/index.esm.js"; import an from "../filter-bar/index.esm.js"; import sn from "../field-selector/index.esm.js"; import un from "../binding-selector/index.esm.js"; import cn from "../image-cropper/index.esm.js"; import dn from "../../designer/input-group/index.esm.js"; import pn from "../layout/index.esm.js"; import mn from "../list-nav/index.esm.js"; import fn from "../../designer/list-view/index.esm.js"; import gn from "../mapping-editor/index.esm.js"; import vn from "../../designer/nav/index.esm.js"; import yn from "../number-range/index.esm.js"; import hn from "../../designer/number-spinner/index.esm.js"; import bn from "../order/index.esm.js"; import Fn from "../page-header/index.esm.js"; import Cn from "../page-footer/index.esm.js"; import Tn from "../pagination/index.esm.js"; import kn from "../progress/index.esm.js"; import xn from "../query-solution/index.esm.js"; import Vn from "../../designer/radio-group/index.esm.js"; import wn from "../../designer/rate/index.esm.js"; import Sn from "../../designer/response-toolbar/index.esm.js"; import En from "../response-layout/index.esm.js"; import Pn from "../../designer/response-layout-editor/index.esm.js"; import On from "../search-box/index.esm.js"; import In from "../../designer/section/index.esm.js"; import Ln from "../smoke-detector/index.esm.js"; import Mn from "../splitter/index.esm.js"; import Nn from "../step/index.esm.js"; import Bn from "../../designer/switch/index.esm.js"; import jn from "../../designer/tabs/index.esm.js"; import Rn from "../../designer/tags/index.esm.js"; import $n from "../text/index.esm.js"; import An from "../../designer/time-picker/index.esm.js"; import qn from "../transfer/index.esm.js"; import Un from "../tree-view/index.esm.js"; import Gn from "../uploader/index.esm.js"; import zn from "../verify-detail/index.esm.js"; import Wn from "../video/index.esm.js"; import Zn from "../../designer/textarea/index.esm.js"; import Hn from "../schema-selector/index.esm.js"; import _n from "../../designer/tree-grid/index.esm.js"; import Jn from "../event-parameter/index.esm.js"; import Qn from "../filter-condition-editor/index.esm.js"; import Yn from "../fieldset/index.esm.js"; import Xn from "../sort-condition-editor/index.esm.js"; import Dn from "../menu-lookup/index.esm.js"; import Kn from "../../designer/drawer/index.esm.js"; import eo from "../json-editor/index.esm.js"; import to from "../property-editor/index.esm.js"; import no from "../expression-editor/index.esm.js"; import oo from "../code-editor/index.esm.js"; import ro from "../html-template/index.esm.js"; import lo from "../collection-property-editor/index.esm.js"; import io from "../../designer/modal/index.esm.js"; import ao from "../external-container/index.esm.js"; import so from "../language-textbox/index.esm.js"; import uo from "../image/index.esm.js"; import co from "../comment/index.esm.js"; import po from "../../designer/wizard/index.esm.js"; import mo from "../tooltip/index.esm.js"; import { useDesignerComponent as rt, DgControl as V } from "../designer-canvas/index.esm.js"; import { InputBaseProperty as fo } from "../property-panel/index.esm.js"; const Ae = { conditions: { type: Array, default: [] }, fields: { type: Array, default: [] }, key: { type: String, default: "" }, /** * 控件标签同行展示 */ isControlInline: { type: [Boolean, String], default: "auto", validator: (e) => [!0, !1, "auto"].includes(e) }, /** * 条件项统一的样式 */ itemClass: { type: String, default: "col-12 col-md-6 col-xl-3 col-el-2" }, /** * 启用自动响应监听 */ autoResponse: { type: Boolean, default: !0 }, customClass: { type: String, default: "" } }; class go { constructor(t = { value: [] }, n) { y(this, "editorType", "check-box"); y(this, "value"); y(this, "valueType", "boolean"); // 编辑器配置 y(this, "editorConfig"); let o = []; Array.isArray(t.value) ? o = t.value.map( (r) => typeof r == "boolean" ? r : JSON.parse(String(r)) ) : typeof t.value == "string" ? o = t.value.split(",").filter((r) => r !== "").map((r) => r.toLowerCase() === "true") : typeof t.value == "boolean" && (o = [t.value]), this.value = o, this.editorConfig = Object.assign({}, n); } clear() { this.value = []; } setValue(t) { this.value = t; } getValue() { return this.value; } getDisplayText() { return this.value.map((t) => t ? "是" : "否").join(","); } isEmpty() { return this.value.length === 0; } } class vo { constructor(t = { textValue: "", value: "", valueField: "" }, n) { y(this, "editorType", "combo-lookup"); y(this, "textValue"); y(this, "value"); y(this, "valueField"); y(this, "valueType", "text"); // 编辑器配置 y(this, "editorConfig"); this.textValue = t == null ? void 0 : t.textValue, this.value = t == null ? void 0 : t.value, this.editorConfig = Object.assign({}, n), this.valueField = t == null ? void 0 : t.valueField; } clear() { this.value = "", this.valueField = "", this.textValue = ""; } getPropValue(t, n) { if (n.length > 1) { const o = n.shift(); return t[o] ? this.getPropValue(t[o], n) : null; } return t[n[0]]; } getTextValue(t) { const n = t.split("."), o = this.value.split(",").map((r) => this.getPropValue(r, pe(n))); return o && o.length ? o.join(",") : ""; } getValue() { const t = this.valueField.split("."), n = this.value.split(",").map((o) => this.getPropValue(o, pe(t))); return n && n.length ? n.join(",") : ""; } getDisplayText() { return this.getValue(); } setValue(t) { throw new Error("Method not implemented."); } isEmpty() { return !this.valueField; } } class Ee { constructor(t = { value: "", displayFormat: "", valueFormat: "" }, n) { y(this, "editorType", "date-picker"); y(this, "value"); y(this, "valueType", "datetime"); y(this, "displayFormat", ""); y(this, "valueFormat", ""); // 编辑器配置 y(this, "editorConfig"); this.value = t == null ? void 0 : t.value, this.editorConfig = Object.assign({}, n), this.displayFormat = (t == null ? void 0 : t.displayFormat) || (n == null ? void 0 : n.displayFormat) || "", this.valueFormat = (t == null ? void 0 : t.valueFormat) || (n == null ? void 0 : n.valueFormat) || ""; } formatValue() { const { formatTo: t, parseToDate: n } = we(); if (!this.value) return ""; const o = n(this.value, this.valueFormat); return t(o, this.displayFormat); } setValue(t) { this.value = t; } getValue() { return this.value; } getDisplayText() { return this.formatValue(); } isEmpty() { return !this.value; } clear() { this.value = void 0; } } class Pe { constructor(t = { begin: "", end: "", displayFormat: "", valueFormat: "" }, n = {}) { y(this, "editorType", "date-range"); y(this, "begin", ""); y(this, "end", ""); y(this, "valueType", "datetime"); y(this, "value", ""); // 编辑器配置 y(this, "editorConfig"); y(this, "displayFormat", ""); y(this, "valueFormat", ""); this.begin = (t == null ? void 0 : t.begin) || "", this.end = (t == null ? void 0 : t.end) || "", this.editorConfig = Object.assign({}, n, { delimiter: "~" }), this.displayFormat = (t == null ? void 0 : t.displayFormat) || (n == null ? void 0 : n.displayFormat) || "", this.valueFormat = (t == null ? void 0 : t.valueFormat) || (n == null ? void 0 : n.valueFormat) || "", this.value = (this.begin === null ? "" : this.begin) + "~" + (this.end === null ? "" : this.end); } clear() { this.begin = "", this.end = "", this.value = ""; } formatValue(t) { const { formatTo: n, parseToDate: o } = we(); if (!t) return ""; const r = o(t, this.valueFormat); return n(r, this.displayFormat); } getValue() { return { begin: this.begin, end: this.end }; } // TODO getDisplayText() { return !this.begin && !this.end ? "" : (this.begin === null ? "" : this.formatValue(this.begin)) + "~" + (this.end === null ? "" : this.formatValue(this.end)); } setValue(t) { if (t) { const n = t.split(this.editorConfig.delimiter); this.begin = n[0] || "", this.end = n[1] || "", this.value = t; } else this.clear(); } isEmpty() { return !this.begin && !this.end; } } class lt { constructor(t = { value: "", valueList: [] }, n) { y(this, "editorType", "combo-list"); y(this, "value"); y(this, "valueType", "enum"); y(this, "valueList", []); // 编辑器配置 y(this, "editorConfig"); this.value = t == null ? void 0 : t.value, this.editorConfig = Object.assign({}, n), this.editorConfig.data && this.editorConfig.data.length ? this.valueList = this.editorConfig.data : this.valueList = (t == null ? void 0 : t.valueList) || []; } clear() { const t = typeof this.value; this.value = t === "string" ? "" : void 0; } /** * 更新数据源 */ updateData(t) { this.valueList = [...t]; } getValue() { return this.value; } getDisplayText() { var r, u; const t = typeof this.value; let n = "", o = []; switch (t) { case "string": o = this.value.split(",") || [], n = this.valueList.filter((s) => o.indexOf(s.value + "") > -1).map((s) => s.name).join(","); break; case "boolean": n = ((r = this.valueList.find((s) => s.value === this.value)) == null ? void 0 : r.name) || ""; break; case "number": n = ((u = this.valueList.find((s) => s.value === this.value)) == null ? void 0 : u.name) || ""; break; } return n; } // setValue(data: { value: string; displayText: string }) { // // this.displayText = data.dispalyText; // const enumValues = getEnumValues(data); // this.value = enumValues; // return this.displayText; // } setValue(t) { this.value = t.value; } isEmpty() { return !this.value && this.value !== !1 && this.value !== 0; } } class yo { constructor(t = { value: "", displayText: "", displayField: "", isInputText: !1 }, n) { y(this, "editorType", "input-group"); // 通过弹窗返回的若干个值对象构成的数组 y(this, "value"); y(this, "valueType", "text"); // 控件内显示的值 y(this, "displayText"); // 弹窗模式下,取列表中哪个字段的值映射到当前字段 y(this, "valueField"); // 是否是手动输入的值 y(this, "isInputText"); // 编辑器配置 y(this, "editorConfig"); this.value = t == null ? void 0 : t.value, this.displayText = t == null ? void 0 : t.displayText, this.valueField = t == null ? void 0 : t.displayField, this.isInputText = t == null ? void 0 : t.isInputText, this.editorConfig = Object.assign({}, n); } clear() { this.value = "", this.displayText = "", this.valueField = ""; } getPropValue(t, n) { if (n.length > 1) { const o = n.shift(); return t[o] ? this.getPropValue(t[o], n) : ""; } return t[n[0]]; } getTextValue(t) { const n = t.split("."), o = this.value.map((r) => this.getPropValue(r, pe(n))); return o && o.length ? o.join(",") : ""; } getValue() { return this.value && typeof this.value == "object" && "value" in this.value ? this.value.value : this.value; } getDisplayText() { return this.getValue(); } setValue(t) { throw new Error("Method not implemented."); } isEmpty() { const t = this.value && typeof this.value == "object" && "value" in this.value ? this.value.value : this.value; return !this.displayText && (t == null || t === "" || !(t != null && t.length)); } } class ho { // 原valueField在帮助中没有实际使用的是idField constructor(t = { mapFields: [], value: "", idField: "", isInputText: !1, helpId: "", valueField: "" }, n) { y(this, "editorType", "lookup"); y(this, "helpId"); y(this, "mapFields"); y(this, "value"); y(this, "valueField"); y(this, "valueType", "text"); // 帮助的值是否为手动输入的任意值,对应帮助的任意输入属性nosearch y(this, "isInputText"); // 编辑器配置 y(this, "editorConfig"); this.editorConfig = Object.assign({}, n), this.value = (t == null ? void 0 : t.value) || "", this.valueField = (t == null ? void 0 : t.valueField) || (n == null ? void 0 : n.valueField) || (t == null ? void 0 : t.idField) || (n == null ? void 0 : n.idField), this.mapFields = t.mapFields, this.isInputText = (t == null ? void 0 : t.isInputText) || (n == null ? void 0 : n.isInputText), this.helpId = (t == null ? void 0 : t.helpId) || (n == null ? void 0 : n.helpId); } clear() { this.value = "", this.mapFields = []; } getValue() { return this.mapFields.map((t) => wt(t, this.valueField || "id")).join(","); } getDisplayText() { return this.value; } setValue(t) { throw new Error("Method not implemented."); } isEmpty() { return !this.mapFields.length; } } class bo extends Ee { constructor(n = { value: "", displayFormat: "", valueFormat: "" }, o) { super(n, o); y(this, "editorType", "month-picker"); } } class Fo extends Pe { constructor(n = { begin: "", end: "", displayFormat: "", valueFormat: "" }, o) { super(n, o); y(this, "editorType", "month-range"); } } class Co { constructor(t = { begin: null, end: null }, n) { y(this, "editorType", "number-range"); y(this, "begin"); y(this, "end"); y(this, "valueType", "number"); // 编辑器配置 y(this, "editorConfig"); this.editorConfig = Object.assign({}, n), this.begin = (t == null ? void 0 : t.begin) == null ? null : parseFloat(t.begin), this.end = (t == null ? void 0 : t.end) == null ? null : parseFloat(t.end); } clear() { this.begin = null, this.end = null; } getValue() { return { begin: this.begin, end: this.end }; } getDisplayText() { return this.begin === null && this.end === null ? "" : (this.begin === null ? "" : this.begin) + "~" + (this.end === null ? "" : this.end); } setValue(t) { this.begin = t.begin == null ? null : parseFloat(t.begin), this.end = t.end == null ? null : parseFloat(t.end); } isEmpty() { return this.begin == null && this.end == null; } } class To { constructor(t = { value: "" }, n) { y(this, "editorType", "number-spinner"); y(this, "value"); y(this, "valueType", "number"); // 编辑器配置 y(this, "editorConfig"); this.editorConfig = Object.assign({}, n); const o = parseFloat(t.value); this.value = isNaN(o) ? null : o; } clear() { this.value = null; } getValue() { return this.value; } getDisplayText() { if (this.isEmpty()) return ""; const { formatTo: t } = et(); return t(this.value, this.editorConfig); } setValue(t) { this.value = isNaN(parseFloat(t)) ? null : t; } isEmpty() { return this.value == null || isNaN(this.value); } } class ko { constructor(t = { value: null, valueList: [] }, n) { y(this, "editorType", "radio-group"); y(this, "value"); y(this, "valueType", "enum"); y(this, "valueList", []); // 编辑器配置 y(this, "editorConfig"); this.editorConfig = Object.assign({}, n), this.value = t == null ? void 0 : t.value, this.editorConfig.data && this.editorConfig.data.length ? this.valueList = this.editorConfig.data : this.valueList = (t == null ? void 0 : t.valueList) || []; } clear() { this.value = void 0, this.valueList = []; } getValue() { return this.value; } getDisplayText() { var t; return ((t = this.valueList.find((n) => n.value === this.value)) == null ? void 0 : t.name) || ""; } setValue(t) { this.value = t; } isEmpty() { return !this.value && this.value !== 0 && this.value !== !1; } } class xo extends Ee { constructor(n = { value: "", displayFormat: "", valueFormat: "" }, o) { super(n, o); y(this, "editorType", "year-picker"); } } class it { constructor(t = { value: "" }, n) { y(this, "editorType", "text"); y(this, "value"); y(this, "valueType", "text"); // 编辑器配置 y(this, "editorConfig"); this.value = t.value; } clear() { this.value = void 0; } getValue() { return this.value; } getDisplayText() { return this.getValue(); } setValue(t) { this.value = t; } isEmpty() { return !this.value; } } function Vo() { const { getLocaleValue: e } = be; return { conditionListLocale: { // 添加条件 add: e("condition.add"), // 生成条件组 create: e("condition.create"), // 重置 reset: e("condition.reset"), and: e("condition.and"), or: e("condition.or") } }; } function wo() { const { getLocaleValue: e } = be; return { operatorsLocale: { equal: e("operators.equal"), notEqual: e("operators.notEqual"), greater: e("operators.greater"), greaterOrEqual: e("operators.greaterOrEqual"), lessOrEqual: e("operators.lessOrEqual"), less: e("operators.less"), contains: e("operators.contains"), startWith: e("operators.startWith"), endWith: e("operators.endWith"), is: e("operators.empty"), isNot: e("operators.notEmpty") } }; } var ee = /* @__PURE__ */ ((e) => (e.Equal = "0", e.NotEqual = "1", e.Greater = "2", e.GreaterOrEqual = "3", e.Less = "4", e.LessOrEqual = "5", e.Like = "6", e.LikeStartWith = "7", e.LikeEndWith = "8", e.NotLike = "9", e.NotLikeStartWith = "10", e.NotLikeEndWith = "11", e.Is = "12", e.IsNot = "13", e.In = "14", e.NotIn = "15", e))(ee || {}); function So() { const { operatorsLocale: e } = wo(); return [ { value: "0", name: e.equal // 等于 }, { value: "1", name: e.notEqual // 不等于 }, { value: "2", name: e.greater // 大于 }, { value: "3", name: e.greaterOrEqual // 大于等于 }, { value: "4", name: e.less // 小于 }, { value: "5", name: e.lessOrEqual // 小于等于 }, { value: "6", name: e.contains // 包含 }, { value: "7", name: e.startWith // 开始是 }, { value: "8", name: e.endWith // 结束是 }, { value: "12", name: e.is // 为空 }, { value: "13", name: e.isNot // 非空 } ]; } const Eo = { "button-edit": ["0", "1", " 6", "7", "8"], "check-box": ["0"], "combo-list": ["0", "1"], "combo-lookup": ["0", "1", " 6", "7", "8"], "date-picker": ["0", "1", "2", "3", "4", "5"], "date-range": [], "datetime-picker": ["0", "1", "2", "3", "4", "5"], "datetime-range": [], "month-picker": ["0", "1", "2", "3", "4", "5"], "month-range": [], "year-picker": ["0", "1", "2", "3", "4", "5"], "year-range": [], "input-group": ["0", "1", "6", "7", "8"], lookup: ["0", "1"], "number-range": [], "number-spinner": ["0", " 1", "2", "3", "4", "5"], "radio-group": ["0"], text: ["0", "1", "6", "7", "8", "12", "13"] }; function Po(e, t, n) { const { fieldMap: o } = n; function r(u) { const s = o.get(u.fieldCode); if (!s) return []; const a = s.editor.type, d = new Set(Eo[a]); return So().filter((h) => d.has(h.value)); } return { getCompareOperators: r }; } class Oo { constructor(t = { begin: "", end: "", displayFormat: "", valueFormat: "" }, n = {}) { y(this, "editorType", "date-range"); y(this, "compareType"); y(this, "value"); y(this, "range"); y(this, "valueType", "datetime"); // 编辑器配置 y(this, "editorConfig"); y(this, "displayFormat", ""); y(this, "valueFormat", ""); var o, r; if (this.editorConfig = Object.assign({}, n, { delimiter: "~" }), this.displayFormat = (t == null ? void 0 : t.displayFormat) || (n == null ? void 0 : n.displayFormat) || "", this.valueFormat = (t == null ? void 0 : t.valueFormat) || (n == null ? void 0 : n.valueFormat) || "", t && typeof t == "object" && "compareType" in t) { const u = t; this.compareType = u.compareType || "range", this.value = u.value || "", this.range = { begin: ((o = u.range) == null ? void 0 : o.begin) || "", end: ((r = u.range) == null ? void 0 : r.end) || "" }; } else { const u = t; this.compareType = "range", this.value = "", this.range = { begin: (u == null ? void 0 : u.begin) || "", end: (u == null ? void 0 : u.end) || "" }; } } clear() { this.compareType = "range", this.value = "", this.range = { begin: "", end: "" }; } formatValue(t) { const { formatTo: n, parseToDate: o } = we(); if (!t) return ""; const r = o(t, this.valueFormat); return n(r, this.displayFormat); } getValue() { return { compareType: this.compareType, value: this.value, range: { ...this.range } }; } getDisplayText() { if (this.isEmpty()) return ""; if (this.compareType === "range") { const t = this.range.begin ? this.formatValue(this.range.begin) : "", n = this.range.end ? this.formatValue(this.range.end) : ""; return t + "~" + n; } return this.compareType === ee.Is ? "为空" : this.compareType === ee.IsNot ? "非空" : this.formatValue(this.value); } setValue(t) { var n, o; if (!t) { this.clear(); return; } if (typeof t == "object" && "compareType" in t) { const r = t; this.compareType = r.compareType || "range", this.value = r.value || "", this.range = { begin: ((n = r.range) == null ? void 0 : n.begin) || "", end: ((o = r.range) == null ? void 0 : o.end) || "" }; } else { const r = String(t).split(this.editorConfig.delimiter); this.compareType = "range", this.value = "", this.range = { begin: r[0] || "", end: r[1] || "" }; } } isEmpty() { return this.compareType === "range" ? !this.range.begin && !this.range.end : this.compareType === ee.Is || this.compareType === ee.IsNot ? !1 : !this.value; } } class Yi extends Oo { constructor(n = { begin: "", end: "", displayFormat: "", valueFormat: "" }, o = {}) { super(n, o); // 这个属性会在后面进行比对 y(this, "editorType", "datetime-range"); y(this, "valueType", "datetime"); } } class Xi { constructor(t = { value: "" }, n) { y(this, "editorType", "number-spinner"); y(this, "compareType"); y(this, "value"); y(this, "range"); y(this, "valueType", "number"); // 编辑器配置 y(this, "editorConfig"); var r, u; this.editorConfig = Object.assign({}, n); const o = t && typeof t == "object" && "compareType" in t ? t : t != null && t.value && typeof t.value == "object" && "compareType" in t.value ? t.value : { compareType: ee.Equal, value: (t == null ? void 0 : t.value) ?? null, range: { begin: null, end: null } }; this.compareType = o.compareType || ee.Equal, this.value = o.value ?? null, this.range = { begin: ((r = o.range) == null ? void 0 : r.begin) ?? null, end: ((u = o.range) == null ? void 0 : u.end) ?? null }; } clear() { this.compareType = ee.Equal, this.value = null, this.range = { begin: null, end: null }; } getValue() { return { compareType: this.compareType, value: this.value, range: { ...this.range } }; } getDisplayText() { if (this.isEmpty()) return ""; if (this.compareType === "range") { const t = this.range.begin == null ? "" : this.formatNumber(this.range.begin), n = this.range.end == null ? "" : this.formatNumber(this.range.end); return t + "~" + n; } return this.compareType === ee.Is ? "为空" : this.compareType === ee.IsNot ? "非空" : this.formatNumber(this.value); } formatNumber(t) { if (t == null) return ""; const { formatTo: n } = et(); return n(t, this.editorConfig); } setValue(t) { var n, o; t && typeof t == "object" && (this.compareType = t.compareType || ee.Equal, this.value = t.value ?? null, this.range = { begin: ((n = t.range) == null ? void 0 : n.begin) ?? null, end: ((o = t.range) == null ? void 0 : o.end) ?? null }); } isEmpty() { return this.compareType === "range" ? this.range.begin == null && this.range.end == null : this.compareType === ee.Is || this.compareType === ee.IsNot ? !1 : this.value == null || isNaN(this.value); } } class Io { constructor(t = { value: "", displayFormat: "", valueFormat: "" }, n) { y(this, "editorType", "date-picker"); y(this, "value"); y(this, "compareType"); y(this, "valueType", "datetime"); y(this, "displayFormat", ""); y(this, "valueFormat", ""); // 编辑器配置 y(this, "editorConfig"); this.editorConfig = Object.assign({}, n), this.displayFormat = (t == null ? void 0 : t.displayFormat) || (n == null ? void 0 : n.displayFormat) || "", this.valueFormat = (t == null ? void 0 : t.valueFormat) || (n == null ? void 0 : n.valueFormat) || ""; const o = t == null ? void 0 : t.value; if (o && typeof o == "object" && "compareType" in o) { const r = o; this.compareType = r.compareType || "", this.value = r.value || ""; } else this.compareType = "", this.value = o; } formatValue() { const { formatTo: t, parseToDate: n } = we(); if (!this.value) return ""; const o = n(this.value, this.valueFormat); return t(o, this.displayFormat); } setValue(t) { this.value = t; } getValue() { return this.value; } getDisplayText() { return this.formatValue(); } isEmpty() { return this.compareType === ee.Is || this.compareType === ee.IsNot ? !1 : !this.value; } clear() { this.value = void 0; } } class Di extends Io { constructor(n = { value: "", displayFormat: "", valueFormat: "" }, o) { super(n, o); y(this, "editorType", "datetime-picker"); } } class Ki { constructor(t = { value: "", displayText: "", displayField: "", isInputText: !1 }, n) { y(this, "editorType", "input-group"); // 通过弹窗返回的若干个值对象构成的数组 y(this, "value"); y(this, "valueType", "text"); // 控件内显示的值 y(this, "displayText"); // 弹窗模式下,取列表中哪个字段的值映射到当前字段 y(this, "valueField"); // 是否是手动输入的值 y(this, "isInputText"); // 编辑器配置 y(this, "editorConfig"); this.value = t == null ? void 0 : t.value, this.value && typeof this.value == "object" && "value" in this.value ? this.displayText = String(this.value.value ?? "") : this.displayText = (t == null ? void 0 : t.displayText) ?? "", this.valueField = t == null ? void 0 : t.displayField, this.isInputText = t == null ? void 0 : t.isInputText, this.editorConfig = Object.assign({}, n); } clear() { this.value = "", this.displayText = "", this.valueField = ""; } getPropValue(t, n) { if (n.length > 1) { const o = n.shift(); return t[o] ? this.getPropValue(t[o], n) : ""; } return t[n[0]]; } getTextValue(t) { const n = t.split("."), o = this.value.map((r) => this.getPropValue(r, pe(n))); return o && o.length ? o.join(",") : ""; } getValue() { return this.value && typeof this.value == "object" && "value" in this.value ? this.value.value : this.value; } getDisplayText() { return this.getValue(); } setValue(t) { throw new Error("Method not implemented."); } isEmpty() { const t = this.value && typeof this.value == "object" && "value" in this.value ? this.value.value : this.value, n = this.value && typeof this.value == "object" && "compareType" in this.value ? String(this.value.compareType) : ""; return n === "12" || n === "13" ? !1 : t == null || t === ""; } } class Lo extends Ee { constructor(n = { value: "", displayFormat: "", valueFormat: "" }, o) { super(n, o); y(this, "editorType", "datetime-picker"); } } class Mo extends Pe { constructor(n = { begin: "", end: "", displayFormat: "", valueFormat: "" }, o) { super(n, o); y(this, "editorType", "year-range"); } } class No extends Pe { constructor(n = { begin: "", end: "", displayFormat: "", valueFormat: "" }, o = {}) { super(n, o); // 这个属性会在后面进行比对 y(this, "editorType", "datetime-range"); y(this, "valueType", "datetime"); } } class Bo extends lt { constructor(n = { value: "", valueList: [] }, o) { super(n, o); y(this, "editorType", "check-group"); } } function at() { function e(t, n, o) { switch (t) { case "check-box": return new go(n, o); case "combo-list": return new lt(n, o); case "combo-lookup": return new vo(n, o); case "input-group": return new yo(n, o); case "year-picker": return new xo(n, o); case "date-picker": return new Ee(n, o); case "datetime-range": return new No(n, o); case "date-range": return new Pe(n, o); case "datetime-picker": return new Lo(n, o); case "lookup": return new ho(n, o); case "month-picker": return new bo(n, o); case "month-range": return new Fo(n, o); case "year-range": return new Mo(n, o); case "number-range": return new Co(n, o); case "number-spinner": return new To(n, o); case "radio-group": return new ko(n, o); case "check-group": return new Bo(n, o); default: return new it(n, o); } } return { createConditionValue: e }; } function st(e = "query-solution") { function t(a) { let d = "input-group"; switch (a) { case "year-picker": case "month-picker": case "year-range": case "month-range": case "date-range": case "datetime-range": case "datetime-picker": d = "date-picker"; break; default: d = a; } return d; } function n(a) { const d = a.editor ? a.editor.type : "input-group"; return a.editor.type = t(d), a.editor.type === "date-picker" ? (d.indexOf("range") > -1 && (a.editor.enablePeriod = !0), d.indexOf("datetime") > -1 && (a.editor.showTime = !0), d.indexOf("year") > -1 && (a.editor.selectMode = "year"), d.indexOf("month") > -1 && (a.editor.selectMode = "month"), a.editor.weekSelect && (a.editor.selectMode = "week")) : a.editor.type === "number-spinner" || a.editor.type === "number-range" ? (a.editor.showZero = !0, a.editor.nullable = !0, a.editor.needValid = !0) : a.editor.type === "check-group" && e === "filter-bar" ? a.editor.direction = "vertical" : (a.editor.type === "lookup" || a.editor.type === "combo-list") && (a.editor.enableClear = Object.prototype.hasOwnProperty.call(a.editor, "enableClear") ? a.editor.enableClear : !0), d === "input-group" && !a.editor.placeholder && (a.editor.placeholder = be.getLocaleValue("input-group.placeholder")), a.editor; } function o(a) { return a.map((m) => Object.assign({}, m)).map((m) => (m.visible = Object.prototype.hasOwnProperty.call(m, "visible") ? m.visible : !0, m.editor = n(m), m)); } function r(a, d, m, h) { switch (a.value.editorType) { case "combo-list": h.newValue && (a.value.valueList = h.newValue.map((l) => ({ name: l.name, value: l.value }))); break; case "radio-group": a.value.valueList = [m.data.find((l) => l.value === d)]; break; case "year-range": case "month-range": case "date-range": case "datetime-range": a.value.setValue(d); break; } } function u(a, d) { a && (a || "").split(",").map((h) => { const l = d.find((i) => i.fieldCode === h); l && l.value.clear(); }); } function s(a, d, m, h = []) { var C, N, T, b, M, U, R; const l = pe((C = a.get(d.fieldCode)) == null ? void 0 : C.editor), i = (N = a.get(d.fieldCode)) == null ? void 0 : N.id, v = Object.prototype.hasOwnProperty.call(d, "visible") ? d.visible : (T = a.get(d.fieldCode)) == null ? void 0 : T.visible; let f = !0; if (((b = d.value) == null ? void 0 : b.editorType) === "lookup" && l) { l.idValue = (M = d.value.mapFields) == null ? void 0 : M.map((x) => x.id).join(","); const { onClear: $ } = l; l.onClear = (x) => { d.value.mapFields = [], u(d.clearFields, h), m(d, ""), $ && $(x); }, l["onUpdate:dataMapping"] = (x) => { d.value.mapFields = x.items || [], u(d.clearFields, h), m(d, d.value.getValue()); }, f = !1; } else ((U = d.value) == null ? void 0 : U.editorType) === "number-range" && l ? (l.beginValue = d.value.begin, l.onBeginValueChange = ($) => { d.value.begin = $, m(d, $); }, l.endValue = d.value.end, l.onEndValueChange = ($) => { d.value.end = $, m(d, $); }, f = !1) : l && ["year-range", "month-range", "date-range", "datetime-range"].find(($) => { var x; return $ === ((x = d.value) == null ? void 0 : x.editorType); }) ? (l.beginValue = d.value.begin, l.endValue = d.value.end) : ((R = d.value) == null ? void 0 : R.editorType) === "combo-list" && l && (l.onDataChanged = ($) => { var Z; const x = (Z = a.get(d.fieldCode)) == null ? void 0 : Z.editor; x && (x.data = $), d.value.updateData($); }); return Object.prototype.hasOwnProperty.call(d, "disabled") && (l.disabled = d.disabled), { id: i, editor: l, visible: v, needEmitChange: f }; } return { getSingleControlType: n, convertToControls: o, conditionChangeHandler: r, renderFieldConditionEditor: s }; } function qe(e, t, n = "query-solution") { const { convertToControls: o } = st(n), r = j(e.fields), u = j([]), s = /* @__PURE__ */ new Map(), { createConditionValue: a } = at(); function d(h = !0, l) { h && (r.value = o(l || r.value)), s.clear(), r.value && r.value.length > 0 && r.value.forEach((i) => { i && i.labelCode && s.set(i.labelCode, i); }); } function m(h) { return h.forEach((l) => { if (l) { const i = s.get(l.fieldCode); i.controlType && (l.value = a(i.controlType, l.value, i.editor)); } }), h; } return { convertToControls: o, fields: r, fieldMap: s, fieldConditions: u, loadFieldConfigs: d, initialConditionValue: m }; } function ut(e, t, n) { const o = j(null), r = j(n), u = j(0); function s(h, l) { let i = null; return function() { const v = arguments; i ? (clearTimeout(i), i = setTimeout(() => { i = null, h(...v); }, 200)) : (h(...v), i = setTimeout(() => { i = null; }, 200)); }; } function a() { r.value && (o.value = new ResizeObserver(s((h) => { const l = h[0]; u.value = l.contentRect.width; })), o.value.observe(r.value)); } function d(h) { let i = "col-12"; return h > 250 * 6 ? i = "col-2" : h > 250 * 4 ? i = "col-3" : h > 250 * 3 ? i = "col-4" : h > 250 * 2 && (i = "col-6"), i; } const m = _(() => d(u.value)); return K([n], ([h]) => { r.value = h, a(); }), { conditionClass: m, resizeObserver: o }; } const jo = { id: { type: String }, required: { type: Boolean, default: !1 }, title: { type: String, default: "" }, valid: { type: Boolean, default: !0 }, inValidTip: { type: String, default: "" }, showSubTitle: { type: Boolean, default: !1 }, showCollapse: { type: Boolean, default: !1 }, subTitle: { type: String, default: "" } }, Ro = { /** * 组件标识 */ id: { type: String }, /** * 下拉数据源 */ data: { type: Array, default: [] }, /** * 可选,是否禁用 * 默认为`false` */ disabled: { default: !1, type: Boolean }, /** * 可选,数据源id字段 * 默认为`id` */ idField: { default: "id", type: String }, /** * 可选,是否支持多选 * 默认`false` */ multiSelect: { type: Boolean, default: !1 }, /** * 绑定值 */ modelValue: {}, /** * 可选,是否只读 * 默认为`false` */ readonly: { default: !1, type: Boolean }, /** * 可选,分隔符 * 默认`,` */ separator: { default: ",", type: String }, /** * 可选,数据源显示字段 * 默认为`name` */ textField: { default: "name", type: String }, /** * 可选,数据源值字段 * 默认为`id` */ valueField: { default: "id", type: String } }, $o = /* @__PURE__ */ te({ name: "FConditionTitle", props: jo, emits: [], setup(e, t) { const n = j(e.required), o = j(e.title), r = j(e.valid), u = j(e.inValidTip), s = j(!1), a = j(); K(() => e.title, () => { o.value = e.title; }), K(() => e.required, (i, v) => { i !== v && (n.value = i); }), K([() => e.valid, () => e.inValidTip], ([i, v]) => { r.value = i, u.value = v; }); const d = _(() => r.value ? o.value : u.value), m = _(() => r.value ? "" : "color:red"), h = _(() => ({ "col-form-label": !0, "condition-title": !0, "d-flex": !0 // 指定必填,当显示模式是隐藏或者没有指定标签名时,宽度不限定 // 'f-width-auto': required.value && (props.showType === 'none' || !text.value) })); function l() { var v; const i = (v = a.value) == null ? void 0 : v.nextElementSibling; i && (s.value ? i.style.display = "block" : i.style.display = "none"), s.value = !s.value; } return () => F("div", { class: h.value, title: d.value, style: m.value, ref: a }, [!r.value && F("span", { class: "f-icon f-icon-warning mr-1", style: "color: red; min-width: 16px;", title: u.value }, null), F("span", { class: "farris-label-text text-truncate", style: "flex-shrink: 0;" }, [n.value && F("span", { class: "farris-label-info text-danger" }, [Ve("*")]), o.value]), F("div", { class: "condition-title--right ml-auto d-flex align-items-center" }, [e.showSubTitle && F("span", { class: "text-info text-truncate mx-2" }, [e.subTitle]), e.showCollapse && F("span", { class: "f-icon f-icon-dropdown", style: { transform: s.value ? "none" : "rotate(180deg)" }, onClick: l }, null), t.slots.right && t.slots.right()])]); } }), Ao = /* @__PURE__ */ te({ name: "FConditionPanelList", props: Ro, emits: ["change", "update:modelValue"], setup(e, t) { const n = _(() => kt(e.modelValue) ? [] : e.multiSelect && e.modelValue.indexOf(",") > -1 ? e.modelValue.split(",") : e.data.find((a) => a[e.valueField] === e.modelValue) ? [e.modelValue] : []), o = (a) => n.value.includes(a[e.valueField]), r = (a) => { let d = ""; o(a) ? e.multiSelect && (d = n.value.filter((l) => l !== a).join(",")) : e.multiSelect ? d = [...n.value, a].join(",") : d = a; const m = e.multiSelect ? d.split(",") : [d], h = e.data.filter((l) => m.includes(l[e.valueField])); t.emit("update:modelValue", d), t.emit("change", d, { newValue: h, newModelValue: d }); }, u = (a) => { r(a[e.valueField]); }; function s(a) { return { "farris-tag-item": !0, "farris-tag-item-info": !0, "border-0": !0, "farris-tag-item-checked": o(a) }; } return () => F("div", { class: "farris-tags condition-panel-list" }, [F("ul", { class: "farris-tags-item-container " }, [e.data.map((a) => F("li", { class: s(a), onClick: () => u(a) }, [F("span", { class: "tag-box text-truncate" }, [a[e.textField]])]))])]); } }), Je = /* @__PURE__ */ te({ name: "FConditionFields", props: Ae, emits: ["valueChange", "blur", "focus", "click", "input"], setup(e, t) { const n = j(), o = tt(), r = be.getLocale(), u = j(e.key), s = j(e.conditions), { renderFieldConditionEditor: a, conditionChangeHandler: d } = st(), m = qe(e), { initialConditionValue: h, fieldMap: l, loadFieldConfigs: i, fields: v } = m, f = ut(e, t, n), { resizeObserver: C } = f, N = j({ enable: o ? !1 : e.autoResponse }); i(!0), h(s.value), Ke(() => { var R; (R = C.value) == null || R.unobserve(n.value); }), K(() => e.fields, () => { i(!0, e.fields); }), K(() => e.conditions, () => { s.value = e.conditions, h(s.value); }); const T = _(() => { const R = { // row: true, "f-utils-flex-row-wrap": !0, "farris-form": !0, "condition-div": !0, "farris-form-controls-inline": !r || e.isControlInline === !0 || e.isControlInline === "auto" && r !== "en" }; return Se(R, e.customClass); }); function b(R, $, x, Z) { d(R, $, x, Z), t.emit("valueChange", $, R); } function M() { return s.value.map((R) => { var k; const { id: $, editor: x, needEmitChange: Z, visible: c } = a(l, R, b); let g = ((k = x == null ? void 0 : x.appearance) == null ? void 0 : k.class) || e.itemClass; x != null && x.multiLineLabel && (g = g + " farris-group-multi-label"); const w = ["radio-group", "check-group", "combo-list", "lookup"].indexOf(x == null ? void 0 : x.type) > -1, B = ["radio-group", "check-group", "combo-list"].indexOf(x == null ? void 0 : x.type) > -1; return F(Ge, { id: $, key: $, visible: c, customClass: g, label: (x == null ? void 0 : x.showLabel) === !1 ? " " : R.fieldName, editor: x, required: x == null ? void 0 : x.required, modelValue: R.value.value, "onUpdate:modelValue": (S) => R.value.value = S, onChange: (S, L) => { Z && b(R, S, x, L); } }, { label: () => F($o, { id: `${$.value}-title`, showSubTitle: w, showCollapse: B, required: x == null ? void 0 : x.required, title: R.fieldName, editorType: x == null ? void 0 : x.type, subTitle: R.value.getDisplayText() }, { ...(x == null ? void 0 : x.type) === "lookup" ? { right: () => F(ot, he({ id: $, customClass: "mobile-lookup-icon" }, x, { modelValue: R.value.value, "onUpdate:modelValue": (S) => R.value.value = S, onChange: (S, L) => { Z && b(R, S, x, L); } }), { content: ({ openDialog: S }) => F(Me, null, [F("div", { class: "d-flex align-items-center lookup-icon-wrapper", onClick: S }, [F("span", { class: " text-muted" }, [Ve("更多")]), F("span", { class: "f-icon f-icon-dropdown" }, null)])]) }) } : {} }), ...["radio-group", "check-group", "combo-list"].indexOf(x == null ? void 0 : x.type) > -1 ? { content: () => F(Ao, he({ id: $ }, x, { modelValue: R.value.value, "onUpdate:modelValue": (S) => R.value.value = S, onChange: (S, L) => { Z && b(R, S, x, L); } }), null) } : {}, ...(x == null ? void 0 : x.type) === "lookup" ? { content: () => F(Me, null, null) } : {} }); }); } function U() { return s.value.map((R) => { var w; const { id: $, editor: x, needEmitChange: Z, visible: c } = a(l, R, b, s.value); let g = ((w = x == null ? void 0 : x.appearance) == null ? void 0 : w.class) || e.itemClass; return x != null && x.multiLineLabel && (g = g + " farris-group-multi-label"), F(Ge, { id: $, key: $, visible: c, customClass: g, label: (x == null ? void 0 : x.showLabel) === !1 ? " " : R.fieldName, editor: x, required: x == null ? void 0 : x.required, modelValue: R.value.value, "onUpdate:modelValue": (B) => R.value.value = B, onChange: (B, k) => { Z && b(R, B, x, k); } }, null); }); } return () => Ce(F("div", { class: T.value, key: u.value, ref: n }, [o ? M() : U()]), [[Te("area-response"), N]]); } }), qo = "root-viewmodel"; class Uo { constructor(t, n) { y(this, "formSchemaUtils"); y(this, "controlCreatorUtils"); y(this, "designViewModelUtils"); this.resolver = t, this.designerHostService = n, this.formSchemaUtils = this.designerHostService.formSchemaUtils, this.controlCreatorUtils = this.designerHostService.controlCreatorUtils, this.designViewModelUtils = this.designerHostService.designViewModelUtils; } createComponent(t) { const n = this.createComponentRefNode(t), o = this.createComponentNode(t), r = this.createViewModeNode(t), u = this.formSchemaUtils.getFormSchema(); return u.module.viewmodels.push(r), u.module.components.push(o), this.designViewModelUtils.assembleDesignViewModel(), n; } createComponentRefNode(t) { const n = this.resolver.getSchemaByType("component-ref"); return Object.assign(n, { id: `${t.componentId}-component-ref`, component: `${t.componentId}-component` }), n; } createComponentNode(t) { const n = this.resolver.getSchemaByType("component"), o = this.createFormComponentContents(t); return Object.assign(n, { id: `${t.componentId}-component`, viewModel: `${t.componentId}-component-viewmodel`, componentType: t.componentType, appearance: { class: this.getFormComponentClass(t) }, formColumns: t.formColumns, contents: o }), n; } /** * 获取卡片组件层级的class样式 */ getFormComponentClass(t) { var o, r; const { templateId: n } = this.formSchemaUtils.getFormSchema().module; if (n === "double-list-in-tab-template" && ((r = (o = t.parentComponentInstance) == null ? void 0 : o.schema) == null ? void 0 : r.type) === "tab-page") { const u = t.parentComponentInstance.parent && t.parentComponentInstance.parent.schema; if ((u == null ? void 0 : u.type) === "tabs" && (u == null ? void 0 : u.fill) === !0) return "f-struct-wrapper f-utils-fill-flex-column"; } return "f-struct-wrapper"; } createFormComponentContents(t) { var a, d; const n = this.resolver.getSchemaByType("section"); Object.assign(n, { id: t.componentId + "-form-section", appearance: { class: "f-section-form f-section-in-mainsubcard" }, mainTitle: t.componentName }); const o = this.resolver.getSchemaByType("response-form"), r = []; Object.assign(o, { id: t.componentId + "-form", appearance: { class: "f-form-layout farris-form farris-form-controls-inline" }, contents: r, controlsInline: !0 }), n.contents = [o]; const { selectedFields: u } = t; u == null || u.forEach((m) => { if (m.$type === We.SimpleField) { const h = pe(m), l = this.resolveControlClassByFormColumns(t), i = this.controlCreatorUtils.setFormFieldProperty(h, "", l); i && r.push(i); } }); const { templateId: s } = this.formSchemaUtils.getFormSchema().module; if (s === "double-list-in-tab-template" && ((d = (a = t.parentComponentInstance) == null ? void 0 : a.schema) == null ? void 0 : d.type) === "tab-page") { const m = t.parentComponentInstance.parent && t.parentComponentInstance.parent.schema; (m == null ? void 0 : m.type) === "tabs" && (m == null ? void 0 : m.fill) === !0 && (n.appearance.class = "f-section-grid f-section-in-main px-0 pt-0", n.fill = !0); } return [n]; } resolveControlClassByFormColumns(t) { let n = ""; switch