This commit is contained in:
what 2024-11-11 22:15:30 +08:00
parent bae404e449
commit d9b3f030fa
16 changed files with 210 additions and 204 deletions

2
dist/button.js vendored
View File

@ -1,4 +1,4 @@
import { P as s, O as u, Q as e } from "./common/main-CcbZvxSB.js";
import { Q as s, P as u, S as e } from "./common/main-hocekuUg.js";
import "prop-types";
export {
s as auth,

View File

@ -14,10 +14,10 @@ var Et = (e, t, i, n) => ({
}
});
import { jsx as c, jsxs as $ } from "react/jsx-runtime";
import C, { useEffect as x, useState as P, useCallback as ge, useMemo as pe, useContext as _e, useRef as Y, useId as Dt, useLayoutEffect as hi } from "react";
import C, { useEffect as x, useState as P, useCallback as ge, useMemo as pe, useContext as Ge, useRef as Y, useId as Dt, useLayoutEffect as hi } from "react";
import g from "lodash";
import R from "classnames";
import { Form as Ze, Input as fi, Button as lt, Breadcrumb as yi, Tree as wi, Pagination as Ci, Table as bi, Empty as ki, Popconfirm as vi, Tooltip as Si, Popover as Pi } from "antd";
import { Form as Xe, Input as fi, Button as lt, Breadcrumb as yi, Tree as wi, Pagination as Ci, Table as bi, Empty as ki, Popconfirm as vi, Tooltip as Si, Popover as Pi } from "antd";
import { useMergedState as $i } from "rc-util";
import re, { FieldContext as Ni, Field as qt } from "rc-field-form";
import { useParams as xi, generatePath as Ei, createBrowserRouter as Ti, useInRouterContext as Fi, Navigate as Ri } from "react-router-dom";
@ -75,80 +75,34 @@ class Kt {
}
}
je = new WeakMap(), qe = new WeakMap(), Ae = new WeakMap(), ce = new WeakMap(), Te = new WeakMap(), Fe = new WeakMap();
const Dn = () => c("div", { children: "Empty" }), Ge = C.createContext({ ele: {}, mount: () => {
const Dn = () => c("div", { children: "Empty" }), _e = C.createContext({ ele: {}, mount: () => {
}, unmount: () => {
} }), K = ({ rootClassName: e, className: t, children: i, actions: n, title: r, subTitle: s, extras: a, style: o = {} }) => {
const { mount: l, unmount: u } = C.useContext(Ge);
const { mount: l, unmount: u } = C.useContext(_e);
return n && K.Action({ children: n }), r && K.Title({ children: r }), s && K.SubTitle({ children: s }), a && K.Extra({ children: a }), x(() => (l("rootClassName", e), () => u(e)), [e]), c("div", { className: R("ff-container", t), style: o, children: i });
}, Qe = (e) => ({ children: t, className: i }) => {
const { mount: n, unmount: r } = C.useContext(Ge);
}, Ze = (e) => ({ children: t, className: i }) => {
const { mount: n, unmount: r } = C.useContext(_e);
return x(() => (n(e, C.createElement("div", { key: `ff-${e}`, className: R(`ff-popup-${e}`, i) }, t)), () => r(e)), [i, t]), null;
};
K.Action = Qe("actions"), K.Title = Qe("title"), K.SubTitle = Qe("sub-title"), K.Extra = Qe("extras"), K.propTypes = { className: L.string, style: L.object, title: L.any, subTitle: L.any, actions: L.any, extras: L.any };
const qn = () => c(K, { className: "ff-loading", children: $("div", { className: "loader", children: [$("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), $("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), $("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), $("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] })] }) }), Hn = () => c("div", { children: "NotFound" }), _t = ({ children: e }) => {
K.Action = Ze("actions"), K.Title = Ze("title"), K.SubTitle = Ze("sub-title"), K.Extra = Ze("extras"), K.propTypes = { className: L.string, style: L.object, title: L.any, subTitle: L.any, actions: L.any, extras: L.any };
const qn = () => c(K, { className: "ff-loading", children: $("div", { className: "loader", children: [$("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), $("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), $("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), $("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] })] }) }), Hn = () => c("div", { children: "NotFound" }), Gt = ({ children: e }) => {
const [t, i] = P({}), n = ge((s, a) => i((o) => ({ ...o, [s]: a })), []), r = ge((s) => i((a) => ({ ...a, [s]: void 0 })), []);
return typeof (e == null ? void 0 : e.type) == "string" ? e : c(Ge.Provider, { value: { ele: t, mount: n, unmount: r }, children: C.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) });
return typeof (e == null ? void 0 : e.type) == "string" ? e : c(_e.Provider, { value: { ele: t, mount: n, unmount: r }, children: C.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) });
};
_t.propTypes = { children: L.element.isRequired };
const Lt = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, bt = ({ type: e, props: t }) => c("i", { ...t, children: c("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Lt[e] || Lt.info).map((i, n) => c("path", { d: i }, n)) }) }), Gt = ({ className: e, content: t, icon: i, $close: n }) => $(C.Fragment, { children: [i && c("div", { className: R("ff-notification-icon", e), children: c(bt, { type: i }) }), t] }), Ai = ({}) => c(K, { children: "Confirm" });
Gt.propTypes = { children: L.element.isRequired };
const Lt = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, bt = ({ type: e, props: t }) => c("i", { ...t, children: c("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Lt[e] || Lt.info).map((i, n) => c("path", { d: i }, n)) }) }), _t = ({ className: e, content: t, icon: i, $close: n }) => $(C.Fragment, { children: [i && c("div", { className: R("ff-notification-icon", e), children: c(bt, { type: i }) }), t] }), Ai = ({}) => c(K, { children: "Confirm" });
var fe, Ie;
const Z = class Z {
const X = class X {
constructor() {
F(this, Ie, null);
k(this, "init", (t) => B(this, Ie, new Map(t)));
k(this, "check", (t) => !m(this, Ie).has(t) || m(this, Ie).get(t));
if (m(Z, fe)) return m(Z, fe);
if (m(X, fe)) return m(X, fe);
}
};
fe = new WeakMap(), Ie = new WeakMap(), F(Z, fe, null), k(Z, "getInstance", () => (m(Z, fe) || B(Z, fe, new Z()), m(Z, fe)));
let dt = Z;
const Ii = dt.getInstance(), Yt = (e = {}, t = {}, i = {}, n = "") => g.deepSome(e, (r, s) => s === "type" && r === "code") ? Xt(e, t, i, n) : Qt(e, t, n), Xt = async (e = {}, t = {}, i = {}, n = "") => {
let r = /* @__PURE__ */ Object.create(null);
for (let s in e) {
let a;
if (Reflect.has(e[s], "type") && ["code", "field", "router", "query", "string"].includes(e[s].type)) {
const { type: o, value: l = "", default: u = n } = e[s];
switch (o) {
case "code":
a = await Pe.exec(l, t, i);
break;
case "field":
a = g.get(t, l) ?? g.get(t, l.substring(l.indexOf(".") + 1));
break;
case "router":
case "query":
a = ue.getPageParams(l);
break;
case "string":
a = l;
}
a ?? (a = u);
} else a = await Xt(e[s], t, i, n);
g.set(r, s, a);
}
return r;
}, Qt = (e = {}, t = {}, i = "") => Object.keys(e || {}).reduce((n, r) => {
if (g.isPlainObject(e[r])) {
let s;
if (Reflect.has(e[r], "type") && ["field", "router", "query", "string"].includes(e[r].type)) {
const { type: a, value: o = "", default: l = i } = e[r];
switch (a) {
case "field":
s = g.get(t, o) ?? g.get(t, o.substring(o.indexOf(".") + 1));
break;
case "router":
case "query":
s = ue.getPageParams(o);
break;
case "string":
s = o;
}
s ?? (s = l);
} else s = Qt(e[r], t, i);
g.set(n, r, s);
}
return n;
}, {});
fe = new WeakMap(), Ie = new WeakMap(), F(X, fe, null), k(X, "getInstance", () => (m(X, fe) || B(X, fe, new X()), m(X, fe)));
let dt = X;
const Ii = dt.getInstance();
var ye, He;
const ee = class ee {
constructor() {
@ -161,7 +115,7 @@ const ee = class ee {
ye = new WeakMap(), He = new WeakMap(), F(ee, ye, null), k(ee, "getInstance", () => (m(ee, ye) || B(ee, ye, new ee()), m(ee, ye)));
let ut = ee;
const Ue = ut.getInstance(), Mi = (e, t, i, n, r) => {
const s = C.lazy(() => X.getWidgetComponent(e).catch((a) => ({ default: () => `${a}` })));
const s = C.lazy(() => Q.getWidgetComponent(e).catch((a) => ({ default: () => `${a}` })));
return c(C.Suspense, { children: c(s, { value: t, record: i, $setting: n, base62params: r }) }, e);
}, zi = (e, t = {}) => (At(e), At(t), pe(() => e == null ? void 0 : e.map(({ widgetByJs: i, widgetByJsSetting: n, ...r }, s) => i && !i.endsWith("/BasicShowFieldData") ? { ...r, render: (a, o) => {
const l = Mi(i, a, o, n, t);
@ -184,11 +138,11 @@ const Ue = ut.getInstance(), Mi = (e, t, i, n, r) => {
const r = t.map((s) => `${s == null ? void 0 : s[n]}`);
return e.some(({ uuid: s }) => !s || !i.has(s) || i.get(s).some((a) => r.includes(`${a}`)));
}, [e, t, i, n]), Wi = ({ className: e, itemClassName: t, classNames: i = {}, dataSource: n, isPaginate: r, isItemOperations: s, isBatchOperations: a, batchOperations: o, itemOperations: l, itemOperationsAccess: u, resource: d, primaryKey: p, title: h, itemGridLayout: f, $setting: y, tabs: b, isConditionFormLayout: w, isTreeSider: E, treeSiderConfig: W }) => {
const { getBase62params: q, onClickCallback: D, onTabChange: H } = _e(Le), { total: A, page: M, pageSize: I, tab: z } = (q == null ? void 0 : q()) || {}, _ = ge((V, v, se) => c(Bi, { className: R("ff-data-list-framework-item", t), operations: s && v ? l == null ? void 0 : l.filter((O) => !(p && O.uuid && u.has(O.uuid)) || u.get(O.uuid).includes(v == null ? void 0 : v[p])) : [], data: d ? { [d]: v } : v, children: V, onClickCallback: D }), [d, p, s, D, l, u]);
return $("div", { className: R("ff-data-list-framework", e), children: [c(ii, { className: i == null ? void 0 : i.sider, isTreeSider: E, ...W }), $("div", { className: R("ff-data-list-container", i == null ? void 0 : i.container), children: [c(vt, { className: i == null ? void 0 : i.filter, isConditionFormLayout: w }), c(ti, { title: h, className: i == null ? void 0 : i.toolbar, tabs: b, tab: z, onTabChange: H }), c(Xi, { ...f, className: i == null ? void 0 : i.content, style: { "--col-num": (y == null ? void 0 : y.colNum) || 1 }, primaryKey: p, itemRender: _, dataSource: n }), c(ni, { className: i == null ? void 0 : i.footer, isPaginate: r, isOperations: a, operations: o, total: A, page: M, pageSize: I })] })] });
const { getBase62params: q, onClickCallback: D, onTabChange: H } = Ge(Le), { total: A, page: M, pageSize: I, tab: z } = (q == null ? void 0 : q()) || {}, G = ge((V, v, se) => c(Bi, { className: R("ff-data-list-framework-item", t), operations: s && v ? l == null ? void 0 : l.filter((O) => !(p && O.uuid && u.has(O.uuid)) || u.get(O.uuid).includes(v == null ? void 0 : v[p])) : [], data: d ? { [d]: v } : v, children: V, onClickCallback: D }), [d, p, s, D, l, u]);
return $("div", { className: R("ff-data-list-framework", e), children: [c(Xt, { className: i == null ? void 0 : i.sider, isTreeSider: E, ...W }), $("div", { className: R("ff-data-list-container", i == null ? void 0 : i.container), children: [c(vt, { className: i == null ? void 0 : i.filter, isConditionFormLayout: w }), c(Zt, { title: h, className: i == null ? void 0 : i.toolbar, tabs: b, tab: z, onTabChange: H }), c(Qi, { ...f, className: i == null ? void 0 : i.content, style: { "--col-num": (y == null ? void 0 : y.colNum) || 1 }, primaryKey: p, itemRender: G, dataSource: n }), c(ei, { className: i == null ? void 0 : i.footer, isPaginate: r, isOperations: a, operations: o, total: A, page: M, pageSize: I })] })] });
}, Bi = ({ className: e, operations: t, children: i, data: n, onClickCallback: r }) => $("div", { className: R("data-list-grid-layout-item-container", e), children: [i, !!(t != null && t.length) && c("div", { className: "data-list-grid-layout-item-actions", children: t.map((s) => c("span", { className: "data-list-grid-layout-item-action", children: c(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: n, onAfterClick: (a) => a !== !1 && (r == null ? void 0 : r(s.isRefresh, n)) }, s.uuid || useId()) }, (s == null ? void 0 : s.uuid) || useId())) })] }), Ui = ({ listCode: e, className: t, classNames: i = {}, itemClassName: n, dataSource: r, columns: s, isItemOperations: a, isBatchOperations: o, batchOperations: l, itemOperations: u, itemOperationsAccess: d, resource: p, primaryKey: h, title: f, tabs: y, isPaginate: b, isTreeSider: w, treeSiderConfig: E, isConditionFormLayout: W, ...q }) => {
const { getBase62params: D, onClickCallback: H, onTabChange: A } = _e(Le), { total: M, page: I, tab: z, pageSize: _ } = (D == null ? void 0 : D()) || {}, V = gt(u, r, d, h);
return $("div", { className: R("ff-data-table-framework", t), children: [c(ii, { className: i == null ? void 0 : i.sider, isTreeSider: w, ...E }), $("div", { className: R("ff-data-table-container", i == null ? void 0 : i.container), children: [c(vt, { listCode: e, isConditionFormLayout: W }), c(ti, { title: f, className: i == null ? void 0 : i.toolbar, tabs: y, tab: z, onTabChange: A }), c(Ji, { ...q, primaryKey: h, className: "ff-data-table-content", columns: s, dataSource: r, operationRender: V ? (v) => c("div", { className: "ff-data-table-actions", children: u == null ? void 0 : u.reduce((se, O, me) => [...se, c(S.Link, { size: "small", uuid: O.uuid, type: O.type, name: O.name, widget: O.widget, widgetType: O.widgetType, widgetProps: O.widgetProps, widgetData: O.widgetData, widgetSetting: O.widgetSetting, widgetContainerProps: O.widgetContainerSetting, data: v, onAfterClick: ($e) => $e !== !1 && (H == null ? void 0 : H(O.isRefresh, data)) }, O.uuid || me)], []) }) : null }), c(ni, { isPaginate: b, isOperations: o, operations: l, total: M, page: I, pageSize: _ })] })] });
const { getBase62params: D, onClickCallback: H, onTabChange: A } = Ge(Le), { total: M, page: I, tab: z, pageSize: G } = (D == null ? void 0 : D()) || {}, V = gt(u, r, d, h);
return $("div", { className: R("ff-data-table-framework", t), children: [c(Xt, { className: i == null ? void 0 : i.sider, isTreeSider: w, ...E }), $("div", { className: R("ff-data-table-container", i == null ? void 0 : i.container), children: [c(vt, { listCode: e, isConditionFormLayout: W }), c(Zt, { title: f, className: i == null ? void 0 : i.toolbar, tabs: y, tab: z, onTabChange: A }), c(Ji, { ...q, primaryKey: h, className: "ff-data-table-content", columns: s, dataSource: r, operationRender: V ? (v) => c("div", { className: "ff-data-table-actions", children: u == null ? void 0 : u.reduce((se, O, me) => [...se, c(S.Link, { size: "small", uuid: O.uuid, type: O.type, name: O.name, widget: O.widget, widgetType: O.widgetType, widgetProps: O.widgetProps, widgetData: O.widgetData, widgetSetting: O.widgetSetting, widgetContainerProps: O.widgetContainerSetting, data: v, onAfterClick: ($e) => $e !== !1 && (H == null ? void 0 : H(O.isRefresh, data)) }, O.uuid || me)], []) }) : null }), c(ei, { isPaginate: b, isOperations: o, operations: l, total: M, page: I, pageSize: G })] })] });
}, Le = C.createContext({ listCode: "", getBase62params: (e, t) => {
}, onReload: () => {
}, onClickCallback: () => {
@ -201,7 +155,7 @@ const Ue = ut.getInstance(), Mi = (e, t, i, n, r) => {
} }), Di = ({ isItemGridLayout: e, theme: t, themeProps: i, onClickCallback: n, onReload: r, getBase62params: s, listCode: a, onPageChange: o, onPageSizeChange: l, onTabChange: u, onSiderChange: d, onKeywordChange: p, onConditonChange: h, ...f }) => {
const [y, b] = P();
return x(() => {
t ? X.getWidgetComponent(t).then((w) => {
t ? Q.getWidgetComponent(t).then((w) => {
if (!w) throw `${t} not found`;
return w;
}).catch((w) => ({ default: () => `${w}` })).then((w) => b(C.createElement(w.default, { ...f, $setting: i }))) : y || b(null);
@ -231,8 +185,8 @@ const te = class te {
};
we = new WeakMap(), de = new WeakMap(), Re = new WeakMap(), it = new WeakMap(), F(te, we, null), k(te, "getInstance", () => (m(te, we) || B(te, we, new te()), m(te, we)));
let pt = te;
const Zt = pt.getInstance(), kt = C.forwardRef(({ listCode: e, base62params: t, className: i, itemClassName: n, theme: r, themeProps: s, classNames: a }, o) => {
const l = li(), u = Y(t), d = Y(/* @__PURE__ */ new Map()), p = Y([]), [{ resource: h, primaryKey: f, batchOperations: y = [], itemOperations: b = [], columns: w = [], themeConfig: E, theme: W, isConditionFormLayout: q = !1, isTreeSider: D, treeSiderConfig: H, isItemGridLayout: A, itemGridLayout: M, title: I, isPaginate: z, tabs: _ }, V] = P({ isItemGridLayout: !1, itemGridLayout: {} }), v = g.throttle((T) => {
const Yt = pt.getInstance(), kt = C.forwardRef(({ listCode: e, base62params: t, className: i, itemClassName: n, theme: r, themeProps: s, classNames: a }, o) => {
const l = si(), u = Y(t), d = Y(/* @__PURE__ */ new Map()), p = Y([]), [{ resource: h, primaryKey: f, batchOperations: y = [], itemOperations: b = [], columns: w = [], themeConfig: E, theme: W, isConditionFormLayout: q = !1, isTreeSider: D, treeSiderConfig: H, isItemGridLayout: A, itemGridLayout: M, title: I, isPaginate: z, tabs: G }, V] = P({ isItemGridLayout: !1, itemGridLayout: {} }), v = g.throttle((T) => {
p.current = [], N.list(e, g.pick({ ...u.current, ...T }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: U, condition: Oe, total: Ne, tab: he, sider: xe, page: ae, pageSize: oe, operationsAccess: le, dataSource: Ee }) => {
u.current = { tab: he, condition: Oe, sider: xe, keyword: U, total: Ne, pageSize: oe, page: Ee != null && Ee.length ? ae : 1 }, p.current = Ee, d.current = new Map(le), l();
});
@ -240,7 +194,7 @@ const Zt = pt.getInstance(), kt = C.forwardRef(({ listCode: e, base62params: t,
x(() => {
let T = null;
return e && N.get(`/api/_/${e}`).resp(({ data: U, res: Oe }) => {
U != null && U.isDynamicRefresh && (T = Zt.subscribe(() => v(), Oe)), u.current.pageSize = U.pageSize, V(U);
U != null && U.isDynamicRefresh && (T = Yt.subscribe(() => v(), Oe)), u.current.pageSize = U.pageSize, V(U);
}).catch(() => V({})), p.current = [], () => T == null ? void 0 : T();
}, [e]), nn(() => {
e && v(t);
@ -264,43 +218,43 @@ const Zt = pt.getInstance(), kt = C.forwardRef(({ listCode: e, base62params: t,
} else T === 1 && me();
};
C.useImperativeHandle(o, () => ({ onReload: me, onClickCallback: $e }));
const rt = { listCode: e, title: I, itemClassName: n, classNames: a, resource: h, primaryKey: f, theme: r || W, themeProps: s || E, isTreeSider: D, treeSiderConfig: H, isPaginate: z, tabs: _, isItemOperations: se, isBatchOperations: O, batchOperations: y, itemOperations: b, isItemGridLayout: A, columns: w, itemGridLayout: M, isConditionFormLayout: q, itemOperationsAccess: d.current, dataSource: p.current };
const rt = { listCode: e, title: I, itemClassName: n, classNames: a, resource: h, primaryKey: f, theme: r || W, themeProps: s || E, isTreeSider: D, treeSiderConfig: H, isPaginate: z, tabs: G, isItemOperations: se, isBatchOperations: O, batchOperations: y, itemOperations: b, isItemGridLayout: A, columns: w, itemGridLayout: M, isConditionFormLayout: q, itemOperationsAccess: d.current, dataSource: p.current };
return c(Di, { ...rt, className: R("ff-data-list-helper", i), getBase62params: (T, U, Oe = !1) => T == "init" ? t : T ? g.get(u.current, T, U) : u.current, onReload: me, onClickCallback: $e, onConditonChange: (T, U) => v({ keyword: U, condition: Ft(u.current.condition || {}, { $merge: T || {} }), page: 1 }), onTabChange: (T) => v({ tab: T, page: 1 }), onSiderChange: (T) => v({ sider: T, page: 1 }), onKeywordChange: (T) => v({ keyword: T, page: 1 }), onPageChange: (T, U) => v({ page: T, pageSize: U }), onPageSizeChange: (T) => v({ pageSize: T, page: 1 }) });
}), ei = (e, t, i, n, r = {}, s = 0) => {
}), Qt = (e, t, i, n, r = {}, s = 0) => {
const a = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${e}`, "--grid-layout-y": `${t}`, "--grid-layout-row-height-offset": "0px" };
return r != null && r.autoHeight ? a.height = "fit-content" : a["--grid-layout-row"] = `${n}`, a["--grid-layout-box-margin"] = Ot(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"] = Ot(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 && (a.height = `${s}px`), a;
}, Ot = (e, t, i, n) => `${e || 0}px ${t || 0}px ${i || 0}px ${n || 0}px`, vt = ({ className: e, isConditionFormLayout: t }) => {
var p, h;
const [i, n] = P({}), { listCode: r, onKeywordChange: s, onConditonChange: a, getBase62params: o } = C.useContext(Le), { keyword: l, condition: u } = (o == null ? void 0 : o()) || {}, [d] = Ze.useForm();
const [i, n] = P({}), { listCode: r, onKeywordChange: s, onConditonChange: a, getBase62params: o } = C.useContext(Le), { keyword: l, condition: u } = (o == null ? void 0 : o()) || {}, [d] = Xe.useForm();
return x(() => {
r && t && N.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: b, rowHeight: w, cols: E, fields: W }) => {
n({ resource: f, itemMargin: [y, b], rowHeight: w, cols: E, fields: W });
}).catch(() => n({}));
}, [r, t]), x(() => {
d.setFieldsValue({ keyword: l, ...u });
}, [JSON.stringify([l, u])]), c("div", { className: R("ff-data-list-filter", e), children: c(Ze, { form: d, layout: "vertical", autoComplete: "off", onFinish: ((p = i.fields) == null ? void 0 : p.length) > 1 ? (f) => a({ [i.resource]: f[i.resource] }, f.keyword) : () => {
}, [JSON.stringify([l, u])]), c("div", { className: R("ff-data-list-filter", e), children: c(Xe, { form: d, layout: "vertical", autoComplete: "off", onFinish: ((p = i.fields) == null ? void 0 : p.length) > 1 ? (f) => a({ [i.resource]: f[i.resource] }, f.keyword) : () => {
}, onValuesChange: (f) => {
g.isEmpty(g.omit(f, ["keyword"])) || d.submit();
}, children: ((h = i.fields) == null ? void 0 : h.length) > 1 ? c(St, { ...i, children: c(qi, { onReset: () => {
const { keyword: f, condition: y } = o("init") || {};
d.setFieldsValue({ keyword: f, ...y });
} }) }) : c("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: c("div", { className: "grid-layout-item", style: ei(20, 0, 5, 2), children: c(Ze.Item, { name: ["keyword"], children: c(fi.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => s(f) }) }) }) }) }) });
} }) }) : c("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: c("div", { className: "grid-layout-item", style: Qt(20, 0, 5, 2), children: c(Xe.Item, { name: ["keyword"], children: c(fi.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => s(f) }) }) }) }) }) });
}, qi = ({ cols: e, fields: t, onReset: i }) => {
const [n, r] = P(!1), s = pe(() => t == null ? void 0 : t.toReversed().some((a) => a.y > 1 || a.x + a.w >= e - 5), [e, t]);
return $(Ze.Item, { label: " ", style: { "--item-span": 5 }, className: R("ff-data-list-filter-actions", { expanded: n }), children: [c(lt, { onClick: i, children: "重置" }), c(lt, { type: "primary", htmlType: "submit", children: "查询" }), s && c(S.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((a) => !a), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] });
return $(Xe.Item, { label: " ", style: { "--item-span": 5 }, className: R("ff-data-list-filter-actions", { expanded: n }), children: [c(lt, { onClick: i, children: "重置" }), c(lt, { type: "primary", htmlType: "submit", children: "查询" }), s && c(S.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((a) => !a), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] });
};
vt.reservedFields = [{ x: 0, y: 0, h: 3, w: 5, field: { isVirtual: !0, widgetPrefix: "@pkg/grid-layout-forms", widget: "Input", code: "keyword", label: "关键字", placeholder: "多关键字 | 分割", extras: { prefix: "icon-search" } } }];
const ti = ({ className: e, title: t, tabs: i, tab: n, onTabChange: r }) => {
const Zt = ({ className: e, title: t, tabs: i, tab: n, onTabChange: r }) => {
const [s, a] = $i(i == null ? void 0 : i[0].value, { value: n, onChange: r });
return $("div", { className: R("ff-data-list-toolbar", e), children: [c("div", { className: "ff-data-list-title", children: t }), c(yi, { className: "ff-data-list-tabs", itemRender: ({ label: o, code: l }) => c("span", { onClick: () => a(l), className: R("ff-data-list-tab", { active: l == s }), children: o }), items: i }), $("div", { className: "ff-data-list-actions", children: [c(S.Link, { icon: "icon-reload" }), c(S.Link, { icon: "icon-setting" })] })] });
}, Hi = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: c("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], ii = ({ className: e, width: t = 280, isTreeSider: i }) => i ? c(wi.DirectoryTree, { className: R("ff-data-list-sider", e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: Hi }) : null, ni = ({ className: e, operations: t, isOperations: i, isPaginate: n, total: r, page: s, pageSize: a }) => {
}, Hi = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: c("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], Xt = ({ className: e, width: t = 280, isTreeSider: i }) => i ? c(wi.DirectoryTree, { className: R("ff-data-list-sider", e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: Hi }) : null, ei = ({ className: e, operations: t, isOperations: i, isPaginate: n, total: r, page: s, pageSize: a }) => {
const { onPageChange: o, onPageSizeChange: l, onClickCallback: u } = C.useContext(Le);
return i && !g.isEmpty(t) || n ? $("div", { className: R("ff-data-list-footer", e), children: [c("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((d, p) => c(S, { uuid: d.uuid, type: d.type, name: d.name, widget: d.widget, widgetType: d.widgetType, widgetProps: d.widgetProps, widgetData: d.widgetData, widgetSetting: d.widgetSetting, widgetContainerProps: d.widgetContainerSetting, onAfterClick: (h) => h !== !1 && (u == null ? void 0 : u(d.isRefresh, null)) }, d.uuid || p)) }), n && c(Ci, { size: "small", total: r, pageSize: a, showSizeChanger: !1, showTotal: (d) => `${s} 页 / 总共 ${d}`, onChange: o, onShowSizeChange: l })] }) : null;
}, ri = (e, t, i = !0) => i !== !0 && i-- <= 0 ? [] : g.isArray(e) && !g.isEmpty(e) ? e.reduce((n, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && n.push(r[t]), Reflect.has(r, "children") && !g.isEmpty(r.children) ? n.concat(ri(r.children, t, i)) : n), []) : [], Ji = ({ className: e, primaryKey: t, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: s = 180, ...a }) => {
}, ti = (e, t, i = !0) => i !== !0 && i-- <= 0 ? [] : g.isArray(e) && !g.isEmpty(e) ? e.reduce((n, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && n.push(r[t]), Reflect.has(r, "children") && !g.isEmpty(r.children) ? n.concat(ti(r.children, t, i)) : n), []) : [], Ji = ({ className: e, primaryKey: t, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: s = 180, ...a }) => {
Dt();
const o = Y(null), l = Y(null), [u, d] = P([]), [p, h] = P({ width: 0, height: 0 });
x(() => {
d(ri(n, t));
d(ti(n, t));
}, [n, t]), hi(() => {
const y = new ResizeObserver(() => {
var b;
@ -312,8 +266,8 @@ const ti = ({ className: e, title: t, tabs: i, tab: n, onTabChange: r }) => {
}, []);
const f = zi(i);
return c("div", { ref: l, className: R("ff-data-list-table", e), children: p.height ? c(bi, { ...a, 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 / p.width * 100).toFixed(2)}%`, render: (y, b, w) => r(b, w) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: p.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: d, expandedRowKeys: u } }) : null });
}, Ki = "RC_FORM_INTERNAL_HOOKS", si = (e, { initialValue: t, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: s = "string" }, a = null) => {
const o = Y(!1), l = _e(Ni), [u, d] = P(), [p, h] = P(i != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: f } = l.getInternalHooks(Ki) || {};
}, Ki = "RC_FORM_INTERNAL_HOOKS", ii = (e, { initialValue: t, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: s = "string" }, a = null) => {
const o = Y(!1), l = Ge(Ni), [u, d] = P(), [p, h] = P(i != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: f } = l.getInternalHooks(Ki) || {};
return x(() => f == null ? void 0 : f((y, b, w) => {
if (!o.current) return;
const E = g.get(b, e);
@ -321,68 +275,68 @@ const ti = ({ className: e, title: t, tabs: i, tab: n, onTabChange: r }) => {
}), [p]), x(() => {
i == "javascript" && t ? Pe.exec(t, {}, { getFieldValueForBasicForm: (y) => a ? a.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => h(g.toPrimitive(y, s))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => o.current = !0) : (t && h(g.toPrimitive(t ?? l.getFieldValue(e), s)), o.current = !0);
}, [t, i]), Ye(() => {
o.current && n && X.getWidgetComponent(n).then(({ default: y }) => y({ value: p, record: l.getFieldsValue(!0), $setting: r })).then(d).catch((y) => console.error("布局数据转换错误: ", y, n));
o.current && n && Q.getWidgetComponent(n).then(({ default: y }) => y({ value: p, record: l.getFieldsValue(!0), $setting: r })).then(d).catch((y) => console.error("布局数据转换错误: ", y, n));
}, [p, n, r]), [u || p, p];
}, ai = (e, t, i = "@pkg/grid-layouts", n = null) => pe(() => {
}, ni = (e, t, i = "@pkg/grid-layouts", n = null) => pe(() => {
var r;
return (r = g.sortBy(e, ["y", "x"])) == null ? void 0 : r.map(({ i: s, x: a, y: o, w: l, h: u, field: { boxStyle: d, widgetPrefix: p = i, widget: h, ...f } }, y) => c("div", { className: "grid-layout-item", style: ei(a, o, l, u, d, h === "Height" && (f == null ? void 0 : f.initialValue)), children: c(_i, { ...f, basicForm: n, itemWidget: h != null && h.startsWith("@") || h != null && h.startsWith("blob:") ? h : `${p}/${h}`, itemWidgetRender: t }) }, s || y));
}, [e]), _i = ({ itemWidget: e, itemWidgetRender: t, basicForm: i, ...n }) => {
return (r = g.sortBy(e, ["y", "x"])) == null ? void 0 : r.map(({ i: s, x: a, y: o, w: l, h: u, field: { boxStyle: d, widgetPrefix: p = i, widget: h, ...f } }, y) => c("div", { className: "grid-layout-item", style: Qt(a, o, l, u, d, h === "Height" && (f == null ? void 0 : f.initialValue)), children: c(Gi, { ...f, basicForm: n, itemWidget: h != null && h.startsWith("@") || h != null && h.startsWith("blob:") ? h : `${p}/${h}`, itemWidgetRender: t }) }, s || y));
}, [e]), Gi = ({ itemWidget: e, itemWidgetRender: t, basicForm: i, ...n }) => {
const [r, s] = P();
return x(() => {
X.getWidgetComponent(e).then(({ defaultProps: a = {}, default: o }) => {
Q.getWidgetComponent(e).then(({ defaultProps: a = {}, default: o }) => {
s(C.createElement(t(o, a, i), n));
}).catch((a) => {
console.error(a), s(e);
});
}, [e]), r;
}, oi = ({ cols: e = 12, rowHeight: t = 21, fields: i = [], data: n, containerPadding: r = [0, 0], itemMargin: s = [4, 0], formProps: a = {}, className: o, ...l }) => {
const [u] = re.useForm(), d = ai(i, Gi, "@pkg/grid-layouts"), p = pe(() => [{ name: "__PROPS__", value: a }], [a]);
}, ri = ({ cols: e = 12, rowHeight: t = 21, fields: i = [], data: n, containerPadding: r = [0, 0], itemMargin: s = [4, 0], formProps: a = {}, className: o, ...l }) => {
const [u] = re.useForm(), d = ni(i, _i, "@pkg/grid-layouts"), p = pe(() => [{ name: "__PROPS__", value: a }], [a]);
return Ye(() => {
u.setFieldsValue(n);
}, [n]), c(re, { fields: p, form: u, component: !1, children: c("div", { ...l, className: R("ff-grid-layout", o), style: { "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-container-padding-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-container-padding-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: d }) });
}, Gi = (e, t = {}, i = null) => (n) => {
const { code: r, label: s, extras: a, isVirtual: o, initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, ...h } = g.merge({}, t, n), [f, y] = si(o ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, type: (h == null ? void 0 : h.type) || "string" }, i);
}, _i = (e, t = {}, i = null) => (n) => {
const { code: r, label: s, extras: a, isVirtual: o, initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, ...h } = g.merge({}, t, n), [f, y] = ii(o ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, type: (h == null ? void 0 : h.type) || "string" }, i);
return c(e, { ...h, value: f, rawValue: y, $setting: a || {} });
}, _n = (Vt = oi, function({ code: e, data: t, ...i }) {
}, Gn = (Vt = ri, function({ code: e, data: t, ...i }) {
const [n, r] = P({ resource: null, cols: 12, rowHeight: 21, fields: [] });
return x(() => {
e && N.get(`/api/_/${e}`).then((s) => r(g.pick(s, ["resource", "cols", "rowHeight", "fields"])));
}, [e]), (n == null ? void 0 : n.resource) && c(Vt, { ...i, rowHeight: n.rowHeight, cols: n.cols, fields: n.fields, data: n != null && n.resource ? { [n == null ? void 0 : n.resource]: t } : {} });
});
var Vt;
const Gn = ({ widget: e, widgetPrefix: t = "@pkg/grid-layouts", basicForm: i, ...n }) => {
const _n = ({ widget: e, widgetPrefix: t = "@pkg/grid-layouts", basicForm: i, ...n }) => {
const r = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [s, a] = P();
return x(() => {
r && X.getWidgetComponent(r).then(({ defaultProps: o = {}, default: l }) => ({ default: Yi(l, o, i) })).catch((o) => ({ default: () => `${o}` })).then((o) => a(C.createElement(o.default, n)));
r && Q.getWidgetComponent(r).then(({ defaultProps: o = {}, default: l }) => ({ default: Yi(l, o, i) })).catch((o) => ({ default: () => `${o}` })).then((o) => a(C.createElement(o.default, n)));
}, [r]), s;
}, Yi = (e, t = {}, i = null) => (n) => {
const { code: r, label: s, extras: a, isVirtual: o, initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, value: h, ...f } = g.merge({}, t, n), [y, b] = si(o ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, type: (f == null ? void 0 : f.type) || "string" }, i);
const { code: r, label: s, extras: a, isVirtual: o, initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, value: h, ...f } = g.merge({}, t, n), [y, b] = ii(o ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: p, type: (f == null ? void 0 : f.type) || "string" }, i);
return c(e, { ...f, value: y, rawValue: b, $setting: a || {} });
}, Xi = ({ cols: e, rowHeight: t, itemMargin: i, fields: n, primaryKey: r, dataSource: s, itemClassName: a, itemRender: o = (p, h, f) => p, empty: l = c(ki, { description: null }), className: u, style: d = {} }) => {
const p = Dt(), h = pe(() => c(oi, { cols: e, rowHeight: t, itemMargin: i, fields: n, className: a }), [n, e, t, i]);
}, Qi = ({ cols: e, rowHeight: t, itemMargin: i, fields: n, primaryKey: r, dataSource: s, itemClassName: a, itemRender: o = (p, h, f) => p, empty: l = c(ki, { description: null }), className: u, style: d = {} }) => {
const p = Dt(), h = pe(() => c(ri, { cols: e, rowHeight: t, itemMargin: i, fields: n, className: a }), [n, e, t, i]);
return c("div", { className: R("ff-data-list-content", u), style: d, children: g.isEmpty(s) ? l : s == null ? void 0 : s.map((f, y) => c(C.Fragment, { children: o(C.cloneElement(h, { data: f }), f, y) }, `${p}-${(f == null ? void 0 : f[r]) || y}`)) });
}, Qi = ({ component: e }) => {
}, Zi = ({ component: e }) => {
const { base62params: t } = xi();
return c(K, { children: c(kt, { listCode: e, base62params: N.decode(t) }) });
}, Zi = () => "Empty", en = ({ component: e, $setting: t }) => {
}, Xi = () => "Empty", en = ({ component: e, $setting: t }) => {
const [i, n] = P();
x(() => {
if (!e) return n(c(Zi, { description: null }));
X.getWidgetComponent(e).catch((s) => ({ default: () => `${s}` })).then((s) => C.createElement(s.default, { $setting: t })).then(n);
if (!e) return n(c(Xi, { description: null }));
Q.getWidgetComponent(e).catch((s) => ({ default: () => `${s}` })).then((s) => C.createElement(s.default, { $setting: t })).then(n);
}, [e]);
const r = ue.getPageParams() || {};
return i ? C.cloneElement(i, r) : null;
};
var Ce, Q, be, ke, Je, Ke;
var Ce, Z, be, ke, Je, Ke;
const ie = class ie {
constructor() {
F(this, Q, /* @__PURE__ */ new Map());
F(this, Z, /* @__PURE__ */ new Map());
F(this, be, {});
F(this, ke, null);
k(this, "init", (t, i) => {
B(this, Q, t), B(this, be, i);
B(this, Z, t), B(this, be, i);
});
k(this, "get", (t) => (m(this, Q).has(t) || (t = Array.from(m(this, Q).keys()).find((i) => m(this, Q).get(i).uri === t)), m(this, Q).get(t) || {}));
k(this, "get", (t) => (m(this, Z).has(t) || (t = Array.from(m(this, Z).keys()).find((i) => m(this, Z).get(i).uri === t)), m(this, Z).get(t) || {}));
k(this, "redirect", (t, i, n = {}) => {
const { uri: r, type: s, widgetProps: a } = this.get(t) || {};
let o = Ei(r || t, s != "list" ? i : g.mapValues(i, (u) => N.encode(u)));
@ -424,7 +378,7 @@ const ie = class ie {
var n;
const i = (n = m(this, ke).state.matches[m(this, ke).state.matches.length - 1 - t]) == null ? void 0 : n.route;
if (!i) return null;
for (let [r, s] of m(this, Q)) if (s.uri === i.path) return s;
for (let [r, s] of m(this, Z)) if (s.uri === i.path) return s;
return null;
});
k(this, "getPageParams", (t) => {
@ -435,14 +389,14 @@ const ie = class ie {
}), t ? g.get(r, t) : r;
});
k(this, "createBrowserRouter", (t = {}) => {
if (m(this, Q).size == 0) return null;
const i = Ue.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/frameworks/BasicLayout"), n = Ue.get(X.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, s = (o, l) => () => X.getWidgetComponent(o).then((u) => u.default || function() {
if (m(this, Z).size == 0) return null;
const i = Ue.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/frameworks/BasicLayout"), n = Ue.get(Q.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, s = (o, l) => () => Q.getWidgetComponent(o).then((u) => u.default || function() {
return `${o}`;
}).then((u) => ({ Component: () => C.createElement(_t, {}, C.createElement(u, l)) })), a = Array.from(m(this, Q).values()).reduce((o, { uuid: l, uri: u, name: d, type: p, component: h, widgetSetting: f, isLogin: y, isLayout: b, extra: w }) => {
}).then((u) => ({ Component: () => C.createElement(Gt, {}, C.createElement(u, l)) })), a = Array.from(m(this, Z).values()).reduce((o, { uuid: l, uri: u, name: d, type: p, component: h, widgetSetting: f, isLogin: y, isLayout: b, extra: w }) => {
let E = {}, W = 0;
switch (p) {
case "list":
E.element = C.createElement(Qi, { component: h });
E.element = C.createElement(Zi, { component: h });
break;
case "fsdpf-component":
E.element = C.createElement(en, { key: h, component: h, $setting: f });
@ -458,9 +412,9 @@ const ie = class ie {
if (m(ie, Ce)) return m(ie, Ce);
}
};
Ce = new WeakMap(), Q = new WeakMap(), be = new WeakMap(), ke = new WeakMap(), Je = new WeakMap(), Ke = new WeakMap(), F(ie, Ce, null), k(ie, "getInstance", () => (m(ie, Ce) || B(ie, Ce, new ie()), m(ie, Ce)));
Ce = new WeakMap(), Z = new WeakMap(), be = new WeakMap(), ke = new WeakMap(), Je = new WeakMap(), Ke = new WeakMap(), F(ie, Ce, null), k(ie, "getInstance", () => (m(ie, Ce) || B(ie, Ce, new ie()), m(ie, Ce)));
let mt = ie;
const tn = ({ to: e, replace: t }) => Fi() ? C.createElement(Ri, { to: e, replace: t }) : (window.document.location = e, "redirect"), ue = mt.getInstance(), Ve = new Worker(new URL("/ff-worker/index.js", self.location)), jt = { getConfigure: (e) => Ue.get(e), route: { redirect: (...e) => ue.redirect(...e), getPageParams: (...e) => ue.getPageParams(...e), getCurrentRoute: () => ue.getCurrentRoute() }, popup: { notification: (...e) => G.notification(...e), success: (...e) => G.success(...e), error: (...e) => G.error(...e), form: (...e) => G.form(...e), modal: (...e) => G.modal(...e), confirm: (...e) => G.confirm(...e) } };
const tn = ({ to: e, replace: t }) => Fi() ? C.createElement(Ri, { to: e, replace: t }) : (window.document.location = e, "redirect"), ue = mt.getInstance(), Ve = new Worker(new URL("/ff-worker/index.js", self.location)), jt = { getConfigure: (e) => Ue.get(e), route: { redirect: (...e) => ue.redirect(...e), getPageParams: (...e) => ue.getPageParams(...e), getCurrentRoute: () => ue.getCurrentRoute() }, popup: { notification: (...e) => _.notification(...e), success: (...e) => _.success(...e), error: (...e) => _.error(...e), form: (...e) => _.form(...e), modal: (...e) => _.modal(...e), confirm: (...e) => _.confirm(...e) } };
var nt, Me, ve;
const j = class j {
constructor() {
@ -490,7 +444,7 @@ const j = class j {
};
nt = new WeakMap(), Me = new WeakMap(), ve = new WeakMap(), k(j, "mQueue", /* @__PURE__ */ new Map()), F(j, nt, 0), F(j, Me, /* @__PURE__ */ new Map()), F(j, ve, null), k(j, "getInstance", () => (m(j, ve) || B(j, ve, new j()), m(j, ve)));
let ht = j;
const Pe = ht.getInstance(), li = () => {
const Pe = ht.getInstance(), si = () => {
const e = Y(!0), [, t] = C.useReducer((i) => i + 1, 0);
return x(() => () => e.current = !1, []), () => e.current && t();
}, At = (e) => {
@ -509,26 +463,26 @@ const Pe = ht.getInstance(), li = () => {
}, t, i = g.isEqual) => {
const n = C.useRef();
i(t, n.current) || (n.current = g.cloneDeep(t)), C.useEffect(e, [n.current]);
}, nn = Ye, ci = (e, t = "string") => {
}, nn = Ye, ai = (e, t = "string") => {
var i;
if (!Array.isArray(e)) return e;
for (let n = 0; n < e.length; n++) e[n].value = g.toPrimitive((i = e[n]) == null ? void 0 : i.value, t), e[n] && Reflect.has(e[n], "children") && (e[n].children = ci(e[n].children, t));
for (let n = 0; n < e.length; n++) e[n].value = g.toPrimitive((i = e[n]) == null ? void 0 : i.value, t), e[n] && Reflect.has(e[n], "children") && (e[n].children = ai(e[n].children, t));
return e;
}, Xn = (e, t = "json", i = "string", n, r = null) => {
}, Qn = (e, t = "json", i = "string", n, r = null) => {
const [s] = re.useForm(n), [a, o] = P([{ label: "无", value: "", disabled: !0 }]), l = Y([]), u = re.useWatch((d) => l.current.length === 0 ? null : g.pick(d, l.current), s) || null;
return x(() => {
Array.isArray(e) ? o(e) : t === "javascript" && e ? Pe.exec(e, {}, { getFieldValue: (d) => (l.current.includes(d) || l.current.push(d), s.getFieldValue(d)), getFieldValueForBasicForm: (d) => (l.current.includes(d) || l.current.push(d), r ? r.getFieldValue(d) : s.getFieldValue(d)) }).then((d) => {
o(g.toPrimitive(d, "array"));
}) : e && o(g.toPrimitive(e, "array"));
}, [e, t, u]), ci(a, i);
}, Qn = (e) => {
}, [e, t, u]), ai(a, i);
}, Zn = (e) => {
const [t, i] = P(), n = { type: "GET" };
if (typeof e == "string" ? n.url = e : g.isPlainObject(e) && Object.assign(n, e), !(n != null && n.url)) throw "url is required";
const r = (s) => N.request(n, !1).resp((a) => (console.log("useSubscribeRequest", s), i(a), a));
return Ye(() => {
let s = null;
return r().then((a) => {
s = Zt.subscribe(g.throttle(r, 180, { leading: !1, trailing: !0 }), a.res);
s = Yt.subscribe(g.throttle(r, 180, { leading: !1, trailing: !0 }), a.res);
}), () => s == null ? void 0 : s();
}, n), t;
}, rn = (e) => {
@ -582,7 +536,7 @@ const Pe = ht.getInstance(), li = () => {
});
}, [e, t, i]), n;
}, on = (e, t, i, n = {}) => {
const r = li(), s = Y(!0), a = Y([]), [o, l] = P(i), u = re.useWatch((d) => JSON.stringify(g.pick(d, a.current)), t) || "{}";
const r = si(), s = Y(!0), a = Y([]), [o, l] = P(i), u = re.useWatch((d) => JSON.stringify(g.pick(d, a.current)), t) || "{}";
return x(() => {
e && Pe.exec(e, n, { getFieldValue: g.wrap(t.getFieldValue, (d, p) => (a.current.some((h) => g.isEqual(h, p)) || (a.current.push(p), r()), d(p))), isFieldTouched: t.isFieldTouched, isFieldsTouched: t.isFieldsTouched }).then((d) => s.current && l(d));
}, [e, u, t, n]), x(() => () => s.current = !1, []), o;
@ -594,23 +548,23 @@ const Pe = ht.getInstance(), li = () => {
}, cn = ({ widget: e = "Input", widgetPrefix: t = "@pkg/grid-layout-forms", widgetDecorator: i, subWidgets: n, basicForm: r, ...s }) => {
const a = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [o, l] = P();
return x(() => {
a && X.getWidgetComponent(a).then(({ defaultProps: u = {}, default: d }) => ({ default: di(d, u, r) })).catch((u) => ({ default: () => `${u}` })).then((u) => l(C.createElement(u.default, s)));
a && Q.getWidgetComponent(a).then(({ defaultProps: u = {}, default: d }) => ({ default: oi(d, u, r) })).catch((u) => ({ default: () => `${u}` })).then((u) => l(C.createElement(u.default, s)));
}, [a]), o && C.cloneElement(o, s);
}, di = (e, t = {}, i = null) => (n) => {
const { type: r, code: s, label: a, noStyle: o, placeholder: l, extras: u, validators: d, help: p, isVirtual: h, $isReserved: f, initialValue: y, initialValueLanguage: b, convertJs: w, convertJsSetting: E, widgetPerfix: W, boxStyle: q, widgetDecorator: D, subWidgets: H, ...A } = { ...t, ...n }, M = sn(d || {}, s, r), I = { label: a, noStyle: o, colon: !1, layout: "vertical" }, z = { placeholder: l, ...A }, _ = ge((V) => V == null ? void 0 : g.toPrimitive(V, r), [r]);
return c(qt, { name: s, rules: M, initialValue: _(y), normalize: _, children: (V, v, se) => {
}, oi = (e, t = {}, i = null) => (n) => {
const { type: r, code: s, label: a, noStyle: o, placeholder: l, extras: u, validators: d, help: p, isVirtual: h, $isReserved: f, initialValue: y, initialValueLanguage: b, convertJs: w, convertJsSetting: E, widgetPerfix: W, boxStyle: q, widgetDecorator: D, subWidgets: H, ...A } = { ...t, ...n }, M = sn(d || {}, s, r), I = { label: a, noStyle: o, colon: !1, layout: "vertical" }, z = { placeholder: l, ...A }, G = ge((V) => V == null ? void 0 : g.toPrimitive(V, r), [r]);
return c(qt, { name: s, rules: M, initialValue: G(y), normalize: G, children: (V, v, se) => {
var O;
return c(e, { type: r, rcform: se, itemProps: { validateStatus: v.errors.length > 0 ? "error" : "success", tooltip: p, help: v.errors.length > 0 ? v.errors.join("、") : null, required: ((O = M == null ? void 0 : M[0]) == null ? void 0 : O.required) || !1, ...I }, fieldProps: { ...z, ...V }, $setting: u || {} });
} });
}, St = ({ cols: e = 24, rowHeight: t = 16, itemMargin: i = [8, 16], containerPadding: n = [0, 0], fields: r = [], children: s, basicForm: a = null }) => {
const o = ai(r, di, "@pkg/grid-layout-forms");
const o = ni(r, oi, "@pkg/grid-layout-forms");
return $("div", { className: "ff-grid-layout-form", style: { "--grid-layout-item-margin-x": `${(i == null ? void 0 : i[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(i == null ? void 0 : i[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: [o, s && C.cloneElement(s, { cols: e, rowHeight: t, itemMargin: i, containerPadding: n, fields: r })] });
};
St.propTypes = { fields: L.array };
const dn = (It = St, ({ code: e, layout: t, name: i, primaryKey: n = 0, style: r = {}, formProps: s = {}, form: a, isPreview: o = !1, className: l, onFinish: u, onValuesChange: d = () => {
}, ...p }) => {
const { align: h, autoComplete: f, resource: y, items: b, hides: w, rowHeight: E, marginX: W, marginY: q, cols: D, listenChangeFields: H, listenChangeFieldsFunc: A, pk: M, uuid: I } = rn(e), [z] = re.useForm(a), _ = pe(() => [{ name: "__PK__", value: M }, { name: "__PROPS__", value: s }, { name: "__RESOURCE__", value: y }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: I }, { name: "__PRIMARY_KEY__", value: n }], [M, e, I, y, n, s]);
return $(re, { className: l, name: i || e, layout: t || h, fields: _, form: z, autoComplete: f, style: { ...r, position: "relative" }, onFinish: u, onValuesChange: (V, v) => (({ changedValues: se, allValues: O, listenChangeFields: me, listenChangeFieldsFunc: $e, onValuesChange: rt, code: T }) => {
const { align: h, autoComplete: f, resource: y, items: b, hides: w, rowHeight: E, marginX: W, marginY: q, cols: D, listenChangeFields: H, listenChangeFieldsFunc: A, pk: M, uuid: I } = rn(e), [z] = re.useForm(a), G = pe(() => [{ name: "__PK__", value: M }, { name: "__PROPS__", value: s }, { name: "__RESOURCE__", value: y }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: I }, { name: "__PRIMARY_KEY__", value: n }], [M, e, I, y, n, s]);
return $(re, { className: l, name: i || e, layout: t || h, fields: G, form: z, autoComplete: f, style: { ...r, position: "relative" }, onFinish: u, onValuesChange: (V, v) => (({ changedValues: se, allValues: O, listenChangeFields: me, listenChangeFieldsFunc: $e, onValuesChange: rt, code: T }) => {
rt(se, O), $e && Array.isArray(me) && Pe.exec($e, { changedValues: se, allValues: O }, { getFieldValue: z.getFieldValue, setFieldValue: z.setFieldValue, setFieldsValue: z.setFieldsValue, isFieldTouched: z.isFieldTouched, isFieldsTouched: z.isFieldsTouched });
})({ changedValues: V, allValues: v, listenChangeFields: H, listenChangeFieldsFunc: A, onValuesChange: d, code: e }), children: [c(It, { ...p, form: z, code: e, fields: b, cols: D, rowHeight: E, itemMargin: [W, q] }), w == null ? void 0 : w.map((V) => {
var v;
@ -618,21 +572,67 @@ const dn = (It = St, ({ code: e, layout: t, name: i, primaryKey: n = 0, style: r
})] }, e);
});
var It;
const ui = ({ $setting: e, $close: t, extras: i, code: n, primaryKey: r, ...s }) => {
const li = ({ $setting: e, $close: t, extras: i, code: n, primaryKey: r, ...s }) => {
const [a] = re.useForm(), o = an(n, r, e);
return x(() => {
o && a.setFieldsValue(o);
}, [o]), c(K, { actions: $(C.Fragment, { children: [c(S, { name: "保存", type: "primary", widget: () => {
const l = a.getFieldValue("__RESOURCE__"), { initDataUri: u = `/api/${n}` } = e || {};
a.validateFields(!0).then((d) => l ? g.pick(d, [l]) : d).then((d) => N.post(r ? `${u}/${r}` : `${u}`, d).msg(t)).catch(() => G.error("请先完善表单信息", { duration: 2e3 }));
a.validateFields(!0).then((d) => l ? g.pick(d, [l]) : d).then((d) => N.post(r ? `${u}/${r}` : `${u}`, d).msg(t)).catch(() => _.error("请先完善表单信息", { duration: 2e3 }));
} }), c(S, { name: "取消", widget: () => t(!1) })] }), extras: i, children: c(dn, { form: a, code: n, primaryKey: r, ...s }) });
}, un = (e, t, i, { isReplaceRouteHistory: n = !1 } = {}) => ue.redirect(i, t, { replace: n }), Mt = (e, t, i, { status: { loading: n, disabled: r }, setStatus: s }) => {
}, ci = (e = {}, t = {}, i = {}, n = "") => g.deepSome(e, (r, s) => s === "type" && r === "code") ? di(e, t, i, n) : ui(e, t, n), di = async (e = {}, t = {}, i = {}, n = "") => {
let r = /* @__PURE__ */ Object.create(null);
for (let s in e) {
let a;
if (Reflect.has(e[s], "type") && ["code", "field", "router", "query", "string"].includes(e[s].type)) {
const { type: o, value: l = "", default: u = n } = e[s];
switch (o) {
case "code":
a = await Pe.exec(l, t, i);
break;
case "field":
a = g.get(t, l) ?? g.get(t, l.substring(l.indexOf(".") + 1));
break;
case "router":
case "query":
a = ue.getPageParams(l);
break;
case "string":
a = l;
}
a ?? (a = u);
} else a = await di(e[s], t, i, n);
g.set(r, s, a);
}
return r;
}, ui = (e = {}, t = {}, i = "") => Object.keys(e || {}).reduce((n, r) => {
if (g.isPlainObject(e[r])) {
let s;
if (Reflect.has(e[r], "type") && ["field", "router", "query", "string"].includes(e[r].type)) {
const { type: a, value: o = "", default: l = i } = e[r];
switch (a) {
case "field":
s = g.get(t, o) ?? g.get(t, o.substring(o.indexOf(".") + 1));
break;
case "router":
case "query":
s = ue.getPageParams(o);
break;
case "string":
s = o;
}
s ?? (s = l);
} else s = ui(e[r], t, i);
g.set(n, r, s);
}
return n;
}, {}), un = (e, t, i, { isReplaceRouteHistory: n = !1 } = {}) => ue.redirect(i, t, { replace: n }), Mt = (e, t, i, { status: { loading: n, disabled: r }, setStatus: s }) => {
const a = { loading: (o) => o === void 0 ? n : s((l) => ({ ...l, loading: o })), disabled: (o) => o === void 0 ? r : s((l) => ({ ...l, disabled: o })) };
return g.isFunction(i) ? i.call(null, { ...t, ...a }) : g.isString(i) && i ? Pe.exec(i, t, a) : null;
}, zt = (e, t, i, n, r) => g.isString(i) && i ? X.getWidgetComponent(i).then(({ default: s }) => G.modal(s, { ...t, $setting: n }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r)).catch((s) => {
G.error(i, { content: s.toString() });
}) : G.modal(i, { ...t, $setting: n }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), gn = (e, t, i, n, r) => G.modal(ui, { ...t, $setting: n, code: i }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), pn = (e, t, i, n, r) => G.modal(kt, { base62params: t, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), mn = ({ widget: e, widgetType: t, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: s }, { onAfterClick: a, onBeforeClick: o }) => {
const l = _e(Le), [u, d] = P({ leading: !0, trailing: !1 }), p = pe(() => {
}, zt = (e, t, i, n, r) => g.isString(i) && i ? Q.getWidgetComponent(i).then(({ default: s }) => _.modal(s, { ...t, $setting: n }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r)).catch((s) => {
_.error(i, { content: s.toString() });
}) : _.modal(i, { ...t, $setting: n }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), gn = (e, t, i, n, r) => _.modal(li, { ...t, $setting: n, code: i }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), pn = (e, t, i, n, r) => _.modal(kt, { base62params: t, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: g.template(r.title)(e) } : r), mn = ({ widget: e, widgetType: t, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: s }, { onAfterClick: a, onBeforeClick: o }) => {
const l = Ge(Le), [u, d] = P({ leading: !0, trailing: !1 }), p = pe(() => {
switch (t) {
case "redirect":
return g.partialRight(un, e, r);
@ -650,7 +650,7 @@ const ui = ({ $setting: e, $close: t, extras: i, code: n, primaryKey: r, ...s })
}
return (...h) => console.error("useButton unknown widgetType", t, ...h);
}, [e, t]);
return [g.debounce((h) => (o == null || o(h), Promise.resolve(Yt(n, h, { list: l })).then((f) => p(h, { ...i, ...f })).then((f) => a == null ? void 0 : a(f)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u];
return [g.debounce((h) => (o == null || o(h), Promise.resolve(ci(n, h, { list: l })).then((f) => p(h, { ...i, ...f })).then((f) => a == null ? void 0 : a(f)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u];
}, Wt = /* @__PURE__ */ new Set(), ft = (e = [], t = 0) => {
const i = e[t];
if (i.length && !Wt.has(i)) {
@ -663,26 +663,26 @@ const ui = ({ $setting: e, $close: t, extras: i, code: n, primaryKey: r, ...s })
}
}, yt = ({ className: e, type: t, style: i = {}, ...n }) => c("span", { role: "img", className: R("ff-iconfont", e), style: i, ...n, children: c("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: c("use", { xlinkHref: `#${t}` }) }) });
yt.propTypes = { className: L.string, type: L.string.isRequired, style: L.object }, yt.init = ft;
const Xe = (e) => function({ className: t, children: i, name: n, icon: r, type: s = "default", iconPosition: a = "start", noAuthType: o, onAfterClick: l, onBeforeClick: u, data: d, loading: p, disabled: h, tooltip: f, popConfirm: y, widget: b, widgetType: w, widgetData: E, widgetProps: W, widgetSetting: q, widgetContainerProps: D, ...H }) {
const Qe = (e) => function({ className: t, children: i, name: n, icon: r, type: s = "default", iconPosition: a = "start", noAuthType: o, onAfterClick: l, onBeforeClick: u, data: d, loading: p, disabled: h, tooltip: f, popConfirm: y, widget: b, widgetType: w, widgetData: E, widgetProps: W, widgetSetting: q, widgetContainerProps: D, ...H }) {
const A = { type: "primary", className: R("ff-button", t), iconPosition: a };
s === "danger" ? A.danger = !0 : s === "default" && (A.type = s), e === "link" || e === "dashed" ? (A.type = e, s === "default" && (A.className = R(A.className, "ff-default"))) : e !== "circle" && e !== "round" || (A.shape = e), r && (A.icon = c(yt, { type: r }));
const [M, I] = P(!1), [z, { disabled: _, loading: V }] = mn({ widget: b, widgetType: w, widgetData: E, widgetProps: W, widgetSetting: q, widgetContainerProps: D }, { onAfterClick: l, onBeforeClick: u });
return c(vi, { okText: "确定", cancelText: "取消", ...y || {}, disabled: _ || h, open: M, onOpenChange: (v) => {
const [M, I] = P(!1), [z, { disabled: G, loading: V }] = mn({ widget: b, widgetType: w, widgetData: E, widgetProps: W, widgetSetting: q, widgetContainerProps: D }, { onAfterClick: l, onBeforeClick: u });
return c(vi, { okText: "确定", cancelText: "取消", ...y || {}, disabled: G || h, open: M, onOpenChange: (v) => {
if (!v) return I(v);
y ? I(v) : z(d);
}, onConfirm: () => {
z(d);
}, onClick: (v) => {
v.stopPropagation();
}, children: c(Si, { ...f, title: M ? null : f == null ? void 0 : f.title, trigger: ["hover", "click"], children: c(lt, { loading: V || p, disabled: _ || h, ...A, ...H, children: i || n }) }) });
}, S = Xe("default"), hn = Xe("link"), fn = Xe("circle"), yn = Xe("round"), wn = Xe("dashed"), Bt = ({ data: e, widget: t, widgetType: i = "fsdpf-component", children: n, widgetData: r, widgetProps: s, widgetSetting: a, widgetContainerProps: o }) => {
const l = _e(Le), [u, d] = P(!1), [p, h] = P("hover"), [f, y] = P({}), [b, w] = P(), { placement: E, align: W, arrow: q = { pointAtCenter: !0 }, getPopupContainer: D, ...H } = o || {};
}, children: c(Si, { ...f, title: M ? null : f == null ? void 0 : f.title, trigger: ["hover", "click"], children: c(lt, { loading: V || p, disabled: G || h, ...A, ...H, children: i || n }) }) });
}, S = Qe("default"), hn = Qe("link"), fn = Qe("circle"), yn = Qe("round"), wn = Qe("dashed"), Bt = ({ data: e, widget: t, widgetType: i = "fsdpf-component", children: n, widgetData: r, widgetProps: s, widgetSetting: a, widgetContainerProps: o }) => {
const l = Ge(Le), [u, d] = P(!1), [p, h] = P("hover"), [f, y] = P({}), [b, w] = P(), { placement: E, align: W, arrow: q = { pointAtCenter: !0 }, getPopupContainer: D, ...H } = o || {};
x(() => {
i == "grid-layout-form" ? w(C.createElement(ui, { ...r, $setting: a, code: t })) : i == "data-list" ? w(C.createElement(kt, { base62params: e, $setting: a, listCode: t })) : g.isString(t) ? X.getWidgetComponent(t).then(({ default: I }) => {
i == "grid-layout-form" ? w(C.createElement(li, { ...r, $setting: a, code: t })) : i == "data-list" ? w(C.createElement(kt, { base62params: e, $setting: a, listCode: t })) : g.isString(t) ? Q.getWidgetComponent(t).then(({ default: I }) => {
w(C.createElement(I, { ...r, $setting: a }));
}).catch((I) => w(I.toString())) : $t(t) ? w(C.createElement(t, { ...r, $setting: a })) : C.isValidElement(t) && w(C.cloneElement(t, { ...r, $setting: a }));
}, [t, i, r]), x(() => {
Promise.resolve(Yt(s, e, { list: l })).then(y);
Promise.resolve(ci(s, e, { list: l })).then(y);
}, [s, e]);
const A = (I) => {
d(I), !I && h("hover");
@ -692,7 +692,7 @@ const Xe = (e) => function({ className: t, children: i, name: n, icon: r, type:
return c(Pi, { zIndex: 1080, placement: E, onPopupClick: M, onClick: M, open: u, align: W, arrow: q, trigger: p, getPopupContainer: D, content: c(Cn, { ...H, children: b && C.cloneElement(b, { ...f, $close: () => A(!1) }) }), children: n, onOpenChange: A });
}, Cn = ({ title: e, className: t, children: i, width: n, height: r, ...s }) => {
const [a, o] = P({}), l = ge((p, h) => o((f) => ({ ...f, [p]: h })), []), u = ge((p) => o((h) => ({ ...h, [p]: void 0 })), []), d = e ? C.createElement("div", { className: "ff-popup-title" }, e) : a == null ? void 0 : a.title;
return c(Ge.Provider, { value: { ele: a, mount: l, unmount: u }, children: $("div", { className: R("ff-popup ff-popover", t), style: { width: n, height: r }, ...s, children: [$("div", { className: "ff-popup-header", children: [d, a == null ? void 0 : a["sub-title"]] }), i, $("div", { className: "ff-popup-footer", children: [a == null ? void 0 : a.extras, a == null ? void 0 : a.actions] })] }) });
return c(_e.Provider, { value: { ele: a, mount: l, unmount: u }, children: $("div", { className: R("ff-popup ff-popover", t), style: { width: n, height: r }, ...s, children: [$("div", { className: "ff-popup-header", children: [d, a == null ? void 0 : a["sub-title"]] }), i, $("div", { className: "ff-popup-footer", children: [a == null ? void 0 : a.extras, a == null ? void 0 : a.actions] })] }) });
};
Bt.propTypes = { widgetType: L.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }, S.propTypes = { type: L.oneOf(["primary", "default", "danger", ""]), name: L.string, icon: L.string, iconPosition: L.oneOf(["start", "end"]), data: L.any, widget: L.any, widgetType: L.oneOf(["destroy", "redirect", "func", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: L.object, widgetProps: L.object, widgetSetting: L.object, widgetContainerProps: L.object }, S.Link = hn, S.Link.defaultProps = S.defaultProps, S.Link.propTypes = S.propTypes, S.Circle = fn, S.Circle.defaultProps = S.defaultProps, S.Circle.propTypes = S.propTypes, S.Round = yn, S.Round.defaultProps = S.defaultProps, S.Round.propTypes = S.propTypes, S.Dashed = wn, S.Dashed.defaultProps = S.defaultProps, S.Dashed.propTypes = S.propTypes, S.Popover = Bt;
const bn = ({ fields: e, formProps: t, $close: i }) => {
@ -707,7 +707,7 @@ const bn = ({ fields: e, formProps: t, $close: i }) => {
const f = () => {
t(!1);
};
return c(Ge.Provider, { value: { ele: a, mount: d, unmount: p }, children: e && e !== "center" ? c(kn, { ...h, placement: e, open: l, afterOpenChange: (y) => !y && f() }) : c(vn, { ...h, visible: l, afterClose: f }) });
return c(_e.Provider, { value: { ele: a, mount: d, unmount: p }, children: e && e !== "center" ? c(kn, { ...h, placement: e, open: l, afterOpenChange: (y) => !y && f() }) : c(vn, { ...h, visible: l, afterClose: f }) });
};
gi.propTypes = { placement: L.oneOf(["center", "left", "top", "right", "bottom"]) };
const J = () => {
@ -722,7 +722,7 @@ const J = () => {
}, []);
const n = (s, a = {}, o = {}) => new Promise((l, u) => r([l, u], s, a, o)), r = ([s, a], o, l = {}, u = {}) => {
const d = J.$index++, p = (h) => ((f, y) => (J.$popups.delete(f), i(), y == null ? void 0 : y()))(d, () => s(h));
if (o === Gt) return e.open({ ...u, key: d, content: C.createElement(o, { ...l, $close: () => e.close(d) }) });
if (o === _t) return e.open({ ...u, key: d, content: C.createElement(o, { ...l, $close: () => e.close(d) }) });
J.$popups.set(d, C.createElement(gi, { zIndex: d, maskClosable: !1, $event: l == null ? void 0 : l.$event, ...u, key: d, $close: p }, C.isValidElement(o) ? C.cloneElement(o, { ...l, $close: p }) : o != null && o.name || Tt.isForwardRef(o) || (o == null ? void 0 : o.$$typeof) === Tt.ForwardRef ? C.createElement(o, { ...l, $close: p }) : o)), i();
};
return $(C.Fragment, { children: [Array.from(J.$popups).map(([s, a]) => a), t] });
@ -730,7 +730,7 @@ const J = () => {
J.$popups = /* @__PURE__ */ new Map(), J.$index = 0, J.$queue = [], J.$onClick = (...e) => new Promise((t, i) => {
J.$queue.push([e, t, i]);
});
const Ut = (e, t, i = {}) => J.$onClick(e, t, i), at = (e, { showProgress: t, duration: i, ...n } = { duration: 1.5 }) => J.$onClick(Gt, { content: e, ...n }, { showProgress: t, duration: i }), G = { modal: Ut, confirm: (e, t = {}) => J.$onClick(Ai, { content: e, ...t }, { placement: "center" }), form: (e, t = {}, i = {}) => Ut(bn, { formProps: i, fields: e }, { placement: "center", ...t }).then((n) => {
const Ut = (e, t, i = {}) => J.$onClick(e, t, i), at = (e, { showProgress: t, duration: i, ...n } = { duration: 1.5 }) => J.$onClick(_t, { content: e, ...n }, { showProgress: t, duration: i }), _ = { modal: Ut, confirm: (e, t = {}) => J.$onClick(Ai, { content: e, ...t }, { placement: "center" }), form: (e, t = {}, i = {}) => Ut(bn, { formProps: i, fields: e }, { placement: "center", ...t }).then((n) => {
if (n === !1) throw !1;
return n;
}), notification: at, success: (e, t = { duration: 1.5 }) => at(e, { ...t, className: "ff-notification-success", icon: "check" }), error: (e, t = { duration: 1.5 }) => at(e, { ...t, className: "ff-notification-error", icon: "close" }) };
@ -740,7 +740,7 @@ We.configure({ showSpinner: !1 }), Be.interceptors.request.use((e) => {
return e.headers.Authorization = t ? `Bearer ${t} ` : void 0, We.inc(), e;
}, (e) => (We.done(), Promise.reject({ code: -1, msg: e }))), Be.interceptors.response.use(({ data: e, headers: t }) => (We.done(), { ...e, res: t == null ? void 0 : t.res }), function(e) {
return We.done(), Promise.reject(e.message);
}), window.addEventListener("unhandledrejection", ct.onUnhandledRejection), ct.onMsg = (e, t) => G[[0, 1].includes(e) ? "success" : "error"](t).then(() => e === 20300 && ue.redirect(Ue.get("Common.WEBSITE_LOGIN_PAGE")));
}), window.addEventListener("unhandledrejection", ct.onUnhandledRejection), ct.onMsg = (e, t) => _[[0, 1].includes(e) ? "success" : "error"](t).then(() => e === 20300 && ue.redirect(Ue.get("Common.WEBSITE_LOGIN_PAGE")));
const wt = { appUrl: "", init: (e, t, i) => {
wt.appUrl = i, Be.defaults.baseURL = i, Be.defaults.timeout = 15e3, Object.assign(wt, new ct(e, t, Be));
} }, N = wt;
@ -823,7 +823,7 @@ const ne = class ne {
};
Se = new WeakMap(), ze = new WeakMap(), F(ne, Se, null), k(ne, "getInstance", () => (m(ne, Se) || B(ne, Se, new ne()), m(ne, Se)));
let Ct = ne;
const X = Ct.getInstance(), Sn = C.createContext({ user: {}, initUser: () => {
const Q = Ct.getInstance(), Sn = C.createContext({ user: {}, initUser: () => {
}, initUserComplete: !1 }), Pn = C.createContext({ set: () => {
}, get: () => {
}, assign: () => {
@ -832,7 +832,7 @@ const X = Ct.getInstance(), Sn = C.createContext({ user: {}, initUser: () => {
if (!e || typeof window > "u") return;
let i = document.querySelector(`style[ff-style-token="${t}"]`);
return i ? (i.innerHTML = e, e) : (i = document.createElement("style"), i.setAttribute("ff-style-token", t), i.setAttribute("type", "text/css"), i.innerHTML = e, document.head.appendChild(i), e);
}, Nn = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Sn, AppGlobalParamsContext: Pn, cache: Kt, configure: Ue, default: X, func: Pe, http: N, insertStyle: $n, isReactComponent: $t, route: ue }, Symbol.toStringTag, { value: "Module" })), xn = (e, t, i = "children") => {
}, Nn = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Sn, AppGlobalParamsContext: Pn, cache: Kt, configure: Ue, default: Q, func: Pe, http: N, insertStyle: $n, isReactComponent: $t, route: ue }, Symbol.toStringTag, { value: "Module" })), xn = (e, t, i = "children") => {
if (g.isEmpty(e)) return {};
const n = g.find(e, ["value", t]);
if (!g.isEmpty(n)) return n;
@ -844,56 +844,57 @@ const X = Ct.getInstance(), Sn = C.createContext({ user: {}, initUser: () => {
return {};
};
export {
$t as $,
Xn as A,
Qn as B,
Q as $,
Qn as A,
Zn as B,
dn as C,
Di as D,
St as E,
cn as F,
_n as G,
Gn as G,
Ki as H,
ui as I,
li as I,
rn as J,
sn as K,
an as L,
on as M,
yt as N,
S as O,
Ii as P,
mn as Q,
Zt as R,
K as S,
Ge as T,
_t as U,
J as V,
G as W,
Dn as X,
qn as Y,
Hn as Z,
X as _,
ri as a,
$n as a0,
N as a1,
Kt as a2,
Ue as a3,
Pe as a4,
ue as a5,
Sn as a6,
Pn as a7,
xn as a8,
oi as b,
Gn as c,
ai as d,
ci as N,
yt as O,
S as P,
Ii as Q,
Yt as R,
mn as S,
K as T,
_e as U,
Gt as V,
J as W,
_ as X,
Dn as Y,
qn as Z,
Hn as _,
ti as a,
$t as a0,
$n as a1,
N as a2,
Kt as a3,
Ue as a4,
Pe as a5,
ue as a6,
Sn as a7,
Pn as a8,
xn as a9,
ri as b,
_n as c,
ni as d,
vt as e,
ti as f,
ei as g,
ii as h,
ni as i,
Zt as f,
Qt as g,
Xt as h,
ei as i,
kt as j,
Le as k,
Ji as l,
Xi as m,
Qi as m,
Wi as n,
Ui as o,
Mi as p,
@ -901,8 +902,8 @@ export {
Jn as r,
Kn as s,
gt as t,
si as u,
li as v,
ii as u,
si as v,
At as w,
Yn as x,
Ye as y,

2
dist/components.js vendored
View File

@ -1,4 +1,4 @@
import { X as s, N as p, Y as n, Z as t, W as d } from "./common/main-CcbZvxSB.js";
import { Y as s, O as p, Z as n, _ as t, X as d } from "./common/main-hocekuUg.js";
export {
s as Empty,
p as Icon,

2
dist/container.js vendored
View File

@ -1,4 +1,4 @@
import { T as o, X as s, Y as p, Z as t, U as d, W as n, V as r, S as u } from "./common/main-CcbZvxSB.js";
import { U as o, Y as s, Z as p, _ as t, V as d, X as n, W as r, T as u } from "./common/main-hocekuUg.js";
export {
o as Context,
s as Empty,

2
dist/data-list.js vendored
View File

@ -1,4 +1,4 @@
import { m as s, k as e, e as r, i, n as o, j as D, h as l, l as u, f as L, o as n, D as d, p as m, q as F, s as p, t as C, r as b } from "./common/main-CcbZvxSB.js";
import { m as s, k as e, e as r, i, n as o, j as D, h as l, l as u, f as L, o as n, D as d, p as m, q as F, s as p, t as C, r as b } from "./common/main-hocekuUg.js";
export {
s as DataListContent,
e as DataListContext,

View File

@ -1,5 +1,5 @@
import "lodash";
import { a as t } from "../common/main-CcbZvxSB.js";
import { a as t } from "../common/main-hocekuUg.js";
export {
t as getDefaultExpandRowKeys
};

View File

@ -1,4 +1,4 @@
import { E as r, I as u, F as e, C as o, M as t, L as F, K as d, J as m } from "./common/main-CcbZvxSB.js";
import { E as r, I as u, F as e, C as o, M as t, L as F, K as d, J as m } from "./common/main-hocekuUg.js";
export {
r as GridLayoutForm,
u as GridLayoutFormHelper,

View File

@ -1,5 +1,5 @@
import "lodash";
import { a8 as a } from "../common/main-CcbZvxSB.js";
import { a9 as a } from "../common/main-hocekuUg.js";
export {
a as getOptionItemByValue
};

2
dist/grid-layout.js vendored
View File

@ -1,4 +1,4 @@
import { b as d, c as e, H as u, G as i, u as t, d as o } from "./common/main-CcbZvxSB.js";
import { b as d, c as e, H as u, G as i, u as t, d as o } from "./common/main-hocekuUg.js";
export {
d as GridLayout,
e as GridLayoutWidget,

View File

@ -1,4 +1,4 @@
import { g as t } from "../common/main-CcbZvxSB.js";
import { g as t } from "../common/main-hocekuUg.js";
export {
t as getBoxStyle
};

2
dist/hooks.js vendored
View File

@ -1,7 +1,7 @@
import "lodash";
import "rc-field-form";
import "react";
import { z as r, y as o, A as p, w as i, x as f, B as m, v as c } from "./common/main-CcbZvxSB.js";
import { z as r, y as o, A as p, w as i, x as f, B as m, v as c } from "./common/main-hocekuUg.js";
import { _ as l } from "./common/vender-egxe712p.js";
export {
r as useDeepEffect,

2
dist/iconfont.js vendored
View File

@ -2,7 +2,7 @@ import "react/jsx-runtime";
import "react";
import "prop-types";
import "classnames";
import { N as a } from "./common/main-CcbZvxSB.js";
import { O as a } from "./common/main-hocekuUg.js";
export {
a as default
};

2
dist/index.js vendored
View File

@ -1,4 +1,4 @@
import { a6 as t, a7 as e, a2 as o, a3 as n, _ as p, a4 as r, a1 as c, a0 as f, $ as l, a5 as u } from "./common/main-CcbZvxSB.js";
import { a7 as t, a8 as e, a3 as o, a4 as n, $ as p, a5 as r, a2 as c, a1 as f, a0 as l, a6 as u } from "./common/main-hocekuUg.js";
export {
t as AppContext,
e as AppGlobalParamsContext,

2
dist/res-ws.js vendored
View File

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

5
dist/utils.js vendored Normal file
View File

@ -0,0 +1,5 @@
import "lodash";
import { N as a } from "./common/main-hocekuUg.js";
export {
a as getWidgetPropsData
};

View File

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