From a06894495183f5944b317b9b34b827c7e1a8c083 Mon Sep 17 00:00:00 2001 From: what Date: Wed, 12 Aug 2026 10:30:22 +0800 Subject: [PATCH] v0.7.4 --- .DS_Store | Bin 6148 -> 6148 bytes dist/button.js | 2 +- .../{main-DahsFEqk.js => main-BlkZ_sRx.js} | 178 +++++++++--------- dist/components.js | 2 +- dist/container.js | 2 +- dist/data-converter.js | 2 +- dist/data-list.js | 2 +- dist/data-list/utils.js | 2 +- dist/grid-layout-form.js | 2 +- dist/grid-layout-form/utils.js | 2 +- dist/grid-layout.js | 2 +- dist/grid-layout/utils.js | 2 +- dist/hooks.js | 2 +- dist/iconfont.js | 2 +- dist/index.d.ts | 41 +++- dist/index.js | 2 +- dist/pages.js | 2 +- dist/res-ws.js | 2 +- dist/utils.js | 2 +- dist/virtual-fs.js | 2 +- package.json | 2 +- 21 files changed, 147 insertions(+), 108 deletions(-) rename dist/common/{main-DahsFEqk.js => main-BlkZ_sRx.js} (95%) diff --git a/.DS_Store b/.DS_Store index 3bc38448aab6980b8732c9e976f6fe3a8b601ed6..9498e50bca478ef0f2ba7e5825a2b5c01a58d1cb 100644 GIT binary patch delta 17 YcmZoMXfc@Jz{oh!QJ#@;W8z|Q04?7H`Tzg` delta 24 gcmZoMXfc@Jz{oJsQGR3MGWN;(BCMOaIezj30ARHTlK=n! diff --git a/dist/button.js b/dist/button.js index e2ca141..2a51f0b 100644 --- a/dist/button.js +++ b/dist/button.js @@ -1,4 +1,4 @@ -import { am as s, al as u, an as e } from "./common/main-DahsFEqk.js"; +import { am as s, al as u, an as e } from "./common/main-BlkZ_sRx.js"; export { s as auth, u as default, diff --git a/dist/common/main-DahsFEqk.js b/dist/common/main-BlkZ_sRx.js similarity index 95% rename from dist/common/main-DahsFEqk.js rename to dist/common/main-BlkZ_sRx.js index 2a2c23e..9fba49f 100644 --- a/dist/common/main-DahsFEqk.js +++ b/dist/common/main-BlkZ_sRx.js @@ -54,7 +54,7 @@ class Mn { } } We = new WeakMap(), et = new WeakMap(), _e = new WeakMap(), Ee = new WeakMap(), De = new WeakMap(), Ue = new WeakMap(); -const Po = () => h("div", { children: "Empty" }), pt = x.createContext({ ele: {}, mount: () => { +const vo = () => h("div", { children: "Empty" }), pt = x.createContext({ ele: {}, mount: () => { }, unmount: () => { } }), ie = ({ rootClassName: t, className: e, children: n, actions: r, title: i, subTitle: o, extras: a, style: s = {} }) => { const { mount: l, unmount: c } = x.useContext(pt); @@ -64,7 +64,7 @@ const Po = () => h("div", { children: "Empty" }), pt = x.createContext({ ele: {} return W(() => (e && r(t, x.createElement("div", { key: `ff-${t}`, className: j(`ff-popup-${t}`, n) }, e)), () => i(t)), [n, e]), null; }; ie.Action = ft("actions"), ie.Title = ft("title"), ie.SubTitle = ft("sub-title"), ie.Extra = ft("extras"), ie.propTypes = { className: C.string, style: C.object, title: C.any, subTitle: C.any, actions: C.any, extras: C.any }; -const vo = () => h(ie, { className: "ff-loading", children: A("div", { className: "loader", children: [A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] })] }) }), No = () => h("div", { children: "NotFound" }), Vn = ({ children: t }) => { +const No = () => h(ie, { className: "ff-loading", children: A("div", { className: "loader", children: [A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] })] }) }), To = () => h("div", { children: "NotFound" }), Vn = ({ children: t }) => { const [e, n] = L({}), r = J((o, a) => n((s) => ({ ...s, [o]: a })), []), i = J((o) => n((a) => ({ ...a, [o]: void 0 })), []); return typeof (t == null ? void 0 : t.type) == "string" ? t : h(pt.Provider, { value: { ele: e, mount: r, unmount: i }, children: x.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); }; @@ -199,13 +199,13 @@ const ri = (t) => function(e) { }, [t, e]), ai = (t = {}) => B(() => { var e; return t.body ?? (t.body = { cell: xn }), (e = t.body).cell ?? (e.cell = xn), t; -}, [t]), To = (t) => { +}, [t]), Oo = (t) => { const [e, n] = L({}); return W(() => { let r = !1; return t && U.get(`/api/_/${t}`).then((i) => w.pick(i, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig", "selectionType"])).then((i) => !r && n(i)), () => r = !0; }, [t]), e; -}, Oo = (t, e = {}) => { +}, Ro = (t, e = {}) => { const [n, r] = L({ dataSource: [] }); return gt(() => { let i = !1; @@ -271,7 +271,7 @@ const ri = (t) => function(e) { }, _n = (t, e, n, r, i = {}, o = 0) => { const a = { "--grid-layout-h": `${r}`, "--grid-layout-w": `${n}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; return i != null && i.autoHeight ? a.height = "fit-content" : a["--grid-layout-row"] = `${r}`, i != null && i.alignItems && (a["--grid-layout-box-align-items"] = i.alignItems), i != null && i.justifyContent && (a["--grid-layout-box-justify-content"] = i.justifyContent), a["--grid-layout-box-margin"] = En(i == null ? void 0 : i.marginTop, i == null ? void 0 : i.marginRight, i == null ? void 0 : i.marginBottom, i == null ? void 0 : i.marginLeft), a["--grid-layout-box-padding"] = En(i == null ? void 0 : i.paddingTop, i == null ? void 0 : i.paddingRight, i == null ? void 0 : i.paddingBottom, i == null ? void 0 : i.paddingLeft), o && (a.height = `${o}px`), a; -}, En = (t, e, n, r) => `${t || 0}px ${e || 0}px ${n || 0}px ${r || 0}px`, Ro = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, qn = (t) => Object.keys(t).reduce((e, n) => (/^on[A-Z]/.test(n) && (e[n] = t[n]), e), {}), Kn = ({ className: t, isConditionFormLayout: e }) => { +}, En = (t, e, n, r) => `${t || 0}px ${e || 0}px ${n || 0}px ${r || 0}px`, Fo = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, qn = (t) => Object.keys(t).reduce((e, n) => (/^on[A-Z]/.test(n) && (e[n] = t[n]), e), {}), Kn = ({ className: t, isConditionFormLayout: e }) => { var m, g; const [n, r] = L({}), { listCode: i, onKeywordChange: o, onConditionChange: a, getBase62params: s, classNames: l } = x.useContext(se), { keyword: c, condition: u } = (s == null ? void 0 : s()) || {}, [p] = yt.useForm(); return W(() => { @@ -410,7 +410,7 @@ const Jn = _t.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e, u(f), console.error("布局数据转换错误: ", f, r); }); }, [p, r, i]), [c ?? p, p]; -}, Fo = (t, e, n = null) => B(() => en(t, e, n), [t]), Yn = (t, e, n = {}, r = {}, i = {}, o = null) => { +}, jo = (t, e, n = null) => B(() => en(t, e, n), [t]), Yn = (t, e, n = {}, r = {}, i = {}, o = null) => { const a = pe(In), s = vt(), l = H(!0), c = H([]), [u, p] = L(e), [m, g] = L(), f = ae.useWatch((y) => JSON.stringify(w.pick(y, c.current)), a) || "{}"; return Nt(() => { t && Le.exec(t, n, { ...r, getFieldValueForBasicForm: (y) => i ? i.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) => { @@ -448,7 +448,7 @@ const Jn = _t.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e, return A("div", { ...V, className: j("ff-grid-layout", i), style: { ...r, "--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(ae, { ...b, fields: k, form: E, component: !1, children: g ? h(Xn, { ...f, items: y, theme: g, itemRender: $, fields: p, children: S, basicForm: n }) : $(0, p, S) }); -}, jo = /* @__PURE__ */ ((t) => function({ code: e, data: n, ...r }) { +}, Io = /* @__PURE__ */ ((t) => function({ code: e, data: n, ...r }) { const { uuid: i, resource: o, items: a, hides: s, rowHeight: l, marginX: c, marginY: u, cols: p, theme: m, themeProps: g, groups: f } = Ci(e) || {}, y = B(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: i }], [e, i, o]); return o && h(t, { name: e, theme: m, themeProps: g, groups: f, ...r, fields: a, formFields: y, rowHeight: l, cols: p, itemMargin: [c, u], data: o ? { [o]: n } : n }); })(Qn), Ei = ({ column: t = 0, colWidth: e = 0, cols: n, rowHeight: r, itemMargin: i, containerPadding: o, fields: a, primaryKey: s, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: m = ($, F, I) => $, empty: g = h(Ut, { description: null }), className: f, style: y = {}, theme: S, themeProps: b = {}, groups: E = [{ key: "default", label: "默认" }], rowSelection: k }) => { @@ -466,13 +466,13 @@ const Jn = _t.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e, }, $i = ({ component: t, $props: e }) => { const { base62params: n } = Pt(e, {}); return h(ie, { children: h(tn, { listCode: t, base62params: U.decode(n) }) }); -}, Io = () => h(Zn, {}), Zn = () => "Empty", Pi = ({ component: t, $setting: e, $props: n }) => { +}, Ao = () => h(Zn, {}), Zn = () => "Empty", Pi = ({ component: t, $setting: e, $props: n }) => { const [r, i] = L(), [o, a] = ir(n); return W(() => { if (!t) return i(h(Zn, { description: null })); Z.getWidgetComponent(t).catch((s) => ({ default: () => `${s}` })).then((s) => x.createElement(s.default, { $setting: e })).then(i); }, [t]), r ? x.cloneElement(r, { ...o, $setProps: a }) : null; -}, Ao = () => "NotFoundPage"; +}, Lo = () => "NotFoundPage"; var Fe, de, je, be, it, ot; const ye = class ye { constructor() { @@ -573,7 +573,7 @@ let qt = ye; const vi = ({ to: t, replace: e }) => Ln() ? x.createElement(Qr, { to: t, replace: e }) : (window.document.location = t, "redirect"), Q = qt.getInstance(); Qe.chainableTypes = [Ar]; const Le = Qe.getInstance(new URL("/ff-worker-pipe/worker.js", self.location), { type: "module" }); -Qe.fns = { user: { logout: () => Z.logout(() => window.location.replace(Ae.get("Common.WEBSITE_LOGIN_PAGE", "/index"))), getUserInfo: (t = !0) => Z.getUserInfo(t), checkUserToken: () => Z.checkUserToken(), getUserToken: () => Z.getUserToken() }, getConfigure: (t) => Ae.get(t), route: { redirect: (...t) => Q.redirect(...t), getPageParams: (...t) => Q.getPageParams(...t), getCurrentRoute: () => Q.getCurrentRoute(), get: (t) => Q.get(t), getMenus: (t) => Q.getMenus(t), findMenuPathByUuid: (t) => Q.findMenuPathByUuid(t) }, popup: { notification: (...t) => re.notification(...t), success: (...t) => re.success(...t), error: (...t) => re.error(...t), form: (...t) => re.form(...t), modal: (...t) => re.modal(...t), confirm: (...t) => re.confirm(...t) } }, Promise.resolve().then(() => oo).then((t) => { +Qe.fns = { generateUUID: () => Fi(), user: { logout: () => Z.logout(() => window.location.replace(Ae.get("Common.WEBSITE_LOGIN_PAGE", "/index"))), getUserInfo: (t = !0) => Z.getUserInfo(t), checkUserToken: () => Z.checkUserToken(), getUserToken: () => Z.getUserToken() }, getConfigure: (t) => Ae.get(t), route: { redirect: (...t) => Q.redirect(...t), getPageParams: (...t) => Q.getPageParams(...t), getCurrentRoute: () => Q.getCurrentRoute(), get: (t) => Q.get(t), getMenus: (t) => Q.getMenus(t), findMenuPathByUuid: (t) => Q.findMenuPathByUuid(t) }, popup: { notification: (...t) => re.notification(...t), success: (...t) => re.success(...t), error: (...t) => re.error(...t), form: (...t) => re.form(...t), modal: (...t) => re.modal(...t), confirm: (...t) => re.confirm(...t) } }, Promise.resolve().then(() => ao).then((t) => { Qe.fns.http = t.http, Qe.fns.generateUUID = () => t.generateUUID(); }); const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2number: (t) => 0, null2bool: (t) => !1, null2string: (t) => "", null2integer: (t) => 0, null2float: (t) => 0, string2json: (t) => t ? JSON.parse(t) : "{}", string2array: (t) => t.substr(0, 1) === "[" && t.substr(-1) === "]" ? JSON.parse(t) : t.split(","), string2number: (t) => t == "" ? 0 : +t, string2integer: (t) => t == "" ? 0 : +t, string2float: (t) => t == "" ? 0 : +t, string2bool: (t) => { @@ -640,16 +640,16 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb w.set(r, i, o); } return r; -}, {}), jt = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((n) => jt(n, e)) : Object.keys(t).reduce((n, r) => (e[r] ? n[e[r]] = jt(t[r], e) : n[r] = jt(t[r], e), n), {}) : t, Lo = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { +}, {}), jt = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((n) => jt(n, e)) : Object.keys(t).reduce((n, r) => (e[r] ? n[e[r]] = jt(t[r], e) : n[r] = jt(t[r], e), n), {}) : t, Mo = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { const e = 16 * Math.random() | 0; return (t === "x" ? e : 3 & e | 8).toString(16); -}), Mo = (t) => { +}), Vo = (t) => { var e, n; return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.name : ""; -}, Vo = (t) => { +}, Do = (t) => { var e, n; return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.category : ""; -}, Do = (t) => { +}, Uo = (t) => { var e, n; return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.owner : ""; }, Ti = (t, e = 32, n = "auto") => { @@ -672,11 +672,11 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb } catch { return !1; } -}, Uo = (t, e = "") => { +}, zo = (t, e = "") => { if (!t || typeof t != "string" || Ri(t)) return t; let n = e; return !n && typeof window < "u" && window.location && (n = `${window.location.protocol}//${window.location.host}`), t.startsWith("/") ? n ? `${n}${t}` : t : n ? `${n}/${t}` : t; -}, zo = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : typeof crypto < "u" && crypto.getRandomValues ? "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)) : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { +}, Fi = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : typeof crypto < "u" && crypto.getRandomValues ? "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)) : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { const e = 16 * Math.random() | 0; return (t === "x" ? e : 3 & e | 8).toString(16); }), vt = () => { @@ -715,7 +715,7 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb o = Jn.subscribe(w.throttle(i, 180, { leading: !1, trailing: !0 }), a.res); }), () => o == null ? void 0 : o(); }, r), e; -}, Fi = (t, e) => J((n) => { +}, ji = (t, e) => J((n) => { const r = {}; for (const [i, o] of Object.entries(n)) { const a = t == null ? void 0 : t[i]; @@ -733,11 +733,11 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb const m = l ?? {}, g = Object.keys({ ...m, ...a }).reduce((f, y) => (m[y] !== a[y] && (f[y] = a[y]), f), {}); Object.keys(g).length > 0 && o((f) => ({ ...f, ...g })); }, [a]); - const u = Fi(t, (m) => { + const u = ji(t, (m) => { o((g) => ({ ...g, ...m })); }), p = B(() => Object.fromEntries(Object.entries(i).filter(([m, g]) => g !== a[m])), [i, a]); return [i, u, p]; -}, ji = (t) => { +}, Ii = (t) => { const [e, n] = x.useState({ items: [], hides: [] }); return x.useEffect(() => { t && U.get(`/api/_/${t}`).then(({ pk: r, uuid: i, 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: r, uuid: i, 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) => { @@ -745,7 +745,7 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb return ($ = k == null ? void 0 : k.field) != null && $.hidden ? E.hides.push(k == null ? void 0 : k.field) : E.items.push(k), E; }, { items: [], hides: [] }) })).then(n); }, [t]), e; -}, Ii = ({ max: t = 0, min: e = 0, type: n = "", message: r, pattern: i, required: o = !1, validator: a } = {}, s, l) => { +}, Ai = ({ max: t = 0, min: e = 0, type: n = "", message: r, pattern: i, required: o = !1, validator: a } = {}, s, l) => { const [c, u] = L([]); return W(() => { const p = []; @@ -779,7 +779,7 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb } u(p); }, [t, e, n, r, i, o, a]), c; -}, Ai = (t, e, n) => { +}, Li = (t, e, n) => { const [r, i] = L(null); return W(() => { const { initDataUri: o = `/api/${t}`, initDataMethod: a = "GET" } = n || {}; @@ -787,18 +787,18 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb i(s); }); }, [t, e, n]), r; -}, Li = (t, e, n) => J((r, i = { serialize: (o) => o, onSuccess: () => { +}, Mi = (t, e, n) => J((r, i = { serialize: (o) => o, onSuccess: () => { }, onFail: (o) => (o == null ? void 0 : o.errorFields) && re.error("请先完善表单信息", { duration: 2e3 }) }) => { const o = r.getFieldValue("__RESOURCE__"), { submitDataUri: a = `/api/${t}`, submitDataMethod: s = "POST" } = n || {}; return r.validateFields().then((l) => o ? w.pick(l, [o]) : l).then(i.serialize).then((l) => U.request({ method: s, url: w.trimEnd(`${a}/${e || ""}`, "/"), data: l }).msg(i.onSuccess)).catch(i.onFail); -}, [t, e, n]), Mi = (t, e, n, r) => { - const i = Ai(e, n, r); +}, [t, e, n]), Vi = (t, e, n, r) => { + const i = Li(e, n, r); W(() => { i ? t.setFieldsValue(i) : t.resetFields(); }, [t, i]); - const o = Li(e, n, r); + const o = Mi(e, n, r); return w.partial(o, t); -}, Vi = (t, e, n = [], r = {}) => { +}, Di = (t, e, n = [], r = {}) => { const i = H({}), o = H(), a = w.debounce(vt(), 180), s = ["disabled", "required"], l = (m, g) => { s.includes(m) && (i.current[m] = g), a(); }, c = B(() => ({ setDisabled: (m) => l("disabled", m), setRequired: (m) => l("required", m), getDisabled: () => i.current.disabled, getRequired: () => i.current.required }), [e]), [u, p] = Yn(e, -1, {}, c, r); @@ -826,12 +826,12 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb r.current = s, e == null || e(s); }]; }, nn = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: n, subWidgets: r = [], basicForm: i, ...o }) => { - const a = zn(t, e), [s, l] = Vi(a, n, r, i), [c, u] = L(); + const a = zn(t, e), [s, l] = Di(a, n, r, i), [c, u] = L(); return W(() => { - s && Z.getWidgetComponent(s).then(({ defaultProps: p = {}, default: m }) => ({ default: Di(m, p, i) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(x.createElement(p.default, o))); + s && Z.getWidgetComponent(s).then(({ defaultProps: p = {}, default: m }) => ({ default: Ui(m, p, i) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(x.createElement(p.default, o))); }, [s]), c && x.cloneElement(c, { ...o, ...l }); -}, Di = (t, e = {}, n = null) => (r) => { - const { type: i, 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, r), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = Ii(Object.assign({}, m, u ? { required: !0 } : {}), o, i), $ = B(() => { +}, Ui = (t, e = {}, n = null) => (r) => { + const { type: i, 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, r), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = Ai(Object.assign({}, m, u ? { required: !0 } : {}), o, i), $ = B(() => { const V = Object.keys((e == null ? void 0 : e.extras) || {}); return w.over([w.partialRight(w.pick, V), w.partialRight(w.omit, V)]); }, [e == null ? void 0 : e.extras]), [F, I] = $(E), T = { label: a, noStyle: s, style: l, colon: !1, layout: "vertical" }, N = J((V) => V == null ? void 0 : ue(V, i), [i]); @@ -848,21 +848,21 @@ const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2numb }; return A(ae, { ...F, form: I, fields: N, onValuesChange: T, children: [b ? h(Xn, { ...E, items: k, theme: b, itemRender: V, fields: c, children: $, basicForm: n }) : V(0, c, $), u == null ? void 0 : u.map((P) => { var M; - return h(Qt, { name: P.code, children: h(Ui, { form: I, basicForm: n, name: P.code, type: P.type, initialValue: P.initialValue, initialValueLanguage: (M = P.extras) == null ? void 0 : M.initialValueLanguage }) }, JSON.stringify(P.code)); + return h(Qt, { name: P.code, children: h(zi, { form: I, basicForm: n, name: P.code, type: P.type, initialValue: P.initialValue, initialValueLanguage: (M = P.extras) == null ? void 0 : M.initialValueLanguage }) }, JSON.stringify(P.code)); })] }); -}, Ui = ({ type: t, initialValue: e, initialValueLanguage: n, onChange: r, basicForm: i }) => { +}, zi = ({ type: t, initialValue: e, initialValueLanguage: n, onChange: r, basicForm: i }) => { const [o, a] = Yn(n == "javascript" && e, n == "javascript" ? void 0 : e, {}, {}, i); return W(() => { n == "javascript" ? r(ue(o, t)) : e && r(ue(e, t)); }, [t, e, o]), null; }; rn.propTypes = { fields: C.array, hides: C.array }; -const zi = /* @__PURE__ */ ((t) => ({ code: e, isPreview: n = !1, ...r }) => { - const { align: i, 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 } = ji(e), $ = B(() => [{ name: "__PK__", value: y }, { name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: S }], [y, e, S, a]); +const Bi = /* @__PURE__ */ ((t) => ({ code: e, isPreview: n = !1, ...r }) => { + const { align: i, 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 } = Ii(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, ...r, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: f, fields: s, hides: l, cols: m, rowHeight: c, itemMargin: [u, p] }); })(rn), or = ({ $setting: t, $close: e, extras: n, code: r, primaryKey: i, ...o }) => { - const [a] = ae.useForm(), s = Mi(a, r, i, t); - return h(ie, { 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(zi, { form: a, code: r, primaryKey: i, ...o }) }); + const [a] = ae.useForm(), s = Vi(a, r, i, t); + return h(ie, { 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(Bi, { form: a, code: r, primaryKey: i, ...o }) }); }, vn = /* @__PURE__ */ new Set(), Ht = (t = [], e = 0) => { const n = t[e]; if (n.length && !vn.has(n)) { @@ -875,7 +875,7 @@ const zi = /* @__PURE__ */ ((t) => ({ code: e, isPreview: n = !1, ...r }) => { } }, kt = ({ className: t, type: e, style: n = {}, ...r }) => h("span", { role: "img", className: j("ff-iconfont", t), style: n, ...r, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); kt.propTypes = { className: C.string, type: C.string.isRequired, style: C.object }, kt.init = Ht; -const Bi = (t, e, n, r) => Q.redirect(n, e, r), Wi = (t, e = {}, n, r = {}) => { +const Wi = (t, e, n, r) => Q.redirect(n, e, r), _i = (t, e = {}, n, r = {}) => { var o; const i = (o = r.router) == null ? void 0 : o.reduce((a, [s, l, c]) => { const u = w.get(e, ["router", s]); @@ -888,22 +888,22 @@ const Bi = (t, e, n, r) => Q.redirect(n, e, r), Wi = (t, e = {}, n, r = {}) => { return w.isFunction(n) ? n.call(null, e, s) : w.isString(n) && n ? Le.exec(n, e, s) : null; }, Tn = (t, e, n, r, i) => w.isString(n) && n ? Z.getWidgetComponent(n).then(({ default: o }) => re.modal(o, { ...e, $setting: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i)).catch((o) => { re.error(n, { content: o.toString() }); -}) : re.modal(n, { ...e, $setting: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), _i = (t, e, n, r, i) => re.modal(or, { ...e, $setting: r, code: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), qi = (t, e, n, r, i) => re.modal(tn, { ...r, base62params: e, listCode: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Ki = ({ widget: t, widgetType: e, widgetData: n, widgetProps: r, widgetSetting: i, widgetContainerProps: o }, { onAfterClick: a, onBeforeClick: s } = {}) => { +}) : re.modal(n, { ...e, $setting: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), qi = (t, e, n, r, i) => re.modal(or, { ...e, $setting: r, code: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Ki = (t, e, n, r, i) => re.modal(tn, { ...r, base62params: e, listCode: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Hi = ({ widget: t, widgetType: e, widgetData: n, widgetProps: r, widgetSetting: i, widgetContainerProps: o }, { onAfterClick: a, onBeforeClick: s } = {}) => { const l = pe(se), [c, u] = L({ leading: !0, trailing: !1 }), p = H(null), [m, g] = B(() => { switch (e) { case "redirect": - return [w.partialRight(Bi, t, i), null]; + return [w.partialRight(Wi, t, i), null]; case "func": return [w.partialRight(Nn, (i == null ? void 0 : i.code) ?? t, { status: c, setStatus: u, listFn: l }), null]; case "component": case "fsdpf-component": return [w.partialRight(Tn, t, i, o), (y) => ({ $setting: y })]; case "grid-layout-form": - return [w.partialRight(_i, t, i, o), (y) => ({ $setting: y })]; + return [w.partialRight(qi, t, i, o), (y) => ({ $setting: y })]; case "data-list": - return [w.partialRight(qi, t, i, o), (y) => y]; + return [w.partialRight(Ki, t, i, o), (y) => y]; case "destroy": - return [w.partialRight(Wi, t, i, o), null]; + return [w.partialRight(_i, t, i, o), null]; default: if (an(t) || x.isValidElement(t)) return [w.partialRight(Tn, t, i, o), (y) => ({ $setting: y })]; if (w.isFunction(t)) return [w.partialRight(Nn, (i == null ? void 0 : i.code) || t, { status: c, setStatus: u }), null]; @@ -930,8 +930,8 @@ const Bi = (t, e, n, r) => Q.redirect(n, e, r), Wi = (t, e = {}, n, r = {}) => { const M = (z, X = !1) => (g(z), !z && y("hover"), z ? l == null ? void 0 : l(S) : s == null ? void 0 : s(X)), D = (z) => { g(!0), y("click"); }; - return h(Wr, { zIndex: I, placement: $, onPopupClick: D, onClick: D, open: m, align: F, arrow: T, trigger: f, getPopupContainer: N || V ? void 0 : (z) => z, content: h(Hi, { ...P, extras: u, children: E && x.cloneElement(E, { ...S, $setProps: b, $close: (z) => M(!1, z) }) }), children: c, onOpenChange: M }); -}, Hi = ({ title: t, className: e, classNames: n, children: r, extras: i, width: o, height: a, ...s }) => { + return h(Wr, { zIndex: I, placement: $, onPopupClick: D, onClick: D, open: m, align: F, arrow: T, trigger: f, getPopupContainer: N || V ? void 0 : (z) => z, content: h(Ji, { ...P, extras: u, children: E && x.cloneElement(E, { ...S, $setProps: b, $close: (z) => M(!1, z) }) }), children: c, onOpenChange: M }); +}, Ji = ({ title: t, className: e, classNames: n, children: r, extras: i, 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 = i ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, i); return h(pt.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: r }), 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] })] }) }); }; @@ -940,7 +940,7 @@ const ht = (t) => function({ className: e, variant: n, children: r, name: i, ico }, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: F, ...I }) { const { mode: T, ...N } = F || {}, V = ar({ className: e, name: i, type: a, icon: o, iconPosition: s }, n ?? t), P = h(bt, { ...V, ...I, children: r || i }); if (T === "popover" && !["destroy", "redirect", "func"].includes(b)) return h(Tt, { data: p, widget: S, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: N, onAfterClick: c, onBeforeClick: u, children: P }); - const M = w.isEmpty(f) || !f.enabled ? {} : f, D = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [z, X] = L(!1), [xe, { disabled: _, loading: le }] = Ki({ widget: S, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u }); + const M = w.isEmpty(f) || !f.enabled ? {} : f, D = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [z, X] = L(!1), [xe, { disabled: _, loading: le }] = Hi({ widget: S, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u }); return h(_r, { okText: "确定", cancelText: "取消", getPopupContainer: (K) => K, ...D, disabled: _ || g, open: z, onOpenChange: (K) => { if (!K) return X(K); D.enabled ? X(K) : xe(p); @@ -951,7 +951,7 @@ const ht = (t) => function({ className: e, variant: n, children: r, name: i, ico }, children: h(qr, { getPopupContainer: (K) => K, ...M, title: z ? null : M == null ? void 0 : M.title, trigger: ["hover", "click"], children: x.cloneElement(P, { loading: le || m, disabled: _ || g }) }) }); }, R = ht("default"); R.propTypes = { type: C.oneOf(["primary", "default", "danger", ""]), size: C.oneOf(["large", "middle", "small"]), name: C.string, icon: C.string, iconPosition: C.oneOf(["start", "end"]), data: C.any, widget: C.any, widgetType: C.oneOf(["destroy", "redirect", "func", "component", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: C.object, widgetProps: C.object, widgetSetting: C.object, widgetContainerProps: C.object, tooltip: C.exact({ title: C.string.isRequired, placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func }), confirm: C.exact({ title: C.string.isRequired, cancelText: C.string, okText: C.string, okType: C.oneOf(["primary", "default", "danger", ""]), placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func, arrow: C.oneOfType([C.bool, C.exact({ pointAtCenter: C.bool })]) }) }; -const Ji = ht("link"), Gi = ht("circle"), Yi = ht("round"), Xi = ht("dashed"), On = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: n = (g, f, y) => { +const Gi = ht("link"), Yi = ht("circle"), Xi = ht("round"), Qi = ht("dashed"), On = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: n = (g, f, y) => { }, onBeforeClick: r = (g, f, y) => { }, labelVariant: i = "link", labelSize: o, labelRender: a, btnVariant: s, btnSize: l, btnRender: c = (g, f) => h(R, { ...g, data: f }, g.uuid || Mt()), widgetContainerProps: u = {}, children: p, data: m }) => { if (w.isEmpty(t)) return p; @@ -965,11 +965,11 @@ const Ji = ht("link"), Gi = ht("circle"), Yi = ht("round"), Xi = ht("dashed"), O let S = y; return (y == null ? void 0 : y.length) > 1 && (S = s == "link" ? h(Dt, { split: h(Kr, { type: "vertical" }), size: l, children: y }) : h(Dt.Compact, { size: l, children: y })), g ? h(Tt, { 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(r, g, m), children: p }) : S; }; -On.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 = Ji, R.Link.defaultProps = R.defaultProps, R.Link.propTypes = R.propTypes, R.Circle = Gi, R.Circle.defaultProps = R.defaultProps, R.Circle.propTypes = R.propTypes, R.Round = Yi, R.Round.defaultProps = R.defaultProps, R.Round.propTypes = R.propTypes, R.Dashed = Xi, R.Dashed.defaultProps = R.defaultProps, R.Dashed.propTypes = R.propTypes, R.Popover = Tt, R.GroupPopover = On; -const Qi = ({ fields: t, formProps: e, $close: n }) => { +On.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 = Gi, R.Link.defaultProps = R.defaultProps, R.Link.propTypes = R.propTypes, R.Circle = Yi, R.Circle.defaultProps = R.defaultProps, R.Circle.propTypes = R.propTypes, R.Round = Xi, R.Round.defaultProps = R.defaultProps, R.Round.propTypes = R.propTypes, R.Dashed = Qi, R.Dashed.defaultProps = R.defaultProps, R.Dashed.propTypes = R.propTypes, R.Popover = Tt, R.GroupPopover = On; +const Zi = ({ fields: t, formProps: e, $close: n }) => { const [r] = ae.useForm(), i = B(() => [{ name: "__PROPS__", value: e }], [e]); return h(ie, { actions: A(x.Fragment, { children: [h(R, { name: "取消", widget: () => n(!1) }), h(R, { name: "确定", type: "primary", widget: () => r.validateFields(!0).then(n) })] }), children: h(ae, { fields: i, form: r, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...a }) => h(nn, { code: o, ...a }, o)) }) }); -}, Zi = ({ className: t, classNames: e, $close: n, children: r, title: i, subTitle: o, actions: a, extras: s, ...l }) => A(Zr, { ...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" }) }), i, o] }), h("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: r }), A("div", { className: j("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, a] })] }), eo = ({ className: t, classNames: e, $close: n, $event: r, children: i, title: o, subTitle: a, actions: s, extras: l, placement: c, ...u }) => { +}, eo = ({ className: t, classNames: e, $close: n, children: r, title: i, subTitle: o, actions: a, extras: s, ...l }) => A(Zr, { ...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" }) }), i, o] }), h("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: r }), 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: r, children: i, 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]; @@ -982,10 +982,10 @@ const Qi = ({ fields: t, formProps: e, $close: n }) => { const g = () => { e(!1); }; - return h(pt.Provider, { value: { ele: a, mount: u, unmount: p }, children: t && t !== "center" ? h(Zi, { ...m, placement: t, open: l, afterOpenChange: (f) => !f && g() }) : h(eo, { ...m, visible: l, afterClose: g }) }); + return h(pt.Provider, { value: { ele: a, mount: u, unmount: p }, children: t && t !== "center" ? h(eo, { ...m, placement: t, open: l, afterOpenChange: (f) => !f && g() }) : h(to, { ...m, visible: l, afterClose: g }) }); }; sr.propTypes = { placement: C.oneOf(["center", "left", "top", "right", "bottom"]) }; -const to = ({ widget: t, widgetProps: e, $close: n, onSetProps: r }) => { +const no = ({ widget: t, widgetProps: e, $close: n, onSetProps: r }) => { const [i, o] = L(e || {}), a = jn(e); Yt(() => { const l = a ?? {}, c = e ?? {}, u = Object.keys({ ...l, ...c }).reduce((p, m) => (l[m] !== c[m] && (p[m] = c[m]), p), {}); @@ -1021,7 +1021,7 @@ const to = ({ widget: t, widgetProps: e, $close: n, onSetProps: r }) => { S && (Y.$popups.set(u, { ...S, widgetProps: f ? { ...S.widgetProps, ...f } : S.widgetProps, widgetContainerProps: y ? { ...S.widgetContainerProps, ...y } : S.widgetContainerProps }), n()); }; }; - return A(x.Fragment, { children: [Array.from(Y.$popups).map(([o, { widget: a, widgetProps: s, widgetContainerProps: l, $close: c, onSetProps: u }]) => h(sr, { maskClosable: !1, $event: s == null ? void 0 : s.$event, ...l, $close: c, children: h(to, { widget: a, widgetProps: s, $close: c, onSetProps: u }) }, o)), e] }); + return A(x.Fragment, { children: [Array.from(Y.$popups).map(([o, { widget: a, widgetProps: s, widgetContainerProps: l, $close: c, onSetProps: u }]) => h(sr, { 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] }); }; Y.$popups = /* @__PURE__ */ new Map(), Y.$index = 0, Y.$queue = [], Y.$onClick = (...t) => { const e = new Promise((n, r) => { @@ -1031,7 +1031,7 @@ Y.$popups = /* @__PURE__ */ new Map(), Y.$index = 0, Y.$queue = [], Y.$onClick = }); return e; }; -const Rn = (t, e, n = {}) => Y.$onClick(t, e, n), It = (t, { showProgress: e, duration: n, ...r } = { duration: 1.5 }) => Y.$onClick(Dn, { content: t, ...r }, { showProgress: e, duration: n }), re = { modal: Rn, confirm: (t, e = {}) => Y.$onClick(ti, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, n = {}) => Rn(Qi, { formProps: n, fields: t }, { placement: "center", ...e }).then((r) => { +const Rn = (t, e, n = {}) => Y.$onClick(t, e, n), It = (t, { showProgress: e, duration: n, ...r } = { duration: 1.5 }) => Y.$onClick(Dn, { content: t, ...r }, { showProgress: e, duration: n }), re = { modal: Rn, confirm: (t, e = {}) => Y.$onClick(ti, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, n = {}) => Rn(Zi, { formProps: n, fields: t }, { placement: "center", ...e }).then((r) => { if (r === !1) throw !1; return r; }), notification: It, success: (t, e = { duration: 1.5 }) => It(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => It(t, { ...e, className: "ff-notification-error", icon: "close" }) }; @@ -1166,8 +1166,8 @@ const we = class we { }; Ie = new WeakMap(), Ge = new WeakMap(), at = new WeakMap(), v(we, Ie, null), O(we, "getInstance", () => (d(we, Ie) || q(we, Ie, new we()), d(we, Ie))); let Gt = we; -const Z = Gt.getInstance(), no = x.createContext({ user: {}, initUser: () => { -}, initUserComplete: !1 }), ro = x.createContext({ set: () => { +const Z = Gt.getInstance(), ro = x.createContext({ user: {}, initUser: () => { +}, initUserComplete: !1 }), io = x.createContext({ set: () => { }, get: () => { }, assign: () => { }, currentRoute: () => { @@ -1179,11 +1179,11 @@ const Z = Gt.getInstance(), no = x.createContext({ user: {}, initUser: () => { return !e || /^[A-Z]/.test(e); } return !1; -}, io = (t, e) => { +}, oo = (t, e) => { if (!t || typeof window > "u") return; let n = document.querySelector(`style[ff-style-token="${e}"]`); return n ? (n.innerHTML = t, t) : (n = document.createElement("style"), n.setAttribute("ff-style-token", e), n.setAttribute("type", "text/css"), n.innerHTML = t, document.head.appendChild(n), t); -}, oo = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: no, AppGlobalParamsContext: ro, cache: Mn, configure: Ae, default: Z, func: Le, http: U, insertStyle: io, isReactComponent: an, route: Q }, Symbol.toStringTag, { value: "Module" })); +}, ao = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: ro, AppGlobalParamsContext: io, cache: Mn, configure: Ae, default: Z, func: Le, http: U, insertStyle: oo, isReactComponent: an, route: Q }, Symbol.toStringTag, { value: "Module" })); var Pe, Ye, ve, Ce, ke, oe, ne, G, Se, st, lt, ct, dt, $t, ut; const sn = class sn { constructor(e, n = "/") { @@ -1433,7 +1433,7 @@ const sn = class sn { }; Pe = new WeakMap(), Ye = new WeakMap(), ve = new WeakMap(), Ce = new WeakMap(), ke = new WeakMap(), oe = new WeakMap(), ne = new WeakMap(), G = new WeakMap(), Se = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), $t = new WeakMap(), ut = new WeakMap(); let Fn = sn; -const ao = async (t, e = "/", n = "") => { +const so = async (t, e = "/", n = "") => { try { const r = await t.stat(e), i = e === "/" ? "/" : ge.basename(e), o = { title: i, key: n ? `${n}${e}` : e, isLeaf: r.isFile() }; if (r.isDirectory()) { @@ -1453,7 +1453,7 @@ const ao = async (t, e = "/", n = "") => { for (const c of [...s, ...l]) { const u = e === "/" ? `/${c}` : `${e}/${c}`; try { - const p = await ao(t, u, n); + const p = await so(t, u, n); o.children.push(p); } catch (p) { console.warn(`Failed to process ${u}:`, p.message); @@ -1467,82 +1467,82 @@ const ao = async (t, e = "/", n = "") => { } }; export { - Uo as $, + zo as $, ai as A, - To as B, - Oo as C, + Oo as B, + Ro as C, Ct as D, Wn as E, Wt as F, - jo as G, + Io as G, bi as H, si as I, li as J, $i as K, Pi as L, - Io as M, - Ao as N, + Ao as M, + Lo as N, ue as O, Ni as P, Pt as Q, Jn as R, er as S, jt as T, - Lo as U, - Mo as V, - Vo as W, - Do as X, + Mo as U, + Vo as V, + Do as W, + Uo as X, Ti as Y, Oi as Z, Ri as _, zn as a, - zo as a0, + Fi as a0, vt as a1, Bo as a2, gt as a3, Nt as a4, Wo as a5, _o as a6, - Fi as a7, + ji as a7, ir as a8, - zi as a9, + Bi as a9, Mn as aA, Ae as aB, Le as aC, Q as aD, - no as aE, - ro as aF, + ro as aE, + io as aF, Fn as aG, - ao as aH, - to as aI, + so as aH, + no as aI, rn as aa, nn as ab, or as ac, - ji as ad, - Ii as ae, - Ai as af, - Li as ag, - Mi as ah, - Vi as ai, + Ii as ad, + Ai as ae, + Li as af, + Mi as ag, + Vi as ah, + Di as ai, qo as aj, kt as ak, R as al, Un as am, - Ki as an, + Hi as an, ie as ao, pt as ap, Vn as aq, Y as ar, re as as, - Po as at, - vo as au, - No as av, + vo as at, + No as au, + To as av, Z as aw, an as ax, - io as ay, + oo as ay, U as az, _n as b, - Ro as c, + Fo as c, qn as d, en as e, Gn as f, @@ -1551,7 +1551,7 @@ export { Si as i, Xn as j, ki as k, - Fo as l, + jo as l, Yn as m, Hn as n, Kn as o, diff --git a/dist/components.js b/dist/components.js index 4ea518b..03bd237 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,4 +1,4 @@ -import { at as s, ak as p, au as r, av as t, as as e, aI as n } from "./common/main-DahsFEqk.js"; +import { at as s, ak as p, au as r, av as t, as as e, aI as n } from "./common/main-BlkZ_sRx.js"; export { s as Empty, p as Icon, diff --git a/dist/container.js b/dist/container.js index 41fffec..34fbd49 100644 --- a/dist/container.js +++ b/dist/container.js @@ -1,4 +1,4 @@ -import { ap as s, at as e, au as p, av as t, aq as d, as as n, ar as r, ao as u } from "./common/main-DahsFEqk.js"; +import { ap as s, at as e, au as p, av as t, aq as d, as as n, ar as r, ao as u } from "./common/main-BlkZ_sRx.js"; export { s as Context, e as Empty, diff --git a/dist/data-converter.js b/dist/data-converter.js index e261842..38d7064 100644 --- a/dist/data-converter.js +++ b/dist/data-converter.js @@ -1,6 +1,6 @@ import "lodash"; import "react"; -import { D as i } from "./common/main-DahsFEqk.js"; +import { D as i } from "./common/main-BlkZ_sRx.js"; import "react-use"; export { i as default diff --git a/dist/data-list.js b/dist/data-list.js index ee8a5c8..0882011 100644 --- a/dist/data-list.js +++ b/dist/data-list.js @@ -1,4 +1,4 @@ -import { w as t, t as e, o as r, r as o, x as i, s as l, q as u, v as n, p as D, y as L, n as p, A as C, z as m, J as b, C as c, F, E as d, I as k, B as w } from "./common/main-DahsFEqk.js"; +import { w as t, t as e, o as r, r as o, x as i, s as l, q as u, v as n, p as D, y as L, n as p, A as C, z as m, J as b, C as c, F, E as d, I as k, B as w } from "./common/main-BlkZ_sRx.js"; export { t as DataListContent, e as DataListContext, diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index 881e14a..4485154 100644 --- a/dist/data-list/utils.js +++ b/dist/data-list/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { f as a } from "../common/main-DahsFEqk.js"; +import { f as a } from "../common/main-BlkZ_sRx.js"; export { a as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index 9f6ffb8..226a925 100644 --- a/dist/grid-layout-form.js +++ b/dist/grid-layout-form.js @@ -1,4 +1,4 @@ -import { aa as s, ac as r, ab as u, a9 as o, m as t, ah as m, af as d, ag as i, aj as F, ae as g, ad as c, ai as l } from "./common/main-DahsFEqk.js"; +import { aa as s, ac as r, ab as u, a9 as o, m as t, ah as m, af as d, ag as i, aj as F, ae as g, ad as c, ai as l } from "./common/main-BlkZ_sRx.js"; export { s as GridLayoutForm, r as GridLayoutFormHelper, diff --git a/dist/grid-layout-form/utils.js b/dist/grid-layout-form/utils.js index 90cddc8..d8e16af 100644 --- a/dist/grid-layout-form/utils.js +++ b/dist/grid-layout-form/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { a as o, g } from "../common/main-DahsFEqk.js"; +import { a as o, g } from "../common/main-BlkZ_sRx.js"; export { o as getNormalizeWidget, g as getOptionItemByValue diff --git a/dist/grid-layout.js b/dist/grid-layout.js index b5b735d..eba87ec 100644 --- a/dist/grid-layout.js +++ b/dist/grid-layout.js @@ -1,4 +1,4 @@ -import { h as u, j as e, i as r, H as t, G as d, k as i, m as o, l as G, u as l } from "./common/main-DahsFEqk.js"; +import { h as u, j as e, i as r, H as t, G as d, k as i, m as o, l as G, u as l } from "./common/main-BlkZ_sRx.js"; export { u as GridLayout, e as GridLayoutFramework, diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index afb42fa..5c099c9 100644 --- a/dist/grid-layout/utils.js +++ b/dist/grid-layout/utils.js @@ -1,4 +1,4 @@ -import { b as a, d as o, e as s, c as g } from "../common/main-DahsFEqk.js"; +import { b as a, d as o, e as s, c as g } from "../common/main-BlkZ_sRx.js"; export { a as getBoxStyle, o as getEventProps, diff --git a/dist/hooks.js b/dist/hooks.js index 03cb404..0bc96b9 100644 --- a/dist/hooks.js +++ b/dist/hooks.js @@ -2,7 +2,7 @@ import "lodash"; import "rc-field-form"; import "react"; import "react-use"; -import { a4 as u, a3 as o, a5 as i, a2 as f, a6 as m, a1 as d, a8 as c, a7 as l } from "./common/main-DahsFEqk.js"; +import { a4 as u, a3 as o, a5 as i, a2 as f, a6 as m, a1 as d, a8 as c, a7 as l } from "./common/main-BlkZ_sRx.js"; import { default as b } from "rc-util/lib/hooks/useMergedState"; import { a as x } from "./common/vender-C5RbewOc.js"; export { diff --git a/dist/iconfont.js b/dist/iconfont.js index 0495bab..45fe033 100644 --- a/dist/iconfont.js +++ b/dist/iconfont.js @@ -2,7 +2,7 @@ import "react/jsx-runtime"; import "react"; import "prop-types"; import "classnames"; -import { ak as a } from "./common/main-DahsFEqk.js"; +import { ak as a } from "./common/main-BlkZ_sRx.js"; export { a as default }; diff --git a/dist/index.d.ts b/dist/index.d.ts index 194d62a..1260079 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,8 +1,47 @@ +import * as axios from 'axios'; +import * as Request from 'ff-request'; +import Request__default from 'ff-request'; +import MockAdapter from 'axios-mock-adapter'; import React from 'react'; declare const _default$3: any; -declare const _default$2: any; +declare const _default$2: Http & Request__default; + +/** + * 应用统一的 HTTP 客户端单例;自身只实现 init/driver/headers/mock/unmock, + * 其余属性通过 Proxy 代理到内部的 ff-request 实例(HttpRequest), + * 所以 get/post/del 等请求方法可以直接在这个单例上调用 + */ +declare class Http { + static "__#private@#instance": any; + static "__#private@#core": any; + /** @returns {Http & import('ff-request').default} 单例实例 */ + static getInstance: () => Http & Request.default; + appUrl: string; + /** + * 初始化(设置请求 baseURL/超时,并初始化内部 ff-request 实例) + * @param {string} appKey + * @param {string} appSecret + * @param {string} appUrl 接口请求的 baseURL + */ + init(appKey: string, appSecret: string, appUrl: string): void; + get driver(): axios.AxiosStatic; + get headers(): Readonly<{ + Platform: "web"; + SaaS: string; + Authorization: `Bearer ${string} `; + }>; + /** + * 开启请求 mock(基于 axios-mock-adapter),未匹配的请求会透传到真实接口 + * @param {Object} [opt] 传给 MockAdapter 的选项 + * @returns {MockAdapter} mock 适配器实例,用于注册具体的 mock 规则 + */ + mock(opt?: any): MockAdapter; + /** 关闭并清除 mock */ + unmock(): void; + #private; +} declare class Cache { constructor(target: any, fn: any); diff --git a/dist/index.js b/dist/index.js index 6f0e26d..fd8f0be 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -import { aE as t, aF as e, aA as o, aB as n, aw as p, aC as r, az as c, ay as f, ax as l, aD as u } from "./common/main-DahsFEqk.js"; +import { aE as t, aF as e, aA as o, aB as n, aw as p, aC as r, az as c, ay as f, ax as l, aD as u } from "./common/main-BlkZ_sRx.js"; export { t as AppContext, e as AppGlobalParamsContext, diff --git a/dist/pages.js b/dist/pages.js index 74422bc..12c9bba 100644 --- a/dist/pages.js +++ b/dist/pages.js @@ -1,4 +1,4 @@ -import { L as t, K as e, M as o, N as g } from "./common/main-DahsFEqk.js"; +import { L as t, K as e, M as o, N as g } from "./common/main-BlkZ_sRx.js"; export { t as CustomPage, e as DataListPage, diff --git a/dist/res-ws.js b/dist/res-ws.js index 6d44070..a074458 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-DahsFEqk.js"; +import { R as a } from "./common/main-BlkZ_sRx.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index 5b39a88..c7c9182 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -1,5 +1,5 @@ import "lodash"; -import { S as r, a0 as i, W as g, V as o, X as P, P as m, $ as p, Q as U, _ as d, Y as h, Z as k, T as n, O as f, U as l } from "./common/main-DahsFEqk.js"; +import { S as r, a0 as i, W as g, V as o, X as P, P as m, $ as p, Q as U, _ as d, Y as h, Z as k, T as n, O as f, U as l } from "./common/main-BlkZ_sRx.js"; import "./common/vender-C5RbewOc.js"; export { r as deepSome, diff --git a/dist/virtual-fs.js b/dist/virtual-fs.js index 04c1aeb..2e12a98 100644 --- a/dist/virtual-fs.js +++ b/dist/virtual-fs.js @@ -1,5 +1,5 @@ import "pathe"; -import { aG as o, aH as r } from "./common/main-DahsFEqk.js"; +import { aG as o, aH as r } from "./common/main-BlkZ_sRx.js"; export { o as default, r as toTreePaths diff --git a/package.json b/package.json index 5c7fb75..f409e9d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.7.3", + "version": "0.7.4", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js",