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