From e9b1166d7d72ccb3d908e901a21fb50b220b26ea Mon Sep 17 00:00:00 2001 From: what Date: Thu, 12 Dec 2024 09:55:56 +0800 Subject: [PATCH] v0.4.38 --- dist/button.js | 2 +- dist/common/main-B9_aE5ZC.js | 979 --------------------------------- dist/common/main-Bklk3nwG.js | 979 +++++++++++++++++++++++++++++++++ dist/components.js | 2 +- dist/container.js | 2 +- dist/data-converter.js | 2 +- dist/data-list.js | 2 +- 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 | 2 +- dist/iconfont.js | 2 +- dist/index.js | 2 +- dist/res-ws.js | 2 +- dist/utils.js | 2 +- package.json | 2 +- 18 files changed, 995 insertions(+), 995 deletions(-) delete mode 100644 dist/common/main-B9_aE5ZC.js create mode 100644 dist/common/main-Bklk3nwG.js diff --git a/dist/button.js b/dist/button.js index 72df50a..d2eb095 100644 --- a/dist/button.js +++ b/dist/button.js @@ -1,4 +1,4 @@ -import { X as s, W as u, Y as e } from "./common/main-B9_aE5ZC.js"; +import { X as s, W as u, Y as e } from "./common/main-Bklk3nwG.js"; import "prop-types"; export { s as auth, diff --git a/dist/common/main-B9_aE5ZC.js b/dist/common/main-B9_aE5ZC.js deleted file mode 100644 index c8b4c92..0000000 --- a/dist/common/main-B9_aE5ZC.js +++ /dev/null @@ -1,979 +0,0 @@ -var ka = Object.defineProperty; -var Rt = (e) => { - throw TypeError(e); -}; -var va = (e, t, a) => t in e ? ka(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a; -var k = (e, t, a) => va(e, typeof t != "symbol" ? t + "" : t, a), Ft = (e, t, a) => t.has(e) || Rt("Cannot " + a); -var g = (e, t, a) => (Ft(e, t, "read from private field"), a ? a.call(e) : t.get(e)), N = (e, t, a) => t.has(e) ? Rt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, a), B = (e, t, a, n) => (Ft(e, t, "write to private field"), n ? n.call(e, a) : t.set(e, a), a); -var Ot = (e, t, a, n) => ({ - set _(r) { - B(e, t, r, a); - }, - get _() { - return g(e, t, n); - } -}); -import { jsx as u, jsxs as F } from "react/jsx-runtime"; -import C, { useEffect as $, useState as P, useCallback as ce, useMemo as Z, useRef as q, useContext as Te, useId as Ge, useLayoutEffect as Sa } from "react"; -import p from "lodash"; -import Ht from "immutability-helper"; -import O from "classnames"; -import { Form as Ke, Input as xa, Button as lt, Breadcrumb as Pa, Tree as Na, Pagination as $a, Table as Ea, Empty as Ta, Popconfirm as Ra, Tooltip as Fa, Popover as Oa } from "antd"; -import { useMergedState as La } from "rc-util"; -import X, { FieldContext as Va, Field as Jt } from "rc-field-form"; -import { useParams as Aa, generatePath as ja, createBrowserRouter as Ia, useInRouterContext as Ma, Navigate as za } from "react-router-dom"; -import A from "prop-types"; -import * as Lt from "react-is"; -import { useNotification as Wa } from "rc-notification"; -import { N as Re, a as Fe, T as ct, S as Ua } from "./vender-DMK1apIA.js"; -import "rc-util/lib/hooks/useMergedState"; -import Da from "rc-drawer"; -import Ba from "rc-dialog"; -var xe, Ve, Pe, ie, be, ke; -class Kt { - constructor(t, a) { - N(this, xe, /* @__PURE__ */ new Map()); - N(this, Ve, !0); - N(this, Pe, []); - N(this, ie); - N(this, be, () => g(this, ie)); - N(this, ke, () => Promise.resolve()); - k(this, "get", (...t) => new Promise((a, n) => { - const r = JSON.stringify(t); - if (g(this, xe).has(r)) return a(g(this, ke).call(this, g(this, ie), ...t)); - if (g(this, ie) === void 0) g(this, Pe).push([t, a, n]), g(this, Ve) && (B(this, Ve, !1), Promise.resolve(typeof g(this, be) == "function" ? g(this, be).call(this) : g(this, be)).then((s) => B(this, ie, s || null)).finally(() => { - g(this, Pe).forEach(([s, i, o]) => { - try { - const l = g(this, ke).call(this, g(this, ie), ...s); - g(this, xe).set(JSON.stringify(s), l), i(l); - } catch (l) { - o(l); - } - }), g(this, Pe).length = 0; - })); - else { - const s = g(this, ke).call(this, g(this, ie), ...t); - g(this, xe).set(r, s), a(s); - } - })); - B(this, ke, a), B(this, be, t); - } -} -xe = new WeakMap(), Ve = new WeakMap(), Pe = new WeakMap(), ie = new WeakMap(), be = new WeakMap(), ke = new WeakMap(); -const Zn = () => u("div", { children: "Empty" }), We = C.createContext({ ele: {}, mount: () => { -}, unmount: () => { -} }), K = ({ rootClassName: e, className: t, children: a, actions: n, title: r, subTitle: s, extras: i, style: o = {} }) => { - const { mount: l, unmount: d } = C.useContext(We); - return n && K.Action({ children: n }), r && K.Title({ children: r }), s && K.SubTitle({ children: s }), i && K.Extra({ children: i }), $(() => (l("rootClassName", e), () => d(e)), [e]), u("div", { className: O("ff-container", t), style: o, children: a }); -}, Je = (e) => ({ children: t, className: a }) => { - const { mount: n, unmount: r } = C.useContext(We); - return $(() => (n(e, C.createElement("div", { key: `ff-${e}`, className: O(`ff-popup-${e}`, a) }, t)), () => r(e)), [a, t]), null; -}; -K.Action = Je("actions"), K.Title = Je("title"), K.SubTitle = Je("sub-title"), K.Extra = Je("extras"), K.propTypes = { className: A.string, style: A.object, title: A.any, subTitle: A.any, actions: A.any, extras: A.any }; -const er = () => u(K, { className: "ff-loading", children: F("div", { className: "loader", children: [F("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] }), F("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] }), F("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] }), F("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] })] }) }), tr = () => u("div", { children: "NotFound" }), _t = ({ children: e }) => { - const [t, a] = P({}), n = ce((s, i) => a((o) => ({ ...o, [s]: i })), []), r = ce((s) => a((i) => ({ ...i, [s]: void 0 })), []); - return typeof (e == null ? void 0 : e.type) == "string" ? e : u(We.Provider, { value: { ele: t, mount: n, unmount: r }, children: C.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) }); -}; -_t.propTypes = { children: A.element.isRequired }; -const Vt = { 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"] }, bt = ({ type: e, props: t }) => u("i", { ...t, children: u("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Vt[e] || Vt.info).map((a, n) => u("path", { d: a }, n)) }) }), Gt = ({ className: e, content: t, icon: a, $close: n }) => F(C.Fragment, { children: [a && u("div", { className: O("ff-notification-icon", e), children: u(bt, { type: a }) }), t] }), qa = ({}) => u(K, { children: "Confirm" }); -var de, Ne; -const ee = class ee { - constructor() { - N(this, Ne, /* @__PURE__ */ new Map()); - k(this, "init", (t) => B(this, Ne, new Map(t))); - k(this, "check", (t) => !g(this, Ne).has(t) || g(this, Ne).get(t)); - if (g(ee, de)) return g(ee, de); - } -}; -de = new WeakMap(), Ne = new WeakMap(), N(ee, de, null), k(ee, "getInstance", () => (g(ee, de) || B(ee, de, new ee()), g(ee, de))); -let dt = ee; -const Ha = dt.getInstance(); -var ue, Ae; -const te = class te { - constructor() { - N(this, Ae, null); - k(this, "init", (t) => B(this, Ae, t)); - k(this, "get", (t, a) => p.get(g(this, Ae), t, a)); - if (g(te, ue)) return g(te, ue); - } -}; -ue = new WeakMap(), Ae = new WeakMap(), N(te, ue, null), k(te, "getInstance", () => (g(te, ue) || B(te, ue, new te()), g(te, ue))); -let ut = te; -const Oe = ut.getInstance(), At = { 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" }, Y = (e, t) => { - let a = "string"; - a = Array.isArray(e) ? "array" : typeof e, p.isObject(e) && (a = "json"); - const n = `${a}2${t}`; - return Reflect.has(At, n) ? At[n](e) : e; -}, Yt = (e = {}, t = {}, a = {}, n = "") => Xt(e, (r, s) => s === "type" && r === "code") ? Qt(e, t, a, n) : Zt(e, t, n), Xt = (e, t = () => !1) => p.some(e, (a) => !!p.some(a, t) || (p.isEmpty(a) || !p.isPlainObject(a) && !p.isArray(a) ? void 0 : Xt(a, t))), Qt = async (e = {}, t = {}, a = {}, n = "") => { - let r = /* @__PURE__ */ Object.create(null); - for (let s in e) { - let i; - if (Reflect.has(e[s], "type") && ["code", "field", "router", "query", "string"].includes(e[s].type)) { - const { type: o, value: l = "", default: d = n } = e[s]; - switch (o) { - case "code": - i = await Ce.exec(l, t, a); - break; - case "field": - i = p.get(t, l) ?? p.get(t, l.substring(l.indexOf(".") + 1)); - break; - case "router": - case "query": - i = le.getPageParams(l); - break; - case "string": - i = l; - } - i ?? (i = d); - } else i = await Qt(e[s], t, a, n); - p.set(r, s, i); - } - return r; -}, Zt = (e = {}, t = {}, a = "") => Object.keys(e || {}).reduce((n, r) => { - if (p.isPlainObject(e[r])) { - let s; - if (Reflect.has(e[r], "type") && ["field", "router", "query", "string"].includes(e[r].type)) { - const { type: i, value: o = "", default: l = a } = e[r]; - switch (i) { - case "field": - s = p.get(t, o) ?? p.get(t, o.substring(o.indexOf(".") + 1)); - break; - case "router": - case "query": - s = le.getPageParams(o); - break; - case "string": - s = o; - } - s ?? (s = l); - } else s = Zt(e[r], t, a); - p.set(n, r, s); - } - return n; -}, {}), st = (e, t) => e && typeof e == "object" ? Array.isArray(e) ? e.map((a) => st(a, t)) : Object.keys(e).reduce((a, n) => (t[n] ? a[t[n]] = st(e[n], t) : a[n] = st(e[n], t), a), {}) : e, ar = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => { - const t = 16 * Math.random() | 0; - return (e === "x" ? t : 3 & t | 8).toString(16); -}); -var Xe, je, Ie, Qe; -const Ze = class Ze { - constructor(...t) { - N(this, je, []); - N(this, Ie, (t) => { - var a; - for (let n of t) Array.isArray(n[0]) ? g(this, Ie).call(this, n) : g(this, je).push(g(a = Ze, Xe).call(a, n[0], n[1])); - }); - k(this, "toValue", async (t, a = null) => { - const n = { getValue: () => t, getRecord: () => a }; - return await g(this, je).reduce(async (r, s) => { - try { - const i = await r; - return (await s).call(n, i); - } catch (i) { - return console.error(i), r; - } - }, t); - }); - k(this, "toRender", (t, a, n = null) => C.createElement(g(this, Qe), { value: t, record: a }, n)); - N(this, Qe, ({ value: t, record: a, children: n }) => { - const [r, s] = P(n); - return xt(() => { - let i = !1; - return s(n), this.toValue(t, a).then((o) => Y(o, "string")).then((o) => !i && s(o)).catch((o) => !i && s(`${o}`)), () => i = !0; - }, [t, a]), r; - }); - g(this, Ie).call(this, t); - } -}; -Xe = new WeakMap(), je = new WeakMap(), Ie = new WeakMap(), Qe = new WeakMap(), N(Ze, Xe, p.memoize((t, a) => Q.getWidgetComponent(t).then((n) => { - var r; - return ((r = n.default) == null ? void 0 : r.call(n, a)) || ((s) => s); -}), (t, a) => `${t}::${Y(a, "string")}`)); -let Ye = Ze; -const Ja = (e, t = {}) => Z(() => e == null ? void 0 : e.map(({ widgetByJs: a, widgetByJsSetting: n, ...r }, s) => a ? { ...r, render: (i, o) => new Ye([a, n]).toRender(i, o, "-") } : r), [e, t]), nr = (e) => { - const [t, a] = P({}); - return $(() => { - let n = !1; - return e && R.get(`/api/_/${e}`).then((r) => p.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig"])).then((r) => !n && a(r)), () => n = !0; - }, [e]), t; -}, rr = (e, t = {}) => { - const [a, n] = P({ dataSource: [] }); - return Ue(() => { - let r = !1; - return e && R.get(`/api/${e}/${R.encode({ page: 1, ...t })}`).then((s) => !r && n(s)), () => r = !0; - }, [e, t]), a; -}, gt = (e, t = null, a = null, n = "id") => Z(() => { - if (p.isEmpty(e) || !e.some(({ uuid: s }) => Ha.check(s))) return !1; - if (p.isEmpty(a) || p.isEmpty(t)) return !0; - const r = t.map((s) => `${s == null ? void 0 : s[n]}`); - return e.some(({ uuid: s }) => !s || !a.has(s) || a.get(s).some((i) => r.includes(`${i}`))); -}, [e, t, a, n]), Ka = (e, t, a = "id", n = null) => { - const r = St(), s = q(!1), i = q(e.dataSource), o = q(e.itemOperationsAccess); - return $(() => (i.current = e.dataSource, o.current = e.itemOperationsAccess, () => s.current = !1), [e.dataSource, e.itemOperationsAccess]), s.current && (e.dataSource = i.current, e.itemOperationsAccess = o.current), [e, (l = 0, d = null) => { - var c, m; - if (s.current = !1, l === 1) return (c = e.onReload) == null ? void 0 : c.call(e); - if (l === 2) { - const h = p.get(d, "__PARENT_ID__", ""), f = p.get(d, a, p.get(d, [n, a], "")), y = p.findIndex(i.current, ["__PARENT_ID__", h]), b = p.findIndex(y > -1 ? p.get(i.current, [y, "children"]) : i.current, [a, f]); - if (b === -1) return (m = e.onReload) == null ? void 0 : m.call(e); - Promise.all([R.get(`/api/${t}/detail/${f}`), R.post(`/api/${t}/list-operations-access`, { ids: f })]).then(([w, v]) => { - const j = p.get(i.current, y > -1 ? [y, "children", b, "children"] : [b, "children"]); - i.current = Ht(i.current, y > -1 ? { [y]: { children: { $splice: [[b, 1, { ...w, children: j }]] } } } : { $splice: [[b, 1, { ...w, children: j }]] }); - const z = new Map(v); - o.current.forEach((I, L) => { - var E; - (E = z.get(L)) != null && E.some((S) => S == f) || o.current.set(L, I.filter((S) => S !== f)); - }), z.forEach((I, L) => { - o.current.has(L) ? o.current.set(L, p.uniq([...o.current.get(L) || [], ...I])) : o.current.set(L, I); - }); - }).then(() => { - s.current = !0, r(); - }); - } - }]; -}, _a = (e, t) => { - const a = St(), n = q(t), r = q(/* @__PURE__ */ new Map()), s = q([]), i = p.throttle((l) => { - s.current = [], R.list(e, p.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: d, condition: c, total: m, tab: h, sider: f, page: y, pageSize: b, operationsAccess: w, dataSource: v }) => { - n.current = { tab: h, condition: c, sider: f, keyword: d, total: m, pageSize: b, page: v != null && v.length ? y : 1 }, s.current = v, r.current = new Map(w), a(); - }); - }, 380, { leading: !1, trailing: !0 }); - xt(() => { - s.current = [], e && i(t); - }, [e, t]); - const o = Z(() => p.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [n.current]); - return Object.assign(o, { onTabChange: (l) => i({ tab: l, page: 1 }), onPageChange: (l, d) => i({ page: l, pageSize: d }), onPageSizeChange: (l) => i({ pageSize: l, page: 1 }), onConditionChange: (l, d) => i({ keyword: d, condition: Ht(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => i({ sider: l, page: 1 }), onKeywordChange: (l) => i({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: s.current, onReload: i }); -}, Ga = ({ className: e, itemClassName: t, classNames: a = {}, dataSource: n, isPaginate: r, isItemOperations: s, isBatchOperations: i, batchOperations: o, itemOperations: l, itemOperationsAccess: d, resource: c, primaryKey: m, title: h, itemGridLayout: f, $setting: y, tabs: b, isConditionFormLayout: w, isTreeSider: v, treeSiderConfig: j }) => { - const { getBase62params: z, onClickCallback: I } = Te(we), { total: L, page: E, pageSize: S } = (z == null ? void 0 : z()) || {}, V = ce((U, D, W) => u(Ya, { className: O("ff-data-list-framework-item", t), operations: s && D ? l == null ? void 0 : l.filter((T) => !(m && T.uuid && d.has(T.uuid)) || d.get(T.uuid).includes(D == null ? void 0 : D[m])) : [], data: c ? { [c]: D } : D, children: U, onClickCallback: I }), [c, m, s, I, l, d]); - return F("div", { className: O("ff-data-list-framework", e), children: [u(na, { className: a == null ? void 0 : a.sider, isTreeSider: v, ...j }), F("div", { className: O("ff-data-list-container", a == null ? void 0 : a.container), children: [u(vt, { className: a == null ? void 0 : a.filter, isConditionFormLayout: w }), u(aa, { title: h, className: a == null ? void 0 : a.toolbar, tabs: b }), u(on, { ...f, className: a == null ? void 0 : a.content, style: { "--col-num": (y == null ? void 0 : y.colNum) || 1 }, primaryKey: m, itemRender: V, dataSource: n }), u(ra, { className: a == null ? void 0 : a.footer, isPaginate: r, isOperations: i, operations: o, total: L, page: E, pageSize: S })] })] }); -}, Ya = ({ className: e, operations: t, children: a, data: n, onClickCallback: r }) => F("div", { className: O("data-list-grid-layout-item-container", e), children: [a, !!(t != null && t.length) && u("div", { className: "data-list-grid-layout-item-actions", children: t.map((s) => u("span", { className: "data-list-grid-layout-item-action", children: u(x.Link, { uuid: s.uuid, type: s.type, name: s.name, widget: s.widget, widgetType: s.widgetType, widgetProps: s.widgetProps, widgetSetting: s.widgetSetting, widgetContainerProps: s.widgetContainerSetting, data: n, confirm: s.confirm, onAfterClick: (i) => i !== !1 && (r == null ? void 0 : r(s.isRefresh, n)) }, s.uuid || Ge()) }, (s == null ? void 0 : s.uuid) || Ge())) })] }), Xa = ({ listCode: e, className: t, classNames: a = {}, itemClassName: n, dataSource: r, columns: s, isItemOperations: i, isBatchOperations: o, batchOperations: l, itemOperations: d, itemOperationsAccess: c, resource: m, primaryKey: h, title: f, tabs: y, isPaginate: b, isTreeSider: w, treeSiderConfig: v, isConditionFormLayout: j, ...z }) => { - const { getBase62params: I, onClickCallback: L } = Te(we), { total: E, page: S, pageSize: V } = (I == null ? void 0 : I()) || {}, U = gt(d, r, c, h); - return F("div", { className: O("ff-data-table-framework", t), children: [u(na, { className: a == null ? void 0 : a.sider, isTreeSider: w, ...v }), F("div", { className: O("ff-data-table-container", a == null ? void 0 : a.container), children: [u(vt, { listCode: e, isConditionFormLayout: j }), u(aa, { title: f, className: a == null ? void 0 : a.toolbar, tabs: y }), u(tn, { ...z, primaryKey: h, className: "ff-data-table-content", columns: s, dataSource: r, operationRender: U ? (D) => u("div", { className: "ff-data-table-actions", children: d == null ? void 0 : d.reduce((W, T, H) => [...W, u(x.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: D, confirm: T.confirm, onAfterClick: (se) => se !== !1 && (L == null ? void 0 : L(T.isRefresh, D)) }, T.uuid || H)], []) }) : null }), u(ra, { isPaginate: b, isOperations: o, operations: l, total: E, page: S, pageSize: V })] })] }); -}, we = C.createContext({ listCode: "", getBase62params: (e, t) => { -}, onReload: () => { -}, onClickCallback: () => { -}, onConditionChange: () => { -}, onTabChange: () => { -}, onSiderChange: () => { -}, onKeywordChange: () => { -}, onPageChange: () => { -}, onPageSizeChange: () => { -} }), Qa = ({ isItemGridLayout: e, theme: t, themeProps: a, onClickCallback: n, onReload: r, listCode: s, total: i = 0, page: o = 0, onPageChange: l, pageSize: d = 30, onPageSizeChange: c, tab: m, onTabChange: h, keyword: f, onKeywordChange: y, condition: b, onConditionChange: w, sider: v, onSiderChange: j, ...z }) => { - const [I, L] = P(); - return $(() => { - t ? Q.getWidgetComponent(t).then((E) => { - if (!E) throw `${t} not found`; - return E; - }).catch((E) => ({ default: () => `${E}` })).then((E) => L(C.createElement(E.default, { ...z, $setting: a }))) : L(u(e ? Ga : Xa, { ...z, $setting: a })); - }, [t, a]), u(we.Provider, { value: { listCode: s, onClickCallback: n, onReload: r, getBase62params: (E, S) => { - const V = { tab: m, page: o, pageSize: d, keyword: f, sider: v, condition: b, total: i }; - return E && E != "init" ? V[E] ?? S : V; - }, onPageChange: l, onPageSizeChange: c, onTabChange: h, onSiderChange: j, onKeywordChange: y, onConditionChange: w }, children: I && C.cloneElement(I, z) }); -}; -var ge, oe, ve, et; -const ae = class ae { - constructor() { - N(this, oe, null); - N(this, ve, /* @__PURE__ */ new Map()); - N(this, et, () => { - if (g(this, oe)) return g(this, oe).port.postMessage({ command: "status", data: [] }); - B(this, oe, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), g(this, oe).port.onmessage = (t) => { - var a, n; - (a = t.data) != null && a.uuid ? g(this, ve).forEach((r, s) => { - var i; - (r == "*" || (i = r == null ? void 0 : r.includes) != null && i.call(r, t.data.uuid)) && s(t.data); - }) : ((n = t.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && R.get("/api/user-api-token").then(({ token: r, expire_at: s }) => { - g(this, oe).port.postMessage({ command: "initWs", data: [`ws${p.trimStart(R.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); - }); - }, g(this, oe).port.postMessage({ command: "status", data: [] }); - }); - k(this, "subscribe", (t, a = []) => (a ? Array.isArray(a) && a.length == 0 ? a = "*" : Array.isArray(a) || (a = [a].flat()) : a = "*", g(this, ve).set(t, a), g(this, ve).size == 1 && g(this, et).call(this), () => this.unsubscribe(t))); - k(this, "unsubscribe", (t) => g(this, ve).delete(t)); - if (g(ae, ge)) return g(ae, ge); - } -}; -ge = new WeakMap(), oe = new WeakMap(), ve = new WeakMap(), et = new WeakMap(), N(ae, ge, null), k(ae, "getInstance", () => (g(ae, ge) || B(ae, ge, new ae()), g(ae, ge))); -let pt = ae; -const ea = pt.getInstance(), kt = C.forwardRef(({ listCode: e, base62params: t, className: a, itemClassName: n, theme: r, themeProps: s, classNames: i }, o) => { - const [{ resource: l, primaryKey: d, batchOperations: c = [], itemOperations: m = [], columns: h = [], themeConfig: f, theme: y, isConditionFormLayout: b = !1, isTreeSider: w, treeSiderConfig: v, isItemGridLayout: j, itemGridLayout: z, title: I, isPaginate: L, tabs: E }, S] = P({ isItemGridLayout: !1, itemGridLayout: {} }), V = _a(e, t), [{ dataSource: U, itemOperationsAccess: D, condition: W, tab: T, keyword: H, page: se, total: at, pageSize: Be, sider: nt, onConditionChange: Et, onTabChange: pa, onKeywordChange: ma, onPageChange: ha, onPageSizeChange: fa, onSiderChange: ya, onReload: rt }, Tt] = Ka(V, e, d, l), wa = gt(m, U, D, d), Ca = gt(c); - return $(() => { - let qe = null; - return e && R.get(`/api/_/${e}`).resp(({ data: He, res: ba }) => { - He != null && He.isDynamicRefresh && (qe = ea.subscribe(() => rt(), ba)), S(He); - }).catch(() => S({})), () => qe == null ? void 0 : qe(); - }, [e]), C.useImperativeHandle(o, () => ({ onReload: rt, onClickCallback: Tt })), u(Qa, { listCode: e, title: I, itemClassName: n, classNames: i, resource: l, primaryKey: d, theme: r || y, themeProps: s || f, isTreeSider: w, treeSiderConfig: v, isPaginate: L, tabs: E, isItemOperations: wa, isBatchOperations: Ca, batchOperations: c, itemOperations: m, isItemGridLayout: j, columns: h, itemGridLayout: z, isConditionFormLayout: b, itemOperationsAccess: D, dataSource: U, onConditionChange: Et, onTabChange: pa, onKeywordChange: ma, onPageChange: ha, onPageSizeChange: fa, onSiderChange: ya, condition: W, tab: T, keyword: H, page: se, total: at, pageSize: Be, sider: nt, className: O("ff-data-list-helper", a), onReload: rt, onClickCallback: Tt }); -}), ta = (e, t, a, n, r = {}, s = 0) => { - const i = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${a}`, "--grid-layout-x": `${e}`, "--grid-layout-y": `${t}`, "--grid-layout-row-height-offset": "0px" }; - return r != null && r.autoHeight ? i.height = "fit-content" : i["--grid-layout-row"] = `${n}`, r != null && r.alignItems && (i["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (i["--grid-layout-box-justify-content"] = r.justifyContent), i["--grid-layout-box-margin"] = jt(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), i["--grid-layout-box-padding"] = jt(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), s && (i.height = `${s}px`), i; -}, jt = (e, t, a, n) => `${e || 0}px ${t || 0}px ${a || 0}px ${n || 0}px`, vt = ({ className: e, isConditionFormLayout: t }) => { - var m, h; - const [a, n] = P({}), { listCode: r, onKeywordChange: s, onConditionChange: i, getBase62params: o } = C.useContext(we), { keyword: l, condition: d } = (o == null ? void 0 : o()) || {}, [c] = Ke.useForm(); - return $(() => { - r && t && R.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: b, rowHeight: w, cols: v, fields: j }) => { - n({ resource: f, itemMargin: [y, b], rowHeight: w, cols: v, fields: j }); - }).catch(() => n({})); - }, [r, t]), $(() => { - c.setFieldsValue({ keyword: l, ...d }); - }, [JSON.stringify([l, d])]), u("div", { className: O("ff-data-list-filter", e), children: u(Ke, { form: c, layout: "vertical", autoComplete: "off", onFinish: ((m = a.fields) == null ? void 0 : m.length) > 1 ? (f) => i({ [a.resource]: f[a.resource] }, f.keyword) : () => { - }, onValuesChange: (f) => { - p.isEmpty(p.omit(f, ["keyword"])) || c.submit(); - }, children: ((h = a.fields) == null ? void 0 : h.length) > 1 ? u(Pt, { ...a, children: u(Za, { onReset: () => { - const { keyword: f, condition: y } = o("init") || {}; - c.setFieldsValue({ keyword: f, ...y }); - } }) }) : u("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: u("div", { className: "grid-layout-item", style: ta(20, 0, 5, 2), children: u(Ke.Item, { name: ["keyword"], children: u(xa.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => s(f) }) }) }) }) }) }); -}, Za = ({ cols: e, fields: t, onReset: a }) => { - const [n, r] = P(!1), s = Z(() => t == null ? void 0 : t.toReversed().some((i) => i.y > 1 || i.x + i.w >= e - 5), [e, t]); - return F(Ke.Item, { label: " ", style: { "--item-span": 5 }, className: O("ff-data-list-filter-actions", { expanded: n }), children: [u(lt, { onClick: a, children: "重置" }), u(lt, { type: "primary", htmlType: "submit", children: "查询" }), s && u(x.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((i) => !i), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); -}; -vt.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 aa = ({ className: e, title: t, tabs: a }) => { - const { getBase62params: n, onTabChange: r, onReload: s } = Te(we), { tab: i } = (n == null ? void 0 : n()) || {}, [o, l] = La((a == null ? void 0 : a[0].value) ?? (a == null ? void 0 : a[0].code), { value: i, onChange: r }); - return F("div", { className: O("ff-data-list-toolbar", e), children: [u("div", { className: "ff-data-list-title", children: t }), u(Pa, { className: "ff-data-list-tabs", itemRender: ({ label: d, code: c, value: m }) => u("span", { onClick: () => l(m ?? c), className: O("ff-data-list-tab", { active: (m ?? c) == o }), children: d }), items: a }), F("div", { className: "ff-data-list-actions", children: [u(x.Link, { icon: "icon-reload", widget: () => s() }), u(x.Link, { icon: "icon-setting" })] })] }); -}, en = [{ 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: u("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], na = ({ className: e, width: t = 280, isTreeSider: a }) => a ? u(Na.DirectoryTree, { className: O("ff-data-list-sider", e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: en }) : null, ra = ({ className: e, operations: t, isOperations: a, isPaginate: n, total: r, page: s, pageSize: i }) => { - const { onPageChange: o, onPageSizeChange: l, onClickCallback: d } = C.useContext(we); - return a && !p.isEmpty(t) || n ? F("div", { className: O("ff-data-list-footer", e), children: [u("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((c, m) => u(x, { 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, onAfterClick: (h) => h !== !1 && (d == null ? void 0 : d(c.isRefresh, null)) }, c.uuid || m)) }), n && u($a, { size: "small", total: r, pageSize: i, showSizeChanger: !1, showTotal: (c) => `第 ${s} 页 / 总共 ${c} 条`, onChange: o, onShowSizeChange: l })] }) : null; -}, sa = (e, t, a = !0) => a !== !0 && a-- <= 0 ? [] : p.isArray(e) && !p.isEmpty(e) ? e.reduce((n, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && n.push(r[t]), Reflect.has(r, "children") && !p.isEmpty(r.children) ? n.concat(sa(r.children, t, a)) : n), []) : [], tn = ({ className: e, primaryKey: t, columns: a = [], dataSource: n = [], operationRender: r, operationWidth: s = 180, ...i }) => { - Ge(); - const o = q(null), l = q(null), [d, c] = P([]), [m, h] = P({ width: 0, height: 0 }); - $(() => { - c(sa(n, t)); - }, [n, t]), Sa(() => { - const y = new ResizeObserver(() => { - var b; - h({ width: ((b = o.current) == null ? void 0 : b.nativeElement.querySelector(".ant-table-body").scrollWidth) || l.current.offsetWidth, height: l.current.offsetHeight }); - }); - return l.current && y.observe(l.current), () => { - l.current && y.unobserve(l.current); - }; - }, []); - const f = Ja(a); - return u("div", { ref: l, className: O("ff-data-list-table", e), children: m.height ? u(Ea, { ...i, ref: o, rowKey: (y) => (y == null ? void 0 : y[t]) ?? Math.random(), columns: f == null ? void 0 : f.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(s / m.width * 100).toFixed(2)}%`, render: (y, b, w) => r(b, w) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: m.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: c, expandedRowKeys: d } }) : null }); -}, an = "RC_FORM_INTERNAL_HOOKS", ia = (e, { initialValue: t, initialValueLanguage: a, convertJs: n, convertJsSetting: r, type: s = "string" }, i = null) => { - const o = q(!1), l = Te(Va), [d, c] = P(), [m, h] = P(a != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: f } = l.getInternalHooks(an) || {}; - return $(() => f == null ? void 0 : f((y, b, w) => { - if (!o.current) return; - const v = p.get(b, e); - p.isEqual(v, m) || h(Y(v, s)); - }), [m]), $(() => { - a == "javascript" && t ? Ce.exec(t, {}, { getFieldValueForBasicForm: (y) => i ? i.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => h(Y(y, s))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => o.current = !0) : (t && h(Y(t ?? l.getFieldValue(e), s)), o.current = !0); - }, [t, a]), Ue(() => { - o.current && n && new Ye([n, r]).toValue(m, l.getFieldsValue(!0)).then(c).catch((y) => { - c(y), console.error("布局数据转换错误: ", y, n); - }); - }, [m, n, r]), [d ?? m, m]; -}, oa = (e, t, a = "@pkg/ff/grid-layouts", n = null) => Z(() => { - var r; - return (r = p.sortBy(e, ["y", "x"])) == null ? void 0 : r.map(({ i: s, x: i, y: o, w: l, h: d, field: { boxStyle: c, widgetPrefix: m = a, widget: h, ...f } }, y) => u("div", { className: "grid-layout-item", style: ta(i, o, l, d, c, h === "Height" && (f == null ? void 0 : f.initialValue)), children: u(nn, { ...f, basicForm: n, itemWidget: h != null && h.startsWith("@") || h != null && h.startsWith("blob:") ? h : `${m}/${h}`, itemWidgetRender: t }) }, s || y)); -}, [e]), nn = ({ itemWidget: e, itemWidgetRender: t, basicForm: a, ...n }) => { - const [r, s] = P(); - return $(() => { - Q.getWidgetComponent(e).then(({ defaultProps: i = {}, default: o }) => { - s(C.createElement(t(o, i, a), n)); - }).catch((i) => { - console.error(i), s(e); - }); - }, [e]), r; -}, la = ({ cols: e = 12, rowHeight: t = 21, fields: a = [], data: n, containerPadding: r = [0, 0], itemMargin: s = [4, 0], formProps: i = {}, className: o, ...l }) => { - const [d] = X.useForm(), c = oa(a, rn, "@pkg/ff/grid-layouts"), m = Z(() => [{ name: "__PROPS__", value: i }], [i]); - return Ue(() => (d.setFieldsValue(n), () => d.resetFields()), [n]), u(X, { fields: m, form: d, component: !1, children: u("div", { ...l, className: O("ff-grid-layout", o), style: { "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-container-padding-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-container-padding-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: c }) }); -}, rn = (e, t = {}, a = null) => (n) => { - const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, ...h } = p.merge({}, t, n), [f, y] = ia(o ? null : r, { initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, type: (h == null ? void 0 : h.type) || "string" }, a); - return u(e, { ...h, value: f, rawValue: y, $setting: i || {} }); -}, sr = (It = la, function({ code: e, data: t, ...a }) { - const [n, r] = P({ resource: null, cols: 12, rowHeight: 21, fields: [] }); - return $(() => { - e && R.get(`/api/_/${e}`).then((s) => r(p.pick(s, ["resource", "cols", "rowHeight", "fields"]))); - }, [e]), (n == null ? void 0 : n.resource) && u(It, { ...a, rowHeight: n.rowHeight, cols: n.cols, fields: n.fields, data: n != null && n.resource ? { [n == null ? void 0 : n.resource]: t } : {} }); -}); -var It; -const ir = ({ widget: e, widgetPrefix: t = "@pkg/ff/grid-layouts", basicForm: a, ...n }) => { - const r = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [s, i] = P(); - return $(() => { - r && Q.getWidgetComponent(r).then(({ defaultProps: o = {}, default: l }) => ({ default: sn(l, o, a) })).catch((o) => ({ default: () => `${o}` })).then((o) => i(C.createElement(o.default, n))); - }, [r]), s; -}, sn = (e, t = {}, a = null) => (n) => { - const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, value: h, ...f } = p.merge({}, t, n), [y, b] = ia(o ? null : r, { initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, type: (f == null ? void 0 : f.type) || "string" }, a); - return u(e, { ...f, value: y, rawValue: b, $setting: i || {} }); -}, on = ({ cols: e, rowHeight: t, itemMargin: a, fields: n, primaryKey: r, dataSource: s, itemClassName: i, itemRender: o = (m, h, f) => m, empty: l = u(Ta, { description: null }), className: d, style: c = {} }) => { - const m = Ge(), h = Z(() => u(la, { cols: e, rowHeight: t, itemMargin: a, fields: n, className: i }), [n, e, t, a]); - return u("div", { className: O("ff-data-list-content", d), style: c, children: p.isEmpty(s) ? l : s.map((f, y) => { - const b = o(C.cloneElement(h, { data: f }), f, y); - return C.cloneElement(b, { key: `${m}-${(f == null ? void 0 : f[r]) || y}` }); - }) }); -}, ln = ({ component: e }) => { - const { base62params: t } = Aa(); - return u(K, { children: u(kt, { listCode: e, base62params: R.decode(t) }) }); -}, cn = () => "Empty", dn = ({ component: e, $setting: t }) => { - const [a, n] = P(); - $(() => { - if (!e) return n(u(cn, { description: null })); - Q.getWidgetComponent(e).catch((s) => ({ default: () => `${s}` })).then((s) => C.createElement(s.default, { $setting: t })).then(n); - }, [e]); - const r = le.getPageParams() || {}; - return a ? C.cloneElement(a, r) : null; -}; -var pe, G, me, he, Me, ze; -const ne = class ne { - constructor() { - N(this, G, /* @__PURE__ */ new Map()); - N(this, me, {}); - N(this, he, null); - k(this, "init", (t, a) => { - B(this, G, t), B(this, me, a); - }); - k(this, "get", (t) => (g(this, G).has(t) || (t = Array.from(g(this, G).keys()).find((a) => g(this, G).get(a).uri === t)), g(this, G).get(t) || {})); - k(this, "redirect", (t, a, n = {}) => { - const { uri: r, type: s, widgetProps: i } = this.get(t) || {}; - let o = ja(r || t, s != "list" ? a : p.mapValues(a, (d) => R.encode(d))); - const l = new URLSearchParams(); - for (const d in i || {}) (i == null ? void 0 : i.type) == "query" && l.append(d, a[d]); - return l.size > 0 && (o = `${o}?${l.toString()}`), g(this, he).navigate(o, n); - }); - k(this, "getMenus", (t) => { - var a; - return ((a = g(this, me)) == null ? void 0 : a[t]) || []; - }); - k(this, "findMenuPathByUuid", (t) => { - let a = []; - for (const n in g(this, me)) if (a = g(this, Me).call(this, g(this, me)[n], t, [n]), a.length > 1) return a; - return a; - }); - k(this, "getMenusByRouteUuid", (t) => g(this, ze).call(this, t, Object.values(g(this, me)).flat())); - N(this, Me, (t, a, n = []) => { - if (p.isEmpty(t)) return n; - for (const { uuid: r, children: s } of t) { - if (r == a) return n.concat(r); - if (!p.isEmpty(s)) return n.concat(r, g(this, Me).call(this, s, a)); - } - return n; - }); - N(this, ze, (t, a) => { - var r; - let n = []; - for (const s of a) s.widgetType == "redirect" && (s.uuid == t || s.widget == t ? n.push(s) : (r = s.children) != null && r.length && (n = n.concat(g(this, ze).call(this, t, s.children)))); - return n; - }); - k(this, "getCurrentMenu", () => { - const { uuid: t } = this.getCurrentRoute() || {}; - if (!t) return; - const a = this.getMenusByRouteUuid(t); - return p.isEmpty(a) ? void 0 : a[0]; - }); - k(this, "getCurrentRoute", (t = 0) => { - var n; - const a = (n = g(this, he).state.matches[g(this, he).state.matches.length - 1 - t]) == null ? void 0 : n.route; - if (!a) return null; - for (let [r, s] of g(this, G)) if (s.uri === a.path) return s; - return null; - }); - k(this, "getPageParams", (t) => { - var s, i; - const { location: a = {}, matches: n = [] } = ((s = g(this, he)) == null ? void 0 : s.state) || {}, r = ((i = n[n.length - 1]) == null ? void 0 : i.params) || {}; - return a.search && new URLSearchParams(a.search).forEach((o, l) => { - r[l] = o; - }), t ? p.get(r, t) : r; - }); - k(this, "createBrowserRouter", (t = {}) => { - if (g(this, G).size == 0) return null; - const a = Oe.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Oe.get(Q.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [a]: 0 }, s = (o, l) => () => Q.getWidgetComponent(o).then((d) => d.default || function() { - return `${o}`; - }).then((d) => ({ Component: () => C.createElement(_t, {}, C.createElement(d, l)) })), i = Array.from(g(this, G).values()).reduce((o, { uuid: l, uri: d, name: c, type: m, component: h, widgetSetting: f, isLogin: y, isLayout: b, extra: w }) => { - let v = {}, j = 0; - switch (m) { - case "list": - v.element = C.createElement(ln, { component: h }); - break; - case "fsdpf-component": - v.element = C.createElement(dn, { key: h, component: h, $setting: f }); - } - if (w != null && w.layout) { - if (!r[w == null ? void 0 : w.layout]) return r[w == null ? void 0 : w.layout] = o.length, [...o, { path: "/", lazy: s(w == null ? void 0 : w.layout, {}), children: [{ path: d, ...v }] }]; - j = r[w == null ? void 0 : w.layout]; - } - return b && j > -1 ? (o[j].children.push({ path: d, ...v }), o) : [...o, { path: d, ...v }]; - }, [{ path: "/", lazy: s(a, {}), children: [] }]); - return i.push({ index: !0, element: C.createElement(un, { to: n, replace: !0 }) }), B(this, he, Ia(i, t)); - }); - if (g(ne, pe)) return g(ne, pe); - } -}; -pe = new WeakMap(), G = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), N(ne, pe, null), k(ne, "getInstance", () => (g(ne, pe) || B(ne, pe, new ne()), g(ne, pe))); -let mt = ne; -const un = ({ to: e, replace: t }) => Ma() ? C.createElement(za, { to: e, replace: t }) : (window.document.location = e, "redirect"), le = mt.getInstance(), Se = new Worker(new URL("/ff-worker/index.js", self.location)), Mt = { getConfigure: (e) => Oe.get(e), route: { redirect: (...e) => le.redirect(...e), getPageParams: (...e) => le.getPageParams(...e), getCurrentRoute: () => le.getCurrentRoute() }, popup: { notification: (...e) => _.notification(...e), success: (...e) => _.success(...e), error: (...e) => _.error(...e), form: (...e) => _.form(...e), modal: (...e) => _.modal(...e), confirm: (...e) => _.confirm(...e) } }; -var tt, $e, fe; -const M = class M { - constructor() { - k(this, "exec", (t, a = {}, n = {}, r = "") => new Promise((s, i) => { - const o = Ot(M, tt)._++; - g(M, $e).set(o, n), M.mQueue.set(o, [s, i]), Se.postMessage({ id: o, session: r, category: "eval", method: t, args: a }); - })); - k(this, "clear", (t) => Se.postMessage({ session: t, category: "clear" })); - if (g(M, fe)) return g(M, fe); - Promise.resolve().then(() => An).then((t) => { - Mt.http = t.http; - }), Se.addEventListener("message", ({ data: { id: t, task_id: a, method: n, args: r, category: s, data: i, error: o, session: l } }) => { - if (s === "eval" && M.mQueue.has(t)) o !== null ? M.mQueue.get(t)[1](o) : M.mQueue.get(t)[0](i), g(M, $e).delete(t), M.mQueue.delete(t); - else if (s === "util") try { - const d = p.get(Mt, n.split("/")) || p.get(g(M, $e).get(a), n.split("/")); - if (!p.isFunction(d)) throw `${n} not found`; - Promise.resolve(Reflect.apply(d, void 0, r)).then((c) => { - Se.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: c, error: null }); - }).catch((c) => { - Se.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: null, error: c }); - }); - } catch (d) { - Se.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: null, error: d }); - } - }, !1); - } -}; -tt = new WeakMap(), $e = new WeakMap(), fe = new WeakMap(), k(M, "mQueue", /* @__PURE__ */ new Map()), N(M, tt, 0), N(M, $e, /* @__PURE__ */ new Map()), N(M, fe, null), k(M, "getInstance", () => (g(M, fe) || B(M, fe, new M()), g(M, fe))); -let ht = M; -const Ce = ht.getInstance(), St = () => { - const e = q(!0), [, t] = C.useReducer((a) => a + 1, 0); - return $(() => () => e.current = !1, []), () => e.current && t(); -}, or = (e) => { - const t = q(); - return $(() => { - t.current = e; - }, [e]), t.current; -}, lr = (e) => { - const [t, a] = P(e), n = q(null), r = ce((s, i) => { - n.current = i, a(s); - }, []); - return $(() => { - n.current && (n.current(t), n.current = null); - }, [t]), [t, r]; -}, Ue = (e = (n) => { -}, t, a = p.isEqual) => { - const n = C.useRef(); - a(t, n.current) || (n.current = p.cloneDeep(t)), C.useEffect(e, [n.current]); -}, xt = Ue, ca = (e, t = "string") => { - var a; - if (!Array.isArray(e)) return e; - for (let n = 0; n < e.length; n++) e[n].value = Y((a = e[n]) == null ? void 0 : a.value, t), e[n] && Reflect.has(e[n], "children") && (e[n].children = ca(e[n].children, t)); - return e; -}, cr = (e, t = "json", a = "string", n, r = null) => { - const [s] = X.useForm(n), [i, o] = P([{ label: "无", value: "", disabled: !0 }]), l = q([]), d = X.useWatch((c) => l.current.length === 0 ? null : p.pick(c, l.current), s) || null; - return $(() => { - Array.isArray(e) ? o(e) : t === "javascript" && e ? Ce.exec(e, {}, { getFieldValue: (c) => (l.current.includes(c) || l.current.push(c), s.getFieldValue(c)), getFieldValueForBasicForm: (c) => (l.current.includes(c) || l.current.push(c), r ? r.getFieldValue(c) : s.getFieldValue(c)) }).then((c) => { - o(Y(c, "array")); - }) : e && o(Y(e, "array")); - }, [e, t, d]), ca(i, a); -}, dr = (e) => { - const [t, a] = P(), n = { type: "GET" }; - if (typeof e == "string" ? n.url = e : p.isPlainObject(e) && Object.assign(n, e), !(n != null && n.url)) throw "url is required"; - const r = (s) => R.request(n, !1).resp((i) => (console.log("useSubscribeRequest", s), a(i), i)); - return Ue(() => { - let s = null; - return r().then((i) => { - s = ea.subscribe(p.throttle(r, 180, { leading: !1, trailing: !0 }), i.res); - }), () => s == null ? void 0 : s(); - }, n), t; -}, gn = (e) => { - const [t, a] = C.useState({ gridItems: [], hideItems: [] }); - return C.useEffect(() => { - e && R.get(`/api/_/${e}`).then(({ pk: n, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: d, marginX: c, marginY: m, listenChangeFields: h, listenChangeFieldsFunc: f, fields: y }) => ({ pk: n, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: d, marginX: c, marginY: m, listenChangeFields: h, listenChangeFieldsFunc: f, ...y.reduce((b, w) => { - var v; - return (v = w == null ? void 0 : w.field) != null && v.hidden ? b.hides.push(w == null ? void 0 : w.field) : b.items.push(w), b; - }, { items: [], hides: [] }) })).then(a); - }, [e]), t; -}, pn = ({ max: e = 0, min: t = 0, type: a = "", message: n, pattern: r, required: s = !1, validator: i } = {}, o, l) => { - const [d, c] = P([]); - return $(() => { - const m = []; - if (s) { - let h = l; - switch (l) { - case "number": - case "string": - case "array": - break; - case "bool": - h = "boolean"; - break; - case "json": - h = "object"; - } - m.push({ type: h, required: !0, whitespace: !0, message: "该项必填" }); - } - switch (a) { - case "string": - m.push({ type: a, max: e, min: t, message: n || (t && e ? `字符必须在 ${t} ~ ${e} 之间` : `${e ? "最多能有" : "最少要有"} ${t || e} 个字符`) }); - break; - case "pattern": - m.push({ type: "string", pattern: r, message: n }); - break; - case "validator": - i && m.push(({ getFieldValue: h }) => ({ validator: async (f, y) => { - const b = await Ce.exec(i, { value: y, fieldName: o }, { getFieldValue: h }); - return p.isString(b) && b ? Promise.reject(b) : p.isBoolean(b) && !b ? Promise.reject(n) : Promise.resolve(); - } })); - } - c(m); - }, [e, t, a, n, r, s, i]), d; -}, mn = (e, t, a) => { - const [n, r] = P(null); - return $(() => { - const { initDataUri: s = `/api/${e}`, initDataMethod: i = "GET" } = a || {}; - t && R.request({ method: i, url: p.trimEnd(`${s}/${t}`, "/") }).then((o) => { - r(o); - }); - }, [e, t, a]), n; -}, hn = (e, t, a, n = {}) => { - const r = St(), s = q(!0), i = q([]), [o, l] = P(a), d = X.useWatch((c) => JSON.stringify(p.pick(c, i.current)), t) || "{}"; - return $(() => { - e && Ce.exec(e, n, { getFieldValue: p.wrap(t.getFieldValue, (c, m) => (i.current.some((h) => p.isEqual(h, m)) || (i.current.push(m), r()), c(m))), isFieldTouched: t.isFieldTouched, isFieldsTouched: t.isFieldsTouched }).then((c) => s.current && l(c)); - }, [e, d, t, n]), $(() => () => s.current = !1, []), o; -}, ur = ({ value: e, onChange: t }, a = null) => { - const n = q(), [r] = X.useForm(a); - return xt(() => { - p.isEqual(n.current, e) || r.setFieldsValue(e); - }, [e]), $(() => () => r.resetFields(), []), [Z(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: {} }, [r]), (s, i) => { - n.current = i, t(i); - }]; -}, fn = ({ type: e, initialValue: t, initialValueLanguage: a, onChange: n, form: r }) => { - const s = hn(a == "javascript" && t, r, a == "javascript" ? void 0 : t, {}); - return $(() => { - a == "javascript" ? n(Y(s, e)) : t && n(Y(t, e)); - }, [e, t, s]), null; -}, yn = ({ widget: e = "Input", widgetPrefix: t = "@pkg/ff/grid-layout-forms", widgetDecorator: a, subWidgets: n, basicForm: r, ...s }) => { - const i = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [o, l] = P(); - return $(() => { - i && Q.getWidgetComponent(i).then(({ defaultProps: d = {}, default: c }) => ({ default: da(c, d, r) })).catch((d) => ({ default: () => `${d}` })).then((d) => l(C.createElement(d.default, s))); - }, [i]), o && C.cloneElement(o, s); -}, da = (e, t = {}, a = null) => (n) => { - const { type: r, code: s, label: i, noStyle: o, placeholder: l, extras: d, validators: c, help: m, isVirtual: h, $isReserved: f, initialValue: y, initialValueLanguage: b, convertJs: w, convertJsSetting: v, widgetPerfix: j, boxStyle: z, widgetDecorator: I, subWidgets: L, ...E } = { ...t, ...n }, S = pn(c || {}, s, r), V = { label: i, noStyle: o, colon: !1, layout: "vertical" }, U = { placeholder: l, ...E }, D = ce((W) => W == null ? void 0 : Y(W, r), [r]); - return u(Jt, { name: s, rules: S, initialValue: D(y), normalize: D, children: (W, T, H) => { - var se; - return u(e, { type: r, rcform: H, itemProps: { validateStatus: T.errors.length > 0 ? "error" : "success", tooltip: m, help: T.errors.length > 0 ? T.errors.join("、") : null, required: ((se = S == null ? void 0 : S[0]) == null ? void 0 : se.required) || !1, ...V }, fieldProps: { ...U, ...W }, $setting: d || {} }); - } }); -}, Pt = ({ cols: e = 24, rowHeight: t = 16, itemMargin: a = [8, 16], containerPadding: n = [0, 0], fields: r = [], children: s, basicForm: i = null }) => { - const o = oa(r, da, "@pkg/ff/grid-layout-forms"); - return F("div", { className: "ff-grid-layout-form", style: { "--grid-layout-item-margin-x": `${(a == null ? void 0 : a[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(a == null ? void 0 : a[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: [o, s && C.cloneElement(s, { cols: e, rowHeight: t, itemMargin: a, containerPadding: n, fields: r })] }); -}; -Pt.propTypes = { fields: A.array }; -const wn = (zt = Pt, ({ code: e, layout: t, name: a, primaryKey: n = 0, style: r = {}, formProps: s = {}, form: i, isPreview: o = !1, className: l, onFinish: d, onValuesChange: c = () => { -}, ...m }) => { - const { align: h, autoComplete: f, resource: y, items: b, hides: w, rowHeight: v, marginX: j, marginY: z, cols: I, listenChangeFields: L, listenChangeFieldsFunc: E, pk: S, uuid: V } = gn(e), [U] = X.useForm(i), D = Z(() => [{ name: "__PK__", value: S }, { name: "__PROPS__", value: s }, { name: "__RESOURCE__", value: y }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: V }, { name: "__PRIMARY_KEY__", value: n }], [S, e, V, y, n, s]); - return F(X, { className: l, name: a || e, layout: t || h, fields: D, form: U, autoComplete: f, style: { ...r, position: "relative" }, onFinish: d, onValuesChange: (W, T) => (({ changedValues: H, allValues: se, listenChangeFields: at, listenChangeFieldsFunc: Be, onValuesChange: nt, code: Et }) => { - nt(H, se), Be && Array.isArray(at) && Ce.exec(Be, { changedValues: H, allValues: se }, { getFieldValue: U.getFieldValue, setFieldValue: U.setFieldValue, setFieldsValue: U.setFieldsValue, isFieldTouched: U.isFieldTouched, isFieldsTouched: U.isFieldsTouched }); - })({ changedValues: W, allValues: T, listenChangeFields: L, listenChangeFieldsFunc: E, onValuesChange: c, code: e }), children: [u(zt, { ...m, form: U, code: e, fields: b, cols: I, rowHeight: v, itemMargin: [j, z] }), w == null ? void 0 : w.map((W) => { - var T; - return u(Jt, { name: W.code, children: u(fn, { form: U, name: W.code, type: W.type, initialValue: W.initialValue, initialValueLanguage: (T = W.extras) == null ? void 0 : T.initialValueLanguage }) }, JSON.stringify(W.code)); - })] }, e); -}); -var zt; -const ua = ({ $setting: e, $close: t, extras: a, code: n, primaryKey: r, ...s }) => { - const [i] = X.useForm(), o = mn(n, r, e); - return $(() => { - o && i.setFieldsValue(o); - }, [o]), u(K, { actions: F(C.Fragment, { children: [u(x, { name: "保存", type: "primary", widget: () => { - const l = i.getFieldValue("__RESOURCE__"), { initDataUri: d = `/api/${n}` } = e || {}; - i.validateFields(!0).then((c) => l ? p.pick(c, [l]) : c).then((c) => R.post(r ? `${d}/${r}` : `${d}`, c).msg(t)).catch(() => _.error("请先完善表单信息", { duration: 2e3 })); - } }), u(x, { name: "取消", widget: () => t(!1) })] }), extras: a, children: u(wn, { form: i, code: n, primaryKey: r, ...s }) }); -}, Cn = (e, t, a, { isReplaceRouteHistory: n = !1 } = {}) => le.redirect(a, t, { replace: n }), bn = (e, t = {}, a, n = {}) => { - var s; - const r = (s = n.router) == null ? void 0 : s.reduce((i, [o, l, d]) => { - const c = p.get(t, ["router", o]); - if (!c && c !== 0 && l) throw `请传入 ${d}`; - return `${i}/${c}`; - }, `/api/${a}`); - return R.del(r, t.param).msg(); -}, Wt = (e, t, a, { status: { loading: n, disabled: r }, setStatus: s }) => { - const i = { loading: (o) => o === void 0 ? n : s((l) => ({ ...l, loading: o })), disabled: (o) => o === void 0 ? r : s((l) => ({ ...l, disabled: o })) }; - return p.isFunction(a) ? a.call(null, { ...t, ...i }) : p.isString(a) && a ? Ce.exec(a, t, i) : null; -}, Ut = (e, t, a, n, r) => p.isString(a) && a ? Q.getWidgetComponent(a).then(({ default: s }) => _.modal(s, { ...t, $setting: n }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r)).catch((s) => { - _.error(a, { content: s.toString() }); -}) : _.modal(a, { ...t, $setting: n }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r), kn = (e, t, a, n, r) => _.modal(ua, { ...t, $setting: n, code: a }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r), vn = (e, t, a, n, r) => _.modal(kt, { base62params: t, $setting: n, listCode: a }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r), Sn = ({ widget: e, widgetType: t, widgetData: a, widgetProps: n, widgetSetting: r, widgetContainerProps: s }, { onAfterClick: i, onBeforeClick: o }) => { - const l = Te(we), [d, c] = P({ leading: !0, trailing: !1 }), m = Z(() => { - switch (t) { - case "redirect": - return p.partialRight(Cn, e, r); - case "func": - return p.partialRight(Wt, (r == null ? void 0 : r.code) ?? e, { status: d, setStatus: c }); - case "fsdpf-component": - return p.partialRight(Ut, e, r, s); - case "grid-layout-form": - return p.partialRight(kn, e, r, s); - case "data-list": - return p.partialRight(vn, e, r, s); - case "destroy": - return p.partialRight(bn, e, r, s); - default: - if ($t(e) || C.isValidElement(e)) return p.partialRight(Ut, e, r, s); - if (p.isFunction(e)) return p.partialRight(Wt, (r == null ? void 0 : r.code) || e, { status: d, setStatus: c }); - } - return (...h) => console.error("useButton unknown widgetType", t, ...h); - }, [e, t]); - return [p.debounce((h) => (o == null || o(h), Promise.resolve(Yt(n, h, { list: l })).then((f) => m(h, { ...a, ...f })).then((f) => i == null ? void 0 : i(f)).catch(console.error)), 300, { leading: !0, trailing: !1 }), d]; -}, Dt = /* @__PURE__ */ new Set(), ft = (e = [], t = 0) => { - const a = e[t]; - if (a.length && !Dt.has(a)) { - const n = document.createElement("script"); - n.setAttribute("src", a), n.setAttribute("data-namespace", a), e.length > t + 1 && (n.onload = () => { - ft(e, t + 1); - }, n.onerror = () => { - ft(e, t + 1); - }), Dt.add(a), document.body.appendChild(n); - } -}, yt = ({ className: e, type: t, style: a = {}, ...n }) => u("span", { role: "img", className: O("ff-iconfont", e), style: a, ...n, children: u("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: u("use", { xlinkHref: `#${t}` }) }) }); -yt.propTypes = { className: A.string, type: A.string.isRequired, style: A.object }, yt.init = ft; -const De = (e) => function({ className: t, children: a, name: n, icon: r, type: s = "default", iconPosition: i = "start", noAuthType: o, onAfterClick: l, onBeforeClick: d, data: c, loading: m, disabled: h, tooltip: f, confirm: y, widget: b, widgetType: w, widgetData: v, widgetProps: j, widgetSetting: z, widgetContainerProps: I, ...L }) { - const E = Object.assign({ enabled: !0 }, y), S = { type: "primary", className: O("ff-button", t), iconPosition: i }; - s === "danger" ? S.danger = !0 : s === "default" && (S.type = s), e === "link" || e === "dashed" ? (S.type = e, s === "default" && (S.className = O(S.className, "ff-default"))) : e !== "circle" && e !== "round" || (S.shape = e), r && (S.icon = u(yt, { type: r })); - const [V, U] = P(!1), [D, { disabled: W, loading: T }] = Sn({ widget: b, widgetType: w, widgetData: v, widgetProps: j, widgetSetting: z, widgetContainerProps: I }, { onAfterClick: l, onBeforeClick: d }); - return u(Ra, { okText: "确定", cancelText: "取消", ...E || {}, disabled: W || h, open: V, onOpenChange: (H) => { - if (!H) return U(H); - E.enabled ? U(H) : D(c); - }, onConfirm: () => { - D(c); - }, onClick: (H) => { - H.stopPropagation(); - }, children: u(Fa, { ...f, title: V ? null : f == null ? void 0 : f.title, trigger: ["hover", "click"], children: u(lt, { loading: T || m, disabled: W || h, ...S, ...L, children: a || n }) }) }); -}, x = De("default"), xn = De("link"), Pn = De("circle"), Nn = De("round"), $n = De("dashed"), Bt = ({ data: e, widget: t, widgetType: a = "fsdpf-component", children: n, widgetData: r, widgetProps: s, widgetSetting: i, widgetContainerProps: o }) => { - const l = Te(we), [d, c] = P(!1), [m, h] = P("hover"), [f, y] = P({}), [b, w] = P(), { placement: v, align: j, arrow: z = { pointAtCenter: !0 }, getPopupContainer: I, ...L } = o || {}; - $(() => { - a == "grid-layout-form" ? w(C.createElement(ua, { ...r, $setting: i, code: t })) : a == "data-list" ? w(C.createElement(kt, { base62params: e, $setting: i, listCode: t })) : p.isString(t) ? Q.getWidgetComponent(t).then(({ default: V }) => { - w(C.createElement(V, { ...r, $setting: i })); - }).catch((V) => w(V.toString())) : $t(t) ? w(C.createElement(t, { ...r, $setting: i })) : C.isValidElement(t) && w(C.cloneElement(t, { ...r, $setting: i })); - }, [t, a, r]), $(() => { - Promise.resolve(Yt(s, e, { list: l })).then(y); - }, [s, e]); - const E = (V) => { - c(V), !V && h("hover"); - }, S = (V) => { - c(!0), h("click"); - }; - return u(Oa, { zIndex: 1080, placement: v, onPopupClick: S, onClick: S, open: d, align: j, arrow: z, trigger: m, getPopupContainer: I, content: u(En, { ...L, children: b && C.cloneElement(b, { ...f, $close: () => E(!1) }) }), children: n, onOpenChange: E }); -}, En = ({ title: e, className: t, children: a, width: n, height: r, ...s }) => { - const [i, o] = P({}), l = ce((m, h) => o((f) => ({ ...f, [m]: h })), []), d = ce((m) => o((h) => ({ ...h, [m]: void 0 })), []), c = e ? C.createElement("div", { className: "ff-popup-title" }, e) : i == null ? void 0 : i.title; - return u(We.Provider, { value: { ele: i, mount: l, unmount: d }, children: F("div", { className: O("ff-popup ff-popover", t), style: { width: n, height: r }, ...s, children: [F("div", { className: "ff-popup-header", children: [c, i == null ? void 0 : i["sub-title"]] }), a, F("div", { className: "ff-popup-footer", children: [i == null ? void 0 : i.extras, i == null ? void 0 : i.actions] })] }) }); -}; -Bt.propTypes = { widgetType: A.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }, x.propTypes = { type: A.oneOf(["primary", "default", "danger", ""]), name: A.string, icon: A.string, iconPosition: A.oneOf(["start", "end"]), data: A.any, widget: A.any, widgetType: A.oneOf(["destroy", "redirect", "func", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: A.object, widgetProps: A.object, widgetSetting: A.object, widgetContainerProps: A.object }, x.Link = xn, x.Link.defaultProps = x.defaultProps, x.Link.propTypes = x.propTypes, x.Circle = Pn, x.Circle.defaultProps = x.defaultProps, x.Circle.propTypes = x.propTypes, x.Round = Nn, x.Round.defaultProps = x.defaultProps, x.Round.propTypes = x.propTypes, x.Dashed = $n, x.Dashed.defaultProps = x.defaultProps, x.Dashed.propTypes = x.propTypes, x.Popover = Bt; -const Tn = ({ fields: e, formProps: t, $close: a }) => { - const [n] = X.useForm(), r = Z(() => [{ name: "__PROPS__", value: t }], [t]); - return u(K, { actions: F(C.Fragment, { children: [u(x, { name: "取消", widget: () => a(!1) }), u(x, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(a) })] }), children: u(X, { fields: r, form: n, className: "ff-modal-form", children: e == null ? void 0 : e.map(({ code: s, ...i }) => u(yn, { code: s, ...i }, s)) }) }); -}, Rn = ({ className: e, $close: t, children: a, title: n, subTitle: r, actions: s, extras: i, zIndex: o, ...l }) => F(Da, { ...l, prefixCls: "ff-drawer", className: O("ff-popup", e), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (d) => ({ motionAppear: !0, motionName: `panel-motion-${d}` }), children: [F("div", { className: "ff-popup-header", children: [u("button", { "aria-label": "Close", className: "ff-popup-close", onClick: l.onClose, children: u(bt, { type: "close" }) }), n, r] }), u("div", { className: "ff-popup-body", children: a }), F("div", { className: "ff-popup-footer", children: [i, s] })] }), Fn = ({ className: e, $close: t, $event: a, children: n, title: r, subTitle: s, actions: i, extras: o, zIndex: l, placement: d, ...c }) => { - const m = (a == null ? void 0 : a.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: a == null ? void 0 : a.pageX, y: a == null ? void 0 : a.pageY } }; - return u(Ba, { ...c, ...m, prefixCls: "ff-modal", modalRender: () => F("div", { className: O("ff-modal-content ff-popup", e), children: [F("div", { className: "ff-popup-header", children: [u("button", { "aria-label": "Close", className: "ff-popup-close", onClick: c.onClose, children: u(bt, { type: "close" }) }), r, s] }), u("div", { className: "ff-popup-body", children: n }), F("div", { className: "ff-popup-footer", children: [o, i] })] }) }); -}, ga = ({ placement: e, $close: t, $event: a, children: n, title: r, ...s }) => { - const [i, o] = P({}), [l, d] = P(!0), c = ce((y, b) => o((w) => ({ ...w, [y]: b })), []), m = ce((y) => o((b) => ({ ...b, [y]: void 0 })), []); - let h = { ...s, className: i.rootClassName, title: i.title || r && C.createElement("div", { className: O("ff-popup-title") }, r), subTitle: i["sub-title"], actions: i.actions, extras: i.extras, children: n, $close: t, $event: a, onClose: () => d(!1) }; - const f = () => { - t(!1); - }; - return u(We.Provider, { value: { ele: i, mount: c, unmount: m }, children: e && e !== "center" ? u(Rn, { ...h, placement: e, open: l, afterOpenChange: (y) => !y && f() }) : u(Fn, { ...h, visible: l, afterClose: f }) }); -}; -ga.propTypes = { placement: A.oneOf(["center", "left", "top", "right", "bottom"]) }; -const J = () => { - const [e, t] = Wa({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (s) => { - const { offsetHeight: i } = s; - return { height: i }; - }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, a] = C.useReducer((s) => s + 1, 0); - $(() => { - J.$onClick = n, J.$queue.forEach(([s, i, o], l, d) => { - r([i, o], ...s), delete d[l]; - }); - }, []); - const n = (s, i = {}, o = {}) => new Promise((l, d) => r([l, d], s, i, o)), r = ([s, i], o, l = {}, d = {}) => { - const c = J.$index++, m = (h) => ((f, y) => (J.$popups.delete(f), a(), y == null ? void 0 : y()))(c, () => s(h)); - if (o === Gt) return e.open({ ...d, key: c, content: C.createElement(o, { ...l, $close: () => e.close(c) }) }); - J.$popups.set(c, C.createElement(ga, { zIndex: c, maskClosable: !1, $event: l == null ? void 0 : l.$event, ...d, key: c, $close: m }, C.isValidElement(o) ? C.cloneElement(o, { ...l, $close: m }) : o != null && o.name || Lt.isForwardRef(o) || (o == null ? void 0 : o.$$typeof) === Lt.ForwardRef ? C.createElement(o, { ...l, $close: m }) : o)), a(); - }; - return F(C.Fragment, { children: [Array.from(J.$popups).map(([s, i]) => i), t] }); -}; -J.$popups = /* @__PURE__ */ new Map(), J.$index = 0, J.$queue = [], J.$onClick = (...e) => new Promise((t, a) => { - J.$queue.push([e, t, a]); -}); -const qt = (e, t, a = {}) => J.$onClick(e, t, a), it = (e, { showProgress: t, duration: a, ...n } = { duration: 1.5 }) => J.$onClick(Gt, { content: e, ...n }, { showProgress: t, duration: a }), _ = { modal: qt, confirm: (e, t = {}) => J.$onClick(qa, { content: e, ...t }, { placement: "center" }), form: (e, t = {}, a = {}) => qt(Tn, { formProps: a, fields: e }, { placement: "center", ...t }).then((n) => { - if (n === !1) throw !1; - return n; -}), notification: it, success: (e, t = { duration: 1.5 }) => it(e, { ...t, className: "ff-notification-success", icon: "check" }), error: (e, t = { duration: 1.5 }) => it(e, { ...t, className: "ff-notification-error", icon: "close" }) }; -Re.configure({ showSpinner: !1 }), Fe.interceptors.request.use((e) => { - e.headers.Platform = "web", e.headers.SaaS = window.localStorage.getItem("SaaS"); - const t = window.localStorage.getItem(_e); - return e.headers.Authorization = t ? `Bearer ${t} ` : void 0, Re.inc(), e; -}, (e) => (Re.done(), Promise.reject({ code: -1, msg: e }))), Fe.interceptors.response.use(({ data: e, headers: t }) => (Re.done(), { ...e, res: t == null ? void 0 : t.res }), function(e) { - return Re.done(), Promise.reject(e.message); -}), window.addEventListener("unhandledrejection", ct.onUnhandledRejection), ct.onMsg = (e, t) => _[[0, 1].includes(e) ? "success" : "error"](t).then(() => e === 20300 && le.redirect(Oe.get("Common.WEBSITE_LOGIN_PAGE"))); -const wt = { appUrl: "", init: (e, t, a) => { - wt.appUrl = a, Fe.defaults.baseURL = a, Fe.defaults.timeout = 15e3, Object.assign(wt, new ct(e, t, Fe)); -} }, R = wt; -class Nt extends Error { - constructor(t, a) { - super(a), Error.captureStackTrace && Error.captureStackTrace(this, Nt), !a instanceof Le && (this.name = `${t} Error Runtime`); - } -} -class Le extends Error { - constructor(t, ...a) { - super(...a), Error.captureStackTrace && Error.captureStackTrace(this, Le), this.name = `${t} Not Found`; - } -} -const ot = "mine", _e = "token"; -var ye, Ee; -const re = class re { - constructor() { - N(this, Ee, /* @__PURE__ */ new Map()); - k(this, "setVendor", (t, a) => g(this, Ee).set(t, new Kt(a, async (n, r) => { - var i, o; - if (!(n != null && n.default)) throw "@pkg not found"; - let s = () => r; - switch ("function") { - case typeof (s = (i = n.default) == null ? void 0 : i[`./${r}/index.jsx`]): - case typeof (s = (o = n.default) == null ? void 0 : o[`./${r}/index.js`]): - return s(); - } - throw new Le(r); - }))); - k(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 [, a] = t == null ? void 0 : t.split("@pkg/"); - if (!a) throw new Le(t); - try { - return g(this, Ee).has("pkg") ? await g(this, Ee).get("pkg").get(a) : await import(`${R.appUrl}/api/pkg-import/web?name=${t}`); - } catch (n) { - throw new Nt(t, n); - } - }); - k(this, "getRoutes", () => R.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: a, ...n }) => [a, { uuid: a, ...n }])).then((t) => new Map(t))); - k(this, "getMenus", () => R.get("/api/my-menu")); - k(this, "getConfigure", () => R.get("api/init-configure")); - k(this, "getWidgetOperationAuth", () => R.get("/api/init-widget-operation-auth").then((t) => t.reduce((a, { uuid: n, auth: r }) => [...a, [n, r]], []))); - k(this, "getPhoneNumber", (t) => R.get(`/api/user-wx-phone-number/${t}`)); - k(this, "getUserToken", () => { - const t = window.localStorage.getItem(_e); - if (!t) return ""; - const a = t.split("."); - if (!Array.isArray(a) || a.length !== 3) throw "登录令牌无效!"; - const { iat: n } = JSON.parse(window.atob(a[1])); - if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; - return t; - }); - k(this, "checkUserToken", () => { - try { - return !!this.getUserToken(); - } catch { - return !1; - } - }); - k(this, "getUserInfo", (t = !0) => { - var a; - try { - const n = this.getUserToken(); - if (!n) return Promise.resolve(null); - const { iat: r } = JSON.parse(window.atob((a = n == null ? void 0 : n.split(".")) == null ? void 0 : a[1])), { iat: s, ...i } = R.decode(window.localStorage.getItem(ot) || "", {}); - return s === r ? Promise.resolve(i) : R.get("/api/mine-info").then(({ User: o = null }) => (window.localStorage.setItem(ot, R.encode({ ...o, iat: r })), o)); - } catch (n) { - console.error(n), t && Popup.error("请登录").then(logout); - } - return Promise.resolve(null); - }); - k(this, "login", (t, a, n = {}) => R.post("/api/user-token", { username: t, passwd: Ua.hash(a), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(_e, r), r))); - k(this, "logout", () => { - window.localStorage.removeItem(ot), window.localStorage.removeItem(_e); - }); - if (g(re, ye)) return g(re, ye); - } -}; -ye = new WeakMap(), Ee = new WeakMap(), N(re, ye, null), k(re, "getInstance", () => (g(re, ye) || B(re, ye, new re()), g(re, ye))); -let Ct = re; -const Q = Ct.getInstance(), On = C.createContext({ user: {}, initUser: () => { -}, initUserComplete: !1 }), Ln = C.createContext({ set: () => { -}, get: () => { -}, assign: () => { -}, currentRoute: () => { -} }), $t = (e) => !!(e != null && e.name) && (e.prototype instanceof C.Component || /^[A-Z]/.test(e.name)), Vn = (e, t) => { - if (!e || typeof window > "u") return; - let a = document.querySelector(`style[ff-style-token="${t}"]`); - return a ? (a.innerHTML = e, e) : (a = document.createElement("style"), a.setAttribute("ff-style-token", t), a.setAttribute("type", "text/css"), a.innerHTML = e, document.head.appendChild(a), e); -}, An = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: On, AppGlobalParamsContext: Ln, cache: Kt, configure: Oe, default: Q, func: Ce, http: R, insertStyle: Vn, isReactComponent: $t, route: le }, Symbol.toStringTag, { value: "Module" })), jn = (e, t, a = "children") => { - if (p.isEmpty(e)) return {}; - const n = p.find(e, ["value", t]); - if (!p.isEmpty(n)) return n; - const r = e.length; - for (let s = 0; s < r; s++) { - const { [a]: i } = e[s], o = jn(i, t, a); - if (!p.isEmpty(o)) return o; - } - return {}; -}; -export { - _t as $, - _a as A, - St as B, - or as C, - Ye as D, - lr as E, - Ue as F, - sr as G, - an as H, - xt as I, - cr as J, - dr as K, - wn as L, - Pt as M, - yn as N, - ua as O, - gn as P, - pn as Q, - ea as R, - mn as S, - hn as T, - ur as U, - yt as V, - x as W, - Ha as X, - Sn as Y, - K as Z, - We as _, - ta as a, - J as a0, - _ as a1, - Zn as a2, - er as a3, - tr as a4, - Q as a5, - $t as a6, - Vn as a7, - R as a8, - Kt as a9, - Oe as aa, - Ce as ab, - le as ac, - On as ad, - Ln as ae, - jn as af, - sa as b, - la as c, - ir as d, - ia as e, - oa as f, - Yt as g, - Qa as h, - vt as i, - aa as j, - na as k, - ra as l, - kt as m, - we as n, - tn as o, - on as p, - Ga as q, - st as r, - Xa as s, - Y as t, - ar as u, - Ja as v, - nr as w, - rr as x, - gt as y, - Ka as z -}; diff --git a/dist/common/main-Bklk3nwG.js b/dist/common/main-Bklk3nwG.js new file mode 100644 index 0000000..43c17f8 --- /dev/null +++ b/dist/common/main-Bklk3nwG.js @@ -0,0 +1,979 @@ +var vn = Object.defineProperty; +var Rt = (e) => { + throw TypeError(e); +}; +var Sn = (e, t, n) => t in e ? vn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; +var k = (e, t, n) => Sn(e, typeof t != "symbol" ? t + "" : t, n), Ft = (e, t, n) => t.has(e) || Rt("Cannot " + n); +var p = (e, t, n) => (Ft(e, t, "read from private field"), n ? n.call(e) : t.get(e)), $ = (e, t, n) => t.has(e) ? Rt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), D = (e, t, n, a) => (Ft(e, t, "write to private field"), a ? a.call(e, n) : t.set(e, n), n); +var Ot = (e, t, n, a) => ({ + set _(r) { + D(e, t, r, n); + }, + get _() { + return p(e, t, a); + } +}); +import { jsx as u, jsxs as O } from "react/jsx-runtime"; +import C, { useEffect as T, useState as N, useCallback as ce, useMemo as Z, useRef as q, useContext as Ee, useId as Ge, useLayoutEffect as xn } from "react"; +import g from "lodash"; +import Ht from "immutability-helper"; +import L from "classnames"; +import { Form as Ke, Input as Pn, Button as lt, Breadcrumb as Nn, Tree as $n, Pagination as Tn, Table as En, Empty as Rn, Popconfirm as Fn, Tooltip as On, Popover as Ln } from "antd"; +import { useMergedState as Vn } from "rc-util"; +import X, { FieldContext as An, Field as Jt } from "rc-field-form"; +import { useParams as jn, generatePath as In, createBrowserRouter as Mn, useInRouterContext as zn, Navigate as Wn } from "react-router-dom"; +import S from "prop-types"; +import * as Lt from "react-is"; +import { useNotification as Bn } from "rc-notification"; +import { N as Re, a as Fe, T as ct, S as Un } from "./vender-DMK1apIA.js"; +import "rc-util/lib/hooks/useMergedState"; +import Dn from "rc-drawer"; +import qn from "rc-dialog"; +var xe, Ve, Pe, ie, be, ke; +class Kt { + constructor(t, n) { + $(this, xe, /* @__PURE__ */ new Map()); + $(this, Ve, !0); + $(this, Pe, []); + $(this, ie); + $(this, be, () => p(this, ie)); + $(this, ke, () => Promise.resolve()); + k(this, "get", (...t) => new Promise((n, a) => { + const r = JSON.stringify(t); + if (p(this, xe).has(r)) return n(p(this, ke).call(this, p(this, ie), ...t)); + if (p(this, ie) === void 0) p(this, Pe).push([t, n, a]), p(this, Ve) && (D(this, Ve, !1), Promise.resolve(typeof p(this, be) == "function" ? p(this, be).call(this) : p(this, be)).then((s) => D(this, ie, s || null)).finally(() => { + p(this, Pe).forEach(([s, i, o]) => { + try { + const l = p(this, ke).call(this, p(this, ie), ...s); + p(this, xe).set(JSON.stringify(s), l), i(l); + } catch (l) { + o(l); + } + }), p(this, Pe).length = 0; + })); + else { + const s = p(this, ke).call(this, p(this, ie), ...t); + p(this, xe).set(r, s), n(s); + } + })); + D(this, ke, n), D(this, be, t); + } +} +xe = new WeakMap(), Ve = new WeakMap(), Pe = new WeakMap(), ie = new WeakMap(), be = new WeakMap(), ke = new WeakMap(); +const Za = () => u("div", { children: "Empty" }), We = C.createContext({ ele: {}, mount: () => { +}, unmount: () => { +} }), K = ({ rootClassName: e, className: t, children: n, actions: a, title: r, subTitle: s, extras: i, style: o = {} }) => { + const { mount: l, unmount: d } = C.useContext(We); + return a && K.Action({ children: a }), r && K.Title({ children: r }), s && K.SubTitle({ children: s }), i && K.Extra({ children: i }), T(() => (l("rootClassName", e), () => d(e)), [e]), u("div", { className: L("ff-container", t), style: o, children: n }); +}, Je = (e) => ({ children: t, className: n }) => { + const { mount: a, unmount: r } = C.useContext(We); + return T(() => (a(e, C.createElement("div", { key: `ff-${e}`, className: L(`ff-popup-${e}`, n) }, t)), () => r(e)), [n, t]), null; +}; +K.Action = Je("actions"), K.Title = Je("title"), K.SubTitle = Je("sub-title"), K.Extra = Je("extras"), K.propTypes = { className: S.string, style: S.object, title: S.any, subTitle: S.any, actions: S.any, extras: S.any }; +const er = () => u(K, { className: "ff-loading", children: O("div", { className: "loader", children: [O("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] }), O("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] }), O("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] }), O("div", { className: "square", children: [u("span", {}), u("span", {}), u("span", {})] })] }) }), tr = () => u("div", { children: "NotFound" }), _t = ({ children: e }) => { + const [t, n] = N({}), a = ce((s, i) => n((o) => ({ ...o, [s]: i })), []), r = ce((s) => n((i) => ({ ...i, [s]: void 0 })), []); + return typeof (e == null ? void 0 : e.type) == "string" ? e : u(We.Provider, { value: { ele: t, mount: a, unmount: r }, children: C.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) }); +}; +_t.propTypes = { children: S.element.isRequired }; +const Vt = { 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"] }, bt = ({ type: e, props: t }) => u("i", { ...t, children: u("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Vt[e] || Vt.info).map((n, a) => u("path", { d: n }, a)) }) }), Gt = ({ className: e, content: t, icon: n, $close: a }) => O(C.Fragment, { children: [n && u("div", { className: L("ff-notification-icon", e), children: u(bt, { type: n }) }), t] }), Hn = ({}) => u(K, { children: "Confirm" }); +var de, Ne; +const ee = class ee { + constructor() { + $(this, Ne, /* @__PURE__ */ new Map()); + k(this, "init", (t) => D(this, Ne, new Map(t))); + k(this, "check", (t) => !p(this, Ne).has(t) || p(this, Ne).get(t)); + if (p(ee, de)) return p(ee, de); + } +}; +de = new WeakMap(), Ne = new WeakMap(), $(ee, de, null), k(ee, "getInstance", () => (p(ee, de) || D(ee, de, new ee()), p(ee, de))); +let dt = ee; +const Jn = dt.getInstance(); +var ue, Ae; +const te = class te { + constructor() { + $(this, Ae, null); + k(this, "init", (t) => D(this, Ae, t)); + k(this, "get", (t, n) => g.get(p(this, Ae), t, n)); + if (p(te, ue)) return p(te, ue); + } +}; +ue = new WeakMap(), Ae = new WeakMap(), $(te, ue, null), k(te, "getInstance", () => (p(te, ue) || D(te, ue, new te()), p(te, ue))); +let ut = te; +const Oe = ut.getInstance(), At = { 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" }, Y = (e, t) => { + let n = "string"; + n = Array.isArray(e) ? "array" : typeof e, g.isObject(e) && (n = "json"); + const a = `${n}2${t}`; + return Reflect.has(At, a) ? At[a](e) : e; +}, Yt = (e = {}, t = {}, n = {}, a = "") => Xt(e, (r, s) => s === "type" && r === "code") ? Qt(e, t, n, a) : Zt(e, t, a), Xt = (e, t = () => !1) => g.some(e, (n) => !!g.some(n, t) || (g.isEmpty(n) || !g.isPlainObject(n) && !g.isArray(n) ? void 0 : Xt(n, t))), Qt = async (e = {}, t = {}, n = {}, a = "") => { + let r = /* @__PURE__ */ Object.create(null); + for (let s in e) { + let i; + if (Reflect.has(e[s], "type") && ["code", "field", "router", "query", "string"].includes(e[s].type)) { + const { type: o, value: l = "", default: d = a } = e[s]; + switch (o) { + case "code": + i = await Ce.exec(l, t, n); + break; + case "field": + i = g.get(t, l) ?? g.get(t, l.substring(l.indexOf(".") + 1)); + break; + case "router": + case "query": + i = le.getPageParams(l); + break; + case "string": + i = l; + } + i ?? (i = d); + } else i = await Qt(e[s], t, n, a); + g.set(r, s, i); + } + return r; +}, Zt = (e = {}, t = {}, n = "") => Object.keys(e || {}).reduce((a, r) => { + if (g.isPlainObject(e[r])) { + let s; + if (Reflect.has(e[r], "type") && ["field", "router", "query", "string"].includes(e[r].type)) { + const { type: i, value: o = "", default: l = n } = e[r]; + switch (i) { + case "field": + s = g.get(t, o) ?? g.get(t, o.substring(o.indexOf(".") + 1)); + break; + case "router": + case "query": + s = le.getPageParams(o); + break; + case "string": + s = o; + } + s ?? (s = l); + } else s = Zt(e[r], t, n); + g.set(a, r, s); + } + return a; +}, {}), st = (e, t) => e && typeof e == "object" ? Array.isArray(e) ? e.map((n) => st(n, t)) : Object.keys(e).reduce((n, a) => (t[a] ? n[t[a]] = st(e[a], t) : n[a] = st(e[a], t), n), {}) : e, nr = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => { + const t = 16 * Math.random() | 0; + return (e === "x" ? t : 3 & t | 8).toString(16); +}); +var Xe, je, Ie, Qe; +const Ze = class Ze { + constructor(...t) { + $(this, je, []); + $(this, Ie, (t) => { + var n; + for (let a of t) Array.isArray(a[0]) ? p(this, Ie).call(this, a) : p(this, je).push(p(n = Ze, Xe).call(n, a[0], a[1])); + }); + k(this, "toValue", async (t, n = null) => { + const a = { getValue: () => t, getRecord: () => n }; + return await p(this, je).reduce(async (r, s) => { + try { + const i = await r; + return (await s).call(a, i); + } catch (i) { + return console.error(i), r; + } + }, t); + }); + k(this, "toRender", (t, n, a = null) => C.createElement(p(this, Qe), { value: t, record: n }, a)); + $(this, Qe, ({ value: t, record: n, children: a }) => { + const [r, s] = N(a); + return xt(() => { + let i = !1; + return s(a), this.toValue(t, n).then((o) => Y(o, "string")).then((o) => !i && s(o)).catch((o) => !i && s(`${o}`)), () => i = !0; + }, [t, n]), r; + }); + p(this, Ie).call(this, t); + } +}; +Xe = new WeakMap(), je = new WeakMap(), Ie = new WeakMap(), Qe = new WeakMap(), $(Ze, Xe, g.memoize((t, n) => Q.getWidgetComponent(t).then((a) => { + var r; + return ((r = a.default) == null ? void 0 : r.call(a, n)) || ((s) => s); +}), (t, n) => `${t}::${Y(n, "string")}`)); +let Ye = Ze; +const Kn = (e, t = {}) => Z(() => e == null ? void 0 : e.map(({ widgetByJs: n, widgetByJsSetting: a, ...r }, s) => n ? { ...r, render: (i, o) => new Ye([n, a]).toRender(i, o, "-") } : r), [e, t]), ar = (e) => { + const [t, n] = N({}); + return T(() => { + let a = !1; + return e && F.get(`/api/_/${e}`).then((r) => g.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig"])).then((r) => !a && n(r)), () => a = !0; + }, [e]), t; +}, rr = (e, t = {}) => { + const [n, a] = N({ dataSource: [] }); + return Be(() => { + let r = !1; + return e && F.get(`/api/${e}/${F.encode({ page: 1, ...t })}`).then((s) => !r && a(s)), () => r = !0; + }, [e, t]), n; +}, gt = (e, t = null, n = null, a = "id") => Z(() => { + if (g.isEmpty(e) || !e.some(({ uuid: s }) => Jn.check(s))) return !1; + if (g.isEmpty(n) || g.isEmpty(t)) return !0; + const r = t.map((s) => `${s == null ? void 0 : s[a]}`); + return e.some(({ uuid: s }) => !s || !n.has(s) || n.get(s).some((i) => r.includes(`${i}`))); +}, [e, t, n, a]), _n = (e, t, n = "id", a = null) => { + const r = St(), s = q(!1), i = q(e.dataSource), o = q(e.itemOperationsAccess); + return T(() => (i.current = e.dataSource, o.current = e.itemOperationsAccess, () => s.current = !1), [e.dataSource, e.itemOperationsAccess]), s.current && (e.dataSource = i.current, e.itemOperationsAccess = o.current), [e, (l = 0, d = null) => { + var c, m; + if (s.current = !1, l === 1) return (c = e.onReload) == null ? void 0 : c.call(e); + if (l === 2) { + const h = g.get(d, "__PARENT_ID__", ""), f = g.get(d, n, g.get(d, [a, n], "")), y = g.findIndex(i.current, ["__PARENT_ID__", h]), b = g.findIndex(y > -1 ? g.get(i.current, [y, "children"]) : i.current, [n, f]); + if (b === -1) return (m = e.onReload) == null ? void 0 : m.call(e); + Promise.all([F.get(`/api/${t}/detail/${f}`), F.post(`/api/${t}/list-operations-access`, { ids: f })]).then(([w, v]) => { + const j = g.get(i.current, y > -1 ? [y, "children", b, "children"] : [b, "children"]); + i.current = Ht(i.current, y > -1 ? { [y]: { children: { $splice: [[b, 1, { ...w, children: j }]] } } } : { $splice: [[b, 1, { ...w, children: j }]] }); + const z = new Map(v); + o.current.forEach((I, V) => { + var E; + (E = z.get(V)) != null && E.some((x) => x == f) || o.current.set(V, I.filter((x) => x !== f)); + }), z.forEach((I, V) => { + o.current.has(V) ? o.current.set(V, g.uniq([...o.current.get(V) || [], ...I])) : o.current.set(V, I); + }); + }).then(() => { + s.current = !0, r(); + }); + } + }]; +}, Gn = (e, t) => { + const n = St(), a = q(t), r = q(/* @__PURE__ */ new Map()), s = q([]), i = g.throttle((l) => { + s.current = [], F.list(e, g.pick({ ...a.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: d, condition: c, total: m, tab: h, sider: f, page: y, pageSize: b, operationsAccess: w, dataSource: v }) => { + a.current = { tab: h, condition: c, sider: f, keyword: d, total: m, pageSize: b, page: v != null && v.length ? y : 1 }, s.current = v, r.current = new Map(w), n(); + }); + }, 380, { leading: !1, trailing: !0 }); + xt(() => { + s.current = [], e && i(t); + }, [e, t]); + const o = Z(() => g.pick(a.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [a.current]); + return Object.assign(o, { onTabChange: (l) => i({ tab: l, page: 1 }), onPageChange: (l, d) => i({ page: l, pageSize: d }), onPageSizeChange: (l) => i({ pageSize: l, page: 1 }), onConditionChange: (l, d) => i({ keyword: d, condition: Ht(a.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => i({ sider: l, page: 1 }), onKeywordChange: (l) => i({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: s.current, onReload: i }); +}, Yn = ({ className: e, itemClassName: t, classNames: n = {}, dataSource: a, isPaginate: r, isItemOperations: s, isBatchOperations: i, batchOperations: o, itemOperations: l, itemOperationsAccess: d, resource: c, primaryKey: m, title: h, itemGridLayout: f, $setting: y, tabs: b, isConditionFormLayout: w, isTreeSider: v, treeSiderConfig: j }) => { + const { getBase62params: z, onClickCallback: I } = Ee(we), { total: V, page: E, pageSize: x } = (z == null ? void 0 : z()) || {}, A = ce((B, U, W) => u(Xn, { className: L("ff-data-list-framework-item", t), operations: s && U ? l == null ? void 0 : l.filter((R) => !(m && R.uuid && d.has(R.uuid)) || d.get(R.uuid).includes(U == null ? void 0 : U[m])) : [], data: c ? { [c]: U } : U, children: B, onClickCallback: I }), [c, m, s, I, l, d]); + return O("div", { className: L("ff-data-list-framework", e), children: [u(an, { className: n == null ? void 0 : n.sider, isTreeSider: v, ...j }), O("div", { className: L("ff-data-list-container", n == null ? void 0 : n.container), children: [u(vt, { className: n == null ? void 0 : n.filter, isConditionFormLayout: w }), u(nn, { title: h, className: n == null ? void 0 : n.toolbar, tabs: b }), u(oa, { ...f, className: n == null ? void 0 : n.content, style: { "--col-num": (y == null ? void 0 : y.colNum) || 1 }, primaryKey: m, itemRender: A, dataSource: a }), u(rn, { className: n == null ? void 0 : n.footer, isPaginate: r, isOperations: i, operations: o, total: V, page: E, pageSize: x })] })] }); +}, Xn = ({ className: e, operations: t, children: n, data: a, onClickCallback: r }) => O("div", { className: L("data-list-grid-layout-item-container", e), children: [n, !!(t != null && t.length) && u("div", { className: "data-list-grid-layout-item-actions", children: t.map((s) => u("span", { className: "data-list-grid-layout-item-action", children: u(P.Link, { uuid: s.uuid, type: s.type, name: s.name, widget: s.widget, widgetType: s.widgetType, widgetProps: s.widgetProps, widgetSetting: s.widgetSetting, widgetContainerProps: s.widgetContainerSetting, data: a, confirm: s.confirm, onAfterClick: (i) => i !== !1 && (r == null ? void 0 : r(s.isRefresh, a)) }, s.uuid || Ge()) }, (s == null ? void 0 : s.uuid) || Ge())) })] }), Qn = ({ listCode: e, className: t, classNames: n = {}, itemClassName: a, dataSource: r, columns: s, isItemOperations: i, isBatchOperations: o, batchOperations: l, itemOperations: d, itemOperationsAccess: c, resource: m, primaryKey: h, title: f, tabs: y, isPaginate: b, isTreeSider: w, treeSiderConfig: v, isConditionFormLayout: j, ...z }) => { + const { getBase62params: I, onClickCallback: V } = Ee(we), { total: E, page: x, pageSize: A } = (I == null ? void 0 : I()) || {}, B = gt(d, r, c, h); + return O("div", { className: L("ff-data-table-framework", t), children: [u(an, { className: n == null ? void 0 : n.sider, isTreeSider: w, ...v }), O("div", { className: L("ff-data-table-container", n == null ? void 0 : n.container), children: [u(vt, { listCode: e, isConditionFormLayout: j }), u(nn, { title: f, className: n == null ? void 0 : n.toolbar, tabs: y }), u(na, { ...z, primaryKey: h, className: "ff-data-table-content", columns: s, dataSource: r, operationRender: B ? (U) => u("div", { className: "ff-data-table-actions", children: d == null ? void 0 : d.reduce((W, R, H) => [...W, u(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: U, confirm: R.confirm, onAfterClick: (se) => se !== !1 && (V == null ? void 0 : V(R.isRefresh, U)) }, R.uuid || H)], []) }) : null }), u(rn, { isPaginate: b, isOperations: o, operations: l, total: E, page: x, pageSize: A })] })] }); +}, we = C.createContext({ listCode: "", getBase62params: (e, t) => { +}, onReload: () => { +}, onClickCallback: () => { +}, onConditionChange: () => { +}, onTabChange: () => { +}, onSiderChange: () => { +}, onKeywordChange: () => { +}, onPageChange: () => { +}, onPageSizeChange: () => { +} }), Zn = ({ isItemGridLayout: e, theme: t, themeProps: n, onClickCallback: a, onReload: r, listCode: s, total: i = 0, page: o = 0, onPageChange: l, pageSize: d = 30, onPageSizeChange: c, tab: m, onTabChange: h, keyword: f, onKeywordChange: y, condition: b, onConditionChange: w, sider: v, onSiderChange: j, ...z }) => { + const [I, V] = N(); + return T(() => { + t ? Q.getWidgetComponent(t).then((E) => { + if (!E) throw `${t} not found`; + return E; + }).catch((E) => ({ default: () => `${E}` })).then((E) => V(C.createElement(E.default, { ...z, $setting: n }))) : V(u(e ? Yn : Qn, { ...z, $setting: n })); + }, [t, n]), u(we.Provider, { value: { listCode: s, onClickCallback: a, onReload: r, getBase62params: (E, x) => { + const A = { tab: m, page: o, pageSize: d, keyword: f, sider: v, condition: b, total: i }; + return E && E != "init" ? A[E] ?? x : A; + }, onPageChange: l, onPageSizeChange: c, onTabChange: h, onSiderChange: j, onKeywordChange: y, onConditionChange: w }, children: I && C.cloneElement(I, z) }); +}; +var ge, oe, ve, et; +const ne = class ne { + constructor() { + $(this, oe, null); + $(this, ve, /* @__PURE__ */ new Map()); + $(this, et, () => { + if (p(this, oe)) return p(this, oe).port.postMessage({ command: "status", data: [] }); + D(this, oe, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), p(this, oe).port.onmessage = (t) => { + var n, a; + (n = t.data) != null && n.uuid ? p(this, ve).forEach((r, s) => { + var i; + (r == "*" || (i = r == null ? void 0 : r.includes) != null && i.call(r, t.data.uuid)) && s(t.data); + }) : ((a = t.data) == null ? void 0 : a.readyState) == WebSocket.CLOSED && F.get("/api/user-api-token").then(({ token: r, expire_at: s }) => { + p(this, oe).port.postMessage({ command: "initWs", data: [`ws${g.trimStart(F.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); + }); + }, p(this, oe).port.postMessage({ command: "status", data: [] }); + }); + k(this, "subscribe", (t, n = []) => (n ? Array.isArray(n) && n.length == 0 ? n = "*" : Array.isArray(n) || (n = [n].flat()) : n = "*", p(this, ve).set(t, n), p(this, ve).size == 1 && p(this, et).call(this), () => this.unsubscribe(t))); + k(this, "unsubscribe", (t) => p(this, ve).delete(t)); + if (p(ne, ge)) return p(ne, ge); + } +}; +ge = new WeakMap(), oe = new WeakMap(), ve = new WeakMap(), et = new WeakMap(), $(ne, ge, null), k(ne, "getInstance", () => (p(ne, ge) || D(ne, ge, new ne()), p(ne, ge))); +let pt = ne; +const en = pt.getInstance(), kt = C.forwardRef(({ listCode: e, base62params: t, className: n, itemClassName: a, theme: r, themeProps: s, classNames: i }, o) => { + const [{ resource: l, primaryKey: d, batchOperations: c = [], itemOperations: m = [], columns: h = [], themeConfig: f, theme: y, isConditionFormLayout: b = !1, isTreeSider: w, treeSiderConfig: v, isItemGridLayout: j, itemGridLayout: z, title: I, isPaginate: V, tabs: E }, x] = N({ isItemGridLayout: !1, itemGridLayout: {} }), A = Gn(e, t), [{ dataSource: B, itemOperationsAccess: U, condition: W, tab: R, keyword: H, page: se, total: nt, pageSize: De, sider: at, onConditionChange: Tt, onTabChange: mn, onKeywordChange: hn, onPageChange: fn, onPageSizeChange: yn, onSiderChange: wn, onReload: rt }, Et] = _n(A, e, d, l), Cn = gt(m, B, U, d), bn = gt(c); + return T(() => { + let qe = null; + return e && F.get(`/api/_/${e}`).resp(({ data: He, res: kn }) => { + He != null && He.isDynamicRefresh && (qe = en.subscribe(() => rt(), kn)), x(He); + }).catch(() => x({})), () => qe == null ? void 0 : qe(); + }, [e]), C.useImperativeHandle(o, () => ({ onReload: rt, onClickCallback: Et })), u(Zn, { listCode: e, title: I, itemClassName: a, classNames: i, resource: l, primaryKey: d, theme: r || y, themeProps: s || f, isTreeSider: w, treeSiderConfig: v, isPaginate: V, tabs: E, isItemOperations: Cn, isBatchOperations: bn, batchOperations: c, itemOperations: m, isItemGridLayout: j, columns: h, itemGridLayout: z, isConditionFormLayout: b, itemOperationsAccess: U, dataSource: B, onConditionChange: Tt, onTabChange: mn, onKeywordChange: hn, onPageChange: fn, onPageSizeChange: yn, onSiderChange: wn, condition: W, tab: R, keyword: H, page: se, total: nt, pageSize: De, sider: at, className: L("ff-data-list-helper", n), onReload: rt, onClickCallback: Et }); +}), tn = (e, t, n, a, r = {}, s = 0) => { + const i = { "--grid-layout-h": `${a}`, "--grid-layout-w": `${n}`, "--grid-layout-x": `${e}`, "--grid-layout-y": `${t}`, "--grid-layout-row-height-offset": "0px" }; + return r != null && r.autoHeight ? i.height = "fit-content" : i["--grid-layout-row"] = `${a}`, r != null && r.alignItems && (i["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (i["--grid-layout-box-justify-content"] = r.justifyContent), i["--grid-layout-box-margin"] = jt(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), i["--grid-layout-box-padding"] = jt(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), s && (i.height = `${s}px`), i; +}, jt = (e, t, n, a) => `${e || 0}px ${t || 0}px ${n || 0}px ${a || 0}px`, vt = ({ className: e, isConditionFormLayout: t }) => { + var m, h; + const [n, a] = N({}), { listCode: r, onKeywordChange: s, onConditionChange: i, getBase62params: o } = C.useContext(we), { keyword: l, condition: d } = (o == null ? void 0 : o()) || {}, [c] = Ke.useForm(); + return T(() => { + r && t && F.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: b, rowHeight: w, cols: v, fields: j }) => { + a({ resource: f, itemMargin: [y, b], rowHeight: w, cols: v, fields: j }); + }).catch(() => a({})); + }, [r, t]), T(() => { + c.setFieldsValue({ keyword: l, ...d }); + }, [JSON.stringify([l, d])]), u("div", { className: L("ff-data-list-filter", e), children: u(Ke, { form: c, layout: "vertical", autoComplete: "off", onFinish: ((m = n.fields) == null ? void 0 : m.length) > 1 ? (f) => i({ [n.resource]: f[n.resource] }, f.keyword) : () => { + }, onValuesChange: (f) => { + g.isEmpty(g.omit(f, ["keyword"])) || c.submit(); + }, children: ((h = n.fields) == null ? void 0 : h.length) > 1 ? u(Pt, { ...n, children: u(ea, { onReset: () => { + const { keyword: f, condition: y } = o("init") || {}; + c.setFieldsValue({ keyword: f, ...y }); + } }) }) : u("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: u("div", { className: "grid-layout-item", style: tn(20, 0, 5, 2), children: u(Ke.Item, { name: ["keyword"], children: u(Pn.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => s(f) }) }) }) }) }) }); +}, ea = ({ cols: e, fields: t, onReset: n }) => { + const [a, r] = N(!1), s = Z(() => t == null ? void 0 : t.toReversed().some((i) => i.y > 1 || i.x + i.w >= e - 5), [e, t]); + return O(Ke.Item, { label: " ", style: { "--item-span": 5 }, className: L("ff-data-list-filter-actions", { expanded: a }), children: [u(lt, { onClick: n, children: "重置" }), u(lt, { type: "primary", htmlType: "submit", children: "查询" }), s && u(P.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((i) => !i), type: "primary", name: a ? "关闭" : "展开", icon: a ? "icon-up" : "icon-down", iconPosition: "end" })] }); +}; +vt.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 nn = ({ className: e, title: t, tabs: n }) => { + const { getBase62params: a, onTabChange: r, onReload: s } = Ee(we), { tab: i } = (a == null ? void 0 : a()) || {}, [o, l] = Vn((n == null ? void 0 : n[0].value) ?? (n == null ? void 0 : n[0].code), { value: i, onChange: r }); + return O("div", { className: L("ff-data-list-toolbar", e), children: [u("div", { className: "ff-data-list-title", children: t }), u(Nn, { className: "ff-data-list-tabs", itemRender: ({ label: d, code: c, value: m }) => u("span", { onClick: () => l(m ?? c), className: L("ff-data-list-tab", { active: (m ?? c) == o }), children: d }), items: n }), O("div", { className: "ff-data-list-actions", children: [u(P.Link, { icon: "icon-reload", widget: () => s() }), u(P.Link, { icon: "icon-setting" })] })] }); +}, ta = [{ 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: u("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], an = ({ className: e, width: t = 280, isTreeSider: n }) => n ? u($n.DirectoryTree, { className: L("ff-data-list-sider", e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: ta }) : null, rn = ({ className: e, operations: t, isOperations: n, isPaginate: a, total: r, page: s, pageSize: i }) => { + const { onPageChange: o, onPageSizeChange: l, onClickCallback: d } = C.useContext(we); + return n && !g.isEmpty(t) || a ? O("div", { className: L("ff-data-list-footer", e), children: [u("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((c, m) => u(P, { 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, onAfterClick: (h) => h !== !1 && (d == null ? void 0 : d(c.isRefresh, null)) }, c.uuid || m)) }), a && u(Tn, { size: "small", total: r, pageSize: i, showSizeChanger: !1, showTotal: (c) => `第 ${s} 页 / 总共 ${c} 条`, onChange: o, onShowSizeChange: l })] }) : null; +}, sn = (e, t, n = !0) => n !== !0 && n-- <= 0 ? [] : g.isArray(e) && !g.isEmpty(e) ? e.reduce((a, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && a.push(r[t]), Reflect.has(r, "children") && !g.isEmpty(r.children) ? a.concat(sn(r.children, t, n)) : a), []) : [], na = ({ className: e, primaryKey: t, columns: n = [], dataSource: a = [], operationRender: r, operationWidth: s = 180, ...i }) => { + Ge(); + const o = q(null), l = q(null), [d, c] = N([]), [m, h] = N({ width: 0, height: 0 }); + T(() => { + c(sn(a, t)); + }, [a, t]), xn(() => { + const y = new ResizeObserver(() => { + var b; + h({ width: ((b = o.current) == null ? void 0 : b.nativeElement.querySelector(".ant-table-body").scrollWidth) || l.current.offsetWidth, height: l.current.offsetHeight }); + }); + return l.current && y.observe(l.current), () => { + l.current && y.unobserve(l.current); + }; + }, []); + const f = Kn(n); + return u("div", { ref: l, className: L("ff-data-list-table", e), children: m.height ? u(En, { ...i, ref: o, rowKey: (y) => (y == null ? void 0 : y[t]) ?? Math.random(), columns: f == null ? void 0 : f.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(s / m.width * 100).toFixed(2)}%`, render: (y, b, w) => r(b, w) }] : []), dataSource: a, size: "middle", scroll: { x: "max-content", y: m.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: c, expandedRowKeys: d } }) : null }); +}, aa = "RC_FORM_INTERNAL_HOOKS", on = (e, { initialValue: t, initialValueLanguage: n, convertJs: a, convertJsSetting: r, type: s = "string" }, i = null) => { + const o = q(!1), l = Ee(An), [d, c] = N(), [m, h] = N(n != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: f } = l.getInternalHooks(aa) || {}; + return T(() => f == null ? void 0 : f((y, b, w) => { + if (!o.current) return; + const v = g.get(b, e); + g.isEqual(v, m) || h(Y(v, s)); + }), [m]), T(() => { + n == "javascript" && t ? Ce.exec(t, {}, { getFieldValueForBasicForm: (y) => i ? i.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => h(Y(y, s))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => o.current = !0) : (t && h(Y(t ?? l.getFieldValue(e), s)), o.current = !0); + }, [t, n]), Be(() => { + o.current && a && new Ye([a, r]).toValue(m, l.getFieldsValue(!0)).then(c).catch((y) => { + c(y), console.error("布局数据转换错误: ", y, a); + }); + }, [m, a, r]), [d ?? m, m]; +}, ln = (e, t, n = "@pkg/ff/grid-layouts", a = null) => Z(() => { + var r; + return (r = g.sortBy(e, ["y", "x"])) == null ? void 0 : r.map(({ i: s, x: i, y: o, w: l, h: d, field: { boxStyle: c, widgetPrefix: m = n, widget: h, ...f } }, y) => u("div", { className: "grid-layout-item", style: tn(i, o, l, d, c, h === "Height" && (f == null ? void 0 : f.initialValue)), children: u(ra, { ...f, basicForm: a, itemWidget: h != null && h.startsWith("@") || h != null && h.startsWith("blob:") ? h : `${m}/${h}`, itemWidgetRender: t }) }, s || y)); +}, [e]), ra = ({ itemWidget: e, itemWidgetRender: t, basicForm: n, ...a }) => { + const [r, s] = N(); + return T(() => { + Q.getWidgetComponent(e).then(({ defaultProps: i = {}, default: o }) => { + s(C.createElement(t(o, i, n), a)); + }).catch((i) => { + console.error(i), s(e); + }); + }, [e]), r; +}, cn = ({ cols: e = 12, rowHeight: t = 21, fields: n = [], data: a, containerPadding: r = [0, 0], itemMargin: s = [4, 0], formProps: i = {}, className: o, ...l }) => { + const [d] = X.useForm(), c = ln(n, sa, "@pkg/ff/grid-layouts"), m = Z(() => [{ name: "__PROPS__", value: i }], [i]); + return Be(() => (d.setFieldsValue(a), () => d.resetFields()), [a]), u(X, { fields: m, form: d, component: !1, children: u("div", { ...l, className: L("ff-grid-layout", o), style: { "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-container-padding-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-container-padding-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: c }) }); +}, sa = (e, t = {}, n = null) => (a) => { + const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, ...h } = g.merge({}, t, a), [f, y] = on(o ? null : r, { initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, type: (h == null ? void 0 : h.type) || "string" }, n); + return u(e, { ...h, value: f, rawValue: y, $setting: i || {} }); +}, sr = (It = cn, function({ code: e, data: t, ...n }) { + const [a, r] = N({ resource: null, cols: 12, rowHeight: 21, fields: [] }); + return T(() => { + e && F.get(`/api/_/${e}`).then((s) => r(g.pick(s, ["resource", "cols", "rowHeight", "fields"]))); + }, [e]), (a == null ? void 0 : a.resource) && u(It, { ...n, rowHeight: a.rowHeight, cols: a.cols, fields: a.fields, data: a != null && a.resource ? { [a == null ? void 0 : a.resource]: t } : {} }); +}); +var It; +const ir = ({ widget: e, widgetPrefix: t = "@pkg/ff/grid-layouts", basicForm: n, ...a }) => { + const r = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [s, i] = N(); + return T(() => { + r && Q.getWidgetComponent(r).then(({ defaultProps: o = {}, default: l }) => ({ default: ia(l, o, n) })).catch((o) => ({ default: () => `${o}` })).then((o) => i(C.createElement(o.default, a))); + }, [r]), s; +}, ia = (e, t = {}, n = null) => (a) => { + const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, value: h, ...f } = g.merge({}, t, a), [y, b] = on(o ? null : r, { initialValue: l, initialValueLanguage: d, convertJs: c, convertJsSetting: m, type: (f == null ? void 0 : f.type) || "string" }, n); + return u(e, { ...f, value: y, rawValue: b, $setting: i || {} }); +}, oa = ({ cols: e, rowHeight: t, itemMargin: n, fields: a, primaryKey: r, dataSource: s, itemClassName: i, itemRender: o = (m, h, f) => m, empty: l = u(Rn, { description: null }), className: d, style: c = {} }) => { + const m = Ge(), h = Z(() => u(cn, { cols: e, rowHeight: t, itemMargin: n, fields: a, className: i }), [a, e, t, n]); + return u("div", { className: L("ff-data-list-content", d), style: c, children: g.isEmpty(s) ? l : s.map((f, y) => { + const b = o(C.cloneElement(h, { data: f }), f, y); + return C.cloneElement(b, { key: `${m}-${(f == null ? void 0 : f[r]) || y}` }); + }) }); +}, la = ({ component: e }) => { + const { base62params: t } = jn(); + return u(K, { children: u(kt, { listCode: e, base62params: F.decode(t) }) }); +}, ca = () => "Empty", da = ({ component: e, $setting: t }) => { + const [n, a] = N(); + T(() => { + if (!e) return a(u(ca, { description: null })); + Q.getWidgetComponent(e).catch((s) => ({ default: () => `${s}` })).then((s) => C.createElement(s.default, { $setting: t })).then(a); + }, [e]); + const r = le.getPageParams() || {}; + return n ? C.cloneElement(n, r) : null; +}; +var pe, G, me, he, Me, ze; +const ae = class ae { + constructor() { + $(this, G, /* @__PURE__ */ new Map()); + $(this, me, {}); + $(this, he, null); + k(this, "init", (t, n) => { + D(this, G, t), D(this, me, n); + }); + k(this, "get", (t) => (p(this, G).has(t) || (t = Array.from(p(this, G).keys()).find((n) => p(this, G).get(n).uri === t)), p(this, G).get(t) || {})); + k(this, "redirect", (t, n, a = {}) => { + const { uri: r, type: s, widgetProps: i } = this.get(t) || {}; + let o = In(r || t, s != "list" ? n : g.mapValues(n, (d) => F.encode(d))); + const l = new URLSearchParams(); + for (const d in i || {}) (i == null ? void 0 : i.type) == "query" && l.append(d, n[d]); + return l.size > 0 && (o = `${o}?${l.toString()}`), p(this, he).navigate(o, a); + }); + k(this, "getMenus", (t) => { + var n; + return ((n = p(this, me)) == null ? void 0 : n[t]) || []; + }); + k(this, "findMenuPathByUuid", (t) => { + let n = []; + for (const a in p(this, me)) if (n = p(this, Me).call(this, p(this, me)[a], t, [a]), n.length > 1) return n; + return n; + }); + k(this, "getMenusByRouteUuid", (t) => p(this, ze).call(this, t, Object.values(p(this, me)).flat())); + $(this, Me, (t, n, a = []) => { + if (g.isEmpty(t)) return a; + for (const { uuid: r, children: s } of t) { + if (r == n) return a.concat(r); + if (!g.isEmpty(s)) return a.concat(r, p(this, Me).call(this, s, n)); + } + return a; + }); + $(this, ze, (t, n) => { + var r; + let a = []; + for (const s of n) s.widgetType == "redirect" && (s.uuid == t || s.widget == t ? a.push(s) : (r = s.children) != null && r.length && (a = a.concat(p(this, ze).call(this, t, s.children)))); + return a; + }); + k(this, "getCurrentMenu", () => { + const { uuid: t } = this.getCurrentRoute() || {}; + if (!t) return; + const n = this.getMenusByRouteUuid(t); + return g.isEmpty(n) ? void 0 : n[0]; + }); + k(this, "getCurrentRoute", (t = 0) => { + var a; + const n = (a = p(this, he).state.matches[p(this, he).state.matches.length - 1 - t]) == null ? void 0 : a.route; + if (!n) return null; + for (let [r, s] of p(this, G)) if (s.uri === n.path) return s; + return null; + }); + k(this, "getPageParams", (t) => { + var s, i; + const { location: n = {}, matches: a = [] } = ((s = p(this, he)) == null ? void 0 : s.state) || {}, r = ((i = a[a.length - 1]) == null ? void 0 : i.params) || {}; + return n.search && new URLSearchParams(n.search).forEach((o, l) => { + r[l] = o; + }), t ? g.get(r, t) : r; + }); + k(this, "createBrowserRouter", (t = {}) => { + if (p(this, G).size == 0) return null; + const n = Oe.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), a = Oe.get(Q.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [n]: 0 }, s = (o, l) => () => Q.getWidgetComponent(o).then((d) => d.default || function() { + return `${o}`; + }).then((d) => ({ Component: () => C.createElement(_t, {}, C.createElement(d, l)) })), i = Array.from(p(this, G).values()).reduce((o, { uuid: l, uri: d, name: c, type: m, component: h, widgetSetting: f, isLogin: y, isLayout: b, extra: w }) => { + let v = {}, j = 0; + switch (m) { + case "list": + v.element = C.createElement(la, { component: h }); + break; + case "fsdpf-component": + v.element = C.createElement(da, { key: h, component: h, $setting: f }); + } + if (w != null && w.layout) { + if (!r[w == null ? void 0 : w.layout]) return r[w == null ? void 0 : w.layout] = o.length, [...o, { path: "/", lazy: s(w == null ? void 0 : w.layout, {}), children: [{ path: d, ...v }] }]; + j = r[w == null ? void 0 : w.layout]; + } + return b && j > -1 ? (o[j].children.push({ path: d, ...v }), o) : [...o, { path: d, ...v }]; + }, [{ path: "/", lazy: s(n, {}), children: [] }]); + return i.push({ index: !0, element: C.createElement(ua, { to: a, replace: !0 }) }), D(this, he, Mn(i, t)); + }); + if (p(ae, pe)) return p(ae, pe); + } +}; +pe = new WeakMap(), G = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Me = new WeakMap(), ze = new WeakMap(), $(ae, pe, null), k(ae, "getInstance", () => (p(ae, pe) || D(ae, pe, new ae()), p(ae, pe))); +let mt = ae; +const ua = ({ to: e, replace: t }) => zn() ? C.createElement(Wn, { to: e, replace: t }) : (window.document.location = e, "redirect"), le = mt.getInstance(), Se = new Worker(new URL("/ff-worker/index.js", self.location)), Mt = { getConfigure: (e) => Oe.get(e), route: { redirect: (...e) => le.redirect(...e), getPageParams: (...e) => le.getPageParams(...e), getCurrentRoute: () => le.getCurrentRoute() }, popup: { notification: (...e) => _.notification(...e), success: (...e) => _.success(...e), error: (...e) => _.error(...e), form: (...e) => _.form(...e), modal: (...e) => _.modal(...e), confirm: (...e) => _.confirm(...e) } }; +var tt, $e, fe; +const M = class M { + constructor() { + k(this, "exec", (t, n = {}, a = {}, r = "") => new Promise((s, i) => { + const o = Ot(M, tt)._++; + p(M, $e).set(o, a), M.mQueue.set(o, [s, i]), Se.postMessage({ id: o, session: r, category: "eval", method: t, args: n }); + })); + k(this, "clear", (t) => Se.postMessage({ session: t, category: "clear" })); + if (p(M, fe)) return p(M, fe); + Promise.resolve().then(() => Aa).then((t) => { + Mt.http = t.http; + }), Se.addEventListener("message", ({ data: { id: t, task_id: n, method: a, args: r, category: s, data: i, error: o, session: l } }) => { + if (s === "eval" && M.mQueue.has(t)) o !== null ? M.mQueue.get(t)[1](o) : M.mQueue.get(t)[0](i), p(M, $e).delete(t), M.mQueue.delete(t); + else if (s === "util") try { + const d = g.get(Mt, a.split("/")) || g.get(p(M, $e).get(n), a.split("/")); + if (!g.isFunction(d)) throw `${a} not found`; + Promise.resolve(Reflect.apply(d, void 0, r)).then((c) => { + Se.postMessage({ id: t, task_id: n, category: s, method: a, args: r, session: l, data: c, error: null }); + }).catch((c) => { + Se.postMessage({ id: t, task_id: n, category: s, method: a, args: r, session: l, data: null, error: c }); + }); + } catch (d) { + Se.postMessage({ id: t, task_id: n, category: s, method: a, args: r, session: l, data: null, error: d }); + } + }, !1); + } +}; +tt = new WeakMap(), $e = new WeakMap(), fe = new WeakMap(), k(M, "mQueue", /* @__PURE__ */ new Map()), $(M, tt, 0), $(M, $e, /* @__PURE__ */ new Map()), $(M, fe, null), k(M, "getInstance", () => (p(M, fe) || D(M, fe, new M()), p(M, fe))); +let ht = M; +const Ce = ht.getInstance(), St = () => { + const e = q(!0), [, t] = C.useReducer((n) => n + 1, 0); + return T(() => () => e.current = !1, []), () => e.current && t(); +}, or = (e) => { + const t = q(); + return T(() => { + t.current = e; + }, [e]), t.current; +}, lr = (e) => { + const [t, n] = N(e), a = q(null), r = ce((s, i) => { + a.current = i, n(s); + }, []); + return T(() => { + a.current && (a.current(t), a.current = null); + }, [t]), [t, r]; +}, Be = (e = (a) => { +}, t, n = g.isEqual) => { + const a = C.useRef(); + n(t, a.current) || (a.current = g.cloneDeep(t)), C.useEffect(e, [a.current]); +}, xt = Be, dn = (e, t = "string") => { + var n; + if (!Array.isArray(e)) return e; + for (let a = 0; a < e.length; a++) e[a].value = Y((n = e[a]) == null ? void 0 : n.value, t), e[a] && Reflect.has(e[a], "children") && (e[a].children = dn(e[a].children, t)); + return e; +}, cr = (e, t = "json", n = "string", a, r = null) => { + const [s] = X.useForm(a), [i, o] = N([{ label: "无", value: "", disabled: !0 }]), l = q([]), d = X.useWatch((c) => l.current.length === 0 ? null : g.pick(c, l.current), s) || null; + return T(() => { + Array.isArray(e) ? o(e) : t === "javascript" && e ? Ce.exec(e, {}, { getFieldValue: (c) => (l.current.includes(c) || l.current.push(c), s.getFieldValue(c)), getFieldValueForBasicForm: (c) => (l.current.includes(c) || l.current.push(c), r ? r.getFieldValue(c) : s.getFieldValue(c)) }).then((c) => { + o(Y(c, "array")); + }) : e && o(Y(e, "array")); + }, [e, t, d]), dn(i, n); +}, dr = (e) => { + const [t, n] = N(), a = { type: "GET" }; + if (typeof e == "string" ? a.url = e : g.isPlainObject(e) && Object.assign(a, e), !(a != null && a.url)) throw "url is required"; + const r = (s) => F.request(a, !1).resp((i) => (console.log("useSubscribeRequest", s), n(i), i)); + return Be(() => { + let s = null; + return r().then((i) => { + s = en.subscribe(g.throttle(r, 180, { leading: !1, trailing: !0 }), i.res); + }), () => s == null ? void 0 : s(); + }, a), t; +}, ga = (e) => { + const [t, n] = C.useState({ gridItems: [], hideItems: [] }); + return C.useEffect(() => { + e && F.get(`/api/_/${e}`).then(({ pk: a, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: d, marginX: c, marginY: m, listenChangeFields: h, listenChangeFieldsFunc: f, fields: y }) => ({ pk: a, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: d, marginX: c, marginY: m, listenChangeFields: h, listenChangeFieldsFunc: f, ...y.reduce((b, w) => { + var v; + return (v = w == null ? void 0 : w.field) != null && v.hidden ? b.hides.push(w == null ? void 0 : w.field) : b.items.push(w), b; + }, { items: [], hides: [] }) })).then(n); + }, [e]), t; +}, pa = ({ max: e = 0, min: t = 0, type: n = "", message: a, pattern: r, required: s = !1, validator: i } = {}, o, l) => { + const [d, c] = N([]); + return T(() => { + const m = []; + if (s) { + let h = l; + switch (l) { + case "number": + case "string": + case "array": + break; + case "bool": + h = "boolean"; + break; + case "json": + h = "object"; + } + m.push({ type: h, required: !0, whitespace: !0, message: "该项必填" }); + } + switch (n) { + case "string": + m.push({ type: n, max: e, min: t, message: a || (t && e ? `字符必须在 ${t} ~ ${e} 之间` : `${e ? "最多能有" : "最少要有"} ${t || e} 个字符`) }); + break; + case "pattern": + m.push({ type: "string", pattern: r, message: a }); + break; + case "validator": + i && m.push(({ getFieldValue: h }) => ({ validator: async (f, y) => { + const b = await Ce.exec(i, { value: y, fieldName: o }, { getFieldValue: h }); + return g.isString(b) && b ? Promise.reject(b) : g.isBoolean(b) && !b ? Promise.reject(a) : Promise.resolve(); + } })); + } + c(m); + }, [e, t, n, a, r, s, i]), d; +}, ma = (e, t, n) => { + const [a, r] = N(null); + return T(() => { + const { initDataUri: s = `/api/${e}`, initDataMethod: i = "GET" } = n || {}; + t && F.request({ method: i, url: g.trimEnd(`${s}/${t}`, "/") }).then((o) => { + r(o); + }); + }, [e, t, n]), a; +}, ha = (e, t, n, a = {}) => { + const r = St(), s = q(!0), i = q([]), [o, l] = N(n), d = X.useWatch((c) => JSON.stringify(g.pick(c, i.current)), t) || "{}"; + return T(() => { + e && Ce.exec(e, a, { getFieldValue: g.wrap(t.getFieldValue, (c, m) => (i.current.some((h) => g.isEqual(h, m)) || (i.current.push(m), r()), c(m))), isFieldTouched: t.isFieldTouched, isFieldsTouched: t.isFieldsTouched }).then((c) => s.current && l(c)); + }, [e, d, t, a]), T(() => () => s.current = !1, []), o; +}, ur = ({ value: e, onChange: t }, n = null) => { + const a = q(), [r] = X.useForm(n); + return xt(() => { + g.isEqual(a.current, e) || r.setFieldsValue(e); + }, [e]), T(() => () => r.resetFields(), []), [Z(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: {} }, [r]), (s, i) => { + a.current = i, t(i); + }]; +}, fa = ({ type: e, initialValue: t, initialValueLanguage: n, onChange: a, form: r }) => { + const s = ha(n == "javascript" && t, r, n == "javascript" ? void 0 : t, {}); + return T(() => { + n == "javascript" ? a(Y(s, e)) : t && a(Y(t, e)); + }, [e, t, s]), null; +}, ya = ({ widget: e = "Input", widgetPrefix: t = "@pkg/ff/grid-layout-forms", widgetDecorator: n, subWidgets: a, basicForm: r, ...s }) => { + const i = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [o, l] = N(); + return T(() => { + i && Q.getWidgetComponent(i).then(({ defaultProps: d = {}, default: c }) => ({ default: un(c, d, r) })).catch((d) => ({ default: () => `${d}` })).then((d) => l(C.createElement(d.default, s))); + }, [i]), o && C.cloneElement(o, s); +}, un = (e, t = {}, n = null) => (a) => { + const { type: r, code: s, label: i, noStyle: o, placeholder: l, extras: d, validators: c, help: m, isVirtual: h, $isReserved: f, initialValue: y, initialValueLanguage: b, convertJs: w, convertJsSetting: v, widgetPerfix: j, boxStyle: z, widgetDecorator: I, subWidgets: V, ...E } = { ...t, ...a }, x = pa(c || {}, s, r), A = { label: i, noStyle: o, colon: !1, layout: "vertical" }, B = { placeholder: l, ...E }, U = ce((W) => W == null ? void 0 : Y(W, r), [r]); + return u(Jt, { name: s, rules: x, initialValue: U(y), normalize: U, children: (W, R, H) => { + var se; + return u(e, { type: r, rcform: H, itemProps: { validateStatus: R.errors.length > 0 ? "error" : "success", tooltip: m, help: R.errors.length > 0 ? R.errors.join("、") : null, required: ((se = x == null ? void 0 : x[0]) == null ? void 0 : se.required) || !1, ...A }, fieldProps: { ...B, ...W }, $setting: d || {} }); + } }); +}, Pt = ({ cols: e = 24, rowHeight: t = 16, itemMargin: n = [8, 16], containerPadding: a = [0, 0], fields: r = [], children: s, basicForm: i = null }) => { + const o = ln(r, un, "@pkg/ff/grid-layout-forms"); + return O("div", { className: "ff-grid-layout-form", style: { "--grid-layout-item-margin-x": `${(n == null ? void 0 : n[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(n == null ? void 0 : n[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(a == null ? void 0 : a[0]) || 0}px`, "--grid-layout-container-padding-x": `${(a == null ? void 0 : a[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: [o, s && C.cloneElement(s, { cols: e, rowHeight: t, itemMargin: n, containerPadding: a, fields: r })] }); +}; +Pt.propTypes = { fields: S.array }; +const wa = (zt = Pt, ({ code: e, layout: t, name: n, primaryKey: a = 0, style: r = {}, formProps: s = {}, form: i, isPreview: o = !1, className: l, onFinish: d, onValuesChange: c = () => { +}, ...m }) => { + const { align: h, autoComplete: f, resource: y, items: b, hides: w, rowHeight: v, marginX: j, marginY: z, cols: I, listenChangeFields: V, listenChangeFieldsFunc: E, pk: x, uuid: A } = ga(e), [B] = X.useForm(i), U = Z(() => [{ name: "__PK__", value: x }, { name: "__PROPS__", value: s }, { name: "__RESOURCE__", value: y }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: A }, { name: "__PRIMARY_KEY__", value: a }], [x, e, A, y, a, s]); + return O(X, { className: l, name: n || e, layout: t || h, fields: U, form: B, autoComplete: f, style: { ...r, position: "relative" }, onFinish: d, onValuesChange: (W, R) => (({ changedValues: H, allValues: se, listenChangeFields: nt, listenChangeFieldsFunc: De, onValuesChange: at, code: Tt }) => { + at(H, se), De && Array.isArray(nt) && Ce.exec(De, { changedValues: H, allValues: se }, { getFieldValue: B.getFieldValue, setFieldValue: B.setFieldValue, setFieldsValue: B.setFieldsValue, isFieldTouched: B.isFieldTouched, isFieldsTouched: B.isFieldsTouched }); + })({ changedValues: W, allValues: R, listenChangeFields: V, listenChangeFieldsFunc: E, onValuesChange: c, code: e }), children: [u(zt, { ...m, form: B, code: e, fields: b, cols: I, rowHeight: v, itemMargin: [j, z] }), w == null ? void 0 : w.map((W) => { + var R; + return u(Jt, { name: W.code, children: u(fa, { form: B, name: W.code, type: W.type, initialValue: W.initialValue, initialValueLanguage: (R = W.extras) == null ? void 0 : R.initialValueLanguage }) }, JSON.stringify(W.code)); + })] }, e); +}); +var zt; +const gn = ({ $setting: e, $close: t, extras: n, code: a, primaryKey: r, ...s }) => { + const [i] = X.useForm(), o = ma(a, r, e); + return T(() => { + o && i.setFieldsValue(o); + }, [o]), u(K, { actions: O(C.Fragment, { children: [u(P, { name: "保存", type: "primary", widget: () => { + const l = i.getFieldValue("__RESOURCE__"), { initDataUri: d = `/api/${a}` } = e || {}; + i.validateFields(!0).then((c) => l ? g.pick(c, [l]) : c).then((c) => F.post(r ? `${d}/${r}` : `${d}`, c).msg(t)).catch(() => _.error("请先完善表单信息", { duration: 2e3 })); + } }), u(P, { name: "取消", widget: () => t(!1) })] }), extras: n, children: u(wa, { form: i, code: a, primaryKey: r, ...s }) }); +}, Ca = (e, t, n, { isReplaceRouteHistory: a = !1 } = {}) => le.redirect(n, t, { replace: a }), ba = (e, t = {}, n, a = {}) => { + var s; + const r = (s = a.router) == null ? void 0 : s.reduce((i, [o, l, d]) => { + const c = g.get(t, ["router", o]); + if (!c && c !== 0 && l) throw `请传入 ${d}`; + return `${i}/${c}`; + }, `/api/${n}`); + return F.del(r, t.param).msg(); +}, Wt = (e, t, n, { status: { loading: a, disabled: r }, setStatus: s }) => { + const i = { loading: (o) => o === void 0 ? a : s((l) => ({ ...l, loading: o })), disabled: (o) => o === void 0 ? r : s((l) => ({ ...l, disabled: o })) }; + return g.isFunction(n) ? n.call(null, { ...t, ...i }) : g.isString(n) && n ? Ce.exec(n, t, i) : null; +}, Bt = (e, t, n, a, r) => g.isString(n) && n ? Q.getWidgetComponent(n).then(({ default: s }) => _.modal(s, { ...t, $setting: a }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r)).catch((s) => { + _.error(n, { content: s.toString() }); +}) : _.modal(n, { ...t, $setting: a }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), ka = (e, t, n, a, r) => _.modal(gn, { ...t, $setting: a, code: n }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), va = (e, t, n, a, r) => _.modal(kt, { base62params: t, $setting: a, listCode: n }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), Sa = ({ widget: e, widgetType: t, widgetData: n, widgetProps: a, widgetSetting: r, widgetContainerProps: s }, { onAfterClick: i, onBeforeClick: o }) => { + const l = Ee(we), [d, c] = N({ leading: !0, trailing: !1 }), m = Z(() => { + switch (t) { + case "redirect": + return g.partialRight(Ca, e, r); + case "func": + return g.partialRight(Wt, (r == null ? void 0 : r.code) ?? e, { status: d, setStatus: c }); + case "fsdpf-component": + return g.partialRight(Bt, e, r, s); + case "grid-layout-form": + return g.partialRight(ka, e, r, s); + case "data-list": + return g.partialRight(va, e, r, s); + case "destroy": + return g.partialRight(ba, e, r, s); + default: + if ($t(e) || C.isValidElement(e)) return g.partialRight(Bt, e, r, s); + if (g.isFunction(e)) return g.partialRight(Wt, (r == null ? void 0 : r.code) || e, { status: d, setStatus: c }); + } + return (...h) => console.error("useButton unknown widgetType", t, ...h); + }, [e, t]); + return [g.debounce((h) => (o == null || o(h), Promise.resolve(Yt(a, h, { list: l })).then((f) => m(h, { ...n, ...f })).then((f) => i == null ? void 0 : i(f)).catch(console.error)), 300, { leading: !0, trailing: !1 }), d]; +}, Ut = /* @__PURE__ */ new Set(), ft = (e = [], t = 0) => { + const n = e[t]; + if (n.length && !Ut.has(n)) { + const a = document.createElement("script"); + a.setAttribute("src", n), a.setAttribute("data-namespace", n), e.length > t + 1 && (a.onload = () => { + ft(e, t + 1); + }, a.onerror = () => { + ft(e, t + 1); + }), Ut.add(n), document.body.appendChild(a); + } +}, yt = ({ className: e, type: t, style: n = {}, ...a }) => u("span", { role: "img", className: L("ff-iconfont", e), style: n, ...a, children: u("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: u("use", { xlinkHref: `#${t}` }) }) }); +yt.propTypes = { className: S.string, type: S.string.isRequired, style: S.object }, yt.init = ft; +const Ue = (e) => function({ className: t, children: n, name: a, icon: r, type: s = "default", iconPosition: i = "start", noAuthType: o, onAfterClick: l, onBeforeClick: d, data: c, loading: m, disabled: h, tooltip: f, confirm: y, widget: b, widgetType: w, widgetData: v, widgetProps: j, widgetSetting: z, widgetContainerProps: I, ...V }) { + const E = g.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), x = { type: "primary", className: L("ff-button", t), iconPosition: i }; + s === "danger" ? x.danger = !0 : s === "default" && (x.type = s), e === "link" || e === "dashed" ? (x.type = e, s === "default" && (x.className = L(x.className, "ff-default"))) : e !== "circle" && e !== "round" || (x.shape = e), r && (x.icon = u(yt, { type: r })); + const [A, B] = N(!1), [U, { disabled: W, loading: R }] = Sa({ widget: b, widgetType: w, widgetData: v, widgetProps: j, widgetSetting: z, widgetContainerProps: I }, { onAfterClick: l, onBeforeClick: d }); + return u(Fn, { okText: "确定", cancelText: "取消", ...E, disabled: W || h, open: A, onOpenChange: (H) => { + if (!H) return B(H); + E.enabled ? B(H) : U(c); + }, onConfirm: () => { + U(c); + }, onClick: (H) => { + H.stopPropagation(); + }, children: u(On, { ...f, title: A ? null : f == null ? void 0 : f.title, trigger: ["hover", "click"], children: u(lt, { loading: R || m, disabled: W || h, ...x, ...V, children: n || a }) }) }); +}, P = Ue("default"), xa = Ue("link"), Pa = Ue("circle"), Na = Ue("round"), $a = Ue("dashed"), Dt = ({ data: e, widget: t, widgetType: n = "fsdpf-component", children: a, widgetData: r, widgetProps: s, widgetSetting: i, widgetContainerProps: o }) => { + const l = Ee(we), [d, c] = N(!1), [m, h] = N("hover"), [f, y] = N({}), [b, w] = N(), { placement: v, align: j, arrow: z = { pointAtCenter: !0 }, getPopupContainer: I, ...V } = o || {}; + T(() => { + n == "grid-layout-form" ? w(C.createElement(gn, { ...r, $setting: i, code: t })) : n == "data-list" ? w(C.createElement(kt, { base62params: e, $setting: i, listCode: t })) : g.isString(t) ? Q.getWidgetComponent(t).then(({ default: A }) => { + w(C.createElement(A, { ...r, $setting: i })); + }).catch((A) => w(A.toString())) : $t(t) ? w(C.createElement(t, { ...r, $setting: i })) : C.isValidElement(t) && w(C.cloneElement(t, { ...r, $setting: i })); + }, [t, n, r]), T(() => { + Promise.resolve(Yt(s, e, { list: l })).then(y); + }, [s, e]); + const E = (A) => { + c(A), !A && h("hover"); + }, x = (A) => { + c(!0), h("click"); + }; + return u(Ln, { zIndex: 1080, placement: v, onPopupClick: x, onClick: x, open: d, align: j, arrow: z, trigger: m, getPopupContainer: I, content: u(Ta, { ...V, children: b && C.cloneElement(b, { ...f, $close: () => E(!1) }) }), children: a, onOpenChange: E }); +}, Ta = ({ title: e, className: t, children: n, width: a, height: r, ...s }) => { + const [i, o] = N({}), l = ce((m, h) => o((f) => ({ ...f, [m]: h })), []), d = ce((m) => o((h) => ({ ...h, [m]: void 0 })), []), c = e ? C.createElement("div", { className: "ff-popup-title" }, e) : i == null ? void 0 : i.title; + return u(We.Provider, { value: { ele: i, mount: l, unmount: d }, children: O("div", { className: L("ff-popup ff-popover", t), style: { width: a, height: r }, ...s, children: [O("div", { className: "ff-popup-header", children: [c, i == null ? void 0 : i["sub-title"]] }), n, O("div", { className: "ff-popup-footer", children: [i == null ? void 0 : i.extras, i == null ? void 0 : i.actions] })] }) }); +}; +Dt.propTypes = { widgetType: S.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }, P.propTypes = { type: S.oneOf(["primary", "default", "danger", ""]), name: S.string, icon: S.string, iconPosition: S.oneOf(["start", "end"]), data: S.any, widget: S.any, widgetType: S.oneOf(["destroy", "redirect", "func", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: S.object, widgetProps: S.object, widgetSetting: S.object, widgetContainerProps: S.object, confirm: S.exact({ title: S.string.isRequired, cancelText: S.string, okText: S.string, okType: S.oneOf(["primary", "default", "danger", ""]), placement: S.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: S.oneOfType([S.bool, S.number]) }) }, P.Link = xa, P.Link.defaultProps = P.defaultProps, P.Link.propTypes = P.propTypes, P.Circle = Pa, P.Circle.defaultProps = P.defaultProps, P.Circle.propTypes = P.propTypes, P.Round = Na, P.Round.defaultProps = P.defaultProps, P.Round.propTypes = P.propTypes, P.Dashed = $a, P.Dashed.defaultProps = P.defaultProps, P.Dashed.propTypes = P.propTypes, P.Popover = Dt; +const Ea = ({ fields: e, formProps: t, $close: n }) => { + const [a] = X.useForm(), r = Z(() => [{ name: "__PROPS__", value: t }], [t]); + return u(K, { actions: O(C.Fragment, { children: [u(P, { name: "取消", widget: () => n(!1) }), u(P, { name: "确定", type: "primary", widget: () => a.validateFields(!0).then(n) })] }), children: u(X, { fields: r, form: a, className: "ff-modal-form", children: e == null ? void 0 : e.map(({ code: s, ...i }) => u(ya, { code: s, ...i }, s)) }) }); +}, Ra = ({ className: e, $close: t, children: n, title: a, subTitle: r, actions: s, extras: i, zIndex: o, ...l }) => O(Dn, { ...l, prefixCls: "ff-drawer", className: L("ff-popup", e), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (d) => ({ motionAppear: !0, motionName: `panel-motion-${d}` }), children: [O("div", { className: "ff-popup-header", children: [u("button", { "aria-label": "Close", className: "ff-popup-close", onClick: l.onClose, children: u(bt, { type: "close" }) }), a, r] }), u("div", { className: "ff-popup-body", children: n }), O("div", { className: "ff-popup-footer", children: [i, s] })] }), Fa = ({ className: e, $close: t, $event: n, children: a, title: r, subTitle: s, actions: i, extras: o, zIndex: l, placement: d, ...c }) => { + const m = (n == null ? void 0 : n.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: n == null ? void 0 : n.pageX, y: n == null ? void 0 : n.pageY } }; + return u(qn, { ...c, ...m, prefixCls: "ff-modal", modalRender: () => O("div", { className: L("ff-modal-content ff-popup", e), children: [O("div", { className: "ff-popup-header", children: [u("button", { "aria-label": "Close", className: "ff-popup-close", onClick: c.onClose, children: u(bt, { type: "close" }) }), r, s] }), u("div", { className: "ff-popup-body", children: a }), O("div", { className: "ff-popup-footer", children: [o, i] })] }) }); +}, pn = ({ placement: e, $close: t, $event: n, children: a, title: r, ...s }) => { + const [i, o] = N({}), [l, d] = N(!0), c = ce((y, b) => o((w) => ({ ...w, [y]: b })), []), m = ce((y) => o((b) => ({ ...b, [y]: void 0 })), []); + let h = { ...s, className: i.rootClassName, title: i.title || r && C.createElement("div", { className: L("ff-popup-title") }, r), subTitle: i["sub-title"], actions: i.actions, extras: i.extras, children: a, $close: t, $event: n, onClose: () => d(!1) }; + const f = () => { + t(!1); + }; + return u(We.Provider, { value: { ele: i, mount: c, unmount: m }, children: e && e !== "center" ? u(Ra, { ...h, placement: e, open: l, afterOpenChange: (y) => !y && f() }) : u(Fa, { ...h, visible: l, afterClose: f }) }); +}; +pn.propTypes = { placement: S.oneOf(["center", "left", "top", "right", "bottom"]) }; +const J = () => { + const [e, t] = Bn({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (s) => { + const { offsetHeight: i } = s; + return { height: i }; + }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, n] = C.useReducer((s) => s + 1, 0); + T(() => { + J.$onClick = a, J.$queue.forEach(([s, i, o], l, d) => { + r([i, o], ...s), delete d[l]; + }); + }, []); + const a = (s, i = {}, o = {}) => new Promise((l, d) => r([l, d], s, i, o)), r = ([s, i], o, l = {}, d = {}) => { + const c = J.$index++, m = (h) => ((f, y) => (J.$popups.delete(f), n(), y == null ? void 0 : y()))(c, () => s(h)); + if (o === Gt) return e.open({ ...d, key: c, content: C.createElement(o, { ...l, $close: () => e.close(c) }) }); + J.$popups.set(c, C.createElement(pn, { zIndex: c, maskClosable: !1, $event: l == null ? void 0 : l.$event, ...d, key: c, $close: m }, C.isValidElement(o) ? C.cloneElement(o, { ...l, $close: m }) : o != null && o.name || Lt.isForwardRef(o) || (o == null ? void 0 : o.$$typeof) === Lt.ForwardRef ? C.createElement(o, { ...l, $close: m }) : o)), n(); + }; + return O(C.Fragment, { children: [Array.from(J.$popups).map(([s, i]) => i), t] }); +}; +J.$popups = /* @__PURE__ */ new Map(), J.$index = 0, J.$queue = [], J.$onClick = (...e) => new Promise((t, n) => { + J.$queue.push([e, t, n]); +}); +const qt = (e, t, n = {}) => J.$onClick(e, t, n), it = (e, { showProgress: t, duration: n, ...a } = { duration: 1.5 }) => J.$onClick(Gt, { content: e, ...a }, { showProgress: t, duration: n }), _ = { modal: qt, confirm: (e, t = {}) => J.$onClick(Hn, { content: e, ...t }, { placement: "center" }), form: (e, t = {}, n = {}) => qt(Ea, { formProps: n, fields: e }, { placement: "center", ...t }).then((a) => { + if (a === !1) throw !1; + return a; +}), notification: it, success: (e, t = { duration: 1.5 }) => it(e, { ...t, className: "ff-notification-success", icon: "check" }), error: (e, t = { duration: 1.5 }) => it(e, { ...t, className: "ff-notification-error", icon: "close" }) }; +Re.configure({ showSpinner: !1 }), Fe.interceptors.request.use((e) => { + e.headers.Platform = "web", e.headers.SaaS = window.localStorage.getItem("SaaS"); + const t = window.localStorage.getItem(_e); + return e.headers.Authorization = t ? `Bearer ${t} ` : void 0, Re.inc(), e; +}, (e) => (Re.done(), Promise.reject({ code: -1, msg: e }))), Fe.interceptors.response.use(({ data: e, headers: t }) => (Re.done(), { ...e, res: t == null ? void 0 : t.res }), function(e) { + return Re.done(), Promise.reject(e.message); +}), window.addEventListener("unhandledrejection", ct.onUnhandledRejection), ct.onMsg = (e, t) => _[[0, 1].includes(e) ? "success" : "error"](t).then(() => e === 20300 && le.redirect(Oe.get("Common.WEBSITE_LOGIN_PAGE"))); +const wt = { appUrl: "", init: (e, t, n) => { + wt.appUrl = n, Fe.defaults.baseURL = n, Fe.defaults.timeout = 15e3, Object.assign(wt, new ct(e, t, Fe)); +} }, F = wt; +class Nt extends Error { + constructor(t, n) { + super(n), Error.captureStackTrace && Error.captureStackTrace(this, Nt), !n instanceof Le && (this.name = `${t} Error Runtime`); + } +} +class Le extends Error { + constructor(t, ...n) { + super(...n), Error.captureStackTrace && Error.captureStackTrace(this, Le), this.name = `${t} Not Found`; + } +} +const ot = "mine", _e = "token"; +var ye, Te; +const re = class re { + constructor() { + $(this, Te, /* @__PURE__ */ new Map()); + k(this, "setVendor", (t, n) => p(this, Te).set(t, new Kt(n, async (a, r) => { + var i, o; + if (!(a != null && a.default)) throw "@pkg not found"; + let s = () => r; + switch ("function") { + case typeof (s = (i = a.default) == null ? void 0 : i[`./${r}/index.jsx`]): + case typeof (s = (o = a.default) == null ? void 0 : o[`./${r}/index.js`]): + return s(); + } + throw new Le(r); + }))); + k(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 [, n] = t == null ? void 0 : t.split("@pkg/"); + if (!n) throw new Le(t); + try { + return p(this, Te).has("pkg") ? await p(this, Te).get("pkg").get(n) : await import(`${F.appUrl}/api/pkg-import/web?name=${t}`); + } catch (a) { + throw new Nt(t, a); + } + }); + k(this, "getRoutes", () => F.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: n, ...a }) => [n, { uuid: n, ...a }])).then((t) => new Map(t))); + k(this, "getMenus", () => F.get("/api/my-menu")); + k(this, "getConfigure", () => F.get("api/init-configure")); + k(this, "getWidgetOperationAuth", () => F.get("/api/init-widget-operation-auth").then((t) => t.reduce((n, { uuid: a, auth: r }) => [...n, [a, r]], []))); + k(this, "getPhoneNumber", (t) => F.get(`/api/user-wx-phone-number/${t}`)); + k(this, "getUserToken", () => { + const t = window.localStorage.getItem(_e); + if (!t) return ""; + const n = t.split("."); + if (!Array.isArray(n) || n.length !== 3) throw "登录令牌无效!"; + const { iat: a } = JSON.parse(window.atob(n[1])); + if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - a > 2592e3) throw "登录令牌已过期, 请重新登录!"; + return t; + }); + k(this, "checkUserToken", () => { + try { + return !!this.getUserToken(); + } catch { + return !1; + } + }); + k(this, "getUserInfo", (t = !0) => { + var n; + try { + const a = this.getUserToken(); + if (!a) return Promise.resolve(null); + const { iat: r } = JSON.parse(window.atob((n = a == null ? void 0 : a.split(".")) == null ? void 0 : n[1])), { iat: s, ...i } = F.decode(window.localStorage.getItem(ot) || "", {}); + return s === r ? Promise.resolve(i) : F.get("/api/mine-info").then(({ User: o = null }) => (window.localStorage.setItem(ot, F.encode({ ...o, iat: r })), o)); + } catch (a) { + console.error(a), t && Popup.error("请登录").then(logout); + } + return Promise.resolve(null); + }); + k(this, "login", (t, n, a = {}) => F.post("/api/user-token", { username: t, passwd: Un.hash(n), platform: "web", ...a }).then(({ token: r }) => (window.localStorage.setItem(_e, r), r))); + k(this, "logout", () => { + window.localStorage.removeItem(ot), window.localStorage.removeItem(_e); + }); + if (p(re, ye)) return p(re, ye); + } +}; +ye = new WeakMap(), Te = new WeakMap(), $(re, ye, null), k(re, "getInstance", () => (p(re, ye) || D(re, ye, new re()), p(re, ye))); +let Ct = re; +const Q = Ct.getInstance(), Oa = C.createContext({ user: {}, initUser: () => { +}, initUserComplete: !1 }), La = C.createContext({ set: () => { +}, get: () => { +}, assign: () => { +}, currentRoute: () => { +} }), $t = (e) => !!(e != null && e.name) && (e.prototype instanceof C.Component || /^[A-Z]/.test(e.name)), Va = (e, t) => { + if (!e || typeof window > "u") return; + let n = document.querySelector(`style[ff-style-token="${t}"]`); + return n ? (n.innerHTML = e, e) : (n = document.createElement("style"), n.setAttribute("ff-style-token", t), n.setAttribute("type", "text/css"), n.innerHTML = e, document.head.appendChild(n), e); +}, Aa = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Oa, AppGlobalParamsContext: La, cache: Kt, configure: Oe, default: Q, func: Ce, http: F, insertStyle: Va, isReactComponent: $t, route: le }, Symbol.toStringTag, { value: "Module" })), ja = (e, t, n = "children") => { + if (g.isEmpty(e)) return {}; + const a = g.find(e, ["value", t]); + if (!g.isEmpty(a)) return a; + const r = e.length; + for (let s = 0; s < r; s++) { + const { [n]: i } = e[s], o = ja(i, t, n); + if (!g.isEmpty(o)) return o; + } + return {}; +}; +export { + _t as $, + Gn as A, + St as B, + or as C, + Ye as D, + lr as E, + Be as F, + sr as G, + aa as H, + xt as I, + cr as J, + dr as K, + wa as L, + Pt as M, + ya as N, + gn as O, + ga as P, + pa as Q, + en as R, + ma as S, + ha as T, + ur as U, + yt as V, + P as W, + Jn as X, + Sa as Y, + K as Z, + We as _, + tn as a, + J as a0, + _ as a1, + Za as a2, + er as a3, + tr as a4, + Q as a5, + $t as a6, + Va as a7, + F as a8, + Kt as a9, + Oe as aa, + Ce as ab, + le as ac, + Oa as ad, + La as ae, + ja as af, + sn as b, + cn as c, + ir as d, + on as e, + ln as f, + Yt as g, + Zn as h, + vt as i, + nn as j, + an as k, + rn as l, + kt as m, + we as n, + na as o, + oa as p, + Yn as q, + st as r, + Qn as s, + Y as t, + nr as u, + Kn as v, + ar as w, + rr as x, + gt as y, + _n as z +}; diff --git a/dist/components.js b/dist/components.js index 39128da..97764f0 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,4 +1,4 @@ -import { a2 as s, V as p, a3 as n, a4 as t, a1 as d } from "./common/main-B9_aE5ZC.js"; +import { a2 as s, V as p, a3 as n, a4 as t, a1 as d } from "./common/main-Bklk3nwG.js"; export { s as Empty, p as Icon, diff --git a/dist/container.js b/dist/container.js index 744bbb6..bb7b7dd 100644 --- a/dist/container.js +++ b/dist/container.js @@ -1,4 +1,4 @@ -import { _ as o, a2 as s, a3 as p, a4 as t, $ as d, a1 as n, a0 as r, Z as u } from "./common/main-B9_aE5ZC.js"; +import { _ as o, a2 as s, a3 as p, a4 as t, $ as d, a1 as n, a0 as r, Z as u } from "./common/main-Bklk3nwG.js"; export { o as Context, s as Empty, diff --git a/dist/data-converter.js b/dist/data-converter.js index e6601c0..1acbb07 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-B9_aE5ZC.js"; +import { D as p } from "./common/main-Bklk3nwG.js"; export { p as default }; diff --git a/dist/data-list.js b/dist/data-list.js index 7b36c1a..9ef90a1 100644 --- a/dist/data-list.js +++ b/dist/data-list.js @@ -1,4 +1,4 @@ -import { p as t, n as e, i as r, l as o, q as i, m as l, k as u, o as D, j as L, s as n, h as m, v as p, A as C, x as b, y as k, z as F, w as c } from "./common/main-B9_aE5ZC.js"; +import { p as t, n as e, i as r, l as o, q as i, m as l, k as u, o as D, j as L, s as n, h as m, v as p, A as C, x as b, y as k, z as F, w as c } from "./common/main-Bklk3nwG.js"; export { t as DataListContent, e as DataListContext, diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index 8557fcc..4ec2a6f 100644 --- a/dist/data-list/utils.js +++ b/dist/data-list/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { b as a } from "../common/main-B9_aE5ZC.js"; +import { b as a } from "../common/main-Bklk3nwG.js"; export { a as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index 0dc4644..e875d6a 100644 --- a/dist/grid-layout-form.js +++ b/dist/grid-layout-form.js @@ -1,4 +1,4 @@ -import { M as s, O as r, N as u, L as o, T as t, S as d, U as m, Q as F, P as i } from "./common/main-B9_aE5ZC.js"; +import { M as s, O as r, N as u, L as o, T as t, S as d, U as m, Q as F, P as i } from "./common/main-Bklk3nwG.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 7c6207f..812068c 100644 --- a/dist/grid-layout-form/utils.js +++ b/dist/grid-layout-form/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { af as a } from "../common/main-B9_aE5ZC.js"; +import { af as a } from "../common/main-Bklk3nwG.js"; export { a as getOptionItemByValue }; diff --git a/dist/grid-layout.js b/dist/grid-layout.js index eb1f4f4..d216fe9 100644 --- a/dist/grid-layout.js +++ b/dist/grid-layout.js @@ -1,4 +1,4 @@ -import { c as d, d as e, H as i, G as t, e as u, f as o } from "./common/main-B9_aE5ZC.js"; +import { c as d, d as e, H as i, G as t, e as u, f as o } from "./common/main-Bklk3nwG.js"; export { d as GridLayout, e as GridLayoutWidget, diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index 48cf9fb..c260474 100644 --- a/dist/grid-layout/utils.js +++ b/dist/grid-layout/utils.js @@ -1,4 +1,4 @@ -import { a as t } from "../common/main-B9_aE5ZC.js"; +import { a as t } from "../common/main-Bklk3nwG.js"; export { t as getBoxStyle }; diff --git a/dist/hooks.js b/dist/hooks.js index 308b389..a6e7804 100644 --- a/dist/hooks.js +++ b/dist/hooks.js @@ -1,7 +1,7 @@ import "lodash"; import "rc-field-form"; import "react"; -import { I as r, F as o, J as p, C as f, E as i, K as m, B as c } from "./common/main-B9_aE5ZC.js"; +import { I as r, F as o, J as p, C as f, E as i, K as m, B as c } from "./common/main-Bklk3nwG.js"; import { default as E } from "rc-util/lib/hooks/useMergedState"; export { r as useDeepEffect, diff --git a/dist/iconfont.js b/dist/iconfont.js index 58d464c..b6f9474 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 { V as a } from "./common/main-B9_aE5ZC.js"; +import { V as a } from "./common/main-Bklk3nwG.js"; export { a as default }; diff --git a/dist/index.js b/dist/index.js index 234d0be..2a1cd43 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -import { ad as t, ae as e, a9 as o, aa as n, a5 as p, ab as c, a8 as r, a7 as f, a6 as l, ac as u } from "./common/main-B9_aE5ZC.js"; +import { ad as t, ae as e, a9 as o, aa as n, a5 as p, ab as c, a8 as r, a7 as f, a6 as l, ac as u } from "./common/main-Bklk3nwG.js"; export { t as AppContext, e as AppGlobalParamsContext, diff --git a/dist/res-ws.js b/dist/res-ws.js index 239723c..05b5feb 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-B9_aE5ZC.js"; +import { R as a } from "./common/main-Bklk3nwG.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index 39e0dff..5f265a6 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { g as r, r as i, t as s, u as o } from "./common/main-B9_aE5ZC.js"; +import { g as r, r as i, t as s, u as o } from "./common/main-Bklk3nwG.js"; export { r as getWidgetPropsData, i as replaceKeys, diff --git a/package.json b/package.json index e613f8a..90489bb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.4.37", + "version": "0.4.38", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js",