This commit is contained in:
2026-06-17 13:15:12 +08:00
parent 08f9274903
commit 7b140892ae
19 changed files with 110 additions and 110 deletions

View File

@@ -30,23 +30,23 @@ import { useMergedState as Xi } from "rc-util";
import { generatePath as Qi, useInRouterContext as Bn, useParams as Zi, useLocation as er, createBrowserRouter as tr, Navigate as nr } from "react-router-dom";
import ir from "rc-drawer";
import rr from "rc-dialog";
import * as $n from "react-is";
var He, it, _e, xe, We, Be;
import * as xn from "react-is";
var He, it, _e, $e, We, Be;
class zn {
constructor(e, n) {
v(this, He, /* @__PURE__ */ new Map());
v(this, it, !0);
v(this, _e, []);
v(this, xe);
v(this, We, () => d(this, xe));
v(this, $e);
v(this, We, () => d(this, $e));
v(this, Be, () => Promise.resolve());
T(this, "get", (...e) => new Promise((n, i) => {
const r = JSON.stringify(e);
if (d(this, He).has(r)) return n(d(this, Be).call(this, d(this, xe), ...e));
if (d(this, xe) === void 0) d(this, _e).push([e, n, i]), d(this, it) && (K(this, it, !1), Promise.resolve(typeof d(this, We) == "function" ? d(this, We).call(this) : d(this, We)).then((a) => K(this, xe, a || null)).finally(() => {
if (d(this, He).has(r)) return n(d(this, Be).call(this, d(this, $e), ...e));
if (d(this, $e) === void 0) d(this, _e).push([e, n, i]), d(this, it) && (K(this, it, !1), Promise.resolve(typeof d(this, We) == "function" ? d(this, We).call(this) : d(this, We)).then((a) => K(this, $e, a || null)).finally(() => {
d(this, _e).forEach(([a, o, s]) => {
try {
const l = d(this, Be).call(this, d(this, xe), ...a);
const l = d(this, Be).call(this, d(this, $e), ...a);
d(this, He).set(JSON.stringify(a), l), o(l);
} catch (l) {
s(l);
@@ -54,14 +54,14 @@ class zn {
}), d(this, _e).length = 0;
}));
else {
const a = d(this, Be).call(this, d(this, xe), ...e);
const a = d(this, Be).call(this, d(this, $e), ...e);
d(this, He).set(r, a), n(a);
}
}));
K(this, Be, n), K(this, We, e);
}
}
He = new WeakMap(), it = new WeakMap(), _e = new WeakMap(), xe = new WeakMap(), We = new WeakMap(), Be = new WeakMap();
He = new WeakMap(), it = new WeakMap(), _e = new WeakMap(), $e = new WeakMap(), We = new WeakMap(), Be = new WeakMap();
const Oa = () => m("div", { children: "Empty" }), ht = E.createContext({ ele: {}, mount: () => {
}, unmount: () => {
} }), te = ({ rootClassName: t, className: e, children: n, actions: i, title: r, subTitle: a, extras: o, style: s = {} }) => {
@@ -77,7 +77,7 @@ const Ra = () => m(te, { className: "ff-loading", children: I("div", { className
return typeof (t == null ? void 0 : t.type) == "string" ? t : m(ht.Provider, { value: { ele: e, mount: i, unmount: r }, children: E.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) });
};
Un.propTypes = { children: C.element.isRequired };
const xn = { 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"] }, tn = ({ type: t, props: e }) => m("i", { ...e, children: m("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (xn[t] || xn.info).map((n, i) => m("path", { d: n }, i)) }) }), qn = ({ className: t, content: e, icon: n, $close: i }) => I(E.Fragment, { children: [n && m("div", { className: j("ff-notification-icon", t), children: m(tn, { type: n }) }), e] }), ar = ({}) => m(te, { children: "Confirm" });
const $n = { 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"] }, tn = ({ type: t, props: e }) => m("i", { ...e, children: m("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: ($n[t] || $n.info).map((n, i) => m("path", { d: n }, i)) }) }), qn = ({ className: t, content: e, icon: n, $close: i }) => I(E.Fragment, { children: [n && m("div", { className: j("ff-notification-icon", t), children: m(tn, { type: n }) }), e] }), ar = ({}) => m(te, { children: "Confirm" });
var Oe, Je;
const me = class me {
constructor() {
@@ -112,13 +112,13 @@ const fe = class fe {
Re = new WeakMap(), rt = new WeakMap(), v(fe, Re, null), T(fe, "getInstance", () => (d(fe, Re) || K(fe, Re, new fe()), d(fe, Re)));
let qt = fe;
const qe = qt.getInstance();
var Ge, $t, at, ot, xt;
var Ge, xt, at, ot, $t;
const Te = class Te {
constructor(...e) {
v(this, at, []);
v(this, ot, (e) => {
var n;
for (let i of e) Array.isArray(i[0]) ? d(this, ot).call(this, i) : d(this, at).push(d(n = Te, $t).call(n, i[0], i[1]));
for (let i of e) Array.isArray(i[0]) ? d(this, ot).call(this, i) : d(this, at).push(d(n = Te, xt).call(n, i[0], i[1]));
});
T(this, "toValue", async (e, n = null) => {
const i = { getValue: () => e, getRecord: () => n };
@@ -135,8 +135,8 @@ const Te = class Te {
}
return r;
});
T(this, "toRender", (e, n, i = null) => E.createElement(d(this, xt), { value: e, record: n }, i));
v(this, xt, ({ value: e, record: n, children: i }) => {
T(this, "toRender", (e, n, i = null) => E.createElement(d(this, $t), { value: e, record: n }, i));
v(this, $t, ({ value: e, record: n, children: i }) => {
const [r, a] = L(i), o = Di();
return en(() => {
a(i), this.toValue(e, n).then((s) => o() && a(s)).catch((s) => o() && a(`${s}`));
@@ -145,7 +145,7 @@ const Te = class Te {
d(this, ot).call(this, e);
}
};
Ge = new WeakMap(), $t = new WeakMap(), at = new WeakMap(), ot = new WeakMap(), xt = new WeakMap(), v(Te, Ge, null), v(Te, $t, f.memoize((e, n) => {
Ge = new WeakMap(), xt = new WeakMap(), at = new WeakMap(), ot = new WeakMap(), $t = new WeakMap(), v(Te, Ge, null), v(Te, xt, f.memoize((e, n) => {
if (typeof e == "function") return e(n);
if (typeof e == "string") return se.getWidgetComponent(e).then((i) => {
var r;
@@ -239,14 +239,14 @@ const sr = (t) => function(e) {
const h = f.get(c, "__PARENT_ID__", ""), g = f.get(c, n, f.get(c, [i, n], "")), y = f.findIndex(o.current, ["__PARENT_ID__", h]), w = f.findIndex(y > -1 ? f.get(o.current, [y, "children"]) : o.current, [n, g]);
if (w === -1) return (p = t.onReload) == null ? void 0 : p.call(t);
Promise.all([W.get(`/api/${e}/detail/${g}`), W.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([S, b]) => {
const x = f.get(o.current, y > -1 ? [y, "children", w, "children"] : [w, "children"]);
o.current = Wn(o.current, y > -1 ? { [y]: { children: { $splice: [[w, 1, { ...S, children: x }]] } } } : { $splice: [[w, 1, { ...S, children: x }]] });
const $ = f.get(o.current, y > -1 ? [y, "children", w, "children"] : [w, "children"]);
o.current = Wn(o.current, y > -1 ? { [y]: { children: { $splice: [[w, 1, { ...S, children: $ }]] } } } : { $splice: [[w, 1, { ...S, children: $ }]] });
const k = new Map(b);
s.current.forEach(($, F) => {
s.current.forEach((x, F) => {
var A;
(A = k.get(F)) != null && A.some((O) => O == g) || s.current.set(F, $.filter((O) => O !== g));
}), k.forEach(($, F) => {
s.current.has(F) ? s.current.set(F, f.uniq([...s.current.get(F) || [], ...$])) : s.current.set(F, $);
(A = k.get(F)) != null && A.some((O) => O == g) || s.current.set(F, x.filter((O) => O !== g));
}), k.forEach((x, F) => {
s.current.has(F) ? s.current.set(F, f.uniq([...s.current.get(F) || [], ...x])) : s.current.set(F, x);
});
}).then(() => {
a.current = !0, r();
@@ -264,12 +264,12 @@ const sr = (t) => function(e) {
}, [t, e]);
const s = z(() => f.pick(i.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [i.current]);
return Object.assign(s, { onTabChange: (l) => o({ tab: l, page: 1 }), onPageChange: (l, c) => o({ page: l, pageSize: c }), onPageSizeChange: (l) => o({ pageSize: l, page: 1 }), onConditionChange: (l, c) => o({ keyword: c, condition: Wn(i.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => o({ sider: l, page: 1 }), onKeywordChange: (l) => o({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: a.current, onReload: o, payload: e == null ? void 0 : e.payload });
}, gr = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, itemGridLayout: g, $setting: y, tabs: w, isConditionFormLayout: S, isTreeSider: b, treeSiderConfig: x, rowSelection: k }) => {
const { classNames: $, onClickCallback: F } = ge(le), A = f.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style", "itemMargin", "containerPadding"]), O = y == null ? void 0 : y.isMarkSelected, N = Jn(l, c, p, u), V = G((P, M, D) => m(hr, { isMarkSelected: O, className: j("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: a ? N(M) : [], data: u ? { [u]: M } : M, children: P, onClickCallback: F }), [O, u, p, a, F, l, c]);
return I("div", { className: j("ff-data-list-framework", e), children: [m(n.sider, { isTreeSider: b, ...x }), I("div", { className: j("ff-data-list-container", $ == null ? void 0 : $.container), children: [m(n.filter, { isConditionFormLayout: S }), m(n.toolbar, { title: h, tabs: w }), m(Nr, { ...A, ...g, rowSelection: k, empty: m(n.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: V, dataSource: i }), m(n.footer, { isPaginate: r, isOperations: o, operations: s })] })] });
}, hr = ({ className: t, operations: e, children: n, data: i, onClickCallback: r, onSelect: a, isMarkSelected: o, isSelected: s, selectionType: l }) => I("div", { className: j("data-list-grid-layout-item", { "is-mark-selected": o, "is-selected": s, "is-selectable": !!l }, t), onClick: a, children: [m("div", { className: "data-list-grid-layout-item-container", children: n }), !!(e != null && e.length) && m("div", { className: "data-list-grid-layout-item-actions", children: e.map((c) => m("span", { className: "data-list-grid-layout-item-action", children: m(R.Link, { uuid: c.uuid, type: c.type, name: c.name, widget: c.widget, widgetType: c.widgetType, widgetProps: c.widgetProps, widgetSetting: c.widgetSetting, widgetContainerProps: c.widgetContainerSetting, data: i, confirm: c.confirm, onAfterClick: (u) => u !== !1 && (r == null ? void 0 : r(c.isRefresh, i)) }, c.uuid || Dt()) }, (c == null ? void 0 : c.uuid) || Dt())) })] }), mr = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, tabs: g, isPaginate: y, rowSelection: w, isTreeSider: S, treeSiderConfig: b, isConditionFormLayout: x, ...k }) => {
const { classNames: $, onClickCallback: F } = ge(le), A = Jn(l, c, p, u), O = Kt(l, c, i, p, u);
return I("div", { className: j("ff-data-table-framework", e), children: [m(n.sider, { isTreeSider: S, ...b }), I("div", { className: j("ff-data-table-container", $ == null ? void 0 : $.container), children: [m(n.filter, { isConditionFormLayout: x }), m(n.toolbar, { title: h, tabs: g }), m(Sr, { ...k, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: i, rowSelection: w, operationRender: O ? (N) => {
}, gr = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, itemGridLayout: g, $setting: y, tabs: w, isConditionFormLayout: S, isTreeSider: b, treeSiderConfig: $, rowSelection: k }) => {
const { classNames: x, onClickCallback: F } = ge(le), A = f.pick(y, ["column", "colWidth", "beforeRender", "afterRender", "style", "itemMargin", "containerPadding"]), O = y == null ? void 0 : y.isMarkSelected, N = Jn(l, c, p, u), V = G((P, M, D) => m(hr, { isMarkSelected: O, className: j("ff-data-list-framework-item", x == null ? void 0 : x.item), operations: a ? N(M) : [], data: u ? { [u]: M } : M, children: P, onClickCallback: F }), [O, u, p, a, F, l, c]);
return I("div", { className: j("ff-data-list-framework", e), children: [m(n.sider, { isTreeSider: b, ...$ }), I("div", { className: j("ff-data-list-container", x == null ? void 0 : x.container), children: [m(n.filter, { isConditionFormLayout: S }), m(n.toolbar, { title: h, tabs: w }), m(Nr, { ...A, ...g, rowSelection: k, empty: m(n.empty, { className: x == null ? void 0 : x.empty }), primaryKey: p, itemRender: V, dataSource: i }), m(n.footer, { isPaginate: r, isOperations: o, operations: s })] })] });
}, hr = ({ className: t, operations: e, children: n, data: i, onClickCallback: r, onSelect: a, isMarkSelected: o, isSelected: s, selectionType: l }) => I("div", { className: j("data-list-grid-layout-item", { "is-mark-selected": o, "is-selected": s, "is-selectable": !!l }, t), onClick: a, children: [m("div", { className: "data-list-grid-layout-item-container", children: n }), !!(e != null && e.length) && m("div", { className: "data-list-grid-layout-item-actions", children: e.map((c) => m("span", { className: "data-list-grid-layout-item-action", children: m(R.Link, { uuid: c.uuid, type: c.type, name: c.name, widget: c.widget, widgetType: c.widgetType, widgetProps: c.widgetProps, widgetSetting: c.widgetSetting, widgetContainerProps: c.widgetContainerSetting, data: i, confirm: c.confirm, onAfterClick: (u) => u !== !1 && (r == null ? void 0 : r(c.isRefresh, i)) }, c.uuid || Dt()) }, (c == null ? void 0 : c.uuid) || Dt())) })] }), mr = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, tabs: g, isPaginate: y, rowSelection: w, isTreeSider: S, treeSiderConfig: b, isConditionFormLayout: $, ...k }) => {
const { classNames: x, onClickCallback: F } = ge(le), A = Jn(l, c, p, u), O = Kt(l, c, i, p, u);
return I("div", { className: j("ff-data-table-framework", e), children: [m(n.sider, { isTreeSider: S, ...b }), I("div", { className: j("ff-data-table-container", x == null ? void 0 : x.container), children: [m(n.filter, { isConditionFormLayout: $ }), m(n.toolbar, { title: h, tabs: g }), m(Sr, { ...k, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: i, rowSelection: w, operationRender: O ? (N) => {
var V;
return m("div", { className: "ff-data-table-actions", children: (V = A(N)) == null ? void 0 : V.map((P, M) => m(R.Link, { size: "small", uuid: P.uuid, type: P.type, name: P.name, widget: P.widget, widgetType: P.widgetType, widgetProps: P.widgetProps, widgetData: P.widgetData, widgetSetting: P.widgetSetting, widgetContainerProps: P.widgetContainerSetting, data: N, confirm: P.confirm, onAfterClick: (D) => D !== !1 && (F == null ? void 0 : F(P.isRefresh, N)) }, P.uuid || M)) });
} : null }), m(n.footer, { isPaginate: y, isOperations: o, operations: s })] })] });
@@ -283,8 +283,8 @@ const sr = (t) => function(e) {
var h, g;
const [n, i] = L({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = E.useContext(le), { keyword: c, condition: u } = (s == null ? void 0 : s()) || {}, [p] = bt.useForm();
return U(() => {
r && e && W.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: y, marginX: w, marginY: S, rowHeight: b, cols: x, fields: k }) => {
i({ resource: y, itemMargin: [w, S], rowHeight: b, cols: x, fields: k });
r && e && W.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: y, marginX: w, marginY: S, rowHeight: b, cols: $, fields: k }) => {
i({ resource: y, itemMargin: [w, S], rowHeight: b, cols: $, fields: k });
}).catch(() => i({}));
}, [r, e]), U(() => {
p.setFieldsValue({ keyword: c, ...u });
@@ -309,11 +309,11 @@ const yr = ({ className: t, operations: e, isOperations: n, isPaginate: i }) =>
}, Cr = ({ className: t, title: e, tabs: n }) => {
const { getBase62params: i, onTabChange: r, onReload: a, classNames: o } = ge(le), { tab: s } = (i == null ? void 0 : i()) || {}, [l, c] = Xi((n == null ? void 0 : n[0].value) ?? (n == null ? void 0 : n[0].code), { value: s, onChange: r });
return I("div", { className: j("ff-data-list-toolbar", o.toolbar, t), children: [m("div", { className: "ff-data-list-title", children: e }), m(Hi, { className: "ff-data-list-tabs", itemRender: ({ label: u, code: p, value: h }) => m("span", { onClick: () => c(h ?? p), className: j("ff-data-list-tab", { active: (h ?? p) == l }), children: u }), items: n }), I("div", { className: "ff-data-list-actions", children: [m(R.Link, { icon: "icon-reload", widget: () => a() }), m(R.Link, { icon: "icon-setting" })] })] });
}, kr = ({ className: t, ...e }) => m(zt, { className: j(t, "ff-data-list-empty"), image: zt.PRESENTED_IMAGE_SIMPLE, ...e }), Qn = ({ isItemGridLayout: t, theme: e, themeProps: n, onClickCallback: i, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: p, onTabChange: h, keyword: g, onKeywordChange: y, condition: w, onConditionChange: S, sider: b, onSiderChange: x, layouts: k, classNames: $ = {}, payload: F = {}, dataSource: A = [], rowSelection: O, getSelectedRows: N, primaryKey: V, ...P }) => {
}, kr = ({ className: t, ...e }) => m(zt, { className: j(t, "ff-data-list-empty"), image: zt.PRESENTED_IMAGE_SIMPLE, ...e }), Qn = ({ isItemGridLayout: t, theme: e, themeProps: n, onClickCallback: i, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: p, onTabChange: h, keyword: g, onKeywordChange: y, condition: w, onConditionChange: S, sider: b, onSiderChange: $, layouts: k, classNames: x = {}, payload: F = {}, dataSource: A = [], rowSelection: O, getSelectedRows: N, primaryKey: V, ...P }) => {
const [M, D] = L(), B = N ?? (() => A), X = G((q, ce) => {
const H = { tab: p, page: s, pageSize: c, keyword: g, sider: b, condition: w, total: o, payload: F };
return q && q != "init" ? f.get(H, q, ce) : H;
}, [JSON.stringify(w), JSON.stringify(F), p, s, c, g, b, o]), $e = z(() => {
}, [JSON.stringify(w), JSON.stringify(F), p, s, c, g, b, o]), xe = z(() => {
let q = { sider: br, filter: Xn, footer: yr, toolbar: Cr, empty: kr };
k === !1 ? q = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : f.isPlainObject(k) && (q = Object.assign({}, q, k));
for (const ce in q) if (q[ce]) {
@@ -328,8 +328,8 @@ const yr = ({ className: t, operations: e, isOperations: n, isPaginate: i }) =>
e ? se.getWidgetComponent(e).then((q) => {
if (!q) throw `${e} not found`;
return q;
}).catch((q) => ({ default: () => `${q}` })).then((q) => D(E.createElement(q.default, { ...P, layouts: $e, $setting: n }))) : D(m(t ? gr : mr, { ...P, layouts: $e, $setting: n }));
}, [e, n]), m(le.Provider, { value: { classNames: $, listCode: a, onClickCallback: i, onReload: r, getBase62params: X, onPageChange: l, onPageSizeChange: u, onTabChange: h, onSiderChange: x, onKeywordChange: y, onConditionChange: S, setPage: l, setPageSize: u, setTab: h, setSider: x, setKeyword: y, setCondition: S, getSelectedRows: B }, children: M && E.cloneElement(M, { dataSource: A, primaryKey: V, rowSelection: O, ...P }) });
}).catch((q) => ({ default: () => `${q}` })).then((q) => D(E.createElement(q.default, { ...P, layouts: xe, $setting: n }))) : D(m(t ? gr : mr, { ...P, layouts: xe, $setting: n }));
}, [e, n]), m(le.Provider, { value: { classNames: x, listCode: a, onClickCallback: i, onReload: r, getBase62params: X, onPageChange: l, onPageSizeChange: u, onTabChange: h, onSiderChange: $, onKeywordChange: y, onConditionChange: S, setPage: l, setPageSize: u, setTab: h, setSider: $, setKeyword: y, setCondition: S, getSelectedRows: B }, children: M && E.cloneElement(M, { dataSource: A, primaryKey: V, rowSelection: O, ...P }) });
};
Qn.propTypes = { classNames: C.exact({ sider: C.string, filter: C.string, footer: C.string, toolbar: C.string, container: C.string, content: C.string, item: C.string, empty: C.string }), layouts: C.oneOfType([C.exact({ sider: C.oneOfType([C.elementType, C.element]), filter: C.oneOfType([C.elementType, C.element]), footer: C.oneOfType([C.elementType, C.element]), toolbar: C.oneOfType([C.elementType, C.element]), empty: C.oneOfType([C.elementType, C.element]) }), C.bool]) };
var Fe, ve, ze, vt;
@@ -357,9 +357,9 @@ const ye = class ye {
Fe = new WeakMap(), ve = new WeakMap(), ze = new WeakMap(), vt = new WeakMap(), v(ye, Fe, null), T(ye, "getInstance", () => (d(ye, Fe) || K(ye, Fe, new ye()), d(ye, Fe)));
let Ht = ye;
const Zn = Ht.getInstance(), rn = E.forwardRef(({ listCode: t, base62params: e, className: n, theme: i, themeProps: r, layouts: a, classNames: o, rowSelection: s = null, onDataSourceChange: l }, c) => {
const [{ resource: u, primaryKey: p, batchOperations: h = [], itemOperations: g = [], columns: y = [], isConditionFormLayout: w = !1, isTreeSider: S, treeSiderConfig: b, theme: x, themeConfig: k, isItemGridLayout: $, itemGridLayout: { themeConfig: F, ...A } = {}, title: O, isPaginate: N, tabs: V, selectionType: P }, M] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: D = P, selectedRowKeys: B, defaultSelectedRowKeys: X, onChange: $e, ...q } = s ?? {}, ce = pr(t, e), [{ dataSource: H, itemOperationsAccess: yt, condition: hi, tab: mi, keyword: fi, page: dn, total: un, pageSize: pn, sider: yi, onConditionChange: wi, onTabChange: bi, onKeywordChange: Ci, onPageChange: ki, onPageSizeChange: Si, onSiderChange: Ei, onReload: jt, payload: $i }, gn] = ur(ce, t, p, u), xi = Sn(l);
const [{ resource: u, primaryKey: p, batchOperations: h = [], itemOperations: g = [], columns: y = [], isConditionFormLayout: w = !1, isTreeSider: S, treeSiderConfig: b, theme: $, themeConfig: k, isItemGridLayout: x, itemGridLayout: { themeConfig: F, ...A } = {}, title: O, isPaginate: N, tabs: V, selectionType: P }, M] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: D = P, selectedRowKeys: B, defaultSelectedRowKeys: X, onChange: xe, ...q } = s ?? {}, ce = pr(t, e), [{ dataSource: H, itemOperationsAccess: yt, condition: hi, tab: mi, keyword: fi, page: dn, total: un, pageSize: pn, sider: yi, onConditionChange: wi, onTabChange: bi, onKeywordChange: Ci, onPageChange: ki, onPageSizeChange: Si, onSiderChange: Ei, onReload: jt, payload: xi }, gn] = ur(ce, t, p, u), $i = Sn(l);
Vn(() => {
xi(H, { page: dn, pageSize: pn, total: un });
$i(H, { page: dn, pageSize: pn, total: un });
}, [H]);
const [hn, vi] = zi([], { defaultValue: X ?? [], value: B }), [mn, Pi] = L([]), fn = G(() => D ? mn : H, [D, mn, H]), Ni = Kt(g, yt, H, p), Ti = Kt(h);
U(() => {
@@ -372,17 +372,17 @@ const Zn = Ht.getInstance(), rn = E.forwardRef(({ listCode: t, base62params: e,
Pi((At) => {
const wn = new Map(At.map((de) => [de == null ? void 0 : de[p], de]));
return Ve.forEach((de) => wn.set(de == null ? void 0 : de[p], de)), Q.map((de) => wn.get(de)).filter(Boolean);
}), vi(Q), $e == null || $e(Q, Ve);
}), vi(Q), xe == null || xe(Q, Ve);
}), Oi = z(() => D ? { columnWidth: 80, ...q, type: D, selectedRowKeys: hn, onChange: yn } : void 0, [D, hn, yn, s]), Ri = z(() => f.merge({}, k, r), [k, r]), Fi = z(() => g == null ? void 0 : g.map((Q) => f.isEmpty(Q == null ? void 0 : Q.confirm) ? Q : { ...Q, confirm: Object.assign({}, Q.confirm, { getPopupContainer: () => document.body }) }), [g]), ji = z(() => ({ ...A, themeProps: F }), [A, F]);
return m(Qn, { listCode: t, title: O, classNames: o, layouts: a, resource: u, primaryKey: p, theme: i || x, themeProps: Ri, isTreeSider: S, treeSiderConfig: b, isPaginate: N, rowSelection: Oi, getSelectedRows: fn, tabs: V, isItemOperations: Ni, itemOperations: Fi, isBatchOperations: Ti, batchOperations: h, isItemGridLayout: $, columns: y, itemGridLayout: ji, isConditionFormLayout: w, itemOperationsAccess: yt, dataSource: H, onConditionChange: wi, onTabChange: bi, onKeywordChange: Ci, onPageChange: ki, onPageSizeChange: Si, onSiderChange: Ei, condition: hi, tab: mi, keyword: fi, page: dn, total: un, pageSize: pn, sider: yi, payload: $i, className: j("ff-data-list-helper", n), onReload: jt, onClickCallback: gn });
return m(Qn, { listCode: t, title: O, classNames: o, layouts: a, resource: u, primaryKey: p, theme: i || $, themeProps: Ri, isTreeSider: S, treeSiderConfig: b, isPaginate: N, rowSelection: Oi, getSelectedRows: fn, tabs: V, isItemOperations: Ni, itemOperations: Fi, isBatchOperations: Ti, batchOperations: h, isItemGridLayout: x, columns: y, itemGridLayout: ji, isConditionFormLayout: w, itemOperationsAccess: yt, dataSource: H, onConditionChange: wi, onTabChange: bi, onKeywordChange: Ci, onPageChange: ki, onPageSizeChange: Si, onSiderChange: Ei, condition: hi, tab: mi, keyword: fi, page: dn, total: un, pageSize: pn, sider: yi, payload: xi, className: j("ff-data-list-helper", n), onReload: jt, onClickCallback: gn });
}), ei = (t, e, n = !0) => n !== !0 && n-- <= 0 ? [] : f.isArray(t) && !f.isEmpty(t) ? t.reduce((i, r) => (Reflect.has(r, e) && Reflect.has(r, "children") && i.push(r[e]), Reflect.has(r, "children") && !f.isEmpty(r.children) ? i.concat(ei(r.children, e, n)) : i), []) : [], Sr = ({ className: t, primaryKey: e, columns: n = [], dataSource: i = [], operationRender: r, operationWidth: a = 180, components: o = {}, rowSelection: s, ...l }) => {
const { classNames: c } = ge(le), u = J(null), p = J(null), [h, g] = L([]), [y, w] = L({ width: 0, height: 0 });
U(() => {
g(ei(i, e));
}, [i, e]), Mi(() => {
const k = new ResizeObserver(() => {
var $;
w({ width: (($ = u.current) == null ? void 0 : $.nativeElement.querySelector(".ant-table-body").scrollWidth) || p.current.offsetWidth, height: p.current.offsetHeight });
var x;
w({ width: ((x = u.current) == null ? void 0 : x.nativeElement.querySelector(".ant-table-body").scrollWidth) || p.current.offsetWidth, height: p.current.offsetHeight });
});
return p.current && k.observe(p.current), () => {
p.current && k.unobserve(p.current);
@@ -390,22 +390,22 @@ const Zn = Ht.getInstance(), rn = E.forwardRef(({ listCode: t, base62params: e,
}, []);
const S = z(() => {
if (!(y != null && y.width) || !(n != null && n.length)) return n;
const k = (s ? s.columnWidth ?? 32 : 0) + (r ? a : 0), $ = n.reduce((O, N) => O + (N != null && N.isWidthFixed && N.width ? N.width : 0), 0), F = n.filter((O) => !(O != null && O.isWidthFixed)).reduce((O, N) => O + ((N == null ? void 0 : N.width) ?? 100), 0);
if ($ + F + k >= y.width) return n;
const A = y.width - $ - k;
const k = (s ? s.columnWidth ?? 32 : 0) + (r ? a : 0), x = n.reduce((O, N) => O + (N != null && N.isWidthFixed && N.width ? N.width : 0), 0), F = n.filter((O) => !(O != null && O.isWidthFixed)).reduce((O, N) => O + ((N == null ? void 0 : N.width) ?? 100), 0);
if (x + F + k >= y.width) return n;
const A = y.width - x - k;
return n.map((O) => O != null && O.isWidthFixed ? O : { ...O, width: Math.floor(A * ((O == null ? void 0 : O.width) ?? 100) / F) });
}, [n, y.width, s, r, a]), b = cr(S), x = dr(o);
return m("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: y.height ? m(En, { bordered: !0, ...l, components: x, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), rowSelection: s, columns: (() => {
var $, F;
}, [n, y.width, s, r, a]), b = cr(S), $ = dr(o);
return m("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: y.height ? m(En, { bordered: !0, ...l, components: $, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), rowSelection: s, columns: (() => {
var x, F;
const k = [...b ?? []];
return s && k.splice((F = ($ = k[0]) == null ? void 0 : $.key) != null && F.startsWith("__") ? 1 : 0, 0, En.SELECTION_COLUMN), r && k.push({ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / y.width * 100).toFixed(2)}%`, render: (A, O, N) => r(O, N) }), k;
return s && k.splice((F = (x = k[0]) == null ? void 0 : x.key) != null && F.startsWith("__") ? 1 : 0, 0, En.SELECTION_COLUMN), r && k.push({ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / y.width * 100).toFixed(2)}%`, render: (A, O, N) => r(O, N) }), k;
})(), dataSource: i, size: "middle", scroll: { x: "max-content", y: y.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: h } }) : null });
}, Er = "RC_FORM_INTERNAL_HOOKS", $r = (t) => {
}, Er = "RC_FORM_INTERNAL_HOOKS", xr = (t) => {
const [e, n] = E.useState({ items: [] });
return U(() => {
t && W.get(`/api/_/${t}`).then(({ uuid: i, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: c, cols: u, rowHeight: p, fields: h, theme: g, themeSetting: y, groups: w }) => ({ uuid: i, code: r, name: a, resource: o, primaryKey: s, marginX: l, marginY: c, cols: u, rowHeight: p, theme: g, themeProps: y, groups: w, items: h })).then(n);
}, [t]), e;
}, xr = (t, { initialValue: e, initialValueLanguage: n, convertJs: i, convertJsSetting: r, type: a = "string" }, o = null) => {
}, $r = (t, { initialValue: e, initialValueLanguage: n, convertJs: i, convertJsSetting: r, type: a = "string" }, o = null) => {
const s = J(!1), l = ge(Mn), [c, u] = L(), [p, h] = L(n != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(Er) || {};
return U(() => g == null ? void 0 : g((y, w, S) => {
if (!s.current) return;
@@ -433,11 +433,11 @@ const Zn = Ht.getInstance(), rn = E.forwardRef(({ listCode: t, base62params: e,
r && se.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: Pr(l, s, n) })).catch((s) => ({ default: () => `${s}` })).then((s) => o(E.createElement(s.default, i)));
}, [r]), a;
}, Pr = (t, e = {}, n = null) => (i) => {
const { code: r, label: a, extras: o, isVirtual: s, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: h, ...g } = f.merge({}, e, i), [y, w] = xr(s ? null : r, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, n), S = z(() => {
const { code: r, label: a, extras: o, isVirtual: s, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: h, ...g } = f.merge({}, e, i), [y, w] = $r(s ? null : r, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, n), S = z(() => {
const k = Object.keys((e == null ? void 0 : e.extras) || {});
return f.over([f.partialRight(f.pick, k), f.partialRight(f.omit, k)]);
}, [e == null ? void 0 : e.extras]), [b, x] = S(g);
return m(t, { ...x, value: y, rawValue: w, $setting: Object.assign({}, o, b) });
}, [e == null ? void 0 : e.extras]), [b, $] = S(g);
return m(t, { ...$, value: y, rawValue: w, $setting: Object.assign({}, o, b) });
}, ni = ({ theme: t, basicForm: e, items: n = [{ key: "default", label: "默认" }], fields: i = [], itemRender: r, chunks: a = [], children: o, $setting: s = {}, ...l }) => {
const [c, u] = L();
U(() => {
@@ -449,24 +449,24 @@ const Zn = Ht.getInstance(), rn = E.forwardRef(({ listCode: t, base62params: e,
const p = z(() => n == null ? void 0 : n.map((h) => ({ ...h, children: r(h, i == null ? void 0 : i.filter((g) => !(g != null && g.group) && h.key == "default" || g.group == h.key), h.key == "default" ? o : null) })).concat(a), [n, o, a]);
return c && E.cloneElement(c, { items: p, basicForm: e, $setting: { ...s, ...l } });
}, ii = ({ name: t, form: e = null, basicForm: n = null, style: i = {}, className: r, cols: a = 12, rowHeight: o = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: c = {}, formFields: u = [], fields: p = [], data: h, theme: g, themeProps: y = {}, groups: w = [{ key: "default", label: "默认" }], children: S, ...b }) => {
const [x] = oe.useForm(e), k = z(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]);
mt(() => (x.setFieldsValue(h), () => x.resetFields()), [h]);
const $ = (F, A, O) => {
const [$] = oe.useForm(e), k = z(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]);
mt(() => ($.setFieldsValue(h), () => $.resetFields()), [h]);
const x = (F, A, O) => {
const N = nn(A, vr, n), V = Yn(b);
return I("div", { ...V, className: j("ff-grid-layout", r), style: { ...i, "--grid-layout-item-margin-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-item-margin-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-container-padding-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-container-padding-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [N, O && E.cloneElement(O, { cols: a, rowHeight: o, itemMargin: l, containerPadding: s, fields: A, basicForm: n })] });
};
return m(oe, { ...b, fields: k, form: x, component: !1, children: g ? m(ni, { ...y, items: w, theme: g, itemRender: $, fields: p, children: S, basicForm: n }) : $(0, p, S) });
return m(oe, { ...b, fields: k, form: $, component: !1, children: g ? m(ni, { ...y, items: w, theme: g, itemRender: x, fields: p, children: S, basicForm: n }) : x(0, p, S) });
}, Ma = /* @__PURE__ */ ((t) => function({ code: e, data: n, ...i }) {
const { uuid: r, resource: a, items: o, hides: s, rowHeight: l, marginX: c, marginY: u, cols: p, theme: h, themeProps: g, groups: y } = $r(e) || {}, w = z(() => [{ name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: r }], [e, r, a]);
const { uuid: r, resource: a, items: o, hides: s, rowHeight: l, marginX: c, marginY: u, cols: p, theme: h, themeProps: g, groups: y } = xr(e) || {}, w = z(() => [{ name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: r }], [e, r, a]);
return a && m(t, { name: e, theme: h, themeProps: g, groups: y, ...i, fields: o, formFields: w, rowHeight: l, cols: p, itemMargin: [c, u], data: a ? { [a]: n } : n });
})(ii), Nr = ({ column: t = 0, colWidth: e = 0, cols: n, rowHeight: i, itemMargin: r, containerPadding: a, fields: o, primaryKey: s, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: h = ($, F, A) => $, empty: g = m(zt, { description: null }), className: y, style: w = {}, theme: S, themeProps: b = {}, groups: x = [{ key: "default", label: "默认" }], rowSelection: k }) => {
const { classNames: $ } = ge(le), F = G((N) => {
})(ii), Nr = ({ column: t = 0, colWidth: e = 0, cols: n, rowHeight: i, itemMargin: r, containerPadding: a, fields: o, primaryKey: s, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: h = (x, F, A) => x, empty: g = m(zt, { description: null }), className: y, style: w = {}, theme: S, themeProps: b = {}, groups: $ = [{ key: "default", label: "默认" }], rowSelection: k }) => {
const { classNames: x } = ge(le), F = G((N) => {
if (!k) return;
const { selectedRowKeys: V = [], onChange: P, type: M = "checkbox" } = k, D = N == null ? void 0 : N[s];
let B;
B = M === "radio" ? [D] : V.includes(D) ? V.filter((X) => X !== D) : [...V, D], P == null || P(B, l.filter((X) => B.includes(X == null ? void 0 : X[s])));
}, [k, s, l]), A = z(() => m(ii, { groups: x, theme: S, themeProps: b, cols: n, rowHeight: i, itemMargin: r, containerPadding: a, fields: o, className: p }), [o, n, i, r, a, x, S, b]), O = f.isEmpty(l);
return I("div", { className: j("ff-data-list-content", $.content, y), style: Object.assign({}, w, t && { "--col-num": t }, e && { "--col-width": e }), children: [c == null ? void 0 : c(l), O ? g : l.map((N, V) => {
}, [k, s, l]), A = z(() => m(ii, { groups: $, theme: S, themeProps: b, cols: n, rowHeight: i, itemMargin: r, containerPadding: a, fields: o, className: p }), [o, n, i, r, a, $, S, b]), O = f.isEmpty(l);
return I("div", { className: j("ff-data-list-content", x.content, y), style: Object.assign({}, w, t && { "--col-num": t }, e && { "--col-width": e }), children: [c == null ? void 0 : c(l), O ? g : l.map((N, V) => {
var B;
const P = (N == null ? void 0 : N[s]) ?? V, M = `${P}-${jr(N)}`, D = h(E.cloneElement(A, { data: N }), N, V);
return E.cloneElement(D, { key: M, ...k && { isSelected: (B = k == null ? void 0 : k.selectedRowKeys) == null ? void 0 : B.includes(P), selectionType: k.type ?? "checkbox", onSelect: () => F(N) } });
@@ -555,21 +555,21 @@ const we = class we {
const n = qe.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), i = qe.get(se.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [n]: 0 }, a = (s, l) => () => Promise.all([se.getWidgetComponent(s), Tt(l)]).then(([c, u]) => [c.default || function() {
return `${s}`;
}, u]).then(([c, u]) => ({ Component: () => E.createElement(Un, {}, E.createElement(c, { $setting: u })) })), o = Array.from(d(this, ue).values()).reduce((s, { uuid: l, uri: c, name: u, type: p, component: h, widgetSetting: g, widgetProps: y, isLogin: w, isLayout: S, extra: b }) => {
let x = {}, k = 0;
let $ = {}, k = 0;
switch (p) {
case "list":
x.element = E.createElement(Tr, { component: h, $props: y });
$.element = E.createElement(Tr, { component: h, $props: y });
break;
case "fsdpf-component":
x.element = E.createElement(Or, { key: h, component: h, $setting: g, $props: y });
$.element = E.createElement(Or, { key: h, component: h, $setting: g, $props: y });
}
const $ = (b == null ? void 0 : b.theme) ?? (b == null ? void 0 : b.layout);
if ($) {
const x = (b == null ? void 0 : b.theme) ?? (b == null ? void 0 : b.layout);
if (x) {
const F = (b == null ? void 0 : b.themeProps) ?? (b == null ? void 0 : b.layoutProps);
if (!r[$]) return r[$] = s.length, [...s, { path: "/", lazy: a($, F), children: [{ path: c, ...x }] }];
k = r[$];
if (!r[x]) return r[x] = s.length, [...s, { path: "/", lazy: a(x, F), children: [{ path: c, ...$ }] }];
k = r[x];
}
return S && k > -1 ? (s[k].children.push({ path: c, ...x }), s) : [...s, { path: c, ...x }];
return S && k > -1 ? (s[k].children.push({ path: c, ...$ }), s) : [...s, { path: c, ...$ }];
}, [{ path: "/", lazy: a(n, {}), children: [] }]);
return o.push({ index: !0, element: E.createElement(Rr, { to: i, replace: !0 }) }), K(this, Ce, tr(o, e));
});
@@ -773,9 +773,9 @@ const Me = Jt.getInstance(), Tn = { null2json: (t) => Object.create(), null2arra
}, Vr = (t) => {
const [e, n] = E.useState({ items: [], hides: [] });
return E.useEffect(() => {
t && W.get(`/api/_/${t}`).then(({ pk: i, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: h, listenChangeFieldsFunc: g, fields: y, theme: w, themeSetting: S, groups: b }) => ({ pk: i, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, theme: w, themeProps: S, groups: b, listenChangeFields: h, listenChangeFieldsFunc: g, ...y.reduce((x, k) => {
var $;
return ($ = k == null ? void 0 : k.field) != null && $.hidden ? x.hides.push(k == null ? void 0 : k.field) : x.items.push(k), x;
t && W.get(`/api/_/${t}`).then(({ pk: i, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: h, listenChangeFieldsFunc: g, fields: y, theme: w, themeSetting: S, groups: b }) => ({ pk: i, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, theme: w, themeProps: S, groups: b, listenChangeFields: h, listenChangeFieldsFunc: g, ...y.reduce(($, k) => {
var x;
return (x = k == null ? void 0 : k.field) != null && x.hidden ? $.hides.push(k == null ? void 0 : k.field) : $.items.push(k), $;
}, { items: [], hides: [] }) })).then(n);
}, [t]), e;
}, Dr = ({ max: t = 0, min: e = 0, type: n = "", message: i, pattern: r, required: a = !1, validator: o } = {}, s, l) => {
@@ -864,22 +864,22 @@ const Me = Jt.getInstance(), Tn = { null2json: (t) => Object.create(), null2arra
s && se.getWidgetComponent(s).then(({ defaultProps: p = {}, default: h }) => ({ default: qr(h, p, r) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(E.createElement(p.default, a)));
}, [s]), c && E.cloneElement(c, { ...a, ...l });
}, qr = (t, e = {}, n = null) => (i) => {
const { type: r, code: a, label: o, noStyle: s, style: l, placeholder: c, required: u = !1, extras: p, validators: h, help: g, isVirtual: y, $isReserved: w, initialValue: S, initialValueLanguage: b, ...x } = f.omit(f.merge({}, e, i), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = Dr(Object.assign({}, h, u ? { required: !0 } : {}), a, r), $ = z(() => {
const { type: r, code: a, label: o, noStyle: s, style: l, placeholder: c, required: u = !1, extras: p, validators: h, help: g, isVirtual: y, $isReserved: w, initialValue: S, initialValueLanguage: b, ...$ } = f.omit(f.merge({}, e, i), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = Dr(Object.assign({}, h, u ? { required: !0 } : {}), a, r), x = z(() => {
const V = Object.keys((e == null ? void 0 : e.extras) || {});
return f.over([f.partialRight(f.pick, V), f.partialRight(f.omit, V)]);
}, [e == null ? void 0 : e.extras]), [F, A] = $(x), O = { label: o, noStyle: s, style: l, colon: !1, layout: "vertical" }, N = G((V) => V == null ? void 0 : pe(V, r), [r]);
}, [e == null ? void 0 : e.extras]), [F, A] = x($), O = { label: o, noStyle: s, style: l, colon: !1, layout: "vertical" }, N = G((V) => V == null ? void 0 : pe(V, r), [r]);
return m(Zt, { name: a, rules: k, initialValue: N(S), normalize: N, children: (V, P, M) => {
var D;
return m(t, { type: r, rcform: M, basicForm: n, itemProps: { validateStatus: P.errors.length > 0 ? "error" : "success", tooltip: g || null, help: P.errors.length > 0 ? P.errors.join("、") : null, required: ((D = k == null ? void 0 : k[0]) == null ? void 0 : D.required) || !1, ...O }, fieldProps: { placeholder: c, ...A, ...V }, $setting: Object.assign({}, p, F) });
} });
}, on = ({ name: t, form: e = null, basicForm: n = null, style: i = {}, className: r, cols: a = 24, rowHeight: o = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: c = [], hides: u = [], primaryKey: p = 0, formProps: h = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: w, onValuesChange: S, theme: b, themeProps: x = {}, groups: k = [{ key: "default", label: "默认" }], children: $, ...F }) => {
}, on = ({ name: t, form: e = null, basicForm: n = null, style: i = {}, className: r, cols: a = 24, rowHeight: o = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: c = [], hides: u = [], primaryKey: p = 0, formProps: h = {}, formFields: g = [], listenChangeFields: y, listenChangeFieldsFunc: w, onValuesChange: S, theme: b, themeProps: $ = {}, groups: k = [{ key: "default", label: "默认" }], children: x, ...F }) => {
const [A] = oe.useForm(e), O = G((P, M) => {
S == null || S(P, M), w && Array.isArray(y) && Me.exec(w, { changedValues: P, allValues: M }, { getFieldValue: A.getFieldValue, setFieldValue: A.setFieldValue, setFieldsValue: A.setFieldsValue, isFieldTouched: A.isFieldTouched, isFieldsTouched: A.isFieldsTouched }).catch((D) => console.error("onFormValuesChange", t, D));
}, [t, A, S, y, w]), N = z(() => [{ name: "__PROPS__", value: h }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, h, g]), V = (P, M, D) => {
const B = nn(M, an, n), X = Yn(F);
return I("div", { ...X, className: j("ff-grid-layout-form", r), style: { ...i, "--grid-layout-item-margin-x": `${(s == null ? void 0 : s[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(s == null ? void 0 : s[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-container-padding-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-cols": a, "--grid-layout-row-height": `${o}px` }, children: [B, D && E.cloneElement(D, { cols: a, rowHeight: o, itemMargin: s, containerPadding: l, fields: M, basicForm: n })] });
};
return I(oe, { ...F, form: A, fields: N, onValuesChange: O, children: [b ? m(ni, { ...x, items: k, theme: b, itemRender: V, fields: c, children: $, basicForm: n }) : V(0, c, $), u == null ? void 0 : u.map((P) => {
return I(oe, { ...F, form: A, fields: N, onValuesChange: O, children: [b ? m(ni, { ...$, items: k, theme: b, itemRender: V, fields: c, children: x, basicForm: n }) : V(0, c, x), u == null ? void 0 : u.map((P) => {
var M;
return m(Zt, { name: P.code, children: m(Kr, { form: A, basicForm: n, name: P.code, type: P.type, initialValue: P.initialValue, initialValueLanguage: (M = P.extras) == null ? void 0 : M.initialValueLanguage }) }, JSON.stringify(P.code));
})] });
@@ -891,8 +891,8 @@ const Me = Jt.getInstance(), Tn = { null2json: (t) => Object.create(), null2arra
};
on.propTypes = { fields: C.array, hides: C.array };
const Hr = /* @__PURE__ */ ((t) => ({ code: e, isPreview: n = !1, ...i }) => {
const { align: r, autoComplete: a, resource: o, items: s, hides: l, rowHeight: c, marginX: u, marginY: p, cols: h, listenChangeFields: g, listenChangeFieldsFunc: y, pk: w, uuid: S, theme: b, themeProps: x, groups: k } = Vr(e), $ = z(() => [{ name: "__PK__", value: w }, { name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: S }], [w, e, S, o]);
return m(t, { name: e, autoComplete: a, theme: b, themeProps: x, groups: k, ...i, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: y, fields: s, hides: l, cols: h, rowHeight: c, itemMargin: [u, p] });
const { align: r, autoComplete: a, resource: o, items: s, hides: l, rowHeight: c, marginX: u, marginY: p, cols: h, listenChangeFields: g, listenChangeFieldsFunc: y, pk: w, uuid: S, theme: b, themeProps: $, groups: k } = Vr(e), x = z(() => [{ name: "__PK__", value: w }, { name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: S }], [w, e, S, o]);
return m(t, { name: e, autoComplete: a, theme: b, themeProps: $, groups: k, ...i, formFields: x, listenChangeFields: g, listenChangeFieldsFunc: y, fields: s, hides: l, cols: h, rowHeight: c, itemMargin: [u, p] });
})(on), di = ({ $setting: t, $close: e, extras: n, code: i, primaryKey: r, ...a }) => {
const [o] = oe.useForm(), s = zr(o, i, r, t);
return m(te, { actions: I(E.Fragment, { children: [m(R, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => s({ onSuccess: e }) }), m(R, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: n, children: m(Hr, { form: o, code: i, primaryKey: r, ...a }) });
@@ -921,7 +921,7 @@ const _r = (t, e, n, i) => ae.redirect(n, e, i), Jr = (t, e = {}, n, i = {}) =>
return f.isFunction(n) ? n.call(null, e, s) : f.isString(n) && n ? Me.exec(n, e, s) : null;
}, jn = (t, e, n, i, r) => f.isString(n) && n ? se.getWidgetComponent(n).then(({ default: a }) => re.modal(a, { ...e, $setting: i }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r)).catch((a) => {
re.error(n, { content: a.toString() });
}) : re.modal(n, { ...e, $setting: i }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Gr = (t, e, n, i, r) => re.modal(di, { ...e, $setting: i, code: n }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Yr = (t, e, n, i, r) => re.modal(rn, { base62params: e, $setting: i, listCode: n }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Xr = ({ widget: t, widgetType: e, widgetData: n, widgetProps: i, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s } = {}) => {
}) : re.modal(n, { ...e, $setting: i }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Gr = (t, e, n, i, r) => re.modal(di, { ...e, $setting: i, code: n }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Yr = (t, e, n, i, r) => re.modal(rn, { ...i, base62params: e, listCode: n }, r != null && r.title ? { ...r, title: f.template(r.title)(t) } : r), Xr = ({ widget: t, widgetType: e, widgetData: n, widgetProps: i, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s } = {}) => {
const l = ge(le), [c, u] = L({ leading: !0, trailing: !1 }), p = z(() => {
switch (e) {
case "redirect":
@@ -948,7 +948,7 @@ const _r = (t, e, n, i) => ae.redirect(n, e, i), Jr = (t, e = {}, n, i = {}) =>
const s = { type: "primary", className: j("ff-button", n), iconPosition: r, size: a };
return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), o === "link" || o === "dashed" ? (s.type = o, t === "default" && (s.className = j(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), i && (s.icon = m(Et, { type: i })), e && (s.children = e), s;
}, [o, t, n, i, r]), Ft = ({ data: t, widget: e, widgetType: n = "fsdpf-component", widgetData: i, widgetProps: r, widgetSetting: a, widgetContainerProps: o, onAfterClick: s, onBeforeClick: l, children: c, extras: u }) => {
const p = ge(le), [h, g] = L(!1), [y, w] = L("hover"), [S, b] = ci(r, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [x, k] = L(), { placement: $, align: F, zIndex: A, arrow: O = { pointAtCenter: !0 }, getPopupContainer: N, isPopupMountBodyContainer: V = !0, ...P } = o || {};
const p = ge(le), [h, g] = L(!1), [y, w] = L("hover"), [S, b] = ci(r, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [$, k] = L(), { placement: x, align: F, zIndex: A, arrow: O = { pointAtCenter: !0 }, getPopupContainer: N, isPopupMountBodyContainer: V = !0, ...P } = o || {};
U(() => {
n == "grid-layout-form" ? k(E.createElement(di, { ...i, $setting: a, code: e })) : n == "data-list" ? k(E.createElement(rn, { base62params: t, $setting: a, listCode: e })) : f.isString(e) ? se.getWidgetComponent(e).then(({ default: B }) => {
k(E.createElement(B, { ...i, $setting: a }));
@@ -957,22 +957,22 @@ const _r = (t, e, n, i) => ae.redirect(n, e, i), Jr = (t, e = {}, n, i = {}) =>
const M = (B, X = !1) => (g(B), !B && w("hover"), B ? l == null ? void 0 : l(S) : s == null ? void 0 : s(X)), D = (B) => {
g(!0), w("click");
};
return m(_i, { zIndex: A, placement: $, onPopupClick: D, onClick: D, open: h, align: F, arrow: O, trigger: y, getPopupContainer: N || V ? void 0 : (B) => B, content: m(Qr, { ...P, extras: u, children: x && E.cloneElement(x, { ...S, $setProps: b, $close: (B) => M(!1, B) }) }), children: c, onOpenChange: M });
return m(_i, { zIndex: A, placement: x, onPopupClick: D, onClick: D, open: h, align: F, arrow: O, trigger: y, getPopupContainer: N || V ? void 0 : (B) => B, content: m(Qr, { ...P, extras: u, children: $ && E.cloneElement($, { ...S, $setProps: b, $close: (B) => M(!1, B) }) }), children: c, onOpenChange: M });
}, Qr = ({ title: t, className: e, classNames: n, children: i, extras: r, width: a, height: o, ...s }) => {
const [l, c] = L({}), u = G((y, w) => c((S) => ({ ...S, [y]: w })), []), p = G((y) => c((w) => ({ ...w, [y]: void 0 })), []), h = t ? E.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = r ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, r);
return m(ht.Provider, { value: { ele: l, mount: u, unmount: p }, children: I("div", { className: j("ff-popup ff-popover", e, l.rootClassName), style: { width: a ?? 260, height: o }, ...s, children: [I("div", { className: j("ff-popup-header", "ff-popover-header", n == null ? void 0 : n.header), children: [h, l == null ? void 0 : l["sub-title"]] }), m("div", { className: j("ff-popup-body", "ff-popover-body", n == null ? void 0 : n.body), children: i }), I("div", { className: j("ff-popup-footer", "ff-popover-footer", n == null ? void 0 : n.footer), children: [g, l == null ? void 0 : l.extras, l == null ? void 0 : l.actions] })] }) });
};
Ft.propTypes = { widgetType: C.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) };
const ft = (t) => function({ className: e, variant: n, children: i, name: r, icon: a, type: o = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: c, onBeforeClick: u, data: p, loading: h, disabled: g, tooltip: y, confirm: w, widget: S = () => {
}, widgetType: b, widgetData: x, widgetProps: k, widgetSetting: $, widgetContainerProps: F, ...A }) {
}, widgetType: b, widgetData: $, widgetProps: k, widgetSetting: x, widgetContainerProps: F, ...A }) {
const { mode: O, ...N } = F || {}, V = ui({ className: e, name: r, type: o, icon: a, iconPosition: s }, n ?? t), P = m(kt, { ...V, ...A, children: i || r });
if (O === "popover" && !["destroy", "redirect", "func"].includes(b)) return m(Ft, { data: p, widget: S, widgetType: b, widgetData: x, widgetProps: k, widgetSetting: $, widgetContainerProps: N, onAfterClick: c, onBeforeClick: u, children: P });
const M = f.isEmpty(y) || !y.enabled ? {} : y, D = f.isEmpty(w) ? { enabled: !1 } : Object.assign({ enabled: !0 }, w), [B, X] = L(!1), [$e, { disabled: q, loading: ce }] = Xr({ widget: S, widgetType: b, widgetData: x, widgetProps: k, widgetSetting: $, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u });
if (O === "popover" && !["destroy", "redirect", "func"].includes(b)) return m(Ft, { data: p, widget: S, widgetType: b, widgetData: $, widgetProps: k, widgetSetting: x, widgetContainerProps: N, onAfterClick: c, onBeforeClick: u, children: P });
const M = f.isEmpty(y) || !y.enabled ? {} : y, D = f.isEmpty(w) ? { enabled: !1 } : Object.assign({ enabled: !0 }, w), [B, X] = L(!1), [xe, { disabled: q, loading: ce }] = Xr({ widget: S, widgetType: b, widgetData: $, widgetProps: k, widgetSetting: x, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u });
return m(Ji, { okText: "确定", cancelText: "取消", getPopupContainer: (H) => H, ...D, disabled: q || g, open: B, onOpenChange: (H) => {
if (!H) return X(H);
D.enabled ? X(H) : $e(p);
D.enabled ? X(H) : xe(p);
}, onConfirm: (H) => {
$e(p, H);
xe(p, H);
}, onClick: (H) => {
H.stopPropagation();
}, children: m(Gi, { getPopupContainer: (H) => H, ...M, title: B ? null : M == null ? void 0 : M.title, trigger: ["hover", "click"], children: E.cloneElement(P, { loading: ce || h, disabled: q || g }) }) });
@@ -983,9 +983,9 @@ const Zr = ft("link"), ea = ft("circle"), ta = ft("round"), na = ft("dashed"), A
}, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: c = (g, y) => m(R, { ...g, data: y }, g.uuid || Dt()), widgetContainerProps: u = {}, children: p, data: h }) => {
if (f.isEmpty(t)) return p;
l ?? (l = a), s ?? (s = r);
const [g, y] = z(() => (t || []).reduce((b, x) => {
const k = e.indexOf(x.widgetType);
return k === -1 ? b[1].push(x) : b[0] ? k < e.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = x) : b[1].push(x) : b[0] = x, b;
const [g, y] = z(() => (t || []).reduce((b, $) => {
const k = e.indexOf($.widgetType);
return k === -1 ? b[1].push($) : b[0] ? k < e.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = $) : b[1].push($) : b[0] = $, b;
}, [null, []]), [t, e]);
o ? p = o(g, h) || p : p || (p = m(kt, { ...ui(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: a }), r) }));
const w = y.map((b) => c(Object.assign({ uuid: b.uuid, type: b.type, name: b.name, widget: b.widget, widgetType: b.widgetType, widgetProps: b.widgetProps, widgetData: b.widgetData, widgetSetting: b.widgetSetting, widgetContainerProps: b.widgetContainerSetting, confirm: b.confirm, onAfterClick: f.partialRight(n, b, h), onBeforeClick: f.partialRight(i, b, h) }, { size: l, variant: s }), h));
@@ -999,7 +999,7 @@ const ia = ({ fields: t, formProps: e, $close: n }) => {
}, ra = ({ className: t, classNames: e, $close: n, children: i, title: r, subTitle: a, actions: o, extras: s, ...l }) => I(ir, { ...l, prefixCls: "ff-drawer", className: j("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (c) => ({ motionAppear: !0, motionName: `panel-motion-${c}` }), children: [I("div", { className: j("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [m("button", { "aria-label": "Close", className: j("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: m(tn, { type: "close" }) }), r, a] }), m("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: i }), I("div", { className: j("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, o] })] }), aa = ({ className: t, classNames: e, $close: n, $event: i, children: r, title: a, subTitle: o, actions: s, extras: l, placement: c, ...u }) => {
const { style: p, rest: h } = ((y, w = ["height", "width", "style"]) => {
const S = { ...y }, b = {};
for (const x of w) x === "style" ? Object.assign(b, S.style) : S[x] !== void 0 && (b[x] = S[x]), delete S[x];
for (const $ of w) $ === "style" ? Object.assign(b, S.style) : S[$] !== void 0 && (b[$] = S[$]), delete S[$];
return { style: b, rest: S };
})(u), g = (i == null ? void 0 : i.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: i == null ? void 0 : i.pageX, y: i == null ? void 0 : i.pageY } };
return m(rr, { ...h, ...g, prefixCls: "ff-modal", className: j("ff-popup", t), modalRender: () => I(E.Fragment, { children: [m("button", { className: j("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: h.onClose, children: m(tn, { type: "close" }) }), I("div", { className: j("ff-modal-content"), style: p, children: [I("div", { className: j("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [a, o] }), m("div", { className: j("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: r }), I("div", { className: j("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] })] }) });
@@ -1021,7 +1021,7 @@ const oa = ({ widget: t, widgetProps: e, $close: n, onSetProps: i }) => {
const s = G((l) => {
a((c) => ({ ...c, ...l })), i == null || i(l);
}, [i]);
return E.isValidElement(t) ? E.cloneElement(t, { ...r, $close: n, $setProps: s }) : t != null && t.name || $n.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === $n.ForwardRef ? E.createElement(t, { ...r, $close: n, $setProps: s }) : t;
return E.isValidElement(t) ? E.cloneElement(t, { ...r, $close: n, $setProps: s }) : t != null && t.name || xn.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === xn.ForwardRef ? E.createElement(t, { ...r, $close: n, $setProps: s }) : t;
}, ie = () => {
const [t, e] = Vi({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (a) => {
const { offsetHeight: o } = a;
@@ -1553,7 +1553,7 @@ export {
ii as h,
vr as i,
ni as j,
xr as k,
$r as k,
La as l,
ti as m,
Qn as n,
@@ -1563,7 +1563,7 @@ export {
yr as r,
rn as s,
le as t,
$r as u,
xr as u,
Sr as v,
Nr as w,
gr as x,