diff --git a/dist/button.js b/dist/button.js index 5451830..ac7315d 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-Dryw40ez.js"; +import { am as s, al as u, an as e } from "./common/main-DCysVEHh.js"; export { s as auth, u as default, diff --git a/dist/common/main-DCysVEHh.js b/dist/common/main-DCysVEHh.js new file mode 100644 index 0000000..d2e34b6 --- /dev/null +++ b/dist/common/main-DCysVEHh.js @@ -0,0 +1,1605 @@ +var Nn = Object.defineProperty; +var fr = (t) => { + throw TypeError(t); +}; +var Tn = (t, e, r) => e in t ? Nn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; +var N = (t, e, r) => Tn(t, typeof e != "symbol" ? e + "" : e, r), yr = (t, e, r) => e.has(t) || fr("Cannot " + r); +var d = (t, e, r) => (yr(t, e, "read from private field"), r ? r.call(t) : e.get(t)), v = (t, e, r) => e.has(t) ? fr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), K = (t, e, r, n) => (yr(t, e, "write to private field"), n ? n.call(t, r) : e.set(t, r), r); +import { jsx as m, jsxs as I } from "react/jsx-runtime"; +import E, { useEffect as z, useState as L, useCallback as H, useRef as J, useContext as de, useMemo as W, useId as Lt, isValidElement as On, useLayoutEffect as Rn, Suspense as Fn } from "react"; +import ue from "pathe"; +import C from "prop-types"; +import j from "classnames"; +import { useNotification as jn } from "rc-notification"; +import w from "lodash"; +import { useMountedState as An, useDeepCompareEffect as Yt, useUpdateEffect as Gt, usePrevious as Fr } from "react-use"; +import ie, { Field as Xt, FieldContext as jr } from "rc-field-form"; +import { _ as wr, C as Zt, L as In, M as Rt, N as Xe, b as Le, s as Vt, c as Ln, S as Vn } from "./vender-CIG7ep61.js"; +import Dn from "rc-util/lib/hooks/useMergedState"; +import Ar from "immutability-helper"; +import { Space as Dt, Form as ft, Input as Mn, Button as wt, Pagination as Bn, Tree as Un, Breadcrumb as Wn, Empty as Mt, Table as br, Popover as zn, Popconfirm as qn, Tooltip as Kn, Divider as _n } from "antd"; +import { useMergedState as Jn } from "rc-util"; +import { generatePath as Hn, useInRouterContext as Ir, useParams as Yn, useLocation as Gn, createBrowserRouter as Xn, Navigate as Zn } from "react-router-dom"; +import Qn from "rc-drawer"; +import ei from "rc-dialog"; +import * as Cr from "react-is"; +var ze, Qe, qe, xe, Ve, De; +class ti { + constructor(e, r) { + v(this, ze, /* @__PURE__ */ new Map()); + v(this, Qe, !0); + v(this, qe, []); + v(this, xe); + v(this, Ve, () => d(this, xe)); + v(this, De, () => Promise.resolve()); + N(this, "get", (...e) => new Promise((r, n) => { + const i = JSON.stringify(e); + if (d(this, ze).has(i)) return r(d(this, De).call(this, d(this, xe), ...e)); + if (d(this, xe) === void 0) d(this, qe).push([e, r, n]), d(this, Qe) && (K(this, Qe, !1), Promise.resolve(typeof d(this, Ve) == "function" ? d(this, Ve).call(this) : d(this, Ve)).then((o) => K(this, xe, o || null)).finally(() => { + d(this, qe).forEach(([o, s, a]) => { + try { + const l = d(this, De).call(this, d(this, xe), ...o); + d(this, ze).set(JSON.stringify(o), l), s(l); + } catch (l) { + a(l); + } + }), d(this, qe).length = 0; + })); + else { + const o = d(this, De).call(this, d(this, xe), ...e); + d(this, ze).set(i, o), r(o); + } + })); + K(this, De, r), K(this, Ve, e); + } +} +ze = new WeakMap(), Qe = new WeakMap(), qe = new WeakMap(), xe = new WeakMap(), Ve = new WeakMap(), De = new WeakMap(); +const ri = () => m("div", { children: "Empty" }), ut = E.createContext({ ele: {}, mount: () => { +}, unmount: () => { +} }), re = ({ rootClassName: t, className: e, children: r, actions: n, title: i, subTitle: o, extras: s, style: a = {} }) => { + const { mount: l, unmount: c } = E.useContext(ut); + return re.Action({ children: n }), re.Title({ children: i }), re.SubTitle({ children: o }), re.Extra({ children: s }), z(() => (l("rootClassName", t), () => c(t)), [t]), m("div", { className: j("ff-container", e), style: a, children: r }); +}, ht = (t) => ({ children: e, className: r }) => { + const { mount: n, unmount: i } = E.useContext(ut); + return z(() => (e && n(t, E.createElement("div", { key: `ff-${t}`, className: j(`ff-popup-${t}`, r) }, e)), () => i(t)), [r, e]), null; +}; +re.Action = ht("actions"), re.Title = ht("title"), re.SubTitle = ht("sub-title"), re.Extra = ht("extras"), re.propTypes = { className: C.string, style: C.object, title: C.any, subTitle: C.any, actions: C.any, extras: C.any }; +const Po = () => m(re, { className: "ff-loading", children: I("div", { className: "loader", children: [I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] })] }) }), vo = () => m("div", { children: "NotFound" }), Lr = ({ children: t }) => { + const [e, r] = L({}), n = H((o, s) => r((a) => ({ ...a, [o]: s })), []), i = H((o) => r((s) => ({ ...s, [o]: void 0 })), []); + return typeof (t == null ? void 0 : t.type) == "string" ? t : m(ut.Provider, { value: { ele: e, mount: n, unmount: i }, children: E.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); +}; +Lr.propTypes = { children: C.element.isRequired }; +const kr = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, Qt = ({ type: t, props: e }) => m("i", { ...e, children: m("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (kr[t] || kr.info).map((r, n) => m("path", { d: r }, n)) }) }), Vr = ({ className: t, content: e, icon: r, $close: n }) => I(E.Fragment, { children: [r && m("div", { className: j("ff-notification-icon", t), children: m(Qt, { type: r }) }), e] }), ni = ({}) => m(re, { children: "Confirm" }); +var Te, Ke; +const pe = class pe { + constructor() { + v(this, Ke, /* @__PURE__ */ new Map()); + N(this, "init", (e) => K(this, Ke, new Map(e))); + N(this, "check", (e) => !d(this, Ke).has(e) || d(this, Ke).get(e)); + if (d(pe, Te)) return d(pe, Te); + } +}; +Te = new WeakMap(), Ke = new WeakMap(), v(pe, Te, null), N(pe, "getInstance", () => (d(pe, Te) || K(pe, Te, new pe()), d(pe, Te))); +let Bt = pe; +const Dr = Bt.getInstance(), ii = (t, e, r = "children") => { + if (w.isEmpty(t)) return {}; + const n = w.find(t, ["value", e]); + if (!w.isEmpty(n)) return n; + const i = t.length; + for (let o = 0; o < i; o++) { + const { [r]: s } = t[o], a = ii(s, e, r); + if (!w.isEmpty(a)) return a; + } + return {}; +}, Mr = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; +var Oe, et; +const ge = class ge { + constructor() { + v(this, et, null); + N(this, "init", (e) => K(this, et, e)); + N(this, "get", (e, r) => w.get(d(this, et), e, r)); + if (d(ge, Oe)) return d(ge, Oe); + } +}; +Oe = new WeakMap(), et = new WeakMap(), v(ge, Oe, null), N(ge, "getInstance", () => (d(ge, Oe) || K(ge, Oe, new ge()), d(ge, Oe))); +let Ut = ge; +const Ue = Ut.getInstance(); +var _e, kt, tt, rt, St; +const Ne = class Ne { + constructor(...e) { + v(this, tt, []); + v(this, rt, (e) => { + var r; + for (let n of e) Array.isArray(n[0]) ? d(this, rt).call(this, n) : d(this, tt).push(d(r = Ne, kt).call(r, n[0], n[1])); + }); + N(this, "toValue", async (e, r = null) => { + const n = { getValue: () => e, getRecord: () => r }; + let i = e; + for (const o of d(this, tt)) try { + const s = await o; + if (typeof s != "function") { + console.warn("middleware is not a function, skip:", s); + continue; + } + i = await s.call(n, i); + } catch (s) { + console.error("middleware error, skip:", s); + } + return i; + }); + N(this, "toRender", (e, r, n = null) => E.createElement(d(this, St), { value: e, record: r }, n)); + v(this, St, ({ value: e, record: r, children: n }) => { + const [i, o] = L(n), s = An(); + return Yt(() => { + o(n), this.toValue(e, r).then((a) => s() && o(a)).catch((a) => s() && o(`${a}`)); + }, [e, r]), i; + }); + d(this, rt).call(this, e); + } +}; +_e = new WeakMap(), kt = new WeakMap(), tt = new WeakMap(), rt = new WeakMap(), St = new WeakMap(), v(Ne, _e, null), v(Ne, kt, w.memoize((e, r) => { + if (typeof e == "function") return e(r); + if (typeof e == "string") return Z.getWidgetComponent(e).then((n) => { + var i; + return ((i = n.default) == null ? void 0 : i.call(n, r)) || ((o) => o); + }); + throw new TypeError("middleware must be a string or a function"); +}, (...e) => { + var r; + return d(Ne, _e) || K(Ne, _e, Fi()), d(r = Ne, _e).call(r, ...e); +})); +let bt = Ne; +const oe = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { +}, getSelectedRows: () => [], onReload: () => { +}, onClickCallback: () => { +}, onConditionChange: () => { +}, onTabChange: () => { +}, onSiderChange: () => { +}, onKeywordChange: () => { +}, onPageChange: () => { +}, onPageSizeChange: () => { +}, reload: () => { +}, setPage: () => { +}, setPageSize: () => { +}, setTab: () => { +}, setSider: () => { +}, setKeyword: () => { +}, setCondition: () => { +} }), Sr = ({ className: t, record: e, column: r, ...n }) => { + if (r != null && r.editableByJs && (r != null && r.uuid)) { + const { formSetting: i = { primaryKey: "id" }, widgetSetting: o = {}, widgetContainerSetting: s = {} } = (r == null ? void 0 : r.editableByJsSetting) || {}; + return m(R.Popover, { widget: Br, widgetData: { record: e, column: r }, widgetSetting: { widgetSetting: o, formSetting: i }, widgetContainerProps: { title: r != null && r.title ? `${r.title} - 编辑` : "编辑", width: 260, zIndex: 1050, arrow: !0, ...s }, children: m("td", { className: j("ff-data-list-cell-editable", t), ...n }) }); + } + return m("td", { className: t, ...n }); +}, Br = ({ record: t, column: e, $close: r, $setting: n }) => { + const i = J(Oi(w.get(t, e == null ? void 0 : e.dataIndex))), { listCode: o, onClickCallback: s } = de(oe), [a] = ie.useForm(), { formSetting: l, widgetSetting: c } = n, { primaryKey: u = "id", help: p, validators: h } = l || {}, g = () => { + a.setFieldsValue({ value: w.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); + }; + return vt(() => g(), [t, e == null ? void 0 : e.dataIndex, o]), m(re, { actions: I(E.Fragment, { children: [m(R, { size: "small", onClick: g, children: "重置" }), I(Dt.Compact, { block: !0, children: [m(R, { size: "small", widget: r, children: "取消" }), m(R, { type: "primary", size: "small", widget: () => a.validateFields().then(({ value: f }) => { + const y = w.get(t, u.substring(u.indexOf(".") + 1)); + if (!y) throw "获取更新主键失败!"; + B.put(`/api/${o}-storeBy-${e == null ? void 0 : e.uuid}/${y}`, { value: f }).msg(() => s(2, t)).then(r); + }).catch(console.warn), children: "保存" })] })] }), children: I(ie, { form: a, children: [m(nr, { label: "", code: "value", type: i.current, widget: e == null ? void 0 : e.editableByJs, help: p, extras: c, validators: h }), m(Xt, { noStyle: !0, name: ["__PROPS__"], children: () => { + } })] }) }); +}; +Br.displayName = "DataListCellEditableContainer"; +const oi = (t) => function(e) { + return t(e, getRecord()); +}, si = async ({ widgetByJs: t, widgetByJsSetting: e }) => { + const r = await Z.getWidgetComponent(t).then((n) => n.default || ((i) => i)); + return function(n) { + return m(r, { value: n, $setting: e }); + }; +}, ai = (t, e = {}) => W(() => { + var r; + return (r = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : r.map(({ widgetByJs: n, widgetByJsSetting: i, middlewares: o, ...s }, a) => { + const l = (c) => ({ record: c, column: s }); + return o || (o = []), n && o.push([si, { widgetByJs: n, widgetByJsSetting: i }]), o.length > 0 ? (s != null && s.render && o.push([oi, s.render]), { ...s, onCell: l, render: (c, u) => new bt(o).toRender(c, u, "-") }) : { ...s, onCell: l }; + }); +}, [t, e]), li = (t = {}) => W(() => { + var e; + return t.body ?? (t.body = { cell: Sr }), (e = t.body).cell ?? (e.cell = Sr), t; +}, [t]), No = (t) => { + const [e, r] = L({}); + return z(() => { + let n = !1; + return t && B.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) => !n && r(i)), () => n = !0; + }, [t]), e; +}, To = (t, e = {}) => { + const [r, n] = L({ dataSource: [] }); + return pt(() => { + let i = !1; + return t && B.get(`/api/${t}/${B.encode({ page: 1, ...e })}`).then((o) => !i && n(o)), () => i = !0; + }, [t, e]), r; +}, Ur = (t = [], e = /* @__PURE__ */ new Map(), r = "id", n) => { + const i = H(n ? (o) => w.get(o, r, w.get(o, [n, r])) : (o) => w.get(o, r), [r, n]); + return H((o) => t == null ? void 0 : t.filter((s) => !s.uuid || !e.has(s.uuid) || e.get(s.uuid).some((a) => a == i(o))), [t, e, i]); +}, Wt = (t = [], e = /* @__PURE__ */ new Map(), r = [], n = "id", i) => { + const o = H(i ? (s) => w.get(s, n, w.get(s, [i, n])) : (s) => w.get(s, n), [n, i]); + return W(() => { + if (w.isEmpty(t) || !t.some(({ uuid: a }) => Dr.check(a))) return !1; + if (w.isEmpty(e) || w.isEmpty(r)) return !0; + const s = r.map((a) => o(a)); + return t.some(({ uuid: a }) => !a || !e.has(a) || e.get(a).some((l) => s.some((c) => c == l))); + }, [t, r, e, o]); +}, ci = (t, e, r = "id", n = null) => { + const i = Pt(), o = J(!1), s = J(t.dataSource), a = J(t.itemOperationsAccess); + return z(() => (s.current = t.dataSource, a.current = t.itemOperationsAccess, () => o.current = !1), [t.dataSource, t.itemOperationsAccess]), o.current && (t.dataSource = s.current, t.itemOperationsAccess = a.current), [t, (l = 0, c = null) => { + var u, p; + if (o.current = !1, l === 1) return (u = t.onReload) == null ? void 0 : u.call(t); + if (l === 2) { + const h = w.get(c, "__PARENT_ID__", ""), g = w.get(c, r, w.get(c, [n, r], "")), f = w.findIndex(s.current, ["__PARENT_ID__", h]), y = w.findIndex(f > -1 ? w.get(s.current, [f, "children"]) : s.current, [r, g]); + if (y === -1) return (p = t.onReload) == null ? void 0 : p.call(t); + Promise.all([B.get(`/api/${e}/detail/${g}`), B.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([k, b]) => { + const x = w.get(s.current, f > -1 ? [f, "children", y, "children"] : [y, "children"]); + s.current = Ar(s.current, f > -1 ? { [f]: { children: { $splice: [[y, 1, { ...k, children: x }]] } } } : { $splice: [[y, 1, { ...k, children: x }]] }); + const S = new Map(b); + a.current.forEach(($, F) => { + var A; + (A = S.get(F)) != null && A.some((O) => O == g) || a.current.set(F, $.filter((O) => O !== g)); + }), S.forEach(($, F) => { + a.current.has(F) ? a.current.set(F, w.uniq([...a.current.get(F) || [], ...$])) : a.current.set(F, $); + }); + }).then(() => { + o.current = !0, i(); + }); + } + }]; +}, di = (t, e) => { + const r = Pt(), n = J(e), i = J(/* @__PURE__ */ new Map()), o = J([]), s = w.throttle((l) => { + o.current = [], B.list(t, w.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: c, condition: u, total: p, tab: h, sider: g, page: f, pageSize: y, operationsAccess: k, dataSource: b }) => { + n.current = { tab: h, condition: u, sider: g, keyword: c, total: p, pageSize: y, page: b != null && b.length ? f : 1 }, o.current = b, i.current = new Map(k), r(); + }); + }, 380, { leading: !1, trailing: !0 }); + vt(() => { + o.current = [], t && s(e); + }, [t, e]); + const a = W(() => w.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword", "primaryKey"]), [n.current]); + return Object.assign(a, { onTabChange: (l) => s({ tab: l, page: 1 }), onPageChange: (l, c) => s({ page: l, pageSize: c }), onPageSizeChange: (l) => s({ pageSize: l, page: 1 }), onConditionChange: (l, c) => s({ keyword: c, condition: Ar(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => s({ sider: l, page: 1 }), onKeywordChange: (l) => s({ keyword: l, page: 1 }), itemOperationsAccess: i.current, dataSource: o.current, onReload: s, payload: e == null ? void 0 : e.payload }); +}, ui = ({ listCode: t, className: e, layouts: r = {}, dataSource: n, isPaginate: i, isItemOperations: o, isBatchOperations: s, batchOperations: a, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, itemGridLayout: g, $setting: f, tabs: y, isConditionFormLayout: k, isTreeSider: b, treeSiderConfig: x, rowSelection: S }) => { + const { classNames: $, onClickCallback: F } = de(oe), A = w.pick(f, ["column", "colWidth", "beforeRender", "afterRender", "style", "itemMargin", "containerPadding"]), O = f == null ? void 0 : f.isMarkSelected, T = Ur(l, c, p, u), D = H((P, V, M) => m(pi, { isMarkSelected: O, className: j("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: o ? T(V) : [], data: u ? { [u]: V } : V, children: P, onClickCallback: F }), [O, u, p, o, F, l, c]); + return I("div", { className: j("ff-data-list-framework", e), children: [m(r.sider, { isTreeSider: b, ...x }), I("div", { className: j("ff-data-list-container", $ == null ? void 0 : $.container), children: [m(r.filter, { isConditionFormLayout: k }), m(r.toolbar, { title: h, tabs: y }), m(Pi, { ...g, ...A, rowSelection: S, empty: m(r.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: D, dataSource: n }), m(r.footer, { isPaginate: i, isOperations: s, operations: a })] })] }); +}, pi = ({ className: t, operations: e, children: r, data: n, onClickCallback: i, onSelect: o, isMarkSelected: s, isSelected: a, selectionType: l }) => I("div", { className: j("data-list-grid-layout-item", { "is-mark-selected": s, "is-selected": a, "is-selectable": !!l }, t), onClick: o, children: [m("div", { className: "data-list-grid-layout-item-container", children: r }), !!(e != null && e.length) && m("div", { className: "data-list-grid-layout-item-actions", children: e.map((c) => m("span", { className: "data-list-grid-layout-item-action", children: m(R.Link, { uuid: c.uuid, type: c.type, name: c.name, widget: c.widget, widgetType: c.widgetType, widgetProps: c.widgetProps, widgetSetting: c.widgetSetting, widgetContainerProps: c.widgetContainerSetting, data: n, confirm: c.confirm, onAfterClick: (u) => u !== !1 && (i == null ? void 0 : i(c.isRefresh, n)) }, c.uuid || Lt()) }, (c == null ? void 0 : c.uuid) || Lt())) })] }), gi = ({ listCode: t, className: e, layouts: r = {}, dataSource: n, columns: i, isItemOperations: o, isBatchOperations: s, batchOperations: a, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, tabs: g, isPaginate: f, rowSelection: y, isTreeSider: k, treeSiderConfig: b, isConditionFormLayout: x, ...S }) => { + const { classNames: $, onClickCallback: F } = de(oe), A = Ur(l, c, p, u), O = Wt(l, c, n, p, u); + return I("div", { className: j("ff-data-table-framework", e), children: [m(r.sider, { isTreeSider: k, ...b }), I("div", { className: j("ff-data-table-container", $ == null ? void 0 : $.container), children: [m(r.filter, { isConditionFormLayout: x }), m(r.toolbar, { title: h, tabs: g }), m(Ci, { ...S, primaryKey: p, className: "ff-data-table-content", columns: i, dataSource: n, rowSelection: y, operationRender: O ? (T) => { + var D; + return m("div", { className: "ff-data-table-actions", children: (D = A(T)) == null ? void 0 : D.map((P, V) => m(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: T, confirm: P.confirm, onAfterClick: (M) => M !== !1 && (F == null ? void 0 : F(P.isRefresh, T)) }, P.uuid || V)) }); + } : null }), m(r.footer, { isPaginate: f, isOperations: s, operations: a })] })] }); +}, er = (t = [], e, r = null) => { + var n; + return (n = w.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i, x: o, y: s, w: a, h: l, field: { boxStyle: c, ...u } = {} }, p) => m("div", { className: "grid-layout-item", style: Wr(o, s, a, l, c), children: m(e, { ...u, basicForm: r }) }, i ?? p)); +}, Wr = (t, e, r, n, i = {}, o = 0) => { + const s = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${r}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; + return i != null && i.autoHeight ? s.height = "fit-content" : s["--grid-layout-row"] = `${n}`, i != null && i.alignItems && (s["--grid-layout-box-align-items"] = i.alignItems), i != null && i.justifyContent && (s["--grid-layout-box-justify-content"] = i.justifyContent), s["--grid-layout-box-margin"] = Er(i == null ? void 0 : i.marginTop, i == null ? void 0 : i.marginRight, i == null ? void 0 : i.marginBottom, i == null ? void 0 : i.marginLeft), s["--grid-layout-box-padding"] = Er(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 && (s.height = `${o}px`), s; +}, Er = (t, e, r, n) => `${t || 0}px ${e || 0}px ${r || 0}px ${n || 0}px`, Oo = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, zr = (t) => Object.keys(t).reduce((e, r) => (/^on[A-Z]/.test(r) && (e[r] = t[r]), e), {}), qr = ({ className: t, isConditionFormLayout: e }) => { + var h, g; + const [r, n] = L({}), { listCode: i, onKeywordChange: o, onConditionChange: s, getBase62params: a, classNames: l } = E.useContext(oe), { keyword: c, condition: u } = (a == null ? void 0 : a()) || {}, [p] = ft.useForm(); + return z(() => { + i && e && B.get(`/api/_/${i}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: k, rowHeight: b, cols: x, fields: S }) => { + n({ resource: f, itemMargin: [y, k], rowHeight: b, cols: x, fields: S }); + }).catch(() => n({})); + }, [i, e]), z(() => { + p.setFieldsValue({ keyword: c, ...u }); + }, [JSON.stringify([c, u])]), m("div", { className: j("ff-data-list-filter", l.filter, t), children: m(ft, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((h = r.fields) == null ? void 0 : h.length) > 1 ? (f) => s({ [r.resource]: f[r.resource] }, f.keyword) : () => { + }, onValuesChange: (f) => { + w.isEmpty(w.omit(f, ["keyword"])) || p.submit(); + }, children: ((g = r.fields) == null ? void 0 : g.length) > 1 ? m(ir, { ...r, children: m(mi, { onReset: () => { + const { keyword: f, condition: y } = a("init") || {}; + p.setFieldsValue({ keyword: f, ...y }); + } }) }) : m("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: m("div", { className: "grid-layout-item", style: Wr(20, 0, 5, 2), children: m(ft.Item, { name: ["keyword"], children: m(Mn.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => o(f) }) }) }) }) }) }); +}, mi = ({ cols: t, fields: e, onReset: r }) => { + const [n, i] = L(!1), o = W(() => e == null ? void 0 : e.toReversed().some((s) => s.y > 1 || s.x + s.w >= t - 5), [t, e]); + return I(ft.Item, { label: " ", style: { "--item-span": 5 }, className: j("ff-data-list-filter-actions", { expanded: n }), children: [m(wt, { onClick: r, children: "重置" }), m(wt, { type: "primary", htmlType: "submit", children: "查询" }), o && m(R.Link, { className: "ff-data-list-filter-expanded-button", widget: () => i((s) => !s), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); +}; +qr.reservedFields = [{ x: 0, y: 0, h: 3, w: 5, field: { isVirtual: !0, widgetPrefix: "@pkg/ff/grid-layout-forms", widget: "Input", code: "keyword", label: "关键字", placeholder: "多关键字 | 分割", extras: { prefix: "icon-search" } } }]; +const hi = ({ className: t, operations: e, isOperations: r, isPaginate: n }) => { + const { onPageChange: i, onPageSizeChange: o, onClickCallback: s, getBase62params: a } = E.useContext(oe), { total: l, page: c, pageSize: u } = (a == null ? void 0 : a()) || {}; + return r && !w.isEmpty(e) || n ? I("div", { className: j("ff-data-list-footer", t), children: [m("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, h) => m(R, { 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, onAfterClick: (g) => g !== !1 && (s == null ? void 0 : s(p.isRefresh, null)) }, p.uuid || h)) }), n && m(Bn, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${c} 页 / 总共 ${p} 条`, onChange: i, onShowSizeChange: o })] }) : null; +}, fi = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: m("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], yi = ({ className: t, width: e = 280, isTreeSider: r }) => { + const { classNames: n } = de(oe); + return r ? m(Un.DirectoryTree, { className: j("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: fi }) : null; +}, wi = ({ className: t, title: e, tabs: r }) => { + const { getBase62params: n, onTabChange: i, onReload: o, classNames: s } = de(oe), { tab: a } = (n == null ? void 0 : n()) || {}, [l, c] = Jn((r == null ? void 0 : r[0].value) ?? (r == null ? void 0 : r[0].code), { value: a, onChange: i }); + return I("div", { className: j("ff-data-list-toolbar", s.toolbar, t), children: [m("div", { className: "ff-data-list-title", children: e }), m(Wn, { className: "ff-data-list-tabs", itemRender: ({ label: u, code: p, value: h }) => m("span", { onClick: () => c(h ?? p), className: j("ff-data-list-tab", { active: (h ?? p) == l }), children: u }), items: r }), I("div", { className: "ff-data-list-actions", children: [m(R.Link, { icon: "icon-reload", widget: () => o() }), m(R.Link, { icon: "icon-setting" })] })] }); +}, bi = ({ className: t, ...e }) => m(Mt, { className: j(t, "ff-data-list-empty"), image: Mt.PRESENTED_IMAGE_SIMPLE, ...e }), Kr = ({ isItemGridLayout: t, theme: e, themeProps: r, onClickCallback: n, onReload: i, listCode: o, total: s = 0, page: a = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: p, onTabChange: h, keyword: g, onKeywordChange: f, condition: y, onConditionChange: k, sider: b, onSiderChange: x, layouts: S, classNames: $ = {}, payload: F = {}, dataSource: A = [], rowSelection: O, getSelectedRows: T, primaryKey: D, ...P }) => { + const [V, M] = L(), U = T ?? (() => A), X = H((q, se) => { + const _ = { tab: p, page: a, pageSize: c, keyword: g, sider: b, condition: y, total: s, payload: F }; + return q && q != "init" ? w.get(_, q, se) : _; + }, [JSON.stringify(y), JSON.stringify(F), p, a, c, g, b, s]), Ee = W(() => { + let q = { sider: yi, filter: qr, footer: hi, toolbar: wi, empty: bi }; + S === !1 ? q = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : w.isPlainObject(S) && (q = Object.assign({}, q, S)); + for (const se in q) if (q[se]) { + if (On(q[se])) { + const _ = q[se]; + q[se] = (mt) => E.cloneElement(_, mt); + } + } else q[se] = () => m(E.Fragment, {}); + return q; + }, [S]); + return z(() => { + e ? Z.getWidgetComponent(e).then((q) => { + if (!q) throw `${e} not found`; + return q; + }).catch((q) => ({ default: () => `${q}` })).then((q) => M(E.createElement(q.default, { ...P, layouts: Ee, $setting: r }))) : M(m(t ? ui : gi, { ...P, layouts: Ee, $setting: r })); + }, [e, r]), m(oe.Provider, { value: { classNames: $, listCode: o, onClickCallback: n, onReload: i, getBase62params: X, onPageChange: l, onPageSizeChange: u, onTabChange: h, onSiderChange: x, onKeywordChange: f, onConditionChange: k, setPage: l, setPageSize: u, setTab: h, setSider: x, setKeyword: f, setCondition: k, getSelectedRows: U }, children: V && E.cloneElement(V, { dataSource: A, primaryKey: D, rowSelection: O, ...P }) }); +}; +Kr.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, Me, Et; +const me = class me { + constructor() { + v(this, $e, null); + v(this, Me, /* @__PURE__ */ new Map()); + v(this, Et, () => { + if (d(this, $e)) return d(this, $e).port.postMessage({ command: "status", data: [] }); + K(this, $e, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), d(this, $e).port.onmessage = (e) => { + var r, n; + (r = e.data) != null && r.uuid ? d(this, Me).forEach((i, o) => { + var s; + (i == "*" || (s = i == null ? void 0 : i.includes) != null && s.call(i, e.data.uuid)) && o(e.data); + }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && B.get("/api/user-api-token").then(({ token: i, expire_at: o }) => { + d(this, $e).port.postMessage({ command: "initWs", data: [`ws${w.trimStart(B.appUrl, "http")}api/user-resource-status-ws?token=${i}`] }); + }); + }, d(this, $e).port.postMessage({ command: "status", data: [] }); + }); + N(this, "subscribe", (e, r = []) => (r ? Array.isArray(r) && r.length == 0 ? r = "*" : Array.isArray(r) || (r = [r].flat()) : r = "*", d(this, Me).set(e, r), d(this, Me).size == 1 && d(this, Et).call(this), () => this.unsubscribe(e))); + N(this, "unsubscribe", (e) => d(this, Me).delete(e)); + if (d(me, Re)) return d(me, Re); + } +}; +Re = new WeakMap(), $e = new WeakMap(), Me = new WeakMap(), Et = new WeakMap(), v(me, Re, null), N(me, "getInstance", () => (d(me, Re) || K(me, Re, new me()), d(me, Re))); +let zt = me; +const _r = zt.getInstance(), tr = E.forwardRef(({ listCode: t, base62params: e, className: r, theme: n, themeProps: i, layouts: o, classNames: s, rowSelection: a = null, onDataSourceChange: l }, c) => { + const [{ resource: u, primaryKey: p, batchOperations: h = [], itemOperations: g = [], columns: f = [], isConditionFormLayout: y = !1, isTreeSider: k, treeSiderConfig: b, theme: x, themeConfig: S, isItemGridLayout: $, itemGridLayout: { themeConfig: F, ...A } = {}, title: O, isPaginate: T, tabs: D, selectionType: P }, V] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: M = P, selectedRowKeys: U, defaultSelectedRowKeys: X, onChange: Ee, ...q } = a ?? {}, se = di(t, e), [{ dataSource: _, itemOperationsAccess: mt, condition: ln, tab: cn, keyword: dn, page: ar, total: lr, pageSize: cr, sider: un, onConditionChange: pn, onTabChange: gn, onKeywordChange: mn, onPageChange: hn, onPageSizeChange: fn, onSiderChange: yn, onReload: Tt, payload: wn }, dr] = ci(se, t, p, u), bn = wr(l); + Gt(() => { + bn(_, { primaryKey: p, page: ar, pageSize: cr, total: lr }); + }, [_]); + const [ur, Cn] = Dn([], { defaultValue: X ?? [], value: U }), [pr, kn] = L([]), gr = H(() => M ? pr : _, [M, pr, _]), Sn = Wt(g, mt, _, p), En = Wt(h); + z(() => { + let Q = null; + return t && B.get(`/api/_/${t}`).resp(({ data: Ie, res: Ot }) => { + Ie != null && Ie.isDynamicRefresh && (Q = _r.subscribe(() => Tt(), Ot)), V(Ie); + }).catch(() => V({})), () => Q == null ? void 0 : Q(); + }, [t]), E.useImperativeHandle(c, () => ({ onReload: Tt, onClickCallback: dr, getSelectedRows: gr })); + const mr = wr((Q, Ie) => { + kn((Ot) => { + const hr = new Map(Ot.map((ae) => [ae == null ? void 0 : ae[p], ae])); + return Ie.forEach((ae) => hr.set(ae == null ? void 0 : ae[p], ae)), Q.map((ae) => hr.get(ae)).filter(Boolean); + }), Cn(Q), Ee == null || Ee(Q, Ie); + }), xn = W(() => M ? { columnWidth: 80, ...q, type: M, selectedRowKeys: ur, onChange: mr } : void 0, [M, ur, mr, a]), $n = W(() => w.merge({}, S, i), [S, i]), Pn = W(() => 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]), vn = W(() => ({ ...A, themeProps: F }), [A, F]); + return m(Kr, { listCode: t, title: O, classNames: s, layouts: o, resource: u, primaryKey: p, theme: n || x, themeProps: $n, isTreeSider: k, treeSiderConfig: b, isPaginate: T, rowSelection: xn, getSelectedRows: gr, tabs: D, isItemOperations: Sn, itemOperations: Pn, isBatchOperations: En, batchOperations: h, isItemGridLayout: $, columns: f, itemGridLayout: vn, isConditionFormLayout: y, itemOperationsAccess: mt, dataSource: _, onConditionChange: pn, onTabChange: gn, onKeywordChange: mn, onPageChange: hn, onPageSizeChange: fn, onSiderChange: yn, condition: ln, tab: cn, keyword: dn, page: ar, total: lr, pageSize: cr, sider: un, payload: wn, className: j("ff-data-list-helper", r), onReload: Tt, onClickCallback: dr }); +}), Jr = (t, e, r = !0) => r !== !0 && r-- <= 0 ? [] : w.isArray(t) && !w.isEmpty(t) ? t.reduce((n, i) => (Reflect.has(i, e) && Reflect.has(i, "children") && n.push(i[e]), Reflect.has(i, "children") && !w.isEmpty(i.children) ? n.concat(Jr(i.children, e, r)) : n), []) : [], Ci = ({ className: t, primaryKey: e, columns: r = [], dataSource: n = [], operationRender: i, operationWidth: o = 180, components: s = {}, rowSelection: a, ...l }) => { + const { classNames: c } = de(oe), u = J(null), p = J(null), [h, g] = L([]), [f, y] = L({ width: 0, height: 0 }); + z(() => { + g(Jr(n, e)); + }, [n, e]), Rn(() => { + 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 && S.observe(p.current), () => { + p.current && S.unobserve(p.current); + }; + }, []); + const k = W(() => { + if (!(f != null && f.width) || !(r != null && r.length)) return r; + const S = (a ? a.columnWidth ?? 32 : 0) + (i ? o : 0), $ = r.reduce((O, T) => O + (T != null && T.isWidthFixed && T.width ? T.width : 0), 0), F = r.filter((O) => !(O != null && O.isWidthFixed)).reduce((O, T) => O + ((T == null ? void 0 : T.width) ?? 100), 0); + if ($ + F + S >= f.width) return r; + const A = f.width - $ - S; + return r.map((O) => O != null && O.isWidthFixed ? O : { ...O, width: Math.floor(A * ((O == null ? void 0 : O.width) ?? 100) / F) }); + }, [r, f.width, a, i, o]), b = ai(k), x = li(s); + return m("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: f.height ? m(br, { bordered: !0, ...l, components: x, ref: u, rowKey: (S) => (S == null ? void 0 : S[e]) ?? Math.random(), rowSelection: a, columns: (() => { + var $, F; + const S = [...b ?? []]; + return a && S.splice((F = ($ = S[0]) == null ? void 0 : $.key) != null && F.startsWith("__") ? 1 : 0, 0, br.SELECTION_COLUMN), i && S.push({ title: "操作", align: "center", fixed: "right", className: "ff-data-list-table-operations", width: `${Math.ceil(o / f.width * 100).toFixed(2)}%`, render: (A, O, T) => i(O, T) }), S; + })(), dataSource: n, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: h } }) : null }); +}, ki = "RC_FORM_INTERNAL_HOOKS", Si = (t) => { + const [e, r] = E.useState({ items: [] }); + return z(() => { + t && B.get(`/api/_/${t}`).then(({ uuid: n, code: i, name: o, resource: s, primaryKey: a, marginX: l, marginY: c, cols: u, rowHeight: p, fields: h, theme: g, themeSetting: f, groups: y }) => ({ uuid: n, code: i, name: o, resource: s, primaryKey: a, marginX: l, marginY: c, cols: u, rowHeight: p, theme: g, themeProps: f, groups: y, items: h })).then(r); + }, [t]), e; +}, Ei = (t, { initialValue: e, initialValueLanguage: r, convertJs: n, convertJsSetting: i, type: o = "string" }, s = null) => { + const a = J(!1), l = de(jr), [c, u] = L(), [p, h] = L(r != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(ki) || {}; + return z(() => g == null ? void 0 : g((f, y, k) => { + if (!a.current) return; + const b = w.get(y, t); + w.isEqual(b, p) || h(ce(b, o)); + }), [p]), z(() => { + r == "javascript" && e ? We.exec(e, {}, { getFieldValueForBasicForm: (f) => s ? s.getFieldValue(f) : l.getFieldValue(f), getFieldValue: (f) => l.getFieldValue(f) }).then((f) => h(ce(f, o))).catch((f) => notification.error({ message: `布局数据错误: ${JSON.stringify(f)}` })).finally(() => a.current = !0) : (e && h(ce(e ?? l.getFieldValue(t), o)), a.current = !0); + }, [e, r]), pt(() => { + a.current && n && new bt([n, i]).toValue(p, l.getFieldsValue(!0)).then(u).catch((f) => { + u(f), console.error("布局数据转换错误: ", f, n); + }); + }, [p, n, i]), [c ?? p, p]; +}, Ro = (t, e, r = null) => W(() => er(t, e, r), [t]), Hr = (t, e, r = {}, n = {}, i = {}, o = null) => { + const s = de(jr), a = Pt(), l = J(!0), c = J([]), [u, p] = L(e), [h, g] = L(), f = ie.useWatch((y) => JSON.stringify(w.pick(y, c.current)), s) || "{}"; + return vt(() => { + t && We.exec(t, r, { ...n, getFieldValueForBasicForm: (y) => i ? i.getFieldValue(y) : null, getFieldValue: w.wrap(s.getFieldValue, (y, k) => (c.current.some((b) => w.isEqual(b, k)) || (c.current.push(k), a()), y == null ? void 0 : y(k))), isFieldTouched: s.isFieldTouched, isFieldsTouched: s.isFieldsTouched }).then((y) => { + l.current && (p(y), g(null)); + }).catch((y) => { + l.current && (p(e), g(y)); + }); + }, [t, f, s, r, n]), z(() => () => l.current = !1, []), t ? [o ? ce(u, o) : u, h] : [o ? ce(e, o) : e, null]; +}, xi = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: r, ...n }) => { + const i = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [o, s] = L(); + return z(() => { + i && Z.getWidgetComponent(i).then(({ defaultProps: a = {}, default: l }) => ({ default: $i(l, a, r) })).catch((a) => ({ default: () => `${a}` })).then((a) => s(E.createElement(a.default, n))); + }, [i]), o; +}, $i = (t, e = {}, r = null) => (n) => { + const { code: i, label: o, extras: s, isVirtual: a, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: h, ...g } = w.merge({}, e, n), [f, y] = Ei(a ? null : i, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, r), k = W(() => { + 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, x] = k(g); + return m(t, { ...x, value: f, rawValue: y, $setting: Object.assign({}, s, b) }); +}, Yr = ({ theme: t, basicForm: e, items: r = [{ key: "default", label: "默认" }], fields: n = [], itemRender: i, chunks: o = [], children: s, $setting: a = {}, ...l }) => { + const [c, u] = L(); + z(() => { + t ? Z.getWidgetComponent(t).then((h) => { + if (!(h != null && h.default)) throw "not found"; + return h; + }).catch((h) => ({ default: () => `${t} ${h}` })).then((h) => u(E.createElement(h.default, {}))) : u(null); + }, [t]); + const p = W(() => r == null ? void 0 : r.map((h) => ({ ...h, children: i(h, n == null ? void 0 : n.filter((g) => !(g != null && g.group) && h.key == "default" || g.group == h.key), h.key == "default" ? s : null) })).concat(o), [r, s, o]); + return c && E.cloneElement(c, { items: p, basicForm: e, $setting: { ...a, ...l } }); +}, Gr = ({ name: t, form: e = null, basicForm: r = null, style: n = {}, className: i, cols: o = 12, rowHeight: s = 21, containerPadding: a = [0, 0], itemMargin: l = [4, 0], formProps: c = {}, formFields: u = [], fields: p = [], data: h, theme: g, themeProps: f = {}, groups: y = [{ key: "default", label: "默认" }], children: k, ...b }) => { + const [x] = ie.useForm(e), S = W(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]); + pt(() => (x.setFieldsValue(h), () => x.resetFields()), [h]); + const $ = (F, A, O) => { + const T = er(A, xi, r), D = zr(b); + return I("div", { ...D, className: j("ff-grid-layout", i), style: { ...n, "--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": `${(a == null ? void 0 : a[0]) || 0}px`, "--grid-layout-container-padding-x": `${(a == null ? void 0 : a[1]) || 0}px`, "--grid-layout-cols": o, "--grid-layout-row-height": `${s}px` }, children: [T, O && E.cloneElement(O, { cols: o, rowHeight: s, itemMargin: l, containerPadding: a, fields: A, basicForm: r })] }); + }; + return m(ie, { ...b, fields: S, form: x, component: !1, children: g ? m(Yr, { ...f, items: y, theme: g, itemRender: $, fields: p, children: k, basicForm: r }) : $(0, p, k) }); +}, Fo = /* @__PURE__ */ ((t) => function({ code: e, data: r, ...n }) { + const { uuid: i, resource: o, items: s, hides: a, rowHeight: l, marginX: c, marginY: u, cols: p, theme: h, themeProps: g, groups: f } = Si(e) || {}, y = W(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: i }], [e, i, o]); + return o && m(t, { name: e, theme: h, themeProps: g, groups: f, ...n, fields: s, formFields: y, rowHeight: l, cols: p, itemMargin: [c, u], data: o ? { [o]: r } : r }); +})(Gr), Pi = ({ column: t = 0, colWidth: e = 0, cols: r, rowHeight: n, itemMargin: i, containerPadding: o, fields: s, primaryKey: a, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: h = ($, F, A) => $, empty: g = m(Mt, { description: null }), className: f, style: y = {}, theme: k, themeProps: b = {}, groups: x = [{ key: "default", label: "默认" }], rowSelection: S }) => { + const { classNames: $ } = de(oe), F = H((T) => { + if (!S) return; + const { selectedRowKeys: D = [], onChange: P, type: V = "checkbox" } = S, M = T == null ? void 0 : T[a]; + let U; + U = V === "radio" ? [M] : D.includes(M) ? D.filter((X) => X !== M) : [...D, M], P == null || P(U, l.filter((X) => U.includes(X == null ? void 0 : X[a]))); + }, [S, a, l]), A = W(() => m(Gr, { groups: x, theme: k, themeProps: b, cols: r, rowHeight: n, itemMargin: i, containerPadding: o, fields: s, className: p }), [s, r, n, i, o, x, k, b]), O = w.isEmpty(l); + return I("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), O ? g : l.map((T, D) => { + var U; + const P = (T == null ? void 0 : T[a]) ?? D, V = `${P}-${Ri(T)}`, M = h(E.cloneElement(A, { data: T }), T, D); + return E.cloneElement(M, { key: V, ...S && { isSelected: (U = S == null ? void 0 : S.selectedRowKeys) == null ? void 0 : U.includes(P), selectionType: S.type ?? "checkbox", onSelect: () => F(T) } }); + }), u == null ? void 0 : u(l)] }); +}, vi = ({ component: t, $props: e }) => { + const { base62params: r } = $t(e, {}); + return m(re, { children: m(tr, { listCode: t, base62params: B.decode(r) }) }); +}, jo = () => m(Xr, {}), Xr = () => "Empty", Ni = ({ component: t, $setting: e, $props: r }) => { + const [n, i] = L(), [o, s] = rr(r); + return z(() => { + if (!t) return i(m(Xr, { description: null })); + Z.getWidgetComponent(t).catch((a) => ({ default: () => `${a}` })).then((a) => E.createElement(a.default, { $setting: e })).then(i); + }, [t]), n ? E.cloneElement(n, { ...o, $setProps: s }) : null; +}, Ao = () => "NotFoundPage"; +var Fe, le, je, ye, nt, it; +const he = class he { + constructor() { + v(this, le, /* @__PURE__ */ new Map()); + v(this, je, {}); + v(this, ye, null); + N(this, "init", (e, r) => { + K(this, le, e), K(this, je, r); + }); + N(this, "get", (e) => (d(this, le).has(e) || (e = Array.from(d(this, le).keys()).find((r) => d(this, le).get(r).uri === e)), d(this, le).get(e) || {})); + N(this, "redirect", (e, r, n = {}) => { + var f; + const { uri: i, type: o, widgetProps: s } = this.get(e) || {}, { router: a, query: l, ...c } = r || {}, u = Object.assign({}, c, a), p = Object.assign({}, c, l); + o == "list" && (u.base62params = B.encode(u != null && u.base62params ? u.base62params : u)); + let h = Hn(i || e, u); + const g = new URLSearchParams(); + for (const y in s || {}) ((f = s[y]) == null ? void 0 : f.type) == "query" && Object.has(p, y) && g.append(y, JSON.stringify(p[y])); + return g.size > 0 && (h = `${h}?${g.toString()}`), n != null && n.isOpenWindow ? window.open(h) : d(this, ye).navigate(h, { replace: !!(n != null && n.isReplaceRouteHistory) }); + }); + N(this, "getMenus", (e) => { + var r; + return ((r = d(this, je)) == null ? void 0 : r[e]) || []; + }); + N(this, "findMenuPathByUuid", (e) => { + let r = []; + for (const n in d(this, je)) if (r = d(this, nt).call(this, d(this, je)[n], e, [n]), r.length > 1) return r; + return r; + }); + N(this, "getMenusByRouteUuid", (e) => d(this, it).call(this, e, Object.values(d(this, je)).flat())); + v(this, nt, (e, r, n = []) => { + if (w.isEmpty(e)) return n; + for (const { uuid: i, children: o } of e) { + if (i == r) return n.concat(i); + if (!w.isEmpty(o)) return n.concat(i, d(this, nt).call(this, o, r)); + } + return n; + }); + v(this, it, (e, r) => { + var i; + let n = []; + for (const o of r) o.widgetType == "redirect" && (o.uuid == e || o.widget == e ? n.push(o) : (i = o.children) != null && i.length && (n = n.concat(d(this, it).call(this, e, o.children)))); + return n; + }); + N(this, "getCurrentMenu", () => { + const { uuid: e } = this.getCurrentRoute() || {}; + if (!e) return; + const r = this.getMenusByRouteUuid(e); + return w.isEmpty(r) ? void 0 : r[0]; + }); + N(this, "getCurrentRoute", (e = 0) => { + var n; + const r = (n = d(this, ye).state.matches[d(this, ye).state.matches.length - 1 - e]) == null ? void 0 : n.route; + if (!r) return null; + for (let [i, o] of d(this, le)) if (o.uri === r.path) return o; + return null; + }); + N(this, "getPageParams", (e) => { + var s, a; + const { location: r = {}, matches: n = [] } = ((s = d(this, ye)) == null ? void 0 : s.state) || {}, i = { ...((a = n[n.length - 1]) == null ? void 0 : a.params) || {} }, o = r.search; + return o && new URLSearchParams(o).forEach((l, c) => { + i[c] = l; + }), e ? w.get(i, e) : i; + }); + N(this, "usePageParams", (e) => { + var n; + let r = Ir() ? { ...Yn(), ...Object.fromEntries(new URLSearchParams(((n = Gn()) == null ? void 0 : n.search) ?? "")) } : this.getPageParams(); + return e ? w.get(r, e) : r; + }); + N(this, "createBrowserRouter", (e = {}) => { + if (d(this, le).size == 0) return null; + if (d(this, ye)) return d(this, ye); + const r = Ue.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Ue.get(Z.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), i = { [r]: 0 }, o = (a, l) => () => Promise.all([Z.getWidgetComponent(a), $t(l)]).then(([c, u]) => [c.default || function() { + return `${a}`; + }, u]).then(([c, u]) => ({ Component: () => E.createElement(Lr, {}, E.createElement(c, { $setting: u })) })), s = Array.from(d(this, le).values()).reduce((a, { uuid: l, uri: c, name: u, type: p, component: h, widgetSetting: g, widgetProps: f, isLogin: y, isLayout: k, extra: b }) => { + let x = {}, S = 0; + switch (p) { + case "list": + x.element = E.createElement(vi, { component: h, $props: f }); + break; + case "fsdpf-component": + x.element = E.createElement(Ni, { key: c, component: h, $setting: g, $props: f }); + } + const $ = (b == null ? void 0 : b.theme) ?? (b == null ? void 0 : b.layout); + if ($) { + const F = (b == null ? void 0 : b.themeProps) ?? (b == null ? void 0 : b.layoutProps); + if (!i[$]) return i[$] = a.length, [...a, { path: "/", lazy: o($, F), children: [{ path: c, ...x }] }]; + S = i[$]; + } + return k && S > -1 ? (a[S].children.push({ path: c, ...x }), a) : [...a, { path: c, ...x }]; + }, [{ path: "/", lazy: o(r, {}), children: [] }]); + return s.push({ index: !0, element: E.createElement(Ti, { to: n, replace: !0 }) }), K(this, ye, Xn(s, e)); + }); + if (d(he, Fe)) return d(he, Fe); + } +}; +Fe = new WeakMap(), le = new WeakMap(), je = new WeakMap(), ye = new WeakMap(), nt = new WeakMap(), it = new WeakMap(), v(he, Fe, null), N(he, "getInstance", () => (d(he, Fe) || K(he, Fe, new he()), d(he, Fe))); +let qt = he; +const Ti = ({ to: t, replace: e }) => Ir() ? E.createElement(Zn, { to: t, replace: e }) : (window.document.location = t, "redirect"), ke = qt.getInstance(); +Zt.chainableTypes = [In]; +const We = Zt.getInstance(new URL("/ff-worker-pipe/worker.js", self.location), { type: "module" }); +Zt.fns = { http: Object.fromEntries(["get", "post", "put", "del", "list", "decode", "encode", "cache", "refreshCache"].map((t) => [t, (...e) => B[t](...e)])), generateUUID: () => Ai(), user: { logout: () => Z.logout(() => window.location.replace(Ue.get("Common.WEBSITE_LOGIN_PAGE", "/index"))), getUserInfo: (t = !0) => Z.getUserInfo(t), checkUserToken: () => Z.checkUserToken(), getUserToken: () => Z.getUserToken() }, getConfigure: (t) => Ue.get(t), route: Object.fromEntries(["redirect", "getPageParams", "getCurrentRoute", "get", "getMenus", "findMenuPathByUuid"].map((t) => [t, (...e) => ke[t](...e)])), popup: Object.fromEntries(["notification", "success", "error", "form", "modal", "confirm"].map((t) => [t, (...e) => Se[t](...e)])) }; +const xr = { 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) => { + switch (`${t}`.toLowerCase()) { + case "0": + case "false": + case "[]": + case "{}": + return !1; + } + return !!t; +}, string2string: (t) => t, json2json: (t) => t, json2array: (t) => t ? Object.values(t) : [], json2number: (t) => Object.keys(t).length, json2integer: (t) => Object.keys(t).length, json2float: (t) => Object.keys(t).length, json2bool: (t) => Object.keys(t).length > 0, json2string: (t) => t ? JSON.stringify(t) : "", array2json: (t) => ({ ...t }), array2array: (t) => t, array2number: (t) => t.length, array2integer: (t) => t.length, array2float: (t) => t.length, array2bool: (t) => t.length > 0, array2string: (t) => JSON.stringify(t), number2json: (t) => ({}), number2array: (t) => [t], number2number: (t) => t, number2integer: (t) => t, number2float: (t) => t, number2bool: (t) => !!t, number2string: (t) => t.toString(), boolean2json: (t) => ({}), boolean2array: (t) => [], boolean2number: (t) => +t, boolean2integer: (t) => +t, boolean2float: (t) => +t, boolean2bool: (t) => t, boolean2string: (t) => t ? "true" : "false" }, ce = (t, e) => { + let r = "string"; + r = Array.isArray(t) ? "array" : typeof t, w.isObject(t) && (r = "json"); + const n = `${r}2${e}`; + return Reflect.has(xr, n) ? xr[n](t) : t; +}, Oi = (t) => t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "json" : typeof t == "boolean" ? "bool" : typeof t == "string" ? "string" : typeof t == "number" ? Number.isInteger(t) ? "integer" : "float" : typeof t, $t = (t = {}, e = {}, r = {}, n = "") => Zr(t, (i, o) => o === "type" && i === "code") ? Qr(t, e, r, n) : en(t, e, n), Zr = (t, e = () => !1) => w.some(t, (r) => !!w.some(r, e) || (w.isEmpty(r) || !w.isPlainObject(r) && !w.isArray(r) ? void 0 : Zr(r, e))), Qr = async (t = {}, e = {}, r = {}, n = "") => { + let i = /* @__PURE__ */ Object.create(null); + for (let o in t) { + let s; + if (Reflect.has(t[o], "type") && ["code", "field", "router", "query", "string"].includes(t[o].type)) { + const { type: a, value: l = "", default: c = n } = t[o]; + switch (a) { + case "code": + try { + s = await We.exec(l, e, r); + } catch (u) { + console.error("getWidgetPropsData", u); + } + break; + case "field": + s = w.get(e, l) ?? w.get(e, l.substring(l.indexOf(".") + 1)); + break; + case "router": + case "query": + s = ke.getPageParams(l); + break; + case "string": + s = l; + } + s ?? (s = c); + } else s = await Qr(t[o], e, r, n); + w.set(i, o, s); + } + return i; +}, en = (t = {}, e = {}, r = "") => Object.keys(t || {}).reduce((n, i) => { + if (w.isPlainObject(t[i])) { + let o; + if (Reflect.has(t[i], "type") && ["field", "router", "query", "string"].includes(t[i].type)) { + const { type: s, value: a = "", default: l = r } = t[i]; + switch (s) { + case "field": + o = w.get(e, a) ?? w.get(e, a.substring(a.indexOf(".") + 1)); + break; + case "router": + case "query": + o = ke.getPageParams(a); + break; + case "string": + o = a; + } + o ?? (o = l); + } else o = en(t[i], e, r); + w.set(n, i, o); + } + return n; +}, {}), Ft = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((r) => Ft(r, e)) : Object.keys(t).reduce((r, n) => (e[n] ? r[e[n]] = Ft(t[n], e) : r[n] = Ft(t[n], e), r), {}) : t, Io = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { + const e = 16 * Math.random() | 0; + return (t === "x" ? e : 3 & e | 8).toString(16); +}), Lo = (t) => { + var e, r; + return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.name : ""; +}, Vo = (t) => { + var e, r; + return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.category : ""; +}, Do = (t) => { + var e, r; + return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.owner : ""; +}, Ri = (t, e = 32, r = "auto") => { + const n = Kt(t), i = r === "auto" ? "x64" : r; + if (e === 32) return Rt.x86.hash32(n).toString(); + if (e === 128) return i === "x64" ? Rt.x64.hash128(n) : Rt.x86.hash128(n); + throw new Error("bits 只能是 32 或 128"); +}, Kt = (t) => t == null ? "null" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "function" ? t.toString() : Array.isArray(t) ? "[" + t.map(Kt).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${Kt(t[e])}`).join(",") + "}" : String(t), Fi = () => { + let t = 1; + const e = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map(); + return (...n) => n.length === 0 ? "" : n.map((i) => { + return String((o = i) === null || typeof o != "object" && typeof o != "function" ? (r.has(o) || r.set(o, t++), r.get(o)) : (e.has(o) || e.set(o, t++), e.get(o))); + var o; + }).join("::"); +}, ji = (t) => { + if (!t || typeof t != "string" || t.startsWith("/") || t.startsWith("./") || t.startsWith("../")) return !1; + try { + let e = t.startsWith("//") ? `http:${t}` : t; + return e.includes("://") || e.startsWith("//") || (e = `http://${e}`), !!new URL(e).hostname; + } catch { + return !1; + } +}, Mo = (t, e = "") => { + if (!t || typeof t != "string" || ji(t)) return t; + let r = e; + return !r && typeof window < "u" && window.location && (r = `${window.location.protocol}//${window.location.host}`), t.startsWith("/") ? r ? `${r}${t}` : t : r ? `${r}/${t}` : t; +}, Ai = () => 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); +}), Pt = () => { + const t = J(!0), [, e] = E.useReducer((r) => r + 1, 0); + return z(() => () => t.current = !1, []), () => t.current && e(); +}, Bo = (t) => { + const [e, r] = L(t), n = J(null), i = H((o, s) => { + n.current = s, r(o); + }, []); + return z(() => { + n.current && (n.current(e), n.current = null); + }, [e]), [e, i]; +}, pt = (t = (n) => { +}, e, r = w.isEqual) => { + const n = E.useRef(); + r(e, n.current) || (n.current = w.cloneDeep(e)), E.useEffect(t, [n.current]); +}, vt = pt, tn = (t, e = "string") => { + var r; + if (!Array.isArray(t)) return t; + for (let n = 0; n < t.length; n++) t[n].value = ce((r = t[n]) == null ? void 0 : r.value, e), t[n] && Reflect.has(t[n], "children") && (t[n].children = tn(t[n].children, e)); + return t; +}, Uo = (t, e = "json", r = "string", n = null, i = null) => { + const [o] = ie.useForm(n), [s, a] = L([{ label: "无", value: "", disabled: !0 }]), l = J([]), c = ie.useWatch((u) => l.current.length === 0 ? null : w.pick(u, l.current), o) || null; + return z(() => { + Array.isArray(t) ? a(t) : e === "javascript" && t ? We.exec(t, {}, { getFieldValue: (u) => (l.current.includes(u) || l.current.push(u), o.getFieldValue(u)), getFieldValueForBasicForm: (u) => (l.current.includes(u) || l.current.push(u), i ? i.getFieldValue(u) : o.getFieldValue(u)) }).then((u) => { + a(ce(u, "array")); + }).catch((u) => console.error("useOptions", u)) : t && a(ce(t, "array")); + }, [t, e, c]), tn(s, r); +}, Wo = (t) => { + const [e, r] = L(), n = { type: "GET" }; + if (typeof t == "string" ? n.url = t : w.isPlainObject(t) && Object.assign(n, t), !(n != null && n.url)) throw "url is required"; + const i = (o) => B.request(n, !1).resp((s) => (console.log("useSubscribeRequest", o), r(s), s)); + return pt(() => { + let o = null; + return i().then((s) => { + o = _r.subscribe(w.throttle(i, 180, { leading: !1, trailing: !0 }), s.res); + }), () => o == null ? void 0 : o(); + }, n), e; +}, Ii = (t, e) => H((r) => { + const n = {}; + for (const [i, o] of Object.entries(r)) { + const s = t == null ? void 0 : t[i]; + if ((s == null ? void 0 : s.type) === "router" || (s == null ? void 0 : s.type) === "query") { + const a = ke.getCurrentRoute(); + a != null && a.uuid && ke.redirect(a.uuid, { ...ke.getPageParams(), [s.type]: { [s.value || i]: o } }, { isReplaceRouteHistory: !0 }); + } else n[i] = o; + } + Object.keys(n).length > 0 && e(n); +}, [t, e]), rr = (t, e = {}, r = {}, n = []) => { + const [i, o] = L({}), [s, a] = L({}), l = Fr(s), c = ke.usePageParams(); + Yt(() => { + Promise.resolve($t(t, e, r)).then(a); + }, [t, e, c, ...n]), Gt(() => { + const h = l ?? {}, g = Object.keys({ ...h, ...s }).reduce((f, y) => (h[y] !== s[y] && (f[y] = s[y]), f), {}); + Object.keys(g).length > 0 && o((f) => ({ ...f, ...g })); + }, [s]); + const u = Ii(t, (h) => { + o((g) => ({ ...g, ...h })); + }), p = W(() => Object.fromEntries(Object.entries(i).filter(([h, g]) => g !== s[h])), [i, s]); + return [i, u, p]; +}, Li = (t) => { + const [e, r] = E.useState({ items: [], hides: [] }); + return E.useEffect(() => { + t && B.get(`/api/_/${t}`).then(({ pk: n, uuid: i, code: o, resource: s, align: a, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: h, listenChangeFieldsFunc: g, fields: f, theme: y, themeSetting: k, groups: b }) => ({ pk: n, uuid: i, code: o, resource: s, align: a, cols: l, rowHeight: c, marginX: u, marginY: p, theme: y, themeProps: k, groups: b, listenChangeFields: h, listenChangeFieldsFunc: g, ...f.reduce((x, S) => { + var $; + return ($ = S == null ? void 0 : S.field) != null && $.hidden ? x.hides.push(S == null ? void 0 : S.field) : x.items.push(S), x; + }, { items: [], hides: [] }) })).then(r); + }, [t]), e; +}, Vi = ({ max: t = 0, min: e = 0, type: r = "", message: n, pattern: i, required: o = !1, validator: s } = {}, a, l) => { + const [c, u] = L([]); + return z(() => { + const p = []; + if (o) { + let h = l; + switch (l) { + case "number": + case "string": + case "array": + break; + case "bool": + h = "boolean"; + break; + case "json": + h = "object"; + } + p.push({ type: h, required: !0, whitespace: !0, message: "该项必填" }); + } + switch (r) { + case "string": + p.push({ type: r, max: t, min: e, message: n || (e && t ? `字符必须在 ${e} ~ ${t} 之间` : `${t ? "最多能有" : "最少要有"} ${e || t} 个字符`) }); + break; + case "pattern": + p.push({ type: "string", pattern: i, message: n }); + break; + case "validator": + s && p.push(({ getFieldValue: h }) => ({ validator: async (g, f) => { + const y = await We.exec(s, { value: f, fieldName: a }, { getFieldValue: h }); + return w.isString(y) && y ? Promise.reject(y) : w.isBoolean(y) && !y ? Promise.reject(n) : Promise.resolve(); + } })); + } + u(p); + }, [t, e, r, n, i, o, s]), c; +}, Di = (t, e, r) => { + const [n, i] = L(null); + return z(() => { + const { initDataUri: o = `/api/${t}`, initDataMethod: s = "GET" } = r || {}; + e && B.request({ method: s, url: w.trimEnd(`${o}/${e}`, "/") }).then((a) => { + i(a); + }); + }, [t, e, r]), n; +}, Mi = (t, e, r) => H((n, i = { serialize: (o) => o, onSuccess: () => { +}, onFail: (o) => (o == null ? void 0 : o.errorFields) && Se.error("请先完善表单信息", { duration: 2e3 }) }) => { + const o = n.getFieldValue("__RESOURCE__"), { submitDataUri: s = `/api/${t}`, submitDataMethod: a = "POST" } = r || {}; + return n.validateFields().then((l) => o ? w.pick(l, [o]) : l).then(i.serialize).then((l) => B.request({ method: a, url: w.trimEnd(`${s}/${e || ""}`, "/"), data: l }).msg(i.onSuccess)).catch(i.onFail); +}, [t, e, r]), Bi = (t, e, r, n) => { + const i = Di(e, r, n); + z(() => { + i ? t.setFieldsValue(i) : t.resetFields(); + }, [t, i]); + const o = Mi(e, r, n); + return w.partial(o, t); +}, Ui = (t, e, r = [], n = {}) => { + const i = J({}), o = J(), s = w.debounce(Pt(), 180), a = ["disabled", "required"], l = (h, g) => { + a.includes(h) && (i.current[h] = g), s(); + }, c = W(() => ({ setDisabled: (h) => l("disabled", h), setRequired: (h) => l("required", h), getDisabled: () => i.current.disabled, getRequired: () => i.current.required }), [e]), [u, p] = Hr(e, -1, {}, c, n); + if (!p && o.current != u && (u >= 0 || !w.isEmpty(r == null ? void 0 : r[u]))) { + o.current = u; + const { widget: h, widgetPrefix: g, props: f } = r == null ? void 0 : r[u]; + t = Mr(h, g), i.current = w.merge(f, w.pick(i.current, a)); + } + return [t, i.current]; +}, $r = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), zo = ({ value: t, onChange: e }, r = null) => { + const n = J(), [i] = ie.useForm(r), o = J({}); + return vt(() => { + w.isEqual(n.current, t) || i.setFieldsValue(t); + }, [t]), z(() => () => i.resetFields(), []), [W(() => i.__INTERNAL__ ? i : { ...i, __INTERNAL__: { itemRef: (s) => (a) => { + const l = $r(s); + a ? o.current[l] = a : delete o.current[l]; + } }, scrollToField: (s, a = {}) => { + console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); + }, focusField: (s) => { + console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); + }, getFieldInstance: (s) => { + const a = $r(s); + return o.current[a]; + } }, [i]), (s, a) => { + n.current = a, e == null || e(a); + }]; +}, nr = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: r, subWidgets: n = [], basicForm: i, ...o }) => { + const s = Mr(t, e), [a, l] = Ui(s, r, n, i), [c, u] = L(); + return z(() => { + a && Z.getWidgetComponent(a).then(({ defaultProps: p = {}, default: h }) => ({ default: Wi(h, p, i) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(E.createElement(p.default, o))); + }, [a]), c && E.cloneElement(c, { ...o, ...l }); +}, Wi = (t, e = {}, r = null) => (n) => { + const { type: i, code: o, label: s, noStyle: a, style: l, placeholder: c, required: u = !1, extras: p, validators: h, help: g, isVirtual: f, $isReserved: y, initialValue: k, initialValueLanguage: b, ...x } = w.omit(w.merge({}, e, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), S = Vi(Object.assign({}, h, u ? { required: !0 } : {}), o, i), $ = W(() => { + const D = Object.keys((e == null ? void 0 : e.extras) || {}); + return w.over([w.partialRight(w.pick, D), w.partialRight(w.omit, D)]); + }, [e == null ? void 0 : e.extras]), [F, A] = $(x), O = { label: s, noStyle: a, style: l, colon: !1, layout: "vertical" }, T = H((D) => D == null ? void 0 : ce(D, i), [i]); + return m(Xt, { name: o, rules: S, initialValue: T(k), normalize: T, children: (D, P, V) => { + var M; + return m(t, { type: i, rcform: V, basicForm: r, itemProps: { validateStatus: P.errors.length > 0 ? "error" : "success", tooltip: g || null, help: P.errors.length > 0 ? P.errors.join("、") : null, required: ((M = S == null ? void 0 : S[0]) == null ? void 0 : M.required) || !1, ...O }, fieldProps: { placeholder: c, ...A, ...D }, $setting: Object.assign({}, p, F) }); + } }); +}, ir = ({ name: t, form: e = null, basicForm: r = null, style: n = {}, className: i, cols: o = 24, rowHeight: s = 16, itemMargin: a = [8, 16], containerPadding: l = [0, 0], fields: c = [], hides: u = [], primaryKey: p = 0, formProps: h = {}, formFields: g = [], listenChangeFields: f, listenChangeFieldsFunc: y, onValuesChange: k, theme: b, themeProps: x = {}, groups: S = [{ key: "default", label: "默认" }], children: $, ...F }) => { + const [A] = ie.useForm(e), O = H((P, V) => { + k == null || k(P, V), y && Array.isArray(f) && We.exec(y, { changedValues: P, allValues: V }, { getFieldValue: A.getFieldValue, setFieldValue: A.setFieldValue, setFieldsValue: A.setFieldsValue, isFieldTouched: A.isFieldTouched, isFieldsTouched: A.isFieldsTouched }).catch((M) => console.error("onFormValuesChange", t, M)); + }, [t, A, k, f, y]), T = W(() => [{ name: "__PROPS__", value: h }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, h, g]), D = (P, V, M) => { + const U = er(V, nr, r), X = zr(F); + return I("div", { ...X, className: j("ff-grid-layout-form", i), style: { ...n, "--grid-layout-item-margin-x": `${(a == null ? void 0 : a[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(a == null ? void 0 : a[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(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": `${s}px` }, children: [U, M && E.cloneElement(M, { cols: o, rowHeight: s, itemMargin: a, containerPadding: l, fields: V, basicForm: r })] }); + }; + return I(ie, { ...F, form: A, fields: T, onValuesChange: O, children: [b ? m(Yr, { ...x, items: S, theme: b, itemRender: D, fields: c, children: $, basicForm: r }) : D(0, c, $), u == null ? void 0 : u.map((P) => { + var V; + return m(Xt, { name: P.code, children: m(zi, { form: A, basicForm: r, name: P.code, type: P.type, initialValue: P.initialValue, initialValueLanguage: (V = P.extras) == null ? void 0 : V.initialValueLanguage }) }, JSON.stringify(P.code)); + })] }); +}, zi = ({ type: t, initialValue: e, initialValueLanguage: r, onChange: n, basicForm: i }) => { + const [o, s] = Hr(r == "javascript" && e, r == "javascript" ? void 0 : e, {}, {}, i); + return z(() => { + r == "javascript" ? n(ce(o, t)) : e && n(ce(e, t)); + }, [t, e, o]), null; +}; +ir.propTypes = { fields: C.array, hides: C.array }; +const qi = /* @__PURE__ */ ((t) => ({ code: e, isPreview: r = !1, ...n }) => { + const { align: i, autoComplete: o, resource: s, items: a, hides: l, rowHeight: c, marginX: u, marginY: p, cols: h, listenChangeFields: g, listenChangeFieldsFunc: f, pk: y, uuid: k, theme: b, themeProps: x, groups: S } = Li(e), $ = W(() => [{ name: "__PK__", value: y }, { name: "__RESOURCE__", value: s }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: k }], [y, e, k, s]); + return m(t, { name: e, autoComplete: o, theme: b, themeProps: x, groups: S, ...n, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: f, fields: a, hides: l, cols: h, rowHeight: c, itemMargin: [u, p] }); +})(ir), rn = ({ $setting: t, $close: e, extras: r, code: n, primaryKey: i, ...o }) => { + const [s] = ie.useForm(), a = Bi(s, n, i, t); + return m(re, { actions: I(E.Fragment, { children: [m(R, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => a({ onSuccess: e }) }), m(R, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: r, children: m(qi, { form: s, code: n, primaryKey: i, ...o }) }); +}, Pr = /* @__PURE__ */ new Set(), _t = (t = [], e = 0) => { + const r = t[e]; + if (r.length && !Pr.has(r)) { + const n = document.createElement("script"); + n.setAttribute("src", r), n.setAttribute("data-namespace", r), t.length > e + 1 && (n.onload = () => { + _t(t, e + 1); + }, n.onerror = () => { + _t(t, e + 1); + }), Pr.add(r), document.body.appendChild(n); + } +}, Ct = ({ className: t, type: e, style: r = {}, rotate: n, spin: i, twoToneColor: o, compact: s, ...a }) => m("span", { role: "img", className: j("ff-iconfont", s && "ff-iconfont--compact", t), style: r, ...a, children: m("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden", ...n != null && { transform: `rotate(${n}deg)` }, ...i && { animation: "ff-iconfont-spin 1s linear infinite" }, ...o && { "--ff-icon-second-color": o } }, viewBox: "0 0 1024 1024", children: m("use", { xlinkHref: `#${e}` }) }) }); +Ct.propTypes = { className: C.string, type: C.string.isRequired, style: C.object }, Ct.init = _t; +const Ki = (t, e, r, n) => ke.redirect(r, e, n), _i = (t, e = {}, r, n = {}) => { + var o; + const i = (o = n.router) == null ? void 0 : o.reduce((s, [a, l, c]) => { + const u = w.get(e, ["router", a]); + if (!u && u !== 0 && l) throw `请传入 ${c}`; + return `${s}/${u}`; + }, `/api/${r}`); + return B.del(i, e.param).msg(); +}, vr = (t, e, r, { status: { loading: n, disabled: i }, setStatus: o, listFn: s }) => { + const a = { loading: (l) => l === void 0 ? n : o((c) => ({ ...c, loading: l })), disabled: (l) => l === void 0 ? i : o((c) => ({ ...c, disabled: l })), list: s }; + return w.isFunction(r) ? r.call(null, e, a) : w.isString(r) && r ? We.exec(r, e, a) : null; +}, Nr = (t, e, r, n, i) => w.isString(r) && r ? Z.getWidgetComponent(r).then(({ default: o }) => Se.modal(o, { ...e, $setting: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i)).catch((o) => { + Se.error(r, { content: o.toString() }); +}) : Se.modal(r, { ...e, $setting: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Ji = (t, e, r, n, i) => Se.modal(rn, { ...e, $setting: n, code: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Hi = (t, e, r, n, i) => Se.modal(tr, { ...n, base62params: e, listCode: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Yi = ({ widget: t, widgetType: e, widgetData: r, widgetProps: n, widgetSetting: i, widgetContainerProps: o }, { onAfterClick: s, onBeforeClick: a } = {}) => { + const l = de(oe), [c, u] = L({ leading: !0, trailing: !1 }), p = J(null), [h, g] = W(() => { + switch (e) { + case "redirect": + return [w.partialRight(Ki, t, i), null]; + case "func": + return [w.partialRight(vr, (i == null ? void 0 : i.code) ?? t, { status: c, setStatus: u, listFn: l }), null]; + case "component": + case "fsdpf-component": + return [w.partialRight(Nr, t, i, o), (y) => ({ $setting: y })]; + case "grid-layout-form": + return [w.partialRight(Ji, t, i, o), (y) => ({ $setting: y })]; + case "data-list": + return [w.partialRight(Hi, t, i, o), (y) => y]; + case "destroy": + return [w.partialRight(_i, t, i, o), null]; + default: + if (an(t) || E.isValidElement(t)) return [w.partialRight(Nr, t, i, o), (y) => ({ $setting: y })]; + if (w.isFunction(t)) return [w.partialRight(vr, (i == null ? void 0 : i.code) || t, { status: c, setStatus: u }), null]; + } + return [(...y) => console.error("useButton unknown widgetType", e, ...y), null]; + }, [t, e, i, o, l.getBase62params, l.getSelectedRows]), f = w.debounce((y) => (a == null || a(y), Promise.resolve($t(n, y, { list: l })).then((k) => { + const b = h(y, { ...r, ...k }); + return b != null && b.update && g && (p.current = (x, S) => b.update(g(x), S)), b; + }).then((k) => s == null ? void 0 : s(k)).catch(console.error)), 300, { leading: !0, trailing: !1 }); + return Gt(() => { + var y; + (y = p.current) == null || y.call(p, i, o); + }, [i, o]), [f, c]; +}, nn = ({ type: t, name: e, className: r, icon: n, iconPosition: i, size: o }, s = "default") => W(() => { + const a = { type: "primary", className: j("ff-button", r), iconPosition: i, size: o }; + return t === "danger" ? a.danger = !0 : t === "default" && (a.type = t), s === "link" || s === "dashed" ? (a.type = s, t === "default" && (a.className = j(a.className, "ff-default"))) : s !== "circle" && s !== "round" || (a.shape = s), n && (a.icon = m(Ct, { type: n })), e && (a.children = e), a; +}, [s, t, r, n, i]), Nt = ({ data: t, widget: e, widgetType: r = "fsdpf-component", widgetData: n, widgetProps: i, widgetSetting: o, widgetContainerProps: s, onAfterClick: a, onBeforeClick: l, children: c, extras: u }) => { + const p = de(oe), [h, g] = L(!1), [f, y] = L("hover"), [k, b] = rr(i, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [x, S] = L(), { placement: $, align: F, zIndex: A, arrow: O = { pointAtCenter: !0 }, getPopupContainer: T, isPopupMountBodyContainer: D = !0, ...P } = s || {}; + z(() => { + r == "grid-layout-form" ? S(E.createElement(rn, { ...n, $setting: o, code: e })) : r == "data-list" ? S(E.createElement(tr, { base62params: t, $setting: o, listCode: e })) : w.isString(e) ? Z.getWidgetComponent(e).then(({ default: U }) => { + S(E.createElement(U, { ...n, $setting: o })); + }).catch((U) => S(U.toString())) : E.isValidElement(e) ? S(E.cloneElement(e, { ...n, $setting: o })) : (an(e) || w.isFunction(e) && ["component", "fsdpf-component"].includes(r)) && S(E.createElement(e, { ...n, $setting: o })); + }, [e, r, n]); + const V = (U, X = !1) => (g(U), !U && y("hover"), U ? l == null ? void 0 : l(k) : a == null ? void 0 : a(X)), M = (U) => { + g(!0), y("click"); + }; + return m(zn, { zIndex: A, placement: $, onPopupClick: M, onClick: M, open: h, align: F, arrow: O, trigger: f, getPopupContainer: T || D ? void 0 : (U) => U, content: m(Gi, { ...P, extras: u, children: x && E.cloneElement(x, { ...k, $setProps: b, $close: (U) => V(!1, U) }) }), children: c, onOpenChange: V }); +}, Gi = ({ title: t, className: e, classNames: r, children: n, extras: i, width: o, height: s, style: a, ...l }) => { + const [c, u] = L({}), p = H((y, k) => u((b) => ({ ...b, [y]: k })), []), h = H((y) => u((k) => ({ ...k, [y]: void 0 })), []), g = t ? E.createElement("div", { className: "ff-popup-title" }, t) : c == null ? void 0 : c.title, f = i ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, i); + return m(ut.Provider, { value: { ele: c, mount: p, unmount: h }, children: I("div", { className: j("ff-popup ff-popover", e, c.rootClassName), style: { ...a, width: o ?? 260, height: s }, ...l, children: [I("div", { className: j("ff-popup-header", "ff-popover-header", r == null ? void 0 : r.header), children: [g, c == null ? void 0 : c["sub-title"]] }), m("div", { className: j("ff-popup-body", "ff-popover-body", r == null ? void 0 : r.body), children: n }), I("div", { className: j("ff-popup-footer", "ff-popover-footer", r == null ? void 0 : r.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: r, children: n, name: i, icon: o, type: s = "default", iconPosition: a = "start", noAuthType: l, onAfterClick: c, onBeforeClick: u, data: p, loading: h, disabled: g, tooltip: f, confirm: y, widget: k = () => { +}, widgetType: b, widgetData: x, widgetProps: S, widgetSetting: $, widgetContainerProps: F, ...A }) { + const { mode: O, ...T } = F || {}, D = nn({ className: e, name: i, type: s, icon: o, iconPosition: a }, r ?? t), P = m(wt, { ...D, ...A, children: n || i }); + if (O === "popover" && !["destroy", "redirect", "func"].includes(b)) return m(Nt, { data: p, widget: k, widgetType: b, widgetData: x, widgetProps: S, widgetSetting: $, widgetContainerProps: T, onAfterClick: c, onBeforeClick: u, children: P }); + const V = w.isEmpty(f) || !f.enabled ? {} : f, M = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [U, X] = L(!1), [Ee, { disabled: q, loading: se }] = Yi({ widget: k, widgetType: b, widgetData: x, widgetProps: S, widgetSetting: $, widgetContainerProps: T }, { onAfterClick: c, onBeforeClick: u }); + return m(qn, { okText: "确定", cancelText: "取消", getPopupContainer: (_) => _, ...M, disabled: q || g, open: U, onOpenChange: (_) => { + if (!_) return X(_); + M.enabled ? X(_) : Ee(p); + }, onConfirm: (_) => { + Ee(p, _); + }, onClick: (_) => { + _.stopPropagation(); + }, children: m(Kn, { getPopupContainer: (_) => _, ...V, title: U ? null : V == null ? void 0 : V.title, trigger: ["hover", "click"], children: E.cloneElement(P, { loading: se || h, disabled: q || g }) }) }); +}, R = gt("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 Xi = gt("link"), Zi = gt("circle"), Qi = gt("round"), eo = gt("dashed"), Tr = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: r = (g, f, y) => { +}, onBeforeClick: n = (g, f, y) => { +}, labelVariant: i = "link", labelSize: o, labelRender: s, btnVariant: a, btnSize: l, btnRender: c = (g, f) => m(R, { ...g, data: f }, g.uuid || Lt()), widgetContainerProps: u = {}, children: p, data: h }) => { + if (w.isEmpty(t)) return p; + l ?? (l = o), a ?? (a = i); + const [g, f] = W(() => (t || []).reduce((b, x) => { + const S = e.indexOf(x.widgetType); + return S === -1 ? b[1].push(x) : b[0] ? S < e.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = x) : b[1].push(x) : b[0] = x, b; + }, [null, []]), [t, e]); + s ? p = s(g, h) || p : p || (p = m(wt, { ...nn(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: o }), i) })); + 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(r, b, h), onBeforeClick: w.partialRight(n, b, h) }, { size: l, variant: a }), h)); + let k = y; + return (y == null ? void 0 : y.length) > 1 && (k = a == "link" ? m(Dt, { split: m(_n, { type: "vertical" }), size: l, children: y }) : m(Dt.Compact, { size: l, children: y })), g ? m(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: h, widgetData: g == null ? void 0 : g.widgetData, extras: k, onAfterClick: w.partialRight(r, g, h), onBeforeClick: w.partialRight(n, g, h), children: p }) : k; +}; +Tr.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 = Xi, R.Link.defaultProps = R.defaultProps, R.Link.propTypes = R.propTypes, R.Circle = Zi, R.Circle.defaultProps = R.defaultProps, R.Circle.propTypes = R.propTypes, R.Round = Qi, R.Round.defaultProps = R.defaultProps, R.Round.propTypes = R.propTypes, R.Dashed = eo, R.Dashed.defaultProps = R.defaultProps, R.Dashed.propTypes = R.propTypes, R.Popover = Nt, R.GroupPopover = Tr; +const to = ({ fields: t, formProps: e, $close: r }) => { + const [n] = ie.useForm(), i = W(() => [{ name: "__PROPS__", value: e }], [e]); + return m(re, { actions: I(E.Fragment, { children: [m(R, { name: "取消", widget: () => r(!1) }), m(R, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(r) })] }), children: m(ie, { fields: i, form: n, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...s }) => m(nr, { code: o, ...s }, o)) }) }); +}, ro = ({ className: t, classNames: e, $close: r, children: n, title: i, subTitle: o, actions: s, extras: a, ...l }) => I(Qn, { ...l, prefixCls: "ff-drawer", className: j("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (c) => ({ motionAppear: !0, motionName: `panel-motion-${c}` }), children: [I("div", { className: j("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [m("button", { "aria-label": "Close", className: j("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: m(Qt, { type: "close" }) }), i, o] }), m("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), I("div", { className: j("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [a, s] })] }), no = ({ className: t, classNames: e, $close: r, $event: n, children: i, title: o, subTitle: s, actions: a, extras: l, placement: c, ...u }) => { + const { style: p, rest: h } = ((f, y = ["height", "width", "style"]) => { + const k = { ...f }, b = {}; + for (const x of y) x === "style" ? Object.assign(b, k.style) : k[x] !== void 0 && (b[x] = k[x]), delete k[x]; + return { style: b, rest: k }; + })(u), g = (n == null ? void 0 : n.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: n == null ? void 0 : n.pageX, y: n == null ? void 0 : n.pageY } }; + return m(ei, { ...h, ...g, prefixCls: "ff-modal", className: j("ff-popup", t), modalRender: () => I(E.Fragment, { children: [m("button", { className: j("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: h.onClose, children: m(Qt, { type: "close" }) }), I("div", { className: j("ff-modal-content"), style: p, children: [I("div", { className: j("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [o, s] }), m("div", { className: j("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: i }), I("div", { className: j("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, a] })] })] }) }); +}, on = ({ placement: t, $close: e, $event: r, children: n, title: i, ...o }) => { + const [s, a] = L({}), [l, c] = L(!0), u = H((f, y) => a((k) => ({ ...k, [f]: y })), []), p = H((f) => a((y) => ({ ...y, [f]: void 0 })), []); + let h = { ...o, className: s.rootClassName, title: s.title || i && E.createElement("div", { className: j("ff-popup-title") }, i), subTitle: s["sub-title"], actions: s.actions, extras: s.extras, children: n, $close: e, $event: r, onClose: () => c(!1) }; + const g = () => { + e(!1); + }; + return m(ut.Provider, { value: { ele: s, mount: u, unmount: p }, children: t && t !== "center" ? m(ro, { ...h, placement: t, open: l, afterOpenChange: (f) => !f && g() }) : m(no, { ...h, visible: l, afterClose: g }) }); +}; +on.propTypes = { placement: C.oneOf(["center", "left", "top", "right", "bottom"]) }; +const io = ({ widget: t, widgetProps: e, $close: r, onSetProps: n }) => { + const [i, o] = L(e || {}), s = Fr(e); + Yt(() => { + const l = s ?? {}, c = e ?? {}, u = Object.keys({ ...l, ...c }).reduce((p, h) => (l[h] !== c[h] && (p[h] = c[h]), p), {}); + Object.keys(u).length > 0 && o((p) => ({ ...p, ...u })); + }, [e]); + const a = H((l) => { + o((c) => ({ ...c, ...l })), n == null || n(l); + }, [n]); + return E.isValidElement(t) ? E.cloneElement(t, { ...i, $close: r, $setProps: a }) : t != null && t.name || Cr.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === Cr.ForwardRef ? E.createElement(t, { ...i, $close: r, $setProps: a }) : t; +}, G = () => { + const [t, e] = jn({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (o) => { + const { offsetHeight: s } = o; + return { height: s }; + }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, r] = E.useReducer((o) => o + 1, 0); + z(() => { + G.$onClick = n, G.$queue.forEach(([o, s, a, l]) => { + l == null || l(i([s, a], ...o)); + }), G.$queue = []; + }, []); + const n = (o, s = {}, a = {}) => { + let l; + const c = new Promise((u, p) => { + l = i([u, p], o, s, a); + }); + return c.update = l, c; + }, i = ([o, s], a, l = {}, c = {}) => { + const u = G.$index++, p = (f) => ((y, k) => (G.$popups.delete(y), r(), k == null ? void 0 : k()))(u, () => o(f)); + if (a === Vr) return t.open({ ...c, key: u, content: E.createElement(a, { ...l, $close: () => t.close(u) }), onClose: () => p() }), () => { + }; + const { $setProps: h, ...g } = l; + return G.$popups.set(u, { widget: a, widgetProps: g, widgetContainerProps: c, $close: p, onSetProps: h }), r(), (f, y) => { + const k = G.$popups.get(u); + k && (G.$popups.set(u, { ...k, widgetProps: f ? { ...k.widgetProps, ...f } : k.widgetProps, widgetContainerProps: y ? { ...k.widgetContainerProps, ...y } : k.widgetContainerProps }), r()); + }; + }; + return I(E.Fragment, { children: [Array.from(G.$popups).map(([o, { widget: s, widgetProps: a, widgetContainerProps: l, $close: c, onSetProps: u }]) => m(on, { maskClosable: !1, $event: a == null ? void 0 : a.$event, ...l, $close: c, children: m(io, { widget: s, widgetProps: a, $close: c, onSetProps: u }) }, o)), e] }); +}; +G.$popups = /* @__PURE__ */ new Map(), G.$index = 0, G.$queue = [], G.$onClick = (...t) => { + const e = new Promise((r, n) => { + G.$queue.push([t, r, n, (i) => { + e.update = i; + }]); + }); + return e; +}; +const Or = (t, e, r = {}) => G.$onClick(t, e, r), jt = (t, { showProgress: e, duration: r, ...n } = { duration: 1.5 }) => G.$onClick(Vr, { content: t, ...n }, { showProgress: e, duration: r }), Se = { modal: Or, confirm: (t, e = {}) => G.$onClick(ni, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, r = {}) => Or(to, { formProps: r, fields: t }, { placement: "center", ...e }).then((n) => { + if (n === !1) throw !1; + return n; +}), notification: jt, success: (t, e = { duration: 1.5 }) => jt(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => jt(t, { ...e, className: "ff-notification-error", icon: "close" }) }; +Xe.configure({ showSpinner: !1 }); +const sn = () => { + const t = window.localStorage.getItem(yt); + return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); +}; +Le.interceptors.request.use((t) => (Object.assign(t.headers, sn()), Xe.inc(), t), (t) => (Xe.done(), Promise.reject({ code: -1, msg: t }))), Le.interceptors.response.use(({ data: t, headers: e }) => (Xe.done(), { ...t, res: e == null ? void 0 : e.res }), function(t) { + return Xe.done(), Promise.reject(t.message); +}), window.addEventListener("unhandledrejection", Vt.onUnhandledRejection), Vt.onMsg = (t, e) => Se[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && ke.redirect(Ue.get("Common.WEBSITE_LOGIN_PAGE"))); +var Je, Be, He; +const ee = class ee { + constructor() { + N(this, "appUrl", ""); + v(this, Je, null); + return d(ee, Be) || (K(ee, He, new Vt()), K(ee, Be, new Proxy(this, { get(e, r) { + if (r in e) { + const n = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), r); + return n != null && n.get ? Reflect.get(e, r, e) : typeof e[r] == "function" ? e[r].bind(e) : e[r]; + } + return d(ee, He)[r]; + } }))), d(ee, Be); + } + init(e, r, n) { + Le.defaults.baseURL = this.appUrl = n, Le.defaults.timeout = 15e3, d(ee, He).init(e, r, Le); + } + get driver() { + return Le; + } + get headers() { + return sn(); + } + mock(e = {}) { + return d(this, Je) ?? K(this, Je, new Ln(Le, { onNoMatch: "passthrough", ...e })); + } + unmock() { + var e; + (e = d(this, Je)) == null || e.restore(), K(this, Je, null); + } +}; +Je = new WeakMap(), Be = new WeakMap(), He = new WeakMap(), v(ee, Be), v(ee, He), N(ee, "getInstance", () => d(ee, Be) ?? K(ee, Be, new ee())); +let Jt = ee; +const B = Jt.getInstance(); +class or extends Error { + constructor(e, r) { + super(r), Error.captureStackTrace && Error.captureStackTrace(this, or), !r instanceof Ze && (this.name = `${e} Error Runtime`); + } +} +class Ze extends Error { + constructor(e, ...r) { + super(...r), Error.captureStackTrace && Error.captureStackTrace(this, Ze), this.name = `${e} Not Found`; + } +} +const At = "mine", yt = "token", It = "user-login-intended-url"; +var Ae, Ye, ot; +const fe = class fe { + constructor() { + v(this, Ye, /* @__PURE__ */ new Map()); + v(this, ot, (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)); + N(this, "setPkgVersion", (e) => { + K(this, ot, e); + }); + N(this, "setVendor", (e, r) => d(this, Ye).set(e, new ti(r, async (n, i) => { + var s, a; + if (!(n != null && n.default)) throw "@pkg not found"; + let o = () => i; + switch ("function") { + case typeof (o = (s = n.default) == null ? void 0 : s[`./${i}/index.jsx`]): + case typeof (o = (a = n.default) == null ? void 0 : a[`./${i}/index.js`]): + return o(); + } + throw new Ze(i); + }))); + N(this, "getWidgetComponent", async (e) => { + if (!e) throw "getWidgetComponent widget is required"; + if (e != null && e.startsWith("blob:") || e != null && e.startsWith("http:") || e != null && e.startsWith("https:")) return await import(e); + const [, r] = e == null ? void 0 : e.split("@pkg/"); + if (!r) throw new Ze(e); + try { + return d(this, Ye).has("pkg") ? await d(this, Ye).get("pkg").get(r) : await import(`${B.appUrl}/api/pkg-import/web?name=${e}&v=${d(this, ot)}`); + } catch (n) { + throw new or(e, n); + } + }); + N(this, "getRoutes", () => B.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: r, ...n }) => [r, { uuid: r, ...n }])).then((e) => new Map(e))); + N(this, "getMenus", () => B.get("/api/my-menu")); + N(this, "getConfigure", () => B.get("api/init-configure")); + N(this, "getWidgetOperationAuth", () => B.get("/api/init-widget-operation-auth").then((e) => e.reduce((r, { uuid: n, auth: i }) => [...r, [n, i]], []))); + N(this, "getPhoneNumber", (e) => B.get(`/api/user-wx-phone-number/${e}`)); + N(this, "getUserToken", () => { + const e = window.localStorage.getItem(yt); + if (!e) return ""; + const r = e.split("."); + if (!Array.isArray(r) || r.length !== 3) throw "登录令牌无效!"; + const { iat: n } = JSON.parse(window.atob(r[1])); + if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; + return e; + }); + N(this, "checkUserToken", () => { + try { + return !!this.getUserToken(); + } catch { + return !1; + } + }); + N(this, "getUserInfo", (e = !0) => { + var r; + try { + const n = this.getUserToken(); + if (!n) return Promise.resolve(null); + const { iat: i } = JSON.parse(window.atob((r = n == null ? void 0 : n.split(".")) == null ? void 0 : r[1])), { iat: o, ...s } = B.decode(window.localStorage.getItem(At) || "", {}); + return o === i ? Promise.resolve(s) : B.get("/api/mine-info").then(({ User: a = null }) => (window.localStorage.setItem(At, B.encode({ ...a, iat: i })), a)).catch((a) => (console.error(a), e && Se.error("请登录").then(this.logout), null)); + } catch (n) { + console.error(n), e && Se.error("请登录").then(this.logout); + } + return Promise.resolve(null); + }); + N(this, "login", (e, r, n = {}) => B.post("/api/user-token", { username: e, passwd: Vn.hash(r), platform: "web", ...n }).then(({ token: i }) => (window.localStorage.setItem(yt, i), i)).then(async (i) => (await this.initAppEnv(), i))); + N(this, "setLoginIntendedUrl", (e) => sessionStorage.setItem(It, e)); + N(this, "getLoginIntendedUrl", (e = !1) => { + const r = sessionStorage.getItem(It); + return e && sessionStorage.removeItem(It), r; + }); + N(this, "logout", (e) => (window.localStorage.removeItem(At), window.localStorage.removeItem(yt), e == null ? void 0 : e())); + N(this, "initAppEnv", async () => { + const [e, r, n, i] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); + return Dr.init(e), Ue.init(i), ke.init(r, n), Ct.init(Ue.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: r, menus: n, configures: i }; + }); + if (d(fe, Ae)) return d(fe, Ae); + } +}; +Ae = new WeakMap(), Ye = new WeakMap(), ot = new WeakMap(), v(fe, Ae, null), N(fe, "getInstance", () => (d(fe, Ae) || K(fe, Ae, new fe()), d(fe, Ae))); +let Ht = fe; +const Z = Ht.getInstance(), qo = E.createContext({ user: {}, initUser: () => { +}, initUserComplete: !1 }), Ko = E.createContext({ set: () => { +}, get: () => { +}, assign: () => { +}, currentRoute: () => { +} }), an = (t) => { + if (!t) return !1; + if (t.prototype instanceof E.Component || t.$$typeof) return !0; + if (typeof t == "function") { + const e = t.displayName || t.name; + return !e || /^[A-Z]/.test(e); + } + return !1; +}, _o = (t, e) => { + if (!t || typeof window > "u") return; + let r = document.querySelector(`style[ff-style-token="${e}"]`); + return r ? (r.innerHTML = t, t) : (r = document.createElement("style"), r.setAttribute("ff-style-token", e), r.setAttribute("type", "text/css"), r.innerHTML = t, document.head.appendChild(r), t); +}; +var Pe, Ge, ve, we, be, ne, te, Y, Ce, st, at, lt, ct, xt, dt; +const sr = class sr { + constructor(e, r = "/") { + v(this, Pe, "/"); + v(this, Ge, /* @__PURE__ */ new Set()); + v(this, ve, (e) => { + for (const r of d(this, Ge)) try { + r(e); + } catch (n) { + console.error("Error in VirtualFS event listener:", n); + } + }); + v(this, we, (e) => { + const r = Date.now(); + if (e && (e.lastModified = r), d(this, Pe) != "/") { + const n = d(this, Y).call(this, d(this, Pe)); + n && (n.lastModified = r); + } + this.root.lastModified = r; + }); + v(this, be, (e) => { + let r = ue.normalize(e); + return r.startsWith("/") || (r = "/" + r), r.length > 1 && r.endsWith("/") && (r = r.slice(0, -1)), r; + }); + v(this, ne, (e) => { + const r = ue.join(d(this, Pe), e); + return d(this, be).call(this, r); + }); + v(this, te, (e) => { + if (!e || typeof e != "string") return !1; + const r = d(this, be).call(this, e); + return !r.includes("..") && r.startsWith("/"); + }); + v(this, Y, (e) => { + var o; + const r = d(this, be).call(this, e); + if (r === "/") return this.root; + const n = r.split("/").filter((s) => s); + let i = this.root; + for (const s of n) { + if (i.type !== "dir") return null; + const a = (o = i.children) == null ? void 0 : o.find((l) => l.name === s); + if (!a) return null; + i = a; + } + return i; + }); + v(this, Ce, (e) => { + const r = d(this, be).call(this, e), n = ue.basename(r), i = ue.dirname(r); + return { parent: d(this, Y).call(this, i), name: n }; + }); + v(this, st, (e, r, n) => n === !1 ? e : n === "root" ? e.map((i) => ue.join(r, i)) : n === !0 || n === "working" ? e.map((i) => ue.relative(d(this, Pe), ue.join(r, i))) : e); + v(this, at, async (e, r, n, i = "") => { + const o = [], s = d(this, Y).call(this, e); + if (!s || s.type !== "dir") return o; + const a = s.children; + for (const l of a) { + const c = l.name, u = e === "/" ? `/${c}` : `${e}/${c}`, p = i ? `${i}/${c}` : c; + try { + if (l.type === "file") r(n ? p : c) && o.push(p); + else if (l.type === "dir" && n) { + const h = await d(this, at).call(this, u, r, n, p); + o.push(...h); + } + } catch { + continue; + } + } + return o; + }); + v(this, lt, async (e, r, n, i = "") => { + const o = [], s = Array.isArray(r) ? r : [r], a = d(this, Y).call(this, e); + if (!a || a.type !== "dir") return o; + if (!n) { + for (const c of s) if (d(this, ct).call(this, c)) { + const u = await d(this, xt).call(this, e, c); + o.push(...u); + } else { + const u = ue.join(e, c), p = d(this, be).call(this, u); + d(this, Y).call(this, p) && o.push(c); + } + return o; + } + const l = a.children; + for (const c of l) { + const u = c.name, p = e === "/" ? `/${u}` : `${e}/${u}`, h = i ? `${i}/${u}` : u; + try { + if (c.type === "file") for (const g of s) { + let f = !1; + if (f = d(this, ct).call(this, g) ? d(this, dt).call(this, u, g) : u === g, f) { + o.push(h); + break; + } + } + else if (c.type === "dir") { + const g = await d(this, lt).call(this, p, r, n, h); + o.push(...g); + } + } catch { + continue; + } + } + return o; + }); + v(this, ct, (e) => /[*?[\]{}]/.test(e)); + v(this, xt, async (e, r) => { + const n = [], i = d(this, Y).call(this, e); + if (!i || i.type !== "dir") return n; + const o = i.children.map((s) => s.name); + for (const s of o) d(this, dt).call(this, s, r) && n.push(s); + return n; + }); + v(this, dt, (e, r) => { + const n = r.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (i, o) => "(" + o.split(",").join("|") + ")"); + return new RegExp(`^${n}$`).test(e); + }); + var n, i, o; + K(this, Pe, r), this.root = { name: "/", type: "dir", children: [], lastModified: Date.now() }, Array.isArray(e) ? this.root.children = e : e && typeof e == "object" && (e.name && e.name !== "/" ? this.root.children.push(e) : (this.root = e, (n = this.root).name ?? (n.name = "/"), (i = this.root).children ?? (i.children = []), (o = this.root).lastModified ?? (o.lastModified = Date.now()))); + } + async stat(e) { + const r = d(this, ne).call(this, e); + if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = d(this, Y).call(this, r); + if (!n) throw new Error(`ENOENT: no such file or directory, stat '${e}'`); + return { isFile: () => n.type === "file", isDirectory: () => n.type === "dir", lastModified: n.lastModified }; + } + async dir(e) { + const r = d(this, ne).call(this, e); + if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = d(this, Y).call(this, r); + if (!n) throw new Error(`ENOENT: no such file or directory, scandir '${e}'`); + if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory, scandir '${e}'`); + return n.children.map((i) => i.name); + } + async readFile(e) { + const r = d(this, ne).call(this, e); + if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = d(this, Y).call(this, r); + if (!n) throw new Error(`ENOENT: no such file or directory, open '${e}'`); + if (n.type !== "file") throw new Error("EISDIR: illegal operation on a directory, read"); + return n.content || ""; + } + async writeFile(e, r) { + const n = d(this, ne).call(this, e); + if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: i, name: o } = d(this, Ce).call(this, n); + if (!i) throw new Error(`ENOENT: no such file or directory, open '${e}'`); + if (i.type !== "dir") throw new Error("ENOTDIR: not a directory"); + const s = i.children.findIndex((c) => c.name === o), a = s >= 0, l = { name: o, type: "file", content: r, lastModified: Date.now() }; + a ? i.children[s] = l : i.children.push(l), d(this, we).call(this, i), d(this, ve).call(this, { action: a ? "update" : "create", path: n, type: "file", timestamp: Date.now() }); + } + async mkdir(e, r = {}) { + const n = d(this, ne).call(this, e); + if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const { recursive: i } = r; + if (i) { + const o = n.split("/").filter((a) => a); + let s = "/"; + for (const a of o) + if (s = ue.join(s, a), !d(this, Y).call(this, s)) { + const { parent: l, name: c } = d(this, Ce).call(this, s); + if (l && l.type === "dir") { + const u = { name: c, type: "dir", children: [], lastModified: Date.now() }; + l.children.push(u), d(this, we).call(this, l), d(this, ve).call(this, { action: "create", path: d(this, be).call(this, s), type: "dir", timestamp: Date.now() }); + } + } + } else { + const { parent: o, name: s } = d(this, Ce).call(this, n); + if (!o) throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`); + if (o.type !== "dir") throw new Error("ENOTDIR: not a directory"); + if (o.children.find((l) => l.name === s)) throw new Error(`EEXIST: file already exists, mkdir '${e}'`); + const a = { name: s, type: "dir", children: [], lastModified: Date.now() }; + o.children.push(a), d(this, we).call(this, o), d(this, ve).call(this, { action: "create", path: n, type: "dir", timestamp: Date.now() }); + } + } + async unlink(e) { + const r = d(this, ne).call(this, e); + if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: n, name: i } = d(this, Ce).call(this, r); + if (!n) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + const o = n.children.findIndex((s) => s.name === i); + if (o < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + if (n.children[o].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); + n.children.splice(o, 1), d(this, we).call(this, n), d(this, ve).call(this, { action: "delete", path: r, type: "file", timestamp: Date.now() }); + } + async rmdir(e, r = {}) { + const n = d(this, ne).call(this, e); + if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: i, name: o } = d(this, Ce).call(this, n); + if (!i) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const s = i.children.findIndex((l) => l.name === o); + if (s < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const a = i.children[s]; + if (a.type !== "dir") throw new Error(`ENOTDIR: not a directory, rmdir '${e}'`); + if (!r.recursive && a.children.length > 0) throw new Error(`ENOTEMPTY: directory not empty, rmdir '${e}'`); + i.children.splice(s, 1), d(this, we).call(this, i), d(this, ve).call(this, { action: "delete", path: n, type: "dir", timestamp: Date.now() }); + } + async rename(e, r) { + const n = d(this, ne).call(this, e), i = d(this, ne).call(this, r); + if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + if (!d(this, te).call(this, i)) throw new Error(`EINVAL: invalid path '${r}'`); + if (!d(this, Y).call(this, n)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${r}'`); + const { parent: o, name: s } = d(this, Ce).call(this, n), { parent: a, name: l } = d(this, Ce).call(this, i); + if (!a) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${r}'`); + if (d(this, Y).call(this, i)) throw new Error(`EEXIST: file already exists, rename '${e}' -> '${r}'`); + const c = o.children.findIndex((p) => p.name === s), u = { ...o.children[c], name: l, lastModified: Date.now() }; + o.children.splice(c, 1), a.children.push(u), d(this, we).call(this, o), o !== a && d(this, we).call(this, a), d(this, ve).call(this, { action: "rename", path: i, oldPath: n, type: u.type, timestamp: Date.now() }); + } + async exists(e) { + const r = d(this, ne).call(this, e); + return d(this, te).call(this, r) ? d(this, Y).call(this, r) !== null : !1; + } + getLastModified() { + return this.root.lastModified; + } + subscribe(e) { + if (typeof e != "function") throw new Error("Callback must be a function"); + return d(this, Ge).add(e), () => { + d(this, Ge).delete(e); + }; + } + getWorkingDirectory() { + return d(this, Pe); + } + scope(e = "/") { + const r = d(this, be).call(this, e); + if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const n = d(this, Y).call(this, r); + if (!n) throw new Error(`ENOENT: no such file or directory '${e}'`); + if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); + return n.children ?? (n.children = []), n.lastModified ?? (n.lastModified = Date.now()), new sr(this.root, r); + } + async findFiles(e, r, n = {}) { + const i = d(this, ne).call(this, e); + if (!d(this, te).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const o = d(this, Y).call(this, i); + if (!o) throw new Error(`ENOENT: no such file or directory '${e}'`); + if (o.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); + const { recursive: s = !1, fullPath: a = !1 } = n; + if (typeof r == "function") { + const c = await d(this, at).call(this, i, r, s); + return d(this, st).call(this, c, i, a); + } + const l = await d(this, lt).call(this, i, r, s); + return d(this, st).call(this, l, i, a); + } +}; +Pe = new WeakMap(), Ge = new WeakMap(), ve = new WeakMap(), we = new WeakMap(), be = new WeakMap(), ne = new WeakMap(), te = new WeakMap(), Y = new WeakMap(), Ce = new WeakMap(), st = new WeakMap(), at = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), xt = new WeakMap(), dt = new WeakMap(); +let Rr = sr; +const oo = async (t, e = "/", r = "") => { + try { + const n = await t.stat(e), i = e === "/" ? "/" : ue.basename(e), o = { title: i, key: r ? `${r}${e}` : e, isLeaf: n.isFile() }; + if (n.isDirectory()) { + const s = await t.dir(e); + if (s.length > 0) { + o.children = []; + const a = [], l = []; + for (const c of s) { + const u = e === "/" ? `/${c}` : `${e}/${c}`; + try { + (await t.stat(u)).isDirectory() ? a.push(c) : l.push(c); + } catch (p) { + console.warn(`Failed to stat ${u}:`, p.message); + } + } + a.sort(), l.sort(); + for (const c of [...a, ...l]) { + const u = e === "/" ? `/${c}` : `${e}/${c}`; + try { + const p = await oo(t, u, r); + o.children.push(p); + } catch (p) { + console.warn(`Failed to process ${u}:`, p.message); + } + } + } + } + return o; + } catch { + return null; + } +}; +class so extends E.Component { + constructor() { + super(...arguments); + N(this, "state", { error: null }); + N(this, "reset", () => { + var r, n; + (n = (r = this.props).onReset) == null || n.call(r), this.setState({ error: null }); + }); + } + static getDerivedStateFromError(r) { + return { error: r }; + } + componentDidCatch(r, n) { + var i, o; + console.error("[ErrorBoundary]", r), (o = (i = this.props).onError) == null || o.call(i, r, n); + } + componentDidUpdate(r) { + const { resetKeys: n } = this.props; + this.state.error && (n != null && n.length) && n.some((i, o) => { + var s; + return i !== ((s = r.resetKeys) == null ? void 0 : s[o]); + }) && this.reset(); + } + render() { + const { error: r } = this.state; + if (r) { + const { fallback: n } = this.props; + return typeof n == "function" ? n(r, this.reset) : n !== void 0 ? n : String(r); + } + return this.props.children; + } +} +const Jo = ({ widget: t, widgetSetting: e, widgetProps: r, fallback: n = null, fallbackOnError: i, onError: o }) => { + const [s, a] = rr(r), l = W(() => t ? E.lazy(() => Z.getWidgetComponent(t).catch((c) => ({ default: () => `${c}` }))) : null, [t]); + return l ? m(so, { fallback: i, onError: o, children: m(Fn, { fallback: n, children: m(l, { ...s, $setProps: a, $setting: e }) }) }) : m(ri, {}); +}; +export { + Mo as $, + li as A, + No as B, + To as C, + bt as D, + Ur as E, + Wt as F, + Fo as G, + ki as H, + ci as I, + di as J, + vi as K, + Ni as L, + jo as M, + Ao as N, + ce as O, + Oi as P, + $t as Q, + _r as R, + Zr as S, + Ft as T, + Io as U, + Lo as V, + Vo as W, + Do as X, + Ri as Y, + Fi as Z, + ji as _, + Mr as a, + Ai as a0, + Pt as a1, + Bo as a2, + pt as a3, + vt as a4, + Uo as a5, + Wo as a6, + Ii as a7, + rr as a8, + qi as a9, + ti as aA, + Ue as aB, + We as aC, + ke as aD, + qo as aE, + Ko as aF, + Rr as aG, + oo as aH, + io as aI, + so as aJ, + Jo as aK, + ir as aa, + nr as ab, + rn as ac, + Li as ad, + Vi as ae, + Di as af, + Mi as ag, + Bi as ah, + Ui as ai, + zo as aj, + Ct as ak, + R as al, + Dr as am, + Yi as an, + re as ao, + ut as ap, + Lr as aq, + G as ar, + Se as as, + ri as at, + Po as au, + vo as av, + Z as aw, + an as ax, + _o as ay, + B as az, + Wr as b, + Oo as c, + zr as d, + er as e, + Jr as f, + ii as g, + Gr as h, + xi as i, + Yr as j, + Ei as k, + Ro as l, + Hr as m, + Kr as n, + qr as o, + wi as p, + yi as q, + hi as r, + tr as s, + oe as t, + Si as u, + Ci as v, + Pi as w, + ui as x, + gi as y, + ai as z +}; diff --git a/dist/common/main-Dryw40ez.js b/dist/common/main-Dryw40ez.js deleted file mode 100644 index fd64f63..0000000 --- a/dist/common/main-Dryw40ez.js +++ /dev/null @@ -1,1567 +0,0 @@ -var Ni = Object.defineProperty; -var fn = (t) => { - throw TypeError(t); -}; -var Ti = (t, e, n) => e in t ? Ni(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; -var O = (t, e, n) => Ti(t, typeof e != "symbol" ? e + "" : e, n), yn = (t, e, n) => e.has(t) || fn("Cannot " + n); -var d = (t, e, n) => (yn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), v = (t, e, n) => e.has(t) ? fn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), _ = (t, e, n, i) => (yn(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n); -import { jsx as h, jsxs as A } from "react/jsx-runtime"; -import x, { useEffect as W, useState as L, useCallback as J, useRef as H, useContext as de, useMemo as B, useId as Lt, isValidElement as Oi, useLayoutEffect as Ri } from "react"; -import ue from "pathe"; -import C from "prop-types"; -import j from "classnames"; -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, 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"; -import { useMergedState as Ki } from "rc-util"; -import { generatePath as Hi, useInRouterContext as An, useParams as Ji, useLocation as Gi, createBrowserRouter as Yi, Navigate as Xi } from "react-router-dom"; -import Qi from "rc-drawer"; -import Zi from "rc-dialog"; -import * as Cn from "react-is"; -var We, Ze, qe, Ee, Ve, Me; -class er { - constructor(e, n) { - v(this, We, /* @__PURE__ */ new Map()); - v(this, Ze, !0); - v(this, qe, []); - v(this, Ee); - v(this, Ve, () => d(this, Ee)); - v(this, Me, () => Promise.resolve()); - O(this, "get", (...e) => new Promise((n, i) => { - const r = JSON.stringify(e); - if (d(this, We).has(r)) return n(d(this, Me).call(this, d(this, Ee), ...e)); - if (d(this, Ee) === void 0) d(this, qe).push([e, n, i]), d(this, Ze) && (_(this, Ze, !1), Promise.resolve(typeof d(this, Ve) == "function" ? d(this, Ve).call(this) : d(this, Ve)).then((o) => _(this, Ee, o || null)).finally(() => { - d(this, qe).forEach(([o, a, s]) => { - try { - const l = d(this, Me).call(this, d(this, Ee), ...o); - d(this, We).set(JSON.stringify(o), l), a(l); - } catch (l) { - s(l); - } - }), d(this, qe).length = 0; - })); - else { - const o = d(this, Me).call(this, d(this, Ee), ...e); - d(this, We).set(r, o), n(o); - } - })); - _(this, Me, n), _(this, Ve, e); - } -} -We = new WeakMap(), Ze = new WeakMap(), qe = new WeakMap(), Ee = new WeakMap(), Ve = new WeakMap(), Me = new WeakMap(); -const xo = () => h("div", { children: "Empty" }), ut = x.createContext({ ele: {}, mount: () => { -}, unmount: () => { -} }), te = ({ rootClassName: t, className: e, children: n, actions: i, title: r, subTitle: o, extras: a, style: s = {} }) => { - const { mount: l, unmount: c } = x.useContext(ut); - return te.Action({ children: i }), te.Title({ children: r }), te.SubTitle({ children: o }), te.Extra({ children: a }), W(() => (l("rootClassName", t), () => c(t)), [t]), h("div", { className: j("ff-container", e), style: s, children: n }); -}, mt = (t) => ({ children: e, className: n }) => { - const { mount: i, unmount: r } = x.useContext(ut); - return W(() => (e && i(t, x.createElement("div", { key: `ff-${t}`, className: j(`ff-popup-${t}`, n) }, e)), () => r(t)), [n, e]), null; -}; -te.Action = mt("actions"), te.Title = mt("title"), te.SubTitle = mt("sub-title"), te.Extra = mt("extras"), te.propTypes = { className: C.string, style: C.object, title: C.any, subTitle: C.any, actions: C.any, extras: C.any }; -const Eo = () => h(te, { 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", {})] })] }) }), $o = () => h("div", { children: "NotFound" }), Ln = ({ children: t }) => { - const [e, n] = L({}), i = J((o, a) => n((s) => ({ ...s, [o]: a })), []), r = J((o) => n((a) => ({ ...a, [o]: void 0 })), []); - return typeof (t == null ? void 0 : t.type) == "string" ? t : h(ut.Provider, { value: { ele: e, mount: i, unmount: r }, children: x.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); -}; -Ln.propTypes = { children: C.element.isRequired }; -const kn = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, Zt = ({ type: t, props: e }) => h("i", { ...e, children: h("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (kn[t] || kn.info).map((n, i) => h("path", { d: n }, i)) }) }), Vn = ({ className: t, content: e, icon: n, $close: i }) => A(x.Fragment, { children: [n && h("div", { className: j("ff-notification-icon", t), children: h(Zt, { type: n }) }), e] }), tr = ({}) => h(te, { children: "Confirm" }); -var Te, _e; -const pe = class pe { - constructor() { - v(this, _e, /* @__PURE__ */ new Map()); - O(this, "init", (e) => _(this, _e, new Map(e))); - O(this, "check", (e) => !d(this, _e).has(e) || d(this, _e).get(e)); - if (d(pe, Te)) return d(pe, Te); - } -}; -Te = new WeakMap(), _e = new WeakMap(), v(pe, Te, null), O(pe, "getInstance", () => (d(pe, Te) || _(pe, Te, new pe()), d(pe, Te))); -let zt = pe; -const Mn = zt.getInstance(), nr = (t, e, n = "children") => { - if (w.isEmpty(t)) return {}; - const i = w.find(t, ["value", e]); - if (!w.isEmpty(i)) return i; - const r = t.length; - for (let o = 0; o < r; o++) { - const { [n]: a } = t[o], s = nr(a, e, n); - if (!w.isEmpty(s)) return s; - } - return {}; -}, Dn = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; -var Oe, et; -const ge = class ge { - constructor() { - v(this, et, null); - O(this, "init", (e) => _(this, et, e)); - O(this, "get", (e, n) => w.get(d(this, et), e, n)); - if (d(ge, Oe)) return d(ge, Oe); - } -}; -Oe = new WeakMap(), et = new WeakMap(), v(ge, Oe, null), O(ge, "getInstance", () => (d(ge, Oe) || _(ge, Oe, new ge()), d(ge, Oe))); -let Ut = ge; -const Ue = Ut.getInstance(); -var Ke, kt, tt, nt, St; -const Ne = class Ne { - constructor(...e) { - v(this, tt, []); - v(this, nt, (e) => { - var n; - for (let i of e) Array.isArray(i[0]) ? d(this, nt).call(this, i) : d(this, tt).push(d(n = Ne, kt).call(n, i[0], i[1])); - }); - O(this, "toValue", async (e, n = null) => { - const i = { getValue: () => e, getRecord: () => n }; - let r = e; - for (const o of d(this, tt)) try { - const a = await o; - if (typeof a != "function") { - console.warn("middleware is not a function, skip:", a); - continue; - } - r = await a.call(i, r); - } catch (a) { - console.error("middleware error, skip:", a); - } - return r; - }); - O(this, "toRender", (e, n, i = null) => x.createElement(d(this, St), { value: e, record: n }, i)); - v(this, St, ({ value: e, record: n, children: i }) => { - const [r, o] = L(i), a = ji(); - return Gt(() => { - o(i), this.toValue(e, n).then((s) => a() && o(s)).catch((s) => a() && o(`${s}`)); - }, [e, n]), r; - }); - d(this, nt).call(this, e); - } -}; -Ke = new WeakMap(), kt = new WeakMap(), tt = new WeakMap(), nt = new WeakMap(), St = new WeakMap(), v(Ne, Ke, null), v(Ne, kt, w.memoize((e, n) => { - if (typeof e == "function") return e(n); - if (typeof e == "string") return ne.getWidgetComponent(e).then((i) => { - var r; - return ((r = i.default) == null ? void 0 : r.call(i, n)) || ((o) => o); - }); - throw new TypeError("middleware must be a string or a function"); -}, (...e) => { - var n; - return d(Ne, Ke) || _(Ne, Ke, Or()), d(n = Ne, Ke).call(n, ...e); -})); -let bt = Ne; -const oe = x.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { -}, getSelectedRows: () => [], onReload: () => { -}, onClickCallback: () => { -}, onConditionChange: () => { -}, onTabChange: () => { -}, onSiderChange: () => { -}, onKeywordChange: () => { -}, onPageChange: () => { -}, onPageSizeChange: () => { -}, reload: () => { -}, setPage: () => { -}, setPageSize: () => { -}, setTab: () => { -}, setSider: () => { -}, setKeyword: () => { -}, setCondition: () => { -} }), Sn = ({ className: t, record: e, column: n, ...i }) => { - if (n != null && n.editableByJs && (n != null && n.uuid)) { - const { formSetting: r = { primaryKey: "id" }, widgetSetting: o = {}, widgetContainerSetting: a = {} } = (n == null ? void 0 : n.editableByJsSetting) || {}; - return h(R.Popover, { widget: zn, widgetData: { record: e, column: n }, widgetSetting: { widgetSetting: o, formSetting: r }, widgetContainerProps: { title: n != null && n.title ? `${n.title} - 编辑` : "编辑", width: 260, zIndex: 1050, arrow: !0, ...a }, children: h("td", { className: j("ff-data-list-cell-editable", t), ...i }) }); - } - return h("td", { className: t, ...i }); -}, zn = ({ record: t, column: e, $close: n, $setting: i }) => { - const r = H(Nr(w.get(t, e == null ? void 0 : e.dataIndex))), { listCode: o, onClickCallback: a } = de(oe), [s] = re.useForm(), { formSetting: l, widgetSetting: c } = i, { primaryKey: u = "id", help: p, validators: m } = l || {}, g = () => { - s.setFieldsValue({ value: w.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); - }; - return vt(() => g(), [t, e == null ? void 0 : e.dataIndex, o]), h(te, { actions: A(x.Fragment, { children: [h(R, { size: "small", onClick: g, children: "重置" }), A(Mt.Compact, { block: !0, children: [h(R, { size: "small", widget: n, children: "取消" }), h(R, { type: "primary", size: "small", widget: () => s.validateFields().then(({ value: f }) => { - const y = w.get(t, u.substring(u.indexOf(".") + 1)); - if (!y) throw "获取更新主键失败!"; - z.put(`/api/${o}-storeBy-${e == null ? void 0 : e.uuid}/${y}`, { value: f }).msg(() => a(2, t)).then(n); - }).catch(console.warn), children: "保存" })] })] }), children: A(re, { form: s, children: [h(nn, { label: "", code: "value", type: r.current, widget: e == null ? void 0 : e.editableByJs, help: p, extras: c, validators: m }), h(Xt, { noStyle: !0, name: ["__PROPS__"], children: () => { - } })] }) }); -}; -zn.displayName = "DataListCellEditableContainer"; -const ir = (t) => function(e) { - return t(e, getRecord()); -}, rr = async ({ widgetByJs: t, widgetByJsSetting: e }) => { - const n = await ne.getWidgetComponent(t).then((i) => i.default || ((r) => r)); - return function(i) { - return h(n, { value: i, $setting: e }); - }; -}, or = (t, e = {}) => B(() => { - var n; - return (n = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : n.map(({ widgetByJs: i, widgetByJsSetting: r, middlewares: o, ...a }, s) => { - const l = (c) => ({ record: c, column: a }); - return o || (o = []), i && o.push([rr, { widgetByJs: i, widgetByJsSetting: r }]), o.length > 0 ? (a != null && a.render && o.push([ir, a.render]), { ...a, onCell: l, render: (c, u) => new bt(o).toRender(c, u, "-") }) : { ...a, onCell: l }; - }); -}, [t, e]), ar = (t = {}) => B(() => { - var e; - return t.body ?? (t.body = { cell: Sn }), (e = t.body).cell ?? (e.cell = Sn), t; -}, [t]), Po = (t) => { - const [e, n] = L({}); - return W(() => { - let i = !1; - return t && z.get(`/api/_/${t}`).then((r) => w.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig", "selectionType"])).then((r) => !i && n(r)), () => i = !0; - }, [t]), e; -}, vo = (t, e = {}) => { - const [n, i] = L({ dataSource: [] }); - return pt(() => { - let r = !1; - return t && z.get(`/api/${t}/${z.encode({ page: 1, ...e })}`).then((o) => !r && i(o)), () => r = !0; - }, [t, e]), n; -}, Un = (t = [], e = /* @__PURE__ */ new Map(), n = "id", i) => { - const r = J(i ? (o) => w.get(o, n, w.get(o, [i, n])) : (o) => w.get(o, n), [n, i]); - return J((o) => t == null ? void 0 : t.filter((a) => !a.uuid || !e.has(a.uuid) || e.get(a.uuid).some((s) => s == r(o))), [t, e, r]); -}, Bt = (t = [], e = /* @__PURE__ */ new Map(), n = [], i = "id", r) => { - const o = J(r ? (a) => w.get(a, i, w.get(a, [r, i])) : (a) => w.get(a, i), [i, r]); - return B(() => { - if (w.isEmpty(t) || !t.some(({ uuid: s }) => Mn.check(s))) return !1; - if (w.isEmpty(e) || w.isEmpty(n)) return !0; - const a = n.map((s) => o(s)); - return t.some(({ uuid: s }) => !s || !e.has(s) || e.get(s).some((l) => a.some((c) => c == l))); - }, [t, n, e, o]); -}, sr = (t, e, n = "id", i = null) => { - const r = Pt(), o = H(!1), a = H(t.dataSource), s = H(t.itemOperationsAccess); - return W(() => (a.current = t.dataSource, s.current = t.itemOperationsAccess, () => o.current = !1), [t.dataSource, t.itemOperationsAccess]), o.current && (t.dataSource = a.current, t.itemOperationsAccess = s.current), [t, (l = 0, c = null) => { - var u, p; - if (o.current = !1, l === 1) return (u = t.onReload) == null ? void 0 : u.call(t); - 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(([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, { ...k, children: E }]] } } } : { $splice: [[y, 1, { ...k, children: E }]] }); - const S = new Map(b); - s.current.forEach(($, F) => { - var I; - (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(() => { - o.current = !0, r(); - }); - } - }]; -}, 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: 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(() => { - o.current = [], t && a(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: 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: 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: 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 })] })] }); -}, en = (t = [], e, n = null) => { - var i; - return (i = w.sortBy(t, ["y", "x"])) == null ? void 0 : i.map(({ i: r, x: o, y: a, w: s, h: l, field: { boxStyle: c, ...u } = {} }, p) => h("div", { className: "grid-layout-item", style: Bn(o, a, s, l, c), children: h(e, { ...u, basicForm: n }) }, r ?? p)); -}, Bn = (t, e, n, i, r = {}, o = 0) => { - const a = { "--grid-layout-h": `${i}`, "--grid-layout-w": `${n}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; - return r != null && r.autoHeight ? a.height = "fit-content" : a["--grid-layout-row"] = `${i}`, r != null && r.alignItems && (a["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (a["--grid-layout-box-justify-content"] = r.justifyContent), a["--grid-layout-box-margin"] = xn(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), a["--grid-layout-box-padding"] = xn(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), o && (a.height = `${o}px`), a; -}, xn = (t, e, n, i) => `${t || 0}px ${e || 0}px ${n || 0}px ${i || 0}px`, No = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, Wn = (t) => Object.keys(t).reduce((e, n) => (/^on[A-Z]/.test(n) && (e[n] = t[n]), e), {}), qn = ({ className: t, isConditionFormLayout: 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: 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 }); - }, [JSON.stringify([c, u])]), h("div", { className: j("ff-data-list-filter", l.filter, t), children: h(ft, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((m = n.fields) == null ? void 0 : m.length) > 1 ? (f) => a({ [n.resource]: f[n.resource] }, f.keyword) : () => { - }, onValuesChange: (f) => { - w.isEmpty(w.omit(f, ["keyword"])) || p.submit(); - }, children: ((g = n.fields) == null ? void 0 : g.length) > 1 ? h(rn, { ...n, children: h(pr, { onReset: () => { - const { keyword: f, condition: y } = s("init") || {}; - p.setFieldsValue({ keyword: f, ...y }); - } }) }) : h("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: h("div", { className: "grid-layout-item", style: Bn(20, 0, 5, 2), children: h(ft.Item, { name: ["keyword"], children: h(Mi.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => o(f) }) }) }) }) }) }); -}, pr = ({ cols: t, fields: e, onReset: n }) => { - const [i, r] = L(!1), o = B(() => e == null ? void 0 : e.toReversed().some((a) => a.y > 1 || a.x + a.w >= t - 5), [t, e]); - return A(ft.Item, { label: " ", style: { "--item-span": 5 }, className: j("ff-data-list-filter-actions", { expanded: i }), children: [h(wt, { onClick: n, children: "重置" }), h(wt, { type: "primary", htmlType: "submit", children: "查询" }), o && h(R.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((a) => !a), type: "primary", name: i ? "关闭" : "展开", icon: i ? "icon-up" : "icon-down", iconPosition: "end" })] }); -}; -qn.reservedFields = [{ x: 0, y: 0, h: 3, w: 5, field: { isVirtual: !0, widgetPrefix: "@pkg/ff/grid-layout-forms", widget: "Input", code: "keyword", label: "关键字", placeholder: "多关键字 | 分割", extras: { prefix: "icon-search" } } }]; -const gr = ({ className: t, operations: e, isOperations: n, isPaginate: i }) => { - const { onPageChange: r, onPageSizeChange: o, onClickCallback: a, getBase62params: s } = x.useContext(oe), { total: l, page: c, pageSize: u } = (s == null ? void 0 : s()) || {}; - return n && !w.isEmpty(e) || i ? A("div", { className: j("ff-data-list-footer", t), children: [h("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, m) => h(R, { 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, onAfterClick: (g) => g !== !1 && (a == null ? void 0 : a(p.isRefresh, null)) }, p.uuid || m)) }), i && h(Di, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${c} 页 / 总共 ${p} 条`, onChange: r, onShowSizeChange: o })] }) : null; -}, hr = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: h("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], mr = ({ className: t, width: e = 280, isTreeSider: n }) => { - const { classNames: i } = de(oe); - return n ? h(zi.DirectoryTree, { className: j("ff-data-list-sider", i.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: hr }) : null; -}, 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: 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 }; - 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]; - q[ae] = (ht) => x.cloneElement(K, ht); - } - } else q[ae] = () => h(x.Fragment, {}); - return q; - }, [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: 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; -const he = class he { - constructor() { - v(this, $e, null); - v(this, De, /* @__PURE__ */ new Map()); - v(this, xt, () => { - if (d(this, $e)) return d(this, $e).port.postMessage({ command: "status", data: [] }); - _(this, $e, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), d(this, $e).port.onmessage = (e) => { - var n, i; - (n = e.data) != null && n.uuid ? d(this, De).forEach((r, o) => { - var a; - (r == "*" || (a = r == null ? void 0 : r.includes) != null && a.call(r, e.data.uuid)) && o(e.data); - }) : ((i = e.data) == null ? void 0 : i.readyState) == WebSocket.CLOSED && z.get("/api/user-api-token").then(({ token: r, expire_at: o }) => { - d(this, $e).port.postMessage({ command: "initWs", data: [`ws${w.trimStart(z.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); - }); - }, d(this, $e).port.postMessage({ command: "status", data: [] }); - }); - O(this, "subscribe", (e, n = []) => (n ? Array.isArray(n) && n.length == 0 ? n = "*" : Array.isArray(n) || (n = [n].flat()) : n = "*", d(this, De).set(e, n), d(this, De).size == 1 && d(this, xt).call(this), () => this.unsubscribe(e))); - O(this, "unsubscribe", (e) => d(this, De).delete(e)); - if (d(he, Re)) return d(he, Re); - } -}; -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: 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]); - const [un, Ci] = Vi([], { defaultValue: X ?? [], value: U }), [pn, ki] = L([]), gn = J(() => D ? pn : K, [D, pn, K]), Si = Bt(g, ht, K, p), xi = Bt(m); - W(() => { - let Q = null; - return t && z.get(`/api/_/${t}`).resp(({ data: Ae, res: Ot }) => { - Ae != null && Ae.isDynamicRefresh && (Q = Kn.subscribe(() => Tt(), Ot)), V(Ae); - }).catch(() => V({})), () => Q == null ? void 0 : Q(); - }, [t]), x.useImperativeHandle(c, () => ({ onReload: Tt, onClickCallback: dn, getSelectedRows: gn })); - const hn = wn((Q, Ae) => { - ki((Ot) => { - 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({}, 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 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 && S.observe(p.current), () => { - p.current && S.unobserve(p.current); - }; - }, []); - const k = B(() => { - if (!(f != null && f.width) || !(n != null && n.length)) return n; - 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(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 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: [] }); - return W(() => { - t && z.get(`/api/_/${t}`).then(({ uuid: i, code: r, name: o, resource: a, primaryKey: s, marginX: l, marginY: c, cols: u, rowHeight: p, fields: m, theme: g, themeSetting: f, groups: y }) => ({ uuid: i, code: r, name: o, resource: a, primaryKey: s, marginX: l, marginY: c, cols: u, rowHeight: p, theme: g, themeProps: f, groups: y, items: m })).then(n); - }, [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, k) => { - if (!s.current) return; - const b = w.get(y, t); - w.isEqual(b, p) || m(ce(b, o)); - }), [p]), W(() => { - n == "javascript" && e ? Be.exec(e, {}, { getFieldValueForBasicForm: (f) => a ? a.getFieldValue(f) : l.getFieldValue(f), getFieldValue: (f) => l.getFieldValue(f) }).then((f) => m(ce(f, o))).catch((f) => notification.error({ message: `布局数据错误: ${JSON.stringify(f)}` })).finally(() => s.current = !0) : (e && m(ce(e ?? l.getFieldValue(t), o)), s.current = !0); - }, [e, n]), pt(() => { - s.current && i && new bt([i, r]).toValue(p, l.getFieldsValue(!0)).then(u).catch((f) => { - u(f), console.error("布局数据转换错误: ", f, i); - }); - }, [p, i, r]), [c ?? p, p]; -}, 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, 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)); - }); - }, [t, f, a, n, i]), W(() => () => l.current = !1, []), t ? [o ? ce(u, o) : u, m] : [o ? ce(e, o) : e, null]; -}, Sr = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: n, ...i }) => { - const r = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [o, a] = L(); - return W(() => { - 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), 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(); - W(() => { - t ? ne.getWidgetComponent(t).then((m) => { - if (!(m != null && m.default)) throw "not found"; - return m; - }).catch((m) => ({ default: () => `${t} ${m}` })).then((m) => u(x.createElement(m.default, {}))) : u(null); - }, [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: 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: 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: k, themeProps: b = {}, groups: E = [{ key: "default", label: "默认" }], rowSelection: S }) => { - const { classNames: $ } = de(oe), F = J((N) => { - 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]))); - }, [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, ...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, {}); - return h(te, { children: h(tn, { listCode: t, base62params: z.decode(n) }) }); -}, Ro = () => h(Xn, {}), Xn = () => "Empty", Pr = ({ component: t, $setting: e, $props: n }) => { - const [i, r] = L(), [o, a] = ni(n); - return W(() => { - if (!t) return r(h(Xn, { description: null })); - ne.getWidgetComponent(t).catch((s) => ({ default: () => `${s}` })).then((s) => x.createElement(s.default, { $setting: e })).then(r); - }, [t]), i ? x.cloneElement(i, { ...o, $setProps: a }) : null; -}, Fo = () => "NotFoundPage"; -var Fe, le, je, ye, it, rt; -const me = class me { - constructor() { - v(this, le, /* @__PURE__ */ new Map()); - v(this, je, {}); - v(this, ye, null); - O(this, "init", (e, n) => { - _(this, le, e), _(this, je, n); - }); - O(this, "get", (e) => (d(this, le).has(e) || (e = Array.from(d(this, le).keys()).find((n) => d(this, le).get(n).uri === e)), d(this, le).get(e) || {})); - O(this, "redirect", (e, n, i = {}) => { - var f; - const { uri: r, type: o, widgetProps: a } = this.get(e) || {}, { router: s, query: l, ...c } = n || {}, u = Object.assign({}, c, s), p = Object.assign({}, c, l); - o == "list" && (u.base62params = z.encode(u != null && u.base62params ? u.base62params : u)); - let m = Hi(r || e, u); - const g = new URLSearchParams(); - for (const y in a || {}) ((f = a[y]) == null ? void 0 : f.type) == "query" && Object.has(p, y) && g.append(y, JSON.stringify(p[y])); - return g.size > 0 && (m = `${m}?${g.toString()}`), i != null && i.isOpenWindow ? window.open(m) : d(this, ye).navigate(m, { replace: !!(i != null && i.isReplaceRouteHistory) }); - }); - O(this, "getMenus", (e) => { - var n; - return ((n = d(this, je)) == null ? void 0 : n[e]) || []; - }); - O(this, "findMenuPathByUuid", (e) => { - let n = []; - for (const i in d(this, je)) if (n = d(this, it).call(this, d(this, je)[i], e, [i]), n.length > 1) return n; - return n; - }); - O(this, "getMenusByRouteUuid", (e) => d(this, rt).call(this, e, Object.values(d(this, je)).flat())); - v(this, it, (e, n, i = []) => { - if (w.isEmpty(e)) return i; - for (const { uuid: r, children: o } of e) { - if (r == n) return i.concat(r); - if (!w.isEmpty(o)) return i.concat(r, d(this, it).call(this, o, n)); - } - return i; - }); - v(this, rt, (e, n) => { - var r; - let i = []; - for (const o of n) o.widgetType == "redirect" && (o.uuid == e || o.widget == e ? i.push(o) : (r = o.children) != null && r.length && (i = i.concat(d(this, rt).call(this, e, o.children)))); - return i; - }); - O(this, "getCurrentMenu", () => { - const { uuid: e } = this.getCurrentRoute() || {}; - if (!e) return; - const n = this.getMenusByRouteUuid(e); - return w.isEmpty(n) ? void 0 : n[0]; - }); - O(this, "getCurrentRoute", (e = 0) => { - var i; - const n = (i = d(this, ye).state.matches[d(this, ye).state.matches.length - 1 - e]) == null ? void 0 : i.route; - if (!n) return null; - for (let [r, o] of d(this, le)) if (o.uri === n.path) return o; - return null; - }); - O(this, "getPageParams", (e) => { - var a, s; - const { location: n = {}, matches: i = [] } = ((a = d(this, ye)) == null ? void 0 : a.state) || {}, r = { ...((s = i[i.length - 1]) == null ? void 0 : s.params) || {} }, o = n.search; - return o && new URLSearchParams(o).forEach((l, c) => { - r[c] = l; - }), e ? w.get(r, e) : r; - }); - O(this, "usePageParams", (e) => { - var i; - let n = An() ? { ...Ji(), ...Object.fromEntries(new URLSearchParams(((i = Gi()) == null ? void 0 : i.search) ?? "")) } : this.getPageParams(); - return e ? w.get(n, e) : n; - }); - O(this, "createBrowserRouter", (e = {}) => { - if (d(this, le).size == 0) return null; - 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: k, extra: b }) => { - let E = {}, S = 0; - switch (p) { - case "list": - E.element = x.createElement($r, { component: m, $props: f }); - break; - case "fsdpf-component": - E.element = x.createElement(Pr, { key: c, component: m, $setting: g, $props: f }); - } - const $ = (b == null ? void 0 : b.theme) ?? (b == null ? void 0 : b.layout); - 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 }] }]; - S = r[$]; - } - 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)); - }); - if (d(me, Fe)) return d(me, Fe); - } -}; -Fe = new WeakMap(), le = new WeakMap(), je = new WeakMap(), ye = new WeakMap(), it = new WeakMap(), rt = new WeakMap(), v(me, Fe, null), O(me, "getInstance", () => (d(me, Fe) || _(me, Fe, new me()), d(me, Fe))); -let qt = me; -const vr = ({ to: t, replace: e }) => An() ? x.createElement(Xi, { to: t, replace: e }) : (window.document.location = t, "redirect"), ke = qt.getInstance(); -Qt.chainableTypes = [Ii]; -const Be = Qt.getInstance(new URL("/ff-worker-pipe/worker.js", self.location), { type: "module" }); -Qt.fns = { http: Object.fromEntries(["get", "post", "put", "del", "list", "decode", "encode", "cache", "refreshCache"].map((t) => [t, (...e) => z[t](...e)])), generateUUID: () => Fr(), user: { logout: () => ne.logout(() => window.location.replace(Ue.get("Common.WEBSITE_LOGIN_PAGE", "/index"))), getUserInfo: (t = !0) => ne.getUserInfo(t), checkUserToken: () => ne.checkUserToken(), getUserToken: () => ne.getUserToken() }, getConfigure: (t) => Ue.get(t), route: Object.fromEntries(["redirect", "getPageParams", "getCurrentRoute", "get", "getMenus", "findMenuPathByUuid"].map((t) => [t, (...e) => ke[t](...e)])), popup: Object.fromEntries(["notification", "success", "error", "form", "modal", "confirm"].map((t) => [t, (...e) => Se[t](...e)])) }; -const En = { 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) => { - switch (`${t}`.toLowerCase()) { - case "0": - case "false": - case "[]": - case "{}": - return !1; - } - return !!t; -}, string2string: (t) => t, json2json: (t) => t, json2array: (t) => t ? Object.values(t) : [], json2number: (t) => Object.keys(t).length, json2integer: (t) => Object.keys(t).length, json2float: (t) => Object.keys(t).length, json2bool: (t) => Object.keys(t).length > 0, json2string: (t) => t ? JSON.stringify(t) : "", array2json: (t) => ({ ...t }), array2array: (t) => t, array2number: (t) => t.length, array2integer: (t) => t.length, array2float: (t) => t.length, array2bool: (t) => t.length > 0, array2string: (t) => JSON.stringify(t), number2json: (t) => ({}), number2array: (t) => [t], number2number: (t) => t, number2integer: (t) => t, number2float: (t) => t, number2bool: (t) => !!t, number2string: (t) => t.toString(), boolean2json: (t) => ({}), boolean2array: (t) => [], boolean2number: (t) => +t, boolean2integer: (t) => +t, boolean2float: (t) => +t, boolean2bool: (t) => t, boolean2string: (t) => t ? "true" : "false" }, ce = (t, e) => { - let n = "string"; - n = Array.isArray(t) ? "array" : typeof t, w.isObject(t) && (n = "json"); - const i = `${n}2${e}`; - return Reflect.has(En, i) ? En[i](t) : t; -}, Nr = (t) => t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "json" : typeof t == "boolean" ? "bool" : typeof t == "string" ? "string" : typeof t == "number" ? Number.isInteger(t) ? "integer" : "float" : typeof t, $t = (t = {}, e = {}, n = {}, i = "") => Qn(t, (r, o) => o === "type" && r === "code") ? Zn(t, e, n, i) : ei(t, e, i), Qn = (t, e = () => !1) => w.some(t, (n) => !!w.some(n, e) || (w.isEmpty(n) || !w.isPlainObject(n) && !w.isArray(n) ? void 0 : Qn(n, e))), Zn = async (t = {}, e = {}, n = {}, i = "") => { - let r = /* @__PURE__ */ Object.create(null); - for (let o in t) { - let a; - if (Reflect.has(t[o], "type") && ["code", "field", "router", "query", "string"].includes(t[o].type)) { - const { type: s, value: l = "", default: c = i } = t[o]; - switch (s) { - case "code": - try { - a = await Be.exec(l, e, n); - } catch (u) { - console.error("getWidgetPropsData", u); - } - break; - case "field": - a = w.get(e, l) ?? w.get(e, l.substring(l.indexOf(".") + 1)); - break; - case "router": - case "query": - a = ke.getPageParams(l); - break; - case "string": - a = l; - } - a ?? (a = c); - } else a = await Zn(t[o], e, n, i); - w.set(r, o, a); - } - return r; -}, ei = (t = {}, e = {}, n = "") => Object.keys(t || {}).reduce((i, r) => { - if (w.isPlainObject(t[r])) { - let o; - if (Reflect.has(t[r], "type") && ["field", "router", "query", "string"].includes(t[r].type)) { - const { type: a, value: s = "", default: l = n } = t[r]; - switch (a) { - case "field": - o = w.get(e, s) ?? w.get(e, s.substring(s.indexOf(".") + 1)); - break; - case "router": - case "query": - o = ke.getPageParams(s); - break; - case "string": - o = s; - } - o ?? (o = l); - } else o = ei(t[r], e, n); - w.set(i, r, o); - } - return i; -}, {}), Ft = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((n) => Ft(n, e)) : Object.keys(t).reduce((n, i) => (e[i] ? n[e[i]] = Ft(t[i], e) : n[i] = Ft(t[i], e), n), {}) : t, jo = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { - const e = 16 * Math.random() | 0; - return (t === "x" ? e : 3 & e | 8).toString(16); -}), Io = (t) => { - var e, n; - return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.name : ""; -}, Ao = (t) => { - var e, n; - return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.category : ""; -}, Lo = (t) => { - var e, n; - return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.owner : ""; -}, Tr = (t, e = 32, n = "auto") => { - const i = _t(t), r = n === "auto" ? "x64" : n; - if (e === 32) return Rt.x86.hash32(i).toString(); - if (e === 128) return r === "x64" ? Rt.x64.hash128(i) : Rt.x86.hash128(i); - throw new Error("bits 只能是 32 或 128"); -}, _t = (t) => t == null ? "null" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "function" ? t.toString() : Array.isArray(t) ? "[" + t.map(_t).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${_t(t[e])}`).join(",") + "}" : String(t), Or = () => { - let t = 1; - const e = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map(); - return (...i) => i.length === 0 ? "" : i.map((r) => { - return String((o = r) === null || typeof o != "object" && typeof o != "function" ? (n.has(o) || n.set(o, t++), n.get(o)) : (e.has(o) || e.set(o, t++), e.get(o))); - var o; - }).join("::"); -}, Rr = (t) => { - if (!t || typeof t != "string" || t.startsWith("/") || t.startsWith("./") || t.startsWith("../")) return !1; - try { - let e = t.startsWith("//") ? `http:${t}` : t; - return e.includes("://") || e.startsWith("//") || (e = `http://${e}`), !!new URL(e).hostname; - } catch { - return !1; - } -}, Vo = (t, e = "") => { - if (!t || typeof t != "string" || Rr(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; -}, Fr = () => 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); -}), Pt = () => { - const t = H(!0), [, e] = x.useReducer((n) => n + 1, 0); - return W(() => () => t.current = !1, []), () => t.current && e(); -}, Mo = (t) => { - const [e, n] = L(t), i = H(null), r = J((o, a) => { - i.current = a, n(o); - }, []); - return W(() => { - i.current && (i.current(e), i.current = null); - }, [e]), [e, r]; -}, pt = (t = (i) => { -}, e, n = w.isEqual) => { - const i = x.useRef(); - n(e, i.current) || (i.current = w.cloneDeep(e)), x.useEffect(t, [i.current]); -}, vt = pt, ti = (t, e = "string") => { - var n; - if (!Array.isArray(t)) return t; - for (let i = 0; i < t.length; i++) t[i].value = ce((n = t[i]) == null ? void 0 : n.value, e), t[i] && Reflect.has(t[i], "children") && (t[i].children = ti(t[i].children, e)); - return t; -}, Do = (t, e = "json", n = "string", i = null, r = null) => { - const [o] = re.useForm(i), [a, s] = L([{ label: "无", value: "", disabled: !0 }]), l = H([]), c = re.useWatch((u) => l.current.length === 0 ? null : w.pick(u, l.current), o) || null; - return W(() => { - Array.isArray(t) ? s(t) : e === "javascript" && t ? Be.exec(t, {}, { getFieldValue: (u) => (l.current.includes(u) || l.current.push(u), o.getFieldValue(u)), getFieldValueForBasicForm: (u) => (l.current.includes(u) || l.current.push(u), r ? r.getFieldValue(u) : o.getFieldValue(u)) }).then((u) => { - s(ce(u, "array")); - }).catch((u) => console.error("useOptions", u)) : t && s(ce(t, "array")); - }, [t, e, c]), ti(a, n); -}, zo = (t) => { - const [e, n] = L(), i = { type: "GET" }; - if (typeof t == "string" ? i.url = t : w.isPlainObject(t) && Object.assign(i, t), !(i != null && i.url)) throw "url is required"; - const r = (o) => z.request(i, !1).resp((a) => (console.log("useSubscribeRequest", o), n(a), a)); - return pt(() => { - let o = null; - return r().then((a) => { - o = Kn.subscribe(w.throttle(r, 180, { leading: !1, trailing: !0 }), a.res); - }), () => o == null ? void 0 : o(); - }, i), e; -}, jr = (t, e) => J((n) => { - const i = {}; - for (const [r, o] of Object.entries(n)) { - const a = t == null ? void 0 : t[r]; - if ((a == null ? void 0 : a.type) === "router" || (a == null ? void 0 : a.type) === "query") { - const s = ke.getCurrentRoute(); - s != null && s.uuid && ke.redirect(s.uuid, { ...ke.getPageParams(), [a.type]: { [a.value || r]: o } }, { isReplaceRouteHistory: !0 }); - } else i[r] = o; - } - Object.keys(i).length > 0 && e(i); -}, [t, e]), ni = (t, e = {}, n = {}, i = []) => { - const [r, o] = L({}), [a, s] = L({}), l = Fn(a), c = ke.usePageParams(); - Gt(() => { - Promise.resolve($t(t, e, n)).then(s); - }, [t, e, c, ...i]), Yt(() => { - 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 = jr(t, (m) => { - o((g) => ({ ...g, ...m })); - }), p = B(() => Object.fromEntries(Object.entries(r).filter(([m, g]) => g !== a[m])), [r, a]); - return [r, u, p]; -}, 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: 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 ($ = 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) => { - const [c, u] = L([]); - return W(() => { - const p = []; - if (o) { - let m = l; - switch (l) { - case "number": - case "string": - case "array": - break; - case "bool": - m = "boolean"; - break; - case "json": - m = "object"; - } - p.push({ type: m, required: !0, whitespace: !0, message: "该项必填" }); - } - switch (n) { - case "string": - p.push({ type: n, max: t, min: e, message: i || (e && t ? `字符必须在 ${e} ~ ${t} 之间` : `${t ? "最多能有" : "最少要有"} ${e || t} 个字符`) }); - break; - case "pattern": - p.push({ type: "string", pattern: r, message: i }); - break; - case "validator": - a && p.push(({ getFieldValue: m }) => ({ validator: async (g, f) => { - const y = await Be.exec(a, { value: f, fieldName: s }, { getFieldValue: m }); - return w.isString(y) && y ? Promise.reject(y) : w.isBoolean(y) && !y ? Promise.reject(i) : Promise.resolve(); - } })); - } - u(p); - }, [t, e, n, i, r, o, a]), c; -}, Lr = (t, e, n) => { - const [i, r] = L(null); - return W(() => { - const { initDataUri: o = `/api/${t}`, initDataMethod: a = "GET" } = n || {}; - e && z.request({ method: a, url: w.trimEnd(`${o}/${e}`, "/") }).then((s) => { - r(s); - }); - }, [t, e, n]), i; -}, Vr = (t, e, n) => J((i, r = { serialize: (o) => o, onSuccess: () => { -}, onFail: (o) => (o == null ? void 0 : o.errorFields) && Se.error("请先完善表单信息", { duration: 2e3 }) }) => { - const o = i.getFieldValue("__RESOURCE__"), { submitDataUri: a = `/api/${t}`, submitDataMethod: s = "POST" } = n || {}; - return i.validateFields().then((l) => o ? w.pick(l, [o]) : l).then(r.serialize).then((l) => z.request({ method: s, url: w.trimEnd(`${a}/${e || ""}`, "/"), data: l }).msg(r.onSuccess)).catch(r.onFail); -}, [t, e, n]), Mr = (t, e, n, i) => { - const r = Lr(e, n, i); - W(() => { - r ? t.setFieldsValue(r) : t.resetFields(); - }, [t, r]); - const o = Vr(e, n, i); - return w.partial(o, t); -}, Dr = (t, e, n = [], i = {}) => { - const r = H({}), o = H(), a = w.debounce(Pt(), 180), s = ["disabled", "required"], l = (m, g) => { - s.includes(m) && (r.current[m] = g), a(); - }, c = B(() => ({ setDisabled: (m) => l("disabled", m), setRequired: (m) => l("required", m), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [e]), [u, p] = Jn(e, -1, {}, c, i); - if (!p && o.current != u && (u >= 0 || !w.isEmpty(n == null ? void 0 : n[u]))) { - o.current = u; - const { widget: m, widgetPrefix: g, props: f } = n == null ? void 0 : n[u]; - t = Dn(m, g), r.current = w.merge(f, w.pick(r.current, s)); - } - return [t, r.current]; -}, $n = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), Uo = ({ value: t, onChange: e }, n = null) => { - const i = H(), [r] = re.useForm(n), o = H({}); - return vt(() => { - w.isEqual(i.current, t) || r.setFieldsValue(t); - }, [t]), W(() => () => r.resetFields(), []), [B(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (a) => (s) => { - const l = $n(a); - s ? o.current[l] = s : delete o.current[l]; - } }, scrollToField: (a, s = {}) => { - console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); - }, focusField: (a) => { - console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); - }, getFieldInstance: (a) => { - const s = $n(a); - return o.current[s]; - } }, [r]), (a, s) => { - i.current = s, e == null || e(s); - }]; -}, nn = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: n, subWidgets: i = [], basicForm: r, ...o }) => { - const a = Dn(t, e), [s, l] = Dr(a, n, i, r), [c, u] = L(); - return W(() => { - 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: 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: 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 = 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: k, theme: b, themeProps: E = {}, groups: S = [{ key: "default", label: "默认" }], children: $, ...F }) => { - const [I] = re.useForm(e), T = J((P, V) => { - 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: 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)); - })] }); -}, Ur = ({ type: t, initialValue: e, initialValueLanguage: n, onChange: i, basicForm: r }) => { - const [o, a] = Jn(n == "javascript" && e, n == "javascript" ? void 0 : e, {}, {}, r); - return W(() => { - n == "javascript" ? i(ce(o, t)) : e && i(ce(e, t)); - }, [t, e, o]), null; -}; -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: 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 }) }); -}, Pn = /* @__PURE__ */ new Set(), Kt = (t = [], e = 0) => { - const n = t[e]; - if (n.length && !Pn.has(n)) { - const i = document.createElement("script"); - i.setAttribute("src", n), i.setAttribute("data-namespace", n), t.length > e + 1 && (i.onload = () => { - Kt(t, e + 1); - }, i.onerror = () => { - Kt(t, e + 1); - }), Pn.add(n), document.body.appendChild(i); - } -}, Ct = ({ className: t, type: e, style: n = {}, rotate: i, spin: r, twoToneColor: o, compact: a, ...s }) => h("span", { role: "img", className: j("ff-iconfont", a && "ff-iconfont--compact", t), style: n, ...s, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden", ...i != null && { transform: `rotate(${i}deg)` }, ...r && { animation: "ff-iconfont-spin 1s linear infinite" }, ...o && { "--ff-icon-second-color": o } }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); -Ct.propTypes = { className: C.string, type: C.string.isRequired, style: C.object }, Ct.init = Kt; -const Wr = (t, e, n, i) => ke.redirect(n, e, i), qr = (t, e = {}, n, i = {}) => { - var o; - const r = (o = i.router) == null ? void 0 : o.reduce((a, [s, l, c]) => { - const u = w.get(e, ["router", s]); - if (!u && u !== 0 && l) throw `请传入 ${c}`; - return `${a}/${u}`; - }, `/api/${n}`); - return z.del(r, e.param).msg(); -}, vn = (t, e, n, { status: { loading: i, disabled: r }, setStatus: o, listFn: a }) => { - const s = { loading: (l) => l === void 0 ? i : o((c) => ({ ...c, loading: l })), disabled: (l) => l === void 0 ? r : o((c) => ({ ...c, disabled: l })), list: a }; - return w.isFunction(n) ? n.call(null, e, s) : w.isString(n) && n ? Be.exec(n, e, s) : null; -}, Nn = (t, e, n, i, r) => w.isString(n) && n ? ne.getWidgetComponent(n).then(({ default: o }) => Se.modal(o, { ...e, $setting: i }, r != null && r.title ? { ...r, title: w.template(r.title)(t) } : r)).catch((o) => { - Se.error(n, { content: o.toString() }); -}) : Se.modal(n, { ...e, $setting: i }, r != null && r.title ? { ...r, title: w.template(r.title)(t) } : r), _r = (t, e, n, i, r) => Se.modal(ii, { ...e, $setting: i, code: n }, r != null && r.title ? { ...r, title: w.template(r.title)(t) } : r), Kr = (t, e, n, i, r) => Se.modal(tn, { ...i, base62params: e, listCode: n }, r != null && r.title ? { ...r, title: w.template(r.title)(t) } : r), Hr = ({ widget: t, widgetType: e, widgetData: n, widgetProps: i, widgetSetting: r, widgetContainerProps: o }, { onAfterClick: a, onBeforeClick: s } = {}) => { - const l = de(oe), [c, u] = L({ leading: !0, trailing: !1 }), p = H(null), [m, g] = B(() => { - switch (e) { - case "redirect": - return [w.partialRight(Wr, t, r), null]; - case "func": - return [w.partialRight(vn, (r == null ? void 0 : r.code) ?? t, { status: c, setStatus: u, listFn: l }), null]; - case "component": - case "fsdpf-component": - return [w.partialRight(Nn, t, r, o), (y) => ({ $setting: y })]; - case "grid-layout-form": - return [w.partialRight(_r, t, r, o), (y) => ({ $setting: y })]; - case "data-list": - return [w.partialRight(Kr, t, r, o), (y) => y]; - case "destroy": - return [w.partialRight(qr, t, r, o), null]; - default: - if (si(t) || x.isValidElement(t)) return [w.partialRight(Nn, t, r, o), (y) => ({ $setting: y })]; - 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((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); - }, [r, o]), [f, c]; -}, ri = ({ type: t, name: e, className: n, icon: i, iconPosition: r, size: o }, a = "default") => B(() => { - 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"), [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" ? 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(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, { ...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: 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: 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); - }, onConfirm: (K) => { - xe(p, K); - }, onClick: (K) => { - K.stopPropagation(); - }, children: h(qi, { getPopupContainer: (K) => K, ...V, title: U ? null : V == null ? void 0 : V.title, trigger: ["hover", "click"], children: x.cloneElement(P, { loading: ae || m, disabled: q || g }) }) }); -}, R = gt("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 Gr = gt("link"), Yr = gt("circle"), Xr = gt("round"), Qr = gt("dashed"), Tn = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: n = (g, f, y) => { -}, onBeforeClick: i = (g, f, y) => { -}, labelVariant: r = "link", labelSize: o, labelRender: a, btnVariant: s, btnSize: l, btnRender: c = (g, f) => h(R, { ...g, data: f }, g.uuid || Lt()), widgetContainerProps: u = {}, children: p, data: m }) => { - if (w.isEmpty(t)) return p; - l ?? (l = o), s ?? (s = r); - const [g, f] = B(() => (t || []).reduce((b, E) => { - 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 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 }) => { - const [i] = re.useForm(), r = B(() => [{ name: "__PROPS__", value: e }], [e]); - 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 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((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); - }; - return h(ut.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 }) }); -}; -oi.propTypes = { placement: C.oneOf(["center", "left", "top", "right", "bottom"]) }; -const no = ({ widget: t, widgetProps: e, $close: n, onSetProps: i }) => { - const [r, o] = L(e || {}), a = Fn(e); - Gt(() => { - const l = a ?? {}, c = e ?? {}, u = Object.keys({ ...l, ...c }).reduce((p, m) => (l[m] !== c[m] && (p[m] = c[m]), p), {}); - Object.keys(u).length > 0 && o((p) => ({ ...p, ...u })); - }, [e]); - const s = J((l) => { - o((c) => ({ ...c, ...l })), i == null || i(l); - }, [i]); - return x.isValidElement(t) ? x.cloneElement(t, { ...r, $close: n, $setProps: s }) : t != null && t.name || Cn.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === Cn.ForwardRef ? x.createElement(t, { ...r, $close: n, $setProps: s }) : t; -}, Y = () => { - const [t, e] = Fi({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (o) => { - const { offsetHeight: a } = o; - return { height: a }; - }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, n] = x.useReducer((o) => o + 1, 0); - W(() => { - Y.$onClick = i, Y.$queue.forEach(([o, a, s, l]) => { - l == null || l(r([a, s], ...o)); - }), Y.$queue = []; - }, []); - const i = (o, a = {}, s = {}) => { - let l; - const c = new Promise((u, p) => { - l = r([u, p], o, a, s); - }); - return c.update = l, c; - }, r = ([o, a], s, l = {}, c = {}) => { - 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 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] }); -}; -Y.$popups = /* @__PURE__ */ new Map(), Y.$index = 0, Y.$queue = [], Y.$onClick = (...t) => { - const e = new Promise((n, i) => { - Y.$queue.push([t, n, i, (r) => { - e.update = r; - }]); - }); - return e; -}; -const On = (t, e, n = {}) => Y.$onClick(t, e, n), jt = (t, { showProgress: e, duration: n, ...i } = { duration: 1.5 }) => Y.$onClick(Vn, { content: t, ...i }, { showProgress: e, duration: n }), Se = { modal: On, confirm: (t, e = {}) => Y.$onClick(tr, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, n = {}) => On(Zr, { formProps: n, fields: t }, { placement: "center", ...e }).then((i) => { - if (i === !1) throw !1; - return i; -}), notification: jt, success: (t, e = { duration: 1.5 }) => jt(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => jt(t, { ...e, className: "ff-notification-error", icon: "close" }) }; -Xe.configure({ showSpinner: !1 }); -const ai = () => { - const t = window.localStorage.getItem(yt); - return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); -}; -Le.interceptors.request.use((t) => (Object.assign(t.headers, ai()), Xe.inc(), t), (t) => (Xe.done(), Promise.reject({ code: -1, msg: t }))), Le.interceptors.response.use(({ data: t, headers: e }) => (Xe.done(), { ...t, res: e == null ? void 0 : e.res }), function(t) { - return Xe.done(), Promise.reject(t.message); -}), window.addEventListener("unhandledrejection", Vt.onUnhandledRejection), Vt.onMsg = (t, e) => Se[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && ke.redirect(Ue.get("Common.WEBSITE_LOGIN_PAGE"))); -var He, ze, Je; -const Z = class Z { - constructor() { - O(this, "appUrl", ""); - v(this, He, null); - return d(Z, ze) || (_(Z, Je, new Vt()), _(Z, ze, new Proxy(this, { get(e, n) { - if (n in e) { - const i = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), n); - return i != null && i.get ? Reflect.get(e, n, e) : typeof e[n] == "function" ? e[n].bind(e) : e[n]; - } - return d(Z, Je)[n]; - } }))), d(Z, ze); - } - init(e, n, i) { - Le.defaults.baseURL = this.appUrl = i, Le.defaults.timeout = 15e3, d(Z, Je).init(e, n, Le); - } - get driver() { - return Le; - } - get headers() { - return ai(); - } - mock(e = {}) { - return d(this, He) ?? _(this, He, new Ai(Le, { onNoMatch: "passthrough", ...e })); - } - unmock() { - var e; - (e = d(this, He)) == null || e.restore(), _(this, He, null); - } -}; -He = new WeakMap(), ze = new WeakMap(), Je = new WeakMap(), v(Z, ze), v(Z, Je), O(Z, "getInstance", () => d(Z, ze) ?? _(Z, ze, new Z())); -let Ht = Z; -const z = Ht.getInstance(); -class on extends Error { - constructor(e, n) { - super(n), Error.captureStackTrace && Error.captureStackTrace(this, on), !n instanceof Qe && (this.name = `${e} Error Runtime`); - } -} -class Qe extends Error { - constructor(e, ...n) { - super(...n), Error.captureStackTrace && Error.captureStackTrace(this, Qe), this.name = `${e} Not Found`; - } -} -const It = "mine", yt = "token", At = "user-login-intended-url"; -var Ie, Ge, ot; -const fe = class fe { - constructor() { - v(this, Ge, /* @__PURE__ */ new Map()); - v(this, ot, (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)); - O(this, "setPkgVersion", (e) => { - _(this, ot, e); - }); - O(this, "setVendor", (e, n) => d(this, Ge).set(e, new er(n, async (i, r) => { - var a, s; - if (!(i != null && i.default)) throw "@pkg not found"; - let o = () => r; - switch ("function") { - case typeof (o = (a = i.default) == null ? void 0 : a[`./${r}/index.jsx`]): - case typeof (o = (s = i.default) == null ? void 0 : s[`./${r}/index.js`]): - return o(); - } - throw new Qe(r); - }))); - O(this, "getWidgetComponent", async (e) => { - if (!e) throw "getWidgetComponent widget is required"; - if (e != null && e.startsWith("blob:") || e != null && e.startsWith("http:") || e != null && e.startsWith("https:")) return await import(e); - const [, n] = e == null ? void 0 : e.split("@pkg/"); - if (!n) throw new Qe(e); - try { - return d(this, Ge).has("pkg") ? await d(this, Ge).get("pkg").get(n) : await import(`${z.appUrl}/api/pkg-import/web?name=${e}&v=${d(this, ot)}`); - } catch (i) { - throw new on(e, i); - } - }); - O(this, "getRoutes", () => z.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: n, ...i }) => [n, { uuid: n, ...i }])).then((e) => new Map(e))); - O(this, "getMenus", () => z.get("/api/my-menu")); - O(this, "getConfigure", () => z.get("api/init-configure")); - O(this, "getWidgetOperationAuth", () => z.get("/api/init-widget-operation-auth").then((e) => e.reduce((n, { uuid: i, auth: r }) => [...n, [i, r]], []))); - O(this, "getPhoneNumber", (e) => z.get(`/api/user-wx-phone-number/${e}`)); - O(this, "getUserToken", () => { - const e = window.localStorage.getItem(yt); - if (!e) return ""; - const n = e.split("."); - if (!Array.isArray(n) || n.length !== 3) throw "登录令牌无效!"; - const { iat: i } = JSON.parse(window.atob(n[1])); - if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - i > 2592e3) throw "登录令牌已过期, 请重新登录!"; - return e; - }); - O(this, "checkUserToken", () => { - try { - return !!this.getUserToken(); - } catch { - return !1; - } - }); - O(this, "getUserInfo", (e = !0) => { - var n; - try { - const i = this.getUserToken(); - if (!i) return Promise.resolve(null); - const { iat: r } = JSON.parse(window.atob((n = i == null ? void 0 : i.split(".")) == null ? void 0 : n[1])), { iat: o, ...a } = z.decode(window.localStorage.getItem(It) || "", {}); - return o === r ? Promise.resolve(a) : z.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(It, z.encode({ ...s, iat: r })), s)).catch((s) => (console.error(s), e && Se.error("请登录").then(this.logout), null)); - } catch (i) { - console.error(i), e && Se.error("请登录").then(this.logout); - } - return Promise.resolve(null); - }); - O(this, "login", (e, n, i = {}) => z.post("/api/user-token", { username: e, passwd: Li.hash(n), platform: "web", ...i }).then(({ token: r }) => (window.localStorage.setItem(yt, r), r)).then(async (r) => (await this.initAppEnv(), r))); - O(this, "setLoginIntendedUrl", (e) => sessionStorage.setItem(At, e)); - O(this, "getLoginIntendedUrl", (e = !1) => { - const n = sessionStorage.getItem(At); - return e && sessionStorage.removeItem(At), n; - }); - O(this, "logout", (e) => (window.localStorage.removeItem(It), window.localStorage.removeItem(yt), e == null ? void 0 : e())); - O(this, "initAppEnv", async () => { - const [e, n, i, r] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); - return Mn.init(e), Ue.init(r), ke.init(n, i), Ct.init(Ue.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: n, menus: i, configures: r }; - }); - if (d(fe, Ie)) return d(fe, Ie); - } -}; -Ie = new WeakMap(), Ge = new WeakMap(), ot = new WeakMap(), v(fe, Ie, null), O(fe, "getInstance", () => (d(fe, Ie) || _(fe, Ie, new fe()), d(fe, Ie))); -let Jt = fe; -const ne = Jt.getInstance(), Bo = x.createContext({ user: {}, initUser: () => { -}, initUserComplete: !1 }), Wo = x.createContext({ set: () => { -}, get: () => { -}, assign: () => { -}, currentRoute: () => { -} }), si = (t) => { - if (!t) return !1; - if (t.prototype instanceof x.Component || t.$$typeof) return !0; - if (typeof t == "function") { - const e = t.displayName || t.name; - return !e || /^[A-Z]/.test(e); - } - return !1; -}, qo = (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); -}; -var Pe, Ye, ve, we, be, ie, ee, G, Ce, at, st, lt, ct, Et, dt; -const an = class an { - constructor(e, n = "/") { - v(this, Pe, "/"); - v(this, Ye, /* @__PURE__ */ new Set()); - v(this, ve, (e) => { - for (const n of d(this, Ye)) try { - n(e); - } catch (i) { - console.error("Error in VirtualFS event listener:", i); - } - }); - v(this, we, (e) => { - const n = Date.now(); - if (e && (e.lastModified = n), d(this, Pe) != "/") { - const i = d(this, G).call(this, d(this, Pe)); - i && (i.lastModified = n); - } - this.root.lastModified = n; - }); - v(this, be, (e) => { - let n = ue.normalize(e); - return n.startsWith("/") || (n = "/" + n), n.length > 1 && n.endsWith("/") && (n = n.slice(0, -1)), n; - }); - v(this, ie, (e) => { - const n = ue.join(d(this, Pe), e); - return d(this, be).call(this, n); - }); - v(this, ee, (e) => { - if (!e || typeof e != "string") return !1; - const n = d(this, be).call(this, e); - return !n.includes("..") && n.startsWith("/"); - }); - v(this, G, (e) => { - var o; - const n = d(this, be).call(this, e); - if (n === "/") return this.root; - const i = n.split("/").filter((a) => a); - let r = this.root; - for (const a of i) { - if (r.type !== "dir") return null; - const s = (o = r.children) == null ? void 0 : o.find((l) => l.name === a); - if (!s) return null; - r = s; - } - return r; - }); - v(this, Ce, (e) => { - const n = d(this, be).call(this, e), i = ue.basename(n), r = ue.dirname(n); - return { parent: d(this, G).call(this, r), name: i }; - }); - v(this, at, (e, n, i) => i === !1 ? e : i === "root" ? e.map((r) => ue.join(n, r)) : i === !0 || i === "working" ? e.map((r) => ue.relative(d(this, Pe), ue.join(n, r))) : e); - v(this, st, async (e, n, i, r = "") => { - const o = [], a = d(this, G).call(this, e); - if (!a || a.type !== "dir") return o; - const s = a.children; - for (const l of s) { - const c = l.name, u = e === "/" ? `/${c}` : `${e}/${c}`, p = r ? `${r}/${c}` : c; - try { - if (l.type === "file") n(i ? p : c) && o.push(p); - else if (l.type === "dir" && i) { - const m = await d(this, st).call(this, u, n, i, p); - o.push(...m); - } - } catch { - continue; - } - } - return o; - }); - v(this, lt, async (e, n, i, r = "") => { - const o = [], a = Array.isArray(n) ? n : [n], s = d(this, G).call(this, e); - if (!s || s.type !== "dir") return o; - if (!i) { - for (const c of a) if (d(this, ct).call(this, c)) { - const u = await d(this, Et).call(this, e, c); - o.push(...u); - } else { - const u = ue.join(e, c), p = d(this, be).call(this, u); - d(this, G).call(this, p) && o.push(c); - } - return o; - } - const l = s.children; - for (const c of l) { - const u = c.name, p = e === "/" ? `/${u}` : `${e}/${u}`, m = r ? `${r}/${u}` : u; - try { - if (c.type === "file") for (const g of a) { - let f = !1; - if (f = d(this, ct).call(this, g) ? d(this, dt).call(this, u, g) : u === g, f) { - o.push(m); - break; - } - } - else if (c.type === "dir") { - const g = await d(this, lt).call(this, p, n, i, m); - o.push(...g); - } - } catch { - continue; - } - } - return o; - }); - v(this, ct, (e) => /[*?[\]{}]/.test(e)); - v(this, Et, async (e, n) => { - const i = [], r = d(this, G).call(this, e); - if (!r || r.type !== "dir") return i; - const o = r.children.map((a) => a.name); - for (const a of o) d(this, dt).call(this, a, n) && i.push(a); - return i; - }); - v(this, dt, (e, n) => { - const i = n.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (r, o) => "(" + o.split(",").join("|") + ")"); - return new RegExp(`^${i}$`).test(e); - }); - var i, r, o; - _(this, Pe, n), this.root = { name: "/", type: "dir", children: [], lastModified: Date.now() }, Array.isArray(e) ? this.root.children = e : e && typeof e == "object" && (e.name && e.name !== "/" ? this.root.children.push(e) : (this.root = e, (i = this.root).name ?? (i.name = "/"), (r = this.root).children ?? (r.children = []), (o = this.root).lastModified ?? (o.lastModified = Date.now()))); - } - async stat(e) { - const n = d(this, ie).call(this, e); - if (!d(this, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const i = d(this, G).call(this, n); - if (!i) throw new Error(`ENOENT: no such file or directory, stat '${e}'`); - return { isFile: () => i.type === "file", isDirectory: () => i.type === "dir", lastModified: i.lastModified }; - } - async dir(e) { - const n = d(this, ie).call(this, e); - if (!d(this, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const i = d(this, G).call(this, n); - if (!i) throw new Error(`ENOENT: no such file or directory, scandir '${e}'`); - if (i.type !== "dir") throw new Error(`ENOTDIR: not a directory, scandir '${e}'`); - return i.children.map((r) => r.name); - } - async readFile(e) { - const n = d(this, ie).call(this, e); - if (!d(this, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const i = d(this, G).call(this, n); - if (!i) throw new Error(`ENOENT: no such file or directory, open '${e}'`); - if (i.type !== "file") throw new Error("EISDIR: illegal operation on a directory, read"); - return i.content || ""; - } - async writeFile(e, n) { - const i = d(this, ie).call(this, e); - if (!d(this, ee).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: r, name: o } = d(this, Ce).call(this, i); - if (!r) throw new Error(`ENOENT: no such file or directory, open '${e}'`); - if (r.type !== "dir") throw new Error("ENOTDIR: not a directory"); - const a = r.children.findIndex((c) => c.name === o), s = a >= 0, l = { name: o, type: "file", content: n, lastModified: Date.now() }; - s ? r.children[a] = l : r.children.push(l), d(this, we).call(this, r), d(this, ve).call(this, { action: s ? "update" : "create", path: i, type: "file", timestamp: Date.now() }); - } - async mkdir(e, n = {}) { - const i = d(this, ie).call(this, e); - if (!d(this, ee).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const { recursive: r } = n; - if (r) { - const o = i.split("/").filter((s) => s); - let a = "/"; - for (const s of o) - if (a = ue.join(a, s), !d(this, G).call(this, a)) { - const { parent: l, name: c } = d(this, Ce).call(this, a); - if (l && l.type === "dir") { - const u = { name: c, type: "dir", children: [], lastModified: Date.now() }; - l.children.push(u), d(this, we).call(this, l), d(this, ve).call(this, { action: "create", path: d(this, be).call(this, a), type: "dir", timestamp: Date.now() }); - } - } - } else { - const { parent: o, name: a } = d(this, Ce).call(this, i); - if (!o) throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`); - if (o.type !== "dir") throw new Error("ENOTDIR: not a directory"); - if (o.children.find((l) => l.name === a)) throw new Error(`EEXIST: file already exists, mkdir '${e}'`); - const s = { name: a, type: "dir", children: [], lastModified: Date.now() }; - o.children.push(s), d(this, we).call(this, o), d(this, ve).call(this, { action: "create", path: i, type: "dir", timestamp: Date.now() }); - } - } - async unlink(e) { - const n = d(this, ie).call(this, e); - if (!d(this, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: i, name: r } = d(this, Ce).call(this, n); - if (!i) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); - const o = i.children.findIndex((a) => a.name === r); - if (o < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); - if (i.children[o].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); - i.children.splice(o, 1), d(this, we).call(this, i), d(this, ve).call(this, { action: "delete", path: n, type: "file", timestamp: Date.now() }); - } - async rmdir(e, n = {}) { - const i = d(this, ie).call(this, e); - if (!d(this, ee).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: r, name: o } = d(this, Ce).call(this, i); - if (!r) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const a = r.children.findIndex((l) => l.name === o); - if (a < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const s = r.children[a]; - if (s.type !== "dir") throw new Error(`ENOTDIR: not a directory, rmdir '${e}'`); - if (!n.recursive && s.children.length > 0) throw new Error(`ENOTEMPTY: directory not empty, rmdir '${e}'`); - r.children.splice(a, 1), d(this, we).call(this, r), d(this, ve).call(this, { action: "delete", path: i, type: "dir", timestamp: Date.now() }); - } - async rename(e, n) { - const i = d(this, ie).call(this, e), r = d(this, ie).call(this, n); - if (!d(this, ee).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - if (!d(this, ee).call(this, r)) throw new Error(`EINVAL: invalid path '${n}'`); - if (!d(this, G).call(this, i)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${n}'`); - const { parent: o, name: a } = d(this, Ce).call(this, i), { parent: s, name: l } = d(this, Ce).call(this, r); - if (!s) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${n}'`); - if (d(this, G).call(this, r)) throw new Error(`EEXIST: file already exists, rename '${e}' -> '${n}'`); - const c = o.children.findIndex((p) => p.name === a), u = { ...o.children[c], name: l, lastModified: Date.now() }; - o.children.splice(c, 1), s.children.push(u), d(this, we).call(this, o), o !== s && d(this, we).call(this, s), d(this, ve).call(this, { action: "rename", path: r, oldPath: i, type: u.type, timestamp: Date.now() }); - } - async exists(e) { - const n = d(this, ie).call(this, e); - return d(this, ee).call(this, n) ? d(this, G).call(this, n) !== null : !1; - } - getLastModified() { - return this.root.lastModified; - } - subscribe(e) { - if (typeof e != "function") throw new Error("Callback must be a function"); - return d(this, Ye).add(e), () => { - d(this, Ye).delete(e); - }; - } - getWorkingDirectory() { - return d(this, Pe); - } - scope(e = "/") { - const n = d(this, be).call(this, e); - if (!d(this, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const i = d(this, G).call(this, n); - if (!i) throw new Error(`ENOENT: no such file or directory '${e}'`); - if (i.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); - return i.children ?? (i.children = []), i.lastModified ?? (i.lastModified = Date.now()), new an(this.root, n); - } - async findFiles(e, n, i = {}) { - const r = d(this, ie).call(this, e); - if (!d(this, ee).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); - const o = d(this, G).call(this, r); - if (!o) throw new Error(`ENOENT: no such file or directory '${e}'`); - if (o.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); - const { recursive: a = !1, fullPath: s = !1 } = i; - if (typeof n == "function") { - const c = await d(this, st).call(this, r, n, a); - return d(this, at).call(this, c, r, s); - } - const l = await d(this, lt).call(this, r, n, a); - return d(this, at).call(this, l, r, s); - } -}; -Pe = new WeakMap(), Ye = new WeakMap(), ve = new WeakMap(), we = new WeakMap(), be = new WeakMap(), ie = new WeakMap(), ee = new WeakMap(), G = new WeakMap(), Ce = new WeakMap(), at = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), Et = new WeakMap(), dt = new WeakMap(); -let Rn = an; -const io = async (t, e = "/", n = "") => { - try { - const i = await t.stat(e), r = e === "/" ? "/" : ue.basename(e), o = { title: r, key: n ? `${n}${e}` : e, isLeaf: i.isFile() }; - if (i.isDirectory()) { - const a = await t.dir(e); - if (a.length > 0) { - o.children = []; - const s = [], l = []; - for (const c of a) { - const u = e === "/" ? `/${c}` : `${e}/${c}`; - try { - (await t.stat(u)).isDirectory() ? s.push(c) : l.push(c); - } catch (p) { - console.warn(`Failed to stat ${u}:`, p.message); - } - } - s.sort(), l.sort(); - for (const c of [...s, ...l]) { - const u = e === "/" ? `/${c}` : `${e}/${c}`; - try { - const p = await io(t, u, n); - o.children.push(p); - } catch (p) { - console.warn(`Failed to process ${u}:`, p.message); - } - } - } - } - return o; - } catch { - return null; - } -}; -export { - Vo as $, - ar as A, - Po as B, - vo as C, - bt as D, - Un as E, - Bt as F, - Oo as G, - br as H, - sr as I, - lr as J, - $r as K, - Pr as L, - Ro as M, - Fo as N, - ce as O, - Nr as P, - $t as Q, - Kn as R, - Qn as S, - Ft as T, - jo as U, - Io as V, - Ao as W, - Lo as X, - Tr as Y, - Or as Z, - Rr as _, - Dn as a, - Fr as a0, - Pt as a1, - Mo as a2, - pt as a3, - vt as a4, - Do as a5, - zo as a6, - jr as a7, - ni as a8, - Br as a9, - er as aA, - Ue as aB, - Be as aC, - ke as aD, - Bo as aE, - Wo as aF, - Rn as aG, - io as aH, - no as aI, - rn as aa, - nn as ab, - ii as ac, - Ir as ad, - Ar as ae, - Lr as af, - Vr as ag, - Mr as ah, - Dr as ai, - Uo as aj, - Ct as ak, - R as al, - Mn as am, - Hr as an, - te as ao, - ut as ap, - Ln as aq, - Y as ar, - Se as as, - xo as at, - Eo as au, - $o as av, - ne as aw, - si as ax, - qo as ay, - z as az, - Bn as b, - No as c, - Wn as d, - en as e, - Hn as f, - nr as g, - Yn as h, - Sr as i, - Gn as j, - kr as k, - To as l, - Jn as m, - _n as n, - qn as o, - fr as p, - mr as q, - gr as r, - tn as s, - oe as t, - Cr as u, - wr as v, - Er as w, - cr as x, - ur as y, - or as z -}; diff --git a/dist/components.d.ts b/dist/components.d.ts index e1330e8..5c7d110 100644 --- a/dist/components.d.ts +++ b/dist/components.d.ts @@ -47,6 +47,42 @@ declare function SetPropsWrapper({ widget, widgetProps: externalProps, $close, o onSetProps?: (patch: any) => void; }): Function | React__default.ReactElement>; +/** + * 通用错误边界组件 + * @param {Object} props + * @param {*} props.children + * @param {ReactNode|((error: Error, reset: () => void) => ReactNode)} [props.fallback] + * 错误时的 UI。函数形式可接收 error 和 reset,不传则显示错误字符串。 + * @param {Function} [props.onError] 错误回调 (error, info) => void + * @param {Function} [props.onReset] 重置回调 () => void + * @param {any[]} [props.resetKeys] 任一值变化时自动重置(类似 react-error-boundary) + */ +declare class ErrorBoundary extends React__default.Component { + static getDerivedStateFromError(error: any): { + error: any; + }; + constructor(props: any); + constructor(props: any, context: any); + state: { + error: any; + }; + componentDidCatch(error: any, info: any): void; + componentDidUpdate(prevProps: any): void; + reset: () => void; + render(): any; +} + +/** + * 按组件名动态加载并渲染组件 + * @param {string} [props.widget] 组件名(@pkg/xxx 格式) + * @param {Object} [props.widgetSetting] 传给目标组件的 $setting + * @param {Object} [props.widgetProps] props 来源配置(经 useWidgetProps 解析) + * @param {*} [props.fallback] Suspense fallback,不传则为 null + * @param {ReactNode|((error, reset) => ReactNode)} [props.fallbackOnError] ErrorBoundary 错误时的 UI + * @param {Function} [props.onError] 错误回调 (error, info) => void + */ +declare function ImportWidgetComponent({ widget, widgetSetting, widgetProps, fallback, fallbackOnError, onError }?: string): React__default.JSX.Element; + /** 空状态占位组件 */ declare function Empty(): React__default.JSX.Element; @@ -112,4 +148,4 @@ declare function success(content: any, opts?: any): Promise; */ declare function error(content: any, opts?: any): Promise; -export { Empty, Iconfont as Icon, Loading, NotFound, FFPopup as Popup, SetPropsWrapper }; +export { Empty, ErrorBoundary, Iconfont as Icon, ImportWidgetComponent, Loading, NotFound, FFPopup as Popup, SetPropsWrapper }; diff --git a/dist/components.js b/dist/components.js index 8f8cf39..d3d9500 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,9 +1,11 @@ -import { at as s, ak as p, au as r, av as t, as as e, aI as n } from "./common/main-Dryw40ez.js"; +import { at as r, aJ as s, ak as p, aK as t, au as n, av as e, as as d, aI as m } from "./common/main-DCysVEHh.js"; export { - s as Empty, + r as Empty, + s as ErrorBoundary, p as Icon, - r as Loading, - t as NotFound, - e as Popup, - n as SetPropsWrapper + t as ImportWidgetComponent, + n as Loading, + e as NotFound, + d as Popup, + m as SetPropsWrapper }; diff --git a/dist/container.js b/dist/container.js index 43097ca..f06abb3 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-Dryw40ez.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-DCysVEHh.js"; export { s as Context, e as Empty, diff --git a/dist/data-converter.js b/dist/data-converter.js index 7c6d968..2f1a2fe 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-Dryw40ez.js"; +import { D as i } from "./common/main-DCysVEHh.js"; import "react-use"; export { i as default diff --git a/dist/data-list.js b/dist/data-list.js index e2a3ab1..86927ca 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-Dryw40ez.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-DCysVEHh.js"; export { t as DataListContent, e as DataListContext, diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index 3f50df2..5f721b7 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-Dryw40ez.js"; +import { f as a } from "../common/main-DCysVEHh.js"; export { a as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index fcf5f7a..36fb54f 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-Dryw40ez.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-DCysVEHh.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 8b05565..71ffe72 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-Dryw40ez.js"; +import { a as o, g } from "../common/main-DCysVEHh.js"; export { o as getNormalizeWidget, g as getOptionItemByValue diff --git a/dist/grid-layout.js b/dist/grid-layout.js index 22a7df8..a60a953 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-Dryw40ez.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-DCysVEHh.js"; export { u as GridLayout, e as GridLayoutFramework, diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index 8b482a8..fa0895c 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-Dryw40ez.js"; +import { b as a, d as o, e as s, c as g } from "../common/main-DCysVEHh.js"; export { a as getBoxStyle, o as getEventProps, diff --git a/dist/hooks.js b/dist/hooks.js index 2ea8c14..e798554 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-Dryw40ez.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-DCysVEHh.js"; import { default as b } from "rc-util/lib/hooks/useMergedState"; import { a as x } from "./common/vender-CIG7ep61.js"; export { diff --git a/dist/iconfont.js b/dist/iconfont.js index 988c9f8..3921deb 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-Dryw40ez.js"; +import { ak as a } from "./common/main-DCysVEHh.js"; export { a as default }; diff --git a/dist/index.js b/dist/index.js index b72b068..5701862 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-Dryw40ez.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-DCysVEHh.js"; export { t as AppContext, e as AppGlobalParamsContext, diff --git a/dist/pages.js b/dist/pages.js index cb0a421..ff30e3a 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-Dryw40ez.js"; +import { L as t, K as e, M as o, N as g } from "./common/main-DCysVEHh.js"; export { t as CustomPage, e as DataListPage, diff --git a/dist/res-ws.js b/dist/res-ws.js index 184fd2c..8e684a8 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-Dryw40ez.js"; +import { R as a } from "./common/main-DCysVEHh.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index f553a5e..e046a03 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-Dryw40ez.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-DCysVEHh.js"; import "./common/vender-CIG7ep61.js"; export { r as deepSome, diff --git a/dist/virtual-fs.js b/dist/virtual-fs.js index 05ddef5..b77f7b3 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-Dryw40ez.js"; +import { aG as o, aH as r } from "./common/main-DCysVEHh.js"; export { o as default, r as toTreePaths diff --git a/package.json b/package.json index 158ce72..3341ba6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.7.9", + "version": "0.7.10", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js",