diff --git a/dist/button.js b/dist/button.js index 6700dee..0b96361 100644 --- a/dist/button.js +++ b/dist/button.js @@ -1,4 +1,4 @@ -import { ak as s, aj as u, al as e } from "./common/main-Cf8W-zss.js"; +import { ak as s, aj as u, al as e } from "./common/main-DOuFUIVr.js"; export { s as auth, u as default, diff --git a/dist/common/main-Cf8W-zss.js b/dist/common/main-Cf8W-zss.js deleted file mode 100644 index 312bbb6..0000000 --- a/dist/common/main-Cf8W-zss.js +++ /dev/null @@ -1,1492 +0,0 @@ -var an = Object.defineProperty; -var ri = (t) => { - throw TypeError(t); -}; -var on = (t, e, i) => e in t ? an(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i; -var N = (t, e, i) => on(t, typeof e != "symbol" ? e + "" : e, i), ai = (t, e, i) => e.has(t) || ri("Cannot " + i); -var c = (t, e, i) => (ai(t, e, "read from private field"), i ? i.call(t) : e.get(t)), v = (t, e, i) => e.has(t) ? ri("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), W = (t, e, i, n) => (ai(t, e, "write to private field"), n ? n.call(t, i) : e.set(t, i), i); -var oi = (t, e, i, n) => ({ - set _(r) { - W(t, e, r, i); - }, - get _() { - return c(t, e, n); - } -}); -import { jsx as h, jsxs as A } from "react/jsx-runtime"; -import E, { useEffect as V, useState as j, useCallback as X, useRef as K, useContext as le, useMemo as _, useId as jt, isValidElement as sn, useLayoutEffect as ln } from "react"; -import de from "pathe"; -import b from "prop-types"; -import O from "classnames"; -import * as si from "react-is"; -import { useNotification as cn } from "rc-notification"; -import m from "lodash"; -import ie, { Field as Jt, FieldContext as Ci } from "rc-field-form"; -import { M as Rt, N as Je, a as Ae, s as It, b as dn, S as un } from "./vender-BkiRbACr.js"; -import ki from "immutability-helper"; -import { Space as pn, Form as ft, Input as gn, Button as wt, Pagination as hn, Tree as mn, Breadcrumb as fn, Empty as Vt, Table as yn, Popover as wn, Popconfirm as bn, Tooltip as Cn } from "antd"; -import { useMergedState as kn } from "rc-util"; -import { generatePath as $n, useInRouterContext as $i, useParams as En, useLocation as Sn, createBrowserRouter as vn, Navigate as xn } from "react-router-dom"; -import "rc-util/lib/hooks/useMergedState"; -import Nn from "rc-drawer"; -import Pn from "rc-dialog"; -var ze, Ye, We, be, Le, je; -class Ei { - constructor(e, i) { - v(this, ze, /* @__PURE__ */ new Map()); - v(this, Ye, !0); - v(this, We, []); - v(this, be); - v(this, Le, () => c(this, be)); - v(this, je, () => Promise.resolve()); - N(this, "get", (...e) => new Promise((i, n) => { - const r = JSON.stringify(e); - if (c(this, ze).has(r)) return i(c(this, je).call(this, c(this, be), ...e)); - if (c(this, be) === void 0) c(this, We).push([e, i, n]), c(this, Ye) && (W(this, Ye, !1), Promise.resolve(typeof c(this, Le) == "function" ? c(this, Le).call(this) : c(this, Le)).then((a) => W(this, be, a || null)).finally(() => { - c(this, We).forEach(([a, o, s]) => { - try { - const l = c(this, je).call(this, c(this, be), ...a); - c(this, ze).set(JSON.stringify(a), l), o(l); - } catch (l) { - s(l); - } - }), c(this, We).length = 0; - })); - else { - const a = c(this, je).call(this, c(this, be), ...e); - c(this, ze).set(r, a), i(a); - } - })); - W(this, je, i), W(this, Le, e); - } -} -ze = new WeakMap(), Ye = new WeakMap(), We = new WeakMap(), be = new WeakMap(), Le = new WeakMap(), je = new WeakMap(); -const Yr = () => h("div", { children: "Empty" }), st = E.createContext({ ele: {}, mount: () => { -}, unmount: () => { -} }), Y = ({ rootClassName: t, className: e, children: i, actions: n, title: r, subTitle: a, extras: o, style: s = {} }) => { - const { mount: l, unmount: u } = E.useContext(st); - return Y.Action({ children: n }), Y.Title({ children: r }), Y.SubTitle({ children: a }), Y.Extra({ children: o }), V(() => (l("rootClassName", t), () => u(t)), [t]), h("div", { className: O("ff-container", e), style: s, children: i }); -}, mt = (t) => ({ children: e, className: i }) => { - const { mount: n, unmount: r } = E.useContext(st); - return V(() => (e && n(t, E.createElement("div", { key: `ff-${t}`, className: O(`ff-popup-${t}`, i) }, e)), () => r(t)), [i, e]), null; -}; -Y.Action = mt("actions"), Y.Title = mt("title"), Y.SubTitle = mt("sub-title"), Y.Extra = mt("extras"), Y.propTypes = { className: b.string, style: b.object, title: b.any, subTitle: b.any, actions: b.any, extras: b.any }; -const Xr = () => h(Y, { className: "ff-loading", children: A("div", { className: "loader", children: [A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] })] }) }), Qr = () => h("div", { children: "NotFound" }), Si = ({ children: t }) => { - const [e, i] = j({}), n = X((a, o) => i((s) => ({ ...s, [a]: o })), []), r = X((a) => i((o) => ({ ...o, [a]: void 0 })), []); - return typeof (t == null ? void 0 : t.type) == "string" ? t : h(st.Provider, { value: { ele: e, mount: n, unmount: r }, children: E.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); -}; -Si.propTypes = { children: b.element.isRequired }; -const li = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, Gt = ({ type: t, props: e }) => h("i", { ...e, children: h("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (li[t] || li.info).map((i, n) => h("path", { d: i }, n)) }) }), vi = ({ className: t, content: e, icon: i, $close: n }) => A(E.Fragment, { children: [i && h("div", { className: O("ff-notification-icon", t), children: h(Gt, { type: i }) }), e] }), Tn = ({}) => h(Y, { children: "Confirm" }); -var Se, Be; -const ue = class ue { - constructor() { - v(this, Be, /* @__PURE__ */ new Map()); - N(this, "init", (e) => W(this, Be, new Map(e))); - N(this, "check", (e) => !c(this, Be).has(e) || c(this, Be).get(e)); - if (c(ue, Se)) return c(ue, Se); - } -}; -Se = new WeakMap(), Be = new WeakMap(), v(ue, Se, null), N(ue, "getInstance", () => (c(ue, Se) || W(ue, Se, new ue()), c(ue, Se))); -let Mt = ue; -const xi = Mt.getInstance(), On = (t, e, i = "children") => { - if (m.isEmpty(t)) return {}; - const n = m.find(t, ["value", e]); - if (!m.isEmpty(n)) return n; - const r = t.length; - for (let a = 0; a < r; a++) { - const { [i]: o } = t[a], s = On(o, e, i); - if (!m.isEmpty(s)) return s; - } - return {}; -}, Ni = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; -var ve, Xe; -const pe = class pe { - constructor() { - v(this, Xe, null); - N(this, "init", (e) => W(this, Xe, e)); - N(this, "get", (e, i) => m.get(c(this, Xe), e, i)); - if (c(pe, ve)) return c(pe, ve); - } -}; -ve = new WeakMap(), Xe = new WeakMap(), v(pe, ve, null), N(pe, "getInstance", () => (c(pe, ve) || W(pe, ve, new pe()), c(pe, ve))); -let Dt = pe; -const Me = Dt.getInstance(), ci = { null2json: (t) => Object.create(), null2array: (t) => [], null2number: (t) => 0, null2bool: (t) => !1, null2string: (t) => "", null2integer: (t) => 0, null2float: (t) => 0, string2json: (t) => t ? JSON.parse(t) : "{}", string2array: (t) => t.substr(0, 1) === "[" && t.substr(-1) === "]" ? JSON.parse(t) : t.split(","), string2number: (t) => t == "" ? 0 : +t, string2integer: (t) => t == "" ? 0 : +t, string2float: (t) => t == "" ? 0 : +t, string2bool: (t) => { - switch (`${t}`.toLowerCase()) { - case "0": - case "false": - case "[]": - case "{}": - return !1; - } - return !!t; -}, string2string: (t) => t, json2json: (t) => t, json2array: (t) => t ? Object.values(t) : [], json2number: (t) => Object.keys(t).length, json2integer: (t) => Object.keys(t).length, json2float: (t) => Object.keys(t).length, json2bool: (t) => Object.keys(t).length > 0, json2string: (t) => t ? JSON.stringify(t) : "", array2json: (t) => ({ ...t }), array2array: (t) => t, array2number: (t) => t.length, array2integer: (t) => t.length, array2float: (t) => t.length, array2bool: (t) => t.length > 0, array2string: (t) => JSON.stringify(t), number2json: (t) => ({}), number2array: (t) => [t], number2number: (t) => t, number2integer: (t) => t, number2float: (t) => t, number2bool: (t) => !!t, number2string: (t) => t.toString(), boolean2json: (t) => ({}), boolean2array: (t) => [], boolean2number: (t) => +t, boolean2integer: (t) => +t, boolean2float: (t) => +t, boolean2bool: (t) => t, boolean2string: (t) => t ? "true" : "false" }, oe = (t, e) => { - let i = "string"; - i = Array.isArray(t) ? "array" : typeof t, m.isObject(t) && (i = "json"); - const n = `${i}2${e}`; - return Reflect.has(ci, n) ? ci[n](t) : t; -}, Rn = (t) => t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "json" : typeof t == "boolean" ? "bool" : typeof t == "string" ? "string" : typeof t == "number" ? Number.isInteger(t) ? "integer" : "float" : typeof t, lt = (t = {}, e = {}, i = {}, n = "") => Pi(t, (r, a) => a === "type" && r === "code") ? Ti(t, e, i, n) : Oi(t, e, n), Pi = (t, e = () => !1) => m.some(t, (i) => !!m.some(i, e) || (m.isEmpty(i) || !m.isPlainObject(i) && !m.isArray(i) ? void 0 : Pi(i, e))), Ti = async (t = {}, e = {}, i = {}, n = "") => { - let r = /* @__PURE__ */ Object.create(null); - for (let a in t) { - let o; - if (Reflect.has(t[a], "type") && ["code", "field", "router", "query", "string"].includes(t[a].type)) { - const { type: s, value: l = "", default: u = n } = t[a]; - switch (s) { - case "code": - try { - o = await Fe.exec(l, e, i); - } catch (d) { - console.error("getWidgetPropsData", d); - } - break; - case "field": - o = m.get(e, l) ?? m.get(e, l.substring(l.indexOf(".") + 1)); - break; - case "router": - case "query": - o = Ee.getPageParams(l); - break; - case "string": - o = l; - } - o ?? (o = u); - } else o = await Ti(t[a], e, i, n); - m.set(r, a, o); - } - return r; -}, Oi = (t = {}, e = {}, i = "") => Object.keys(t || {}).reduce((n, r) => { - if (m.isPlainObject(t[r])) { - let a; - if (Reflect.has(t[r], "type") && ["field", "router", "query", "string"].includes(t[r].type)) { - const { type: o, value: s = "", default: l = i } = t[r]; - switch (o) { - case "field": - a = m.get(e, s) ?? m.get(e, s.substring(s.indexOf(".") + 1)); - break; - case "router": - case "query": - a = Ee.getPageParams(s); - break; - case "string": - a = s; - } - a ?? (a = l); - } else a = Oi(t[r], e, i); - m.set(n, r, a); - } - return n; -}, {}), Ft = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((i) => Ft(i, e)) : Object.keys(t).reduce((i, n) => (e[n] ? i[e[n]] = Ft(t[n], e) : i[n] = Ft(t[n], e), i), {}) : t, Zr = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { - const e = 16 * Math.random() | 0; - return (t === "x" ? e : 3 & e | 8).toString(16); -}), ea = (t) => { - var e, i; - return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.name : ""; -}, ta = (t) => { - var e, i; - return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.category : ""; -}, ia = (t) => { - var e, i; - return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.owner : ""; -}, Fn = (t, e = 32, i = "auto") => { - const n = zt(t), r = i === "auto" ? "x64" : i; - if (e === 32) return Rt.x86.hash32(n).toString(); - if (e === 128) return r === "x64" ? Rt.x64.hash128(n) : Rt.x86.hash128(n); - throw new Error("bits 只能是 32 或 128"); -}, zt = (t) => t == null ? "null" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "function" ? t.toString() : Array.isArray(t) ? "[" + t.map(zt).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${zt(t[e])}`).join(",") + "}" : String(t), An = () => { - let t = 1; - const e = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Map(); - return (...n) => n.length === 0 ? "" : n.map((r) => { - return String((a = r) === null || typeof a != "object" && typeof a != "function" ? (i.has(a) || i.set(a, t++), i.get(a)) : (e.has(a) || e.set(a, t++), e.get(a))); - var a; - }).join("::"); -}, Ln = (t) => { - if (!t || typeof t != "string" || t.startsWith("/") || t.startsWith("./") || t.startsWith("../")) return !1; - try { - let e = t.startsWith("//") ? `http:${t}` : t; - return e.includes("://") || e.startsWith("//") || (e = `http://${e}`), !!new URL(e).hostname; - } catch { - return !1; - } -}, na = (t, e = "") => { - if (!t || typeof t != "string" || Ln(t)) return t; - let i = e; - return !i && typeof window < "u" && window.location && (i = `${window.location.protocol}//${window.location.host}`), t.startsWith("/") ? i ? `${i}${t}` : t : i ? `${i}/${t}` : t; -}; -var kt, Qe, Ze, $t; -const Et = class Et { - constructor(...e) { - v(this, Qe, []); - v(this, Ze, (e) => { - var i; - for (let n of e) Array.isArray(n[0]) ? c(this, Ze).call(this, n) : c(this, Qe).push(c(i = Et, kt).call(i, n[0], n[1])); - }); - N(this, "toValue", async (e, i = null) => { - const n = { getValue: () => e, getRecord: () => i }; - let r = e; - for (const a of c(this, Qe)) try { - const o = await a; - if (typeof o != "function") { - console.warn("middleware is not a function, skip:", o); - continue; - } - r = await o.call(n, r); - } catch (o) { - console.error("middleware error, skip:", o); - } - return r; - }); - N(this, "toRender", (e, i, n = null) => E.createElement(c(this, $t), { value: e, record: i }, n)); - v(this, $t, ({ value: e, record: i, children: n }) => { - const [r, a] = j(n); - return dt(() => { - let o = !1; - return a(n), this.toValue(e, i).then((s) => !o && a(s)).catch((s) => !o && a(`${s}`)), () => o = !0; - }, [e, i]), r; - }); - c(this, Ze).call(this, e); - } -}; -kt = new WeakMap(), Qe = new WeakMap(), Ze = new WeakMap(), $t = new WeakMap(), v(Et, kt, m.memoize((e, i) => { - if (typeof e == "function") return e(i); - if (typeof e == "string") return se.getWidgetComponent(e).then((n) => { - var r; - return ((r = n.default) == null ? void 0 : r.call(n, i)) || ((a) => a); - }); - throw new TypeError("middleware must be a string or a function"); -}, An())); -let bt = Et; -const ne = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { -}, onReload: () => { -}, onClickCallback: () => { -}, onConditionChange: () => { -}, onTabChange: () => { -}, onSiderChange: () => { -}, onKeywordChange: () => { -}, onPageChange: () => { -}, onPageSizeChange: () => { -}, reload: () => { -}, setPage: () => { -}, setPageSize: () => { -}, setTab: () => { -}, setSider: () => { -}, setKeyword: () => { -}, setCondition: () => { -} }), di = ({ className: t, record: e, column: i, ...n }) => { - if (i != null && i.editableByJs && (i != null && i.uuid)) { - const { formSetting: r = { primaryKey: "id" }, widgetSetting: a = {}, widgetContainerSetting: o = {} } = (i == null ? void 0 : i.editableByJsSetting) || {}; - return h(P.Popover, { widget: jn, widgetData: { record: e, column: i }, widgetSetting: { widgetSetting: a, formSetting: r }, widgetContainerProps: { title: i != null && i.title ? `${i.title} - 编辑` : "编辑", ...o, width: (o == null ? void 0 : o.width) || 260, arrow: !0 }, children: h("td", { className: O("ff-data-list-cell-editable", t), ...n }) }); - } - return h("td", { className: t, ...n }); -}, jn = ({ record: t, column: e, $close: i, $setting: n }) => { - const r = K(Rn(m.get(t, e == null ? void 0 : e.dataIndex))), { listCode: a, onClickCallback: o } = le(ne), [s] = ie.useForm(), { formSetting: l, widgetSetting: u } = n, d = (l == null ? void 0 : l.primaryKey) || "id", p = () => { - s.setFieldsValue({ value: m.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); - }; - return dt(() => p(), [t, e == null ? void 0 : e.dataIndex, a]), h(Y, { actions: A(E.Fragment, { children: [h(P, { size: "small", onClick: p, children: "重置" }), A(pn.Compact, { block: !0, children: [h(P, { size: "small", widget: i, children: "取消" }), h(P, { type: "primary", size: "small", widget: () => s.validateFields().then(({ value: f }) => { - const g = m.get(t, d.substring(d.indexOf(".") + 1)); - if (!g) throw "获取更新主键失败!"; - I.put(`/api/${a}-storeBy-${e == null ? void 0 : e.uuid}/${g}`, { value: f }).msg(() => o(2, t)).then(i); - }).catch(console.warn), children: "保存" })] })] }), children: A(ie, { form: s, children: [h(Qt, { label: "", type: r.current, code: "value", widget: e == null ? void 0 : e.editableByJs, extras: u }), h(Jt, { noStyle: !0, name: ["__PROPS__"], children: () => { - } })] }) }); -}, In = (t) => function(e) { - return t(e, getRecord()); -}, Vn = (t, e = {}) => _(() => { - var i; - return (i = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : i.map(({ widgetByJs: n, widgetByJsSetting: r, ...a }, o) => { - const s = (u) => ({ record: u, column: a }); - let l = []; - return n && l.push([n, r]), l.length > 0 ? (a != null && a.render && l.push([In, a.render]), { ...a, onCell: s, render: (u, d) => new bt(l).toRender(u, d, "-") }) : { ...a, onCell: s }; - }); -}, [t, e]), Mn = (t = {}) => _(() => { - var e; - return t.body ?? (t.body = { cell: di }), (e = t.body).cell ?? (e.cell = di), t; -}, [t]), ra = (t) => { - const [e, i] = j({}); - return V(() => { - let n = !1; - return t && I.get(`/api/_/${t}`).then((r) => m.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig"])).then((r) => !n && i(r)), () => n = !0; - }, [t]), e; -}, aa = (t, e = {}) => { - const [i, n] = j({ dataSource: [] }); - return ct(() => { - let r = !1; - return t && I.get(`/api/${t}/${I.encode({ page: 1, ...e })}`).then((a) => !r && n(a)), () => r = !0; - }, [t, e]), i; -}, Ri = (t = [], e = /* @__PURE__ */ new Map(), i = "id", n) => { - const r = X(n ? (a) => m.get(a, i, m.get(a, [n, i])) : (a) => m.get(a, i), [i, n]); - return X((a) => t == null ? void 0 : t.filter((o) => !o.uuid || !e.has(o.uuid) || e.get(o.uuid).some((s) => s == r(a))), [t, e, r]); -}, Wt = (t = [], e = /* @__PURE__ */ new Map(), i = [], n = "id", r) => { - const a = X(r ? (o) => m.get(o, n, m.get(o, [r, n])) : (o) => m.get(o, n), [n, r]); - return _(() => { - if (m.isEmpty(t) || !t.some(({ uuid: s }) => xi.check(s))) return !1; - if (m.isEmpty(e) || m.isEmpty(i)) return !0; - const o = i.map((s) => a(s)); - return t.some(({ uuid: s }) => !s || !e.has(s) || e.get(s).some((l) => o.some((u) => u == l))); - }, [t, i, e, a]); -}, Dn = (t, e, i = "id", n = null) => { - const r = Nt(), a = K(!1), o = K(t.dataSource), s = K(t.itemOperationsAccess); - return V(() => (o.current = t.dataSource, s.current = t.itemOperationsAccess, () => a.current = !1), [t.dataSource, t.itemOperationsAccess]), a.current && (t.dataSource = o.current, t.itemOperationsAccess = s.current), [t, (l = 0, u = null) => { - var d, p; - if (a.current = !1, l === 1) return (d = t.onReload) == null ? void 0 : d.call(t); - if (l === 2) { - const f = m.get(u, "__PARENT_ID__", ""), g = m.get(u, i, m.get(u, [n, i], "")), y = m.findIndex(o.current, ["__PARENT_ID__", f]), w = m.findIndex(y > -1 ? m.get(o.current, [y, "children"]) : o.current, [i, g]); - if (w === -1) return (p = t.onReload) == null ? void 0 : p.call(t); - Promise.all([I.get(`/api/${e}/detail/${g}`), I.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([C, k]) => { - const S = m.get(o.current, y > -1 ? [y, "children", w, "children"] : [w, "children"]); - o.current = ki(o.current, y > -1 ? { [y]: { children: { $splice: [[w, 1, { ...C, children: S }]] } } } : { $splice: [[w, 1, { ...C, children: S }]] }); - const $ = new Map(k); - s.current.forEach((T, F) => { - var L; - (L = $.get(F)) != null && L.some((D) => D == g) || s.current.set(F, T.filter((D) => D !== g)); - }), $.forEach((T, F) => { - s.current.has(F) ? s.current.set(F, m.uniq([...s.current.get(F) || [], ...T])) : s.current.set(F, T); - }); - }).then(() => { - a.current = !0, r(); - }); - } - }]; -}, zn = (t, e) => { - const i = Nt(), n = K(e), r = K(/* @__PURE__ */ new Map()), a = K([]), o = m.throttle((l) => { - a.current = [], I.list(t, m.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: u, condition: d, total: p, tab: f, sider: g, page: y, pageSize: w, operationsAccess: C, dataSource: k }) => { - n.current = { tab: f, condition: d, sider: g, keyword: u, total: p, pageSize: w, page: k != null && k.length ? y : 1 }, a.current = k, r.current = new Map(C), i(); - }); - }, 380, { leading: !1, trailing: !0 }); - dt(() => { - a.current = [], t && o(e); - }, [t, e]); - const s = _(() => m.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [n.current]); - return Object.assign(s, { onTabChange: (l) => o({ tab: l, page: 1 }), onPageChange: (l, u) => o({ page: l, pageSize: u }), onPageSizeChange: (l) => o({ pageSize: l, page: 1 }), onConditionChange: (l, u) => o({ keyword: u, condition: ki(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => o({ sider: l, page: 1 }), onKeywordChange: (l) => o({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: a.current, onReload: o, payload: e == null ? void 0 : e.payload }); -}, Wn = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: d, primaryKey: p, title: f, itemGridLayout: g, $setting: y, tabs: w, isConditionFormLayout: C, isTreeSider: k, treeSiderConfig: S }) => { - const { classNames: $, onClickCallback: T } = le(ne), F = m.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style"]), L = Ri(l, u, p, d), D = X((U, R, M) => h(Bn, { className: O("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: a ? L(R) : [], data: d ? { [d]: R } : R, children: U, onClickCallback: T }), [d, p, a, T, l, u]); - return A("div", { className: O("ff-data-list-framework", e), children: [h(i.sider, { isTreeSider: k, ...S }), A("div", { className: O("ff-data-list-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: C }), h(i.toolbar, { title: f, tabs: w }), h(ir, { ...F, ...g, empty: h(i.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: D, dataSource: n }), h(i.footer, { isPaginate: r, isOperations: o, operations: s })] })] }); -}, Bn = ({ className: t, operations: e, children: i, data: n, onClickCallback: r }) => A("div", { className: O("data-list-grid-layout-item", t), children: [h("div", { className: "data-list-grid-layout-item-container", children: i }), !!(e != null && e.length) && h("div", { className: "data-list-grid-layout-item-actions", children: e.map((a) => h("span", { className: "data-list-grid-layout-item-action", children: h(P.Link, { uuid: a.uuid, type: a.type, name: a.name, widget: a.widget, widgetType: a.widgetType, widgetProps: a.widgetProps, widgetSetting: a.widgetSetting, widgetContainerProps: a.widgetContainerSetting, data: n, confirm: a.confirm, onAfterClick: (o) => o !== !1 && (r == null ? void 0 : r(a.isRefresh, n)) }, a.uuid || jt()) }, (a == null ? void 0 : a.uuid) || jt())) })] }), Un = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: d, primaryKey: p, title: f, tabs: g, isPaginate: y, isTreeSider: w, treeSiderConfig: C, isConditionFormLayout: k, ...S }) => { - const { classNames: $, onClickCallback: T } = le(ne), F = Ri(l, u, p, d), L = Wt(l, u, n, p, d); - return A("div", { className: O("ff-data-table-framework", e), children: [h(i.sider, { isTreeSider: w, ...C }), A("div", { className: O("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: k }), h(i.toolbar, { title: f, tabs: g }), h(Yn, { ...S, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: n, operationRender: L ? (D) => { - var U; - return h("div", { className: "ff-data-table-actions", children: (U = F(D)) == null ? void 0 : U.map((R, M) => h(P.Link, { size: "small", uuid: R.uuid, type: R.type, name: R.name, widget: R.widget, widgetType: R.widgetType, widgetProps: R.widgetProps, widgetData: R.widgetData, widgetSetting: R.widgetSetting, widgetContainerProps: R.widgetContainerSetting, data: D, confirm: R.confirm, onAfterClick: (x) => x !== !1 && (T == null ? void 0 : T(R.isRefresh, D)) }, R.uuid || M)) }); - } : null }), h(i.footer, { isPaginate: y, isOperations: o, operations: s })] })] }); -}, Yt = (t = [], e, i = null) => { - var n; - return (n = m.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: a, y: o, w: s, h: l, field: { boxStyle: u, ...d } = {} }, p) => h("div", { className: "grid-layout-item", style: Fi(a, o, s, l, u), children: h(e, { ...d, basicForm: i }) }, r ?? p)); -}, Fi = (t, e, i, n, r = {}, a = 0) => { - const o = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; - return r != null && r.autoHeight ? o.height = "fit-content" : o["--grid-layout-row"] = `${n}`, r != null && r.alignItems && (o["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (o["--grid-layout-box-justify-content"] = r.justifyContent), o["--grid-layout-box-margin"] = ui(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), o["--grid-layout-box-padding"] = ui(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), a && (o.height = `${a}px`), o; -}, ui = (t, e, i, n) => `${t || 0}px ${e || 0}px ${i || 0}px ${n || 0}px`, oa = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, Ai = (t) => Object.keys(t).reduce((e, i) => (/^on[A-Z]/.test(i) && (e[i] = t[i]), e), {}), Li = ({ className: t, isConditionFormLayout: e }) => { - var f, g; - const [i, n] = j({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = E.useContext(ne), { keyword: u, condition: d } = (s == null ? void 0 : s()) || {}, [p] = ft.useForm(); - return V(() => { - r && e && I.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: y, marginX: w, marginY: C, rowHeight: k, cols: S, fields: $ }) => { - n({ resource: y, itemMargin: [w, C], rowHeight: k, cols: S, fields: $ }); - }).catch(() => n({})); - }, [r, e]), V(() => { - p.setFieldsValue({ keyword: u, ...d }); - }, [JSON.stringify([u, d])]), h("div", { className: O("ff-data-list-filter", l.filter, t), children: h(ft, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((f = i.fields) == null ? void 0 : f.length) > 1 ? (y) => o({ [i.resource]: y[i.resource] }, y.keyword) : () => { - }, onValuesChange: (y) => { - m.isEmpty(m.omit(y, ["keyword"])) || p.submit(); - }, children: ((g = i.fields) == null ? void 0 : g.length) > 1 ? h(Zt, { ...i, children: h(qn, { onReset: () => { - const { keyword: y, condition: w } = s("init") || {}; - p.setFieldsValue({ keyword: y, ...w }); - } }) }) : h("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: h("div", { className: "grid-layout-item", style: Fi(20, 0, 5, 2), children: h(ft.Item, { name: ["keyword"], children: h(gn.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (y) => a(y) }) }) }) }) }) }); -}, qn = ({ cols: t, fields: e, onReset: i }) => { - const [n, r] = j(!1), a = _(() => e == null ? void 0 : e.toReversed().some((o) => o.y > 1 || o.x + o.w >= t - 5), [t, e]); - return A(ft.Item, { label: " ", style: { "--item-span": 5 }, className: O("ff-data-list-filter-actions", { expanded: n }), children: [h(wt, { onClick: i, children: "重置" }), h(wt, { type: "primary", htmlType: "submit", children: "查询" }), a && h(P.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((o) => !o), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); -}; -Li.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 _n = ({ className: t, operations: e, isOperations: i, isPaginate: n }) => { - const { onPageChange: r, onPageSizeChange: a, onClickCallback: o, getBase62params: s } = E.useContext(ne), { total: l, page: u, pageSize: d } = (s == null ? void 0 : s()) || {}; - return i && !m.isEmpty(e) || n ? A("div", { className: O("ff-data-list-footer", t), children: [h("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, f) => h(P, { uuid: p.uuid, type: p.type, name: p.name, widget: p.widget, widgetType: p.widgetType, widgetProps: p.widgetProps, widgetData: p.widgetData, widgetSetting: p.widgetSetting, widgetContainerProps: p.widgetContainerSetting, onAfterClick: (g) => g !== !1 && (o == null ? void 0 : o(p.isRefresh, null)) }, p.uuid || f)) }), n && h(hn, { size: "small", total: l, pageSize: d, showSizeChanger: !1, showTotal: (p) => `第 ${u} 页 / 总共 ${p} 条`, onChange: r, onShowSizeChange: a })] }) : null; -}, Kn = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: h("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], Hn = ({ className: t, width: e = 280, isTreeSider: i }) => { - const { classNames: n } = le(ne); - return i ? h(mn.DirectoryTree, { className: O("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: Kn }) : null; -}, Jn = ({ className: t, title: e, tabs: i }) => { - const { getBase62params: n, onTabChange: r, onReload: a, classNames: o } = le(ne), { tab: s } = (n == null ? void 0 : n()) || {}, [l, u] = kn((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: r }); - return A("div", { className: O("ff-data-list-toolbar", o.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(fn, { className: "ff-data-list-tabs", itemRender: ({ label: d, code: p, value: f }) => h("span", { onClick: () => u(f ?? p), className: O("ff-data-list-tab", { active: (f ?? p) == l }), children: d }), items: i }), A("div", { className: "ff-data-list-actions", children: [h(P.Link, { icon: "icon-reload", widget: () => a() }), h(P.Link, { icon: "icon-setting" })] })] }); -}, Gn = ({ className: t, ...e }) => h(Vt, { className: O(t, "ff-data-list-empty"), image: Vt.PRESENTED_IMAGE_SIMPLE, ...e }), ji = ({ isItemGridLayout: t, theme: e, themeProps: i, onClickCallback: n, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: u = 30, onPageSizeChange: d, tab: p, onTabChange: f, keyword: g, onKeywordChange: y, condition: w, onConditionChange: C, sider: k, onSiderChange: S, layouts: $, classNames: T = {}, payload: F = {}, ...L }) => { - const [D, U] = j(), R = X((x, B) => { - const z = { tab: p, page: s, pageSize: u, keyword: g, sider: k, condition: w, total: o, payload: F }; - return x && x != "init" ? m.get(z, x, B) : z; - }, [JSON.stringify(w), JSON.stringify(F), p, s, u, g, k, o]), M = _(() => { - let x = { sider: Hn, filter: Li, footer: _n, toolbar: Jn, empty: Gn }; - $ === !1 ? x = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : m.isPlainObject($) && (x = Object.assign({}, x, $)); - for (const B in x) if (x[B]) { - if (sn(x[B])) { - const z = x[B]; - x[B] = (ce) => E.cloneElement(z, ce); - } - } else x[B] = () => h(E.Fragment, {}); - return x; - }, [$]); - return V(() => { - e ? se.getWidgetComponent(e).then((x) => { - if (!x) throw `${e} not found`; - return x; - }).catch((x) => ({ default: () => `${x}` })).then((x) => U(E.createElement(x.default, { ...L, layouts: M, $setting: i }))) : U(h(t ? Wn : Un, { ...L, layouts: M, $setting: i })); - }, [e, i]), h(ne.Provider, { value: { classNames: T, listCode: a, onClickCallback: n, onReload: r, getBase62params: R, onPageChange: l, onPageSizeChange: d, onTabChange: f, onSiderChange: S, onKeywordChange: y, onConditionChange: C, setPage: l, setPageSize: d, setTab: f, setSider: S, setKeyword: y, setCondition: C }, children: D && E.cloneElement(D, L) }); -}; -ji.propTypes = { classNames: b.exact({ sider: b.string, filter: b.string, footer: b.string, toolbar: b.string, container: b.string, content: b.string, item: b.string, empty: b.string }), layouts: b.oneOfType([b.exact({ sider: b.oneOfType([b.elementType, b.element]), filter: b.oneOfType([b.elementType, b.element]), footer: b.oneOfType([b.elementType, b.element]), toolbar: b.oneOfType([b.elementType, b.element]), empty: b.oneOfType([b.elementType, b.element]) }), b.bool]) }; -var xe, Ce, Ie, St; -const ge = class ge { - constructor() { - v(this, Ce, null); - v(this, Ie, /* @__PURE__ */ new Map()); - v(this, St, () => { - if (c(this, Ce)) return c(this, Ce).port.postMessage({ command: "status", data: [] }); - W(this, Ce, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), c(this, Ce).port.onmessage = (e) => { - var i, n; - (i = e.data) != null && i.uuid ? c(this, Ie).forEach((r, a) => { - var o; - (r == "*" || (o = r == null ? void 0 : r.includes) != null && o.call(r, e.data.uuid)) && a(e.data); - }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && I.get("/api/user-api-token").then(({ token: r, expire_at: a }) => { - c(this, Ce).port.postMessage({ command: "initWs", data: [`ws${m.trimStart(I.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); - }); - }, c(this, Ce).port.postMessage({ command: "status", data: [] }); - }); - N(this, "subscribe", (e, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", c(this, Ie).set(e, i), c(this, Ie).size == 1 && c(this, St).call(this), () => this.unsubscribe(e))); - N(this, "unsubscribe", (e) => c(this, Ie).delete(e)); - if (c(ge, xe)) return c(ge, xe); - } -}; -xe = new WeakMap(), Ce = new WeakMap(), Ie = new WeakMap(), St = new WeakMap(), v(ge, xe, null), N(ge, "getInstance", () => (c(ge, xe) || W(ge, xe, new ge()), c(ge, xe))); -let Bt = ge; -const Ii = Bt.getInstance(), Xt = E.forwardRef(({ listCode: t, base62params: e, className: i, theme: n, themeProps: r, layouts: a, classNames: o }, s) => { - const [{ resource: l, primaryKey: u, batchOperations: d = [], itemOperations: p = [], columns: f = [], themeConfig: g, theme: y, isConditionFormLayout: w = !1, isTreeSider: C, treeSiderConfig: k, isItemGridLayout: S, itemGridLayout: { themeConfig: $, ...T } = {}, title: F, isPaginate: L, tabs: D }, U] = j({ isItemGridLayout: !1, itemGridLayout: {} }), R = zn(t, e), [{ dataSource: M, itemOperationsAccess: x, condition: B, tab: z, keyword: ce, page: pt, total: gt, pageSize: Tt, sider: te, onConditionChange: Hi, onTabChange: Ji, onKeywordChange: Gi, onPageChange: Yi, onPageSizeChange: Xi, onSiderChange: Qi, onReload: Ot, payload: Zi }, ni] = Dn(R, t, u, l), en = Wt(p, x, M, u), tn = Wt(d); - V(() => { - let re = null; - return t && I.get(`/api/_/${t}`).resp(({ data: ht, res: rn }) => { - ht != null && ht.isDynamicRefresh && (re = Ii.subscribe(() => Ot(), rn)), U(ht); - }).catch(() => U({})), () => re == null ? void 0 : re(); - }, [t]), E.useImperativeHandle(s, () => ({ onReload: Ot, onClickCallback: ni })); - const nn = { listCode: t, title: F, classNames: o, layouts: a, resource: l, primaryKey: u, theme: n || y, themeProps: r || g, isTreeSider: C, treeSiderConfig: k, isPaginate: L, tabs: D, isItemOperations: en, itemOperations: p == null ? void 0 : p.map((re) => m.isEmpty(re == null ? void 0 : re.confirm) ? re : { ...re, confirm: Object.assign({}, re.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: tn, batchOperations: d, isItemGridLayout: S, columns: f, itemGridLayout: { ...T, themeProps: $ }, isConditionFormLayout: w, itemOperationsAccess: x, dataSource: M, onConditionChange: Hi, onTabChange: Ji, onKeywordChange: Gi, onPageChange: Yi, onPageSizeChange: Xi, onSiderChange: Qi, condition: B, tab: z, keyword: ce, page: pt, total: gt, pageSize: Tt, sider: te, payload: Zi }; - return h(ji, { ...nn, className: O("ff-data-list-helper", i), onReload: Ot, onClickCallback: ni }); -}), Vi = (t, e, i = !0) => i !== !0 && i-- <= 0 ? [] : m.isArray(t) && !m.isEmpty(t) ? t.reduce((n, r) => (Reflect.has(r, e) && Reflect.has(r, "children") && n.push(r[e]), Reflect.has(r, "children") && !m.isEmpty(r.children) ? n.concat(Vi(r.children, e, i)) : n), []) : [], Yn = ({ className: t, primaryKey: e, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: a = 180, components: o = {}, ...s }) => { - const { classNames: l } = le(ne), u = K(null), d = K(null), [p, f] = j([]), [g, y] = j({ width: 0, height: 0 }); - V(() => { - f(Vi(n, e)); - }, [n, e]), ln(() => { - const k = new ResizeObserver(() => { - var S; - y({ width: ((S = u.current) == null ? void 0 : S.nativeElement.querySelector(".ant-table-body").scrollWidth) || d.current.offsetWidth, height: d.current.offsetHeight }); - }); - return d.current && k.observe(d.current), () => { - d.current && k.unobserve(d.current); - }; - }, []); - const w = Vn(i), C = Mn(o); - return h("div", { ref: d, className: O("ff-data-list-table", l.content, t), children: g.height ? h(yn, { bordered: !0, ...s, components: C, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), columns: w == null ? void 0 : w.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / g.width * 100).toFixed(2)}%`, render: (k, S, $) => r(S, $) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: g.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: f, expandedRowKeys: p } }) : null }); -}, Xn = "RC_FORM_INTERNAL_HOOKS", Qn = (t) => { - const [e, i] = E.useState({ items: [] }); - return V(() => { - t && I.get(`/api/_/${t}`).then(({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: u, cols: d, rowHeight: p, fields: f, theme: g, themeSetting: y, groups: w }) => ({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: u, cols: d, rowHeight: p, theme: g, themeProps: y, groups: w, items: f })).then(i); - }, [t]), e; -}, Zn = (t, { initialValue: e, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: a = "string" }, o = null) => { - const s = K(!1), l = le(Ci), [u, d] = j(), [p, f] = j(i != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(Xn) || {}; - return V(() => g == null ? void 0 : g((y, w, C) => { - if (!s.current) return; - const k = m.get(w, t); - m.isEqual(k, p) || f(oe(k, a)); - }), [p]), V(() => { - i == "javascript" && e ? Fe.exec(e, {}, { getFieldValueForBasicForm: (y) => o ? o.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => f(oe(y, a))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => s.current = !0) : (e && f(oe(e ?? l.getFieldValue(t), a)), s.current = !0); - }, [e, i]), ct(() => { - s.current && n && new bt([n, r]).toValue(p, l.getFieldsValue(!0)).then(d).catch((y) => { - d(y), console.error("布局数据转换错误: ", y, n); - }); - }, [p, n, r]), [u ?? p, p]; -}, sa = (t, e, i = null) => _(() => Yt(t, e, i), [t]), Mi = (t, e, i = {}, n = {}, r = {}, a = null) => { - const o = le(Ci), s = Nt(), l = K(!0), u = K([]), [d, p] = j(e), [f, g] = j(), y = ie.useWatch((w) => JSON.stringify(m.pick(w, u.current)), o) || "{}"; - return dt(() => { - t && Fe.exec(t, i, { ...n, getFieldValueForBasicForm: (w) => r ? r.getFieldValue(w) : null, getFieldValue: m.wrap(o.getFieldValue, (w, C) => (u.current.some((k) => m.isEqual(k, C)) || (u.current.push(C), s()), w == null ? void 0 : w(C))), isFieldTouched: o.isFieldTouched, isFieldsTouched: o.isFieldsTouched }).then((w) => { - l.current && (p(w), g(null)); - }).catch((w) => { - l.current && (p(e), g(w)); - }); - }, [t, y, o, i, n]), V(() => () => l.current = !1, []), t ? [a ? oe(d, a) : d, f] : [a ? oe(e, a) : e, null]; -}, er = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: i, ...n }) => { - const r = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [a, o] = j(); - return V(() => { - r && se.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: tr(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => o(E.createElement(s.default, n))); - }, [r]), a; -}, tr = (t, e = {}, i = null) => (n) => { - const { code: r, label: a, extras: o, isVirtual: s, initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, value: f, ...g } = m.merge({}, e, n), [y, w] = Zn(s ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, i), C = _(() => { - const $ = Object.keys((e == null ? void 0 : e.extras) || {}); - return m.over([m.partialRight(m.pick, $), m.partialRight(m.omit, $)]); - }, [e == null ? void 0 : e.extras]), [k, S] = C(g); - return h(t, { ...S, value: y, rawValue: w, $setting: Object.assign({}, o, k) }); -}, Di = ({ theme: t, basicForm: e, items: i = [{ key: "default", label: "默认" }], fields: n = [], itemRender: r, chunks: a = [], children: o, $setting: s = {}, ...l }) => { - const [u, d] = j(); - V(() => { - t ? se.getWidgetComponent(t).then((f) => { - if (!(f != null && f.default)) throw "not found"; - return f; - }).catch((f) => ({ default: () => `${t} ${f}` })).then((f) => d(E.createElement(f.default, {}))) : d(null); - }, [t]); - const p = _(() => i == null ? void 0 : i.map((f) => ({ ...f, children: r(f, n == null ? void 0 : n.filter((g) => !(g != null && g.group) && f.key == "default" || g.group == f.key), f.key == "default" ? o : null) })).concat(a), [i, o, a]); - return u && E.cloneElement(u, { items: p, basicForm: e, $setting: { ...s, ...l } }); -}, zi = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: a = 12, rowHeight: o = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: u = {}, formFields: d = [], fields: p = [], data: f, theme: g, themeProps: y = {}, groups: w = [{ key: "default", label: "默认" }], children: C, ...k }) => { - const [S] = ie.useForm(e), $ = _(() => [{ name: "__PROPS__", value: u }].concat(d), [u, d]); - ct(() => (S.setFieldsValue(f), () => S.resetFields()), [f]); - const T = (F, L, D) => { - const U = Yt(L, er, i), R = Ai(k); - return A("div", { ...R, className: O("ff-grid-layout", r), style: { ...n, "--grid-layout-item-margin-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-item-margin-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-container-padding-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-container-padding-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [U, D && E.cloneElement(D, { cols: a, rowHeight: o, itemMargin: l, containerPadding: s, fields: L, basicForm: i })] }); - }; - return h(ie, { ...k, fields: $, form: S, component: !1, children: g ? h(Di, { ...y, items: w, theme: g, itemRender: T, fields: p, children: C, basicForm: i }) : T(0, p, C) }); -}, la = /* @__PURE__ */ ((t) => function({ code: e, data: i, ...n }) { - const { uuid: r, resource: a, items: o, hides: s, rowHeight: l, marginX: u, marginY: d, cols: p, theme: f, themeProps: g, groups: y } = Qn(e) || {}, w = _(() => [{ name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: r }], [e, r, a]); - return a && h(t, { name: e, theme: f, themeProps: g, groups: y, ...n, fields: o, formFields: w, rowHeight: l, cols: p, itemMargin: [u, d], data: a ? { [a]: i } : i }); -})(zi), ir = ({ column: t = 0, colWidth: e = 0, cols: i, rowHeight: n, itemMargin: r, fields: a, primaryKey: o, dataSource: s, beforeRender: l = null, afterRender: u = null, itemClassName: d, itemRender: p = (S, $, T) => S, empty: f = h(Vt, { description: null }), className: g, style: y = {}, theme: w, themeProps: C = {}, groups: k = [{ key: "default", label: "默认" }] }) => { - const { classNames: S } = le(ne), $ = _(() => h(zi, { groups: k, theme: w, themeProps: C, cols: i, rowHeight: n, itemMargin: r, fields: a, className: d }), [a, i, n, r, k, w, C]), T = m.isEmpty(s); - return A("div", { className: O("ff-data-list-content", S.content, g), style: Object.assign({}, y, t && { "--col-num": t }, e && { "--col-width": e }), children: [l == null ? void 0 : l(s), T ? f : s.map((F, L) => { - const D = p(E.cloneElement($, { data: F }), F, L); - return E.cloneElement(D, { key: `${(F == null ? void 0 : F[o]) ?? L}-${Fn(F)}` }); - }), u == null ? void 0 : u(s)] }); -}, nr = ({ component: t, $props: e }) => { - const { base62params: i } = lt(e, {}); - return h(Y, { children: h(Xt, { listCode: t, base62params: I.decode(i) }) }); -}, ca = () => h(Wi, {}), Wi = () => "Empty", rr = ({ component: t, $setting: e, $props: i }) => { - const [n, r] = j(); - V(() => { - if (!t) return r(h(Wi, { description: null })); - se.getWidgetComponent(t).catch((o) => ({ default: () => `${o}` })).then((o) => E.createElement(o.default, { $setting: e })).then(r); - }, [t]); - const a = lt(i, {}); - return n ? E.cloneElement(n, a) : null; -}, da = () => "NotFoundPage"; -var Ne, ae, Pe, Te, et, tt; -const he = class he { - constructor() { - v(this, ae, /* @__PURE__ */ new Map()); - v(this, Pe, {}); - v(this, Te, null); - N(this, "init", (e, i) => { - W(this, ae, e), W(this, Pe, i); - }); - N(this, "get", (e) => (c(this, ae).has(e) || (e = Array.from(c(this, ae).keys()).find((i) => c(this, ae).get(i).uri === e)), c(this, ae).get(e) || {})); - N(this, "redirect", (e, i, n = {}) => { - const { uri: r, type: a, widgetProps: o } = this.get(e) || {}, { router: s, query: l, ...u } = i || {}, d = Object.assign({}, u, s), p = Object.assign({}, u, l); - a == "list" && (d.base62params = I.encode(d != null && d.base62params ? d.base62params : d)); - let f = $n(r || e, d); - const g = new URLSearchParams(); - for (const y in o || {}) (o == null ? void 0 : o.type) == "query" && Object.has(p, y) && g.append(y, JSON.stringify(p[y])); - return g.size > 0 && (f = `${f}?${g.toString()}`), n != null && n.isOpenWindow ? window.open(f) : c(this, Te).navigate(f, { replace: !!(n != null && n.isReplaceRouteHistory) }); - }); - N(this, "getMenus", (e) => { - var i; - return ((i = c(this, Pe)) == null ? void 0 : i[e]) || []; - }); - N(this, "findMenuPathByUuid", (e) => { - let i = []; - for (const n in c(this, Pe)) if (i = c(this, et).call(this, c(this, Pe)[n], e, [n]), i.length > 1) return i; - return i; - }); - N(this, "getMenusByRouteUuid", (e) => c(this, tt).call(this, e, Object.values(c(this, Pe)).flat())); - v(this, et, (e, i, n = []) => { - if (m.isEmpty(e)) return n; - for (const { uuid: r, children: a } of e) { - if (r == i) return n.concat(r); - if (!m.isEmpty(a)) return n.concat(r, c(this, et).call(this, a, i)); - } - return n; - }); - v(this, tt, (e, i) => { - var r; - let n = []; - for (const a of i) a.widgetType == "redirect" && (a.uuid == e || a.widget == e ? n.push(a) : (r = a.children) != null && r.length && (n = n.concat(c(this, tt).call(this, e, a.children)))); - return n; - }); - N(this, "getCurrentMenu", () => { - const { uuid: e } = this.getCurrentRoute() || {}; - if (!e) return; - const i = this.getMenusByRouteUuid(e); - return m.isEmpty(i) ? void 0 : i[0]; - }); - N(this, "getCurrentRoute", (e = 0) => { - var n; - const i = (n = c(this, Te).state.matches[c(this, Te).state.matches.length - 1 - e]) == null ? void 0 : n.route; - if (!i) return null; - for (let [r, a] of c(this, ae)) if (a.uri === i.path) return a; - return null; - }); - N(this, "getPageParams", (e) => { - var r, a, o; - let i = "", n = {}; - if ($i()) n = En(), i = (r = Sn()) == null ? void 0 : r.search; - else { - const { location: s = {}, matches: l = [] } = ((a = c(this, Te)) == null ? void 0 : a.state) || {}; - n = ((o = l[l.length - 1]) == null ? void 0 : o.params) || {}, i = s.search; - } - return i && new URLSearchParams(i).forEach((s, l) => { - n[l] = s; - }), e ? m.get(n, e) : n; - }); - N(this, "createBrowserRouter", (e = {}) => { - if (c(this, ae).size == 0) return null; - const i = Me.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Me.get(se.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, a = (s, l) => () => Promise.all([se.getWidgetComponent(s), lt(l)]).then(([u, d]) => [u.default || function() { - return `${s}`; - }, d]).then(([u, d]) => ({ Component: () => E.createElement(Si, {}, E.createElement(u, { $setting: d })) })), o = Array.from(c(this, ae).values()).reduce((s, { uuid: l, uri: u, name: d, type: p, component: f, widgetSetting: g, widgetProps: y, isLogin: w, isLayout: C, extra: k }) => { - let S = {}, $ = 0; - switch (p) { - case "list": - S.element = E.createElement(nr, { component: f, $props: y }); - break; - case "fsdpf-component": - S.element = E.createElement(rr, { key: f, component: f, $setting: g, $props: y }); - } - const T = (k == null ? void 0 : k.theme) ?? (k == null ? void 0 : k.layout); - if (T) { - const F = (k == null ? void 0 : k.themeProps) ?? (k == null ? void 0 : k.layoutProps); - if (!r[T]) return r[T] = s.length, [...s, { path: "/", lazy: a(T, F), children: [{ path: u, ...S }] }]; - $ = r[T]; - } - return C && $ > -1 ? (s[$].children.push({ path: u, ...S }), s) : [...s, { path: u, ...S }]; - }, [{ path: "/", lazy: a(i, {}), children: [] }]); - return o.push({ index: !0, element: E.createElement(ar, { to: n, replace: !0 }) }), W(this, Te, vn(o, e)); - }); - if (c(he, Ne)) return c(he, Ne); - } -}; -Ne = new WeakMap(), ae = new WeakMap(), Pe = new WeakMap(), Te = new WeakMap(), et = new WeakMap(), tt = new WeakMap(), v(he, Ne, null), N(he, "getInstance", () => (c(he, Ne) || W(he, Ne, new he()), c(he, Ne))); -let Ut = he; -const ar = ({ to: t, replace: e }) => $i() ? E.createElement(xn, { to: t, replace: e }) : (window.document.location = t, "redirect"), Ee = Ut.getInstance(), De = new Worker(new URL("/ff-worker/index.js", self.location)), pi = { getConfigure: (t) => Me.get(t), route: { redirect: (...t) => Ee.redirect(...t), getPageParams: (...t) => Ee.getPageParams(...t), getCurrentRoute: () => Ee.getCurrentRoute() }, popup: { notification: (...t) => ee.notification(...t), success: (...t) => ee.success(...t), error: (...t) => ee.error(...t), form: (...t) => ee.form(...t), modal: (...t) => ee.modal(...t), confirm: (...t) => ee.confirm(...t) } }; -var vt, Ue, Oe; -const q = class q { - constructor() { - N(this, "exec", (e, i = {}, n = {}, r = "") => new Promise((a, o) => { - if (!/^(?!\s*(\/\/|\/\*|\*)).*?\S+/m.test(e)) return a(); - const s = oi(q, vt)._++; - c(q, Ue).set(s, n), q.mQueue.set(s, [a, o]), De.postMessage({ id: s, session: r, category: "eval", method: e, args: i }); - })); - N(this, "clear", (e) => De.postMessage({ session: e, category: "clear" })); - if (c(q, Oe)) return c(q, Oe); - Promise.resolve().then(() => Rr).then((e) => { - pi.http = e.http; - }), De.addEventListener("message", ({ data: { id: e, task_id: i, method: n, args: r, category: a, data: o, error: s, session: l } }) => { - if (a === "eval" && q.mQueue.has(e)) s !== null ? q.mQueue.get(e)[1](s) : q.mQueue.get(e)[0](o), c(q, Ue).delete(e), q.mQueue.delete(e); - else if (a === "util") try { - const u = m.get(pi, n.split("/")) || m.get(c(q, Ue).get(i), n.split("/")); - if (!m.isFunction(u)) throw `${n} not found`; - Promise.resolve(Reflect.apply(u, void 0, r)).then((d) => { - De.postMessage({ id: e, task_id: i, category: a, method: n, args: r, session: l, data: d, error: null }); - }).catch((d) => { - De.postMessage({ id: e, task_id: i, category: a, method: n, args: r, session: l, data: null, error: d }); - }); - } catch (u) { - De.postMessage({ id: e, task_id: i, category: a, method: n, args: r, session: l, data: null, error: u }); - } - }, !1); - } -}; -vt = new WeakMap(), Ue = new WeakMap(), Oe = new WeakMap(), N(q, "mQueue", /* @__PURE__ */ new Map()), v(q, vt, 0), v(q, Ue, /* @__PURE__ */ new Map()), v(q, Oe, null), N(q, "getInstance", () => (c(q, Oe) || W(q, Oe, new q()), c(q, Oe))); -let qt = q; -const Fe = qt.getInstance(), Nt = () => { - const t = K(!0), [, e] = E.useReducer((i) => i + 1, 0); - return V(() => () => t.current = !1, []), () => t.current && e(); -}, ua = (t) => { - const e = K(); - return V(() => { - e.current = t; - }, [t]), e.current; -}, pa = (t) => { - const [e, i] = j(t), n = K(null), r = X((a, o) => { - n.current = o, i(a); - }, []); - return V(() => { - n.current && (n.current(e), n.current = null); - }, [e]), [e, r]; -}, ct = (t = (n) => { -}, e, i = m.isEqual) => { - const n = E.useRef(); - i(e, n.current) || (n.current = m.cloneDeep(e)), E.useEffect(t, [n.current]); -}, dt = ct, Bi = (t, e = "string") => { - var i; - if (!Array.isArray(t)) return t; - for (let n = 0; n < t.length; n++) t[n].value = oe((i = t[n]) == null ? void 0 : i.value, e), t[n] && Reflect.has(t[n], "children") && (t[n].children = Bi(t[n].children, e)); - return t; -}, ga = (t, e = "json", i = "string", n, r = null) => { - const [a] = ie.useForm(n), [o, s] = j([{ label: "无", value: "", disabled: !0 }]), l = K([]), u = ie.useWatch((d) => l.current.length === 0 ? null : m.pick(d, l.current), a) || null; - return V(() => { - Array.isArray(t) ? s(t) : e === "javascript" && t ? Fe.exec(t, {}, { getFieldValue: (d) => (l.current.includes(d) || l.current.push(d), a.getFieldValue(d)), getFieldValueForBasicForm: (d) => (l.current.includes(d) || l.current.push(d), r ? r.getFieldValue(d) : a.getFieldValue(d)) }).then((d) => { - s(oe(d, "array")); - }).catch((d) => console.error("useOptions", d)) : t && s(oe(t, "array")); - }, [t, e, u]), Bi(o, i); -}, ha = (t) => { - const [e, i] = j(), n = { type: "GET" }; - if (typeof t == "string" ? n.url = t : m.isPlainObject(t) && Object.assign(n, t), !(n != null && n.url)) throw "url is required"; - const r = (a) => I.request(n, !1).resp((o) => (console.log("useSubscribeRequest", a), i(o), o)); - return ct(() => { - let a = null; - return r().then((o) => { - a = Ii.subscribe(m.throttle(r, 180, { leading: !1, trailing: !0 }), o.res); - }), () => a == null ? void 0 : a(); - }, n), e; -}, or = (t) => { - const [e, i] = E.useState({ items: [], hides: [] }); - return E.useEffect(() => { - t && I.get(`/api/_/${t}`).then(({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: d, marginY: p, listenChangeFields: f, listenChangeFieldsFunc: g, fields: y, theme: w, themeSetting: C, groups: k }) => ({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: d, marginY: p, theme: w, themeProps: C, groups: k, listenChangeFields: f, listenChangeFieldsFunc: g, ...y.reduce((S, $) => { - var T; - return (T = $ == null ? void 0 : $.field) != null && T.hidden ? S.hides.push($ == null ? void 0 : $.field) : S.items.push($), S; - }, { items: [], hides: [] }) })).then(i); - }, [t]), e; -}, sr = ({ max: t = 0, min: e = 0, type: i = "", message: n, pattern: r, required: a = !1, validator: o } = {}, s, l) => { - const [u, d] = j([]); - return V(() => { - const p = []; - if (a) { - let f = l; - switch (l) { - case "number": - case "string": - case "array": - break; - case "bool": - f = "boolean"; - break; - case "json": - f = "object"; - } - p.push({ type: f, required: !0, whitespace: !0, message: "该项必填" }); - } - switch (i) { - case "string": - p.push({ type: i, max: t, min: e, message: n || (e && t ? `字符必须在 ${e} ~ ${t} 之间` : `${t ? "最多能有" : "最少要有"} ${e || t} 个字符`) }); - break; - case "pattern": - p.push({ type: "string", pattern: r, message: n }); - break; - case "validator": - o && p.push(({ getFieldValue: f }) => ({ validator: async (g, y) => { - const w = await Fe.exec(o, { value: y, fieldName: s }, { getFieldValue: f }); - return m.isString(w) && w ? Promise.reject(w) : m.isBoolean(w) && !w ? Promise.reject(n) : Promise.resolve(); - } })); - } - d(p); - }, [t, e, i, n, r, a, o]), u; -}, lr = (t, e, i) => { - const [n, r] = j(null); - return V(() => { - const { initDataUri: a = `/api/${t}`, initDataMethod: o = "GET" } = i || {}; - e && I.request({ method: o, url: m.trimEnd(`${a}/${e}`, "/") }).then((s) => { - r(s); - }); - }, [t, e, i]), n; -}, cr = (t, e, i) => X((n, r = { serialize: (a) => a, onSuccess: () => { -}, onFail: (a) => (a == null ? void 0 : a.errorFields) && ee.error("请先完善表单信息", { duration: 2e3 }) }) => { - const a = n.getFieldValue("__RESOURCE__"), { submitDataUri: o = `/api/${t}`, submitDataMethod: s = "POST" } = i || {}; - return n.validateFields().then((l) => a ? m.pick(l, [a]) : l).then(r.serialize).then((l) => I.request({ method: s, url: m.trimEnd(`${o}/${e || ""}`, "/"), data: l }).msg(r.onSuccess)).catch(r.onFail); -}, [t, e, i]), dr = (t, e, i, n) => { - const r = lr(e, i, n); - V(() => { - r ? t.setFieldsValue(r) : t.resetFields(); - }, [t, r]); - const a = cr(e, i, n); - return m.partial(a, t); -}, ur = (t, e, i = [], n = {}) => { - const r = K({}), a = K(), o = m.debounce(Nt(), 180), s = ["disabled", "required"], l = (f, g) => { - s.includes(f) && (r.current[f] = g), o(); - }, u = _(() => ({ setDisabled: (f) => l("disabled", f), setRequired: (f) => l("required", f), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [e]), [d, p] = Mi(e, -1, {}, u, n); - if (!p && a.current != d && (d >= 0 || !m.isEmpty(i == null ? void 0 : i[d]))) { - a.current = d; - const { widget: f, widgetPrefix: g, props: y } = i == null ? void 0 : i[d]; - t = Ni(f, g), r.current = m.merge(y, m.pick(r.current, s)); - } - return [t, r.current]; -}, gi = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), ma = ({ value: t, onChange: e }, i = null) => { - const n = K(), [r] = ie.useForm(i), a = K({}); - return dt(() => { - m.isEqual(n.current, t) || r.setFieldsValue(t); - }, [t]), V(() => () => r.resetFields(), []), [_(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (o) => (s) => { - const l = gi(o); - s ? a.current[l] = s : delete a.current[l]; - } }, scrollToField: (o, s = {}) => { - console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); - }, focusField: (o) => { - console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); - }, getFieldInstance: (o) => { - const s = gi(o); - return a.current[s]; - } }, [r]), (o, s) => { - n.current = s, e == null || e(s); - }]; -}, Qt = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: i, subWidgets: n = [], basicForm: r, ...a }) => { - const o = Ni(t, e), [s, l] = ur(o, i, n, r), [u, d] = j(); - return V(() => { - s && se.getWidgetComponent(s).then(({ defaultProps: p = {}, default: f }) => ({ default: pr(f, p, r) })).catch((p) => ({ default: () => `${p}` })).then((p) => d(E.createElement(p.default, a))); - }, [s]), u && E.cloneElement(u, { ...a, ...l }); -}, pr = (t, e = {}, i = null) => (n) => { - const { type: r, code: a, label: o, noStyle: s, style: l, placeholder: u, required: d = !1, extras: p, validators: f, help: g, isVirtual: y, $isReserved: w, initialValue: C, initialValueLanguage: k, ...S } = m.omit(m.merge({}, e, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), $ = sr(Object.assign({}, f, d ? { required: !0 } : {}), a, r), T = _(() => { - const R = Object.keys((e == null ? void 0 : e.extras) || {}); - return m.over([m.partialRight(m.pick, R), m.partialRight(m.omit, R)]); - }, [e == null ? void 0 : e.extras]), [F, L] = T(S), D = { label: o, noStyle: s, style: l, colon: !1, layout: "vertical" }, U = X((R) => R == null ? void 0 : oe(R, r), [r]); - return h(Jt, { name: a, rules: $, initialValue: U(C), normalize: U, children: (R, M, x) => { - var B; - return h(t, { type: r, rcform: x, basicForm: i, itemProps: { validateStatus: M.errors.length > 0 ? "error" : "success", tooltip: g || null, help: M.errors.length > 0 ? M.errors.join("、") : null, required: ((B = $ == null ? void 0 : $[0]) == null ? void 0 : B.required) || !1, ...D }, fieldProps: { placeholder: u, ...L, ...R }, $setting: Object.assign({}, p, F) }); - } }); -}, Zt = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: a = 24, rowHeight: o = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: u = [], hides: d = [], primaryKey: p = 0, formProps: f = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: w, onValuesChange: C, theme: k, themeProps: S = {}, groups: $ = [{ key: "default", label: "默认" }], children: T, ...F }) => { - const [L] = ie.useForm(e), D = X((M, x) => { - C == null || C(M, x), w && Array.isArray(y) && Fe.exec(w, { changedValues: M, allValues: x }, { getFieldValue: L.getFieldValue, setFieldValue: L.setFieldValue, setFieldsValue: L.setFieldsValue, isFieldTouched: L.isFieldTouched, isFieldsTouched: L.isFieldsTouched }).catch((B) => console.error("onFormValuesChange", t, B)); - }, [t, L, C, y, w]), U = _(() => [{ name: "__PROPS__", value: f }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, f, g]), R = (M, x, B) => { - const z = Yt(x, Qt, i), ce = Ai(F); - return A("div", { ...ce, className: O("ff-grid-layout-form", r), style: { ...n, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-container-padding-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [z, B && E.cloneElement(B, { cols: a, rowHeight: o, itemMargin: s, containerPadding: l, fields: x, basicForm: i })] }); - }; - return A(ie, { ...F, form: L, fields: U, onValuesChange: D, children: [k ? h(Di, { ...S, items: $, theme: k, itemRender: R, fields: u, children: T, basicForm: i }) : R(0, u, T), d == null ? void 0 : d.map((M) => { - var x; - return h(Jt, { name: M.code, children: h(gr, { form: L, basicForm: i, name: M.code, type: M.type, initialValue: M.initialValue, initialValueLanguage: (x = M.extras) == null ? void 0 : x.initialValueLanguage }) }, JSON.stringify(M.code)); - })] }); -}, gr = ({ type: t, initialValue: e, initialValueLanguage: i, onChange: n, basicForm: r }) => { - const [a, o] = Mi(i == "javascript" && e, i == "javascript" ? void 0 : e, {}, {}, r); - return V(() => { - i == "javascript" ? n(oe(a, t)) : e && n(oe(e, t)); - }, [t, e, a]), null; -}; -Zt.propTypes = { fields: b.array, hides: b.array }; -const hr = /* @__PURE__ */ ((t) => ({ code: e, isPreview: i = !1, ...n }) => { - const { align: r, autoComplete: a, resource: o, items: s, hides: l, rowHeight: u, marginX: d, marginY: p, cols: f, listenChangeFields: g, listenChangeFieldsFunc: y, pk: w, uuid: C, theme: k, themeProps: S, groups: $ } = or(e), T = _(() => [{ name: "__PK__", value: w }, { name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: C }], [w, e, C, o]); - return h(t, { name: e, autoComplete: a, theme: k, themeProps: S, groups: $, ...n, formFields: T, listenChangeFields: g, listenChangeFieldsFunc: y, fields: s, hides: l, cols: f, rowHeight: u, itemMargin: [d, p] }); -})(Zt), Ui = ({ $setting: t, $close: e, extras: i, code: n, primaryKey: r, ...a }) => { - const [o] = ie.useForm(), s = dr(o, n, r, t); - return h(Y, { actions: A(E.Fragment, { children: [h(P, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => s({ onSuccess: e }) }), h(P, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: i, children: h(hr, { form: o, code: n, primaryKey: r, ...a }) }); -}, hi = /* @__PURE__ */ new Set(), _t = (t = [], e = 0) => { - const i = t[e]; - if (i.length && !hi.has(i)) { - const n = document.createElement("script"); - n.setAttribute("src", i), n.setAttribute("data-namespace", i), t.length > e + 1 && (n.onload = () => { - _t(t, e + 1); - }, n.onerror = () => { - _t(t, e + 1); - }), hi.add(i), document.body.appendChild(n); - } -}, Ct = ({ className: t, type: e, style: i = {}, ...n }) => h("span", { role: "img", className: O("ff-iconfont", t), style: i, ...n, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); -Ct.propTypes = { className: b.string, type: b.string.isRequired, style: b.object }, Ct.init = _t; -const mr = (t, e, i, n) => Ee.redirect(i, e, n), fr = (t, e = {}, i, n = {}) => { - var a; - const r = (a = n.router) == null ? void 0 : a.reduce((o, [s, l, u]) => { - const d = m.get(e, ["router", s]); - if (!d && d !== 0 && l) throw `请传入 ${u}`; - return `${o}/${d}`; - }, `/api/${i}`); - return I.del(r, e.param).msg(); -}, mi = (t, e, i, { status: { loading: n, disabled: r }, setStatus: a }) => { - const o = { loading: (s) => s === void 0 ? n : a((l) => ({ ...l, loading: s })), disabled: (s) => s === void 0 ? r : a((l) => ({ ...l, disabled: s })) }; - return m.isFunction(i) ? i.call(null, { ...e, ...o }) : m.isString(i) && i ? Fe.exec(i, e, o) : null; -}, fi = (t, e, i, n, r) => m.isString(i) && i ? se.getWidgetComponent(i).then(({ default: a }) => ee.modal(a, { ...e, $setting: n }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r)).catch((a) => { - ee.error(i, { content: a.toString() }); -}) : ee.modal(i, { ...e, $setting: n }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), yr = (t, e, i, n, r) => ee.modal(Ui, { ...e, $setting: n, code: i }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), wr = (t, e, i, n, r) => ee.modal(Xt, { base62params: e, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), br = ({ widget: t, widgetType: e, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s } = {}) => { - const l = le(ne), [u, d] = j({ leading: !0, trailing: !1 }), p = _(() => { - switch (e) { - case "redirect": - return m.partialRight(mr, t, r); - case "func": - return m.partialRight(mi, (r == null ? void 0 : r.code) ?? t, { status: u, setStatus: d }); - case "component": - case "fsdpf-component": - return m.partialRight(fi, t, r, a); - case "grid-layout-form": - return m.partialRight(yr, t, r, a); - case "data-list": - return m.partialRight(wr, t, r, a); - case "destroy": - return m.partialRight(fr, t, r, a); - default: - if (ti(t) || E.isValidElement(t)) return m.partialRight(fi, t, r, a); - if (m.isFunction(t)) return m.partialRight(mi, (r == null ? void 0 : r.code) || t, { status: u, setStatus: d }); - } - return (...f) => console.error("useButton unknown widgetType", e, ...f); - }, [t, e]); - return [m.debounce((f) => (s == null || s(f), Promise.resolve(lt(n, f, { list: l })).then((g) => p(f, { ...i, ...g })).then((g) => o == null ? void 0 : o(g)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u]; -}, qi = ({ type: t, name: e, className: i, icon: n, iconPosition: r, size: a }, o = "default") => _(() => { - const s = { type: "primary", className: O("ff-button", i), iconPosition: r, size: a }; - return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), o === "link" || o === "dashed" ? (s.type = o, t === "default" && (s.className = O(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), n && (s.icon = h(Ct, { type: n })), e && (s.children = e), s; -}, [o, t, i, n, r]), Pt = ({ data: t, widget: e, widgetType: i = "fsdpf-component", widgetData: n, widgetProps: r, widgetSetting: a, widgetContainerProps: o, onAfterClick: s, onBeforeClick: l, children: u, extras: d }) => { - const p = le(ne), [f, g] = j(!1), [y, w] = j("hover"), [C, k] = j({}), [S, $] = j(), { placement: T, align: F, zIndex: L, arrow: D = { pointAtCenter: !0 }, getPopupContainer: U, isPopupMountBodyContainer: R = !0, ...M } = o || {}; - V(() => { - i == "grid-layout-form" ? $(E.createElement(Ui, { ...n, $setting: a, code: e })) : i == "data-list" ? $(E.createElement(Xt, { base62params: t, $setting: a, listCode: e })) : m.isString(e) ? se.getWidgetComponent(e).then(({ default: z }) => { - $(E.createElement(z, { ...n, $setting: a })); - }).catch((z) => $(z.toString())) : ti(e) ? $(E.createElement(e, { ...n, $setting: a })) : E.isValidElement(e) && $(E.cloneElement(e, { ...n, $setting: a })); - }, [e, i, n]), V(() => { - Promise.resolve(lt(r, t, { list: p })).then(k); - }, [r, t, p.getBase62params]); - const x = (z, ce = !1) => (g(z), !z && w("hover"), z ? l == null ? void 0 : l(C) : s == null ? void 0 : s(ce)), B = (z) => { - g(!0), w("click"); - }; - return h(wn, { zIndex: L, placement: T, onPopupClick: B, onClick: B, open: f, align: F, arrow: D, trigger: y, getPopupContainer: U || R ? void 0 : (z) => z, content: h(Cr, { ...M, extras: d, children: S && E.cloneElement(S, { ...C, $close: (z) => x(!1, z) }) }), children: u, onOpenChange: x }); -}, Cr = ({ title: t, className: e, classNames: i, children: n, extras: r, width: a, height: o, ...s }) => { - const [l, u] = j({}), d = X((y, w) => u((C) => ({ ...C, [y]: w })), []), p = X((y) => u((w) => ({ ...w, [y]: void 0 })), []), f = t ? E.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = r ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, r); - return h(st.Provider, { value: { ele: l, mount: d, unmount: p }, children: A("div", { className: O("ff-popup ff-popover", e, l.rootClassName), style: { width: a ?? 260, height: o }, ...s, children: [A("div", { className: O("ff-popup-header", "ff-popover-header", i == null ? void 0 : i.header), children: [f, l == null ? void 0 : l["sub-title"]] }), h("div", { className: O("ff-popup-body", "ff-popover-body", i == null ? void 0 : i.body), children: n }), A("div", { className: O("ff-popup-footer", "ff-popover-footer", i == null ? void 0 : i.footer), children: [g, l == null ? void 0 : l.extras, l == null ? void 0 : l.actions] })] }) }); -}; -Pt.propTypes = { widgetType: b.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; -const ut = (t) => function({ className: e, variant: i, children: n, name: r, icon: a, type: o = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: u, onBeforeClick: d, data: p, loading: f, disabled: g, tooltip: y, confirm: w, widget: C = () => { -}, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: F, ...L }) { - const { mode: D, ...U } = F || {}, R = qi({ className: e, name: r, type: o, icon: a, iconPosition: s }, i ?? t), M = h(wt, { ...R, ...L, children: n || r }); - if (D === "popover" && !["destroy", "redirect", "func"].includes(k)) return h(Pt, { data: p, widget: C, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: U, onAfterClick: u, onBeforeClick: d, children: M }); - const x = m.isEmpty(y) || !y.enabled ? {} : y, B = m.isEmpty(w) ? { enabled: !1 } : Object.assign({ enabled: !0 }, w), [z, ce] = j(!1), [pt, { disabled: gt, loading: Tt }] = br({ widget: C, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: U }, { onAfterClick: u, onBeforeClick: d }); - return h(bn, { okText: "确定", cancelText: "取消", getPopupContainer: (te) => te, ...B, disabled: gt || g, open: z, onOpenChange: (te) => { - if (!te) return ce(te); - B.enabled ? ce(te) : pt(p); - }, onConfirm: (te) => { - pt(p, te); - }, onClick: (te) => { - te.stopPropagation(); - }, children: h(Cn, { getPopupContainer: (te) => te, ...x, title: z ? null : x == null ? void 0 : x.title, trigger: ["hover", "click"], children: E.cloneElement(M, { loading: Tt || f, disabled: gt || g }) }) }); -}, P = ut("default"); -P.propTypes = { type: b.oneOf(["primary", "default", "danger", ""]), size: b.oneOf(["large", "middle", "small"]), name: b.string, icon: b.string, iconPosition: b.oneOf(["start", "end"]), data: b.any, widget: b.any, widgetType: b.oneOf(["destroy", "redirect", "func", "component", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: b.object, widgetProps: b.object, widgetSetting: b.object, widgetContainerProps: b.object, tooltip: b.exact({ title: b.string.isRequired, placement: b.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: b.oneOfType([b.bool, b.number]), getPopupContainer: b.func }), confirm: b.exact({ title: b.string.isRequired, cancelText: b.string, okText: b.string, okType: b.oneOf(["primary", "default", "danger", ""]), placement: b.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: b.oneOfType([b.bool, b.number]), getPopupContainer: b.func, arrow: b.oneOfType([b.bool, b.exact({ pointAtCenter: b.bool })]) }) }; -const kr = ut("link"), $r = ut("circle"), Er = ut("round"), Sr = ut("dashed"), yi = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: i = (g, y, w) => { -}, onBeforeClick: n = (g, y, w) => { -}, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: u = (g, y) => h(P, { ...g, data: y }, g.uuid || jt()), widgetContainerProps: d = {}, children: p, data: f }) => { - if (m.isEmpty(t)) return p; - const [g, y] = _(() => (t || []).reduce((C, k) => { - const S = e.indexOf(k.widgetType); - return S === -1 ? C[1].push(k) : C[0] ? S < e.indexOf(C[0].widgetType) ? (C[1].push(C[0]), C[0] = k) : C[1].push(k) : C[0] = k, C; - }, [null, []]), [t, e]); - o ? p = o(g, f) || p : p || (p = h(wt, { ...qi(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: a }), r) })); - const w = y.map((C) => u(Object.assign({ uuid: C.uuid, type: C.type, name: C.name, widget: C.widget, widgetType: C.widgetType, widgetProps: C.widgetProps, widgetData: C.widgetData, widgetSetting: C.widgetSetting, widgetContainerProps: C.widgetContainerSetting, confirm: C.confirm, onAfterClick: m.partialRight(i, C, f), onBeforeClick: m.partialRight(n, C, f) }, { size: l, variant: s }), f)); - return h(Pt, { widget: g == null ? void 0 : g.widget, widgetType: g == null ? void 0 : g.widgetType, widgetProps: g == null ? void 0 : g.widgetProps, widgetSetting: g == null ? void 0 : g.widgetSetting, widgetContainerProps: Object.assign({}, d, g == null ? void 0 : g.widgetContainerProps), data: f, widgetData: g == null ? void 0 : g.widgetData, extras: w, onAfterClick: m.partialRight(i, g, f), onBeforeClick: m.partialRight(n, g, f), children: p }); -}; -yi.propTypes = { triggerWeights: b.array, options: b.arrayOf(b.shape({ ...P.propTypes, widgetType: P.propTypes.widgetType.isRequired })), btnSize: P.propTypes.size, btnRender: b.func, btnVariant: b.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: b.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: b.func, labelSize: P.propTypes.size, onAfterClick: b.func, onBeforeClick: b.func, widgetContainerProps: P.propTypes.widgetContainerProps, data: P.propTypes.data }, P.Link = kr, P.Link.defaultProps = P.defaultProps, P.Link.propTypes = P.propTypes, P.Circle = $r, P.Circle.defaultProps = P.defaultProps, P.Circle.propTypes = P.propTypes, P.Round = Er, P.Round.defaultProps = P.defaultProps, P.Round.propTypes = P.propTypes, P.Dashed = Sr, P.Dashed.defaultProps = P.defaultProps, P.Dashed.propTypes = P.propTypes, P.Popover = Pt, P.GroupPopover = yi; -const vr = ({ fields: t, formProps: e, $close: i }) => { - const [n] = ie.useForm(), r = _(() => [{ name: "__PROPS__", value: e }], [e]); - return h(Y, { actions: A(E.Fragment, { children: [h(P, { name: "取消", widget: () => i(!1) }), h(P, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(i) })] }), children: h(ie, { fields: r, form: n, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: a, ...o }) => h(Qt, { code: a, ...o }, a)) }) }); -}, xr = ({ className: t, classNames: e, $close: i, children: n, title: r, subTitle: a, actions: o, extras: s, ...l }) => A(Nn, { ...l, prefixCls: "ff-drawer", className: O("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (u) => ({ motionAppear: !0, motionName: `panel-motion-${u}` }), children: [A("div", { className: O("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: O("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: h(Gt, { type: "close" }) }), r, a] }), h("div", { className: O("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), A("div", { className: O("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, o] })] }), Nr = ({ className: t, classNames: e, $close: i, $event: n, children: r, title: a, subTitle: o, actions: s, extras: l, placement: u, ...d }) => { - const p = (n == null ? void 0 : n.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: n == null ? void 0 : n.pageX, y: n == null ? void 0 : n.pageY } }; - return h(Pn, { ...d, ...p, prefixCls: "ff-modal", modalRender: () => A("div", { className: O("ff-modal-content ff-popup", t), children: [A("div", { className: O("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: O("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: d.onClose, children: h(Gt, { type: "close" }) }), a, o] }), h("div", { className: O("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: r }), A("div", { className: O("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] }) }); -}, _i = ({ placement: t, $close: e, $event: i, children: n, title: r, ...a }) => { - const [o, s] = j({}), [l, u] = j(!0), d = X((y, w) => s((C) => ({ ...C, [y]: w })), []), p = X((y) => s((w) => ({ ...w, [y]: void 0 })), []); - let f = { ...a, className: o.rootClassName, title: o.title || r && E.createElement("div", { className: O("ff-popup-title") }, r), subTitle: o["sub-title"], actions: o.actions, extras: o.extras, children: n, $close: e, $event: i, onClose: () => u(!1) }; - const g = () => { - e(!1); - }; - return h(st.Provider, { value: { ele: o, mount: d, unmount: p }, children: t && t !== "center" ? h(xr, { ...f, placement: t, open: l, afterOpenChange: (y) => !y && g() }) : h(Nr, { ...f, visible: l, afterClose: g }) }); -}; -_i.propTypes = { placement: b.oneOf(["center", "left", "top", "right", "bottom"]) }; -const Z = () => { - const [t, e] = cn({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (a) => { - const { offsetHeight: o } = a; - return { height: o }; - }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = E.useReducer((a) => a + 1, 0); - V(() => { - Z.$onClick = n, Z.$queue.forEach(([a, o, s], l, u) => { - r([o, s], ...a), delete u[l]; - }); - }, []); - const n = (a, o = {}, s = {}) => new Promise((l, u) => r([l, u], a, o, s)), r = ([a, o], s, l = {}, u = {}) => { - const d = Z.$index++, p = (f) => ((g, y) => (Z.$popups.delete(g), i(), y == null ? void 0 : y()))(d, () => a(f)); - if (s === vi) return t.open({ ...u, key: d, content: E.createElement(s, { ...l, $close: () => t.close(d) }) }); - Z.$popups.set(d, E.createElement(_i, { maskClosable: !1, $event: l == null ? void 0 : l.$event, ...u, key: d, $close: p }, E.isValidElement(s) ? E.cloneElement(s, { ...l, $close: p }) : s != null && s.name || si.isForwardRef(s) || (s == null ? void 0 : s.$$typeof) === si.ForwardRef ? E.createElement(s, { ...l, $close: p }) : s)), i(); - }; - return A(E.Fragment, { children: [Array.from(Z.$popups).map(([a, o]) => o), e] }); -}; -Z.$popups = /* @__PURE__ */ new Map(), Z.$index = 0, Z.$queue = [], Z.$onClick = (...t) => new Promise((e, i) => { - Z.$queue.push([t, e, i]); -}); -const wi = (t, e, i = {}) => Z.$onClick(t, e, i), At = (t, { showProgress: e, duration: i, ...n } = { duration: 1.5 }) => Z.$onClick(vi, { content: t, ...n }, { showProgress: e, duration: i }), ee = { modal: wi, confirm: (t, e = {}) => Z.$onClick(Tn, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, i = {}) => wi(vr, { formProps: i, fields: t }, { placement: "center", ...e }).then((n) => { - if (n === !1) throw !1; - return n; -}), notification: At, success: (t, e = { duration: 1.5 }) => At(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => At(t, { ...e, className: "ff-notification-error", icon: "close" }) }; -Je.configure({ showSpinner: !1 }); -const Ki = () => { - const t = window.localStorage.getItem(yt); - return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); -}; -Ae.interceptors.request.use((t) => (Object.assign(t.headers, Ki()), Je.inc(), t), (t) => (Je.done(), Promise.reject({ code: -1, msg: t }))), Ae.interceptors.response.use(({ data: t, headers: e }) => (Je.done(), { ...t, res: e == null ? void 0 : e.res }), function(t) { - return Je.done(), Promise.reject(t.message); -}), window.addEventListener("unhandledrejection", It.onUnhandledRejection), It.onMsg = (t, e) => ee[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && Ee.redirect(Me.get("Common.WEBSITE_LOGIN_PAGE"))); -var qe, Ve, _e; -const J = class J { - constructor() { - N(this, "appUrl", ""); - v(this, qe, null); - return c(J, Ve) || (W(J, _e, new It()), W(J, Ve, new Proxy(this, { get(e, i) { - if (i in e) { - const n = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), i); - return n != null && n.get ? Reflect.get(e, i, e) : typeof e[i] == "function" ? e[i].bind(e) : e[i]; - } - return c(J, _e)[i]; - } }))), c(J, Ve); - } - init(e, i, n) { - Ae.defaults.baseURL = this.appUrl = n, Ae.defaults.timeout = 15e3, c(J, _e).init(e, i, Ae); - } - get driver() { - return Ae; - } - get headers() { - return Ki(); - } - mock(e = {}) { - return c(this, qe) ?? W(this, qe, new dn(Ae, { onNoMatch: "passthrough", ...e })); - } - unmock() { - var e; - (e = c(this, qe)) == null || e.restore(), W(this, qe, null); - } -}; -qe = new WeakMap(), Ve = new WeakMap(), _e = new WeakMap(), v(J, Ve), v(J, _e), N(J, "getInstance", () => c(J, Ve) ?? W(J, Ve, new J())); -let Kt = J; -const I = Kt.getInstance(); -class ei extends Error { - constructor(e, i) { - super(i), Error.captureStackTrace && Error.captureStackTrace(this, ei), !i instanceof Ge && (this.name = `${e} Error Runtime`); - } -} -class Ge extends Error { - constructor(e, ...i) { - super(...i), Error.captureStackTrace && Error.captureStackTrace(this, Ge), this.name = `${e} Not Found`; - } -} -const Lt = "mine", yt = "token"; -var Re, Ke; -const me = class me { - constructor() { - v(this, Ke, /* @__PURE__ */ new Map()); - N(this, "setVendor", (e, i) => c(this, Ke).set(e, new Ei(i, async (n, r) => { - var o, s; - if (!(n != null && n.default)) throw "@pkg not found"; - let a = () => r; - switch ("function") { - case typeof (a = (o = n.default) == null ? void 0 : o[`./${r}/index.jsx`]): - case typeof (a = (s = n.default) == null ? void 0 : s[`./${r}/index.js`]): - return a(); - } - throw new Ge(r); - }))); - N(this, "getWidgetComponent", async (e) => { - if (!e) throw "getWidgetComponent widget is required"; - if (e != null && e.startsWith("blob:") || e != null && e.startsWith("http:") || e != null && e.startsWith("https:")) return await import(e); - const [, i] = e == null ? void 0 : e.split("@pkg/"); - if (!i) throw new Ge(e); - try { - return c(this, Ke).has("pkg") ? await c(this, Ke).get("pkg").get(i) : await import(`${I.appUrl}/api/pkg-import/web?name=${e}`); - } catch (n) { - throw new ei(e, n); - } - }); - N(this, "getRoutes", () => I.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: i, ...n }) => [i, { uuid: i, ...n }])).then((e) => new Map(e))); - N(this, "getMenus", () => I.get("/api/my-menu")); - N(this, "getConfigure", () => I.get("api/init-configure")); - N(this, "getWidgetOperationAuth", () => I.get("/api/init-widget-operation-auth").then((e) => e.reduce((i, { uuid: n, auth: r }) => [...i, [n, r]], []))); - N(this, "getPhoneNumber", (e) => I.get(`/api/user-wx-phone-number/${e}`)); - N(this, "getUserToken", () => { - const e = window.localStorage.getItem(yt); - if (!e) return ""; - const i = e.split("."); - if (!Array.isArray(i) || i.length !== 3) throw "登录令牌无效!"; - const { iat: n } = JSON.parse(window.atob(i[1])); - if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; - return e; - }); - N(this, "checkUserToken", () => { - try { - return !!this.getUserToken(); - } catch { - return !1; - } - }); - N(this, "getUserInfo", (e = !0) => { - var i; - try { - const n = this.getUserToken(); - if (!n) return Promise.resolve(null); - const { iat: r } = JSON.parse(window.atob((i = n == null ? void 0 : n.split(".")) == null ? void 0 : i[1])), { iat: a, ...o } = I.decode(window.localStorage.getItem(Lt) || "", {}); - return a === r ? Promise.resolve(o) : I.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(Lt, I.encode({ ...s, iat: r })), s)); - } catch (n) { - console.error(n), e && ee.error("请登录").then(this.logout); - } - return Promise.resolve(null); - }); - N(this, "login", (e, i, n = {}) => I.post("/api/user-token", { username: e, passwd: un.hash(i), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(yt, r), r)).then(async (r) => (await this.initAppEnv(), r))); - N(this, "logout", (e) => (window.localStorage.removeItem(Lt), window.localStorage.removeItem(yt), e == null ? void 0 : e())); - N(this, "initAppEnv", async () => { - const [e, i, n, r] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); - return xi.init(e), Me.init(r), Ee.init(i, n), Ct.init(Me.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: i, menus: n, configures: r }; - }); - if (c(me, Re)) return c(me, Re); - } -}; -Re = new WeakMap(), Ke = new WeakMap(), v(me, Re, null), N(me, "getInstance", () => (c(me, Re) || W(me, Re, new me()), c(me, Re))); -let Ht = me; -const se = Ht.getInstance(), Pr = E.createContext({ user: {}, initUser: () => { -}, initUserComplete: !1 }), Tr = E.createContext({ set: () => { -}, get: () => { -}, assign: () => { -}, currentRoute: () => { -} }), ti = (t) => !!(t != null && t.name) && (t.prototype instanceof E.Component || /^[A-Z]/.test(t.name)), Or = (t, e) => { - if (!t || typeof window > "u") return; - let i = document.querySelector(`style[ff-style-token="${e}"]`); - return i ? (i.innerHTML = t, t) : (i = document.createElement("style"), i.setAttribute("ff-style-token", e), i.setAttribute("type", "text/css"), i.innerHTML = t, document.head.appendChild(i), t); -}, Rr = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Pr, AppGlobalParamsContext: Tr, cache: Ei, configure: Me, default: se, func: Fe, http: I, insertStyle: Or, isReactComponent: ti, route: Ee }, Symbol.toStringTag, { value: "Module" })); -var ke, He, $e, fe, ye, Q, G, H, we, it, nt, rt, at, xt, ot; -const ii = class ii { - constructor(e, i = "/") { - v(this, ke, "/"); - v(this, He, /* @__PURE__ */ new Set()); - v(this, $e, (e) => { - for (const i of c(this, He)) try { - i(e); - } catch (n) { - console.error("Error in VirtualFS event listener:", n); - } - }); - v(this, fe, (e) => { - const i = Date.now(); - if (e && (e.lastModified = i), c(this, ke) != "/") { - const n = c(this, H).call(this, c(this, ke)); - n && (n.lastModified = i); - } - this.root.lastModified = i; - }); - v(this, ye, (e) => { - let i = de.normalize(e); - return i.startsWith("/") || (i = "/" + i), i.length > 1 && i.endsWith("/") && (i = i.slice(0, -1)), i; - }); - v(this, Q, (e) => { - const i = de.join(c(this, ke), e); - return c(this, ye).call(this, i); - }); - v(this, G, (e) => { - if (!e || typeof e != "string") return !1; - const i = c(this, ye).call(this, e); - return !i.includes("..") && i.startsWith("/"); - }); - v(this, H, (e) => { - var a; - const i = c(this, ye).call(this, e); - if (i === "/") return this.root; - const n = i.split("/").filter((o) => o); - let r = this.root; - for (const o of n) { - if (r.type !== "dir") return null; - const s = (a = r.children) == null ? void 0 : a.find((l) => l.name === o); - if (!s) return null; - r = s; - } - return r; - }); - v(this, we, (e) => { - const i = c(this, ye).call(this, e), n = de.basename(i), r = de.dirname(i); - return { parent: c(this, H).call(this, r), name: n }; - }); - v(this, it, (e, i, n) => n === !1 ? e : n === "root" ? e.map((r) => de.join(i, r)) : n === !0 || n === "working" ? e.map((r) => de.relative(c(this, ke), de.join(i, r))) : e); - v(this, nt, async (e, i, n, r = "") => { - const a = [], o = c(this, H).call(this, e); - if (!o || o.type !== "dir") return a; - const s = o.children; - for (const l of s) { - const u = l.name, d = e === "/" ? `/${u}` : `${e}/${u}`, p = r ? `${r}/${u}` : u; - try { - if (l.type === "file") i(n ? p : u) && a.push(p); - else if (l.type === "dir" && n) { - const f = await c(this, nt).call(this, d, i, n, p); - a.push(...f); - } - } catch { - continue; - } - } - return a; - }); - v(this, rt, async (e, i, n, r = "") => { - const a = [], o = Array.isArray(i) ? i : [i], s = c(this, H).call(this, e); - if (!s || s.type !== "dir") return a; - if (!n) { - for (const u of o) if (c(this, at).call(this, u)) { - const d = await c(this, xt).call(this, e, u); - a.push(...d); - } else { - const d = de.join(e, u), p = c(this, ye).call(this, d); - c(this, H).call(this, p) && a.push(u); - } - return a; - } - const l = s.children; - for (const u of l) { - const d = u.name, p = e === "/" ? `/${d}` : `${e}/${d}`, f = r ? `${r}/${d}` : d; - try { - if (u.type === "file") for (const g of o) { - let y = !1; - if (y = c(this, at).call(this, g) ? c(this, ot).call(this, d, g) : d === g, y) { - a.push(f); - break; - } - } - else if (u.type === "dir") { - const g = await c(this, rt).call(this, p, i, n, f); - a.push(...g); - } - } catch { - continue; - } - } - return a; - }); - v(this, at, (e) => /[*?[\]{}]/.test(e)); - v(this, xt, async (e, i) => { - const n = [], r = c(this, H).call(this, e); - if (!r || r.type !== "dir") return n; - const a = r.children.map((o) => o.name); - for (const o of a) c(this, ot).call(this, o, i) && n.push(o); - return n; - }); - v(this, ot, (e, i) => { - const n = i.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (r, a) => "(" + a.split(",").join("|") + ")"); - return new RegExp(`^${n}$`).test(e); - }); - var n, r, a; - W(this, ke, i), this.root = { name: "/", type: "dir", children: [], lastModified: Date.now() }, Array.isArray(e) ? this.root.children = e : e && typeof e == "object" && (e.name && e.name !== "/" ? this.root.children.push(e) : (this.root = e, (n = this.root).name ?? (n.name = "/"), (r = this.root).children ?? (r.children = []), (a = this.root).lastModified ?? (a.lastModified = Date.now()))); - } - async stat(e) { - const i = c(this, Q).call(this, e); - if (!c(this, G).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = c(this, H).call(this, i); - if (!n) throw new Error(`ENOENT: no such file or directory, stat '${e}'`); - return { isFile: () => n.type === "file", isDirectory: () => n.type === "dir", lastModified: n.lastModified }; - } - async dir(e) { - const i = c(this, Q).call(this, e); - if (!c(this, G).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = c(this, H).call(this, i); - if (!n) throw new Error(`ENOENT: no such file or directory, scandir '${e}'`); - if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory, scandir '${e}'`); - return n.children.map((r) => r.name); - } - async readFile(e) { - const i = c(this, Q).call(this, e); - if (!c(this, G).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = c(this, H).call(this, i); - if (!n) throw new Error(`ENOENT: no such file or directory, open '${e}'`); - if (n.type !== "file") throw new Error("EISDIR: illegal operation on a directory, read"); - return n.content || ""; - } - async writeFile(e, i) { - const n = c(this, Q).call(this, e); - if (!c(this, G).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: r, name: a } = c(this, we).call(this, n); - if (!r) throw new Error(`ENOENT: no such file or directory, open '${e}'`); - if (r.type !== "dir") throw new Error("ENOTDIR: not a directory"); - const o = r.children.findIndex((u) => u.name === a), s = o >= 0, l = { name: a, type: "file", content: i, lastModified: Date.now() }; - s ? r.children[o] = l : r.children.push(l), c(this, fe).call(this, r), c(this, $e).call(this, { action: s ? "update" : "create", path: n, type: "file", timestamp: Date.now() }); - } - async mkdir(e, i = {}) { - const n = c(this, Q).call(this, e); - if (!c(this, G).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const { recursive: r } = i; - if (r) { - const a = n.split("/").filter((s) => s); - let o = "/"; - for (const s of a) - if (o = de.join(o, s), !c(this, H).call(this, o)) { - const { parent: l, name: u } = c(this, we).call(this, o); - if (l && l.type === "dir") { - const d = { name: u, type: "dir", children: [], lastModified: Date.now() }; - l.children.push(d), c(this, fe).call(this, l), c(this, $e).call(this, { action: "create", path: c(this, ye).call(this, o), type: "dir", timestamp: Date.now() }); - } - } - } else { - const { parent: a, name: o } = c(this, we).call(this, n); - if (!a) throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`); - if (a.type !== "dir") throw new Error("ENOTDIR: not a directory"); - if (a.children.find((l) => l.name === o)) throw new Error(`EEXIST: file already exists, mkdir '${e}'`); - const s = { name: o, type: "dir", children: [], lastModified: Date.now() }; - a.children.push(s), c(this, fe).call(this, a), c(this, $e).call(this, { action: "create", path: n, type: "dir", timestamp: Date.now() }); - } - } - async unlink(e) { - const i = c(this, Q).call(this, e); - if (!c(this, G).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: n, name: r } = c(this, we).call(this, i); - if (!n) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); - const a = n.children.findIndex((o) => o.name === r); - if (a < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); - if (n.children[a].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); - n.children.splice(a, 1), c(this, fe).call(this, n), c(this, $e).call(this, { action: "delete", path: i, type: "file", timestamp: Date.now() }); - } - async rmdir(e, i = {}) { - const n = c(this, Q).call(this, e); - if (!c(this, G).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: r, name: a } = c(this, we).call(this, n); - if (!r) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const o = r.children.findIndex((l) => l.name === a); - if (o < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const s = r.children[o]; - if (s.type !== "dir") throw new Error(`ENOTDIR: not a directory, rmdir '${e}'`); - if (!i.recursive && s.children.length > 0) throw new Error(`ENOTEMPTY: directory not empty, rmdir '${e}'`); - r.children.splice(o, 1), c(this, fe).call(this, r), c(this, $e).call(this, { action: "delete", path: n, type: "dir", timestamp: Date.now() }); - } - async rename(e, i) { - const n = c(this, Q).call(this, e), r = c(this, Q).call(this, i); - if (!c(this, G).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - if (!c(this, G).call(this, r)) throw new Error(`EINVAL: invalid path '${i}'`); - if (!c(this, H).call(this, n)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${i}'`); - const { parent: a, name: o } = c(this, we).call(this, n), { parent: s, name: l } = c(this, we).call(this, r); - if (!s) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${i}'`); - if (c(this, H).call(this, r)) throw new Error(`EEXIST: file already exists, rename '${e}' -> '${i}'`); - const u = a.children.findIndex((p) => p.name === o), d = { ...a.children[u], name: l, lastModified: Date.now() }; - a.children.splice(u, 1), s.children.push(d), c(this, fe).call(this, a), a !== s && c(this, fe).call(this, s), c(this, $e).call(this, { action: "rename", path: r, oldPath: n, type: d.type, timestamp: Date.now() }); - } - async exists(e) { - const i = c(this, Q).call(this, e); - return c(this, G).call(this, i) ? c(this, H).call(this, i) !== null : !1; - } - getLastModified() { - return this.root.lastModified; - } - subscribe(e) { - if (typeof e != "function") throw new Error("Callback must be a function"); - return c(this, He).add(e), () => { - c(this, He).delete(e); - }; - } - getWorkingDirectory() { - return c(this, ke); - } - scope(e = "/") { - const i = c(this, ye).call(this, e); - if (!c(this, G).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = c(this, H).call(this, i); - if (!n) throw new Error(`ENOENT: no such file or directory '${e}'`); - if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); - return n.children ?? (n.children = []), n.lastModified ?? (n.lastModified = Date.now()), new ii(this.root, i); - } - async findFiles(e, i, n = {}) { - const r = c(this, Q).call(this, e); - if (!c(this, G).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); - const a = c(this, H).call(this, r); - if (!a) throw new Error(`ENOENT: no such file or directory '${e}'`); - if (a.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); - const { recursive: o = !1, fullPath: s = !1 } = n; - if (typeof i == "function") { - const u = await c(this, nt).call(this, r, i, o); - return c(this, it).call(this, u, r, s); - } - const l = await c(this, rt).call(this, r, i, o); - return c(this, it).call(this, l, r, s); - } -}; -ke = new WeakMap(), He = new WeakMap(), $e = new WeakMap(), fe = new WeakMap(), ye = new WeakMap(), Q = new WeakMap(), G = new WeakMap(), H = new WeakMap(), we = new WeakMap(), it = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), at = new WeakMap(), xt = new WeakMap(), ot = new WeakMap(); -let bi = ii; -const Fr = async (t, e = "/", i = "") => { - try { - const n = await t.stat(e), r = e === "/" ? "/" : de.basename(e), a = { title: r, key: i ? `${i}${e}` : e, isLeaf: n.isFile() }; - if (n.isDirectory()) { - const o = await t.dir(e); - if (o.length > 0) { - a.children = []; - const s = [], l = []; - for (const u of o) { - const d = e === "/" ? `/${u}` : `${e}/${u}`; - try { - (await t.stat(d)).isDirectory() ? s.push(u) : l.push(u); - } catch (p) { - console.warn(`Failed to stat ${d}:`, p.message); - } - } - s.sort(), l.sort(); - for (const u of [...s, ...l]) { - const d = e === "/" ? `/${u}` : `${e}/${u}`; - try { - const p = await Fr(t, d, i); - a.children.push(p); - } catch (p) { - console.warn(`Failed to process ${d}:`, p.message); - } - } - } - } - return a; - } catch { - return null; - } -}; -export { - da as $, - Mi as A, - ji as B, - Li as C, - bt as D, - Jn as E, - Hn as F, - la as G, - Xn as H, - _n as I, - Xt as J, - ne as K, - Yn as L, - ir as M, - Wn as N, - Un as O, - Vn as P, - Mn as Q, - Ii as R, - ra as S, - aa as T, - Ri as U, - Wt as V, - Dn as W, - zn as X, - nr as Y, - rr as Z, - ca as _, - Ni as a, - Nt as a0, - ua as a1, - pa as a2, - ct as a3, - dt as a4, - ga as a5, - ha as a6, - hr as a7, - Zt as a8, - Qt as a9, - Fe as aA, - Ee as aB, - Pr as aC, - Tr as aD, - bi as aE, - Fr as aF, - Ui as aa, - or as ab, - sr as ac, - lr as ad, - cr as ae, - dr as af, - ur as ag, - ma as ah, - Ct as ai, - P as aj, - xi as ak, - br as al, - Y as am, - st as an, - Si as ao, - Z as ap, - ee as aq, - Yr as ar, - Xr as as, - Qr as at, - se as au, - ti as av, - Or as aw, - I as ax, - Ei as ay, - Me as az, - Rn as b, - lt as c, - Pi as d, - ea as e, - ta as f, - On as g, - ia as h, - Fn as i, - Ln as j, - na as k, - Fi as l, - An as m, - oa as n, - Ai as o, - Yt as p, - Vi as q, - Ft as r, - zi as s, - oe as t, - Zr as u, - er as v, - Di as w, - Qn as x, - Zn as y, - sa as z -}; diff --git a/dist/common/main-DOuFUIVr.js b/dist/common/main-DOuFUIVr.js new file mode 100644 index 0000000..49d2d9b --- /dev/null +++ b/dist/common/main-DOuFUIVr.js @@ -0,0 +1,1507 @@ +var yn = Object.defineProperty; +var di = (t) => { + throw TypeError(t); +}; +var wn = (t, e, i) => e in t ? yn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i; +var N = (t, e, i) => wn(t, typeof e != "symbol" ? e + "" : e, i), ui = (t, e, i) => e.has(t) || di("Cannot " + i); +var c = (t, e, i) => (ui(t, e, "read from private field"), i ? i.call(t) : e.get(t)), x = (t, e, i) => e.has(t) ? di("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), B = (t, e, i, n) => (ui(t, e, "write to private field"), n ? n.call(t, i) : e.set(t, i), i); +var pi = (t, e, i, n) => ({ + set _(r) { + B(t, e, r, i); + }, + get _() { + return c(t, e, n); + } +}); +import { jsx as h, jsxs as j } from "react/jsx-runtime"; +import E, { useEffect as V, useState as L, useCallback as Y, useRef as H, useContext as pe, useMemo as U, useId as Vt, isValidElement as bn, useLayoutEffect as Cn } from "react"; +import ge from "pathe"; +import w from "prop-types"; +import R from "classnames"; +import * as gi from "react-is"; +import { useNotification as kn } from "rc-notification"; +import f from "lodash"; +import ae, { Field as Xt, FieldContext as Ni } from "rc-field-form"; +import { M as jt, N as Ze, a as Ve, s as Dt, b as Sn, S as En } from "./vender-BkiRbACr.js"; +import Pi from "immutability-helper"; +import { Space as $n, Form as wt, Input as vn, Button as Ct, Pagination as xn, Tree as Nn, Breadcrumb as Pn, Empty as zt, Table as hi, Popover as Tn, Popconfirm as Rn, Tooltip as On } from "antd"; +import Fn from "rc-util/lib/hooks/useMergedState"; +import { useMergedState as An } from "rc-util"; +import { generatePath as jn, useInRouterContext as Ti, useParams as Ln, useLocation as In, createBrowserRouter as Mn, Navigate as Vn } from "react-router-dom"; +import Dn from "rc-drawer"; +import zn from "rc-dialog"; +var Ke, tt, _e, Se, De, ze; +class Ri { + constructor(e, i) { + x(this, Ke, /* @__PURE__ */ new Map()); + x(this, tt, !0); + x(this, _e, []); + x(this, Se); + x(this, De, () => c(this, Se)); + x(this, ze, () => Promise.resolve()); + N(this, "get", (...e) => new Promise((i, n) => { + const r = JSON.stringify(e); + if (c(this, Ke).has(r)) return i(c(this, ze).call(this, c(this, Se), ...e)); + if (c(this, Se) === void 0) c(this, _e).push([e, i, n]), c(this, tt) && (B(this, tt, !1), Promise.resolve(typeof c(this, De) == "function" ? c(this, De).call(this) : c(this, De)).then((a) => B(this, Se, a || null)).finally(() => { + c(this, _e).forEach(([a, o, s]) => { + try { + const l = c(this, ze).call(this, c(this, Se), ...a); + c(this, Ke).set(JSON.stringify(a), l), o(l); + } catch (l) { + s(l); + } + }), c(this, _e).length = 0; + })); + else { + const a = c(this, ze).call(this, c(this, Se), ...e); + c(this, Ke).set(r, a), i(a); + } + })); + B(this, ze, i), B(this, De, e); + } +} +Ke = new WeakMap(), tt = new WeakMap(), _e = new WeakMap(), Se = new WeakMap(), De = new WeakMap(), ze = new WeakMap(); +const la = () => h("div", { children: "Empty" }), pt = E.createContext({ ele: {}, mount: () => { +}, unmount: () => { +} }), ee = ({ rootClassName: t, className: e, children: i, actions: n, title: r, subTitle: a, extras: o, style: s = {} }) => { + const { mount: l, unmount: d } = E.useContext(pt); + return ee.Action({ children: n }), ee.Title({ children: r }), ee.SubTitle({ children: a }), ee.Extra({ children: o }), V(() => (l("rootClassName", t), () => d(t)), [t]), h("div", { className: R("ff-container", e), style: s, children: i }); +}, yt = (t) => ({ children: e, className: i }) => { + const { mount: n, unmount: r } = E.useContext(pt); + return V(() => (e && n(t, E.createElement("div", { key: `ff-${t}`, className: R(`ff-popup-${t}`, i) }, e)), () => r(t)), [i, e]), null; +}; +ee.Action = yt("actions"), ee.Title = yt("title"), ee.SubTitle = yt("sub-title"), ee.Extra = yt("extras"), ee.propTypes = { className: w.string, style: w.object, title: w.any, subTitle: w.any, actions: w.any, extras: w.any }; +const ca = () => h(ee, { className: "ff-loading", children: j("div", { className: "loader", children: [j("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), j("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), j("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), j("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] })] }) }), da = () => h("div", { children: "NotFound" }), Oi = ({ children: t }) => { + const [e, i] = L({}), n = Y((a, o) => i((s) => ({ ...s, [a]: o })), []), r = Y((a) => i((o) => ({ ...o, [a]: void 0 })), []); + return typeof (t == null ? void 0 : t.type) == "string" ? t : h(pt.Provider, { value: { ele: e, mount: n, unmount: r }, children: E.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); +}; +Oi.propTypes = { children: w.element.isRequired }; +const mi = { 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"] }, Qt = ({ type: t, props: e }) => h("i", { ...e, children: h("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (mi[t] || mi.info).map((i, n) => h("path", { d: i }, n)) }) }), Fi = ({ className: t, content: e, icon: i, $close: n }) => j(E.Fragment, { children: [i && h("div", { className: R("ff-notification-icon", t), children: h(Qt, { type: i }) }), e] }), Wn = ({}) => h(ee, { children: "Confirm" }); +var Pe, He; +const he = class he { + constructor() { + x(this, He, /* @__PURE__ */ new Map()); + N(this, "init", (e) => B(this, He, new Map(e))); + N(this, "check", (e) => !c(this, He).has(e) || c(this, He).get(e)); + if (c(he, Pe)) return c(he, Pe); + } +}; +Pe = new WeakMap(), He = new WeakMap(), x(he, Pe, null), N(he, "getInstance", () => (c(he, Pe) || B(he, Pe, new he()), c(he, Pe))); +let Wt = he; +const Ai = Wt.getInstance(), Bn = (t, e, i = "children") => { + if (f.isEmpty(t)) return {}; + const n = f.find(t, ["value", e]); + if (!f.isEmpty(n)) return n; + const r = t.length; + for (let a = 0; a < r; a++) { + const { [i]: o } = t[a], s = Bn(o, e, i); + if (!f.isEmpty(s)) return s; + } + return {}; +}, ji = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; +var Te, it; +const me = class me { + constructor() { + x(this, it, null); + N(this, "init", (e) => B(this, it, e)); + N(this, "get", (e, i) => f.get(c(this, it), e, i)); + if (c(me, Te)) return c(me, Te); + } +}; +Te = new WeakMap(), it = new WeakMap(), x(me, Te, null), N(me, "getInstance", () => (c(me, Te) || B(me, Te, new me()), c(me, Te))); +let Bt = me; +const qe = Bt.getInstance(), fi = { null2json: (t) => Object.create(), null2array: (t) => [], null2number: (t) => 0, null2bool: (t) => !1, null2string: (t) => "", null2integer: (t) => 0, null2float: (t) => 0, string2json: (t) => t ? JSON.parse(t) : "{}", string2array: (t) => t.substr(0, 1) === "[" && t.substr(-1) === "]" ? JSON.parse(t) : t.split(","), string2number: (t) => t == "" ? 0 : +t, string2integer: (t) => t == "" ? 0 : +t, string2float: (t) => t == "" ? 0 : +t, string2bool: (t) => { + switch (`${t}`.toLowerCase()) { + case "0": + case "false": + case "[]": + case "{}": + return !1; + } + return !!t; +}, string2string: (t) => t, json2json: (t) => t, json2array: (t) => t ? Object.values(t) : [], json2number: (t) => Object.keys(t).length, json2integer: (t) => Object.keys(t).length, json2float: (t) => Object.keys(t).length, json2bool: (t) => Object.keys(t).length > 0, json2string: (t) => t ? JSON.stringify(t) : "", array2json: (t) => ({ ...t }), array2array: (t) => t, array2number: (t) => t.length, array2integer: (t) => t.length, array2float: (t) => t.length, array2bool: (t) => t.length > 0, array2string: (t) => JSON.stringify(t), number2json: (t) => ({}), number2array: (t) => [t], number2number: (t) => t, number2integer: (t) => t, number2float: (t) => t, number2bool: (t) => !!t, number2string: (t) => t.toString(), boolean2json: (t) => ({}), boolean2array: (t) => [], boolean2number: (t) => +t, boolean2integer: (t) => +t, boolean2float: (t) => +t, boolean2bool: (t) => t, boolean2string: (t) => t ? "true" : "false" }, de = (t, e) => { + let i = "string"; + i = Array.isArray(t) ? "array" : typeof t, f.isObject(t) && (i = "json"); + const n = `${i}2${e}`; + return Reflect.has(fi, n) ? fi[n](t) : t; +}, qn = (t) => t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "json" : typeof t == "boolean" ? "bool" : typeof t == "string" ? "string" : typeof t == "number" ? Number.isInteger(t) ? "integer" : "float" : typeof t, gt = (t = {}, e = {}, i = {}, n = "") => Li(t, (r, a) => a === "type" && r === "code") ? Ii(t, e, i, n) : Mi(t, e, n), Li = (t, e = () => !1) => f.some(t, (i) => !!f.some(i, e) || (f.isEmpty(i) || !f.isPlainObject(i) && !f.isArray(i) ? void 0 : Li(i, e))), Ii = async (t = {}, e = {}, i = {}, n = "") => { + let r = /* @__PURE__ */ Object.create(null); + for (let a in t) { + let o; + if (Reflect.has(t[a], "type") && ["code", "field", "router", "query", "string"].includes(t[a].type)) { + const { type: s, value: l = "", default: d = n } = t[a]; + switch (s) { + case "code": + try { + o = await Ie.exec(l, e, i); + } catch (u) { + console.error("getWidgetPropsData", u); + } + break; + case "field": + o = f.get(e, l) ?? f.get(e, l.substring(l.indexOf(".") + 1)); + break; + case "router": + case "query": + o = xe.getPageParams(l); + break; + case "string": + o = l; + } + o ?? (o = d); + } else o = await Ii(t[a], e, i, n); + f.set(r, a, o); + } + return r; +}, Mi = (t = {}, e = {}, i = "") => Object.keys(t || {}).reduce((n, r) => { + if (f.isPlainObject(t[r])) { + let a; + if (Reflect.has(t[r], "type") && ["field", "router", "query", "string"].includes(t[r].type)) { + const { type: o, value: s = "", default: l = i } = t[r]; + switch (o) { + case "field": + a = f.get(e, s) ?? f.get(e, s.substring(s.indexOf(".") + 1)); + break; + case "router": + case "query": + a = xe.getPageParams(s); + break; + case "string": + a = s; + } + a ?? (a = l); + } else a = Mi(t[r], e, i); + f.set(n, r, a); + } + return n; +}, {}), Lt = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((i) => Lt(i, e)) : Object.keys(t).reduce((i, n) => (e[n] ? i[e[n]] = Lt(t[n], e) : i[n] = Lt(t[n], e), i), {}) : t, ua = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { + const e = 16 * Math.random() | 0; + return (t === "x" ? e : 3 & e | 8).toString(16); +}), pa = (t) => { + var e, i; + return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.name : ""; +}, ga = (t) => { + var e, i; + return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.category : ""; +}, ha = (t) => { + var e, i; + return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.owner : ""; +}, Un = (t, e = 32, i = "auto") => { + const n = qt(t), r = i === "auto" ? "x64" : i; + if (e === 32) return jt.x86.hash32(n).toString(); + if (e === 128) return r === "x64" ? jt.x64.hash128(n) : jt.x86.hash128(n); + throw new Error("bits 只能是 32 或 128"); +}, qt = (t) => t == null ? "null" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "function" ? t.toString() : Array.isArray(t) ? "[" + t.map(qt).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${qt(t[e])}`).join(",") + "}" : String(t), Kn = () => { + let t = 1; + const e = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Map(); + return (...n) => n.length === 0 ? "" : n.map((r) => { + return String((a = r) === null || typeof a != "object" && typeof a != "function" ? (i.has(a) || i.set(a, t++), i.get(a)) : (e.has(a) || e.set(a, t++), e.get(a))); + var a; + }).join("::"); +}, _n = (t) => { + if (!t || typeof t != "string" || t.startsWith("/") || t.startsWith("./") || t.startsWith("../")) return !1; + try { + let e = t.startsWith("//") ? `http:${t}` : t; + return e.includes("://") || e.startsWith("//") || (e = `http://${e}`), !!new URL(e).hostname; + } catch { + return !1; + } +}, ma = (t, e = "") => { + if (!t || typeof t != "string" || _n(t)) return t; + let i = e; + return !i && typeof window < "u" && window.location && (i = `${window.location.protocol}//${window.location.host}`), t.startsWith("/") ? i ? `${i}${t}` : t : i ? `${i}/${t}` : t; +}; +var Et, nt, rt, $t; +const vt = class vt { + constructor(...e) { + x(this, nt, []); + x(this, rt, (e) => { + var i; + for (let n of e) Array.isArray(n[0]) ? c(this, rt).call(this, n) : c(this, nt).push(c(i = vt, Et).call(i, n[0], n[1])); + }); + N(this, "toValue", async (e, i = null) => { + const n = { getValue: () => e, getRecord: () => i }; + let r = e; + for (const a of c(this, nt)) try { + const o = await a; + if (typeof o != "function") { + console.warn("middleware is not a function, skip:", o); + continue; + } + r = await o.call(n, r); + } catch (o) { + console.error("middleware error, skip:", o); + } + return r; + }); + N(this, "toRender", (e, i, n = null) => E.createElement(c(this, $t), { value: e, record: i }, n)); + x(this, $t, ({ value: e, record: i, children: n }) => { + const [r, a] = L(n); + return mt(() => { + let o = !1; + return a(n), this.toValue(e, i).then((s) => !o && a(s)).catch((s) => !o && a(`${s}`)), () => o = !0; + }, [e, i]), r; + }); + c(this, rt).call(this, e); + } +}; +Et = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), $t = new WeakMap(), x(vt, Et, f.memoize((e, i) => { + if (typeof e == "function") return e(i); + if (typeof e == "string") return ue.getWidgetComponent(e).then((n) => { + var r; + return ((r = n.default) == null ? void 0 : r.call(n, i)) || ((a) => a); + }); + throw new TypeError("middleware must be a string or a function"); +}, Kn())); +let kt = vt; +const oe = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { +}, getSelectedRows: () => [], onReload: () => { +}, onClickCallback: () => { +}, onConditionChange: () => { +}, onTabChange: () => { +}, onSiderChange: () => { +}, onKeywordChange: () => { +}, onPageChange: () => { +}, onPageSizeChange: () => { +}, reload: () => { +}, setPage: () => { +}, setPageSize: () => { +}, setTab: () => { +}, setSider: () => { +}, setKeyword: () => { +}, setCondition: () => { +} }), yi = ({ className: t, record: e, column: i, ...n }) => { + if (i != null && i.editableByJs && (i != null && i.uuid)) { + const { formSetting: r = { primaryKey: "id" }, widgetSetting: a = {}, widgetContainerSetting: o = {} } = (i == null ? void 0 : i.editableByJsSetting) || {}; + return h(P.Popover, { widget: Hn, widgetData: { record: e, column: i }, widgetSetting: { widgetSetting: a, formSetting: r }, widgetContainerProps: { title: i != null && i.title ? `${i.title} - 编辑` : "编辑", ...o, width: (o == null ? void 0 : o.width) || 260, arrow: !0 }, children: h("td", { className: R("ff-data-list-cell-editable", t), ...n }) }); + } + return h("td", { className: t, ...n }); +}, Hn = ({ record: t, column: e, $close: i, $setting: n }) => { + const r = H(qn(f.get(t, e == null ? void 0 : e.dataIndex))), { listCode: a, onClickCallback: o } = pe(oe), [s] = ae.useForm(), { formSetting: l, widgetSetting: d } = n, u = (l == null ? void 0 : l.primaryKey) || "id", p = () => { + s.setFieldsValue({ value: f.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); + }; + return mt(() => p(), [t, e == null ? void 0 : e.dataIndex, a]), h(ee, { actions: j(E.Fragment, { children: [h(P, { size: "small", onClick: p, children: "重置" }), j($n.Compact, { block: !0, children: [h(P, { size: "small", widget: i, children: "取消" }), h(P, { type: "primary", size: "small", widget: () => s.validateFields().then(({ value: m }) => { + const g = f.get(t, u.substring(u.indexOf(".") + 1)); + if (!g) throw "获取更新主键失败!"; + I.put(`/api/${a}-storeBy-${e == null ? void 0 : e.uuid}/${g}`, { value: m }).msg(() => o(2, t)).then(i); + }).catch(console.warn), children: "保存" })] })] }), children: j(ae, { form: s, children: [h(ti, { label: "", type: r.current, code: "value", widget: e == null ? void 0 : e.editableByJs, extras: d }), h(Xt, { noStyle: !0, name: ["__PROPS__"], children: () => { + } })] }) }); +}, Jn = (t) => function(e) { + return t(e, getRecord()); +}, Gn = (t, e = {}) => U(() => { + var i; + return (i = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : i.map(({ widgetByJs: n, widgetByJsSetting: r, ...a }, o) => { + const s = (d) => ({ record: d, column: a }); + let l = []; + return n && l.push([n, r]), l.length > 0 ? (a != null && a.render && l.push([Jn, a.render]), { ...a, onCell: s, render: (d, u) => new kt(l).toRender(d, u, "-") }) : { ...a, onCell: s }; + }); +}, [t, e]), Yn = (t = {}) => U(() => { + var e; + return t.body ?? (t.body = { cell: yi }), (e = t.body).cell ?? (e.cell = yi), t; +}, [t]), fa = (t) => { + const [e, i] = L({}); + return V(() => { + let n = !1; + return t && I.get(`/api/_/${t}`).then((r) => f.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig", "selectionType"])).then((r) => !n && i(r)), () => n = !0; + }, [t]), e; +}, ya = (t, e = {}) => { + const [i, n] = L({ dataSource: [] }); + return ht(() => { + let r = !1; + return t && I.get(`/api/${t}/${I.encode({ page: 1, ...e })}`).then((a) => !r && n(a)), () => r = !0; + }, [t, e]), i; +}, Vi = (t = [], e = /* @__PURE__ */ new Map(), i = "id", n) => { + const r = Y(n ? (a) => f.get(a, i, f.get(a, [n, i])) : (a) => f.get(a, i), [i, n]); + return Y((a) => t == null ? void 0 : t.filter((o) => !o.uuid || !e.has(o.uuid) || e.get(o.uuid).some((s) => s == r(a))), [t, e, r]); +}, Ut = (t = [], e = /* @__PURE__ */ new Map(), i = [], n = "id", r) => { + const a = Y(r ? (o) => f.get(o, n, f.get(o, [r, n])) : (o) => f.get(o, n), [n, r]); + return U(() => { + if (f.isEmpty(t) || !t.some(({ uuid: s }) => Ai.check(s))) return !1; + if (f.isEmpty(e) || f.isEmpty(i)) return !0; + const o = i.map((s) => a(s)); + return t.some(({ uuid: s }) => !s || !e.has(s) || e.get(s).some((l) => o.some((d) => d == l))); + }, [t, i, e, a]); +}, Xn = (t, e, i = "id", n = null) => { + const r = Tt(), a = H(!1), o = H(t.dataSource), s = H(t.itemOperationsAccess); + return V(() => (o.current = t.dataSource, s.current = t.itemOperationsAccess, () => a.current = !1), [t.dataSource, t.itemOperationsAccess]), a.current && (t.dataSource = o.current, t.itemOperationsAccess = s.current), [t, (l = 0, d = null) => { + var u, p; + if (a.current = !1, l === 1) return (u = t.onReload) == null ? void 0 : u.call(t); + if (l === 2) { + const m = f.get(d, "__PARENT_ID__", ""), g = f.get(d, i, f.get(d, [n, i], "")), y = f.findIndex(o.current, ["__PARENT_ID__", m]), b = f.findIndex(y > -1 ? f.get(o.current, [y, "children"]) : o.current, [i, g]); + if (b === -1) return (p = t.onReload) == null ? void 0 : p.call(t); + Promise.all([I.get(`/api/${e}/detail/${g}`), I.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([C, S]) => { + const v = f.get(o.current, y > -1 ? [y, "children", b, "children"] : [b, "children"]); + o.current = Pi(o.current, y > -1 ? { [y]: { children: { $splice: [[b, 1, { ...C, children: v }]] } } } : { $splice: [[b, 1, { ...C, children: v }]] }); + const k = new Map(S); + s.current.forEach(($, T) => { + var A; + (A = k.get(T)) != null && A.some((F) => F == g) || s.current.set(T, $.filter((F) => F !== g)); + }), k.forEach(($, T) => { + s.current.has(T) ? s.current.set(T, f.uniq([...s.current.get(T) || [], ...$])) : s.current.set(T, $); + }); + }).then(() => { + a.current = !0, r(); + }); + } + }]; +}, Qn = (t, e) => { + const i = Tt(), n = H(e), r = H(/* @__PURE__ */ new Map()), a = H([]), o = f.throttle((l) => { + a.current = [], I.list(t, f.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: d, condition: u, total: p, tab: m, sider: g, page: y, pageSize: b, operationsAccess: C, dataSource: S }) => { + n.current = { tab: m, condition: u, sider: g, keyword: d, total: p, pageSize: b, page: S != null && S.length ? y : 1 }, a.current = S, r.current = new Map(C), i(); + }); + }, 380, { leading: !1, trailing: !0 }); + mt(() => { + a.current = [], t && o(e); + }, [t, e]); + const s = U(() => f.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [n.current]); + return Object.assign(s, { onTabChange: (l) => o({ tab: l, page: 1 }), onPageChange: (l, d) => o({ page: l, pageSize: d }), onPageSizeChange: (l) => o({ pageSize: l, page: 1 }), onConditionChange: (l, d) => o({ keyword: d, condition: Pi(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => o({ sider: l, page: 1 }), onKeywordChange: (l) => o({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: a.current, onReload: o, payload: e == null ? void 0 : e.payload }); +}, Zn = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: d, resource: u, primaryKey: p, title: m, itemGridLayout: g, $setting: y, tabs: b, isConditionFormLayout: C, isTreeSider: S, treeSiderConfig: v }) => { + const { classNames: k, onClickCallback: $ } = pe(oe), T = f.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style"]), A = Vi(l, d, p, u), F = Y((M, z, O) => h(er, { className: R("ff-data-list-framework-item", k == null ? void 0 : k.item), operations: a ? A(z) : [], data: u ? { [u]: z } : z, children: M, onClickCallback: $ }), [u, p, a, $, l, d]); + return j("div", { className: R("ff-data-list-framework", e), children: [h(i.sider, { isTreeSider: S, ...v }), j("div", { className: R("ff-data-list-container", k == null ? void 0 : k.container), children: [h(i.filter, { isConditionFormLayout: C }), h(i.toolbar, { title: m, tabs: b }), h(hr, { ...T, ...g, empty: h(i.empty, { className: k == null ? void 0 : k.empty }), primaryKey: p, itemRender: F, dataSource: n }), h(i.footer, { isPaginate: r, isOperations: o, operations: s })] })] }); +}, er = ({ className: t, operations: e, children: i, data: n, onClickCallback: r }) => j("div", { className: R("data-list-grid-layout-item", t), children: [h("div", { className: "data-list-grid-layout-item-container", children: i }), !!(e != null && e.length) && h("div", { className: "data-list-grid-layout-item-actions", children: e.map((a) => h("span", { className: "data-list-grid-layout-item-action", children: h(P.Link, { uuid: a.uuid, type: a.type, name: a.name, widget: a.widget, widgetType: a.widgetType, widgetProps: a.widgetProps, widgetSetting: a.widgetSetting, widgetContainerProps: a.widgetContainerSetting, data: n, confirm: a.confirm, onAfterClick: (o) => o !== !1 && (r == null ? void 0 : r(a.isRefresh, n)) }, a.uuid || Vt()) }, (a == null ? void 0 : a.uuid) || Vt())) })] }), tr = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: d, resource: u, primaryKey: p, title: m, tabs: g, isPaginate: y, rowSelection: b, isTreeSider: C, treeSiderConfig: S, isConditionFormLayout: v, ...k }) => { + const { classNames: $, onClickCallback: T } = pe(oe), A = Vi(l, d, p, u), F = Ut(l, d, n, p, u); + return j("div", { className: R("ff-data-table-framework", e), children: [h(i.sider, { isTreeSider: C, ...S }), j("div", { className: R("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: v }), h(i.toolbar, { title: m, tabs: g }), h(lr, { ...k, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: n, rowSelection: b, operationRender: F ? (M) => { + var z; + return h("div", { className: "ff-data-table-actions", children: (z = A(M)) == null ? void 0 : z.map((O, D) => h(P.Link, { size: "small", uuid: O.uuid, type: O.type, name: O.name, widget: O.widget, widgetType: O.widgetType, widgetProps: O.widgetProps, widgetData: O.widgetData, widgetSetting: O.widgetSetting, widgetContainerProps: O.widgetContainerSetting, data: M, confirm: O.confirm, onAfterClick: (K) => K !== !1 && (T == null ? void 0 : T(O.isRefresh, M)) }, O.uuid || D)) }); + } : null }), h(i.footer, { isPaginate: y, isOperations: o, operations: s })] })] }); +}, Zt = (t = [], e, i = null) => { + var n; + return (n = f.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: a, y: o, w: s, h: l, field: { boxStyle: d, ...u } = {} }, p) => h("div", { className: "grid-layout-item", style: Di(a, o, s, l, d), children: h(e, { ...u, basicForm: i }) }, r ?? p)); +}, Di = (t, e, i, n, r = {}, a = 0) => { + const o = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; + return r != null && r.autoHeight ? o.height = "fit-content" : o["--grid-layout-row"] = `${n}`, r != null && r.alignItems && (o["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (o["--grid-layout-box-justify-content"] = r.justifyContent), o["--grid-layout-box-margin"] = wi(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), o["--grid-layout-box-padding"] = wi(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), a && (o.height = `${a}px`), o; +}, wi = (t, e, i, n) => `${t || 0}px ${e || 0}px ${i || 0}px ${n || 0}px`, wa = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, zi = (t) => Object.keys(t).reduce((e, i) => (/^on[A-Z]/.test(i) && (e[i] = t[i]), e), {}), Wi = ({ className: t, isConditionFormLayout: e }) => { + var m, g; + const [i, n] = L({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = E.useContext(oe), { keyword: d, condition: u } = (s == null ? void 0 : s()) || {}, [p] = wt.useForm(); + return V(() => { + r && e && I.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: y, marginX: b, marginY: C, rowHeight: S, cols: v, fields: k }) => { + n({ resource: y, itemMargin: [b, C], rowHeight: S, cols: v, fields: k }); + }).catch(() => n({})); + }, [r, e]), V(() => { + p.setFieldsValue({ keyword: d, ...u }); + }, [JSON.stringify([d, u])]), h("div", { className: R("ff-data-list-filter", l.filter, t), children: h(wt, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((m = i.fields) == null ? void 0 : m.length) > 1 ? (y) => o({ [i.resource]: y[i.resource] }, y.keyword) : () => { + }, onValuesChange: (y) => { + f.isEmpty(f.omit(y, ["keyword"])) || p.submit(); + }, children: ((g = i.fields) == null ? void 0 : g.length) > 1 ? h(ii, { ...i, children: h(ir, { onReset: () => { + const { keyword: y, condition: b } = s("init") || {}; + p.setFieldsValue({ keyword: y, ...b }); + } }) }) : h("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: h("div", { className: "grid-layout-item", style: Di(20, 0, 5, 2), children: h(wt.Item, { name: ["keyword"], children: h(vn.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (y) => a(y) }) }) }) }) }) }); +}, ir = ({ cols: t, fields: e, onReset: i }) => { + const [n, r] = L(!1), a = U(() => e == null ? void 0 : e.toReversed().some((o) => o.y > 1 || o.x + o.w >= t - 5), [t, e]); + return j(wt.Item, { label: " ", style: { "--item-span": 5 }, className: R("ff-data-list-filter-actions", { expanded: n }), children: [h(Ct, { onClick: i, children: "重置" }), h(Ct, { type: "primary", htmlType: "submit", children: "查询" }), a && h(P.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((o) => !o), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); +}; +Wi.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 nr = ({ className: t, operations: e, isOperations: i, isPaginate: n }) => { + const { onPageChange: r, onPageSizeChange: a, onClickCallback: o, getBase62params: s } = E.useContext(oe), { total: l, page: d, pageSize: u } = (s == null ? void 0 : s()) || {}; + return i && !f.isEmpty(e) || n ? j("div", { className: R("ff-data-list-footer", t), children: [h("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, m) => h(P, { uuid: p.uuid, type: p.type, name: p.name, widget: p.widget, widgetType: p.widgetType, widgetProps: p.widgetProps, widgetData: p.widgetData, widgetSetting: p.widgetSetting, widgetContainerProps: p.widgetContainerSetting, onAfterClick: (g) => g !== !1 && (o == null ? void 0 : o(p.isRefresh, null)) }, p.uuid || m)) }), n && h(xn, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${d} 页 / 总共 ${p} 条`, onChange: r, onShowSizeChange: a })] }) : null; +}, rr = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: h("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], ar = ({ className: t, width: e = 280, isTreeSider: i }) => { + const { classNames: n } = pe(oe); + return i ? h(Nn.DirectoryTree, { className: R("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: rr }) : null; +}, or = ({ className: t, title: e, tabs: i }) => { + const { getBase62params: n, onTabChange: r, onReload: a, classNames: o } = pe(oe), { tab: s } = (n == null ? void 0 : n()) || {}, [l, d] = An((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: r }); + return j("div", { className: R("ff-data-list-toolbar", o.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(Pn, { className: "ff-data-list-tabs", itemRender: ({ label: u, code: p, value: m }) => h("span", { onClick: () => d(m ?? p), className: R("ff-data-list-tab", { active: (m ?? p) == l }), children: u }), items: i }), j("div", { className: "ff-data-list-actions", children: [h(P.Link, { icon: "icon-reload", widget: () => a() }), h(P.Link, { icon: "icon-setting" })] })] }); +}, sr = ({ className: t, ...e }) => h(zt, { className: R(t, "ff-data-list-empty"), image: zt.PRESENTED_IMAGE_SIMPLE, ...e }), Bi = ({ isItemGridLayout: t, theme: e, themeProps: i, onClickCallback: n, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: d = 30, onPageSizeChange: u, tab: p, onTabChange: m, keyword: g, onKeywordChange: y, condition: b, onConditionChange: C, sider: S, onSiderChange: v, layouts: k, classNames: $ = {}, payload: T = {}, dataSource: A = [], rowSelection: F, getSelectedRows: M, primaryKey: z, ...O }) => { + const [D, K] = L(), _ = M ?? (() => A), re = Y((W, se) => { + const J = { tab: p, page: s, pageSize: d, keyword: g, sider: S, condition: b, total: o, payload: T }; + return W && W != "init" ? f.get(J, W, se) : J; + }, [JSON.stringify(b), JSON.stringify(T), p, s, d, g, S, o]), Ne = U(() => { + let W = { sider: ar, filter: Wi, footer: nr, toolbar: or, empty: sr }; + k === !1 ? W = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : f.isPlainObject(k) && (W = Object.assign({}, W, k)); + for (const se in W) if (W[se]) { + if (bn(W[se])) { + const J = W[se]; + W[se] = (Ot) => E.cloneElement(J, Ot); + } + } else W[se] = () => h(E.Fragment, {}); + return W; + }, [k]); + return V(() => { + e ? ue.getWidgetComponent(e).then((W) => { + if (!W) throw `${e} not found`; + return W; + }).catch((W) => ({ default: () => `${W}` })).then((W) => K(E.createElement(W.default, { ...O, layouts: Ne, $setting: i }))) : K(h(t ? Zn : tr, { ...O, layouts: Ne, $setting: i })); + }, [e, i]), h(oe.Provider, { value: { classNames: $, listCode: a, onClickCallback: n, onReload: r, getBase62params: re, onPageChange: l, onPageSizeChange: u, onTabChange: m, onSiderChange: v, onKeywordChange: y, onConditionChange: C, setPage: l, setPageSize: u, setTab: m, setSider: v, setKeyword: y, setCondition: C, getSelectedRows: _ }, children: D && E.cloneElement(D, { dataSource: A, primaryKey: z, rowSelection: F, ...O }) }); +}; +Bi.propTypes = { classNames: w.exact({ sider: w.string, filter: w.string, footer: w.string, toolbar: w.string, container: w.string, content: w.string, item: w.string, empty: w.string }), layouts: w.oneOfType([w.exact({ sider: w.oneOfType([w.elementType, w.element]), filter: w.oneOfType([w.elementType, w.element]), footer: w.oneOfType([w.elementType, w.element]), toolbar: w.oneOfType([w.elementType, w.element]), empty: w.oneOfType([w.elementType, w.element]) }), w.bool]) }; +var Re, Ee, We, xt; +const fe = class fe { + constructor() { + x(this, Ee, null); + x(this, We, /* @__PURE__ */ new Map()); + x(this, xt, () => { + if (c(this, Ee)) return c(this, Ee).port.postMessage({ command: "status", data: [] }); + B(this, Ee, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), c(this, Ee).port.onmessage = (e) => { + var i, n; + (i = e.data) != null && i.uuid ? c(this, We).forEach((r, a) => { + var o; + (r == "*" || (o = r == null ? void 0 : r.includes) != null && o.call(r, e.data.uuid)) && a(e.data); + }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && I.get("/api/user-api-token").then(({ token: r, expire_at: a }) => { + c(this, Ee).port.postMessage({ command: "initWs", data: [`ws${f.trimStart(I.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); + }); + }, c(this, Ee).port.postMessage({ command: "status", data: [] }); + }); + N(this, "subscribe", (e, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", c(this, We).set(e, i), c(this, We).size == 1 && c(this, xt).call(this), () => this.unsubscribe(e))); + N(this, "unsubscribe", (e) => c(this, We).delete(e)); + if (c(fe, Re)) return c(fe, Re); + } +}; +Re = new WeakMap(), Ee = new WeakMap(), We = new WeakMap(), xt = new WeakMap(), x(fe, Re, null), N(fe, "getInstance", () => (c(fe, Re) || B(fe, Re, new fe()), c(fe, Re))); +let Kt = fe; +const qi = Kt.getInstance(), ei = E.forwardRef(({ listCode: t, base62params: e, className: i, theme: n, themeProps: r, layouts: a, classNames: o, onSelectionChange: s, defaultSelectedRowKeys: l, selectedRowKeys: d }, u) => { + const [{ resource: p, primaryKey: m, batchOperations: g = [], itemOperations: y = [], columns: b = [], themeConfig: C, theme: S, isConditionFormLayout: v = !1, isTreeSider: k, treeSiderConfig: $, isItemGridLayout: T, itemGridLayout: { themeConfig: A, ...F } = {}, title: M, isPaginate: z, tabs: O, selectionType: D }, K] = L({ isItemGridLayout: !1, itemGridLayout: {} }), _ = Qn(t, e), [{ dataSource: re, itemOperationsAccess: Ne, condition: W, tab: se, keyword: J, page: Ot, total: en, pageSize: tn, sider: nn, onConditionChange: rn, onTabChange: an, onKeywordChange: on, onPageChange: sn, onPageSizeChange: ln, onSiderChange: cn, onReload: Ft, payload: dn }, oi] = Xn(_, t, m, p), [un, pn] = Fn([], { defaultValue: l ?? [], value: d }), [si, gn] = L([]), li = Y(() => D ? si : re, [D, si, re]), hn = Ut(y, Ne, re, m), mn = Ut(g); + V(() => { + let X = null; + return t && I.get(`/api/_/${t}`).resp(({ data: Me, res: At }) => { + Me != null && Me.isDynamicRefresh && (X = qi.subscribe(() => Ft(), At)), K(Me); + }).catch(() => K({})), () => X == null ? void 0 : X(); + }, [t]), E.useImperativeHandle(u, () => ({ onReload: Ft, onClickCallback: oi, getSelectedRows: li })); + const fn = { listCode: t, title: M, classNames: o, layouts: a, resource: p, primaryKey: m, theme: n || S, themeProps: r || C, isTreeSider: k, treeSiderConfig: $, isPaginate: z, rowSelection: D ? { type: D, columnWidth: 80, selectedRowKeys: un, onChange: (X, Me) => { + gn((At) => { + const ci = new Map(At.map((le) => [le == null ? void 0 : le[m], le])); + return Me.forEach((le) => ci.set(le == null ? void 0 : le[m], le)), X.map((le) => ci.get(le)).filter(Boolean); + }), pn(X), s == null || s(X, Me); + } } : void 0, getSelectedRows: li, tabs: O, isItemOperations: hn, itemOperations: y == null ? void 0 : y.map((X) => f.isEmpty(X == null ? void 0 : X.confirm) ? X : { ...X, confirm: Object.assign({}, X.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: mn, batchOperations: g, isItemGridLayout: T, columns: b, itemGridLayout: { ...F, themeProps: A }, isConditionFormLayout: v, itemOperationsAccess: Ne, dataSource: re, onConditionChange: rn, onTabChange: an, onKeywordChange: on, onPageChange: sn, onPageSizeChange: ln, onSiderChange: cn, condition: W, tab: se, keyword: J, page: Ot, total: en, pageSize: tn, sider: nn, payload: dn }; + return h(Bi, { ...fn, className: R("ff-data-list-helper", i), onReload: Ft, onClickCallback: oi }); +}), Ui = (t, e, i = !0) => i !== !0 && i-- <= 0 ? [] : f.isArray(t) && !f.isEmpty(t) ? t.reduce((n, r) => (Reflect.has(r, e) && Reflect.has(r, "children") && n.push(r[e]), Reflect.has(r, "children") && !f.isEmpty(r.children) ? n.concat(Ui(r.children, e, i)) : n), []) : [], lr = ({ className: t, primaryKey: e, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: a = 180, components: o = {}, rowSelection: s, ...l }) => { + const { classNames: d } = pe(oe), u = H(null), p = H(null), [m, g] = L([]), [y, b] = L({ width: 0, height: 0 }); + V(() => { + g(Ui(n, e)); + }, [n, e]), Cn(() => { + const k = new ResizeObserver(() => { + var $; + b({ width: (($ = u.current) == null ? void 0 : $.nativeElement.querySelector(".ant-table-body").scrollWidth) || p.current.offsetWidth, height: p.current.offsetHeight }); + }); + return p.current && k.observe(p.current), () => { + p.current && k.unobserve(p.current); + }; + }, []); + const C = U(() => { + if (!(y != null && y.width) || !(i != null && i.length)) return i; + const k = (s ? s.columnWidth ?? 32 : 0) + (r ? a : 0), $ = i.reduce((F, M) => F + (M.isWidthFixed && M.width ? M.width : 0), 0), T = i.filter((F) => !F.isWidthFixed).reduce((F, M) => F + (M.width ?? 100), 0); + if ($ + T + k >= y.width) return i; + const A = y.width - $ - k; + return i.map((F) => F.isWidthFixed ? F : { ...F, width: Math.floor(A * (F.width ?? 100) / T) }); + }, [i, y.width, s, r, a]), S = Gn(C), v = Yn(o); + return h("div", { ref: p, className: R("ff-data-list-table", d.content, t), children: y.height ? h(hi, { bordered: !0, ...l, components: v, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), rowSelection: s, columns: (() => { + var $, T; + const k = [...S ?? []]; + return s && k.splice((T = ($ = k[0]) == null ? void 0 : $.key) != null && T.startsWith("__") ? 1 : 0, 0, hi.SELECTION_COLUMN), r && k.push({ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / y.width * 100).toFixed(2)}%`, render: (A, F, M) => r(F, M) }), k; + })(), dataSource: n, size: "middle", scroll: { x: "max-content", y: y.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: m } }) : null }); +}, cr = "RC_FORM_INTERNAL_HOOKS", dr = (t) => { + const [e, i] = E.useState({ items: [] }); + return V(() => { + t && I.get(`/api/_/${t}`).then(({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: d, cols: u, rowHeight: p, fields: m, theme: g, themeSetting: y, groups: b }) => ({ uuid: n, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: d, cols: u, rowHeight: p, theme: g, themeProps: y, groups: b, items: m })).then(i); + }, [t]), e; +}, ur = (t, { initialValue: e, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: a = "string" }, o = null) => { + const s = H(!1), l = pe(Ni), [d, u] = L(), [p, m] = L(i != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(cr) || {}; + return V(() => g == null ? void 0 : g((y, b, C) => { + if (!s.current) return; + const S = f.get(b, t); + f.isEqual(S, p) || m(de(S, a)); + }), [p]), V(() => { + i == "javascript" && e ? Ie.exec(e, {}, { getFieldValueForBasicForm: (y) => o ? o.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => m(de(y, a))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => s.current = !0) : (e && m(de(e ?? l.getFieldValue(t), a)), s.current = !0); + }, [e, i]), ht(() => { + s.current && n && new kt([n, r]).toValue(p, l.getFieldsValue(!0)).then(u).catch((y) => { + u(y), console.error("布局数据转换错误: ", y, n); + }); + }, [p, n, r]), [d ?? p, p]; +}, ba = (t, e, i = null) => U(() => Zt(t, e, i), [t]), Ki = (t, e, i = {}, n = {}, r = {}, a = null) => { + const o = pe(Ni), s = Tt(), l = H(!0), d = H([]), [u, p] = L(e), [m, g] = L(), y = ae.useWatch((b) => JSON.stringify(f.pick(b, d.current)), o) || "{}"; + return mt(() => { + t && Ie.exec(t, i, { ...n, getFieldValueForBasicForm: (b) => r ? r.getFieldValue(b) : null, getFieldValue: f.wrap(o.getFieldValue, (b, C) => (d.current.some((S) => f.isEqual(S, C)) || (d.current.push(C), s()), b == null ? void 0 : b(C))), isFieldTouched: o.isFieldTouched, isFieldsTouched: o.isFieldsTouched }).then((b) => { + l.current && (p(b), g(null)); + }).catch((b) => { + l.current && (p(e), g(b)); + }); + }, [t, y, o, i, n]), V(() => () => l.current = !1, []), t ? [a ? de(u, a) : u, m] : [a ? de(e, a) : e, null]; +}, pr = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: i, ...n }) => { + const r = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [a, o] = L(); + return V(() => { + r && ue.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: gr(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => o(E.createElement(s.default, n))); + }, [r]), a; +}, gr = (t, e = {}, i = null) => (n) => { + const { code: r, label: a, extras: o, isVirtual: s, initialValue: l, initialValueLanguage: d, convertJs: u, convertJsSetting: p, value: m, ...g } = f.merge({}, e, n), [y, b] = ur(s ? null : r, { initialValue: l, initialValueLanguage: d, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, i), C = U(() => { + const k = Object.keys((e == null ? void 0 : e.extras) || {}); + return f.over([f.partialRight(f.pick, k), f.partialRight(f.omit, k)]); + }, [e == null ? void 0 : e.extras]), [S, v] = C(g); + return h(t, { ...v, value: y, rawValue: b, $setting: Object.assign({}, o, S) }); +}, _i = ({ theme: t, basicForm: e, items: i = [{ key: "default", label: "默认" }], fields: n = [], itemRender: r, chunks: a = [], children: o, $setting: s = {}, ...l }) => { + const [d, u] = L(); + V(() => { + t ? ue.getWidgetComponent(t).then((m) => { + if (!(m != null && m.default)) throw "not found"; + return m; + }).catch((m) => ({ default: () => `${t} ${m}` })).then((m) => u(E.createElement(m.default, {}))) : u(null); + }, [t]); + const p = U(() => i == null ? void 0 : i.map((m) => ({ ...m, children: r(m, n == null ? void 0 : n.filter((g) => !(g != null && g.group) && m.key == "default" || g.group == m.key), m.key == "default" ? o : null) })).concat(a), [i, o, a]); + return d && E.cloneElement(d, { items: p, basicForm: e, $setting: { ...s, ...l } }); +}, Hi = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: a = 12, rowHeight: o = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: d = {}, formFields: u = [], fields: p = [], data: m, theme: g, themeProps: y = {}, groups: b = [{ key: "default", label: "默认" }], children: C, ...S }) => { + const [v] = ae.useForm(e), k = U(() => [{ name: "__PROPS__", value: d }].concat(u), [d, u]); + ht(() => (v.setFieldsValue(m), () => v.resetFields()), [m]); + const $ = (T, A, F) => { + const M = Zt(A, pr, i), z = zi(S); + return j("div", { ...z, className: R("ff-grid-layout", r), style: { ...n, "--grid-layout-item-margin-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-item-margin-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-container-padding-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-container-padding-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [M, F && E.cloneElement(F, { cols: a, rowHeight: o, itemMargin: l, containerPadding: s, fields: A, basicForm: i })] }); + }; + return h(ae, { ...S, fields: k, form: v, component: !1, children: g ? h(_i, { ...y, items: b, theme: g, itemRender: $, fields: p, children: C, basicForm: i }) : $(0, p, C) }); +}, Ca = /* @__PURE__ */ ((t) => function({ code: e, data: i, ...n }) { + const { uuid: r, resource: a, items: o, hides: s, rowHeight: l, marginX: d, marginY: u, cols: p, theme: m, themeProps: g, groups: y } = dr(e) || {}, b = U(() => [{ name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: r }], [e, r, a]); + return a && h(t, { name: e, theme: m, themeProps: g, groups: y, ...n, fields: o, formFields: b, rowHeight: l, cols: p, itemMargin: [d, u], data: a ? { [a]: i } : i }); +})(Hi), hr = ({ column: t = 0, colWidth: e = 0, cols: i, rowHeight: n, itemMargin: r, fields: a, primaryKey: o, dataSource: s, beforeRender: l = null, afterRender: d = null, itemClassName: u, itemRender: p = (v, k, $) => v, empty: m = h(zt, { description: null }), className: g, style: y = {}, theme: b, themeProps: C = {}, groups: S = [{ key: "default", label: "默认" }] }) => { + const { classNames: v } = pe(oe), k = U(() => h(Hi, { groups: S, theme: b, themeProps: C, cols: i, rowHeight: n, itemMargin: r, fields: a, className: u }), [a, i, n, r, S, b, C]), $ = f.isEmpty(s); + return j("div", { className: R("ff-data-list-content", v.content, g), style: Object.assign({}, y, t && { "--col-num": t }, e && { "--col-width": e }), children: [l == null ? void 0 : l(s), $ ? m : s.map((T, A) => { + const F = p(E.cloneElement(k, { data: T }), T, A); + return E.cloneElement(F, { key: `${(T == null ? void 0 : T[o]) ?? A}-${Un(T)}` }); + }), d == null ? void 0 : d(s)] }); +}, mr = ({ component: t, $props: e }) => { + const { base62params: i } = gt(e, {}); + return h(ee, { children: h(ei, { listCode: t, base62params: I.decode(i) }) }); +}, ka = () => h(Ji, {}), Ji = () => "Empty", fr = ({ component: t, $setting: e, $props: i }) => { + const [n, r] = L(); + V(() => { + if (!t) return r(h(Ji, { description: null })); + ue.getWidgetComponent(t).catch((o) => ({ default: () => `${o}` })).then((o) => E.createElement(o.default, { $setting: e })).then(r); + }, [t]); + const a = gt(i, {}); + return n ? E.cloneElement(n, a) : null; +}, Sa = () => "NotFoundPage"; +var Oe, ce, Fe, Ae, at, ot; +const ye = class ye { + constructor() { + x(this, ce, /* @__PURE__ */ new Map()); + x(this, Fe, {}); + x(this, Ae, null); + N(this, "init", (e, i) => { + B(this, ce, e), B(this, Fe, i); + }); + N(this, "get", (e) => (c(this, ce).has(e) || (e = Array.from(c(this, ce).keys()).find((i) => c(this, ce).get(i).uri === e)), c(this, ce).get(e) || {})); + N(this, "redirect", (e, i, n = {}) => { + const { uri: r, type: a, widgetProps: o } = this.get(e) || {}, { router: s, query: l, ...d } = i || {}, u = Object.assign({}, d, s), p = Object.assign({}, d, l); + a == "list" && (u.base62params = I.encode(u != null && u.base62params ? u.base62params : u)); + let m = jn(r || e, u); + const g = new URLSearchParams(); + for (const y in o || {}) (o == null ? void 0 : o.type) == "query" && Object.has(p, y) && g.append(y, JSON.stringify(p[y])); + return g.size > 0 && (m = `${m}?${g.toString()}`), n != null && n.isOpenWindow ? window.open(m) : c(this, Ae).navigate(m, { replace: !!(n != null && n.isReplaceRouteHistory) }); + }); + N(this, "getMenus", (e) => { + var i; + return ((i = c(this, Fe)) == null ? void 0 : i[e]) || []; + }); + N(this, "findMenuPathByUuid", (e) => { + let i = []; + for (const n in c(this, Fe)) if (i = c(this, at).call(this, c(this, Fe)[n], e, [n]), i.length > 1) return i; + return i; + }); + N(this, "getMenusByRouteUuid", (e) => c(this, ot).call(this, e, Object.values(c(this, Fe)).flat())); + x(this, at, (e, i, n = []) => { + if (f.isEmpty(e)) return n; + for (const { uuid: r, children: a } of e) { + if (r == i) return n.concat(r); + if (!f.isEmpty(a)) return n.concat(r, c(this, at).call(this, a, i)); + } + return n; + }); + x(this, ot, (e, i) => { + var r; + let n = []; + for (const a of i) a.widgetType == "redirect" && (a.uuid == e || a.widget == e ? n.push(a) : (r = a.children) != null && r.length && (n = n.concat(c(this, ot).call(this, e, a.children)))); + return n; + }); + N(this, "getCurrentMenu", () => { + const { uuid: e } = this.getCurrentRoute() || {}; + if (!e) return; + const i = this.getMenusByRouteUuid(e); + return f.isEmpty(i) ? void 0 : i[0]; + }); + N(this, "getCurrentRoute", (e = 0) => { + var n; + const i = (n = c(this, Ae).state.matches[c(this, Ae).state.matches.length - 1 - e]) == null ? void 0 : n.route; + if (!i) return null; + for (let [r, a] of c(this, ce)) if (a.uri === i.path) return a; + return null; + }); + N(this, "getPageParams", (e) => { + var r, a, o; + let i = "", n = {}; + if (Ti()) n = Ln(), i = (r = In()) == null ? void 0 : r.search; + else { + const { location: s = {}, matches: l = [] } = ((a = c(this, Ae)) == null ? void 0 : a.state) || {}; + n = ((o = l[l.length - 1]) == null ? void 0 : o.params) || {}, i = s.search; + } + return i && new URLSearchParams(i).forEach((s, l) => { + n[l] = s; + }), e ? f.get(n, e) : n; + }); + N(this, "createBrowserRouter", (e = {}) => { + if (c(this, ce).size == 0) return null; + const i = qe.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = qe.get(ue.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, a = (s, l) => () => Promise.all([ue.getWidgetComponent(s), gt(l)]).then(([d, u]) => [d.default || function() { + return `${s}`; + }, u]).then(([d, u]) => ({ Component: () => E.createElement(Oi, {}, E.createElement(d, { $setting: u })) })), o = Array.from(c(this, ce).values()).reduce((s, { uuid: l, uri: d, name: u, type: p, component: m, widgetSetting: g, widgetProps: y, isLogin: b, isLayout: C, extra: S }) => { + let v = {}, k = 0; + switch (p) { + case "list": + v.element = E.createElement(mr, { component: m, $props: y }); + break; + case "fsdpf-component": + v.element = E.createElement(fr, { key: m, component: m, $setting: g, $props: y }); + } + const $ = (S == null ? void 0 : S.theme) ?? (S == null ? void 0 : S.layout); + if ($) { + const T = (S == null ? void 0 : S.themeProps) ?? (S == null ? void 0 : S.layoutProps); + if (!r[$]) return r[$] = s.length, [...s, { path: "/", lazy: a($, T), children: [{ path: d, ...v }] }]; + k = r[$]; + } + return C && k > -1 ? (s[k].children.push({ path: d, ...v }), s) : [...s, { path: d, ...v }]; + }, [{ path: "/", lazy: a(i, {}), children: [] }]); + return o.push({ index: !0, element: E.createElement(yr, { to: n, replace: !0 }) }), B(this, Ae, Mn(o, e)); + }); + if (c(ye, Oe)) return c(ye, Oe); + } +}; +Oe = new WeakMap(), ce = new WeakMap(), Fe = new WeakMap(), Ae = new WeakMap(), at = new WeakMap(), ot = new WeakMap(), x(ye, Oe, null), N(ye, "getInstance", () => (c(ye, Oe) || B(ye, Oe, new ye()), c(ye, Oe))); +let _t = ye; +const yr = ({ to: t, replace: e }) => Ti() ? E.createElement(Vn, { to: t, replace: e }) : (window.document.location = t, "redirect"), xe = _t.getInstance(), Ue = new Worker(new URL("/ff-worker/index.js", self.location)), bi = { getConfigure: (t) => qe.get(t), route: { redirect: (...t) => xe.redirect(...t), getPageParams: (...t) => xe.getPageParams(...t), getCurrentRoute: () => xe.getCurrentRoute() }, popup: { notification: (...t) => ne.notification(...t), success: (...t) => ne.success(...t), error: (...t) => ne.error(...t), form: (...t) => ne.form(...t), modal: (...t) => ne.modal(...t), confirm: (...t) => ne.confirm(...t) } }; +var Nt, Je, je; +const q = class q { + constructor() { + N(this, "exec", (e, i = {}, n = {}, r = "") => new Promise((a, o) => { + if (!/^(?!\s*(\/\/|\/\*|\*)).*?\S+/m.test(e)) return a(); + const s = pi(q, Nt)._++; + c(q, Je).set(s, n), q.mQueue.set(s, [a, o]), Ue.postMessage({ id: s, session: r, category: "eval", method: e, args: i }); + })); + N(this, "clear", (e) => Ue.postMessage({ session: e, category: "clear" })); + if (c(q, je)) return c(q, je); + Promise.resolve().then(() => qr).then((e) => { + bi.http = e.http; + }), Ue.addEventListener("message", ({ data: { id: e, task_id: i, method: n, args: r, category: a, data: o, error: s, session: l } }) => { + if (a === "eval" && q.mQueue.has(e)) s !== null ? q.mQueue.get(e)[1](s) : q.mQueue.get(e)[0](o), c(q, Je).delete(e), q.mQueue.delete(e); + else if (a === "util") try { + const d = f.get(bi, n.split("/")) || f.get(c(q, Je).get(i), n.split("/")); + if (!f.isFunction(d)) throw `${n} not found`; + Promise.resolve(Reflect.apply(d, void 0, r)).then((u) => { + Ue.postMessage({ id: e, task_id: i, category: a, method: n, args: r, session: l, data: u, error: null }); + }).catch((u) => { + Ue.postMessage({ id: e, task_id: i, category: a, method: n, args: r, session: l, data: null, error: u }); + }); + } catch (d) { + Ue.postMessage({ id: e, task_id: i, category: a, method: n, args: r, session: l, data: null, error: d }); + } + }, !1); + } +}; +Nt = new WeakMap(), Je = new WeakMap(), je = new WeakMap(), N(q, "mQueue", /* @__PURE__ */ new Map()), x(q, Nt, 0), x(q, Je, /* @__PURE__ */ new Map()), x(q, je, null), N(q, "getInstance", () => (c(q, je) || B(q, je, new q()), c(q, je))); +let Ht = q; +const Ie = Ht.getInstance(), Tt = () => { + const t = H(!0), [, e] = E.useReducer((i) => i + 1, 0); + return V(() => () => t.current = !1, []), () => t.current && e(); +}, Ea = (t) => { + const e = H(); + return V(() => { + e.current = t; + }, [t]), e.current; +}, $a = (t) => { + const [e, i] = L(t), n = H(null), r = Y((a, o) => { + n.current = o, i(a); + }, []); + return V(() => { + n.current && (n.current(e), n.current = null); + }, [e]), [e, r]; +}, ht = (t = (n) => { +}, e, i = f.isEqual) => { + const n = E.useRef(); + i(e, n.current) || (n.current = f.cloneDeep(e)), E.useEffect(t, [n.current]); +}, mt = ht, Gi = (t, e = "string") => { + var i; + if (!Array.isArray(t)) return t; + for (let n = 0; n < t.length; n++) t[n].value = de((i = t[n]) == null ? void 0 : i.value, e), t[n] && Reflect.has(t[n], "children") && (t[n].children = Gi(t[n].children, e)); + return t; +}, va = (t, e = "json", i = "string", n, r = null) => { + const [a] = ae.useForm(n), [o, s] = L([{ label: "无", value: "", disabled: !0 }]), l = H([]), d = ae.useWatch((u) => l.current.length === 0 ? null : f.pick(u, l.current), a) || null; + return V(() => { + Array.isArray(t) ? s(t) : e === "javascript" && t ? Ie.exec(t, {}, { getFieldValue: (u) => (l.current.includes(u) || l.current.push(u), a.getFieldValue(u)), getFieldValueForBasicForm: (u) => (l.current.includes(u) || l.current.push(u), r ? r.getFieldValue(u) : a.getFieldValue(u)) }).then((u) => { + s(de(u, "array")); + }).catch((u) => console.error("useOptions", u)) : t && s(de(t, "array")); + }, [t, e, d]), Gi(o, i); +}, xa = (t) => { + const [e, i] = L(), n = { type: "GET" }; + if (typeof t == "string" ? n.url = t : f.isPlainObject(t) && Object.assign(n, t), !(n != null && n.url)) throw "url is required"; + const r = (a) => I.request(n, !1).resp((o) => (console.log("useSubscribeRequest", a), i(o), o)); + return ht(() => { + let a = null; + return r().then((o) => { + a = qi.subscribe(f.throttle(r, 180, { leading: !1, trailing: !0 }), o.res); + }), () => a == null ? void 0 : a(); + }, n), e; +}, wr = (t) => { + const [e, i] = E.useState({ items: [], hides: [] }); + return E.useEffect(() => { + t && I.get(`/api/_/${t}`).then(({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: d, marginX: u, marginY: p, listenChangeFields: m, listenChangeFieldsFunc: g, fields: y, theme: b, themeSetting: C, groups: S }) => ({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: d, marginX: u, marginY: p, theme: b, themeProps: C, groups: S, listenChangeFields: m, listenChangeFieldsFunc: g, ...y.reduce((v, k) => { + var $; + return ($ = k == null ? void 0 : k.field) != null && $.hidden ? v.hides.push(k == null ? void 0 : k.field) : v.items.push(k), v; + }, { items: [], hides: [] }) })).then(i); + }, [t]), e; +}, br = ({ max: t = 0, min: e = 0, type: i = "", message: n, pattern: r, required: a = !1, validator: o } = {}, s, l) => { + const [d, u] = L([]); + return V(() => { + const p = []; + if (a) { + let m = l; + switch (l) { + case "number": + case "string": + case "array": + break; + case "bool": + m = "boolean"; + break; + case "json": + m = "object"; + } + p.push({ type: m, required: !0, whitespace: !0, message: "该项必填" }); + } + switch (i) { + case "string": + p.push({ type: i, max: t, min: e, message: n || (e && t ? `字符必须在 ${e} ~ ${t} 之间` : `${t ? "最多能有" : "最少要有"} ${e || t} 个字符`) }); + break; + case "pattern": + p.push({ type: "string", pattern: r, message: n }); + break; + case "validator": + o && p.push(({ getFieldValue: m }) => ({ validator: async (g, y) => { + const b = await Ie.exec(o, { value: y, fieldName: s }, { getFieldValue: m }); + return f.isString(b) && b ? Promise.reject(b) : f.isBoolean(b) && !b ? Promise.reject(n) : Promise.resolve(); + } })); + } + u(p); + }, [t, e, i, n, r, a, o]), d; +}, Cr = (t, e, i) => { + const [n, r] = L(null); + return V(() => { + const { initDataUri: a = `/api/${t}`, initDataMethod: o = "GET" } = i || {}; + e && I.request({ method: o, url: f.trimEnd(`${a}/${e}`, "/") }).then((s) => { + r(s); + }); + }, [t, e, i]), n; +}, kr = (t, e, i) => Y((n, r = { serialize: (a) => a, onSuccess: () => { +}, onFail: (a) => (a == null ? void 0 : a.errorFields) && ne.error("请先完善表单信息", { duration: 2e3 }) }) => { + const a = n.getFieldValue("__RESOURCE__"), { submitDataUri: o = `/api/${t}`, submitDataMethod: s = "POST" } = i || {}; + return n.validateFields().then((l) => a ? f.pick(l, [a]) : l).then(r.serialize).then((l) => I.request({ method: s, url: f.trimEnd(`${o}/${e || ""}`, "/"), data: l }).msg(r.onSuccess)).catch(r.onFail); +}, [t, e, i]), Sr = (t, e, i, n) => { + const r = Cr(e, i, n); + V(() => { + r ? t.setFieldsValue(r) : t.resetFields(); + }, [t, r]); + const a = kr(e, i, n); + return f.partial(a, t); +}, Er = (t, e, i = [], n = {}) => { + const r = H({}), a = H(), o = f.debounce(Tt(), 180), s = ["disabled", "required"], l = (m, g) => { + s.includes(m) && (r.current[m] = g), o(); + }, d = U(() => ({ setDisabled: (m) => l("disabled", m), setRequired: (m) => l("required", m), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [e]), [u, p] = Ki(e, -1, {}, d, n); + if (!p && a.current != u && (u >= 0 || !f.isEmpty(i == null ? void 0 : i[u]))) { + a.current = u; + const { widget: m, widgetPrefix: g, props: y } = i == null ? void 0 : i[u]; + t = ji(m, g), r.current = f.merge(y, f.pick(r.current, s)); + } + return [t, r.current]; +}, Ci = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), Na = ({ value: t, onChange: e }, i = null) => { + const n = H(), [r] = ae.useForm(i), a = H({}); + return mt(() => { + f.isEqual(n.current, t) || r.setFieldsValue(t); + }, [t]), V(() => () => r.resetFields(), []), [U(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (o) => (s) => { + const l = Ci(o); + s ? a.current[l] = s : delete a.current[l]; + } }, scrollToField: (o, s = {}) => { + console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); + }, focusField: (o) => { + console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); + }, getFieldInstance: (o) => { + const s = Ci(o); + return a.current[s]; + } }, [r]), (o, s) => { + n.current = s, e == null || e(s); + }]; +}, ti = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: i, subWidgets: n = [], basicForm: r, ...a }) => { + const o = ji(t, e), [s, l] = Er(o, i, n, r), [d, u] = L(); + return V(() => { + s && ue.getWidgetComponent(s).then(({ defaultProps: p = {}, default: m }) => ({ default: $r(m, p, r) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(E.createElement(p.default, a))); + }, [s]), d && E.cloneElement(d, { ...a, ...l }); +}, $r = (t, e = {}, i = null) => (n) => { + const { type: r, code: a, label: o, noStyle: s, style: l, placeholder: d, required: u = !1, extras: p, validators: m, help: g, isVirtual: y, $isReserved: b, initialValue: C, initialValueLanguage: S, ...v } = f.omit(f.merge({}, e, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = br(Object.assign({}, m, u ? { required: !0 } : {}), a, r), $ = U(() => { + const z = Object.keys((e == null ? void 0 : e.extras) || {}); + return f.over([f.partialRight(f.pick, z), f.partialRight(f.omit, z)]); + }, [e == null ? void 0 : e.extras]), [T, A] = $(v), F = { label: o, noStyle: s, style: l, colon: !1, layout: "vertical" }, M = Y((z) => z == null ? void 0 : de(z, r), [r]); + return h(Xt, { name: a, rules: k, initialValue: M(C), normalize: M, children: (z, O, D) => { + var K; + return h(t, { type: r, rcform: D, basicForm: i, itemProps: { validateStatus: O.errors.length > 0 ? "error" : "success", tooltip: g || null, help: O.errors.length > 0 ? O.errors.join("、") : null, required: ((K = k == null ? void 0 : k[0]) == null ? void 0 : K.required) || !1, ...F }, fieldProps: { placeholder: d, ...A, ...z }, $setting: Object.assign({}, p, T) }); + } }); +}, ii = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: a = 24, rowHeight: o = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: d = [], hides: u = [], primaryKey: p = 0, formProps: m = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: b, onValuesChange: C, theme: S, themeProps: v = {}, groups: k = [{ key: "default", label: "默认" }], children: $, ...T }) => { + const [A] = ae.useForm(e), F = Y((O, D) => { + C == null || C(O, D), b && Array.isArray(y) && Ie.exec(b, { changedValues: O, allValues: D }, { getFieldValue: A.getFieldValue, setFieldValue: A.setFieldValue, setFieldsValue: A.setFieldsValue, isFieldTouched: A.isFieldTouched, isFieldsTouched: A.isFieldsTouched }).catch((K) => console.error("onFormValuesChange", t, K)); + }, [t, A, C, y, b]), M = U(() => [{ name: "__PROPS__", value: m }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, m, g]), z = (O, D, K) => { + const _ = Zt(D, ti, i), re = zi(T); + return j("div", { ...re, className: R("ff-grid-layout-form", r), style: { ...n, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-container-padding-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [_, K && E.cloneElement(K, { cols: a, rowHeight: o, itemMargin: s, containerPadding: l, fields: D, basicForm: i })] }); + }; + return j(ae, { ...T, form: A, fields: M, onValuesChange: F, children: [S ? h(_i, { ...v, items: k, theme: S, itemRender: z, fields: d, children: $, basicForm: i }) : z(0, d, $), u == null ? void 0 : u.map((O) => { + var D; + return h(Xt, { name: O.code, children: h(vr, { form: A, basicForm: i, name: O.code, type: O.type, initialValue: O.initialValue, initialValueLanguage: (D = O.extras) == null ? void 0 : D.initialValueLanguage }) }, JSON.stringify(O.code)); + })] }); +}, vr = ({ type: t, initialValue: e, initialValueLanguage: i, onChange: n, basicForm: r }) => { + const [a, o] = Ki(i == "javascript" && e, i == "javascript" ? void 0 : e, {}, {}, r); + return V(() => { + i == "javascript" ? n(de(a, t)) : e && n(de(e, t)); + }, [t, e, a]), null; +}; +ii.propTypes = { fields: w.array, hides: w.array }; +const xr = /* @__PURE__ */ ((t) => ({ code: e, isPreview: i = !1, ...n }) => { + const { align: r, autoComplete: a, resource: o, items: s, hides: l, rowHeight: d, marginX: u, marginY: p, cols: m, listenChangeFields: g, listenChangeFieldsFunc: y, pk: b, uuid: C, theme: S, themeProps: v, groups: k } = wr(e), $ = U(() => [{ name: "__PK__", value: b }, { name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: C }], [b, e, C, o]); + return h(t, { name: e, autoComplete: a, theme: S, themeProps: v, groups: k, ...n, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: y, fields: s, hides: l, cols: m, rowHeight: d, itemMargin: [u, p] }); +})(ii), Yi = ({ $setting: t, $close: e, extras: i, code: n, primaryKey: r, ...a }) => { + const [o] = ae.useForm(), s = Sr(o, n, r, t); + return h(ee, { actions: j(E.Fragment, { children: [h(P, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => s({ onSuccess: e }) }), h(P, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: i, children: h(xr, { form: o, code: n, primaryKey: r, ...a }) }); +}, ki = /* @__PURE__ */ new Set(), Jt = (t = [], e = 0) => { + const i = t[e]; + if (i.length && !ki.has(i)) { + const n = document.createElement("script"); + n.setAttribute("src", i), n.setAttribute("data-namespace", i), t.length > e + 1 && (n.onload = () => { + Jt(t, e + 1); + }, n.onerror = () => { + Jt(t, e + 1); + }), ki.add(i), document.body.appendChild(n); + } +}, St = ({ className: t, type: e, style: i = {}, ...n }) => h("span", { role: "img", className: R("ff-iconfont", t), style: i, ...n, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); +St.propTypes = { className: w.string, type: w.string.isRequired, style: w.object }, St.init = Jt; +const Nr = (t, e, i, n) => xe.redirect(i, e, n), Pr = (t, e = {}, i, n = {}) => { + var a; + const r = (a = n.router) == null ? void 0 : a.reduce((o, [s, l, d]) => { + const u = f.get(e, ["router", s]); + if (!u && u !== 0 && l) throw `请传入 ${d}`; + return `${o}/${u}`; + }, `/api/${i}`); + return I.del(r, e.param).msg(); +}, Si = (t, e, i, { status: { loading: n, disabled: r }, setStatus: a, listFn: o }) => { + const s = { loading: (l) => l === void 0 ? n : a((d) => ({ ...d, loading: l })), disabled: (l) => l === void 0 ? r : a((d) => ({ ...d, disabled: l })), list: o }; + return f.isFunction(i) ? i.call(null, e, s) : f.isString(i) && i ? Ie.exec(i, e, s) : null; +}, Ei = (t, e, i, n, r) => f.isString(i) && i ? ue.getWidgetComponent(i).then(({ default: a }) => ne.modal(a, { ...e, $setting: n }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r)).catch((a) => { + ne.error(i, { content: a.toString() }); +}) : ne.modal(i, { ...e, $setting: n }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Tr = (t, e, i, n, r) => ne.modal(Yi, { ...e, $setting: n, code: i }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Rr = (t, e, i, n, r) => ne.modal(ei, { base62params: e, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Or = ({ widget: t, widgetType: e, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s } = {}) => { + const l = pe(oe), [d, u] = L({ leading: !0, trailing: !1 }), p = U(() => { + switch (e) { + case "redirect": + return f.partialRight(Nr, t, r); + case "func": + return f.partialRight(Si, (r == null ? void 0 : r.code) ?? t, { status: d, setStatus: u, listFn: l }); + case "component": + case "fsdpf-component": + return f.partialRight(Ei, t, r, a); + case "grid-layout-form": + return f.partialRight(Tr, t, r, a); + case "data-list": + return f.partialRight(Rr, t, r, a); + case "destroy": + return f.partialRight(Pr, t, r, a); + default: + if (ri(t) || E.isValidElement(t)) return f.partialRight(Ei, t, r, a); + if (f.isFunction(t)) return f.partialRight(Si, (r == null ? void 0 : r.code) || t, { status: d, setStatus: u }); + } + return (...m) => console.error("useButton unknown widgetType", e, ...m); + }, [t, e, l.getBase62params, l.getSelectedRows]); + return [f.debounce((m) => (s == null || s(m), Promise.resolve(gt(n, m, { list: l })).then((g) => p(m, { ...i, ...g })).then((g) => o == null ? void 0 : o(g)).catch(console.error)), 300, { leading: !0, trailing: !1 }), d]; +}, Xi = ({ type: t, name: e, className: i, icon: n, iconPosition: r, size: a }, o = "default") => U(() => { + const s = { type: "primary", className: R("ff-button", i), iconPosition: r, size: a }; + return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), o === "link" || o === "dashed" ? (s.type = o, t === "default" && (s.className = R(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), n && (s.icon = h(St, { type: n })), e && (s.children = e), s; +}, [o, t, i, n, r]), Rt = ({ data: t, widget: e, widgetType: i = "fsdpf-component", widgetData: n, widgetProps: r, widgetSetting: a, widgetContainerProps: o, onAfterClick: s, onBeforeClick: l, children: d, extras: u }) => { + const p = pe(oe), [m, g] = L(!1), [y, b] = L("hover"), [C, S] = L({}), [v, k] = L(), { placement: $, align: T, zIndex: A, arrow: F = { pointAtCenter: !0 }, getPopupContainer: M, isPopupMountBodyContainer: z = !0, ...O } = o || {}; + V(() => { + i == "grid-layout-form" ? k(E.createElement(Yi, { ...n, $setting: a, code: e })) : i == "data-list" ? k(E.createElement(ei, { base62params: t, $setting: a, listCode: e })) : f.isString(e) ? ue.getWidgetComponent(e).then(({ default: _ }) => { + k(E.createElement(_, { ...n, $setting: a })); + }).catch((_) => k(_.toString())) : ri(e) ? k(E.createElement(e, { ...n, $setting: a })) : E.isValidElement(e) && k(E.cloneElement(e, { ...n, $setting: a })); + }, [e, i, n]), V(() => { + Promise.resolve(gt(r, t, { list: p })).then(S); + }, [r, t, p.getBase62params, p.getSelectedRows]); + const D = (_, re = !1) => (g(_), !_ && b("hover"), _ ? l == null ? void 0 : l(C) : s == null ? void 0 : s(re)), K = (_) => { + g(!0), b("click"); + }; + return h(Tn, { zIndex: A, placement: $, onPopupClick: K, onClick: K, open: m, align: T, arrow: F, trigger: y, getPopupContainer: M || z ? void 0 : (_) => _, content: h(Fr, { ...O, extras: u, children: v && E.cloneElement(v, { ...C, $close: (_) => D(!1, _) }) }), children: d, onOpenChange: D }); +}, Fr = ({ title: t, className: e, classNames: i, children: n, extras: r, width: a, height: o, ...s }) => { + const [l, d] = L({}), u = Y((y, b) => d((C) => ({ ...C, [y]: b })), []), p = Y((y) => d((b) => ({ ...b, [y]: void 0 })), []), m = t ? E.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = r ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, r); + return h(pt.Provider, { value: { ele: l, mount: u, unmount: p }, children: j("div", { className: R("ff-popup ff-popover", e, l.rootClassName), style: { width: a ?? 260, height: o }, ...s, children: [j("div", { className: R("ff-popup-header", "ff-popover-header", i == null ? void 0 : i.header), children: [m, l == null ? void 0 : l["sub-title"]] }), h("div", { className: R("ff-popup-body", "ff-popover-body", i == null ? void 0 : i.body), children: n }), j("div", { className: R("ff-popup-footer", "ff-popover-footer", i == null ? void 0 : i.footer), children: [g, l == null ? void 0 : l.extras, l == null ? void 0 : l.actions] })] }) }); +}; +Rt.propTypes = { widgetType: w.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; +const ft = (t) => function({ className: e, variant: i, children: n, name: r, icon: a, type: o = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: d, onBeforeClick: u, data: p, loading: m, disabled: g, tooltip: y, confirm: b, widget: C = () => { +}, widgetType: S, widgetData: v, widgetProps: k, widgetSetting: $, widgetContainerProps: T, ...A }) { + const { mode: F, ...M } = T || {}, z = Xi({ className: e, name: r, type: o, icon: a, iconPosition: s }, i ?? t), O = h(Ct, { ...z, ...A, children: n || r }); + if (F === "popover" && !["destroy", "redirect", "func"].includes(S)) return h(Rt, { data: p, widget: C, widgetType: S, widgetData: v, widgetProps: k, widgetSetting: $, widgetContainerProps: M, onAfterClick: d, onBeforeClick: u, children: O }); + const D = f.isEmpty(y) || !y.enabled ? {} : y, K = f.isEmpty(b) ? { enabled: !1 } : Object.assign({ enabled: !0 }, b), [_, re] = L(!1), [Ne, { disabled: W, loading: se }] = Or({ widget: C, widgetType: S, widgetData: v, widgetProps: k, widgetSetting: $, widgetContainerProps: M }, { onAfterClick: d, onBeforeClick: u }); + return h(Rn, { okText: "确定", cancelText: "取消", getPopupContainer: (J) => J, ...K, disabled: W || g, open: _, onOpenChange: (J) => { + if (!J) return re(J); + K.enabled ? re(J) : Ne(p); + }, onConfirm: (J) => { + Ne(p, J); + }, onClick: (J) => { + J.stopPropagation(); + }, children: h(On, { getPopupContainer: (J) => J, ...D, title: _ ? null : D == null ? void 0 : D.title, trigger: ["hover", "click"], children: E.cloneElement(O, { loading: se || m, disabled: W || g }) }) }); +}, P = ft("default"); +P.propTypes = { type: w.oneOf(["primary", "default", "danger", ""]), size: w.oneOf(["large", "middle", "small"]), name: w.string, icon: w.string, iconPosition: w.oneOf(["start", "end"]), data: w.any, widget: w.any, widgetType: w.oneOf(["destroy", "redirect", "func", "component", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: w.object, widgetProps: w.object, widgetSetting: w.object, widgetContainerProps: w.object, tooltip: w.exact({ title: w.string.isRequired, placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func }), confirm: w.exact({ title: w.string.isRequired, cancelText: w.string, okText: w.string, okType: w.oneOf(["primary", "default", "danger", ""]), placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func, arrow: w.oneOfType([w.bool, w.exact({ pointAtCenter: w.bool })]) }) }; +const Ar = ft("link"), jr = ft("circle"), Lr = ft("round"), Ir = ft("dashed"), $i = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: i = (g, y, b) => { +}, onBeforeClick: n = (g, y, b) => { +}, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: d = (g, y) => h(P, { ...g, data: y }, g.uuid || Vt()), widgetContainerProps: u = {}, children: p, data: m }) => { + if (f.isEmpty(t)) return p; + const [g, y] = U(() => (t || []).reduce((C, S) => { + const v = e.indexOf(S.widgetType); + return v === -1 ? C[1].push(S) : C[0] ? v < e.indexOf(C[0].widgetType) ? (C[1].push(C[0]), C[0] = S) : C[1].push(S) : C[0] = S, C; + }, [null, []]), [t, e]); + o ? p = o(g, m) || p : p || (p = h(Ct, { ...Xi(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: a }), r) })); + const b = y.map((C) => d(Object.assign({ uuid: C.uuid, type: C.type, name: C.name, widget: C.widget, widgetType: C.widgetType, widgetProps: C.widgetProps, widgetData: C.widgetData, widgetSetting: C.widgetSetting, widgetContainerProps: C.widgetContainerSetting, confirm: C.confirm, onAfterClick: f.partialRight(i, C, m), onBeforeClick: f.partialRight(n, C, m) }, { size: l, variant: s }), m)); + return h(Rt, { widget: g == null ? void 0 : g.widget, widgetType: g == null ? void 0 : g.widgetType, widgetProps: g == null ? void 0 : g.widgetProps, widgetSetting: g == null ? void 0 : g.widgetSetting, widgetContainerProps: Object.assign({}, u, g == null ? void 0 : g.widgetContainerProps), data: m, widgetData: g == null ? void 0 : g.widgetData, extras: b, onAfterClick: f.partialRight(i, g, m), onBeforeClick: f.partialRight(n, g, m), children: p }); +}; +$i.propTypes = { triggerWeights: w.array, options: w.arrayOf(w.shape({ ...P.propTypes, widgetType: P.propTypes.widgetType.isRequired })), btnSize: P.propTypes.size, btnRender: w.func, btnVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: w.func, labelSize: P.propTypes.size, onAfterClick: w.func, onBeforeClick: w.func, widgetContainerProps: P.propTypes.widgetContainerProps, data: P.propTypes.data }, P.Link = Ar, P.Link.defaultProps = P.defaultProps, P.Link.propTypes = P.propTypes, P.Circle = jr, P.Circle.defaultProps = P.defaultProps, P.Circle.propTypes = P.propTypes, P.Round = Lr, P.Round.defaultProps = P.defaultProps, P.Round.propTypes = P.propTypes, P.Dashed = Ir, P.Dashed.defaultProps = P.defaultProps, P.Dashed.propTypes = P.propTypes, P.Popover = Rt, P.GroupPopover = $i; +const Mr = ({ fields: t, formProps: e, $close: i }) => { + const [n] = ae.useForm(), r = U(() => [{ name: "__PROPS__", value: e }], [e]); + return h(ee, { actions: j(E.Fragment, { children: [h(P, { name: "取消", widget: () => i(!1) }), h(P, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(i) })] }), children: h(ae, { fields: r, form: n, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: a, ...o }) => h(ti, { code: a, ...o }, a)) }) }); +}, Vr = ({ className: t, classNames: e, $close: i, children: n, title: r, subTitle: a, actions: o, extras: s, ...l }) => j(Dn, { ...l, prefixCls: "ff-drawer", className: R("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (d) => ({ motionAppear: !0, motionName: `panel-motion-${d}` }), children: [j("div", { className: R("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: R("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: h(Qt, { type: "close" }) }), r, a] }), h("div", { className: R("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), j("div", { className: R("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, o] })] }), Dr = ({ className: t, classNames: e, $close: i, $event: n, children: r, title: a, subTitle: o, actions: s, extras: l, placement: d, ...u }) => { + const p = (n == null ? void 0 : n.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: n == null ? void 0 : n.pageX, y: n == null ? void 0 : n.pageY } }; + return h(zn, { ...u, ...p, prefixCls: "ff-modal", modalRender: () => j("div", { className: R("ff-modal-content ff-popup", t), children: [j("div", { className: R("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: R("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: u.onClose, children: h(Qt, { type: "close" }) }), a, o] }), h("div", { className: R("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: r }), j("div", { className: R("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] }) }); +}, Qi = ({ placement: t, $close: e, $event: i, children: n, title: r, ...a }) => { + const [o, s] = L({}), [l, d] = L(!0), u = Y((y, b) => s((C) => ({ ...C, [y]: b })), []), p = Y((y) => s((b) => ({ ...b, [y]: void 0 })), []); + let m = { ...a, className: o.rootClassName, title: o.title || r && E.createElement("div", { className: R("ff-popup-title") }, r), subTitle: o["sub-title"], actions: o.actions, extras: o.extras, children: n, $close: e, $event: i, onClose: () => d(!1) }; + const g = () => { + e(!1); + }; + return h(pt.Provider, { value: { ele: o, mount: u, unmount: p }, children: t && t !== "center" ? h(Vr, { ...m, placement: t, open: l, afterOpenChange: (y) => !y && g() }) : h(Dr, { ...m, visible: l, afterClose: g }) }); +}; +Qi.propTypes = { placement: w.oneOf(["center", "left", "top", "right", "bottom"]) }; +const ie = () => { + const [t, e] = kn({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (a) => { + const { offsetHeight: o } = a; + return { height: o }; + }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = E.useReducer((a) => a + 1, 0); + V(() => { + ie.$onClick = n, ie.$queue.forEach(([a, o, s], l, d) => { + r([o, s], ...a), delete d[l]; + }); + }, []); + const n = (a, o = {}, s = {}) => new Promise((l, d) => r([l, d], a, o, s)), r = ([a, o], s, l = {}, d = {}) => { + const u = ie.$index++, p = (m) => ((g, y) => (ie.$popups.delete(g), i(), y == null ? void 0 : y()))(u, () => a(m)); + if (s === Fi) return t.open({ ...d, key: u, content: E.createElement(s, { ...l, $close: () => t.close(u) }) }); + ie.$popups.set(u, E.createElement(Qi, { maskClosable: !1, $event: l == null ? void 0 : l.$event, ...d, key: u, $close: p }, E.isValidElement(s) ? E.cloneElement(s, { ...l, $close: p }) : s != null && s.name || gi.isForwardRef(s) || (s == null ? void 0 : s.$$typeof) === gi.ForwardRef ? E.createElement(s, { ...l, $close: p }) : s)), i(); + }; + return j(E.Fragment, { children: [Array.from(ie.$popups).map(([a, o]) => o), e] }); +}; +ie.$popups = /* @__PURE__ */ new Map(), ie.$index = 0, ie.$queue = [], ie.$onClick = (...t) => new Promise((e, i) => { + ie.$queue.push([t, e, i]); +}); +const vi = (t, e, i = {}) => ie.$onClick(t, e, i), It = (t, { showProgress: e, duration: i, ...n } = { duration: 1.5 }) => ie.$onClick(Fi, { content: t, ...n }, { showProgress: e, duration: i }), ne = { modal: vi, confirm: (t, e = {}) => ie.$onClick(Wn, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, i = {}) => vi(Mr, { formProps: i, fields: t }, { placement: "center", ...e }).then((n) => { + if (n === !1) throw !1; + return n; +}), notification: It, success: (t, e = { duration: 1.5 }) => It(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => It(t, { ...e, className: "ff-notification-error", icon: "close" }) }; +Ze.configure({ showSpinner: !1 }); +const Zi = () => { + const t = window.localStorage.getItem(bt); + return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); +}; +Ve.interceptors.request.use((t) => (Object.assign(t.headers, Zi()), Ze.inc(), t), (t) => (Ze.done(), Promise.reject({ code: -1, msg: t }))), Ve.interceptors.response.use(({ data: t, headers: e }) => (Ze.done(), { ...t, res: e == null ? void 0 : e.res }), function(t) { + return Ze.done(), Promise.reject(t.message); +}), window.addEventListener("unhandledrejection", Dt.onUnhandledRejection), Dt.onMsg = (t, e) => ne[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && xe.redirect(qe.get("Common.WEBSITE_LOGIN_PAGE"))); +var Ge, Be, Ye; +const Q = class Q { + constructor() { + N(this, "appUrl", ""); + x(this, Ge, null); + return c(Q, Be) || (B(Q, Ye, new Dt()), B(Q, Be, new Proxy(this, { get(e, i) { + if (i in e) { + const n = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), i); + return n != null && n.get ? Reflect.get(e, i, e) : typeof e[i] == "function" ? e[i].bind(e) : e[i]; + } + return c(Q, Ye)[i]; + } }))), c(Q, Be); + } + init(e, i, n) { + Ve.defaults.baseURL = this.appUrl = n, Ve.defaults.timeout = 15e3, c(Q, Ye).init(e, i, Ve); + } + get driver() { + return Ve; + } + get headers() { + return Zi(); + } + mock(e = {}) { + return c(this, Ge) ?? B(this, Ge, new Sn(Ve, { onNoMatch: "passthrough", ...e })); + } + unmock() { + var e; + (e = c(this, Ge)) == null || e.restore(), B(this, Ge, null); + } +}; +Ge = new WeakMap(), Be = new WeakMap(), Ye = new WeakMap(), x(Q, Be), x(Q, Ye), N(Q, "getInstance", () => c(Q, Be) ?? B(Q, Be, new Q())); +let Gt = Q; +const I = Gt.getInstance(); +class ni extends Error { + constructor(e, i) { + super(i), Error.captureStackTrace && Error.captureStackTrace(this, ni), !i instanceof et && (this.name = `${e} Error Runtime`); + } +} +class et extends Error { + constructor(e, ...i) { + super(...i), Error.captureStackTrace && Error.captureStackTrace(this, et), this.name = `${e} Not Found`; + } +} +const Mt = "mine", bt = "token"; +var Le, Xe; +const we = class we { + constructor() { + x(this, Xe, /* @__PURE__ */ new Map()); + N(this, "setVendor", (e, i) => c(this, Xe).set(e, new Ri(i, async (n, r) => { + var o, s; + if (!(n != null && n.default)) throw "@pkg not found"; + let a = () => r; + switch ("function") { + case typeof (a = (o = n.default) == null ? void 0 : o[`./${r}/index.jsx`]): + case typeof (a = (s = n.default) == null ? void 0 : s[`./${r}/index.js`]): + return a(); + } + throw new et(r); + }))); + N(this, "getWidgetComponent", async (e) => { + if (!e) throw "getWidgetComponent widget is required"; + if (e != null && e.startsWith("blob:") || e != null && e.startsWith("http:") || e != null && e.startsWith("https:")) return await import(e); + const [, i] = e == null ? void 0 : e.split("@pkg/"); + if (!i) throw new et(e); + try { + return c(this, Xe).has("pkg") ? await c(this, Xe).get("pkg").get(i) : await import(`${I.appUrl}/api/pkg-import/web?name=${e}`); + } catch (n) { + throw new ni(e, n); + } + }); + N(this, "getRoutes", () => I.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: i, ...n }) => [i, { uuid: i, ...n }])).then((e) => new Map(e))); + N(this, "getMenus", () => I.get("/api/my-menu")); + N(this, "getConfigure", () => I.get("api/init-configure")); + N(this, "getWidgetOperationAuth", () => I.get("/api/init-widget-operation-auth").then((e) => e.reduce((i, { uuid: n, auth: r }) => [...i, [n, r]], []))); + N(this, "getPhoneNumber", (e) => I.get(`/api/user-wx-phone-number/${e}`)); + N(this, "getUserToken", () => { + const e = window.localStorage.getItem(bt); + if (!e) return ""; + const i = e.split("."); + if (!Array.isArray(i) || i.length !== 3) throw "登录令牌无效!"; + const { iat: n } = JSON.parse(window.atob(i[1])); + if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; + return e; + }); + N(this, "checkUserToken", () => { + try { + return !!this.getUserToken(); + } catch { + return !1; + } + }); + N(this, "getUserInfo", (e = !0) => { + var i; + try { + const n = this.getUserToken(); + if (!n) return Promise.resolve(null); + const { iat: r } = JSON.parse(window.atob((i = n == null ? void 0 : n.split(".")) == null ? void 0 : i[1])), { iat: a, ...o } = I.decode(window.localStorage.getItem(Mt) || "", {}); + return a === r ? Promise.resolve(o) : I.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(Mt, I.encode({ ...s, iat: r })), s)); + } catch (n) { + console.error(n), e && ne.error("请登录").then(this.logout); + } + return Promise.resolve(null); + }); + N(this, "login", (e, i, n = {}) => I.post("/api/user-token", { username: e, passwd: En.hash(i), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(bt, r), r)).then(async (r) => (await this.initAppEnv(), r))); + N(this, "logout", (e) => (window.localStorage.removeItem(Mt), window.localStorage.removeItem(bt), e == null ? void 0 : e())); + N(this, "initAppEnv", async () => { + const [e, i, n, r] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); + return Ai.init(e), qe.init(r), xe.init(i, n), St.init(qe.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: i, menus: n, configures: r }; + }); + if (c(we, Le)) return c(we, Le); + } +}; +Le = new WeakMap(), Xe = new WeakMap(), x(we, Le, null), N(we, "getInstance", () => (c(we, Le) || B(we, Le, new we()), c(we, Le))); +let Yt = we; +const ue = Yt.getInstance(), zr = E.createContext({ user: {}, initUser: () => { +}, initUserComplete: !1 }), Wr = E.createContext({ set: () => { +}, get: () => { +}, assign: () => { +}, currentRoute: () => { +} }), ri = (t) => !!(t != null && t.name) && (t.prototype instanceof E.Component || /^[A-Z]/.test(t.name)), Br = (t, e) => { + if (!t || typeof window > "u") return; + let i = document.querySelector(`style[ff-style-token="${e}"]`); + return i ? (i.innerHTML = t, t) : (i = document.createElement("style"), i.setAttribute("ff-style-token", e), i.setAttribute("type", "text/css"), i.innerHTML = t, document.head.appendChild(i), t); +}, qr = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: zr, AppGlobalParamsContext: Wr, cache: Ri, configure: qe, default: ue, func: Ie, http: I, insertStyle: Br, isReactComponent: ri, route: xe }, Symbol.toStringTag, { value: "Module" })); +var $e, Qe, ve, be, Ce, te, Z, G, ke, st, lt, ct, dt, Pt, ut; +const ai = class ai { + constructor(e, i = "/") { + x(this, $e, "/"); + x(this, Qe, /* @__PURE__ */ new Set()); + x(this, ve, (e) => { + for (const i of c(this, Qe)) try { + i(e); + } catch (n) { + console.error("Error in VirtualFS event listener:", n); + } + }); + x(this, be, (e) => { + const i = Date.now(); + if (e && (e.lastModified = i), c(this, $e) != "/") { + const n = c(this, G).call(this, c(this, $e)); + n && (n.lastModified = i); + } + this.root.lastModified = i; + }); + x(this, Ce, (e) => { + let i = ge.normalize(e); + return i.startsWith("/") || (i = "/" + i), i.length > 1 && i.endsWith("/") && (i = i.slice(0, -1)), i; + }); + x(this, te, (e) => { + const i = ge.join(c(this, $e), e); + return c(this, Ce).call(this, i); + }); + x(this, Z, (e) => { + if (!e || typeof e != "string") return !1; + const i = c(this, Ce).call(this, e); + return !i.includes("..") && i.startsWith("/"); + }); + x(this, G, (e) => { + var a; + const i = c(this, Ce).call(this, e); + if (i === "/") return this.root; + const n = i.split("/").filter((o) => o); + let r = this.root; + for (const o of n) { + if (r.type !== "dir") return null; + const s = (a = r.children) == null ? void 0 : a.find((l) => l.name === o); + if (!s) return null; + r = s; + } + return r; + }); + x(this, ke, (e) => { + const i = c(this, Ce).call(this, e), n = ge.basename(i), r = ge.dirname(i); + return { parent: c(this, G).call(this, r), name: n }; + }); + x(this, st, (e, i, n) => n === !1 ? e : n === "root" ? e.map((r) => ge.join(i, r)) : n === !0 || n === "working" ? e.map((r) => ge.relative(c(this, $e), ge.join(i, r))) : e); + x(this, lt, async (e, i, n, r = "") => { + const a = [], o = c(this, G).call(this, e); + if (!o || o.type !== "dir") return a; + const s = o.children; + for (const l of s) { + const d = l.name, u = e === "/" ? `/${d}` : `${e}/${d}`, p = r ? `${r}/${d}` : d; + try { + if (l.type === "file") i(n ? p : d) && a.push(p); + else if (l.type === "dir" && n) { + const m = await c(this, lt).call(this, u, i, n, p); + a.push(...m); + } + } catch { + continue; + } + } + return a; + }); + x(this, ct, async (e, i, n, r = "") => { + const a = [], o = Array.isArray(i) ? i : [i], s = c(this, G).call(this, e); + if (!s || s.type !== "dir") return a; + if (!n) { + for (const d of o) if (c(this, dt).call(this, d)) { + const u = await c(this, Pt).call(this, e, d); + a.push(...u); + } else { + const u = ge.join(e, d), p = c(this, Ce).call(this, u); + c(this, G).call(this, p) && a.push(d); + } + return a; + } + const l = s.children; + for (const d of l) { + const u = d.name, p = e === "/" ? `/${u}` : `${e}/${u}`, m = r ? `${r}/${u}` : u; + try { + if (d.type === "file") for (const g of o) { + let y = !1; + if (y = c(this, dt).call(this, g) ? c(this, ut).call(this, u, g) : u === g, y) { + a.push(m); + break; + } + } + else if (d.type === "dir") { + const g = await c(this, ct).call(this, p, i, n, m); + a.push(...g); + } + } catch { + continue; + } + } + return a; + }); + x(this, dt, (e) => /[*?[\]{}]/.test(e)); + x(this, Pt, async (e, i) => { + const n = [], r = c(this, G).call(this, e); + if (!r || r.type !== "dir") return n; + const a = r.children.map((o) => o.name); + for (const o of a) c(this, ut).call(this, o, i) && n.push(o); + return n; + }); + x(this, ut, (e, i) => { + const n = i.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (r, a) => "(" + a.split(",").join("|") + ")"); + return new RegExp(`^${n}$`).test(e); + }); + var n, r, a; + B(this, $e, i), this.root = { name: "/", type: "dir", children: [], lastModified: Date.now() }, Array.isArray(e) ? this.root.children = e : e && typeof e == "object" && (e.name && e.name !== "/" ? this.root.children.push(e) : (this.root = e, (n = this.root).name ?? (n.name = "/"), (r = this.root).children ?? (r.children = []), (a = this.root).lastModified ?? (a.lastModified = Date.now()))); + } + async stat(e) { + const i = c(this, te).call(this, e); + if (!c(this, Z).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = c(this, G).call(this, i); + if (!n) throw new Error(`ENOENT: no such file or directory, stat '${e}'`); + return { isFile: () => n.type === "file", isDirectory: () => n.type === "dir", lastModified: n.lastModified }; + } + async dir(e) { + const i = c(this, te).call(this, e); + if (!c(this, Z).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = c(this, G).call(this, i); + if (!n) throw new Error(`ENOENT: no such file or directory, scandir '${e}'`); + if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory, scandir '${e}'`); + return n.children.map((r) => r.name); + } + async readFile(e) { + const i = c(this, te).call(this, e); + if (!c(this, Z).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = c(this, G).call(this, i); + if (!n) throw new Error(`ENOENT: no such file or directory, open '${e}'`); + if (n.type !== "file") throw new Error("EISDIR: illegal operation on a directory, read"); + return n.content || ""; + } + async writeFile(e, i) { + const n = c(this, te).call(this, e); + if (!c(this, Z).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: r, name: a } = c(this, ke).call(this, n); + if (!r) throw new Error(`ENOENT: no such file or directory, open '${e}'`); + if (r.type !== "dir") throw new Error("ENOTDIR: not a directory"); + const o = r.children.findIndex((d) => d.name === a), s = o >= 0, l = { name: a, type: "file", content: i, lastModified: Date.now() }; + s ? r.children[o] = l : r.children.push(l), c(this, be).call(this, r), c(this, ve).call(this, { action: s ? "update" : "create", path: n, type: "file", timestamp: Date.now() }); + } + async mkdir(e, i = {}) { + const n = c(this, te).call(this, e); + if (!c(this, Z).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const { recursive: r } = i; + if (r) { + const a = n.split("/").filter((s) => s); + let o = "/"; + for (const s of a) + if (o = ge.join(o, s), !c(this, G).call(this, o)) { + const { parent: l, name: d } = c(this, ke).call(this, o); + if (l && l.type === "dir") { + const u = { name: d, type: "dir", children: [], lastModified: Date.now() }; + l.children.push(u), c(this, be).call(this, l), c(this, ve).call(this, { action: "create", path: c(this, Ce).call(this, o), type: "dir", timestamp: Date.now() }); + } + } + } else { + const { parent: a, name: o } = c(this, ke).call(this, n); + if (!a) throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`); + if (a.type !== "dir") throw new Error("ENOTDIR: not a directory"); + if (a.children.find((l) => l.name === o)) throw new Error(`EEXIST: file already exists, mkdir '${e}'`); + const s = { name: o, type: "dir", children: [], lastModified: Date.now() }; + a.children.push(s), c(this, be).call(this, a), c(this, ve).call(this, { action: "create", path: n, type: "dir", timestamp: Date.now() }); + } + } + async unlink(e) { + const i = c(this, te).call(this, e); + if (!c(this, Z).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: n, name: r } = c(this, ke).call(this, i); + if (!n) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + const a = n.children.findIndex((o) => o.name === r); + if (a < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + if (n.children[a].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); + n.children.splice(a, 1), c(this, be).call(this, n), c(this, ve).call(this, { action: "delete", path: i, type: "file", timestamp: Date.now() }); + } + async rmdir(e, i = {}) { + const n = c(this, te).call(this, e); + if (!c(this, Z).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: r, name: a } = c(this, ke).call(this, n); + if (!r) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const o = r.children.findIndex((l) => l.name === a); + if (o < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const s = r.children[o]; + if (s.type !== "dir") throw new Error(`ENOTDIR: not a directory, rmdir '${e}'`); + if (!i.recursive && s.children.length > 0) throw new Error(`ENOTEMPTY: directory not empty, rmdir '${e}'`); + r.children.splice(o, 1), c(this, be).call(this, r), c(this, ve).call(this, { action: "delete", path: n, type: "dir", timestamp: Date.now() }); + } + async rename(e, i) { + const n = c(this, te).call(this, e), r = c(this, te).call(this, i); + if (!c(this, Z).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + if (!c(this, Z).call(this, r)) throw new Error(`EINVAL: invalid path '${i}'`); + if (!c(this, G).call(this, n)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${i}'`); + const { parent: a, name: o } = c(this, ke).call(this, n), { parent: s, name: l } = c(this, ke).call(this, r); + if (!s) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${i}'`); + if (c(this, G).call(this, r)) throw new Error(`EEXIST: file already exists, rename '${e}' -> '${i}'`); + const d = a.children.findIndex((p) => p.name === o), u = { ...a.children[d], name: l, lastModified: Date.now() }; + a.children.splice(d, 1), s.children.push(u), c(this, be).call(this, a), a !== s && c(this, be).call(this, s), c(this, ve).call(this, { action: "rename", path: r, oldPath: n, type: u.type, timestamp: Date.now() }); + } + async exists(e) { + const i = c(this, te).call(this, e); + return c(this, Z).call(this, i) ? c(this, G).call(this, i) !== null : !1; + } + getLastModified() { + return this.root.lastModified; + } + subscribe(e) { + if (typeof e != "function") throw new Error("Callback must be a function"); + return c(this, Qe).add(e), () => { + c(this, Qe).delete(e); + }; + } + getWorkingDirectory() { + return c(this, $e); + } + scope(e = "/") { + const i = c(this, Ce).call(this, e); + if (!c(this, Z).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = c(this, G).call(this, i); + if (!n) throw new Error(`ENOENT: no such file or directory '${e}'`); + if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); + return n.children ?? (n.children = []), n.lastModified ?? (n.lastModified = Date.now()), new ai(this.root, i); + } + async findFiles(e, i, n = {}) { + const r = c(this, te).call(this, e); + if (!c(this, Z).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const a = c(this, G).call(this, r); + if (!a) throw new Error(`ENOENT: no such file or directory '${e}'`); + if (a.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); + const { recursive: o = !1, fullPath: s = !1 } = n; + if (typeof i == "function") { + const d = await c(this, lt).call(this, r, i, o); + return c(this, st).call(this, d, r, s); + } + const l = await c(this, ct).call(this, r, i, o); + return c(this, st).call(this, l, r, s); + } +}; +$e = new WeakMap(), Qe = new WeakMap(), ve = new WeakMap(), be = new WeakMap(), Ce = new WeakMap(), te = new WeakMap(), Z = new WeakMap(), G = new WeakMap(), ke = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), Pt = new WeakMap(), ut = new WeakMap(); +let xi = ai; +const Ur = async (t, e = "/", i = "") => { + try { + const n = await t.stat(e), r = e === "/" ? "/" : ge.basename(e), a = { title: r, key: i ? `${i}${e}` : e, isLeaf: n.isFile() }; + if (n.isDirectory()) { + const o = await t.dir(e); + if (o.length > 0) { + a.children = []; + const s = [], l = []; + for (const d of o) { + const u = e === "/" ? `/${d}` : `${e}/${d}`; + try { + (await t.stat(u)).isDirectory() ? s.push(d) : l.push(d); + } catch (p) { + console.warn(`Failed to stat ${u}:`, p.message); + } + } + s.sort(), l.sort(); + for (const d of [...s, ...l]) { + const u = e === "/" ? `/${d}` : `${e}/${d}`; + try { + const p = await Ur(t, u, i); + a.children.push(p); + } catch (p) { + console.warn(`Failed to process ${u}:`, p.message); + } + } + } + } + return a; + } catch { + return null; + } +}; +export { + Sa as $, + Ki as A, + Bi as B, + Wi as C, + kt as D, + or as E, + ar as F, + Ca as G, + cr as H, + nr as I, + ei as J, + oe as K, + lr as L, + hr as M, + Zn as N, + tr as O, + Gn as P, + Yn as Q, + qi as R, + fa as S, + ya as T, + Vi as U, + Ut as V, + Xn as W, + Qn as X, + mr as Y, + fr as Z, + ka as _, + ji as a, + Tt as a0, + Ea as a1, + $a as a2, + ht as a3, + mt as a4, + va as a5, + xa as a6, + xr as a7, + ii as a8, + ti as a9, + Ie as aA, + xe as aB, + zr as aC, + Wr as aD, + xi as aE, + Ur as aF, + Yi as aa, + wr as ab, + br as ac, + Cr as ad, + kr as ae, + Sr as af, + Er as ag, + Na as ah, + St as ai, + P as aj, + Ai as ak, + Or as al, + ee as am, + pt as an, + Oi as ao, + ie as ap, + ne as aq, + la as ar, + ca as as, + da as at, + ue as au, + ri as av, + Br as aw, + I as ax, + Ri as ay, + qe as az, + qn as b, + gt as c, + Li as d, + pa as e, + ga as f, + Bn as g, + ha as h, + Un as i, + _n as j, + ma as k, + Di as l, + Kn as m, + wa as n, + zi as o, + Zt as p, + Ui as q, + Lt as r, + Hi as s, + de as t, + ua as u, + pr as v, + _i as w, + dr as x, + ur as y, + ba as z +}; diff --git a/dist/components.js b/dist/components.js index 2d49085..c6d1e0b 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,4 +1,4 @@ -import { ar as s, ai as p, as as t, at as n, aq as r } from "./common/main-Cf8W-zss.js"; +import { ar as s, ai as p, as as t, at as n, aq as r } from "./common/main-DOuFUIVr.js"; export { s as Empty, p as Icon, diff --git a/dist/container.js b/dist/container.js index cdd3afe..8ced345 100644 --- a/dist/container.js +++ b/dist/container.js @@ -1,4 +1,4 @@ -import { an as s, ar as e, as as p, at as t, ao as n, aq as d, ap as r, am as u } from "./common/main-Cf8W-zss.js"; +import { an as s, ar as e, as as p, at as t, ao as n, aq as d, ap as r, am as u } from "./common/main-DOuFUIVr.js"; export { s as Context, e as Empty, diff --git a/dist/data-converter.js b/dist/data-converter.js index b2a96a4..6a314ff 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-Cf8W-zss.js"; +import { D as p } from "./common/main-DOuFUIVr.js"; export { p as default }; diff --git a/dist/data-list.js b/dist/data-list.js index d308f79..0ffe011 100644 --- a/dist/data-list.js +++ b/dist/data-list.js @@ -1,4 +1,4 @@ -import { M as t, K as e, C as r, I as o, N as i, J as l, F as u, L as D, E as n, O as L, B as C, Q as m, P as p, X as b, T as c, V as F, U as d, W as O, S } from "./common/main-Cf8W-zss.js"; +import { M as t, K as e, C as r, I as o, N as i, J as l, F as u, L as D, E as n, O as L, B as C, Q as m, P as p, X as b, T as c, V as F, U as d, W as O, S } from "./common/main-DOuFUIVr.js"; export { t as DataListContent, e as DataListContext, diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index 760250d..7335c35 100644 --- a/dist/data-list/utils.js +++ b/dist/data-list/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { q as a } from "../common/main-Cf8W-zss.js"; +import { q as a } from "../common/main-DOuFUIVr.js"; export { a as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index 6ee4d46..2d72319 100644 --- a/dist/grid-layout-form.js +++ b/dist/grid-layout-form.js @@ -1,4 +1,4 @@ -import { a8 as s, aa as r, a9 as u, a7 as o, A as t, af as m, ad as d, ae as F, ah as i, ac as g, ab as c, ag as l } from "./common/main-Cf8W-zss.js"; +import { a8 as s, aa as r, a9 as u, a7 as o, A as t, af as m, ad as d, ae as F, ah as i, ac as g, ab as c, ag as l } from "./common/main-DOuFUIVr.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 908d862..dca85a1 100644 --- a/dist/grid-layout-form/utils.js +++ b/dist/grid-layout-form/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { a as o, g } from "../common/main-Cf8W-zss.js"; +import { a as o, g } from "../common/main-DOuFUIVr.js"; export { o as getNormalizeWidget, g as getOptionItemByValue diff --git a/dist/grid-layout.js b/dist/grid-layout.js index 97b3893..2a63f1b 100644 --- a/dist/grid-layout.js +++ b/dist/grid-layout.js @@ -1,4 +1,4 @@ -import { s as u, w as e, v as r, H as t, G as d, y as i, A as o, z as y, x as G } from "./common/main-Cf8W-zss.js"; +import { s as u, w as e, v as r, H as t, G as d, y as i, A as o, z as y, x as G } from "./common/main-DOuFUIVr.js"; export { u as GridLayout, e as GridLayoutFramework, diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index c9815ac..ca974a2 100644 --- a/dist/grid-layout/utils.js +++ b/dist/grid-layout/utils.js @@ -1,4 +1,4 @@ -import { l as o, o as a, p as s, n as g } from "../common/main-Cf8W-zss.js"; +import { l as o, o as a, p as s, n as g } from "../common/main-DOuFUIVr.js"; export { o as getBoxStyle, a as getEventProps, diff --git a/dist/hooks.js b/dist/hooks.js index a6db81f..369f556 100644 --- a/dist/hooks.js +++ b/dist/hooks.js @@ -1,7 +1,7 @@ import "lodash"; import "rc-field-form"; import "react"; -import { a4 as r, a3 as o, a5 as p, a1 as f, a2 as i, a6 as m, a0 as c } from "./common/main-Cf8W-zss.js"; +import { a4 as r, a3 as o, a5 as p, a1 as f, a2 as i, a6 as m, a0 as c } from "./common/main-DOuFUIVr.js"; import { default as b } from "rc-util/lib/hooks/useMergedState"; export { r as useDeepEffect, diff --git a/dist/iconfont.js b/dist/iconfont.js index 80aeafb..41a1c3e 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 { ai as a } from "./common/main-Cf8W-zss.js"; +import { ai as a } from "./common/main-DOuFUIVr.js"; export { a as default }; diff --git a/dist/index.js b/dist/index.js index 4525f37..80b7db9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -import { aC as t, aD as e, ay as o, az as n, au as p, aA as r, ax as c, aw as u, av as f, aB as l } from "./common/main-Cf8W-zss.js"; +import { aC as t, aD as e, ay as o, az as n, au as p, aA as r, ax as c, aw as u, av as f, aB as l } from "./common/main-DOuFUIVr.js"; export { t as AppContext, e as AppGlobalParamsContext, diff --git a/dist/pages.js b/dist/pages.js index 24ec44d..c2a9ed4 100644 --- a/dist/pages.js +++ b/dist/pages.js @@ -1,4 +1,4 @@ -import { Z as t, Y as e, _ as o, $ as g } from "./common/main-Cf8W-zss.js"; +import { Z as t, Y as e, _ as o, $ as g } from "./common/main-DOuFUIVr.js"; export { t as CustomPage, e as DataListPage, diff --git a/dist/res-ws.js b/dist/res-ws.js index 2e1a61f..6009211 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-Cf8W-zss.js"; +import { R as a } from "./common/main-DOuFUIVr.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index 5e1cc08..75ba8e0 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { d as s, f as i, e as g, h as m, b as o, k as P, c as p, j as d, i as h, m as k, r as f, t as u, u as l } from "./common/main-Cf8W-zss.js"; +import { d as s, f as i, e as g, h as m, b as o, k as P, c as p, j as d, i as h, m as k, r as f, t as u, u as l } from "./common/main-DOuFUIVr.js"; import "./common/vender-BkiRbACr.js"; export { s as deepSome, diff --git a/dist/virtual-fs.js b/dist/virtual-fs.js index 7c2b1df..b78645e 100644 --- a/dist/virtual-fs.js +++ b/dist/virtual-fs.js @@ -1,5 +1,5 @@ import "pathe"; -import { aE as o, aF as r } from "./common/main-Cf8W-zss.js"; +import { aE as o, aF as r } from "./common/main-DOuFUIVr.js"; export { o as default, r as toTreePaths diff --git a/package.json b/package.json index a9ae1c1..c912fed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.6.30", + "version": "0.6.31", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js", @@ -18,6 +18,7 @@ "axios": "^1.7.2", "ff-request": "git+https://git.fsdpf.net/npm/ff-request-dist.git", "nprogress": "^0.2.0", + "pathe": "^2.0.3", "spark-md5": "^3.0.2" }, "peerDependencies": {