This commit is contained in:
what 2024-12-02 17:31:31 +08:00
parent b8e5552f94
commit 2140e73a44
17 changed files with 144 additions and 144 deletions

2
dist/button.js vendored
View File

@ -1,4 +1,4 @@
import { W as s, V as u, X as e } from "./common/main-DgiG2gXc.js";
import { W as s, V as u, X as e } from "./common/main-BKsu5-u9.js";
import "prop-types";
export {
s as auth,

View File

@ -13,7 +13,7 @@ var Ot = (e, t, a, n) => ({
return g(e, t, n);
}
});
import { jsx as c, jsxs as T } from "react/jsx-runtime";
import { jsx as d, jsxs as T } from "react/jsx-runtime";
import C, { useEffect as x, useState as N, useCallback as ce, useMemo as Z, useRef as q, useContext as Ue, useId as Ye, useLayoutEffect as Sa } from "react";
import p from "lodash";
import Ht from "immutability-helper";
@ -60,22 +60,22 @@ class Kt {
}
}
Ne = new WeakMap(), Ae = new WeakMap(), Pe = new WeakMap(), ie = new WeakMap(), Ce = new WeakMap(), be = new WeakMap();
const Xn = () => c("div", { children: "Empty" }), Be = C.createContext({ ele: {}, mount: () => {
const Xn = () => d("div", { children: "Empty" }), Be = C.createContext({ ele: {}, mount: () => {
}, unmount: () => {
} }), K = ({ rootClassName: e, className: t, children: a, actions: n, title: r, subTitle: s, extras: i, style: o = {} }) => {
const { mount: l, unmount: u } = C.useContext(Be);
return n && K.Action({ children: n }), r && K.Title({ children: r }), s && K.SubTitle({ children: s }), i && K.Extra({ children: i }), x(() => (l("rootClassName", e), () => u(e)), [e]), c("div", { className: F("ff-container", t), style: o, children: a });
const { mount: l, unmount: c } = C.useContext(Be);
return n && K.Action({ children: n }), r && K.Title({ children: r }), s && K.SubTitle({ children: s }), i && K.Extra({ children: i }), x(() => (l("rootClassName", e), () => c(e)), [e]), d("div", { className: F("ff-container", t), style: o, children: a });
}, Ke = (e) => ({ children: t, className: a }) => {
const { mount: n, unmount: r } = C.useContext(Be);
return x(() => (n(e, C.createElement("div", { key: `ff-${e}`, className: F(`ff-popup-${e}`, a) }, t)), () => r(e)), [a, t]), null;
};
K.Action = Ke("actions"), K.Title = Ke("title"), K.SubTitle = Ke("sub-title"), K.Extra = Ke("extras"), K.propTypes = { className: L.string, style: L.object, title: L.any, subTitle: L.any, actions: L.any, extras: L.any };
const Zn = () => c(K, { className: "ff-loading", children: T("div", { className: "loader", children: [T("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), T("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), T("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] }), T("div", { className: "square", children: [c("span", {}), c("span", {}), c("span", {})] })] }) }), er = () => c("div", { children: "NotFound" }), _t = ({ children: e }) => {
const Zn = () => d(K, { className: "ff-loading", children: T("div", { className: "loader", children: [T("div", { className: "square", children: [d("span", {}), d("span", {}), d("span", {})] }), T("div", { className: "square", children: [d("span", {}), d("span", {}), d("span", {})] }), T("div", { className: "square", children: [d("span", {}), d("span", {}), d("span", {})] }), T("div", { className: "square", children: [d("span", {}), d("span", {}), d("span", {})] })] }) }), er = () => d("div", { children: "NotFound" }), _t = ({ children: e }) => {
const [t, a] = N({}), n = ce((s, i) => a((o) => ({ ...o, [s]: i })), []), r = ce((s) => a((i) => ({ ...i, [s]: void 0 })), []);
return typeof (e == null ? void 0 : e.type) == "string" ? e : c(Be.Provider, { value: { ele: t, mount: n, unmount: r }, children: C.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) });
return typeof (e == null ? void 0 : e.type) == "string" ? e : d(Be.Provider, { value: { ele: t, mount: n, unmount: r }, children: C.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) });
};
_t.propTypes = { children: L.element.isRequired };
const Vt = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, bt = ({ type: e, props: t }) => c("i", { ...t, children: c("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Vt[e] || Vt.info).map((a, n) => c("path", { d: a }, n)) }) }), Gt = ({ className: e, content: t, icon: a, $close: n }) => T(C.Fragment, { children: [a && c("div", { className: F("ff-notification-icon", e), children: c(bt, { type: a }) }), t] }), qa = ({}) => c(K, { children: "Confirm" });
const Vt = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, bt = ({ type: e, props: t }) => d("i", { ...t, children: d("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Vt[e] || Vt.info).map((a, n) => d("path", { d: a }, n)) }) }), Gt = ({ className: e, content: t, icon: a, $close: n }) => T(C.Fragment, { children: [a && d("div", { className: F("ff-notification-icon", e), children: d(bt, { type: a }) }), t] }), qa = ({}) => d(K, { children: "Confirm" });
var de, xe;
const ee = class ee {
constructor() {
@ -118,7 +118,7 @@ const Le = dt.getInstance(), At = { null2json: (e) => Object.create(), null2arra
for (let s in e) {
let i;
if (Reflect.has(e[s], "type") && ["code", "field", "router", "query", "string"].includes(e[s].type)) {
const { type: o, value: l = "", default: u = n } = e[s];
const { type: o, value: l = "", default: c = n } = e[s];
switch (o) {
case "code":
i = await we.exec(l, t, a);
@ -133,7 +133,7 @@ const Le = dt.getInstance(), At = { null2json: (e) => Object.create(), null2arra
case "string":
i = l;
}
i ?? (i = u);
i ?? (i = c);
} else i = await Xt(e[s], t, a, n);
p.set(r, s, i);
}
@ -215,7 +215,7 @@ const Ja = (e, t = {}) => Z(() => e == null ? void 0 : e.map(({ widgetByJs: a, w
}, [e, t, a, n]), Ka = (e, t = "id", a = null) => {
const n = St(), r = q(!1), s = q(e.dataSource), i = q(e.itemOperationsAccess);
return x(() => (s.current = e.dataSource, i.current = e.itemOperationsAccess, () => r.current = !1), [e.dataSource, e.itemOperationsAccess]), r.current && (e.dataSource = s.current, e.itemOperationsAccess = i.current), [e, (o = 0, l = null) => {
var u, d;
var c, u;
if (o === 2) {
r.current = !0;
const f = p.get(l, "__PARENT_ID__", ""), m = p.get(l, t, p.get(l, [a, t], "")), h = p.findIndex(s.current, ["__PARENT_ID__", f]), y = p.findIndex(h > -1 ? p.get(s.current, [h, "children"]) : s.current, [t, m]);
@ -229,26 +229,26 @@ const Ja = (e, t = {}) => Z(() => e == null ? void 0 : e.map(({ widgetByJs: a, w
}), b.forEach((w, k) => {
i.current.has(k) ? i.current.set(k, p.uniq([...i.current.get(k) || [], ...w])) : i.current.set(k, w);
}), n();
})) : (u = e.onReload) == null || u.call(e);
} else o === 1 && ((d = e.onReload) == null || d.call(e));
})) : (c = e.onReload) == null || c.call(e);
} else o === 1 && ((u = e.onReload) == null || u.call(e));
}];
}, _a = (e, t) => {
const a = St(), n = q(t), r = q(/* @__PURE__ */ new Map()), s = q([]), i = p.throttle((l) => {
s.current = [], E.list(e, p.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: u, condition: d, total: f, tab: m, sider: h, page: y, pageSize: b, operationsAccess: w, dataSource: k }) => {
n.current = { tab: m, condition: d, sider: h, keyword: u, total: f, pageSize: b, page: k != null && k.length ? y : 1 }, s.current = k, r.current = new Map(w), a();
s.current = [], E.list(e, p.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: c, condition: u, total: f, tab: m, sider: h, page: y, pageSize: b, operationsAccess: w, dataSource: k }) => {
n.current = { tab: m, condition: u, sider: h, keyword: c, total: f, pageSize: b, page: k != null && k.length ? y : 1 }, s.current = k, r.current = new Map(w), a();
});
}, 380, { leading: !1, trailing: !0 });
$t(() => {
s.current = [], e && i(t);
}, [e, t]);
const o = Z(() => p.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [n.current]);
return Object.assign(o, { onTabChange: (l) => i({ tab: l, page: 1 }), onPageChange: (l, u) => i({ page: l, pageSize: u }), onPageSizeChange: (l) => i({ pageSize: l, page: 1 }), onConditionChange: (l, u) => i({ keyword: u, condition: Ht(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => i({ sider: l, page: 1 }), onKeywordChange: (l) => i({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: s.current, onReload: i });
}, Ga = ({ className: e, itemClassName: t, classNames: a = {}, dataSource: n, isPaginate: r, isItemOperations: s, isBatchOperations: i, batchOperations: o, itemOperations: l, itemOperationsAccess: u, resource: d, primaryKey: f, title: m, itemGridLayout: h, $setting: y, tabs: b, isConditionFormLayout: w, isTreeSider: k, treeSiderConfig: V }) => {
const { getBase62params: j, onClickCallback: U, onTabChange: D } = Ue(ve), { total: S, page: I, pageSize: O, tab: W } = (j == null ? void 0 : j()) || {}, H = ce((z, R, se) => c(Ya, { className: F("ff-data-list-framework-item", t), operations: s && R ? l == null ? void 0 : l.filter((A) => !(f && A.uuid && u.has(A.uuid)) || u.get(A.uuid).includes(R == null ? void 0 : R[f])) : [], data: d ? { [d]: R } : R, children: z, onClickCallback: U }), [d, f, s, U, l, u]);
return T("div", { className: F("ff-data-list-framework", e), children: [c(na, { className: a == null ? void 0 : a.sider, isTreeSider: k, ...V }), T("div", { className: F("ff-data-list-container", a == null ? void 0 : a.container), children: [c(vt, { className: a == null ? void 0 : a.filter, isConditionFormLayout: w }), c(aa, { title: m, className: a == null ? void 0 : a.toolbar, tabs: b, tab: W, onTabChange: D }), c(on, { ...h, className: a == null ? void 0 : a.content, style: { "--col-num": (y == null ? void 0 : y.colNum) || 1 }, primaryKey: f, itemRender: H, dataSource: n }), c(ra, { className: a == null ? void 0 : a.footer, isPaginate: r, isOperations: i, operations: o, total: S, page: I, pageSize: O })] })] });
}, Ya = ({ className: e, operations: t, children: a, data: n, onClickCallback: r }) => T("div", { className: F("data-list-grid-layout-item-container", e), children: [a, !!(t != null && t.length) && c("div", { className: "data-list-grid-layout-item-actions", children: t.map((s) => c("span", { className: "data-list-grid-layout-item-action", children: c($.Link, { uuid: s.uuid, type: s.type, name: s.name, widget: s.widget, widgetType: s.widgetType, widgetProps: s.widgetProps, widgetSetting: s.widgetSetting, widgetContainerProps: s.widgetContainerSetting, data: n, onAfterClick: (i) => i !== !1 && (r == null ? void 0 : r(s.isRefresh, n)) }, s.uuid || Ye()) }, (s == null ? void 0 : s.uuid) || Ye())) })] }), Qa = ({ listCode: e, className: t, classNames: a = {}, itemClassName: n, dataSource: r, columns: s, isItemOperations: i, isBatchOperations: o, batchOperations: l, itemOperations: u, itemOperationsAccess: d, resource: f, primaryKey: m, title: h, tabs: y, isPaginate: b, isTreeSider: w, treeSiderConfig: k, isConditionFormLayout: V, ...j }) => {
const { getBase62params: U, onClickCallback: D, onTabChange: S } = Ue(ve), { total: I, page: O, tab: W, pageSize: H } = (U == null ? void 0 : U()) || {}, z = gt(u, r, d, m);
return T("div", { className: F("ff-data-table-framework", t), children: [c(na, { className: a == null ? void 0 : a.sider, isTreeSider: w, ...k }), T("div", { className: F("ff-data-table-container", a == null ? void 0 : a.container), children: [c(vt, { listCode: e, isConditionFormLayout: V }), c(aa, { title: h, className: a == null ? void 0 : a.toolbar, tabs: y, tab: W, onTabChange: S }), c(tn, { ...j, primaryKey: m, className: "ff-data-table-content", columns: s, dataSource: r, operationRender: z ? (R) => c("div", { className: "ff-data-table-actions", children: u == null ? void 0 : u.reduce((se, A, Fe) => [...se, c($.Link, { size: "small", uuid: A.uuid, type: A.type, name: A.name, widget: A.widget, widgetType: A.widgetType, widgetProps: A.widgetProps, widgetData: A.widgetData, widgetSetting: A.widgetSetting, widgetContainerProps: A.widgetContainerSetting, data: R, onAfterClick: (Se) => Se !== !1 && (D == null ? void 0 : D(A.isRefresh, data)) }, A.uuid || Fe)], []) }) : null }), c(ra, { isPaginate: b, isOperations: o, operations: l, total: I, page: O, pageSize: H })] })] });
return Object.assign(o, { onTabChange: (l) => i({ tab: l, page: 1 }), onPageChange: (l, c) => i({ page: l, pageSize: c }), onPageSizeChange: (l) => i({ pageSize: l, page: 1 }), onConditionChange: (l, c) => i({ keyword: c, condition: Ht(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => i({ sider: l, page: 1 }), onKeywordChange: (l) => i({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: s.current, onReload: i });
}, Ga = ({ className: e, itemClassName: t, classNames: a = {}, dataSource: n, isPaginate: r, isItemOperations: s, isBatchOperations: i, batchOperations: o, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: f, title: m, itemGridLayout: h, $setting: y, tabs: b, isConditionFormLayout: w, isTreeSider: k, treeSiderConfig: V }) => {
const { getBase62params: j, onClickCallback: U, onTabChange: D } = Ue(ve), { total: S, page: I, pageSize: O, tab: W } = (j == null ? void 0 : j()) || {}, H = ce((z, R, se) => d(Ya, { className: F("ff-data-list-framework-item", t), operations: s && R ? l == null ? void 0 : l.filter((A) => !(f && A.uuid && c.has(A.uuid)) || c.get(A.uuid).includes(R == null ? void 0 : R[f])) : [], data: u ? { [u]: R } : R, children: z, onClickCallback: U }), [u, f, s, U, l, c]);
return T("div", { className: F("ff-data-list-framework", e), children: [d(na, { className: a == null ? void 0 : a.sider, isTreeSider: k, ...V }), T("div", { className: F("ff-data-list-container", a == null ? void 0 : a.container), children: [d(vt, { className: a == null ? void 0 : a.filter, isConditionFormLayout: w }), d(aa, { title: m, className: a == null ? void 0 : a.toolbar, tabs: b, tab: W, onTabChange: D }), d(on, { ...h, className: a == null ? void 0 : a.content, style: { "--col-num": (y == null ? void 0 : y.colNum) || 1 }, primaryKey: f, itemRender: H, dataSource: n }), d(ra, { className: a == null ? void 0 : a.footer, isPaginate: r, isOperations: i, operations: o, total: S, page: I, pageSize: O })] })] });
}, Ya = ({ className: e, operations: t, children: a, data: n, onClickCallback: r }) => T("div", { className: F("data-list-grid-layout-item-container", e), children: [a, !!(t != null && t.length) && d("div", { className: "data-list-grid-layout-item-actions", children: t.map((s) => d("span", { className: "data-list-grid-layout-item-action", children: d($.Link, { uuid: s.uuid, type: s.type, name: s.name, widget: s.widget, widgetType: s.widgetType, widgetProps: s.widgetProps, widgetSetting: s.widgetSetting, widgetContainerProps: s.widgetContainerSetting, data: n, onAfterClick: (i) => i !== !1 && (r == null ? void 0 : r(s.isRefresh, n)) }, s.uuid || Ye()) }, (s == null ? void 0 : s.uuid) || Ye())) })] }), Qa = ({ listCode: e, className: t, classNames: a = {}, itemClassName: n, dataSource: r, columns: s, isItemOperations: i, isBatchOperations: o, batchOperations: l, itemOperations: c, itemOperationsAccess: u, resource: f, primaryKey: m, title: h, tabs: y, isPaginate: b, isTreeSider: w, treeSiderConfig: k, isConditionFormLayout: V, ...j }) => {
const { getBase62params: U, onClickCallback: D, onTabChange: S } = Ue(ve), { total: I, page: O, tab: W, pageSize: H } = (U == null ? void 0 : U()) || {}, z = gt(c, r, u, m);
return T("div", { className: F("ff-data-table-framework", t), children: [d(na, { className: a == null ? void 0 : a.sider, isTreeSider: w, ...k }), T("div", { className: F("ff-data-table-container", a == null ? void 0 : a.container), children: [d(vt, { listCode: e, isConditionFormLayout: V }), d(aa, { title: h, className: a == null ? void 0 : a.toolbar, tabs: y, tab: W, onTabChange: S }), d(tn, { ...j, primaryKey: m, className: "ff-data-table-content", columns: s, dataSource: r, operationRender: z ? (R) => d("div", { className: "ff-data-table-actions", children: c == null ? void 0 : c.reduce((se, A, Fe) => [...se, d($.Link, { size: "small", uuid: A.uuid, type: A.type, name: A.name, widget: A.widget, widgetType: A.widgetType, widgetProps: A.widgetProps, widgetData: A.widgetData, widgetSetting: A.widgetSetting, widgetContainerProps: A.widgetContainerSetting, data: R, onAfterClick: (Se) => Se !== !1 && (D == null ? void 0 : D(A.isRefresh, data)) }, A.uuid || Fe)], []) }) : null }), d(ra, { isPaginate: b, isOperations: o, operations: l, total: I, page: O, pageSize: H })] })] });
}, ve = C.createContext({ listCode: "", getBase62params: (e, t) => {
}, onReload: () => {
}, onClickCallback: () => {
@ -258,17 +258,17 @@ const Ja = (e, t = {}) => Z(() => e == null ? void 0 : e.map(({ widgetByJs: a, w
}, onKeywordChange: () => {
}, onPageChange: () => {
}, onPageSizeChange: () => {
} }), Xa = ({ isItemGridLayout: e, theme: t, themeProps: a, onClickCallback: n, onReload: r, listCode: s, total: i = 0, page: o = 0, onPageChange: l, pageSize: u = 30, onPageSizeChange: d, tab: f, onTabChange: m, keyword: h, onKeywordChange: y, condition: b, onConditionChange: w, sider: k, onSiderChange: V, ...j }) => {
} }), Xa = ({ isItemGridLayout: e, theme: t, themeProps: a, onClickCallback: n, onReload: r, listCode: s, total: i = 0, page: o = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: f, onTabChange: m, keyword: h, onKeywordChange: y, condition: b, onConditionChange: w, sider: k, onSiderChange: V, ...j }) => {
const [U, D] = N();
return x(() => {
t ? G.getWidgetComponent(t).then((S) => {
if (!S) throw `${t} not found`;
return S;
}).catch((S) => ({ default: () => `${S}` })).then((S) => D(C.createElement(S.default, { ...j, $setting: a }))) : D(c(e ? Ga : Qa, { ...j, $setting: a }));
}, [t, a]), c(ve.Provider, { value: { listCode: s, onClickCallback: n, onReload: r, getBase62params: (S, I) => {
const O = { tab: f, page: o, pageSize: u, keyword: h, sider: k, condition: b, total: i };
}).catch((S) => ({ default: () => `${S}` })).then((S) => D(C.createElement(S.default, { ...j, $setting: a }))) : D(d(e ? Ga : Qa, { ...j, $setting: a }));
}, [t, a]), d(ve.Provider, { value: { listCode: s, onClickCallback: n, onReload: r, getBase62params: (S, I) => {
const O = { tab: f, page: o, pageSize: c, keyword: h, sider: k, condition: b, total: i };
return S && S != "init" ? O[S] ?? I : O;
}, onPageChange: l, onPageSizeChange: d, onTabChange: m, onSiderChange: V, onKeywordChange: y, onConditionChange: w }, children: U && C.cloneElement(U, j) });
}, onPageChange: l, onPageSizeChange: u, onTabChange: m, onSiderChange: V, onKeywordChange: y, onConditionChange: w }, children: U && C.cloneElement(U, j) });
};
var ge, oe, ke, et;
const ae = class ae {
@ -295,48 +295,48 @@ const ae = class ae {
ge = new WeakMap(), oe = new WeakMap(), ke = new WeakMap(), et = new WeakMap(), P(ae, ge, null), v(ae, "getInstance", () => (g(ae, ge) || B(ae, ge, new ae()), g(ae, ge)));
let pt = ae;
const ea = pt.getInstance(), kt = C.forwardRef(({ listCode: e, base62params: t, className: a, itemClassName: n, theme: r, themeProps: s, classNames: i }, o) => {
const [{ resource: l, primaryKey: u, batchOperations: d = [], itemOperations: f = [], columns: m = [], themeConfig: h, theme: y, isConditionFormLayout: b = !1, isTreeSider: w, treeSiderConfig: k, isItemGridLayout: V, itemGridLayout: j, title: U, isPaginate: D, tabs: S }, I] = N({ isItemGridLayout: !1, itemGridLayout: {} }), O = _a(e, t), [{ dataSource: W, itemOperationsAccess: H, condition: z, tab: R, keyword: se, page: A, total: Fe, pageSize: Se, sider: at, onConditionChange: Tt, onTabChange: pa, onKeywordChange: ma, onPageChange: ha, onPageSizeChange: fa, onSiderChange: ya, onReload: nt }, Et] = Ka(O, u, l), wa = gt(f, W, H, u), Ca = gt(d);
const [{ resource: l, primaryKey: c, batchOperations: u = [], itemOperations: f = [], columns: m = [], themeConfig: h, theme: y, isConditionFormLayout: b = !1, isTreeSider: w, treeSiderConfig: k, isItemGridLayout: V, itemGridLayout: j, title: U, isPaginate: D, tabs: S }, I] = N({ isItemGridLayout: !1, itemGridLayout: {} }), O = _a(e, t), [{ dataSource: W, itemOperationsAccess: H, condition: z, tab: R, keyword: se, page: A, total: Fe, pageSize: Se, sider: at, onConditionChange: Tt, onTabChange: pa, onKeywordChange: ma, onPageChange: ha, onPageSizeChange: fa, onSiderChange: ya, onReload: nt }, Et] = Ka(O, c, l), wa = gt(f, W, H, c), Ca = gt(u);
return x(() => {
let He = null;
return e && E.get(`/api/_/${e}`).resp(({ data: Je, res: ba }) => {
Je != null && Je.isDynamicRefresh && (He = ea.subscribe(() => nt(), ba)), I(Je);
}).catch(() => I({})), () => He == null ? void 0 : He();
}, [e]), C.useImperativeHandle(o, () => ({ onReload: nt, onClickCallback: Et })), c(Xa, { listCode: e, title: U, itemClassName: n, classNames: i, resource: l, primaryKey: u, theme: r || y, themeProps: s || h, isTreeSider: w, treeSiderConfig: k, isPaginate: D, tabs: S, isItemOperations: wa, isBatchOperations: Ca, batchOperations: d, itemOperations: f, isItemGridLayout: V, columns: m, itemGridLayout: j, isConditionFormLayout: b, itemOperationsAccess: H, dataSource: W, onConditionChange: Tt, onTabChange: pa, onKeywordChange: ma, onPageChange: ha, onPageSizeChange: fa, onSiderChange: ya, condition: z, tab: R, keyword: se, page: A, total: Fe, pageSize: Se, sider: at, className: F("ff-data-list-helper", a), onReload: nt, onClickCallback: Et });
}, [e]), C.useImperativeHandle(o, () => ({ onReload: nt, onClickCallback: Et })), d(Xa, { listCode: e, title: U, itemClassName: n, classNames: i, resource: l, primaryKey: c, theme: r || y, themeProps: s || h, isTreeSider: w, treeSiderConfig: k, isPaginate: D, tabs: S, isItemOperations: wa, isBatchOperations: Ca, batchOperations: u, itemOperations: f, isItemGridLayout: V, columns: m, itemGridLayout: j, isConditionFormLayout: b, itemOperationsAccess: H, dataSource: W, onConditionChange: Tt, onTabChange: pa, onKeywordChange: ma, onPageChange: ha, onPageSizeChange: fa, onSiderChange: ya, condition: z, tab: R, keyword: se, page: A, total: Fe, pageSize: Se, sider: at, className: F("ff-data-list-helper", a), onReload: nt, onClickCallback: Et });
}), ta = (e, t, a, n, r = {}, s = 0) => {
const i = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${a}`, "--grid-layout-x": `${e}`, "--grid-layout-y": `${t}`, "--grid-layout-row-height-offset": "0px" };
return r != null && r.autoHeight ? i.height = "fit-content" : i["--grid-layout-row"] = `${n}`, i["--grid-layout-box-margin"] = jt(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), i["--grid-layout-box-padding"] = jt(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), s && (i.height = `${s}px`), i;
}, jt = (e, t, a, n) => `${e || 0}px ${t || 0}px ${a || 0}px ${n || 0}px`, vt = ({ className: e, isConditionFormLayout: t }) => {
var f, m;
const [a, n] = N({}), { listCode: r, onKeywordChange: s, onConditionChange: i, getBase62params: o } = C.useContext(ve), { keyword: l, condition: u } = (o == null ? void 0 : o()) || {}, [d] = _e.useForm();
const [a, n] = N({}), { listCode: r, onKeywordChange: s, onConditionChange: i, getBase62params: o } = C.useContext(ve), { keyword: l, condition: c } = (o == null ? void 0 : o()) || {}, [u] = _e.useForm();
return x(() => {
r && t && E.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: h, marginX: y, marginY: b, rowHeight: w, cols: k, fields: V }) => {
n({ resource: h, itemMargin: [y, b], rowHeight: w, cols: k, fields: V });
}).catch(() => n({}));
}, [r, t]), x(() => {
d.setFieldsValue({ keyword: l, ...u });
}, [JSON.stringify([l, u])]), c("div", { className: F("ff-data-list-filter", e), children: c(_e, { form: d, layout: "vertical", autoComplete: "off", onFinish: ((f = a.fields) == null ? void 0 : f.length) > 1 ? (h) => i({ [a.resource]: h[a.resource] }, h.keyword) : () => {
u.setFieldsValue({ keyword: l, ...c });
}, [JSON.stringify([l, c])]), d("div", { className: F("ff-data-list-filter", e), children: d(_e, { form: u, layout: "vertical", autoComplete: "off", onFinish: ((f = a.fields) == null ? void 0 : f.length) > 1 ? (h) => i({ [a.resource]: h[a.resource] }, h.keyword) : () => {
}, onValuesChange: (h) => {
p.isEmpty(p.omit(h, ["keyword"])) || d.submit();
}, children: ((m = a.fields) == null ? void 0 : m.length) > 1 ? c(Nt, { ...a, children: c(Za, { onReset: () => {
p.isEmpty(p.omit(h, ["keyword"])) || u.submit();
}, children: ((m = a.fields) == null ? void 0 : m.length) > 1 ? d(Nt, { ...a, children: d(Za, { onReset: () => {
const { keyword: h, condition: y } = o("init") || {};
d.setFieldsValue({ keyword: h, ...y });
} }) }) : c("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: c("div", { className: "grid-layout-item", style: ta(20, 0, 5, 2), children: c(_e.Item, { name: ["keyword"], children: c($a.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (h) => s(h) }) }) }) }) }) });
u.setFieldsValue({ keyword: h, ...y });
} }) }) : d("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: d("div", { className: "grid-layout-item", style: ta(20, 0, 5, 2), children: d(_e.Item, { name: ["keyword"], children: d($a.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (h) => s(h) }) }) }) }) }) });
}, Za = ({ cols: e, fields: t, onReset: a }) => {
const [n, r] = N(!1), s = Z(() => t == null ? void 0 : t.toReversed().some((i) => i.y > 1 || i.x + i.w >= e - 5), [e, t]);
return T(_e.Item, { label: " ", style: { "--item-span": 5 }, className: F("ff-data-list-filter-actions", { expanded: n }), children: [c(ot, { onClick: a, children: "重置" }), c(ot, { type: "primary", htmlType: "submit", children: "查询" }), s && c($.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((i) => !i), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] });
return T(_e.Item, { label: " ", style: { "--item-span": 5 }, className: F("ff-data-list-filter-actions", { expanded: n }), children: [d(ot, { onClick: a, children: "重置" }), d(ot, { type: "primary", htmlType: "submit", children: "查询" }), s && d($.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((i) => !i), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] });
};
vt.reservedFields = [{ x: 0, y: 0, h: 3, w: 5, field: { isVirtual: !0, widgetPrefix: "@pkg/ff/grid-layout-forms", widget: "Input", code: "keyword", label: "关键字", placeholder: "多关键字 | 分割", extras: { prefix: "icon-search" } } }];
const aa = ({ className: e, title: t, tabs: a, tab: n, onTabChange: r }) => {
const [s, i] = La(a == null ? void 0 : a[0].value, { value: n, onChange: r });
return T("div", { className: F("ff-data-list-toolbar", e), children: [c("div", { className: "ff-data-list-title", children: t }), c(Na, { className: "ff-data-list-tabs", itemRender: ({ label: o, code: l }) => c("span", { onClick: () => i(l), className: F("ff-data-list-tab", { active: l == s }), children: o }), items: a }), T("div", { className: "ff-data-list-actions", children: [c($.Link, { icon: "icon-reload" }), c($.Link, { icon: "icon-setting" })] })] });
}, en = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: c("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], na = ({ className: e, width: t = 280, isTreeSider: a }) => a ? c(Pa.DirectoryTree, { className: F("ff-data-list-sider", e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: en }) : null, ra = ({ className: e, operations: t, isOperations: a, isPaginate: n, total: r, page: s, pageSize: i }) => {
const { onPageChange: o, onPageSizeChange: l, onClickCallback: u } = C.useContext(ve);
return a && !p.isEmpty(t) || n ? T("div", { className: F("ff-data-list-footer", e), children: [c("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((d, f) => c($, { uuid: d.uuid, type: d.type, name: d.name, widget: d.widget, widgetType: d.widgetType, widgetProps: d.widgetProps, widgetData: d.widgetData, widgetSetting: d.widgetSetting, widgetContainerProps: d.widgetContainerSetting, onAfterClick: (m) => m !== !1 && (u == null ? void 0 : u(d.isRefresh, null)) }, d.uuid || f)) }), n && c(xa, { size: "small", total: r, pageSize: i, showSizeChanger: !1, showTotal: (d) => `${s} 页 / 总共 ${d}`, onChange: o, onShowSizeChange: l })] }) : null;
const [s, i] = La((a == null ? void 0 : a[0].value) ?? (a == null ? void 0 : a[0].code), { value: n, onChange: r });
return T("div", { className: F("ff-data-list-toolbar", e), children: [d("div", { className: "ff-data-list-title", children: t }), d(Na, { className: "ff-data-list-tabs", itemRender: ({ label: o, code: l, value: c }) => d("span", { onClick: () => i(c ?? l), className: F("ff-data-list-tab", { active: (c ?? l) == s }), children: o }), items: a }), T("div", { className: "ff-data-list-actions", children: [d($.Link, { icon: "icon-reload" }), d($.Link, { icon: "icon-setting" })] })] });
}, en = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: d("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], na = ({ className: e, width: t = 280, isTreeSider: a }) => a ? d(Pa.DirectoryTree, { className: F("ff-data-list-sider", e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: en }) : null, ra = ({ className: e, operations: t, isOperations: a, isPaginate: n, total: r, page: s, pageSize: i }) => {
const { onPageChange: o, onPageSizeChange: l, onClickCallback: c } = C.useContext(ve);
return a && !p.isEmpty(t) || n ? T("div", { className: F("ff-data-list-footer", e), children: [d("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((u, f) => d($, { uuid: u.uuid, type: u.type, name: u.name, widget: u.widget, widgetType: u.widgetType, widgetProps: u.widgetProps, widgetData: u.widgetData, widgetSetting: u.widgetSetting, widgetContainerProps: u.widgetContainerSetting, onAfterClick: (m) => m !== !1 && (c == null ? void 0 : c(u.isRefresh, null)) }, u.uuid || f)) }), n && d(xa, { size: "small", total: r, pageSize: i, showSizeChanger: !1, showTotal: (u) => `${s} 页 / 总共 ${u}`, onChange: o, onShowSizeChange: l })] }) : null;
}, sa = (e, t, a = !0) => a !== !0 && a-- <= 0 ? [] : p.isArray(e) && !p.isEmpty(e) ? e.reduce((n, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && n.push(r[t]), Reflect.has(r, "children") && !p.isEmpty(r.children) ? n.concat(sa(r.children, t, a)) : n), []) : [], tn = ({ className: e, primaryKey: t, columns: a = [], dataSource: n = [], operationRender: r, operationWidth: s = 180, ...i }) => {
Ye();
const o = q(null), l = q(null), [u, d] = N([]), [f, m] = N({ width: 0, height: 0 });
const o = q(null), l = q(null), [c, u] = N([]), [f, m] = N({ width: 0, height: 0 });
x(() => {
d(sa(n, t));
u(sa(n, t));
}, [n, t]), Sa(() => {
const y = new ResizeObserver(() => {
var b;
@ -347,9 +347,9 @@ const aa = ({ className: e, title: t, tabs: a, tab: n, onTabChange: r }) => {
};
}, []);
const h = Ja(a);
return c("div", { ref: l, className: F("ff-data-list-table", e), children: f.height ? c(Ta, { ...i, ref: o, rowKey: (y) => (y == null ? void 0 : y[t]) ?? Math.random(), columns: h == null ? void 0 : h.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(s / f.width * 100).toFixed(2)}%`, render: (y, b, w) => r(b, w) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: d, expandedRowKeys: u } }) : null });
return d("div", { ref: l, className: F("ff-data-list-table", e), children: f.height ? d(Ta, { ...i, ref: o, rowKey: (y) => (y == null ? void 0 : y[t]) ?? Math.random(), columns: h == null ? void 0 : h.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(s / f.width * 100).toFixed(2)}%`, render: (y, b, w) => r(b, w) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: u, expandedRowKeys: c } }) : null });
}, an = "RC_FORM_INTERNAL_HOOKS", ia = (e, { initialValue: t, initialValueLanguage: a, convertJs: n, convertJsSetting: r, type: s = "string" }, i = null) => {
const o = q(!1), l = Ue(Va), [u, d] = N(), [f, m] = N(a != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: h } = l.getInternalHooks(an) || {};
const o = q(!1), l = Ue(Va), [c, u] = N(), [f, m] = N(a != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: h } = l.getInternalHooks(an) || {};
return x(() => h == null ? void 0 : h((y, b, w) => {
if (!o.current) return;
const k = p.get(b, e);
@ -357,11 +357,11 @@ const aa = ({ className: e, title: t, tabs: a, tab: n, onTabChange: r }) => {
}), [f]), x(() => {
a == "javascript" && t ? we.exec(t, {}, { getFieldValueForBasicForm: (y) => i ? i.getFieldValue(y) : l.getFieldValue(y), getFieldValue: (y) => l.getFieldValue(y) }).then((y) => m(Q(y, s))).catch((y) => notification.error({ message: `布局数据错误: ${JSON.stringify(y)}` })).finally(() => o.current = !0) : (t && m(Q(t ?? l.getFieldValue(e), s)), o.current = !0);
}, [t, a]), De(() => {
o.current && n && G.getWidgetComponent(n).then(({ default: y }) => y({ value: f, record: l.getFieldsValue(!0), $setting: r })).then(d).catch((y) => console.error("布局数据转换错误: ", y, n));
}, [f, n, r]), [u || f, f];
o.current && n && G.getWidgetComponent(n).then(({ default: y }) => y({ value: f, record: l.getFieldsValue(!0), $setting: r })).then(u).catch((y) => console.error("布局数据转换错误: ", y, n));
}, [f, n, r]), [c || f, f];
}, oa = (e, t, a = "@pkg/ff/grid-layouts", n = null) => Z(() => {
var r;
return (r = p.sortBy(e, ["y", "x"])) == null ? void 0 : r.map(({ i: s, x: i, y: o, w: l, h: u, field: { boxStyle: d, widgetPrefix: f = a, widget: m, ...h } }, y) => c("div", { className: "grid-layout-item", style: ta(i, o, l, u, d, m === "Height" && (h == null ? void 0 : h.initialValue)), children: c(nn, { ...h, basicForm: n, itemWidget: m != null && m.startsWith("@") || m != null && m.startsWith("blob:") ? m : `${f}/${m}`, itemWidgetRender: t }) }, s || y));
return (r = p.sortBy(e, ["y", "x"])) == null ? void 0 : r.map(({ i: s, x: i, y: o, w: l, h: c, field: { boxStyle: u, widgetPrefix: f = a, widget: m, ...h } }, y) => d("div", { className: "grid-layout-item", style: ta(i, o, l, c, u, m === "Height" && (h == null ? void 0 : h.initialValue)), children: d(nn, { ...h, basicForm: n, itemWidget: m != null && m.startsWith("@") || m != null && m.startsWith("blob:") ? m : `${f}/${m}`, itemWidgetRender: t }) }, s || y));
}, [e]), nn = ({ itemWidget: e, itemWidgetRender: t, basicForm: a, ...n }) => {
const [r, s] = N();
return x(() => {
@ -372,18 +372,18 @@ const aa = ({ className: e, title: t, tabs: a, tab: n, onTabChange: r }) => {
});
}, [e]), r;
}, la = ({ cols: e = 12, rowHeight: t = 21, fields: a = [], data: n, containerPadding: r = [0, 0], itemMargin: s = [4, 0], formProps: i = {}, className: o, ...l }) => {
const [u] = X.useForm(), d = oa(a, rn, "@pkg/ff/grid-layouts"), f = Z(() => [{ name: "__PROPS__", value: i }], [i]);
const [c] = X.useForm(), u = oa(a, rn, "@pkg/ff/grid-layouts"), f = Z(() => [{ name: "__PROPS__", value: i }], [i]);
return De(() => {
u.setFieldsValue(n);
}, [n]), c(X, { fields: f, form: u, component: !1, children: c("div", { ...l, className: F("ff-grid-layout", o), style: { "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-container-padding-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-container-padding-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: d }) });
c.setFieldsValue(n);
}, [n]), d(X, { fields: f, form: c, component: !1, children: d("div", { ...l, className: F("ff-grid-layout", o), style: { "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-container-padding-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-container-padding-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: u }) });
}, rn = (e, t = {}, a = null) => (n) => {
const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: f, ...m } = p.merge({}, t, n), [h, y] = ia(o ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: f, type: (m == null ? void 0 : m.type) || "string" }, a);
return c(e, { ...m, value: h, rawValue: y, $setting: i || {} });
const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: f, ...m } = p.merge({}, t, n), [h, y] = ia(o ? null : r, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: f, type: (m == null ? void 0 : m.type) || "string" }, a);
return d(e, { ...m, value: h, rawValue: y, $setting: i || {} });
}, nr = (It = la, function({ code: e, data: t, ...a }) {
const [n, r] = N({ resource: null, cols: 12, rowHeight: 21, fields: [] });
return x(() => {
e && E.get(`/api/_/${e}`).then((s) => r(p.pick(s, ["resource", "cols", "rowHeight", "fields"])));
}, [e]), (n == null ? void 0 : n.resource) && c(It, { ...a, rowHeight: n.rowHeight, cols: n.cols, fields: n.fields, data: n != null && n.resource ? { [n == null ? void 0 : n.resource]: t } : {} });
}, [e]), (n == null ? void 0 : n.resource) && d(It, { ...a, rowHeight: n.rowHeight, cols: n.cols, fields: n.fields, data: n != null && n.resource ? { [n == null ? void 0 : n.resource]: t } : {} });
});
var It;
const rr = ({ widget: e, widgetPrefix: t = "@pkg/ff/grid-layouts", basicForm: a, ...n }) => {
@ -392,18 +392,18 @@ const rr = ({ widget: e, widgetPrefix: t = "@pkg/ff/grid-layouts", basicForm: a,
r && G.getWidgetComponent(r).then(({ defaultProps: o = {}, default: l }) => ({ default: sn(l, o, a) })).catch((o) => ({ default: () => `${o}` })).then((o) => i(C.createElement(o.default, n)));
}, [r]), s;
}, sn = (e, t = {}, a = null) => (n) => {
const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: f, value: m, ...h } = p.merge({}, t, n), [y, b] = ia(o ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: d, convertJsSetting: f, type: (h == null ? void 0 : h.type) || "string" }, a);
return c(e, { ...h, value: y, rawValue: b, $setting: i || {} });
}, on = ({ cols: e, rowHeight: t, itemMargin: a, fields: n, primaryKey: r, dataSource: s, itemClassName: i, itemRender: o = (f, m, h) => f, empty: l = c(Ea, { description: null }), className: u, style: d = {} }) => {
const f = Ye(), m = Z(() => c(la, { cols: e, rowHeight: t, itemMargin: a, fields: n, className: i }), [n, e, t, a]);
return c("div", { className: F("ff-data-list-content", u), style: d, children: p.isEmpty(s) ? l : s == null ? void 0 : s.map((h, y) => c(C.Fragment, { children: o(C.cloneElement(m, { data: h }), h, y) }, `${f}-${(h == null ? void 0 : h[r]) || y}`)) });
const { code: r, label: s, extras: i, isVirtual: o, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: f, value: m, ...h } = p.merge({}, t, n), [y, b] = ia(o ? null : r, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: f, type: (h == null ? void 0 : h.type) || "string" }, a);
return d(e, { ...h, value: y, rawValue: b, $setting: i || {} });
}, on = ({ cols: e, rowHeight: t, itemMargin: a, fields: n, primaryKey: r, dataSource: s, itemClassName: i, itemRender: o = (f, m, h) => f, empty: l = d(Ea, { description: null }), className: c, style: u = {} }) => {
const f = Ye(), m = Z(() => d(la, { cols: e, rowHeight: t, itemMargin: a, fields: n, className: i }), [n, e, t, a]);
return d("div", { className: F("ff-data-list-content", c), style: u, children: p.isEmpty(s) ? l : s == null ? void 0 : s.map((h, y) => d(C.Fragment, { children: o(C.cloneElement(m, { data: h }), h, y) }, `${f}-${(h == null ? void 0 : h[r]) || y}`)) });
}, ln = ({ component: e }) => {
const { base62params: t } = Aa();
return c(K, { children: c(kt, { listCode: e, base62params: E.decode(t) }) });
return d(K, { children: d(kt, { listCode: e, base62params: E.decode(t) }) });
}, cn = () => "Empty", dn = ({ component: e, $setting: t }) => {
const [a, n] = N();
x(() => {
if (!e) return n(c(cn, { description: null }));
if (!e) return n(d(cn, { description: null }));
G.getWidgetComponent(e).catch((s) => ({ default: () => `${s}` })).then((s) => C.createElement(s.default, { $setting: t })).then(n);
}, [e]);
const r = le.getPageParams() || {};
@ -421,9 +421,9 @@ const ne = class ne {
v(this, "get", (t) => (g(this, Y).has(t) || (t = Array.from(g(this, Y).keys()).find((a) => g(this, Y).get(a).uri === t)), g(this, Y).get(t) || {}));
v(this, "redirect", (t, a, n = {}) => {
const { uri: r, type: s, widgetProps: i } = this.get(t) || {};
let o = ja(r || t, s != "list" ? a : p.mapValues(a, (u) => E.encode(u)));
let o = ja(r || t, s != "list" ? a : p.mapValues(a, (c) => E.encode(c)));
const l = new URLSearchParams();
for (const u in i || {}) (i == null ? void 0 : i.type) == "query" && l.append(u, a[u]);
for (const c in i || {}) (i == null ? void 0 : i.type) == "query" && l.append(c, a[c]);
return l.size > 0 && (o = `${o}?${l.toString()}`), g(this, he).navigate(o, n);
});
v(this, "getMenus", (t) => {
@ -472,9 +472,9 @@ const ne = class ne {
});
v(this, "createBrowserRouter", (t = {}) => {
if (g(this, Y).size == 0) return null;
const a = Le.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/BasicLayout"), n = Le.get(G.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [a]: 0 }, s = (o, l) => () => G.getWidgetComponent(o).then((u) => u.default || function() {
const a = Le.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/BasicLayout"), n = Le.get(G.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [a]: 0 }, s = (o, l) => () => G.getWidgetComponent(o).then((c) => c.default || function() {
return `${o}`;
}).then((u) => ({ Component: () => C.createElement(_t, {}, C.createElement(u, l)) })), i = Array.from(g(this, Y).values()).reduce((o, { uuid: l, uri: u, name: d, type: f, component: m, widgetSetting: h, isLogin: y, isLayout: b, extra: w }) => {
}).then((c) => ({ Component: () => C.createElement(_t, {}, C.createElement(c, l)) })), i = Array.from(g(this, Y).values()).reduce((o, { uuid: l, uri: c, name: u, type: f, component: m, widgetSetting: h, isLogin: y, isLayout: b, extra: w }) => {
let k = {}, V = 0;
switch (f) {
case "list":
@ -484,10 +484,10 @@ const ne = class ne {
k.element = C.createElement(dn, { key: m, component: m, $setting: h });
}
if (w != null && w.layout) {
if (!r[w == null ? void 0 : w.layout]) return r[w == null ? void 0 : w.layout] = o.length, [...o, { path: "/", lazy: s(w == null ? void 0 : w.layout, {}), children: [{ path: u, ...k }] }];
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: c, ...k }] }];
V = r[w == null ? void 0 : w.layout];
}
return b && V > -1 ? (o[V].children.push({ path: u, ...k }), o) : [...o, { path: u, ...k }];
return b && V > -1 ? (o[V].children.push({ path: c, ...k }), o) : [...o, { path: c, ...k }];
}, [{ path: "/", lazy: s(a, {}), children: [] }]);
return i.push({ index: !0, element: C.createElement(un, { to: n, replace: !0 }) }), B(this, he, Ia(i, t));
});
@ -511,15 +511,15 @@ const M = class M {
}), $e.addEventListener("message", ({ data: { id: t, task_id: a, method: n, args: r, category: s, data: i, error: o, session: l } }) => {
if (s === "eval" && M.mQueue.has(t)) o !== null ? M.mQueue.get(t)[1](o) : M.mQueue.get(t)[0](i), g(M, Te).delete(t), M.mQueue.delete(t);
else if (s === "util") try {
const u = p.get(Mt, n.split("/")) || p.get(g(M, Te).get(a), n.split("/"));
if (!p.isFunction(u)) throw `${n} not found`;
Promise.resolve(Reflect.apply(u, void 0, r)).then((d) => {
$e.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: d, error: null });
}).catch((d) => {
$e.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: null, error: d });
const c = p.get(Mt, n.split("/")) || p.get(g(M, Te).get(a), n.split("/"));
if (!p.isFunction(c)) throw `${n} not found`;
Promise.resolve(Reflect.apply(c, void 0, r)).then((u) => {
$e.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: u, error: null });
}).catch((u) => {
$e.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: null, error: u });
});
} catch (u) {
$e.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: null, error: u });
} catch (c) {
$e.postMessage({ id: t, task_id: a, category: s, method: n, args: r, session: l, data: null, error: c });
}
}, !1);
}
@ -551,12 +551,12 @@ const we = ht.getInstance(), St = () => {
for (let n = 0; n < e.length; n++) e[n].value = Q((a = e[n]) == null ? void 0 : a.value, t), e[n] && Reflect.has(e[n], "children") && (e[n].children = ca(e[n].children, t));
return e;
}, or = (e, t = "json", a = "string", n, r = null) => {
const [s] = X.useForm(n), [i, o] = N([{ label: "无", value: "", disabled: !0 }]), l = q([]), u = X.useWatch((d) => l.current.length === 0 ? null : p.pick(d, l.current), s) || null;
const [s] = X.useForm(n), [i, o] = N([{ label: "无", value: "", disabled: !0 }]), l = q([]), c = X.useWatch((u) => l.current.length === 0 ? null : p.pick(u, l.current), s) || null;
return x(() => {
Array.isArray(e) ? o(e) : t === "javascript" && e ? we.exec(e, {}, { getFieldValue: (d) => (l.current.includes(d) || l.current.push(d), s.getFieldValue(d)), getFieldValueForBasicForm: (d) => (l.current.includes(d) || l.current.push(d), r ? r.getFieldValue(d) : s.getFieldValue(d)) }).then((d) => {
o(Q(d, "array"));
Array.isArray(e) ? o(e) : t === "javascript" && e ? we.exec(e, {}, { getFieldValue: (u) => (l.current.includes(u) || l.current.push(u), s.getFieldValue(u)), getFieldValueForBasicForm: (u) => (l.current.includes(u) || l.current.push(u), r ? r.getFieldValue(u) : s.getFieldValue(u)) }).then((u) => {
o(Q(u, "array"));
}) : e && o(Q(e, "array"));
}, [e, t, u]), ca(i, a);
}, [e, t, c]), ca(i, a);
}, lr = (e) => {
const [t, a] = N(), n = { type: "GET" };
if (typeof e == "string" ? n.url = e : p.isPlainObject(e) && Object.assign(n, e), !(n != null && n.url)) throw "url is required";
@ -570,13 +570,13 @@ const we = ht.getInstance(), St = () => {
}, gn = (e) => {
const [t, a] = C.useState({ gridItems: [], hideItems: [] });
return C.useEffect(() => {
e && E.get(`/api/_/${e}`).then(({ pk: n, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: u, marginX: d, marginY: f, listenChangeFields: m, listenChangeFieldsFunc: h, fields: y }) => ({ pk: n, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: u, marginX: d, marginY: f, listenChangeFields: m, listenChangeFieldsFunc: h, ...y.reduce((b, w) => {
e && E.get(`/api/_/${e}`).then(({ pk: n, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: c, marginX: u, marginY: f, listenChangeFields: m, listenChangeFieldsFunc: h, fields: y }) => ({ pk: n, uuid: r, code: s, resource: i, align: o, cols: l, rowHeight: c, marginX: u, marginY: f, listenChangeFields: m, listenChangeFieldsFunc: h, ...y.reduce((b, w) => {
var k;
return (k = w == null ? void 0 : w.field) != null && k.hidden ? b.hides.push(w == null ? void 0 : w.field) : b.items.push(w), b;
}, { items: [], hides: [] }) })).then(a);
}, [e]), t;
}, pn = ({ max: e = 0, min: t = 0, type: a = "", message: n, pattern: r, required: s = !1, validator: i } = {}, o, l) => {
const [u, d] = N([]);
const [c, u] = N([]);
return x(() => {
const f = [];
if (s) {
@ -607,8 +607,8 @@ const we = ht.getInstance(), St = () => {
return p.isString(b) && b ? Promise.reject(b) : p.isBoolean(b) && !b ? Promise.reject(n) : Promise.resolve();
} }));
}
d(f);
}, [e, t, a, n, r, s, i]), u;
u(f);
}, [e, t, a, n, r, s, i]), c;
}, mn = (e, t, a) => {
const [n, r] = N(null);
return x(() => {
@ -618,10 +618,10 @@ const we = ht.getInstance(), St = () => {
});
}, [e, t, a]), n;
}, hn = (e, t, a, n = {}) => {
const r = St(), s = q(!0), i = q([]), [o, l] = N(a), u = X.useWatch((d) => JSON.stringify(p.pick(d, i.current)), t) || "{}";
const r = St(), s = q(!0), i = q([]), [o, l] = N(a), c = X.useWatch((u) => JSON.stringify(p.pick(u, i.current)), t) || "{}";
return x(() => {
e && we.exec(e, n, { getFieldValue: p.wrap(t.getFieldValue, (d, f) => (i.current.some((m) => p.isEqual(m, f)) || (i.current.push(f), r()), d(f))), isFieldTouched: t.isFieldTouched, isFieldsTouched: t.isFieldsTouched }).then((d) => s.current && l(d));
}, [e, u, t, n]), x(() => () => s.current = !1, []), o;
e && we.exec(e, n, { getFieldValue: p.wrap(t.getFieldValue, (u, f) => (i.current.some((m) => p.isEqual(m, f)) || (i.current.push(f), r()), u(f))), isFieldTouched: t.isFieldTouched, isFieldsTouched: t.isFieldsTouched }).then((u) => s.current && l(u));
}, [e, c, t, n]), x(() => () => s.current = !1, []), o;
}, cr = ({ value: e, onChange: t }, a = null) => {
const n = q(), [r] = X.useForm(a);
return $t(() => {
@ -637,27 +637,27 @@ const we = ht.getInstance(), St = () => {
}, yn = ({ widget: e = "Input", widgetPrefix: t = "@pkg/ff/grid-layout-forms", widgetDecorator: a, subWidgets: n, basicForm: r, ...s }) => {
const i = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [o, l] = N();
return x(() => {
i && G.getWidgetComponent(i).then(({ defaultProps: u = {}, default: d }) => ({ default: da(d, u, r) })).catch((u) => ({ default: () => `${u}` })).then((u) => l(C.createElement(u.default, s)));
i && G.getWidgetComponent(i).then(({ defaultProps: c = {}, default: u }) => ({ default: da(u, c, r) })).catch((c) => ({ default: () => `${c}` })).then((c) => l(C.createElement(c.default, s)));
}, [i]), o && C.cloneElement(o, s);
}, da = (e, t = {}, a = null) => (n) => {
const { type: r, code: s, label: i, noStyle: o, placeholder: l, extras: u, validators: d, help: f, isVirtual: m, $isReserved: h, initialValue: y, initialValueLanguage: b, convertJs: w, convertJsSetting: k, widgetPerfix: V, boxStyle: j, widgetDecorator: U, subWidgets: D, ...S } = { ...t, ...n }, I = pn(d || {}, s, r), O = { label: i, noStyle: o, colon: !1, layout: "vertical" }, W = { placeholder: l, ...S }, H = ce((z) => z == null ? void 0 : Q(z, r), [r]);
return c(Jt, { name: s, rules: I, initialValue: H(y), normalize: H, children: (z, R, se) => {
const { type: r, code: s, label: i, noStyle: o, placeholder: l, extras: c, validators: u, help: f, isVirtual: m, $isReserved: h, initialValue: y, initialValueLanguage: b, convertJs: w, convertJsSetting: k, widgetPerfix: V, boxStyle: j, widgetDecorator: U, subWidgets: D, ...S } = { ...t, ...n }, I = pn(u || {}, s, r), O = { label: i, noStyle: o, colon: !1, layout: "vertical" }, W = { placeholder: l, ...S }, H = ce((z) => z == null ? void 0 : Q(z, r), [r]);
return d(Jt, { name: s, rules: I, initialValue: H(y), normalize: H, children: (z, R, se) => {
var A;
return c(e, { type: r, rcform: se, itemProps: { validateStatus: R.errors.length > 0 ? "error" : "success", tooltip: f, help: R.errors.length > 0 ? R.errors.join("、") : null, required: ((A = I == null ? void 0 : I[0]) == null ? void 0 : A.required) || !1, ...O }, fieldProps: { ...W, ...z }, $setting: u || {} });
return d(e, { type: r, rcform: se, itemProps: { validateStatus: R.errors.length > 0 ? "error" : "success", tooltip: f, help: R.errors.length > 0 ? R.errors.join("、") : null, required: ((A = I == null ? void 0 : I[0]) == null ? void 0 : A.required) || !1, ...O }, fieldProps: { ...W, ...z }, $setting: c || {} });
} });
}, Nt = ({ cols: e = 24, rowHeight: t = 16, itemMargin: a = [8, 16], containerPadding: n = [0, 0], fields: r = [], children: s, basicForm: i = null }) => {
const o = oa(r, da, "@pkg/ff/grid-layout-forms");
return T("div", { className: "ff-grid-layout-form", style: { "--grid-layout-item-margin-x": `${(a == null ? void 0 : a[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(a == null ? void 0 : a[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: [o, s && C.cloneElement(s, { cols: e, rowHeight: t, itemMargin: a, containerPadding: n, fields: r })] });
};
Nt.propTypes = { fields: L.array };
const wn = (zt = Nt, ({ code: e, layout: t, name: a, primaryKey: n = 0, style: r = {}, formProps: s = {}, form: i, isPreview: o = !1, className: l, onFinish: u, onValuesChange: d = () => {
const wn = (zt = Nt, ({ code: e, layout: t, name: a, primaryKey: n = 0, style: r = {}, formProps: s = {}, form: i, isPreview: o = !1, className: l, onFinish: c, onValuesChange: u = () => {
}, ...f }) => {
const { align: m, autoComplete: h, resource: y, items: b, hides: w, rowHeight: k, marginX: V, marginY: j, cols: U, listenChangeFields: D, listenChangeFieldsFunc: S, pk: I, uuid: O } = gn(e), [W] = X.useForm(i), H = Z(() => [{ name: "__PK__", value: I }, { name: "__PROPS__", value: s }, { name: "__RESOURCE__", value: y }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: O }, { name: "__PRIMARY_KEY__", value: n }], [I, e, O, y, n, s]);
return T(X, { className: l, name: a || e, layout: t || m, fields: H, form: W, autoComplete: h, style: { ...r, position: "relative" }, onFinish: u, onValuesChange: (z, R) => (({ changedValues: se, allValues: A, listenChangeFields: Fe, listenChangeFieldsFunc: Se, onValuesChange: at, code: Tt }) => {
return T(X, { className: l, name: a || e, layout: t || m, fields: H, form: W, autoComplete: h, style: { ...r, position: "relative" }, onFinish: c, onValuesChange: (z, R) => (({ changedValues: se, allValues: A, listenChangeFields: Fe, listenChangeFieldsFunc: Se, onValuesChange: at, code: Tt }) => {
at(se, A), Se && Array.isArray(Fe) && we.exec(Se, { changedValues: se, allValues: A }, { getFieldValue: W.getFieldValue, setFieldValue: W.setFieldValue, setFieldsValue: W.setFieldsValue, isFieldTouched: W.isFieldTouched, isFieldsTouched: W.isFieldsTouched });
})({ changedValues: z, allValues: R, listenChangeFields: D, listenChangeFieldsFunc: S, onValuesChange: d, code: e }), children: [c(zt, { ...f, form: W, code: e, fields: b, cols: U, rowHeight: k, itemMargin: [V, j] }), w == null ? void 0 : w.map((z) => {
})({ changedValues: z, allValues: R, listenChangeFields: D, listenChangeFieldsFunc: S, onValuesChange: u, code: e }), children: [d(zt, { ...f, form: W, code: e, fields: b, cols: U, rowHeight: k, itemMargin: [V, j] }), w == null ? void 0 : w.map((z) => {
var R;
return c(Jt, { name: z.code, children: c(fn, { form: W, name: z.code, type: z.type, initialValue: z.initialValue, initialValueLanguage: (R = z.extras) == null ? void 0 : R.initialValueLanguage }) }, JSON.stringify(z.code));
return d(Jt, { name: z.code, children: d(fn, { form: W, name: z.code, type: z.type, initialValue: z.initialValue, initialValueLanguage: (R = z.extras) == null ? void 0 : R.initialValueLanguage }) }, JSON.stringify(z.code));
})] }, e);
});
var zt;
@ -665,22 +665,22 @@ const ua = ({ $setting: e, $close: t, extras: a, code: n, primaryKey: r, ...s })
const [i] = X.useForm(), o = mn(n, r, e);
return x(() => {
o && i.setFieldsValue(o);
}, [o]), c(K, { actions: T(C.Fragment, { children: [c($, { name: "保存", type: "primary", widget: () => {
const l = i.getFieldValue("__RESOURCE__"), { initDataUri: u = `/api/${n}` } = e || {};
i.validateFields(!0).then((d) => l ? p.pick(d, [l]) : d).then((d) => E.post(r ? `${u}/${r}` : `${u}`, d).msg(t)).catch(() => _.error("请先完善表单信息", { duration: 2e3 }));
} }), c($, { name: "取消", widget: () => t(!1) })] }), extras: a, children: c(wn, { form: i, code: n, primaryKey: r, ...s }) });
}, [o]), d(K, { actions: T(C.Fragment, { children: [d($, { name: "保存", type: "primary", widget: () => {
const l = i.getFieldValue("__RESOURCE__"), { initDataUri: c = `/api/${n}` } = e || {};
i.validateFields(!0).then((u) => l ? p.pick(u, [l]) : u).then((u) => E.post(r ? `${c}/${r}` : `${c}`, u).msg(t)).catch(() => _.error("请先完善表单信息", { duration: 2e3 }));
} }), d($, { name: "取消", widget: () => t(!1) })] }), extras: a, children: d(wn, { form: i, code: n, primaryKey: r, ...s }) });
}, Cn = (e, t, a, { isReplaceRouteHistory: n = !1 } = {}) => le.redirect(a, t, { replace: n }), Wt = (e, t, a, { status: { loading: n, disabled: r }, setStatus: s }) => {
const i = { loading: (o) => o === void 0 ? n : s((l) => ({ ...l, loading: o })), disabled: (o) => o === void 0 ? r : s((l) => ({ ...l, disabled: o })) };
return p.isFunction(a) ? a.call(null, { ...t, ...i }) : p.isString(a) && a ? we.exec(a, t, i) : null;
}, Ut = (e, t, a, n, r) => p.isString(a) && a ? G.getWidgetComponent(a).then(({ default: s }) => _.modal(s, { ...t, $setting: n }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r)).catch((s) => {
_.error(a, { content: s.toString() });
}) : _.modal(a, { ...t, $setting: n }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r), bn = (e, t, a, n, r) => _.modal(ua, { ...t, $setting: n, code: a }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r), kn = (e, t, a, n, r) => _.modal(kt, { base62params: t, $setting: n, listCode: a }, r != null && r.title ? { ...r, title: p.template(r.title)(e) } : r), vn = ({ widget: e, widgetType: t, widgetData: a, widgetProps: n, widgetSetting: r, widgetContainerProps: s }, { onAfterClick: i, onBeforeClick: o }) => {
const l = Ue(ve), [u, d] = N({ leading: !0, trailing: !1 }), f = Z(() => {
const l = Ue(ve), [c, u] = N({ leading: !0, trailing: !1 }), f = Z(() => {
switch (t) {
case "redirect":
return p.partialRight(Cn, e, r);
case "func":
return p.partialRight(Wt, (r == null ? void 0 : r.code) ?? e, { status: u, setStatus: d });
return p.partialRight(Wt, (r == null ? void 0 : r.code) ?? e, { status: c, setStatus: u });
case "fsdpf-component":
return p.partialRight(Ut, e, r, s);
case "grid-layout-form":
@ -689,11 +689,11 @@ const ua = ({ $setting: e, $close: t, extras: a, code: n, primaryKey: r, ...s })
return p.partialRight(kn, e, r, s);
default:
if (xt(e) || C.isValidElement(e)) return p.partialRight(Ut, e, r, s);
if (p.isFunction(e)) return p.partialRight(Wt, (r == null ? void 0 : r.code) || e, { status: u, setStatus: d });
if (p.isFunction(e)) return p.partialRight(Wt, (r == null ? void 0 : r.code) || e, { status: c, setStatus: u });
}
return (...m) => console.error("useButton unknown widgetType", t, ...m);
}, [e, t]);
return [p.debounce((m) => (o == null || o(m), Promise.resolve(Yt(n, m, { list: l })).then((h) => f(m, { ...a, ...h })).then((h) => i == null ? void 0 : i(h)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u];
return [p.debounce((m) => (o == null || o(m), Promise.resolve(Yt(n, m, { list: l })).then((h) => f(m, { ...a, ...h })).then((h) => i == null ? void 0 : i(h)).catch(console.error)), 300, { leading: !0, trailing: !1 }), c];
}, Bt = /* @__PURE__ */ new Set(), ft = (e = [], t = 0) => {
const a = e[t];
if (a.length && !Bt.has(a)) {
@ -704,22 +704,22 @@ const ua = ({ $setting: e, $close: t, extras: a, code: n, primaryKey: r, ...s })
ft(e, t + 1);
}), Bt.add(a), document.body.appendChild(n);
}
}, yt = ({ className: e, type: t, style: a = {}, ...n }) => c("span", { role: "img", className: F("ff-iconfont", e), style: a, ...n, children: c("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: c("use", { xlinkHref: `#${t}` }) }) });
}, yt = ({ className: e, type: t, style: a = {}, ...n }) => d("span", { role: "img", className: F("ff-iconfont", e), style: a, ...n, children: d("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: d("use", { xlinkHref: `#${t}` }) }) });
yt.propTypes = { className: L.string, type: L.string.isRequired, style: L.object }, yt.init = ft;
const qe = (e) => function({ className: t, children: a, name: n, icon: r, type: s = "default", iconPosition: i = "start", noAuthType: o, onAfterClick: l, onBeforeClick: u, data: d, loading: f, disabled: m, tooltip: h, popConfirm: y, widget: b, widgetType: w, widgetData: k, widgetProps: V, widgetSetting: j, widgetContainerProps: U, ...D }) {
const qe = (e) => function({ className: t, children: a, name: n, icon: r, type: s = "default", iconPosition: i = "start", noAuthType: o, onAfterClick: l, onBeforeClick: c, data: u, loading: f, disabled: m, tooltip: h, popConfirm: y, widget: b, widgetType: w, widgetData: k, widgetProps: V, widgetSetting: j, widgetContainerProps: U, ...D }) {
const S = { type: "primary", className: F("ff-button", t), iconPosition: i };
s === "danger" ? S.danger = !0 : s === "default" && (S.type = s), e === "link" || e === "dashed" ? (S.type = e, s === "default" && (S.className = F(S.className, "ff-default"))) : e !== "circle" && e !== "round" || (S.shape = e), r && (S.icon = c(yt, { type: r }));
const [I, O] = N(!1), [W, { disabled: H, loading: z }] = vn({ widget: b, widgetType: w, widgetData: k, widgetProps: V, widgetSetting: j, widgetContainerProps: U }, { onAfterClick: l, onBeforeClick: u });
return c(Fa, { okText: "确定", cancelText: "取消", ...y || {}, disabled: H || m, open: I, onOpenChange: (R) => {
s === "danger" ? S.danger = !0 : s === "default" && (S.type = s), e === "link" || e === "dashed" ? (S.type = e, s === "default" && (S.className = F(S.className, "ff-default"))) : e !== "circle" && e !== "round" || (S.shape = e), r && (S.icon = d(yt, { type: r }));
const [I, O] = N(!1), [W, { disabled: H, loading: z }] = vn({ widget: b, widgetType: w, widgetData: k, widgetProps: V, widgetSetting: j, widgetContainerProps: U }, { onAfterClick: l, onBeforeClick: c });
return d(Fa, { okText: "确定", cancelText: "取消", ...y || {}, disabled: H || m, open: I, onOpenChange: (R) => {
if (!R) return O(R);
y ? O(R) : W(d);
y ? O(R) : W(u);
}, onConfirm: () => {
W(d);
W(u);
}, onClick: (R) => {
R.stopPropagation();
}, children: c(Ra, { ...h, title: I ? null : h == null ? void 0 : h.title, trigger: ["hover", "click"], children: c(ot, { loading: z || f, disabled: H || m, ...S, ...D, children: a || n }) }) });
}, children: d(Ra, { ...h, title: I ? null : h == null ? void 0 : h.title, trigger: ["hover", "click"], children: d(ot, { loading: z || f, disabled: H || m, ...S, ...D, children: a || n }) }) });
}, $ = qe("default"), Sn = qe("link"), $n = qe("circle"), Nn = qe("round"), Pn = qe("dashed"), Dt = ({ data: e, widget: t, widgetType: a = "fsdpf-component", children: n, widgetData: r, widgetProps: s, widgetSetting: i, widgetContainerProps: o }) => {
const l = Ue(ve), [u, d] = N(!1), [f, m] = N("hover"), [h, y] = N({}), [b, w] = N(), { placement: k, align: V, arrow: j = { pointAtCenter: !0 }, getPopupContainer: U, ...D } = o || {};
const l = Ue(ve), [c, u] = N(!1), [f, m] = N("hover"), [h, y] = N({}), [b, w] = N(), { placement: k, align: V, arrow: j = { pointAtCenter: !0 }, getPopupContainer: U, ...D } = o || {};
x(() => {
a == "grid-layout-form" ? w(C.createElement(ua, { ...r, $setting: i, code: t })) : a == "data-list" ? w(C.createElement(kt, { base62params: e, $setting: i, listCode: t })) : p.isString(t) ? G.getWidgetComponent(t).then(({ default: O }) => {
w(C.createElement(O, { ...r, $setting: i }));
@ -728,29 +728,29 @@ const qe = (e) => function({ className: t, children: a, name: n, icon: r, type:
Promise.resolve(Yt(s, e, { list: l })).then(y);
}, [s, e]);
const S = (O) => {
d(O), !O && m("hover");
u(O), !O && m("hover");
}, I = (O) => {
d(!0), m("click");
u(!0), m("click");
};
return c(Oa, { zIndex: 1080, placement: k, onPopupClick: I, onClick: I, open: u, align: V, arrow: j, trigger: f, getPopupContainer: U, content: c(xn, { ...D, children: b && C.cloneElement(b, { ...h, $close: () => S(!1) }) }), children: n, onOpenChange: S });
return d(Oa, { zIndex: 1080, placement: k, onPopupClick: I, onClick: I, open: c, align: V, arrow: j, trigger: f, getPopupContainer: U, content: d(xn, { ...D, children: b && C.cloneElement(b, { ...h, $close: () => S(!1) }) }), children: n, onOpenChange: S });
}, xn = ({ title: e, className: t, children: a, width: n, height: r, ...s }) => {
const [i, o] = N({}), l = ce((f, m) => o((h) => ({ ...h, [f]: m })), []), u = ce((f) => o((m) => ({ ...m, [f]: void 0 })), []), d = e ? C.createElement("div", { className: "ff-popup-title" }, e) : i == null ? void 0 : i.title;
return c(Be.Provider, { value: { ele: i, mount: l, unmount: u }, children: T("div", { className: F("ff-popup ff-popover", t), style: { width: n, height: r }, ...s, children: [T("div", { className: "ff-popup-header", children: [d, i == null ? void 0 : i["sub-title"]] }), a, T("div", { className: "ff-popup-footer", children: [i == null ? void 0 : i.extras, i == null ? void 0 : i.actions] })] }) });
const [i, o] = N({}), l = ce((f, m) => o((h) => ({ ...h, [f]: m })), []), c = ce((f) => o((m) => ({ ...m, [f]: void 0 })), []), u = e ? C.createElement("div", { className: "ff-popup-title" }, e) : i == null ? void 0 : i.title;
return d(Be.Provider, { value: { ele: i, mount: l, unmount: c }, children: T("div", { className: F("ff-popup ff-popover", t), style: { width: n, height: r }, ...s, children: [T("div", { className: "ff-popup-header", children: [u, i == null ? void 0 : i["sub-title"]] }), a, T("div", { className: "ff-popup-footer", children: [i == null ? void 0 : i.extras, i == null ? void 0 : i.actions] })] }) });
};
Dt.propTypes = { widgetType: L.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }, $.propTypes = { type: L.oneOf(["primary", "default", "danger", ""]), name: L.string, icon: L.string, iconPosition: L.oneOf(["start", "end"]), data: L.any, widget: L.any, widgetType: L.oneOf(["destroy", "redirect", "func", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: L.object, widgetProps: L.object, widgetSetting: L.object, widgetContainerProps: L.object }, $.Link = Sn, $.Link.defaultProps = $.defaultProps, $.Link.propTypes = $.propTypes, $.Circle = $n, $.Circle.defaultProps = $.defaultProps, $.Circle.propTypes = $.propTypes, $.Round = Nn, $.Round.defaultProps = $.defaultProps, $.Round.propTypes = $.propTypes, $.Dashed = Pn, $.Dashed.defaultProps = $.defaultProps, $.Dashed.propTypes = $.propTypes, $.Popover = Dt;
const Tn = ({ fields: e, formProps: t, $close: a }) => {
const [n] = X.useForm(), r = Z(() => [{ name: "__PROPS__", value: t }], [t]);
return c(K, { actions: T(C.Fragment, { children: [c($, { name: "取消", widget: () => a(!1) }), c($, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(a) })] }), children: c(X, { fields: r, form: n, className: "ff-modal-form", children: e == null ? void 0 : e.map(({ code: s, ...i }) => c(yn, { code: s, ...i }, s)) }) });
}, En = ({ className: e, $close: t, children: a, title: n, subTitle: r, actions: s, extras: i, zIndex: o, ...l }) => T(Ba, { ...l, prefixCls: "ff-drawer", className: F("ff-popup", e), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (u) => ({ motionAppear: !0, motionName: `panel-motion-${u}` }), children: [T("div", { className: "ff-popup-header", children: [c("button", { "aria-label": "Close", className: "ff-popup-close", onClick: l.onClose, children: c(bt, { type: "close" }) }), n, r] }), c("div", { className: "ff-popup-body", children: a }), T("div", { className: "ff-popup-footer", children: [i, s] })] }), Fn = ({ className: e, $close: t, $event: a, children: n, title: r, subTitle: s, actions: i, extras: o, zIndex: l, placement: u, ...d }) => {
return d(K, { actions: T(C.Fragment, { children: [d($, { name: "取消", widget: () => a(!1) }), d($, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(a) })] }), children: d(X, { fields: r, form: n, className: "ff-modal-form", children: e == null ? void 0 : e.map(({ code: s, ...i }) => d(yn, { code: s, ...i }, s)) }) });
}, En = ({ className: e, $close: t, children: a, title: n, subTitle: r, actions: s, extras: i, zIndex: o, ...l }) => T(Ba, { ...l, prefixCls: "ff-drawer", className: F("ff-popup", e), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (c) => ({ motionAppear: !0, motionName: `panel-motion-${c}` }), children: [T("div", { className: "ff-popup-header", children: [d("button", { "aria-label": "Close", className: "ff-popup-close", onClick: l.onClose, children: d(bt, { type: "close" }) }), n, r] }), d("div", { className: "ff-popup-body", children: a }), T("div", { className: "ff-popup-footer", children: [i, s] })] }), Fn = ({ className: e, $close: t, $event: a, children: n, title: r, subTitle: s, actions: i, extras: o, zIndex: l, placement: c, ...u }) => {
const f = (a == null ? void 0 : a.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: a == null ? void 0 : a.pageX, y: a == null ? void 0 : a.pageY } };
return c(Da, { ...d, ...f, prefixCls: "ff-modal", modalRender: () => T("div", { className: F("ff-modal-content ff-popup", e), children: [T("div", { className: "ff-popup-header", children: [c("button", { "aria-label": "Close", className: "ff-popup-close", onClick: d.onClose, children: c(bt, { type: "close" }) }), r, s] }), c("div", { className: "ff-popup-body", children: n }), T("div", { className: "ff-popup-footer", children: [o, i] })] }) });
return d(Da, { ...u, ...f, prefixCls: "ff-modal", modalRender: () => T("div", { className: F("ff-modal-content ff-popup", e), children: [T("div", { className: "ff-popup-header", children: [d("button", { "aria-label": "Close", className: "ff-popup-close", onClick: u.onClose, children: d(bt, { type: "close" }) }), r, s] }), d("div", { className: "ff-popup-body", children: n }), T("div", { className: "ff-popup-footer", children: [o, i] })] }) });
}, ga = ({ placement: e, $close: t, $event: a, children: n, title: r, ...s }) => {
const [i, o] = N({}), [l, u] = N(!0), d = ce((y, b) => o((w) => ({ ...w, [y]: b })), []), f = ce((y) => o((b) => ({ ...b, [y]: void 0 })), []);
let m = { ...s, className: i.rootClassName, title: i.title || r && C.createElement("div", { className: F("ff-popup-title") }, r), subTitle: i["sub-title"], actions: i.actions, extras: i.extras, children: n, $close: t, $event: a, onClose: () => u(!1) };
const [i, o] = N({}), [l, c] = N(!0), u = ce((y, b) => o((w) => ({ ...w, [y]: b })), []), f = ce((y) => o((b) => ({ ...b, [y]: void 0 })), []);
let m = { ...s, className: i.rootClassName, title: i.title || r && C.createElement("div", { className: F("ff-popup-title") }, r), subTitle: i["sub-title"], actions: i.actions, extras: i.extras, children: n, $close: t, $event: a, onClose: () => c(!1) };
const h = () => {
t(!1);
};
return c(Be.Provider, { value: { ele: i, mount: d, unmount: f }, children: e && e !== "center" ? c(En, { ...m, placement: e, open: l, afterOpenChange: (y) => !y && h() }) : c(Fn, { ...m, visible: l, afterClose: h }) });
return d(Be.Provider, { value: { ele: i, mount: u, unmount: f }, children: e && e !== "center" ? d(En, { ...m, placement: e, open: l, afterOpenChange: (y) => !y && h() }) : d(Fn, { ...m, visible: l, afterClose: h }) });
};
ga.propTypes = { placement: L.oneOf(["center", "left", "top", "right", "bottom"]) };
const J = () => {
@ -759,14 +759,14 @@ const J = () => {
return { height: i };
}, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, a] = C.useReducer((s) => s + 1, 0);
x(() => {
J.$onClick = n, J.$queue.forEach(([s, i, o], l, u) => {
r([i, o], ...s), delete u[l];
J.$onClick = n, J.$queue.forEach(([s, i, o], l, c) => {
r([i, o], ...s), delete c[l];
});
}, []);
const n = (s, i = {}, o = {}) => new Promise((l, u) => r([l, u], s, i, o)), r = ([s, i], o, l = {}, u = {}) => {
const d = J.$index++, f = (m) => ((h, y) => (J.$popups.delete(h), a(), y == null ? void 0 : y()))(d, () => s(m));
if (o === Gt) return e.open({ ...u, key: d, content: C.createElement(o, { ...l, $close: () => e.close(d) }) });
J.$popups.set(d, C.createElement(ga, { zIndex: d, maskClosable: !1, $event: l == null ? void 0 : l.$event, ...u, key: d, $close: f }, C.isValidElement(o) ? C.cloneElement(o, { ...l, $close: f }) : o != null && o.name || Lt.isForwardRef(o) || (o == null ? void 0 : o.$$typeof) === Lt.ForwardRef ? C.createElement(o, { ...l, $close: f }) : o)), a();
const n = (s, i = {}, o = {}) => new Promise((l, c) => r([l, c], s, i, o)), r = ([s, i], o, l = {}, c = {}) => {
const u = J.$index++, f = (m) => ((h, y) => (J.$popups.delete(h), a(), y == null ? void 0 : y()))(u, () => s(m));
if (o === Gt) return e.open({ ...c, key: u, content: C.createElement(o, { ...l, $close: () => e.close(u) }) });
J.$popups.set(u, C.createElement(ga, { zIndex: u, maskClosable: !1, $event: l == null ? void 0 : l.$event, ...c, key: u, $close: f }, C.isValidElement(o) ? C.cloneElement(o, { ...l, $close: f }) : o != null && o.name || Lt.isForwardRef(o) || (o == null ? void 0 : o.$$typeof) === Lt.ForwardRef ? C.createElement(o, { ...l, $close: f }) : o)), a();
};
return T(C.Fragment, { children: [Array.from(J.$popups).map(([s, i]) => i), t] });
};

2
dist/components.js vendored
View File

@ -1,4 +1,4 @@
import { a1 as s, U as p, a2 as n, a3 as t, a0 as d } from "./common/main-DgiG2gXc.js";
import { a1 as s, U as p, a2 as n, a3 as t, a0 as d } from "./common/main-BKsu5-u9.js";
export {
s as Empty,
p as Icon,

2
dist/container.js vendored
View File

@ -1,4 +1,4 @@
import { Z as o, a1 as s, a2 as p, a3 as t, _ as d, a0 as n, $ as r, Y as u } from "./common/main-DgiG2gXc.js";
import { Z as o, a1 as s, a2 as p, a3 as t, _ as d, a0 as n, $ as r, Y as u } from "./common/main-BKsu5-u9.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-DgiG2gXc.js";
import { D as p } from "./common/main-BKsu5-u9.js";
export {
p as default
};

2
dist/data-list.js vendored
View File

@ -1,4 +1,4 @@
import { o as t, m as e, h as r, k as o, p as i, l, j as u, n as D, i as L, q as n, f as m, s as p, z as C, w as b, x as k, y as F, v as c } from "./common/main-DgiG2gXc.js";
import { o as t, m as e, h as r, k as o, p as i, l, j as u, n as D, i as L, q as n, f as m, s as p, z as C, w as b, x as k, y as F, v as c } from "./common/main-BKsu5-u9.js";
export {
t as DataListContent,
e as DataListContext,

View File

@ -1,5 +1,5 @@
import "lodash";
import { b as a } from "../common/main-DgiG2gXc.js";
import { b as a } from "../common/main-BKsu5-u9.js";
export {
a as getDefaultExpandRowKeys
};

View File

@ -1,4 +1,4 @@
import { L as s, N as r, M as u, K as o, S as t, Q as d, T as m, P as F, O as i } from "./common/main-DgiG2gXc.js";
import { L as s, N as r, M as u, K as o, S as t, Q as d, T as m, P as F, O as i } from "./common/main-BKsu5-u9.js";
export {
s as GridLayoutForm,
r as GridLayoutFormHelper,

View File

@ -1,5 +1,5 @@
import "lodash";
import { ae as a } from "../common/main-DgiG2gXc.js";
import { ae as a } from "../common/main-BKsu5-u9.js";
export {
a as getOptionItemByValue
};

2
dist/grid-layout.js vendored
View File

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

View File

@ -1,4 +1,4 @@
import { a as t } from "../common/main-DgiG2gXc.js";
import { a as t } from "../common/main-BKsu5-u9.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 { F as r, E as o, I as p, B as f, C as i, J as m, A as c } from "./common/main-DgiG2gXc.js";
import { F as r, E as o, I as p, B as f, C as i, J as m, A as c } from "./common/main-BKsu5-u9.js";
import { default as E } from "rc-util/lib/hooks/useMergedState";
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 { U as a } from "./common/main-DgiG2gXc.js";
import { U as a } from "./common/main-BKsu5-u9.js";
export {
a as default
};

2
dist/index.js vendored
View File

@ -1,4 +1,4 @@
import { ac as t, ad as e, a8 as o, a9 as n, a4 as p, aa as c, a7 as r, a6 as f, a5 as l, ab as u } from "./common/main-DgiG2gXc.js";
import { ac as t, ad as e, a8 as o, a9 as n, a4 as p, aa as c, a7 as r, a6 as f, a5 as l, ab as u } from "./common/main-BKsu5-u9.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-DgiG2gXc.js";
import { R as a } from "./common/main-BKsu5-u9.js";
export {
a as default
};

2
dist/utils.js vendored
View File

@ -1,5 +1,5 @@
import "lodash";
import { g as a, r as i, t as o } from "./common/main-DgiG2gXc.js";
import { g as a, r as i, t as o } from "./common/main-BKsu5-u9.js";
export {
a as getWidgetPropsData,
i as replaceKeys,

View File

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