From 1fde032b7d6a932ce20e8eb38ec5d6158af47e1c Mon Sep 17 00:00:00 2001 From: what Date: Mon, 4 May 2026 17:09:32 +0800 Subject: [PATCH] v0.6.35 --- dist/button.js | 2 +- dist/common/main-DqCTTBs4.js | 1506 ---------------- dist/common/main-MUM7h7VT.js | 1541 +++++++++++++++++ ...{vender-DJd-PP9T.js => vender-BCl09qsS.js} | 94 +- dist/components.js | 9 +- dist/container.js | 6 +- dist/data-converter.js | 2 +- dist/data-list.js | 16 +- dist/data-list/utils.js | 2 +- dist/grid-layout-form.js | 6 +- dist/grid-layout-form/utils.js | 2 +- dist/grid-layout.js | 6 +- dist/grid-layout/utils.js | 6 +- dist/hooks.js | 21 +- dist/iconfont.js | 2 +- dist/index.js | 10 +- dist/pages.js | 2 +- dist/res-ws.js | 2 +- dist/utils.js | 16 +- dist/virtual-fs.js | 2 +- package.json | 2 +- 21 files changed, 1647 insertions(+), 1608 deletions(-) delete mode 100644 dist/common/main-DqCTTBs4.js create mode 100644 dist/common/main-MUM7h7VT.js rename dist/common/{vender-DJd-PP9T.js => vender-BCl09qsS.js} (99%) diff --git a/dist/button.js b/dist/button.js index 9d07ed0..42da56a 100644 --- a/dist/button.js +++ b/dist/button.js @@ -1,4 +1,4 @@ -import { aj as s, ai as u, ak as e } from "./common/main-DqCTTBs4.js"; +import { al as s, ak as u, am as e } from "./common/main-MUM7h7VT.js"; export { s as auth, u as default, diff --git a/dist/common/main-DqCTTBs4.js b/dist/common/main-DqCTTBs4.js deleted file mode 100644 index ec6a131..0000000 --- a/dist/common/main-DqCTTBs4.js +++ /dev/null @@ -1,1506 +0,0 @@ -var bn = Object.defineProperty; -var gi = (t) => { - throw TypeError(t); -}; -var Cn = (t, e, i) => e in t ? bn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i; -var N = (t, e, i) => Cn(t, typeof e != "symbol" ? e + "" : e, i), hi = (t, e, i) => e.has(t) || gi("Cannot " + i); -var c = (t, e, i) => (hi(t, e, "read from private field"), i ? i.call(t) : e.get(t)), x = (t, e, i) => e.has(t) ? gi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), B = (t, e, i, n) => (hi(t, e, "write to private field"), n ? n.call(t, i) : e.set(t, i), i); -var mi = (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 M, useState as L, useCallback as Y, useRef as J, useContext as pe, useMemo as H, useId as Mt, isValidElement as kn, useLayoutEffect as Sn } from "react"; -import he from "pathe"; -import b from "prop-types"; -import O from "classnames"; -import * as fi from "react-is"; -import { useNotification as En } from "rc-notification"; -import m from "lodash"; -import re, { Field as Xt, FieldContext as Oi } from "rc-field-form"; -import { M as jt, _ as $n, N as Ze, b as Me, s as Dt, c as vn, S as xn } from "./vender-DJd-PP9T.js"; -import Ri from "immutability-helper"; -import { Space as Nn, Form as wt, Input as Pn, Button as Ct, Pagination as Tn, Tree as On, Breadcrumb as Rn, Empty as zt, Table as yi, Popover as Fn, Popconfirm as An, Tooltip as jn } from "antd"; -import Ln from "rc-util/lib/hooks/useMergedState"; -import { useUpdateEffect as In } from "react-use"; -import { useMergedState as Vn } from "rc-util"; -import { generatePath as Mn, useInRouterContext as Fi, useParams as Dn, useLocation as zn, createBrowserRouter as Wn, Navigate as Bn } from "react-router-dom"; -import Un from "rc-drawer"; -import qn from "rc-dialog"; -var Ke, tt, He, Ee, De, ze; -class Ai { - constructor(e, i) { - x(this, Ke, /* @__PURE__ */ new Map()); - x(this, tt, !0); - x(this, He, []); - x(this, Ee); - x(this, De, () => c(this, Ee)); - 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, Ee), ...e)); - if (c(this, Ee) === void 0) c(this, He).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((o) => B(this, Ee, o || null)).finally(() => { - c(this, He).forEach(([o, a, s]) => { - try { - const l = c(this, ze).call(this, c(this, Ee), ...o); - c(this, Ke).set(JSON.stringify(o), l), a(l); - } catch (l) { - s(l); - } - }), c(this, He).length = 0; - })); - else { - const o = c(this, ze).call(this, c(this, Ee), ...e); - c(this, Ke).set(r, o), i(o); - } - })); - B(this, ze, i), B(this, De, e); - } -} -Ke = new WeakMap(), tt = new WeakMap(), He = new WeakMap(), Ee = new WeakMap(), De = new WeakMap(), ze = new WeakMap(); -const ho = () => h("div", { children: "Empty" }), pt = E.createContext({ ele: {}, mount: () => { -}, unmount: () => { -} }), ee = ({ rootClassName: t, className: e, children: i, actions: n, title: r, subTitle: o, extras: a, style: s = {} }) => { - const { mount: l, unmount: d } = E.useContext(pt); - return ee.Action({ children: n }), ee.Title({ children: r }), ee.SubTitle({ children: o }), ee.Extra({ children: a }), M(() => (l("rootClassName", t), () => d(t)), [t]), h("div", { className: O("ff-container", e), style: s, children: i }); -}, yt = (t) => ({ children: e, className: i }) => { - const { mount: n, unmount: r } = E.useContext(pt); - return M(() => (e && n(t, E.createElement("div", { key: `ff-${t}`, className: O(`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: b.string, style: b.object, title: b.any, subTitle: b.any, actions: b.any, extras: b.any }; -const mo = () => 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", {})] })] }) }), fo = () => h("div", { children: "NotFound" }), ji = ({ children: t }) => { - const [e, i] = L({}), n = Y((o, a) => i((s) => ({ ...s, [o]: a })), []), r = Y((o) => i((a) => ({ ...a, [o]: 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 }) }); -}; -ji.propTypes = { children: b.element.isRequired }; -const wi = { 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: (wi[t] || wi.info).map((i, n) => h("path", { d: i }, n)) }) }), Li = ({ className: t, content: e, icon: i, $close: n }) => j(E.Fragment, { children: [i && h("div", { className: O("ff-notification-icon", t), children: h(Qt, { type: i }) }), e] }), Kn = ({}) => h(ee, { children: "Confirm" }); -var Pe, Je; -const me = class me { - constructor() { - x(this, Je, /* @__PURE__ */ new Map()); - N(this, "init", (e) => B(this, Je, new Map(e))); - N(this, "check", (e) => !c(this, Je).has(e) || c(this, Je).get(e)); - if (c(me, Pe)) return c(me, Pe); - } -}; -Pe = new WeakMap(), Je = new WeakMap(), x(me, Pe, null), N(me, "getInstance", () => (c(me, Pe) || B(me, Pe, new me()), c(me, Pe))); -let Wt = me; -const Ii = Wt.getInstance(), Hn = (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 o = 0; o < r; o++) { - const { [i]: a } = t[o], s = Hn(a, e, i); - if (!m.isEmpty(s)) return s; - } - return {}; -}, Vi = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; -var Te, it; -const fe = class fe { - constructor() { - x(this, it, null); - N(this, "init", (e) => B(this, it, e)); - N(this, "get", (e, i) => m.get(c(this, it), e, i)); - if (c(fe, Te)) return c(fe, Te); - } -}; -Te = new WeakMap(), it = new WeakMap(), x(fe, Te, null), N(fe, "getInstance", () => (c(fe, Te) || B(fe, Te, new fe()), c(fe, Te))); -let Bt = fe; -const Ue = Bt.getInstance(), bi = { 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, m.isObject(t) && (i = "json"); - const n = `${i}2${e}`; - return Reflect.has(bi, n) ? bi[n](t) : t; -}, Jn = (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 = "") => Mi(t, (r, o) => o === "type" && r === "code") ? Di(t, e, i, n) : zi(t, e, n), Mi = (t, e = () => !1) => m.some(t, (i) => !!m.some(i, e) || (m.isEmpty(i) || !m.isPlainObject(i) && !m.isArray(i) ? void 0 : Mi(i, e))), Di = async (t = {}, e = {}, i = {}, n = "") => { - let r = /* @__PURE__ */ Object.create(null); - for (let o in t) { - let a; - if (Reflect.has(t[o], "type") && ["code", "field", "router", "query", "string"].includes(t[o].type)) { - const { type: s, value: l = "", default: d = n } = t[o]; - switch (s) { - case "code": - try { - a = await Ie.exec(l, e, i); - } catch (u) { - console.error("getWidgetPropsData", u); - } - break; - case "field": - a = m.get(e, l) ?? m.get(e, l.substring(l.indexOf(".") + 1)); - break; - case "router": - case "query": - a = Ne.getPageParams(l); - break; - case "string": - a = l; - } - a ?? (a = d); - } else a = await Di(t[o], e, i, n); - m.set(r, o, a); - } - return r; -}, zi = (t = {}, e = {}, i = "") => Object.keys(t || {}).reduce((n, r) => { - if (m.isPlainObject(t[r])) { - let o; - if (Reflect.has(t[r], "type") && ["field", "router", "query", "string"].includes(t[r].type)) { - const { type: a, value: s = "", default: l = i } = t[r]; - switch (a) { - case "field": - o = m.get(e, s) ?? m.get(e, s.substring(s.indexOf(".") + 1)); - break; - case "router": - case "query": - o = Ne.getPageParams(s); - break; - case "string": - o = s; - } - o ?? (o = l); - } else o = zi(t[r], e, i); - m.set(n, r, o); - } - 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, yo = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { - const e = 16 * Math.random() | 0; - return (t === "x" ? e : 3 & e | 8).toString(16); -}), wo = (t) => { - var e, i; - return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.name : ""; -}, bo = (t) => { - var e, i; - return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.category : ""; -}, Co = (t) => { - var e, i; - return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.owner : ""; -}, _n = (t, e = 32, i = "auto") => { - const n = Ut(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"); -}, Ut = (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(Ut).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${Ut(t[e])}`).join(",") + "}" : String(t), Gn = () => { - let t = 1; - const e = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Map(); - return (...n) => n.length === 0 ? "" : n.map((r) => { - return String((o = r) === null || typeof o != "object" && typeof o != "function" ? (i.has(o) || i.set(o, t++), i.get(o)) : (e.has(o) || e.set(o, t++), e.get(o))); - var o; - }).join("::"); -}, Yn = (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; - } -}, ko = (t, e = "") => { - if (!t || typeof t != "string" || Yn(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 o of c(this, nt)) try { - const a = await o; - if (typeof a != "function") { - console.warn("middleware is not a function, skip:", a); - continue; - } - r = await a.call(n, r); - } catch (a) { - console.error("middleware error, skip:", a); - } - 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, o] = L(n); - return mt(() => { - let a = !1; - return o(n), this.toValue(e, i).then((s) => !a && o(s)).catch((s) => !a && o(`${s}`)), () => a = !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, m.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)) || ((o) => o); - }); - throw new TypeError("middleware must be a string or a function"); -}, Gn())); -let kt = vt; -const ae = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { -}, getSelectedRows: () => [], onReload: () => { -}, onClickCallback: () => { -}, onConditionChange: () => { -}, onTabChange: () => { -}, onSiderChange: () => { -}, onKeywordChange: () => { -}, onPageChange: () => { -}, onPageSizeChange: () => { -}, reload: () => { -}, setPage: () => { -}, setPageSize: () => { -}, setTab: () => { -}, setSider: () => { -}, setKeyword: () => { -}, setCondition: () => { -} }), Ci = ({ className: t, record: e, column: i, ...n }) => { - if (i != null && i.editableByJs && (i != null && i.uuid)) { - const { formSetting: r = { primaryKey: "id" }, widgetSetting: o = {}, widgetContainerSetting: a = {} } = (i == null ? void 0 : i.editableByJsSetting) || {}; - return h(P.Popover, { widget: Xn, widgetData: { record: e, column: i }, widgetSetting: { widgetSetting: o, formSetting: r }, widgetContainerProps: { title: i != null && i.title ? `${i.title} - 编辑` : "编辑", ...a, width: (a == null ? void 0 : a.width) || 260, arrow: !0 }, children: h("td", { className: O("ff-data-list-cell-editable", t), ...n }) }); - } - return h("td", { className: t, ...n }); -}, Xn = ({ record: t, column: e, $close: i, $setting: n }) => { - const r = J(Jn(m.get(t, e == null ? void 0 : e.dataIndex))), { listCode: o, onClickCallback: a } = pe(ae), [s] = re.useForm(), { formSetting: l, widgetSetting: d } = n, u = (l == null ? void 0 : l.primaryKey) || "id", p = () => { - s.setFieldsValue({ value: m.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); - }; - return mt(() => p(), [t, e == null ? void 0 : e.dataIndex, o]), h(ee, { actions: j(E.Fragment, { children: [h(P, { size: "small", onClick: p, children: "重置" }), j(Nn.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, u.substring(u.indexOf(".") + 1)); - if (!g) throw "获取更新主键失败!"; - I.put(`/api/${o}-storeBy-${e == null ? void 0 : e.uuid}/${g}`, { value: f }).msg(() => a(2, t)).then(i); - }).catch(console.warn), children: "保存" })] })] }), children: j(re, { 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: () => { - } })] }) }); -}, Qn = (t) => function(e) { - return t(e, getRecord()); -}, Zn = (t, e = {}) => H(() => { - var i; - return (i = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : i.map(({ widgetByJs: n, widgetByJsSetting: r, ...o }, a) => { - const s = (d) => ({ record: d, column: o }); - let l = []; - return n && l.push([n, r]), l.length > 0 ? (o != null && o.render && l.push([Qn, o.render]), { ...o, onCell: s, render: (d, u) => new kt(l).toRender(d, u, "-") }) : { ...o, onCell: s }; - }); -}, [t, e]), er = (t = {}) => H(() => { - var e; - return t.body ?? (t.body = { cell: Ci }), (e = t.body).cell ?? (e.cell = Ci), t; -}, [t]), So = (t) => { - const [e, i] = L({}); - return M(() => { - 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", "selectionType"])).then((r) => !n && i(r)), () => n = !0; - }, [t]), e; -}, Eo = (t, e = {}) => { - const [i, n] = L({ dataSource: [] }); - return ht(() => { - let r = !1; - return t && I.get(`/api/${t}/${I.encode({ page: 1, ...e })}`).then((o) => !r && n(o)), () => r = !0; - }, [t, e]), i; -}, Wi = (t = [], e = /* @__PURE__ */ new Map(), i = "id", n) => { - const r = Y(n ? (o) => m.get(o, i, m.get(o, [n, i])) : (o) => m.get(o, i), [i, n]); - return Y((o) => t == null ? void 0 : t.filter((a) => !a.uuid || !e.has(a.uuid) || e.get(a.uuid).some((s) => s == r(o))), [t, e, r]); -}, qt = (t = [], e = /* @__PURE__ */ new Map(), i = [], n = "id", r) => { - const o = Y(r ? (a) => m.get(a, n, m.get(a, [r, n])) : (a) => m.get(a, n), [n, r]); - return H(() => { - if (m.isEmpty(t) || !t.some(({ uuid: s }) => Ii.check(s))) return !1; - if (m.isEmpty(e) || m.isEmpty(i)) return !0; - const a = i.map((s) => o(s)); - return t.some(({ uuid: s }) => !s || !e.has(s) || e.get(s).some((l) => a.some((d) => d == l))); - }, [t, i, e, o]); -}, tr = (t, e, i = "id", n = null) => { - const r = Tt(), o = J(!1), a = J(t.dataSource), s = J(t.itemOperationsAccess); - return M(() => (a.current = t.dataSource, s.current = t.itemOperationsAccess, () => o.current = !1), [t.dataSource, t.itemOperationsAccess]), o.current && (t.dataSource = a.current, t.itemOperationsAccess = s.current), [t, (l = 0, d = null) => { - var u, p; - if (o.current = !1, l === 1) return (u = t.onReload) == null ? void 0 : u.call(t); - if (l === 2) { - const f = m.get(d, "__PARENT_ID__", ""), g = m.get(d, i, m.get(d, [n, i], "")), y = m.findIndex(a.current, ["__PARENT_ID__", f]), w = m.findIndex(y > -1 ? m.get(a.current, [y, "children"]) : a.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, S]) => { - const v = m.get(a.current, y > -1 ? [y, "children", w, "children"] : [w, "children"]); - a.current = Ri(a.current, y > -1 ? { [y]: { children: { $splice: [[w, 1, { ...C, children: v }]] } } } : { $splice: [[w, 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, m.uniq([...s.current.get(T) || [], ...$])) : s.current.set(T, $); - }); - }).then(() => { - o.current = !0, r(); - }); - } - }]; -}, ir = (t, e) => { - const i = Tt(), n = J(e), r = J(/* @__PURE__ */ new Map()), o = J([]), a = m.throttle((l) => { - o.current = [], I.list(t, m.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: d, condition: u, total: p, tab: f, sider: g, page: y, pageSize: w, operationsAccess: C, dataSource: S }) => { - n.current = { tab: f, condition: u, sider: g, keyword: d, total: p, pageSize: w, page: S != null && S.length ? y : 1 }, o.current = S, r.current = new Map(C), i(); - }); - }, 380, { leading: !1, trailing: !0 }); - mt(() => { - o.current = [], t && a(e); - }, [t, e]); - const s = H(() => m.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [n.current]); - return Object.assign(s, { onTabChange: (l) => a({ tab: l, page: 1 }), onPageChange: (l, d) => a({ page: l, pageSize: d }), onPageSizeChange: (l) => a({ pageSize: l, page: 1 }), onConditionChange: (l, d) => a({ keyword: d, condition: Ri(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => a({ sider: l, page: 1 }), onKeywordChange: (l) => a({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: o.current, onReload: a, payload: e == null ? void 0 : e.payload }); -}, nr = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, isPaginate: r, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: d, resource: u, primaryKey: p, title: f, itemGridLayout: g, $setting: y, tabs: w, isConditionFormLayout: C, isTreeSider: S, treeSiderConfig: v }) => { - const { classNames: k, onClickCallback: $ } = pe(ae), T = m.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style"]), A = Wi(l, d, p, u), F = Y((V, D, R) => h(rr, { className: O("ff-data-list-framework-item", k == null ? void 0 : k.item), operations: o ? A(D) : [], data: u ? { [u]: D } : D, children: V, onClickCallback: $ }), [u, p, o, $, l, d]); - return j("div", { className: O("ff-data-list-framework", e), children: [h(i.sider, { isTreeSider: S, ...v }), j("div", { className: O("ff-data-list-container", k == null ? void 0 : k.container), children: [h(i.filter, { isConditionFormLayout: C }), h(i.toolbar, { title: f, tabs: w }), h(wr, { ...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: a, operations: s })] })] }); -}, rr = ({ className: t, operations: e, children: i, data: n, onClickCallback: r }) => j("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((o) => h("span", { className: "data-list-grid-layout-item-action", children: h(P.Link, { uuid: o.uuid, type: o.type, name: o.name, widget: o.widget, widgetType: o.widgetType, widgetProps: o.widgetProps, widgetSetting: o.widgetSetting, widgetContainerProps: o.widgetContainerSetting, data: n, confirm: o.confirm, onAfterClick: (a) => a !== !1 && (r == null ? void 0 : r(o.isRefresh, n)) }, o.uuid || Mt()) }, (o == null ? void 0 : o.uuid) || Mt())) })] }), or = ({ listCode: t, className: e, layouts: i = {}, dataSource: n, columns: r, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: d, resource: u, primaryKey: p, title: f, tabs: g, isPaginate: y, rowSelection: w, isTreeSider: C, treeSiderConfig: S, isConditionFormLayout: v, ...k }) => { - const { classNames: $, onClickCallback: T } = pe(ae), A = Wi(l, d, p, u), F = qt(l, d, n, p, u); - return j("div", { className: O("ff-data-table-framework", e), children: [h(i.sider, { isTreeSider: C, ...S }), j("div", { className: O("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(i.filter, { isConditionFormLayout: v }), h(i.toolbar, { title: f, tabs: g }), h(pr, { ...k, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: n, rowSelection: w, operationRender: F ? (V) => { - var D; - return h("div", { className: "ff-data-table-actions", children: (D = A(V)) == null ? void 0 : D.map((R, W) => 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: V, confirm: R.confirm, onAfterClick: (U) => U !== !1 && (T == null ? void 0 : T(R.isRefresh, V)) }, R.uuid || W)) }); - } : null }), h(i.footer, { isPaginate: y, isOperations: a, operations: s })] })] }); -}, Zt = (t = [], e, i = null) => { - var n; - return (n = m.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: o, y: a, w: s, h: l, field: { boxStyle: d, ...u } = {} }, p) => h("div", { className: "grid-layout-item", style: Bi(o, a, s, l, d), children: h(e, { ...u, basicForm: i }) }, r ?? p)); -}, Bi = (t, e, i, n, r = {}, o = 0) => { - const a = { "--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 ? a.height = "fit-content" : a["--grid-layout-row"] = `${n}`, r != null && r.alignItems && (a["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (a["--grid-layout-box-justify-content"] = r.justifyContent), a["--grid-layout-box-margin"] = ki(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), a["--grid-layout-box-padding"] = ki(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), o && (a.height = `${o}px`), a; -}, ki = (t, e, i, n) => `${t || 0}px ${e || 0}px ${i || 0}px ${n || 0}px`, $o = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, Ui = (t) => Object.keys(t).reduce((e, i) => (/^on[A-Z]/.test(i) && (e[i] = t[i]), e), {}), qi = ({ className: t, isConditionFormLayout: e }) => { - var f, g; - const [i, n] = L({}), { listCode: r, onKeywordChange: o, onConditionChange: a, getBase62params: s, classNames: l } = E.useContext(ae), { keyword: d, condition: u } = (s == null ? void 0 : s()) || {}, [p] = wt.useForm(); - return M(() => { - r && e && I.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: y, marginX: w, marginY: C, rowHeight: S, cols: v, fields: k }) => { - n({ resource: y, itemMargin: [w, C], rowHeight: S, cols: v, fields: k }); - }).catch(() => n({})); - }, [r, e]), M(() => { - p.setFieldsValue({ keyword: d, ...u }); - }, [JSON.stringify([d, u])]), h("div", { className: O("ff-data-list-filter", l.filter, t), children: h(wt, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((f = i.fields) == null ? void 0 : f.length) > 1 ? (y) => a({ [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(ii, { ...i, children: h(ar, { 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: Bi(20, 0, 5, 2), children: h(wt.Item, { name: ["keyword"], children: h(Pn.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (y) => o(y) }) }) }) }) }) }); -}, ar = ({ cols: t, fields: e, onReset: i }) => { - const [n, r] = L(!1), o = H(() => e == null ? void 0 : e.toReversed().some((a) => a.y > 1 || a.x + a.w >= t - 5), [t, e]); - return j(wt.Item, { label: " ", style: { "--item-span": 5 }, className: O("ff-data-list-filter-actions", { expanded: n }), children: [h(Ct, { onClick: i, children: "重置" }), h(Ct, { type: "primary", htmlType: "submit", children: "查询" }), o && h(P.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((a) => !a), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); -}; -qi.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 sr = ({ className: t, operations: e, isOperations: i, isPaginate: n }) => { - const { onPageChange: r, onPageSizeChange: o, onClickCallback: a, getBase62params: s } = E.useContext(ae), { total: l, page: d, pageSize: u } = (s == null ? void 0 : s()) || {}; - return i && !m.isEmpty(e) || n ? j("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 && (a == null ? void 0 : a(p.isRefresh, null)) }, p.uuid || f)) }), n && h(Tn, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${d} 页 / 总共 ${p} 条`, onChange: r, onShowSizeChange: o })] }) : null; -}, lr = [{ 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" }] }] }], cr = ({ className: t, width: e = 280, isTreeSider: i }) => { - const { classNames: n } = pe(ae); - return i ? h(On.DirectoryTree, { className: O("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: lr }) : null; -}, dr = ({ className: t, title: e, tabs: i }) => { - const { getBase62params: n, onTabChange: r, onReload: o, classNames: a } = pe(ae), { tab: s } = (n == null ? void 0 : n()) || {}, [l, d] = Vn((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: r }); - return j("div", { className: O("ff-data-list-toolbar", a.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(Rn, { className: "ff-data-list-tabs", itemRender: ({ label: u, code: p, value: f }) => h("span", { onClick: () => d(f ?? p), className: O("ff-data-list-tab", { active: (f ?? p) == l }), children: u }), items: i }), j("div", { className: "ff-data-list-actions", children: [h(P.Link, { icon: "icon-reload", widget: () => o() }), h(P.Link, { icon: "icon-setting" })] })] }); -}, ur = ({ className: t, ...e }) => h(zt, { className: O(t, "ff-data-list-empty"), image: zt.PRESENTED_IMAGE_SIMPLE, ...e }), Ki = ({ isItemGridLayout: t, theme: e, themeProps: i, onClickCallback: n, onReload: r, listCode: o, total: a = 0, page: s = 0, onPageChange: l, pageSize: d = 30, onPageSizeChange: u, tab: p, onTabChange: f, keyword: g, onKeywordChange: y, condition: w, onConditionChange: C, sider: S, onSiderChange: v, layouts: k, classNames: $ = {}, payload: T = {}, dataSource: A = [], rowSelection: F, getSelectedRows: V, primaryKey: D, ...R }) => { - const [W, U] = L(), q = V ?? (() => A), ge = Y((z, se) => { - const _ = { tab: p, page: s, pageSize: d, keyword: g, sider: S, condition: w, total: a, payload: T }; - return z && z != "init" ? m.get(_, z, se) : _; - }, [JSON.stringify(w), JSON.stringify(T), p, s, d, g, S, a]), oe = H(() => { - let z = { sider: cr, filter: qi, footer: sr, toolbar: dr, empty: ur }; - k === !1 ? z = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : m.isPlainObject(k) && (z = Object.assign({}, z, k)); - for (const se in z) if (z[se]) { - if (kn(z[se])) { - const _ = z[se]; - z[se] = (Rt) => E.cloneElement(_, Rt); - } - } else z[se] = () => h(E.Fragment, {}); - return z; - }, [k]); - return M(() => { - e ? ue.getWidgetComponent(e).then((z) => { - if (!z) throw `${e} not found`; - return z; - }).catch((z) => ({ default: () => `${z}` })).then((z) => U(E.createElement(z.default, { ...R, layouts: oe, $setting: i }))) : U(h(t ? nr : or, { ...R, layouts: oe, $setting: i })); - }, [e, i]), h(ae.Provider, { value: { classNames: $, listCode: o, onClickCallback: n, onReload: r, getBase62params: ge, onPageChange: l, onPageSizeChange: u, onTabChange: f, onSiderChange: v, onKeywordChange: y, onConditionChange: C, setPage: l, setPageSize: u, setTab: f, setSider: v, setKeyword: y, setCondition: C, getSelectedRows: q }, children: W && E.cloneElement(W, { dataSource: A, primaryKey: D, rowSelection: F, ...R }) }); -}; -Ki.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 Oe, $e, We, xt; -const ye = class ye { - constructor() { - x(this, $e, null); - x(this, We, /* @__PURE__ */ new Map()); - x(this, xt, () => { - if (c(this, $e)) return c(this, $e).port.postMessage({ command: "status", data: [] }); - B(this, $e, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), c(this, $e).port.onmessage = (e) => { - var i, n; - (i = e.data) != null && i.uuid ? c(this, We).forEach((r, o) => { - var a; - (r == "*" || (a = r == null ? void 0 : r.includes) != null && a.call(r, e.data.uuid)) && o(e.data); - }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && I.get("/api/user-api-token").then(({ token: r, expire_at: o }) => { - c(this, $e).port.postMessage({ command: "initWs", data: [`ws${m.trimStart(I.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); - }); - }, c(this, $e).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(ye, Oe)) return c(ye, Oe); - } -}; -Oe = new WeakMap(), $e = new WeakMap(), We = new WeakMap(), xt = new WeakMap(), x(ye, Oe, null), N(ye, "getInstance", () => (c(ye, Oe) || B(ye, Oe, new ye()), c(ye, Oe))); -let Kt = ye; -const Hi = Kt.getInstance(), ei = E.forwardRef(({ listCode: t, base62params: e, className: i, theme: n, themeProps: r, layouts: o, classNames: a, onSelectionChange: s, defaultSelectedRowKeys: l, selectedRowKeys: d, onDataSourceChange: u }, p) => { - const [{ resource: f, primaryKey: g, batchOperations: y = [], itemOperations: w = [], columns: C = [], themeConfig: S, theme: v, isConditionFormLayout: k = !1, isTreeSider: $, treeSiderConfig: T, isItemGridLayout: A, itemGridLayout: { themeConfig: F, ...V } = {}, title: D, isPaginate: R, tabs: W, selectionType: U }, q] = L({ isItemGridLayout: !1, itemGridLayout: {} }), ge = ir(t, e), [{ dataSource: oe, itemOperationsAccess: z, condition: se, tab: _, keyword: Rt, page: ai, total: si, pageSize: li, sider: rn, onConditionChange: on, onTabChange: an, onKeywordChange: sn, onPageChange: ln, onPageSizeChange: cn, onSiderChange: dn, onReload: Ft, payload: un }, ci] = tr(ge, t, g, f), pn = $n(u); - In(() => { - pn(oe, { page: ai, pageSize: li, total: si }); - }, [oe]); - const [gn, hn] = Ln([], { defaultValue: l ?? [], value: d }), [di, mn] = L([]), ui = Y(() => U ? di : oe, [U, di, oe]), fn = qt(w, z, oe, g), yn = qt(y); - M(() => { - let X = null; - return t && I.get(`/api/_/${t}`).resp(({ data: Ve, res: At }) => { - Ve != null && Ve.isDynamicRefresh && (X = Hi.subscribe(() => Ft(), At)), q(Ve); - }).catch(() => q({})), () => X == null ? void 0 : X(); - }, [t]), E.useImperativeHandle(p, () => ({ onReload: Ft, onClickCallback: ci, getSelectedRows: ui })); - const wn = { listCode: t, title: D, classNames: a, layouts: o, resource: f, primaryKey: g, theme: n || v, themeProps: r || S, isTreeSider: $, treeSiderConfig: T, isPaginate: R, rowSelection: U ? { type: U, columnWidth: 80, selectedRowKeys: gn, onChange: (X, Ve) => { - mn((At) => { - const pi = new Map(At.map((le) => [le == null ? void 0 : le[g], le])); - return Ve.forEach((le) => pi.set(le == null ? void 0 : le[g], le)), X.map((le) => pi.get(le)).filter(Boolean); - }), hn(X), s == null || s(X, Ve); - } } : void 0, getSelectedRows: ui, tabs: W, isItemOperations: fn, itemOperations: w == null ? void 0 : w.map((X) => m.isEmpty(X == null ? void 0 : X.confirm) ? X : { ...X, confirm: Object.assign({}, X.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: yn, batchOperations: y, isItemGridLayout: A, columns: C, itemGridLayout: { ...V, themeProps: F }, isConditionFormLayout: k, itemOperationsAccess: z, dataSource: oe, onConditionChange: on, onTabChange: an, onKeywordChange: sn, onPageChange: ln, onPageSizeChange: cn, onSiderChange: dn, condition: se, tab: _, keyword: Rt, page: ai, total: si, pageSize: li, sider: rn, payload: un }; - return h(Ki, { ...wn, className: O("ff-data-list-helper", i), onReload: Ft, onClickCallback: ci }); -}), Ji = (t, e, i = !0) => i !== !0 && i-- <= 0 ? [] : m.isArray(t) && !m.isEmpty(t) ? t.reduce((n, r) => (Reflect.has(r, e) && Reflect.has(r, "children") && n.push(r[e]), Reflect.has(r, "children") && !m.isEmpty(r.children) ? n.concat(Ji(r.children, e, i)) : n), []) : [], pr = ({ className: t, primaryKey: e, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: o = 180, components: a = {}, rowSelection: s, ...l }) => { - const { classNames: d } = pe(ae), u = J(null), p = J(null), [f, g] = L([]), [y, w] = L({ width: 0, height: 0 }); - M(() => { - g(Ji(n, e)); - }, [n, e]), Sn(() => { - const k = new ResizeObserver(() => { - var $; - w({ 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 = H(() => { - if (!(y != null && y.width) || !(i != null && i.length)) return i; - const k = (s ? s.columnWidth ?? 32 : 0) + (r ? o : 0), $ = i.reduce((F, V) => F + (V.isWidthFixed && V.width ? V.width : 0), 0), T = i.filter((F) => !F.isWidthFixed).reduce((F, V) => F + (V.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, o]), S = Zn(C), v = er(a); - return h("div", { ref: p, className: O("ff-data-list-table", d.content, t), children: y.height ? h(yi, { 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, yi.SELECTION_COLUMN), r && k.push({ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(o / y.width * 100).toFixed(2)}%`, render: (A, F, V) => r(F, V) }), k; - })(), dataSource: n, size: "middle", scroll: { x: "max-content", y: y.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: f } }) : null }); -}, gr = "RC_FORM_INTERNAL_HOOKS", hr = (t) => { - const [e, i] = E.useState({ items: [] }); - return M(() => { - t && I.get(`/api/_/${t}`).then(({ uuid: n, code: r, name: o, resource: a, primaryKey: s, marginX: l, marginY: d, cols: u, rowHeight: p, fields: f, theme: g, themeSetting: y, groups: w }) => ({ uuid: n, code: r, name: o, resource: a, primaryKey: s, marginX: l, marginY: d, cols: u, rowHeight: p, theme: g, themeProps: y, groups: w, items: f })).then(i); - }, [t]), e; -}, mr = (t, { initialValue: e, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: o = "string" }, a = null) => { - const s = J(!1), l = pe(Oi), [d, u] = L(), [p, f] = L(i != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(gr) || {}; - return M(() => g == null ? void 0 : g((y, w, C) => { - if (!s.current) return; - const S = m.get(w, t); - m.isEqual(S, p) || f(de(S, o)); - }), [p]), M(() => { - i == "javascript" && e ? Ie.exec(e, {}, { getFieldValueForBasicForm: (y) => a ? a.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => f(de(y, o))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => s.current = !0) : (e && f(de(e ?? l.getFieldValue(t), o)), 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]; -}, vo = (t, e, i = null) => H(() => Zt(t, e, i), [t]), _i = (t, e, i = {}, n = {}, r = {}, o = null) => { - const a = pe(Oi), s = Tt(), l = J(!0), d = J([]), [u, p] = L(e), [f, g] = L(), y = re.useWatch((w) => JSON.stringify(m.pick(w, d.current)), a) || "{}"; - return mt(() => { - t && Ie.exec(t, i, { ...n, getFieldValueForBasicForm: (w) => r ? r.getFieldValue(w) : null, getFieldValue: m.wrap(a.getFieldValue, (w, C) => (d.current.some((S) => m.isEqual(S, C)) || (d.current.push(C), s()), w == null ? void 0 : w(C))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((w) => { - l.current && (p(w), g(null)); - }).catch((w) => { - l.current && (p(e), g(w)); - }); - }, [t, y, a, i, n]), M(() => () => l.current = !1, []), t ? [o ? de(u, o) : u, f] : [o ? de(e, o) : e, null]; -}, fr = ({ 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}`, [o, a] = L(); - return M(() => { - r && ue.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: yr(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => a(E.createElement(s.default, n))); - }, [r]), o; -}, yr = (t, e = {}, i = null) => (n) => { - const { code: r, label: o, extras: a, isVirtual: s, initialValue: l, initialValueLanguage: d, convertJs: u, convertJsSetting: p, value: f, ...g } = m.merge({}, e, n), [y, w] = mr(s ? null : r, { initialValue: l, initialValueLanguage: d, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, i), C = H(() => { - const k = Object.keys((e == null ? void 0 : e.extras) || {}); - return m.over([m.partialRight(m.pick, k), m.partialRight(m.omit, k)]); - }, [e == null ? void 0 : e.extras]), [S, v] = C(g); - return h(t, { ...v, value: y, rawValue: w, $setting: Object.assign({}, a, S) }); -}, Gi = ({ theme: t, basicForm: e, items: i = [{ key: "default", label: "默认" }], fields: n = [], itemRender: r, chunks: o = [], children: a, $setting: s = {}, ...l }) => { - const [d, u] = L(); - M(() => { - t ? ue.getWidgetComponent(t).then((f) => { - if (!(f != null && f.default)) throw "not found"; - return f; - }).catch((f) => ({ default: () => `${t} ${f}` })).then((f) => u(E.createElement(f.default, {}))) : u(null); - }, [t]); - const p = H(() => 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" ? a : null) })).concat(o), [i, a, o]); - return d && E.cloneElement(d, { items: p, basicForm: e, $setting: { ...s, ...l } }); -}, Yi = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: o = 12, rowHeight: a = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: d = {}, formFields: u = [], fields: p = [], data: f, theme: g, themeProps: y = {}, groups: w = [{ key: "default", label: "默认" }], children: C, ...S }) => { - const [v] = re.useForm(e), k = H(() => [{ name: "__PROPS__", value: d }].concat(u), [d, u]); - ht(() => (v.setFieldsValue(f), () => v.resetFields()), [f]); - const $ = (T, A, F) => { - const V = Zt(A, fr, i), D = Ui(S); - return j("div", { ...D, 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": o, "--grid-layout-row-height": `${a}px` }, children: [V, F && E.cloneElement(F, { cols: o, rowHeight: a, itemMargin: l, containerPadding: s, fields: A, basicForm: i })] }); - }; - return h(re, { ...S, fields: k, form: v, component: !1, children: g ? h(Gi, { ...y, items: w, theme: g, itemRender: $, fields: p, children: C, basicForm: i }) : $(0, p, C) }); -}, xo = /* @__PURE__ */ ((t) => function({ code: e, data: i, ...n }) { - const { uuid: r, resource: o, items: a, hides: s, rowHeight: l, marginX: d, marginY: u, cols: p, theme: f, themeProps: g, groups: y } = hr(e) || {}, w = H(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: r }], [e, r, o]); - return o && h(t, { name: e, theme: f, themeProps: g, groups: y, ...n, fields: a, formFields: w, rowHeight: l, cols: p, itemMargin: [d, u], data: o ? { [o]: i } : i }); -})(Yi), wr = ({ column: t = 0, colWidth: e = 0, cols: i, rowHeight: n, itemMargin: r, fields: o, primaryKey: a, dataSource: s, beforeRender: l = null, afterRender: d = null, itemClassName: u, itemRender: p = (v, k, $) => v, empty: f = h(zt, { description: null }), className: g, style: y = {}, theme: w, themeProps: C = {}, groups: S = [{ key: "default", label: "默认" }] }) => { - const { classNames: v } = pe(ae), k = H(() => h(Yi, { groups: S, theme: w, themeProps: C, cols: i, rowHeight: n, itemMargin: r, fields: o, className: u }), [o, i, n, r, S, w, C]), $ = m.isEmpty(s); - return j("div", { className: O("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), $ ? f : s.map((T, A) => { - const F = p(E.cloneElement(k, { data: T }), T, A); - return E.cloneElement(F, { key: `${(T == null ? void 0 : T[a]) ?? A}-${_n(T)}` }); - }), d == null ? void 0 : d(s)] }); -}, br = ({ component: t, $props: e }) => { - const { base62params: i } = gt(e, {}); - return h(ee, { children: h(ei, { listCode: t, base62params: I.decode(i) }) }); -}, No = () => h(Xi, {}), Xi = () => "Empty", Cr = ({ component: t, $setting: e, $props: i }) => { - const [n, r] = L(); - M(() => { - if (!t) return r(h(Xi, { description: null })); - ue.getWidgetComponent(t).catch((a) => ({ default: () => `${a}` })).then((a) => E.createElement(a.default, { $setting: e })).then(r); - }, [t]); - const o = gt(i, {}); - return n ? E.cloneElement(n, o) : null; -}, Po = () => "NotFoundPage"; -var Re, ce, Fe, Ae, ot, at; -const we = class we { - 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: o, widgetProps: a } = this.get(e) || {}, { router: s, query: l, ...d } = i || {}, u = Object.assign({}, d, s), p = Object.assign({}, d, l); - o == "list" && (u.base62params = I.encode(u != null && u.base62params ? u.base62params : u)); - let f = Mn(r || e, u); - const g = new URLSearchParams(); - for (const y in a || {}) (a == null ? void 0 : a.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, Ae).navigate(f, { 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, ot).call(this, c(this, Fe)[n], e, [n]), i.length > 1) return i; - return i; - }); - N(this, "getMenusByRouteUuid", (e) => c(this, at).call(this, e, Object.values(c(this, Fe)).flat())); - x(this, ot, (e, i, n = []) => { - if (m.isEmpty(e)) return n; - for (const { uuid: r, children: o } of e) { - if (r == i) return n.concat(r); - if (!m.isEmpty(o)) return n.concat(r, c(this, ot).call(this, o, i)); - } - return n; - }); - x(this, at, (e, i) => { - var r; - let n = []; - for (const o of i) o.widgetType == "redirect" && (o.uuid == e || o.widget == e ? n.push(o) : (r = o.children) != null && r.length && (n = n.concat(c(this, at).call(this, e, o.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, Ae).state.matches[c(this, Ae).state.matches.length - 1 - e]) == null ? void 0 : n.route; - if (!i) return null; - for (let [r, o] of c(this, ce)) if (o.uri === i.path) return o; - return null; - }); - N(this, "getPageParams", (e) => { - var r, o, a; - let i = "", n = {}; - if (Fi()) n = Dn(), i = (r = zn()) == null ? void 0 : r.search; - else { - const { location: s = {}, matches: l = [] } = ((o = c(this, Ae)) == null ? void 0 : o.state) || {}; - n = ((a = l[l.length - 1]) == null ? void 0 : a.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, ce).size == 0) return null; - const i = Ue.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Ue.get(ue.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, o = (s, l) => () => Promise.all([ue.getWidgetComponent(s), gt(l)]).then(([d, u]) => [d.default || function() { - return `${s}`; - }, u]).then(([d, u]) => ({ Component: () => E.createElement(ji, {}, E.createElement(d, { $setting: u })) })), a = Array.from(c(this, ce).values()).reduce((s, { uuid: l, uri: d, name: u, type: p, component: f, widgetSetting: g, widgetProps: y, isLogin: w, isLayout: C, extra: S }) => { - let v = {}, k = 0; - switch (p) { - case "list": - v.element = E.createElement(br, { component: f, $props: y }); - break; - case "fsdpf-component": - v.element = E.createElement(Cr, { key: f, component: f, $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: o($, 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: o(i, {}), children: [] }]); - return a.push({ index: !0, element: E.createElement(kr, { to: n, replace: !0 }) }), B(this, Ae, Wn(a, e)); - }); - if (c(we, Re)) return c(we, Re); - } -}; -Re = new WeakMap(), ce = new WeakMap(), Fe = new WeakMap(), Ae = new WeakMap(), ot = new WeakMap(), at = new WeakMap(), x(we, Re, null), N(we, "getInstance", () => (c(we, Re) || B(we, Re, new we()), c(we, Re))); -let Ht = we; -const kr = ({ to: t, replace: e }) => Fi() ? E.createElement(Bn, { to: t, replace: e }) : (window.document.location = t, "redirect"), Ne = Ht.getInstance(), qe = new Worker(new URL("/ff-worker/index.js", self.location)), Si = { getConfigure: (t) => Ue.get(t), route: { redirect: (...t) => Ne.redirect(...t), getPageParams: (...t) => Ne.getPageParams(...t), getCurrentRoute: () => Ne.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, _e, je; -const K = class K { - constructor() { - N(this, "exec", (e, i = {}, n = {}, r = "") => new Promise((o, a) => { - if (!/^(?!\s*(\/\/|\/\*|\*)).*?\S+/m.test(e)) return o(); - const s = mi(K, Nt)._++; - c(K, _e).set(s, n), K.mQueue.set(s, [o, a]), qe.postMessage({ id: s, session: r, category: "eval", method: e, args: i }); - })); - N(this, "clear", (e) => qe.postMessage({ session: e, category: "clear" })); - if (c(K, je)) return c(K, je); - Promise.resolve().then(() => Jr).then((e) => { - Si.http = e.http; - }), qe.addEventListener("message", ({ data: { id: e, task_id: i, method: n, args: r, category: o, data: a, error: s, session: l } }) => { - if (o === "eval" && K.mQueue.has(e)) s !== null ? K.mQueue.get(e)[1](s) : K.mQueue.get(e)[0](a), c(K, _e).delete(e), K.mQueue.delete(e); - else if (o === "util") try { - const d = m.get(Si, n.split("/")) || m.get(c(K, _e).get(i), n.split("/")); - if (!m.isFunction(d)) throw `${n} not found`; - Promise.resolve(Reflect.apply(d, void 0, r)).then((u) => { - qe.postMessage({ id: e, task_id: i, category: o, method: n, args: r, session: l, data: u, error: null }); - }).catch((u) => { - qe.postMessage({ id: e, task_id: i, category: o, method: n, args: r, session: l, data: null, error: u }); - }); - } catch (d) { - qe.postMessage({ id: e, task_id: i, category: o, method: n, args: r, session: l, data: null, error: d }); - } - }, !1); - } -}; -Nt = new WeakMap(), _e = new WeakMap(), je = new WeakMap(), N(K, "mQueue", /* @__PURE__ */ new Map()), x(K, Nt, 0), x(K, _e, /* @__PURE__ */ new Map()), x(K, je, null), N(K, "getInstance", () => (c(K, je) || B(K, je, new K()), c(K, je))); -let Jt = K; -const Ie = Jt.getInstance(), Tt = () => { - const t = J(!0), [, e] = E.useReducer((i) => i + 1, 0); - return M(() => () => t.current = !1, []), () => t.current && e(); -}, To = (t) => { - const [e, i] = L(t), n = J(null), r = Y((o, a) => { - n.current = a, i(o); - }, []); - return M(() => { - n.current && (n.current(e), n.current = null); - }, [e]), [e, r]; -}, ht = (t = (n) => { -}, e, i = m.isEqual) => { - const n = E.useRef(); - i(e, n.current) || (n.current = m.cloneDeep(e)), E.useEffect(t, [n.current]); -}, mt = ht, Qi = (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 = Qi(t[n].children, e)); - return t; -}, Oo = (t, e = "json", i = "string", n, r = null) => { - const [o] = re.useForm(n), [a, s] = L([{ label: "无", value: "", disabled: !0 }]), l = J([]), d = re.useWatch((u) => l.current.length === 0 ? null : m.pick(u, l.current), o) || null; - return M(() => { - Array.isArray(t) ? s(t) : e === "javascript" && t ? Ie.exec(t, {}, { getFieldValue: (u) => (l.current.includes(u) || l.current.push(u), o.getFieldValue(u)), getFieldValueForBasicForm: (u) => (l.current.includes(u) || l.current.push(u), r ? r.getFieldValue(u) : o.getFieldValue(u)) }).then((u) => { - s(de(u, "array")); - }).catch((u) => console.error("useOptions", u)) : t && s(de(t, "array")); - }, [t, e, d]), Qi(a, i); -}, Ro = (t) => { - const [e, i] = L(), n = { type: "GET" }; - if (typeof t == "string" ? n.url = t : m.isPlainObject(t) && Object.assign(n, t), !(n != null && n.url)) throw "url is required"; - const r = (o) => I.request(n, !1).resp((a) => (console.log("useSubscribeRequest", o), i(a), a)); - return ht(() => { - let o = null; - return r().then((a) => { - o = Hi.subscribe(m.throttle(r, 180, { leading: !1, trailing: !0 }), a.res); - }), () => o == null ? void 0 : o(); - }, n), e; -}, Sr = (t) => { - const [e, i] = E.useState({ items: [], hides: [] }); - return E.useEffect(() => { - t && I.get(`/api/_/${t}`).then(({ pk: n, uuid: r, code: o, resource: a, align: s, cols: l, rowHeight: d, marginX: u, marginY: p, listenChangeFields: f, listenChangeFieldsFunc: g, fields: y, theme: w, themeSetting: C, groups: S }) => ({ pk: n, uuid: r, code: o, resource: a, align: s, cols: l, rowHeight: d, marginX: u, marginY: p, theme: w, themeProps: C, groups: S, listenChangeFields: f, 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; -}, Er = ({ max: t = 0, min: e = 0, type: i = "", message: n, pattern: r, required: o = !1, validator: a } = {}, s, l) => { - const [d, u] = L([]); - return M(() => { - const p = []; - if (o) { - 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": - a && p.push(({ getFieldValue: f }) => ({ validator: async (g, y) => { - const w = await Ie.exec(a, { value: y, fieldName: s }, { getFieldValue: f }); - return m.isString(w) && w ? Promise.reject(w) : m.isBoolean(w) && !w ? Promise.reject(n) : Promise.resolve(); - } })); - } - u(p); - }, [t, e, i, n, r, o, a]), d; -}, $r = (t, e, i) => { - const [n, r] = L(null); - return M(() => { - const { initDataUri: o = `/api/${t}`, initDataMethod: a = "GET" } = i || {}; - e && I.request({ method: a, url: m.trimEnd(`${o}/${e}`, "/") }).then((s) => { - r(s); - }); - }, [t, e, i]), n; -}, vr = (t, e, i) => Y((n, r = { serialize: (o) => o, onSuccess: () => { -}, onFail: (o) => (o == null ? void 0 : o.errorFields) && ne.error("请先完善表单信息", { duration: 2e3 }) }) => { - const o = n.getFieldValue("__RESOURCE__"), { submitDataUri: a = `/api/${t}`, submitDataMethod: s = "POST" } = i || {}; - return n.validateFields().then((l) => o ? m.pick(l, [o]) : l).then(r.serialize).then((l) => I.request({ method: s, url: m.trimEnd(`${a}/${e || ""}`, "/"), data: l }).msg(r.onSuccess)).catch(r.onFail); -}, [t, e, i]), xr = (t, e, i, n) => { - const r = $r(e, i, n); - M(() => { - r ? t.setFieldsValue(r) : t.resetFields(); - }, [t, r]); - const o = vr(e, i, n); - return m.partial(o, t); -}, Nr = (t, e, i = [], n = {}) => { - const r = J({}), o = J(), a = m.debounce(Tt(), 180), s = ["disabled", "required"], l = (f, g) => { - s.includes(f) && (r.current[f] = g), a(); - }, d = H(() => ({ setDisabled: (f) => l("disabled", f), setRequired: (f) => l("required", f), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [e]), [u, p] = _i(e, -1, {}, d, n); - if (!p && o.current != u && (u >= 0 || !m.isEmpty(i == null ? void 0 : i[u]))) { - o.current = u; - const { widget: f, widgetPrefix: g, props: y } = i == null ? void 0 : i[u]; - t = Vi(f, g), r.current = m.merge(y, m.pick(r.current, s)); - } - return [t, r.current]; -}, Ei = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), Fo = ({ value: t, onChange: e }, i = null) => { - const n = J(), [r] = re.useForm(i), o = J({}); - return mt(() => { - m.isEqual(n.current, t) || r.setFieldsValue(t); - }, [t]), M(() => () => r.resetFields(), []), [H(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (a) => (s) => { - const l = Ei(a); - s ? o.current[l] = s : delete o.current[l]; - } }, scrollToField: (a, s = {}) => { - console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); - }, focusField: (a) => { - console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); - }, getFieldInstance: (a) => { - const s = Ei(a); - return o.current[s]; - } }, [r]), (a, 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, ...o }) => { - const a = Vi(t, e), [s, l] = Nr(a, i, n, r), [d, u] = L(); - return M(() => { - s && ue.getWidgetComponent(s).then(({ defaultProps: p = {}, default: f }) => ({ default: Pr(f, p, r) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(E.createElement(p.default, o))); - }, [s]), d && E.cloneElement(d, { ...o, ...l }); -}, Pr = (t, e = {}, i = null) => (n) => { - const { type: r, code: o, label: a, noStyle: s, style: l, placeholder: d, required: u = !1, extras: p, validators: f, help: g, isVirtual: y, $isReserved: w, initialValue: C, initialValueLanguage: S, ...v } = m.omit(m.merge({}, e, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = Er(Object.assign({}, f, u ? { required: !0 } : {}), o, r), $ = H(() => { - const D = Object.keys((e == null ? void 0 : e.extras) || {}); - return m.over([m.partialRight(m.pick, D), m.partialRight(m.omit, D)]); - }, [e == null ? void 0 : e.extras]), [T, A] = $(v), F = { label: a, noStyle: s, style: l, colon: !1, layout: "vertical" }, V = Y((D) => D == null ? void 0 : de(D, r), [r]); - return h(Xt, { name: o, rules: k, initialValue: V(C), normalize: V, children: (D, R, W) => { - var U; - return h(t, { type: r, rcform: W, basicForm: i, itemProps: { validateStatus: R.errors.length > 0 ? "error" : "success", tooltip: g || null, help: R.errors.length > 0 ? R.errors.join("、") : null, required: ((U = k == null ? void 0 : k[0]) == null ? void 0 : U.required) || !1, ...F }, fieldProps: { placeholder: d, ...A, ...D }, $setting: Object.assign({}, p, T) }); - } }); -}, ii = ({ name: t, form: e = null, basicForm: i = null, style: n = {}, className: r, cols: o = 24, rowHeight: a = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: d = [], hides: u = [], primaryKey: p = 0, formProps: f = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: w, onValuesChange: C, theme: S, themeProps: v = {}, groups: k = [{ key: "default", label: "默认" }], children: $, ...T }) => { - const [A] = re.useForm(e), F = Y((R, W) => { - C == null || C(R, W), w && Array.isArray(y) && Ie.exec(w, { changedValues: R, allValues: W }, { getFieldValue: A.getFieldValue, setFieldValue: A.setFieldValue, setFieldsValue: A.setFieldsValue, isFieldTouched: A.isFieldTouched, isFieldsTouched: A.isFieldsTouched }).catch((U) => console.error("onFormValuesChange", t, U)); - }, [t, A, C, y, w]), V = H(() => [{ name: "__PROPS__", value: f }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, f, g]), D = (R, W, U) => { - const q = Zt(W, ti, i), ge = Ui(T); - return j("div", { ...ge, 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": o, "--grid-layout-row-height": `${a}px` }, children: [q, U && E.cloneElement(U, { cols: o, rowHeight: a, itemMargin: s, containerPadding: l, fields: W, basicForm: i })] }); - }; - return j(re, { ...T, form: A, fields: V, onValuesChange: F, children: [S ? h(Gi, { ...v, items: k, theme: S, itemRender: D, fields: d, children: $, basicForm: i }) : D(0, d, $), u == null ? void 0 : u.map((R) => { - var W; - return h(Xt, { name: R.code, children: h(Tr, { form: A, basicForm: i, name: R.code, type: R.type, initialValue: R.initialValue, initialValueLanguage: (W = R.extras) == null ? void 0 : W.initialValueLanguage }) }, JSON.stringify(R.code)); - })] }); -}, Tr = ({ type: t, initialValue: e, initialValueLanguage: i, onChange: n, basicForm: r }) => { - const [o, a] = _i(i == "javascript" && e, i == "javascript" ? void 0 : e, {}, {}, r); - return M(() => { - i == "javascript" ? n(de(o, t)) : e && n(de(e, t)); - }, [t, e, o]), null; -}; -ii.propTypes = { fields: b.array, hides: b.array }; -const Or = /* @__PURE__ */ ((t) => ({ code: e, isPreview: i = !1, ...n }) => { - const { align: r, autoComplete: o, resource: a, items: s, hides: l, rowHeight: d, marginX: u, marginY: p, cols: f, listenChangeFields: g, listenChangeFieldsFunc: y, pk: w, uuid: C, theme: S, themeProps: v, groups: k } = Sr(e), $ = H(() => [{ name: "__PK__", value: w }, { name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: C }], [w, e, C, a]); - return h(t, { name: e, autoComplete: o, theme: S, themeProps: v, groups: k, ...n, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: y, fields: s, hides: l, cols: f, rowHeight: d, itemMargin: [u, p] }); -})(ii), Zi = ({ $setting: t, $close: e, extras: i, code: n, primaryKey: r, ...o }) => { - const [a] = re.useForm(), s = xr(a, 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(Or, { form: a, code: n, primaryKey: r, ...o }) }); -}, $i = /* @__PURE__ */ new Set(), _t = (t = [], e = 0) => { - const i = t[e]; - if (i.length && !$i.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); - }), $i.add(i), document.body.appendChild(n); - } -}, St = ({ 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}` }) }) }); -St.propTypes = { className: b.string, type: b.string.isRequired, style: b.object }, St.init = _t; -const Rr = (t, e, i, n) => Ne.redirect(i, e, n), Fr = (t, e = {}, i, n = {}) => { - var o; - const r = (o = n.router) == null ? void 0 : o.reduce((a, [s, l, d]) => { - const u = m.get(e, ["router", s]); - if (!u && u !== 0 && l) throw `请传入 ${d}`; - return `${a}/${u}`; - }, `/api/${i}`); - return I.del(r, e.param).msg(); -}, vi = (t, e, i, { status: { loading: n, disabled: r }, setStatus: o, listFn: a }) => { - const s = { loading: (l) => l === void 0 ? n : o((d) => ({ ...d, loading: l })), disabled: (l) => l === void 0 ? r : o((d) => ({ ...d, disabled: l })), list: a }; - return m.isFunction(i) ? i.call(null, e, s) : m.isString(i) && i ? Ie.exec(i, e, s) : null; -}, xi = (t, e, i, n, r) => m.isString(i) && i ? ue.getWidgetComponent(i).then(({ default: o }) => ne.modal(o, { ...e, $setting: n }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r)).catch((o) => { - ne.error(i, { content: o.toString() }); -}) : ne.modal(i, { ...e, $setting: n }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), Ar = (t, e, i, n, r) => ne.modal(Zi, { ...e, $setting: n, code: i }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), jr = (t, e, i, n, r) => ne.modal(ei, { base62params: e, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: m.template(r.title)(t) } : r), Lr = ({ widget: t, widgetType: e, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: o }, { onAfterClick: a, onBeforeClick: s } = {}) => { - const l = pe(ae), [d, u] = L({ leading: !0, trailing: !1 }), p = H(() => { - switch (e) { - case "redirect": - return m.partialRight(Rr, t, r); - case "func": - return m.partialRight(vi, (r == null ? void 0 : r.code) ?? t, { status: d, setStatus: u, listFn: l }); - case "component": - case "fsdpf-component": - return m.partialRight(xi, t, r, o); - case "grid-layout-form": - return m.partialRight(Ar, t, r, o); - case "data-list": - return m.partialRight(jr, t, r, o); - case "destroy": - return m.partialRight(Fr, t, r, o); - default: - if (ri(t) || E.isValidElement(t)) return m.partialRight(xi, t, r, o); - if (m.isFunction(t)) return m.partialRight(vi, (r == null ? void 0 : r.code) || t, { status: d, setStatus: u }); - } - return (...f) => console.error("useButton unknown widgetType", e, ...f); - }, [t, e, l.getBase62params, l.getSelectedRows]); - return [m.debounce((f) => (s == null || s(f), Promise.resolve(gt(n, f, { list: l })).then((g) => p(f, { ...i, ...g })).then((g) => a == null ? void 0 : a(g)).catch(console.error)), 300, { leading: !0, trailing: !1 }), d]; -}, en = ({ type: t, name: e, className: i, icon: n, iconPosition: r, size: o }, a = "default") => H(() => { - const s = { type: "primary", className: O("ff-button", i), iconPosition: r, size: o }; - return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), a === "link" || a === "dashed" ? (s.type = a, t === "default" && (s.className = O(s.className, "ff-default"))) : a !== "circle" && a !== "round" || (s.shape = a), n && (s.icon = h(St, { type: n })), e && (s.children = e), s; -}, [a, t, i, n, r]), Ot = ({ data: t, widget: e, widgetType: i = "fsdpf-component", widgetData: n, widgetProps: r, widgetSetting: o, widgetContainerProps: a, onAfterClick: s, onBeforeClick: l, children: d, extras: u }) => { - const p = pe(ae), [f, g] = L(!1), [y, w] = L("hover"), [C, S] = L({}), [v, k] = L(), { placement: $, align: T, zIndex: A, arrow: F = { pointAtCenter: !0 }, getPopupContainer: V, isPopupMountBodyContainer: D = !0, ...R } = a || {}; - M(() => { - i == "grid-layout-form" ? k(E.createElement(Zi, { ...n, $setting: o, code: e })) : i == "data-list" ? k(E.createElement(ei, { base62params: t, $setting: o, listCode: e })) : m.isString(e) ? ue.getWidgetComponent(e).then(({ default: q }) => { - k(E.createElement(q, { ...n, $setting: o })); - }).catch((q) => k(q.toString())) : ri(e) ? k(E.createElement(e, { ...n, $setting: o })) : E.isValidElement(e) && k(E.cloneElement(e, { ...n, $setting: o })); - }, [e, i, n]), M(() => { - Promise.resolve(gt(r, t, { list: p })).then(S); - }, [r, t, p.getBase62params, p.getSelectedRows]); - const W = (q, ge = !1) => (g(q), !q && w("hover"), q ? l == null ? void 0 : l(C) : s == null ? void 0 : s(ge)), U = (q) => { - g(!0), w("click"); - }; - return h(Fn, { zIndex: A, placement: $, onPopupClick: U, onClick: U, open: f, align: T, arrow: F, trigger: y, getPopupContainer: V || D ? void 0 : (q) => q, content: h(Ir, { ...R, extras: u, children: v && E.cloneElement(v, { ...C, $close: (q) => W(!1, q) }) }), children: d, onOpenChange: W }); -}, Ir = ({ title: t, className: e, classNames: i, children: n, extras: r, width: o, height: a, ...s }) => { - const [l, d] = L({}), u = Y((y, w) => d((C) => ({ ...C, [y]: w })), []), p = Y((y) => d((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(pt.Provider, { value: { ele: l, mount: u, unmount: p }, children: j("div", { className: O("ff-popup ff-popover", e, l.rootClassName), style: { width: o ?? 260, height: a }, ...s, children: [j("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 }), j("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] })] }) }); -}; -Ot.propTypes = { widgetType: b.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; -const ft = (t) => function({ className: e, variant: i, children: n, name: r, icon: o, type: a = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: d, onBeforeClick: u, data: p, loading: f, disabled: g, tooltip: y, confirm: w, widget: C = () => { -}, widgetType: S, widgetData: v, widgetProps: k, widgetSetting: $, widgetContainerProps: T, ...A }) { - const { mode: F, ...V } = T || {}, D = en({ className: e, name: r, type: a, icon: o, iconPosition: s }, i ?? t), R = h(Ct, { ...D, ...A, children: n || r }); - if (F === "popover" && !["destroy", "redirect", "func"].includes(S)) return h(Ot, { data: p, widget: C, widgetType: S, widgetData: v, widgetProps: k, widgetSetting: $, widgetContainerProps: V, onAfterClick: d, onBeforeClick: u, children: R }); - const W = m.isEmpty(y) || !y.enabled ? {} : y, U = m.isEmpty(w) ? { enabled: !1 } : Object.assign({ enabled: !0 }, w), [q, ge] = L(!1), [oe, { disabled: z, loading: se }] = Lr({ widget: C, widgetType: S, widgetData: v, widgetProps: k, widgetSetting: $, widgetContainerProps: V }, { onAfterClick: d, onBeforeClick: u }); - return h(An, { okText: "确定", cancelText: "取消", getPopupContainer: (_) => _, ...U, disabled: z || g, open: q, onOpenChange: (_) => { - if (!_) return ge(_); - U.enabled ? ge(_) : oe(p); - }, onConfirm: (_) => { - oe(p, _); - }, onClick: (_) => { - _.stopPropagation(); - }, children: h(jn, { getPopupContainer: (_) => _, ...W, title: q ? null : W == null ? void 0 : W.title, trigger: ["hover", "click"], children: E.cloneElement(R, { loading: se || f, disabled: z || g }) }) }); -}, P = ft("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 Vr = ft("link"), Mr = ft("circle"), Dr = ft("round"), zr = ft("dashed"), Ni = ({ 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: o, labelRender: a, btnVariant: s, btnSize: l, btnRender: d = (g, y) => h(P, { ...g, data: y }, g.uuid || Mt()), widgetContainerProps: u = {}, children: p, data: f }) => { - if (m.isEmpty(t)) return p; - const [g, y] = H(() => (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]); - a ? p = a(g, f) || p : p || (p = h(Ct, { ...en(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: o }), r) })); - const w = 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: m.partialRight(i, C, f), onBeforeClick: m.partialRight(n, C, f) }, { size: l, variant: s }), f)); - return h(Ot, { 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: f, widgetData: g == null ? void 0 : g.widgetData, extras: w, onAfterClick: m.partialRight(i, g, f), onBeforeClick: m.partialRight(n, g, f), children: p }); -}; -Ni.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 = Vr, P.Link.defaultProps = P.defaultProps, P.Link.propTypes = P.propTypes, P.Circle = Mr, P.Circle.defaultProps = P.defaultProps, P.Circle.propTypes = P.propTypes, P.Round = Dr, P.Round.defaultProps = P.defaultProps, P.Round.propTypes = P.propTypes, P.Dashed = zr, P.Dashed.defaultProps = P.defaultProps, P.Dashed.propTypes = P.propTypes, P.Popover = Ot, P.GroupPopover = Ni; -const Wr = ({ fields: t, formProps: e, $close: i }) => { - const [n] = re.useForm(), r = H(() => [{ 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(re, { fields: r, form: n, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...a }) => h(ti, { code: o, ...a }, o)) }) }); -}, Br = ({ className: t, classNames: e, $close: i, children: n, title: r, subTitle: o, actions: a, extras: s, ...l }) => j(Un, { ...l, prefixCls: "ff-drawer", className: O("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (d) => ({ motionAppear: !0, motionName: `panel-motion-${d}` }), children: [j("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(Qt, { type: "close" }) }), r, o] }), h("div", { className: O("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), j("div", { className: O("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, a] })] }), Ur = ({ className: t, classNames: e, $close: i, $event: n, children: r, title: o, subTitle: a, 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(qn, { ...u, ...p, prefixCls: "ff-modal", modalRender: () => j("div", { className: O("ff-modal-content ff-popup", t), children: [j("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: u.onClose, children: h(Qt, { type: "close" }) }), o, a] }), h("div", { className: O("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: r }), j("div", { className: O("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] }) }); -}, tn = ({ placement: t, $close: e, $event: i, children: n, title: r, ...o }) => { - const [a, s] = L({}), [l, d] = L(!0), u = Y((y, w) => s((C) => ({ ...C, [y]: w })), []), p = Y((y) => s((w) => ({ ...w, [y]: void 0 })), []); - let f = { ...o, className: a.rootClassName, title: a.title || r && E.createElement("div", { className: O("ff-popup-title") }, r), subTitle: a["sub-title"], actions: a.actions, extras: a.extras, children: n, $close: e, $event: i, onClose: () => d(!1) }; - const g = () => { - e(!1); - }; - return h(pt.Provider, { value: { ele: a, mount: u, unmount: p }, children: t && t !== "center" ? h(Br, { ...f, placement: t, open: l, afterOpenChange: (y) => !y && g() }) : h(Ur, { ...f, visible: l, afterClose: g }) }); -}; -tn.propTypes = { placement: b.oneOf(["center", "left", "top", "right", "bottom"]) }; -const ie = () => { - const [t, e] = En({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (o) => { - const { offsetHeight: a } = o; - return { height: a }; - }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = E.useReducer((o) => o + 1, 0); - M(() => { - ie.$onClick = n, ie.$queue.forEach(([o, a, s], l, d) => { - r([a, s], ...o), delete d[l]; - }); - }, []); - const n = (o, a = {}, s = {}) => new Promise((l, d) => r([l, d], o, a, s)), r = ([o, a], s, l = {}, d = {}) => { - const u = ie.$index++, p = (f) => ((g, y) => (ie.$popups.delete(g), i(), y == null ? void 0 : y()))(u, () => o(f)); - if (s === Li) return t.open({ ...d, key: u, content: E.createElement(s, { ...l, $close: () => t.close(u) }) }); - ie.$popups.set(u, E.createElement(tn, { 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 || fi.isForwardRef(s) || (s == null ? void 0 : s.$$typeof) === fi.ForwardRef ? E.createElement(s, { ...l, $close: p }) : s)), i(); - }; - return j(E.Fragment, { children: [Array.from(ie.$popups).map(([o, a]) => a), 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 Pi = (t, e, i = {}) => ie.$onClick(t, e, i), It = (t, { showProgress: e, duration: i, ...n } = { duration: 1.5 }) => ie.$onClick(Li, { content: t, ...n }, { showProgress: e, duration: i }), ne = { modal: Pi, confirm: (t, e = {}) => ie.$onClick(Kn, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, i = {}) => Pi(Wr, { 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 nn = () => { - const t = window.localStorage.getItem(bt); - return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); -}; -Me.interceptors.request.use((t) => (Object.assign(t.headers, nn()), Ze.inc(), t), (t) => (Ze.done(), Promise.reject({ code: -1, msg: t }))), Me.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 && Ne.redirect(Ue.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) { - Me.defaults.baseURL = this.appUrl = n, Me.defaults.timeout = 15e3, c(Q, Ye).init(e, i, Me); - } - get driver() { - return Me; - } - get headers() { - return nn(); - } - mock(e = {}) { - return c(this, Ge) ?? B(this, Ge, new vn(Me, { 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 Vt = "mine", bt = "token"; -var Le, Xe; -const be = class be { - constructor() { - x(this, Xe, /* @__PURE__ */ new Map()); - N(this, "setVendor", (e, i) => c(this, Xe).set(e, new Ai(i, async (n, r) => { - var a, s; - if (!(n != null && n.default)) throw "@pkg not found"; - let o = () => r; - switch ("function") { - case typeof (o = (a = n.default) == null ? void 0 : a[`./${r}/index.jsx`]): - case typeof (o = (s = n.default) == null ? void 0 : s[`./${r}/index.js`]): - return o(); - } - 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: o, ...a } = I.decode(window.localStorage.getItem(Vt) || "", {}); - return o === r ? Promise.resolve(a) : I.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(Vt, 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: xn.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(Vt), 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 Ii.init(e), Ue.init(r), Ne.init(i, n), St.init(Ue.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: i, menus: n, configures: r }; - }); - if (c(be, Le)) return c(be, Le); - } -}; -Le = new WeakMap(), Xe = new WeakMap(), x(be, Le, null), N(be, "getInstance", () => (c(be, Le) || B(be, Le, new be()), c(be, Le))); -let Yt = be; -const ue = Yt.getInstance(), qr = E.createContext({ user: {}, initUser: () => { -}, initUserComplete: !1 }), Kr = E.createContext({ set: () => { -}, get: () => { -}, assign: () => { -}, currentRoute: () => { -} }), ri = (t) => !!(t != null && t.name) && (t.prototype instanceof E.Component || /^[A-Z]/.test(t.name)), Hr = (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); -}, Jr = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: qr, AppGlobalParamsContext: Kr, cache: Ai, configure: Ue, default: ue, func: Ie, http: I, insertStyle: Hr, isReactComponent: ri, route: Ne }, Symbol.toStringTag, { value: "Module" })); -var ve, Qe, xe, Ce, ke, te, Z, G, Se, st, lt, ct, dt, Pt, ut; -const oi = class oi { - constructor(e, i = "/") { - x(this, ve, "/"); - x(this, Qe, /* @__PURE__ */ new Set()); - x(this, xe, (e) => { - for (const i of c(this, Qe)) try { - i(e); - } catch (n) { - console.error("Error in VirtualFS event listener:", n); - } - }); - x(this, Ce, (e) => { - const i = Date.now(); - if (e && (e.lastModified = i), c(this, ve) != "/") { - const n = c(this, G).call(this, c(this, ve)); - n && (n.lastModified = i); - } - this.root.lastModified = i; - }); - x(this, ke, (e) => { - let i = he.normalize(e); - return i.startsWith("/") || (i = "/" + i), i.length > 1 && i.endsWith("/") && (i = i.slice(0, -1)), i; - }); - x(this, te, (e) => { - const i = he.join(c(this, ve), e); - return c(this, ke).call(this, i); - }); - x(this, Z, (e) => { - if (!e || typeof e != "string") return !1; - const i = c(this, ke).call(this, e); - return !i.includes("..") && i.startsWith("/"); - }); - x(this, G, (e) => { - var o; - const i = c(this, ke).call(this, e); - if (i === "/") return this.root; - const n = i.split("/").filter((a) => a); - let r = this.root; - for (const a of n) { - if (r.type !== "dir") return null; - const s = (o = r.children) == null ? void 0 : o.find((l) => l.name === a); - if (!s) return null; - r = s; - } - return r; - }); - x(this, Se, (e) => { - const i = c(this, ke).call(this, e), n = he.basename(i), r = he.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) => he.join(i, r)) : n === !0 || n === "working" ? e.map((r) => he.relative(c(this, ve), he.join(i, r))) : e); - x(this, lt, async (e, i, n, r = "") => { - const o = [], a = c(this, G).call(this, e); - if (!a || a.type !== "dir") return o; - const s = a.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) && o.push(p); - else if (l.type === "dir" && n) { - const f = await c(this, lt).call(this, u, i, n, p); - o.push(...f); - } - } catch { - continue; - } - } - return o; - }); - x(this, ct, async (e, i, n, r = "") => { - const o = [], a = Array.isArray(i) ? i : [i], s = c(this, G).call(this, e); - if (!s || s.type !== "dir") return o; - if (!n) { - for (const d of a) if (c(this, dt).call(this, d)) { - const u = await c(this, Pt).call(this, e, d); - o.push(...u); - } else { - const u = he.join(e, d), p = c(this, ke).call(this, u); - c(this, G).call(this, p) && o.push(d); - } - return o; - } - const l = s.children; - for (const d of l) { - const u = d.name, p = e === "/" ? `/${u}` : `${e}/${u}`, f = r ? `${r}/${u}` : u; - try { - if (d.type === "file") for (const g of a) { - let y = !1; - if (y = c(this, dt).call(this, g) ? c(this, ut).call(this, u, g) : u === g, y) { - o.push(f); - break; - } - } - else if (d.type === "dir") { - const g = await c(this, ct).call(this, p, i, n, f); - o.push(...g); - } - } catch { - continue; - } - } - return o; - }); - 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 o = r.children.map((a) => a.name); - for (const a of o) c(this, ut).call(this, a, i) && n.push(a); - return n; - }); - x(this, ut, (e, i) => { - const n = i.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (r, o) => "(" + o.split(",").join("|") + ")"); - return new RegExp(`^${n}$`).test(e); - }); - var n, r, o; - B(this, ve, 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 = []), (o = this.root).lastModified ?? (o.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: o } = c(this, Se).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 a = r.children.findIndex((d) => d.name === o), s = a >= 0, l = { name: o, type: "file", content: i, lastModified: Date.now() }; - s ? r.children[a] = l : r.children.push(l), c(this, Ce).call(this, r), c(this, xe).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 o = n.split("/").filter((s) => s); - let a = "/"; - for (const s of o) - if (a = he.join(a, s), !c(this, G).call(this, a)) { - const { parent: l, name: d } = c(this, Se).call(this, a); - if (l && l.type === "dir") { - const u = { name: d, type: "dir", children: [], lastModified: Date.now() }; - l.children.push(u), c(this, Ce).call(this, l), c(this, xe).call(this, { action: "create", path: c(this, ke).call(this, a), type: "dir", timestamp: Date.now() }); - } - } - } else { - const { parent: o, name: a } = c(this, Se).call(this, n); - if (!o) throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`); - if (o.type !== "dir") throw new Error("ENOTDIR: not a directory"); - if (o.children.find((l) => l.name === a)) throw new Error(`EEXIST: file already exists, mkdir '${e}'`); - const s = { name: a, type: "dir", children: [], lastModified: Date.now() }; - o.children.push(s), c(this, Ce).call(this, o), c(this, xe).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, Se).call(this, i); - if (!n) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); - const o = n.children.findIndex((a) => a.name === r); - if (o < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); - if (n.children[o].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); - n.children.splice(o, 1), c(this, Ce).call(this, n), c(this, xe).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: o } = c(this, Se).call(this, n); - if (!r) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const a = r.children.findIndex((l) => l.name === o); - if (a < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const s = r.children[a]; - 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(a, 1), c(this, Ce).call(this, r), c(this, xe).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: o, name: a } = c(this, Se).call(this, n), { parent: s, name: l } = c(this, Se).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 = o.children.findIndex((p) => p.name === a), u = { ...o.children[d], name: l, lastModified: Date.now() }; - o.children.splice(d, 1), s.children.push(u), c(this, Ce).call(this, o), o !== s && c(this, Ce).call(this, s), c(this, xe).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, ve); - } - scope(e = "/") { - const i = c(this, ke).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 oi(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 o = c(this, G).call(this, r); - if (!o) throw new Error(`ENOENT: no such file or directory '${e}'`); - if (o.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); - const { recursive: a = !1, fullPath: s = !1 } = n; - if (typeof i == "function") { - const d = await c(this, lt).call(this, r, i, a); - return c(this, st).call(this, d, r, s); - } - const l = await c(this, ct).call(this, r, i, a); - return c(this, st).call(this, l, r, s); - } -}; -ve = new WeakMap(), Qe = new WeakMap(), xe = new WeakMap(), Ce = new WeakMap(), ke = new WeakMap(), te = new WeakMap(), Z = new WeakMap(), G = new WeakMap(), Se = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), Pt = new WeakMap(), ut = new WeakMap(); -let Ti = oi; -const _r = async (t, e = "/", i = "") => { - try { - const n = await t.stat(e), r = e === "/" ? "/" : he.basename(e), o = { title: r, key: i ? `${i}${e}` : e, isLeaf: n.isFile() }; - if (n.isDirectory()) { - const a = await t.dir(e); - if (a.length > 0) { - o.children = []; - const s = [], l = []; - for (const d of a) { - 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 _r(t, u, i); - o.children.push(p); - } catch (p) { - console.warn(`Failed to process ${u}:`, p.message); - } - } - } - } - return o; - } catch { - return null; - } -}; -export { - Po as $, - _i as A, - Ki as B, - qi as C, - kt as D, - dr as E, - cr as F, - xo as G, - gr as H, - sr as I, - ei as J, - ae as K, - pr as L, - wr as M, - nr as N, - or as O, - Zn as P, - er as Q, - Hi as R, - So as S, - Eo as T, - Wi as U, - qt as V, - tr as W, - ir as X, - br as Y, - Cr as Z, - No as _, - Vi as a, - Tt as a0, - To as a1, - ht as a2, - mt as a3, - Oo as a4, - Ro as a5, - Or as a6, - ii as a7, - ti as a8, - Zi as a9, - Ne as aA, - qr as aB, - Kr as aC, - Ti as aD, - _r as aE, - Sr as aa, - Er as ab, - $r as ac, - vr as ad, - xr as ae, - Nr as af, - Fo as ag, - St as ah, - P as ai, - Ii as aj, - Lr as ak, - ee as al, - pt as am, - ji as an, - ie as ao, - ne as ap, - ho as aq, - mo as ar, - fo as as, - ue as at, - ri as au, - Hr as av, - I as aw, - Ai as ax, - Ue as ay, - Ie as az, - Jn as b, - gt as c, - Mi as d, - wo as e, - bo as f, - Hn as g, - Co as h, - _n as i, - Yn as j, - ko as k, - Bi as l, - Gn as m, - $o as n, - Ui as o, - Zt as p, - Ji as q, - Lt as r, - Yi as s, - de as t, - yo as u, - fr as v, - Gi as w, - hr as x, - mr as y, - vo as z -}; diff --git a/dist/common/main-MUM7h7VT.js b/dist/common/main-MUM7h7VT.js new file mode 100644 index 0000000..38bd524 --- /dev/null +++ b/dist/common/main-MUM7h7VT.js @@ -0,0 +1,1541 @@ +var Sr = Object.defineProperty; +var mi = (t) => { + throw TypeError(t); +}; +var Er = (t, e, i) => e in t ? Sr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i; +var x = (t, e, i) => Er(t, typeof e != "symbol" ? e + "" : e, i), fi = (t, e, i) => e.has(t) || mi("Cannot " + i); +var c = (t, e, i) => (fi(t, e, "read from private field"), i ? i.call(t) : e.get(t)), N = (t, e, i) => e.has(t) ? mi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), B = (t, e, i, r) => (fi(t, e, "write to private field"), r ? r.call(t, i) : e.set(t, i), i); +var yi = (t, e, i, r) => ({ + set _(n) { + B(t, e, n, i); + }, + get _() { + return c(t, e, r); + } +}); +import { jsx as m, jsxs as L } from "react/jsx-runtime"; +import E, { useEffect as V, useState as A, useCallback as Y, useRef as J, useContext as ge, useMemo as q, useId as Dt, isValidElement as $r, useLayoutEffect as Pr } from "react"; +import me from "pathe"; +import b from "prop-types"; +import O from "classnames"; +import { useNotification as Nr } from "rc-notification"; +import f from "lodash"; +import ne, { Field as Qt, FieldContext as Fi } from "rc-field-form"; +import { useUpdateEffect as xr, usePrevious as ji, useDeepCompareEffect as Ai } from "react-use"; +import { _ as vr, M as Lt, N as tt, b as De, s as zt, c as Tr, S as Or } from "./vender-BCl09qsS.js"; +import Li from "immutability-helper"; +import { Space as Rr, Form as bt, Input as Fr, Button as kt, Pagination as jr, Tree as Ar, Breadcrumb as Lr, Empty as Wt, Table as wi, Popover as Ir, Popconfirm as Mr, Tooltip as Vr } from "antd"; +import Dr from "rc-util/lib/hooks/useMergedState"; +import { useMergedState as zr } from "rc-util"; +import { generatePath as Wr, useInRouterContext as Ii, useParams as Br, useLocation as Ur, createBrowserRouter as qr, Navigate as Kr } from "react-router-dom"; +import Hr from "rc-drawer"; +import Jr from "rc-dialog"; +import * as bi from "react-is"; +var He, rt, Je, $e, ze, We; +class Mi { + constructor(e, i) { + N(this, He, /* @__PURE__ */ new Map()); + N(this, rt, !0); + N(this, Je, []); + N(this, $e); + N(this, ze, () => c(this, $e)); + N(this, We, () => Promise.resolve()); + x(this, "get", (...e) => new Promise((i, r) => { + const n = JSON.stringify(e); + if (c(this, He).has(n)) return i(c(this, We).call(this, c(this, $e), ...e)); + if (c(this, $e) === void 0) c(this, Je).push([e, i, r]), c(this, rt) && (B(this, rt, !1), Promise.resolve(typeof c(this, ze) == "function" ? c(this, ze).call(this) : c(this, ze)).then((o) => B(this, $e, o || null)).finally(() => { + c(this, Je).forEach(([o, a, s]) => { + try { + const l = c(this, We).call(this, c(this, $e), ...o); + c(this, He).set(JSON.stringify(o), l), a(l); + } catch (l) { + s(l); + } + }), c(this, Je).length = 0; + })); + else { + const o = c(this, We).call(this, c(this, $e), ...e); + c(this, He).set(n, o), i(o); + } + })); + B(this, We, i), B(this, ze, e); + } +} +He = new WeakMap(), rt = new WeakMap(), Je = new WeakMap(), $e = new WeakMap(), ze = new WeakMap(), We = new WeakMap(); +const Co = () => m("div", { children: "Empty" }), ht = E.createContext({ ele: {}, mount: () => { +}, unmount: () => { +} }), ee = ({ rootClassName: t, className: e, children: i, actions: r, title: n, subTitle: o, extras: a, style: s = {} }) => { + const { mount: l, unmount: d } = E.useContext(ht); + return ee.Action({ children: r }), ee.Title({ children: n }), ee.SubTitle({ children: o }), ee.Extra({ children: a }), V(() => (l("rootClassName", t), () => d(t)), [t]), m("div", { className: O("ff-container", e), style: s, children: i }); +}, wt = (t) => ({ children: e, className: i }) => { + const { mount: r, unmount: n } = E.useContext(ht); + return V(() => (e && r(t, E.createElement("div", { key: `ff-${t}`, className: O(`ff-popup-${t}`, i) }, e)), () => n(t)), [i, e]), null; +}; +ee.Action = wt("actions"), ee.Title = wt("title"), ee.SubTitle = wt("sub-title"), ee.Extra = wt("extras"), ee.propTypes = { className: b.string, style: b.object, title: b.any, subTitle: b.any, actions: b.any, extras: b.any }; +const ko = () => m(ee, { className: "ff-loading", children: L("div", { className: "loader", children: [L("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), L("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), L("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), L("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] })] }) }), So = () => m("div", { children: "NotFound" }), Vi = ({ children: t }) => { + const [e, i] = A({}), r = Y((o, a) => i((s) => ({ ...s, [o]: a })), []), n = Y((o) => i((a) => ({ ...a, [o]: void 0 })), []); + return typeof (t == null ? void 0 : t.type) == "string" ? t : m(ht.Provider, { value: { ele: e, mount: r, unmount: n }, children: E.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); +}; +Vi.propTypes = { children: b.element.isRequired }; +const Ci = { 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"] }, Zt = ({ type: t, props: e }) => m("i", { ...e, children: m("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Ci[t] || Ci.info).map((i, r) => m("path", { d: i }, r)) }) }), Di = ({ className: t, content: e, icon: i, $close: r }) => L(E.Fragment, { children: [i && m("div", { className: O("ff-notification-icon", t), children: m(Zt, { type: i }) }), e] }), _r = ({}) => m(ee, { children: "Confirm" }); +var Te, _e; +const fe = class fe { + constructor() { + N(this, _e, /* @__PURE__ */ new Map()); + x(this, "init", (e) => B(this, _e, new Map(e))); + x(this, "check", (e) => !c(this, _e).has(e) || c(this, _e).get(e)); + if (c(fe, Te)) return c(fe, Te); + } +}; +Te = new WeakMap(), _e = new WeakMap(), N(fe, Te, null), x(fe, "getInstance", () => (c(fe, Te) || B(fe, Te, new fe()), c(fe, Te))); +let Bt = fe; +const zi = Bt.getInstance(), Gr = (t, e, i = "children") => { + if (f.isEmpty(t)) return {}; + const r = f.find(t, ["value", e]); + if (!f.isEmpty(r)) return r; + const n = t.length; + for (let o = 0; o < n; o++) { + const { [i]: a } = t[o], s = Gr(a, e, i); + if (!f.isEmpty(s)) return s; + } + return {}; +}, Wi = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; +var Oe, nt; +const ye = class ye { + constructor() { + N(this, nt, null); + x(this, "init", (e) => B(this, nt, e)); + x(this, "get", (e, i) => f.get(c(this, nt), e, i)); + if (c(ye, Oe)) return c(ye, Oe); + } +}; +Oe = new WeakMap(), nt = new WeakMap(), N(ye, Oe, null), x(ye, "getInstance", () => (c(ye, Oe) || B(ye, Oe, new ye()), c(ye, Oe))); +let Ut = ye; +const qe = Ut.getInstance(); +var Ge, $t, ot, at, Pt; +const ve = class ve { + constructor(...e) { + N(this, ot, []); + N(this, at, (e) => { + var i; + for (let r of e) Array.isArray(r[0]) ? c(this, at).call(this, r) : c(this, ot).push(c(i = ve, $t).call(i, r[0], r[1])); + }); + x(this, "toValue", async (e, i = null) => { + const r = { getValue: () => e, getRecord: () => i }; + let n = e; + for (const o of c(this, ot)) try { + const a = await o; + if (typeof a != "function") { + console.warn("middleware is not a function, skip:", a); + continue; + } + n = await a.call(r, n); + } catch (a) { + console.error("middleware error, skip:", a); + } + return n; + }); + x(this, "toRender", (e, i, r = null) => E.createElement(c(this, Pt), { value: e, record: i }, r)); + N(this, Pt, ({ value: e, record: i, children: r }) => { + const [n, o] = A(r); + return ft(() => { + let a = !1; + return o(r), this.toValue(e, i).then((s) => !a && o(s)).catch((s) => !a && o(`${s}`)), () => a = !0; + }, [e, i]), n; + }); + c(this, at).call(this, e); + } +}; +Ge = new WeakMap(), $t = new WeakMap(), ot = new WeakMap(), at = new WeakMap(), Pt = new WeakMap(), N(ve, Ge, null), N(ve, $t, f.memoize((e, i) => { + if (typeof e == "function") return e(i); + if (typeof e == "string") return pe.getWidgetComponent(e).then((r) => { + var n; + return ((n = r.default) == null ? void 0 : n.call(r, i)) || ((o) => o); + }); + throw new TypeError("middleware must be a string or a function"); +}, (...e) => { + var i; + return c(ve, Ge) || B(ve, Ge, $n()), c(i = ve, Ge).call(i, ...e); +})); +let St = ve; +const se = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { +}, getSelectedRows: () => [], onReload: () => { +}, onClickCallback: () => { +}, onConditionChange: () => { +}, onTabChange: () => { +}, onSiderChange: () => { +}, onKeywordChange: () => { +}, onPageChange: () => { +}, onPageSizeChange: () => { +}, reload: () => { +}, setPage: () => { +}, setPageSize: () => { +}, setTab: () => { +}, setSider: () => { +}, setKeyword: () => { +}, setCondition: () => { +} }), ki = ({ className: t, record: e, column: i, ...r }) => { + if (i != null && i.editableByJs && (i != null && i.uuid)) { + const { formSetting: n = { primaryKey: "id" }, widgetSetting: o = {}, widgetContainerSetting: a = {} } = (i == null ? void 0 : i.editableByJsSetting) || {}; + return m(v.Popover, { widget: Yr, widgetData: { record: e, column: i }, widgetSetting: { widgetSetting: o, formSetting: n }, widgetContainerProps: { title: i != null && i.title ? `${i.title} - 编辑` : "编辑", ...a, width: (a == null ? void 0 : a.width) || 260, arrow: !0 }, children: m("td", { className: O("ff-data-list-cell-editable", t), ...r }) }); + } + return m("td", { className: t, ...r }); +}, Yr = ({ record: t, column: e, $close: i, $setting: r }) => { + const n = J(Sn(f.get(t, e == null ? void 0 : e.dataIndex))), { listCode: o, onClickCallback: a } = ge(se), [s] = ne.useForm(), { formSetting: l, widgetSetting: d } = r, u = (l == null ? void 0 : l.primaryKey) || "id", p = () => { + s.setFieldsValue({ value: f.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); + }; + return ft(() => p(), [t, e == null ? void 0 : e.dataIndex, o]), m(ee, { actions: L(E.Fragment, { children: [m(v, { size: "small", onClick: p, children: "重置" }), L(Rr.Compact, { block: !0, children: [m(v, { size: "small", widget: i, children: "取消" }), m(v, { type: "primary", size: "small", widget: () => s.validateFields().then(({ value: h }) => { + const g = f.get(t, u.substring(u.indexOf(".") + 1)); + if (!g) throw "获取更新主键失败!"; + I.put(`/api/${o}-storeBy-${e == null ? void 0 : e.uuid}/${g}`, { value: h }).msg(() => a(2, t)).then(i); + }).catch(console.warn), children: "保存" })] })] }), children: L(ne, { form: s, children: [m(ri, { label: "", type: n.current, code: "value", widget: e == null ? void 0 : e.editableByJs, extras: d }), m(Qt, { noStyle: !0, name: ["__PROPS__"], children: () => { + } })] }) }); +}, Xr = (t) => function(e) { + return t(e, getRecord()); +}, Qr = (t, e = {}) => q(() => { + var i; + return (i = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : i.map(({ widgetByJs: r, widgetByJsSetting: n, ...o }, a) => { + const s = (d) => ({ record: d, column: o }); + let l = []; + return r && l.push([r, n]), l.length > 0 ? (o != null && o.render && l.push([Xr, o.render]), { ...o, onCell: s, render: (d, u) => new St(l).toRender(d, u, "-") }) : { ...o, onCell: s }; + }); +}, [t, e]), Zr = (t = {}) => q(() => { + var e; + return t.body ?? (t.body = { cell: ki }), (e = t.body).cell ?? (e.cell = ki), t; +}, [t]), Eo = (t) => { + const [e, i] = A({}); + return V(() => { + let r = !1; + return t && I.get(`/api/_/${t}`).then((n) => f.pick(n, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig", "selectionType"])).then((n) => !r && i(n)), () => r = !0; + }, [t]), e; +}, $o = (t, e = {}) => { + const [i, r] = A({ dataSource: [] }); + return mt(() => { + let n = !1; + return t && I.get(`/api/${t}/${I.encode({ page: 1, ...e })}`).then((o) => !n && r(o)), () => n = !0; + }, [t, e]), i; +}, Bi = (t = [], e = /* @__PURE__ */ new Map(), i = "id", r) => { + const n = Y(r ? (o) => f.get(o, i, f.get(o, [r, i])) : (o) => f.get(o, i), [i, r]); + return Y((o) => t == null ? void 0 : t.filter((a) => !a.uuid || !e.has(a.uuid) || e.get(a.uuid).some((s) => s == n(o))), [t, e, n]); +}, qt = (t = [], e = /* @__PURE__ */ new Map(), i = [], r = "id", n) => { + const o = Y(n ? (a) => f.get(a, r, f.get(a, [n, r])) : (a) => f.get(a, r), [r, n]); + return q(() => { + if (f.isEmpty(t) || !t.some(({ uuid: s }) => zi.check(s))) return !1; + if (f.isEmpty(e) || f.isEmpty(i)) return !0; + const a = i.map((s) => o(s)); + return t.some(({ uuid: s }) => !s || !e.has(s) || e.get(s).some((l) => a.some((d) => d == l))); + }, [t, i, e, o]); +}, en = (t, e, i = "id", r = null) => { + const n = Ot(), o = J(!1), a = J(t.dataSource), s = J(t.itemOperationsAccess); + return V(() => (a.current = t.dataSource, s.current = t.itemOperationsAccess, () => o.current = !1), [t.dataSource, t.itemOperationsAccess]), o.current && (t.dataSource = a.current, t.itemOperationsAccess = s.current), [t, (l = 0, d = null) => { + var u, p; + if (o.current = !1, l === 1) return (u = t.onReload) == null ? void 0 : u.call(t); + if (l === 2) { + const h = f.get(d, "__PARENT_ID__", ""), g = f.get(d, i, f.get(d, [r, i], "")), y = f.findIndex(a.current, ["__PARENT_ID__", h]), w = f.findIndex(y > -1 ? f.get(a.current, [y, "children"]) : a.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, S]) => { + const P = f.get(a.current, y > -1 ? [y, "children", w, "children"] : [w, "children"]); + a.current = Li(a.current, y > -1 ? { [y]: { children: { $splice: [[w, 1, { ...C, children: P }]] } } } : { $splice: [[w, 1, { ...C, children: P }]] }); + const k = new Map(S); + s.current.forEach(($, T) => { + var j; + (j = k.get(T)) != null && j.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(() => { + o.current = !0, n(); + }); + } + }]; +}, tn = (t, e) => { + const i = Ot(), r = J(e), n = J(/* @__PURE__ */ new Map()), o = J([]), a = f.throttle((l) => { + o.current = [], I.list(t, f.pick({ ...r.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: d, condition: u, total: p, tab: h, sider: g, page: y, pageSize: w, operationsAccess: C, dataSource: S }) => { + r.current = { tab: h, condition: u, sider: g, keyword: d, total: p, pageSize: w, page: S != null && S.length ? y : 1 }, o.current = S, n.current = new Map(C), i(); + }); + }, 380, { leading: !1, trailing: !0 }); + ft(() => { + o.current = [], t && a(e); + }, [t, e]); + const s = q(() => f.pick(r.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [r.current]); + return Object.assign(s, { onTabChange: (l) => a({ tab: l, page: 1 }), onPageChange: (l, d) => a({ page: l, pageSize: d }), onPageSizeChange: (l) => a({ pageSize: l, page: 1 }), onConditionChange: (l, d) => a({ keyword: d, condition: Li(r.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => a({ sider: l, page: 1 }), onKeywordChange: (l) => a({ keyword: l, page: 1 }), itemOperationsAccess: n.current, dataSource: o.current, onReload: a, payload: e == null ? void 0 : e.payload }); +}, rn = ({ listCode: t, className: e, layouts: i = {}, dataSource: r, isPaginate: n, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: d, resource: u, primaryKey: p, title: h, itemGridLayout: g, $setting: y, tabs: w, isConditionFormLayout: C, isTreeSider: S, treeSiderConfig: P }) => { + const { classNames: k, onClickCallback: $ } = ge(se), T = f.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style"]), j = Bi(l, d, p, u), F = Y((M, D, R) => m(nn, { className: O("ff-data-list-framework-item", k == null ? void 0 : k.item), operations: o ? j(D) : [], data: u ? { [u]: D } : D, children: M, onClickCallback: $ }), [u, p, o, $, l, d]); + return L("div", { className: O("ff-data-list-framework", e), children: [m(i.sider, { isTreeSider: S, ...P }), L("div", { className: O("ff-data-list-container", k == null ? void 0 : k.container), children: [m(i.filter, { isConditionFormLayout: C }), m(i.toolbar, { title: h, tabs: w }), m(wn, { ...T, ...g, empty: m(i.empty, { className: k == null ? void 0 : k.empty }), primaryKey: p, itemRender: F, dataSource: r }), m(i.footer, { isPaginate: n, isOperations: a, operations: s })] })] }); +}, nn = ({ className: t, operations: e, children: i, data: r, onClickCallback: n }) => L("div", { className: O("data-list-grid-layout-item", t), children: [m("div", { className: "data-list-grid-layout-item-container", children: i }), !!(e != null && e.length) && m("div", { className: "data-list-grid-layout-item-actions", children: e.map((o) => m("span", { className: "data-list-grid-layout-item-action", children: m(v.Link, { uuid: o.uuid, type: o.type, name: o.name, widget: o.widget, widgetType: o.widgetType, widgetProps: o.widgetProps, widgetSetting: o.widgetSetting, widgetContainerProps: o.widgetContainerSetting, data: r, confirm: o.confirm, onAfterClick: (a) => a !== !1 && (n == null ? void 0 : n(o.isRefresh, r)) }, o.uuid || Dt()) }, (o == null ? void 0 : o.uuid) || Dt())) })] }), on = ({ listCode: t, className: e, layouts: i = {}, dataSource: r, columns: n, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: d, resource: u, primaryKey: p, title: h, tabs: g, isPaginate: y, rowSelection: w, isTreeSider: C, treeSiderConfig: S, isConditionFormLayout: P, ...k }) => { + const { classNames: $, onClickCallback: T } = ge(se), j = Bi(l, d, p, u), F = qt(l, d, r, p, u); + return L("div", { className: O("ff-data-table-framework", e), children: [m(i.sider, { isTreeSider: C, ...S }), L("div", { className: O("ff-data-table-container", $ == null ? void 0 : $.container), children: [m(i.filter, { isConditionFormLayout: P }), m(i.toolbar, { title: h, tabs: g }), m(pn, { ...k, primaryKey: p, className: "ff-data-table-content", columns: n, dataSource: r, rowSelection: w, operationRender: F ? (M) => { + var D; + return m("div", { className: "ff-data-table-actions", children: (D = j(M)) == null ? void 0 : D.map((R, W) => m(v.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: M, confirm: R.confirm, onAfterClick: (U) => U !== !1 && (T == null ? void 0 : T(R.isRefresh, M)) }, R.uuid || W)) }); + } : null }), m(i.footer, { isPaginate: y, isOperations: a, operations: s })] })] }); +}, ei = (t = [], e, i = null) => { + var r; + return (r = f.sortBy(t, ["y", "x"])) == null ? void 0 : r.map(({ i: n, x: o, y: a, w: s, h: l, field: { boxStyle: d, ...u } = {} }, p) => m("div", { className: "grid-layout-item", style: Ui(o, a, s, l, d), children: m(e, { ...u, basicForm: i }) }, n ?? p)); +}, Ui = (t, e, i, r, n = {}, o = 0) => { + const a = { "--grid-layout-h": `${r}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; + return n != null && n.autoHeight ? a.height = "fit-content" : a["--grid-layout-row"] = `${r}`, n != null && n.alignItems && (a["--grid-layout-box-align-items"] = n.alignItems), n != null && n.justifyContent && (a["--grid-layout-box-justify-content"] = n.justifyContent), a["--grid-layout-box-margin"] = Si(n == null ? void 0 : n.marginTop, n == null ? void 0 : n.marginRight, n == null ? void 0 : n.marginBottom, n == null ? void 0 : n.marginLeft), a["--grid-layout-box-padding"] = Si(n == null ? void 0 : n.paddingTop, n == null ? void 0 : n.paddingRight, n == null ? void 0 : n.paddingBottom, n == null ? void 0 : n.paddingLeft), o && (a.height = `${o}px`), a; +}, Si = (t, e, i, r) => `${t || 0}px ${e || 0}px ${i || 0}px ${r || 0}px`, Po = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, qi = (t) => Object.keys(t).reduce((e, i) => (/^on[A-Z]/.test(i) && (e[i] = t[i]), e), {}), Ki = ({ className: t, isConditionFormLayout: e }) => { + var h, g; + const [i, r] = A({}), { listCode: n, onKeywordChange: o, onConditionChange: a, getBase62params: s, classNames: l } = E.useContext(se), { keyword: d, condition: u } = (s == null ? void 0 : s()) || {}, [p] = bt.useForm(); + return V(() => { + n && e && I.get(`/api/_/${n}/list-condition-form-layout`).then(({ resource: y, marginX: w, marginY: C, rowHeight: S, cols: P, fields: k }) => { + r({ resource: y, itemMargin: [w, C], rowHeight: S, cols: P, fields: k }); + }).catch(() => r({})); + }, [n, e]), V(() => { + p.setFieldsValue({ keyword: d, ...u }); + }, [JSON.stringify([d, u])]), m("div", { className: O("ff-data-list-filter", l.filter, t), children: m(bt, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((h = i.fields) == null ? void 0 : h.length) > 1 ? (y) => a({ [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 ? m(ni, { ...i, children: m(an, { onReset: () => { + const { keyword: y, condition: w } = s("init") || {}; + p.setFieldsValue({ keyword: y, ...w }); + } }) }) : m("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: m("div", { className: "grid-layout-item", style: Ui(20, 0, 5, 2), children: m(bt.Item, { name: ["keyword"], children: m(Fr.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (y) => o(y) }) }) }) }) }) }); +}, an = ({ cols: t, fields: e, onReset: i }) => { + const [r, n] = A(!1), o = q(() => e == null ? void 0 : e.toReversed().some((a) => a.y > 1 || a.x + a.w >= t - 5), [t, e]); + return L(bt.Item, { label: " ", style: { "--item-span": 5 }, className: O("ff-data-list-filter-actions", { expanded: r }), children: [m(kt, { onClick: i, children: "重置" }), m(kt, { type: "primary", htmlType: "submit", children: "查询" }), o && m(v.Link, { className: "ff-data-list-filter-expanded-button", widget: () => n((a) => !a), type: "primary", name: r ? "关闭" : "展开", icon: r ? "icon-up" : "icon-down", iconPosition: "end" })] }); +}; +Ki.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 sn = ({ className: t, operations: e, isOperations: i, isPaginate: r }) => { + const { onPageChange: n, onPageSizeChange: o, onClickCallback: a, getBase62params: s } = E.useContext(se), { total: l, page: d, pageSize: u } = (s == null ? void 0 : s()) || {}; + return i && !f.isEmpty(e) || r ? L("div", { className: O("ff-data-list-footer", t), children: [m("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, h) => m(v, { 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 && (a == null ? void 0 : a(p.isRefresh, null)) }, p.uuid || h)) }), r && m(jr, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${d} 页 / 总共 ${p} 条`, onChange: n, onShowSizeChange: o })] }) : null; +}, ln = [{ 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: m("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], cn = ({ className: t, width: e = 280, isTreeSider: i }) => { + const { classNames: r } = ge(se); + return i ? m(Ar.DirectoryTree, { className: O("ff-data-list-sider", r.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: ln }) : null; +}, dn = ({ className: t, title: e, tabs: i }) => { + const { getBase62params: r, onTabChange: n, onReload: o, classNames: a } = ge(se), { tab: s } = (r == null ? void 0 : r()) || {}, [l, d] = zr((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: n }); + return L("div", { className: O("ff-data-list-toolbar", a.toolbar, t), children: [m("div", { className: "ff-data-list-title", children: e }), m(Lr, { className: "ff-data-list-tabs", itemRender: ({ label: u, code: p, value: h }) => m("span", { onClick: () => d(h ?? p), className: O("ff-data-list-tab", { active: (h ?? p) == l }), children: u }), items: i }), L("div", { className: "ff-data-list-actions", children: [m(v.Link, { icon: "icon-reload", widget: () => o() }), m(v.Link, { icon: "icon-setting" })] })] }); +}, un = ({ className: t, ...e }) => m(Wt, { className: O(t, "ff-data-list-empty"), image: Wt.PRESENTED_IMAGE_SIMPLE, ...e }), Hi = ({ isItemGridLayout: t, theme: e, themeProps: i, onClickCallback: r, onReload: n, listCode: o, total: a = 0, page: s = 0, onPageChange: l, pageSize: d = 30, onPageSizeChange: u, tab: p, onTabChange: h, keyword: g, onKeywordChange: y, condition: w, onConditionChange: C, sider: S, onSiderChange: P, layouts: k, classNames: $ = {}, payload: T = {}, dataSource: j = [], rowSelection: F, getSelectedRows: M, primaryKey: D, ...R }) => { + const [W, U] = A(), K = M ?? (() => j), he = Y((z, le) => { + const _ = { tab: p, page: s, pageSize: d, keyword: g, sider: S, condition: w, total: a, payload: T }; + return z && z != "init" ? f.get(_, z, le) : _; + }, [JSON.stringify(w), JSON.stringify(T), p, s, d, g, S, a]), oe = q(() => { + let z = { sider: cn, filter: Ki, footer: sn, toolbar: dn, empty: un }; + k === !1 ? z = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : f.isPlainObject(k) && (z = Object.assign({}, z, k)); + for (const le in z) if (z[le]) { + if ($r(z[le])) { + const _ = z[le]; + z[le] = (Ft) => E.cloneElement(_, Ft); + } + } else z[le] = () => m(E.Fragment, {}); + return z; + }, [k]); + return V(() => { + e ? pe.getWidgetComponent(e).then((z) => { + if (!z) throw `${e} not found`; + return z; + }).catch((z) => ({ default: () => `${z}` })).then((z) => U(E.createElement(z.default, { ...R, layouts: oe, $setting: i }))) : U(m(t ? rn : on, { ...R, layouts: oe, $setting: i })); + }, [e, i]), m(se.Provider, { value: { classNames: $, listCode: o, onClickCallback: r, onReload: n, getBase62params: he, onPageChange: l, onPageSizeChange: u, onTabChange: h, onSiderChange: P, onKeywordChange: y, onConditionChange: C, setPage: l, setPageSize: u, setTab: h, setSider: P, setKeyword: y, setCondition: C, getSelectedRows: K }, children: W && E.cloneElement(W, { dataSource: j, primaryKey: D, rowSelection: F, ...R }) }); +}; +Hi.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 Re, Pe, Be, Nt; +const we = class we { + constructor() { + N(this, Pe, null); + N(this, Be, /* @__PURE__ */ new Map()); + N(this, Nt, () => { + if (c(this, Pe)) return c(this, Pe).port.postMessage({ command: "status", data: [] }); + B(this, Pe, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), c(this, Pe).port.onmessage = (e) => { + var i, r; + (i = e.data) != null && i.uuid ? c(this, Be).forEach((n, o) => { + var a; + (n == "*" || (a = n == null ? void 0 : n.includes) != null && a.call(n, e.data.uuid)) && o(e.data); + }) : ((r = e.data) == null ? void 0 : r.readyState) == WebSocket.CLOSED && I.get("/api/user-api-token").then(({ token: n, expire_at: o }) => { + c(this, Pe).port.postMessage({ command: "initWs", data: [`ws${f.trimStart(I.appUrl, "http")}api/user-resource-status-ws?token=${n}`] }); + }); + }, c(this, Pe).port.postMessage({ command: "status", data: [] }); + }); + x(this, "subscribe", (e, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", c(this, Be).set(e, i), c(this, Be).size == 1 && c(this, Nt).call(this), () => this.unsubscribe(e))); + x(this, "unsubscribe", (e) => c(this, Be).delete(e)); + if (c(we, Re)) return c(we, Re); + } +}; +Re = new WeakMap(), Pe = new WeakMap(), Be = new WeakMap(), Nt = new WeakMap(), N(we, Re, null), x(we, "getInstance", () => (c(we, Re) || B(we, Re, new we()), c(we, Re))); +let Kt = we; +const Ji = Kt.getInstance(), ti = E.forwardRef(({ listCode: t, base62params: e, className: i, theme: r, themeProps: n, layouts: o, classNames: a, onSelectionChange: s, defaultSelectedRowKeys: l, selectedRowKeys: d, onDataSourceChange: u }, p) => { + const [{ resource: h, primaryKey: g, batchOperations: y = [], itemOperations: w = [], columns: C = [], themeConfig: S, theme: P, isConditionFormLayout: k = !1, isTreeSider: $, treeSiderConfig: T, isItemGridLayout: j, itemGridLayout: { themeConfig: F, ...M } = {}, title: D, isPaginate: R, tabs: W, selectionType: U }, K] = A({ isItemGridLayout: !1, itemGridLayout: {} }), he = tn(t, e), [{ dataSource: oe, itemOperationsAccess: z, condition: le, tab: _, keyword: Ft, page: li, total: ci, pageSize: di, sider: sr, onConditionChange: lr, onTabChange: cr, onKeywordChange: dr, onPageChange: ur, onPageSizeChange: pr, onSiderChange: gr, onReload: jt, payload: hr }, ui] = en(he, t, g, h), mr = vr(u); + xr(() => { + mr(oe, { page: li, pageSize: di, total: ci }); + }, [oe]); + const [fr, yr] = Dr([], { defaultValue: l ?? [], value: d }), [pi, wr] = A([]), gi = Y(() => U ? pi : oe, [U, pi, oe]), br = qt(w, z, oe, g), Cr = qt(y); + V(() => { + let X = null; + return t && I.get(`/api/_/${t}`).resp(({ data: Ve, res: At }) => { + Ve != null && Ve.isDynamicRefresh && (X = Ji.subscribe(() => jt(), At)), K(Ve); + }).catch(() => K({})), () => X == null ? void 0 : X(); + }, [t]), E.useImperativeHandle(p, () => ({ onReload: jt, onClickCallback: ui, getSelectedRows: gi })); + const kr = { listCode: t, title: D, classNames: a, layouts: o, resource: h, primaryKey: g, theme: r || P, themeProps: n || S, isTreeSider: $, treeSiderConfig: T, isPaginate: R, rowSelection: U ? { type: U, columnWidth: 80, selectedRowKeys: fr, onChange: (X, Ve) => { + wr((At) => { + const hi = new Map(At.map((ce) => [ce == null ? void 0 : ce[g], ce])); + return Ve.forEach((ce) => hi.set(ce == null ? void 0 : ce[g], ce)), X.map((ce) => hi.get(ce)).filter(Boolean); + }), yr(X), s == null || s(X, Ve); + } } : void 0, getSelectedRows: gi, tabs: W, isItemOperations: br, itemOperations: w == null ? void 0 : w.map((X) => f.isEmpty(X == null ? void 0 : X.confirm) ? X : { ...X, confirm: Object.assign({}, X.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: Cr, batchOperations: y, isItemGridLayout: j, columns: C, itemGridLayout: { ...M, themeProps: F }, isConditionFormLayout: k, itemOperationsAccess: z, dataSource: oe, onConditionChange: lr, onTabChange: cr, onKeywordChange: dr, onPageChange: ur, onPageSizeChange: pr, onSiderChange: gr, condition: le, tab: _, keyword: Ft, page: li, total: ci, pageSize: di, sider: sr, payload: hr }; + return m(Hi, { ...kr, className: O("ff-data-list-helper", i), onReload: jt, onClickCallback: ui }); +}), _i = (t, e, i = !0) => i !== !0 && i-- <= 0 ? [] : f.isArray(t) && !f.isEmpty(t) ? t.reduce((r, n) => (Reflect.has(n, e) && Reflect.has(n, "children") && r.push(n[e]), Reflect.has(n, "children") && !f.isEmpty(n.children) ? r.concat(_i(n.children, e, i)) : r), []) : [], pn = ({ className: t, primaryKey: e, columns: i = [], dataSource: r = [], operationRender: n, operationWidth: o = 180, components: a = {}, rowSelection: s, ...l }) => { + const { classNames: d } = ge(se), u = J(null), p = J(null), [h, g] = A([]), [y, w] = A({ width: 0, height: 0 }); + V(() => { + g(_i(r, e)); + }, [r, e]), Pr(() => { + const k = new ResizeObserver(() => { + var $; + w({ 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 = q(() => { + if (!(y != null && y.width) || !(i != null && i.length)) return i; + const k = (s ? s.columnWidth ?? 32 : 0) + (n ? o : 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 j = y.width - $ - k; + return i.map((F) => F.isWidthFixed ? F : { ...F, width: Math.floor(j * (F.width ?? 100) / T) }); + }, [i, y.width, s, n, o]), S = Qr(C), P = Zr(a); + return m("div", { ref: p, className: O("ff-data-list-table", d.content, t), children: y.height ? m(wi, { bordered: !0, ...l, components: P, 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, wi.SELECTION_COLUMN), n && k.push({ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(o / y.width * 100).toFixed(2)}%`, render: (j, F, M) => n(F, M) }), k; + })(), dataSource: r, size: "middle", scroll: { x: "max-content", y: y.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: h } }) : null }); +}, gn = "RC_FORM_INTERNAL_HOOKS", hn = (t) => { + const [e, i] = E.useState({ items: [] }); + return V(() => { + t && I.get(`/api/_/${t}`).then(({ uuid: r, code: n, name: o, resource: a, primaryKey: s, marginX: l, marginY: d, cols: u, rowHeight: p, fields: h, theme: g, themeSetting: y, groups: w }) => ({ uuid: r, code: n, name: o, resource: a, primaryKey: s, marginX: l, marginY: d, cols: u, rowHeight: p, theme: g, themeProps: y, groups: w, items: h })).then(i); + }, [t]), e; +}, mn = (t, { initialValue: e, initialValueLanguage: i, convertJs: r, convertJsSetting: n, type: o = "string" }, a = null) => { + const s = J(!1), l = ge(Fi), [d, u] = A(), [p, h] = A(i != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(gn) || {}; + return V(() => g == null ? void 0 : g((y, w, C) => { + if (!s.current) return; + const S = f.get(w, t); + f.isEqual(S, p) || h(ue(S, o)); + }), [p]), V(() => { + i == "javascript" && e ? Me.exec(e, {}, { getFieldValueForBasicForm: (y) => a ? a.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => h(ue(y, o))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => s.current = !0) : (e && h(ue(e ?? l.getFieldValue(t), o)), s.current = !0); + }, [e, i]), mt(() => { + s.current && r && new St([r, n]).toValue(p, l.getFieldsValue(!0)).then(u).catch((y) => { + u(y), console.error("布局数据转换错误: ", y, r); + }); + }, [p, r, n]), [d ?? p, p]; +}, No = (t, e, i = null) => q(() => ei(t, e, i), [t]), Gi = (t, e, i = {}, r = {}, n = {}, o = null) => { + const a = ge(Fi), s = Ot(), l = J(!0), d = J([]), [u, p] = A(e), [h, g] = A(), y = ne.useWatch((w) => JSON.stringify(f.pick(w, d.current)), a) || "{}"; + return ft(() => { + t && Me.exec(t, i, { ...r, getFieldValueForBasicForm: (w) => n ? n.getFieldValue(w) : null, getFieldValue: f.wrap(a.getFieldValue, (w, C) => (d.current.some((S) => f.isEqual(S, C)) || (d.current.push(C), s()), w == null ? void 0 : w(C))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((w) => { + l.current && (p(w), g(null)); + }).catch((w) => { + l.current && (p(e), g(w)); + }); + }, [t, y, a, i, r]), V(() => () => l.current = !1, []), t ? [o ? ue(u, o) : u, h] : [o ? ue(e, o) : e, null]; +}, fn = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: i, ...r }) => { + const n = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [o, a] = A(); + return V(() => { + n && pe.getWidgetComponent(n).then(({ defaultProps: s = {}, default: l }) => ({ default: yn(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => a(E.createElement(s.default, r))); + }, [n]), o; +}, yn = (t, e = {}, i = null) => (r) => { + const { code: n, label: o, extras: a, isVirtual: s, initialValue: l, initialValueLanguage: d, convertJs: u, convertJsSetting: p, value: h, ...g } = f.merge({}, e, r), [y, w] = mn(s ? null : n, { initialValue: l, initialValueLanguage: d, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, i), C = q(() => { + 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, P] = C(g); + return m(t, { ...P, value: y, rawValue: w, $setting: Object.assign({}, a, S) }); +}, Yi = ({ theme: t, basicForm: e, items: i = [{ key: "default", label: "默认" }], fields: r = [], itemRender: n, chunks: o = [], children: a, $setting: s = {}, ...l }) => { + const [d, u] = A(); + V(() => { + t ? pe.getWidgetComponent(t).then((h) => { + if (!(h != null && h.default)) throw "not found"; + return h; + }).catch((h) => ({ default: () => `${t} ${h}` })).then((h) => u(E.createElement(h.default, {}))) : u(null); + }, [t]); + const p = q(() => i == null ? void 0 : i.map((h) => ({ ...h, children: n(h, r == null ? void 0 : r.filter((g) => !(g != null && g.group) && h.key == "default" || g.group == h.key), h.key == "default" ? a : null) })).concat(o), [i, a, o]); + return d && E.cloneElement(d, { items: p, basicForm: e, $setting: { ...s, ...l } }); +}, Xi = ({ name: t, form: e = null, basicForm: i = null, style: r = {}, className: n, cols: o = 12, rowHeight: a = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: d = {}, formFields: u = [], fields: p = [], data: h, theme: g, themeProps: y = {}, groups: w = [{ key: "default", label: "默认" }], children: C, ...S }) => { + const [P] = ne.useForm(e), k = q(() => [{ name: "__PROPS__", value: d }].concat(u), [d, u]); + mt(() => (P.setFieldsValue(h), () => P.resetFields()), [h]); + const $ = (T, j, F) => { + const M = ei(j, fn, i), D = qi(S); + return L("div", { ...D, className: O("ff-grid-layout", n), style: { ...r, "--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": o, "--grid-layout-row-height": `${a}px` }, children: [M, F && E.cloneElement(F, { cols: o, rowHeight: a, itemMargin: l, containerPadding: s, fields: j, basicForm: i })] }); + }; + return m(ne, { ...S, fields: k, form: P, component: !1, children: g ? m(Yi, { ...y, items: w, theme: g, itemRender: $, fields: p, children: C, basicForm: i }) : $(0, p, C) }); +}, xo = /* @__PURE__ */ ((t) => function({ code: e, data: i, ...r }) { + const { uuid: n, resource: o, items: a, hides: s, rowHeight: l, marginX: d, marginY: u, cols: p, theme: h, themeProps: g, groups: y } = hn(e) || {}, w = q(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: n }], [e, n, o]); + return o && m(t, { name: e, theme: h, themeProps: g, groups: y, ...r, fields: a, formFields: w, rowHeight: l, cols: p, itemMargin: [d, u], data: o ? { [o]: i } : i }); +})(Xi), wn = ({ column: t = 0, colWidth: e = 0, cols: i, rowHeight: r, itemMargin: n, fields: o, primaryKey: a, dataSource: s, beforeRender: l = null, afterRender: d = null, itemClassName: u, itemRender: p = (P, k, $) => P, empty: h = m(Wt, { description: null }), className: g, style: y = {}, theme: w, themeProps: C = {}, groups: S = [{ key: "default", label: "默认" }] }) => { + const { classNames: P } = ge(se), k = q(() => m(Xi, { groups: S, theme: w, themeProps: C, cols: i, rowHeight: r, itemMargin: n, fields: o, className: u }), [o, i, r, n, S, w, C]), $ = f.isEmpty(s); + return L("div", { className: O("ff-data-list-content", P.content, g), style: Object.assign({}, y, t && { "--col-num": t }, e && { "--col-width": e }), children: [l == null ? void 0 : l(s), $ ? h : s.map((T, j) => { + const F = p(E.cloneElement(k, { data: T }), T, j); + return E.cloneElement(F, { key: `${(T == null ? void 0 : T[a]) ?? j}-${En(T)}` }); + }), d == null ? void 0 : d(s)] }); +}, bn = ({ component: t, $props: e }) => { + const { base62params: i } = Tt(e, {}); + return m(ee, { children: m(ti, { listCode: t, base62params: I.decode(i) }) }); +}, vo = () => m(Qi, {}), Qi = () => "Empty", Cn = ({ component: t, $setting: e, $props: i }) => { + const [r, n] = A(), [o, a] = ii(i); + return V(() => { + if (!t) return n(m(Qi, { description: null })); + pe.getWidgetComponent(t).catch((s) => ({ default: () => `${s}` })).then((s) => E.createElement(s.default, { $setting: e })).then(n); + }, [t]), r ? E.cloneElement(r, { ...o, $setProps: a }) : null; +}, To = () => "NotFoundPage"; +var Fe, de, je, Ae, st, lt; +const be = class be { + constructor() { + N(this, de, /* @__PURE__ */ new Map()); + N(this, je, {}); + N(this, Ae, null); + x(this, "init", (e, i) => { + B(this, de, e), B(this, je, i); + }); + x(this, "get", (e) => (c(this, de).has(e) || (e = Array.from(c(this, de).keys()).find((i) => c(this, de).get(i).uri === e)), c(this, de).get(e) || {})); + x(this, "redirect", (e, i, r = {}) => { + const { uri: n, type: o, widgetProps: a } = this.get(e) || {}, { router: s, query: l, ...d } = i || {}, u = Object.assign({}, d, s), p = Object.assign({}, d, l); + o == "list" && (u.base62params = I.encode(u != null && u.base62params ? u.base62params : u)); + let h = Wr(n || e, u); + const g = new URLSearchParams(); + for (const y in a || {}) (a == null ? void 0 : a.type) == "query" && Object.has(p, y) && g.append(y, JSON.stringify(p[y])); + return g.size > 0 && (h = `${h}?${g.toString()}`), r != null && r.isOpenWindow ? window.open(h) : c(this, Ae).navigate(h, { replace: !!(r != null && r.isReplaceRouteHistory) }); + }); + x(this, "getMenus", (e) => { + var i; + return ((i = c(this, je)) == null ? void 0 : i[e]) || []; + }); + x(this, "findMenuPathByUuid", (e) => { + let i = []; + for (const r in c(this, je)) if (i = c(this, st).call(this, c(this, je)[r], e, [r]), i.length > 1) return i; + return i; + }); + x(this, "getMenusByRouteUuid", (e) => c(this, lt).call(this, e, Object.values(c(this, je)).flat())); + N(this, st, (e, i, r = []) => { + if (f.isEmpty(e)) return r; + for (const { uuid: n, children: o } of e) { + if (n == i) return r.concat(n); + if (!f.isEmpty(o)) return r.concat(n, c(this, st).call(this, o, i)); + } + return r; + }); + N(this, lt, (e, i) => { + var n; + let r = []; + for (const o of i) o.widgetType == "redirect" && (o.uuid == e || o.widget == e ? r.push(o) : (n = o.children) != null && n.length && (r = r.concat(c(this, lt).call(this, e, o.children)))); + return r; + }); + x(this, "getCurrentMenu", () => { + const { uuid: e } = this.getCurrentRoute() || {}; + if (!e) return; + const i = this.getMenusByRouteUuid(e); + return f.isEmpty(i) ? void 0 : i[0]; + }); + x(this, "getCurrentRoute", (e = 0) => { + var r; + const i = (r = c(this, Ae).state.matches[c(this, Ae).state.matches.length - 1 - e]) == null ? void 0 : r.route; + if (!i) return null; + for (let [n, o] of c(this, de)) if (o.uri === i.path) return o; + return null; + }); + x(this, "getPageParams", (e) => { + var a, s; + const { location: i = {}, matches: r = [] } = ((a = c(this, Ae)) == null ? void 0 : a.state) || {}, n = { ...((s = r[r.length - 1]) == null ? void 0 : s.params) || {} }, o = i.search; + return o && new URLSearchParams(o).forEach((l, d) => { + n[d] = l; + }), e ? f.get(n, e) : n; + }); + x(this, "usePageParams", (e) => { + var r; + let i = Ii() ? { ...Br(), ...Object.fromEntries(new URLSearchParams(((r = Ur()) == null ? void 0 : r.search) ?? "")) } : this.getPageParams(); + return e ? f.get(i, e) : i; + }); + x(this, "createBrowserRouter", (e = {}) => { + if (c(this, de).size == 0) return null; + const i = qe.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), r = qe.get(pe.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), n = { [i]: 0 }, o = (s, l) => () => Promise.all([pe.getWidgetComponent(s), Tt(l)]).then(([d, u]) => [d.default || function() { + return `${s}`; + }, u]).then(([d, u]) => ({ Component: () => E.createElement(Vi, {}, E.createElement(d, { $setting: u })) })), a = Array.from(c(this, de).values()).reduce((s, { uuid: l, uri: d, name: u, type: p, component: h, widgetSetting: g, widgetProps: y, isLogin: w, isLayout: C, extra: S }) => { + let P = {}, k = 0; + switch (p) { + case "list": + P.element = E.createElement(bn, { component: h, $props: y }); + break; + case "fsdpf-component": + P.element = E.createElement(Cn, { key: h, component: h, $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 (!n[$]) return n[$] = s.length, [...s, { path: "/", lazy: o($, T), children: [{ path: d, ...P }] }]; + k = n[$]; + } + return C && k > -1 ? (s[k].children.push({ path: d, ...P }), s) : [...s, { path: d, ...P }]; + }, [{ path: "/", lazy: o(i, {}), children: [] }]); + return a.push({ index: !0, element: E.createElement(kn, { to: r, replace: !0 }) }), B(this, Ae, qr(a, e)); + }); + if (c(be, Fe)) return c(be, Fe); + } +}; +Fe = new WeakMap(), de = new WeakMap(), je = new WeakMap(), Ae = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), N(be, Fe, null), x(be, "getInstance", () => (c(be, Fe) || B(be, Fe, new be()), c(be, Fe))); +let Ht = be; +const kn = ({ to: t, replace: e }) => Ii() ? E.createElement(Kr, { to: t, replace: e }) : (window.document.location = t, "redirect"), ae = Ht.getInstance(), Ke = new Worker(new URL("/ff-worker/index.js", self.location)), Ei = { getConfigure: (t) => qe.get(t), route: { redirect: (...t) => ae.redirect(...t), getPageParams: (...t) => ae.getPageParams(...t), getCurrentRoute: () => ae.getCurrentRoute() }, popup: { notification: (...t) => re.notification(...t), success: (...t) => re.success(...t), error: (...t) => re.error(...t), form: (...t) => re.form(...t), modal: (...t) => re.modal(...t), confirm: (...t) => re.confirm(...t) } }; +var xt, Ye, Le; +const H = class H { + constructor() { + x(this, "exec", (e, i = {}, r = {}, n = "") => new Promise((o, a) => { + if (!/^(?!\s*(\/\/|\/\*|\*)).*?\S+/m.test(e)) return o(); + const s = yi(H, xt)._++; + c(H, Ye).set(s, r), H.mQueue.set(s, [o, a]), Ke.postMessage({ id: s, session: n, category: "eval", method: e, args: i }); + })); + x(this, "clear", (e) => Ke.postMessage({ session: e, category: "clear" })); + if (c(H, Le)) return c(H, Le); + Promise.resolve().then(() => Zn).then((e) => { + Ei.http = e.http; + }), Ke.addEventListener("message", ({ data: { id: e, task_id: i, method: r, args: n, category: o, data: a, error: s, session: l } }) => { + if (o === "eval" && H.mQueue.has(e)) s !== null ? H.mQueue.get(e)[1](s) : H.mQueue.get(e)[0](a), c(H, Ye).delete(e), H.mQueue.delete(e); + else if (o === "util") try { + const d = f.get(Ei, r.split("/")) || f.get(c(H, Ye).get(i), r.split("/")); + if (!f.isFunction(d)) throw `${r} not found`; + Promise.resolve(Reflect.apply(d, void 0, n)).then((u) => { + Ke.postMessage({ id: e, task_id: i, category: o, method: r, args: n, session: l, data: u, error: null }); + }).catch((u) => { + Ke.postMessage({ id: e, task_id: i, category: o, method: r, args: n, session: l, data: null, error: u }); + }); + } catch (d) { + Ke.postMessage({ id: e, task_id: i, category: o, method: r, args: n, session: l, data: null, error: d }); + } + }, !1); + } +}; +xt = new WeakMap(), Ye = new WeakMap(), Le = new WeakMap(), x(H, "mQueue", /* @__PURE__ */ new Map()), N(H, xt, 0), N(H, Ye, /* @__PURE__ */ new Map()), N(H, Le, null), x(H, "getInstance", () => (c(H, Le) || B(H, Le, new H()), c(H, Le))); +let Jt = H; +const Me = Jt.getInstance(), $i = { 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" }, ue = (t, e) => { + let i = "string"; + i = Array.isArray(t) ? "array" : typeof t, f.isObject(t) && (i = "json"); + const r = `${i}2${e}`; + return Reflect.has($i, r) ? $i[r](t) : t; +}, Sn = (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, Tt = (t = {}, e = {}, i = {}, r = "") => Zi(t, (n, o) => o === "type" && n === "code") ? er(t, e, i, r) : tr(t, e, r), Zi = (t, e = () => !1) => f.some(t, (i) => !!f.some(i, e) || (f.isEmpty(i) || !f.isPlainObject(i) && !f.isArray(i) ? void 0 : Zi(i, e))), er = async (t = {}, e = {}, i = {}, r = "") => { + let n = /* @__PURE__ */ Object.create(null); + for (let o in t) { + let a; + if (Reflect.has(t[o], "type") && ["code", "field", "router", "query", "string"].includes(t[o].type)) { + const { type: s, value: l = "", default: d = r } = t[o]; + switch (s) { + case "code": + try { + a = await Me.exec(l, e, i); + } catch (u) { + console.error("getWidgetPropsData", u); + } + break; + case "field": + a = f.get(e, l) ?? f.get(e, l.substring(l.indexOf(".") + 1)); + break; + case "router": + case "query": + a = ae.getPageParams(l); + break; + case "string": + a = l; + } + a ?? (a = d); + } else a = await er(t[o], e, i, r); + f.set(n, o, a); + } + return n; +}, tr = (t = {}, e = {}, i = "") => Object.keys(t || {}).reduce((r, n) => { + if (f.isPlainObject(t[n])) { + let o; + if (Reflect.has(t[n], "type") && ["field", "router", "query", "string"].includes(t[n].type)) { + const { type: a, value: s = "", default: l = i } = t[n]; + switch (a) { + case "field": + o = f.get(e, s) ?? f.get(e, s.substring(s.indexOf(".") + 1)); + break; + case "router": + case "query": + o = ae.getPageParams(s); + break; + case "string": + o = s; + } + o ?? (o = l); + } else o = tr(t[n], e, i); + f.set(r, n, o); + } + return r; +}, {}), It = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((i) => It(i, e)) : Object.keys(t).reduce((i, r) => (e[r] ? i[e[r]] = It(t[r], e) : i[r] = It(t[r], e), i), {}) : t, Oo = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { + const e = 16 * Math.random() | 0; + return (t === "x" ? e : 3 & e | 8).toString(16); +}), Ro = (t) => { + var e, i; + return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.name : ""; +}, Fo = (t) => { + var e, i; + return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.category : ""; +}, jo = (t) => { + var e, i; + return t ? (i = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : i.owner : ""; +}, En = (t, e = 32, i = "auto") => { + const r = _t(t), n = i === "auto" ? "x64" : i; + if (e === 32) return Lt.x86.hash32(r).toString(); + if (e === 128) return n === "x64" ? Lt.x64.hash128(r) : Lt.x86.hash128(r); + throw new Error("bits 只能是 32 或 128"); +}, _t = (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(_t).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${_t(t[e])}`).join(",") + "}" : String(t), $n = () => { + let t = 1; + const e = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Map(); + return (...r) => r.length === 0 ? "" : r.map((n) => { + return String((o = n) === null || typeof o != "object" && typeof o != "function" ? (i.has(o) || i.set(o, t++), i.get(o)) : (e.has(o) || e.set(o, t++), e.get(o))); + var o; + }).join("::"); +}, Pn = (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; + } +}, Ao = (t, e = "") => { + if (!t || typeof t != "string" || Pn(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; +}, Ot = () => { + const t = J(!0), [, e] = E.useReducer((i) => i + 1, 0); + return V(() => () => t.current = !1, []), () => t.current && e(); +}, Lo = (t) => { + const [e, i] = A(t), r = J(null), n = Y((o, a) => { + r.current = a, i(o); + }, []); + return V(() => { + r.current && (r.current(e), r.current = null); + }, [e]), [e, n]; +}, mt = (t = (r) => { +}, e, i = f.isEqual) => { + const r = E.useRef(); + i(e, r.current) || (r.current = f.cloneDeep(e)), E.useEffect(t, [r.current]); +}, ft = mt, ir = (t, e = "string") => { + var i; + if (!Array.isArray(t)) return t; + for (let r = 0; r < t.length; r++) t[r].value = ue((i = t[r]) == null ? void 0 : i.value, e), t[r] && Reflect.has(t[r], "children") && (t[r].children = ir(t[r].children, e)); + return t; +}, Io = (t, e = "json", i = "string", r, n = null) => { + const [o] = ne.useForm(r), [a, s] = A([{ label: "无", value: "", disabled: !0 }]), l = J([]), d = ne.useWatch((u) => l.current.length === 0 ? null : f.pick(u, l.current), o) || null; + return V(() => { + Array.isArray(t) ? s(t) : e === "javascript" && t ? Me.exec(t, {}, { getFieldValue: (u) => (l.current.includes(u) || l.current.push(u), o.getFieldValue(u)), getFieldValueForBasicForm: (u) => (l.current.includes(u) || l.current.push(u), n ? n.getFieldValue(u) : o.getFieldValue(u)) }).then((u) => { + s(ue(u, "array")); + }).catch((u) => console.error("useOptions", u)) : t && s(ue(t, "array")); + }, [t, e, d]), ir(a, i); +}, Mo = (t) => { + const [e, i] = A(), r = { type: "GET" }; + if (typeof t == "string" ? r.url = t : f.isPlainObject(t) && Object.assign(r, t), !(r != null && r.url)) throw "url is required"; + const n = (o) => I.request(r, !1).resp((a) => (console.log("useSubscribeRequest", o), i(a), a)); + return mt(() => { + let o = null; + return n().then((a) => { + o = Ji.subscribe(f.throttle(n, 180, { leading: !1, trailing: !0 }), a.res); + }), () => o == null ? void 0 : o(); + }, r), e; +}, Nn = (t, e) => Y((i) => { + const r = {}; + for (const [n, o] of Object.entries(i)) { + const a = t == null ? void 0 : t[n]; + if ((a == null ? void 0 : a.type) === "router" || (a == null ? void 0 : a.type) === "query") { + const s = ae.getCurrentRoute(); + s != null && s.uuid && ae.redirect(s.uuid, { ...ae.getPageParams(), [a.type]: { [a.value || n]: o } }, { isReplaceRouteHistory: !0 }); + } else r[n] = o; + } + Object.keys(r).length > 0 && e(r); +}, [t, e]), ii = (t, e = {}, i = {}, r = []) => { + const [n, o] = A({}), [a, s] = A({}), l = ji(a); + Ai(() => { + Promise.resolve(Tt(t, e, i)).then(s); + }, [t, e, ...r]), V(() => { + const p = l ?? {}, h = Object.keys({ ...p, ...a }).reduce((g, y) => (p[y] !== a[y] && (g[y] = a[y]), g), {}); + Object.keys(h).length > 0 && o((g) => ({ ...g, ...h })); + }, [a]); + const d = Nn(t, (p) => { + o((h) => ({ ...h, ...p })); + }), u = q(() => Object.fromEntries(Object.entries(n).filter(([p, h]) => h !== a[p])), [n, a]); + return [n, d, u]; +}, xn = (t) => { + const [e, i] = E.useState({ items: [], hides: [] }); + return E.useEffect(() => { + t && I.get(`/api/_/${t}`).then(({ pk: r, uuid: n, code: o, resource: a, align: s, cols: l, rowHeight: d, marginX: u, marginY: p, listenChangeFields: h, listenChangeFieldsFunc: g, fields: y, theme: w, themeSetting: C, groups: S }) => ({ pk: r, uuid: n, code: o, resource: a, align: s, cols: l, rowHeight: d, marginX: u, marginY: p, theme: w, themeProps: C, groups: S, listenChangeFields: h, listenChangeFieldsFunc: g, ...y.reduce((P, k) => { + var $; + return ($ = k == null ? void 0 : k.field) != null && $.hidden ? P.hides.push(k == null ? void 0 : k.field) : P.items.push(k), P; + }, { items: [], hides: [] }) })).then(i); + }, [t]), e; +}, vn = ({ max: t = 0, min: e = 0, type: i = "", message: r, pattern: n, required: o = !1, validator: a } = {}, s, l) => { + const [d, u] = A([]); + return V(() => { + const p = []; + if (o) { + let h = l; + switch (l) { + case "number": + case "string": + case "array": + break; + case "bool": + h = "boolean"; + break; + case "json": + h = "object"; + } + p.push({ type: h, required: !0, whitespace: !0, message: "该项必填" }); + } + switch (i) { + case "string": + p.push({ type: i, max: t, min: e, message: r || (e && t ? `字符必须在 ${e} ~ ${t} 之间` : `${t ? "最多能有" : "最少要有"} ${e || t} 个字符`) }); + break; + case "pattern": + p.push({ type: "string", pattern: n, message: r }); + break; + case "validator": + a && p.push(({ getFieldValue: h }) => ({ validator: async (g, y) => { + const w = await Me.exec(a, { value: y, fieldName: s }, { getFieldValue: h }); + return f.isString(w) && w ? Promise.reject(w) : f.isBoolean(w) && !w ? Promise.reject(r) : Promise.resolve(); + } })); + } + u(p); + }, [t, e, i, r, n, o, a]), d; +}, Tn = (t, e, i) => { + const [r, n] = A(null); + return V(() => { + const { initDataUri: o = `/api/${t}`, initDataMethod: a = "GET" } = i || {}; + e && I.request({ method: a, url: f.trimEnd(`${o}/${e}`, "/") }).then((s) => { + n(s); + }); + }, [t, e, i]), r; +}, On = (t, e, i) => Y((r, n = { serialize: (o) => o, onSuccess: () => { +}, onFail: (o) => (o == null ? void 0 : o.errorFields) && re.error("请先完善表单信息", { duration: 2e3 }) }) => { + const o = r.getFieldValue("__RESOURCE__"), { submitDataUri: a = `/api/${t}`, submitDataMethod: s = "POST" } = i || {}; + return r.validateFields().then((l) => o ? f.pick(l, [o]) : l).then(n.serialize).then((l) => I.request({ method: s, url: f.trimEnd(`${a}/${e || ""}`, "/"), data: l }).msg(n.onSuccess)).catch(n.onFail); +}, [t, e, i]), Rn = (t, e, i, r) => { + const n = Tn(e, i, r); + V(() => { + n ? t.setFieldsValue(n) : t.resetFields(); + }, [t, n]); + const o = On(e, i, r); + return f.partial(o, t); +}, Fn = (t, e, i = [], r = {}) => { + const n = J({}), o = J(), a = f.debounce(Ot(), 180), s = ["disabled", "required"], l = (h, g) => { + s.includes(h) && (n.current[h] = g), a(); + }, d = q(() => ({ setDisabled: (h) => l("disabled", h), setRequired: (h) => l("required", h), getDisabled: () => n.current.disabled, getRequired: () => n.current.required }), [e]), [u, p] = Gi(e, -1, {}, d, r); + if (!p && o.current != u && (u >= 0 || !f.isEmpty(i == null ? void 0 : i[u]))) { + o.current = u; + const { widget: h, widgetPrefix: g, props: y } = i == null ? void 0 : i[u]; + t = Wi(h, g), n.current = f.merge(y, f.pick(n.current, s)); + } + return [t, n.current]; +}, Pi = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), Vo = ({ value: t, onChange: e }, i = null) => { + const r = J(), [n] = ne.useForm(i), o = J({}); + return ft(() => { + f.isEqual(r.current, t) || n.setFieldsValue(t); + }, [t]), V(() => () => n.resetFields(), []), [q(() => n.__INTERNAL__ ? n : { ...n, __INTERNAL__: { itemRef: (a) => (s) => { + const l = Pi(a); + s ? o.current[l] = s : delete o.current[l]; + } }, scrollToField: (a, s = {}) => { + console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); + }, focusField: (a) => { + console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); + }, getFieldInstance: (a) => { + const s = Pi(a); + return o.current[s]; + } }, [n]), (a, s) => { + r.current = s, e == null || e(s); + }]; +}, ri = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: i, subWidgets: r = [], basicForm: n, ...o }) => { + const a = Wi(t, e), [s, l] = Fn(a, i, r, n), [d, u] = A(); + return V(() => { + s && pe.getWidgetComponent(s).then(({ defaultProps: p = {}, default: h }) => ({ default: jn(h, p, n) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(E.createElement(p.default, o))); + }, [s]), d && E.cloneElement(d, { ...o, ...l }); +}, jn = (t, e = {}, i = null) => (r) => { + const { type: n, code: o, label: a, noStyle: s, style: l, placeholder: d, required: u = !1, extras: p, validators: h, help: g, isVirtual: y, $isReserved: w, initialValue: C, initialValueLanguage: S, ...P } = f.omit(f.merge({}, e, r), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = vn(Object.assign({}, h, u ? { required: !0 } : {}), o, n), $ = q(() => { + const D = Object.keys((e == null ? void 0 : e.extras) || {}); + return f.over([f.partialRight(f.pick, D), f.partialRight(f.omit, D)]); + }, [e == null ? void 0 : e.extras]), [T, j] = $(P), F = { label: a, noStyle: s, style: l, colon: !1, layout: "vertical" }, M = Y((D) => D == null ? void 0 : ue(D, n), [n]); + return m(Qt, { name: o, rules: k, initialValue: M(C), normalize: M, children: (D, R, W) => { + var U; + return m(t, { type: n, rcform: W, basicForm: i, itemProps: { validateStatus: R.errors.length > 0 ? "error" : "success", tooltip: g || null, help: R.errors.length > 0 ? R.errors.join("、") : null, required: ((U = k == null ? void 0 : k[0]) == null ? void 0 : U.required) || !1, ...F }, fieldProps: { placeholder: d, ...j, ...D }, $setting: Object.assign({}, p, T) }); + } }); +}, ni = ({ name: t, form: e = null, basicForm: i = null, style: r = {}, className: n, cols: o = 24, rowHeight: a = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: d = [], hides: u = [], primaryKey: p = 0, formProps: h = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: w, onValuesChange: C, theme: S, themeProps: P = {}, groups: k = [{ key: "default", label: "默认" }], children: $, ...T }) => { + const [j] = ne.useForm(e), F = Y((R, W) => { + C == null || C(R, W), w && Array.isArray(y) && Me.exec(w, { changedValues: R, allValues: W }, { getFieldValue: j.getFieldValue, setFieldValue: j.setFieldValue, setFieldsValue: j.setFieldsValue, isFieldTouched: j.isFieldTouched, isFieldsTouched: j.isFieldsTouched }).catch((U) => console.error("onFormValuesChange", t, U)); + }, [t, j, C, y, w]), M = q(() => [{ name: "__PROPS__", value: h }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, h, g]), D = (R, W, U) => { + const K = ei(W, ri, i), he = qi(T); + return L("div", { ...he, className: O("ff-grid-layout-form", n), style: { ...r, "--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": o, "--grid-layout-row-height": `${a}px` }, children: [K, U && E.cloneElement(U, { cols: o, rowHeight: a, itemMargin: s, containerPadding: l, fields: W, basicForm: i })] }); + }; + return L(ne, { ...T, form: j, fields: M, onValuesChange: F, children: [S ? m(Yi, { ...P, items: k, theme: S, itemRender: D, fields: d, children: $, basicForm: i }) : D(0, d, $), u == null ? void 0 : u.map((R) => { + var W; + return m(Qt, { name: R.code, children: m(An, { form: j, basicForm: i, name: R.code, type: R.type, initialValue: R.initialValue, initialValueLanguage: (W = R.extras) == null ? void 0 : W.initialValueLanguage }) }, JSON.stringify(R.code)); + })] }); +}, An = ({ type: t, initialValue: e, initialValueLanguage: i, onChange: r, basicForm: n }) => { + const [o, a] = Gi(i == "javascript" && e, i == "javascript" ? void 0 : e, {}, {}, n); + return V(() => { + i == "javascript" ? r(ue(o, t)) : e && r(ue(e, t)); + }, [t, e, o]), null; +}; +ni.propTypes = { fields: b.array, hides: b.array }; +const Ln = /* @__PURE__ */ ((t) => ({ code: e, isPreview: i = !1, ...r }) => { + const { align: n, autoComplete: o, resource: a, items: s, hides: l, rowHeight: d, marginX: u, marginY: p, cols: h, listenChangeFields: g, listenChangeFieldsFunc: y, pk: w, uuid: C, theme: S, themeProps: P, groups: k } = xn(e), $ = q(() => [{ name: "__PK__", value: w }, { name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: C }], [w, e, C, a]); + return m(t, { name: e, autoComplete: o, theme: S, themeProps: P, groups: k, ...r, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: y, fields: s, hides: l, cols: h, rowHeight: d, itemMargin: [u, p] }); +})(ni), rr = ({ $setting: t, $close: e, extras: i, code: r, primaryKey: n, ...o }) => { + const [a] = ne.useForm(), s = Rn(a, r, n, t); + return m(ee, { actions: L(E.Fragment, { children: [m(v, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => s({ onSuccess: e }) }), m(v, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: i, children: m(Ln, { form: a, code: r, primaryKey: n, ...o }) }); +}, Ni = /* @__PURE__ */ new Set(), Gt = (t = [], e = 0) => { + const i = t[e]; + if (i.length && !Ni.has(i)) { + const r = document.createElement("script"); + r.setAttribute("src", i), r.setAttribute("data-namespace", i), t.length > e + 1 && (r.onload = () => { + Gt(t, e + 1); + }, r.onerror = () => { + Gt(t, e + 1); + }), Ni.add(i), document.body.appendChild(r); + } +}, Et = ({ className: t, type: e, style: i = {}, ...r }) => m("span", { role: "img", className: O("ff-iconfont", t), style: i, ...r, children: m("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: m("use", { xlinkHref: `#${e}` }) }) }); +Et.propTypes = { className: b.string, type: b.string.isRequired, style: b.object }, Et.init = Gt; +const In = (t, e, i, r) => ae.redirect(i, e, r), Mn = (t, e = {}, i, r = {}) => { + var o; + const n = (o = r.router) == null ? void 0 : o.reduce((a, [s, l, d]) => { + const u = f.get(e, ["router", s]); + if (!u && u !== 0 && l) throw `请传入 ${d}`; + return `${a}/${u}`; + }, `/api/${i}`); + return I.del(n, e.param).msg(); +}, xi = (t, e, i, { status: { loading: r, disabled: n }, setStatus: o, listFn: a }) => { + const s = { loading: (l) => l === void 0 ? r : o((d) => ({ ...d, loading: l })), disabled: (l) => l === void 0 ? n : o((d) => ({ ...d, disabled: l })), list: a }; + return f.isFunction(i) ? i.call(null, e, s) : f.isString(i) && i ? Me.exec(i, e, s) : null; +}, vi = (t, e, i, r, n) => f.isString(i) && i ? pe.getWidgetComponent(i).then(({ default: o }) => re.modal(o, { ...e, $setting: r }, n != null && n.title ? { ...n, title: f.template(n.title)(t) } : n)).catch((o) => { + re.error(i, { content: o.toString() }); +}) : re.modal(i, { ...e, $setting: r }, n != null && n.title ? { ...n, title: f.template(n.title)(t) } : n), Vn = (t, e, i, r, n) => re.modal(rr, { ...e, $setting: r, code: i }, n != null && n.title ? { ...n, title: f.template(n.title)(t) } : n), Dn = (t, e, i, r, n) => re.modal(ti, { base62params: e, $setting: r, listCode: i }, n != null && n.title ? { ...n, title: f.template(n.title)(t) } : n), zn = ({ widget: t, widgetType: e, widgetData: i, widgetProps: r, widgetSetting: n, widgetContainerProps: o }, { onAfterClick: a, onBeforeClick: s } = {}) => { + const l = ge(se), [d, u] = A({ leading: !0, trailing: !1 }), [, p, h] = ii(r, {}, { list: l }, [l.getBase62params, l.getSelectedRows]), g = q(() => { + switch (e) { + case "redirect": + return f.partialRight(In, t, n); + case "func": + return f.partialRight(xi, (n == null ? void 0 : n.code) ?? t, { status: d, setStatus: u, listFn: l }); + case "component": + case "fsdpf-component": + return f.partialRight(vi, t, n, o); + case "grid-layout-form": + return f.partialRight(Vn, t, n, o); + case "data-list": + return f.partialRight(Dn, t, n, o); + case "destroy": + return f.partialRight(Mn, t, n, o); + default: + if (ai(t) || E.isValidElement(t)) return f.partialRight(vi, t, n, o); + if (f.isFunction(t)) return f.partialRight(xi, (n == null ? void 0 : n.code) || t, { status: d, setStatus: u }); + } + return (...y) => console.error("useButton unknown widgetType", e, ...y); + }, [t, e, l.getBase62params, l.getSelectedRows]); + return [f.debounce((y) => (s == null || s(y), Promise.resolve(Tt(r, y, { list: l })).then((w) => (console.log("[useButton] onClick overrides", h, "resolvedProps", w), g(y, { ...i, ...w, ...h, $setProps: p }))).then((w) => a == null ? void 0 : a(w)).catch(console.error)), 300, { leading: !0, trailing: !1 }), d]; +}, nr = ({ type: t, name: e, className: i, icon: r, iconPosition: n, size: o }, a = "default") => q(() => { + const s = { type: "primary", className: O("ff-button", i), iconPosition: n, size: o }; + return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), a === "link" || a === "dashed" ? (s.type = a, t === "default" && (s.className = O(s.className, "ff-default"))) : a !== "circle" && a !== "round" || (s.shape = a), r && (s.icon = m(Et, { type: r })), e && (s.children = e), s; +}, [a, t, i, r, n]), Rt = ({ data: t, widget: e, widgetType: i = "fsdpf-component", widgetData: r, widgetProps: n, widgetSetting: o, widgetContainerProps: a, onAfterClick: s, onBeforeClick: l, children: d, extras: u }) => { + const p = ge(se), [h, g] = A(!1), [y, w] = A("hover"), [C, S] = ii(n, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [P, k] = A(), { placement: $, align: T, zIndex: j, arrow: F = { pointAtCenter: !0 }, getPopupContainer: M, isPopupMountBodyContainer: D = !0, ...R } = a || {}; + V(() => { + i == "grid-layout-form" ? k(E.createElement(rr, { ...r, $setting: o, code: e })) : i == "data-list" ? k(E.createElement(ti, { base62params: t, $setting: o, listCode: e })) : f.isString(e) ? pe.getWidgetComponent(e).then(({ default: K }) => { + k(E.createElement(K, { ...r, $setting: o })); + }).catch((K) => k(K.toString())) : ai(e) ? k(E.createElement(e, { ...r, $setting: o })) : E.isValidElement(e) && k(E.cloneElement(e, { ...r, $setting: o })); + }, [e, i, r]); + const W = (K, he = !1) => (g(K), !K && w("hover"), K ? l == null ? void 0 : l(C) : s == null ? void 0 : s(he)), U = (K) => { + g(!0), w("click"); + }; + return m(Ir, { zIndex: j, placement: $, onPopupClick: U, onClick: U, open: h, align: T, arrow: F, trigger: y, getPopupContainer: M || D ? void 0 : (K) => K, content: m(Wn, { ...R, extras: u, children: P && E.cloneElement(P, { ...C, $setProps: S, $close: (K) => W(!1, K) }) }), children: d, onOpenChange: W }); +}, Wn = ({ title: t, className: e, classNames: i, children: r, extras: n, width: o, height: a, ...s }) => { + const [l, d] = A({}), u = Y((y, w) => d((C) => ({ ...C, [y]: w })), []), p = Y((y) => d((w) => ({ ...w, [y]: void 0 })), []), h = t ? E.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = n ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, n); + return m(ht.Provider, { value: { ele: l, mount: u, unmount: p }, children: L("div", { className: O("ff-popup ff-popover", e, l.rootClassName), style: { width: o ?? 260, height: a }, ...s, children: [L("div", { className: O("ff-popup-header", "ff-popover-header", i == null ? void 0 : i.header), children: [h, l == null ? void 0 : l["sub-title"]] }), m("div", { className: O("ff-popup-body", "ff-popover-body", i == null ? void 0 : i.body), children: r }), L("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] })] }) }); +}; +Rt.propTypes = { widgetType: b.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; +const yt = (t) => function({ className: e, variant: i, children: r, name: n, icon: o, type: a = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: d, onBeforeClick: u, data: p, loading: h, disabled: g, tooltip: y, confirm: w, widget: C = () => { +}, widgetType: S, widgetData: P, widgetProps: k, widgetSetting: $, widgetContainerProps: T, ...j }) { + const { mode: F, ...M } = T || {}, D = nr({ className: e, name: n, type: a, icon: o, iconPosition: s }, i ?? t), R = m(kt, { ...D, ...j, children: r || n }); + if (F === "popover" && !["destroy", "redirect", "func"].includes(S)) return m(Rt, { data: p, widget: C, widgetType: S, widgetData: P, widgetProps: k, widgetSetting: $, widgetContainerProps: M, onAfterClick: d, onBeforeClick: u, children: R }); + const W = f.isEmpty(y) || !y.enabled ? {} : y, U = f.isEmpty(w) ? { enabled: !1 } : Object.assign({ enabled: !0 }, w), [K, he] = A(!1), [oe, { disabled: z, loading: le }] = zn({ widget: C, widgetType: S, widgetData: P, widgetProps: k, widgetSetting: $, widgetContainerProps: M }, { onAfterClick: d, onBeforeClick: u }); + return m(Mr, { okText: "确定", cancelText: "取消", getPopupContainer: (_) => _, ...U, disabled: z || g, open: K, onOpenChange: (_) => { + if (!_) return he(_); + U.enabled ? he(_) : oe(p); + }, onConfirm: (_) => { + oe(p, _); + }, onClick: (_) => { + _.stopPropagation(); + }, children: m(Vr, { getPopupContainer: (_) => _, ...W, title: K ? null : W == null ? void 0 : W.title, trigger: ["hover", "click"], children: E.cloneElement(R, { loading: le || h, disabled: z || g }) }) }); +}, v = yt("default"); +v.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 Bn = yt("link"), Un = yt("circle"), qn = yt("round"), Kn = yt("dashed"), Ti = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: i = (g, y, w) => { +}, onBeforeClick: r = (g, y, w) => { +}, labelVariant: n = "link", labelSize: o, labelRender: a, btnVariant: s, btnSize: l, btnRender: d = (g, y) => m(v, { ...g, data: y }, g.uuid || Dt()), widgetContainerProps: u = {}, children: p, data: h }) => { + if (f.isEmpty(t)) return p; + const [g, y] = q(() => (t || []).reduce((C, S) => { + const P = e.indexOf(S.widgetType); + return P === -1 ? C[1].push(S) : C[0] ? P < e.indexOf(C[0].widgetType) ? (C[1].push(C[0]), C[0] = S) : C[1].push(S) : C[0] = S, C; + }, [null, []]), [t, e]); + a ? p = a(g, h) || p : p || (p = m(kt, { ...nr(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: o }), n) })); + const w = 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, h), onBeforeClick: f.partialRight(r, C, h) }, { size: l, variant: s }), h)); + return m(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: h, widgetData: g == null ? void 0 : g.widgetData, extras: w, onAfterClick: f.partialRight(i, g, h), onBeforeClick: f.partialRight(r, g, h), children: p }); +}; +Ti.propTypes = { triggerWeights: b.array, options: b.arrayOf(b.shape({ ...v.propTypes, widgetType: v.propTypes.widgetType.isRequired })), btnSize: v.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: v.propTypes.size, onAfterClick: b.func, onBeforeClick: b.func, widgetContainerProps: v.propTypes.widgetContainerProps, data: v.propTypes.data }, v.Link = Bn, v.Link.defaultProps = v.defaultProps, v.Link.propTypes = v.propTypes, v.Circle = Un, v.Circle.defaultProps = v.defaultProps, v.Circle.propTypes = v.propTypes, v.Round = qn, v.Round.defaultProps = v.defaultProps, v.Round.propTypes = v.propTypes, v.Dashed = Kn, v.Dashed.defaultProps = v.defaultProps, v.Dashed.propTypes = v.propTypes, v.Popover = Rt, v.GroupPopover = Ti; +const Hn = ({ fields: t, formProps: e, $close: i }) => { + const [r] = ne.useForm(), n = q(() => [{ name: "__PROPS__", value: e }], [e]); + return m(ee, { actions: L(E.Fragment, { children: [m(v, { name: "取消", widget: () => i(!1) }), m(v, { name: "确定", type: "primary", widget: () => r.validateFields(!0).then(i) })] }), children: m(ne, { fields: n, form: r, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...a }) => m(ri, { code: o, ...a }, o)) }) }); +}, Jn = ({ className: t, classNames: e, $close: i, children: r, title: n, subTitle: o, actions: a, extras: s, ...l }) => L(Hr, { ...l, prefixCls: "ff-drawer", className: O("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (d) => ({ motionAppear: !0, motionName: `panel-motion-${d}` }), children: [L("div", { className: O("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [m("button", { "aria-label": "Close", className: O("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: m(Zt, { type: "close" }) }), n, o] }), m("div", { className: O("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: r }), L("div", { className: O("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, a] })] }), _n = ({ className: t, classNames: e, $close: i, $event: r, children: n, title: o, subTitle: a, actions: s, extras: l, placement: d, ...u }) => { + const p = (r == null ? void 0 : r.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: r == null ? void 0 : r.pageX, y: r == null ? void 0 : r.pageY } }; + return m(Jr, { ...u, ...p, prefixCls: "ff-modal", modalRender: () => L("div", { className: O("ff-modal-content ff-popup", t), children: [L("div", { className: O("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [m("button", { "aria-label": "Close", className: O("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: u.onClose, children: m(Zt, { type: "close" }) }), o, a] }), m("div", { className: O("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: n }), L("div", { className: O("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] }) }); +}, or = ({ placement: t, $close: e, $event: i, children: r, title: n, ...o }) => { + const [a, s] = A({}), [l, d] = A(!0), u = Y((y, w) => s((C) => ({ ...C, [y]: w })), []), p = Y((y) => s((w) => ({ ...w, [y]: void 0 })), []); + let h = { ...o, className: a.rootClassName, title: a.title || n && E.createElement("div", { className: O("ff-popup-title") }, n), subTitle: a["sub-title"], actions: a.actions, extras: a.extras, children: r, $close: e, $event: i, onClose: () => d(!1) }; + const g = () => { + e(!1); + }; + return m(ht.Provider, { value: { ele: a, mount: u, unmount: p }, children: t && t !== "center" ? m(Jn, { ...h, placement: t, open: l, afterOpenChange: (y) => !y && g() }) : m(_n, { ...h, visible: l, afterClose: g }) }); +}; +or.propTypes = { placement: b.oneOf(["center", "left", "top", "right", "bottom"]) }; +const Gn = ({ widget: t, widgetProps: e, $close: i, onSetProps: r }) => { + const [n, o] = A(e || {}), a = ji(e); + Ai(() => { + const l = a ?? {}, d = e ?? {}, u = Object.keys({ ...l, ...d }).reduce((p, h) => (l[h] !== d[h] && (p[h] = d[h]), p), {}); + Object.keys(u).length > 0 && o((p) => ({ ...p, ...u })); + }, [e]); + const s = Y((l) => { + o((d) => ({ ...d, ...l })), r == null || r(l); + }, [r]); + return E.isValidElement(t) ? E.cloneElement(t, { ...n, $close: i, $setProps: s }) : t != null && t.name || bi.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === bi.ForwardRef ? E.createElement(t, { ...n, $close: i, $setProps: s }) : t; +}, ie = () => { + const [t, e] = Nr({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (o) => { + const { offsetHeight: a } = o; + return { height: a }; + }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = E.useReducer((o) => o + 1, 0); + V(() => { + ie.$onClick = r, ie.$queue.forEach(([o, a, s], l, d) => { + n([a, s], ...o), delete d[l]; + }); + }, []); + const r = (o, a = {}, s = {}) => new Promise((l, d) => n([l, d], o, a, s)), n = ([o, a], s, l = {}, d = {}) => { + const u = ie.$index++, p = (y) => ((w, C) => (ie.$popups.delete(w), i(), C == null ? void 0 : C()))(u, () => o(y)); + if (s === Di) return t.open({ ...d, key: u, content: E.createElement(s, { ...l, $close: () => t.close(u) }) }); + const { $setProps: h, ...g } = l; + ie.$popups.set(u, E.createElement(or, { maskClosable: !1, $event: g == null ? void 0 : g.$event, ...d, key: u, $close: p }, E.createElement(Gn, { widget: s, widgetProps: g, $close: p, onSetProps: h }))), i(); + }; + return L(E.Fragment, { children: [Array.from(ie.$popups).map(([o, a]) => a), 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 Oi = (t, e, i = {}) => ie.$onClick(t, e, i), Mt = (t, { showProgress: e, duration: i, ...r } = { duration: 1.5 }) => ie.$onClick(Di, { content: t, ...r }, { showProgress: e, duration: i }), re = { modal: Oi, confirm: (t, e = {}) => ie.$onClick(_r, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, i = {}) => Oi(Hn, { formProps: i, fields: t }, { placement: "center", ...e }).then((r) => { + if (r === !1) throw !1; + return r; +}), notification: Mt, success: (t, e = { duration: 1.5 }) => Mt(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => Mt(t, { ...e, className: "ff-notification-error", icon: "close" }) }; +tt.configure({ showSpinner: !1 }); +const ar = () => { + const t = window.localStorage.getItem(Ct); + return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); +}; +De.interceptors.request.use((t) => (Object.assign(t.headers, ar()), tt.inc(), t), (t) => (tt.done(), Promise.reject({ code: -1, msg: t }))), De.interceptors.response.use(({ data: t, headers: e }) => (tt.done(), { ...t, res: e == null ? void 0 : e.res }), function(t) { + return tt.done(), Promise.reject(t.message); +}), window.addEventListener("unhandledrejection", zt.onUnhandledRejection), zt.onMsg = (t, e) => re[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && ae.redirect(qe.get("Common.WEBSITE_LOGIN_PAGE"))); +var Xe, Ue, Qe; +const Q = class Q { + constructor() { + x(this, "appUrl", ""); + N(this, Xe, null); + return c(Q, Ue) || (B(Q, Qe, new zt()), B(Q, Ue, new Proxy(this, { get(e, i) { + if (i in e) { + const r = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), i); + return r != null && r.get ? Reflect.get(e, i, e) : typeof e[i] == "function" ? e[i].bind(e) : e[i]; + } + return c(Q, Qe)[i]; + } }))), c(Q, Ue); + } + init(e, i, r) { + De.defaults.baseURL = this.appUrl = r, De.defaults.timeout = 15e3, c(Q, Qe).init(e, i, De); + } + get driver() { + return De; + } + get headers() { + return ar(); + } + mock(e = {}) { + return c(this, Xe) ?? B(this, Xe, new Tr(De, { onNoMatch: "passthrough", ...e })); + } + unmock() { + var e; + (e = c(this, Xe)) == null || e.restore(), B(this, Xe, null); + } +}; +Xe = new WeakMap(), Ue = new WeakMap(), Qe = new WeakMap(), N(Q, Ue), N(Q, Qe), x(Q, "getInstance", () => c(Q, Ue) ?? B(Q, Ue, new Q())); +let Yt = Q; +const I = Yt.getInstance(); +class oi extends Error { + constructor(e, i) { + super(i), Error.captureStackTrace && Error.captureStackTrace(this, oi), !i instanceof it && (this.name = `${e} Error Runtime`); + } +} +class it extends Error { + constructor(e, ...i) { + super(...i), Error.captureStackTrace && Error.captureStackTrace(this, it), this.name = `${e} Not Found`; + } +} +const Vt = "mine", Ct = "token"; +var Ie, Ze; +const Ce = class Ce { + constructor() { + N(this, Ze, /* @__PURE__ */ new Map()); + x(this, "setVendor", (e, i) => c(this, Ze).set(e, new Mi(i, async (r, n) => { + var a, s; + if (!(r != null && r.default)) throw "@pkg not found"; + let o = () => n; + switch ("function") { + case typeof (o = (a = r.default) == null ? void 0 : a[`./${n}/index.jsx`]): + case typeof (o = (s = r.default) == null ? void 0 : s[`./${n}/index.js`]): + return o(); + } + throw new it(n); + }))); + x(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 it(e); + try { + return c(this, Ze).has("pkg") ? await c(this, Ze).get("pkg").get(i) : await import(`${I.appUrl}/api/pkg-import/web?name=${e}`); + } catch (r) { + throw new oi(e, r); + } + }); + x(this, "getRoutes", () => I.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: i, ...r }) => [i, { uuid: i, ...r }])).then((e) => new Map(e))); + x(this, "getMenus", () => I.get("/api/my-menu")); + x(this, "getConfigure", () => I.get("api/init-configure")); + x(this, "getWidgetOperationAuth", () => I.get("/api/init-widget-operation-auth").then((e) => e.reduce((i, { uuid: r, auth: n }) => [...i, [r, n]], []))); + x(this, "getPhoneNumber", (e) => I.get(`/api/user-wx-phone-number/${e}`)); + x(this, "getUserToken", () => { + const e = window.localStorage.getItem(Ct); + if (!e) return ""; + const i = e.split("."); + if (!Array.isArray(i) || i.length !== 3) throw "登录令牌无效!"; + const { iat: r } = JSON.parse(window.atob(i[1])); + if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - r > 2592e3) throw "登录令牌已过期, 请重新登录!"; + return e; + }); + x(this, "checkUserToken", () => { + try { + return !!this.getUserToken(); + } catch { + return !1; + } + }); + x(this, "getUserInfo", (e = !0) => { + var i; + try { + const r = this.getUserToken(); + if (!r) return Promise.resolve(null); + const { iat: n } = JSON.parse(window.atob((i = r == null ? void 0 : r.split(".")) == null ? void 0 : i[1])), { iat: o, ...a } = I.decode(window.localStorage.getItem(Vt) || "", {}); + return o === n ? Promise.resolve(a) : I.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(Vt, I.encode({ ...s, iat: n })), s)); + } catch (r) { + console.error(r), e && re.error("请登录").then(this.logout); + } + return Promise.resolve(null); + }); + x(this, "login", (e, i, r = {}) => I.post("/api/user-token", { username: e, passwd: Or.hash(i), platform: "web", ...r }).then(({ token: n }) => (window.localStorage.setItem(Ct, n), n)).then(async (n) => (await this.initAppEnv(), n))); + x(this, "logout", (e) => (window.localStorage.removeItem(Vt), window.localStorage.removeItem(Ct), e == null ? void 0 : e())); + x(this, "initAppEnv", async () => { + const [e, i, r, n] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); + return zi.init(e), qe.init(n), ae.init(i, r), Et.init(qe.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: i, menus: r, configures: n }; + }); + if (c(Ce, Ie)) return c(Ce, Ie); + } +}; +Ie = new WeakMap(), Ze = new WeakMap(), N(Ce, Ie, null), x(Ce, "getInstance", () => (c(Ce, Ie) || B(Ce, Ie, new Ce()), c(Ce, Ie))); +let Xt = Ce; +const pe = Xt.getInstance(), Yn = E.createContext({ user: {}, initUser: () => { +}, initUserComplete: !1 }), Xn = E.createContext({ set: () => { +}, get: () => { +}, assign: () => { +}, currentRoute: () => { +} }), ai = (t) => !!(t != null && t.name) && (t.prototype instanceof E.Component || /^[A-Z]/.test(t.name)), Qn = (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); +}, Zn = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Yn, AppGlobalParamsContext: Xn, cache: Mi, configure: qe, default: pe, func: Me, http: I, insertStyle: Qn, isReactComponent: ai, route: ae }, Symbol.toStringTag, { value: "Module" })); +var Ne, et, xe, ke, Se, te, Z, G, Ee, ct, dt, ut, pt, vt, gt; +const si = class si { + constructor(e, i = "/") { + N(this, Ne, "/"); + N(this, et, /* @__PURE__ */ new Set()); + N(this, xe, (e) => { + for (const i of c(this, et)) try { + i(e); + } catch (r) { + console.error("Error in VirtualFS event listener:", r); + } + }); + N(this, ke, (e) => { + const i = Date.now(); + if (e && (e.lastModified = i), c(this, Ne) != "/") { + const r = c(this, G).call(this, c(this, Ne)); + r && (r.lastModified = i); + } + this.root.lastModified = i; + }); + N(this, Se, (e) => { + let i = me.normalize(e); + return i.startsWith("/") || (i = "/" + i), i.length > 1 && i.endsWith("/") && (i = i.slice(0, -1)), i; + }); + N(this, te, (e) => { + const i = me.join(c(this, Ne), e); + return c(this, Se).call(this, i); + }); + N(this, Z, (e) => { + if (!e || typeof e != "string") return !1; + const i = c(this, Se).call(this, e); + return !i.includes("..") && i.startsWith("/"); + }); + N(this, G, (e) => { + var o; + const i = c(this, Se).call(this, e); + if (i === "/") return this.root; + const r = i.split("/").filter((a) => a); + let n = this.root; + for (const a of r) { + if (n.type !== "dir") return null; + const s = (o = n.children) == null ? void 0 : o.find((l) => l.name === a); + if (!s) return null; + n = s; + } + return n; + }); + N(this, Ee, (e) => { + const i = c(this, Se).call(this, e), r = me.basename(i), n = me.dirname(i); + return { parent: c(this, G).call(this, n), name: r }; + }); + N(this, ct, (e, i, r) => r === !1 ? e : r === "root" ? e.map((n) => me.join(i, n)) : r === !0 || r === "working" ? e.map((n) => me.relative(c(this, Ne), me.join(i, n))) : e); + N(this, dt, async (e, i, r, n = "") => { + const o = [], a = c(this, G).call(this, e); + if (!a || a.type !== "dir") return o; + const s = a.children; + for (const l of s) { + const d = l.name, u = e === "/" ? `/${d}` : `${e}/${d}`, p = n ? `${n}/${d}` : d; + try { + if (l.type === "file") i(r ? p : d) && o.push(p); + else if (l.type === "dir" && r) { + const h = await c(this, dt).call(this, u, i, r, p); + o.push(...h); + } + } catch { + continue; + } + } + return o; + }); + N(this, ut, async (e, i, r, n = "") => { + const o = [], a = Array.isArray(i) ? i : [i], s = c(this, G).call(this, e); + if (!s || s.type !== "dir") return o; + if (!r) { + for (const d of a) if (c(this, pt).call(this, d)) { + const u = await c(this, vt).call(this, e, d); + o.push(...u); + } else { + const u = me.join(e, d), p = c(this, Se).call(this, u); + c(this, G).call(this, p) && o.push(d); + } + return o; + } + const l = s.children; + for (const d of l) { + const u = d.name, p = e === "/" ? `/${u}` : `${e}/${u}`, h = n ? `${n}/${u}` : u; + try { + if (d.type === "file") for (const g of a) { + let y = !1; + if (y = c(this, pt).call(this, g) ? c(this, gt).call(this, u, g) : u === g, y) { + o.push(h); + break; + } + } + else if (d.type === "dir") { + const g = await c(this, ut).call(this, p, i, r, h); + o.push(...g); + } + } catch { + continue; + } + } + return o; + }); + N(this, pt, (e) => /[*?[\]{}]/.test(e)); + N(this, vt, async (e, i) => { + const r = [], n = c(this, G).call(this, e); + if (!n || n.type !== "dir") return r; + const o = n.children.map((a) => a.name); + for (const a of o) c(this, gt).call(this, a, i) && r.push(a); + return r; + }); + N(this, gt, (e, i) => { + const r = i.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (n, o) => "(" + o.split(",").join("|") + ")"); + return new RegExp(`^${r}$`).test(e); + }); + var r, n, o; + B(this, Ne, 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, (r = this.root).name ?? (r.name = "/"), (n = this.root).children ?? (n.children = []), (o = this.root).lastModified ?? (o.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 r = c(this, G).call(this, i); + if (!r) throw new Error(`ENOENT: no such file or directory, stat '${e}'`); + return { isFile: () => r.type === "file", isDirectory: () => r.type === "dir", lastModified: r.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 r = c(this, G).call(this, i); + if (!r) throw new Error(`ENOENT: no such file or directory, scandir '${e}'`); + if (r.type !== "dir") throw new Error(`ENOTDIR: not a directory, scandir '${e}'`); + return r.children.map((n) => n.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 r = c(this, G).call(this, i); + if (!r) throw new Error(`ENOENT: no such file or directory, open '${e}'`); + if (r.type !== "file") throw new Error("EISDIR: illegal operation on a directory, read"); + return r.content || ""; + } + async writeFile(e, i) { + const r = c(this, te).call(this, e); + if (!c(this, Z).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: n, name: o } = c(this, Ee).call(this, r); + if (!n) throw new Error(`ENOENT: no such file or directory, open '${e}'`); + if (n.type !== "dir") throw new Error("ENOTDIR: not a directory"); + const a = n.children.findIndex((d) => d.name === o), s = a >= 0, l = { name: o, type: "file", content: i, lastModified: Date.now() }; + s ? n.children[a] = l : n.children.push(l), c(this, ke).call(this, n), c(this, xe).call(this, { action: s ? "update" : "create", path: r, type: "file", timestamp: Date.now() }); + } + async mkdir(e, i = {}) { + const r = c(this, te).call(this, e); + if (!c(this, Z).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const { recursive: n } = i; + if (n) { + const o = r.split("/").filter((s) => s); + let a = "/"; + for (const s of o) + if (a = me.join(a, s), !c(this, G).call(this, a)) { + const { parent: l, name: d } = c(this, Ee).call(this, a); + if (l && l.type === "dir") { + const u = { name: d, type: "dir", children: [], lastModified: Date.now() }; + l.children.push(u), c(this, ke).call(this, l), c(this, xe).call(this, { action: "create", path: c(this, Se).call(this, a), type: "dir", timestamp: Date.now() }); + } + } + } else { + const { parent: o, name: a } = c(this, Ee).call(this, r); + if (!o) throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`); + if (o.type !== "dir") throw new Error("ENOTDIR: not a directory"); + if (o.children.find((l) => l.name === a)) throw new Error(`EEXIST: file already exists, mkdir '${e}'`); + const s = { name: a, type: "dir", children: [], lastModified: Date.now() }; + o.children.push(s), c(this, ke).call(this, o), c(this, xe).call(this, { action: "create", path: r, 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: r, name: n } = c(this, Ee).call(this, i); + if (!r) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + const o = r.children.findIndex((a) => a.name === n); + if (o < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + if (r.children[o].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); + r.children.splice(o, 1), c(this, ke).call(this, r), c(this, xe).call(this, { action: "delete", path: i, type: "file", timestamp: Date.now() }); + } + async rmdir(e, i = {}) { + const r = c(this, te).call(this, e); + if (!c(this, Z).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: n, name: o } = c(this, Ee).call(this, r); + if (!n) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const a = n.children.findIndex((l) => l.name === o); + if (a < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const s = n.children[a]; + 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}'`); + n.children.splice(a, 1), c(this, ke).call(this, n), c(this, xe).call(this, { action: "delete", path: r, type: "dir", timestamp: Date.now() }); + } + async rename(e, i) { + const r = c(this, te).call(this, e), n = c(this, te).call(this, i); + if (!c(this, Z).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + if (!c(this, Z).call(this, n)) throw new Error(`EINVAL: invalid path '${i}'`); + if (!c(this, G).call(this, r)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${i}'`); + const { parent: o, name: a } = c(this, Ee).call(this, r), { parent: s, name: l } = c(this, Ee).call(this, n); + if (!s) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${i}'`); + if (c(this, G).call(this, n)) throw new Error(`EEXIST: file already exists, rename '${e}' -> '${i}'`); + const d = o.children.findIndex((p) => p.name === a), u = { ...o.children[d], name: l, lastModified: Date.now() }; + o.children.splice(d, 1), s.children.push(u), c(this, ke).call(this, o), o !== s && c(this, ke).call(this, s), c(this, xe).call(this, { action: "rename", path: n, oldPath: r, 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, et).add(e), () => { + c(this, et).delete(e); + }; + } + getWorkingDirectory() { + return c(this, Ne); + } + scope(e = "/") { + const i = c(this, Se).call(this, e); + if (!c(this, Z).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const r = c(this, G).call(this, i); + if (!r) throw new Error(`ENOENT: no such file or directory '${e}'`); + if (r.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); + return r.children ?? (r.children = []), r.lastModified ?? (r.lastModified = Date.now()), new si(this.root, i); + } + async findFiles(e, i, r = {}) { + const n = c(this, te).call(this, e); + if (!c(this, Z).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const o = c(this, G).call(this, n); + if (!o) throw new Error(`ENOENT: no such file or directory '${e}'`); + if (o.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); + const { recursive: a = !1, fullPath: s = !1 } = r; + if (typeof i == "function") { + const d = await c(this, dt).call(this, n, i, a); + return c(this, ct).call(this, d, n, s); + } + const l = await c(this, ut).call(this, n, i, a); + return c(this, ct).call(this, l, n, s); + } +}; +Ne = new WeakMap(), et = new WeakMap(), xe = new WeakMap(), ke = new WeakMap(), Se = new WeakMap(), te = new WeakMap(), Z = new WeakMap(), G = new WeakMap(), Ee = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), ut = new WeakMap(), pt = new WeakMap(), vt = new WeakMap(), gt = new WeakMap(); +let Ri = si; +const eo = async (t, e = "/", i = "") => { + try { + const r = await t.stat(e), n = e === "/" ? "/" : me.basename(e), o = { title: n, key: i ? `${i}${e}` : e, isLeaf: r.isFile() }; + if (r.isDirectory()) { + const a = await t.dir(e); + if (a.length > 0) { + o.children = []; + const s = [], l = []; + for (const d of a) { + 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 eo(t, u, i); + o.children.push(p); + } catch (p) { + console.warn(`Failed to process ${u}:`, p.message); + } + } + } + } + return o; + } catch { + return null; + } +}; +export { + Ao as $, + Zr as A, + Eo as B, + $o as C, + St as D, + Bi as E, + qt as F, + xo as G, + gn as H, + en as I, + tn as J, + bn as K, + Cn as L, + vo as M, + To as N, + ue as O, + Sn as P, + Tt as Q, + Ji as R, + Zi as S, + It as T, + Oo as U, + Ro as V, + Fo as W, + jo as X, + En as Y, + $n as Z, + Pn as _, + Wi as a, + Ot as a0, + Lo as a1, + mt as a2, + ft as a3, + Io as a4, + Mo as a5, + Nn as a6, + ii as a7, + Ln as a8, + ni as a9, + qe as aA, + Me as aB, + ae as aC, + Yn as aD, + Xn as aE, + Ri as aF, + eo as aG, + Gn as aH, + ri as aa, + rr as ab, + xn as ac, + vn as ad, + Tn as ae, + On as af, + Rn as ag, + Fn as ah, + Vo as ai, + Et as aj, + v as ak, + zi as al, + zn as am, + ee as an, + ht as ao, + Vi as ap, + ie as aq, + re as ar, + Co as as, + ko as at, + So as au, + pe as av, + ai as aw, + Qn as ax, + I as ay, + Mi as az, + Ui as b, + Po as c, + qi as d, + ei as e, + _i as f, + Gr as g, + Xi as h, + fn as i, + Yi as j, + mn as k, + No as l, + Gi as m, + Hi as n, + Ki as o, + dn as p, + cn as q, + sn as r, + ti as s, + se as t, + hn as u, + pn as v, + wn as w, + rn as x, + on as y, + Qr as z +}; diff --git a/dist/common/vender-DJd-PP9T.js b/dist/common/vender-BCl09qsS.js similarity index 99% rename from dist/common/vender-DJd-PP9T.js rename to dist/common/vender-BCl09qsS.js index 589f5da..ed910d3 100644 --- a/dist/common/vender-DJd-PP9T.js +++ b/dist/common/vender-BCl09qsS.js @@ -1611,7 +1611,49 @@ ir.exports = function() { return r; }(); const xn = gt(ir.exports); -var Tt, _t, Ht = { exports: {} }; +var ar = {}, cr = { exports: {} }, ur = { exports: {} }; +(function(t) { + function e(r) { + return t.exports = e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) { + return typeof n; + } : function(n) { + return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n; + }, t.exports.__esModule = !0, t.exports.default = t.exports, e(r); + } + t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports; +})(ur); +var En = ur.exports; +(function(t) { + var e = En.default; + function r(n) { + if (typeof WeakMap != "function") return null; + var o = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(); + return (r = function(c) { + return c ? a : o; + })(n); + } + t.exports = function(n, o) { + if (!o && n && n.__esModule) return n; + if (n === null || e(n) != "object" && typeof n != "function") return { default: n }; + var a = r(o); + if (a && a.has(n)) return a.get(n); + var c = { __proto__: null }, g = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var y in n) if (y !== "default" && {}.hasOwnProperty.call(n, y)) { + var m = g ? Object.getOwnPropertyDescriptor(n, y) : null; + m && (m.get || m.set) ? Object.defineProperty(c, y, m) : c[y] = n[y]; + } + return c.default = n, a && a.set(n, c), c; + }, t.exports.__esModule = !0, t.exports.default = t.exports; +})(cr); +var An = cr.exports.default; +Object.defineProperty(ar, "__esModule", { value: !0 }); +var Tn = ar.default = function(t) { + var e = Ne.useRef(); + return e.current = t, Ne.useCallback(function() { + for (var r, n = arguments.length, o = new Array(n), a = 0; a < n; a++) o[a] = arguments[a]; + return (r = e.current) === null || r === void 0 ? void 0 : r.call.apply(r, [e].concat(o)); + }, []); +}, Ne = An(Ue), Tt, _t, Ht = { exports: {} }; Tt = Ht, _t = Ht.exports, function() { var t = { version: "3.0.1", x86: {}, x64: {} }; function e(s, b) { @@ -1731,50 +1773,8 @@ Tt = Ht, _t = Ht.exports, function() { return d = o(d = y(d, [0, s.length]), l = y(l, [0, s.length])), l = o(l, d), d = o(d = m(d), l = m(l)), l = o(l, d), ("00000000" + (d[0] >>> 0).toString(16)).slice(-8) + ("00000000" + (d[1] >>> 0).toString(16)).slice(-8) + ("00000000" + (l[0] >>> 0).toString(16)).slice(-8) + ("00000000" + (l[1] >>> 0).toString(16)).slice(-8); }, Tt.exports && (_t = Tt.exports = t), _t.murmurHash3 = t; }(); -const Tn = gt(Ht.exports); -var ar = {}, cr = { exports: {} }, ur = { exports: {} }; -(function(t) { - function e(r) { - return t.exports = e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) { - return typeof n; - } : function(n) { - return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n; - }, t.exports.__esModule = !0, t.exports.default = t.exports, e(r); - } - t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports; -})(ur); -var En = ur.exports; -(function(t) { - var e = En.default; - function r(n) { - if (typeof WeakMap != "function") return null; - var o = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(); - return (r = function(c) { - return c ? a : o; - })(n); - } - t.exports = function(n, o) { - if (!o && n && n.__esModule) return n; - if (n === null || e(n) != "object" && typeof n != "function") return { default: n }; - var a = r(o); - if (a && a.has(n)) return a.get(n); - var c = { __proto__: null }, g = Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var y in n) if (y !== "default" && {}.hasOwnProperty.call(n, y)) { - var m = g ? Object.getOwnPropertyDescriptor(n, y) : null; - m && (m.get || m.set) ? Object.defineProperty(c, y, m) : c[y] = n[y]; - } - return c.default = n, a && a.set(n, c), c; - }, t.exports.__esModule = !0, t.exports.default = t.exports; -})(cr); -var An = cr.exports.default; -Object.defineProperty(ar, "__esModule", { value: !0 }); -var _n = ar.default = function(t) { - var e = Ne.useRef(); - return e.current = t, Ne.useCallback(function() { - for (var r, n = arguments.length, o = new Array(n), a = 0; a < n; a++) o[a] = arguments[a]; - return (r = e.current) === null || r === void 0 ? void 0 : r.call.apply(r, [e].concat(o)); - }, []); -}, Ne = An(Ue), lr = {}, fr = { exports: {} }, hr = { exports: {} }; +const _n = gt(Ht.exports); +var lr = {}, fr = { exports: {} }, hr = { exports: {} }; (function(t) { function e(r) { return t.exports = e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) { @@ -1940,10 +1940,10 @@ dr.exports = function(t) { }(); const jn = gt(dr.exports); export { - Tn as M, + _n as M, xn as N, jn as S, - _n as _, + Tn as _, Pn as a, _ as b, Rn as c, diff --git a/dist/components.js b/dist/components.js index 95061be..14193fa 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,8 +1,9 @@ -import { aq as s, ah as p, ar as n, as as r, ap as t } from "./common/main-DqCTTBs4.js"; +import { as as s, aj as p, at as r, au as t, ar as e, aH as n } from "./common/main-MUM7h7VT.js"; export { s as Empty, p as Icon, - n as Loading, - r as NotFound, - t as Popup + r as Loading, + t as NotFound, + e as Popup, + n as SetPropsWrapper }; diff --git a/dist/container.js b/dist/container.js index 8c862c5..31aada2 100644 --- a/dist/container.js +++ b/dist/container.js @@ -1,10 +1,10 @@ -import { am as s, aq as e, ar as p, as as n, an as t, ap as d, ao as r, al as u } from "./common/main-DqCTTBs4.js"; +import { ao as s, as as e, at as p, au as t, ap as n, ar as d, aq as r, an as u } from "./common/main-MUM7h7VT.js"; export { s as Context, e as Empty, p as Loading, - n as NotFound, - t as PageRender, + t as NotFound, + n as PageRender, d as Popup, r as PopupRender, u as default diff --git a/dist/data-converter.js b/dist/data-converter.js index 2f89253..187127b 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-DqCTTBs4.js"; +import { D as p } from "./common/main-MUM7h7VT.js"; export { p as default }; diff --git a/dist/data-list.js b/dist/data-list.js index 96edc2b..15f2e9e 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-DqCTTBs4.js"; +import { w as t, t as e, o as r, r as o, x as i, s as l, q as u, v as n, p as D, y as L, n as p, A as C, z as m, J as b, C as c, F, E as d, I as k, B as w } from "./common/main-MUM7h7VT.js"; export { t as DataListContent, e as DataListContext, @@ -7,16 +7,16 @@ export { i as DataListFramework, l as DataListHelper, u as DataListSider, - D as DataListTable, - n as DataListToolbar, + n as DataListTable, + D as DataListToolbar, L as DataTableFramework, - C as default, - m as useCellEditableComponents, - p as useColumnsRender, + p as default, + C as useCellEditableComponents, + m as useColumnsRender, b as useDataListHelper, c as useDataSource, F as useHasOperationColumn, d as useItemOperationsAccess, - O as useOperationCallback, - S as useStructure + k as useOperationCallback, + w as useStructure }; diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index 9effa2d..51bee18 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-DqCTTBs4.js"; +import { f as a } from "../common/main-MUM7h7VT.js"; export { a as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index 6e802a3..37963cb 100644 --- a/dist/grid-layout-form.js +++ b/dist/grid-layout-form.js @@ -1,4 +1,4 @@ -import { a7 as s, a9 as r, a8 as u, a6 as o, A as t, ae as m, ac as d, ad as F, ag as i, ab as g, aa as c, af as l } from "./common/main-DqCTTBs4.js"; +import { a9 as s, ab as r, aa as u, a8 as o, m as t, ag as m, ae as d, af as i, ai as F, ad as g, ac as c, ah as l } from "./common/main-MUM7h7VT.js"; export { s as GridLayoutForm, r as GridLayoutFormHelper, @@ -7,8 +7,8 @@ export { t as useFnRun, m as useFormAction, d as useFormData, - F as useFormSubmit, - i as useMergedFormValuesChange, + i as useFormSubmit, + F as useMergedFormValuesChange, g as useRules, c as useStructure, l as useWidgetDecorator diff --git a/dist/grid-layout-form/utils.js b/dist/grid-layout-form/utils.js index 6ca4bfb..5c8496a 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-DqCTTBs4.js"; +import { a as o, g } from "../common/main-MUM7h7VT.js"; export { o as getNormalizeWidget, g as getOptionItemByValue diff --git a/dist/grid-layout.js b/dist/grid-layout.js index 6d03f6e..133c924 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-DqCTTBs4.js"; +import { h as u, j as e, i as r, H as t, G as d, k as i, m as o, l as G, u as l } from "./common/main-MUM7h7VT.js"; export { u as GridLayout, e as GridLayoutFramework, @@ -7,6 +7,6 @@ export { d as default, i as useField, o as useFnRun, - y as useGridLayoutFields, - G as useStructure + G as useGridLayoutFields, + l as useStructure }; diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index 381c2dd..0e03a26 100644 --- a/dist/grid-layout/utils.js +++ b/dist/grid-layout/utils.js @@ -1,7 +1,7 @@ -import { l as o, o as a, p as s, n as g } from "../common/main-DqCTTBs4.js"; +import { b as a, d as o, e as s, c as g } from "../common/main-MUM7h7VT.js"; export { - o as getBoxStyle, - a as getEventProps, + a as getBoxStyle, + o as getEventProps, s as getNormalizeFields, g as getNormalizeWidget }; diff --git a/dist/hooks.js b/dist/hooks.js index 746efc8..226a158 100644 --- a/dist/hooks.js +++ b/dist/hooks.js @@ -1,16 +1,19 @@ import "lodash"; import "rc-field-form"; import "react"; -import { a3 as r, a2 as o, a4 as p, a1 as f, a5 as i, a0 as m } from "./common/main-DqCTTBs4.js"; -import { default as l } from "rc-util/lib/hooks/useMergedState"; -import { a as b } from "./common/vender-DJd-PP9T.js"; +import "react-use"; +import { a3 as u, a2 as o, a4 as i, a1 as f, a5 as m, a0 as d, a7 as c, a6 as l } from "./common/main-MUM7h7VT.js"; +import { default as b } from "rc-util/lib/hooks/useMergedState"; +import { a as x } from "./common/vender-BCl09qsS.js"; export { - r as useDeepEffect, + u as useDeepEffect, o as useDeepEqualEffect, - b as useEvent, - l as useMergedState, - p as useOptions, + x as useEvent, + b as useMergedState, + i as useOptions, f as useStateWithCallback, - i as useSubscribeRequest, - m as useUpdate + m as useSubscribeRequest, + d as useUpdate, + c as useWidgetProps, + l as useWidgetPropsUpdater }; diff --git a/dist/iconfont.js b/dist/iconfont.js index 36d352a..0fc4ac9 100644 --- a/dist/iconfont.js +++ b/dist/iconfont.js @@ -2,7 +2,7 @@ import "react/jsx-runtime"; import "react"; import "prop-types"; import "classnames"; -import { ah as a } from "./common/main-DqCTTBs4.js"; +import { aj as a } from "./common/main-MUM7h7VT.js"; export { a as default }; diff --git a/dist/index.js b/dist/index.js index a14eac2..33b93b6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,13 +1,13 @@ -import { aB as s, aC as e, ax as o, ay as n, at as p, az as r, aw as c, av as u, au as f, aA as l } from "./common/main-DqCTTBs4.js"; +import { aD as t, aE as e, az as o, aA as n, av as p, aB as r, ay as c, ax as f, aw as l, aC as u } from "./common/main-MUM7h7VT.js"; export { - s as AppContext, + t as AppContext, e as AppGlobalParamsContext, o as cache, n as configure, p as default, r as func, c as http, - u as insertStyle, - f as isReactComponent, - l as route + f as insertStyle, + l as isReactComponent, + u as route }; diff --git a/dist/pages.js b/dist/pages.js index fcc2701..935f50d 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-DqCTTBs4.js"; +import { L as t, K as e, M as o, N as g } from "./common/main-MUM7h7VT.js"; export { t as CustomPage, e as DataListPage, diff --git a/dist/res-ws.js b/dist/res-ws.js index d4f90a1..ad199bf 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-DqCTTBs4.js"; +import { R as a } from "./common/main-MUM7h7VT.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index 86f5be3..ed9db4e 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,18 +1,18 @@ 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-DqCTTBs4.js"; -import "./common/vender-DJd-PP9T.js"; +import { S as r, W as i, V as g, X as o, P, $ as m, Q as p, _ as d, Y as h, Z as k, T as U, O as f, U as l } from "./common/main-MUM7h7VT.js"; +import "./common/vender-BCl09qsS.js"; export { - s as deepSome, + r as deepSome, i as getPkgCategory, g as getPkgName, - m as getPkgOwner, - o as getPrimitiveType, - P as getUrlWithPrefix, + o as getPkgOwner, + P as getPrimitiveType, + m as getUrlWithPrefix, p as getWidgetPropsData, d as hasUrlPrefix, h as hashJSON, k as makeUniqueIdGenerator, - f as replaceKeys, - u as toPrimitive, + U as replaceKeys, + f as toPrimitive, l as uuid }; diff --git a/dist/virtual-fs.js b/dist/virtual-fs.js index 538449d..6e7833a 100644 --- a/dist/virtual-fs.js +++ b/dist/virtual-fs.js @@ -1,5 +1,5 @@ import "pathe"; -import { aD as o, aE as r } from "./common/main-DqCTTBs4.js"; +import { aF as o, aG as r } from "./common/main-MUM7h7VT.js"; export { o as default, r as toTreePaths diff --git a/package.json b/package.json index 3572bfd..86fa61c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.6.34", + "version": "0.6.35", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js",