This commit is contained in:
what 2024-12-16 15:24:40 +08:00
parent 419676c641
commit ed8d79e61a
19 changed files with 1035 additions and 1010 deletions

2
dist/button.js vendored
View File

@ -1,4 +1,4 @@
import { Y as s, X as u, Z as e } from "./common/main-CAjvwlqH.js";
import { $ as s, _ as u, a0 as e } from "./common/main-B5hgccZL.js";
import "prop-types";
export {
s as auth,

1000
dist/common/main-B5hgccZL.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

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

2
dist/components.js vendored
View File

@ -1,4 +1,4 @@
import { a3 as s, W as p, a4 as n, a5 as t, a2 as d } from "./common/main-CAjvwlqH.js";
import { a6 as s, Z as p, a7 as n, a8 as t, a5 as d } from "./common/main-B5hgccZL.js";
export {
s as Empty,
p as Icon,

2
dist/container.js vendored
View File

@ -1,4 +1,4 @@
import { $ as o, a3 as s, a4 as p, a5 as t, a0 as d, a2 as n, a1 as r, _ as u } from "./common/main-CAjvwlqH.js";
import { a2 as o, a6 as s, a7 as p, a8 as t, a3 as d, a5 as n, a4 as r, a1 as u } from "./common/main-B5hgccZL.js";
export {
o as Context,
s as Empty,

View File

@ -1,6 +1,6 @@
import "lodash";
import "react";
import { D as p } from "./common/main-CAjvwlqH.js";
import { D as p } from "./common/main-B5hgccZL.js";
export {
p as default
};

10
dist/data-list.js vendored
View File

@ -1,4 +1,4 @@
import { q as t, o as e, j as r, m as o, s as i, n as l, l as u, p as D, k as L, v as n, i as m, w as p, B as C, y as b, z as k, A as F, x as c } from "./common/main-CAjvwlqH.js";
import { w as t, s as e, m as r, p as o, x as i, q as l, o as u, v as D, n as L, y as n, l as m, z as p, F as C, B as F, C as b, E as c, A as d } from "./common/main-B5hgccZL.js";
export {
t as DataListContent,
e as DataListContext,
@ -13,8 +13,8 @@ export {
m as default,
p as useColumnsRender,
C as useDataListHelper,
b as useDataSource,
k as useHasOperationColumn,
F as useOperationCallback,
c as useStructure
F as useDataSource,
b as useHasOperationColumn,
c as useOperationCallback,
d as useStructure
};

View File

@ -1,5 +1,5 @@
import "lodash";
import { b as a } from "../common/main-CAjvwlqH.js";
import { f as a } from "../common/main-B5hgccZL.js";
export {
a as getDefaultExpandRowKeys
};

View File

@ -1,4 +1,4 @@
import { N as s, P as r, O as u, M as o, U as t, T as d, V as m, S as F, Q as i } from "./common/main-CAjvwlqH.js";
import { Q as s, T as r, S as u, P as o, X as t, W as d, Y as m, V as F, U as i } from "./common/main-B5hgccZL.js";
export {
s as GridLayoutForm,
r as GridLayoutFormHelper,

View File

@ -1,5 +1,5 @@
import "lodash";
import { ag as a } from "../common/main-CAjvwlqH.js";
import { aj as a } from "../common/main-B5hgccZL.js";
export {
a as getOptionItemByValue
};

6
dist/grid-layout.js vendored
View File

@ -1,7 +1,7 @@
import { c as e, e as d, H as i, G as t, f as u, h as o } from "./common/main-CAjvwlqH.js";
import { h as d, i as e, H as i, G as t, j as u, k as o } from "./common/main-B5hgccZL.js";
export {
e as GridLayout,
d as GridLayoutWidget,
d as GridLayout,
e as GridLayoutWidget,
i as HOOK_MARK,
t as default,
u as useField,

View File

@ -1,4 +1,4 @@
import { a as t } from "../common/main-CAjvwlqH.js";
import { e as t } from "../common/main-B5hgccZL.js";
export {
t as getBoxStyle
};

6
dist/hooks.js vendored
View File

@ -1,12 +1,12 @@
import "lodash";
import "rc-field-form";
import "react";
import { J as r, I as o, K as p, E as f, F as i, L as m, C as c } from "./common/main-CAjvwlqH.js";
import { default as E } from "rc-util/lib/hooks/useMergedState";
import { M as r, L as o, N as p, J as f, K as i, O as m, I as c } from "./common/main-B5hgccZL.js";
import { default as b } from "rc-util/lib/hooks/useMergedState";
export {
r as useDeepEffect,
o as useDeepEqualEffect,
E as useMergedState,
b as useMergedState,
p as useOptions,
f as usePrevious,
i as useStateWithCallback,

2
dist/iconfont.js vendored
View File

@ -2,7 +2,7 @@ import "react/jsx-runtime";
import "react";
import "prop-types";
import "classnames";
import { W as a } from "./common/main-CAjvwlqH.js";
import { Z as a } from "./common/main-B5hgccZL.js";
export {
a as default
};

6
dist/index.js vendored
View File

@ -1,4 +1,4 @@
import { ae as t, af as e, aa as o, ab as n, a6 as p, ac as c, a9 as r, a8 as f, a7 as l, ad as u } from "./common/main-CAjvwlqH.js";
import { ah as t, ai as e, ad as o, ae as n, a9 as p, af as c, ac as r, ab as f, aa as i, ag as l } from "./common/main-B5hgccZL.js";
export {
t as AppContext,
e as AppGlobalParamsContext,
@ -8,6 +8,6 @@ export {
c as func,
r as http,
f as insertStyle,
l as isReactComponent,
u as route
i as isReactComponent,
l as route
};

2
dist/res-ws.js vendored
View File

@ -1,5 +1,5 @@
import "lodash";
import { R as a } from "./common/main-CAjvwlqH.js";
import { R as a } from "./common/main-B5hgccZL.js";
export {
a as default
};

2
dist/style.css vendored

File diff suppressed because one or more lines are too long

15
dist/utils.js vendored
View File

@ -1,9 +1,12 @@
import "lodash";
import { d as r, g as s, r as i, t as o, u as p } from "./common/main-CAjvwlqH.js";
import { d as g, b as s, a as r, c as o, g as i, r as m, t as p, u as P } from "./common/main-B5hgccZL.js";
export {
r as deepSome,
s as getWidgetPropsData,
i as replaceKeys,
o as toPrimitive,
p as uuid
g as deepSome,
s as getPkgCategory,
r as getPkgName,
o as getPkgOwner,
i as getWidgetPropsData,
m as replaceKeys,
p as toPrimitive,
P as uuid
};

View File

@ -1,7 +1,7 @@
{
"name": "ff",
"private": true,
"version": "0.4.42",
"version": "0.4.43",
"author": "www.fsdpf.com",
"type": "module",
"main": "./dist/index.js",