v0.7.7
This commit is contained in:
+89
-89
@@ -14,7 +14,7 @@ import { useNotification as Fi } from "rc-notification";
|
||||
import w from "lodash";
|
||||
import { useMountedState as ji, useDeepCompareEffect as Gt, useUpdateEffect as Yt, usePrevious as Fn } from "react-use";
|
||||
import re, { Field as Xt, FieldContext as jn } from "rc-field-form";
|
||||
import { _ as wn, C as Qt, L as Ii, M as Rt, N as Xe, b as Le, o as Vt, c as Ai, S as Li } from "./vender-C5RbewOc.js";
|
||||
import { _ as wn, C as Qt, L as Ii, M as Rt, N as Xe, b as Le, s as Vt, c as Ai, S as Li } from "./vender-CIG7ep61.js";
|
||||
import Vi from "rc-util/lib/hooks/useMergedState";
|
||||
import In from "immutability-helper";
|
||||
import { Space as Mt, Form as ft, Input as Mi, Button as wt, Pagination as Di, Tree as zi, Breadcrumb as Ui, Empty as Dt, Table as bn, Popover as Bi, Popconfirm as Wi, Tooltip as qi, Divider as _i } from "antd";
|
||||
@@ -230,14 +230,14 @@ const ir = (t) => function(e) {
|
||||
if (l === 2) {
|
||||
const m = w.get(c, "__PARENT_ID__", ""), g = w.get(c, n, w.get(c, [i, n], "")), f = w.findIndex(a.current, ["__PARENT_ID__", m]), y = w.findIndex(f > -1 ? w.get(a.current, [f, "children"]) : a.current, [n, g]);
|
||||
if (y === -1) return (p = t.onReload) == null ? void 0 : p.call(t);
|
||||
Promise.all([z.get(`/api/${e}/detail/${g}`), z.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([S, b]) => {
|
||||
Promise.all([z.get(`/api/${e}/detail/${g}`), z.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([k, b]) => {
|
||||
const E = w.get(a.current, f > -1 ? [f, "children", y, "children"] : [y, "children"]);
|
||||
a.current = In(a.current, f > -1 ? { [f]: { children: { $splice: [[y, 1, { ...S, children: E }]] } } } : { $splice: [[y, 1, { ...S, children: E }]] });
|
||||
const k = new Map(b);
|
||||
a.current = In(a.current, f > -1 ? { [f]: { children: { $splice: [[y, 1, { ...k, children: E }]] } } } : { $splice: [[y, 1, { ...k, children: E }]] });
|
||||
const S = new Map(b);
|
||||
s.current.forEach(($, F) => {
|
||||
var I;
|
||||
(I = k.get(F)) != null && I.some((T) => T == g) || s.current.set(F, $.filter((T) => T !== g));
|
||||
}), k.forEach(($, F) => {
|
||||
(I = S.get(F)) != null && I.some((T) => T == g) || s.current.set(F, $.filter((T) => T !== g));
|
||||
}), S.forEach(($, F) => {
|
||||
s.current.has(F) ? s.current.set(F, w.uniq([...s.current.get(F) || [], ...$])) : s.current.set(F, $);
|
||||
});
|
||||
}).then(() => {
|
||||
@@ -247,8 +247,8 @@ const ir = (t) => function(e) {
|
||||
}];
|
||||
}, lr = (t, e) => {
|
||||
const n = Pt(), i = H(e), r = H(/* @__PURE__ */ new Map()), o = H([]), a = w.throttle((l) => {
|
||||
o.current = [], z.list(t, w.pick({ ...i.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: c, condition: u, total: p, tab: m, sider: g, page: f, pageSize: y, operationsAccess: S, dataSource: b }) => {
|
||||
i.current = { tab: m, condition: u, sider: g, keyword: c, total: p, pageSize: y, page: b != null && b.length ? f : 1 }, o.current = b, r.current = new Map(S), n();
|
||||
o.current = [], z.list(t, w.pick({ ...i.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: c, condition: u, total: p, tab: m, sider: g, page: f, pageSize: y, operationsAccess: k, dataSource: b }) => {
|
||||
i.current = { tab: m, condition: u, sider: g, keyword: c, total: p, pageSize: y, page: b != null && b.length ? f : 1 }, o.current = b, r.current = new Map(k), n();
|
||||
});
|
||||
}, 380, { leading: !1, trailing: !0 });
|
||||
vt(() => {
|
||||
@@ -256,12 +256,12 @@ const ir = (t) => function(e) {
|
||||
}, [t, e]);
|
||||
const s = B(() => w.pick(i.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword", "primaryKey"]), [i.current]);
|
||||
return Object.assign(s, { onTabChange: (l) => a({ tab: l, page: 1 }), onPageChange: (l, c) => a({ page: l, pageSize: c }), onPageSizeChange: (l) => a({ pageSize: l, page: 1 }), onConditionChange: (l, c) => a({ keyword: c, condition: In(i.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => a({ sider: l, page: 1 }), onKeywordChange: (l) => a({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: o.current, onReload: a, payload: e == null ? void 0 : e.payload });
|
||||
}, cr = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, isPaginate: r, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: m, itemGridLayout: g, $setting: f, tabs: y, isConditionFormLayout: S, isTreeSider: b, treeSiderConfig: E, rowSelection: k }) => {
|
||||
}, cr = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, isPaginate: r, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: m, itemGridLayout: g, $setting: f, tabs: y, isConditionFormLayout: k, isTreeSider: b, treeSiderConfig: E, rowSelection: S }) => {
|
||||
const { classNames: $, onClickCallback: F } = de(oe), I = w.pick(f, ["column", "colWidth", "beforeRender", "afterRender", "style", "itemMargin", "containerPadding"]), T = f == null ? void 0 : f.isMarkSelected, N = Un(l, c, p, u), M = J((P, V, D) => h(dr, { isMarkSelected: T, className: j("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: o ? N(V) : [], data: u ? { [u]: V } : V, children: P, onClickCallback: F }), [T, u, p, o, F, l, c]);
|
||||
return A("div", { className: j("ff-data-list-framework", e), children: [h(n.sider, { isTreeSider: b, ...E }), A("div", { className: j("ff-data-list-container", $ == null ? void 0 : $.container), children: [h(n.filter, { isConditionFormLayout: S }), h(n.toolbar, { title: m, tabs: y }), h(Er, { ...g, ...I, rowSelection: k, empty: h(n.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: M, dataSource: i }), h(n.footer, { isPaginate: r, isOperations: a, operations: s })] })] });
|
||||
}, dr = ({ className: t, operations: e, children: n, data: i, onClickCallback: r, onSelect: o, isMarkSelected: a, isSelected: s, selectionType: l }) => A("div", { className: j("data-list-grid-layout-item", { "is-mark-selected": a, "is-selected": s, "is-selectable": !!l }, t), onClick: o, children: [h("div", { className: "data-list-grid-layout-item-container", children: n }), !!(e != null && e.length) && h("div", { className: "data-list-grid-layout-item-actions", children: e.map((c) => h("span", { className: "data-list-grid-layout-item-action", children: h(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 || Lt()) }, (c == null ? void 0 : c.uuid) || Lt())) })] }), ur = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, columns: r, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: m, tabs: g, isPaginate: f, rowSelection: y, isTreeSider: S, treeSiderConfig: b, isConditionFormLayout: E, ...k }) => {
|
||||
return A("div", { className: j("ff-data-list-framework", e), children: [h(n.sider, { isTreeSider: b, ...E }), A("div", { className: j("ff-data-list-container", $ == null ? void 0 : $.container), children: [h(n.filter, { isConditionFormLayout: k }), h(n.toolbar, { title: m, tabs: y }), h(Er, { ...g, ...I, rowSelection: S, empty: h(n.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: M, dataSource: i }), h(n.footer, { isPaginate: r, isOperations: a, operations: s })] })] });
|
||||
}, dr = ({ className: t, operations: e, children: n, data: i, onClickCallback: r, onSelect: o, isMarkSelected: a, isSelected: s, selectionType: l }) => A("div", { className: j("data-list-grid-layout-item", { "is-mark-selected": a, "is-selected": s, "is-selectable": !!l }, t), onClick: o, children: [h("div", { className: "data-list-grid-layout-item-container", children: n }), !!(e != null && e.length) && h("div", { className: "data-list-grid-layout-item-actions", children: e.map((c) => h("span", { className: "data-list-grid-layout-item-action", children: h(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 || Lt()) }, (c == null ? void 0 : c.uuid) || Lt())) })] }), ur = ({ listCode: t, className: e, layouts: n = {}, dataSource: i, columns: r, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: m, tabs: g, isPaginate: f, rowSelection: y, isTreeSider: k, treeSiderConfig: b, isConditionFormLayout: E, ...S }) => {
|
||||
const { classNames: $, onClickCallback: F } = de(oe), I = Un(l, c, p, u), T = Bt(l, c, i, p, u);
|
||||
return A("div", { className: j("ff-data-table-framework", e), children: [h(n.sider, { isTreeSider: S, ...b }), A("div", { className: j("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(n.filter, { isConditionFormLayout: E }), h(n.toolbar, { title: m, tabs: g }), h(wr, { ...k, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: i, rowSelection: y, operationRender: T ? (N) => {
|
||||
return A("div", { className: j("ff-data-table-framework", e), children: [h(n.sider, { isTreeSider: k, ...b }), A("div", { className: j("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(n.filter, { isConditionFormLayout: E }), h(n.toolbar, { title: m, tabs: g }), h(wr, { ...S, primaryKey: p, className: "ff-data-table-content", columns: r, dataSource: i, rowSelection: y, operationRender: T ? (N) => {
|
||||
var M;
|
||||
return h("div", { className: "ff-data-table-actions", children: (M = I(N)) == null ? void 0 : M.map((P, V) => h(R, { 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 || V)) });
|
||||
} : null }), h(n.footer, { isPaginate: f, isOperations: a, operations: s })] })] });
|
||||
@@ -275,8 +275,8 @@ const ir = (t) => function(e) {
|
||||
var m, g;
|
||||
const [n, i] = L({}), { listCode: r, onKeywordChange: o, onConditionChange: a, getBase62params: s, classNames: l } = x.useContext(oe), { keyword: c, condition: u } = (s == null ? void 0 : s()) || {}, [p] = ft.useForm();
|
||||
return W(() => {
|
||||
r && e && z.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: S, rowHeight: b, cols: E, fields: k }) => {
|
||||
i({ resource: f, itemMargin: [y, S], rowHeight: b, cols: E, fields: k });
|
||||
r && e && z.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: k, rowHeight: b, cols: E, fields: S }) => {
|
||||
i({ resource: f, itemMargin: [y, k], rowHeight: b, cols: E, fields: S });
|
||||
}).catch(() => i({}));
|
||||
}, [r, e]), W(() => {
|
||||
p.setFieldsValue({ keyword: c, ...u });
|
||||
@@ -301,13 +301,13 @@ const gr = ({ className: t, operations: e, isOperations: n, isPaginate: i }) =>
|
||||
}, fr = ({ className: t, title: e, tabs: n }) => {
|
||||
const { getBase62params: i, onTabChange: r, onReload: o, classNames: a } = de(oe), { tab: s } = (i == null ? void 0 : i()) || {}, [l, c] = Ki((n == null ? void 0 : n[0].value) ?? (n == null ? void 0 : n[0].code), { value: s, onChange: r });
|
||||
return A("div", { className: j("ff-data-list-toolbar", a.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(Ui, { className: "ff-data-list-tabs", itemRender: ({ label: u, code: p, value: m }) => h("span", { onClick: () => c(m ?? p), className: j("ff-data-list-tab", { active: (m ?? p) == l }), children: u }), items: n }), A("div", { className: "ff-data-list-actions", children: [h(R.Link, { icon: "icon-reload", widget: () => o() }), h(R.Link, { icon: "icon-setting" })] })] });
|
||||
}, yr = ({ className: t, ...e }) => h(Dt, { className: j(t, "ff-data-list-empty"), image: Dt.PRESENTED_IMAGE_SIMPLE, ...e }), _n = ({ isItemGridLayout: t, theme: e, themeProps: n, onClickCallback: i, onReload: r, listCode: o, total: a = 0, page: s = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: p, onTabChange: m, keyword: g, onKeywordChange: f, condition: y, onConditionChange: S, sider: b, onSiderChange: E, layouts: k, classNames: $ = {}, payload: F = {}, dataSource: I = [], rowSelection: T, getSelectedRows: N, primaryKey: M, ...P }) => {
|
||||
}, yr = ({ className: t, ...e }) => h(Dt, { className: j(t, "ff-data-list-empty"), image: Dt.PRESENTED_IMAGE_SIMPLE, ...e }), _n = ({ isItemGridLayout: t, theme: e, themeProps: n, onClickCallback: i, onReload: r, listCode: o, total: a = 0, page: s = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: p, onTabChange: m, keyword: g, onKeywordChange: f, condition: y, onConditionChange: k, sider: b, onSiderChange: E, layouts: S, classNames: $ = {}, payload: F = {}, dataSource: I = [], rowSelection: T, getSelectedRows: N, primaryKey: M, ...P }) => {
|
||||
const [V, D] = L(), U = N ?? (() => I), X = J((q, ae) => {
|
||||
const K = { tab: p, page: s, pageSize: c, keyword: g, sider: b, condition: y, total: a, payload: F };
|
||||
return q && q != "init" ? w.get(K, q, ae) : K;
|
||||
}, [JSON.stringify(y), JSON.stringify(F), p, s, c, g, b, a]), xe = B(() => {
|
||||
let q = { sider: mr, filter: qn, footer: gr, toolbar: fr, empty: yr };
|
||||
k === !1 ? q = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : w.isPlainObject(k) && (q = Object.assign({}, q, k));
|
||||
S === !1 ? q = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : w.isPlainObject(S) && (q = Object.assign({}, q, S));
|
||||
for (const ae in q) if (q[ae]) {
|
||||
if (Oi(q[ae])) {
|
||||
const K = q[ae];
|
||||
@@ -315,13 +315,13 @@ const gr = ({ className: t, operations: e, isOperations: n, isPaginate: i }) =>
|
||||
}
|
||||
} else q[ae] = () => h(x.Fragment, {});
|
||||
return q;
|
||||
}, [k]);
|
||||
}, [S]);
|
||||
return W(() => {
|
||||
e ? ne.getWidgetComponent(e).then((q) => {
|
||||
if (!q) throw `${e} not found`;
|
||||
return q;
|
||||
}).catch((q) => ({ default: () => `${q}` })).then((q) => D(x.createElement(q.default, { ...P, layouts: xe, $setting: n }))) : D(h(t ? cr : ur, { ...P, layouts: xe, $setting: n }));
|
||||
}, [e, n]), h(oe.Provider, { value: { classNames: $, listCode: o, onClickCallback: i, onReload: r, getBase62params: X, onPageChange: l, onPageSizeChange: u, onTabChange: m, onSiderChange: E, onKeywordChange: f, onConditionChange: S, setPage: l, setPageSize: u, setTab: m, setSider: E, setKeyword: f, setCondition: S, getSelectedRows: U }, children: V && x.cloneElement(V, { dataSource: I, primaryKey: M, rowSelection: T, ...P }) });
|
||||
}, [e, n]), h(oe.Provider, { value: { classNames: $, listCode: o, onClickCallback: i, onReload: r, getBase62params: X, onPageChange: l, onPageSizeChange: u, onTabChange: m, onSiderChange: E, onKeywordChange: f, onConditionChange: k, setPage: l, setPageSize: u, setTab: m, setSider: E, setKeyword: f, setCondition: k, getSelectedRows: U }, children: V && x.cloneElement(V, { dataSource: I, primaryKey: M, rowSelection: T, ...P }) });
|
||||
};
|
||||
_n.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 Re, $e, De, xt;
|
||||
@@ -349,7 +349,7 @@ const he = class he {
|
||||
Re = new WeakMap(), $e = new WeakMap(), De = new WeakMap(), xt = new WeakMap(), v(he, Re, null), O(he, "getInstance", () => (d(he, Re) || _(he, Re, new he()), d(he, Re)));
|
||||
let Wt = he;
|
||||
const Kn = Wt.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e, className: n, theme: i, themeProps: r, layouts: o, classNames: a, rowSelection: s = null, onDataSourceChange: l }, c) => {
|
||||
const [{ resource: u, primaryKey: p, batchOperations: m = [], itemOperations: g = [], columns: f = [], isConditionFormLayout: y = !1, isTreeSider: S, treeSiderConfig: b, theme: E, themeConfig: k, isItemGridLayout: $, itemGridLayout: { themeConfig: F, ...I } = {}, title: T, isPaginate: N, tabs: M, selectionType: P }, V] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: D = P, selectedRowKeys: U, defaultSelectedRowKeys: X, onChange: xe, ...q } = s ?? {}, ae = lr(t, e), [{ dataSource: K, itemOperationsAccess: ht, condition: li, tab: ci, keyword: di, page: sn, total: ln, pageSize: cn, sider: ui, onConditionChange: pi, onTabChange: gi, onKeywordChange: hi, onPageChange: mi, onPageSizeChange: fi, onSiderChange: yi, onReload: Tt, payload: wi }, dn] = sr(ae, t, p, u), bi = wn(l);
|
||||
const [{ resource: u, primaryKey: p, batchOperations: m = [], itemOperations: g = [], columns: f = [], isConditionFormLayout: y = !1, isTreeSider: k, treeSiderConfig: b, theme: E, themeConfig: S, isItemGridLayout: $, itemGridLayout: { themeConfig: F, ...I } = {}, title: T, isPaginate: N, tabs: M, selectionType: P }, V] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: D = P, selectedRowKeys: U, defaultSelectedRowKeys: X, onChange: xe, ...q } = s ?? {}, ae = lr(t, e), [{ dataSource: K, itemOperationsAccess: ht, condition: li, tab: ci, keyword: di, page: sn, total: ln, pageSize: cn, sider: ui, onConditionChange: pi, onTabChange: gi, onKeywordChange: hi, onPageChange: mi, onPageSizeChange: fi, onSiderChange: yi, onReload: Tt, payload: wi }, dn] = sr(ae, t, p, u), bi = wn(l);
|
||||
Yt(() => {
|
||||
bi(K, { primaryKey: p, page: sn, pageSize: cn, total: ln });
|
||||
}, [K]);
|
||||
@@ -365,32 +365,32 @@ const Kn = Wt.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e,
|
||||
const mn = new Map(Ot.map((se) => [se == null ? void 0 : se[p], se]));
|
||||
return Ae.forEach((se) => mn.set(se == null ? void 0 : se[p], se)), Q.map((se) => mn.get(se)).filter(Boolean);
|
||||
}), Ci(Q), xe == null || xe(Q, Ae);
|
||||
}), Ei = B(() => D ? { columnWidth: 80, ...q, type: D, selectedRowKeys: un, onChange: hn } : void 0, [D, un, hn, s]), $i = B(() => w.merge({}, k, r), [k, r]), Pi = B(() => g == null ? void 0 : g.map((Q) => w.isEmpty(Q == null ? void 0 : Q.confirm) ? Q : { ...Q, confirm: Object.assign({}, Q.confirm, { getPopupContainer: () => document.body }) }), [g]), vi = B(() => ({ ...I, themeProps: F }), [I, F]);
|
||||
return h(_n, { listCode: t, title: T, classNames: a, layouts: o, resource: u, primaryKey: p, theme: i || E, themeProps: $i, isTreeSider: S, treeSiderConfig: b, isPaginate: N, rowSelection: Ei, getSelectedRows: gn, tabs: M, isItemOperations: Si, itemOperations: Pi, isBatchOperations: xi, batchOperations: m, isItemGridLayout: $, columns: f, itemGridLayout: vi, isConditionFormLayout: y, itemOperationsAccess: ht, dataSource: K, onConditionChange: pi, onTabChange: gi, onKeywordChange: hi, onPageChange: mi, onPageSizeChange: fi, onSiderChange: yi, condition: li, tab: ci, keyword: di, page: sn, total: ln, pageSize: cn, sider: ui, payload: wi, className: j("ff-data-list-helper", n), onReload: Tt, onClickCallback: dn });
|
||||
}), Ei = B(() => D ? { columnWidth: 80, ...q, type: D, selectedRowKeys: un, onChange: hn } : void 0, [D, un, hn, s]), $i = B(() => w.merge({}, S, r), [S, r]), Pi = B(() => g == null ? void 0 : g.map((Q) => w.isEmpty(Q == null ? void 0 : Q.confirm) ? Q : { ...Q, confirm: Object.assign({}, Q.confirm, { getPopupContainer: () => document.body }) }), [g]), vi = B(() => ({ ...I, themeProps: F }), [I, F]);
|
||||
return h(_n, { listCode: t, title: T, classNames: a, layouts: o, resource: u, primaryKey: p, theme: i || E, themeProps: $i, isTreeSider: k, treeSiderConfig: b, isPaginate: N, rowSelection: Ei, getSelectedRows: gn, tabs: M, isItemOperations: Si, itemOperations: Pi, isBatchOperations: xi, batchOperations: m, isItemGridLayout: $, columns: f, itemGridLayout: vi, isConditionFormLayout: y, itemOperationsAccess: ht, dataSource: K, onConditionChange: pi, onTabChange: gi, onKeywordChange: hi, onPageChange: mi, onPageSizeChange: fi, onSiderChange: yi, condition: li, tab: ci, keyword: di, page: sn, total: ln, pageSize: cn, sider: ui, payload: wi, className: j("ff-data-list-helper", n), onReload: Tt, onClickCallback: dn });
|
||||
}), Hn = (t, e, n = !0) => n !== !0 && n-- <= 0 ? [] : w.isArray(t) && !w.isEmpty(t) ? t.reduce((i, r) => (Reflect.has(r, e) && Reflect.has(r, "children") && i.push(r[e]), Reflect.has(r, "children") && !w.isEmpty(r.children) ? i.concat(Hn(r.children, e, n)) : i), []) : [], wr = ({ className: t, primaryKey: e, columns: n = [], dataSource: i = [], operationRender: r, operationWidth: o = 180, components: a = {}, rowSelection: s, ...l }) => {
|
||||
const { classNames: c } = de(oe), u = H(null), p = H(null), [m, g] = L([]), [f, y] = L({ width: 0, height: 0 });
|
||||
W(() => {
|
||||
g(Hn(i, e));
|
||||
}, [i, e]), Ri(() => {
|
||||
const k = new ResizeObserver(() => {
|
||||
const S = new ResizeObserver(() => {
|
||||
var $;
|
||||
y({ width: (($ = u.current) == null ? void 0 : $.nativeElement.querySelector(".ant-table-body").scrollWidth) || p.current.offsetWidth, height: p.current.offsetHeight });
|
||||
});
|
||||
return p.current && k.observe(p.current), () => {
|
||||
p.current && k.unobserve(p.current);
|
||||
return p.current && S.observe(p.current), () => {
|
||||
p.current && S.unobserve(p.current);
|
||||
};
|
||||
}, []);
|
||||
const S = B(() => {
|
||||
const k = B(() => {
|
||||
if (!(f != null && f.width) || !(n != null && n.length)) return n;
|
||||
const k = (s ? s.columnWidth ?? 32 : 0) + (r ? o : 0), $ = n.reduce((T, N) => T + (N != null && N.isWidthFixed && N.width ? N.width : 0), 0), F = n.filter((T) => !(T != null && T.isWidthFixed)).reduce((T, N) => T + ((N == null ? void 0 : N.width) ?? 100), 0);
|
||||
if ($ + F + k >= f.width) return n;
|
||||
const I = f.width - $ - k;
|
||||
const S = (s ? s.columnWidth ?? 32 : 0) + (r ? o : 0), $ = n.reduce((T, N) => T + (N != null && N.isWidthFixed && N.width ? N.width : 0), 0), F = n.filter((T) => !(T != null && T.isWidthFixed)).reduce((T, N) => T + ((N == null ? void 0 : N.width) ?? 100), 0);
|
||||
if ($ + F + S >= f.width) return n;
|
||||
const I = f.width - $ - S;
|
||||
return n.map((T) => T != null && T.isWidthFixed ? T : { ...T, width: Math.floor(I * ((T == null ? void 0 : T.width) ?? 100) / F) });
|
||||
}, [n, f.width, s, r, o]), b = or(S), E = ar(a);
|
||||
return h("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: f.height ? h(bn, { bordered: !0, ...l, components: E, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), rowSelection: s, columns: (() => {
|
||||
}, [n, f.width, s, r, o]), b = or(k), E = ar(a);
|
||||
return h("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: f.height ? h(bn, { bordered: !0, ...l, components: E, ref: u, rowKey: (S) => (S == null ? void 0 : S[e]) ?? Math.random(), rowSelection: s, columns: (() => {
|
||||
var $, F;
|
||||
const k = [...b ?? []];
|
||||
return s && k.splice((F = ($ = k[0]) == null ? void 0 : $.key) != null && F.startsWith("__") ? 1 : 0, 0, bn.SELECTION_COLUMN), r && k.push({ title: "操作", align: "center", fixed: "right", className: "ff-data-list-table-operations", width: `${Math.ceil(o / f.width * 100).toFixed(2)}%`, render: (I, T, N) => r(T, N) }), k;
|
||||
const S = [...b ?? []];
|
||||
return s && S.splice((F = ($ = S[0]) == null ? void 0 : $.key) != null && F.startsWith("__") ? 1 : 0, 0, bn.SELECTION_COLUMN), r && S.push({ title: "操作", align: "center", fixed: "right", className: "ff-data-list-table-operations", width: `${Math.ceil(o / f.width * 100).toFixed(2)}%`, render: (I, T, N) => r(T, N) }), S;
|
||||
})(), dataSource: i, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: m } }) : null });
|
||||
}, br = "RC_FORM_INTERNAL_HOOKS", Cr = (t) => {
|
||||
const [e, n] = x.useState({ items: [] });
|
||||
@@ -399,7 +399,7 @@ const Kn = Wt.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e,
|
||||
}, [t]), e;
|
||||
}, kr = (t, { initialValue: e, initialValueLanguage: n, convertJs: i, convertJsSetting: r, type: o = "string" }, a = null) => {
|
||||
const s = H(!1), l = de(jn), [c, u] = L(), [p, m] = L(n != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(br) || {};
|
||||
return W(() => g == null ? void 0 : g((f, y, S) => {
|
||||
return W(() => g == null ? void 0 : g((f, y, k) => {
|
||||
if (!s.current) return;
|
||||
const b = w.get(y, t);
|
||||
w.isEqual(b, p) || m(ce(b, o));
|
||||
@@ -413,7 +413,7 @@ const Kn = Wt.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e,
|
||||
}, To = (t, e, n = null) => B(() => en(t, e, n), [t]), Jn = (t, e, n = {}, i = {}, r = {}, o = null) => {
|
||||
const a = de(jn), s = Pt(), l = H(!0), c = H([]), [u, p] = L(e), [m, g] = L(), f = re.useWatch((y) => JSON.stringify(w.pick(y, c.current)), a) || "{}";
|
||||
return vt(() => {
|
||||
t && Be.exec(t, n, { ...i, getFieldValueForBasicForm: (y) => r ? r.getFieldValue(y) : null, getFieldValue: w.wrap(a.getFieldValue, (y, S) => (c.current.some((b) => w.isEqual(b, S)) || (c.current.push(S), s()), y == null ? void 0 : y(S))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((y) => {
|
||||
t && Be.exec(t, n, { ...i, getFieldValueForBasicForm: (y) => r ? r.getFieldValue(y) : null, getFieldValue: w.wrap(a.getFieldValue, (y, k) => (c.current.some((b) => w.isEqual(b, k)) || (c.current.push(k), s()), y == null ? void 0 : y(k))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((y) => {
|
||||
l.current && (p(y), g(null));
|
||||
}).catch((y) => {
|
||||
l.current && (p(e), g(y));
|
||||
@@ -425,10 +425,10 @@ const Kn = Wt.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e,
|
||||
r && ne.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: xr(l, s, n) })).catch((s) => ({ default: () => `${s}` })).then((s) => a(x.createElement(s.default, i)));
|
||||
}, [r]), o;
|
||||
}, xr = (t, e = {}, n = null) => (i) => {
|
||||
const { code: r, label: o, extras: a, isVirtual: s, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: m, ...g } = w.merge({}, e, i), [f, y] = kr(s ? null : r, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, n), S = B(() => {
|
||||
const k = Object.keys((e == null ? void 0 : e.extras) || {});
|
||||
return w.over([w.partialRight(w.pick, k), w.partialRight(w.omit, k)]);
|
||||
}, [e == null ? void 0 : e.extras]), [b, E] = S(g);
|
||||
const { code: r, label: o, extras: a, isVirtual: s, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: m, ...g } = w.merge({}, e, i), [f, y] = kr(s ? null : r, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, n), k = B(() => {
|
||||
const S = Object.keys((e == null ? void 0 : e.extras) || {});
|
||||
return w.over([w.partialRight(w.pick, S), w.partialRight(w.omit, S)]);
|
||||
}, [e == null ? void 0 : e.extras]), [b, E] = k(g);
|
||||
return h(t, { ...E, value: f, rawValue: y, $setting: Object.assign({}, a, b) });
|
||||
}, Gn = ({ theme: t, basicForm: e, items: n = [{ key: "default", label: "默认" }], fields: i = [], itemRender: r, chunks: o = [], children: a, $setting: s = {}, ...l }) => {
|
||||
const [c, u] = L();
|
||||
@@ -440,28 +440,28 @@ const Kn = Wt.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e,
|
||||
}, [t]);
|
||||
const p = B(() => n == null ? void 0 : n.map((m) => ({ ...m, children: r(m, i == null ? void 0 : i.filter((g) => !(g != null && g.group) && m.key == "default" || g.group == m.key), m.key == "default" ? a : null) })).concat(o), [n, a, o]);
|
||||
return c && x.cloneElement(c, { items: p, basicForm: e, $setting: { ...s, ...l } });
|
||||
}, Yn = ({ name: t, form: e = null, basicForm: n = null, style: i = {}, className: r, cols: o = 12, rowHeight: a = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: c = {}, formFields: u = [], fields: p = [], data: m, theme: g, themeProps: f = {}, groups: y = [{ key: "default", label: "默认" }], children: S, ...b }) => {
|
||||
const [E] = re.useForm(e), k = B(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]);
|
||||
}, Yn = ({ name: t, form: e = null, basicForm: n = null, style: i = {}, className: r, cols: o = 12, rowHeight: a = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: c = {}, formFields: u = [], fields: p = [], data: m, theme: g, themeProps: f = {}, groups: y = [{ key: "default", label: "默认" }], children: k, ...b }) => {
|
||||
const [E] = re.useForm(e), S = B(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]);
|
||||
pt(() => (E.setFieldsValue(m), () => E.resetFields()), [m]);
|
||||
const $ = (F, I, T) => {
|
||||
const N = en(I, Sr, n), M = Wn(b);
|
||||
return A("div", { ...M, 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": o, "--grid-layout-row-height": `${a}px` }, children: [N, T && x.cloneElement(T, { cols: o, rowHeight: a, itemMargin: l, containerPadding: s, fields: I, basicForm: n })] });
|
||||
};
|
||||
return h(re, { ...b, fields: k, form: E, component: !1, children: g ? h(Gn, { ...f, items: y, theme: g, itemRender: $, fields: p, children: S, basicForm: n }) : $(0, p, S) });
|
||||
return h(re, { ...b, fields: S, form: E, component: !1, children: g ? h(Gn, { ...f, items: y, theme: g, itemRender: $, fields: p, children: k, basicForm: n }) : $(0, p, k) });
|
||||
}, Oo = /* @__PURE__ */ ((t) => function({ code: e, data: n, ...i }) {
|
||||
const { uuid: r, resource: o, items: a, hides: s, rowHeight: l, marginX: c, marginY: u, cols: p, theme: m, themeProps: g, groups: f } = Cr(e) || {}, y = B(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: r }], [e, r, o]);
|
||||
return o && h(t, { name: e, theme: m, themeProps: g, groups: f, ...i, fields: a, formFields: y, rowHeight: l, cols: p, itemMargin: [c, u], data: o ? { [o]: n } : n });
|
||||
})(Yn), Er = ({ column: t = 0, colWidth: e = 0, cols: n, rowHeight: i, itemMargin: r, containerPadding: o, fields: a, primaryKey: s, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: m = ($, F, I) => $, empty: g = h(Dt, { description: null }), className: f, style: y = {}, theme: S, themeProps: b = {}, groups: E = [{ key: "default", label: "默认" }], rowSelection: k }) => {
|
||||
})(Yn), Er = ({ column: t = 0, colWidth: e = 0, cols: n, rowHeight: i, itemMargin: r, containerPadding: o, fields: a, primaryKey: s, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: m = ($, F, I) => $, empty: g = h(Dt, { description: null }), className: f, style: y = {}, theme: k, themeProps: b = {}, groups: E = [{ key: "default", label: "默认" }], rowSelection: S }) => {
|
||||
const { classNames: $ } = de(oe), F = J((N) => {
|
||||
if (!k) return;
|
||||
const { selectedRowKeys: M = [], onChange: P, type: V = "checkbox" } = k, D = N == null ? void 0 : N[s];
|
||||
if (!S) return;
|
||||
const { selectedRowKeys: M = [], onChange: P, type: V = "checkbox" } = S, D = N == null ? void 0 : N[s];
|
||||
let U;
|
||||
U = V === "radio" ? [D] : M.includes(D) ? M.filter((X) => X !== D) : [...M, D], P == null || P(U, l.filter((X) => U.includes(X == null ? void 0 : X[s])));
|
||||
}, [k, s, l]), I = B(() => h(Yn, { groups: E, theme: S, themeProps: b, cols: n, rowHeight: i, itemMargin: r, containerPadding: o, fields: a, className: p }), [a, n, i, r, o, E, S, b]), T = w.isEmpty(l);
|
||||
}, [S, s, l]), I = B(() => h(Yn, { groups: E, theme: k, themeProps: b, cols: n, rowHeight: i, itemMargin: r, containerPadding: o, fields: a, className: p }), [a, n, i, r, o, E, k, b]), T = w.isEmpty(l);
|
||||
return A("div", { className: j("ff-data-list-content", $.content, f), style: Object.assign({}, y, t && { "--col-num": t }, e && { "--col-width": e }), children: [c == null ? void 0 : c(l), T ? g : l.map((N, M) => {
|
||||
var U;
|
||||
const P = (N == null ? void 0 : N[s]) ?? M, V = `${P}-${Tr(N)}`, D = m(x.cloneElement(I, { data: N }), N, M);
|
||||
return x.cloneElement(D, { key: V, ...k && { isSelected: (U = k == null ? void 0 : k.selectedRowKeys) == null ? void 0 : U.includes(P), selectionType: k.type ?? "checkbox", onSelect: () => F(N) } });
|
||||
return x.cloneElement(D, { key: V, ...S && { isSelected: (U = S == null ? void 0 : S.selectedRowKeys) == null ? void 0 : U.includes(P), selectionType: S.type ?? "checkbox", onSelect: () => F(N) } });
|
||||
}), u == null ? void 0 : u(l)] });
|
||||
}, $r = ({ component: t, $props: e }) => {
|
||||
const { base62params: n } = $t(e, {});
|
||||
@@ -546,8 +546,8 @@ const me = class me {
|
||||
if (d(this, ye)) return d(this, ye);
|
||||
const n = Ue.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), i = Ue.get(ne.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [n]: 0 }, o = (s, l) => () => Promise.all([ne.getWidgetComponent(s), $t(l)]).then(([c, u]) => [c.default || function() {
|
||||
return `${s}`;
|
||||
}, u]).then(([c, u]) => ({ Component: () => x.createElement(Ln, {}, x.createElement(c, { $setting: u })) })), a = Array.from(d(this, le).values()).reduce((s, { uuid: l, uri: c, name: u, type: p, component: m, widgetSetting: g, widgetProps: f, isLogin: y, isLayout: S, extra: b }) => {
|
||||
let E = {}, k = 0;
|
||||
}, u]).then(([c, u]) => ({ Component: () => x.createElement(Ln, {}, x.createElement(c, { $setting: u })) })), a = Array.from(d(this, le).values()).reduce((s, { uuid: l, uri: c, name: u, type: p, component: m, widgetSetting: g, widgetProps: f, isLogin: y, isLayout: k, extra: b }) => {
|
||||
let E = {}, S = 0;
|
||||
switch (p) {
|
||||
case "list":
|
||||
E.element = x.createElement($r, { component: m, $props: f });
|
||||
@@ -559,9 +559,9 @@ const me = class me {
|
||||
if ($) {
|
||||
const F = (b == null ? void 0 : b.themeProps) ?? (b == null ? void 0 : b.layoutProps);
|
||||
if (!r[$]) return r[$] = s.length, [...s, { path: "/", lazy: o($, F), children: [{ path: c, ...E }] }];
|
||||
k = r[$];
|
||||
S = r[$];
|
||||
}
|
||||
return S && k > -1 ? (s[k].children.push({ path: c, ...E }), s) : [...s, { path: c, ...E }];
|
||||
return k && S > -1 ? (s[S].children.push({ path: c, ...E }), s) : [...s, { path: c, ...E }];
|
||||
}, [{ path: "/", lazy: o(n, {}), children: [] }]);
|
||||
return a.push({ index: !0, element: x.createElement(vr, { to: i, replace: !0 }) }), _(this, ye, Yi(a, e));
|
||||
});
|
||||
@@ -738,9 +738,9 @@ const En = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb
|
||||
}, Ir = (t) => {
|
||||
const [e, n] = x.useState({ items: [], hides: [] });
|
||||
return x.useEffect(() => {
|
||||
t && z.get(`/api/_/${t}`).then(({ pk: i, uuid: r, code: o, resource: a, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: m, listenChangeFieldsFunc: g, fields: f, theme: y, themeSetting: S, groups: b }) => ({ pk: i, uuid: r, code: o, resource: a, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, theme: y, themeProps: S, groups: b, listenChangeFields: m, listenChangeFieldsFunc: g, ...f.reduce((E, k) => {
|
||||
t && z.get(`/api/_/${t}`).then(({ pk: i, uuid: r, code: o, resource: a, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: m, listenChangeFieldsFunc: g, fields: f, theme: y, themeSetting: k, groups: b }) => ({ pk: i, uuid: r, code: o, resource: a, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, theme: y, themeProps: k, groups: b, listenChangeFields: m, listenChangeFieldsFunc: g, ...f.reduce((E, S) => {
|
||||
var $;
|
||||
return ($ = k == null ? void 0 : k.field) != null && $.hidden ? E.hides.push(k == null ? void 0 : k.field) : E.items.push(k), E;
|
||||
return ($ = S == null ? void 0 : S.field) != null && $.hidden ? E.hides.push(S == null ? void 0 : S.field) : E.items.push(S), E;
|
||||
}, { items: [], hides: [] }) })).then(n);
|
||||
}, [t]), e;
|
||||
}, Ar = ({ max: t = 0, min: e = 0, type: n = "", message: i, pattern: r, required: o = !1, validator: a } = {}, s, l) => {
|
||||
@@ -829,22 +829,22 @@ const En = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb
|
||||
s && ne.getWidgetComponent(s).then(({ defaultProps: p = {}, default: m }) => ({ default: zr(m, p, r) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(x.createElement(p.default, o)));
|
||||
}, [s]), c && x.cloneElement(c, { ...o, ...l });
|
||||
}, zr = (t, e = {}, n = null) => (i) => {
|
||||
const { type: r, code: o, label: a, noStyle: s, style: l, placeholder: c, required: u = !1, extras: p, validators: m, help: g, isVirtual: f, $isReserved: y, initialValue: S, initialValueLanguage: b, ...E } = w.omit(w.merge({}, e, i), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = Ar(Object.assign({}, m, u ? { required: !0 } : {}), o, r), $ = B(() => {
|
||||
const { type: r, code: o, label: a, noStyle: s, style: l, placeholder: c, required: u = !1, extras: p, validators: m, help: g, isVirtual: f, $isReserved: y, initialValue: k, initialValueLanguage: b, ...E } = w.omit(w.merge({}, e, i), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), S = Ar(Object.assign({}, m, u ? { required: !0 } : {}), o, r), $ = B(() => {
|
||||
const M = Object.keys((e == null ? void 0 : e.extras) || {});
|
||||
return w.over([w.partialRight(w.pick, M), w.partialRight(w.omit, M)]);
|
||||
}, [e == null ? void 0 : e.extras]), [F, I] = $(E), T = { label: a, noStyle: s, style: l, colon: !1, layout: "vertical" }, N = J((M) => M == null ? void 0 : ce(M, r), [r]);
|
||||
return h(Xt, { name: o, rules: k, initialValue: N(S), normalize: N, children: (M, P, V) => {
|
||||
return h(Xt, { name: o, rules: S, initialValue: N(k), normalize: N, children: (M, P, V) => {
|
||||
var D;
|
||||
return h(t, { type: r, rcform: V, 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, ...T }, fieldProps: { placeholder: c, ...I, ...M }, $setting: Object.assign({}, p, F) });
|
||||
return h(t, { type: r, rcform: V, basicForm: n, itemProps: { validateStatus: P.errors.length > 0 ? "error" : "success", tooltip: g || null, help: P.errors.length > 0 ? P.errors.join("、") : null, required: ((D = S == null ? void 0 : S[0]) == null ? void 0 : D.required) || !1, ...T }, fieldProps: { placeholder: c, ...I, ...M }, $setting: Object.assign({}, p, F) });
|
||||
} });
|
||||
}, rn = ({ name: t, form: e = null, basicForm: n = null, style: i = {}, className: r, cols: o = 24, rowHeight: a = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: c = [], hides: u = [], primaryKey: p = 0, formProps: m = {}, formFields: g = [], listenChangeFields: f, listenChangeFieldsFunc: y, onValuesChange: S, theme: b, themeProps: E = {}, groups: k = [{ key: "default", label: "默认" }], children: $, ...F }) => {
|
||||
}, rn = ({ name: t, form: e = null, basicForm: n = null, style: i = {}, className: r, cols: o = 24, rowHeight: a = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: c = [], hides: u = [], primaryKey: p = 0, formProps: m = {}, formFields: g = [], listenChangeFields: f, listenChangeFieldsFunc: y, onValuesChange: k, theme: b, themeProps: E = {}, groups: S = [{ key: "default", label: "默认" }], children: $, ...F }) => {
|
||||
const [I] = re.useForm(e), T = J((P, V) => {
|
||||
S == null || S(P, V), y && Array.isArray(f) && Be.exec(y, { changedValues: P, allValues: V }, { getFieldValue: I.getFieldValue, setFieldValue: I.setFieldValue, setFieldsValue: I.setFieldsValue, isFieldTouched: I.isFieldTouched, isFieldsTouched: I.isFieldsTouched }).catch((D) => console.error("onFormValuesChange", t, D));
|
||||
}, [t, I, S, f, y]), N = B(() => [{ name: "__PROPS__", value: m }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, m, g]), M = (P, V, D) => {
|
||||
k == null || k(P, V), y && Array.isArray(f) && Be.exec(y, { changedValues: P, allValues: V }, { getFieldValue: I.getFieldValue, setFieldValue: I.setFieldValue, setFieldsValue: I.setFieldsValue, isFieldTouched: I.isFieldTouched, isFieldsTouched: I.isFieldsTouched }).catch((D) => console.error("onFormValuesChange", t, D));
|
||||
}, [t, I, k, f, y]), N = B(() => [{ name: "__PROPS__", value: m }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, m, g]), M = (P, V, D) => {
|
||||
const U = en(V, nn, n), X = Wn(F);
|
||||
return A("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": o, "--grid-layout-row-height": `${a}px` }, children: [U, D && x.cloneElement(D, { cols: o, rowHeight: a, itemMargin: s, containerPadding: l, fields: V, basicForm: n })] });
|
||||
};
|
||||
return A(re, { ...F, form: I, fields: N, onValuesChange: T, children: [b ? h(Gn, { ...E, items: k, theme: b, itemRender: M, fields: c, children: $, basicForm: n }) : M(0, c, $), u == null ? void 0 : u.map((P) => {
|
||||
return A(re, { ...F, form: I, fields: N, onValuesChange: T, children: [b ? h(Gn, { ...E, items: S, theme: b, itemRender: M, fields: c, children: $, basicForm: n }) : M(0, c, $), u == null ? void 0 : u.map((P) => {
|
||||
var V;
|
||||
return h(Xt, { name: P.code, children: h(Ur, { form: I, basicForm: n, name: P.code, type: P.type, initialValue: P.initialValue, initialValueLanguage: (V = P.extras) == null ? void 0 : V.initialValueLanguage }) }, JSON.stringify(P.code));
|
||||
})] });
|
||||
@@ -856,8 +856,8 @@ const En = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb
|
||||
};
|
||||
rn.propTypes = { fields: C.array, hides: C.array };
|
||||
const Br = /* @__PURE__ */ ((t) => ({ code: e, isPreview: n = !1, ...i }) => {
|
||||
const { align: r, autoComplete: o, resource: a, items: s, hides: l, rowHeight: c, marginX: u, marginY: p, cols: m, listenChangeFields: g, listenChangeFieldsFunc: f, pk: y, uuid: S, theme: b, themeProps: E, groups: k } = Ir(e), $ = B(() => [{ name: "__PK__", value: y }, { name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: S }], [y, e, S, a]);
|
||||
return h(t, { name: e, autoComplete: o, theme: b, themeProps: E, groups: k, ...i, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: f, fields: s, hides: l, cols: m, rowHeight: c, itemMargin: [u, p] });
|
||||
const { align: r, autoComplete: o, resource: a, items: s, hides: l, rowHeight: c, marginX: u, marginY: p, cols: m, listenChangeFields: g, listenChangeFieldsFunc: f, pk: y, uuid: k, theme: b, themeProps: E, groups: S } = Ir(e), $ = B(() => [{ name: "__PK__", value: y }, { name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: k }], [y, e, k, a]);
|
||||
return h(t, { name: e, autoComplete: o, theme: b, themeProps: E, groups: S, ...i, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: f, fields: s, hides: l, cols: m, rowHeight: c, itemMargin: [u, p] });
|
||||
})(rn), ii = ({ $setting: t, $close: e, extras: n, code: i, primaryKey: r, ...o }) => {
|
||||
const [a] = re.useForm(), s = Mr(a, i, r, t);
|
||||
return h(te, { actions: A(x.Fragment, { children: [h(R, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => s({ onSuccess: e }) }), h(R, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: n, children: h(Br, { form: a, code: i, primaryKey: r, ...o }) });
|
||||
@@ -907,10 +907,10 @@ const Wr = (t, e, n, i) => ke.redirect(n, e, i), qr = (t, e = {}, n, i = {}) =>
|
||||
if (w.isFunction(t)) return [w.partialRight(vn, (r == null ? void 0 : r.code) || t, { status: c, setStatus: u }), null];
|
||||
}
|
||||
return [(...y) => console.error("useButton unknown widgetType", e, ...y), null];
|
||||
}, [t, e, r, o, l.getBase62params, l.getSelectedRows]), f = w.debounce((y) => (s == null || s(y), Promise.resolve($t(i, y, { list: l })).then((S) => {
|
||||
const b = m(y, { ...n, ...S });
|
||||
return b != null && b.update && g && (p.current = (E, k) => b.update(g(E), k)), b;
|
||||
}).then((S) => a == null ? void 0 : a(S)).catch(console.error)), 300, { leading: !0, trailing: !1 });
|
||||
}, [t, e, r, o, l.getBase62params, l.getSelectedRows]), f = w.debounce((y) => (s == null || s(y), Promise.resolve($t(i, y, { list: l })).then((k) => {
|
||||
const b = m(y, { ...n, ...k });
|
||||
return b != null && b.update && g && (p.current = (E, S) => b.update(g(E), S)), b;
|
||||
}).then((k) => a == null ? void 0 : a(k)).catch(console.error)), 300, { leading: !0, trailing: !1 });
|
||||
return Yt(() => {
|
||||
var y;
|
||||
(y = p.current) == null || y.call(p, r, o);
|
||||
@@ -919,26 +919,26 @@ const Wr = (t, e, n, i) => ke.redirect(n, e, i), qr = (t, e = {}, n, i = {}) =>
|
||||
const s = { type: "primary", className: j("ff-button", n), iconPosition: r, size: o };
|
||||
return t === "danger" ? s.danger = !0 : t === "default" && (s.type = t), a === "link" || a === "dashed" ? (s.type = a, t === "default" && (s.className = j(s.className, "ff-default"))) : a !== "circle" && a !== "round" || (s.shape = a), i && (s.icon = h(Ct, { type: i })), e && (s.children = e), s;
|
||||
}, [a, t, n, i, r]), Nt = ({ data: t, widget: e, widgetType: n = "fsdpf-component", widgetData: i, widgetProps: r, widgetSetting: o, widgetContainerProps: a, onAfterClick: s, onBeforeClick: l, children: c, extras: u }) => {
|
||||
const p = de(oe), [m, g] = L(!1), [f, y] = L("hover"), [S, b] = ni(r, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [E, k] = L(), { placement: $, align: F, zIndex: I, arrow: T = { pointAtCenter: !0 }, getPopupContainer: N, isPopupMountBodyContainer: M = !0, ...P } = a || {};
|
||||
const p = de(oe), [m, g] = L(!1), [f, y] = L("hover"), [k, b] = ni(r, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [E, S] = L(), { placement: $, align: F, zIndex: I, arrow: T = { pointAtCenter: !0 }, getPopupContainer: N, isPopupMountBodyContainer: M = !0, ...P } = a || {};
|
||||
W(() => {
|
||||
n == "grid-layout-form" ? k(x.createElement(ii, { ...i, $setting: o, code: e })) : n == "data-list" ? k(x.createElement(tn, { base62params: t, $setting: o, listCode: e })) : w.isString(e) ? ne.getWidgetComponent(e).then(({ default: U }) => {
|
||||
k(x.createElement(U, { ...i, $setting: o }));
|
||||
}).catch((U) => k(U.toString())) : x.isValidElement(e) ? k(x.cloneElement(e, { ...i, $setting: o })) : (si(e) || w.isFunction(e) && ["component", "fsdpf-component"].includes(n)) && k(x.createElement(e, { ...i, $setting: o }));
|
||||
n == "grid-layout-form" ? S(x.createElement(ii, { ...i, $setting: o, code: e })) : n == "data-list" ? S(x.createElement(tn, { base62params: t, $setting: o, listCode: e })) : w.isString(e) ? ne.getWidgetComponent(e).then(({ default: U }) => {
|
||||
S(x.createElement(U, { ...i, $setting: o }));
|
||||
}).catch((U) => S(U.toString())) : x.isValidElement(e) ? S(x.cloneElement(e, { ...i, $setting: o })) : (si(e) || w.isFunction(e) && ["component", "fsdpf-component"].includes(n)) && S(x.createElement(e, { ...i, $setting: o }));
|
||||
}, [e, n, i]);
|
||||
const V = (U, X = !1) => (g(U), !U && y("hover"), U ? l == null ? void 0 : l(S) : s == null ? void 0 : s(X)), D = (U) => {
|
||||
const V = (U, X = !1) => (g(U), !U && y("hover"), U ? l == null ? void 0 : l(k) : s == null ? void 0 : s(X)), D = (U) => {
|
||||
g(!0), y("click");
|
||||
};
|
||||
return h(Bi, { zIndex: I, placement: $, onPopupClick: D, onClick: D, open: m, align: F, arrow: T, trigger: f, getPopupContainer: N || M ? void 0 : (U) => U, content: h(Jr, { ...P, extras: u, children: E && x.cloneElement(E, { ...S, $setProps: b, $close: (U) => V(!1, U) }) }), children: c, onOpenChange: V });
|
||||
}, Jr = ({ title: t, className: e, classNames: n, children: i, extras: r, width: o, height: a, ...s }) => {
|
||||
const [l, c] = L({}), u = J((f, y) => c((S) => ({ ...S, [f]: y })), []), p = J((f) => c((y) => ({ ...y, [f]: void 0 })), []), m = t ? x.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = r ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, r);
|
||||
return h(ut.Provider, { value: { ele: l, mount: u, unmount: p }, children: A("div", { className: j("ff-popup ff-popover", e, l.rootClassName), style: { width: o ?? 260, height: a }, ...s, children: [A("div", { className: j("ff-popup-header", "ff-popover-header", n == null ? void 0 : n.header), children: [m, l == null ? void 0 : l["sub-title"]] }), h("div", { className: j("ff-popup-body", "ff-popover-body", n == null ? void 0 : n.body), children: i }), A("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] })] }) });
|
||||
return h(Bi, { zIndex: I, placement: $, onPopupClick: D, onClick: D, open: m, align: F, arrow: T, trigger: f, getPopupContainer: N || M ? void 0 : (U) => U, content: h(Jr, { ...P, extras: u, children: E && x.cloneElement(E, { ...k, $setProps: b, $close: (U) => V(!1, U) }) }), children: c, onOpenChange: V });
|
||||
}, Jr = ({ title: t, className: e, classNames: n, children: i, extras: r, width: o, height: a, style: s, ...l }) => {
|
||||
const [c, u] = L({}), p = J((y, k) => u((b) => ({ ...b, [y]: k })), []), m = J((y) => u((k) => ({ ...k, [y]: void 0 })), []), g = t ? x.createElement("div", { className: "ff-popup-title" }, t) : c == null ? void 0 : c.title, f = r ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, r);
|
||||
return h(ut.Provider, { value: { ele: c, mount: p, unmount: m }, children: A("div", { className: j("ff-popup ff-popover", e, c.rootClassName), style: { ...s, width: o ?? 260, height: a }, ...l, children: [A("div", { className: j("ff-popup-header", "ff-popover-header", n == null ? void 0 : n.header), children: [g, c == null ? void 0 : c["sub-title"]] }), h("div", { className: j("ff-popup-body", "ff-popover-body", n == null ? void 0 : n.body), children: i }), A("div", { className: j("ff-popup-footer", "ff-popover-footer", n == null ? void 0 : n.footer), children: [f, c == null ? void 0 : c.extras, c == null ? void 0 : c.actions] })] }) });
|
||||
};
|
||||
Nt.propTypes = { widgetType: C.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) };
|
||||
const gt = (t) => function({ className: e, variant: n, children: i, name: r, icon: o, type: a = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: c, onBeforeClick: u, data: p, loading: m, disabled: g, tooltip: f, confirm: y, widget: S = () => {
|
||||
}, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: F, ...I }) {
|
||||
const gt = (t) => function({ className: e, variant: n, children: i, name: r, icon: o, type: a = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: c, onBeforeClick: u, data: p, loading: m, disabled: g, tooltip: f, confirm: y, widget: k = () => {
|
||||
}, widgetType: b, widgetData: E, widgetProps: S, widgetSetting: $, widgetContainerProps: F, ...I }) {
|
||||
const { mode: T, ...N } = F || {}, M = ri({ className: e, name: r, type: a, icon: o, iconPosition: s }, n ?? t), P = h(wt, { ...M, ...I, children: i || r });
|
||||
if (T === "popover" && !["destroy", "redirect", "func"].includes(b)) return h(Nt, { data: p, widget: S, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: N, onAfterClick: c, onBeforeClick: u, children: P });
|
||||
const V = w.isEmpty(f) || !f.enabled ? {} : f, D = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [U, X] = L(!1), [xe, { disabled: q, loading: ae }] = Hr({ widget: S, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u });
|
||||
if (T === "popover" && !["destroy", "redirect", "func"].includes(b)) return h(Nt, { data: p, widget: k, widgetType: b, widgetData: E, widgetProps: S, widgetSetting: $, widgetContainerProps: N, onAfterClick: c, onBeforeClick: u, children: P });
|
||||
const V = w.isEmpty(f) || !f.enabled ? {} : f, D = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [U, X] = L(!1), [xe, { disabled: q, loading: ae }] = Hr({ widget: k, widgetType: b, widgetData: E, widgetProps: S, widgetSetting: $, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u });
|
||||
return h(Wi, { okText: "确定", cancelText: "取消", getPopupContainer: (K) => K, ...D, disabled: q || g, open: U, onOpenChange: (K) => {
|
||||
if (!K) return X(K);
|
||||
D.enabled ? X(K) : xe(p);
|
||||
@@ -955,13 +955,13 @@ const Gr = gt("link"), Yr = gt("circle"), Xr = gt("round"), Qr = gt("dashed"), T
|
||||
if (w.isEmpty(t)) return p;
|
||||
l ?? (l = o), s ?? (s = r);
|
||||
const [g, f] = B(() => (t || []).reduce((b, E) => {
|
||||
const k = e.indexOf(E.widgetType);
|
||||
return k === -1 ? b[1].push(E) : b[0] ? k < e.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = E) : b[1].push(E) : b[0] = E, b;
|
||||
const S = e.indexOf(E.widgetType);
|
||||
return S === -1 ? b[1].push(E) : b[0] ? S < e.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = E) : b[1].push(E) : b[0] = E, b;
|
||||
}, [null, []]), [t, e]);
|
||||
a ? p = a(g, m) || p : p || (p = h(wt, { ...ri(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: o }), r) }));
|
||||
const y = f.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: w.partialRight(n, b, m), onBeforeClick: w.partialRight(i, b, m) }, { size: l, variant: s }), m));
|
||||
let S = y;
|
||||
return (y == null ? void 0 : y.length) > 1 && (S = s == "link" ? h(Mt, { split: h(_i, { type: "vertical" }), size: l, children: y }) : h(Mt.Compact, { size: l, children: y })), g ? h(Nt, { widget: g == null ? void 0 : g.widget, widgetType: g == null ? void 0 : g.widgetType, widgetProps: g == null ? void 0 : g.widgetProps, widgetSetting: g == null ? void 0 : g.widgetSetting, widgetContainerProps: Object.assign({}, u, g == null ? void 0 : g.widgetContainerProps), data: m, widgetData: g == null ? void 0 : g.widgetData, extras: S, onAfterClick: w.partialRight(n, g, m), onBeforeClick: w.partialRight(i, g, m), children: p }) : S;
|
||||
let k = y;
|
||||
return (y == null ? void 0 : y.length) > 1 && (k = s == "link" ? h(Mt, { split: h(_i, { type: "vertical" }), size: l, children: y }) : h(Mt.Compact, { size: l, children: y })), g ? h(Nt, { widget: g == null ? void 0 : g.widget, widgetType: g == null ? void 0 : g.widgetType, widgetProps: g == null ? void 0 : g.widgetProps, widgetSetting: g == null ? void 0 : g.widgetSetting, widgetContainerProps: Object.assign({}, u, g == null ? void 0 : g.widgetContainerProps), data: m, widgetData: g == null ? void 0 : g.widgetData, extras: k, onAfterClick: w.partialRight(n, g, m), onBeforeClick: w.partialRight(i, g, m), children: p }) : k;
|
||||
};
|
||||
Tn.propTypes = { triggerWeights: C.array, options: C.arrayOf(C.shape({ ...R.propTypes, widgetType: R.propTypes.widgetType.isRequired })), btnSize: R.propTypes.size, btnRender: C.func, btnVariant: C.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: C.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: C.func, labelSize: R.propTypes.size, onAfterClick: C.func, onBeforeClick: C.func, widgetContainerProps: R.propTypes.widgetContainerProps, data: R.propTypes.data }, R.Link = Gr, R.Link.defaultProps = R.defaultProps, R.Link.propTypes = R.propTypes, R.Circle = Yr, R.Circle.defaultProps = R.defaultProps, R.Circle.propTypes = R.propTypes, R.Round = Xr, R.Round.defaultProps = R.defaultProps, R.Round.propTypes = R.propTypes, R.Dashed = Qr, R.Dashed.defaultProps = R.defaultProps, R.Dashed.propTypes = R.propTypes, R.Popover = Nt, R.GroupPopover = Tn;
|
||||
const Zr = ({ fields: t, formProps: e, $close: n }) => {
|
||||
@@ -969,13 +969,13 @@ const Zr = ({ fields: t, formProps: e, $close: n }) => {
|
||||
return h(te, { actions: A(x.Fragment, { children: [h(R, { name: "取消", widget: () => n(!1) }), h(R, { name: "确定", type: "primary", widget: () => i.validateFields(!0).then(n) })] }), children: h(re, { fields: r, form: i, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...a }) => h(nn, { code: o, ...a }, o)) }) });
|
||||
}, eo = ({ className: t, classNames: e, $close: n, children: i, title: r, subTitle: o, actions: a, extras: s, ...l }) => A(Qi, { ...l, prefixCls: "ff-drawer", className: j("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (c) => ({ motionAppear: !0, motionName: `panel-motion-${c}` }), children: [A("div", { className: j("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: j("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: h(Zt, { type: "close" }) }), r, o] }), h("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: i }), A("div", { className: j("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, a] })] }), to = ({ className: t, classNames: e, $close: n, $event: i, children: r, title: o, subTitle: a, actions: s, extras: l, placement: c, ...u }) => {
|
||||
const { style: p, rest: m } = ((f, y = ["height", "width", "style"]) => {
|
||||
const S = { ...f }, b = {};
|
||||
for (const E of y) E === "style" ? Object.assign(b, S.style) : S[E] !== void 0 && (b[E] = S[E]), delete S[E];
|
||||
return { style: b, rest: S };
|
||||
const k = { ...f }, b = {};
|
||||
for (const E of y) E === "style" ? Object.assign(b, k.style) : k[E] !== void 0 && (b[E] = k[E]), delete k[E];
|
||||
return { style: b, rest: k };
|
||||
})(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 h(Zi, { ...m, ...g, prefixCls: "ff-modal", className: j("ff-popup", t), modalRender: () => A(x.Fragment, { children: [h("button", { className: j("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: m.onClose, children: h(Zt, { type: "close" }) }), A("div", { className: j("ff-modal-content"), style: p, children: [A("div", { className: j("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [o, a] }), h("div", { className: j("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: r }), A("div", { className: j("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] })] }) });
|
||||
}, oi = ({ placement: t, $close: e, $event: n, children: i, title: r, ...o }) => {
|
||||
const [a, s] = L({}), [l, c] = L(!0), u = J((f, y) => s((S) => ({ ...S, [f]: y })), []), p = J((f) => s((y) => ({ ...y, [f]: void 0 })), []);
|
||||
const [a, s] = L({}), [l, c] = L(!0), u = J((f, y) => s((k) => ({ ...k, [f]: y })), []), p = J((f) => s((y) => ({ ...y, [f]: void 0 })), []);
|
||||
let m = { ...o, className: a.rootClassName, title: a.title || r && x.createElement("div", { className: j("ff-popup-title") }, r), subTitle: a["sub-title"], actions: a.actions, extras: a.extras, children: i, $close: e, $event: n, onClose: () => c(!1) };
|
||||
const g = () => {
|
||||
e(!1);
|
||||
@@ -1010,13 +1010,13 @@ const no = ({ widget: t, widgetProps: e, $close: n, onSetProps: i }) => {
|
||||
});
|
||||
return c.update = l, c;
|
||||
}, r = ([o, a], s, l = {}, c = {}) => {
|
||||
const u = Y.$index++, p = (f) => ((y, S) => (Y.$popups.delete(y), n(), S == null ? void 0 : S()))(u, () => o(f));
|
||||
const u = Y.$index++, p = (f) => ((y, k) => (Y.$popups.delete(y), n(), k == null ? void 0 : k()))(u, () => o(f));
|
||||
if (s === Vn) return t.open({ ...c, key: u, content: x.createElement(s, { ...l, $close: () => t.close(u) }), onClose: () => p() }), () => {
|
||||
};
|
||||
const { $setProps: m, ...g } = l;
|
||||
return Y.$popups.set(u, { widget: s, widgetProps: g, widgetContainerProps: c, $close: p, onSetProps: m }), n(), (f, y) => {
|
||||
const S = Y.$popups.get(u);
|
||||
S && (Y.$popups.set(u, { ...S, widgetProps: f ? { ...S.widgetProps, ...f } : S.widgetProps, widgetContainerProps: y ? { ...S.widgetContainerProps, ...y } : S.widgetContainerProps }), n());
|
||||
const k = Y.$popups.get(u);
|
||||
k && (Y.$popups.set(u, { ...k, widgetProps: f ? { ...k.widgetProps, ...f } : k.widgetProps, widgetContainerProps: y ? { ...k.widgetContainerProps, ...y } : k.widgetContainerProps }), n());
|
||||
};
|
||||
};
|
||||
return A(x.Fragment, { children: [Array.from(Y.$popups).map(([o, { widget: a, widgetProps: s, widgetContainerProps: l, $close: c, onSetProps: u }]) => h(oi, { maskClosable: !1, $event: s == null ? void 0 : s.$event, ...l, $close: c, children: h(no, { widget: a, widgetProps: s, $close: c, onSetProps: u }) }, o)), e] });
|
||||
+387
-378
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user