@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,497 lines • 215 kB
JavaScript
var Vn = Object.defineProperty;
var jn = (n, e, t) => e in n ? Vn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
var X = (n, e, t) => jn(n, typeof e != "symbol" ? e + "" : e, t);
import { getCustomClass as $t, withInstall as Kt, FormSchemaEntityField$Type as ht, FormSchemaEntityFieldTypeName as Dt, FormSchemaEntityFieldType$Type as Rn } from "../common/index.esm.js";
import { ref as M, computed as $, createVNode as w, onMounted as He, nextTick as et, defineComponent as Ie, watch as ye, Fragment as lt, reactive as De, createApp as en, onUnmounted as St, Transition as tn, mergeProps as zt, createTextVNode as Ln, inject as Ht, onBeforeMount as $n, Teleport as Dn, shallowRef as Hn, render as Lt, h as An, cloneVNode as zn } from "vue";
import { cloneDeep as yt, isPlainObject as Jt, isUndefined as Le } from "lodash-es";
import Se from "bignumber.js";
import { useI18n as xt } from "vue-i18n";
import { getSchemaByTypeForDesigner as Un, createPropsResolver as nn, resolveAppearance as qn } from "../dynamic-resolver/index.esm.js";
import { DgControl as Qt } from "../designer-canvas/index.esm.js";
import { LocaleService as Tt } from "../locale/index.esm.js";
import { useResizeObserver as _n } from "@vueuse/core";
import { getHierarchyRow as Wn, useIdentify as Gn, useGroupData as Xn, useFilter as Yn, useHierarchy as Zn, useLoading as Jn, useDataView as Qn, useSelection as Kn, useSelectHierarchyItem as eo, usePagination as to, useDataViewContainerStyle as no, useCommandColumn as oo, useSettingColumn as io, useColumn as ro, useSort as ao, useGroupColumn as so, useRow as lo, useEdit as uo, useVisualDataBound as co, useVisualDataCell as fo, useVisualDataRow as po, useVisualData as mo, useCellPosition as vo, useSidebar as go, useVirtualScroll as ho, useFitColumn as yo, useFilterHistory as bo, useColumnFilter as wo, useDragColumn as Co, getColumnHeader as So, getSidebar as xo, getDisableMask as To, getHorizontalScrollbar as Mo, getVerticalScrollbar as Eo, getEmpty as Fo, getPagination as Bo, getSummary as ko } from "../data-view/index.esm.js";
import "../property-panel/index.esm.js";
import "../accordion/index.esm.js";
import "../avatar/index.esm.js";
import "../../designer/button-edit/index.esm.js";
import "../button-group/index.esm.js";
import "../calendar/index.esm.js";
import "../capsule/index.esm.js";
import "../../designer/checkbox/index.esm.js";
import "../../designer/checkbox-group/index.esm.js";
import "../combo-list/index.esm.js";
import "../combo-tree/index.esm.js";
import "../component/index.esm.js";
import "../color-picker/index.esm.js";
import "../content-container/index.esm.js";
import "../date-picker/index.esm.js";
import "../../designer/data-grid/index.esm.js";
import "../dropdown/index.esm.js";
import "../dynamic-form/index.esm.js";
import "../events-editor/index.esm.js";
import "../filter-bar/index.esm.js";
import "../field-selector/index.esm.js";
import "../binding-selector/index.esm.js";
import "../image-cropper/index.esm.js";
import "../../designer/input-group/index.esm.js";
import "../layout/index.esm.js";
import "../list-nav/index.esm.js";
import "../../designer/list-view/index.esm.js";
import "../lookup/index.esm.js";
import "../mapping-editor/index.esm.js";
import "../nav/index.esm.js";
import "../number-range/index.esm.js";
import "../number-spinner/index.esm.js";
import "../order/index.esm.js";
import "../page-header/index.esm.js";
import "../page-footer/index.esm.js";
import "../pagination/index.esm.js";
import "../progress/index.esm.js";
import "../query-solution/index.esm.js";
import "../../designer/radio-group/index.esm.js";
import "../rate/index.esm.js";
import "../response-toolbar/index.esm.js";
import "../response-layout/index.esm.js";
import "../response-layout-editor/index.esm.js";
import "../search-box/index.esm.js";
import "../section/index.esm.js";
import "../smoke-detector/index.esm.js";
import "../splitter/index.esm.js";
import "../step/index.esm.js";
import "../switch/index.esm.js";
import "../tabs/index.esm.js";
import "../tags/index.esm.js";
import "../text/index.esm.js";
import "../time-picker/index.esm.js";
import "../transfer/index.esm.js";
import "../tree-view/index.esm.js";
import "../uploader/index.esm.js";
import "../verify-detail/index.esm.js";
import "../video/index.esm.js";
import "../textarea/index.esm.js";
import "../schema-selector/index.esm.js";
import "../../designer/tree-grid/index.esm.js";
import "../event-parameter/index.esm.js";
import "../filter-condition-editor/index.esm.js";
import "../fieldset/index.esm.js";
import "../sort-condition-editor/index.esm.js";
import "../menu-lookup/index.esm.js";
import "../../designer/drawer/index.esm.js";
import "../json-editor/index.esm.js";
import "../property-editor/index.esm.js";
import "../expression-editor/index.esm.js";
import "../code-editor/index.esm.js";
import "../html-template/index.esm.js";
import "../collection-property-editor/index.esm.js";
import "../modal/index.esm.js";
import "../external-container/index.esm.js";
import "../language-textbox/index.esm.js";
import "../notify/index.esm.js";
function on(n, e) {
let t;
function o(s) {
const { properties: f, title: d, ignore: m } = s, v = m && Array.isArray(m), h = Object.keys(f).reduce((F, I) => ((!v || !m.find((A) => A === I)) && (F[I] = f[I].type === "object" && f[I].properties ? o(f[I]) : yt(f[I].default)), F), {});
if (d && (!v || !m.find((F) => F === "id"))) {
const F = d.toLowerCase().replace(/-/g, "_");
h.id = `${F}_${Math.random().toString().slice(2, 6)}`;
}
return h;
}
function i(s) {
const { properties: f, title: d, required: m } = s;
if (m && Array.isArray(m)) {
const v = m.reduce((h, F) => (h[F] = f[F].type === "object" && f[F].properties ? o(f[F]) : yt(f[F].default), h), {});
if (d && m.find((h) => h === "id")) {
const h = d.toLowerCase().replace(/-/g, "_");
v.id = `${h}_${Math.random().toString().slice(2, 6)}`;
}
return v;
}
return {
type: d
};
}
function a(s, f = {}, d) {
const m = n[s];
if (m) {
let v = i(m);
const h = e[s];
return v = h ? h({ getSchemaByType: a }, v, f, d) : v, t != null && t.appendIdentifyForNewControl && t.appendIdentifyForNewControl(v), v;
}
return null;
}
function r(s, f) {
const d = o(f);
return Object.keys(d).reduce((m, v) => (Object.prototype.hasOwnProperty.call(s, v) && (m[v] && Jt(m[v]) && Jt(s[v] || !s[v]) ? Object.assign(m[v], s[v] || {}) : m[v] = s[v]), m), d), d;
}
function c(s, f) {
return Object.keys(s).filter((m) => s[m] != null).reduce((m, v) => {
if (f.has(v)) {
const h = f.get(v);
if (typeof h == "string")
m[h] = s[v];
else {
const F = h(v, s[v], s);
Object.assign(m, F);
}
} else
m[v] = s[v];
return m;
}, {});
}
function u(s, f, d = /* @__PURE__ */ new Map()) {
const m = r(s, f);
return c(m, d);
}
function l(s) {
var d;
const f = s.type;
if (f) {
const m = n[f];
if (!m)
return s;
const v = r(s, m), h = ((d = s.editor) == null ? void 0 : d.type) || "";
if (h) {
const F = n[h], I = r(s.editor, F);
v.editor = I;
}
return v;
}
return s;
}
function p(s) {
t = s;
}
return { getSchemaByType: a, resolveSchemaWithDefaultValue: l, resolveSchemaToProps: u, mappingSchemaToProps: c, setDesignerContext: p };
}
const rn = {}, an = {}, { getSchemaByType: Gs, resolveSchemaWithDefaultValue: Io, resolveSchemaToProps: Oo, mappingSchemaToProps: No, setDesignerContext: Xs } = on(rn, an);
function Po(n = {}) {
function e(l, p, s, f) {
if (typeof s == "number")
return f[l].length === s;
if (typeof s == "object") {
const d = Object.keys(s)[0], m = s[d];
if (d === "not")
return Number(f[l].length) !== Number(m);
if (d === "moreThan")
return Number(f[l].length) >= Number(m);
if (d === "lessThan")
return Number(f[l].length) <= Number(m);
}
return !1;
}
function t(l, p, s, f) {
return f[l] && f[l].propertyValue && String(f[l].propertyValue.value) === String(s);
}
const o = /* @__PURE__ */ new Map([
["length", e],
["getProperty", t]
]);
Object.keys(n).reduce((l, p) => (l.set(p, n[p]), l), o);
function i(l, p) {
const s = l;
return typeof p == "number" ? [{ target: s, operator: "length", param: null, value: Number(p) }] : typeof p == "boolean" ? [{ target: s, operator: "getProperty", param: l, value: !!p }] : typeof p == "object" ? Object.keys(p).map((f) => {
if (f === "length")
return { target: s, operator: "length", param: null, value: p[f] };
const d = f, m = p[f];
return { target: s, operator: "getProperty", param: d, value: m };
}) : [];
}
function a(l) {
return Object.keys(l).reduce((s, f) => {
const d = i(f, l[f]);
return s.push(...d), s;
}, []);
}
function r(l, p) {
if (o.has(l.operator)) {
const s = o.get(l.operator);
return s && s(l.target, l.param, l.value, p) || !1;
}
return !1;
}
function c(l, p) {
return a(l).reduce((d, m) => d && r(m, p), !0);
}
function u(l, p) {
const s = Object.keys(l), f = s.includes("allOf"), d = s.includes("anyOf"), m = f || d, F = (m ? l[m ? f ? "allOf" : "anyOf" : "allOf"] : [l]).map((A) => c(A, p));
return f ? !F.includes(!1) : F.includes(!0);
}
return { parseValueSchema: u };
}
const Vo = {
convertTo: (n, e, t, o) => {
n.appearance || (n.appearance = {}), n.appearance[e] = t;
},
convertFrom: (n, e, t) => n.appearance ? n.appearance[e] : n[e]
}, jo = {
convertFrom: (n, e, t) => n.buttons && n.buttons.length ? `共 ${n.buttons.length} 项` : "无"
}, Ro = {
convertTo: (n, e, t, o) => {
n.editor && (n.editor[e] = t);
},
convertFrom: (n, e, t) => n.editor && Object.prototype.hasOwnProperty.call(n.editor, e) ? n.editor[e] : n[e]
}, L = {
button: { type: "button", name: "按钮" },
"response-toolbar": { type: "response-toolbar", name: "工具栏" },
"response-toolbar-item": { type: "response-toolbar-item", name: "按钮" },
"content-container": { type: "content-container", name: "容器" },
"input-group": { type: "input-group", name: "文本" },
textarea: { type: "textarea", name: "多行文本" },
lookup: { type: "lookup", name: "帮助" },
"number-spinner": { type: "number-spinner", name: "数值" },
"date-picker": { type: "date-picker", name: "日期" },
switch: { type: "switch", name: "开关" },
"radio-group": { type: "radio-group", name: "单选组" },
"check-box": { type: "check-box", name: "复选框" },
"check-group": { type: "check-group", name: "复选框组" },
"combo-list": { type: "combo-list", name: "下拉列表" },
"response-form": { type: "response-form", name: "卡片面板" },
"response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" },
"response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" },
"tree-grid": { type: "tree-grid", name: "树表格" },
"tree-grid-column": { type: "tree-grid-column", name: "树表格列" },
"data-grid": { type: "data-grid", name: "表格" },
"data-grid-column": { type: "data-grid-column", name: "表格列" },
module: { type: "Module", name: "模块" },
component: { type: "component", name: "组件" },
tabs: { type: "tabs", name: "标签页" },
"tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" },
"tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" },
"html-template": { type: "html-template", name: "模板容器" },
"time-picker": { type: "time-picker", name: "时间选择" },
section: { type: "section", name: "分组面板" },
"section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" },
"section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" },
splitter: { type: "splitter", name: "分栏面板" },
"splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" },
"component-ref": { type: "component-ref", name: "组件引用节点" },
uploader: { type: "uploader", name: "附件上传" },
"page-header": { type: "page-header", name: "页头" },
"page-footer": { type: "page-footer", name: "页脚" },
"tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" },
fieldset: { type: "fieldset", name: "分组" },
"query-solution": { type: "query-solution", name: "筛选方案" },
drawer: { type: "drawer", name: "抽屉" },
"external-container": { type: "external-container", name: "外部容器", icon: "content-container" },
"list-nav": { type: "list-nav", name: "列表导航" },
"list-view": { type: "list-view", name: "列表" },
"filter-bar": { type: "filter-bar", name: "筛选条" },
"language-textbox": { type: "language-textbox", name: "多语输入框" }
}, Lo = {
convertFrom: (n, e, t) => {
var i;
const o = n.editor && n.editor[e] ? n.editor[e] : n[e];
return ((i = L[o]) == null ? void 0 : i.name) || o;
}
}, $o = {
convertTo: (n, e, t, o) => {
n[e] = n[e];
},
convertFrom: (n, e, t) => n.editor ? t.getRealEditorType(n.editor.type) : ""
}, Do = {
convertTo: (n, e, t, o) => {
(n.type === "data-grid-column" || n.type === "tree-grid-column") && (n.formatter ? n.formatter[e] = t : n.formatter = {
[e]: t
});
},
convertFrom: (n, e, t) => {
if (n.formatter) {
if (e === "trueText")
return n.formatter.trueText;
if (e === "falseText")
return n.formatter.falseText;
if (e === "prefix")
return n.formatter.prefix;
if (e === "suffix")
return n.formatter.suffix;
if (e === "precision")
return n.formatter.precision;
if (e === "decimal")
return n.formatter.decimal;
if (e === "thousand")
return n.formatter.thousand;
if (e === "tempDateFormat")
return n.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : n.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : n.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : n.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : n.formatter.tempDateFormat || n.formatter.dateFormat || "yyyy-MM-dd";
if (e === "customFormat")
return n.formatter.customFormat;
if (e === "type")
return n.formatter.type || "none";
}
return "none";
}
}, Ho = {
convertTo: (n, e, t, o) => {
n.command ? n.command[e] = t : n.command = {
[e]: t
}, e === "enable" && t && (n.command.commands || (n.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (n, e, t) => n.command && e === "enable" ? n.command.enable : ""
}, Ao = {
convertTo: (n, e, t, o) => {
n.column ? n.column[e] = t : n.column = {
[e]: t
}, e === "fitColumns" && t && (n.column.fitMode || (n.column.fitMode = "average"));
},
convertFrom: (n, e, t) => {
if (n.column) {
if (e === "fitColumns")
return n.column.fitColumns;
if (e === "fitMode")
return n.column.fitMode;
}
return "";
}
}, zo = {
convertTo: (n, e, t, o) => {
n.summary ? n.summary[e] = t : n.summary = {
[e]: t
}, e === "enable" && t && (n.summary ? n.summary.groupFields || (n.summary.groupFields = []) : n.summary = {
enable: t,
groupFields: []
});
},
convertFrom: (n, e, t) => n.summary && e === "enable" ? n.summary.enable : n.type === "data-grid-column" ? n.enableSummary === void 0 ? !1 : n.enableSummary : ""
}, Uo = {
convertTo: (n, e, t, o) => {
n.group ? n.group[e] = t : n.group = {
[e]: t
}, e === "enable" && t && (n.group ? n.group.groupFields || (n.group.groupFields = []) : n.group = {
enable: t,
groupFields: [],
showSummary: !1
});
},
convertFrom: (n, e, t) => {
if (n.group) {
if (e === "enable")
return n.group.enable;
if (e === "showSummary")
return n.group.showSummary;
}
}
}, qo = {
convertFrom: (n, e) => n.binding ? n.binding.path : "",
convertTo: (n, e, t) => {
if (t && t.length > 0) {
const o = t[0];
n.binding || (n.binding = {}), n.binding.type = "Form", n.binding.path = o.bindingField, n.binding.field = o.id, n.binding.fullPath = o.path, n.path = o.bindingPath;
}
}
}, _o = {
convertTo: (n, e, t, o) => {
n.pagination || (n.pagination = {}), n.pagination[e] = t;
},
convertFrom: (n, e, t) => n.pagination ? n.pagination[e] : n[e]
}, Wo = {
convertTo: (n, e, t, o) => {
n.rowNumber || (n.rowNumber = {}), n.rowNumber[e] = t;
},
convertFrom: (n, e, t) => n.rowNumber ? n.rowNumber[e] : n[e]
}, Go = {
convertTo: (n, e, t, o) => {
n.selection || (n.selection = {}), n.selection[e] = t;
},
convertFrom: (n, e, t) => n.selection ? n.selection[e] : n[e]
}, Xo = {
convertFrom: (n, e, t) => n[e] && n[e].length ? `共 ${n[e].length} 项` : ""
}, Yo = {
convertFrom: (n, e) => n[e] || "",
convertTo: (n, e, t) => {
n[e] = t;
}
}, Zo = {
convertTo: (n, e, t, o) => {
n.size || (n.size = {}), n.size[e] = t;
},
convertFrom: (n, e, t) => n.size ? n.size[e] : n[e]
}, Jo = {
convertFrom: (n, e, t) => {
var o, i;
return (o = n.formatter) != null && o.data && e === "formatterEnumData" && !n.formatterEnumData ? (i = n.formatter) == null ? void 0 : i.data : n.formatterEnumData;
}
}, Qo = {
convertTo: (n, e, t, o) => {
n.sort || (n.sort = {}), n.sort[e] = t;
},
convertFrom: (n, e, t) => {
var o, i;
if (e === "mode")
return ((o = n.sort) == null ? void 0 : o.mode) || "client";
if (e === "multiSort")
return !!((i = n.sort) != null && i.multiSort);
}
}, Ko = {
convertTo: (n, e, t, o) => {
n.filter || (n.filter = {}), n.filter[e] = t;
},
convertFrom: (n, e, t) => {
var o;
if (e === "mode")
return ((o = n.filter) == null ? void 0 : o.mode) || "client";
}
}, ei = {
convertTo: (n, e, t, o) => {
n.rowOption ? n.rowOption[e] = t : n.rowOption = {
[e]: t
};
},
convertFrom: (n, e, t) => {
if (n.rowOption) {
if (e === "customRowStyle")
return n.rowOption.customRowStyle;
if (e === "customCellStyle")
return n.rowOption.customCellStyle;
}
return "";
}
};
function sn(n, e, t) {
const o = /* @__PURE__ */ new Map([
["/converter/appearance.converter", Vo],
["/converter/buttons.converter", jo],
["/converter/property-editor.converter", Ro],
["/converter/items-count.converter", Xo],
["/converter/type.converter", Lo],
["/converter/change-editor.converter", $o],
["/converter/change-formatter.converter", Do],
["/converter/column-command.converter", Ho],
["/converter/column-option.converter", Ao],
["/converter/summary.converter", zo],
["/converter/group.converter", Uo],
["/converter/form-group-label.converter", Yo],
["/converter/field-selector.converter", qo],
["/converter/pagination.converter", _o],
["/converter/row-number.converter", Wo],
["/converter/grid-selection.converter", Go],
["/converter/size.converter", Zo],
["/converter/change-formatter-enum.converter", Jo],
["/converter/grid-sort.converter", Qo],
["/converter/grid-filter.converter", Ko],
["/converter/row-option.converter", ei]
]), i = /* @__PURE__ */ new Map([
["string", { type: "input-group", enableClear: !1 }],
["boolean", {
type: "combo-list",
textField: "name",
valueField: "value",
idField: "value",
enableClear: !1,
editable: !1,
data: [
{
value: !0,
name: "是"
},
{
value: !1,
name: "否"
}
]
}],
["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }],
["array", { type: "button-edit" }],
["number", { type: "number-spinner", placeholder: "" }],
["events-editor", { type: "events-editor", hide: !0 }]
]), a = Po();
function r(m, v) {
return () => a.parseValueSchema(m, v);
}
function c(m, v, h) {
return m.includes("visible") && v.visible !== void 0 ? typeof v.visible == "boolean" ? () => !!v.visible : v.visible === void 0 ? !0 : r(v.visible, h) : () => !0;
}
function u(m, v, h) {
return m.includes("readonly") && v.readonly !== void 0 ? typeof v.readonly == "boolean" ? () => !!v.readonly : r(v.readonly, h) : () => !1;
}
function l(m, v) {
const h = m.$converter || v;
return typeof h == "string" && h && o.has(h) ? o.get(h) || null : h || null;
}
function p(m, v, h, F, I, A = "", E = "") {
return Object.keys(m).map((y) => {
const C = M(1), S = y, b = m[y], k = Object.keys(b), x = b.title, B = b.type, N = i.get(B) || { type: "input-group", enableClear: !1 }, P = b.editor ? Object.assign({}, N, b.editor) : Object.assign({}, N), D = c(k, b, v), _ = u(k, b, v);
P.readonly = P.readonly === void 0 ? _() : P.readonly;
const Q = b.type === "cascade" ? p(b.properties, v, h, F, I, A, E) : [], j = !0;
let V = l(b, E);
const G = $({
get() {
if (C.value) {
if (["class", "style"].find((ue) => ue === S) && !V && (V = o.get("/converter/appearance.converter") || null), V && V.convertFrom)
return V.convertFrom(h, y, I, A);
const ie = h[y];
return Object.prototype.hasOwnProperty.call(b, "defaultValue") && (ie === void 0 || typeof ie == "string" && ie === "") ? b.type === "boolean" ? b.defaultValue : b.defaultValue || "" : ie;
}
return null;
},
set(ie) {
C.value += 1, V && V.convertTo ? (V.convertTo(F, y, ie, I, A), V.convertTo(h, y, ie, I, A)) : (F[y] = ie, h[y] = ie);
}
}), { refreshPanelAfterChanged: z, description: ee, isExpand: me, parentPropertyID: ae } = b, Y = { propertyID: S, propertyName: x, propertyType: B, propertyValue: G, editor: P, visible: D, readonly: _, cascadeConfig: Q, hideCascadeTitle: j, refreshPanelAfterChanged: z, description: ee, isExpand: me, parentPropertyID: ae };
return v[S] = Y, Y;
});
}
function s(m, v, h = {}) {
const F = {}, I = n[m];
return I && I.categories ? Object.keys(I.categories).map((E) => {
const g = I.categories[E], y = g == null ? void 0 : g.title, C = p(g.properties || {}, F, {}, h, v);
return { categoryId: E, categoryName: y, properties: C };
}) : [];
}
function f(m, v, h, F, I = "") {
const A = v.$ref.schema, E = v.$ref.converter, g = h[A], y = g.type, C = t(g), S = {}, b = n[y];
if (b && b.categories) {
const k = b.categories[m], x = k == null ? void 0 : k.title;
E && Object.keys(k.properties).forEach((P) => {
k.properties[P].$converter = E;
});
const B = (k == null ? void 0 : k.properties) || {}, N = p(B, S, C, g, F, I);
return { categoryId: m, categoryName: x, properties: N };
}
return { categoryId: m, categoryName: "", properties: [] };
}
function d(m, v, h, F, I) {
const A = m.type, E = t(m), g = {};
let y = I || n[A];
if (y && Object.keys(y).length === 0 && h && h.getPropConfig && (y = h.getPropConfig(F)), y && y.categories) {
const C = [];
return Object.keys(y.categories).map((S) => {
const b = y.categories[S];
if (b.$ref) {
C.push(f(S, b, m, v, F));
return;
}
const k = b == null ? void 0 : b.title, x = b == null ? void 0 : b.tabId, B = b == null ? void 0 : b.tabName, N = b == null ? void 0 : b.hide, P = b == null ? void 0 : b.hideTitle, D = p(b.properties || {}, g, E, m, v, F, b.$converter), { setPropertyRelates: _ } = b, Q = b == null ? void 0 : b.parentPropertyID;
C.push({ categoryId: S, categoryName: k, tabId: x, tabName: B, hide: N, properties: D, hideTitle: P, setPropertyRelates: _, parentPropertyID: Q });
}), C;
}
return [];
}
return {
getPropertyConfigBySchema: d,
getPropertyConfigByType: s,
propertyConverterMap: o
};
}
const ln = {}, un = {};
sn(ln, un, Io);
const cn = {}, dn = {}, { getSchemaByType: Ys, resolveSchemaWithDefaultValue: ti, resolveSchemaToProps: Zs, mappingSchemaToProps: Js, setDesignerContext: Qs } = on(cn, dn), fn = {}, pn = {};
sn(fn, pn, ti);
function ut(n, e, t = /* @__PURE__ */ new Map(), o = (r, c, u, l) => c, i = {}, a = (r) => r) {
return rn[e.title] = e, an[e.title] = o, ln[e.title] = i, un[e.title] = a, cn[e.title] = e, dn[e.title] = o, fn[e.title] = i, pn[e.title] = a, (r = {}, c = !0) => {
if (!c)
return No(r, t);
const u = Oo(r, e, t), l = Object.keys(n).reduce((p, s) => (p[s] = n[s].default, p), {});
return Object.assign(l, u);
};
}
function Ut(n, e) {
return { customClass: e.class, customStyle: e.style };
}
const ni = /* @__PURE__ */ new Map([
["appearance", Ut]
]), oi = "https://json-schema.org/draft/2020-12/schema", ii = "https://farris-design.gitee.io/number-spinner.schema.json", ri = "number-spinner", ai = "A Farris Input Component", si = "object", li = {
id: {
description: "The unique identifier for a number spinner",
type: "string"
},
type: {
description: "The type string of number spinner component",
type: "string",
default: "number-spinner"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
editable: {
description: "",
type: "boolean",
default: !0
},
placeholder: {
description: "",
type: "string",
default: "请输入数字"
},
readonly: {
description: "",
type: "boolean",
default: !1
},
disabled: {
description: "",
type: "boolean",
default: !1
},
required: {
description: "",
type: "boolean",
default: !1
},
precision: {
description: "",
type: "number",
default: 0
},
min: {
description: "",
type: "number"
},
step: {
description: "",
type: "number",
default: 1
},
tabindex: {
description: "",
type: "number",
default: -1
},
textAlign: {
description: "",
type: "string",
enum: [
"left",
"middle",
"right"
],
default: "left"
},
nullable: {
description: "",
type: "boolean",
default: !1
},
max: {
description: "",
type: "number"
},
onBlur: {
description: "",
type: "string",
default: ""
},
onClickLinkLabel: {
description: "",
type: "sting",
default: ""
},
showZero: {
description: "",
type: "boolean",
default: !0
},
useThousands: {
description: "",
type: "boolean",
default: !0
},
keyboard: {
description: "",
type: "boolean",
default: !0
},
bigNumber: {
description: "",
type: "boolean",
default: !1
},
updateOn: {
description: "",
type: "string",
default: "blur"
},
showButton: {
description: "",
type: "boolean",
default: !0
}
}, ui = [
"type"
], ci = [
"id",
"appearance",
"binding",
"visible"
], di = {
$schema: oi,
$id: ii,
title: ri,
description: ai,
type: si,
properties: li,
required: ui,
ignore: ci
};
function fi(n, e, t) {
return e;
}
const qt = {
/**
* 组件标识
*/
id: String,
/**
* 是否禁用
*/
disabled: { type: Boolean, default: !1 },
/**
* 是否只读
*/
readonly: { type: Boolean, default: !1 },
/**
* 是否可编辑
*/
editable: { type: Boolean, default: !0 },
/**
* 格式化 formatter 和 parser 必须同时存在
* formatter: (val: number) => string;
* parser: (val: string | number) => number;
*/
formatter: { type: Function },
parser: { type: Function },
/**
* 空白提示文本
*/
placeholder: { type: String, default: "请输入数字" },
/**
* up or down 步长
*/
step: { type: Number, default: 1 },
/**
* 最大值
*/
max: { type: [Number, String] },
/**
* 最小值
*/
min: { type: [Number, String] },
/**
* 是否显示加减按钮
*/
showButton: { type: Boolean, default: !0 },
/**
* 是否使用千分值
*/
useThousands: { type: Boolean, default: !0 },
/**
* 文本方向
*/
textAlign: { type: String, default: "left" },
/**
* 自动补全小数---未实现
*/
autoDecimal: { type: Boolean, default: !0 },
/**
* 允许为空
*/
nullable: { type: Boolean, default: !1 },
/**
* 精度
*/
precision: { type: Number, default: 0 },
/**
* 前缀
*/
prefix: { type: String, default: "" },
/**
* 后缀
*/
suffix: { type: String, default: "" },
/**
* 小数点符号
*/
decimalSeparator: { type: String, default: "." },
/** 始终显示占位符文本 */
forcePlaceholder: { Type: Boolean, default: !1 },
/**
* 千分位符号
*/
groupSeparator: { type: String, default: "," },
/**
* 使用千分位时,每组显示的字符数
*/
groupSize: { type: Number, default: 3 },
/**
* 值
*/
value: { type: [Number, String], default: "" },
/**
* 显示0值
*/
showZero: { type: Boolean, default: !0 },
/**
* 组件值
*/
modelValue: { type: [Number, String], default: "" },
/**
* 作为内嵌编辑器被创建后默认获得焦点
*/
focusOnCreated: { type: Boolean, default: !1 },
/**
* 作为内嵌编辑器被创建后默认选中文本
*/
selectOnCreated: { type: Boolean, default: !1 },
/**
* 是否启用快捷键
*/
keyboard: { type: Boolean, default: !0 },
/**
* 是否启用大数
*/
bigNumber: { type: Boolean, default: !1 },
/** 更新方式 blur | change */
updateOn: { type: String, default: "change" }
}, pi = Object.assign({}, qt, {
readonly: {}
}), mn = ut(qt, di, ni, fi);
function mi(n, e, t, o) {
const { format: i } = t, { displayValue: a, getRealValue: r, modelValue: c, onNumberValueChanged: u } = o;
function l() {
const h = new Se(c.value || 0);
return !((n.max || n.max === 0) && !new Se(n.max).isNaN() && h.gte(new Se(n.max)) && (c.value || c.value === 0));
}
function p() {
const h = new Se(c.value || 0);
return !((n.min || n.min === 0) && !new Se(n.min).isNaN() && h.lte(new Se(n.min)) && (c.value || c.value === 0));
}
function s(h) {
if (n.readonly || n.disabled)
return;
const F = h === "up" ? l : p, I = h === "up" ? "plus" : "minus";
if (F()) {
const E = new Se(c.value || 0)[I](Number(n.step)), g = E.toFixed();
a.value = i(g), u(r(E));
}
}
function f() {
s("up");
}
function d() {
s("down");
}
function m(h) {
f(), h.stopPropagation();
}
function v(h) {
d(), h.stopPropagation();
}
return { canDownward: p, canUpward: l, downward: d, onClickDownButton: v, onClickUpButton: m, upward: f };
}
function vn(n, e, t) {
const o = $(() => ({
prefix: n.prefix,
suffix: n.suffix,
decimalSeparator: n.decimalSeparator,
groupSeparator: n.useThousands ? n.groupSeparator : "",
groupSize: n.groupSize
})), { getValidNumberObject: i, precision: a } = t;
function r(l) {
return l = l == null || l === "" ? "" : String(l), l = l.replace(new RegExp(n.prefix, "g"), "").replace(new RegExp(n.suffix, "g"), "").replace(/,/g, ""), n.groupSeparator && n.groupSeparator !== "," && (l = l.replace(new RegExp(`\\${n.groupSeparator}`, "g"), "")), n.decimalSeparator && n.decimalSeparator !== "." && (l = l.replace(new RegExp(`\\${n.decimalSeparator}`, "g"), ".")), l;
}
function c(l, p) {
return n.precision !== null && n.precision !== void 0 ? l.toFormat(a.value, p) : l.toFormat(p);
}
function u(l, p = !0) {
const s = r(l), f = new Se(s, 10);
let d = f;
return p && (d = i(f)), d.valueOf() === "0" && !n.showZero || d.isNaN() ? "" : n.formatter ? n.formatter(d.toNumber()) : c(d, o.value);
}
return { cleanFormat: r, format: u };
}
function gn(n, e) {
const t = M(""), o = M(n.modelValue), i = $(() => Number(n.precision) || 0), a = M(n.bigNumber);
a.value = !1;
function r(s) {
return s.toFixed(i.value);
}
function c(s) {
return isNaN(s) || s === null || s === void 0 || s === "";
}
function u(s) {
const f = c(n.max) ? null : new Se(String(n.max), 10), d = c(n.min) ? null : new Se(String(n.min), 10);
return f && s.gt(f) ? f : d && s.lt(d) ? d : s;
}
function l(s, f = !0) {
if (n.parser)
return isNaN(Number(s)) ? n.parser(s) : s;
let d = new Se(s, 10);
if (f && (d = u(d)), d.isNaN()) {
if (n.nullable || !f)
return null;
const v = new Se("" + n.min, 10), h = new Se("" + n.max, 10);
if (!v.isNaN())
d = v;
else if (!h.isNaN())
d = h;
else
return 0;
}
return r(d);
}
function p(s) {
let f = a.value ? s : Number(s);
n.nullable && s === null && (f = null), f !== n.modelValue && (e.emit("update:modelValue", f), e.emit("valueChange", f), e.emit("change", f));
}
return { displayValue: t, getRealValue: l, modelValue: o, isEmpty: c, onNumberValueChanged: p, precision: i, getValidNumberObject: u };
}
function vi(n, e, t, o, i) {
const { cleanFormat: a, format: r } = t, { displayValue: c, getRealValue: u, modelValue: l, isEmpty: p, onNumberValueChanged: s } = o, { downward: f, upward: d } = i, m = M(!1), v = $(() => c.value);
function h(C) {
var k;
if (C.stopPropagation(), m.value = !1, n.readonly || n.disabled)
return;
let S = (k = C.target) == null ? void 0 : k.value;
n.nullable || (S = S || 0);
const b = a(S);
c.value = r(u(b)), n.updateOn === "blur" && s(u(b)), e.emit("blur", { event: C, formatted: c.value, value: l.value });
}
function F(C) {
C.stopPropagation(), m.value = !0, !(n.readonly || n.disabled) && (c.value = p(l.value) || !n.showZero && "" + l.value == "0" ? "" : String(l.value), e.emit("focus", { event: C, formatted: c.value, value: l.value }));
}
function I(C) {
var k;
C.stopPropagation();
let S = (k = C.target) == null ? void 0 : k.value;
n.nullable || (S = S || 0);
const b = a(S);
n.updateOn === "change" && (c.value = b, s(u(b))), e.emit("input", u(b));
}
function A(C) {
const S = C;
return S.value.substring((S == null ? void 0 : S.selectionStart) || 0, (S == null ? void 0 : S.selectionEnd) || 0);
}
function E(C) {
const { key: S, keyCode: b, target: k, ctrlKey: x, metaKey: B, shiftKey: N } = C;
if (!k)
return;
const P = k, D = P.value, _ = Number(n.precision), Q = /* @__PURE__ */ new Set([".", "-", "%"]), j = A(k);
if (Q.has(S) && D.includes(S) && !j.includes(S) || n.precision === 0 && [110, 190].includes(b)) {
C.preventDefault();
return;
}
const G = /* @__PURE__ */ new Set([46, 8, 9, 27, 13, 110, 190, 173]), z = /* @__PURE__ */ new Set([65, 67, 86, 88]), ee = /* @__PURE__ */ new Set([...Array.from({ length: 5 }, (ae, Y) => 35 + Y), 189, 109]);
if (G.has(b) || z.has(b) && (x || B) || ee.has(b))
return;
if (!(!N && (b >= 48 && b <= 57 || b >= 96 && b <= 105))) {
C.preventDefault();
return;
}
if ((N || b < 48 || b > 57) && (b < 96 || b > 105) && C.preventDefault(), D.includes(".") && n.precision) {
const ae = D.indexOf("."), Y = D.length - ae - 1;
if ((P.selectionStart || 0) > ae && Y >= _)
return C.preventDefault(), !1;
}
}
const g = (C) => {
var k;
let S = (k = C.target) == null ? void 0 : k.value;
n.nullable || (S = S || 0);
const b = a(S);
l.value = u(b);
};
function y(C) {
return n.keyboard && C.key === "ArrowDown" && (C.preventDefault(), g(C), f(), C.stopPropagation()), n.keyboard && C.key === "ArrowUp" && (C.preventDefault(), g(C), d(), C.stopPropagation()), E(C);
}
return { textBoxValue: v, onBlurTextBox: h, onFocusTextBox: F, onInput: I, onKeyDown: y, isFocus: m };
}
function gi(n, e, t) {
const {
canDownward: o,
canUpward: i,
onClickDownButton: a,
onClickUpButton: r
} = t, c = $(() => ({
"input-group-append": !0,
"btn-group": !0,
"btn-group-number": !0
})), u = $(() => ({
btn: !0,
"btn-secondary": !0,
"btn-number-flag": !0
})), l = $(() => ({
cursor: i() ? "pointer" : "not-allowed",
"margin-left": 0
})), p = $(() => ({
cursor: o() ? "pointer" : "not-allowed",
"margin-left": 0
}));
return () => w("div", {
class: c.value
}, [w("button", {
class: u.value,
style: l.value,
onClick: r,
disabled: !i()
}, [w("span", {
class: "f-icon f-icon-arrow-chevron-up number-arrow-chevron",
style: "cursor: inherit"
}, null)]), w("button", {
class: u.value,
style: p.value,
onClick: a,
disabled: !o()
}, [w("span", {
class: "f-icon f-icon-arrow-chevron-down number-arrow-chevron",
style: "cursor: inherit"
}, null)])]);
}
function hi(n) {
const { t: e } = xt();
function t(a, r, c) {
return r === c ? e(a) : r || "";
}
const o = t("numberSpinner.placeholder", n.placeholder, "请输入数字"), i = {
begin: t("numberSpinner.range.begin", n.beginPlaceHolder, "开始数字"),
end: t("numberSpinner.range.end", n.endPlaceHolder, "结束数字")
};
return { placeholder: o, range: i };
}
function yi(n, e, t) {
const o = hi(n), i = M(), {
onBlurTextBox: a,
onFocusTextBox: r,
onInput: c,
onKeyDown: u,
textBoxValue: l
} = t, p = $(() => (n.disabled || n.readonly || !n.editable) && !n.forcePlaceholder ? "" : o.placeholder), s = $(() => ({
"form-control": !0,
"f-utils-fill": !0
})), f = $(() => ({
"text-align": n.textAlign
}));
function d(h) {
h.stopPropagation();
}
function m() {
var h, F;
n.selectOnCreated && ((h = i.value) == null || h.select()), n.focusOnCreated && ((F = i.value) == null || F.focus({
preventScroll: !0
}));
}
async function v(h) {
r(h), await et, m();
}
return He(async () => {
await et, m();
}), () => w("input", {
ref: i,
class: s.value,
style: f.value,
type: "text",
value: l.value,
disabled: n.disabled,
readonly: n.readonly || !n.editable,
placeholder: p.value,
onBlur: a,
onChange: d,
onFocus: v,
onInput: c,
onKeydown: u
}, null);
}
const bt = /* @__PURE__ */ Ie({
name: "FNumberSpinner",
props: qt,
emits: ["update:modelValue", "valueChange", "change", "blur", "focus", "click", "input"],
setup(n, e) {
const t = gn(n, e), o = vn(n, e, t), i = mi(n, e, o, t), a = vi(n, e, o, t, i), r = gi(n, e, i), {
displayValue: c,
modelValue: u,
getRealValue: l
} = t, p = yi(n, e, a), {
format: s
} = o, {
isFocus: f
} = a, d = $(() => !n.disabled && !n.readonly && n.showButton), m = $(() => ({
"input-group": !0,
"flex-row": !0,
"f-cmp-number-spinner": !0,
"f-state-disabled": n.disable,
"f-state-readonly": n.readonly && !n.disable,
"f-state-focus": f.value,
"spinner-hidden": !d.value
}));
return He(() => {
const v = l(n.modelValue, !1);
c.value = s(v, !1);
}), ye(() => [n.value], ([v]) => {
const h = l(v, !1);
u.value = h, c.value = s(h, !1);
}), ye(() => [n.modelValue], ([v]) => {
v !== u.value && (u.value = v, !f.value && (c.value = s(l(v, !1), !1)));
}), ye(() => [n.precision, n.useThousands, n.prefix, n.suffix, n.showZero], () => {
c.value = s(u.value, !1);
}), () => w("div", {
class: m.value
}, [p(), d.value && r()]);
}
});
function bi() {
const n = $(() => ({
"input-group-append": !0,
"btn-group": !0,
"btn-group-number": !0
})), e = $(() => ({
btn: !0,
"btn-secondary": !0,
"btn-number-flag": !0
})), t = $(() => ({
cursor: "pointer",
"margin-left": 0
})), o = $(() => ({
cursor: "pointer",
"margin-left": 0
}));
return () => w("div", {
class: n.value
}, [w("button", {
class: e.value,
style: t.value
}, [w("span", {
class: "f-icon f-icon-arrow-chevron-up number-arrow-chevron"
}, null)]), w("button", {
class: e.value,
style: o.value
}, [w("span", {
class: "f-icon f-icon-arrow-chevron-down number-arrow-chevron"
}, null)])]);
}
function hn(n, e, t) {
var x;
const o = t && t.getStyles && t.getStyles() || "", i = t && t.getDesignerClass && t.getDesignerClass() || "", a = M();
let r;
function c() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : t && t.checkCanMoveComponent ? t.checkCanMoveComponent() : !0;
}
function u() {
return !1;
}
function l() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : t && t.checkCanDeleteComponent ? t.checkCanDeleteComponent() : !0;
}
function p() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !0 : t && t.hideNestedPaddingInDesginerView ? t.hideNestedPaddingInDesginerView() : !1;
}
function s(B) {
if (!B || !B.value)
return null;
if (B.value.schema && B.value.schema.type === "component")
return B.value;
const N = M(B == null ? void 0 : B.value.parent), P = s(N);
return P || null;
}
function f(B = e) {
var _;
if (t != null && t.getDraggableDesignItemElement)
return t.getDraggableDesignItemElement(B);
const { componentInstance: N, designerItemElementRef: P } = B;
if (!N || !N.value)
return null;
const { getCustomButtons: D } = N.value;
return N.value.canMove || D && ((_ = D()) != null && _.length) ? P : f(B.parent);
}
function d(B) {
return !!t && t.canAccepts(B);
}
function m() {
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 h(B, N) {
var P;
!B || !N || (t != null && t.onAcceptMovedChildElement && t.onAcceptMovedChildElement(B, N), (P = e == null ? void 0 : e.setupContext) == null || P.emit("dragEnd"));
}
function F(B, N) {
const { componentType: P } = B;
let D = Un(P, B, N);
t && t.onResolveNewComponentSchema && (D = t.onResolveNewComponentSchema(B, D));
const _ = P.toLowerCase().replace(/-/g, "_");
return D && !D.id && D.type === P && (D.id = `${_}_${Math.random().toString().slice(2, 6)}`), D;
}
function I(B) {
B && t != null && t.onChildElementMovedOut && t.onChildElementMovedOut(B);
}
function A(...B) {
if (t && t.getPropsConfig)
return t.getPropsConfig(...B);
}
function E(B) {
if (!B)
return;
const N = e == null ? void 0 : e.schema, { formSchemaUtils: P } = B;
if (N && P.getExpressions().length) {
const D = P.getExpressions().findIndex((_) => _.target === N.id);
D > -1 && P.getExpressions().splice(D, 1);
}
}
function g(B) {
if (!B || !(e != null && e.schema))
return;
const N = e.schema, { formSchemaUtils: P } = B;
P.removeCommunicationInComponent(N);
}
function y(B) {
t && t.onRemoveComponent && t.onRemoveComponent(), E(B), g(B), e != null && e.schema.contents && e.schema.contents.map((N) => {
let P = N.id;
N.type === "component-ref" && (P = N.component);
const D = n.value.querySelectorAll(`#${P}-design-item`);
D != null && D.length && Array.from(D).map((_) => {
var Q;
(Q = _ == null ? void 0 : _.componentInstance) != null && Q.value.onRemoveComponent && _.componentInstance.value.onRemoveComponent(B);
});
});
}
function C() {
if (t && t.getCustomButtons)
return t.getCustomButtons();
}
function S(B) {
var P, D;
if (!((P = e == null ? void 0 : e.schema) != null && P.id))
return;
if (!r && B && (r = B.formSchemaUtils), t != null && t.setComponentBasicInfoMap) {
t.setComponentBasicInfoMap();
return;
}
let N = "";
if (t != null && t.getComponentTitle)
N = t.getComponentTitle();
else {
const { text: _, title: Q, label: j, mainTitle: V, name: G, type: z } = e.schema;
N = _ || Q || j || V || G || ((D = L[z]) == null ? void 0 : D.name);
}
N && r.getControlBasicInfoMap().set(e.schema.id, {
componentTitle: N,
parentPathName: N
});
}
function b(B) {
var _;
const { changeObject: N } = B, { propertyID: P, propertyValue: D } = N;
if (["text", "title", "label", "name", "mainTitle"].includes((_ = B == null ? void 0 : B.changeObject) == null ? void 0 : _.propertyID) && P && D && (S(), r)) {
const Q = r.getControlBasicInfoMap(), j = Q.keys().toArray().filter((V) => {
var G, z;
return ((G = Q.get(V)) == null ? void 0 : G.reliedComponentId) === ((z = e == null ? void 0 : e.schema) == null ? void 0 : z.id);
});
j != null && j.length && j.forEach((V) => {
const G = Q.get(V).parentPathName.split(" > ");
G[0] = D, Q.get(V).parentPathName = G.join(" > ");
});
}
}
function k(B) {
if (b(B), t && t.onPropertyChanged)
return t.onPropertyChanged(B);
}
return a.value = {
canMove: c(),
canSelectParent: u(),
canDelete: l(),
canNested: !p(),
contents: e == null ? void 0 : e.schema.contents,
elementRef: n,
parent: (x = e == null ? void 0 : e.parent) == null ? void 0 : x.componentInstance,
schema: e == null ? void 0 : e.schema,
styles: o,
designerClass: i,
canAccepts: d,
getBelongedComponentInstance: s,
getDraggableDesignItemElement: f,
getDraggingDisplayText: m,
getPropConfig: A,
getDragScopeElement: v,
onAcceptMovedChildElement: h,
onChildElementMovedOut: I,
addNewChildComponentSchema: F,
triggerBelongedComponentToMoveWhenMoved: !!t && t.triggerBelongedComponentToMoveWhenMoved || M(!1),
triggerBelongedComponentToDeleteWhenDeleted: !!t && t.triggerBelongedComponentToDeleteWhenDeleted || M(!1),
onRemoveComponent: y,
getCustomButtons: C,
onPropertyChanged: k,
setComponentBasicInfoMap: S,
updateContextSchema: e == null ? void 0 : e.updateContextSchema
}, a;
}
const wi = M(0);
function Ci() {
wi.value++;
}
const pt = M(0);
function Si(n) {
const { formSchemaUtils: e, formStateMachineUtils: t } = n;
function o(u, l = "") {
return {
path: l + u.code,
field: u.id,
fullPath: u.code
};
}
function i(u, l = "") {
return e.getViewModelById(u).states.map((s) => o(s, l));
}
function a(u) {
const l = e.getRootViewModelId(), p = i(u);
if (u === l)
return p;
const s = i(l, "root-component.");
return [...p, ...s];
}
function r(u) {
return u.binding && u.binding.path || u.id || "";
}
function c() {
return t && t.getRenderStates() || [];
}
return { getVariables: a, getControlName: r, getStateMachines: c };
}
class yn {
constructor(e) {
X(this, "sessionVariables", [
{
key: "CurrentSysOrgName",
name: "当前组织Name",
description: "当前组织Name"
},
// {
// key: "CurrentSysOrgCode",
// name: "当前组织Code",
// description: "当前组织Code"
// },
{
key: "CurrentSysOrgId",
name: "当前组织Id",
description: "当前组织Id"
},
{
key: "CurrentUserName",
name: "当前用户Name",
description: "当前用户Name"
},
{
key: "CurrentUserCode",
name: "当前用户Code",
description: "当前用户Code"
},
{
key: "CurrentUserId",
name: "当前用户Id",
description: "当前用户Id"
},
{
key: "CurrentLanguage",
name: "当前语言编号",
description: "当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'"
}
]);
X(this, "expressionNames", {
compute: "计算表达式",
dependency: "依赖表达式",
validate: "验证表达式",
dataPicking: "帮助前表达式",
visible: "可见表达式",
readonly: "只读表达式",
required: "必填表达式"
});
X(this, "getExpressionConverter", (e, t) => ({
convertFrom: (o, i, a, r) => {
const c = a.getExpressionRuleValue(e, t || i);
return c && c.value || "";
},
convertTo: (o, i, a, r, c) => {
var u;
if (i === "dataPicking" && (a != null && a.target)) {
const l = `${a.target}_dataPicking`;
((u = a.rules) == null ? void 0 : u.some(
(s) => s.id === l && s.value
)) ? o.dictPickingExpressionId = l : delete o.dictPickingExpressionId;
}
r.updateExpression(a);
}
}));
this.formSchemaService = e;
}
getExpressionRule(e, t) {
const o = this.formSchemaService.getExpressions();
if (!o)
return "";
const i = o.find((r) => r.target === e);
if (!i)
return "";
const a = i.rules.find((r) => r.type === t);
return a || "";
}
// 获取上下文表单变量
getContextFormVariables() {
const { module: e } = this.formSchemaService.getFormSchema();
if (!e.viewmodels || e.viewmodels.length === 0)
return [];
const t = this.formSchemaService.getRootViewModelId(), o = this.formSchemaService.getViewModelById(t);
if (!o || !o.states || o.states.length === 0)
return [];
const i = [];
return o.states.forEach((a) => {
i.push({
key: a.code,
name: a.name,
description: a.name,
category: a.category
});
}), i;
}
createTreeNode(e, t, o = "label") {
return {
id: e.id,
name: e.name,
bindingPath: e[o],
parents: t,
type: "field"
};
}
buildEntityFieldsTreeData(e = null, t) {
const o = [];
return e == null || e.forEach((i) => {
var c;
const a = this.createTreeNode(i, t);
let r = [];
(c = i.type) != null && c.fields && (r = this.buildEntityFieldsTreeData(i.type.fields, [...t, i.label])), o.push({
data: a,
children: r,
expanded: !0
});
}), o;
}
buildChildEntityTreeData(e = null, t) {
const o = [];
return e == null || e.forEach((i) => {
var u, l;
const a = this.createTreeNode(i, t);
a.type = "entity";
const r = this.buildEntityFieldsTreeData((u = i.type) == null ? void 0 : u.fields, [...t, i.label]), c = this.buildChildEntityTreeData((l = i.type)