From a7245be7415cd148e94c2ad97790274e6f96ce73 Mon Sep 17 00:00:00 2001 From: what Date: Wed, 17 Sep 2025 16:45:18 +0800 Subject: [PATCH] v0.5.11 --- dist/button.js | 2 +- dist/common/main-C_FS7g0q.js | 1071 -------------------------------- dist/common/main-DnobNY7x.js | 1068 +++++++++++++++++++++++++++++++ dist/components.js | 2 +- dist/container.js | 2 +- dist/data-converter.js | 2 +- dist/data-list.js | 6 +- dist/data-list/utils.js | 2 +- dist/grid-layout-form.js | 2 +- dist/grid-layout-form/utils.js | 2 +- dist/grid-layout.js | 2 +- dist/grid-layout/utils.js | 2 +- dist/hooks.js | 6 +- dist/iconfont.js | 2 +- dist/index.js | 2 +- dist/pages.js | 2 +- dist/res-ws.js | 2 +- dist/utils.js | 23 +- package.json | 2 +- 19 files changed, 1098 insertions(+), 1104 deletions(-) delete mode 100644 dist/common/main-C_FS7g0q.js create mode 100644 dist/common/main-DnobNY7x.js diff --git a/dist/button.js b/dist/button.js index 21b5264..086ddd2 100644 --- a/dist/button.js +++ b/dist/button.js @@ -1,4 +1,4 @@ -import { aa as s, a9 as u, ab as e } from "./common/main-C_FS7g0q.js"; +import { a9 as s, a8 as u, aa as e } from "./common/main-DnobNY7x.js"; export { s as auth, u as default, diff --git a/dist/common/main-C_FS7g0q.js b/dist/common/main-C_FS7g0q.js deleted file mode 100644 index 2b5f7d2..0000000 --- a/dist/common/main-C_FS7g0q.js +++ /dev/null @@ -1,1071 +0,0 @@ -var Oi = Object.defineProperty; -var Lt = (e) => { - throw TypeError(e); -}; -var ji = (e, t, i) => t in e ? Oi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i; -var v = (e, t, i) => ji(e, typeof t != "symbol" ? t + "" : t, i), At = (e, t, i) => t.has(e) || Lt("Cannot " + i); -var y = (e, t, i) => (At(e, t, "read from private field"), i ? i.call(e) : t.get(e)), O = (e, t, i) => t.has(e) ? Lt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), H = (e, t, i, n) => (At(e, t, "write to private field"), n ? n.call(e, i) : t.set(e, i), i); -var Vt = (e, t, i, n) => ({ - set _(r) { - H(e, t, r, i); - }, - get _() { - return y(e, t, n); - } -}); -import { jsx as p, jsxs as j } from "react/jsx-runtime"; -import x, { useEffect as A, useState as E, useCallback as X, useMemo as U, useRef as W, useContext as ce, useId as Qe, isValidElement as Li, useLayoutEffect as Ai } from "react"; -import w from "prop-types"; -import M from "classnames"; -import * as It from "react-is"; -import { useNotification as Vi } from "rc-notification"; -import d from "lodash"; -import te, { FieldContext as Yt, Field as Xt } from "rc-field-form"; -import { M as dt, N as je, a as Le, P as mt, S as Ii } from "./vender-CtjyT19B.js"; -import Qt from "immutability-helper"; -import { Form as Ye, Input as Mi, Button as Ze, Pagination as zi, Tree as Bi, Breadcrumb as Di, Table as qi, Empty as Wi, Popconfirm as Ui, Tooltip as Hi, Popover as Ji } from "antd"; -import { useMergedState as Ki } from "rc-util"; -import { generatePath as _i, useInRouterContext as Zt, useParams as Gi, useLocation as Yi, createBrowserRouter as Xi, Navigate as Qi } from "react-router-dom"; -import "rc-util/lib/hooks/useMergedState"; -import Zi from "rc-drawer"; -import en from "rc-dialog"; -var Ne, Ie, Re, ue, Se, ve; -class ei { - constructor(t, i) { - O(this, Ne, /* @__PURE__ */ new Map()); - O(this, Ie, !0); - O(this, Re, []); - O(this, ue); - O(this, Se, () => y(this, ue)); - O(this, ve, () => Promise.resolve()); - v(this, "get", (...t) => new Promise((i, n) => { - const r = JSON.stringify(t); - if (y(this, Ne).has(r)) return i(y(this, ve).call(this, y(this, ue), ...t)); - if (y(this, ue) === void 0) y(this, Re).push([t, i, n]), y(this, Ie) && (H(this, Ie, !1), Promise.resolve(typeof y(this, Se) == "function" ? y(this, Se).call(this) : y(this, Se)).then((a) => H(this, ue, a || null)).finally(() => { - y(this, Re).forEach(([a, o, s]) => { - try { - const l = y(this, ve).call(this, y(this, ue), ...a); - y(this, Ne).set(JSON.stringify(a), l), o(l); - } catch (l) { - s(l); - } - }), y(this, Re).length = 0; - })); - else { - const a = y(this, ve).call(this, y(this, ue), ...t); - y(this, Ne).set(r, a), i(a); - } - })); - H(this, ve, i), H(this, Se, t); - } -} -Ne = new WeakMap(), Ie = new WeakMap(), Re = new WeakMap(), ue = new WeakMap(), Se = new WeakMap(), ve = new WeakMap(); -const gr = () => p("div", { children: "Empty" }), We = x.createContext({ ele: {}, mount: () => { -}, unmount: () => { -} }), Y = ({ rootClassName: e, className: t, children: i, actions: n, title: r, subTitle: a, extras: o, style: s = {} }) => { - const { mount: l, unmount: u } = x.useContext(We); - return Y.Action({ children: n }), Y.Title({ children: r }), Y.SubTitle({ children: a }), Y.Extra({ children: o }), A(() => (l("rootClassName", e), () => u(e)), [e]), p("div", { className: M("ff-container", t), style: s, children: i }); -}, Ge = (e) => ({ children: t, className: i }) => { - const { mount: n, unmount: r } = x.useContext(We); - return A(() => (t && n(e, x.createElement("div", { key: `ff-${e}`, className: M(`ff-popup-${e}`, i) }, t)), () => r(e)), [i, t]), null; -}; -Y.Action = Ge("actions"), Y.Title = Ge("title"), Y.SubTitle = Ge("sub-title"), Y.Extra = Ge("extras"), Y.propTypes = { className: w.string, style: w.object, title: w.any, subTitle: w.any, actions: w.any, extras: w.any }; -const pr = () => p(Y, { className: "ff-loading", children: j("div", { className: "loader", children: [j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] })] }) }), mr = () => p("div", { children: "NotFound" }), ti = ({ children: e }) => { - const [t, i] = E({}), n = X((a, o) => i((s) => ({ ...s, [a]: o })), []), r = X((a) => i((o) => ({ ...o, [a]: void 0 })), []); - return typeof (e == null ? void 0 : e.type) == "string" ? e : p(We.Provider, { value: { ele: t, mount: n, unmount: r }, children: x.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) }); -}; -ti.propTypes = { children: w.element.isRequired }; -const Mt = { 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"] }, $t = ({ type: e, props: t }) => p("i", { ...t, children: p("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Mt[e] || Mt.info).map((i, n) => p("path", { d: i }, n)) }) }), ii = ({ className: e, content: t, icon: i, $close: n }) => j(x.Fragment, { children: [i && p("div", { className: M("ff-notification-icon", e), children: p($t, { type: i }) }), t] }), tn = ({}) => p(Y, { children: "Confirm" }); -var pe, Fe; -const ne = class ne { - constructor() { - O(this, Fe, /* @__PURE__ */ new Map()); - v(this, "init", (t) => H(this, Fe, new Map(t))); - v(this, "check", (t) => !y(this, Fe).has(t) || y(this, Fe).get(t)); - if (y(ne, pe)) return y(ne, pe); - } -}; -pe = new WeakMap(), Fe = new WeakMap(), O(ne, pe, null), v(ne, "getInstance", () => (y(ne, pe) || H(ne, pe, new ne()), y(ne, pe))); -let ht = ne; -const nn = ht.getInstance(), rn = (e, t, i = "children") => { - if (d.isEmpty(e)) return {}; - const n = d.find(e, ["value", t]); - if (!d.isEmpty(n)) return n; - const r = e.length; - for (let a = 0; a < r; a++) { - const { [i]: o } = e[a], s = rn(o, t, i); - if (!d.isEmpty(s)) return s; - } - return {}; -}, ni = (e = "Input", t = "@pkg/ff/grid-layout-forms") => e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`; -var me, Me; -const re = class re { - constructor() { - O(this, Me, null); - v(this, "init", (t) => H(this, Me, t)); - v(this, "get", (t, i) => d.get(y(this, Me), t, i)); - if (y(re, me)) return y(re, me); - } -}; -me = new WeakMap(), Me = new WeakMap(), O(re, me, null), v(re, "getInstance", () => (y(re, me) || H(re, me, new re()), y(re, me))); -let ft = re; -const Ae = ft.getInstance(), zt = { null2json: (e) => Object.create(), null2array: (e) => [], null2number: (e) => 0, null2bool: (e) => !1, null2string: (e) => "", null2integer: (e) => 0, null2float: (e) => 0, string2json: (e) => e ? JSON.parse(e) : "{}", string2array: (e) => e.substr(0, 1) === "[" && e.substr(-1) === "]" ? JSON.parse(e) : e.split(","), string2number: (e) => e == "" ? 0 : +e, string2integer: (e) => e == "" ? 0 : +e, string2float: (e) => e == "" ? 0 : +e, string2bool: (e) => { - switch (`${e}`.toLowerCase()) { - case "0": - case "false": - case "[]": - case "{}": - return !1; - } - return !!e; -}, string2string: (e) => e, json2json: (e) => e, json2array: (e) => e ? Object.values(e) : [], json2number: (e) => Object.keys(e).length, json2integer: (e) => Object.keys(e).length, json2float: (e) => Object.keys(e).length, json2bool: (e) => Object.keys(e).length > 0, json2string: (e) => e ? JSON.stringify(e) : "", array2json: (e) => ({ ...e }), array2array: (e) => e, array2number: (e) => e.length, array2integer: (e) => e.length, array2float: (e) => e.length, array2bool: (e) => e.length > 0, array2string: (e) => JSON.stringify(e), number2json: (e) => ({}), number2array: (e) => [e], number2number: (e) => e, number2integer: (e) => e, number2float: (e) => e, number2bool: (e) => !!e, number2string: (e) => e.toString(), boolean2json: (e) => ({}), boolean2array: (e) => [], boolean2number: (e) => +e, boolean2integer: (e) => +e, boolean2float: (e) => +e, boolean2bool: (e) => e, boolean2string: (e) => e ? "true" : "false" }, ee = (e, t) => { - let i = "string"; - i = Array.isArray(e) ? "array" : typeof e, d.isObject(e) && (i = "json"); - const n = `${i}2${t}`; - return Reflect.has(zt, n) ? zt[n](e) : e; -}, Ue = (e = {}, t = {}, i = {}, n = "") => ri(e, (r, a) => a === "type" && r === "code") ? ai(e, t, i, n) : si(e, t, n), ri = (e, t = () => !1) => d.some(e, (i) => !!d.some(i, t) || (d.isEmpty(i) || !d.isPlainObject(i) && !d.isArray(i) ? void 0 : ri(i, t))), ai = async (e = {}, t = {}, i = {}, n = "") => { - let r = /* @__PURE__ */ Object.create(null); - for (let a in e) { - let o; - if (Reflect.has(e[a], "type") && ["code", "field", "router", "query", "string"].includes(e[a].type)) { - const { type: s, value: l = "", default: u = n } = e[a]; - switch (s) { - case "code": - o = await xe.exec(l, t, i); - break; - case "field": - o = d.get(t, l) ?? d.get(t, l.substring(l.indexOf(".") + 1)); - break; - case "router": - case "query": - o = ke.getPageParams(l); - break; - case "string": - o = l; - } - o ?? (o = u); - } else o = await ai(e[a], t, i, n); - d.set(r, a, o); - } - return r; -}, si = (e = {}, t = {}, i = "") => Object.keys(e || {}).reduce((n, r) => { - if (d.isPlainObject(e[r])) { - let a; - if (Reflect.has(e[r], "type") && ["field", "router", "query", "string"].includes(e[r].type)) { - const { type: o, value: s = "", default: l = i } = e[r]; - switch (o) { - case "field": - a = d.get(t, s) ?? d.get(t, s.substring(s.indexOf(".") + 1)); - break; - case "router": - case "query": - a = ke.getPageParams(s); - break; - case "string": - a = s; - } - a ?? (a = l); - } else a = si(e[r], t, i); - d.set(n, r, a); - } - return n; -}, {}), ut = (e, t) => e && typeof e == "object" ? Array.isArray(e) ? e.map((i) => ut(i, t)) : Object.keys(e).reduce((i, n) => (t[n] ? i[t[n]] = ut(e[n], t) : i[n] = ut(e[n], t), i), {}) : e, hr = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => { - const t = 16 * Math.random() | 0; - return (e === "x" ? t : 3 & t | 8).toString(16); -}), fr = (e) => { - var t, i; - return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.name : ""; -}, yr = (e) => { - var t, i; - return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.category : ""; -}, wr = (e) => { - var t, i; - return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.owner : ""; -}, oi = () => _.$index++, an = (e, t = 32, i = "auto") => { - const n = yt(e), r = i === "auto" ? "x64" : i; - if (t === 32) return dt.x86.hash32(n).toString(); - if (t === 128) return r === "x64" ? dt.x64.hash128(n) : dt.x86.hash128(n); - throw new Error("bits 只能是 32 或 128"); -}, yt = (e) => e == null ? "null" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : typeof e == "function" ? e.toString() : Array.isArray(e) ? "[" + e.map(yt).join(",") + "]" : typeof e == "object" ? "{" + Object.keys(e).sort().map((t) => `${t}:${yt(e[t])}`).join(",") + "}" : String(e); -var tt, ze, Be, it; -const nt = class nt { - constructor(...t) { - O(this, ze, []); - O(this, Be, (t) => { - var i; - for (let n of t) Array.isArray(n[0]) ? y(this, Be).call(this, n) : y(this, ze).push(y(i = nt, tt).call(i, n[0], n[1])); - }); - v(this, "toValue", async (t, i = null) => { - const n = { getValue: () => t, getRecord: () => i }; - return await y(this, ze).reduce(async (r, a) => { - try { - const o = await r; - return (await a).call(n, o); - } catch (o) { - return console.error(o), r; - } - }, t); - }); - v(this, "toRender", (t, i, n = null) => x.createElement(y(this, it), { value: t, record: i }, n)); - O(this, it, ({ value: t, record: i, children: n }) => { - const [r, a] = E(n); - return ot(() => { - let o = !1; - return a(n), this.toValue(t, i).then((s) => ee(s, "string")).then((s) => !o && a(s)).catch((s) => !o && a(`${s}`)), () => o = !0; - }, [t, i]), r; - }); - y(this, Be).call(this, t); - } -}; -tt = new WeakMap(), ze = new WeakMap(), Be = new WeakMap(), it = new WeakMap(), O(nt, tt, d.memoize((t, i) => le.getWidgetComponent(t).then((n) => { - var r; - return ((r = n.default) == null ? void 0 : r.call(n, i)) || ((a) => a); -}), (t, i) => `${t}::${ee(i, "string")}`)); -let et = nt; -const sn = (e, t = {}) => U(() => e == null ? void 0 : e.map(({ widgetByJs: i, widgetByJsSetting: n, ...r }, a) => i ? { ...r, render: (o, s) => new et([i, n]).toRender(o, s, "-") } : r), [e, t]), br = (e) => { - const [t, i] = E({}); - return A(() => { - let n = !1; - return e && L.get(`/api/_/${e}`).then((r) => d.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; - }, [e]), t; -}, Cr = (e, t = {}) => { - const [i, n] = E({ dataSource: [] }); - return He(() => { - let r = !1; - return e && L.get(`/api/${e}/${L.encode({ page: 1, ...t })}`).then((a) => !r && n(a)), () => r = !0; - }, [e, t]), i; -}, li = (e = [], t = /* @__PURE__ */ new Map(), i = "id", n) => { - const r = X(n ? (a) => d.get(a, i, d.get(a, [n, i])) : (a) => d.get(a, i), [i, n]); - return X((a) => e == null ? void 0 : e.filter((o) => !o.uuid || !t.has(o.uuid) || t.get(o.uuid).some((s) => s == r(a))), [e, t, r]); -}, wt = (e = [], t = /* @__PURE__ */ new Map(), i = [], n = "id", r) => { - const a = X(r ? (o) => d.get(o, n, d.get(o, [r, n])) : (o) => d.get(o, n), [n, r]); - return U(() => { - if (d.isEmpty(e) || !e.some(({ uuid: s }) => nn.check(s))) return !1; - if (d.isEmpty(t) || d.isEmpty(i)) return !0; - const o = i.map((s) => a(s)); - return e.some(({ uuid: s }) => !s || !t.has(s) || t.get(s).some((l) => o.some((u) => u == l))); - }, [e, i, t, a]); -}, on = (e, t, i = "id", n = null) => { - const r = st(), a = W(!1), o = W(e.dataSource), s = W(e.itemOperationsAccess); - return A(() => (o.current = e.dataSource, s.current = e.itemOperationsAccess, () => a.current = !1), [e.dataSource, e.itemOperationsAccess]), a.current && (e.dataSource = o.current, e.itemOperationsAccess = s.current), [e, (l = 0, u = null) => { - var c, g; - if (a.current = !1, l === 1) return (c = e.onReload) == null ? void 0 : c.call(e); - if (l === 2) { - const h = d.get(u, "__PARENT_ID__", ""), m = d.get(u, i, d.get(u, [n, i], "")), f = d.findIndex(o.current, ["__PARENT_ID__", h]), C = d.findIndex(f > -1 ? d.get(o.current, [f, "children"]) : o.current, [i, m]); - if (C === -1) return (g = e.onReload) == null ? void 0 : g.call(e); - Promise.all([L.get(`/api/${t}/detail/${m}`), L.post(`/api/${t}/list-operations-access`, { ids: m })]).then(([b, k]) => { - const S = d.get(o.current, f > -1 ? [f, "children", C, "children"] : [C, "children"]); - o.current = Qt(o.current, f > -1 ? { [f]: { children: { $splice: [[C, 1, { ...b, children: S }]] } } } : { $splice: [[C, 1, { ...b, children: S }]] }); - const $ = new Map(k); - s.current.forEach((T, I) => { - var q; - (q = $.get(I)) != null && q.some((z) => z == m) || s.current.set(I, T.filter((z) => z !== m)); - }), $.forEach((T, I) => { - s.current.has(I) ? s.current.set(I, d.uniq([...s.current.get(I) || [], ...T])) : s.current.set(I, T); - }); - }).then(() => { - a.current = !0, r(); - }); - } - }]; -}, ln = (e, t) => { - const i = st(), n = W(t), r = W(/* @__PURE__ */ new Map()), a = W([]), o = d.throttle((l) => { - a.current = [], L.list(e, d.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: u, condition: c, total: g, tab: h, sider: m, page: f, pageSize: C, operationsAccess: b, dataSource: k }) => { - n.current = { tab: h, condition: c, sider: m, keyword: u, total: g, pageSize: C, page: k != null && k.length ? f : 1 }, a.current = k, r.current = new Map(b), i(); - }); - }, 380, { leading: !1, trailing: !0 }); - ot(() => { - a.current = [], e && o(t); - }, [e, t]); - const s = U(() => d.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: Qt(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: t == null ? void 0 : t.payload }); -}, cn = ({ listCode: e, className: t, layouts: i, dataSource: n, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: c, primaryKey: g, title: h, itemGridLayout: m, $setting: f, tabs: C, isConditionFormLayout: b, isTreeSider: k, treeSiderConfig: S }) => { - const { classNames: $, onClickCallback: T } = ce(ie), I = d.pick(f, ["column", "colWidth", "beforeRender", "afterRender", "style"]), q = li(l, u, g, c), z = X((V, R, B) => p(dn, { className: M("ff-data-list-framework-item", $.item), operations: a ? q(R) : [], data: c ? { [c]: R } : R, children: V, onClickCallback: T }), [c, g, a, T, l, u]); - return j("div", { className: M("ff-data-list-framework", t), children: [p(i.sider, { isTreeSider: k, ...S }), j("div", { className: M("ff-data-list-container", $ == null ? void 0 : $.container), children: [p(i.filter, { isConditionFormLayout: b }), p(i.toolbar, { title: h, tabs: C }), p(xn, { ...I, ...m, primaryKey: g, itemRender: z, dataSource: n }), p(i.footer, { isPaginate: r, isOperations: o, operations: s })] })] }); -}, dn = ({ className: e, operations: t, children: i, data: n, onClickCallback: r }) => j("div", { className: M("data-list-grid-layout-item-container", e), children: [i, !!(t != null && t.length) && p("div", { className: "data-list-grid-layout-item-actions", children: t.map((a) => p("span", { className: "data-list-grid-layout-item-action", children: p(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 || Qe()) }, (a == null ? void 0 : a.uuid) || Qe())) })] }), un = ({ listCode: e, className: t, layouts: i, dataSource: n, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: c, primaryKey: g, title: h, tabs: m, isPaginate: f, isTreeSider: C, treeSiderConfig: b, isConditionFormLayout: k, ...S }) => { - const { classNames: $, onClickCallback: T } = ce(ie), I = li(l, u, g, c), q = wt(l, u, n, g, c); - return j("div", { className: M("ff-data-table-framework", t), children: [p(i.sider, { isTreeSider: C, ...b }), j("div", { className: M("ff-data-table-container", $ == null ? void 0 : $.container), children: [p(i.filter, { isConditionFormLayout: k }), p(i.toolbar, { title: h, tabs: m }), p(yn, { ...S, primaryKey: g, className: "ff-data-table-content", columns: r, dataSource: n, operationRender: q ? (z) => { - var V; - return p("div", { className: "ff-data-table-actions", children: (V = I(z)) == null ? void 0 : V.map((R, B) => p(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: z, confirm: R.confirm, onAfterClick: (N) => N !== !1 && (T == null ? void 0 : T(R.isRefresh, z)) }, R.uuid || B)) }); - } : null }), p(i.footer, { isPaginate: f, isOperations: o, operations: s })] })] }); -}, ie = x.createContext({ listCode: "", classNames: {}, getBase62params: (e, t) => { -}, onReload: () => { -}, onClickCallback: () => { -}, onConditionChange: () => { -}, onTabChange: () => { -}, onSiderChange: () => { -}, onKeywordChange: () => { -}, onPageChange: () => { -}, onPageSizeChange: () => { -} }), ci = (e, t, i, n, r = {}, a = 0) => { - const o = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${e}`, "--grid-layout-y": `${t}`, "--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"] = Bt(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"] = Bt(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; -}, Bt = (e, t, i, n) => `${e || 0}px ${t || 0}px ${i || 0}px ${n || 0}px`, kr = (e = "Text", t = "@pkg/ff/grid-layouts") => e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, di = ({ className: e, isConditionFormLayout: t }) => { - var h, m; - const [i, n] = E({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = x.useContext(ie), { keyword: u, condition: c } = (s == null ? void 0 : s()) || {}, [g] = Ye.useForm(); - return A(() => { - r && t && L.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: f, marginX: C, marginY: b, rowHeight: k, cols: S, fields: $ }) => { - n({ resource: f, itemMargin: [C, b], rowHeight: k, cols: S, fields: $ }); - }).catch(() => n({})); - }, [r, t]), A(() => { - g.setFieldsValue({ keyword: u, ...c }); - }, [JSON.stringify([u, c])]), p("div", { className: M("ff-data-list-filter", l.filter, e), children: p(Ye, { form: g, layout: "vertical", autoComplete: "off", onFinish: ((h = i.fields) == null ? void 0 : h.length) > 1 ? (f) => o({ [i.resource]: f[i.resource] }, f.keyword) : () => { - }, onValuesChange: (f) => { - d.isEmpty(d.omit(f, ["keyword"])) || g.submit(); - }, children: ((m = i.fields) == null ? void 0 : m.length) > 1 ? p(Nt, { ...i, children: p(gn, { onReset: () => { - const { keyword: f, condition: C } = s("init") || {}; - g.setFieldsValue({ keyword: f, ...C }); - } }) }) : p("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: p("div", { className: "grid-layout-item", style: ci(20, 0, 5, 2), children: p(Ye.Item, { name: ["keyword"], children: p(Mi.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => a(f) }) }) }) }) }) }); -}, gn = ({ cols: e, fields: t, onReset: i }) => { - const [n, r] = E(!1), a = U(() => t == null ? void 0 : t.toReversed().some((o) => o.y > 1 || o.x + o.w >= e - 5), [e, t]); - return j(Ye.Item, { label: " ", style: { "--item-span": 5 }, className: M("ff-data-list-filter-actions", { expanded: n }), children: [p(Ze, { onClick: i, children: "重置" }), p(Ze, { type: "primary", htmlType: "submit", children: "查询" }), a && p(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" })] }); -}; -di.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 pn = ({ className: e, operations: t, isOperations: i, isPaginate: n }) => { - const { onPageChange: r, onPageSizeChange: a, onClickCallback: o, getBase62params: s } = x.useContext(ie), { total: l, page: u, pageSize: c } = (s == null ? void 0 : s()) || {}; - return i && !d.isEmpty(t) || n ? j("div", { className: M("ff-data-list-footer", e), children: [p("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((g, h) => p(P, { uuid: g.uuid, type: g.type, name: g.name, widget: g.widget, widgetType: g.widgetType, widgetProps: g.widgetProps, widgetData: g.widgetData, widgetSetting: g.widgetSetting, widgetContainerProps: g.widgetContainerSetting, onAfterClick: (m) => m !== !1 && (o == null ? void 0 : o(g.isRefresh, null)) }, g.uuid || h)) }), n && p(zi, { size: "small", total: l, pageSize: c, showSizeChanger: !1, showTotal: (g) => `第 ${u} 页 / 总共 ${g} 条`, onChange: r, onShowSizeChange: a })] }) : null; -}, mn = [{ 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: p("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], hn = ({ className: e, width: t = 280, isTreeSider: i }) => { - const { classNames: n } = ce(ie); - return i ? p(Bi.DirectoryTree, { className: M("ff-data-list-sider", n.sider, e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: mn }) : null; -}, fn = ({ className: e, title: t, tabs: i }) => { - const { getBase62params: n, onTabChange: r, onReload: a, classNames: o } = ce(ie), { tab: s } = (n == null ? void 0 : n()) || {}, [l, u] = Ki((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: r }); - return j("div", { className: M("ff-data-list-toolbar", o.toolbar, e), children: [p("div", { className: "ff-data-list-title", children: t }), p(Di, { className: "ff-data-list-tabs", itemRender: ({ label: c, code: g, value: h }) => p("span", { onClick: () => u(h ?? g), className: M("ff-data-list-tab", { active: (h ?? g) == l }), children: c }), items: i }), j("div", { className: "ff-data-list-actions", children: [p(P.Link, { icon: "icon-reload", widget: () => a() }), p(P.Link, { icon: "icon-setting" })] })] }); -}, ui = ({ isItemGridLayout: e, theme: t, themeProps: i, onClickCallback: n, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: u = 30, onPageSizeChange: c, tab: g, onTabChange: h, keyword: m, onKeywordChange: f, condition: C, onConditionChange: b, sider: k, onSiderChange: S, layouts: $, classNames: T = {}, payload: I = {}, ...q }) => { - const [z, V] = E(), R = X((N, F) => { - const J = { tab: g, page: s, pageSize: u, keyword: m, sider: k, condition: C, total: o, payload: I }; - return N && N != "init" ? d.get(J, N, F) : J; - }, [JSON.stringify(C), JSON.stringify(I), g, s, u, m, k, o]), B = U(() => { - let N = { sider: hn, filter: di, footer: pn, toolbar: fn }; - $ === !1 ? N = { sider: null, filter: null, footer: null, toolbar: null } : d.isPlainObject($) && (N = Object.assign({}, N, $)); - for (const F in N) if (N[F]) { - if (Li(N[F])) { - const J = N[F]; - N[F] = (de) => x.cloneElement(J, de); - } - } else N[F] = () => p(x.Fragment, {}); - return N; - }, [$]); - return A(() => { - t ? le.getWidgetComponent(t).then((N) => { - if (!N) throw `${t} not found`; - return N; - }).catch((N) => ({ default: () => `${N}` })).then((N) => V(x.createElement(N.default, { ...q, layouts: B, $setting: i }))) : V(p(e ? cn : un, { ...q, layouts: B, $setting: i })); - }, [t, i]), p(ie.Provider, { value: { classNames: T, listCode: a, onClickCallback: n, onReload: r, getBase62params: R, onPageChange: l, onPageSizeChange: c, onTabChange: h, onSiderChange: S, onKeywordChange: f, onConditionChange: b }, children: z && x.cloneElement(z, q) }); -}; -ui.propTypes = { classNames: w.exact({ sider: w.string, filter: w.string, footer: w.string, toolbar: w.string, container: w.string, content: w.string, item: w.string }), layouts: w.oneOfType([w.exact({ sider: w.oneOfType([w.elementType, w.element]), filter: w.oneOfType([w.elementType, w.element]), footer: w.oneOfType([w.elementType, w.element]), toolbar: w.oneOfType([w.elementType, w.element]) }), w.bool]) }; -var he, ge, Pe, rt; -const ae = class ae { - constructor() { - O(this, ge, null); - O(this, Pe, /* @__PURE__ */ new Map()); - O(this, rt, () => { - if (y(this, ge)) return y(this, ge).port.postMessage({ command: "status", data: [] }); - H(this, ge, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), y(this, ge).port.onmessage = (t) => { - var i, n; - (i = t.data) != null && i.uuid ? y(this, Pe).forEach((r, a) => { - var o; - (r == "*" || (o = r == null ? void 0 : r.includes) != null && o.call(r, t.data.uuid)) && a(t.data); - }) : ((n = t.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && L.get("/api/user-api-token").then(({ token: r, expire_at: a }) => { - y(this, ge).port.postMessage({ command: "initWs", data: [`ws${d.trimStart(L.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); - }); - }, y(this, ge).port.postMessage({ command: "status", data: [] }); - }); - v(this, "subscribe", (t, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", y(this, Pe).set(t, i), y(this, Pe).size == 1 && y(this, rt).call(this), () => this.unsubscribe(t))); - v(this, "unsubscribe", (t) => y(this, Pe).delete(t)); - if (y(ae, he)) return y(ae, he); - } -}; -he = new WeakMap(), ge = new WeakMap(), Pe = new WeakMap(), rt = new WeakMap(), O(ae, he, null), v(ae, "getInstance", () => (y(ae, he) || H(ae, he, new ae()), y(ae, he))); -let bt = ae; -const gi = bt.getInstance(), Tt = x.forwardRef(({ listCode: e, base62params: t, className: i, theme: n, themeProps: r, layouts: a, classNames: o }, s) => { - const [{ resource: l, primaryKey: u, batchOperations: c = [], itemOperations: g = [], columns: h = [], themeConfig: m, theme: f, isConditionFormLayout: C = !1, isTreeSider: b, treeSiderConfig: k, isItemGridLayout: S, itemGridLayout: $, title: T, isPaginate: I, tabs: q }, z] = E({ isItemGridLayout: !1, itemGridLayout: {} }), V = ln(e, t), [{ dataSource: R, itemOperationsAccess: B, condition: N, tab: F, keyword: J, page: de, total: $e, pageSize: K, sider: Ke, onConditionChange: lt, onTabChange: Ot, onKeywordChange: Si, onPageChange: vi, onPageSizeChange: Pi, onSiderChange: $i, onReload: ct, payload: Ti }, jt] = on(V, e, u, l), Ni = wt(g, B, R, u), Ri = wt(c); - A(() => { - let Q = null; - return e && L.get(`/api/_/${e}`).resp(({ data: _e, res: Ei }) => { - _e != null && _e.isDynamicRefresh && (Q = gi.subscribe(() => ct(), Ei)), z(_e); - }).catch(() => z({})), () => Q == null ? void 0 : Q(); - }, [e]), x.useImperativeHandle(s, () => ({ onReload: ct, onClickCallback: jt })); - const Fi = { listCode: e, title: T, classNames: o, layouts: a, resource: l, primaryKey: u, theme: n || f, themeProps: r || m, isTreeSider: b, treeSiderConfig: k, isPaginate: I, tabs: q, isItemOperations: Ni, itemOperations: g == null ? void 0 : g.map((Q) => d.isEmpty(Q == null ? void 0 : Q.confirm) ? Q : { ...Q, confirm: Object.assign({}, Q.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: Ri, batchOperations: c, isItemGridLayout: S, columns: h, itemGridLayout: $, isConditionFormLayout: C, itemOperationsAccess: B, dataSource: R, onConditionChange: lt, onTabChange: Ot, onKeywordChange: Si, onPageChange: vi, onPageSizeChange: Pi, onSiderChange: $i, condition: N, tab: F, keyword: J, page: de, total: $e, pageSize: K, sider: Ke, payload: Ti }; - return p(ui, { ...Fi, className: M("ff-data-list-helper", i), onReload: ct, onClickCallback: jt }); -}), pi = (e, t, i = !0) => i !== !0 && i-- <= 0 ? [] : d.isArray(e) && !d.isEmpty(e) ? e.reduce((n, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && n.push(r[t]), Reflect.has(r, "children") && !d.isEmpty(r.children) ? n.concat(pi(r.children, t, i)) : n), []) : [], yn = ({ className: e, primaryKey: t, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: a = 180, ...o }) => { - const { classNames: s } = ce(ie); - Qe(); - const l = W(null), u = W(null), [c, g] = E([]), [h, m] = E({ width: 0, height: 0 }); - A(() => { - g(pi(n, t)); - }, [n, t]), Ai(() => { - const C = new ResizeObserver(() => { - var b; - m({ width: ((b = l.current) == null ? void 0 : b.nativeElement.querySelector(".ant-table-body").scrollWidth) || u.current.offsetWidth, height: u.current.offsetHeight }); - }); - return u.current && C.observe(u.current), () => { - u.current && C.unobserve(u.current); - }; - }, []); - const f = sn(i); - return p("div", { ref: u, className: M("ff-data-list-table", s.content, e), children: h.height ? p(qi, { ...o, ref: l, rowKey: (C) => (C == null ? void 0 : C[t]) ?? Math.random(), columns: f == null ? void 0 : f.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / h.width * 100).toFixed(2)}%`, render: (C, b, k) => r(b, k) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: h.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: c } }) : null }); -}, wn = "RC_FORM_INTERNAL_HOOKS", bn = (e, { initialValue: t, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: a = "string" }, o = null) => { - const s = W(!1), l = ce(Yt), [u, c] = E(), [g, h] = E(i != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: m } = l.getInternalHooks(wn) || {}; - return A(() => m == null ? void 0 : m((f, C, b) => { - if (!s.current) return; - const k = d.get(C, e); - d.isEqual(k, g) || h(ee(k, a)); - }), [g]), A(() => { - i == "javascript" && t ? xe.exec(t, {}, { getFieldValueForBasicForm: (f) => o ? o.getFieldValue(f) : l.getFieldValue(f), getFieldValue: (f) => l.getFieldValue(f) }).then((f) => h(ee(f, a))).catch((f) => notification.error({ message: `布局数据错误: ${JSON.stringify(f)}` })).finally(() => s.current = !0) : (t && h(ee(t ?? l.getFieldValue(e), a)), s.current = !0); - }, [t, i]), He(() => { - s.current && n && new et([n, r]).toValue(g, l.getFieldsValue(!0)).then(c).catch((f) => { - c(f), console.error("布局数据转换错误: ", f, n); - }); - }, [g, n, r]), [u ?? g, g]; -}, mi = (e, t, i = null) => U(() => { - var n; - return (n = d.sortBy(e, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: a, y: o, w: s, h: l, field: { boxStyle: u, ...c } }, g) => p("div", { className: "grid-layout-item", style: ci(a, o, s, l, u), children: p(t, { ...c, basicForm: i }) }, r ?? g)); -}, [e]), Cn = ({ widget: e, widgetPrefix: t = "@pkg/ff/grid-layouts", basicForm: i, ...n }) => { - const r = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [a, o] = E(); - return A(() => { - r && le.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: kn(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => o(x.createElement(s.default, n))); - }, [r]), a; -}, kn = (e, t = {}, i = null) => (n) => { - const { code: r, label: a, extras: o, isVirtual: s, initialValue: l, initialValueLanguage: u, convertJs: c, convertJsSetting: g, value: h, ...m } = d.merge({}, t, n), [f, C] = bn(s ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: c, convertJsSetting: g, type: (m == null ? void 0 : m.type) || "string" }, i), b = U(() => { - const $ = Object.keys((t == null ? void 0 : t.extras) || {}); - return d.over([d.partialRight(d.pick, $), d.partialRight(d.omit, $)]); - }, [t == null ? void 0 : t.extras]), [k, S] = b(m); - return p(e, { ...S, value: f, rawValue: C, $setting: Object.assign({}, o, k) }); -}, hi = ({ className: e, cols: t = 12, rowHeight: i = 21, containerPadding: n = [0, 0], itemMargin: r = [4, 0], formProps: a = {}, fields: o = [], data: s, basicForm: l = null, ...u }) => { - const [c] = te.useForm(), g = mi(o, Cn, l), h = U(() => [{ name: "__PROPS__", value: a }], [a]); - return He(() => (c.setFieldsValue(s), () => c.resetFields()), [s]), p(te, { fields: h, form: c, component: !1, children: p("div", { ...u, className: M("ff-grid-layout", e), style: { "--grid-layout-item-margin-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-item-margin-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": t, "--grid-layout-row-height": `${i}px` }, children: g }) }); -}, xr = (Dt = hi, function({ code: e, data: t, ...i }) { - const [n, r] = E({ resource: null, cols: 12, rowHeight: 21, fields: [] }); - return A(() => { - e && L.get(`/api/_/${e}`).then((a) => r(d.pick(a, ["resource", "cols", "rowHeight", "fields"]))); - }, [e]), (n == null ? void 0 : n.resource) && p(Dt, { ...i, rowHeight: n.rowHeight, cols: n.cols, fields: n.fields, data: n != null && n.resource ? { [n == null ? void 0 : n.resource]: t } : {} }); -}); -var Dt; -const xn = ({ column: e = 0, colWidth: t = 0, cols: i, rowHeight: n, itemMargin: r, fields: a, primaryKey: o, dataSource: s, itemClassName: l, beforeRender: u = null, afterRender: c = null, itemRender: g = (C, b, k) => C, empty: h = p(Wi, { description: null }), className: m, style: f = {} }) => { - const { classNames: C } = ce(ie), b = U(() => p(hi, { cols: i, rowHeight: n, itemMargin: r, fields: a, className: l }), [a, i, n, r]), k = d.isEmpty(s); - return j("div", { className: M("ff-data-list-content", C.content, m), style: Object.assign({}, f, e && { "--col-num": e }, t && { "--col-width": t }), children: [u == null ? void 0 : u(s), k ? h : s.map((S, $) => { - const T = g(x.cloneElement(b, { data: S }), S, $); - return x.cloneElement(T, { key: `${(S == null ? void 0 : S[o]) ?? $}-${an(S)}` }); - }), c == null ? void 0 : c(s)] }); -}, Sn = ({ component: e, $props: t }) => { - const { base62params: i } = Ue(t, {}); - return p(Y, { children: p(Tt, { listCode: e, base62params: L.decode(i) }) }); -}, Sr = () => p(fi, {}), fi = () => "Empty", vn = ({ component: e, $setting: t, $props: i }) => { - const [n, r] = E(); - A(() => { - if (!e) return r(p(fi, { description: null })); - le.getWidgetComponent(e).catch((o) => ({ default: () => `${o}` })).then((o) => x.createElement(o.default, { $setting: t })).then(r); - }, [e]); - const a = Ue(i, {}); - return n ? x.cloneElement(n, a) : null; -}, vr = () => "NotFoundPage"; -var fe, Z, ye, we, De, qe; -const se = class se { - constructor() { - O(this, Z, /* @__PURE__ */ new Map()); - O(this, ye, {}); - O(this, we, null); - v(this, "init", (t, i) => { - H(this, Z, t), H(this, ye, i); - }); - v(this, "get", (t) => (y(this, Z).has(t) || (t = Array.from(y(this, Z).keys()).find((i) => y(this, Z).get(i).uri === t)), y(this, Z).get(t) || {})); - v(this, "redirect", (t, i, n = {}) => { - const { uri: r, type: a, widgetProps: o } = this.get(t) || {}, { router: s, query: l, ...u } = i || {}, c = Object.assign({}, u, s), g = Object.assign({}, u, l); - a == "list" && (c.base62params = L.encode(c != null && c.base62params ? c.base62params : c)); - let h = _i(r || t, c); - const m = new URLSearchParams(); - for (const f in o || {}) (o == null ? void 0 : o.type) == "query" && Object.has(g, f) && m.append(f, JSON.stringify(g[f])); - return m.size > 0 && (h = `${h}?${m.toString()}`), n != null && n.isOpenWindow ? window.open(h) : y(this, we).navigate(h, { replace: !!(n != null && n.isReplaceRouteHistory) }); - }); - v(this, "getMenus", (t) => { - var i; - return ((i = y(this, ye)) == null ? void 0 : i[t]) || []; - }); - v(this, "findMenuPathByUuid", (t) => { - let i = []; - for (const n in y(this, ye)) if (i = y(this, De).call(this, y(this, ye)[n], t, [n]), i.length > 1) return i; - return i; - }); - v(this, "getMenusByRouteUuid", (t) => y(this, qe).call(this, t, Object.values(y(this, ye)).flat())); - O(this, De, (t, i, n = []) => { - if (d.isEmpty(t)) return n; - for (const { uuid: r, children: a } of t) { - if (r == i) return n.concat(r); - if (!d.isEmpty(a)) return n.concat(r, y(this, De).call(this, a, i)); - } - return n; - }); - O(this, qe, (t, i) => { - var r; - let n = []; - for (const a of i) a.widgetType == "redirect" && (a.uuid == t || a.widget == t ? n.push(a) : (r = a.children) != null && r.length && (n = n.concat(y(this, qe).call(this, t, a.children)))); - return n; - }); - v(this, "getCurrentMenu", () => { - const { uuid: t } = this.getCurrentRoute() || {}; - if (!t) return; - const i = this.getMenusByRouteUuid(t); - return d.isEmpty(i) ? void 0 : i[0]; - }); - v(this, "getCurrentRoute", (t = 0) => { - var n; - const i = (n = y(this, we).state.matches[y(this, we).state.matches.length - 1 - t]) == null ? void 0 : n.route; - if (!i) return null; - for (let [r, a] of y(this, Z)) if (a.uri === i.path) return a; - return null; - }); - v(this, "getPageParams", (t) => { - var r, a, o; - let i = "", n = {}; - if (Zt()) n = Gi(), i = (r = Yi()) == null ? void 0 : r.search; - else { - const { location: s = {}, matches: l = [] } = ((a = y(this, we)) == null ? void 0 : a.state) || {}; - n = ((o = l[l.length - 1]) == null ? void 0 : o.params) || {}, i = s.search; - } - return i && new URLSearchParams(i).forEach((s, l) => { - n[l] = s; - }), t ? d.get(n, t) : n; - }); - v(this, "createBrowserRouter", (t = {}) => { - if (y(this, Z).size == 0) return null; - const i = Ae.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Ae.get(le.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, a = (s, l) => () => Promise.all([le.getWidgetComponent(s), Ue(l)]).then(([u, c]) => [u.default || function() { - return `${s}`; - }, c]).then(([u, c]) => ({ Component: () => x.createElement(ti, {}, x.createElement(u, { $setting: c })) })), o = Array.from(y(this, Z).values()).reduce((s, { uuid: l, uri: u, name: c, type: g, component: h, widgetSetting: m, widgetProps: f, isLogin: C, isLayout: b, extra: k }) => { - let S = {}, $ = 0; - switch (g) { - case "list": - S.element = x.createElement(Sn, { component: h, $props: f }); - break; - case "fsdpf-component": - S.element = x.createElement(vn, { key: h, component: h, $setting: m, $props: f }); - } - const T = (k == null ? void 0 : k.theme) ?? (k == null ? void 0 : k.layout); - if (T) { - const I = (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, I), children: [{ path: u, ...S }] }]; - $ = r[T]; - } - return b && $ > -1 ? (s[$].children.push({ path: u, ...S }), s) : [...s, { path: u, ...S }]; - }, [{ path: "/", lazy: a(i, {}), children: [] }]); - return o.push({ index: !0, element: x.createElement(Pn, { to: n, replace: !0 }) }), H(this, we, Xi(o, t)); - }); - if (y(se, fe)) return y(se, fe); - } -}; -fe = new WeakMap(), Z = new WeakMap(), ye = new WeakMap(), we = new WeakMap(), De = new WeakMap(), qe = new WeakMap(), O(se, fe, null), v(se, "getInstance", () => (y(se, fe) || H(se, fe, new se()), y(se, fe))); -let Ct = se; -const Pn = ({ to: e, replace: t }) => Zt() ? x.createElement(Qi, { to: e, replace: t }) : (window.document.location = e, "redirect"), ke = Ct.getInstance(), Te = new Worker(new URL("/ff-worker/index.js", self.location)), qt = { getConfigure: (e) => Ae.get(e), route: { redirect: (...e) => ke.redirect(...e), getPageParams: (...e) => ke.getPageParams(...e), getCurrentRoute: () => ke.getCurrentRoute() }, popup: { notification: (...e) => G.notification(...e), success: (...e) => G.success(...e), error: (...e) => G.error(...e), form: (...e) => G.form(...e), modal: (...e) => G.modal(...e), confirm: (...e) => G.confirm(...e) } }; -var at, Ee, be; -const D = class D { - constructor() { - v(this, "exec", (t, i = {}, n = {}, r = "") => new Promise((a, o) => { - if (!/^(?!\s*(\/\/|\/\*|\*)).*?\S+/m.test(t)) return a(); - const s = Vt(D, at)._++; - y(D, Ee).set(s, n), D.mQueue.set(s, [a, o]), Te.postMessage({ id: s, session: r, category: "eval", method: t, args: i }); - })); - v(this, "clear", (t) => Te.postMessage({ session: t, category: "clear" })); - if (y(D, be)) return y(D, be); - Promise.resolve().then(() => Gn).then((t) => { - qt.http = t.http; - }), Te.addEventListener("message", ({ data: { id: t, task_id: i, method: n, args: r, category: a, data: o, error: s, session: l } }) => { - if (a === "eval" && D.mQueue.has(t)) s !== null ? D.mQueue.get(t)[1](s) : D.mQueue.get(t)[0](o), y(D, Ee).delete(t), D.mQueue.delete(t); - else if (a === "util") try { - const u = d.get(qt, n.split("/")) || d.get(y(D, Ee).get(i), n.split("/")); - if (!d.isFunction(u)) throw `${n} not found`; - Promise.resolve(Reflect.apply(u, void 0, r)).then((c) => { - Te.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: c, error: null }); - }).catch((c) => { - Te.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: null, error: c }); - }); - } catch (u) { - Te.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: null, error: u }); - } - }, !1); - } -}; -at = new WeakMap(), Ee = new WeakMap(), be = new WeakMap(), v(D, "mQueue", /* @__PURE__ */ new Map()), O(D, at, 0), O(D, Ee, /* @__PURE__ */ new Map()), O(D, be, null), v(D, "getInstance", () => (y(D, be) || H(D, be, new D()), y(D, be))); -let kt = D; -const xe = kt.getInstance(), st = () => { - const e = W(!0), [, t] = x.useReducer((i) => i + 1, 0); - return A(() => () => e.current = !1, []), () => e.current && t(); -}, Pr = (e) => { - const t = W(); - return A(() => { - t.current = e; - }, [e]), t.current; -}, $r = (e) => { - const [t, i] = E(e), n = W(null), r = X((a, o) => { - n.current = o, i(a); - }, []); - return A(() => { - n.current && (n.current(t), n.current = null); - }, [t]), [t, r]; -}, He = (e = (n) => { -}, t, i = d.isEqual) => { - const n = x.useRef(); - i(t, n.current) || (n.current = d.cloneDeep(t)), x.useEffect(e, [n.current]); -}, ot = He, yi = (e, t = "string") => { - var i; - if (!Array.isArray(e)) return e; - for (let n = 0; n < e.length; n++) e[n].value = ee((i = e[n]) == null ? void 0 : i.value, t), e[n] && Reflect.has(e[n], "children") && (e[n].children = yi(e[n].children, t)); - return e; -}, Tr = (e, t = "json", i = "string", n, r = null) => { - const [a] = te.useForm(n), [o, s] = E([{ label: "无", value: "", disabled: !0 }]), l = W([]), u = te.useWatch((c) => l.current.length === 0 ? null : d.pick(c, l.current), a) || null; - return A(() => { - Array.isArray(e) ? s(e) : t === "javascript" && e ? xe.exec(e, {}, { getFieldValue: (c) => (l.current.includes(c) || l.current.push(c), a.getFieldValue(c)), getFieldValueForBasicForm: (c) => (l.current.includes(c) || l.current.push(c), r ? r.getFieldValue(c) : a.getFieldValue(c)) }).then((c) => { - s(ee(c, "array")); - }) : e && s(ee(e, "array")); - }, [e, t, u]), yi(o, i); -}, Nr = (e) => { - const [t, i] = E(), n = { type: "GET" }; - if (typeof e == "string" ? n.url = e : d.isPlainObject(e) && Object.assign(n, e), !(n != null && n.url)) throw "url is required"; - const r = (a) => L.request(n, !1).resp((o) => (console.log("useSubscribeRequest", a), i(o), o)); - return He(() => { - let a = null; - return r().then((o) => { - a = gi.subscribe(d.throttle(r, 180, { leading: !1, trailing: !0 }), o.res); - }), () => a == null ? void 0 : a(); - }, n), t; -}, $n = (e) => { - const [t, i] = x.useState({ gridItems: [], hideItems: [] }); - return x.useEffect(() => { - e && L.get(`/api/_/${e}`).then(({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: c, marginY: g, listenChangeFields: h, listenChangeFieldsFunc: m, fields: f }) => ({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: c, marginY: g, listenChangeFields: h, listenChangeFieldsFunc: m, ...f.reduce((C, b) => { - var k; - return (k = b == null ? void 0 : b.field) != null && k.hidden ? C.hides.push(b == null ? void 0 : b.field) : C.items.push(b), C; - }, { items: [], hides: [] }) })).then(i); - }, [e]), t; -}, Tn = ({ max: e = 0, min: t = 0, type: i = "", message: n, pattern: r, required: a = !1, validator: o } = {}, s, l) => { - const [u, c] = E([]); - return A(() => { - const g = []; - if (a) { - let h = l; - switch (l) { - case "number": - case "string": - case "array": - break; - case "bool": - h = "boolean"; - break; - case "json": - h = "object"; - } - g.push({ type: h, required: !0, whitespace: !0, message: "该项必填" }); - } - switch (i) { - case "string": - g.push({ type: i, max: e, min: t, message: n || (t && e ? `字符必须在 ${t} ~ ${e} 之间` : `${e ? "最多能有" : "最少要有"} ${t || e} 个字符`) }); - break; - case "pattern": - g.push({ type: "string", pattern: r, message: n }); - break; - case "validator": - o && g.push(({ getFieldValue: h }) => ({ validator: async (m, f) => { - const C = await xe.exec(o, { value: f, fieldName: s }, { getFieldValue: h }); - return d.isString(C) && C ? Promise.reject(C) : d.isBoolean(C) && !C ? Promise.reject(n) : Promise.resolve(); - } })); - } - c(g); - }, [e, t, i, n, r, a, o]), u; -}, Nn = (e, t, i) => { - const [n, r] = E(null); - return A(() => { - const { initDataUri: a = `/api/${e}`, initDataMethod: o = "GET" } = i || {}; - t && L.request({ method: o, url: d.trimEnd(`${a}/${t}`, "/") }).then((s) => { - r(s); - }); - }, [e, t, i]), n; -}, wi = (e, t, i = {}, n = {}, r = {}) => { - const a = ce(Yt), o = st(), s = W(!0), l = W([]), [u, c] = E(t), g = te.useWatch((h) => JSON.stringify(d.pick(h, l.current)), a) || "{}"; - return ot(() => { - e && xe.exec(e, i, { ...n, getFieldValueForBasicForm: (h) => r ? r.getFieldValue(h) : null, getFieldValue: d.wrap(a.getFieldValue, (h, m) => (l.current.some((f) => d.isEqual(f, m)) || (l.current.push(m), o()), h == null ? void 0 : h(m))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((h) => s.current && c(h)); - }, [e, g, a, i, n]), A(() => () => s.current = !1, []), u; -}, Rn = (e, t, i = [], n = {}) => { - const r = W({}); - if (!t) return [e, r.current]; - const a = W(), o = d.debounce(st(), 180), s = ["disabled", "required"], l = (g, h) => { - s.includes(g) && (r.current[g] = h), o(); - }, u = U(() => ({ setDisabled: (g) => l("disabled", g), setRequired: (g) => l("required", g), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [t]), c = wi(t, -1, {}, u, n) ?? -1; - if (a.current != c && (c >= 0 || !d.isEmpty(i == null ? void 0 : i[c]))) { - a.current = c; - const { widget: g, widgetPrefix: h, props: m } = i == null ? void 0 : i[c]; - e = ni(g, h), r.current = d.merge(m, d.pick(r.current, s)); - } - return [e, r.current]; -}, Wt = (e) => e === void 0 || e === !1 ? "" : (Array.isArray(e) ? e : [e]).join("_"), Rr = ({ value: e, onChange: t }, i = null) => { - const n = W(), [r] = te.useForm(i), a = W({}); - return ot(() => { - d.isEqual(n.current, e) || r.setFieldsValue(e); - }, [e]), A(() => () => r.resetFields(), []), [U(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (o) => (s) => { - const l = Wt(o); - s ? a.current[l] = s : delete a.current[l]; - } }, scrollToField: (o, s = {}) => { - console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); - }, focusField: (o) => { - console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); - }, getFieldInstance: (o) => { - const s = Wt(o); - return a.current[s]; - } }, [r]), (o, s) => { - n.current = s, t == null || t(s); - }]; -}, Fn = ({ type: e, initialValue: t, initialValueLanguage: i, onChange: n, basicForm: r }) => { - const a = wi(i == "javascript" && t, i == "javascript" ? void 0 : t, {}, {}, r); - return A(() => { - i == "javascript" ? n(ee(a, e)) : t && n(ee(t, e)); - }, [e, t, a]), null; -}, bi = ({ widget: e = "Input", widgetPrefix: t = "@pkg/ff/grid-layout-forms", widgetDecorator: i, subWidgets: n = [], basicForm: r, ...a }) => { - const o = ni(e, t), [s, l] = Rn(o, i, n, r), [u, c] = E(); - return A(() => { - s && le.getWidgetComponent(s).then(({ defaultProps: g = {}, default: h }) => ({ default: En(h, g, r) })).catch((g) => ({ default: () => `${g}` })).then((g) => c(x.createElement(g.default, a))); - }, [s]), u && x.cloneElement(u, { ...a, ...l }); -}, En = (e, t = {}, i = null) => (n) => { - const { type: r, code: a, label: o, noStyle: s, placeholder: l, required: u = !1, extras: c, validators: g, help: h, isVirtual: m, $isReserved: f, initialValue: C, initialValueLanguage: b, ...k } = d.omit(d.merge({}, t, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), S = Tn(Object.assign({}, g, u ? { required: !0 } : {}), a, r), $ = U(() => { - const V = Object.keys((t == null ? void 0 : t.extras) || {}); - return d.over([d.partialRight(d.pick, V), d.partialRight(d.omit, V)]); - }, [t == null ? void 0 : t.extras]), [T, I] = $(k), q = { label: o, noStyle: s, colon: !1, layout: "vertical" }, z = X((V) => V == null ? void 0 : ee(V, r), [r]); - return p(Xt, { name: a, rules: S, initialValue: z(C), normalize: z, children: (V, R, B) => { - var N; - return p(e, { type: r, rcform: B, basicForm: i, itemProps: { validateStatus: R.errors.length > 0 ? "error" : "success", tooltip: h || null, help: R.errors.length > 0 ? R.errors.join("、") : null, required: ((N = S == null ? void 0 : S[0]) == null ? void 0 : N.required) || !1, ...q }, fieldProps: { placeholder: l, ...I, ...V }, $setting: Object.assign({}, c, T) }); - } }); -}, Nt = ({ cols: e = 24, rowHeight: t = 16, itemMargin: i = [8, 16], containerPadding: n = [0, 0], fields: r = [], children: a, basicForm: o = null }) => { - const s = mi(r, bi, o); - return j("div", { className: "ff-grid-layout-form", style: { "--grid-layout-item-margin-x": `${(i == null ? void 0 : i[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(i == null ? void 0 : i[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: [s, a && x.cloneElement(a, { cols: e, rowHeight: t, itemMargin: i, containerPadding: n, fields: r })] }); -}; -Nt.propTypes = { fields: w.array }; -const On = (Ut = Nt, ({ code: e, layout: t, name: i, primaryKey: n = 0, style: r = {}, formProps: a = {}, form: o, basicForm: s, isPreview: l = !1, className: u, onFinish: c, onValuesChange: g = () => { -}, ...h }) => { - const { align: m, autoComplete: f, resource: C, items: b, hides: k, rowHeight: S, marginX: $, marginY: T, cols: I, listenChangeFields: q, listenChangeFieldsFunc: z, pk: V, uuid: R } = $n(e), [B] = te.useForm(o), N = U(() => [{ name: "__PK__", value: V }, { name: "__PROPS__", value: a }, { name: "__RESOURCE__", value: C }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: R }, { name: "__PRIMARY_KEY__", value: n }], [V, e, R, C, n, a]); - return j(te, { className: u, name: i || e, layout: t || m, fields: N, form: B, autoComplete: f, style: { ...r, position: "relative" }, onFinish: c, onValuesChange: (F, J) => (({ changedValues: de, allValues: $e, listenChangeFields: K, listenChangeFieldsFunc: Ke, onValuesChange: lt, code: Ot }) => { - lt(de, $e), Ke && Array.isArray(K) && xe.exec(Ke, { changedValues: de, allValues: $e }, { getFieldValue: B.getFieldValue, setFieldValue: B.setFieldValue, setFieldsValue: B.setFieldsValue, isFieldTouched: B.isFieldTouched, isFieldsTouched: B.isFieldsTouched }); - })({ changedValues: F, allValues: J, listenChangeFields: q, listenChangeFieldsFunc: z, onValuesChange: g, code: e }), children: [p(Ut, { ...h, form: B, basicForm: s, code: e, fields: b, cols: I, rowHeight: S, itemMargin: [$, T] }), k == null ? void 0 : k.map((F) => { - var J; - return p(Xt, { name: F.code, children: p(Fn, { form: B, basicForm: s, name: F.code, type: F.type, initialValue: F.initialValue, initialValueLanguage: (J = F.extras) == null ? void 0 : J.initialValueLanguage }) }, JSON.stringify(F.code)); - })] }, e); -}); -var Ut; -const Ci = ({ $setting: e, $close: t, extras: i, code: n, primaryKey: r, ...a }) => { - const [o] = te.useForm(), s = Nn(n, r, e); - return A(() => { - s && o.setFieldsValue(s); - }, [s]), p(Y, { actions: j(x.Fragment, { children: [p(P, { name: "保存", type: "primary", widget: () => { - const l = o.getFieldValue("__RESOURCE__"), { initDataUri: u = `/api/${n}` } = e || {}; - o.validateFields(!0).then((c) => l ? d.pick(c, [l]) : c).then((c) => L.post(r ? `${u}/${r}` : `${u}`, c).msg(t)).catch(() => G.error("请先完善表单信息", { duration: 2e3 })); - } }), p(P, { name: "取消", widget: () => t(!1) })] }), extras: i, children: p(On, { form: o, code: n, primaryKey: r, ...a }) }); -}, Ht = /* @__PURE__ */ new Set(), xt = (e = [], t = 0) => { - const i = e[t]; - if (i.length && !Ht.has(i)) { - const n = document.createElement("script"); - n.setAttribute("src", i), n.setAttribute("data-namespace", i), e.length > t + 1 && (n.onload = () => { - xt(e, t + 1); - }, n.onerror = () => { - xt(e, t + 1); - }), Ht.add(i), document.body.appendChild(n); - } -}, St = ({ className: e, type: t, style: i = {}, ...n }) => p("span", { role: "img", className: M("ff-iconfont", e), style: i, ...n, children: p("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: p("use", { xlinkHref: `#${t}` }) }) }); -St.propTypes = { className: w.string, type: w.string.isRequired, style: w.object }, St.init = xt; -const jn = (e, t, i, n) => ke.redirect(i, t, n), Ln = (e, t = {}, i, n = {}) => { - var a; - const r = (a = n.router) == null ? void 0 : a.reduce((o, [s, l, u]) => { - const c = d.get(t, ["router", s]); - if (!c && c !== 0 && l) throw `请传入 ${u}`; - return `${o}/${c}`; - }, `/api/${i}`); - return L.del(r, t.param).msg(); -}, Jt = (e, t, 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 d.isFunction(i) ? i.call(null, { ...t, ...o }) : d.isString(i) && i ? xe.exec(i, t, o) : null; -}, Kt = (e, t, i, n, r) => d.isString(i) && i ? le.getWidgetComponent(i).then(({ default: a }) => G.modal(a, { ...t, $setting: n }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r)).catch((a) => { - G.error(i, { content: a.toString() }); -}) : G.modal(i, { ...t, $setting: n }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), An = (e, t, i, n, r) => G.modal(Ci, { ...t, $setting: n, code: i }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), Vn = (e, t, i, n, r) => G.modal(Tt, { base62params: t, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), In = ({ widget: e, widgetType: t, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s }) => { - const l = ce(ie), [u, c] = E({ leading: !0, trailing: !1 }), g = U(() => { - switch (t) { - case "redirect": - return d.partialRight(jn, e, r); - case "func": - return d.partialRight(Jt, (r == null ? void 0 : r.code) ?? e, { status: u, setStatus: c }); - case "fsdpf-component": - return d.partialRight(Kt, e, r, a); - case "grid-layout-form": - return d.partialRight(An, e, r, a); - case "data-list": - return d.partialRight(Vn, e, r, a); - case "destroy": - return d.partialRight(Ln, e, r, a); - default: - if (Et(e) || x.isValidElement(e)) return d.partialRight(Kt, e, r, a); - if (d.isFunction(e)) return d.partialRight(Jt, (r == null ? void 0 : r.code) || e, { status: u, setStatus: c }); - } - return (...h) => console.error("useButton unknown widgetType", t, ...h); - }, [e, t]); - return [d.debounce((h) => (s == null || s(h), Promise.resolve(Ue(n, h, { list: l })).then((m) => g(h, { ...i, ...m })).then((m) => o == null ? void 0 : o(m)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u]; -}, ki = ({ type: e, name: t, className: i, icon: n, iconPosition: r, size: a }, o = "default") => U(() => { - const s = { type: "primary", className: M("ff-button", i), iconPosition: r, size: a }; - return e === "danger" ? s.danger = !0 : e === "default" && (s.type = e), o === "link" || o === "dashed" ? (s.type = o, e === "default" && (s.className = M(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), n && (s.icon = p(St, { type: n })), t && (s.children = t), s; -}, [o, e, i, n, r]), Je = (e) => function({ className: t, variant: i, children: n, name: r, icon: a, type: o = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: u, onBeforeClick: c, data: g, loading: h, disabled: m, tooltip: f, confirm: C, widget: b = () => { -}, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: I, ...q }) { - const z = U(() => oi(), []), V = d.isEmpty(f) || !f.enabled ? {} : f, R = d.isEmpty(C) ? { enabled: !1 } : Object.assign({ enabled: !0 }, C), B = ki({ className: t, name: r, type: o, icon: a, iconPosition: s }, i ?? e), [N, F] = E(!1), [J, { disabled: de, loading: $e }] = In({ widget: b, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: I }, { onAfterClick: u, onBeforeClick: c }); - return p(Ui, { zIndex: z, okText: "确定", cancelText: "取消", getPopupContainer: (K) => K, ...R, disabled: de || m, open: N, onOpenChange: (K) => { - if (!K) return F(K); - R.enabled ? F(K) : J(g); - }, onConfirm: (K) => { - J(g, K); - }, onClick: (K) => { - K.stopPropagation(); - }, children: p(Hi, { zIndex: z, getPopupContainer: (K) => K, ...V, title: N ? null : V == null ? void 0 : V.title, trigger: ["hover", "click"], children: p(Ze, { loading: $e || h, disabled: de || m, ...B, ...q, children: n || r }) }) }); -}, P = Je("default"); -P.propTypes = { type: w.oneOf(["primary", "default", "danger", ""]), size: w.oneOf(["large", "middle", "small"]), name: w.string, icon: w.string, iconPosition: w.oneOf(["start", "end"]), data: w.any, widget: w.any, widgetType: w.oneOf(["destroy", "redirect", "func", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: w.object, widgetProps: w.object, widgetSetting: w.object, widgetContainerProps: w.object, tooltip: w.exact({ title: w.string.isRequired, placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func }), confirm: w.exact({ title: w.string.isRequired, cancelText: w.string, okText: w.string, okType: w.oneOf(["primary", "default", "danger", ""]), placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func, arrow: w.oneOfType([w.bool, w.exact({ pointAtCenter: w.bool })]) }) }; -const Mn = Je("link"), zn = Je("circle"), Bn = Je("round"), Dn = Je("dashed"), Rt = ({ data: e, widget: t, widgetType: i = "fsdpf-component", widgetData: n, widgetProps: r, widgetSetting: a, widgetContainerProps: o, onAfterClick: s, onBeforeClick: l, children: u, extras: c }) => { - const g = U(() => oi(), []), h = ce(ie), [m, f] = E(!1), [C, b] = E("hover"), [k, S] = E({}), [$, T] = E(), { placement: I, align: q, arrow: z = { pointAtCenter: !0 }, getPopupContainer: V, ...R } = o || {}; - A(() => { - i == "grid-layout-form" ? T(x.createElement(Ci, { ...n, $setting: a, code: t })) : i == "data-list" ? T(x.createElement(Tt, { base62params: e, $setting: a, listCode: t })) : d.isString(t) ? le.getWidgetComponent(t).then(({ default: F }) => { - T(x.createElement(F, { ...n, $setting: a })); - }).catch((F) => T(F.toString())) : Et(t) ? T(x.createElement(t, { ...n, $setting: a })) : x.isValidElement(t) && T(x.cloneElement(t, { ...n, $setting: a })); - }, [t, i, n]), A(() => { - Promise.resolve(Ue(r, e, { list: h })).then(S); - }, [r, e, h.getBase62params]); - const B = (F, J = !1) => (f(F), !F && b("hover"), F ? l == null ? void 0 : l(k) : s == null ? void 0 : s(J)), N = (F) => { - f(!0), b("click"); - }; - return p(Ji, { zIndex: g, placement: I, onPopupClick: N, onClick: N, open: m, align: q, arrow: z, trigger: C, getPopupContainer: V, content: p(qn, { ...R, extras: c, children: $ && x.cloneElement($, { ...k, $close: (F) => B(!1, F) }) }), children: u, onOpenChange: B }); -}, qn = ({ title: e, className: t, children: i, extras: n, width: r, height: a, ...o }) => { - const [s, l] = E({}), u = X((m, f) => l((C) => ({ ...C, [m]: f })), []), c = X((m) => l((f) => ({ ...f, [m]: void 0 })), []), g = e ? x.createElement("div", { className: "ff-popup-title" }, e) : s == null ? void 0 : s.title, h = n ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, n); - return p(We.Provider, { value: { ele: s, mount: u, unmount: c }, children: j("div", { className: M("ff-popup ff-popover", t, s.rootClassName), style: { width: r, height: a }, ...o, children: [j("div", { className: "ff-popup-header", children: [g, s == null ? void 0 : s["sub-title"]] }), i, j("div", { className: "ff-popup-footer", children: [h, s == null ? void 0 : s.extras, s == null ? void 0 : s.actions] })] }) }); -}; -Rt.propTypes = { widgetType: w.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; -const _t = ({ options: e = [], triggerWeights: t = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: i = (m, f, C) => { -}, onBeforeClick: n = (m, f, C) => { -}, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: u = (m, f) => p(P, { ...m, data: f }, m.uuid || Qe()), widgetContainerProps: c = {}, children: g, data: h }) => { - if (d.isEmpty(e)) return g; - const [m, f] = U(() => (e || []).reduce((b, k) => { - const S = t.indexOf(k.widgetType); - return S === -1 ? b[1].push(k) : b[0] ? S < t.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = k) : b[1].push(k) : b[0] = k, b; - }, [null, []]), [e, t]); - o ? g = o(m, h) || g : g || (g = p(Ze, { ...ki(Object.assign(m != null && m.name || m != null && m.icon ? {} : { icon: "icon-location" }, m, { size: a }), r) })); - const C = f.map((b) => u(Object.assign({ uuid: b.uuid, type: b.type, name: b.name, widget: b.widget, widgetType: b.widgetType, widgetProps: b.widgetProps, widgetData: b.widgetData, widgetSetting: b.widgetSetting, widgetContainerProps: b.widgetContainerSetting, confirm: b.confirm, onAfterClick: d.partialRight(i, b, h), onBeforeClick: d.partialRight(n, b, h) }, { size: l, variant: s }), h)); - return p(Rt, { widget: m == null ? void 0 : m.widget, widgetType: m == null ? void 0 : m.widgetType, widgetProps: m == null ? void 0 : m.widgetProps, widgetSetting: m == null ? void 0 : m.widgetSetting, widgetContainerProps: Object.assign({}, c, m == null ? void 0 : m.widgetContainerProps), data: h, widgetData: m == null ? void 0 : m.widgetData, extras: C, onAfterClick: d.partialRight(i, m, h), onBeforeClick: d.partialRight(n, m, h), children: g }); -}; -_t.propTypes = { triggerWeights: w.array, options: w.arrayOf(w.shape({ ...P.propTypes, widgetType: P.propTypes.widgetType.isRequired })), btnSize: P.propTypes.size, btnRender: w.func, btnVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: w.func, labelSize: P.propTypes.size, onAfterClick: w.func, onBeforeClick: w.func, widgetContainerProps: P.propTypes.widgetContainerProps, data: P.propTypes.data }, P.Link = Mn, P.Link.defaultProps = P.defaultProps, P.Link.propTypes = P.propTypes, P.Circle = zn, P.Circle.defaultProps = P.defaultProps, P.Circle.propTypes = P.propTypes, P.Round = Bn, P.Round.defaultProps = P.defaultProps, P.Round.propTypes = P.propTypes, P.Dashed = Dn, P.Dashed.defaultProps = P.defaultProps, P.Dashed.propTypes = P.propTypes, P.Popover = Rt, P.GroupPopover = _t; -const Wn = ({ fields: e, formProps: t, $close: i }) => { - const [n] = te.useForm(), r = U(() => [{ name: "__PROPS__", value: t }], [t]); - return p(Y, { actions: j(x.Fragment, { children: [p(P, { name: "取消", widget: () => i(!1) }), p(P, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(i) })] }), children: p(te, { fields: r, form: n, className: "ff-modal-form", children: e == null ? void 0 : e.map(({ code: a, ...o }) => p(bi, { code: a, ...o }, a)) }) }); -}, Un = ({ className: e, $close: t, children: i, title: n, subTitle: r, actions: a, extras: o, ...s }) => j(Zi, { ...s, prefixCls: "ff-drawer", className: M("ff-popup", e), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (l) => ({ motionAppear: !0, motionName: `panel-motion-${l}` }), children: [j("div", { className: "ff-popup-header", children: [p("button", { "aria-label": "Close", className: "ff-popup-close", onClick: s.onClose, children: p($t, { type: "close" }) }), n, r] }), p("div", { className: "ff-popup-body", children: i }), j("div", { className: "ff-popup-footer", children: [o, a] })] }), Hn = ({ className: e, $close: t, $event: i, children: n, title: r, subTitle: a, actions: o, extras: s, placement: l, ...u }) => { - const c = (i == null ? void 0 : i.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: i == null ? void 0 : i.pageX, y: i == null ? void 0 : i.pageY } }; - return p(en, { ...u, ...c, prefixCls: "ff-modal", modalRender: () => j("div", { className: M("ff-modal-content ff-popup", e), children: [j("div", { className: "ff-popup-header", children: [p("button", { "aria-label": "Close", className: "ff-popup-close", onClick: u.onClose, children: p($t, { type: "close" }) }), r, a] }), p("div", { className: "ff-popup-body", children: n }), j("div", { className: "ff-popup-footer", children: [s, o] })] }) }); -}, xi = ({ placement: e, $close: t, $event: i, children: n, title: r, ...a }) => { - const [o, s] = E({}), [l, u] = E(!0), c = X((f, C) => s((b) => ({ ...b, [f]: C })), []), g = X((f) => s((C) => ({ ...C, [f]: void 0 })), []); - let h = { ...a, className: o.rootClassName, title: o.title || r && x.createElement("div", { className: M("ff-popup-title") }, r), subTitle: o["sub-title"], actions: o.actions, extras: o.extras, children: n, $close: t, $event: i, onClose: () => u(!1) }; - const m = () => { - t(!1); - }; - return p(We.Provider, { value: { ele: o, mount: c, unmount: g }, children: e && e !== "center" ? p(Un, { ...h, placement: e, open: l, afterOpenChange: (f) => !f && m() }) : p(Hn, { ...h, visible: l, afterClose: m }) }); -}; -xi.propTypes = { placement: w.oneOf(["center", "left", "top", "right", "bottom"]) }; -const _ = () => { - const [e, t] = Vi({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (a) => { - const { offsetHeight: o } = a; - return { height: o }; - }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = x.useReducer((a) => a + 1, 0); - A(() => { - _.$onClick = n, _.$queue.forEach(([a, o, s], l, u) => { - r([o, s], ...a), delete u[l]; - }); - }, []); - const n = (a, o = {}, s = {}) => new Promise((l, u) => r([l, u], a, o, s)), r = ([a, o], s, l = {}, u = {}) => { - const c = _.$index++, g = (h) => ((m, f) => (_.$popups.delete(m), i(), f == null ? void 0 : f()))(c, () => a(h)); - if (s === ii) return e.open({ ...u, key: c, content: x.createElement(s, { ...l, $close: () => e.close(c) }) }); - _.$popups.set(c, x.createElement(xi, { zIndex: c, maskClosable: !1, $event: l == null ? void 0 : l.$event, ...u, key: c, $close: g }, x.isValidElement(s) ? x.cloneElement(s, { ...l, $close: g }) : s != null && s.name || It.isForwardRef(s) || (s == null ? void 0 : s.$$typeof) === It.ForwardRef ? x.createElement(s, { ...l, $close: g }) : s)), i(); - }; - return j(x.Fragment, { children: [Array.from(_.$popups).map(([a, o]) => o), t] }); -}; -_.$popups = /* @__PURE__ */ new Map(), _.$index = 9999, _.$queue = [], _.$onClick = (...e) => new Promise((t, i) => { - _.$queue.push([e, t, i]); -}); -const Gt = (e, t, i = {}) => _.$onClick(e, t, i), gt = (e, { showProgress: t, duration: i, ...n } = { duration: 1.5 }) => _.$onClick(ii, { content: e, ...n }, { showProgress: t, duration: i }), G = { modal: Gt, confirm: (e, t = {}) => _.$onClick(tn, { content: e, ...t }, { placement: "center" }), form: (e, t = {}, i = {}) => Gt(Wn, { formProps: i, fields: e }, { placement: "center", ...t }).then((n) => { - if (n === !1) throw !1; - return n; -}), notification: gt, success: (e, t = { duration: 1.5 }) => gt(e, { ...t, className: "ff-notification-success", icon: "check" }), error: (e, t = { duration: 1.5 }) => gt(e, { ...t, className: "ff-notification-error", icon: "close" }) }; -je.configure({ showSpinner: !1 }), Le.interceptors.request.use((e) => { - e.headers.Platform = "web", e.headers.SaaS = window.localStorage.getItem("SaaS"); - const t = window.localStorage.getItem(Xe); - return e.headers.Authorization = t ? `Bearer ${t} ` : void 0, je.inc(), e; -}, (e) => (je.done(), Promise.reject({ code: -1, msg: e }))), Le.interceptors.response.use(({ data: e, headers: t }) => (je.done(), { ...e, res: t == null ? void 0 : t.res }), function(e) { - return je.done(), Promise.reject(e.message); -}), window.addEventListener("unhandledrejection", mt.onUnhandledRejection), mt.onMsg = (e, t) => G[[0, 1].includes(e) ? "success" : "error"](t).then(() => e === 20300 && ke.redirect(Ae.get("Common.WEBSITE_LOGIN_PAGE"))); -const vt = { appUrl: "", init: (e, t, i) => { - vt.appUrl = i, Le.defaults.baseURL = i, Le.defaults.timeout = 15e3, Object.assign(vt, new mt(e, t, Le)); -} }, L = vt; -class Ft extends Error { - constructor(t, i) { - super(i), Error.captureStackTrace && Error.captureStackTrace(this, Ft), !i instanceof Ve && (this.name = `${t} Error Runtime`); - } -} -class Ve extends Error { - constructor(t, ...i) { - super(...i), Error.captureStackTrace && Error.captureStackTrace(this, Ve), this.name = `${t} Not Found`; - } -} -const pt = "mine", Xe = "token"; -var Ce, Oe; -const oe = class oe { - constructor() { - O(this, Oe, /* @__PURE__ */ new Map()); - v(this, "setVendor", (t, i) => y(this, Oe).set(t, new ei(i, async (n, r) => { - var o, s; - if (!(n != null && n.default)) throw "@pkg not found"; - let a = () => r; - switch ("function") { - case typeof (a = (o = n.default) == null ? void 0 : o[`./${r}/index.jsx`]): - case typeof (a = (s = n.default) == null ? void 0 : s[`./${r}/index.js`]): - return a(); - } - throw new Ve(r); - }))); - v(this, "getWidgetComponent", async (t) => { - if (!t) throw "getWidgetComponent widget is required"; - if (t != null && t.startsWith("blob:") || t != null && t.startsWith("http:") || t != null && t.startsWith("https:")) return await import(t); - const [, i] = t == null ? void 0 : t.split("@pkg/"); - if (!i) throw new Ve(t); - try { - return y(this, Oe).has("pkg") ? await y(this, Oe).get("pkg").get(i) : await import(`${L.appUrl}/api/pkg-import/web?name=${t}`); - } catch (n) { - throw new Ft(t, n); - } - }); - v(this, "getRoutes", () => L.get("/api/my-router").then((t) => [...t, { 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((t) => new Map(t))); - v(this, "getMenus", () => L.get("/api/my-menu")); - v(this, "getConfigure", () => L.get("api/init-configure")); - v(this, "getWidgetOperationAuth", () => L.get("/api/init-widget-operation-auth").then((t) => t.reduce((i, { uuid: n, auth: r }) => [...i, [n, r]], []))); - v(this, "getPhoneNumber", (t) => L.get(`/api/user-wx-phone-number/${t}`)); - v(this, "getUserToken", () => { - const t = window.localStorage.getItem(Xe); - if (!t) return ""; - const i = t.split("."); - if (!Array.isArray(i) || i.length !== 3) throw "登录令牌无效!"; - const { iat: n } = JSON.parse(window.atob(i[1])); - if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; - return t; - }); - v(this, "checkUserToken", () => { - try { - return !!this.getUserToken(); - } catch { - return !1; - } - }); - v(this, "getUserInfo", (t = !0) => { - var i; - 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 } = L.decode(window.localStorage.getItem(pt) || "", {}); - return a === r ? Promise.resolve(o) : L.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(pt, L.encode({ ...s, iat: r })), s)); - } catch (n) { - console.error(n), t && G.error("请登录").then(this.logout); - } - return Promise.resolve(null); - }); - v(this, "login", (t, i, n = {}) => L.post("/api/user-token", { username: t, passwd: Ii.hash(i), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(Xe, r), r))); - v(this, "logout", (t) => (window.localStorage.removeItem(pt), window.localStorage.removeItem(Xe), t == null ? void 0 : t())); - if (y(oe, Ce)) return y(oe, Ce); - } -}; -Ce = new WeakMap(), Oe = new WeakMap(), O(oe, Ce, null), v(oe, "getInstance", () => (y(oe, Ce) || H(oe, Ce, new oe()), y(oe, Ce))); -let Pt = oe; -const le = Pt.getInstance(), Jn = x.createContext({ user: {}, initUser: () => { -}, initUserComplete: !1 }), Kn = x.createContext({ set: () => { -}, get: () => { -}, assign: () => { -}, currentRoute: () => { -} }), Et = (e) => !!(e != null && e.name) && (e.prototype instanceof x.Component || /^[A-Z]/.test(e.name)), _n = (e, t) => { - if (!e || typeof window > "u") return; - let i = document.querySelector(`style[ff-style-token="${t}"]`); - return i ? (i.innerHTML = e, e) : (i = document.createElement("style"), i.setAttribute("ff-style-token", t), i.setAttribute("type", "text/css"), i.innerHTML = e, document.head.appendChild(i), e); -}, Gn = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Jn, AppGlobalParamsContext: Kn, cache: ei, configure: Ae, default: le, func: xe, http: L, insertStyle: _n, isReactComponent: Et, route: ke }, Symbol.toStringTag, { value: "Module" })); -export { - Nt as $, - yn as A, - xn as B, - cn as C, - et as D, - un as E, - sn as F, - xr as G, - wn as H, - br as I, - Cr as J, - li as K, - wt as L, - on as M, - ln as N, - Sn as O, - vn as P, - Sr as Q, - gi as R, - vr as S, - st as T, - Pr as U, - $r as V, - He as W, - ot as X, - Tr as Y, - Nr as Z, - On as _, - ni as a, - bi as a0, - Ci as a1, - $n as a2, - Tn as a3, - Nn as a4, - wi as a5, - Rn as a6, - Rr as a7, - St as a8, - P as a9, - nn as aa, - In as ab, - Y as ac, - We as ad, - ti as ae, - _ as af, - G as ag, - gr as ah, - pr as ai, - mr as aj, - le as ak, - Et as al, - _n as am, - L as an, - ei as ao, - Ae as ap, - xe as aq, - ke as ar, - Jn as as, - Kn as at, - Ue as b, - fr as c, - ri as d, - yr as e, - wr as f, - rn as g, - oi as h, - an as i, - ci as j, - kr as k, - pi as l, - hi as m, - Cn as n, - bn as o, - mi as p, - ui as q, - ut as r, - di as s, - ee as t, - hr as u, - fn as v, - hn as w, - pn as x, - Tt as y, - ie as z -}; diff --git a/dist/common/main-DnobNY7x.js b/dist/common/main-DnobNY7x.js new file mode 100644 index 0000000..7f60ec2 --- /dev/null +++ b/dist/common/main-DnobNY7x.js @@ -0,0 +1,1068 @@ +var Ei = Object.defineProperty; +var Lt = (e) => { + throw TypeError(e); +}; +var Oi = (e, t, i) => t in e ? Ei(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i; +var $ = (e, t, i) => Oi(e, typeof t != "symbol" ? t + "" : t, i), At = (e, t, i) => t.has(e) || Lt("Cannot " + i); +var y = (e, t, i) => (At(e, t, "read from private field"), i ? i.call(e) : t.get(e)), E = (e, t, i) => t.has(e) ? Lt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), U = (e, t, i, n) => (At(e, t, "write to private field"), n ? n.call(e, i) : t.set(e, i), i); +var Vt = (e, t, i, n) => ({ + set _(r) { + U(e, t, r, i); + }, + get _() { + return y(e, t, n); + } +}); +import { jsx as p, jsxs as O } from "react/jsx-runtime"; +import x, { useEffect as L, useState as F, useCallback as X, useMemo as H, useRef as W, useContext as ce, useId as pt, isValidElement as ji, useLayoutEffect as Li } from "react"; +import w from "prop-types"; +import I from "classnames"; +import * as It from "react-is"; +import { useNotification as Ai } from "rc-notification"; +import d from "lodash"; +import te, { FieldContext as Yt, Field as Xt } from "rc-field-form"; +import { M as ct, N as Oe, a as je, P as mt, S as Vi } from "./vender-CtjyT19B.js"; +import Qt from "immutability-helper"; +import { Form as Ge, Input as Ii, Button as Xe, Pagination as Mi, Tree as zi, Breadcrumb as Bi, Table as Di, Empty as qi, Popconfirm as Wi, Tooltip as Ui, Popover as Hi } from "antd"; +import { useMergedState as Ji } from "rc-util"; +import { generatePath as Ki, useInRouterContext as Zt, useParams as _i, useLocation as Gi, createBrowserRouter as Yi, Navigate as Xi } from "react-router-dom"; +import "rc-util/lib/hooks/useMergedState"; +import Qi from "rc-drawer"; +import Zi from "rc-dialog"; +var Ne, Ve, Te, de, ve, Se; +class ei { + constructor(t, i) { + E(this, Ne, /* @__PURE__ */ new Map()); + E(this, Ve, !0); + E(this, Te, []); + E(this, de); + E(this, ve, () => y(this, de)); + E(this, Se, () => Promise.resolve()); + $(this, "get", (...t) => new Promise((i, n) => { + const r = JSON.stringify(t); + if (y(this, Ne).has(r)) return i(y(this, Se).call(this, y(this, de), ...t)); + if (y(this, de) === void 0) y(this, Te).push([t, i, n]), y(this, Ve) && (U(this, Ve, !1), Promise.resolve(typeof y(this, ve) == "function" ? y(this, ve).call(this) : y(this, ve)).then((a) => U(this, de, a || null)).finally(() => { + y(this, Te).forEach(([a, o, s]) => { + try { + const l = y(this, Se).call(this, y(this, de), ...a); + y(this, Ne).set(JSON.stringify(a), l), o(l); + } catch (l) { + s(l); + } + }), y(this, Te).length = 0; + })); + else { + const a = y(this, Se).call(this, y(this, de), ...t); + y(this, Ne).set(r, a), i(a); + } + })); + U(this, Se, i), U(this, ve, t); + } +} +Ne = new WeakMap(), Ve = new WeakMap(), Te = new WeakMap(), de = new WeakMap(), ve = new WeakMap(), Se = new WeakMap(); +const ur = () => p("div", { children: "Empty" }), qe = x.createContext({ ele: {}, mount: () => { +}, unmount: () => { +} }), Y = ({ rootClassName: e, className: t, children: i, actions: n, title: r, subTitle: a, extras: o, style: s = {} }) => { + const { mount: l, unmount: u } = x.useContext(qe); + return Y.Action({ children: n }), Y.Title({ children: r }), Y.SubTitle({ children: a }), Y.Extra({ children: o }), L(() => (l("rootClassName", e), () => u(e)), [e]), p("div", { className: I("ff-container", t), style: s, children: i }); +}, _e = (e) => ({ children: t, className: i }) => { + const { mount: n, unmount: r } = x.useContext(qe); + return L(() => (t && n(e, x.createElement("div", { key: `ff-${e}`, className: I(`ff-popup-${e}`, i) }, t)), () => r(e)), [i, t]), null; +}; +Y.Action = _e("actions"), Y.Title = _e("title"), Y.SubTitle = _e("sub-title"), Y.Extra = _e("extras"), Y.propTypes = { className: w.string, style: w.object, title: w.any, subTitle: w.any, actions: w.any, extras: w.any }; +const gr = () => p(Y, { className: "ff-loading", children: O("div", { className: "loader", children: [O("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), O("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), O("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), O("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] })] }) }), pr = () => p("div", { children: "NotFound" }), ti = ({ children: e }) => { + const [t, i] = F({}), n = X((a, o) => i((s) => ({ ...s, [a]: o })), []), r = X((a) => i((o) => ({ ...o, [a]: void 0 })), []); + return typeof (e == null ? void 0 : e.type) == "string" ? e : p(qe.Provider, { value: { ele: t, mount: n, unmount: r }, children: x.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) }); +}; +ti.propTypes = { children: w.element.isRequired }; +const Mt = { 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"] }, $t = ({ type: e, props: t }) => p("i", { ...t, children: p("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Mt[e] || Mt.info).map((i, n) => p("path", { d: i }, n)) }) }), ii = ({ className: e, content: t, icon: i, $close: n }) => O(x.Fragment, { children: [i && p("div", { className: I("ff-notification-icon", e), children: p($t, { type: i }) }), t] }), en = ({}) => p(Y, { children: "Confirm" }); +var pe, Re; +const ne = class ne { + constructor() { + E(this, Re, /* @__PURE__ */ new Map()); + $(this, "init", (t) => U(this, Re, new Map(t))); + $(this, "check", (t) => !y(this, Re).has(t) || y(this, Re).get(t)); + if (y(ne, pe)) return y(ne, pe); + } +}; +pe = new WeakMap(), Re = new WeakMap(), E(ne, pe, null), $(ne, "getInstance", () => (y(ne, pe) || U(ne, pe, new ne()), y(ne, pe))); +let ft = ne; +const tn = ft.getInstance(), nn = (e, t, i = "children") => { + if (d.isEmpty(e)) return {}; + const n = d.find(e, ["value", t]); + if (!d.isEmpty(n)) return n; + const r = e.length; + for (let a = 0; a < r; a++) { + const { [i]: o } = e[a], s = nn(o, t, i); + if (!d.isEmpty(s)) return s; + } + return {}; +}, ni = (e = "Input", t = "@pkg/ff/grid-layout-forms") => e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`; +var me, Ie; +const re = class re { + constructor() { + E(this, Ie, null); + $(this, "init", (t) => U(this, Ie, t)); + $(this, "get", (t, i) => d.get(y(this, Ie), t, i)); + if (y(re, me)) return y(re, me); + } +}; +me = new WeakMap(), Ie = new WeakMap(), E(re, me, null), $(re, "getInstance", () => (y(re, me) || U(re, me, new re()), y(re, me))); +let ht = re; +const Le = ht.getInstance(), zt = { null2json: (e) => Object.create(), null2array: (e) => [], null2number: (e) => 0, null2bool: (e) => !1, null2string: (e) => "", null2integer: (e) => 0, null2float: (e) => 0, string2json: (e) => e ? JSON.parse(e) : "{}", string2array: (e) => e.substr(0, 1) === "[" && e.substr(-1) === "]" ? JSON.parse(e) : e.split(","), string2number: (e) => e == "" ? 0 : +e, string2integer: (e) => e == "" ? 0 : +e, string2float: (e) => e == "" ? 0 : +e, string2bool: (e) => { + switch (`${e}`.toLowerCase()) { + case "0": + case "false": + case "[]": + case "{}": + return !1; + } + return !!e; +}, string2string: (e) => e, json2json: (e) => e, json2array: (e) => e ? Object.values(e) : [], json2number: (e) => Object.keys(e).length, json2integer: (e) => Object.keys(e).length, json2float: (e) => Object.keys(e).length, json2bool: (e) => Object.keys(e).length > 0, json2string: (e) => e ? JSON.stringify(e) : "", array2json: (e) => ({ ...e }), array2array: (e) => e, array2number: (e) => e.length, array2integer: (e) => e.length, array2float: (e) => e.length, array2bool: (e) => e.length > 0, array2string: (e) => JSON.stringify(e), number2json: (e) => ({}), number2array: (e) => [e], number2number: (e) => e, number2integer: (e) => e, number2float: (e) => e, number2bool: (e) => !!e, number2string: (e) => e.toString(), boolean2json: (e) => ({}), boolean2array: (e) => [], boolean2number: (e) => +e, boolean2integer: (e) => +e, boolean2float: (e) => +e, boolean2bool: (e) => e, boolean2string: (e) => e ? "true" : "false" }, ee = (e, t) => { + let i = "string"; + i = Array.isArray(e) ? "array" : typeof e, d.isObject(e) && (i = "json"); + const n = `${i}2${t}`; + return Reflect.has(zt, n) ? zt[n](e) : e; +}, We = (e = {}, t = {}, i = {}, n = "") => ri(e, (r, a) => a === "type" && r === "code") ? ai(e, t, i, n) : si(e, t, n), ri = (e, t = () => !1) => d.some(e, (i) => !!d.some(i, t) || (d.isEmpty(i) || !d.isPlainObject(i) && !d.isArray(i) ? void 0 : ri(i, t))), ai = async (e = {}, t = {}, i = {}, n = "") => { + let r = /* @__PURE__ */ Object.create(null); + for (let a in e) { + let o; + if (Reflect.has(e[a], "type") && ["code", "field", "router", "query", "string"].includes(e[a].type)) { + const { type: s, value: l = "", default: u = n } = e[a]; + switch (s) { + case "code": + o = await xe.exec(l, t, i); + break; + case "field": + o = d.get(t, l) ?? d.get(t, l.substring(l.indexOf(".") + 1)); + break; + case "router": + case "query": + o = ke.getPageParams(l); + break; + case "string": + o = l; + } + o ?? (o = u); + } else o = await ai(e[a], t, i, n); + d.set(r, a, o); + } + return r; +}, si = (e = {}, t = {}, i = "") => Object.keys(e || {}).reduce((n, r) => { + if (d.isPlainObject(e[r])) { + let a; + if (Reflect.has(e[r], "type") && ["field", "router", "query", "string"].includes(e[r].type)) { + const { type: o, value: s = "", default: l = i } = e[r]; + switch (o) { + case "field": + a = d.get(t, s) ?? d.get(t, s.substring(s.indexOf(".") + 1)); + break; + case "router": + case "query": + a = ke.getPageParams(s); + break; + case "string": + a = s; + } + a ?? (a = l); + } else a = si(e[r], t, i); + d.set(n, r, a); + } + return n; +}, {}), dt = (e, t) => e && typeof e == "object" ? Array.isArray(e) ? e.map((i) => dt(i, t)) : Object.keys(e).reduce((i, n) => (t[n] ? i[t[n]] = dt(e[n], t) : i[n] = dt(e[n], t), i), {}) : e, mr = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => { + const t = 16 * Math.random() | 0; + return (e === "x" ? t : 3 & t | 8).toString(16); +}), fr = (e) => { + var t, i; + return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.name : ""; +}, hr = (e) => { + var t, i; + return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.category : ""; +}, yr = (e) => { + var t, i; + return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.owner : ""; +}, rn = (e, t = 32, i = "auto") => { + const n = yt(e), r = i === "auto" ? "x64" : i; + if (t === 32) return ct.x86.hash32(n).toString(); + if (t === 128) return r === "x64" ? ct.x64.hash128(n) : ct.x86.hash128(n); + throw new Error("bits 只能是 32 或 128"); +}, yt = (e) => e == null ? "null" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : typeof e == "function" ? e.toString() : Array.isArray(e) ? "[" + e.map(yt).join(",") + "]" : typeof e == "object" ? "{" + Object.keys(e).sort().map((t) => `${t}:${yt(e[t])}`).join(",") + "}" : String(e); +var Ze, Me, ze, et; +const tt = class tt { + constructor(...t) { + E(this, Me, []); + E(this, ze, (t) => { + var i; + for (let n of t) Array.isArray(n[0]) ? y(this, ze).call(this, n) : y(this, Me).push(y(i = tt, Ze).call(i, n[0], n[1])); + }); + $(this, "toValue", async (t, i = null) => { + const n = { getValue: () => t, getRecord: () => i }; + return await y(this, Me).reduce(async (r, a) => { + try { + const o = await r; + return (await a).call(n, o); + } catch (o) { + return console.error(o), r; + } + }, t); + }); + $(this, "toRender", (t, i, n = null) => x.createElement(y(this, et), { value: t, record: i }, n)); + E(this, et, ({ value: t, record: i, children: n }) => { + const [r, a] = F(n); + return at(() => { + let o = !1; + return a(n), this.toValue(t, i).then((s) => ee(s, "string")).then((s) => !o && a(s)).catch((s) => !o && a(`${s}`)), () => o = !0; + }, [t, i]), r; + }); + y(this, ze).call(this, t); + } +}; +Ze = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), et = new WeakMap(), E(tt, Ze, d.memoize((t, i) => le.getWidgetComponent(t).then((n) => { + var r; + return ((r = n.default) == null ? void 0 : r.call(n, i)) || ((a) => a); +}), (t, i) => `${t}::${ee(i, "string")}`)); +let Qe = tt; +const an = (e, t = {}) => H(() => e == null ? void 0 : e.map(({ widgetByJs: i, widgetByJsSetting: n, ...r }, a) => i ? { ...r, render: (o, s) => new Qe([i, n]).toRender(o, s, "-") } : r), [e, t]), wr = (e) => { + const [t, i] = F({}); + return L(() => { + let n = !1; + return e && j.get(`/api/_/${e}`).then((r) => d.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; + }, [e]), t; +}, br = (e, t = {}) => { + const [i, n] = F({ dataSource: [] }); + return Ue(() => { + let r = !1; + return e && j.get(`/api/${e}/${j.encode({ page: 1, ...t })}`).then((a) => !r && n(a)), () => r = !0; + }, [e, t]), i; +}, oi = (e = [], t = /* @__PURE__ */ new Map(), i = "id", n) => { + const r = X(n ? (a) => d.get(a, i, d.get(a, [n, i])) : (a) => d.get(a, i), [i, n]); + return X((a) => e == null ? void 0 : e.filter((o) => !o.uuid || !t.has(o.uuid) || t.get(o.uuid).some((s) => s == r(a))), [e, t, r]); +}, wt = (e = [], t = /* @__PURE__ */ new Map(), i = [], n = "id", r) => { + const a = X(r ? (o) => d.get(o, n, d.get(o, [r, n])) : (o) => d.get(o, n), [n, r]); + return H(() => { + if (d.isEmpty(e) || !e.some(({ uuid: s }) => tn.check(s))) return !1; + if (d.isEmpty(t) || d.isEmpty(i)) return !0; + const o = i.map((s) => a(s)); + return e.some(({ uuid: s }) => !s || !t.has(s) || t.get(s).some((l) => o.some((u) => u == l))); + }, [e, i, t, a]); +}, sn = (e, t, i = "id", n = null) => { + const r = rt(), a = W(!1), o = W(e.dataSource), s = W(e.itemOperationsAccess); + return L(() => (o.current = e.dataSource, s.current = e.itemOperationsAccess, () => a.current = !1), [e.dataSource, e.itemOperationsAccess]), a.current && (e.dataSource = o.current, e.itemOperationsAccess = s.current), [e, (l = 0, u = null) => { + var c, g; + if (a.current = !1, l === 1) return (c = e.onReload) == null ? void 0 : c.call(e); + if (l === 2) { + const f = d.get(u, "__PARENT_ID__", ""), m = d.get(u, i, d.get(u, [n, i], "")), h = d.findIndex(o.current, ["__PARENT_ID__", f]), b = d.findIndex(h > -1 ? d.get(o.current, [h, "children"]) : o.current, [i, m]); + if (b === -1) return (g = e.onReload) == null ? void 0 : g.call(e); + Promise.all([j.get(`/api/${t}/detail/${m}`), j.post(`/api/${t}/list-operations-access`, { ids: m })]).then(([C, k]) => { + const P = d.get(o.current, h > -1 ? [h, "children", b, "children"] : [b, "children"]); + o.current = Qt(o.current, h > -1 ? { [h]: { children: { $splice: [[b, 1, { ...C, children: P }]] } } } : { $splice: [[b, 1, { ...C, children: P }]] }); + const S = new Map(k); + s.current.forEach((R, V) => { + var q; + (q = S.get(V)) != null && q.some((A) => A == m) || s.current.set(V, R.filter((A) => A !== m)); + }), S.forEach((R, V) => { + s.current.has(V) ? s.current.set(V, d.uniq([...s.current.get(V) || [], ...R])) : s.current.set(V, R); + }); + }).then(() => { + a.current = !0, r(); + }); + } + }]; +}, on = (e, t) => { + const i = rt(), n = W(t), r = W(/* @__PURE__ */ new Map()), a = W([]), o = d.throttle((l) => { + a.current = [], j.list(e, d.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: u, condition: c, total: g, tab: f, sider: m, page: h, pageSize: b, operationsAccess: C, dataSource: k }) => { + n.current = { tab: f, condition: c, sider: m, keyword: u, total: g, pageSize: b, page: k != null && k.length ? h : 1 }, a.current = k, r.current = new Map(C), i(); + }); + }, 380, { leading: !1, trailing: !0 }); + at(() => { + a.current = [], e && o(t); + }, [e, t]); + const s = H(() => d.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: Qt(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: t == null ? void 0 : t.payload }); +}, ln = ({ listCode: e, className: t, layouts: i, dataSource: n, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: c, primaryKey: g, title: f, itemGridLayout: m, $setting: h, tabs: b, isConditionFormLayout: C, isTreeSider: k, treeSiderConfig: P }) => { + const { classNames: S, onClickCallback: R } = ce(ie), V = d.pick(h, ["column", "colWidth", "beforeRender", "afterRender", "style"]), q = oi(l, u, g, c), A = X((M, T, z) => p(cn, { className: I("ff-data-list-framework-item", S.item), operations: a ? q(T) : [], data: c ? { [c]: T } : T, children: M, onClickCallback: R }), [c, g, a, R, l, u]); + return O("div", { className: I("ff-data-list-framework", t), children: [p(i.sider, { isTreeSider: k, ...P }), O("div", { className: I("ff-data-list-container", S == null ? void 0 : S.container), children: [p(i.filter, { isConditionFormLayout: C }), p(i.toolbar, { title: f, tabs: b }), p(kn, { ...V, ...m, primaryKey: g, itemRender: A, dataSource: n }), p(i.footer, { isPaginate: r, isOperations: o, operations: s })] })] }); +}, cn = ({ className: e, operations: t, children: i, data: n, onClickCallback: r }) => O("div", { className: I("data-list-grid-layout-item-container", e), children: [i, !!(t != null && t.length) && p("div", { className: "data-list-grid-layout-item-actions", children: t.map((a) => p("span", { className: "data-list-grid-layout-item-action", children: p(N.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 || pt()) }, (a == null ? void 0 : a.uuid) || pt())) })] }), dn = ({ listCode: e, className: t, layouts: i, dataSource: n, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: c, primaryKey: g, title: f, tabs: m, isPaginate: h, isTreeSider: b, treeSiderConfig: C, isConditionFormLayout: k, ...P }) => { + const { classNames: S, onClickCallback: R } = ce(ie), V = oi(l, u, g, c), q = wt(l, u, n, g, c); + return O("div", { className: I("ff-data-table-framework", t), children: [p(i.sider, { isTreeSider: b, ...C }), O("div", { className: I("ff-data-table-container", S == null ? void 0 : S.container), children: [p(i.filter, { isConditionFormLayout: k }), p(i.toolbar, { title: f, tabs: m }), p(hn, { ...P, primaryKey: g, className: "ff-data-table-content", columns: r, dataSource: n, operationRender: q ? (A) => { + var M; + return p("div", { className: "ff-data-table-actions", children: (M = V(A)) == null ? void 0 : M.map((T, z) => p(N.Link, { size: "small", uuid: T.uuid, type: T.type, name: T.name, widget: T.widget, widgetType: T.widgetType, widgetProps: T.widgetProps, widgetData: T.widgetData, widgetSetting: T.widgetSetting, widgetContainerProps: T.widgetContainerSetting, data: A, confirm: T.confirm, onAfterClick: (v) => v !== !1 && (R == null ? void 0 : R(T.isRefresh, A)) }, T.uuid || z)) }); + } : null }), p(i.footer, { isPaginate: h, isOperations: o, operations: s })] })] }); +}, ie = x.createContext({ listCode: "", classNames: {}, getBase62params: (e, t) => { +}, onReload: () => { +}, onClickCallback: () => { +}, onConditionChange: () => { +}, onTabChange: () => { +}, onSiderChange: () => { +}, onKeywordChange: () => { +}, onPageChange: () => { +}, onPageSizeChange: () => { +} }), li = (e, t, i, n, r = {}, a = 0) => { + const o = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${e}`, "--grid-layout-y": `${t}`, "--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"] = Bt(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"] = Bt(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; +}, Bt = (e, t, i, n) => `${e || 0}px ${t || 0}px ${i || 0}px ${n || 0}px`, Cr = (e = "Text", t = "@pkg/ff/grid-layouts") => e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, ci = ({ className: e, isConditionFormLayout: t }) => { + var f, m; + const [i, n] = F({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = x.useContext(ie), { keyword: u, condition: c } = (s == null ? void 0 : s()) || {}, [g] = Ge.useForm(); + return L(() => { + r && t && j.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: h, marginX: b, marginY: C, rowHeight: k, cols: P, fields: S }) => { + n({ resource: h, itemMargin: [b, C], rowHeight: k, cols: P, fields: S }); + }).catch(() => n({})); + }, [r, t]), L(() => { + g.setFieldsValue({ keyword: u, ...c }); + }, [JSON.stringify([u, c])]), p("div", { className: I("ff-data-list-filter", l.filter, e), children: p(Ge, { form: g, layout: "vertical", autoComplete: "off", onFinish: ((f = i.fields) == null ? void 0 : f.length) > 1 ? (h) => o({ [i.resource]: h[i.resource] }, h.keyword) : () => { + }, onValuesChange: (h) => { + d.isEmpty(d.omit(h, ["keyword"])) || g.submit(); + }, children: ((m = i.fields) == null ? void 0 : m.length) > 1 ? p(Tt, { ...i, children: p(un, { onReset: () => { + const { keyword: h, condition: b } = s("init") || {}; + g.setFieldsValue({ keyword: h, ...b }); + } }) }) : p("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: p("div", { className: "grid-layout-item", style: li(20, 0, 5, 2), children: p(Ge.Item, { name: ["keyword"], children: p(Ii.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (h) => a(h) }) }) }) }) }) }); +}, un = ({ cols: e, fields: t, onReset: i }) => { + const [n, r] = F(!1), a = H(() => t == null ? void 0 : t.toReversed().some((o) => o.y > 1 || o.x + o.w >= e - 5), [e, t]); + return O(Ge.Item, { label: " ", style: { "--item-span": 5 }, className: I("ff-data-list-filter-actions", { expanded: n }), children: [p(Xe, { onClick: i, children: "重置" }), p(Xe, { type: "primary", htmlType: "submit", children: "查询" }), a && p(N.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((o) => !o), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); +}; +ci.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 gn = ({ className: e, operations: t, isOperations: i, isPaginate: n }) => { + const { onPageChange: r, onPageSizeChange: a, onClickCallback: o, getBase62params: s } = x.useContext(ie), { total: l, page: u, pageSize: c } = (s == null ? void 0 : s()) || {}; + return i && !d.isEmpty(t) || n ? O("div", { className: I("ff-data-list-footer", e), children: [p("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((g, f) => p(N, { uuid: g.uuid, type: g.type, name: g.name, widget: g.widget, widgetType: g.widgetType, widgetProps: g.widgetProps, widgetData: g.widgetData, widgetSetting: g.widgetSetting, widgetContainerProps: g.widgetContainerSetting, onAfterClick: (m) => m !== !1 && (o == null ? void 0 : o(g.isRefresh, null)) }, g.uuid || f)) }), n && p(Mi, { size: "small", total: l, pageSize: c, showSizeChanger: !1, showTotal: (g) => `第 ${u} 页 / 总共 ${g} 条`, onChange: r, onShowSizeChange: a })] }) : null; +}, pn = [{ 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: p("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], mn = ({ className: e, width: t = 280, isTreeSider: i }) => { + const { classNames: n } = ce(ie); + return i ? p(zi.DirectoryTree, { className: I("ff-data-list-sider", n.sider, e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: pn }) : null; +}, fn = ({ className: e, title: t, tabs: i }) => { + const { getBase62params: n, onTabChange: r, onReload: a, classNames: o } = ce(ie), { tab: s } = (n == null ? void 0 : n()) || {}, [l, u] = Ji((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: r }); + return O("div", { className: I("ff-data-list-toolbar", o.toolbar, e), children: [p("div", { className: "ff-data-list-title", children: t }), p(Bi, { className: "ff-data-list-tabs", itemRender: ({ label: c, code: g, value: f }) => p("span", { onClick: () => u(f ?? g), className: I("ff-data-list-tab", { active: (f ?? g) == l }), children: c }), items: i }), O("div", { className: "ff-data-list-actions", children: [p(N.Link, { icon: "icon-reload", widget: () => a() }), p(N.Link, { icon: "icon-setting" })] })] }); +}, di = ({ isItemGridLayout: e, theme: t, themeProps: i, onClickCallback: n, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: u = 30, onPageSizeChange: c, tab: g, onTabChange: f, keyword: m, onKeywordChange: h, condition: b, onConditionChange: C, sider: k, onSiderChange: P, layouts: S, classNames: R = {}, payload: V = {}, ...q }) => { + const [A, M] = F(), T = X((v, B) => { + const K = { tab: g, page: s, pageSize: u, keyword: m, sider: k, condition: b, total: o, payload: V }; + return v && v != "init" ? d.get(K, v, B) : K; + }, [JSON.stringify(b), JSON.stringify(V), g, s, u, m, k, o]), z = H(() => { + let v = { sider: mn, filter: ci, footer: gn, toolbar: fn }; + S === !1 ? v = { sider: null, filter: null, footer: null, toolbar: null } : d.isPlainObject(S) && (v = Object.assign({}, v, S)); + for (const B in v) if (v[B]) { + if (ji(v[B])) { + const K = v[B]; + v[B] = (ge) => x.cloneElement(K, ge); + } + } else v[B] = () => p(x.Fragment, {}); + return v; + }, [S]); + return L(() => { + t ? le.getWidgetComponent(t).then((v) => { + if (!v) throw `${t} not found`; + return v; + }).catch((v) => ({ default: () => `${v}` })).then((v) => M(x.createElement(v.default, { ...q, layouts: z, $setting: i }))) : M(p(e ? ln : dn, { ...q, layouts: z, $setting: i })); + }, [t, i]), p(ie.Provider, { value: { classNames: R, listCode: a, onClickCallback: n, onReload: r, getBase62params: T, onPageChange: l, onPageSizeChange: c, onTabChange: f, onSiderChange: P, onKeywordChange: h, onConditionChange: C }, children: A && x.cloneElement(A, q) }); +}; +di.propTypes = { classNames: w.exact({ sider: w.string, filter: w.string, footer: w.string, toolbar: w.string, container: w.string, content: w.string, item: w.string }), layouts: w.oneOfType([w.exact({ sider: w.oneOfType([w.elementType, w.element]), filter: w.oneOfType([w.elementType, w.element]), footer: w.oneOfType([w.elementType, w.element]), toolbar: w.oneOfType([w.elementType, w.element]) }), w.bool]) }; +var fe, ue, Pe, it; +const ae = class ae { + constructor() { + E(this, ue, null); + E(this, Pe, /* @__PURE__ */ new Map()); + E(this, it, () => { + if (y(this, ue)) return y(this, ue).port.postMessage({ command: "status", data: [] }); + U(this, ue, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), y(this, ue).port.onmessage = (t) => { + var i, n; + (i = t.data) != null && i.uuid ? y(this, Pe).forEach((r, a) => { + var o; + (r == "*" || (o = r == null ? void 0 : r.includes) != null && o.call(r, t.data.uuid)) && a(t.data); + }) : ((n = t.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && j.get("/api/user-api-token").then(({ token: r, expire_at: a }) => { + y(this, ue).port.postMessage({ command: "initWs", data: [`ws${d.trimStart(j.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); + }); + }, y(this, ue).port.postMessage({ command: "status", data: [] }); + }); + $(this, "subscribe", (t, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", y(this, Pe).set(t, i), y(this, Pe).size == 1 && y(this, it).call(this), () => this.unsubscribe(t))); + $(this, "unsubscribe", (t) => y(this, Pe).delete(t)); + if (y(ae, fe)) return y(ae, fe); + } +}; +fe = new WeakMap(), ue = new WeakMap(), Pe = new WeakMap(), it = new WeakMap(), E(ae, fe, null), $(ae, "getInstance", () => (y(ae, fe) || U(ae, fe, new ae()), y(ae, fe))); +let bt = ae; +const ui = bt.getInstance(), Nt = x.forwardRef(({ listCode: e, base62params: t, className: i, theme: n, themeProps: r, layouts: a, classNames: o }, s) => { + const [{ resource: l, primaryKey: u, batchOperations: c = [], itemOperations: g = [], columns: f = [], themeConfig: m, theme: h, isConditionFormLayout: b = !1, isTreeSider: C, treeSiderConfig: k, isItemGridLayout: P, itemGridLayout: S, title: R, isPaginate: V, tabs: q }, A] = F({ isItemGridLayout: !1, itemGridLayout: {} }), M = on(e, t), [{ dataSource: T, itemOperationsAccess: z, condition: v, tab: B, keyword: K, page: ge, total: J, pageSize: st, sider: Je, onConditionChange: ot, onTabChange: Ot, onKeywordChange: xi, onPageChange: vi, onPageSizeChange: Si, onSiderChange: Pi, onReload: lt, payload: $i }, jt] = sn(M, e, u, l), Ni = wt(g, z, T, u), Ti = wt(c); + L(() => { + let Q = null; + return e && j.get(`/api/_/${e}`).resp(({ data: Ke, res: Fi }) => { + Ke != null && Ke.isDynamicRefresh && (Q = ui.subscribe(() => lt(), Fi)), A(Ke); + }).catch(() => A({})), () => Q == null ? void 0 : Q(); + }, [e]), x.useImperativeHandle(s, () => ({ onReload: lt, onClickCallback: jt })); + const Ri = { listCode: e, title: R, classNames: o, layouts: a, resource: l, primaryKey: u, theme: n || h, themeProps: r || m, isTreeSider: C, treeSiderConfig: k, isPaginate: V, tabs: q, isItemOperations: Ni, itemOperations: g == null ? void 0 : g.map((Q) => d.isEmpty(Q == null ? void 0 : Q.confirm) ? Q : { ...Q, confirm: Object.assign({}, Q.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: Ti, batchOperations: c, isItemGridLayout: P, columns: f, itemGridLayout: S, isConditionFormLayout: b, itemOperationsAccess: z, dataSource: T, onConditionChange: ot, onTabChange: Ot, onKeywordChange: xi, onPageChange: vi, onPageSizeChange: Si, onSiderChange: Pi, condition: v, tab: B, keyword: K, page: ge, total: J, pageSize: st, sider: Je, payload: $i }; + return p(di, { ...Ri, className: I("ff-data-list-helper", i), onReload: lt, onClickCallback: jt }); +}), gi = (e, t, i = !0) => i !== !0 && i-- <= 0 ? [] : d.isArray(e) && !d.isEmpty(e) ? e.reduce((n, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && n.push(r[t]), Reflect.has(r, "children") && !d.isEmpty(r.children) ? n.concat(gi(r.children, t, i)) : n), []) : [], hn = ({ className: e, primaryKey: t, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: a = 180, ...o }) => { + const { classNames: s } = ce(ie), l = W(null), u = W(null), [c, g] = F([]), [f, m] = F({ width: 0, height: 0 }); + L(() => { + g(gi(n, t)); + }, [n, t]), Li(() => { + const b = new ResizeObserver(() => { + var C; + m({ width: ((C = l.current) == null ? void 0 : C.nativeElement.querySelector(".ant-table-body").scrollWidth) || u.current.offsetWidth, height: u.current.offsetHeight }); + }); + return u.current && b.observe(u.current), () => { + u.current && b.unobserve(u.current); + }; + }, []); + const h = an(i); + return p("div", { ref: u, className: I("ff-data-list-table", s.content, e), children: f.height ? p(Di, { ...o, ref: l, rowKey: (b) => (b == null ? void 0 : b[t]) ?? Math.random(), columns: h == null ? void 0 : h.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / f.width * 100).toFixed(2)}%`, render: (b, C, k) => r(C, k) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: c } }) : null }); +}, yn = "RC_FORM_INTERNAL_HOOKS", wn = (e, { initialValue: t, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: a = "string" }, o = null) => { + const s = W(!1), l = ce(Yt), [u, c] = F(), [g, f] = F(i != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: m } = l.getInternalHooks(yn) || {}; + return L(() => m == null ? void 0 : m((h, b, C) => { + if (!s.current) return; + const k = d.get(b, e); + d.isEqual(k, g) || f(ee(k, a)); + }), [g]), L(() => { + i == "javascript" && t ? xe.exec(t, {}, { getFieldValueForBasicForm: (h) => o ? o.getFieldValue(h) : l.getFieldValue(h), getFieldValue: (h) => l.getFieldValue(h) }).then((h) => f(ee(h, a))).catch((h) => notification.error({ message: `布局数据错误: ${JSON.stringify(h)}` })).finally(() => s.current = !0) : (t && f(ee(t ?? l.getFieldValue(e), a)), s.current = !0); + }, [t, i]), Ue(() => { + s.current && n && new Qe([n, r]).toValue(g, l.getFieldsValue(!0)).then(c).catch((h) => { + c(h), console.error("布局数据转换错误: ", h, n); + }); + }, [g, n, r]), [u ?? g, g]; +}, pi = (e, t, i = null) => H(() => { + var n; + return (n = d.sortBy(e, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: a, y: o, w: s, h: l, field: { boxStyle: u, ...c } }, g) => p("div", { className: "grid-layout-item", style: li(a, o, s, l, u), children: p(t, { ...c, basicForm: i }) }, r ?? g)); +}, [e]), bn = ({ widget: e, widgetPrefix: t = "@pkg/ff/grid-layouts", basicForm: i, ...n }) => { + const r = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [a, o] = F(); + return L(() => { + r && le.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: Cn(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => o(x.createElement(s.default, n))); + }, [r]), a; +}, Cn = (e, t = {}, i = null) => (n) => { + const { code: r, label: a, extras: o, isVirtual: s, initialValue: l, initialValueLanguage: u, convertJs: c, convertJsSetting: g, value: f, ...m } = d.merge({}, t, n), [h, b] = wn(s ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: c, convertJsSetting: g, type: (m == null ? void 0 : m.type) || "string" }, i), C = H(() => { + const S = Object.keys((t == null ? void 0 : t.extras) || {}); + return d.over([d.partialRight(d.pick, S), d.partialRight(d.omit, S)]); + }, [t == null ? void 0 : t.extras]), [k, P] = C(m); + return p(e, { ...P, value: h, rawValue: b, $setting: Object.assign({}, o, k) }); +}, mi = ({ className: e, cols: t = 12, rowHeight: i = 21, containerPadding: n = [0, 0], itemMargin: r = [4, 0], formProps: a = {}, fields: o = [], data: s, basicForm: l = null, ...u }) => { + const [c] = te.useForm(), g = pi(o, bn, l), f = H(() => [{ name: "__PROPS__", value: a }], [a]); + return Ue(() => (c.setFieldsValue(s), () => c.resetFields()), [s]), p(te, { fields: f, form: c, component: !1, children: p("div", { ...u, className: I("ff-grid-layout", e), style: { "--grid-layout-item-margin-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-item-margin-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": t, "--grid-layout-row-height": `${i}px` }, children: g }) }); +}, kr = (Dt = mi, function({ code: e, data: t, ...i }) { + const [n, r] = F({ resource: null, cols: 12, rowHeight: 21, fields: [] }); + return L(() => { + e && j.get(`/api/_/${e}`).then((a) => r(d.pick(a, ["resource", "cols", "rowHeight", "fields"]))); + }, [e]), (n == null ? void 0 : n.resource) && p(Dt, { ...i, rowHeight: n.rowHeight, cols: n.cols, fields: n.fields, data: n != null && n.resource ? { [n == null ? void 0 : n.resource]: t } : {} }); +}); +var Dt; +const kn = ({ column: e = 0, colWidth: t = 0, cols: i, rowHeight: n, itemMargin: r, fields: a, primaryKey: o, dataSource: s, itemClassName: l, beforeRender: u = null, afterRender: c = null, itemRender: g = (b, C, k) => b, empty: f = p(qi, { description: null }), className: m, style: h = {} }) => { + const { classNames: b } = ce(ie), C = H(() => p(mi, { cols: i, rowHeight: n, itemMargin: r, fields: a, className: l }), [a, i, n, r]), k = d.isEmpty(s); + return O("div", { className: I("ff-data-list-content", b.content, m), style: Object.assign({}, h, e && { "--col-num": e }, t && { "--col-width": t }), children: [u == null ? void 0 : u(s), k ? f : s.map((P, S) => { + const R = g(x.cloneElement(C, { data: P }), P, S); + return x.cloneElement(R, { key: `${(P == null ? void 0 : P[o]) ?? S}-${rn(P)}` }); + }), c == null ? void 0 : c(s)] }); +}, xn = ({ component: e, $props: t }) => { + const { base62params: i } = We(t, {}); + return p(Y, { children: p(Nt, { listCode: e, base62params: j.decode(i) }) }); +}, xr = () => p(fi, {}), fi = () => "Empty", vn = ({ component: e, $setting: t, $props: i }) => { + const [n, r] = F(); + L(() => { + if (!e) return r(p(fi, { description: null })); + le.getWidgetComponent(e).catch((o) => ({ default: () => `${o}` })).then((o) => x.createElement(o.default, { $setting: t })).then(r); + }, [e]); + const a = We(i, {}); + return n ? x.cloneElement(n, a) : null; +}, vr = () => "NotFoundPage"; +var he, Z, ye, we, Be, De; +const se = class se { + constructor() { + E(this, Z, /* @__PURE__ */ new Map()); + E(this, ye, {}); + E(this, we, null); + $(this, "init", (t, i) => { + U(this, Z, t), U(this, ye, i); + }); + $(this, "get", (t) => (y(this, Z).has(t) || (t = Array.from(y(this, Z).keys()).find((i) => y(this, Z).get(i).uri === t)), y(this, Z).get(t) || {})); + $(this, "redirect", (t, i, n = {}) => { + const { uri: r, type: a, widgetProps: o } = this.get(t) || {}, { router: s, query: l, ...u } = i || {}, c = Object.assign({}, u, s), g = Object.assign({}, u, l); + a == "list" && (c.base62params = j.encode(c != null && c.base62params ? c.base62params : c)); + let f = Ki(r || t, c); + const m = new URLSearchParams(); + for (const h in o || {}) (o == null ? void 0 : o.type) == "query" && Object.has(g, h) && m.append(h, JSON.stringify(g[h])); + return m.size > 0 && (f = `${f}?${m.toString()}`), n != null && n.isOpenWindow ? window.open(f) : y(this, we).navigate(f, { replace: !!(n != null && n.isReplaceRouteHistory) }); + }); + $(this, "getMenus", (t) => { + var i; + return ((i = y(this, ye)) == null ? void 0 : i[t]) || []; + }); + $(this, "findMenuPathByUuid", (t) => { + let i = []; + for (const n in y(this, ye)) if (i = y(this, Be).call(this, y(this, ye)[n], t, [n]), i.length > 1) return i; + return i; + }); + $(this, "getMenusByRouteUuid", (t) => y(this, De).call(this, t, Object.values(y(this, ye)).flat())); + E(this, Be, (t, i, n = []) => { + if (d.isEmpty(t)) return n; + for (const { uuid: r, children: a } of t) { + if (r == i) return n.concat(r); + if (!d.isEmpty(a)) return n.concat(r, y(this, Be).call(this, a, i)); + } + return n; + }); + E(this, De, (t, i) => { + var r; + let n = []; + for (const a of i) a.widgetType == "redirect" && (a.uuid == t || a.widget == t ? n.push(a) : (r = a.children) != null && r.length && (n = n.concat(y(this, De).call(this, t, a.children)))); + return n; + }); + $(this, "getCurrentMenu", () => { + const { uuid: t } = this.getCurrentRoute() || {}; + if (!t) return; + const i = this.getMenusByRouteUuid(t); + return d.isEmpty(i) ? void 0 : i[0]; + }); + $(this, "getCurrentRoute", (t = 0) => { + var n; + const i = (n = y(this, we).state.matches[y(this, we).state.matches.length - 1 - t]) == null ? void 0 : n.route; + if (!i) return null; + for (let [r, a] of y(this, Z)) if (a.uri === i.path) return a; + return null; + }); + $(this, "getPageParams", (t) => { + var r, a, o; + let i = "", n = {}; + if (Zt()) n = _i(), i = (r = Gi()) == null ? void 0 : r.search; + else { + const { location: s = {}, matches: l = [] } = ((a = y(this, we)) == null ? void 0 : a.state) || {}; + n = ((o = l[l.length - 1]) == null ? void 0 : o.params) || {}, i = s.search; + } + return i && new URLSearchParams(i).forEach((s, l) => { + n[l] = s; + }), t ? d.get(n, t) : n; + }); + $(this, "createBrowserRouter", (t = {}) => { + if (y(this, Z).size == 0) return null; + const i = Le.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Le.get(le.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, a = (s, l) => () => Promise.all([le.getWidgetComponent(s), We(l)]).then(([u, c]) => [u.default || function() { + return `${s}`; + }, c]).then(([u, c]) => ({ Component: () => x.createElement(ti, {}, x.createElement(u, { $setting: c })) })), o = Array.from(y(this, Z).values()).reduce((s, { uuid: l, uri: u, name: c, type: g, component: f, widgetSetting: m, widgetProps: h, isLogin: b, isLayout: C, extra: k }) => { + let P = {}, S = 0; + switch (g) { + case "list": + P.element = x.createElement(xn, { component: f, $props: h }); + break; + case "fsdpf-component": + P.element = x.createElement(vn, { key: f, component: f, $setting: m, $props: h }); + } + const R = (k == null ? void 0 : k.theme) ?? (k == null ? void 0 : k.layout); + if (R) { + const V = (k == null ? void 0 : k.themeProps) ?? (k == null ? void 0 : k.layoutProps); + if (!r[R]) return r[R] = s.length, [...s, { path: "/", lazy: a(R, V), children: [{ path: u, ...P }] }]; + S = r[R]; + } + return C && S > -1 ? (s[S].children.push({ path: u, ...P }), s) : [...s, { path: u, ...P }]; + }, [{ path: "/", lazy: a(i, {}), children: [] }]); + return o.push({ index: !0, element: x.createElement(Sn, { to: n, replace: !0 }) }), U(this, we, Yi(o, t)); + }); + if (y(se, he)) return y(se, he); + } +}; +he = new WeakMap(), Z = new WeakMap(), ye = new WeakMap(), we = new WeakMap(), Be = new WeakMap(), De = new WeakMap(), E(se, he, null), $(se, "getInstance", () => (y(se, he) || U(se, he, new se()), y(se, he))); +let Ct = se; +const Sn = ({ to: e, replace: t }) => Zt() ? x.createElement(Xi, { to: e, replace: t }) : (window.document.location = e, "redirect"), ke = Ct.getInstance(), $e = new Worker(new URL("/ff-worker/index.js", self.location)), qt = { getConfigure: (e) => Le.get(e), route: { redirect: (...e) => ke.redirect(...e), getPageParams: (...e) => ke.getPageParams(...e), getCurrentRoute: () => ke.getCurrentRoute() }, popup: { notification: (...e) => G.notification(...e), success: (...e) => G.success(...e), error: (...e) => G.error(...e), form: (...e) => G.form(...e), modal: (...e) => G.modal(...e), confirm: (...e) => G.confirm(...e) } }; +var nt, Fe, be; +const D = class D { + constructor() { + $(this, "exec", (t, i = {}, n = {}, r = "") => new Promise((a, o) => { + if (!/^(?!\s*(\/\/|\/\*|\*)).*?\S+/m.test(t)) return a(); + const s = Vt(D, nt)._++; + y(D, Fe).set(s, n), D.mQueue.set(s, [a, o]), $e.postMessage({ id: s, session: r, category: "eval", method: t, args: i }); + })); + $(this, "clear", (t) => $e.postMessage({ session: t, category: "clear" })); + if (y(D, be)) return y(D, be); + Promise.resolve().then(() => _n).then((t) => { + qt.http = t.http; + }), $e.addEventListener("message", ({ data: { id: t, task_id: i, method: n, args: r, category: a, data: o, error: s, session: l } }) => { + if (a === "eval" && D.mQueue.has(t)) s !== null ? D.mQueue.get(t)[1](s) : D.mQueue.get(t)[0](o), y(D, Fe).delete(t), D.mQueue.delete(t); + else if (a === "util") try { + const u = d.get(qt, n.split("/")) || d.get(y(D, Fe).get(i), n.split("/")); + if (!d.isFunction(u)) throw `${n} not found`; + Promise.resolve(Reflect.apply(u, void 0, r)).then((c) => { + $e.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: c, error: null }); + }).catch((c) => { + $e.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: null, error: c }); + }); + } catch (u) { + $e.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: null, error: u }); + } + }, !1); + } +}; +nt = new WeakMap(), Fe = new WeakMap(), be = new WeakMap(), $(D, "mQueue", /* @__PURE__ */ new Map()), E(D, nt, 0), E(D, Fe, /* @__PURE__ */ new Map()), E(D, be, null), $(D, "getInstance", () => (y(D, be) || U(D, be, new D()), y(D, be))); +let kt = D; +const xe = kt.getInstance(), rt = () => { + const e = W(!0), [, t] = x.useReducer((i) => i + 1, 0); + return L(() => () => e.current = !1, []), () => e.current && t(); +}, Sr = (e) => { + const t = W(); + return L(() => { + t.current = e; + }, [e]), t.current; +}, Pr = (e) => { + const [t, i] = F(e), n = W(null), r = X((a, o) => { + n.current = o, i(a); + }, []); + return L(() => { + n.current && (n.current(t), n.current = null); + }, [t]), [t, r]; +}, Ue = (e = (n) => { +}, t, i = d.isEqual) => { + const n = x.useRef(); + i(t, n.current) || (n.current = d.cloneDeep(t)), x.useEffect(e, [n.current]); +}, at = Ue, hi = (e, t = "string") => { + var i; + if (!Array.isArray(e)) return e; + for (let n = 0; n < e.length; n++) e[n].value = ee((i = e[n]) == null ? void 0 : i.value, t), e[n] && Reflect.has(e[n], "children") && (e[n].children = hi(e[n].children, t)); + return e; +}, $r = (e, t = "json", i = "string", n, r = null) => { + const [a] = te.useForm(n), [o, s] = F([{ label: "无", value: "", disabled: !0 }]), l = W([]), u = te.useWatch((c) => l.current.length === 0 ? null : d.pick(c, l.current), a) || null; + return L(() => { + Array.isArray(e) ? s(e) : t === "javascript" && e ? xe.exec(e, {}, { getFieldValue: (c) => (l.current.includes(c) || l.current.push(c), a.getFieldValue(c)), getFieldValueForBasicForm: (c) => (l.current.includes(c) || l.current.push(c), r ? r.getFieldValue(c) : a.getFieldValue(c)) }).then((c) => { + s(ee(c, "array")); + }) : e && s(ee(e, "array")); + }, [e, t, u]), hi(o, i); +}, Nr = (e) => { + const [t, i] = F(), n = { type: "GET" }; + if (typeof e == "string" ? n.url = e : d.isPlainObject(e) && Object.assign(n, e), !(n != null && n.url)) throw "url is required"; + const r = (a) => j.request(n, !1).resp((o) => (console.log("useSubscribeRequest", a), i(o), o)); + return Ue(() => { + let a = null; + return r().then((o) => { + a = ui.subscribe(d.throttle(r, 180, { leading: !1, trailing: !0 }), o.res); + }), () => a == null ? void 0 : a(); + }, n), t; +}, Pn = (e) => { + const [t, i] = x.useState({ gridItems: [], hideItems: [] }); + return x.useEffect(() => { + e && j.get(`/api/_/${e}`).then(({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: c, marginY: g, listenChangeFields: f, listenChangeFieldsFunc: m, fields: h }) => ({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: c, marginY: g, listenChangeFields: f, listenChangeFieldsFunc: m, ...h.reduce((b, C) => { + var k; + return (k = C == null ? void 0 : C.field) != null && k.hidden ? b.hides.push(C == null ? void 0 : C.field) : b.items.push(C), b; + }, { items: [], hides: [] }) })).then(i); + }, [e]), t; +}, $n = ({ max: e = 0, min: t = 0, type: i = "", message: n, pattern: r, required: a = !1, validator: o } = {}, s, l) => { + const [u, c] = F([]); + return L(() => { + const g = []; + if (a) { + let f = l; + switch (l) { + case "number": + case "string": + case "array": + break; + case "bool": + f = "boolean"; + break; + case "json": + f = "object"; + } + g.push({ type: f, required: !0, whitespace: !0, message: "该项必填" }); + } + switch (i) { + case "string": + g.push({ type: i, max: e, min: t, message: n || (t && e ? `字符必须在 ${t} ~ ${e} 之间` : `${e ? "最多能有" : "最少要有"} ${t || e} 个字符`) }); + break; + case "pattern": + g.push({ type: "string", pattern: r, message: n }); + break; + case "validator": + o && g.push(({ getFieldValue: f }) => ({ validator: async (m, h) => { + const b = await xe.exec(o, { value: h, fieldName: s }, { getFieldValue: f }); + return d.isString(b) && b ? Promise.reject(b) : d.isBoolean(b) && !b ? Promise.reject(n) : Promise.resolve(); + } })); + } + c(g); + }, [e, t, i, n, r, a, o]), u; +}, Nn = (e, t, i) => { + const [n, r] = F(null); + return L(() => { + const { initDataUri: a = `/api/${e}`, initDataMethod: o = "GET" } = i || {}; + t && j.request({ method: o, url: d.trimEnd(`${a}/${t}`, "/") }).then((s) => { + r(s); + }); + }, [e, t, i]), n; +}, yi = (e, t, i = {}, n = {}, r = {}) => { + const a = ce(Yt), o = rt(), s = W(!0), l = W([]), [u, c] = F(t), g = te.useWatch((f) => JSON.stringify(d.pick(f, l.current)), a) || "{}"; + return at(() => { + e && xe.exec(e, i, { ...n, getFieldValueForBasicForm: (f) => r ? r.getFieldValue(f) : null, getFieldValue: d.wrap(a.getFieldValue, (f, m) => (l.current.some((h) => d.isEqual(h, m)) || (l.current.push(m), o()), f == null ? void 0 : f(m))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((f) => s.current && c(f)); + }, [e, g, a, i, n]), L(() => () => s.current = !1, []), u; +}, Tn = (e, t, i = [], n = {}) => { + const r = W({}); + if (!t) return [e, r.current]; + const a = W(), o = d.debounce(rt(), 180), s = ["disabled", "required"], l = (g, f) => { + s.includes(g) && (r.current[g] = f), o(); + }, u = H(() => ({ setDisabled: (g) => l("disabled", g), setRequired: (g) => l("required", g), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [t]), c = yi(t, -1, {}, u, n) ?? -1; + if (a.current != c && (c >= 0 || !d.isEmpty(i == null ? void 0 : i[c]))) { + a.current = c; + const { widget: g, widgetPrefix: f, props: m } = i == null ? void 0 : i[c]; + e = ni(g, f), r.current = d.merge(m, d.pick(r.current, s)); + } + return [e, r.current]; +}, Wt = (e) => e === void 0 || e === !1 ? "" : (Array.isArray(e) ? e : [e]).join("_"), Tr = ({ value: e, onChange: t }, i = null) => { + const n = W(), [r] = te.useForm(i), a = W({}); + return at(() => { + d.isEqual(n.current, e) || r.setFieldsValue(e); + }, [e]), L(() => () => r.resetFields(), []), [H(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (o) => (s) => { + const l = Wt(o); + s ? a.current[l] = s : delete a.current[l]; + } }, scrollToField: (o, s = {}) => { + console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); + }, focusField: (o) => { + console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); + }, getFieldInstance: (o) => { + const s = Wt(o); + return a.current[s]; + } }, [r]), (o, s) => { + n.current = s, t == null || t(s); + }]; +}, Rn = ({ type: e, initialValue: t, initialValueLanguage: i, onChange: n, basicForm: r }) => { + const a = yi(i == "javascript" && t, i == "javascript" ? void 0 : t, {}, {}, r); + return L(() => { + i == "javascript" ? n(ee(a, e)) : t && n(ee(t, e)); + }, [e, t, a]), null; +}, wi = ({ widget: e = "Input", widgetPrefix: t = "@pkg/ff/grid-layout-forms", widgetDecorator: i, subWidgets: n = [], basicForm: r, ...a }) => { + const o = ni(e, t), [s, l] = Tn(o, i, n, r), [u, c] = F(); + return L(() => { + s && le.getWidgetComponent(s).then(({ defaultProps: g = {}, default: f }) => ({ default: Fn(f, g, r) })).catch((g) => ({ default: () => `${g}` })).then((g) => c(x.createElement(g.default, a))); + }, [s]), u && x.cloneElement(u, { ...a, ...l }); +}, Fn = (e, t = {}, i = null) => (n) => { + const { type: r, code: a, label: o, noStyle: s, placeholder: l, required: u = !1, extras: c, validators: g, help: f, isVirtual: m, $isReserved: h, initialValue: b, initialValueLanguage: C, ...k } = d.omit(d.merge({}, t, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), P = $n(Object.assign({}, g, u ? { required: !0 } : {}), a, r), S = H(() => { + const M = Object.keys((t == null ? void 0 : t.extras) || {}); + return d.over([d.partialRight(d.pick, M), d.partialRight(d.omit, M)]); + }, [t == null ? void 0 : t.extras]), [R, V] = S(k), q = { label: o, noStyle: s, colon: !1, layout: "vertical" }, A = X((M) => M == null ? void 0 : ee(M, r), [r]); + return p(Xt, { name: a, rules: P, initialValue: A(b), normalize: A, children: (M, T, z) => { + var v; + return p(e, { type: r, rcform: z, basicForm: i, itemProps: { validateStatus: T.errors.length > 0 ? "error" : "success", tooltip: f || null, help: T.errors.length > 0 ? T.errors.join("、") : null, required: ((v = P == null ? void 0 : P[0]) == null ? void 0 : v.required) || !1, ...q }, fieldProps: { placeholder: l, ...V, ...M }, $setting: Object.assign({}, c, R) }); + } }); +}, Tt = ({ cols: e = 24, rowHeight: t = 16, itemMargin: i = [8, 16], containerPadding: n = [0, 0], fields: r = [], children: a, basicForm: o = null }) => { + const s = pi(r, wi, o); + return O("div", { className: "ff-grid-layout-form", style: { "--grid-layout-item-margin-x": `${(i == null ? void 0 : i[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(i == null ? void 0 : i[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: [s, a && x.cloneElement(a, { cols: e, rowHeight: t, itemMargin: i, containerPadding: n, fields: r })] }); +}; +Tt.propTypes = { fields: w.array }; +const En = (Ut = Tt, ({ code: e, layout: t, name: i, primaryKey: n = 0, style: r = {}, formProps: a = {}, form: o, basicForm: s, isPreview: l = !1, className: u, onFinish: c, onValuesChange: g = () => { +}, ...f }) => { + const { align: m, autoComplete: h, resource: b, items: C, hides: k, rowHeight: P, marginX: S, marginY: R, cols: V, listenChangeFields: q, listenChangeFieldsFunc: A, pk: M, uuid: T } = Pn(e), [z] = te.useForm(o), v = H(() => [{ name: "__PK__", value: M }, { name: "__PROPS__", value: a }, { name: "__RESOURCE__", value: b }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: T }, { name: "__PRIMARY_KEY__", value: n }], [M, e, T, b, n, a]); + return O(te, { className: u, name: i || e, layout: t || m, fields: v, form: z, autoComplete: h, style: { ...r, position: "relative" }, onFinish: c, onValuesChange: (B, K) => (({ changedValues: ge, allValues: J, listenChangeFields: st, listenChangeFieldsFunc: Je, onValuesChange: ot, code: Ot }) => { + ot(ge, J), Je && Array.isArray(st) && xe.exec(Je, { changedValues: ge, allValues: J }, { getFieldValue: z.getFieldValue, setFieldValue: z.setFieldValue, setFieldsValue: z.setFieldsValue, isFieldTouched: z.isFieldTouched, isFieldsTouched: z.isFieldsTouched }); + })({ changedValues: B, allValues: K, listenChangeFields: q, listenChangeFieldsFunc: A, onValuesChange: g, code: e }), children: [p(Ut, { ...f, form: z, basicForm: s, code: e, fields: C, cols: V, rowHeight: P, itemMargin: [S, R] }), k == null ? void 0 : k.map((B) => { + var K; + return p(Xt, { name: B.code, children: p(Rn, { form: z, basicForm: s, name: B.code, type: B.type, initialValue: B.initialValue, initialValueLanguage: (K = B.extras) == null ? void 0 : K.initialValueLanguage }) }, JSON.stringify(B.code)); + })] }, e); +}); +var Ut; +const bi = ({ $setting: e, $close: t, extras: i, code: n, primaryKey: r, ...a }) => { + const [o] = te.useForm(), s = Nn(n, r, e); + return L(() => { + s && o.setFieldsValue(s); + }, [s]), p(Y, { actions: O(x.Fragment, { children: [p(N, { name: "保存", type: "primary", widget: () => { + const l = o.getFieldValue("__RESOURCE__"), { initDataUri: u = `/api/${n}` } = e || {}; + o.validateFields(!0).then((c) => l ? d.pick(c, [l]) : c).then((c) => j.post(r ? `${u}/${r}` : `${u}`, c).msg(t)).catch(() => G.error("请先完善表单信息", { duration: 2e3 })); + } }), p(N, { name: "取消", widget: () => t(!1) })] }), extras: i, children: p(En, { form: o, code: n, primaryKey: r, ...a }) }); +}, Ht = /* @__PURE__ */ new Set(), xt = (e = [], t = 0) => { + const i = e[t]; + if (i.length && !Ht.has(i)) { + const n = document.createElement("script"); + n.setAttribute("src", i), n.setAttribute("data-namespace", i), e.length > t + 1 && (n.onload = () => { + xt(e, t + 1); + }, n.onerror = () => { + xt(e, t + 1); + }), Ht.add(i), document.body.appendChild(n); + } +}, vt = ({ className: e, type: t, style: i = {}, ...n }) => p("span", { role: "img", className: I("ff-iconfont", e), style: i, ...n, children: p("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: p("use", { xlinkHref: `#${t}` }) }) }); +vt.propTypes = { className: w.string, type: w.string.isRequired, style: w.object }, vt.init = xt; +const On = (e, t, i, n) => ke.redirect(i, t, n), jn = (e, t = {}, i, n = {}) => { + var a; + const r = (a = n.router) == null ? void 0 : a.reduce((o, [s, l, u]) => { + const c = d.get(t, ["router", s]); + if (!c && c !== 0 && l) throw `请传入 ${u}`; + return `${o}/${c}`; + }, `/api/${i}`); + return j.del(r, t.param).msg(); +}, Jt = (e, t, 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 d.isFunction(i) ? i.call(null, { ...t, ...o }) : d.isString(i) && i ? xe.exec(i, t, o) : null; +}, Kt = (e, t, i, n, r) => d.isString(i) && i ? le.getWidgetComponent(i).then(({ default: a }) => G.modal(a, { ...t, $setting: n }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r)).catch((a) => { + G.error(i, { content: a.toString() }); +}) : G.modal(i, { ...t, $setting: n }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), Ln = (e, t, i, n, r) => G.modal(bi, { ...t, $setting: n, code: i }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), An = (e, t, i, n, r) => G.modal(Nt, { base62params: t, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), Vn = ({ widget: e, widgetType: t, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s }) => { + const l = ce(ie), [u, c] = F({ leading: !0, trailing: !1 }), g = H(() => { + switch (t) { + case "redirect": + return d.partialRight(On, e, r); + case "func": + return d.partialRight(Jt, (r == null ? void 0 : r.code) ?? e, { status: u, setStatus: c }); + case "fsdpf-component": + return d.partialRight(Kt, e, r, a); + case "grid-layout-form": + return d.partialRight(Ln, e, r, a); + case "data-list": + return d.partialRight(An, e, r, a); + case "destroy": + return d.partialRight(jn, e, r, a); + default: + if (Et(e) || x.isValidElement(e)) return d.partialRight(Kt, e, r, a); + if (d.isFunction(e)) return d.partialRight(Jt, (r == null ? void 0 : r.code) || e, { status: u, setStatus: c }); + } + return (...f) => console.error("useButton unknown widgetType", t, ...f); + }, [e, t]); + return [d.debounce((f) => (s == null || s(f), Promise.resolve(We(n, f, { list: l })).then((m) => g(f, { ...i, ...m })).then((m) => o == null ? void 0 : o(m)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u]; +}, Ci = ({ type: e, name: t, className: i, icon: n, iconPosition: r, size: a }, o = "default") => H(() => { + const s = { type: "primary", className: I("ff-button", i), iconPosition: r, size: a }; + return e === "danger" ? s.danger = !0 : e === "default" && (s.type = e), o === "link" || o === "dashed" ? (s.type = o, e === "default" && (s.className = I(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), n && (s.icon = p(vt, { type: n })), t && (s.children = t), s; +}, [o, e, i, n, r]), He = (e) => function({ className: t, variant: i, children: n, name: r, icon: a, type: o = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: u, onBeforeClick: c, data: g, loading: f, disabled: m, tooltip: h, confirm: b, widget: C = () => { +}, widgetType: k, widgetData: P, widgetProps: S, widgetSetting: R, widgetContainerProps: V, ...q }) { + const A = d.isEmpty(h) || !h.enabled ? {} : h, M = d.isEmpty(b) ? { enabled: !1 } : Object.assign({ enabled: !0 }, b), T = Ci({ className: t, name: r, type: o, icon: a, iconPosition: s }, i ?? e), [z, v] = F(!1), [B, { disabled: K, loading: ge }] = Vn({ widget: C, widgetType: k, widgetData: P, widgetProps: S, widgetSetting: R, widgetContainerProps: V }, { onAfterClick: u, onBeforeClick: c }); + return p(Wi, { okText: "确定", cancelText: "取消", getPopupContainer: (J) => J, ...M, disabled: K || m, open: z, onOpenChange: (J) => { + if (!J) return v(J); + M.enabled ? v(J) : B(g); + }, onConfirm: (J) => { + B(g, J); + }, onClick: (J) => { + J.stopPropagation(); + }, children: p(Ui, { getPopupContainer: (J) => J, ...A, title: z ? null : A == null ? void 0 : A.title, trigger: ["hover", "click"], children: p(Xe, { loading: ge || f, disabled: K || m, ...T, ...q, children: n || r }) }) }); +}, N = He("default"); +N.propTypes = { type: w.oneOf(["primary", "default", "danger", ""]), size: w.oneOf(["large", "middle", "small"]), name: w.string, icon: w.string, iconPosition: w.oneOf(["start", "end"]), data: w.any, widget: w.any, widgetType: w.oneOf(["destroy", "redirect", "func", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: w.object, widgetProps: w.object, widgetSetting: w.object, widgetContainerProps: w.object, tooltip: w.exact({ title: w.string.isRequired, placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func }), confirm: w.exact({ title: w.string.isRequired, cancelText: w.string, okText: w.string, okType: w.oneOf(["primary", "default", "danger", ""]), placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func, arrow: w.oneOfType([w.bool, w.exact({ pointAtCenter: w.bool })]) }) }; +const In = He("link"), Mn = He("circle"), zn = He("round"), Bn = He("dashed"), Rt = ({ data: e, widget: t, widgetType: i = "fsdpf-component", widgetData: n, widgetProps: r, widgetSetting: a, widgetContainerProps: o, onAfterClick: s, onBeforeClick: l, children: u, extras: c }) => { + const g = ce(ie), [f, m] = F(!1), [h, b] = F("hover"), [C, k] = F({}), [P, S] = F(), { placement: R, align: V, arrow: q = { pointAtCenter: !0 }, getPopupContainer: A, ...M } = o || {}; + L(() => { + i == "grid-layout-form" ? S(x.createElement(bi, { ...n, $setting: a, code: t })) : i == "data-list" ? S(x.createElement(Nt, { base62params: e, $setting: a, listCode: t })) : d.isString(t) ? le.getWidgetComponent(t).then(({ default: v }) => { + S(x.createElement(v, { ...n, $setting: a })); + }).catch((v) => S(v.toString())) : Et(t) ? S(x.createElement(t, { ...n, $setting: a })) : x.isValidElement(t) && S(x.cloneElement(t, { ...n, $setting: a })); + }, [t, i, n]), L(() => { + Promise.resolve(We(r, e, { list: g })).then(k); + }, [r, e, g.getBase62params]); + const T = (v, B = !1) => (m(v), !v && b("hover"), v ? l == null ? void 0 : l(C) : s == null ? void 0 : s(B)), z = (v) => { + m(!0), b("click"); + }; + return p(Hi, { placement: R, onPopupClick: z, onClick: z, open: f, align: V, arrow: q, trigger: h, getPopupContainer: A, content: p(Dn, { ...M, extras: c, children: P && x.cloneElement(P, { ...C, $close: (v) => T(!1, v) }) }), children: u, onOpenChange: T }); +}, Dn = ({ title: e, className: t, children: i, extras: n, width: r, height: a, ...o }) => { + const [s, l] = F({}), u = X((m, h) => l((b) => ({ ...b, [m]: h })), []), c = X((m) => l((h) => ({ ...h, [m]: void 0 })), []), g = e ? x.createElement("div", { className: "ff-popup-title" }, e) : s == null ? void 0 : s.title, f = n ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, n); + return p(qe.Provider, { value: { ele: s, mount: u, unmount: c }, children: O("div", { className: I("ff-popup ff-popover", t, s.rootClassName), style: { width: r, height: a }, ...o, children: [O("div", { className: "ff-popup-header", children: [g, s == null ? void 0 : s["sub-title"]] }), i, O("div", { className: "ff-popup-footer", children: [f, s == null ? void 0 : s.extras, s == null ? void 0 : s.actions] })] }) }); +}; +Rt.propTypes = { widgetType: w.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; +const _t = ({ options: e = [], triggerWeights: t = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: i = (m, h, b) => { +}, onBeforeClick: n = (m, h, b) => { +}, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: u = (m, h) => p(N, { ...m, data: h }, m.uuid || pt()), widgetContainerProps: c = {}, children: g, data: f }) => { + if (d.isEmpty(e)) return g; + const [m, h] = H(() => (e || []).reduce((C, k) => { + const P = t.indexOf(k.widgetType); + return P === -1 ? C[1].push(k) : C[0] ? P < t.indexOf(C[0].widgetType) ? (C[1].push(C[0]), C[0] = k) : C[1].push(k) : C[0] = k, C; + }, [null, []]), [e, t]); + o ? g = o(m, f) || g : g || (g = p(Xe, { ...Ci(Object.assign(m != null && m.name || m != null && m.icon ? {} : { icon: "icon-location" }, m, { size: a }), r) })); + const b = h.map((C) => u(Object.assign({ uuid: C.uuid, type: C.type, name: C.name, widget: C.widget, widgetType: C.widgetType, widgetProps: C.widgetProps, widgetData: C.widgetData, widgetSetting: C.widgetSetting, widgetContainerProps: C.widgetContainerSetting, confirm: C.confirm, onAfterClick: d.partialRight(i, C, f), onBeforeClick: d.partialRight(n, C, f) }, { size: l, variant: s }), f)); + return p(Rt, { widget: m == null ? void 0 : m.widget, widgetType: m == null ? void 0 : m.widgetType, widgetProps: m == null ? void 0 : m.widgetProps, widgetSetting: m == null ? void 0 : m.widgetSetting, widgetContainerProps: Object.assign({}, c, m == null ? void 0 : m.widgetContainerProps), data: f, widgetData: m == null ? void 0 : m.widgetData, extras: b, onAfterClick: d.partialRight(i, m, f), onBeforeClick: d.partialRight(n, m, f), children: g }); +}; +_t.propTypes = { triggerWeights: w.array, options: w.arrayOf(w.shape({ ...N.propTypes, widgetType: N.propTypes.widgetType.isRequired })), btnSize: N.propTypes.size, btnRender: w.func, btnVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: w.func, labelSize: N.propTypes.size, onAfterClick: w.func, onBeforeClick: w.func, widgetContainerProps: N.propTypes.widgetContainerProps, data: N.propTypes.data }, N.Link = In, N.Link.defaultProps = N.defaultProps, N.Link.propTypes = N.propTypes, N.Circle = Mn, N.Circle.defaultProps = N.defaultProps, N.Circle.propTypes = N.propTypes, N.Round = zn, N.Round.defaultProps = N.defaultProps, N.Round.propTypes = N.propTypes, N.Dashed = Bn, N.Dashed.defaultProps = N.defaultProps, N.Dashed.propTypes = N.propTypes, N.Popover = Rt, N.GroupPopover = _t; +const qn = ({ fields: e, formProps: t, $close: i }) => { + const [n] = te.useForm(), r = H(() => [{ name: "__PROPS__", value: t }], [t]); + return p(Y, { actions: O(x.Fragment, { children: [p(N, { name: "取消", widget: () => i(!1) }), p(N, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(i) })] }), children: p(te, { fields: r, form: n, className: "ff-modal-form", children: e == null ? void 0 : e.map(({ code: a, ...o }) => p(wi, { code: a, ...o }, a)) }) }); +}, Wn = ({ className: e, $close: t, children: i, title: n, subTitle: r, actions: a, extras: o, ...s }) => O(Qi, { ...s, prefixCls: "ff-drawer", className: I("ff-popup", e), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (l) => ({ motionAppear: !0, motionName: `panel-motion-${l}` }), children: [O("div", { className: "ff-popup-header", children: [p("button", { "aria-label": "Close", className: "ff-popup-close", onClick: s.onClose, children: p($t, { type: "close" }) }), n, r] }), p("div", { className: "ff-popup-body", children: i }), O("div", { className: "ff-popup-footer", children: [o, a] })] }), Un = ({ className: e, $close: t, $event: i, children: n, title: r, subTitle: a, actions: o, extras: s, placement: l, ...u }) => { + const c = (i == null ? void 0 : i.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: i == null ? void 0 : i.pageX, y: i == null ? void 0 : i.pageY } }; + return p(Zi, { ...u, ...c, prefixCls: "ff-modal", modalRender: () => O("div", { className: I("ff-modal-content ff-popup", e), children: [O("div", { className: "ff-popup-header", children: [p("button", { "aria-label": "Close", className: "ff-popup-close", onClick: u.onClose, children: p($t, { type: "close" }) }), r, a] }), p("div", { className: "ff-popup-body", children: n }), O("div", { className: "ff-popup-footer", children: [s, o] })] }) }); +}, ki = ({ placement: e, $close: t, $event: i, children: n, title: r, ...a }) => { + const [o, s] = F({}), [l, u] = F(!0), c = X((h, b) => s((C) => ({ ...C, [h]: b })), []), g = X((h) => s((b) => ({ ...b, [h]: void 0 })), []); + let f = { ...a, className: o.rootClassName, title: o.title || r && x.createElement("div", { className: I("ff-popup-title") }, r), subTitle: o["sub-title"], actions: o.actions, extras: o.extras, children: n, $close: t, $event: i, onClose: () => u(!1) }; + const m = () => { + t(!1); + }; + return p(qe.Provider, { value: { ele: o, mount: c, unmount: g }, children: e && e !== "center" ? p(Wn, { ...f, placement: e, open: l, afterOpenChange: (h) => !h && m() }) : p(Un, { ...f, visible: l, afterClose: m }) }); +}; +ki.propTypes = { placement: w.oneOf(["center", "left", "top", "right", "bottom"]) }; +const _ = () => { + const [e, t] = Ai({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (a) => { + const { offsetHeight: o } = a; + return { height: o }; + }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = x.useReducer((a) => a + 1, 0); + L(() => { + _.$onClick = n, _.$queue.forEach(([a, o, s], l, u) => { + r([o, s], ...a), delete u[l]; + }); + }, []); + const n = (a, o = {}, s = {}) => new Promise((l, u) => r([l, u], a, o, s)), r = ([a, o], s, l = {}, u = {}) => { + const c = _.$index++, g = (f) => ((m, h) => (_.$popups.delete(m), i(), h == null ? void 0 : h()))(c, () => a(f)); + if (s === ii) return e.open({ ...u, key: c, content: x.createElement(s, { ...l, $close: () => e.close(c) }) }); + _.$popups.set(c, x.createElement(ki, { maskClosable: !1, $event: l == null ? void 0 : l.$event, ...u, key: c, $close: g }, x.isValidElement(s) ? x.cloneElement(s, { ...l, $close: g }) : s != null && s.name || It.isForwardRef(s) || (s == null ? void 0 : s.$$typeof) === It.ForwardRef ? x.createElement(s, { ...l, $close: g }) : s)), i(); + }; + return O(x.Fragment, { children: [Array.from(_.$popups).map(([a, o]) => o), t] }); +}; +_.$popups = /* @__PURE__ */ new Map(), _.$index = 0, _.$queue = [], _.$onClick = (...e) => new Promise((t, i) => { + _.$queue.push([e, t, i]); +}); +const Gt = (e, t, i = {}) => _.$onClick(e, t, i), ut = (e, { showProgress: t, duration: i, ...n } = { duration: 1.5 }) => _.$onClick(ii, { content: e, ...n }, { showProgress: t, duration: i }), G = { modal: Gt, confirm: (e, t = {}) => _.$onClick(en, { content: e, ...t }, { placement: "center" }), form: (e, t = {}, i = {}) => Gt(qn, { formProps: i, fields: e }, { placement: "center", ...t }).then((n) => { + if (n === !1) throw !1; + return n; +}), notification: ut, success: (e, t = { duration: 1.5 }) => ut(e, { ...t, className: "ff-notification-success", icon: "check" }), error: (e, t = { duration: 1.5 }) => ut(e, { ...t, className: "ff-notification-error", icon: "close" }) }; +Oe.configure({ showSpinner: !1 }), je.interceptors.request.use((e) => { + e.headers.Platform = "web", e.headers.SaaS = window.localStorage.getItem("SaaS"); + const t = window.localStorage.getItem(Ye); + return e.headers.Authorization = t ? `Bearer ${t} ` : void 0, Oe.inc(), e; +}, (e) => (Oe.done(), Promise.reject({ code: -1, msg: e }))), je.interceptors.response.use(({ data: e, headers: t }) => (Oe.done(), { ...e, res: t == null ? void 0 : t.res }), function(e) { + return Oe.done(), Promise.reject(e.message); +}), window.addEventListener("unhandledrejection", mt.onUnhandledRejection), mt.onMsg = (e, t) => G[[0, 1].includes(e) ? "success" : "error"](t).then(() => e === 20300 && ke.redirect(Le.get("Common.WEBSITE_LOGIN_PAGE"))); +const St = { appUrl: "", init: (e, t, i) => { + St.appUrl = i, je.defaults.baseURL = i, je.defaults.timeout = 15e3, Object.assign(St, new mt(e, t, je)); +} }, j = St; +class Ft extends Error { + constructor(t, i) { + super(i), Error.captureStackTrace && Error.captureStackTrace(this, Ft), !i instanceof Ae && (this.name = `${t} Error Runtime`); + } +} +class Ae extends Error { + constructor(t, ...i) { + super(...i), Error.captureStackTrace && Error.captureStackTrace(this, Ae), this.name = `${t} Not Found`; + } +} +const gt = "mine", Ye = "token"; +var Ce, Ee; +const oe = class oe { + constructor() { + E(this, Ee, /* @__PURE__ */ new Map()); + $(this, "setVendor", (t, i) => y(this, Ee).set(t, new ei(i, async (n, r) => { + var o, s; + if (!(n != null && n.default)) throw "@pkg not found"; + let a = () => r; + switch ("function") { + case typeof (a = (o = n.default) == null ? void 0 : o[`./${r}/index.jsx`]): + case typeof (a = (s = n.default) == null ? void 0 : s[`./${r}/index.js`]): + return a(); + } + throw new Ae(r); + }))); + $(this, "getWidgetComponent", async (t) => { + if (!t) throw "getWidgetComponent widget is required"; + if (t != null && t.startsWith("blob:") || t != null && t.startsWith("http:") || t != null && t.startsWith("https:")) return await import(t); + const [, i] = t == null ? void 0 : t.split("@pkg/"); + if (!i) throw new Ae(t); + try { + return y(this, Ee).has("pkg") ? await y(this, Ee).get("pkg").get(i) : await import(`${j.appUrl}/api/pkg-import/web?name=${t}`); + } catch (n) { + throw new Ft(t, n); + } + }); + $(this, "getRoutes", () => j.get("/api/my-router").then((t) => [...t, { 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((t) => new Map(t))); + $(this, "getMenus", () => j.get("/api/my-menu")); + $(this, "getConfigure", () => j.get("api/init-configure")); + $(this, "getWidgetOperationAuth", () => j.get("/api/init-widget-operation-auth").then((t) => t.reduce((i, { uuid: n, auth: r }) => [...i, [n, r]], []))); + $(this, "getPhoneNumber", (t) => j.get(`/api/user-wx-phone-number/${t}`)); + $(this, "getUserToken", () => { + const t = window.localStorage.getItem(Ye); + if (!t) return ""; + const i = t.split("."); + if (!Array.isArray(i) || i.length !== 3) throw "登录令牌无效!"; + const { iat: n } = JSON.parse(window.atob(i[1])); + if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; + return t; + }); + $(this, "checkUserToken", () => { + try { + return !!this.getUserToken(); + } catch { + return !1; + } + }); + $(this, "getUserInfo", (t = !0) => { + var i; + 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(gt) || "", {}); + return a === r ? Promise.resolve(o) : j.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(gt, j.encode({ ...s, iat: r })), s)); + } catch (n) { + console.error(n), t && G.error("请登录").then(this.logout); + } + return Promise.resolve(null); + }); + $(this, "login", (t, i, n = {}) => j.post("/api/user-token", { username: t, passwd: Vi.hash(i), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(Ye, r), r))); + $(this, "logout", (t) => (window.localStorage.removeItem(gt), window.localStorage.removeItem(Ye), t == null ? void 0 : t())); + if (y(oe, Ce)) return y(oe, Ce); + } +}; +Ce = new WeakMap(), Ee = new WeakMap(), E(oe, Ce, null), $(oe, "getInstance", () => (y(oe, Ce) || U(oe, Ce, new oe()), y(oe, Ce))); +let Pt = oe; +const le = Pt.getInstance(), Hn = x.createContext({ user: {}, initUser: () => { +}, initUserComplete: !1 }), Jn = x.createContext({ set: () => { +}, get: () => { +}, assign: () => { +}, currentRoute: () => { +} }), Et = (e) => !!(e != null && e.name) && (e.prototype instanceof x.Component || /^[A-Z]/.test(e.name)), Kn = (e, t) => { + if (!e || typeof window > "u") return; + let i = document.querySelector(`style[ff-style-token="${t}"]`); + return i ? (i.innerHTML = e, e) : (i = document.createElement("style"), i.setAttribute("ff-style-token", t), i.setAttribute("type", "text/css"), i.innerHTML = e, document.head.appendChild(i), e); +}, _n = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Hn, AppGlobalParamsContext: Jn, cache: ei, configure: Le, default: le, func: xe, http: j, insertStyle: Kn, isReactComponent: Et, route: ke }, Symbol.toStringTag, { value: "Module" })); +export { + wi as $, + kn as A, + ln as B, + dn as C, + Qe as D, + an as E, + wr as F, + kr as G, + yn as H, + br as I, + oi as J, + wt as K, + sn as L, + on as M, + xn as N, + vn as O, + xr as P, + vr as Q, + ui as R, + rt as S, + Sr as T, + Pr as U, + Ue as V, + at as W, + $r as X, + Nr as Y, + En as Z, + Tt as _, + ni as a, + bi as a0, + Pn as a1, + $n as a2, + Nn as a3, + yi as a4, + Tn as a5, + Tr as a6, + vt as a7, + N as a8, + tn as a9, + Vn as aa, + Y as ab, + qe as ac, + ti as ad, + _ as ae, + G as af, + ur as ag, + gr as ah, + pr as ai, + le as aj, + Et as ak, + Kn as al, + j as am, + ei as an, + Le as ao, + xe as ap, + ke as aq, + Hn as ar, + Jn as as, + We as b, + fr as c, + ri as d, + hr as e, + yr as f, + nn as g, + rn as h, + li as i, + Cr as j, + gi as k, + mi as l, + bn as m, + wn as n, + pi as o, + di as p, + ci as q, + dt as r, + fn as s, + ee as t, + mr as u, + mn as v, + gn as w, + Nt as x, + ie as y, + hn as z +}; diff --git a/dist/components.js b/dist/components.js index 4806ac1..e960a1b 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,4 +1,4 @@ -import { ah as s, a8 as p, ai as n, aj as t, ag as d } from "./common/main-C_FS7g0q.js"; +import { ag as s, a7 as p, ah as n, ai as t, af as d } from "./common/main-DnobNY7x.js"; export { s as Empty, p as Icon, diff --git a/dist/container.js b/dist/container.js index 504dc38..65d433d 100644 --- a/dist/container.js +++ b/dist/container.js @@ -1,4 +1,4 @@ -import { ad as o, ah as s, ai as d, aj as p, ae as t, ag as n, af as r, ac as u } from "./common/main-C_FS7g0q.js"; +import { ac as o, ag as s, ah as d, ai as p, ad as t, af as n, ae as r, ab as u } from "./common/main-DnobNY7x.js"; export { o as Context, s as Empty, diff --git a/dist/data-converter.js b/dist/data-converter.js index 6d55401..7fcf00c 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-C_FS7g0q.js"; +import { D as p } from "./common/main-DnobNY7x.js"; export { p as default }; diff --git a/dist/data-list.js b/dist/data-list.js index a1a4c6b..ff621c7 100644 --- a/dist/data-list.js +++ b/dist/data-list.js @@ -1,4 +1,4 @@ -import { B as t, z as e, s as r, x as o, C as i, y as u, w as D, A as l, v as L, E as n, q as m, F as p, N as C, J as c, L as F, K as b, M as d, I as k } from "./common/main-C_FS7g0q.js"; +import { A as t, y as e, q as r, w as o, B as i, x as u, v as D, z as l, s as L, C as n, p, E as m, M as C, I as c, K as F, J as b, L as d, F as k } from "./common/main-DnobNY7x.js"; export { t as DataListContent, e as DataListContext, @@ -10,8 +10,8 @@ export { l as DataListTable, L as DataListToolbar, n as DataTableFramework, - m as default, - p as useColumnsRender, + p as default, + m as useColumnsRender, C as useDataListHelper, c as useDataSource, F as useHasOperationColumn, diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index fb19358..b2e0351 100644 --- a/dist/data-list/utils.js +++ b/dist/data-list/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { l as a } from "../common/main-C_FS7g0q.js"; +import { k as a } from "../common/main-DnobNY7x.js"; export { a as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index fee4192..a1cc662 100644 --- a/dist/grid-layout-form.js +++ b/dist/grid-layout-form.js @@ -1,4 +1,4 @@ -import { $ as s, a1 as r, a0 as u, _ as o, a5 as t, a4 as d, a7 as m, a3 as F, a2 as i, a6 as g } from "./common/main-C_FS7g0q.js"; +import { _ as s, a0 as r, $ as u, Z as o, a4 as t, a3 as d, a6 as m, a2 as F, a1 as i, a5 as g } from "./common/main-DnobNY7x.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 60eafdc..238d7a5 100644 --- a/dist/grid-layout-form/utils.js +++ b/dist/grid-layout-form/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { g as o, a as g } from "../common/main-C_FS7g0q.js"; +import { g as o, a as g } from "../common/main-DnobNY7x.js"; export { o as getOptionItemByValue, g as getWidgetByNormalize diff --git a/dist/grid-layout.js b/dist/grid-layout.js index 5a6aee7..7780d86 100644 --- a/dist/grid-layout.js +++ b/dist/grid-layout.js @@ -1,4 +1,4 @@ -import { m as d, n as e, H as i, G as o, o as t, p as u } from "./common/main-C_FS7g0q.js"; +import { l as d, m as e, H as i, G as o, n as t, o as u } from "./common/main-DnobNY7x.js"; export { d as GridLayout, e as GridLayoutWidget, diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index e0fc460..b4c87e2 100644 --- a/dist/grid-layout/utils.js +++ b/dist/grid-layout/utils.js @@ -1,4 +1,4 @@ -import { j as o, k as a } from "../common/main-C_FS7g0q.js"; +import { i as o, j as a } from "../common/main-DnobNY7x.js"; export { o as getBoxStyle, a as getWidgetByNormalize diff --git a/dist/hooks.js b/dist/hooks.js index a7da7ea..4b478b9 100644 --- a/dist/hooks.js +++ b/dist/hooks.js @@ -1,12 +1,12 @@ import "lodash"; import "rc-field-form"; import "react"; -import { X as r, W as o, Y as p, U as f, V as i, Z as m, T as c } from "./common/main-C_FS7g0q.js"; -import { default as b } from "rc-util/lib/hooks/useMergedState"; +import { W as r, V as o, X as p, T as f, U as i, Y as m, S as c } from "./common/main-DnobNY7x.js"; +import { default as S } from "rc-util/lib/hooks/useMergedState"; export { r as useDeepEffect, o as useDeepEqualEffect, - b as useMergedState, + S as useMergedState, p as useOptions, f as usePrevious, i as useStateWithCallback, diff --git a/dist/iconfont.js b/dist/iconfont.js index 03f5284..3b0bb4c 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 { a8 as a } from "./common/main-C_FS7g0q.js"; +import { a7 as a } from "./common/main-DnobNY7x.js"; export { a as default }; diff --git a/dist/index.js b/dist/index.js index 43cc004..e45c1da 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -import { as as t, at as e, ao as o, ap as n, ak as p, aq as r, an as c, am as l, al as f, ar as m } from "./common/main-C_FS7g0q.js"; +import { ar as t, as as e, an as o, ao as n, aj as p, ap as r, am as c, al as l, ak as f, aq as m } from "./common/main-DnobNY7x.js"; export { t as AppContext, e as AppGlobalParamsContext, diff --git a/dist/pages.js b/dist/pages.js index ee938ef..710fc5f 100644 --- a/dist/pages.js +++ b/dist/pages.js @@ -1,4 +1,4 @@ -import { P as t, O as e, Q as o, S as P } from "./common/main-C_FS7g0q.js"; +import { O as t, N as e, P as o, Q as P } from "./common/main-DnobNY7x.js"; export { t as CustomPage, e as DataListPage, diff --git a/dist/res-ws.js b/dist/res-ws.js index ac5f499..b7f63ca 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-C_FS7g0q.js"; +import { R as a } from "./common/main-DnobNY7x.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index 5f39e6b..ac6e555 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,17 +1,14 @@ import "lodash"; -import { d as g, e as i, c as p, f as m, h as P, b as d, i as u, r as h, t as k, u as c } from "./common/main-C_FS7g0q.js"; -import "react/jsx-runtime"; -import "react"; +import { d as r, e as g, c as o, f as i, b as m, h as p, r as P, t as d, u as h } from "./common/main-DnobNY7x.js"; import "./common/vender-CtjyT19B.js"; export { - g as deepSome, - i as getPkgCategory, - p as getPkgName, - m as getPkgOwner, - P as getPopupzIndex, - d as getWidgetPropsData, - u as hashJSON, - h as replaceKeys, - k as toPrimitive, - c as uuid + r as deepSome, + g as getPkgCategory, + o as getPkgName, + i as getPkgOwner, + m as getWidgetPropsData, + p as hashJSON, + P as replaceKeys, + d as toPrimitive, + h as uuid }; diff --git a/package.json b/package.json index 83a786a..e4a6f2d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.5.10", + "version": "0.5.11", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js",