diff --git a/dist/button.js b/dist/button.js index 386b3ec..03d8616 100644 --- a/dist/button.js +++ b/dist/button.js @@ -1,4 +1,4 @@ -import { aj as s, ai as u, ak as e } from "./common/main-BNMEkn4Y.js"; +import { aj as s, ai as u, ak as e } from "./common/main-D7LpJB9E.js"; export { s as auth, u as default, diff --git a/dist/common/main-BNMEkn4Y.js b/dist/common/main-D7LpJB9E.js similarity index 84% rename from dist/common/main-BNMEkn4Y.js rename to dist/common/main-D7LpJB9E.js index 79f0487..547e9e9 100644 --- a/dist/common/main-BNMEkn4Y.js +++ b/dist/common/main-D7LpJB9E.js @@ -14,38 +14,38 @@ var oi = (t, e, i, n) => ({ } }); import { jsx as h, jsxs as A } from "react/jsx-runtime"; -import E, { useEffect as M, useState as I, useCallback as X, useRef as H, useContext as le, useMemo as K, useId as It, isValidElement as an, useLayoutEffect as on } from "react"; +import E, { useEffect as V, useState as L, useCallback as X, useRef as H, useContext as le, useMemo as K, useId as Lt, isValidElement as an, useLayoutEffect as on } from "react"; import ce from "pathe"; import b from "prop-types"; -import O from "classnames"; +import R from "classnames"; import * as si from "react-is"; import { useNotification as sn } from "rc-notification"; import m from "lodash"; import ie, { Field as Jt, FieldContext as Ci } from "rc-field-form"; -import { M as Rt, N as Je, a as Ae, s as jt, b as ln, S as cn } from "./vender-BkiRbACr.js"; +import { M as Ft, N as Je, a as Ae, s as It, b as ln, S as cn } from "./vender-BkiRbACr.js"; import ki from "immutability-helper"; -import { Space as dn, Form as ft, Input as un, Button as wt, Pagination as pn, Tree as gn, Breadcrumb as hn, Empty as Mt, Table as mn, Popover as fn, Popconfirm as yn, Tooltip as wn } from "antd"; +import { Space as dn, Form as ft, Input as un, Button as wt, Pagination as pn, Tree as gn, Breadcrumb as hn, Empty as Vt, Table as mn, Popover as fn, Popconfirm as yn, Tooltip as wn } from "antd"; import { useMergedState as bn } from "rc-util"; import { generatePath as Cn, useInRouterContext as $i, useParams as kn, useLocation as $n, createBrowserRouter as En, Navigate as Sn } from "react-router-dom"; import "rc-util/lib/hooks/useMergedState"; import vn from "rc-drawer"; import Nn from "rc-dialog"; -var ze, Ye, Be, we, Le, Ie; +var ze, Ye, Be, we, je, Le; class Ei { constructor(e, i) { v(this, ze, /* @__PURE__ */ new Map()); v(this, Ye, !0); v(this, Be, []); v(this, we); - v(this, Le, () => c(this, we)); - v(this, Ie, () => Promise.resolve()); + v(this, je, () => c(this, we)); + v(this, Le, () => Promise.resolve()); x(this, "get", (...e) => new Promise((i, n) => { const r = JSON.stringify(e); - if (c(this, ze).has(r)) return i(c(this, Ie).call(this, c(this, we), ...e)); - if (c(this, we) === void 0) c(this, Be).push([e, i, n]), c(this, Ye) && (B(this, Ye, !1), Promise.resolve(typeof c(this, Le) == "function" ? c(this, Le).call(this) : c(this, Le)).then((a) => B(this, we, a || null)).finally(() => { + if (c(this, ze).has(r)) return i(c(this, Le).call(this, c(this, we), ...e)); + if (c(this, we) === void 0) c(this, Be).push([e, i, n]), c(this, Ye) && (B(this, Ye, !1), Promise.resolve(typeof c(this, je) == "function" ? c(this, je).call(this) : c(this, je)).then((a) => B(this, we, a || null)).finally(() => { c(this, Be).forEach(([a, o, s]) => { try { - const l = c(this, Ie).call(this, c(this, we), ...a); + const l = c(this, Le).call(this, c(this, we), ...a); c(this, ze).set(JSON.stringify(a), l), o(l); } catch (l) { s(l); @@ -53,30 +53,30 @@ class Ei { }), c(this, Be).length = 0; })); else { - const a = c(this, Ie).call(this, c(this, we), ...e); + const a = c(this, Le).call(this, c(this, we), ...e); c(this, ze).set(r, a), i(a); } })); - B(this, Ie, i), B(this, Le, e); + B(this, Le, i), B(this, je, e); } } -ze = new WeakMap(), Ye = new WeakMap(), Be = new WeakMap(), we = new WeakMap(), Le = new WeakMap(), Ie = new WeakMap(); +ze = new WeakMap(), Ye = new WeakMap(), Be = new WeakMap(), we = new WeakMap(), je = new WeakMap(), Le = new WeakMap(); const Jr = () => h("div", { children: "Empty" }), st = E.createContext({ ele: {}, mount: () => { }, unmount: () => { } }), Y = ({ rootClassName: t, className: e, children: i, actions: n, title: r, subTitle: a, extras: o, style: s = {} }) => { const { mount: l, unmount: u } = E.useContext(st); - return Y.Action({ children: n }), Y.Title({ children: r }), Y.SubTitle({ children: a }), Y.Extra({ children: o }), M(() => (l("rootClassName", t), () => u(t)), [t]), h("div", { className: O("ff-container", e), style: s, children: i }); + return Y.Action({ children: n }), Y.Title({ children: r }), Y.SubTitle({ children: a }), Y.Extra({ children: o }), V(() => (l("rootClassName", t), () => u(t)), [t]), h("div", { className: R("ff-container", e), style: s, children: i }); }, mt = (t) => ({ children: e, className: i }) => { const { mount: n, unmount: r } = E.useContext(st); - return M(() => (e && n(t, E.createElement("div", { key: `ff-${t}`, className: O(`ff-popup-${t}`, i) }, e)), () => r(t)), [i, e]), null; + return V(() => (e && n(t, E.createElement("div", { key: `ff-${t}`, className: R(`ff-popup-${t}`, i) }, e)), () => r(t)), [i, e]), null; }; Y.Action = mt("actions"), Y.Title = mt("title"), Y.SubTitle = mt("sub-title"), Y.Extra = mt("extras"), Y.propTypes = { className: b.string, style: b.object, title: b.any, subTitle: b.any, actions: b.any, extras: b.any }; const Gr = () => h(Y, { className: "ff-loading", children: A("div", { className: "loader", children: [A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] })] }) }), Yr = () => h("div", { children: "NotFound" }), Si = ({ children: t }) => { - const [e, i] = I({}), n = X((a, o) => i((s) => ({ ...s, [a]: o })), []), r = X((a) => i((o) => ({ ...o, [a]: void 0 })), []); + const [e, i] = L({}), n = X((a, o) => i((s) => ({ ...s, [a]: o })), []), r = X((a) => i((o) => ({ ...o, [a]: void 0 })), []); return typeof (t == null ? void 0 : t.type) == "string" ? t : h(st.Provider, { value: { ele: e, mount: n, unmount: r }, children: E.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); }; Si.propTypes = { children: b.element.isRequired }; -const li = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, Gt = ({ type: t, props: e }) => h("i", { ...e, children: h("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (li[t] || li.info).map((i, n) => h("path", { d: i }, n)) }) }), vi = ({ className: t, content: e, icon: i, $close: n }) => A(E.Fragment, { children: [i && h("div", { className: O("ff-notification-icon", t), children: h(Gt, { type: i }) }), e] }), xn = ({}) => h(Y, { children: "Confirm" }); +const li = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, Gt = ({ type: t, props: e }) => h("i", { ...e, children: h("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (li[t] || li.info).map((i, n) => h("path", { d: i }, n)) }) }), vi = ({ className: t, content: e, icon: i, $close: n }) => A(E.Fragment, { children: [i && h("div", { className: R("ff-notification-icon", t), children: h(Gt, { type: i }) }), e] }), xn = ({}) => h(Y, { children: "Confirm" }); var Se, We; const de = class de { constructor() { @@ -87,8 +87,8 @@ const de = class de { } }; Se = new WeakMap(), We = new WeakMap(), v(de, Se, null), x(de, "getInstance", () => (c(de, Se) || B(de, Se, new de()), c(de, Se))); -let Vt = de; -const Ni = Vt.getInstance(), Pn = (t, e, i = "children") => { +let Mt = de; +const Ni = Mt.getInstance(), Pn = (t, e, i = "children") => { if (m.isEmpty(t)) return {}; const n = m.find(t, ["value", e]); if (!m.isEmpty(n)) return n; @@ -110,7 +110,7 @@ const ue = class ue { }; ve = new WeakMap(), Xe = new WeakMap(), v(ue, ve, null), x(ue, "getInstance", () => (c(ue, ve) || B(ue, ve, new ue()), c(ue, ve))); let Dt = ue; -const Ve = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2array: (t) => [], null2number: (t) => 0, null2bool: (t) => !1, null2string: (t) => "", null2integer: (t) => 0, null2float: (t) => 0, string2json: (t) => t ? JSON.parse(t) : "{}", string2array: (t) => t.substr(0, 1) === "[" && t.substr(-1) === "]" ? JSON.parse(t) : t.split(","), string2number: (t) => t == "" ? 0 : +t, string2integer: (t) => t == "" ? 0 : +t, string2float: (t) => t == "" ? 0 : +t, string2bool: (t) => { +const Me = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2array: (t) => [], null2number: (t) => 0, null2bool: (t) => !1, null2string: (t) => "", null2integer: (t) => 0, null2float: (t) => 0, string2json: (t) => t ? JSON.parse(t) : "{}", string2array: (t) => t.substr(0, 1) === "[" && t.substr(-1) === "]" ? JSON.parse(t) : t.split(","), string2number: (t) => t == "" ? 0 : +t, string2integer: (t) => t == "" ? 0 : +t, string2float: (t) => t == "" ? 0 : +t, string2bool: (t) => { switch (`${t}`.toLowerCase()) { case "0": case "false": @@ -124,7 +124,7 @@ const Ve = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2arra i = Array.isArray(t) ? "array" : typeof t, m.isObject(t) && (i = "json"); const n = `${i}2${e}`; return Reflect.has(ci, n) ? ci[n](t) : t; -}, Tn = (t) => t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "json" : typeof t == "boolean" ? "bool" : typeof t == "string" ? "string" : typeof t == "number" ? Number.isInteger(t) ? "integer" : "float" : typeof t, lt = (t = {}, e = {}, i = {}, n = "") => Pi(t, (r, a) => a === "type" && r === "code") ? Ti(t, e, i, n) : Oi(t, e, n), Pi = (t, e = () => !1) => m.some(t, (i) => !!m.some(i, e) || (m.isEmpty(i) || !m.isPlainObject(i) && !m.isArray(i) ? void 0 : Pi(i, e))), Ti = async (t = {}, e = {}, i = {}, n = "") => { +}, Tn = (t) => t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "json" : typeof t == "boolean" ? "bool" : typeof t == "string" ? "string" : typeof t == "number" ? Number.isInteger(t) ? "integer" : "float" : typeof t, lt = (t = {}, e = {}, i = {}, n = "") => Pi(t, (r, a) => a === "type" && r === "code") ? Ti(t, e, i, n) : Ri(t, e, n), Pi = (t, e = () => !1) => m.some(t, (i) => !!m.some(i, e) || (m.isEmpty(i) || !m.isPlainObject(i) && !m.isArray(i) ? void 0 : Pi(i, e))), Ti = async (t = {}, e = {}, i = {}, n = "") => { let r = /* @__PURE__ */ Object.create(null); for (let a in t) { let o; @@ -133,7 +133,7 @@ const Ve = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2arra switch (s) { case "code": try { - o = await Fe.exec(l, e, i); + o = await Oe.exec(l, e, i); } catch (d) { console.error("getWidgetPropsData", d); } @@ -153,7 +153,7 @@ const Ve = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2arra m.set(r, a, o); } return r; -}, Oi = (t = {}, e = {}, i = "") => Object.keys(t || {}).reduce((n, r) => { +}, Ri = (t = {}, e = {}, i = "") => Object.keys(t || {}).reduce((n, r) => { if (m.isPlainObject(t[r])) { let a; if (Reflect.has(t[r], "type") && ["field", "router", "query", "string"].includes(t[r].type)) { @@ -170,11 +170,11 @@ const Ve = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2arra a = s; } a ?? (a = l); - } else a = Oi(t[r], e, i); + } else a = Ri(t[r], e, i); m.set(n, r, a); } return n; -}, {}), Ft = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((i) => Ft(i, e)) : Object.keys(t).reduce((i, n) => (e[n] ? i[e[n]] = Ft(t[n], e) : i[n] = Ft(t[n], e), i), {}) : t, Xr = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { +}, {}), Ot = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((i) => Ot(i, e)) : Object.keys(t).reduce((i, n) => (e[n] ? i[e[n]] = Ot(t[n], e) : i[n] = Ot(t[n], e), i), {}) : t, Xr = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { const e = 16 * Math.random() | 0; return (t === "x" ? e : 3 & e | 8).toString(16); }), Qr = (t) => { @@ -186,19 +186,19 @@ const Ve = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2arra }, ea = (t) => { var e, i; return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.owner : ""; -}, On = (t, e = 32, i = "auto") => { +}, Rn = (t, e = 32, i = "auto") => { const n = zt(t), r = i === "auto" ? "x64" : i; - if (e === 32) return Rt.x86.hash32(n).toString(); - if (e === 128) return r === "x64" ? Rt.x64.hash128(n) : Rt.x86.hash128(n); + if (e === 32) return Ft.x86.hash32(n).toString(); + if (e === 128) return r === "x64" ? Ft.x64.hash128(n) : Ft.x86.hash128(n); throw new Error("bits 只能是 32 或 128"); -}, zt = (t) => t == null ? "null" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "function" ? t.toString() : Array.isArray(t) ? "[" + t.map(zt).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${zt(t[e])}`).join(",") + "}" : String(t), Rn = () => { +}, zt = (t) => t == null ? "null" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "function" ? t.toString() : Array.isArray(t) ? "[" + t.map(zt).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${zt(t[e])}`).join(",") + "}" : String(t), Fn = () => { let t = 1; const e = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Map(); return (...n) => n.length === 0 ? "" : n.map((r) => { return String((a = r) === null || typeof a != "object" && typeof a != "function" ? (i.has(a) || i.set(a, t++), i.get(a)) : (e.has(a) || e.set(a, t++), e.get(a))); var a; }).join("::"); -}, Fn = (t) => { +}, On = (t) => { if (!t || typeof t != "string" || t.startsWith("/") || t.startsWith("./") || t.startsWith("../")) return !1; try { let e = t.startsWith("//") ? `http:${t}` : t; @@ -207,7 +207,7 @@ const Ve = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2arra return !1; } }, ta = (t, e = "") => { - if (!t || typeof t != "string" || Fn(t)) return t; + if (!t || typeof t != "string" || On(t)) return t; let i = e; return !i && typeof window < "u" && window.location && (i = `${window.location.protocol}//${window.location.host}`), t.startsWith("/") ? i ? `${i}${t}` : t : i ? `${i}/${t}` : t; }; @@ -236,7 +236,7 @@ const Et = class Et { }); x(this, "toRender", (e, i, n = null) => E.createElement(c(this, $t), { value: e, record: i }, n)); v(this, $t, ({ value: e, record: i, children: n }) => { - const [r, a] = I(n); + const [r, a] = L(n); return dt(() => { let o = !1; return a(n), this.toValue(e, i).then((s) => !o && a(s)).catch((s) => !o && a(`${s}`)), () => o = !0; @@ -252,7 +252,7 @@ kt = new WeakMap(), Qe = new WeakMap(), Ze = new WeakMap(), $t = new WeakMap(), return ((r = n.default) == null ? void 0 : r.call(n, i)) || ((a) => a); }); throw new TypeError("middleware must be a string or a function"); -}, Rn())); +}, Fn())); let bt = Et; const ne = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { }, onReload: () => { @@ -273,7 +273,7 @@ const ne = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, } }), di = ({ className: t, record: e, column: i, ...n }) => { if (i != null && i.editableByJs && (i != null && i.uuid)) { const { formSetting: r = { primaryKey: "id" }, widgetSetting: a = {}, widgetContainerSetting: o = {} } = (i == null ? void 0 : i.editableByJsSetting) || {}; - return h(P.Popover, { widget: An, widgetData: { record: e, column: i }, widgetSetting: { widgetSetting: a, formSetting: r }, widgetContainerProps: { title: i != null && i.title ? `${i.title} - 编辑` : "编辑", ...o, width: (o == null ? void 0 : o.width) || 260, arrow: !0 }, children: h("td", { className: O("ff-data-list-cell-editable", t), ...n }) }); + return h(P.Popover, { widget: An, widgetData: { record: e, column: i }, widgetSetting: { widgetSetting: a, formSetting: r }, widgetContainerProps: { title: i != null && i.title ? `${i.title} - 编辑` : "编辑", ...o, width: (o == null ? void 0 : o.width) || 260, arrow: !0 }, children: h("td", { className: R("ff-data-list-cell-editable", t), ...n }) }); } return h("td", { className: t, ...n }); }, An = ({ record: t, column: e, $close: i, $setting: n }) => { @@ -283,34 +283,34 @@ const ne = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, return dt(() => p(), [t, e == null ? void 0 : e.dataIndex, a]), h(Y, { actions: A(E.Fragment, { children: [h(P, { size: "small", onClick: p, children: "重置" }), A(dn.Compact, { block: !0, children: [h(P, { size: "small", widget: i, children: "取消" }), h(P, { type: "primary", size: "small", widget: () => s.validateFields().then(({ value: f }) => { const g = m.get(t, d.substring(d.indexOf(".") + 1)); if (!g) throw "获取更新主键失败!"; - j.put(`/api/${a}-storeBy-${e == null ? void 0 : e.uuid}/${g}`, { value: f }).msg(() => o(2, t)).then(i); + I.put(`/api/${a}-storeBy-${e == null ? void 0 : e.uuid}/${g}`, { value: f }).msg(() => o(2, t)).then(i); }).catch(console.warn), children: "保存" })] })] }), children: A(ie, { form: s, children: [h(Qt, { label: "", type: r.current, code: "value", widget: e == null ? void 0 : e.editableByJs, extras: u }), h(Jt, { noStyle: !0, name: ["__PROPS__"], children: () => { } })] }) }); -}, Ln = (t) => function(e) { +}, jn = (t) => function(e) { return t(e, getRecord()); -}, In = (t, e = {}) => K(() => { +}, Ln = (t, e = {}) => K(() => { var i; return (i = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : i.map(({ widgetByJs: n, widgetByJsSetting: r, ...a }, o) => { const s = (u) => ({ record: u, column: a }); let l = []; - return n && l.push([n, r]), l.length > 0 ? (a != null && a.render && l.push([Ln, a.render]), { ...a, onCell: s, render: (u, d) => new bt(l).toRender(u, d, "-") }) : { ...a, onCell: s }; + return n && l.push([n, r]), l.length > 0 ? (a != null && a.render && l.push([jn, a.render]), { ...a, onCell: s, render: (u, d) => new bt(l).toRender(u, d, "-") }) : { ...a, onCell: s }; }); -}, [t, e]), jn = (t = {}) => K(() => { +}, [t, e]), In = (t = {}) => K(() => { var e; return t.body ?? (t.body = { cell: di }), (e = t.body).cell ?? (e.cell = di), t; }, [t]), ia = (t) => { - const [e, i] = I({}); - return M(() => { + const [e, i] = L({}); + return V(() => { let n = !1; - return t && j.get(`/api/_/${t}`).then((r) => m.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig"])).then((r) => !n && i(r)), () => n = !0; + return t && I.get(`/api/_/${t}`).then((r) => m.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig"])).then((r) => !n && i(r)), () => n = !0; }, [t]), e; }, na = (t, e = {}) => { - const [i, n] = I({ dataSource: [] }); + const [i, n] = L({ dataSource: [] }); return ct(() => { let r = !1; - return t && j.get(`/api/${t}/${j.encode({ page: 1, ...e })}`).then((a) => !r && n(a)), () => r = !0; + return t && I.get(`/api/${t}/${I.encode({ page: 1, ...e })}`).then((a) => !r && n(a)), () => r = !0; }, [t, e]), i; -}, Ri = (t = [], e = /* @__PURE__ */ new Map(), i = "id", n) => { +}, Fi = (t = [], e = /* @__PURE__ */ new Map(), i = "id", n) => { const r = X(n ? (a) => m.get(a, i, m.get(a, [n, i])) : (a) => m.get(a, i), [i, n]); return X((a) => t == null ? void 0 : t.filter((o) => !o.uuid || !e.has(o.uuid) || e.get(o.uuid).some((s) => s == r(a))), [t, e, r]); }, Bt = (t = [], e = /* @__PURE__ */ new Map(), i = [], n = "id", r) => { @@ -321,32 +321,32 @@ const ne = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, const o = i.map((s) => a(s)); return t.some(({ uuid: s }) => !s || !e.has(s) || e.get(s).some((l) => o.some((u) => u == l))); }, [t, i, e, a]); -}, Mn = (t, e, i = "id", n = null) => { +}, Vn = (t, e, i = "id", n = null) => { const r = xt(), a = H(!1), o = H(t.dataSource), s = H(t.itemOperationsAccess); - return M(() => (o.current = t.dataSource, s.current = t.itemOperationsAccess, () => a.current = !1), [t.dataSource, t.itemOperationsAccess]), a.current && (t.dataSource = o.current, t.itemOperationsAccess = s.current), [t, (l = 0, u = null) => { + return V(() => (o.current = t.dataSource, s.current = t.itemOperationsAccess, () => a.current = !1), [t.dataSource, t.itemOperationsAccess]), a.current && (t.dataSource = o.current, t.itemOperationsAccess = s.current), [t, (l = 0, u = null) => { var d, p; if (a.current = !1, l === 1) return (d = t.onReload) == null ? void 0 : d.call(t); if (l === 2) { const f = m.get(u, "__PARENT_ID__", ""), g = m.get(u, i, m.get(u, [n, i], "")), y = m.findIndex(o.current, ["__PARENT_ID__", f]), w = m.findIndex(y > -1 ? m.get(o.current, [y, "children"]) : o.current, [i, g]); if (w === -1) return (p = t.onReload) == null ? void 0 : p.call(t); - Promise.all([j.get(`/api/${e}/detail/${g}`), j.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([C, k]) => { + Promise.all([I.get(`/api/${e}/detail/${g}`), I.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([C, k]) => { const S = m.get(o.current, y > -1 ? [y, "children", w, "children"] : [w, "children"]); o.current = ki(o.current, y > -1 ? { [y]: { children: { $splice: [[w, 1, { ...C, children: S }]] } } } : { $splice: [[w, 1, { ...C, children: S }]] }); const $ = new Map(k); - s.current.forEach((T, F) => { - var L; - (L = $.get(F)) != null && L.some((D) => D == g) || s.current.set(F, T.filter((D) => D !== g)); - }), $.forEach((T, F) => { - s.current.has(F) ? s.current.set(F, m.uniq([...s.current.get(F) || [], ...T])) : s.current.set(F, T); + s.current.forEach((T, O) => { + var j; + (j = $.get(O)) != null && j.some((D) => D == g) || s.current.set(O, T.filter((D) => D !== g)); + }), $.forEach((T, O) => { + s.current.has(O) ? s.current.set(O, m.uniq([...s.current.get(O) || [], ...T])) : s.current.set(O, T); }); }).then(() => { a.current = !0, r(); }); } }]; -}, Vn = (t, e) => { +}, Mn = (t, e) => { const i = xt(), n = H(e), r = H(/* @__PURE__ */ new Map()), a = H([]), o = m.throttle((l) => { - a.current = [], j.list(t, m.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: u, condition: d, total: p, tab: f, sider: g, page: y, pageSize: w, operationsAccess: C, dataSource: k }) => { + a.current = [], I.list(t, m.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: u, condition: d, total: p, tab: f, sider: g, page: y, pageSize: w, operationsAccess: C, dataSource: k }) => { n.current = { tab: f, condition: d, sider: g, keyword: u, total: p, pageSize: w, page: k != null && k.length ? y : 1 }, a.current = k, r.current = new Map(C), i(); }); }, 380, { leading: !1, trailing: !0 }); @@ -356,55 +356,55 @@ const ne = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, const s = K(() => m.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [n.current]); return Object.assign(s, { onTabChange: (l) => o({ tab: l, page: 1 }), onPageChange: (l, u) => o({ page: l, pageSize: u }), onPageSizeChange: (l) => o({ pageSize: l, page: 1 }), onConditionChange: (l, u) => o({ keyword: u, condition: ki(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => o({ sider: l, page: 1 }), onKeywordChange: (l) => o({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: a.current, onReload: o, payload: e == null ? void 0 : e.payload }); }, Dn = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: d, primaryKey: p, title: f, itemGridLayout: g, $setting: y, tabs: w, isConditionFormLayout: C, isTreeSider: k, treeSiderConfig: S }) => { - const { classNames: $, onClickCallback: T } = le(ne), F = m.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style"]), L = Ri(l, u, p, d), D = X((U, R, V) => h(zn, { className: O("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: a ? L(R) : [], data: d ? { [d]: R } : R, children: U, onClickCallback: T }), [d, p, a, T, l, u]); - return A("div", { className: O("ff-data-list-framework", e), children: [h(i.sider, { isTreeSider: k, ...S }), A("div", { className: O("ff-data-list-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: C }), h(i.toolbar, { title: f, tabs: w }), h(er, { ...F, ...g, empty: h(i.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: D, dataSource: n }), h(i.footer, { isPaginate: r, isOperations: o, operations: s })] })] }); -}, zn = ({ className: t, operations: e, children: i, data: n, onClickCallback: r }) => A("div", { className: O("data-list-grid-layout-item", t), children: [h("div", { className: "data-list-grid-layout-item-container", children: i }), !!(e != null && e.length) && h("div", { className: "data-list-grid-layout-item-actions", children: e.map((a) => h("span", { className: "data-list-grid-layout-item-action", children: h(P.Link, { uuid: a.uuid, type: a.type, name: a.name, widget: a.widget, widgetType: a.widgetType, widgetProps: a.widgetProps, widgetSetting: a.widgetSetting, widgetContainerProps: a.widgetContainerSetting, data: n, confirm: a.confirm, onAfterClick: (o) => o !== !1 && (r == null ? void 0 : r(a.isRefresh, n)) }, a.uuid || It()) }, (a == null ? void 0 : a.uuid) || It())) })] }), Bn = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: d, primaryKey: p, title: f, tabs: g, isPaginate: y, isTreeSider: w, treeSiderConfig: C, isConditionFormLayout: k, ...S }) => { - const { classNames: $, onClickCallback: T } = le(ne), F = Ri(l, u, p, d), L = Bt(l, u, n, p, d); - return A("div", { className: O("ff-data-table-framework", e), children: [h(i.sider, { isTreeSider: w, ...C }), A("div", { className: O("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: k }), h(i.toolbar, { title: f, tabs: g }), h(Jn, { ...S, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: n, operationRender: L ? (D) => { + const { classNames: $, onClickCallback: T } = le(ne), O = m.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style"]), j = Fi(l, u, p, d), D = X((U, F, M) => h(zn, { className: R("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: a ? j(F) : [], data: d ? { [d]: F } : F, children: U, onClickCallback: T }), [d, p, a, T, l, u]); + return A("div", { className: R("ff-data-list-framework", e), children: [h(i.sider, { isTreeSider: k, ...S }), A("div", { className: R("ff-data-list-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: C }), h(i.toolbar, { title: f, tabs: w }), h(er, { ...O, ...g, empty: h(i.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: D, dataSource: n }), h(i.footer, { isPaginate: r, isOperations: o, operations: s })] })] }); +}, zn = ({ className: t, operations: e, children: i, data: n, onClickCallback: r }) => A("div", { className: R("data-list-grid-layout-item", t), children: [h("div", { className: "data-list-grid-layout-item-container", children: i }), !!(e != null && e.length) && h("div", { className: "data-list-grid-layout-item-actions", children: e.map((a) => h("span", { className: "data-list-grid-layout-item-action", children: h(P.Link, { uuid: a.uuid, type: a.type, name: a.name, widget: a.widget, widgetType: a.widgetType, widgetProps: a.widgetProps, widgetSetting: a.widgetSetting, widgetContainerProps: a.widgetContainerSetting, data: n, confirm: a.confirm, onAfterClick: (o) => o !== !1 && (r == null ? void 0 : r(a.isRefresh, n)) }, a.uuid || Lt()) }, (a == null ? void 0 : a.uuid) || Lt())) })] }), Bn = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: d, primaryKey: p, title: f, tabs: g, isPaginate: y, isTreeSider: w, treeSiderConfig: C, isConditionFormLayout: k, ...S }) => { + const { classNames: $, onClickCallback: T } = le(ne), O = Fi(l, u, p, d), j = Bt(l, u, n, p, d); + return A("div", { className: R("ff-data-table-framework", e), children: [h(i.sider, { isTreeSider: w, ...C }), A("div", { className: R("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: k }), h(i.toolbar, { title: f, tabs: g }), h(Jn, { ...S, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: n, operationRender: j ? (D) => { var U; - return h("div", { className: "ff-data-table-actions", children: (U = F(D)) == null ? void 0 : U.map((R, V) => h(P.Link, { size: "small", uuid: R.uuid, type: R.type, name: R.name, widget: R.widget, widgetType: R.widgetType, widgetProps: R.widgetProps, widgetData: R.widgetData, widgetSetting: R.widgetSetting, widgetContainerProps: R.widgetContainerSetting, data: D, confirm: R.confirm, onAfterClick: (N) => N !== !1 && (T == null ? void 0 : T(R.isRefresh, D)) }, R.uuid || V)) }); + return h("div", { className: "ff-data-table-actions", children: (U = O(D)) == null ? void 0 : U.map((F, M) => h(P.Link, { size: "small", uuid: F.uuid, type: F.type, name: F.name, widget: F.widget, widgetType: F.widgetType, widgetProps: F.widgetProps, widgetData: F.widgetData, widgetSetting: F.widgetSetting, widgetContainerProps: F.widgetContainerSetting, data: D, confirm: F.confirm, onAfterClick: (N) => N !== !1 && (T == null ? void 0 : T(F.isRefresh, D)) }, F.uuid || M)) }); } : null }), h(i.footer, { isPaginate: y, isOperations: o, operations: s })] })] }); }, Yt = (t = [], e, i = null) => { var n; - return (n = m.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: a, y: o, w: s, h: l, field: { boxStyle: u, ...d } = {} }, p) => h("div", { className: "grid-layout-item", style: Fi(a, o, s, l, u), children: h(e, { ...d, basicForm: i }) }, r ?? p)); -}, Fi = (t, e, i, n, r = {}, a = 0) => { + return (n = m.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: a, y: o, w: s, h: l, field: { boxStyle: u, ...d } = {} }, p) => h("div", { className: "grid-layout-item", style: Oi(a, o, s, l, u), children: h(e, { ...d, basicForm: i }) }, r ?? p)); +}, Oi = (t, e, i, n, r = {}, a = 0) => { const o = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; return r != null && r.autoHeight ? o.height = "fit-content" : o["--grid-layout-row"] = `${n}`, r != null && r.alignItems && (o["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (o["--grid-layout-box-justify-content"] = r.justifyContent), o["--grid-layout-box-margin"] = ui(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), o["--grid-layout-box-padding"] = ui(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), a && (o.height = `${a}px`), o; }, ui = (t, e, i, n) => `${t || 0}px ${e || 0}px ${i || 0}px ${n || 0}px`, ra = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, Ai = ({ className: t, isConditionFormLayout: e }) => { var f, g; - const [i, n] = I({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = E.useContext(ne), { keyword: u, condition: d } = (s == null ? void 0 : s()) || {}, [p] = ft.useForm(); - return M(() => { - r && e && j.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: y, marginX: w, marginY: C, rowHeight: k, cols: S, fields: $ }) => { + const [i, n] = L({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = E.useContext(ne), { keyword: u, condition: d } = (s == null ? void 0 : s()) || {}, [p] = ft.useForm(); + return V(() => { + r && e && I.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: y, marginX: w, marginY: C, rowHeight: k, cols: S, fields: $ }) => { n({ resource: y, itemMargin: [w, C], rowHeight: k, cols: S, fields: $ }); }).catch(() => n({})); - }, [r, e]), M(() => { + }, [r, e]), V(() => { p.setFieldsValue({ keyword: u, ...d }); - }, [JSON.stringify([u, d])]), h("div", { className: O("ff-data-list-filter", l.filter, t), children: h(ft, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((f = i.fields) == null ? void 0 : f.length) > 1 ? (y) => o({ [i.resource]: y[i.resource] }, y.keyword) : () => { + }, [JSON.stringify([u, d])]), h("div", { className: R("ff-data-list-filter", l.filter, t), children: h(ft, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((f = i.fields) == null ? void 0 : f.length) > 1 ? (y) => o({ [i.resource]: y[i.resource] }, y.keyword) : () => { }, onValuesChange: (y) => { m.isEmpty(m.omit(y, ["keyword"])) || p.submit(); }, children: ((g = i.fields) == null ? void 0 : g.length) > 1 ? h(Zt, { ...i, children: h(Wn, { onReset: () => { const { keyword: y, condition: w } = s("init") || {}; p.setFieldsValue({ keyword: y, ...w }); - } }) }) : h("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: h("div", { className: "grid-layout-item", style: Fi(20, 0, 5, 2), children: h(ft.Item, { name: ["keyword"], children: h(un.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (y) => a(y) }) }) }) }) }) }); + } }) }) : h("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: h("div", { className: "grid-layout-item", style: Oi(20, 0, 5, 2), children: h(ft.Item, { name: ["keyword"], children: h(un.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (y) => a(y) }) }) }) }) }) }); }, Wn = ({ cols: t, fields: e, onReset: i }) => { - const [n, r] = I(!1), a = K(() => e == null ? void 0 : e.toReversed().some((o) => o.y > 1 || o.x + o.w >= t - 5), [t, e]); - return A(ft.Item, { label: " ", style: { "--item-span": 5 }, className: O("ff-data-list-filter-actions", { expanded: n }), children: [h(wt, { onClick: i, children: "重置" }), h(wt, { type: "primary", htmlType: "submit", children: "查询" }), a && h(P.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((o) => !o), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); + const [n, r] = L(!1), a = K(() => e == null ? void 0 : e.toReversed().some((o) => o.y > 1 || o.x + o.w >= t - 5), [t, e]); + return A(ft.Item, { label: " ", style: { "--item-span": 5 }, className: R("ff-data-list-filter-actions", { expanded: n }), children: [h(wt, { onClick: i, children: "重置" }), h(wt, { type: "primary", htmlType: "submit", children: "查询" }), a && h(P.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((o) => !o), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); }; Ai.reservedFields = [{ x: 0, y: 0, h: 3, w: 5, field: { isVirtual: !0, widgetPrefix: "@pkg/ff/grid-layout-forms", widget: "Input", code: "keyword", label: "关键字", placeholder: "多关键字 | 分割", extras: { prefix: "icon-search" } } }]; const Un = ({ className: t, operations: e, isOperations: i, isPaginate: n }) => { const { onPageChange: r, onPageSizeChange: a, onClickCallback: o, getBase62params: s } = E.useContext(ne), { total: l, page: u, pageSize: d } = (s == null ? void 0 : s()) || {}; - return i && !m.isEmpty(e) || n ? A("div", { className: O("ff-data-list-footer", t), children: [h("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, f) => h(P, { uuid: p.uuid, type: p.type, name: p.name, widget: p.widget, widgetType: p.widgetType, widgetProps: p.widgetProps, widgetData: p.widgetData, widgetSetting: p.widgetSetting, widgetContainerProps: p.widgetContainerSetting, onAfterClick: (g) => g !== !1 && (o == null ? void 0 : o(p.isRefresh, null)) }, p.uuid || f)) }), n && h(pn, { size: "small", total: l, pageSize: d, showSizeChanger: !1, showTotal: (p) => `第 ${u} 页 / 总共 ${p} 条`, onChange: r, onShowSizeChange: a })] }) : null; + return i && !m.isEmpty(e) || n ? A("div", { className: R("ff-data-list-footer", t), children: [h("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, f) => h(P, { uuid: p.uuid, type: p.type, name: p.name, widget: p.widget, widgetType: p.widgetType, widgetProps: p.widgetProps, widgetData: p.widgetData, widgetSetting: p.widgetSetting, widgetContainerProps: p.widgetContainerSetting, onAfterClick: (g) => g !== !1 && (o == null ? void 0 : o(p.isRefresh, null)) }, p.uuid || f)) }), n && h(pn, { size: "small", total: l, pageSize: d, showSizeChanger: !1, showTotal: (p) => `第 ${u} 页 / 总共 ${p} 条`, onChange: r, onShowSizeChange: a })] }) : null; }, qn = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: h("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], Kn = ({ className: t, width: e = 280, isTreeSider: i }) => { const { classNames: n } = le(ne); - return i ? h(gn.DirectoryTree, { className: O("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: qn }) : null; + return i ? h(gn.DirectoryTree, { className: R("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: qn }) : null; }, Hn = ({ className: t, title: e, tabs: i }) => { const { getBase62params: n, onTabChange: r, onReload: a, classNames: o } = le(ne), { tab: s } = (n == null ? void 0 : n()) || {}, [l, u] = bn((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: r }); - return A("div", { className: O("ff-data-list-toolbar", o.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(hn, { className: "ff-data-list-tabs", itemRender: ({ label: d, code: p, value: f }) => h("span", { onClick: () => u(f ?? p), className: O("ff-data-list-tab", { active: (f ?? p) == l }), children: d }), items: i }), A("div", { className: "ff-data-list-actions", children: [h(P.Link, { icon: "icon-reload", widget: () => a() }), h(P.Link, { icon: "icon-setting" })] })] }); -}, _n = ({ className: t, ...e }) => h(Mt, { className: O(t, "ff-data-list-empty"), image: Mt.PRESENTED_IMAGE_SIMPLE, ...e }), Li = ({ isItemGridLayout: t, theme: e, themeProps: i, onClickCallback: n, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: u = 30, onPageSizeChange: d, tab: p, onTabChange: f, keyword: g, onKeywordChange: y, condition: w, onConditionChange: C, sider: k, onSiderChange: S, layouts: $, classNames: T = {}, payload: F = {}, ...L }) => { - const [D, U] = I(), R = X((N, W) => { - const z = { tab: p, page: s, pageSize: u, keyword: g, sider: k, condition: w, total: o, payload: F }; + return A("div", { className: R("ff-data-list-toolbar", o.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(hn, { className: "ff-data-list-tabs", itemRender: ({ label: d, code: p, value: f }) => h("span", { onClick: () => u(f ?? p), className: R("ff-data-list-tab", { active: (f ?? p) == l }), children: d }), items: i }), A("div", { className: "ff-data-list-actions", children: [h(P.Link, { icon: "icon-reload", widget: () => a() }), h(P.Link, { icon: "icon-setting" })] })] }); +}, _n = ({ className: t, ...e }) => h(Vt, { className: R(t, "ff-data-list-empty"), image: Vt.PRESENTED_IMAGE_SIMPLE, ...e }), ji = ({ isItemGridLayout: t, theme: e, themeProps: i, onClickCallback: n, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: u = 30, onPageSizeChange: d, tab: p, onTabChange: f, keyword: g, onKeywordChange: y, condition: w, onConditionChange: C, sider: k, onSiderChange: S, layouts: $, classNames: T = {}, payload: O = {}, ...j }) => { + const [D, U] = L(), F = X((N, W) => { + const z = { tab: p, page: s, pageSize: u, keyword: g, sider: k, condition: w, total: o, payload: O }; return N && N != "init" ? m.get(z, N, W) : z; - }, [JSON.stringify(w), JSON.stringify(F), p, s, u, g, k, o]), V = K(() => { + }, [JSON.stringify(w), JSON.stringify(O), p, s, u, g, k, o]), M = K(() => { let N = { sider: Kn, filter: Ai, footer: Un, toolbar: Hn, empty: _n }; $ === !1 ? N = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : m.isPlainObject($) && (N = Object.assign({}, N, $)); for (const W in N) if (N[W]) { @@ -415,52 +415,52 @@ const Un = ({ className: t, operations: e, isOperations: i, isPaginate: n }) => } else N[W] = () => h(E.Fragment, {}); return N; }, [$]); - return M(() => { + return V(() => { e ? se.getWidgetComponent(e).then((N) => { if (!N) throw `${e} not found`; return N; - }).catch((N) => ({ default: () => `${N}` })).then((N) => U(E.createElement(N.default, { ...L, layouts: V, $setting: i }))) : U(h(t ? Dn : Bn, { ...L, layouts: V, $setting: i })); - }, [e, i]), h(ne.Provider, { value: { classNames: T, listCode: a, onClickCallback: n, onReload: r, getBase62params: R, onPageChange: l, onPageSizeChange: d, onTabChange: f, onSiderChange: S, onKeywordChange: y, onConditionChange: C, setPage: l, setPageSize: d, setTab: f, setSider: S, setKeyword: y, setCondition: C }, children: D && E.cloneElement(D, L) }); + }).catch((N) => ({ default: () => `${N}` })).then((N) => U(E.createElement(N.default, { ...j, layouts: M, $setting: i }))) : U(h(t ? Dn : Bn, { ...j, layouts: M, $setting: i })); + }, [e, i]), h(ne.Provider, { value: { classNames: T, listCode: a, onClickCallback: n, onReload: r, getBase62params: F, onPageChange: l, onPageSizeChange: d, onTabChange: f, onSiderChange: S, onKeywordChange: y, onConditionChange: C, setPage: l, setPageSize: d, setTab: f, setSider: S, setKeyword: y, setCondition: C }, children: D && E.cloneElement(D, j) }); }; -Li.propTypes = { classNames: b.exact({ sider: b.string, filter: b.string, footer: b.string, toolbar: b.string, container: b.string, content: b.string, item: b.string, empty: b.string }), layouts: b.oneOfType([b.exact({ sider: b.oneOfType([b.elementType, b.element]), filter: b.oneOfType([b.elementType, b.element]), footer: b.oneOfType([b.elementType, b.element]), toolbar: b.oneOfType([b.elementType, b.element]), empty: b.oneOfType([b.elementType, b.element]) }), b.bool]) }; -var Ne, be, je, St; +ji.propTypes = { classNames: b.exact({ sider: b.string, filter: b.string, footer: b.string, toolbar: b.string, container: b.string, content: b.string, item: b.string, empty: b.string }), layouts: b.oneOfType([b.exact({ sider: b.oneOfType([b.elementType, b.element]), filter: b.oneOfType([b.elementType, b.element]), footer: b.oneOfType([b.elementType, b.element]), toolbar: b.oneOfType([b.elementType, b.element]), empty: b.oneOfType([b.elementType, b.element]) }), b.bool]) }; +var Ne, be, Ie, St; const pe = class pe { constructor() { v(this, be, null); - v(this, je, /* @__PURE__ */ new Map()); + v(this, Ie, /* @__PURE__ */ new Map()); v(this, St, () => { if (c(this, be)) return c(this, be).port.postMessage({ command: "status", data: [] }); B(this, be, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), c(this, be).port.onmessage = (e) => { var i, n; - (i = e.data) != null && i.uuid ? c(this, je).forEach((r, a) => { + (i = e.data) != null && i.uuid ? c(this, Ie).forEach((r, a) => { var o; (r == "*" || (o = r == null ? void 0 : r.includes) != null && o.call(r, e.data.uuid)) && a(e.data); - }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && j.get("/api/user-api-token").then(({ token: r, expire_at: a }) => { - c(this, be).port.postMessage({ command: "initWs", data: [`ws${m.trimStart(j.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); + }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && I.get("/api/user-api-token").then(({ token: r, expire_at: a }) => { + c(this, be).port.postMessage({ command: "initWs", data: [`ws${m.trimStart(I.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); }); }, c(this, be).port.postMessage({ command: "status", data: [] }); }); - x(this, "subscribe", (e, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", c(this, je).set(e, i), c(this, je).size == 1 && c(this, St).call(this), () => this.unsubscribe(e))); - x(this, "unsubscribe", (e) => c(this, je).delete(e)); + x(this, "subscribe", (e, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", c(this, Ie).set(e, i), c(this, Ie).size == 1 && c(this, St).call(this), () => this.unsubscribe(e))); + x(this, "unsubscribe", (e) => c(this, Ie).delete(e)); if (c(pe, Ne)) return c(pe, Ne); } }; -Ne = new WeakMap(), be = new WeakMap(), je = new WeakMap(), St = new WeakMap(), v(pe, Ne, null), x(pe, "getInstance", () => (c(pe, Ne) || B(pe, Ne, new pe()), c(pe, Ne))); +Ne = new WeakMap(), be = new WeakMap(), Ie = new WeakMap(), St = new WeakMap(), v(pe, Ne, null), x(pe, "getInstance", () => (c(pe, Ne) || B(pe, Ne, new pe()), c(pe, Ne))); let Wt = pe; -const Ii = Wt.getInstance(), Xt = E.forwardRef(({ listCode: t, base62params: e, className: i, theme: n, themeProps: r, layouts: a, classNames: o }, s) => { - const [{ resource: l, primaryKey: u, batchOperations: d = [], itemOperations: p = [], columns: f = [], themeConfig: g, theme: y, isConditionFormLayout: w = !1, isTreeSider: C, treeSiderConfig: k, isItemGridLayout: S, itemGridLayout: { themeConfig: $, ...T } = {}, title: F, isPaginate: L, tabs: D }, U] = I({ isItemGridLayout: !1, itemGridLayout: {} }), R = Vn(t, e), [{ dataSource: V, itemOperationsAccess: N, condition: W, tab: z, keyword: Ee, page: pt, total: gt, pageSize: Tt, sider: te, onConditionChange: Ki, onTabChange: Hi, onKeywordChange: _i, onPageChange: Ji, onPageSizeChange: Gi, onSiderChange: Yi, onReload: Ot, payload: Xi }, ni] = Mn(R, t, u, l), Qi = Bt(p, N, V, u), Zi = Bt(d); - M(() => { +const Li = Wt.getInstance(), Xt = E.forwardRef(({ listCode: t, base62params: e, className: i, theme: n, themeProps: r, layouts: a, classNames: o }, s) => { + const [{ resource: l, primaryKey: u, batchOperations: d = [], itemOperations: p = [], columns: f = [], themeConfig: g, theme: y, isConditionFormLayout: w = !1, isTreeSider: C, treeSiderConfig: k, isItemGridLayout: S, itemGridLayout: { themeConfig: $, ...T } = {}, title: O, isPaginate: j, tabs: D }, U] = L({ isItemGridLayout: !1, itemGridLayout: {} }), F = Mn(t, e), [{ dataSource: M, itemOperationsAccess: N, condition: W, tab: z, keyword: Ee, page: pt, total: gt, pageSize: Tt, sider: te, onConditionChange: Ki, onTabChange: Hi, onKeywordChange: _i, onPageChange: Ji, onPageSizeChange: Gi, onSiderChange: Yi, onReload: Rt, payload: Xi }, ni] = Vn(F, t, u, l), Qi = Bt(p, N, M, u), Zi = Bt(d); + V(() => { let re = null; - return t && j.get(`/api/_/${t}`).resp(({ data: ht, res: tn }) => { - ht != null && ht.isDynamicRefresh && (re = Ii.subscribe(() => Ot(), tn)), U(ht); + return t && I.get(`/api/_/${t}`).resp(({ data: ht, res: tn }) => { + ht != null && ht.isDynamicRefresh && (re = Li.subscribe(() => Rt(), tn)), U(ht); }).catch(() => U({})), () => re == null ? void 0 : re(); - }, [t]), E.useImperativeHandle(s, () => ({ onReload: Ot, onClickCallback: ni })); - const en = { listCode: t, title: F, classNames: o, layouts: a, resource: l, primaryKey: u, theme: n || y, themeProps: r || g, isTreeSider: C, treeSiderConfig: k, isPaginate: L, tabs: D, isItemOperations: Qi, itemOperations: p == null ? void 0 : p.map((re) => m.isEmpty(re == null ? void 0 : re.confirm) ? re : { ...re, confirm: Object.assign({}, re.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: Zi, batchOperations: d, isItemGridLayout: S, columns: f, itemGridLayout: { ...T, themeProps: $ }, isConditionFormLayout: w, itemOperationsAccess: N, dataSource: V, onConditionChange: Ki, onTabChange: Hi, onKeywordChange: _i, onPageChange: Ji, onPageSizeChange: Gi, onSiderChange: Yi, condition: W, tab: z, keyword: Ee, page: pt, total: gt, pageSize: Tt, sider: te, payload: Xi }; - return h(Li, { ...en, className: O("ff-data-list-helper", i), onReload: Ot, onClickCallback: ni }); -}), ji = (t, e, i = !0) => i !== !0 && i-- <= 0 ? [] : m.isArray(t) && !m.isEmpty(t) ? t.reduce((n, r) => (Reflect.has(r, e) && Reflect.has(r, "children") && n.push(r[e]), Reflect.has(r, "children") && !m.isEmpty(r.children) ? n.concat(ji(r.children, e, i)) : n), []) : [], Jn = ({ className: t, primaryKey: e, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: a = 180, components: o = {}, ...s }) => { - const { classNames: l } = le(ne), u = H(null), d = H(null), [p, f] = I([]), [g, y] = I({ width: 0, height: 0 }); - M(() => { - f(ji(n, e)); + }, [t]), E.useImperativeHandle(s, () => ({ onReload: Rt, onClickCallback: ni })); + const en = { listCode: t, title: O, classNames: o, layouts: a, resource: l, primaryKey: u, theme: n || y, themeProps: r || g, isTreeSider: C, treeSiderConfig: k, isPaginate: j, tabs: D, isItemOperations: Qi, itemOperations: p == null ? void 0 : p.map((re) => m.isEmpty(re == null ? void 0 : re.confirm) ? re : { ...re, confirm: Object.assign({}, re.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: Zi, batchOperations: d, isItemGridLayout: S, columns: f, itemGridLayout: { ...T, themeProps: $ }, isConditionFormLayout: w, itemOperationsAccess: N, dataSource: M, onConditionChange: Ki, onTabChange: Hi, onKeywordChange: _i, onPageChange: Ji, onPageSizeChange: Gi, onSiderChange: Yi, condition: W, tab: z, keyword: Ee, page: pt, total: gt, pageSize: Tt, sider: te, payload: Xi }; + return h(ji, { ...en, className: R("ff-data-list-helper", i), onReload: Rt, onClickCallback: ni }); +}), Ii = (t, e, i = !0) => i !== !0 && i-- <= 0 ? [] : m.isArray(t) && !m.isEmpty(t) ? t.reduce((n, r) => (Reflect.has(r, e) && Reflect.has(r, "children") && n.push(r[e]), Reflect.has(r, "children") && !m.isEmpty(r.children) ? n.concat(Ii(r.children, e, i)) : n), []) : [], Jn = ({ className: t, primaryKey: e, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: a = 180, components: o = {}, ...s }) => { + const { classNames: l } = le(ne), u = H(null), d = H(null), [p, f] = L([]), [g, y] = L({ width: 0, height: 0 }); + V(() => { + f(Ii(n, e)); }, [n, e]), on(() => { const k = new ResizeObserver(() => { var S; @@ -470,38 +470,38 @@ const Ii = Wt.getInstance(), Xt = E.forwardRef(({ listCode: t, base62params: e, d.current && k.unobserve(d.current); }; }, []); - const w = In(i), C = jn(o); - return h("div", { ref: d, className: O("ff-data-list-table", l.content, t), children: g.height ? h(mn, { bordered: !0, ...s, components: C, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), columns: w == null ? void 0 : w.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / g.width * 100).toFixed(2)}%`, render: (k, S, $) => r(S, $) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: g.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: f, expandedRowKeys: p } }) : null }); + const w = Ln(i), C = In(o); + return h("div", { ref: d, className: R("ff-data-list-table", l.content, t), children: g.height ? h(mn, { bordered: !0, ...s, components: C, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), columns: w == null ? void 0 : w.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / g.width * 100).toFixed(2)}%`, render: (k, S, $) => r(S, $) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: g.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: f, expandedRowKeys: p } }) : null }); }, Gn = "RC_FORM_INTERNAL_HOOKS", Yn = (t) => { const [e, i] = E.useState({ items: [] }); - return M(() => { - t && j.get(`/api/_/${t}`).then(({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: u, cols: d, rowHeight: p, fields: f, theme: g, themeSetting: y, groups: w }) => ({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: u, cols: d, rowHeight: p, theme: g, themeProps: y, groups: w, items: f })).then(i); + return V(() => { + t && I.get(`/api/_/${t}`).then(({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: u, cols: d, rowHeight: p, fields: f, theme: g, themeSetting: y, groups: w }) => ({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: u, cols: d, rowHeight: p, theme: g, themeProps: y, groups: w, items: f })).then(i); }, [t]), e; }, Xn = (t, { initialValue: e, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: a = "string" }, o = null) => { - const s = H(!1), l = le(Ci), [u, d] = I(), [p, f] = I(i != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(Gn) || {}; - return M(() => g == null ? void 0 : g((y, w, C) => { + const s = H(!1), l = le(Ci), [u, d] = L(), [p, f] = L(i != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(Gn) || {}; + return V(() => g == null ? void 0 : g((y, w, C) => { if (!s.current) return; const k = m.get(w, t); m.isEqual(k, p) || f(oe(k, a)); - }), [p]), M(() => { - i == "javascript" && e ? Fe.exec(e, {}, { getFieldValueForBasicForm: (y) => o ? o.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => f(oe(y, a))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => s.current = !0) : (e && f(oe(e ?? l.getFieldValue(t), a)), s.current = !0); + }), [p]), V(() => { + i == "javascript" && e ? Oe.exec(e, {}, { getFieldValueForBasicForm: (y) => o ? o.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => f(oe(y, a))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => s.current = !0) : (e && f(oe(e ?? l.getFieldValue(t), a)), s.current = !0); }, [e, i]), ct(() => { s.current && n && new bt([n, r]).toValue(p, l.getFieldsValue(!0)).then(d).catch((y) => { d(y), console.error("布局数据转换错误: ", y, n); }); }, [p, n, r]), [u ?? p, p]; -}, aa = (t, e, i = null) => K(() => Yt(t, e, i), [t]), Mi = (t, e, i = {}, n = {}, r = {}, a = null) => { - const o = le(Ci), s = xt(), l = H(!0), u = H([]), [d, p] = I(e), [f, g] = I(), y = ie.useWatch((w) => JSON.stringify(m.pick(w, u.current)), o) || "{}"; +}, aa = (t, e, i = null) => K(() => Yt(t, e, i), [t]), Vi = (t, e, i = {}, n = {}, r = {}, a = null) => { + const o = le(Ci), s = xt(), l = H(!0), u = H([]), [d, p] = L(e), [f, g] = L(), y = ie.useWatch((w) => JSON.stringify(m.pick(w, u.current)), o) || "{}"; return dt(() => { - t && Fe.exec(t, i, { ...n, getFieldValueForBasicForm: (w) => r ? r.getFieldValue(w) : null, getFieldValue: m.wrap(o.getFieldValue, (w, C) => (u.current.some((k) => m.isEqual(k, C)) || (u.current.push(C), s()), w == null ? void 0 : w(C))), isFieldTouched: o.isFieldTouched, isFieldsTouched: o.isFieldsTouched }).then((w) => { + t && Oe.exec(t, i, { ...n, getFieldValueForBasicForm: (w) => r ? r.getFieldValue(w) : null, getFieldValue: m.wrap(o.getFieldValue, (w, C) => (u.current.some((k) => m.isEqual(k, C)) || (u.current.push(C), s()), w == null ? void 0 : w(C))), isFieldTouched: o.isFieldTouched, isFieldsTouched: o.isFieldsTouched }).then((w) => { l.current && (p(w), g(null)); }).catch((w) => { l.current && (p(e), g(w)); }); - }, [t, y, o, i, n]), M(() => () => l.current = !1, []), t ? [a ? oe(d, a) : d, f] : [a ? oe(e, a) : e, null]; + }, [t, y, o, i, n]), V(() => () => l.current = !1, []), t ? [a ? oe(d, a) : d, f] : [a ? oe(e, a) : e, null]; }, Qn = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: i, ...n }) => { - const r = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [a, o] = I(); - return M(() => { + const r = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [a, o] = L(); + return V(() => { r && se.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: Zn(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => o(E.createElement(s.default, n))); }, [r]), a; }, Zn = (t, e = {}, i = null) => (n) => { @@ -510,9 +510,9 @@ const Ii = Wt.getInstance(), Xt = E.forwardRef(({ listCode: t, base62params: e, return m.over([m.partialRight(m.pick, $), m.partialRight(m.omit, $)]); }, [e == null ? void 0 : e.extras]), [k, S] = C(g); return h(t, { ...S, value: y, rawValue: w, $setting: Object.assign({}, o, k) }); -}, Vi = ({ theme: t, basicForm: e, items: i = [{ key: "default", label: "默认" }], fields: n = [], itemRender: r, chunks: a = [], children: o, $setting: s = {}, ...l }) => { - const [u, d] = I(); - M(() => { +}, Mi = ({ theme: t, basicForm: e, items: i = [{ key: "default", label: "默认" }], fields: n = [], itemRender: r, chunks: a = [], children: o, $setting: s = {}, ...l }) => { + const [u, d] = L(); + V(() => { t ? se.getWidgetComponent(t).then((f) => { if (!(f != null && f.default)) throw "not found"; return f; @@ -523,26 +523,26 @@ const Ii = Wt.getInstance(), Xt = E.forwardRef(({ listCode: t, base62params: e, }, Di = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: a = 12, rowHeight: o = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: u = {}, formFields: d = [], fields: p = [], data: f, theme: g, themeProps: y = {}, groups: w = [{ key: "default", label: "默认" }], children: C, ...k }) => { const [S] = ie.useForm(e), $ = K(() => [{ name: "__PROPS__", value: u }].concat(d), [u, d]); ct(() => (S.setFieldsValue(f), () => S.resetFields()), [f]); - const T = (F, L, D) => { - const U = Yt(L, Qn, i); - return A("div", { className: O("ff-grid-layout", r), style: { ...n, "--grid-layout-item-margin-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-item-margin-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-container-padding-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-container-padding-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [U, D && E.cloneElement(D, { cols: a, rowHeight: o, itemMargin: l, containerPadding: s, fields: L, basicForm: i })] }); + const T = (O, j, D) => { + const U = Yt(j, Qn, i); + return A("div", { className: R("ff-grid-layout", r), style: { ...n, "--grid-layout-item-margin-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-item-margin-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-container-padding-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-container-padding-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [U, D && E.cloneElement(D, { cols: a, rowHeight: o, itemMargin: l, containerPadding: s, fields: j, basicForm: i })] }); }; - return h(ie, { ...k, fields: $, form: S, component: !1, children: g ? h(Vi, { ...y, items: w, theme: g, itemRender: T, fields: p, children: C, basicForm: i }) : T(0, p, C) }); + return h(ie, { ...k, fields: $, form: S, component: !1, children: g ? h(Mi, { ...y, items: w, theme: g, itemRender: T, fields: p, children: C, basicForm: i }) : T(0, p, C) }); }, oa = /* @__PURE__ */ ((t) => function({ code: e, data: i, ...n }) { const { uuid: r, resource: a, items: o, hides: s, rowHeight: l, marginX: u, marginY: d, cols: p, theme: f, themeProps: g, groups: y } = Yn(e) || {}, w = K(() => [{ name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: r }], [e, r, a]); return a && h(t, { name: e, theme: f, themeProps: g, groups: y, ...n, fields: o, formFields: w, rowHeight: l, cols: p, itemMargin: [u, d], data: a ? { [a]: i } : i }); -})(Di), er = ({ column: t = 0, colWidth: e = 0, cols: i, rowHeight: n, itemMargin: r, fields: a, primaryKey: o, dataSource: s, beforeRender: l = null, afterRender: u = null, itemClassName: d, itemRender: p = (S, $, T) => S, empty: f = h(Mt, { description: null }), className: g, style: y = {}, theme: w, themeProps: C = {}, groups: k = [{ key: "default", label: "默认" }] }) => { +})(Di), er = ({ column: t = 0, colWidth: e = 0, cols: i, rowHeight: n, itemMargin: r, fields: a, primaryKey: o, dataSource: s, beforeRender: l = null, afterRender: u = null, itemClassName: d, itemRender: p = (S, $, T) => S, empty: f = h(Vt, { description: null }), className: g, style: y = {}, theme: w, themeProps: C = {}, groups: k = [{ key: "default", label: "默认" }] }) => { const { classNames: S } = le(ne), $ = K(() => h(Di, { groups: k, theme: w, themeProps: C, cols: i, rowHeight: n, itemMargin: r, fields: a, className: d }), [a, i, n, r, k, w, C]), T = m.isEmpty(s); - return A("div", { className: O("ff-data-list-content", S.content, g), style: Object.assign({}, y, t && { "--col-num": t }, e && { "--col-width": e }), children: [l == null ? void 0 : l(s), T ? f : s.map((F, L) => { - const D = p(E.cloneElement($, { data: F }), F, L); - return E.cloneElement(D, { key: `${(F == null ? void 0 : F[o]) ?? L}-${On(F)}` }); + return A("div", { className: R("ff-data-list-content", S.content, g), style: Object.assign({}, y, t && { "--col-num": t }, e && { "--col-width": e }), children: [l == null ? void 0 : l(s), T ? f : s.map((O, j) => { + const D = p(E.cloneElement($, { data: O }), O, j); + return E.cloneElement(D, { key: `${(O == null ? void 0 : O[o]) ?? j}-${Rn(O)}` }); }), u == null ? void 0 : u(s)] }); }, tr = ({ component: t, $props: e }) => { const { base62params: i } = lt(e, {}); - return h(Y, { children: h(Xt, { listCode: t, base62params: j.decode(i) }) }); + return h(Y, { children: h(Xt, { listCode: t, base62params: I.decode(i) }) }); }, sa = () => h(zi, {}), zi = () => "Empty", ir = ({ component: t, $setting: e, $props: i }) => { - const [n, r] = I(); - M(() => { + const [n, r] = L(); + V(() => { if (!t) return r(h(zi, { description: null })); se.getWidgetComponent(t).catch((o) => ({ default: () => `${o}` })).then((o) => E.createElement(o.default, { $setting: e })).then(r); }, [t]); @@ -561,7 +561,7 @@ const ge = class ge { x(this, "get", (e) => (c(this, ae).has(e) || (e = Array.from(c(this, ae).keys()).find((i) => c(this, ae).get(i).uri === e)), c(this, ae).get(e) || {})); x(this, "redirect", (e, i, n = {}) => { const { uri: r, type: a, widgetProps: o } = this.get(e) || {}, { router: s, query: l, ...u } = i || {}, d = Object.assign({}, u, s), p = Object.assign({}, u, l); - a == "list" && (d.base62params = j.encode(d != null && d.base62params ? d.base62params : d)); + a == "list" && (d.base62params = I.encode(d != null && d.base62params ? d.base62params : d)); let f = Cn(r || e, d); const g = new URLSearchParams(); for (const y in o || {}) (o == null ? void 0 : o.type) == "query" && Object.has(p, y) && g.append(y, JSON.stringify(p[y])); @@ -618,7 +618,7 @@ const ge = class ge { }); x(this, "createBrowserRouter", (e = {}) => { if (c(this, ae).size == 0) return null; - const i = Ve.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Ve.get(se.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, a = (s, l) => () => Promise.all([se.getWidgetComponent(s), lt(l)]).then(([u, d]) => [u.default || function() { + const i = Me.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Me.get(se.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, a = (s, l) => () => Promise.all([se.getWidgetComponent(s), lt(l)]).then(([u, d]) => [u.default || function() { return `${s}`; }, d]).then(([u, d]) => ({ Component: () => E.createElement(Si, {}, E.createElement(u, { $setting: d })) })), o = Array.from(c(this, ae).values()).reduce((s, { uuid: l, uri: u, name: d, type: p, component: f, widgetSetting: g, widgetProps: y, isLogin: w, isLayout: C, extra: k }) => { let S = {}, $ = 0; @@ -631,8 +631,8 @@ const ge = class ge { } const T = (k == null ? void 0 : k.theme) ?? (k == null ? void 0 : k.layout); if (T) { - const F = (k == null ? void 0 : k.themeProps) ?? (k == null ? void 0 : k.layoutProps); - if (!r[T]) return r[T] = s.length, [...s, { path: "/", lazy: a(T, F), children: [{ path: u, ...S }] }]; + const O = (k == null ? void 0 : k.themeProps) ?? (k == null ? void 0 : k.layoutProps); + if (!r[T]) return r[T] = s.length, [...s, { path: "/", lazy: a(T, O), children: [{ path: u, ...S }] }]; $ = r[T]; } return C && $ > -1 ? (s[$].children.push({ path: u, ...S }), s) : [...s, { path: u, ...S }]; @@ -644,8 +644,8 @@ const ge = class ge { }; xe = new WeakMap(), ae = new WeakMap(), Pe = new WeakMap(), Te = new WeakMap(), et = new WeakMap(), tt = new WeakMap(), v(ge, xe, null), x(ge, "getInstance", () => (c(ge, xe) || B(ge, xe, new ge()), c(ge, xe))); let Ut = ge; -const nr = ({ to: t, replace: e }) => $i() ? E.createElement(Sn, { to: t, replace: e }) : (window.document.location = t, "redirect"), $e = Ut.getInstance(), De = new Worker(new URL("/ff-worker/index.js", self.location)), pi = { getConfigure: (t) => Ve.get(t), route: { redirect: (...t) => $e.redirect(...t), getPageParams: (...t) => $e.getPageParams(...t), getCurrentRoute: () => $e.getCurrentRoute() }, popup: { notification: (...t) => ee.notification(...t), success: (...t) => ee.success(...t), error: (...t) => ee.error(...t), form: (...t) => ee.form(...t), modal: (...t) => ee.modal(...t), confirm: (...t) => ee.confirm(...t) } }; -var vt, Ue, Oe; +const nr = ({ to: t, replace: e }) => $i() ? E.createElement(Sn, { to: t, replace: e }) : (window.document.location = t, "redirect"), $e = Ut.getInstance(), De = new Worker(new URL("/ff-worker/index.js", self.location)), pi = { getConfigure: (t) => Me.get(t), route: { redirect: (...t) => $e.redirect(...t), getPageParams: (...t) => $e.getPageParams(...t), getCurrentRoute: () => $e.getCurrentRoute() }, popup: { notification: (...t) => ee.notification(...t), success: (...t) => ee.success(...t), error: (...t) => ee.error(...t), form: (...t) => ee.form(...t), modal: (...t) => ee.modal(...t), confirm: (...t) => ee.confirm(...t) } }; +var vt, Ue, Re; const q = class q { constructor() { x(this, "exec", (e, i = {}, n = {}, r = "") => new Promise((a, o) => { @@ -654,7 +654,7 @@ const q = class q { c(q, Ue).set(s, n), q.mQueue.set(s, [a, o]), De.postMessage({ id: s, session: r, category: "eval", method: e, args: i }); })); x(this, "clear", (e) => De.postMessage({ session: e, category: "clear" })); - if (c(q, Oe)) return c(q, Oe); + if (c(q, Re)) return c(q, Re); Promise.resolve().then(() => Tr).then((e) => { pi.http = e.http; }), De.addEventListener("message", ({ data: { id: e, task_id: i, method: n, args: r, category: a, data: o, error: s, session: l } }) => { @@ -673,21 +673,21 @@ const q = class q { }, !1); } }; -vt = new WeakMap(), Ue = new WeakMap(), Oe = new WeakMap(), x(q, "mQueue", /* @__PURE__ */ new Map()), v(q, vt, 0), v(q, Ue, /* @__PURE__ */ new Map()), v(q, Oe, null), x(q, "getInstance", () => (c(q, Oe) || B(q, Oe, new q()), c(q, Oe))); +vt = new WeakMap(), Ue = new WeakMap(), Re = new WeakMap(), x(q, "mQueue", /* @__PURE__ */ new Map()), v(q, vt, 0), v(q, Ue, /* @__PURE__ */ new Map()), v(q, Re, null), x(q, "getInstance", () => (c(q, Re) || B(q, Re, new q()), c(q, Re))); let qt = q; -const Fe = qt.getInstance(), xt = () => { +const Oe = qt.getInstance(), xt = () => { const t = H(!0), [, e] = E.useReducer((i) => i + 1, 0); - return M(() => () => t.current = !1, []), () => t.current && e(); + return V(() => () => t.current = !1, []), () => t.current && e(); }, ca = (t) => { const e = H(); - return M(() => { + return V(() => { e.current = t; }, [t]), e.current; }, da = (t) => { - const [e, i] = I(t), n = H(null), r = X((a, o) => { + const [e, i] = L(t), n = H(null), r = X((a, o) => { n.current = o, i(a); }, []); - return M(() => { + return V(() => { n.current && (n.current(e), n.current = null); }, [e]), [e, r]; }, ct = (t = (n) => { @@ -700,33 +700,33 @@ const Fe = qt.getInstance(), xt = () => { for (let n = 0; n < t.length; n++) t[n].value = oe((i = t[n]) == null ? void 0 : i.value, e), t[n] && Reflect.has(t[n], "children") && (t[n].children = Bi(t[n].children, e)); return t; }, ua = (t, e = "json", i = "string", n, r = null) => { - const [a] = ie.useForm(n), [o, s] = I([{ label: "无", value: "", disabled: !0 }]), l = H([]), u = ie.useWatch((d) => l.current.length === 0 ? null : m.pick(d, l.current), a) || null; - return M(() => { - Array.isArray(t) ? s(t) : e === "javascript" && t ? Fe.exec(t, {}, { getFieldValue: (d) => (l.current.includes(d) || l.current.push(d), a.getFieldValue(d)), getFieldValueForBasicForm: (d) => (l.current.includes(d) || l.current.push(d), r ? r.getFieldValue(d) : a.getFieldValue(d)) }).then((d) => { + const [a] = ie.useForm(n), [o, s] = L([{ label: "无", value: "", disabled: !0 }]), l = H([]), u = ie.useWatch((d) => l.current.length === 0 ? null : m.pick(d, l.current), a) || null; + return V(() => { + Array.isArray(t) ? s(t) : e === "javascript" && t ? Oe.exec(t, {}, { getFieldValue: (d) => (l.current.includes(d) || l.current.push(d), a.getFieldValue(d)), getFieldValueForBasicForm: (d) => (l.current.includes(d) || l.current.push(d), r ? r.getFieldValue(d) : a.getFieldValue(d)) }).then((d) => { s(oe(d, "array")); }).catch((d) => console.error("useOptions", d)) : t && s(oe(t, "array")); }, [t, e, u]), Bi(o, i); }, pa = (t) => { - const [e, i] = I(), n = { type: "GET" }; + const [e, i] = L(), n = { type: "GET" }; if (typeof t == "string" ? n.url = t : m.isPlainObject(t) && Object.assign(n, t), !(n != null && n.url)) throw "url is required"; - const r = (a) => j.request(n, !1).resp((o) => (console.log("useSubscribeRequest", a), i(o), o)); + const r = (a) => I.request(n, !1).resp((o) => (console.log("useSubscribeRequest", a), i(o), o)); return ct(() => { let a = null; return r().then((o) => { - a = Ii.subscribe(m.throttle(r, 180, { leading: !1, trailing: !0 }), o.res); + a = Li.subscribe(m.throttle(r, 180, { leading: !1, trailing: !0 }), o.res); }), () => a == null ? void 0 : a(); }, n), e; }, rr = (t) => { const [e, i] = E.useState({ items: [], hides: [] }); return E.useEffect(() => { - t && j.get(`/api/_/${t}`).then(({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: d, marginY: p, listenChangeFields: f, listenChangeFieldsFunc: g, fields: y, theme: w, themeSetting: C, groups: k }) => ({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: d, marginY: p, theme: w, themeProps: C, groups: k, listenChangeFields: f, listenChangeFieldsFunc: g, ...y.reduce((S, $) => { + t && I.get(`/api/_/${t}`).then(({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: d, marginY: p, listenChangeFields: f, listenChangeFieldsFunc: g, fields: y, theme: w, themeSetting: C, groups: k }) => ({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: d, marginY: p, theme: w, themeProps: C, groups: k, listenChangeFields: f, listenChangeFieldsFunc: g, ...y.reduce((S, $) => { var T; return (T = $ == null ? void 0 : $.field) != null && T.hidden ? S.hides.push($ == null ? void 0 : $.field) : S.items.push($), S; }, { items: [], hides: [] }) })).then(i); }, [t]), e; }, ar = ({ max: t = 0, min: e = 0, type: i = "", message: n, pattern: r, required: a = !1, validator: o } = {}, s, l) => { - const [u, d] = I([]); - return M(() => { + const [u, d] = L([]); + return V(() => { const p = []; if (a) { let f = l; @@ -752,27 +752,27 @@ const Fe = qt.getInstance(), xt = () => { break; case "validator": o && p.push(({ getFieldValue: f }) => ({ validator: async (g, y) => { - const w = await Fe.exec(o, { value: y, fieldName: s }, { getFieldValue: f }); + const w = await Oe.exec(o, { value: y, fieldName: s }, { getFieldValue: f }); return m.isString(w) && w ? Promise.reject(w) : m.isBoolean(w) && !w ? Promise.reject(n) : Promise.resolve(); } })); } d(p); }, [t, e, i, n, r, a, o]), u; }, or = (t, e, i) => { - const [n, r] = I(null); - return M(() => { + const [n, r] = L(null); + return V(() => { const { initDataUri: a = `/api/${t}`, initDataMethod: o = "GET" } = i || {}; - e && j.request({ method: o, url: m.trimEnd(`${a}/${e}`, "/") }).then((s) => { + e && I.request({ method: o, url: m.trimEnd(`${a}/${e}`, "/") }).then((s) => { r(s); }); }, [t, e, i]), n; }, sr = (t, e, i) => X((n, r = { serialize: (a) => a, onSuccess: () => { }, onFail: (a) => (a == null ? void 0 : a.errorFields) && ee.error("请先完善表单信息", { duration: 2e3 }) }) => { const a = n.getFieldValue("__RESOURCE__"), { submitDataUri: o = `/api/${t}`, submitDataMethod: s = "POST" } = i || {}; - return n.validateFields().then((l) => a ? m.pick(l, [a]) : l).then(r.serialize).then((l) => j.request({ method: s, url: m.trimEnd(`${o}/${e || ""}`, "/"), data: l }).msg(r.onSuccess)).catch(r.onFail); + return n.validateFields().then((l) => a ? m.pick(l, [a]) : l).then(r.serialize).then((l) => I.request({ method: s, url: m.trimEnd(`${o}/${e || ""}`, "/"), data: l }).msg(r.onSuccess)).catch(r.onFail); }, [t, e, i]), lr = (t, e, i, n) => { const r = or(e, i, n); - M(() => { + V(() => { r ? t.setFieldsValue(r) : t.resetFields(); }, [t, r]); const a = sr(e, i, n); @@ -780,7 +780,7 @@ const Fe = qt.getInstance(), xt = () => { }, cr = (t, e, i = [], n = {}) => { const r = H({}), a = H(), o = m.debounce(xt(), 180), s = ["disabled", "required"], l = (f, g) => { s.includes(f) && (r.current[f] = g), o(); - }, u = K(() => ({ setDisabled: (f) => l("disabled", f), setRequired: (f) => l("required", f), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [e]), [d, p] = Mi(e, -1, {}, u, n); + }, u = K(() => ({ setDisabled: (f) => l("disabled", f), setRequired: (f) => l("required", f), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [e]), [d, p] = Vi(e, -1, {}, u, n); if (!p && a.current != d && (d >= 0 || !m.isEmpty(i == null ? void 0 : i[d]))) { a.current = d; const { widget: f, widgetPrefix: g, props: y } = i == null ? void 0 : i[d]; @@ -791,7 +791,7 @@ const Fe = qt.getInstance(), xt = () => { const n = H(), [r] = ie.useForm(i), a = H({}); return dt(() => { m.isEqual(n.current, t) || r.setFieldsValue(t); - }, [t]), M(() => () => r.resetFields(), []), [K(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (o) => (s) => { + }, [t]), V(() => () => r.resetFields(), []), [K(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (o) => (s) => { const l = gi(o); s ? a.current[l] = s : delete a.current[l]; } }, scrollToField: (o, s = {}) => { @@ -805,33 +805,33 @@ const Fe = qt.getInstance(), xt = () => { n.current = s, e == null || e(s); }]; }, Qt = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: i, subWidgets: n = [], basicForm: r, ...a }) => { - const o = xi(t, e), [s, l] = cr(o, i, n, r), [u, d] = I(); - return M(() => { + const o = xi(t, e), [s, l] = cr(o, i, n, r), [u, d] = L(); + return V(() => { s && se.getWidgetComponent(s).then(({ defaultProps: p = {}, default: f }) => ({ default: dr(f, p, r) })).catch((p) => ({ default: () => `${p}` })).then((p) => d(E.createElement(p.default, a))); }, [s]), u && E.cloneElement(u, { ...a, ...l }); }, dr = (t, e = {}, i = null) => (n) => { const { type: r, code: a, label: o, noStyle: s, style: l, placeholder: u, required: d = !1, extras: p, validators: f, help: g, isVirtual: y, $isReserved: w, initialValue: C, initialValueLanguage: k, ...S } = m.omit(m.merge({}, e, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), $ = ar(Object.assign({}, f, d ? { required: !0 } : {}), a, r), T = K(() => { - const R = Object.keys((e == null ? void 0 : e.extras) || {}); - return m.over([m.partialRight(m.pick, R), m.partialRight(m.omit, R)]); - }, [e == null ? void 0 : e.extras]), [F, L] = T(S), D = { label: o, noStyle: s, style: l, colon: !1, layout: "vertical" }, U = X((R) => R == null ? void 0 : oe(R, r), [r]); - return h(Jt, { name: a, rules: $, initialValue: U(C), normalize: U, children: (R, V, N) => { + const F = Object.keys((e == null ? void 0 : e.extras) || {}); + return m.over([m.partialRight(m.pick, F), m.partialRight(m.omit, F)]); + }, [e == null ? void 0 : e.extras]), [O, j] = T(S), D = { label: o, noStyle: s, style: l, colon: !1, layout: "vertical" }, U = X((F) => F == null ? void 0 : oe(F, r), [r]); + return h(Jt, { name: a, rules: $, initialValue: U(C), normalize: U, children: (F, M, N) => { var W; - return h(t, { type: r, rcform: N, basicForm: i, itemProps: { validateStatus: V.errors.length > 0 ? "error" : "success", tooltip: g || null, help: V.errors.length > 0 ? V.errors.join("、") : null, required: ((W = $ == null ? void 0 : $[0]) == null ? void 0 : W.required) || !1, ...D }, fieldProps: { placeholder: u, ...L, ...R }, $setting: Object.assign({}, p, F) }); + return h(t, { type: r, rcform: N, basicForm: i, itemProps: { validateStatus: M.errors.length > 0 ? "error" : "success", tooltip: g || null, help: M.errors.length > 0 ? M.errors.join("、") : null, required: ((W = $ == null ? void 0 : $[0]) == null ? void 0 : W.required) || !1, ...D }, fieldProps: { placeholder: u, ...j, ...F }, $setting: Object.assign({}, p, O) }); } }); -}, Zt = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: a = 24, rowHeight: o = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: u = [], hides: d = [], primaryKey: p = 0, formProps: f = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: w, onValuesChange: C, theme: k, themeProps: S = {}, groups: $ = [{ key: "default", label: "默认" }], children: T, ...F }) => { - const [L] = ie.useForm(e), D = X((V, N) => { - C == null || C(V, N), w && Array.isArray(y) && Fe.exec(w, { changedValues: V, allValues: N }, { getFieldValue: L.getFieldValue, setFieldValue: L.setFieldValue, setFieldsValue: L.setFieldsValue, isFieldTouched: L.isFieldTouched, isFieldsTouched: L.isFieldsTouched }).catch((W) => console.error("onFormValuesChange", t, W)); - }, [t, L, C, y, w]), U = K(() => [{ name: "__PROPS__", value: f }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, f, g]), R = (V, N, W) => { +}, Zt = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: a = 24, rowHeight: o = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: u = [], hides: d = [], primaryKey: p = 0, formProps: f = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: w, onValuesChange: C, theme: k, themeProps: S = {}, groups: $ = [{ key: "default", label: "默认" }], children: T, ...O }) => { + const [j] = ie.useForm(e), D = X((M, N) => { + C == null || C(M, N), w && Array.isArray(y) && Oe.exec(w, { changedValues: M, allValues: N }, { getFieldValue: j.getFieldValue, setFieldValue: j.setFieldValue, setFieldsValue: j.setFieldsValue, isFieldTouched: j.isFieldTouched, isFieldsTouched: j.isFieldsTouched }).catch((W) => console.error("onFormValuesChange", t, W)); + }, [t, j, C, y, w]), U = K(() => [{ name: "__PROPS__", value: f }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, f, g]), F = (M, N, W) => { const z = Yt(N, Qt, i); - return A("div", { className: O("ff-grid-layout-form", r), style: { ...n, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-container-padding-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [z, W && E.cloneElement(W, { cols: a, rowHeight: o, itemMargin: s, containerPadding: l, fields: N, basicForm: i })] }); + return A("div", { className: R("ff-grid-layout-form", r), style: { ...n, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-container-padding-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [z, W && E.cloneElement(W, { cols: a, rowHeight: o, itemMargin: s, containerPadding: l, fields: N, basicForm: i })] }); }; - return A(ie, { ...F, form: L, fields: U, onValuesChange: D, children: [k ? h(Vi, { ...S, items: $, theme: k, itemRender: R, fields: u, children: T, basicForm: i }) : R(0, u, T), d == null ? void 0 : d.map((V) => { + return A(ie, { ...O, form: j, fields: U, onValuesChange: D, children: [k ? h(Mi, { ...S, items: $, theme: k, itemRender: F, fields: u, children: T, basicForm: i }) : F(0, u, T), d == null ? void 0 : d.map((M) => { var N; - return h(Jt, { name: V.code, children: h(ur, { form: L, basicForm: i, name: V.code, type: V.type, initialValue: V.initialValue, initialValueLanguage: (N = V.extras) == null ? void 0 : N.initialValueLanguage }) }, JSON.stringify(V.code)); + return h(Jt, { name: M.code, children: h(ur, { form: j, basicForm: i, name: M.code, type: M.type, initialValue: M.initialValue, initialValueLanguage: (N = M.extras) == null ? void 0 : N.initialValueLanguage }) }, JSON.stringify(M.code)); })] }); }, ur = ({ type: t, initialValue: e, initialValueLanguage: i, onChange: n, basicForm: r }) => { - const [a, o] = Mi(i == "javascript" && e, i == "javascript" ? void 0 : e, {}, {}, r); - return M(() => { + const [a, o] = Vi(i == "javascript" && e, i == "javascript" ? void 0 : e, {}, {}, r); + return V(() => { i == "javascript" ? n(oe(a, t)) : e && n(oe(e, t)); }, [t, e, a]), null; }; @@ -852,7 +852,7 @@ const pr = /* @__PURE__ */ ((t) => ({ code: e, isPreview: i = !1, ...n }) => { Kt(t, e + 1); }), hi.add(i), document.body.appendChild(n); } -}, Ct = ({ className: t, type: e, style: i = {}, ...n }) => h("span", { role: "img", className: O("ff-iconfont", t), style: i, ...n, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); +}, Ct = ({ className: t, type: e, style: i = {}, ...n }) => h("span", { role: "img", className: R("ff-iconfont", t), style: i, ...n, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); Ct.propTypes = { className: b.string, type: b.string.isRequired, style: b.object }, Ct.init = Kt; const gr = (t, e, i, n) => $e.redirect(i, e, n), hr = (t, e = {}, i, n = {}) => { var a; @@ -861,14 +861,14 @@ const gr = (t, e, i, n) => $e.redirect(i, e, n), hr = (t, e = {}, i, n = {}) => if (!d && d !== 0 && l) throw `请传入 ${u}`; return `${o}/${d}`; }, `/api/${i}`); - return j.del(r, e.param).msg(); + return I.del(r, e.param).msg(); }, mi = (t, e, i, { status: { loading: n, disabled: r }, setStatus: a }) => { const o = { loading: (s) => s === void 0 ? n : a((l) => ({ ...l, loading: s })), disabled: (s) => s === void 0 ? r : a((l) => ({ ...l, disabled: s })) }; - return m.isFunction(i) ? i.call(null, { ...e, ...o }) : m.isString(i) && i ? Fe.exec(i, e, o) : null; + return m.isFunction(i) ? i.call(null, { ...e, ...o }) : m.isString(i) && i ? Oe.exec(i, e, o) : null; }, fi = (t, e, i, n, r) => m.isString(i) && i ? se.getWidgetComponent(i).then(({ default: a }) => ee.modal(a, { ...e, $setting: n }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r)).catch((a) => { ee.error(i, { content: a.toString() }); }) : ee.modal(i, { ...e, $setting: n }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), mr = (t, e, i, n, r) => ee.modal(Wi, { ...e, $setting: n, code: i }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), fr = (t, e, i, n, r) => ee.modal(Xt, { base62params: e, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), yr = ({ widget: t, widgetType: e, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s } = {}) => { - const l = le(ne), [u, d] = I({ leading: !0, trailing: !1 }), p = K(() => { + const l = le(ne), [u, d] = L({ leading: !0, trailing: !1 }), p = K(() => { switch (e) { case "redirect": return m.partialRight(gr, t, r); @@ -891,31 +891,31 @@ const gr = (t, e, i, n) => $e.redirect(i, e, n), hr = (t, e = {}, i, n = {}) => }, [t, e]); return [m.debounce((f) => (s == null || s(f), Promise.resolve(lt(n, f, { list: l })).then((g) => p(f, { ...i, ...g })).then((g) => o == null ? void 0 : o(g)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u]; }, Ui = ({ type: t, name: e, className: i, icon: n, iconPosition: r, size: a }, o = "default") => K(() => { - const s = { type: "primary", className: O("ff-button", i), iconPosition: r, size: a }; - return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), o === "link" || o === "dashed" ? (s.type = o, t === "default" && (s.className = O(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), n && (s.icon = h(Ct, { type: n })), e && (s.children = e), s; + const s = { type: "primary", className: R("ff-button", i), iconPosition: r, size: a }; + return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), o === "link" || o === "dashed" ? (s.type = o, t === "default" && (s.className = R(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), n && (s.icon = h(Ct, { type: n })), e && (s.children = e), s; }, [o, t, i, n, r]), Pt = ({ data: t, widget: e, widgetType: i = "fsdpf-component", widgetData: n, widgetProps: r, widgetSetting: a, widgetContainerProps: o, onAfterClick: s, onBeforeClick: l, children: u, extras: d }) => { - const p = le(ne), [f, g] = I(!1), [y, w] = I("hover"), [C, k] = I({}), [S, $] = I(), { placement: T, align: F, zIndex: L, arrow: D = { pointAtCenter: !0 }, getPopupContainer: U, isPopupMountBodyContainer: R = !0, ...V } = o || {}; - M(() => { + const p = le(ne), [f, g] = L(!1), [y, w] = L("hover"), [C, k] = L({}), [S, $] = L(), { placement: T, align: O, zIndex: j, arrow: D = { pointAtCenter: !0 }, getPopupContainer: U, isPopupMountBodyContainer: F = !0, ...M } = o || {}; + V(() => { i == "grid-layout-form" ? $(E.createElement(Wi, { ...n, $setting: a, code: e })) : i == "data-list" ? $(E.createElement(Xt, { base62params: t, $setting: a, listCode: e })) : m.isString(e) ? se.getWidgetComponent(e).then(({ default: z }) => { $(E.createElement(z, { ...n, $setting: a })); }).catch((z) => $(z.toString())) : ti(e) ? $(E.createElement(e, { ...n, $setting: a })) : E.isValidElement(e) && $(E.cloneElement(e, { ...n, $setting: a })); - }, [e, i, n]), M(() => { + }, [e, i, n]), V(() => { Promise.resolve(lt(r, t, { list: p })).then(k); }, [r, t, p.getBase62params]); const N = (z, Ee = !1) => (g(z), !z && w("hover"), z ? l == null ? void 0 : l(C) : s == null ? void 0 : s(Ee)), W = (z) => { g(!0), w("click"); }; - return h(fn, { zIndex: L, placement: T, onPopupClick: W, onClick: W, open: f, align: F, arrow: D, trigger: y, getPopupContainer: U || R ? void 0 : (z) => z, content: h(wr, { ...V, extras: d, children: S && E.cloneElement(S, { ...C, $close: (z) => N(!1, z) }) }), children: u, onOpenChange: N }); + return h(fn, { zIndex: j, placement: T, onPopupClick: W, onClick: W, open: f, align: O, arrow: D, trigger: y, getPopupContainer: U || F ? void 0 : (z) => z, content: h(wr, { ...M, extras: d, children: S && E.cloneElement(S, { ...C, $close: (z) => N(!1, z) }) }), children: u, onOpenChange: N }); }, wr = ({ title: t, className: e, classNames: i, children: n, extras: r, width: a, height: o, ...s }) => { - const [l, u] = I({}), d = X((y, w) => u((C) => ({ ...C, [y]: w })), []), p = X((y) => u((w) => ({ ...w, [y]: void 0 })), []), f = t ? E.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = r ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, r); - return h(st.Provider, { value: { ele: l, mount: d, unmount: p }, children: A("div", { className: O("ff-popup ff-popover", e, l.rootClassName), style: { width: a ?? 260, height: o }, ...s, children: [A("div", { className: O("ff-popup-header", "ff-popover-header", i == null ? void 0 : i.header), children: [f, l == null ? void 0 : l["sub-title"]] }), h("div", { className: O("ff-popup-body", "ff-popover-body", i == null ? void 0 : i.body), children: n }), A("div", { className: O("ff-popup-footer", "ff-popover-footer", i == null ? void 0 : i.footer), children: [g, l == null ? void 0 : l.extras, l == null ? void 0 : l.actions] })] }) }); + const [l, u] = L({}), d = X((y, w) => u((C) => ({ ...C, [y]: w })), []), p = X((y) => u((w) => ({ ...w, [y]: void 0 })), []), f = t ? E.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = r ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, r); + return h(st.Provider, { value: { ele: l, mount: d, unmount: p }, children: A("div", { className: R("ff-popup ff-popover", e, l.rootClassName), style: { width: a ?? 260, height: o }, ...s, children: [A("div", { className: R("ff-popup-header", "ff-popover-header", i == null ? void 0 : i.header), children: [f, l == null ? void 0 : l["sub-title"]] }), h("div", { className: R("ff-popup-body", "ff-popover-body", i == null ? void 0 : i.body), children: n }), A("div", { className: R("ff-popup-footer", "ff-popover-footer", i == null ? void 0 : i.footer), children: [g, l == null ? void 0 : l.extras, l == null ? void 0 : l.actions] })] }) }); }; Pt.propTypes = { widgetType: b.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; const ut = (t) => function({ className: e, variant: i, children: n, name: r, icon: a, type: o = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: u, onBeforeClick: d, data: p, loading: f, disabled: g, tooltip: y, confirm: w, widget: C = () => { -}, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: F, ...L }) { - const { mode: D, ...U } = F || {}, R = Ui({ className: e, name: r, type: o, icon: a, iconPosition: s }, i ?? t), V = h(wt, { ...R, ...L, children: n || r }); - if (D === "popover" && !["destroy", "redirect", "func"].includes(k)) return h(Pt, { data: p, widget: C, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: U, onAfterClick: u, onBeforeClick: d, children: V }); - const N = m.isEmpty(y) || !y.enabled ? {} : y, W = m.isEmpty(w) ? { enabled: !1 } : Object.assign({ enabled: !0 }, w), [z, Ee] = I(!1), [pt, { disabled: gt, loading: Tt }] = yr({ widget: C, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: U }, { onAfterClick: u, onBeforeClick: d }); +}, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: O, ...j }) { + const { mode: D, ...U } = O || {}, F = Ui({ className: e, name: r, type: o, icon: a, iconPosition: s }, i ?? t), M = h(wt, { ...F, ...j, children: n || r }); + if (D === "popover" && !["destroy", "redirect", "func"].includes(k)) return h(Pt, { data: p, widget: C, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: U, onAfterClick: u, onBeforeClick: d, children: M }); + const N = m.isEmpty(y) || !y.enabled ? {} : y, W = m.isEmpty(w) ? { enabled: !1 } : Object.assign({ enabled: !0 }, w), [z, Ee] = L(!1), [pt, { disabled: gt, loading: Tt }] = yr({ widget: C, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: U }, { onAfterClick: u, onBeforeClick: d }); return h(yn, { okText: "确定", cancelText: "取消", getPopupContainer: (te) => te, ...W, disabled: gt || g, open: z, onOpenChange: (te) => { if (!te) return Ee(te); W.enabled ? Ee(te) : pt(p); @@ -923,12 +923,12 @@ const ut = (t) => function({ className: e, variant: i, children: n, name: r, ico pt(p, te); }, onClick: (te) => { te.stopPropagation(); - }, children: h(wn, { getPopupContainer: (te) => te, ...N, title: z ? null : N == null ? void 0 : N.title, trigger: ["hover", "click"], children: E.cloneElement(V, { loading: Tt || f, disabled: gt || g }) }) }); + }, children: h(wn, { getPopupContainer: (te) => te, ...N, title: z ? null : N == null ? void 0 : N.title, trigger: ["hover", "click"], children: E.cloneElement(M, { loading: Tt || f, disabled: gt || g }) }) }); }, P = ut("default"); P.propTypes = { type: b.oneOf(["primary", "default", "danger", ""]), size: b.oneOf(["large", "middle", "small"]), name: b.string, icon: b.string, iconPosition: b.oneOf(["start", "end"]), data: b.any, widget: b.any, widgetType: b.oneOf(["destroy", "redirect", "func", "component", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: b.object, widgetProps: b.object, widgetSetting: b.object, widgetContainerProps: b.object, tooltip: b.exact({ title: b.string.isRequired, placement: b.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: b.oneOfType([b.bool, b.number]), getPopupContainer: b.func }), confirm: b.exact({ title: b.string.isRequired, cancelText: b.string, okText: b.string, okType: b.oneOf(["primary", "default", "danger", ""]), placement: b.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: b.oneOfType([b.bool, b.number]), getPopupContainer: b.func, arrow: b.oneOfType([b.bool, b.exact({ pointAtCenter: b.bool })]) }) }; const br = ut("link"), Cr = ut("circle"), kr = ut("round"), $r = ut("dashed"), yi = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: i = (g, y, w) => { }, onBeforeClick: n = (g, y, w) => { -}, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: u = (g, y) => h(P, { ...g, data: y }, g.uuid || It()), widgetContainerProps: d = {}, children: p, data: f }) => { +}, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: u = (g, y) => h(P, { ...g, data: y }, g.uuid || Lt()), widgetContainerProps: d = {}, children: p, data: f }) => { if (m.isEmpty(t)) return p; const [g, y] = K(() => (t || []).reduce((C, k) => { const S = e.indexOf(k.widgetType); @@ -942,12 +942,12 @@ yi.propTypes = { triggerWeights: b.array, options: b.arrayOf(b.shape({ ...P.prop const Er = ({ fields: t, formProps: e, $close: i }) => { const [n] = ie.useForm(), r = K(() => [{ name: "__PROPS__", value: e }], [e]); return h(Y, { actions: A(E.Fragment, { children: [h(P, { name: "取消", widget: () => i(!1) }), h(P, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(i) })] }), children: h(ie, { fields: r, form: n, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: a, ...o }) => h(Qt, { code: a, ...o }, a)) }) }); -}, Sr = ({ className: t, classNames: e, $close: i, children: n, title: r, subTitle: a, actions: o, extras: s, ...l }) => A(vn, { ...l, prefixCls: "ff-drawer", className: O("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (u) => ({ motionAppear: !0, motionName: `panel-motion-${u}` }), children: [A("div", { className: O("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: O("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: h(Gt, { type: "close" }) }), r, a] }), h("div", { className: O("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), A("div", { className: O("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, o] })] }), vr = ({ className: t, classNames: e, $close: i, $event: n, children: r, title: a, subTitle: o, actions: s, extras: l, placement: u, ...d }) => { +}, Sr = ({ className: t, classNames: e, $close: i, children: n, title: r, subTitle: a, actions: o, extras: s, ...l }) => A(vn, { ...l, prefixCls: "ff-drawer", className: R("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (u) => ({ motionAppear: !0, motionName: `panel-motion-${u}` }), children: [A("div", { className: R("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: R("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: h(Gt, { type: "close" }) }), r, a] }), h("div", { className: R("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), A("div", { className: R("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, o] })] }), vr = ({ className: t, classNames: e, $close: i, $event: n, children: r, title: a, subTitle: o, actions: s, extras: l, placement: u, ...d }) => { const p = (n == null ? void 0 : n.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: n == null ? void 0 : n.pageX, y: n == null ? void 0 : n.pageY } }; - return h(Nn, { ...d, ...p, prefixCls: "ff-modal", modalRender: () => A("div", { className: O("ff-modal-content ff-popup", t), children: [A("div", { className: O("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: O("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: d.onClose, children: h(Gt, { type: "close" }) }), a, o] }), h("div", { className: O("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: r }), A("div", { className: O("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] }) }); + return h(Nn, { ...d, ...p, prefixCls: "ff-modal", modalRender: () => A("div", { className: R("ff-modal-content ff-popup", t), children: [A("div", { className: R("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: R("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: d.onClose, children: h(Gt, { type: "close" }) }), a, o] }), h("div", { className: R("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: r }), A("div", { className: R("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] }) }); }, qi = ({ placement: t, $close: e, $event: i, children: n, title: r, ...a }) => { - const [o, s] = I({}), [l, u] = I(!0), d = X((y, w) => s((C) => ({ ...C, [y]: w })), []), p = X((y) => s((w) => ({ ...w, [y]: void 0 })), []); - let f = { ...a, className: o.rootClassName, title: o.title || r && E.createElement("div", { className: O("ff-popup-title") }, r), subTitle: o["sub-title"], actions: o.actions, extras: o.extras, children: n, $close: e, $event: i, onClose: () => u(!1) }; + const [o, s] = L({}), [l, u] = L(!0), d = X((y, w) => s((C) => ({ ...C, [y]: w })), []), p = X((y) => s((w) => ({ ...w, [y]: void 0 })), []); + let f = { ...a, className: o.rootClassName, title: o.title || r && E.createElement("div", { className: R("ff-popup-title") }, r), subTitle: o["sub-title"], actions: o.actions, extras: o.extras, children: n, $close: e, $event: i, onClose: () => u(!1) }; const g = () => { e(!1); }; @@ -959,7 +959,7 @@ const Z = () => { const { offsetHeight: o } = a; return { height: o }; }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = E.useReducer((a) => a + 1, 0); - M(() => { + V(() => { Z.$onClick = n, Z.$queue.forEach(([a, o, s], l, u) => { r([o, s], ...a), delete u[l]; }); @@ -984,13 +984,19 @@ Je.configure({ showSpinner: !1 }), Ae.interceptors.request.use((t) => { return t.headers.Authorization = e ? `Bearer ${e} ` : void 0, Je.inc(), t; }, (t) => (Je.done(), Promise.reject({ code: -1, msg: t }))), Ae.interceptors.response.use(({ data: t, headers: e }) => (Je.done(), { ...t, res: e == null ? void 0 : e.res }), function(t) { return Je.done(), Promise.reject(t.message); -}), window.addEventListener("unhandledrejection", jt.onUnhandledRejection), jt.onMsg = (t, e) => ee[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && $e.redirect(Ve.get("Common.WEBSITE_LOGIN_PAGE"))); -var qe, Me, Ke; +}), window.addEventListener("unhandledrejection", It.onUnhandledRejection), It.onMsg = (t, e) => ee[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && $e.redirect(Me.get("Common.WEBSITE_LOGIN_PAGE"))); +var qe, Ve, Ke; const J = class J { constructor() { x(this, "appUrl", ""); v(this, qe, null); - return c(J, Me) || (B(J, Ke, new jt()), B(J, Me, new Proxy(this, { get: (e, i) => i in e ? typeof e[i] == "function" ? e[i].bind(e) : e[i] : c(J, Ke)[i] }))), c(J, Me); + return c(J, Ve) || (B(J, Ke, new It()), B(J, Ve, new Proxy(this, { get(e, i) { + if (i in e) { + const n = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), i); + return n != null && n.get ? Reflect.get(e, i, e) : typeof e[i] == "function" ? e[i].bind(e) : e[i]; + } + return c(J, Ke)[i]; + } }))), c(J, Ve); } init(e, i, n) { Ae.defaults.baseURL = this.appUrl = n, Ae.defaults.timeout = 15e3, c(J, Ke).init(e, i, Ae); @@ -1006,9 +1012,9 @@ const J = class J { (e = c(this, qe)) == null || e.restore(), B(this, qe, null); } }; -qe = new WeakMap(), Me = new WeakMap(), Ke = new WeakMap(), v(J, Me), v(J, Ke), x(J, "getInstance", () => c(J, Me) ?? B(J, Me, new J())); +qe = new WeakMap(), Ve = new WeakMap(), Ke = new WeakMap(), v(J, Ve), v(J, Ke), x(J, "getInstance", () => c(J, Ve) ?? B(J, Ve, new J())); let Ht = J; -const j = Ht.getInstance(); +const I = Ht.getInstance(); class ei extends Error { constructor(e, i) { super(i), Error.captureStackTrace && Error.captureStackTrace(this, ei), !i instanceof Ge && (this.name = `${e} Error Runtime`); @@ -1019,8 +1025,8 @@ class Ge extends Error { super(...i), Error.captureStackTrace && Error.captureStackTrace(this, Ge), this.name = `${e} Not Found`; } } -const Lt = "mine", yt = "token"; -var Re, He; +const jt = "mine", yt = "token"; +var Fe, He; const he = class he { constructor() { v(this, He, /* @__PURE__ */ new Map()); @@ -1041,16 +1047,16 @@ const he = class he { const [, i] = e == null ? void 0 : e.split("@pkg/"); if (!i) throw new Ge(e); try { - return c(this, He).has("pkg") ? await c(this, He).get("pkg").get(i) : await import(`${j.appUrl}/api/pkg-import/web?name=${e}`); + return c(this, He).has("pkg") ? await c(this, He).get("pkg").get(i) : await import(`${I.appUrl}/api/pkg-import/web?name=${e}`); } catch (n) { throw new ei(e, n); } }); - x(this, "getRoutes", () => j.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: i, ...n }) => [i, { uuid: i, ...n }])).then((e) => new Map(e))); - x(this, "getMenus", () => j.get("/api/my-menu")); - x(this, "getConfigure", () => j.get("api/init-configure")); - x(this, "getWidgetOperationAuth", () => j.get("/api/init-widget-operation-auth").then((e) => e.reduce((i, { uuid: n, auth: r }) => [...i, [n, r]], []))); - x(this, "getPhoneNumber", (e) => j.get(`/api/user-wx-phone-number/${e}`)); + x(this, "getRoutes", () => I.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: i, ...n }) => [i, { uuid: i, ...n }])).then((e) => new Map(e))); + x(this, "getMenus", () => I.get("/api/my-menu")); + x(this, "getConfigure", () => I.get("api/init-configure")); + x(this, "getWidgetOperationAuth", () => I.get("/api/init-widget-operation-auth").then((e) => e.reduce((i, { uuid: n, auth: r }) => [...i, [n, r]], []))); + x(this, "getPhoneNumber", (e) => I.get(`/api/user-wx-phone-number/${e}`)); x(this, "getUserToken", () => { const e = window.localStorage.getItem(yt); if (!e) return ""; @@ -1072,23 +1078,23 @@ const he = class he { try { const n = this.getUserToken(); if (!n) return Promise.resolve(null); - const { iat: r } = JSON.parse(window.atob((i = n == null ? void 0 : n.split(".")) == null ? void 0 : i[1])), { iat: a, ...o } = j.decode(window.localStorage.getItem(Lt) || "", {}); - return a === r ? Promise.resolve(o) : j.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(Lt, j.encode({ ...s, iat: r })), s)); + const { iat: r } = JSON.parse(window.atob((i = n == null ? void 0 : n.split(".")) == null ? void 0 : i[1])), { iat: a, ...o } = I.decode(window.localStorage.getItem(jt) || "", {}); + return a === r ? Promise.resolve(o) : I.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(jt, I.encode({ ...s, iat: r })), s)); } catch (n) { console.error(n), e && ee.error("请登录").then(this.logout); } return Promise.resolve(null); }); - x(this, "login", (e, i, n = {}) => j.post("/api/user-token", { username: e, passwd: cn.hash(i), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(yt, r), r)).then(async (r) => (await this.initAppEnv(), r))); - x(this, "logout", (e) => (window.localStorage.removeItem(Lt), window.localStorage.removeItem(yt), e == null ? void 0 : e())); + x(this, "login", (e, i, n = {}) => I.post("/api/user-token", { username: e, passwd: cn.hash(i), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(yt, r), r)).then(async (r) => (await this.initAppEnv(), r))); + x(this, "logout", (e) => (window.localStorage.removeItem(jt), window.localStorage.removeItem(yt), e == null ? void 0 : e())); x(this, "initAppEnv", async () => { const [e, i, n, r] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); - return Ni.init(e), Ve.init(r), $e.init(i, n), Ct.init(Ve.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: i, menus: n, configures: r }; + return Ni.init(e), Me.init(r), $e.init(i, n), Ct.init(Me.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: i, menus: n, configures: r }; }); - if (c(he, Re)) return c(he, Re); + if (c(he, Fe)) return c(he, Fe); } }; -Re = new WeakMap(), He = new WeakMap(), v(he, Re, null), x(he, "getInstance", () => (c(he, Re) || B(he, Re, new he()), c(he, Re))); +Fe = new WeakMap(), He = new WeakMap(), v(he, Fe, null), x(he, "getInstance", () => (c(he, Fe) || B(he, Fe, new he()), c(he, Fe))); let _t = he; const se = _t.getInstance(), Nr = E.createContext({ user: {}, initUser: () => { }, initUserComplete: !1 }), xr = E.createContext({ set: () => { @@ -1099,7 +1105,7 @@ const se = _t.getInstance(), Nr = E.createContext({ user: {}, initUser: () => { if (!t || typeof window > "u") return; let i = document.querySelector(`style[ff-style-token="${e}"]`); return i ? (i.innerHTML = t, t) : (i = document.createElement("style"), i.setAttribute("ff-style-token", e), i.setAttribute("type", "text/css"), i.innerHTML = t, document.head.appendChild(i), t); -}, Tr = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Nr, AppGlobalParamsContext: xr, cache: Ei, configure: Ve, default: se, func: Fe, http: j, insertStyle: Pr, isReactComponent: ti, route: $e }, Symbol.toStringTag, { value: "Module" })); +}, Tr = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Nr, AppGlobalParamsContext: xr, cache: Ei, configure: Me, default: se, func: Oe, http: I, insertStyle: Pr, isReactComponent: ti, route: $e }, Symbol.toStringTag, { value: "Module" })); var Ce, _e, ke, me, fe, Q, G, _, ye, it, nt, rt, at, Nt, ot; const ii = class ii { constructor(e, i = "/") { @@ -1349,7 +1355,7 @@ const ii = class ii { }; Ce = new WeakMap(), _e = new WeakMap(), ke = new WeakMap(), me = new WeakMap(), fe = new WeakMap(), Q = new WeakMap(), G = new WeakMap(), _ = new WeakMap(), ye = new WeakMap(), it = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), at = new WeakMap(), Nt = new WeakMap(), ot = new WeakMap(); let bi = ii; -const Or = async (t, e = "/", i = "") => { +const Rr = async (t, e = "/", i = "") => { try { const n = await t.stat(e), r = e === "/" ? "/" : ce.basename(e), a = { title: r, key: i ? `${i}${e}` : e, isLeaf: n.isFile() }; if (n.isDirectory()) { @@ -1369,7 +1375,7 @@ const Or = async (t, e = "/", i = "") => { for (const u of [...s, ...l]) { const d = e === "/" ? `/${u}` : `${e}/${u}`; try { - const p = await Or(t, d, i); + const p = await Rr(t, d, i); a.children.push(p); } catch (p) { console.warn(`Failed to process ${d}:`, p.message); @@ -1384,7 +1390,7 @@ const Or = async (t, e = "/", i = "") => { }; export { xt as $, - Li as A, + ji as A, Ai as B, Hn as C, bt as D, @@ -1398,15 +1404,15 @@ export { er as L, Dn as M, Bn as N, - In as O, - jn as P, + Ln as O, + In as P, ia as Q, - Ii as R, + Li as R, na as S, - Ri as T, + Fi as T, Bt as U, - Mn as V, - Vn as W, + Vn as V, + Mn as W, tr as X, ir as Y, sa as Z, @@ -1426,7 +1432,7 @@ export { Nr as aB, xr as aC, bi as aD, - Or as aE, + Rr as aE, rr as aa, ar as ab, or as ac, @@ -1449,10 +1455,10 @@ export { se as at, ti as au, Pr as av, - j as aw, + I as aw, Ei as ax, - Ve as ay, - Fe as az, + Me as ay, + Oe as az, Tn as b, lt as c, Pi as d, @@ -1460,22 +1466,22 @@ export { Zr as f, Pn as g, ea as h, - On as i, - Fn as j, + Rn as i, + On as j, ta as k, - Fi as l, - Rn as m, + Oi as l, + Fn as m, ra as n, Yt as o, - ji as p, + Ii as p, Di as q, - Ft as r, + Ot as r, Qn as s, oe as t, Xr as u, - Vi as v, + Mi as v, Yn as w, Xn as x, aa as y, - Mi as z + Vi as z }; diff --git a/dist/components.js b/dist/components.js index 51c40f7..c0d9ba1 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,4 +1,4 @@ -import { aq as s, ah as p, ar as n, as as r, ap as t } from "./common/main-BNMEkn4Y.js"; +import { aq as s, ah as p, ar as n, as as r, ap as t } from "./common/main-D7LpJB9E.js"; export { s as Empty, p as Icon, diff --git a/dist/container.js b/dist/container.js index bf6c23b..606f811 100644 --- a/dist/container.js +++ b/dist/container.js @@ -1,4 +1,4 @@ -import { am as s, aq as e, ar as p, as as n, an as t, ap as d, ao as r, al as u } from "./common/main-BNMEkn4Y.js"; +import { am as s, aq as e, ar as p, as as n, an as t, ap as d, ao as r, al as u } from "./common/main-D7LpJB9E.js"; export { s as Context, e as Empty, diff --git a/dist/data-converter.js b/dist/data-converter.js index 0d023a7..8c4acc2 100644 --- a/dist/data-converter.js +++ b/dist/data-converter.js @@ -1,6 +1,6 @@ import "lodash"; import "react"; -import { D as p } from "./common/main-BNMEkn4Y.js"; +import { D as p } from "./common/main-D7LpJB9E.js"; export { p as default }; diff --git a/dist/data-list.js b/dist/data-list.js index b17c9f0..5a82816 100644 --- a/dist/data-list.js +++ b/dist/data-list.js @@ -1,4 +1,4 @@ -import { L as t, J as e, B as r, F as o, M as i, I as l, E as u, K as D, C as n, N as L, A as C, P as m, O as p, W as b, S as c, U as F, T as d, V as O, Q as S } from "./common/main-BNMEkn4Y.js"; +import { L as t, J as e, B as r, F as o, M as i, I as l, E as u, K as D, C as n, N as L, A as C, P as m, O as p, W as b, S as c, U as F, T as d, V as O, Q as S } from "./common/main-D7LpJB9E.js"; export { t as DataListContent, e as DataListContext, diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index d60bbc9..3f3c5ab 100644 --- a/dist/data-list/utils.js +++ b/dist/data-list/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { p as t } from "../common/main-BNMEkn4Y.js"; +import { p as t } from "../common/main-D7LpJB9E.js"; export { t as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index cdcbfa7..2f98af9 100644 --- a/dist/grid-layout-form.js +++ b/dist/grid-layout-form.js @@ -1,4 +1,4 @@ -import { a7 as s, a9 as r, a8 as u, a6 as o, z as t, ae as m, ac as d, ad as F, ag as i, ab as g, aa as c, af as l } from "./common/main-BNMEkn4Y.js"; +import { a7 as s, a9 as r, a8 as u, a6 as o, z as t, ae as m, ac as d, ad as F, ag as i, ab as g, aa as c, af as l } from "./common/main-D7LpJB9E.js"; export { s as GridLayoutForm, r as GridLayoutFormHelper, diff --git a/dist/grid-layout-form/utils.js b/dist/grid-layout-form/utils.js index 4477559..671da67 100644 --- a/dist/grid-layout-form/utils.js +++ b/dist/grid-layout-form/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { a as o, g } from "../common/main-BNMEkn4Y.js"; +import { a as o, g } from "../common/main-D7LpJB9E.js"; export { o as getNormalizeWidget, g as getOptionItemByValue diff --git a/dist/grid-layout.js b/dist/grid-layout.js index 212d151..0c7b8b8 100644 --- a/dist/grid-layout.js +++ b/dist/grid-layout.js @@ -1,4 +1,4 @@ -import { q as u, v as e, s as r, H as t, G as d, x as i, z as o, y, w as G } from "./common/main-BNMEkn4Y.js"; +import { q as u, v as e, s as r, H as t, G as d, x as i, z as o, y, w as G } from "./common/main-D7LpJB9E.js"; export { u as GridLayout, e as GridLayoutFramework, diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index b6fe0de..b78a898 100644 --- a/dist/grid-layout/utils.js +++ b/dist/grid-layout/utils.js @@ -1,4 +1,4 @@ -import { l as t, o as a, n as l } from "../common/main-BNMEkn4Y.js"; +import { l as t, o as a, n as l } from "../common/main-D7LpJB9E.js"; export { t as getBoxStyle, a as getNormalizeFields, diff --git a/dist/hooks.js b/dist/hooks.js index 1455911..302bfd9 100644 --- a/dist/hooks.js +++ b/dist/hooks.js @@ -1,7 +1,7 @@ import "lodash"; import "rc-field-form"; import "react"; -import { a3 as r, a2 as o, a4 as p, a0 as f, a1 as i, a5 as m, $ as c } from "./common/main-BNMEkn4Y.js"; +import { a3 as r, a2 as o, a4 as p, a0 as f, a1 as i, a5 as m, $ as c } from "./common/main-D7LpJB9E.js"; import { default as b } from "rc-util/lib/hooks/useMergedState"; export { r as useDeepEffect, diff --git a/dist/iconfont.js b/dist/iconfont.js index ce7e146..abfe4e2 100644 --- a/dist/iconfont.js +++ b/dist/iconfont.js @@ -2,7 +2,7 @@ import "react/jsx-runtime"; import "react"; import "prop-types"; import "classnames"; -import { ah as a } from "./common/main-BNMEkn4Y.js"; +import { ah as a } from "./common/main-D7LpJB9E.js"; export { a as default }; diff --git a/dist/index.js b/dist/index.js index 2247961..d9d3972 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -import { aB as s, aC as e, ax as o, ay as n, at as p, az as r, aw as c, av as u, au as f, aA as l } from "./common/main-BNMEkn4Y.js"; +import { aB as s, aC as e, ax as o, ay as n, at as p, az as r, aw as c, av as u, au as f, aA as l } from "./common/main-D7LpJB9E.js"; export { s as AppContext, e as AppGlobalParamsContext, diff --git a/dist/pages.js b/dist/pages.js index 38a72be..6551305 100644 --- a/dist/pages.js +++ b/dist/pages.js @@ -1,4 +1,4 @@ -import { Y as t, X as e, Z as o, _ as g } from "./common/main-BNMEkn4Y.js"; +import { Y as t, X as e, Z as o, _ as g } from "./common/main-D7LpJB9E.js"; export { t as CustomPage, e as DataListPage, diff --git a/dist/res-ws.js b/dist/res-ws.js index 942107a..6f600a6 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-BNMEkn4Y.js"; +import { R as a } from "./common/main-D7LpJB9E.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index e7db01d..5f475d8 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { d as s, f as i, e as g, h as m, b as o, k as P, c as p, j as d, i as h, m as k, r as f, t as u, u as l } from "./common/main-BNMEkn4Y.js"; +import { d as s, f as i, e as g, h as m, b as o, k as P, c as p, j as d, i as h, m as k, r as f, t as u, u as l } from "./common/main-D7LpJB9E.js"; import "./common/vender-BkiRbACr.js"; export { s as deepSome, diff --git a/dist/virtual-fs.js b/dist/virtual-fs.js index 738d372..30e3917 100644 --- a/dist/virtual-fs.js +++ b/dist/virtual-fs.js @@ -1,5 +1,5 @@ import "pathe"; -import { aD as o, aE as r } from "./common/main-BNMEkn4Y.js"; +import { aD as o, aE as r } from "./common/main-D7LpJB9E.js"; export { o as default, r as toTreePaths diff --git a/package.json b/package.json index 7a47ab4..2377083 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.6.27", + "version": "0.6.28", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js",