diff --git a/dist/button.js b/dist/button.js index abba377..c810bc4 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-DcQsUE57.js"; +import { am as s, al as u, an as e } from "./common/main-DsRa-iMx.js"; export { s as auth, u as default, diff --git a/dist/common/main-DcQsUE57.js b/dist/common/main-DcQsUE57.js deleted file mode 100644 index c99ef93..0000000 --- a/dist/common/main-DcQsUE57.js +++ /dev/null @@ -1,1569 +0,0 @@ -var Tn = Object.defineProperty; -var fr = (t) => { - throw TypeError(t); -}; -var On = (t, e, r) => e in t ? Tn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; -var O = (t, e, r) => On(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), q = (t, e, r, n) => (yr(t, e, "write to private field"), n ? n.call(t, r) : e.set(t, r), r); -import { jsx as h, jsxs as I } from "react/jsx-runtime"; -import x, { useEffect as W, useState as L, useCallback as J, useRef as H, useContext as pe, useMemo as U, useId as Vt, isValidElement as Rn, useLayoutEffect as Fn } from "react"; -import ge 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 Xt, usePrevious as Fr } from "react-use"; -import oe, { Field as Qt, FieldContext as jr } from "rc-field-form"; -import { _ as wr, C as Qe, L as In, M as Ft, N as Xe, b as Ve, o as Dt, c as Ln, S as Vn } from "./vender-C5RbewOc.js"; -import Dn from "rc-util/lib/hooks/useMergedState"; -import Ar from "immutability-helper"; -import { Space as Mt, Form as yt, Input as Mn, Button as bt, Pagination as zn, Tree as Bn, Breadcrumb as Un, Empty as zt, Table as br, Popover as Wn, Popconfirm as _n, Tooltip as qn, Divider as Kn } from "antd"; -import { useMergedState as Hn } from "rc-util"; -import { generatePath as Jn, useInRouterContext as Ir, useParams as Gn, useLocation as Yn, createBrowserRouter as Xn, Navigate as Qn } from "react-router-dom"; -import Zn from "rc-drawer"; -import ei from "rc-dialog"; -import * as Cr from "react-is"; -var We, et, _e, Ee, De, Me; -class Lr { - constructor(e, r) { - v(this, We, /* @__PURE__ */ new Map()); - v(this, et, !0); - v(this, _e, []); - v(this, Ee); - v(this, De, () => d(this, Ee)); - v(this, Me, () => Promise.resolve()); - O(this, "get", (...e) => new Promise((r, n) => { - const i = JSON.stringify(e); - if (d(this, We).has(i)) return r(d(this, Me).call(this, d(this, Ee), ...e)); - if (d(this, Ee) === void 0) d(this, _e).push([e, r, n]), d(this, et) && (q(this, et, !1), Promise.resolve(typeof d(this, De) == "function" ? d(this, De).call(this) : d(this, De)).then((o) => q(this, Ee, o || null)).finally(() => { - d(this, _e).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, _e).length = 0; - })); - else { - const o = d(this, Me).call(this, d(this, Ee), ...e); - d(this, We).set(i, o), r(o); - } - })); - q(this, Me, r), q(this, De, e); - } -} -We = new WeakMap(), et = new WeakMap(), _e = new WeakMap(), Ee = new WeakMap(), De = new WeakMap(), Me = new WeakMap(); -const $o = () => h("div", { children: "Empty" }), pt = x.createContext({ ele: {}, mount: () => { -}, unmount: () => { -} }), re = ({ rootClassName: t, className: e, children: r, actions: n, title: i, subTitle: o, extras: a, style: s = {} }) => { - const { mount: l, unmount: c } = x.useContext(pt); - return re.Action({ children: n }), re.Title({ children: i }), re.SubTitle({ children: o }), re.Extra({ children: a }), W(() => (l("rootClassName", t), () => c(t)), [t]), h("div", { className: j("ff-container", e), style: s, children: r }); -}, ft = (t) => ({ children: e, className: r }) => { - const { mount: n, unmount: i } = x.useContext(pt); - return W(() => (e && n(t, x.createElement("div", { key: `ff-${t}`, className: j(`ff-popup-${t}`, r) }, e)), () => i(t)), [r, e]), null; -}; -re.Action = ft("actions"), re.Title = ft("title"), re.SubTitle = ft("sub-title"), re.Extra = ft("extras"), re.propTypes = { className: C.string, style: C.object, title: C.any, subTitle: C.any, actions: C.any, extras: C.any }; -const vo = () => h(re, { className: "ff-loading", children: I("div", { className: "loader", children: [I("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), I("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), I("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), I("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] })] }) }), No = () => h("div", { children: "NotFound" }), Vr = ({ children: t }) => { - const [e, r] = L({}), n = J((o, a) => r((s) => ({ ...s, [o]: a })), []), i = J((o) => r((a) => ({ ...a, [o]: void 0 })), []); - return typeof (t == null ? void 0 : t.type) == "string" ? t : h(pt.Provider, { value: { ele: e, mount: n, unmount: i }, children: x.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); -}; -Vr.propTypes = { children: C.element.isRequired }; -const Sr = { 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: (Sr[t] || Sr.info).map((r, n) => h("path", { d: r }, n)) }) }), Dr = ({ className: t, content: e, icon: r, $close: n }) => I(x.Fragment, { children: [r && h("div", { className: j("ff-notification-icon", t), children: h(Zt, { type: r }) }), e] }), ti = ({}) => h(re, { children: "Confirm" }); -var Te, qe; -const he = class he { - constructor() { - v(this, qe, /* @__PURE__ */ new Map()); - O(this, "init", (e) => q(this, qe, new Map(e))); - O(this, "check", (e) => !d(this, qe).has(e) || d(this, qe).get(e)); - if (d(he, Te)) return d(he, Te); - } -}; -Te = new WeakMap(), qe = new WeakMap(), v(he, Te, null), O(he, "getInstance", () => (d(he, Te) || q(he, Te, new he()), d(he, Te))); -let Bt = he; -const Mr = Bt.getInstance(), ri = (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]: a } = t[o], s = ri(a, e, r); - if (!w.isEmpty(s)) return s; - } - return {}; -}, zr = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; -var Oe, tt; -const me = class me { - constructor() { - v(this, tt, null); - O(this, "init", (e) => q(this, tt, e)); - O(this, "get", (e, r) => w.get(d(this, tt), e, r)); - if (d(me, Oe)) return d(me, Oe); - } -}; -Oe = new WeakMap(), tt = new WeakMap(), v(me, Oe, null), O(me, "getInstance", () => (d(me, Oe) || q(me, Oe, new me()), d(me, Oe))); -let Ut = me; -const Ue = Ut.getInstance(); -var Ke, kt, rt, nt, xt; -const Ne = class Ne { - constructor(...e) { - v(this, rt, []); - v(this, nt, (e) => { - var r; - for (let n of e) Array.isArray(n[0]) ? d(this, nt).call(this, n) : d(this, rt).push(d(r = Ne, kt).call(r, n[0], n[1])); - }); - O(this, "toValue", async (e, r = null) => { - const n = { getValue: () => e, getRecord: () => r }; - let i = e; - for (const o of d(this, rt)) try { - const a = await o; - if (typeof a != "function") { - console.warn("middleware is not a function, skip:", a); - continue; - } - i = await a.call(n, i); - } catch (a) { - console.error("middleware error, skip:", a); - } - return i; - }); - O(this, "toRender", (e, r, n = null) => x.createElement(d(this, xt), { value: e, record: r }, n)); - v(this, xt, ({ value: e, record: r, children: n }) => { - const [i, o] = L(n), a = An(); - return Yt(() => { - o(n), this.toValue(e, r).then((s) => a() && o(s)).catch((s) => a() && o(`${s}`)); - }, [e, r]), i; - }); - d(this, nt).call(this, e); - } -}; -Ke = new WeakMap(), kt = new WeakMap(), rt = new WeakMap(), nt = new WeakMap(), xt = new WeakMap(), v(Ne, Ke, null), v(Ne, kt, w.memoize((e, r) => { - if (typeof e == "function") return e(r); - if (typeof e == "string") return ae.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, Ke) || q(Ne, Ke, Oi()), d(r = Ne, Ke).call(r, ...e); -})); -let Ct = Ne; -const se = x.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { -}, getSelectedRows: () => [], onReload: () => { -}, onClickCallback: () => { -}, onConditionChange: () => { -}, onTabChange: () => { -}, onSiderChange: () => { -}, onKeywordChange: () => { -}, onPageChange: () => { -}, onPageSizeChange: () => { -}, reload: () => { -}, setPage: () => { -}, setPageSize: () => { -}, setTab: () => { -}, setSider: () => { -}, setKeyword: () => { -}, setCondition: () => { -} }), kr = ({ className: t, record: e, column: r, ...n }) => { - if (r != null && r.editableByJs && (r != null && r.uuid)) { - const { formSetting: i = { primaryKey: "id" }, widgetSetting: o = {}, widgetContainerSetting: a = {} } = (r == null ? void 0 : r.editableByJsSetting) || {}; - return h(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, ...a }, children: h("td", { className: j("ff-data-list-cell-editable", t), ...n }) }); - } - return h("td", { className: t, ...n }); -}, Br = ({ record: t, column: e, $close: r, $setting: n }) => { - const i = H(Ni(w.get(t, e == null ? void 0 : e.dataIndex))), { listCode: o, onClickCallback: a } = pe(se), [s] = oe.useForm(), { formSetting: l, widgetSetting: c } = n, { primaryKey: u = "id", help: p, validators: m } = l || {}, g = () => { - s.setFieldsValue({ value: w.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); - }; - return Nt(() => g(), [t, e == null ? void 0 : e.dataIndex, o]), h(re, { actions: I(x.Fragment, { children: [h(R, { size: "small", onClick: g, children: "重置" }), I(Mt.Compact, { block: !0, children: [h(R, { size: "small", widget: r, 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(r); - }).catch(console.warn), children: "保存" })] })] }), children: I(oe, { form: s, children: [h(rr, { label: "", code: "value", type: i.current, widget: e == null ? void 0 : e.editableByJs, help: p, extras: c, validators: m }), h(Qt, { noStyle: !0, name: ["__PROPS__"], children: () => { - } })] }) }); -}; -Br.displayName = "DataListCellEditableContainer"; -const ni = (t) => function(e) { - return t(e, getRecord()); -}, ii = async ({ widgetByJs: t, widgetByJsSetting: e }) => { - const r = await ae.getWidgetComponent(t).then((n) => n.default || ((i) => i)); - return function(n) { - return h(r, { value: n, $setting: e }); - }; -}, oi = (t, e = {}) => U(() => { - var r; - return (r = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : r.map(({ widgetByJs: n, widgetByJsSetting: i, middlewares: o, ...a }, s) => { - const l = (c) => ({ record: c, column: a }); - return o || (o = []), n && o.push([ii, { widgetByJs: n, widgetByJsSetting: i }]), o.length > 0 ? (a != null && a.render && o.push([ni, a.render]), { ...a, onCell: l, render: (c, u) => new Ct(o).toRender(c, u, "-") }) : { ...a, onCell: l }; - }); -}, [t, e]), ai = (t = {}) => U(() => { - var e; - return t.body ?? (t.body = { cell: kr }), (e = t.body).cell ?? (e.cell = kr), t; -}, [t]), To = (t) => { - const [e, r] = L({}); - return W(() => { - let n = !1; - return t && z.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; -}, Oo = (t, e = {}) => { - const [r, n] = L({ dataSource: [] }); - return gt(() => { - let i = !1; - return t && z.get(`/api/${t}/${z.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 = J(n ? (o) => w.get(o, r, w.get(o, [n, r])) : (o) => w.get(o, r), [r, n]); - return J((o) => t == null ? void 0 : t.filter((a) => !a.uuid || !e.has(a.uuid) || e.get(a.uuid).some((s) => s == i(o))), [t, e, i]); -}, Wt = (t = [], e = /* @__PURE__ */ new Map(), r = [], n = "id", i) => { - const o = J(i ? (a) => w.get(a, n, w.get(a, [i, n])) : (a) => w.get(a, n), [n, i]); - return U(() => { - if (w.isEmpty(t) || !t.some(({ uuid: s }) => Mr.check(s))) return !1; - if (w.isEmpty(e) || w.isEmpty(r)) return !0; - const a = r.map((s) => o(s)); - return t.some(({ uuid: s }) => !s || !e.has(s) || e.get(s).some((l) => a.some((c) => c == l))); - }, [t, r, e, o]); -}, si = (t, e, r = "id", n = null) => { - const i = vt(), 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, r, w.get(c, [n, r], "")), f = w.findIndex(a.current, ["__PARENT_ID__", m]), y = w.findIndex(f > -1 ? w.get(a.current, [f, "children"]) : a.current, [r, 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 = Ar(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((P, F) => { - var A; - (A = S.get(F)) != null && A.some((T) => T == g) || s.current.set(F, P.filter((T) => T !== g)); - }), S.forEach((P, F) => { - s.current.has(F) ? s.current.set(F, w.uniq([...s.current.get(F) || [], ...P])) : s.current.set(F, P); - }); - }).then(() => { - o.current = !0, i(); - }); - } - }]; -}, li = (t, e) => { - const r = vt(), n = H(e), i = H(/* @__PURE__ */ new Map()), o = H([]), a = w.throttle((l) => { - o.current = [], z.list(t, w.pick({ ...n.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 }) => { - n.current = { tab: m, 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 }); - Nt(() => { - o.current = [], t && a(e); - }, [t, e]); - const s = U(() => w.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword", "primaryKey"]), [n.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: Ar(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => a({ sider: l, page: 1 }), onKeywordChange: (l) => a({ keyword: l, page: 1 }), itemOperationsAccess: i.current, dataSource: o.current, onReload: a, payload: e == null ? void 0 : e.payload }); -}, ci = ({ listCode: t, className: e, layouts: r = {}, dataSource: n, isPaginate: i, 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: P, onClickCallback: F } = pe(se), A = w.pick(f, ["column", "colWidth", "beforeRender", "afterRender", "style", "itemMargin", "containerPadding"]), T = f == null ? void 0 : f.isMarkSelected, N = Ur(l, c, p, u), D = J(($, V, M) => h(di, { isMarkSelected: T, className: j("ff-data-list-framework-item", P == null ? void 0 : P.item), operations: o ? N(V) : [], data: u ? { [u]: V } : V, children: $, onClickCallback: F }), [T, u, p, o, F, l, c]); - return I("div", { className: j("ff-data-list-framework", e), children: [h(r.sider, { isTreeSider: b, ...E }), I("div", { className: j("ff-data-list-container", P == null ? void 0 : P.container), children: [h(r.filter, { isConditionFormLayout: k }), h(r.toolbar, { title: m, tabs: y }), h(Ei, { ...g, ...A, rowSelection: S, empty: h(r.empty, { className: P == null ? void 0 : P.empty }), primaryKey: p, itemRender: D, dataSource: n }), h(r.footer, { isPaginate: i, isOperations: a, operations: s })] })] }); -}, di = ({ className: t, operations: e, children: r, data: n, onClickCallback: i, onSelect: o, isMarkSelected: a, isSelected: s, selectionType: l }) => I("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: r }), !!(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: n, confirm: c.confirm, onAfterClick: (u) => u !== !1 && (i == null ? void 0 : i(c.isRefresh, n)) }, c.uuid || Vt()) }, (c == null ? void 0 : c.uuid) || Vt())) })] }), ui = ({ listCode: t, className: e, layouts: r = {}, dataSource: n, columns: i, 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: P, onClickCallback: F } = pe(se), A = Ur(l, c, p, u), T = Wt(l, c, n, p, u); - return I("div", { className: j("ff-data-table-framework", e), children: [h(r.sider, { isTreeSider: k, ...b }), I("div", { className: j("ff-data-table-container", P == null ? void 0 : P.container), children: [h(r.filter, { isConditionFormLayout: E }), h(r.toolbar, { title: m, tabs: g }), h(wi, { ...S, primaryKey: p, className: "ff-data-table-content", columns: i, dataSource: n, rowSelection: y, operationRender: T ? (N) => { - var D; - return h("div", { className: "ff-data-table-actions", children: (D = A(N)) == null ? void 0 : D.map(($, V) => h(R, { size: "small", uuid: $.uuid, type: $.type, name: $.name, widget: $.widget, widgetType: $.widgetType, widgetProps: $.widgetProps, widgetData: $.widgetData, widgetSetting: $.widgetSetting, widgetContainerProps: $.widgetContainerSetting, data: N, confirm: $.confirm, onAfterClick: (M) => M !== !1 && (F == null ? void 0 : F($.isRefresh, N)) }, $.uuid || V)) }); - } : null }), h(r.footer, { isPaginate: f, isOperations: a, operations: s })] })] }); -}, er = (t = [], e, r = null) => { - var n; - return (n = w.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i, x: o, y: a, w: s, h: l, field: { boxStyle: c, ...u } = {} }, p) => h("div", { className: "grid-layout-item", style: Wr(o, a, s, l, c), children: h(e, { ...u, basicForm: r }) }, i ?? p)); -}, Wr = (t, e, r, n, i = {}, o = 0) => { - const a = { "--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 ? a.height = "fit-content" : a["--grid-layout-row"] = `${n}`, i != null && i.alignItems && (a["--grid-layout-box-align-items"] = i.alignItems), i != null && i.justifyContent && (a["--grid-layout-box-justify-content"] = i.justifyContent), a["--grid-layout-box-margin"] = xr(i == null ? void 0 : i.marginTop, i == null ? void 0 : i.marginRight, i == null ? void 0 : i.marginBottom, i == null ? void 0 : i.marginLeft), a["--grid-layout-box-padding"] = xr(i == null ? void 0 : i.paddingTop, i == null ? void 0 : i.paddingRight, i == null ? void 0 : i.paddingBottom, i == null ? void 0 : i.paddingLeft), o && (a.height = `${o}px`), a; -}, xr = (t, e, r, n) => `${t || 0}px ${e || 0}px ${r || 0}px ${n || 0}px`, Ro = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, _r = (t) => Object.keys(t).reduce((e, r) => (/^on[A-Z]/.test(r) && (e[r] = t[r]), e), {}), qr = ({ className: t, isConditionFormLayout: e }) => { - var m, g; - const [r, n] = L({}), { listCode: i, onKeywordChange: o, onConditionChange: a, getBase62params: s, classNames: l } = x.useContext(se), { keyword: c, condition: u } = (s == null ? void 0 : s()) || {}, [p] = yt.useForm(); - return W(() => { - i && e && z.get(`/api/_/${i}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: k, rowHeight: b, cols: E, fields: S }) => { - n({ resource: f, itemMargin: [y, k], rowHeight: b, cols: E, fields: S }); - }).catch(() => n({})); - }, [i, e]), W(() => { - p.setFieldsValue({ keyword: c, ...u }); - }, [JSON.stringify([c, u])]), h("div", { className: j("ff-data-list-filter", l.filter, t), children: h(yt, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((m = r.fields) == null ? void 0 : m.length) > 1 ? (f) => a({ [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 ? h(nr, { ...r, children: h(pi, { 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: Wr(20, 0, 5, 2), children: h(yt.Item, { name: ["keyword"], children: h(Mn.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => o(f) }) }) }) }) }) }); -}, pi = ({ cols: t, fields: e, onReset: r }) => { - const [n, i] = L(!1), o = U(() => e == null ? void 0 : e.toReversed().some((a) => a.y > 1 || a.x + a.w >= t - 5), [t, e]); - return I(yt.Item, { label: " ", style: { "--item-span": 5 }, className: j("ff-data-list-filter-actions", { expanded: n }), children: [h(bt, { onClick: r, children: "重置" }), h(bt, { type: "primary", htmlType: "submit", children: "查询" }), o && h(R.Link, { className: "ff-data-list-filter-expanded-button", widget: () => i((a) => !a), 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 gi = ({ className: t, operations: e, isOperations: r, isPaginate: n }) => { - const { onPageChange: i, onPageSizeChange: o, onClickCallback: a, getBase62params: s } = x.useContext(se), { total: l, page: c, pageSize: u } = (s == null ? void 0 : s()) || {}; - return r && !w.isEmpty(e) || n ? I("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)) }), n && h(zn, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${c} 页 / 总共 ${p} 条`, onChange: i, onShowSizeChange: o })] }) : null; -}, hi = [{ 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" }] }] }], mi = ({ className: t, width: e = 280, isTreeSider: r }) => { - const { classNames: n } = pe(se); - return r ? h(Bn.DirectoryTree, { className: j("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: hi }) : null; -}, fi = ({ className: t, title: e, tabs: r }) => { - const { getBase62params: n, onTabChange: i, onReload: o, classNames: a } = pe(se), { tab: s } = (n == null ? void 0 : n()) || {}, [l, c] = Hn((r == null ? void 0 : r[0].value) ?? (r == null ? void 0 : r[0].code), { value: s, onChange: i }); - return I("div", { className: j("ff-data-list-toolbar", a.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(Un, { 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: r }), I("div", { className: "ff-data-list-actions", children: [h(R.Link, { icon: "icon-reload", widget: () => o() }), h(R.Link, { icon: "icon-setting" })] })] }); -}, yi = ({ className: t, ...e }) => h(zt, { className: j(t, "ff-data-list-empty"), image: zt.PRESENTED_IMAGE_SIMPLE, ...e }), Kr = ({ isItemGridLayout: t, theme: e, themeProps: r, onClickCallback: n, onReload: i, 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: P = {}, payload: F = {}, dataSource: A = [], rowSelection: T, getSelectedRows: N, primaryKey: D, ...$ }) => { - const [V, M] = L(), B = N ?? (() => A), X = J((_, le) => { - const K = { tab: p, page: s, pageSize: c, keyword: g, sider: b, condition: y, total: a, payload: F }; - return _ && _ != "init" ? w.get(K, _, le) : K; - }, [JSON.stringify(y), JSON.stringify(F), p, s, c, g, b, a]), xe = U(() => { - let _ = { sider: mi, filter: qr, footer: gi, toolbar: fi, empty: yi }; - S === !1 ? _ = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : w.isPlainObject(S) && (_ = Object.assign({}, _, S)); - for (const le in _) if (_[le]) { - if (Rn(_[le])) { - const K = _[le]; - _[le] = (mt) => x.cloneElement(K, mt); - } - } else _[le] = () => h(x.Fragment, {}); - return _; - }, [S]); - return W(() => { - e ? ae.getWidgetComponent(e).then((_) => { - if (!_) throw `${e} not found`; - return _; - }).catch((_) => ({ default: () => `${_}` })).then((_) => M(x.createElement(_.default, { ...$, layouts: xe, $setting: r }))) : M(h(t ? ci : ui, { ...$, layouts: xe, $setting: r })); - }, [e, r]), h(se.Provider, { value: { classNames: P, listCode: o, onClickCallback: n, onReload: i, 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: B }, children: V && x.cloneElement(V, { dataSource: A, primaryKey: D, rowSelection: T, ...$ }) }); -}; -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, Pe, ze, Et; -const fe = class fe { - constructor() { - v(this, Pe, null); - v(this, ze, /* @__PURE__ */ new Map()); - v(this, Et, () => { - if (d(this, Pe)) return d(this, Pe).port.postMessage({ command: "status", data: [] }); - q(this, Pe, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), d(this, Pe).port.onmessage = (e) => { - var r, n; - (r = e.data) != null && r.uuid ? d(this, ze).forEach((i, o) => { - var a; - (i == "*" || (a = i == null ? void 0 : i.includes) != null && a.call(i, e.data.uuid)) && o(e.data); - }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && z.get("/api/user-api-token").then(({ token: i, expire_at: o }) => { - d(this, Pe).port.postMessage({ command: "initWs", data: [`ws${w.trimStart(z.appUrl, "http")}api/user-resource-status-ws?token=${i}`] }); - }); - }, d(this, Pe).port.postMessage({ command: "status", data: [] }); - }); - O(this, "subscribe", (e, r = []) => (r ? Array.isArray(r) && r.length == 0 ? r = "*" : Array.isArray(r) || (r = [r].flat()) : r = "*", d(this, ze).set(e, r), d(this, ze).size == 1 && d(this, Et).call(this), () => this.unsubscribe(e))); - O(this, "unsubscribe", (e) => d(this, ze).delete(e)); - if (d(fe, Re)) return d(fe, Re); - } -}; -Re = new WeakMap(), Pe = new WeakMap(), ze = new WeakMap(), Et = new WeakMap(), v(fe, Re, null), O(fe, "getInstance", () => (d(fe, Re) || q(fe, Re, new fe()), d(fe, Re))); -let _t = fe; -const Hr = _t.getInstance(), tr = x.forwardRef(({ listCode: t, base62params: e, className: r, theme: n, themeProps: i, 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: P, itemGridLayout: { themeConfig: F, ...A } = {}, title: T, isPaginate: N, tabs: D, selectionType: $ }, V] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: M = $, selectedRowKeys: B, defaultSelectedRowKeys: X, onChange: xe, ..._ } = s ?? {}, le = li(t, e), [{ dataSource: K, itemOperationsAccess: mt, condition: cn, tab: dn, keyword: un, page: sr, total: lr, pageSize: cr, sider: pn, onConditionChange: gn, onTabChange: hn, onKeywordChange: mn, onPageChange: fn, onPageSizeChange: yn, onSiderChange: wn, onReload: Ot, payload: bn }, dr] = si(le, t, p, u), Cn = wr(l); - Xt(() => { - Cn(K, { primaryKey: p, page: sr, pageSize: cr, total: lr }); - }, [K]); - const [ur, Sn] = Dn([], { defaultValue: X ?? [], value: B }), [pr, kn] = L([]), gr = J(() => M ? pr : K, [M, pr, K]), xn = Wt(g, mt, K, p), En = Wt(m); - W(() => { - let Q = null; - return t && z.get(`/api/_/${t}`).resp(({ data: Le, res: Rt }) => { - Le != null && Le.isDynamicRefresh && (Q = Hr.subscribe(() => Ot(), Rt)), V(Le); - }).catch(() => V({})), () => Q == null ? void 0 : Q(); - }, [t]), x.useImperativeHandle(c, () => ({ onReload: Ot, onClickCallback: dr, getSelectedRows: gr })); - const hr = wr((Q, Le) => { - kn((Rt) => { - const mr = new Map(Rt.map((ce) => [ce == null ? void 0 : ce[p], ce])); - return Le.forEach((ce) => mr.set(ce == null ? void 0 : ce[p], ce)), Q.map((ce) => mr.get(ce)).filter(Boolean); - }), Sn(Q), xe == null || xe(Q, Le); - }), Pn = U(() => M ? { columnWidth: 80, ..._, type: M, selectedRowKeys: ur, onChange: hr } : void 0, [M, ur, hr, s]), $n = U(() => w.merge({}, S, i), [S, i]), vn = U(() => 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]), Nn = U(() => ({ ...A, themeProps: F }), [A, F]); - return h(Kr, { listCode: t, title: T, classNames: a, layouts: o, resource: u, primaryKey: p, theme: n || E, themeProps: $n, isTreeSider: k, treeSiderConfig: b, isPaginate: N, rowSelection: Pn, getSelectedRows: gr, tabs: D, isItemOperations: xn, itemOperations: vn, isBatchOperations: En, batchOperations: m, isItemGridLayout: P, columns: f, itemGridLayout: Nn, isConditionFormLayout: y, itemOperationsAccess: mt, dataSource: K, onConditionChange: gn, onTabChange: hn, onKeywordChange: mn, onPageChange: fn, onPageSizeChange: yn, onSiderChange: wn, condition: cn, tab: dn, keyword: un, page: sr, total: lr, pageSize: cr, sider: pn, payload: bn, className: j("ff-data-list-helper", r), onReload: Ot, 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), []) : [], wi = ({ className: t, primaryKey: e, columns: r = [], dataSource: n = [], operationRender: i, operationWidth: o = 180, components: a = {}, rowSelection: s, ...l }) => { - const { classNames: c } = pe(se), u = H(null), p = H(null), [m, g] = L([]), [f, y] = L({ width: 0, height: 0 }); - W(() => { - g(Jr(n, e)); - }, [n, e]), Fn(() => { - const S = new ResizeObserver(() => { - var P; - y({ width: ((P = u.current) == null ? void 0 : P.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 = U(() => { - if (!(f != null && f.width) || !(r != null && r.length)) return r; - const S = (s ? s.columnWidth ?? 32 : 0) + (i ? o : 0), P = r.reduce((T, N) => T + (N != null && N.isWidthFixed && N.width ? N.width : 0), 0), F = r.filter((T) => !(T != null && T.isWidthFixed)).reduce((T, N) => T + ((N == null ? void 0 : N.width) ?? 100), 0); - if (P + F + S >= f.width) return r; - const A = f.width - P - S; - return r.map((T) => T != null && T.isWidthFixed ? T : { ...T, width: Math.floor(A * ((T == null ? void 0 : T.width) ?? 100) / F) }); - }, [r, f.width, s, i, o]), b = oi(k), E = ai(a); - return h("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: f.height ? h(br, { bordered: !0, ...l, components: E, ref: u, rowKey: (S) => (S == null ? void 0 : S[e]) ?? Math.random(), rowSelection: s, columns: (() => { - var P, F; - const S = [...b ?? []]; - return s && S.splice((F = (P = S[0]) == null ? void 0 : P.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, T, N) => i(T, N) }), S; - })(), dataSource: n, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: m } }) : null }); -}, bi = "RC_FORM_INTERNAL_HOOKS", Ci = (t) => { - const [e, r] = x.useState({ items: [] }); - return W(() => { - t && z.get(`/api/_/${t}`).then(({ uuid: n, code: i, name: o, resource: a, primaryKey: s, marginX: l, marginY: c, cols: u, rowHeight: p, fields: m, theme: g, themeSetting: f, groups: y }) => ({ uuid: n, code: i, name: o, resource: a, primaryKey: s, marginX: l, marginY: c, cols: u, rowHeight: p, theme: g, themeProps: f, groups: y, items: m })).then(r); - }, [t]), e; -}, Si = (t, { initialValue: e, initialValueLanguage: r, convertJs: n, convertJsSetting: i, type: o = "string" }, a = null) => { - const s = H(!1), l = pe(jr), [c, u] = L(), [p, m] = L(r != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(bi) || {}; - 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(ue(b, o)); - }), [p]), W(() => { - r == "javascript" && e ? Ie.exec(e, {}, { getFieldValueForBasicForm: (f) => a ? a.getFieldValue(f) : l.getFieldValue(f), getFieldValue: (f) => l.getFieldValue(f) }).then((f) => m(ue(f, o))).catch((f) => notification.error({ message: `布局数据错误: ${JSON.stringify(f)}` })).finally(() => s.current = !0) : (e && m(ue(e ?? l.getFieldValue(t), o)), s.current = !0); - }, [e, r]), gt(() => { - s.current && n && new Ct([n, i]).toValue(p, l.getFieldsValue(!0)).then(u).catch((f) => { - u(f), console.error("布局数据转换错误: ", f, n); - }); - }, [p, n, i]), [c ?? p, p]; -}, Fo = (t, e, r = null) => U(() => er(t, e, r), [t]), Gr = (t, e, r = {}, n = {}, i = {}, o = null) => { - const a = pe(jr), s = vt(), l = H(!0), c = H([]), [u, p] = L(e), [m, g] = L(), f = oe.useWatch((y) => JSON.stringify(w.pick(y, c.current)), a) || "{}"; - return Nt(() => { - t && Ie.exec(t, r, { ...n, getFieldValueForBasicForm: (y) => i ? i.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, r, n]), W(() => () => l.current = !1, []), t ? [o ? ue(u, o) : u, m] : [o ? ue(e, o) : e, null]; -}, ki = ({ 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, a] = L(); - return W(() => { - i && ae.getWidgetComponent(i).then(({ defaultProps: s = {}, default: l }) => ({ default: xi(l, s, r) })).catch((s) => ({ default: () => `${s}` })).then((s) => a(x.createElement(s.default, n))); - }, [i]), o; -}, xi = (t, e = {}, r = null) => (n) => { - const { code: i, label: o, extras: a, isVirtual: s, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: m, ...g } = w.merge({}, e, n), [f, y] = Si(s ? null : i, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, r), k = U(() => { - 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) }); -}, Yr = ({ theme: t, basicForm: e, items: r = [{ key: "default", label: "默认" }], fields: n = [], itemRender: i, chunks: o = [], children: a, $setting: s = {}, ...l }) => { - const [c, u] = L(); - W(() => { - t ? ae.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 = U(() => r == null ? void 0 : r.map((m) => ({ ...m, children: i(m, n == null ? void 0 : n.filter((g) => !(g != null && g.group) && m.key == "default" || g.group == m.key), m.key == "default" ? a : null) })).concat(o), [r, a, o]); - return c && x.cloneElement(c, { items: p, basicForm: e, $setting: { ...s, ...l } }); -}, Xr = ({ name: t, form: e = null, basicForm: r = null, style: n = {}, className: i, 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] = oe.useForm(e), S = U(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]); - gt(() => (E.setFieldsValue(m), () => E.resetFields()), [m]); - const P = (F, A, T) => { - const N = er(A, ki, r), D = _r(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": `${(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: A, basicForm: r })] }); - }; - return h(oe, { ...b, fields: S, form: E, component: !1, children: g ? h(Yr, { ...f, items: y, theme: g, itemRender: P, fields: p, children: k, basicForm: r }) : P(0, p, k) }); -}, jo = /* @__PURE__ */ ((t) => function({ code: e, data: r, ...n }) { - const { uuid: i, resource: o, items: a, hides: s, rowHeight: l, marginX: c, marginY: u, cols: p, theme: m, themeProps: g, groups: f } = Ci(e) || {}, y = U(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: i }], [e, i, o]); - return o && h(t, { name: e, theme: m, themeProps: g, groups: f, ...n, fields: a, formFields: y, rowHeight: l, cols: p, itemMargin: [c, u], data: o ? { [o]: r } : r }); -})(Xr), Ei = ({ column: t = 0, colWidth: e = 0, cols: r, rowHeight: n, itemMargin: i, containerPadding: o, fields: a, primaryKey: s, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: m = (P, F, A) => P, empty: g = h(zt, { description: null }), className: f, style: y = {}, theme: k, themeProps: b = {}, groups: E = [{ key: "default", label: "默认" }], rowSelection: S }) => { - const { classNames: P } = pe(se), F = J((N) => { - if (!S) return; - const { selectedRowKeys: D = [], onChange: $, type: V = "checkbox" } = S, M = N == null ? void 0 : N[s]; - let B; - B = V === "radio" ? [M] : D.includes(M) ? D.filter((X) => X !== M) : [...D, M], $ == null || $(B, l.filter((X) => B.includes(X == null ? void 0 : X[s]))); - }, [S, s, l]), A = U(() => h(Xr, { groups: E, theme: k, themeProps: b, cols: r, rowHeight: n, itemMargin: i, containerPadding: o, fields: a, className: p }), [a, r, n, i, o, E, k, b]), T = w.isEmpty(l); - return I("div", { className: j("ff-data-list-content", P.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, D) => { - var B; - const $ = (N == null ? void 0 : N[s]) ?? D, V = `${$}-${Ti(N)}`, M = m(x.cloneElement(A, { data: N }), N, D); - return x.cloneElement(M, { key: V, ...S && { isSelected: (B = S == null ? void 0 : S.selectedRowKeys) == null ? void 0 : B.includes($), selectionType: S.type ?? "checkbox", onSelect: () => F(N) } }); - }), u == null ? void 0 : u(l)] }); -}, Pi = ({ component: t, $props: e }) => { - const { base62params: r } = $t(e, {}); - return h(re, { children: h(tr, { listCode: t, base62params: z.decode(r) }) }); -}, Ao = () => h(Qr, {}), Qr = () => "Empty", $i = ({ component: t, $setting: e, $props: r }) => { - const [n, i] = L(), [o, a] = nn(r); - return W(() => { - if (!t) return i(h(Qr, { description: null })); - ae.getWidgetComponent(t).catch((s) => ({ default: () => `${s}` })).then((s) => x.createElement(s.default, { $setting: e })).then(i); - }, [t]), n ? x.cloneElement(n, { ...o, $setProps: a }) : null; -}, Io = () => "NotFoundPage"; -var Fe, de, je, be, it, ot; -const ye = class ye { - constructor() { - v(this, de, /* @__PURE__ */ new Map()); - v(this, je, {}); - v(this, be, null); - O(this, "init", (e, r) => { - q(this, de, e), q(this, je, r); - }); - O(this, "get", (e) => (d(this, de).has(e) || (e = Array.from(d(this, de).keys()).find((r) => d(this, de).get(r).uri === e)), d(this, de).get(e) || {})); - O(this, "redirect", (e, r, n = {}) => { - var f; - const { uri: i, type: o, widgetProps: a } = this.get(e) || {}, { router: s, query: l, ...c } = r || {}, 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 = Jn(i || 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()}`), n != null && n.isOpenWindow ? window.open(m) : d(this, be).navigate(m, { replace: !!(n != null && n.isReplaceRouteHistory) }); - }); - O(this, "getMenus", (e) => { - var r; - return ((r = d(this, je)) == null ? void 0 : r[e]) || []; - }); - O(this, "findMenuPathByUuid", (e) => { - let r = []; - for (const n in d(this, je)) if (r = d(this, it).call(this, d(this, je)[n], e, [n]), r.length > 1) return r; - return r; - }); - O(this, "getMenusByRouteUuid", (e) => d(this, ot).call(this, e, Object.values(d(this, je)).flat())); - v(this, it, (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, it).call(this, o, r)); - } - return n; - }); - v(this, ot, (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, ot).call(this, e, o.children)))); - return n; - }); - O(this, "getCurrentMenu", () => { - const { uuid: e } = this.getCurrentRoute() || {}; - if (!e) return; - const r = this.getMenusByRouteUuid(e); - return w.isEmpty(r) ? void 0 : r[0]; - }); - O(this, "getCurrentRoute", (e = 0) => { - var n; - const r = (n = d(this, be).state.matches[d(this, be).state.matches.length - 1 - e]) == null ? void 0 : n.route; - if (!r) return null; - for (let [i, o] of d(this, de)) if (o.uri === r.path) return o; - return null; - }); - O(this, "getPageParams", (e) => { - var a, s; - const { location: r = {}, matches: n = [] } = ((a = d(this, be)) == null ? void 0 : a.state) || {}, i = { ...((s = n[n.length - 1]) == null ? void 0 : s.params) || {} }, o = r.search; - return o && new URLSearchParams(o).forEach((l, c) => { - i[c] = l; - }), e ? w.get(i, e) : i; - }); - O(this, "usePageParams", (e) => { - var n; - let r = Ir() ? { ...Gn(), ...Object.fromEntries(new URLSearchParams(((n = Yn()) == null ? void 0 : n.search) ?? "")) } : this.getPageParams(); - return e ? w.get(r, e) : r; - }); - O(this, "createBrowserRouter", (e = {}) => { - if (d(this, de).size == 0) return null; - if (d(this, be)) return d(this, be); - const r = Ue.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Ue.get(ae.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), i = { [r]: 0 }, o = (s, l) => () => Promise.all([ae.getWidgetComponent(s), $t(l)]).then(([c, u]) => [c.default || function() { - return `${s}`; - }, u]).then(([c, u]) => ({ Component: () => x.createElement(Vr, {}, x.createElement(c, { $setting: u })) })), a = Array.from(d(this, de).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(Pi, { component: m, $props: f }); - break; - case "fsdpf-component": - E.element = x.createElement($i, { key: c, component: m, $setting: g, $props: f }); - } - const P = (b == null ? void 0 : b.theme) ?? (b == null ? void 0 : b.layout); - if (P) { - const F = (b == null ? void 0 : b.themeProps) ?? (b == null ? void 0 : b.layoutProps); - if (!i[P]) return i[P] = s.length, [...s, { path: "/", lazy: o(P, F), children: [{ path: c, ...E }] }]; - S = i[P]; - } - return k && S > -1 ? (s[S].children.push({ path: c, ...E }), s) : [...s, { path: c, ...E }]; - }, [{ path: "/", lazy: o(r, {}), children: [] }]); - return a.push({ index: !0, element: x.createElement(vi, { to: n, replace: !0 }) }), q(this, be, Xn(a, e)); - }); - if (d(ye, Fe)) return d(ye, Fe); - } -}; -Fe = new WeakMap(), de = new WeakMap(), je = new WeakMap(), be = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), v(ye, Fe, null), O(ye, "getInstance", () => (d(ye, Fe) || q(ye, Fe, new ye()), d(ye, Fe))); -let qt = ye; -const vi = ({ to: t, replace: e }) => Ir() ? x.createElement(Qn, { to: t, replace: e }) : (window.document.location = t, "redirect"), ie = qt.getInstance(); -Qe.chainableTypes = [In]; -const Ie = Qe.getInstance(new URL("/ff-worker-pipe/worker.js", self.location), { type: "module" }); -Qe.fns = { getConfigure: (t) => Ue.get(t), route: { redirect: (...t) => ie.redirect(...t), getPageParams: (...t) => ie.getPageParams(...t), getCurrentRoute: () => ie.getCurrentRoute() }, popup: { notification: (...t) => te.notification(...t), success: (...t) => te.success(...t), error: (...t) => te.error(...t), form: (...t) => te.form(...t), modal: (...t) => te.modal(...t), confirm: (...t) => te.confirm(...t) } }, Promise.resolve().then(() => oo).then((t) => { - Qe.fns.http = t.http, Qe.fns.generateUUID = () => t.generateUUID(); -}); -const Er = { 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" }, ue = (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(Er, n) ? Er[n](t) : t; -}, Ni = (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") ? en(t, e, r, n) : tn(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))), en = async (t = {}, e = {}, r = {}, n = "") => { - let i = /* @__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 = n } = t[o]; - switch (s) { - case "code": - try { - a = await Ie.exec(l, e, r); - } 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 = ie.getPageParams(l); - break; - case "string": - a = l; - } - a ?? (a = c); - } else a = await en(t[o], e, r, n); - w.set(i, o, a); - } - return i; -}, tn = (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: a, value: s = "", default: l = r } = t[i]; - switch (a) { - case "field": - o = w.get(e, s) ?? w.get(e, s.substring(s.indexOf(".") + 1)); - break; - case "router": - case "query": - o = ie.getPageParams(s); - break; - case "string": - o = s; - } - o ?? (o = l); - } else o = tn(t[i], e, r); - w.set(n, i, o); - } - return n; -}, {}), jt = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((r) => jt(r, e)) : Object.keys(t).reduce((r, n) => (e[n] ? r[e[n]] = jt(t[n], e) : r[n] = jt(t[n], e), r), {}) : t, Lo = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { - const e = 16 * Math.random() | 0; - return (t === "x" ? e : 3 & e | 8).toString(16); -}), Vo = (t) => { - var e, r; - return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.name : ""; -}, Do = (t) => { - var e, r; - return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.category : ""; -}, Mo = (t) => { - var e, r; - return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.owner : ""; -}, Ti = (t, e = 32, r = "auto") => { - const n = Kt(t), i = r === "auto" ? "x64" : r; - if (e === 32) return Ft.x86.hash32(n).toString(); - if (e === 128) return i === "x64" ? Ft.x64.hash128(n) : Ft.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), Oi = () => { - 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("::"); -}, Ri = (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; - } -}, zo = (t, e = "") => { - if (!t || typeof t != "string" || Ri(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; -}, Bo = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : typeof crypto < "u" && crypto.getRandomValues ? "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)) : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { - const e = 16 * Math.random() | 0; - return (t === "x" ? e : 3 & e | 8).toString(16); -}), vt = () => { - const t = H(!0), [, e] = x.useReducer((r) => r + 1, 0); - return W(() => () => t.current = !1, []), () => t.current && e(); -}, Uo = (t) => { - const [e, r] = L(t), n = H(null), i = J((o, a) => { - n.current = a, r(o); - }, []); - return W(() => { - n.current && (n.current(e), n.current = null); - }, [e]), [e, i]; -}, gt = (t = (n) => { -}, e, r = w.isEqual) => { - const n = x.useRef(); - r(e, n.current) || (n.current = w.cloneDeep(e)), x.useEffect(t, [n.current]); -}, Nt = gt, rn = (t, e = "string") => { - var r; - if (!Array.isArray(t)) return t; - for (let n = 0; n < t.length; n++) t[n].value = ue((r = t[n]) == null ? void 0 : r.value, e), t[n] && Reflect.has(t[n], "children") && (t[n].children = rn(t[n].children, e)); - return t; -}, Wo = (t, e = "json", r = "string", n, i = null) => { - const [o] = oe.useForm(n), [a, s] = L([{ label: "无", value: "", disabled: !0 }]), l = H([]), c = oe.useWatch((u) => l.current.length === 0 ? null : w.pick(u, l.current), o) || null; - return W(() => { - Array.isArray(t) ? s(t) : e === "javascript" && t ? Ie.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) => { - s(ue(u, "array")); - }).catch((u) => console.error("useOptions", u)) : t && s(ue(t, "array")); - }, [t, e, c]), rn(a, r); -}, _o = (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) => z.request(n, !1).resp((a) => (console.log("useSubscribeRequest", o), r(a), a)); - return gt(() => { - let o = null; - return i().then((a) => { - o = Hr.subscribe(w.throttle(i, 180, { leading: !1, trailing: !0 }), a.res); - }), () => o == null ? void 0 : o(); - }, n), e; -}, Fi = (t, e) => J((r) => { - const n = {}; - for (const [i, o] of Object.entries(r)) { - const a = t == null ? void 0 : t[i]; - if ((a == null ? void 0 : a.type) === "router" || (a == null ? void 0 : a.type) === "query") { - const s = ie.getCurrentRoute(); - s != null && s.uuid && ie.redirect(s.uuid, { ...ie.getPageParams(), [a.type]: { [a.value || i]: o } }, { isReplaceRouteHistory: !0 }); - } else n[i] = o; - } - Object.keys(n).length > 0 && e(n); -}, [t, e]), nn = (t, e = {}, r = {}, n = []) => { - const [i, o] = L({}), [a, s] = L({}), l = Fr(a), c = ie.usePageParams(); - Yt(() => { - Promise.resolve($t(t, e, r)).then(s); - }, [t, e, c, ...n]), Xt(() => { - const m = l ?? {}, g = Object.keys({ ...m, ...a }).reduce((f, y) => (m[y] !== a[y] && (f[y] = a[y]), f), {}); - Object.keys(g).length > 0 && o((f) => ({ ...f, ...g })); - }, [a]); - const u = Fi(t, (m) => { - o((g) => ({ ...g, ...m })); - }), p = U(() => Object.fromEntries(Object.entries(i).filter(([m, g]) => g !== a[m])), [i, a]); - return [i, u, p]; -}, ji = (t) => { - const [e, r] = x.useState({ items: [], hides: [] }); - return x.useEffect(() => { - t && z.get(`/api/_/${t}`).then(({ pk: n, uuid: i, code: o, resource: a, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: m, listenChangeFieldsFunc: g, fields: f, theme: y, themeSetting: k, groups: b }) => ({ pk: n, uuid: i, 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 P; - return (P = S == null ? void 0 : S.field) != null && P.hidden ? E.hides.push(S == null ? void 0 : S.field) : E.items.push(S), E; - }, { items: [], hides: [] }) })).then(r); - }, [t]), e; -}, Ai = ({ max: t = 0, min: e = 0, type: r = "", message: n, pattern: i, 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 (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": - a && p.push(({ getFieldValue: m }) => ({ validator: async (g, f) => { - const y = await Ie.exec(a, { value: f, fieldName: s }, { getFieldValue: m }); - 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, a]), c; -}, Ii = (t, e, r) => { - const [n, i] = L(null); - return W(() => { - const { initDataUri: o = `/api/${t}`, initDataMethod: a = "GET" } = r || {}; - e && z.request({ method: a, url: w.trimEnd(`${o}/${e}`, "/") }).then((s) => { - i(s); - }); - }, [t, e, r]), n; -}, Li = (t, e, r) => J((n, i = { serialize: (o) => o, onSuccess: () => { -}, onFail: (o) => (o == null ? void 0 : o.errorFields) && te.error("请先完善表单信息", { duration: 2e3 }) }) => { - const o = n.getFieldValue("__RESOURCE__"), { submitDataUri: a = `/api/${t}`, submitDataMethod: s = "POST" } = r || {}; - return n.validateFields().then((l) => o ? w.pick(l, [o]) : l).then(i.serialize).then((l) => z.request({ method: s, url: w.trimEnd(`${a}/${e || ""}`, "/"), data: l }).msg(i.onSuccess)).catch(i.onFail); -}, [t, e, r]), Vi = (t, e, r, n) => { - const i = Ii(e, r, n); - W(() => { - i ? t.setFieldsValue(i) : t.resetFields(); - }, [t, i]); - const o = Li(e, r, n); - return w.partial(o, t); -}, Di = (t, e, r = [], n = {}) => { - const i = H({}), o = H(), a = w.debounce(vt(), 180), s = ["disabled", "required"], l = (m, g) => { - s.includes(m) && (i.current[m] = g), a(); - }, c = U(() => ({ setDisabled: (m) => l("disabled", m), setRequired: (m) => l("required", m), getDisabled: () => i.current.disabled, getRequired: () => i.current.required }), [e]), [u, p] = Gr(e, -1, {}, c, n); - if (!p && o.current != u && (u >= 0 || !w.isEmpty(r == null ? void 0 : r[u]))) { - o.current = u; - const { widget: m, widgetPrefix: g, props: f } = r == null ? void 0 : r[u]; - t = zr(m, g), i.current = w.merge(f, w.pick(i.current, s)); - } - return [t, i.current]; -}, Pr = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), qo = ({ value: t, onChange: e }, r = null) => { - const n = H(), [i] = oe.useForm(r), o = H({}); - return Nt(() => { - w.isEqual(n.current, t) || i.setFieldsValue(t); - }, [t]), W(() => () => i.resetFields(), []), [U(() => i.__INTERNAL__ ? i : { ...i, __INTERNAL__: { itemRef: (a) => (s) => { - const l = Pr(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 = Pr(a); - return o.current[s]; - } }, [i]), (a, s) => { - n.current = s, e == null || e(s); - }]; -}, rr = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: r, subWidgets: n = [], basicForm: i, ...o }) => { - const a = zr(t, e), [s, l] = Di(a, r, n, i), [c, u] = L(); - return W(() => { - s && ae.getWidgetComponent(s).then(({ defaultProps: p = {}, default: m }) => ({ default: Mi(m, p, i) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(x.createElement(p.default, o))); - }, [s]), c && x.cloneElement(c, { ...o, ...l }); -}, Mi = (t, e = {}, r = null) => (n) => { - const { type: i, code: o, label: a, noStyle: s, style: l, placeholder: c, required: u = !1, extras: p, validators: m, help: g, isVirtual: f, $isReserved: y, initialValue: k, initialValueLanguage: b, ...E } = w.omit(w.merge({}, e, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), S = Ai(Object.assign({}, m, u ? { required: !0 } : {}), o, i), P = U(() => { - 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] = P(E), T = { label: a, noStyle: s, style: l, colon: !1, layout: "vertical" }, N = J((D) => D == null ? void 0 : ue(D, i), [i]); - return h(Qt, { name: o, rules: S, initialValue: N(k), normalize: N, children: (D, $, V) => { - var M; - return h(t, { type: i, rcform: V, basicForm: r, itemProps: { validateStatus: $.errors.length > 0 ? "error" : "success", tooltip: g || null, help: $.errors.length > 0 ? $.errors.join("、") : null, required: ((M = S == null ? void 0 : S[0]) == null ? void 0 : M.required) || !1, ...T }, fieldProps: { placeholder: c, ...A, ...D }, $setting: Object.assign({}, p, F) }); - } }); -}, nr = ({ name: t, form: e = null, basicForm: r = null, style: n = {}, className: i, 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: P, ...F }) => { - const [A] = oe.useForm(e), T = J(($, V) => { - k == null || k($, V), y && Array.isArray(f) && Ie.exec(y, { changedValues: $, 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]), N = U(() => [{ name: "__PROPS__", value: m }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, m, g]), D = ($, V, M) => { - const B = er(V, rr, r), X = _r(F); - return I("div", { ...X, className: j("ff-grid-layout-form", i), style: { ...n, "--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: [B, M && x.cloneElement(M, { cols: o, rowHeight: a, itemMargin: s, containerPadding: l, fields: V, basicForm: r })] }); - }; - return I(oe, { ...F, form: A, fields: N, onValuesChange: T, children: [b ? h(Yr, { ...E, items: S, theme: b, itemRender: D, fields: c, children: P, basicForm: r }) : D(0, c, P), u == null ? void 0 : u.map(($) => { - var V; - return h(Qt, { name: $.code, children: h(zi, { form: A, basicForm: r, name: $.code, type: $.type, initialValue: $.initialValue, initialValueLanguage: (V = $.extras) == null ? void 0 : V.initialValueLanguage }) }, JSON.stringify($.code)); - })] }); -}, zi = ({ type: t, initialValue: e, initialValueLanguage: r, onChange: n, basicForm: i }) => { - const [o, a] = Gr(r == "javascript" && e, r == "javascript" ? void 0 : e, {}, {}, i); - return W(() => { - r == "javascript" ? n(ue(o, t)) : e && n(ue(e, t)); - }, [t, e, o]), null; -}; -nr.propTypes = { fields: C.array, hides: C.array }; -const Bi = /* @__PURE__ */ ((t) => ({ code: e, isPreview: r = !1, ...n }) => { - const { align: i, autoComplete: o, resource: a, items: s, hides: l, rowHeight: c, marginX: u, marginY: p, cols: m, listenChangeFields: g, listenChangeFieldsFunc: f, pk: y, uuid: k, theme: b, themeProps: E, groups: S } = ji(e), P = U(() => [{ 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, ...n, formFields: P, listenChangeFields: g, listenChangeFieldsFunc: f, fields: s, hides: l, cols: m, rowHeight: c, itemMargin: [u, p] }); -})(nr), on = ({ $setting: t, $close: e, extras: r, code: n, primaryKey: i, ...o }) => { - const [a] = oe.useForm(), s = Vi(a, n, i, t); - return h(re, { actions: I(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: r, children: h(Bi, { form: a, code: n, primaryKey: i, ...o }) }); -}, $r = /* @__PURE__ */ new Set(), Ht = (t = [], e = 0) => { - const r = t[e]; - if (r.length && !$r.has(r)) { - const n = document.createElement("script"); - n.setAttribute("src", r), n.setAttribute("data-namespace", r), t.length > e + 1 && (n.onload = () => { - Ht(t, e + 1); - }, n.onerror = () => { - Ht(t, e + 1); - }), $r.add(r), document.body.appendChild(n); - } -}, St = ({ className: t, type: e, style: r = {}, ...n }) => h("span", { role: "img", className: j("ff-iconfont", t), style: r, ...n, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); -St.propTypes = { className: C.string, type: C.string.isRequired, style: C.object }, St.init = Ht; -const Ui = (t, e, r, n) => ie.redirect(r, e, n), Wi = (t, e = {}, r, n = {}) => { - var o; - const i = (o = n.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/${r}`); - return z.del(i, e.param).msg(); -}, vr = (t, e, r, { status: { loading: n, disabled: i }, setStatus: o, listFn: a }) => { - const s = { loading: (l) => l === void 0 ? n : o((c) => ({ ...c, loading: l })), disabled: (l) => l === void 0 ? i : o((c) => ({ ...c, disabled: l })), list: a }; - return w.isFunction(r) ? r.call(null, e, s) : w.isString(r) && r ? Ie.exec(r, e, s) : null; -}, Nr = (t, e, r, n, i) => w.isString(r) && r ? ae.getWidgetComponent(r).then(({ default: o }) => te.modal(o, { ...e, $setting: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i)).catch((o) => { - te.error(r, { content: o.toString() }); -}) : te.modal(r, { ...e, $setting: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), _i = (t, e, r, n, i) => te.modal(on, { ...e, $setting: n, code: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), qi = (t, e, r, n, i) => te.modal(tr, { ...n, base62params: e, listCode: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Ki = ({ widget: t, widgetType: e, widgetData: r, widgetProps: n, widgetSetting: i, widgetContainerProps: o }, { onAfterClick: a, onBeforeClick: s } = {}) => { - const l = pe(se), [c, u] = L({ leading: !0, trailing: !1 }), p = H(null), [m, g] = U(() => { - switch (e) { - case "redirect": - return [w.partialRight(Ui, 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(_i, t, i, o), (y) => ({ $setting: y })]; - case "data-list": - return [w.partialRight(qi, t, i, o), (y) => y]; - case "destroy": - return [w.partialRight(Wi, t, i, o), null]; - default: - if (or(t) || x.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) => (s == null || s(y), Promise.resolve($t(n, y, { list: l })).then((k) => { - const b = m(y, { ...r, ...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 Xt(() => { - var y; - (y = p.current) == null || y.call(p, i, o); - }, [i, o]), [f, c]; -}, an = ({ type: t, name: e, className: r, icon: n, iconPosition: i, size: o }, a = "default") => U(() => { - const s = { type: "primary", className: j("ff-button", r), iconPosition: i, 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), n && (s.icon = h(St, { type: n })), e && (s.children = e), s; -}, [a, t, r, n, i]), Tt = ({ data: t, widget: e, widgetType: r = "fsdpf-component", widgetData: n, widgetProps: i, widgetSetting: o, widgetContainerProps: a, onAfterClick: s, onBeforeClick: l, children: c, extras: u }) => { - const p = pe(se), [m, g] = L(!1), [f, y] = L("hover"), [k, b] = nn(i, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [E, S] = L(), { placement: P, align: F, zIndex: A, arrow: T = { pointAtCenter: !0 }, getPopupContainer: N, isPopupMountBodyContainer: D = !0, ...$ } = a || {}; - W(() => { - r == "grid-layout-form" ? S(x.createElement(on, { ...n, $setting: o, code: e })) : r == "data-list" ? S(x.createElement(tr, { base62params: t, $setting: o, listCode: e })) : w.isString(e) ? ae.getWidgetComponent(e).then(({ default: B }) => { - S(x.createElement(B, { ...n, $setting: o })); - }).catch((B) => S(B.toString())) : x.isValidElement(e) ? S(x.cloneElement(e, { ...n, $setting: o })) : (or(e) || w.isFunction(e) && ["component", "fsdpf-component"].includes(r)) && S(x.createElement(e, { ...n, $setting: o })); - }, [e, r, n]); - const V = (B, X = !1) => (g(B), !B && y("hover"), B ? l == null ? void 0 : l(k) : s == null ? void 0 : s(X)), M = (B) => { - g(!0), y("click"); - }; - return h(Wn, { zIndex: A, placement: P, onPopupClick: M, onClick: M, open: m, align: F, arrow: T, trigger: f, getPopupContainer: N || D ? void 0 : (B) => B, content: h(Hi, { ...$, extras: u, children: E && x.cloneElement(E, { ...k, $setProps: b, $close: (B) => V(!1, B) }) }), children: c, onOpenChange: V }); -}, Hi = ({ title: t, className: e, classNames: r, children: n, extras: i, width: o, height: a, ...s }) => { - const [l, c] = L({}), u = J((f, y) => c((k) => ({ ...k, [f]: y })), []), p = J((f) => c((y) => ({ ...y, [f]: void 0 })), []), m = t ? x.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = i ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, i); - return h(pt.Provider, { value: { ele: l, mount: u, unmount: p }, children: I("div", { className: j("ff-popup ff-popover", e, l.rootClassName), style: { width: o ?? 260, height: a }, ...s, children: [I("div", { className: j("ff-popup-header", "ff-popover-header", r == null ? void 0 : r.header), children: [m, l == null ? void 0 : l["sub-title"]] }), h("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: [g, l == null ? void 0 : l.extras, l == null ? void 0 : l.actions] })] }) }); -}; -Tt.propTypes = { widgetType: C.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; -const ht = (t) => function({ className: e, variant: r, children: n, name: i, 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: P, widgetContainerProps: F, ...A }) { - const { mode: T, ...N } = F || {}, D = an({ className: e, name: i, type: a, icon: o, iconPosition: s }, r ?? t), $ = h(bt, { ...D, ...A, children: n || i }); - if (T === "popover" && !["destroy", "redirect", "func"].includes(b)) return h(Tt, { data: p, widget: k, widgetType: b, widgetData: E, widgetProps: S, widgetSetting: P, widgetContainerProps: N, onAfterClick: c, onBeforeClick: u, children: $ }); - const V = w.isEmpty(f) || !f.enabled ? {} : f, M = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [B, X] = L(!1), [xe, { disabled: _, loading: le }] = Ki({ widget: k, widgetType: b, widgetData: E, widgetProps: S, widgetSetting: P, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u }); - return h(_n, { okText: "确定", cancelText: "取消", getPopupContainer: (K) => K, ...M, disabled: _ || g, open: B, onOpenChange: (K) => { - if (!K) return X(K); - M.enabled ? X(K) : xe(p); - }, onConfirm: (K) => { - xe(p, K); - }, onClick: (K) => { - K.stopPropagation(); - }, children: h(qn, { getPopupContainer: (K) => K, ...V, title: B ? null : V == null ? void 0 : V.title, trigger: ["hover", "click"], children: x.cloneElement($, { loading: le || m, disabled: _ || g }) }) }); -}, R = ht("default"); -R.propTypes = { type: C.oneOf(["primary", "default", "danger", ""]), size: C.oneOf(["large", "middle", "small"]), name: C.string, icon: C.string, iconPosition: C.oneOf(["start", "end"]), data: C.any, widget: C.any, widgetType: C.oneOf(["destroy", "redirect", "func", "component", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: C.object, widgetProps: C.object, widgetSetting: C.object, widgetContainerProps: C.object, tooltip: C.exact({ title: C.string.isRequired, placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func }), confirm: C.exact({ title: C.string.isRequired, cancelText: C.string, okText: C.string, okType: C.oneOf(["primary", "default", "danger", ""]), placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func, arrow: C.oneOfType([C.bool, C.exact({ pointAtCenter: C.bool })]) }) }; -const Ji = ht("link"), Gi = ht("circle"), Yi = ht("round"), Xi = ht("dashed"), 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: a, btnVariant: s, btnSize: l, btnRender: c = (g, f) => h(R, { ...g, data: f }, g.uuid || Vt()), widgetContainerProps: u = {}, children: p, data: m }) => { - if (w.isEmpty(t)) return p; - l ?? (l = o), s ?? (s = i); - const [g, f] = U(() => (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(bt, { ...an(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, m), onBeforeClick: w.partialRight(n, 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(Kn, { type: "vertical" }), size: l, children: y }) : h(Mt.Compact, { size: l, children: y })), g ? h(Tt, { widget: g == null ? void 0 : g.widget, widgetType: g == null ? void 0 : g.widgetType, widgetProps: g == null ? void 0 : g.widgetProps, widgetSetting: g == null ? void 0 : g.widgetSetting, widgetContainerProps: Object.assign({}, u, g == null ? void 0 : g.widgetContainerProps), data: m, widgetData: g == null ? void 0 : g.widgetData, extras: k, onAfterClick: w.partialRight(r, g, m), onBeforeClick: w.partialRight(n, g, m), 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 = Ji, R.Link.defaultProps = R.defaultProps, R.Link.propTypes = R.propTypes, R.Circle = Gi, R.Circle.defaultProps = R.defaultProps, R.Circle.propTypes = R.propTypes, R.Round = Yi, R.Round.defaultProps = R.defaultProps, R.Round.propTypes = R.propTypes, R.Dashed = Xi, R.Dashed.defaultProps = R.defaultProps, R.Dashed.propTypes = R.propTypes, R.Popover = Tt, R.GroupPopover = Tr; -const Qi = ({ fields: t, formProps: e, $close: r }) => { - const [n] = oe.useForm(), i = U(() => [{ name: "__PROPS__", value: e }], [e]); - return h(re, { actions: I(x.Fragment, { children: [h(R, { name: "取消", widget: () => r(!1) }), h(R, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(r) })] }), children: h(oe, { fields: i, form: n, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...a }) => h(rr, { code: o, ...a }, o)) }) }); -}, Zi = ({ className: t, classNames: e, $close: r, children: n, title: i, subTitle: o, actions: a, extras: s, ...l }) => I(Zn, { ...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: [h("button", { "aria-label": "Close", className: j("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: h(Zt, { type: "close" }) }), i, o] }), h("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), I("div", { className: j("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, a] })] }), eo = ({ className: t, classNames: e, $close: r, $event: n, children: i, 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 = (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 h(ei, { ...m, ...g, prefixCls: "ff-modal", className: j("ff-popup", t), modalRender: () => I(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" }) }), 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, a] }), h("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, s] })] })] }) }); -}, sn = ({ placement: t, $close: e, $event: r, children: n, title: i, ...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 || i && x.createElement("div", { className: j("ff-popup-title") }, i), subTitle: a["sub-title"], actions: a.actions, extras: a.extras, children: n, $close: e, $event: r, onClose: () => c(!1) }; - const g = () => { - e(!1); - }; - return h(pt.Provider, { value: { ele: a, mount: u, unmount: p }, children: t && t !== "center" ? h(Zi, { ...m, placement: t, open: l, afterOpenChange: (f) => !f && g() }) : h(eo, { ...m, visible: l, afterClose: g }) }); -}; -sn.propTypes = { placement: C.oneOf(["center", "left", "top", "right", "bottom"]) }; -const to = ({ widget: t, widgetProps: e, $close: r, onSetProps: n }) => { - const [i, o] = L(e || {}), a = Fr(e); - Yt(() => { - 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 })), n == null || n(l); - }, [n]); - return x.isValidElement(t) ? x.cloneElement(t, { ...i, $close: r, $setProps: s }) : t != null && t.name || Cr.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === Cr.ForwardRef ? x.createElement(t, { ...i, $close: r, $setProps: s }) : t; -}, Y = () => { - const [t, e] = jn({ 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" }), [, r] = x.useReducer((o) => o + 1, 0); - W(() => { - Y.$onClick = n, Y.$queue.forEach(([o, a, s, l]) => { - l == null || l(i([a, s], ...o)); - }), Y.$queue = []; - }, []); - const n = (o, a = {}, s = {}) => { - let l; - const c = new Promise((u, p) => { - l = i([u, p], o, a, s); - }); - return c.update = l, c; - }, i = ([o, a], s, l = {}, c = {}) => { - const u = Y.$index++, p = (f) => ((y, k) => (Y.$popups.delete(y), r(), k == null ? void 0 : k()))(u, () => o(f)); - if (s === Dr) 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 }), r(), (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 }), r()); - }; - }; - return I(x.Fragment, { children: [Array.from(Y.$popups).map(([o, { widget: a, widgetProps: s, widgetContainerProps: l, $close: c, onSetProps: u }]) => h(sn, { maskClosable: !1, $event: s == null ? void 0 : s.$event, ...l, $close: c, children: h(to, { widget: a, widgetProps: s, $close: c, onSetProps: u }) }, o)), e] }); -}; -Y.$popups = /* @__PURE__ */ new Map(), Y.$index = 0, Y.$queue = [], Y.$onClick = (...t) => { - const e = new Promise((r, n) => { - Y.$queue.push([t, r, n, (i) => { - e.update = i; - }]); - }); - return e; -}; -const Or = (t, e, r = {}) => Y.$onClick(t, e, r), At = (t, { showProgress: e, duration: r, ...n } = { duration: 1.5 }) => Y.$onClick(Dr, { content: t, ...n }, { showProgress: e, duration: r }), te = { modal: Or, confirm: (t, e = {}) => Y.$onClick(ti, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, r = {}) => Or(Qi, { formProps: r, fields: t }, { placement: "center", ...e }).then((n) => { - if (n === !1) throw !1; - return n; -}), notification: At, success: (t, e = { duration: 1.5 }) => At(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => At(t, { ...e, className: "ff-notification-error", icon: "close" }) }; -Xe.configure({ showSpinner: !1 }); -const ln = () => { - const t = window.localStorage.getItem(wt); - return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); -}; -Ve.interceptors.request.use((t) => (Object.assign(t.headers, ln()), Xe.inc(), t), (t) => (Xe.done(), Promise.reject({ code: -1, msg: t }))), Ve.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", Dt.onUnhandledRejection), Dt.onMsg = (t, e) => te[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && ie.redirect(Ue.get("Common.WEBSITE_LOGIN_PAGE"))); -var He, Be, Je; -const Z = class Z { - constructor() { - O(this, "appUrl", ""); - v(this, He, null); - return d(Z, Be) || (q(Z, Je, new Dt()), q(Z, 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(Z, Je)[r]; - } }))), d(Z, Be); - } - init(e, r, n) { - Ve.defaults.baseURL = this.appUrl = n, Ve.defaults.timeout = 15e3, d(Z, Je).init(e, r, Ve); - } - get driver() { - return Ve; - } - get headers() { - return ln(); - } - mock(e = {}) { - return d(this, He) ?? q(this, He, new Ln(Ve, { onNoMatch: "passthrough", ...e })); - } - unmock() { - var e; - (e = d(this, He)) == null || e.restore(), q(this, He, null); - } -}; -He = new WeakMap(), Be = new WeakMap(), Je = new WeakMap(), v(Z, Be), v(Z, Je), O(Z, "getInstance", () => d(Z, Be) ?? q(Z, Be, new Z())); -let Jt = Z; -const z = Jt.getInstance(); -class ir extends Error { - constructor(e, r) { - super(r), Error.captureStackTrace && Error.captureStackTrace(this, ir), !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 It = "mine", wt = "token", Lt = "user-login-intended-url"; -var Ae, Ge, at; -const we = class we { - constructor() { - v(this, Ge, /* @__PURE__ */ new Map()); - v(this, at, (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)); - O(this, "setPkgVersion", (e) => { - q(this, at, e); - }); - O(this, "setVendor", (e, r) => d(this, Ge).set(e, new Lr(r, async (n, i) => { - var a, s; - if (!(n != null && n.default)) throw "@pkg not found"; - let o = () => i; - switch ("function") { - case typeof (o = (a = n.default) == null ? void 0 : a[`./${i}/index.jsx`]): - case typeof (o = (s = n.default) == null ? void 0 : s[`./${i}/index.js`]): - return o(); - } - throw new Ze(i); - }))); - 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 [, r] = e == null ? void 0 : e.split("@pkg/"); - if (!r) throw new Ze(e); - try { - return d(this, Ge).has("pkg") ? await d(this, Ge).get("pkg").get(r) : await import(`${z.appUrl}/api/pkg-import/web?name=${e}&v=${d(this, at)}`); - } catch (n) { - throw new ir(e, n); - } - }); - 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: r, ...n }) => [r, { uuid: r, ...n }])).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((r, { uuid: n, auth: i }) => [...r, [n, i]], []))); - O(this, "getPhoneNumber", (e) => z.get(`/api/user-wx-phone-number/${e}`)); - O(this, "getUserToken", () => { - const e = window.localStorage.getItem(wt); - 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; - }); - O(this, "checkUserToken", () => { - try { - return !!this.getUserToken(); - } catch { - return !1; - } - }); - O(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, ...a } = z.decode(window.localStorage.getItem(It) || "", {}); - return o === i ? Promise.resolve(a) : z.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(It, z.encode({ ...s, iat: i })), s)).catch((s) => (console.error(s), e && te.error("请登录").then(this.logout), null)); - } catch (n) { - console.error(n), e && te.error("请登录").then(this.logout); - } - return Promise.resolve(null); - }); - O(this, "login", (e, r, n = {}) => z.post("/api/user-token", { username: e, passwd: Vn.hash(r), platform: "web", ...n }).then(({ token: i }) => (window.localStorage.setItem(wt, i), i)).then(async (i) => (await this.initAppEnv(), i))); - O(this, "setLoginIntendedUrl", (e) => sessionStorage.setItem(Lt, e)); - O(this, "getLoginIntendedUrl", (e = !1) => { - const r = sessionStorage.getItem(Lt); - return e && sessionStorage.removeItem(Lt), r; - }); - O(this, "logout", (e) => (window.localStorage.removeItem(It), window.localStorage.removeItem(wt), e == null ? void 0 : e())); - O(this, "initAppEnv", async () => { - const [e, r, n, i] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); - return Mr.init(e), Ue.init(i), ie.init(r, n), St.init(Ue.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: r, menus: n, configures: i }; - }); - if (d(we, Ae)) return d(we, Ae); - } -}; -Ae = new WeakMap(), Ge = new WeakMap(), at = new WeakMap(), v(we, Ae, null), O(we, "getInstance", () => (d(we, Ae) || q(we, Ae, new we()), d(we, Ae))); -let Gt = we; -const ae = Gt.getInstance(), ro = x.createContext({ user: {}, initUser: () => { -}, initUserComplete: !1 }), no = x.createContext({ set: () => { -}, get: () => { -}, assign: () => { -}, currentRoute: () => { -} }), or = (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; -}, io = (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); -}, oo = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: ro, AppGlobalParamsContext: no, cache: Lr, configure: Ue, default: ae, func: Ie, http: z, insertStyle: io, isReactComponent: or, route: ie }, Symbol.toStringTag, { value: "Module" })); -var $e, Ye, ve, Ce, Se, ne, ee, G, ke, st, lt, ct, dt, Pt, ut; -const ar = class ar { - constructor(e, r = "/") { - v(this, $e, "/"); - v(this, Ye, /* @__PURE__ */ new Set()); - v(this, ve, (e) => { - for (const r of d(this, Ye)) try { - r(e); - } catch (n) { - console.error("Error in VirtualFS event listener:", n); - } - }); - v(this, Ce, (e) => { - const r = Date.now(); - if (e && (e.lastModified = r), d(this, $e) != "/") { - const n = d(this, G).call(this, d(this, $e)); - n && (n.lastModified = r); - } - this.root.lastModified = r; - }); - v(this, Se, (e) => { - let r = ge.normalize(e); - return r.startsWith("/") || (r = "/" + r), r.length > 1 && r.endsWith("/") && (r = r.slice(0, -1)), r; - }); - v(this, ne, (e) => { - const r = ge.join(d(this, $e), e); - return d(this, Se).call(this, r); - }); - v(this, ee, (e) => { - if (!e || typeof e != "string") return !1; - const r = d(this, Se).call(this, e); - return !r.includes("..") && r.startsWith("/"); - }); - v(this, G, (e) => { - var o; - const r = d(this, Se).call(this, e); - if (r === "/") return this.root; - const n = r.split("/").filter((a) => a); - let i = this.root; - for (const a of n) { - if (i.type !== "dir") return null; - const s = (o = i.children) == null ? void 0 : o.find((l) => l.name === a); - if (!s) return null; - i = s; - } - return i; - }); - v(this, ke, (e) => { - const r = d(this, Se).call(this, e), n = ge.basename(r), i = ge.dirname(r); - return { parent: d(this, G).call(this, i), name: n }; - }); - v(this, st, (e, r, n) => n === !1 ? e : n === "root" ? e.map((i) => ge.join(r, i)) : n === !0 || n === "working" ? e.map((i) => ge.relative(d(this, $e), ge.join(r, i))) : e); - v(this, lt, async (e, r, n, i = "") => { - 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 = i ? `${i}/${c}` : c; - try { - if (l.type === "file") r(n ? p : c) && o.push(p); - else if (l.type === "dir" && n) { - const m = await d(this, lt).call(this, u, r, n, p); - o.push(...m); - } - } catch { - continue; - } - } - return o; - }); - v(this, ct, async (e, r, n, i = "") => { - const o = [], a = Array.isArray(r) ? r : [r], s = d(this, G).call(this, e); - if (!s || s.type !== "dir") return o; - if (!n) { - for (const c of a) if (d(this, dt).call(this, c)) { - const u = await d(this, Pt).call(this, e, c); - o.push(...u); - } else { - const u = ge.join(e, c), p = d(this, Se).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 = i ? `${i}/${u}` : u; - try { - if (c.type === "file") for (const g of a) { - let f = !1; - if (f = d(this, dt).call(this, g) ? d(this, ut).call(this, u, g) : u === g, f) { - o.push(m); - break; - } - } - else if (c.type === "dir") { - const g = await d(this, ct).call(this, p, r, n, m); - o.push(...g); - } - } catch { - continue; - } - } - return o; - }); - v(this, dt, (e) => /[*?[\]{}]/.test(e)); - v(this, Pt, async (e, r) => { - const n = [], i = d(this, G).call(this, e); - if (!i || i.type !== "dir") return n; - const o = i.children.map((a) => a.name); - for (const a of o) d(this, ut).call(this, a, r) && n.push(a); - return n; - }); - v(this, ut, (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; - q(this, $e, 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, ee).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = d(this, G).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, ee).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = d(this, G).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, ee).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = d(this, G).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, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: i, name: o } = d(this, ke).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 a = i.children.findIndex((c) => c.name === o), s = a >= 0, l = { name: o, type: "file", content: r, lastModified: Date.now() }; - s ? i.children[a] = l : i.children.push(l), d(this, Ce).call(this, i), d(this, ve).call(this, { action: s ? "update" : "create", path: n, type: "file", timestamp: Date.now() }); - } - async mkdir(e, r = {}) { - const n = d(this, ne).call(this, e); - if (!d(this, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const { recursive: i } = r; - if (i) { - const o = n.split("/").filter((s) => s); - let a = "/"; - for (const s of o) - if (a = ge.join(a, s), !d(this, G).call(this, a)) { - const { parent: l, name: c } = d(this, ke).call(this, a); - if (l && l.type === "dir") { - const u = { name: c, type: "dir", children: [], lastModified: Date.now() }; - l.children.push(u), d(this, Ce).call(this, l), d(this, ve).call(this, { action: "create", path: d(this, Se).call(this, a), type: "dir", timestamp: Date.now() }); - } - } - } else { - const { parent: o, name: a } = d(this, ke).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 === 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, Ce).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, ee).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: n, name: i } = d(this, ke).call(this, r); - if (!n) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); - const o = n.children.findIndex((a) => a.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, Ce).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, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - const { parent: i, name: o } = d(this, ke).call(this, n); - if (!i) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const a = i.children.findIndex((l) => l.name === o); - if (a < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); - const s = i.children[a]; - if (s.type !== "dir") throw new Error(`ENOTDIR: not a directory, rmdir '${e}'`); - if (!r.recursive && s.children.length > 0) throw new Error(`ENOTEMPTY: directory not empty, rmdir '${e}'`); - i.children.splice(a, 1), d(this, Ce).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, ee).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); - if (!d(this, ee).call(this, i)) throw new Error(`EINVAL: invalid path '${r}'`); - if (!d(this, G).call(this, n)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${r}'`); - const { parent: o, name: a } = d(this, ke).call(this, n), { parent: s, name: l } = d(this, ke).call(this, i); - if (!s) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${r}'`); - if (d(this, G).call(this, i)) throw new Error(`EEXIST: file already exists, rename '${e}' -> '${r}'`); - 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, Ce).call(this, o), o !== s && d(this, Ce).call(this, s), 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, ee).call(this, r) ? d(this, G).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, Ye).add(e), () => { - d(this, Ye).delete(e); - }; - } - getWorkingDirectory() { - return d(this, $e); - } - scope(e = "/") { - const r = d(this, Se).call(this, e); - if (!d(this, ee).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); - const n = d(this, G).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 ar(this.root, r); - } - async findFiles(e, r, n = {}) { - const i = d(this, ne).call(this, e); - if (!d(this, ee).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); - const o = d(this, G).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: a = !1, fullPath: s = !1 } = n; - if (typeof r == "function") { - const c = await d(this, lt).call(this, i, r, a); - return d(this, st).call(this, c, i, s); - } - const l = await d(this, ct).call(this, i, r, a); - return d(this, st).call(this, l, i, s); - } -}; -$e = new WeakMap(), Ye = new WeakMap(), ve = new WeakMap(), Ce = new WeakMap(), Se = new WeakMap(), ne = new WeakMap(), ee = new WeakMap(), G = new WeakMap(), ke = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), Pt = new WeakMap(), ut = new WeakMap(); -let Rr = ar; -const ao = async (t, e = "/", r = "") => { - try { - const n = await t.stat(e), i = e === "/" ? "/" : ge.basename(e), o = { title: i, key: r ? `${r}${e}` : e, isLeaf: n.isFile() }; - if (n.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 ao(t, u, r); - o.children.push(p); - } catch (p) { - console.warn(`Failed to process ${u}:`, p.message); - } - } - } - } - return o; - } catch { - return null; - } -}; -export { - zo as $, - ai as A, - To as B, - Oo as C, - Ct as D, - Ur as E, - Wt as F, - jo as G, - bi as H, - si as I, - li as J, - Pi as K, - $i as L, - Ao as M, - Io as N, - ue as O, - Ni as P, - $t as Q, - Hr as R, - Zr as S, - jt as T, - Lo as U, - Vo as V, - Do as W, - Mo as X, - Ti as Y, - Oi as Z, - Ri as _, - zr as a, - Bo as a0, - vt as a1, - Uo as a2, - gt as a3, - Nt as a4, - Wo as a5, - _o as a6, - Fi as a7, - nn as a8, - Bi as a9, - Lr as aA, - Ue as aB, - Ie as aC, - ie as aD, - ro as aE, - no as aF, - Rr as aG, - ao as aH, - to as aI, - nr as aa, - rr as ab, - on as ac, - ji as ad, - Ai as ae, - Ii as af, - Li as ag, - Vi as ah, - Di as ai, - qo as aj, - St as ak, - R as al, - Mr as am, - Ki as an, - re as ao, - pt as ap, - Vr as aq, - Y as ar, - te as as, - $o as at, - vo as au, - No as av, - ae as aw, - or as ax, - io as ay, - z as az, - Wr as b, - Ro as c, - _r as d, - er as e, - Jr as f, - ri as g, - Xr as h, - ki as i, - Yr as j, - Si as k, - Fo as l, - Gr as m, - Kr as n, - qr as o, - fi as p, - mi as q, - gi as r, - tr as s, - se as t, - Ci as u, - wi as v, - Ei as w, - ci as x, - ui as y, - oi as z -}; diff --git a/dist/common/main-DsRa-iMx.js b/dist/common/main-DsRa-iMx.js new file mode 100644 index 0000000..94272ce --- /dev/null +++ b/dist/common/main-DsRa-iMx.js @@ -0,0 +1,1569 @@ +var Tr = Object.defineProperty; +var yn = (t) => { + throw TypeError(t); +}; +var Or = (t, e, n) => e in t ? Tr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; +var O = (t, e, n) => Or(t, typeof e != "symbol" ? e + "" : e, n), wn = (t, e, n) => e.has(t) || yn("Cannot " + n); +var d = (t, e, n) => (wn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), v = (t, e, n) => e.has(t) ? yn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), q = (t, e, n, r) => (wn(t, e, "write to private field"), r ? r.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 pe, useMemo as B, useId as Mt, isValidElement as Rr, useLayoutEffect as Fr } from "react"; +import ge from "pathe"; +import C from "prop-types"; +import j from "classnames"; +import { useNotification as jr } from "rc-notification"; +import w from "lodash"; +import { useMountedState as Ir, useDeepCompareEffect as Yt, useUpdateEffect as Xt, usePrevious as jn } from "react-use"; +import ae, { Field as Qt, FieldContext as In } from "rc-field-form"; +import { _ as bn, C as Qe, L as Ar, M as Ft, N as Xe, b as Ve, o as Vt, c as Lr, S as Mr } from "./vender-C5RbewOc.js"; +import Vr from "rc-util/lib/hooks/useMergedState"; +import An from "immutability-helper"; +import { Space as Dt, Form as yt, Input as Dr, Button as bt, Pagination as Ur, Tree as zr, Breadcrumb as Br, Empty as Ut, Table as Cn, Popover as Wr, Popconfirm as _r, Tooltip as qr, Divider as Kr } from "antd"; +import { useMergedState as Hr } from "rc-util"; +import { generatePath as Jr, useInRouterContext as Ln, useParams as Gr, useLocation as Yr, createBrowserRouter as Xr, Navigate as Qr } from "react-router-dom"; +import Zr from "rc-drawer"; +import ei from "rc-dialog"; +import * as kn from "react-is"; +var We, et, _e, Ee, De, Ue; +class Mn { + constructor(e, n) { + v(this, We, /* @__PURE__ */ new Map()); + v(this, et, !0); + v(this, _e, []); + v(this, Ee); + v(this, De, () => d(this, Ee)); + v(this, Ue, () => Promise.resolve()); + O(this, "get", (...e) => new Promise((n, r) => { + const i = JSON.stringify(e); + if (d(this, We).has(i)) return n(d(this, Ue).call(this, d(this, Ee), ...e)); + if (d(this, Ee) === void 0) d(this, _e).push([e, n, r]), d(this, et) && (q(this, et, !1), Promise.resolve(typeof d(this, De) == "function" ? d(this, De).call(this) : d(this, De)).then((o) => q(this, Ee, o || null)).finally(() => { + d(this, _e).forEach(([o, a, s]) => { + try { + const l = d(this, Ue).call(this, d(this, Ee), ...o); + d(this, We).set(JSON.stringify(o), l), a(l); + } catch (l) { + s(l); + } + }), d(this, _e).length = 0; + })); + else { + const o = d(this, Ue).call(this, d(this, Ee), ...e); + d(this, We).set(i, o), n(o); + } + })); + q(this, Ue, n), q(this, De, e); + } +} +We = new WeakMap(), et = new WeakMap(), _e = new WeakMap(), Ee = new WeakMap(), De = new WeakMap(), Ue = new WeakMap(); +const Po = () => h("div", { children: "Empty" }), pt = x.createContext({ ele: {}, mount: () => { +}, unmount: () => { +} }), ie = ({ rootClassName: t, className: e, children: n, actions: r, title: i, subTitle: o, extras: a, style: s = {} }) => { + const { mount: l, unmount: c } = x.useContext(pt); + return ie.Action({ children: r }), ie.Title({ children: i }), ie.SubTitle({ children: o }), ie.Extra({ children: a }), W(() => (l("rootClassName", t), () => c(t)), [t]), h("div", { className: j("ff-container", e), style: s, children: n }); +}, ft = (t) => ({ children: e, className: n }) => { + const { mount: r, unmount: i } = x.useContext(pt); + return W(() => (e && r(t, x.createElement("div", { key: `ff-${t}`, className: j(`ff-popup-${t}`, n) }, e)), () => i(t)), [n, e]), null; +}; +ie.Action = ft("actions"), ie.Title = ft("title"), ie.SubTitle = ft("sub-title"), ie.Extra = ft("extras"), ie.propTypes = { className: C.string, style: C.object, title: C.any, subTitle: C.any, actions: C.any, extras: C.any }; +const vo = () => h(ie, { className: "ff-loading", children: A("div", { className: "loader", children: [A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] }), A("div", { className: "square", children: [h("span", {}), h("span", {}), h("span", {})] })] }) }), No = () => h("div", { children: "NotFound" }), Vn = ({ children: t }) => { + const [e, n] = L({}), r = J((o, a) => n((s) => ({ ...s, [o]: a })), []), i = J((o) => n((a) => ({ ...a, [o]: void 0 })), []); + return typeof (t == null ? void 0 : t.type) == "string" ? t : h(pt.Provider, { value: { ele: e, mount: r, unmount: i }, children: x.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); +}; +Vn.propTypes = { children: C.element.isRequired }; +const Sn = { 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: (Sn[t] || Sn.info).map((n, r) => h("path", { d: n }, r)) }) }), Dn = ({ className: t, content: e, icon: n, $close: r }) => A(x.Fragment, { children: [n && h("div", { className: j("ff-notification-icon", t), children: h(Zt, { type: n }) }), e] }), ti = ({}) => h(ie, { children: "Confirm" }); +var Te, qe; +const he = class he { + constructor() { + v(this, qe, /* @__PURE__ */ new Map()); + O(this, "init", (e) => q(this, qe, new Map(e))); + O(this, "check", (e) => !d(this, qe).has(e) || d(this, qe).get(e)); + if (d(he, Te)) return d(he, Te); + } +}; +Te = new WeakMap(), qe = new WeakMap(), v(he, Te, null), O(he, "getInstance", () => (d(he, Te) || q(he, Te, new he()), d(he, Te))); +let zt = he; +const Un = zt.getInstance(), ni = (t, e, n = "children") => { + if (w.isEmpty(t)) return {}; + const r = w.find(t, ["value", e]); + if (!w.isEmpty(r)) return r; + const i = t.length; + for (let o = 0; o < i; o++) { + const { [n]: a } = t[o], s = ni(a, e, n); + if (!w.isEmpty(s)) return s; + } + return {}; +}, zn = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; +var Oe, tt; +const me = class me { + constructor() { + v(this, tt, null); + O(this, "init", (e) => q(this, tt, e)); + O(this, "get", (e, n) => w.get(d(this, tt), e, n)); + if (d(me, Oe)) return d(me, Oe); + } +}; +Oe = new WeakMap(), tt = new WeakMap(), v(me, Oe, null), O(me, "getInstance", () => (d(me, Oe) || q(me, Oe, new me()), d(me, Oe))); +let Bt = me; +const Ae = Bt.getInstance(); +var Ke, St, nt, rt, xt; +const Ne = class Ne { + constructor(...e) { + v(this, nt, []); + v(this, rt, (e) => { + var n; + for (let r of e) Array.isArray(r[0]) ? d(this, rt).call(this, r) : d(this, nt).push(d(n = Ne, St).call(n, r[0], r[1])); + }); + O(this, "toValue", async (e, n = null) => { + const r = { getValue: () => e, getRecord: () => n }; + let i = e; + for (const o of d(this, nt)) try { + const a = await o; + if (typeof a != "function") { + console.warn("middleware is not a function, skip:", a); + continue; + } + i = await a.call(r, i); + } catch (a) { + console.error("middleware error, skip:", a); + } + return i; + }); + O(this, "toRender", (e, n, r = null) => x.createElement(d(this, xt), { value: e, record: n }, r)); + v(this, xt, ({ value: e, record: n, children: r }) => { + const [i, o] = L(r), a = Ir(); + return Yt(() => { + o(r), this.toValue(e, n).then((s) => a() && o(s)).catch((s) => a() && o(`${s}`)); + }, [e, n]), i; + }); + d(this, rt).call(this, e); + } +}; +Ke = new WeakMap(), St = new WeakMap(), nt = new WeakMap(), rt = new WeakMap(), xt = new WeakMap(), v(Ne, Ke, null), v(Ne, St, w.memoize((e, n) => { + if (typeof e == "function") return e(n); + if (typeof e == "string") return Z.getWidgetComponent(e).then((r) => { + var i; + return ((i = r.default) == null ? void 0 : i.call(r, n)) || ((o) => o); + }); + throw new TypeError("middleware must be a string or a function"); +}, (...e) => { + var n; + return d(Ne, Ke) || q(Ne, Ke, Oi()), d(n = Ne, Ke).call(n, ...e); +})); +let Ct = Ne; +const se = x.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { +}, getSelectedRows: () => [], onReload: () => { +}, onClickCallback: () => { +}, onConditionChange: () => { +}, onTabChange: () => { +}, onSiderChange: () => { +}, onKeywordChange: () => { +}, onPageChange: () => { +}, onPageSizeChange: () => { +}, reload: () => { +}, setPage: () => { +}, setPageSize: () => { +}, setTab: () => { +}, setSider: () => { +}, setKeyword: () => { +}, setCondition: () => { +} }), xn = ({ className: t, record: e, column: n, ...r }) => { + if (n != null && n.editableByJs && (n != null && n.uuid)) { + const { formSetting: i = { primaryKey: "id" }, widgetSetting: o = {}, widgetContainerSetting: a = {} } = (n == null ? void 0 : n.editableByJsSetting) || {}; + return h(R.Popover, { widget: Bn, widgetData: { record: e, column: n }, widgetSetting: { widgetSetting: o, formSetting: i }, 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), ...r }) }); + } + return h("td", { className: t, ...r }); +}, Bn = ({ record: t, column: e, $close: n, $setting: r }) => { + const i = H(Ni(w.get(t, e == null ? void 0 : e.dataIndex))), { listCode: o, onClickCallback: a } = pe(se), [s] = ae.useForm(), { formSetting: l, widgetSetting: c } = r, { primaryKey: u = "id", help: p, validators: m } = l || {}, g = () => { + s.setFieldsValue({ value: w.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); + }; + return Nt(() => g(), [t, e == null ? void 0 : e.dataIndex, o]), h(ie, { actions: A(x.Fragment, { children: [h(R, { size: "small", onClick: g, children: "重置" }), A(Dt.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 "获取更新主键失败!"; + U.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(ae, { form: s, children: [h(nn, { label: "", code: "value", type: i.current, widget: e == null ? void 0 : e.editableByJs, help: p, extras: c, validators: m }), h(Qt, { noStyle: !0, name: ["__PROPS__"], children: () => { + } })] }) }); +}; +Bn.displayName = "DataListCellEditableContainer"; +const ri = (t) => function(e) { + return t(e, getRecord()); +}, ii = async ({ widgetByJs: t, widgetByJsSetting: e }) => { + const n = await Z.getWidgetComponent(t).then((r) => r.default || ((i) => i)); + return function(r) { + return h(n, { value: r, $setting: e }); + }; +}, oi = (t, e = {}) => B(() => { + var n; + return (n = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : n.map(({ widgetByJs: r, widgetByJsSetting: i, middlewares: o, ...a }, s) => { + const l = (c) => ({ record: c, column: a }); + return o || (o = []), r && o.push([ii, { widgetByJs: r, widgetByJsSetting: i }]), o.length > 0 ? (a != null && a.render && o.push([ri, a.render]), { ...a, onCell: l, render: (c, u) => new Ct(o).toRender(c, u, "-") }) : { ...a, onCell: l }; + }); +}, [t, e]), ai = (t = {}) => B(() => { + var e; + return t.body ?? (t.body = { cell: xn }), (e = t.body).cell ?? (e.cell = xn), t; +}, [t]), To = (t) => { + const [e, n] = L({}); + return W(() => { + let r = !1; + return t && U.get(`/api/_/${t}`).then((i) => w.pick(i, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig", "selectionType"])).then((i) => !r && n(i)), () => r = !0; + }, [t]), e; +}, Oo = (t, e = {}) => { + const [n, r] = L({ dataSource: [] }); + return gt(() => { + let i = !1; + return t && U.get(`/api/${t}/${U.encode({ page: 1, ...e })}`).then((o) => !i && r(o)), () => i = !0; + }, [t, e]), n; +}, Wn = (t = [], e = /* @__PURE__ */ new Map(), n = "id", r) => { + const i = J(r ? (o) => w.get(o, n, w.get(o, [r, n])) : (o) => w.get(o, n), [n, r]); + return J((o) => t == null ? void 0 : t.filter((a) => !a.uuid || !e.has(a.uuid) || e.get(a.uuid).some((s) => s == i(o))), [t, e, i]); +}, Wt = (t = [], e = /* @__PURE__ */ new Map(), n = [], r = "id", i) => { + const o = J(i ? (a) => w.get(a, r, w.get(a, [i, r])) : (a) => w.get(a, r), [r, i]); + return B(() => { + if (w.isEmpty(t) || !t.some(({ uuid: s }) => Un.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]); +}, si = (t, e, n = "id", r = null) => { + const i = vt(), 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, [r, 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([U.get(`/api/${e}/detail/${g}`), U.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([S, b]) => { + const E = w.get(a.current, f > -1 ? [f, "children", y, "children"] : [y, "children"]); + a.current = An(a.current, f > -1 ? { [f]: { children: { $splice: [[y, 1, { ...S, children: E }]] } } } : { $splice: [[y, 1, { ...S, children: E }]] }); + const k = new Map(b); + s.current.forEach(($, F) => { + var I; + (I = k.get(F)) != null && I.some((T) => T == g) || s.current.set(F, $.filter((T) => T !== g)); + }), k.forEach(($, F) => { + s.current.has(F) ? s.current.set(F, w.uniq([...s.current.get(F) || [], ...$])) : s.current.set(F, $); + }); + }).then(() => { + o.current = !0, i(); + }); + } + }]; +}, li = (t, e) => { + const n = vt(), r = H(e), i = H(/* @__PURE__ */ new Map()), o = H([]), a = w.throttle((l) => { + o.current = [], U.list(t, w.pick({ ...r.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: c, condition: u, total: p, tab: m, sider: g, page: f, pageSize: y, operationsAccess: S, dataSource: b }) => { + r.current = { tab: m, condition: u, sider: g, keyword: c, total: p, pageSize: y, page: b != null && b.length ? f : 1 }, o.current = b, i.current = new Map(S), n(); + }); + }, 380, { leading: !1, trailing: !0 }); + Nt(() => { + o.current = [], t && a(e); + }, [t, e]); + const s = B(() => w.pick(r.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword", "primaryKey"]), [r.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: An(r.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => a({ sider: l, page: 1 }), onKeywordChange: (l) => a({ keyword: l, page: 1 }), itemOperationsAccess: i.current, dataSource: o.current, onReload: a, payload: e == null ? void 0 : e.payload }); +}, ci = ({ listCode: t, className: e, layouts: n = {}, dataSource: r, isPaginate: i, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: m, itemGridLayout: g, $setting: f, tabs: y, isConditionFormLayout: S, isTreeSider: b, treeSiderConfig: E, rowSelection: k }) => { + const { classNames: $, onClickCallback: F } = pe(se), I = w.pick(f, ["column", "colWidth", "beforeRender", "afterRender", "style", "itemMargin", "containerPadding"]), T = f == null ? void 0 : f.isMarkSelected, N = Wn(l, c, p, u), V = J((P, M, D) => h(di, { isMarkSelected: T, className: j("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: o ? N(M) : [], data: u ? { [u]: M } : M, children: P, onClickCallback: F }), [T, u, p, o, F, l, c]); + return A("div", { className: j("ff-data-list-framework", e), children: [h(n.sider, { isTreeSider: b, ...E }), A("div", { className: j("ff-data-list-container", $ == null ? void 0 : $.container), children: [h(n.filter, { isConditionFormLayout: S }), h(n.toolbar, { title: m, tabs: y }), h(Ei, { ...g, ...I, rowSelection: k, empty: h(n.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: V, dataSource: r }), h(n.footer, { isPaginate: i, isOperations: a, operations: s })] })] }); +}, di = ({ className: t, operations: e, children: n, data: r, onClickCallback: i, 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: r, confirm: c.confirm, onAfterClick: (u) => u !== !1 && (i == null ? void 0 : i(c.isRefresh, r)) }, c.uuid || Mt()) }, (c == null ? void 0 : c.uuid) || Mt())) })] }), ui = ({ listCode: t, className: e, layouts: n = {}, dataSource: r, columns: i, isItemOperations: o, isBatchOperations: a, batchOperations: s, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: m, tabs: g, isPaginate: f, rowSelection: y, isTreeSider: S, treeSiderConfig: b, isConditionFormLayout: E, ...k }) => { + const { classNames: $, onClickCallback: F } = pe(se), I = Wn(l, c, p, u), T = Wt(l, c, r, p, u); + return A("div", { className: j("ff-data-table-framework", e), children: [h(n.sider, { isTreeSider: S, ...b }), A("div", { className: j("ff-data-table-container", $ == null ? void 0 : $.container), children: [h(n.filter, { isConditionFormLayout: E }), h(n.toolbar, { title: m, tabs: g }), h(wi, { ...k, primaryKey: p, className: "ff-data-table-content", columns: i, dataSource: r, rowSelection: y, operationRender: T ? (N) => { + var V; + return h("div", { className: "ff-data-table-actions", children: (V = I(N)) == null ? void 0 : V.map((P, M) => 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 || M)) }); + } : null }), h(n.footer, { isPaginate: f, isOperations: a, operations: s })] })] }); +}, en = (t = [], e, n = null) => { + var r; + return (r = w.sortBy(t, ["y", "x"])) == null ? void 0 : r.map(({ i, x: o, y: a, w: s, h: l, field: { boxStyle: c, ...u } = {} }, p) => h("div", { className: "grid-layout-item", style: _n(o, a, s, l, c), children: h(e, { ...u, basicForm: n }) }, i ?? p)); +}, _n = (t, e, n, r, i = {}, o = 0) => { + const a = { "--grid-layout-h": `${r}`, "--grid-layout-w": `${n}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; + return i != null && i.autoHeight ? a.height = "fit-content" : a["--grid-layout-row"] = `${r}`, i != null && i.alignItems && (a["--grid-layout-box-align-items"] = i.alignItems), i != null && i.justifyContent && (a["--grid-layout-box-justify-content"] = i.justifyContent), a["--grid-layout-box-margin"] = En(i == null ? void 0 : i.marginTop, i == null ? void 0 : i.marginRight, i == null ? void 0 : i.marginBottom, i == null ? void 0 : i.marginLeft), a["--grid-layout-box-padding"] = En(i == null ? void 0 : i.paddingTop, i == null ? void 0 : i.paddingRight, i == null ? void 0 : i.paddingBottom, i == null ? void 0 : i.paddingLeft), o && (a.height = `${o}px`), a; +}, En = (t, e, n, r) => `${t || 0}px ${e || 0}px ${n || 0}px ${r || 0}px`, Ro = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, qn = (t) => Object.keys(t).reduce((e, n) => (/^on[A-Z]/.test(n) && (e[n] = t[n]), e), {}), Kn = ({ className: t, isConditionFormLayout: e }) => { + var m, g; + const [n, r] = L({}), { listCode: i, onKeywordChange: o, onConditionChange: a, getBase62params: s, classNames: l } = x.useContext(se), { keyword: c, condition: u } = (s == null ? void 0 : s()) || {}, [p] = yt.useForm(); + return W(() => { + i && e && U.get(`/api/_/${i}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: S, rowHeight: b, cols: E, fields: k }) => { + r({ resource: f, itemMargin: [y, S], rowHeight: b, cols: E, fields: k }); + }).catch(() => r({})); + }, [i, e]), W(() => { + p.setFieldsValue({ keyword: c, ...u }); + }, [JSON.stringify([c, u])]), h("div", { className: j("ff-data-list-filter", l.filter, t), children: h(yt, { 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(pi, { 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: _n(20, 0, 5, 2), children: h(yt.Item, { name: ["keyword"], children: h(Dr.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => o(f) }) }) }) }) }) }); +}, pi = ({ cols: t, fields: e, onReset: n }) => { + const [r, i] = 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(yt.Item, { label: " ", style: { "--item-span": 5 }, className: j("ff-data-list-filter-actions", { expanded: r }), children: [h(bt, { onClick: n, children: "重置" }), h(bt, { type: "primary", htmlType: "submit", children: "查询" }), o && h(R.Link, { className: "ff-data-list-filter-expanded-button", widget: () => i((a) => !a), type: "primary", name: r ? "关闭" : "展开", icon: r ? "icon-up" : "icon-down", iconPosition: "end" })] }); +}; +Kn.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 gi = ({ className: t, operations: e, isOperations: n, isPaginate: r }) => { + const { onPageChange: i, onPageSizeChange: o, onClickCallback: a, getBase62params: s } = x.useContext(se), { total: l, page: c, pageSize: u } = (s == null ? void 0 : s()) || {}; + return n && !w.isEmpty(e) || r ? 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)) }), r && h(Ur, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${c} 页 / 总共 ${p} 条`, onChange: i, onShowSizeChange: o })] }) : null; +}, hi = [{ 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" }] }] }], mi = ({ className: t, width: e = 280, isTreeSider: n }) => { + const { classNames: r } = pe(se); + return n ? h(zr.DirectoryTree, { className: j("ff-data-list-sider", r.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: hi }) : null; +}, fi = ({ className: t, title: e, tabs: n }) => { + const { getBase62params: r, onTabChange: i, onReload: o, classNames: a } = pe(se), { tab: s } = (r == null ? void 0 : r()) || {}, [l, c] = Hr((n == null ? void 0 : n[0].value) ?? (n == null ? void 0 : n[0].code), { value: s, onChange: i }); + return A("div", { className: j("ff-data-list-toolbar", a.toolbar, t), children: [h("div", { className: "ff-data-list-title", children: e }), h(Br, { 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" })] })] }); +}, yi = ({ className: t, ...e }) => h(Ut, { className: j(t, "ff-data-list-empty"), image: Ut.PRESENTED_IMAGE_SIMPLE, ...e }), Hn = ({ isItemGridLayout: t, theme: e, themeProps: n, onClickCallback: r, onReload: i, listCode: o, total: a = 0, page: s = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: p, onTabChange: m, keyword: g, onKeywordChange: f, condition: y, onConditionChange: S, sider: b, onSiderChange: E, layouts: k, classNames: $ = {}, payload: F = {}, dataSource: I = [], rowSelection: T, getSelectedRows: N, primaryKey: V, ...P }) => { + const [M, D] = L(), z = N ?? (() => I), X = J((_, le) => { + const K = { tab: p, page: s, pageSize: c, keyword: g, sider: b, condition: y, total: a, payload: F }; + return _ && _ != "init" ? w.get(K, _, le) : K; + }, [JSON.stringify(y), JSON.stringify(F), p, s, c, g, b, a]), xe = B(() => { + let _ = { sider: mi, filter: Kn, footer: gi, toolbar: fi, empty: yi }; + k === !1 ? _ = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : w.isPlainObject(k) && (_ = Object.assign({}, _, k)); + for (const le in _) if (_[le]) { + if (Rr(_[le])) { + const K = _[le]; + _[le] = (mt) => x.cloneElement(K, mt); + } + } else _[le] = () => h(x.Fragment, {}); + return _; + }, [k]); + return W(() => { + e ? Z.getWidgetComponent(e).then((_) => { + if (!_) throw `${e} not found`; + return _; + }).catch((_) => ({ default: () => `${_}` })).then((_) => D(x.createElement(_.default, { ...P, layouts: xe, $setting: n }))) : D(h(t ? ci : ui, { ...P, layouts: xe, $setting: n })); + }, [e, n]), h(se.Provider, { value: { classNames: $, listCode: o, onClickCallback: r, onReload: i, getBase62params: X, onPageChange: l, onPageSizeChange: u, onTabChange: m, onSiderChange: E, onKeywordChange: f, onConditionChange: S, setPage: l, setPageSize: u, setTab: m, setSider: E, setKeyword: f, setCondition: S, getSelectedRows: z }, children: M && x.cloneElement(M, { dataSource: I, primaryKey: V, rowSelection: T, ...P }) }); +}; +Hn.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, ze, Et; +const fe = class fe { + constructor() { + v(this, $e, null); + v(this, ze, /* @__PURE__ */ new Map()); + v(this, Et, () => { + if (d(this, $e)) return d(this, $e).port.postMessage({ command: "status", data: [] }); + q(this, $e, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), d(this, $e).port.onmessage = (e) => { + var n, r; + (n = e.data) != null && n.uuid ? d(this, ze).forEach((i, o) => { + var a; + (i == "*" || (a = i == null ? void 0 : i.includes) != null && a.call(i, e.data.uuid)) && o(e.data); + }) : ((r = e.data) == null ? void 0 : r.readyState) == WebSocket.CLOSED && U.get("/api/user-api-token").then(({ token: i, expire_at: o }) => { + d(this, $e).port.postMessage({ command: "initWs", data: [`ws${w.trimStart(U.appUrl, "http")}api/user-resource-status-ws?token=${i}`] }); + }); + }, 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, ze).set(e, n), d(this, ze).size == 1 && d(this, Et).call(this), () => this.unsubscribe(e))); + O(this, "unsubscribe", (e) => d(this, ze).delete(e)); + if (d(fe, Re)) return d(fe, Re); + } +}; +Re = new WeakMap(), $e = new WeakMap(), ze = new WeakMap(), Et = new WeakMap(), v(fe, Re, null), O(fe, "getInstance", () => (d(fe, Re) || q(fe, Re, new fe()), d(fe, Re))); +let _t = fe; +const Jn = _t.getInstance(), tn = x.forwardRef(({ listCode: t, base62params: e, className: n, theme: r, themeProps: i, layouts: o, classNames: a, rowSelection: s = null, onDataSourceChange: l }, c) => { + const [{ resource: u, primaryKey: p, batchOperations: m = [], itemOperations: g = [], columns: f = [], isConditionFormLayout: y = !1, isTreeSider: S, treeSiderConfig: b, theme: E, themeConfig: k, isItemGridLayout: $, itemGridLayout: { themeConfig: F, ...I } = {}, title: T, isPaginate: N, tabs: V, selectionType: P }, M] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: D = P, selectedRowKeys: z, defaultSelectedRowKeys: X, onChange: xe, ..._ } = s ?? {}, le = li(t, e), [{ dataSource: K, itemOperationsAccess: mt, condition: cr, tab: dr, keyword: ur, page: ln, total: cn, pageSize: dn, sider: pr, onConditionChange: gr, onTabChange: hr, onKeywordChange: mr, onPageChange: fr, onPageSizeChange: yr, onSiderChange: wr, onReload: Ot, payload: br }, un] = si(le, t, p, u), Cr = bn(l); + Xt(() => { + Cr(K, { primaryKey: p, page: ln, pageSize: dn, total: cn }); + }, [K]); + const [pn, kr] = Vr([], { defaultValue: X ?? [], value: z }), [gn, Sr] = L([]), hn = J(() => D ? gn : K, [D, gn, K]), xr = Wt(g, mt, K, p), Er = Wt(m); + W(() => { + let ee = null; + return t && U.get(`/api/_/${t}`).resp(({ data: Me, res: Rt }) => { + Me != null && Me.isDynamicRefresh && (ee = Jn.subscribe(() => Ot(), Rt)), M(Me); + }).catch(() => M({})), () => ee == null ? void 0 : ee(); + }, [t]), x.useImperativeHandle(c, () => ({ onReload: Ot, onClickCallback: un, getSelectedRows: hn })); + const mn = bn((ee, Me) => { + Sr((Rt) => { + const fn = new Map(Rt.map((ce) => [ce == null ? void 0 : ce[p], ce])); + return Me.forEach((ce) => fn.set(ce == null ? void 0 : ce[p], ce)), ee.map((ce) => fn.get(ce)).filter(Boolean); + }), kr(ee), xe == null || xe(ee, Me); + }), $r = B(() => D ? { columnWidth: 80, ..._, type: D, selectedRowKeys: pn, onChange: mn } : void 0, [D, pn, mn, s]), Pr = B(() => w.merge({}, k, i), [k, i]), vr = B(() => g == null ? void 0 : g.map((ee) => w.isEmpty(ee == null ? void 0 : ee.confirm) ? ee : { ...ee, confirm: Object.assign({}, ee.confirm, { getPopupContainer: () => document.body }) }), [g]), Nr = B(() => ({ ...I, themeProps: F }), [I, F]); + return h(Hn, { listCode: t, title: T, classNames: a, layouts: o, resource: u, primaryKey: p, theme: r || E, themeProps: Pr, isTreeSider: S, treeSiderConfig: b, isPaginate: N, rowSelection: $r, getSelectedRows: hn, tabs: V, isItemOperations: xr, itemOperations: vr, isBatchOperations: Er, batchOperations: m, isItemGridLayout: $, columns: f, itemGridLayout: Nr, isConditionFormLayout: y, itemOperationsAccess: mt, dataSource: K, onConditionChange: gr, onTabChange: hr, onKeywordChange: mr, onPageChange: fr, onPageSizeChange: yr, onSiderChange: wr, condition: cr, tab: dr, keyword: ur, page: ln, total: cn, pageSize: dn, sider: pr, payload: br, className: j("ff-data-list-helper", n), onReload: Ot, onClickCallback: un }); +}), Gn = (t, e, n = !0) => n !== !0 && n-- <= 0 ? [] : w.isArray(t) && !w.isEmpty(t) ? t.reduce((r, i) => (Reflect.has(i, e) && Reflect.has(i, "children") && r.push(i[e]), Reflect.has(i, "children") && !w.isEmpty(i.children) ? r.concat(Gn(i.children, e, n)) : r), []) : [], wi = ({ className: t, primaryKey: e, columns: n = [], dataSource: r = [], operationRender: i, operationWidth: o = 180, components: a = {}, rowSelection: s, ...l }) => { + const { classNames: c } = pe(se), u = H(null), p = H(null), [m, g] = L([]), [f, y] = L({ width: 0, height: 0 }); + W(() => { + g(Gn(r, e)); + }, [r, e]), Fr(() => { + const k = new ResizeObserver(() => { + var $; + y({ width: (($ = u.current) == null ? void 0 : $.nativeElement.querySelector(".ant-table-body").scrollWidth) || p.current.offsetWidth, height: p.current.offsetHeight }); + }); + return p.current && k.observe(p.current), () => { + p.current && k.unobserve(p.current); + }; + }, []); + const S = B(() => { + if (!(f != null && f.width) || !(n != null && n.length)) return n; + const k = (s ? s.columnWidth ?? 32 : 0) + (i ? o : 0), $ = n.reduce((T, N) => T + (N != null && N.isWidthFixed && N.width ? N.width : 0), 0), F = n.filter((T) => !(T != null && T.isWidthFixed)).reduce((T, N) => T + ((N == null ? void 0 : N.width) ?? 100), 0); + if ($ + F + k >= f.width) return n; + const I = f.width - $ - k; + 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, i, o]), b = oi(S), E = ai(a); + return h("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: f.height ? h(Cn, { bordered: !0, ...l, components: E, ref: u, rowKey: (k) => (k == null ? void 0 : k[e]) ?? Math.random(), rowSelection: s, columns: (() => { + var $, F; + const k = [...b ?? []]; + return s && k.splice((F = ($ = k[0]) == null ? void 0 : $.key) != null && F.startsWith("__") ? 1 : 0, 0, Cn.SELECTION_COLUMN), i && k.push({ title: "操作", align: "center", fixed: "right", className: "ff-data-list-table-operations", width: `${Math.ceil(o / f.width * 100).toFixed(2)}%`, render: (I, T, N) => i(T, N) }), k; + })(), dataSource: r, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: m } }) : null }); +}, bi = "RC_FORM_INTERNAL_HOOKS", Ci = (t) => { + const [e, n] = x.useState({ items: [] }); + return W(() => { + t && U.get(`/api/_/${t}`).then(({ uuid: r, code: i, name: o, resource: a, primaryKey: s, marginX: l, marginY: c, cols: u, rowHeight: p, fields: m, theme: g, themeSetting: f, groups: y }) => ({ uuid: r, code: i, 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; +}, ki = (t, { initialValue: e, initialValueLanguage: n, convertJs: r, convertJsSetting: i, type: o = "string" }, a = null) => { + const s = H(!1), l = pe(In), [c, u] = L(), [p, m] = L(n != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(bi) || {}; + return W(() => g == null ? void 0 : g((f, y, S) => { + if (!s.current) return; + const b = w.get(y, t); + w.isEqual(b, p) || m(ue(b, o)); + }), [p]), W(() => { + n == "javascript" && e ? Le.exec(e, {}, { getFieldValueForBasicForm: (f) => a ? a.getFieldValue(f) : l.getFieldValue(f), getFieldValue: (f) => l.getFieldValue(f) }).then((f) => m(ue(f, o))).catch((f) => notification.error({ message: `布局数据错误: ${JSON.stringify(f)}` })).finally(() => s.current = !0) : (e && m(ue(e ?? l.getFieldValue(t), o)), s.current = !0); + }, [e, n]), gt(() => { + s.current && r && new Ct([r, i]).toValue(p, l.getFieldsValue(!0)).then(u).catch((f) => { + u(f), console.error("布局数据转换错误: ", f, r); + }); + }, [p, r, i]), [c ?? p, p]; +}, Fo = (t, e, n = null) => B(() => en(t, e, n), [t]), Yn = (t, e, n = {}, r = {}, i = {}, o = null) => { + const a = pe(In), s = vt(), l = H(!0), c = H([]), [u, p] = L(e), [m, g] = L(), f = ae.useWatch((y) => JSON.stringify(w.pick(y, c.current)), a) || "{}"; + return Nt(() => { + t && Le.exec(t, n, { ...r, getFieldValueForBasicForm: (y) => i ? i.getFieldValue(y) : null, getFieldValue: w.wrap(a.getFieldValue, (y, S) => (c.current.some((b) => w.isEqual(b, S)) || (c.current.push(S), s()), y == null ? void 0 : y(S))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((y) => { + l.current && (p(y), g(null)); + }).catch((y) => { + l.current && (p(e), g(y)); + }); + }, [t, f, a, n, r]), W(() => () => l.current = !1, []), t ? [o ? ue(u, o) : u, m] : [o ? ue(e, o) : e, null]; +}, Si = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: n, ...r }) => { + const i = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [o, a] = L(); + return W(() => { + i && Z.getWidgetComponent(i).then(({ defaultProps: s = {}, default: l }) => ({ default: xi(l, s, n) })).catch((s) => ({ default: () => `${s}` })).then((s) => a(x.createElement(s.default, r))); + }, [i]), o; +}, xi = (t, e = {}, n = null) => (r) => { + const { code: i, label: o, extras: a, isVirtual: s, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: m, ...g } = w.merge({}, e, r), [f, y] = ki(s ? null : i, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, n), S = B(() => { + const k = Object.keys((e == null ? void 0 : e.extras) || {}); + return w.over([w.partialRight(w.pick, k), w.partialRight(w.omit, k)]); + }, [e == null ? void 0 : e.extras]), [b, E] = S(g); + return h(t, { ...E, value: f, rawValue: y, $setting: Object.assign({}, a, b) }); +}, Xn = ({ theme: t, basicForm: e, items: n = [{ key: "default", label: "默认" }], fields: r = [], itemRender: i, chunks: o = [], children: a, $setting: s = {}, ...l }) => { + const [c, u] = L(); + W(() => { + t ? Z.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: i(m, r == null ? void 0 : r.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 } }); +}, Qn = ({ name: t, form: e = null, basicForm: n = null, style: r = {}, className: i, cols: o = 12, rowHeight: a = 21, containerPadding: s = [0, 0], itemMargin: l = [4, 0], formProps: c = {}, formFields: u = [], fields: p = [], data: m, theme: g, themeProps: f = {}, groups: y = [{ key: "default", label: "默认" }], children: S, ...b }) => { + const [E] = ae.useForm(e), k = B(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]); + gt(() => (E.setFieldsValue(m), () => E.resetFields()), [m]); + const $ = (F, I, T) => { + const N = en(I, Si, n), V = qn(b); + return A("div", { ...V, className: j("ff-grid-layout", i), style: { ...r, "--grid-layout-item-margin-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-item-margin-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-container-padding-y": `${(s == null ? void 0 : s[0]) || 0}px`, "--grid-layout-container-padding-x": `${(s == null ? void 0 : s[1]) || 0}px`, "--grid-layout-cols": o, "--grid-layout-row-height": `${a}px` }, children: [N, T && x.cloneElement(T, { cols: o, rowHeight: a, itemMargin: l, containerPadding: s, fields: I, basicForm: n })] }); + }; + return h(ae, { ...b, fields: k, form: E, component: !1, children: g ? h(Xn, { ...f, items: y, theme: g, itemRender: $, fields: p, children: S, basicForm: n }) : $(0, p, S) }); +}, jo = /* @__PURE__ */ ((t) => function({ code: e, data: n, ...r }) { + const { uuid: i, resource: o, items: a, hides: s, rowHeight: l, marginX: c, marginY: u, cols: p, theme: m, themeProps: g, groups: f } = Ci(e) || {}, y = B(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: i }], [e, i, o]); + return o && h(t, { name: e, theme: m, themeProps: g, groups: f, ...r, fields: a, formFields: y, rowHeight: l, cols: p, itemMargin: [c, u], data: o ? { [o]: n } : n }); +})(Qn), Ei = ({ column: t = 0, colWidth: e = 0, cols: n, rowHeight: r, itemMargin: i, containerPadding: o, fields: a, primaryKey: s, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: m = ($, F, I) => $, empty: g = h(Ut, { description: null }), className: f, style: y = {}, theme: S, themeProps: b = {}, groups: E = [{ key: "default", label: "默认" }], rowSelection: k }) => { + const { classNames: $ } = pe(se), F = J((N) => { + if (!k) return; + const { selectedRowKeys: V = [], onChange: P, type: M = "checkbox" } = k, D = N == null ? void 0 : N[s]; + let z; + z = M === "radio" ? [D] : V.includes(D) ? V.filter((X) => X !== D) : [...V, D], P == null || P(z, l.filter((X) => z.includes(X == null ? void 0 : X[s]))); + }, [k, s, l]), I = B(() => h(Qn, { groups: E, theme: S, themeProps: b, cols: n, rowHeight: r, itemMargin: i, containerPadding: o, fields: a, className: p }), [a, n, r, i, o, E, S, 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, V) => { + var z; + const P = (N == null ? void 0 : N[s]) ?? V, M = `${P}-${Ti(N)}`, D = m(x.cloneElement(I, { data: N }), N, V); + return x.cloneElement(D, { key: M, ...k && { isSelected: (z = k == null ? void 0 : k.selectedRowKeys) == null ? void 0 : z.includes(P), selectionType: k.type ?? "checkbox", onSelect: () => F(N) } }); + }), u == null ? void 0 : u(l)] }); +}, $i = ({ component: t, $props: e }) => { + const { base62params: n } = Pt(e, {}); + return h(ie, { children: h(tn, { listCode: t, base62params: U.decode(n) }) }); +}, Io = () => h(Zn, {}), Zn = () => "Empty", Pi = ({ component: t, $setting: e, $props: n }) => { + const [r, i] = L(), [o, a] = ir(n); + return W(() => { + if (!t) return i(h(Zn, { description: null })); + Z.getWidgetComponent(t).catch((s) => ({ default: () => `${s}` })).then((s) => x.createElement(s.default, { $setting: e })).then(i); + }, [t]), r ? x.cloneElement(r, { ...o, $setProps: a }) : null; +}, Ao = () => "NotFoundPage"; +var Fe, de, je, be, it, ot; +const ye = class ye { + constructor() { + v(this, de, /* @__PURE__ */ new Map()); + v(this, je, {}); + v(this, be, null); + O(this, "init", (e, n) => { + q(this, de, e), q(this, je, n); + }); + O(this, "get", (e) => (d(this, de).has(e) || (e = Array.from(d(this, de).keys()).find((n) => d(this, de).get(n).uri === e)), d(this, de).get(e) || {})); + O(this, "redirect", (e, n, r = {}) => { + var f; + const { uri: i, 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 = U.encode(u != null && u.base62params ? u.base62params : u)); + let m = Jr(i || 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()}`), r != null && r.isOpenWindow ? window.open(m) : d(this, be).navigate(m, { replace: !!(r != null && r.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 r in d(this, je)) if (n = d(this, it).call(this, d(this, je)[r], e, [r]), n.length > 1) return n; + return n; + }); + O(this, "getMenusByRouteUuid", (e) => d(this, ot).call(this, e, Object.values(d(this, je)).flat())); + v(this, it, (e, n, r = []) => { + if (w.isEmpty(e)) return r; + for (const { uuid: i, children: o } of e) { + if (i == n) return r.concat(i); + if (!w.isEmpty(o)) return r.concat(i, d(this, it).call(this, o, n)); + } + return r; + }); + v(this, ot, (e, n) => { + var i; + let r = []; + for (const o of n) o.widgetType == "redirect" && (o.uuid == e || o.widget == e ? r.push(o) : (i = o.children) != null && i.length && (r = r.concat(d(this, ot).call(this, e, o.children)))); + return r; + }); + 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 r; + const n = (r = d(this, be).state.matches[d(this, be).state.matches.length - 1 - e]) == null ? void 0 : r.route; + if (!n) return null; + for (let [i, o] of d(this, de)) if (o.uri === n.path) return o; + return null; + }); + O(this, "getPageParams", (e) => { + var a, s; + const { location: n = {}, matches: r = [] } = ((a = d(this, be)) == null ? void 0 : a.state) || {}, i = { ...((s = r[r.length - 1]) == null ? void 0 : s.params) || {} }, o = n.search; + return o && new URLSearchParams(o).forEach((l, c) => { + i[c] = l; + }), e ? w.get(i, e) : i; + }); + O(this, "usePageParams", (e) => { + var r; + let n = Ln() ? { ...Gr(), ...Object.fromEntries(new URLSearchParams(((r = Yr()) == null ? void 0 : r.search) ?? "")) } : this.getPageParams(); + return e ? w.get(n, e) : n; + }); + O(this, "createBrowserRouter", (e = {}) => { + if (d(this, de).size == 0) return null; + if (d(this, be)) return d(this, be); + const n = Ae.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), r = Ae.get(Z.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), i = { [n]: 0 }, o = (s, l) => () => Promise.all([Z.getWidgetComponent(s), Pt(l)]).then(([c, u]) => [c.default || function() { + return `${s}`; + }, u]).then(([c, u]) => ({ Component: () => x.createElement(Vn, {}, x.createElement(c, { $setting: u })) })), a = Array.from(d(this, de).values()).reduce((s, { uuid: l, uri: c, name: u, type: p, component: m, widgetSetting: g, widgetProps: f, isLogin: y, isLayout: S, extra: b }) => { + let E = {}, k = 0; + switch (p) { + case "list": + E.element = x.createElement($i, { component: m, $props: f }); + break; + case "fsdpf-component": + E.element = x.createElement(Pi, { 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 (!i[$]) return i[$] = s.length, [...s, { path: "/", lazy: o($, F), children: [{ path: c, ...E }] }]; + k = i[$]; + } + return S && k > -1 ? (s[k].children.push({ path: c, ...E }), s) : [...s, { path: c, ...E }]; + }, [{ path: "/", lazy: o(n, {}), children: [] }]); + return a.push({ index: !0, element: x.createElement(vi, { to: r, replace: !0 }) }), q(this, be, Xr(a, e)); + }); + if (d(ye, Fe)) return d(ye, Fe); + } +}; +Fe = new WeakMap(), de = new WeakMap(), je = new WeakMap(), be = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), v(ye, Fe, null), O(ye, "getInstance", () => (d(ye, Fe) || q(ye, Fe, new ye()), d(ye, Fe))); +let qt = ye; +const vi = ({ to: t, replace: e }) => Ln() ? x.createElement(Qr, { to: t, replace: e }) : (window.document.location = t, "redirect"), Q = qt.getInstance(); +Qe.chainableTypes = [Ar]; +const Le = Qe.getInstance(new URL("/ff-worker-pipe/worker.js", self.location), { type: "module" }); +Qe.fns = { user: { logout: () => Z.logout(() => window.location.replace(Ae.get("Common.WEBSITE_LOGIN_PAGE", "/index"))), getUserInfo: (t = !0) => Z.getUserInfo(t), checkUserToken: () => Z.checkUserToken(), getUserToken: () => Z.getUserToken() }, getConfigure: (t) => Ae.get(t), route: { redirect: (...t) => Q.redirect(...t), getPageParams: (...t) => Q.getPageParams(...t), getCurrentRoute: () => Q.getCurrentRoute(), get: (t) => Q.get(t), getMenus: (t) => Q.getMenus(t), findMenuPathByUuid: (t) => Q.findMenuPathByUuid(t) }, popup: { notification: (...t) => re.notification(...t), success: (...t) => re.success(...t), error: (...t) => re.error(...t), form: (...t) => re.form(...t), modal: (...t) => re.modal(...t), confirm: (...t) => re.confirm(...t) } }, Promise.resolve().then(() => oo).then((t) => { + Qe.fns.http = t.http, Qe.fns.generateUUID = () => t.generateUUID(); +}); +const $n = { null2json: (t) => Object.create(), null2array: (t) => [], null2number: (t) => 0, null2bool: (t) => !1, null2string: (t) => "", null2integer: (t) => 0, null2float: (t) => 0, string2json: (t) => t ? JSON.parse(t) : "{}", string2array: (t) => t.substr(0, 1) === "[" && t.substr(-1) === "]" ? JSON.parse(t) : t.split(","), string2number: (t) => t == "" ? 0 : +t, string2integer: (t) => t == "" ? 0 : +t, string2float: (t) => t == "" ? 0 : +t, string2bool: (t) => { + 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" }, ue = (t, e) => { + let n = "string"; + n = Array.isArray(t) ? "array" : typeof t, w.isObject(t) && (n = "json"); + const r = `${n}2${e}`; + return Reflect.has($n, r) ? $n[r](t) : t; +}, Ni = (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, Pt = (t = {}, e = {}, n = {}, r = "") => er(t, (i, o) => o === "type" && i === "code") ? tr(t, e, n, r) : nr(t, e, r), er = (t, e = () => !1) => w.some(t, (n) => !!w.some(n, e) || (w.isEmpty(n) || !w.isPlainObject(n) && !w.isArray(n) ? void 0 : er(n, e))), tr = async (t = {}, e = {}, n = {}, r = "") => { + let i = /* @__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 = r } = t[o]; + switch (s) { + case "code": + try { + a = await Le.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 = Q.getPageParams(l); + break; + case "string": + a = l; + } + a ?? (a = c); + } else a = await tr(t[o], e, n, r); + w.set(i, o, a); + } + return i; +}, nr = (t = {}, e = {}, n = "") => Object.keys(t || {}).reduce((r, i) => { + if (w.isPlainObject(t[i])) { + let o; + if (Reflect.has(t[i], "type") && ["field", "router", "query", "string"].includes(t[i].type)) { + const { type: a, value: s = "", default: l = n } = t[i]; + switch (a) { + case "field": + o = w.get(e, s) ?? w.get(e, s.substring(s.indexOf(".") + 1)); + break; + case "router": + case "query": + o = Q.getPageParams(s); + break; + case "string": + o = s; + } + o ?? (o = l); + } else o = nr(t[i], e, n); + w.set(r, i, o); + } + return r; +}, {}), jt = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((n) => jt(n, e)) : Object.keys(t).reduce((n, r) => (e[r] ? n[e[r]] = jt(t[r], e) : n[r] = jt(t[r], e), n), {}) : t, Lo = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { + const e = 16 * Math.random() | 0; + return (t === "x" ? e : 3 & e | 8).toString(16); +}), Mo = (t) => { + var e, n; + return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.name : ""; +}, Vo = (t) => { + var e, n; + return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.category : ""; +}, Do = (t) => { + var e, n; + return t ? (n = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : n.owner : ""; +}, Ti = (t, e = 32, n = "auto") => { + const r = Kt(t), i = n === "auto" ? "x64" : n; + if (e === 32) return Ft.x86.hash32(r).toString(); + if (e === 128) return i === "x64" ? Ft.x64.hash128(r) : Ft.x86.hash128(r); + 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), Oi = () => { + let t = 1; + const e = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map(); + return (...r) => r.length === 0 ? "" : r.map((i) => { + return String((o = i) === 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("::"); +}, Ri = (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; + } +}, Uo = (t, e = "") => { + if (!t || typeof t != "string" || Ri(t)) return t; + let n = e; + return !n && typeof window < "u" && window.location && (n = `${window.location.protocol}//${window.location.host}`), t.startsWith("/") ? n ? `${n}${t}` : t : n ? `${n}/${t}` : t; +}, zo = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : typeof crypto < "u" && crypto.getRandomValues ? "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)) : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { + const e = 16 * Math.random() | 0; + return (t === "x" ? e : 3 & e | 8).toString(16); +}), vt = () => { + const t = H(!0), [, e] = x.useReducer((n) => n + 1, 0); + return W(() => () => t.current = !1, []), () => t.current && e(); +}, Bo = (t) => { + const [e, n] = L(t), r = H(null), i = J((o, a) => { + r.current = a, n(o); + }, []); + return W(() => { + r.current && (r.current(e), r.current = null); + }, [e]), [e, i]; +}, gt = (t = (r) => { +}, e, n = w.isEqual) => { + const r = x.useRef(); + n(e, r.current) || (r.current = w.cloneDeep(e)), x.useEffect(t, [r.current]); +}, Nt = gt, rr = (t, e = "string") => { + var n; + if (!Array.isArray(t)) return t; + for (let r = 0; r < t.length; r++) t[r].value = ue((n = t[r]) == null ? void 0 : n.value, e), t[r] && Reflect.has(t[r], "children") && (t[r].children = rr(t[r].children, e)); + return t; +}, Wo = (t, e = "json", n = "string", r, i = null) => { + const [o] = ae.useForm(r), [a, s] = L([{ label: "无", value: "", disabled: !0 }]), l = H([]), c = ae.useWatch((u) => l.current.length === 0 ? null : w.pick(u, l.current), o) || null; + return W(() => { + Array.isArray(t) ? s(t) : e === "javascript" && t ? Le.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) => { + s(ue(u, "array")); + }).catch((u) => console.error("useOptions", u)) : t && s(ue(t, "array")); + }, [t, e, c]), rr(a, n); +}, _o = (t) => { + const [e, n] = L(), r = { type: "GET" }; + if (typeof t == "string" ? r.url = t : w.isPlainObject(t) && Object.assign(r, t), !(r != null && r.url)) throw "url is required"; + const i = (o) => U.request(r, !1).resp((a) => (console.log("useSubscribeRequest", o), n(a), a)); + return gt(() => { + let o = null; + return i().then((a) => { + o = Jn.subscribe(w.throttle(i, 180, { leading: !1, trailing: !0 }), a.res); + }), () => o == null ? void 0 : o(); + }, r), e; +}, Fi = (t, e) => J((n) => { + const r = {}; + for (const [i, o] of Object.entries(n)) { + const a = t == null ? void 0 : t[i]; + if ((a == null ? void 0 : a.type) === "router" || (a == null ? void 0 : a.type) === "query") { + const s = Q.getCurrentRoute(); + s != null && s.uuid && Q.redirect(s.uuid, { ...Q.getPageParams(), [a.type]: { [a.value || i]: o } }, { isReplaceRouteHistory: !0 }); + } else r[i] = o; + } + Object.keys(r).length > 0 && e(r); +}, [t, e]), ir = (t, e = {}, n = {}, r = []) => { + const [i, o] = L({}), [a, s] = L({}), l = jn(a), c = Q.usePageParams(); + Yt(() => { + Promise.resolve(Pt(t, e, n)).then(s); + }, [t, e, c, ...r]), Xt(() => { + const m = l ?? {}, g = Object.keys({ ...m, ...a }).reduce((f, y) => (m[y] !== a[y] && (f[y] = a[y]), f), {}); + Object.keys(g).length > 0 && o((f) => ({ ...f, ...g })); + }, [a]); + const u = Fi(t, (m) => { + o((g) => ({ ...g, ...m })); + }), p = B(() => Object.fromEntries(Object.entries(i).filter(([m, g]) => g !== a[m])), [i, a]); + return [i, u, p]; +}, ji = (t) => { + const [e, n] = x.useState({ items: [], hides: [] }); + return x.useEffect(() => { + t && U.get(`/api/_/${t}`).then(({ pk: r, uuid: i, code: o, resource: a, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: m, listenChangeFieldsFunc: g, fields: f, theme: y, themeSetting: S, groups: b }) => ({ pk: r, uuid: i, code: o, resource: a, align: s, cols: l, rowHeight: c, marginX: u, marginY: p, theme: y, themeProps: S, groups: b, listenChangeFields: m, listenChangeFieldsFunc: g, ...f.reduce((E, k) => { + var $; + return ($ = k == null ? void 0 : k.field) != null && $.hidden ? E.hides.push(k == null ? void 0 : k.field) : E.items.push(k), E; + }, { items: [], hides: [] }) })).then(n); + }, [t]), e; +}, Ii = ({ max: t = 0, min: e = 0, type: n = "", message: r, pattern: i, required: o = !1, validator: a } = {}, s, l) => { + 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: r || (e && t ? `字符必须在 ${e} ~ ${t} 之间` : `${t ? "最多能有" : "最少要有"} ${e || t} 个字符`) }); + break; + case "pattern": + p.push({ type: "string", pattern: i, message: r }); + break; + case "validator": + a && p.push(({ getFieldValue: m }) => ({ validator: async (g, f) => { + const y = await Le.exec(a, { value: f, fieldName: s }, { getFieldValue: m }); + return w.isString(y) && y ? Promise.reject(y) : w.isBoolean(y) && !y ? Promise.reject(r) : Promise.resolve(); + } })); + } + u(p); + }, [t, e, n, r, i, o, a]), c; +}, Ai = (t, e, n) => { + const [r, i] = L(null); + return W(() => { + const { initDataUri: o = `/api/${t}`, initDataMethod: a = "GET" } = n || {}; + e && U.request({ method: a, url: w.trimEnd(`${o}/${e}`, "/") }).then((s) => { + i(s); + }); + }, [t, e, n]), r; +}, Li = (t, e, n) => J((r, i = { serialize: (o) => o, onSuccess: () => { +}, onFail: (o) => (o == null ? void 0 : o.errorFields) && re.error("请先完善表单信息", { duration: 2e3 }) }) => { + const o = r.getFieldValue("__RESOURCE__"), { submitDataUri: a = `/api/${t}`, submitDataMethod: s = "POST" } = n || {}; + return r.validateFields().then((l) => o ? w.pick(l, [o]) : l).then(i.serialize).then((l) => U.request({ method: s, url: w.trimEnd(`${a}/${e || ""}`, "/"), data: l }).msg(i.onSuccess)).catch(i.onFail); +}, [t, e, n]), Mi = (t, e, n, r) => { + const i = Ai(e, n, r); + W(() => { + i ? t.setFieldsValue(i) : t.resetFields(); + }, [t, i]); + const o = Li(e, n, r); + return w.partial(o, t); +}, Vi = (t, e, n = [], r = {}) => { + const i = H({}), o = H(), a = w.debounce(vt(), 180), s = ["disabled", "required"], l = (m, g) => { + s.includes(m) && (i.current[m] = g), a(); + }, c = B(() => ({ setDisabled: (m) => l("disabled", m), setRequired: (m) => l("required", m), getDisabled: () => i.current.disabled, getRequired: () => i.current.required }), [e]), [u, p] = Yn(e, -1, {}, c, r); + 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 = zn(m, g), i.current = w.merge(f, w.pick(i.current, s)); + } + return [t, i.current]; +}, Pn = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), qo = ({ value: t, onChange: e }, n = null) => { + const r = H(), [i] = ae.useForm(n), o = H({}); + return Nt(() => { + w.isEqual(r.current, t) || i.setFieldsValue(t); + }, [t]), W(() => () => i.resetFields(), []), [B(() => i.__INTERNAL__ ? i : { ...i, __INTERNAL__: { itemRef: (a) => (s) => { + const l = Pn(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 = Pn(a); + return o.current[s]; + } }, [i]), (a, s) => { + r.current = s, e == null || e(s); + }]; +}, nn = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: n, subWidgets: r = [], basicForm: i, ...o }) => { + const a = zn(t, e), [s, l] = Vi(a, n, r, i), [c, u] = L(); + return W(() => { + s && Z.getWidgetComponent(s).then(({ defaultProps: p = {}, default: m }) => ({ default: Di(m, p, i) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(x.createElement(p.default, o))); + }, [s]), c && x.cloneElement(c, { ...o, ...l }); +}, Di = (t, e = {}, n = null) => (r) => { + const { type: i, code: o, label: a, noStyle: s, style: l, placeholder: c, required: u = !1, extras: p, validators: m, help: g, isVirtual: f, $isReserved: y, initialValue: S, initialValueLanguage: b, ...E } = w.omit(w.merge({}, e, r), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), k = Ii(Object.assign({}, m, u ? { required: !0 } : {}), o, i), $ = B(() => { + const V = Object.keys((e == null ? void 0 : e.extras) || {}); + return w.over([w.partialRight(w.pick, V), w.partialRight(w.omit, V)]); + }, [e == null ? void 0 : e.extras]), [F, I] = $(E), T = { label: a, noStyle: s, style: l, colon: !1, layout: "vertical" }, N = J((V) => V == null ? void 0 : ue(V, i), [i]); + return h(Qt, { name: o, rules: k, initialValue: N(S), normalize: N, children: (V, P, M) => { + var D; + return h(t, { type: i, rcform: M, basicForm: n, itemProps: { validateStatus: P.errors.length > 0 ? "error" : "success", tooltip: g || null, help: P.errors.length > 0 ? P.errors.join("、") : null, required: ((D = k == null ? void 0 : k[0]) == null ? void 0 : D.required) || !1, ...T }, fieldProps: { placeholder: c, ...I, ...V }, $setting: Object.assign({}, p, F) }); + } }); +}, rn = ({ name: t, form: e = null, basicForm: n = null, style: r = {}, className: i, cols: o = 24, rowHeight: a = 16, itemMargin: s = [8, 16], containerPadding: l = [0, 0], fields: c = [], hides: u = [], primaryKey: p = 0, formProps: m = {}, formFields: g = [], listenChangeFields: f, listenChangeFieldsFunc: y, onValuesChange: S, theme: b, themeProps: E = {}, groups: k = [{ key: "default", label: "默认" }], children: $, ...F }) => { + const [I] = ae.useForm(e), T = J((P, M) => { + S == null || S(P, M), y && Array.isArray(f) && Le.exec(y, { changedValues: P, allValues: M }, { getFieldValue: I.getFieldValue, setFieldValue: I.setFieldValue, setFieldsValue: I.setFieldsValue, isFieldTouched: I.isFieldTouched, isFieldsTouched: I.isFieldsTouched }).catch((D) => console.error("onFormValuesChange", t, D)); + }, [t, I, S, f, y]), N = B(() => [{ name: "__PROPS__", value: m }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, m, g]), V = (P, M, D) => { + const z = en(M, nn, n), X = qn(F); + return A("div", { ...X, className: j("ff-grid-layout-form", i), style: { ...r, "--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: [z, D && x.cloneElement(D, { cols: o, rowHeight: a, itemMargin: s, containerPadding: l, fields: M, basicForm: n })] }); + }; + return A(ae, { ...F, form: I, fields: N, onValuesChange: T, children: [b ? h(Xn, { ...E, items: k, theme: b, itemRender: V, fields: c, children: $, basicForm: n }) : V(0, c, $), u == null ? void 0 : u.map((P) => { + var M; + return h(Qt, { name: P.code, children: h(Ui, { form: I, basicForm: n, name: P.code, type: P.type, initialValue: P.initialValue, initialValueLanguage: (M = P.extras) == null ? void 0 : M.initialValueLanguage }) }, JSON.stringify(P.code)); + })] }); +}, Ui = ({ type: t, initialValue: e, initialValueLanguage: n, onChange: r, basicForm: i }) => { + const [o, a] = Yn(n == "javascript" && e, n == "javascript" ? void 0 : e, {}, {}, i); + return W(() => { + n == "javascript" ? r(ue(o, t)) : e && r(ue(e, t)); + }, [t, e, o]), null; +}; +rn.propTypes = { fields: C.array, hides: C.array }; +const zi = /* @__PURE__ */ ((t) => ({ code: e, isPreview: n = !1, ...r }) => { + const { align: i, autoComplete: o, resource: a, items: s, hides: l, rowHeight: c, marginX: u, marginY: p, cols: m, listenChangeFields: g, listenChangeFieldsFunc: f, pk: y, uuid: S, theme: b, themeProps: E, groups: k } = ji(e), $ = B(() => [{ name: "__PK__", value: y }, { name: "__RESOURCE__", value: a }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: S }], [y, e, S, a]); + return h(t, { name: e, autoComplete: o, theme: b, themeProps: E, groups: k, ...r, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: f, fields: s, hides: l, cols: m, rowHeight: c, itemMargin: [u, p] }); +})(rn), or = ({ $setting: t, $close: e, extras: n, code: r, primaryKey: i, ...o }) => { + const [a] = ae.useForm(), s = Mi(a, r, i, t); + return h(ie, { actions: A(x.Fragment, { children: [h(R, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => s({ onSuccess: e }) }), h(R, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: n, children: h(zi, { form: a, code: r, primaryKey: i, ...o }) }); +}, vn = /* @__PURE__ */ new Set(), Ht = (t = [], e = 0) => { + const n = t[e]; + if (n.length && !vn.has(n)) { + const r = document.createElement("script"); + r.setAttribute("src", n), r.setAttribute("data-namespace", n), t.length > e + 1 && (r.onload = () => { + Ht(t, e + 1); + }, r.onerror = () => { + Ht(t, e + 1); + }), vn.add(n), document.body.appendChild(r); + } +}, kt = ({ className: t, type: e, style: n = {}, ...r }) => h("span", { role: "img", className: j("ff-iconfont", t), style: n, ...r, children: h("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: h("use", { xlinkHref: `#${e}` }) }) }); +kt.propTypes = { className: C.string, type: C.string.isRequired, style: C.object }, kt.init = Ht; +const Bi = (t, e, n, r) => Q.redirect(n, e, r), Wi = (t, e = {}, n, r = {}) => { + var o; + const i = (o = r.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 U.del(i, e.param).msg(); +}, Nn = (t, e, n, { status: { loading: r, disabled: i }, setStatus: o, listFn: a }) => { + const s = { loading: (l) => l === void 0 ? r : o((c) => ({ ...c, loading: l })), disabled: (l) => l === void 0 ? i : o((c) => ({ ...c, disabled: l })), list: a }; + return w.isFunction(n) ? n.call(null, e, s) : w.isString(n) && n ? Le.exec(n, e, s) : null; +}, Tn = (t, e, n, r, i) => w.isString(n) && n ? Z.getWidgetComponent(n).then(({ default: o }) => re.modal(o, { ...e, $setting: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i)).catch((o) => { + re.error(n, { content: o.toString() }); +}) : re.modal(n, { ...e, $setting: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), _i = (t, e, n, r, i) => re.modal(or, { ...e, $setting: r, code: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), qi = (t, e, n, r, i) => re.modal(tn, { ...r, base62params: e, listCode: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Ki = ({ widget: t, widgetType: e, widgetData: n, widgetProps: r, widgetSetting: i, widgetContainerProps: o }, { onAfterClick: a, onBeforeClick: s } = {}) => { + const l = pe(se), [c, u] = L({ leading: !0, trailing: !1 }), p = H(null), [m, g] = B(() => { + switch (e) { + case "redirect": + return [w.partialRight(Bi, t, i), null]; + case "func": + return [w.partialRight(Nn, (i == null ? void 0 : i.code) ?? t, { status: c, setStatus: u, listFn: l }), null]; + case "component": + case "fsdpf-component": + return [w.partialRight(Tn, t, i, o), (y) => ({ $setting: y })]; + case "grid-layout-form": + return [w.partialRight(_i, t, i, o), (y) => ({ $setting: y })]; + case "data-list": + return [w.partialRight(qi, t, i, o), (y) => y]; + case "destroy": + return [w.partialRight(Wi, t, i, o), null]; + default: + if (an(t) || x.isValidElement(t)) return [w.partialRight(Tn, t, i, o), (y) => ({ $setting: y })]; + if (w.isFunction(t)) return [w.partialRight(Nn, (i == null ? void 0 : i.code) || t, { status: c, setStatus: u }), null]; + } + return [(...y) => console.error("useButton unknown widgetType", e, ...y), null]; + }, [t, e, i, o, l.getBase62params, l.getSelectedRows]), f = w.debounce((y) => (s == null || s(y), Promise.resolve(Pt(r, y, { list: l })).then((S) => { + const b = m(y, { ...n, ...S }); + return b != null && b.update && g && (p.current = (E, k) => b.update(g(E), k)), b; + }).then((S) => a == null ? void 0 : a(S)).catch(console.error)), 300, { leading: !0, trailing: !1 }); + return Xt(() => { + var y; + (y = p.current) == null || y.call(p, i, o); + }, [i, o]), [f, c]; +}, ar = ({ type: t, name: e, className: n, icon: r, iconPosition: i, size: o }, a = "default") => B(() => { + const s = { type: "primary", className: j("ff-button", n), iconPosition: i, 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), r && (s.icon = h(kt, { type: r })), e && (s.children = e), s; +}, [a, t, n, r, i]), Tt = ({ data: t, widget: e, widgetType: n = "fsdpf-component", widgetData: r, widgetProps: i, widgetSetting: o, widgetContainerProps: a, onAfterClick: s, onBeforeClick: l, children: c, extras: u }) => { + const p = pe(se), [m, g] = L(!1), [f, y] = L("hover"), [S, b] = ir(i, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [E, k] = L(), { placement: $, align: F, zIndex: I, arrow: T = { pointAtCenter: !0 }, getPopupContainer: N, isPopupMountBodyContainer: V = !0, ...P } = a || {}; + W(() => { + n == "grid-layout-form" ? k(x.createElement(or, { ...r, $setting: o, code: e })) : n == "data-list" ? k(x.createElement(tn, { base62params: t, $setting: o, listCode: e })) : w.isString(e) ? Z.getWidgetComponent(e).then(({ default: z }) => { + k(x.createElement(z, { ...r, $setting: o })); + }).catch((z) => k(z.toString())) : x.isValidElement(e) ? k(x.cloneElement(e, { ...r, $setting: o })) : (an(e) || w.isFunction(e) && ["component", "fsdpf-component"].includes(n)) && k(x.createElement(e, { ...r, $setting: o })); + }, [e, n, r]); + const M = (z, X = !1) => (g(z), !z && y("hover"), z ? l == null ? void 0 : l(S) : s == null ? void 0 : s(X)), D = (z) => { + g(!0), y("click"); + }; + return h(Wr, { zIndex: I, placement: $, onPopupClick: D, onClick: D, open: m, align: F, arrow: T, trigger: f, getPopupContainer: N || V ? void 0 : (z) => z, content: h(Hi, { ...P, extras: u, children: E && x.cloneElement(E, { ...S, $setProps: b, $close: (z) => M(!1, z) }) }), children: c, onOpenChange: M }); +}, Hi = ({ title: t, className: e, classNames: n, children: r, extras: i, width: o, height: a, ...s }) => { + const [l, c] = L({}), u = J((f, y) => c((S) => ({ ...S, [f]: y })), []), p = J((f) => c((y) => ({ ...y, [f]: void 0 })), []), m = t ? x.createElement("div", { className: "ff-popup-title" }, t) : l == null ? void 0 : l.title, g = i ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, i); + return h(pt.Provider, { value: { ele: l, mount: u, unmount: p }, children: A("div", { className: j("ff-popup ff-popover", e, l.rootClassName), style: { width: o ?? 260, height: a }, ...s, children: [A("div", { className: j("ff-popup-header", "ff-popover-header", n == null ? void 0 : n.header), children: [m, l == null ? void 0 : l["sub-title"]] }), h("div", { className: j("ff-popup-body", "ff-popover-body", n == null ? void 0 : n.body), children: r }), A("div", { className: j("ff-popup-footer", "ff-popover-footer", n == null ? void 0 : n.footer), children: [g, l == null ? void 0 : l.extras, l == null ? void 0 : l.actions] })] }) }); +}; +Tt.propTypes = { widgetType: C.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; +const ht = (t) => function({ className: e, variant: n, children: r, name: i, icon: o, type: a = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: c, onBeforeClick: u, data: p, loading: m, disabled: g, tooltip: f, confirm: y, widget: S = () => { +}, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: F, ...I }) { + const { mode: T, ...N } = F || {}, V = ar({ className: e, name: i, type: a, icon: o, iconPosition: s }, n ?? t), P = h(bt, { ...V, ...I, children: r || i }); + if (T === "popover" && !["destroy", "redirect", "func"].includes(b)) return h(Tt, { data: p, widget: S, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: N, onAfterClick: c, onBeforeClick: u, children: P }); + const M = w.isEmpty(f) || !f.enabled ? {} : f, D = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [z, X] = L(!1), [xe, { disabled: _, loading: le }] = Ki({ widget: S, widgetType: b, widgetData: E, widgetProps: k, widgetSetting: $, widgetContainerProps: N }, { onAfterClick: c, onBeforeClick: u }); + return h(_r, { okText: "确定", cancelText: "取消", getPopupContainer: (K) => K, ...D, disabled: _ || g, open: z, onOpenChange: (K) => { + if (!K) return X(K); + D.enabled ? X(K) : xe(p); + }, onConfirm: (K) => { + xe(p, K); + }, onClick: (K) => { + K.stopPropagation(); + }, children: h(qr, { getPopupContainer: (K) => K, ...M, title: z ? null : M == null ? void 0 : M.title, trigger: ["hover", "click"], children: x.cloneElement(P, { loading: le || m, disabled: _ || g }) }) }); +}, R = ht("default"); +R.propTypes = { type: C.oneOf(["primary", "default", "danger", ""]), size: C.oneOf(["large", "middle", "small"]), name: C.string, icon: C.string, iconPosition: C.oneOf(["start", "end"]), data: C.any, widget: C.any, widgetType: C.oneOf(["destroy", "redirect", "func", "component", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: C.object, widgetProps: C.object, widgetSetting: C.object, widgetContainerProps: C.object, tooltip: C.exact({ title: C.string.isRequired, placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func }), confirm: C.exact({ title: C.string.isRequired, cancelText: C.string, okText: C.string, okType: C.oneOf(["primary", "default", "danger", ""]), placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func, arrow: C.oneOfType([C.bool, C.exact({ pointAtCenter: C.bool })]) }) }; +const Ji = ht("link"), Gi = ht("circle"), Yi = ht("round"), Xi = ht("dashed"), On = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: n = (g, f, y) => { +}, onBeforeClick: r = (g, f, y) => { +}, labelVariant: i = "link", labelSize: o, labelRender: a, btnVariant: s, btnSize: l, btnRender: c = (g, f) => h(R, { ...g, data: f }, g.uuid || Mt()), widgetContainerProps: u = {}, children: p, data: m }) => { + if (w.isEmpty(t)) return p; + l ?? (l = o), s ?? (s = i); + const [g, f] = B(() => (t || []).reduce((b, E) => { + const k = e.indexOf(E.widgetType); + return k === -1 ? b[1].push(E) : b[0] ? k < e.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = E) : b[1].push(E) : b[0] = E, b; + }, [null, []]), [t, e]); + a ? p = a(g, m) || p : p || (p = h(bt, { ...ar(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(n, b, m), onBeforeClick: w.partialRight(r, b, m) }, { size: l, variant: s }), m)); + let S = y; + return (y == null ? void 0 : y.length) > 1 && (S = s == "link" ? h(Dt, { split: h(Kr, { type: "vertical" }), size: l, children: y }) : h(Dt.Compact, { size: l, children: y })), g ? h(Tt, { widget: g == null ? void 0 : g.widget, widgetType: g == null ? void 0 : g.widgetType, widgetProps: g == null ? void 0 : g.widgetProps, widgetSetting: g == null ? void 0 : g.widgetSetting, widgetContainerProps: Object.assign({}, u, g == null ? void 0 : g.widgetContainerProps), data: m, widgetData: g == null ? void 0 : g.widgetData, extras: S, onAfterClick: w.partialRight(n, g, m), onBeforeClick: w.partialRight(r, g, m), children: p }) : S; +}; +On.propTypes = { triggerWeights: C.array, options: C.arrayOf(C.shape({ ...R.propTypes, widgetType: R.propTypes.widgetType.isRequired })), btnSize: R.propTypes.size, btnRender: C.func, btnVariant: C.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: C.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: C.func, labelSize: R.propTypes.size, onAfterClick: C.func, onBeforeClick: C.func, widgetContainerProps: R.propTypes.widgetContainerProps, data: R.propTypes.data }, R.Link = Ji, R.Link.defaultProps = R.defaultProps, R.Link.propTypes = R.propTypes, R.Circle = Gi, R.Circle.defaultProps = R.defaultProps, R.Circle.propTypes = R.propTypes, R.Round = Yi, R.Round.defaultProps = R.defaultProps, R.Round.propTypes = R.propTypes, R.Dashed = Xi, R.Dashed.defaultProps = R.defaultProps, R.Dashed.propTypes = R.propTypes, R.Popover = Tt, R.GroupPopover = On; +const Qi = ({ fields: t, formProps: e, $close: n }) => { + const [r] = ae.useForm(), i = B(() => [{ name: "__PROPS__", value: e }], [e]); + return h(ie, { actions: A(x.Fragment, { children: [h(R, { name: "取消", widget: () => n(!1) }), h(R, { name: "确定", type: "primary", widget: () => r.validateFields(!0).then(n) })] }), children: h(ae, { fields: i, form: r, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...a }) => h(nn, { code: o, ...a }, o)) }) }); +}, Zi = ({ className: t, classNames: e, $close: n, children: r, title: i, subTitle: o, actions: a, extras: s, ...l }) => A(Zr, { ...l, prefixCls: "ff-drawer", className: j("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (c) => ({ motionAppear: !0, motionName: `panel-motion-${c}` }), children: [A("div", { className: j("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [h("button", { "aria-label": "Close", className: j("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: h(Zt, { type: "close" }) }), i, o] }), h("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: r }), A("div", { className: j("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [s, a] })] }), eo = ({ className: t, classNames: e, $close: n, $event: r, children: i, title: o, subTitle: a, actions: s, extras: l, placement: c, ...u }) => { + const { style: p, rest: m } = ((f, y = ["height", "width", "style"]) => { + const S = { ...f }, b = {}; + for (const E of y) E === "style" ? Object.assign(b, S.style) : S[E] !== void 0 && (b[E] = S[E]), delete S[E]; + return { style: b, rest: S }; + })(u), g = (r == null ? void 0 : r.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: r == null ? void 0 : r.pageX, y: r == null ? void 0 : r.pageY } }; + return h(ei, { ...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: i }), A("div", { className: j("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, s] })] })] }) }); +}, sr = ({ placement: t, $close: e, $event: n, children: r, title: i, ...o }) => { + const [a, s] = L({}), [l, c] = L(!0), u = J((f, y) => s((S) => ({ ...S, [f]: y })), []), p = J((f) => s((y) => ({ ...y, [f]: void 0 })), []); + let m = { ...o, className: a.rootClassName, title: a.title || i && x.createElement("div", { className: j("ff-popup-title") }, i), subTitle: a["sub-title"], actions: a.actions, extras: a.extras, children: r, $close: e, $event: n, onClose: () => c(!1) }; + const g = () => { + e(!1); + }; + return h(pt.Provider, { value: { ele: a, mount: u, unmount: p }, children: t && t !== "center" ? h(Zi, { ...m, placement: t, open: l, afterOpenChange: (f) => !f && g() }) : h(eo, { ...m, visible: l, afterClose: g }) }); +}; +sr.propTypes = { placement: C.oneOf(["center", "left", "top", "right", "bottom"]) }; +const to = ({ widget: t, widgetProps: e, $close: n, onSetProps: r }) => { + const [i, o] = L(e || {}), a = jn(e); + Yt(() => { + const l = a ?? {}, c = e ?? {}, u = Object.keys({ ...l, ...c }).reduce((p, m) => (l[m] !== c[m] && (p[m] = c[m]), p), {}); + Object.keys(u).length > 0 && o((p) => ({ ...p, ...u })); + }, [e]); + const s = J((l) => { + o((c) => ({ ...c, ...l })), r == null || r(l); + }, [r]); + return x.isValidElement(t) ? x.cloneElement(t, { ...i, $close: n, $setProps: s }) : t != null && t.name || kn.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === kn.ForwardRef ? x.createElement(t, { ...i, $close: n, $setProps: s }) : t; +}, Y = () => { + const [t, e] = jr({ 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 = r, Y.$queue.forEach(([o, a, s, l]) => { + l == null || l(i([a, s], ...o)); + }), Y.$queue = []; + }, []); + const r = (o, a = {}, s = {}) => { + let l; + const c = new Promise((u, p) => { + l = i([u, p], o, a, s); + }); + return c.update = l, c; + }, i = ([o, a], s, l = {}, c = {}) => { + const u = Y.$index++, p = (f) => ((y, S) => (Y.$popups.delete(y), n(), S == null ? void 0 : S()))(u, () => o(f)); + if (s === Dn) return t.open({ ...c, key: u, content: x.createElement(s, { ...l, $close: () => t.close(u) }), onClose: () => p() }), () => { + }; + const { $setProps: m, ...g } = l; + return Y.$popups.set(u, { widget: s, widgetProps: g, widgetContainerProps: c, $close: p, onSetProps: m }), n(), (f, y) => { + const S = Y.$popups.get(u); + S && (Y.$popups.set(u, { ...S, widgetProps: f ? { ...S.widgetProps, ...f } : S.widgetProps, widgetContainerProps: y ? { ...S.widgetContainerProps, ...y } : S.widgetContainerProps }), n()); + }; + }; + return A(x.Fragment, { children: [Array.from(Y.$popups).map(([o, { widget: a, widgetProps: s, widgetContainerProps: l, $close: c, onSetProps: u }]) => h(sr, { maskClosable: !1, $event: s == null ? void 0 : s.$event, ...l, $close: c, children: h(to, { widget: a, widgetProps: s, $close: c, onSetProps: u }) }, o)), e] }); +}; +Y.$popups = /* @__PURE__ */ new Map(), Y.$index = 0, Y.$queue = [], Y.$onClick = (...t) => { + const e = new Promise((n, r) => { + Y.$queue.push([t, n, r, (i) => { + e.update = i; + }]); + }); + return e; +}; +const Rn = (t, e, n = {}) => Y.$onClick(t, e, n), It = (t, { showProgress: e, duration: n, ...r } = { duration: 1.5 }) => Y.$onClick(Dn, { content: t, ...r }, { showProgress: e, duration: n }), re = { modal: Rn, confirm: (t, e = {}) => Y.$onClick(ti, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, n = {}) => Rn(Qi, { formProps: n, fields: t }, { placement: "center", ...e }).then((r) => { + if (r === !1) throw !1; + return r; +}), notification: It, success: (t, e = { duration: 1.5 }) => It(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => It(t, { ...e, className: "ff-notification-error", icon: "close" }) }; +Xe.configure({ showSpinner: !1 }); +const lr = () => { + const t = window.localStorage.getItem(wt); + return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); +}; +Ve.interceptors.request.use((t) => (Object.assign(t.headers, lr()), Xe.inc(), t), (t) => (Xe.done(), Promise.reject({ code: -1, msg: t }))), Ve.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) => re[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && Q.redirect(Ae.get("Common.WEBSITE_LOGIN_PAGE"))); +var He, Be, Je; +const te = class te { + constructor() { + O(this, "appUrl", ""); + v(this, He, null); + return d(te, Be) || (q(te, Je, new Vt()), q(te, Be, new Proxy(this, { get(e, n) { + if (n in e) { + const r = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), n); + return r != null && r.get ? Reflect.get(e, n, e) : typeof e[n] == "function" ? e[n].bind(e) : e[n]; + } + return d(te, Je)[n]; + } }))), d(te, Be); + } + init(e, n, r) { + Ve.defaults.baseURL = this.appUrl = r, Ve.defaults.timeout = 15e3, d(te, Je).init(e, n, Ve); + } + get driver() { + return Ve; + } + get headers() { + return lr(); + } + mock(e = {}) { + return d(this, He) ?? q(this, He, new Lr(Ve, { onNoMatch: "passthrough", ...e })); + } + unmock() { + var e; + (e = d(this, He)) == null || e.restore(), q(this, He, null); + } +}; +He = new WeakMap(), Be = new WeakMap(), Je = new WeakMap(), v(te, Be), v(te, Je), O(te, "getInstance", () => d(te, Be) ?? q(te, Be, new te())); +let Jt = te; +const U = Jt.getInstance(); +class on extends Error { + constructor(e, n) { + super(n), Error.captureStackTrace && Error.captureStackTrace(this, on), !n instanceof Ze && (this.name = `${e} Error Runtime`); + } +} +class Ze extends Error { + constructor(e, ...n) { + super(...n), Error.captureStackTrace && Error.captureStackTrace(this, Ze), this.name = `${e} Not Found`; + } +} +const At = "mine", wt = "token", Lt = "user-login-intended-url"; +var Ie, Ge, at; +const we = class we { + constructor() { + v(this, Ge, /* @__PURE__ */ new Map()); + v(this, at, (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)); + O(this, "setPkgVersion", (e) => { + q(this, at, e); + }); + O(this, "setVendor", (e, n) => d(this, Ge).set(e, new Mn(n, async (r, i) => { + var a, s; + if (!(r != null && r.default)) throw "@pkg not found"; + let o = () => i; + switch ("function") { + case typeof (o = (a = r.default) == null ? void 0 : a[`./${i}/index.jsx`]): + case typeof (o = (s = r.default) == null ? void 0 : s[`./${i}/index.js`]): + return o(); + } + throw new Ze(i); + }))); + 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 Ze(e); + try { + return d(this, Ge).has("pkg") ? await d(this, Ge).get("pkg").get(n) : await import(`${U.appUrl}/api/pkg-import/web?name=${e}&v=${d(this, at)}`); + } catch (r) { + throw new on(e, r); + } + }); + O(this, "getRoutes", () => U.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, ...r }) => [n, { uuid: n, ...r }])).then((e) => new Map(e))); + O(this, "getMenus", () => U.get("/api/my-menu")); + O(this, "getConfigure", () => U.get("api/init-configure")); + O(this, "getWidgetOperationAuth", () => U.get("/api/init-widget-operation-auth").then((e) => e.reduce((n, { uuid: r, auth: i }) => [...n, [r, i]], []))); + O(this, "getPhoneNumber", (e) => U.get(`/api/user-wx-phone-number/${e}`)); + O(this, "getUserToken", () => { + const e = window.localStorage.getItem(wt); + if (!e) return ""; + const n = e.split("."); + if (!Array.isArray(n) || n.length !== 3) throw "登录令牌无效!"; + const { iat: r } = JSON.parse(window.atob(n[1])); + if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - r > 2592e3) throw "登录令牌已过期, 请重新登录!"; + return e; + }); + O(this, "checkUserToken", () => { + try { + return !!this.getUserToken(); + } catch { + return !1; + } + }); + O(this, "getUserInfo", (e = !0) => { + var n; + try { + const r = this.getUserToken(); + if (!r) return Promise.resolve(null); + const { iat: i } = JSON.parse(window.atob((n = r == null ? void 0 : r.split(".")) == null ? void 0 : n[1])), { iat: o, ...a } = U.decode(window.localStorage.getItem(At) || "", {}); + return o === i ? Promise.resolve(a) : U.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(At, U.encode({ ...s, iat: i })), s)).catch((s) => (console.error(s), e && re.error("请登录").then(this.logout), null)); + } catch (r) { + console.error(r), e && re.error("请登录").then(this.logout); + } + return Promise.resolve(null); + }); + O(this, "login", (e, n, r = {}) => U.post("/api/user-token", { username: e, passwd: Mr.hash(n), platform: "web", ...r }).then(({ token: i }) => (window.localStorage.setItem(wt, i), i)).then(async (i) => (await this.initAppEnv(), i))); + O(this, "setLoginIntendedUrl", (e) => sessionStorage.setItem(Lt, e)); + O(this, "getLoginIntendedUrl", (e = !1) => { + const n = sessionStorage.getItem(Lt); + return e && sessionStorage.removeItem(Lt), n; + }); + O(this, "logout", (e) => (window.localStorage.removeItem(At), window.localStorage.removeItem(wt), e == null ? void 0 : e())); + O(this, "initAppEnv", async () => { + const [e, n, r, i] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); + return Un.init(e), Ae.init(i), Q.init(n, r), kt.init(Ae.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: n, menus: r, configures: i }; + }); + if (d(we, Ie)) return d(we, Ie); + } +}; +Ie = new WeakMap(), Ge = new WeakMap(), at = new WeakMap(), v(we, Ie, null), O(we, "getInstance", () => (d(we, Ie) || q(we, Ie, new we()), d(we, Ie))); +let Gt = we; +const Z = Gt.getInstance(), no = x.createContext({ user: {}, initUser: () => { +}, initUserComplete: !1 }), ro = x.createContext({ set: () => { +}, get: () => { +}, assign: () => { +}, currentRoute: () => { +} }), an = (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; +}, io = (t, e) => { + if (!t || typeof window > "u") return; + let n = document.querySelector(`style[ff-style-token="${e}"]`); + return n ? (n.innerHTML = t, t) : (n = document.createElement("style"), n.setAttribute("ff-style-token", e), n.setAttribute("type", "text/css"), n.innerHTML = t, document.head.appendChild(n), t); +}, oo = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: no, AppGlobalParamsContext: ro, cache: Mn, configure: Ae, default: Z, func: Le, http: U, insertStyle: io, isReactComponent: an, route: Q }, Symbol.toStringTag, { value: "Module" })); +var Pe, Ye, ve, Ce, ke, oe, ne, G, Se, st, lt, ct, dt, $t, ut; +const sn = class sn { + 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 (r) { + console.error("Error in VirtualFS event listener:", r); + } + }); + v(this, Ce, (e) => { + const n = Date.now(); + if (e && (e.lastModified = n), d(this, Pe) != "/") { + const r = d(this, G).call(this, d(this, Pe)); + r && (r.lastModified = n); + } + this.root.lastModified = n; + }); + v(this, ke, (e) => { + let n = ge.normalize(e); + return n.startsWith("/") || (n = "/" + n), n.length > 1 && n.endsWith("/") && (n = n.slice(0, -1)), n; + }); + v(this, oe, (e) => { + const n = ge.join(d(this, Pe), e); + return d(this, ke).call(this, n); + }); + v(this, ne, (e) => { + if (!e || typeof e != "string") return !1; + const n = d(this, ke).call(this, e); + return !n.includes("..") && n.startsWith("/"); + }); + v(this, G, (e) => { + var o; + const n = d(this, ke).call(this, e); + if (n === "/") return this.root; + const r = n.split("/").filter((a) => a); + let i = this.root; + for (const a of r) { + if (i.type !== "dir") return null; + const s = (o = i.children) == null ? void 0 : o.find((l) => l.name === a); + if (!s) return null; + i = s; + } + return i; + }); + v(this, Se, (e) => { + const n = d(this, ke).call(this, e), r = ge.basename(n), i = ge.dirname(n); + return { parent: d(this, G).call(this, i), name: r }; + }); + v(this, st, (e, n, r) => r === !1 ? e : r === "root" ? e.map((i) => ge.join(n, i)) : r === !0 || r === "working" ? e.map((i) => ge.relative(d(this, Pe), ge.join(n, i))) : e); + v(this, lt, async (e, n, r, i = "") => { + 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 = i ? `${i}/${c}` : c; + try { + if (l.type === "file") n(r ? p : c) && o.push(p); + else if (l.type === "dir" && r) { + const m = await d(this, lt).call(this, u, n, r, p); + o.push(...m); + } + } catch { + continue; + } + } + return o; + }); + v(this, ct, async (e, n, r, i = "") => { + const o = [], a = Array.isArray(n) ? n : [n], s = d(this, G).call(this, e); + if (!s || s.type !== "dir") return o; + if (!r) { + for (const c of a) if (d(this, dt).call(this, c)) { + const u = await d(this, $t).call(this, e, c); + o.push(...u); + } else { + const u = ge.join(e, c), p = d(this, ke).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 = i ? `${i}/${u}` : u; + try { + if (c.type === "file") for (const g of a) { + let f = !1; + if (f = d(this, dt).call(this, g) ? d(this, ut).call(this, u, g) : u === g, f) { + o.push(m); + break; + } + } + else if (c.type === "dir") { + const g = await d(this, ct).call(this, p, n, r, m); + o.push(...g); + } + } catch { + continue; + } + } + return o; + }); + v(this, dt, (e) => /[*?[\]{}]/.test(e)); + v(this, $t, async (e, n) => { + const r = [], i = d(this, G).call(this, e); + if (!i || i.type !== "dir") return r; + const o = i.children.map((a) => a.name); + for (const a of o) d(this, ut).call(this, a, n) && r.push(a); + return r; + }); + v(this, ut, (e, n) => { + const r = n.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (i, o) => "(" + o.split(",").join("|") + ")"); + return new RegExp(`^${r}$`).test(e); + }); + var r, i, o; + q(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, (r = this.root).name ?? (r.name = "/"), (i = this.root).children ?? (i.children = []), (o = this.root).lastModified ?? (o.lastModified = Date.now()))); + } + async stat(e) { + const n = d(this, oe).call(this, e); + if (!d(this, ne).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const r = d(this, G).call(this, n); + if (!r) throw new Error(`ENOENT: no such file or directory, stat '${e}'`); + return { isFile: () => r.type === "file", isDirectory: () => r.type === "dir", lastModified: r.lastModified }; + } + async dir(e) { + const n = d(this, oe).call(this, e); + if (!d(this, ne).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const r = d(this, G).call(this, n); + if (!r) throw new Error(`ENOENT: no such file or directory, scandir '${e}'`); + if (r.type !== "dir") throw new Error(`ENOTDIR: not a directory, scandir '${e}'`); + return r.children.map((i) => i.name); + } + async readFile(e) { + const n = d(this, oe).call(this, e); + if (!d(this, ne).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const r = d(this, G).call(this, n); + if (!r) throw new Error(`ENOENT: no such file or directory, open '${e}'`); + if (r.type !== "file") throw new Error("EISDIR: illegal operation on a directory, read"); + return r.content || ""; + } + async writeFile(e, n) { + const r = d(this, oe).call(this, e); + if (!d(this, ne).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: i, name: o } = d(this, Se).call(this, r); + 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 a = i.children.findIndex((c) => c.name === o), s = a >= 0, l = { name: o, type: "file", content: n, lastModified: Date.now() }; + s ? i.children[a] = l : i.children.push(l), d(this, Ce).call(this, i), d(this, ve).call(this, { action: s ? "update" : "create", path: r, type: "file", timestamp: Date.now() }); + } + async mkdir(e, n = {}) { + const r = d(this, oe).call(this, e); + if (!d(this, ne).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const { recursive: i } = n; + if (i) { + const o = r.split("/").filter((s) => s); + let a = "/"; + for (const s of o) + if (a = ge.join(a, s), !d(this, G).call(this, a)) { + const { parent: l, name: c } = d(this, Se).call(this, a); + if (l && l.type === "dir") { + const u = { name: c, type: "dir", children: [], lastModified: Date.now() }; + l.children.push(u), d(this, Ce).call(this, l), d(this, ve).call(this, { action: "create", path: d(this, ke).call(this, a), type: "dir", timestamp: Date.now() }); + } + } + } else { + const { parent: o, name: a } = d(this, Se).call(this, r); + 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, Ce).call(this, o), d(this, ve).call(this, { action: "create", path: r, type: "dir", timestamp: Date.now() }); + } + } + async unlink(e) { + const n = d(this, oe).call(this, e); + if (!d(this, ne).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: r, name: i } = d(this, Se).call(this, n); + if (!r) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + const o = r.children.findIndex((a) => a.name === i); + if (o < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); + if (r.children[o].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); + r.children.splice(o, 1), d(this, Ce).call(this, r), d(this, ve).call(this, { action: "delete", path: n, type: "file", timestamp: Date.now() }); + } + async rmdir(e, n = {}) { + const r = d(this, oe).call(this, e); + if (!d(this, ne).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + const { parent: i, name: o } = d(this, Se).call(this, r); + if (!i) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const a = i.children.findIndex((l) => l.name === o); + if (a < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); + const s = i.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}'`); + i.children.splice(a, 1), d(this, Ce).call(this, i), d(this, ve).call(this, { action: "delete", path: r, type: "dir", timestamp: Date.now() }); + } + async rename(e, n) { + const r = d(this, oe).call(this, e), i = d(this, oe).call(this, n); + if (!d(this, ne).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); + if (!d(this, ne).call(this, i)) throw new Error(`EINVAL: invalid path '${n}'`); + if (!d(this, G).call(this, r)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${n}'`); + const { parent: o, name: a } = d(this, Se).call(this, r), { parent: s, name: l } = d(this, Se).call(this, i); + if (!s) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${n}'`); + if (d(this, G).call(this, i)) 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, Ce).call(this, o), o !== s && d(this, Ce).call(this, s), d(this, ve).call(this, { action: "rename", path: i, oldPath: r, type: u.type, timestamp: Date.now() }); + } + async exists(e) { + const n = d(this, oe).call(this, e); + return d(this, ne).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, ke).call(this, e); + if (!d(this, ne).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); + const r = d(this, G).call(this, n); + if (!r) throw new Error(`ENOENT: no such file or directory '${e}'`); + if (r.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); + return r.children ?? (r.children = []), r.lastModified ?? (r.lastModified = Date.now()), new sn(this.root, n); + } + async findFiles(e, n, r = {}) { + const i = d(this, oe).call(this, e); + if (!d(this, ne).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); + const o = d(this, G).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: a = !1, fullPath: s = !1 } = r; + if (typeof n == "function") { + const c = await d(this, lt).call(this, i, n, a); + return d(this, st).call(this, c, i, s); + } + const l = await d(this, ct).call(this, i, n, a); + return d(this, st).call(this, l, i, s); + } +}; +Pe = new WeakMap(), Ye = new WeakMap(), ve = new WeakMap(), Ce = new WeakMap(), ke = new WeakMap(), oe = new WeakMap(), ne = new WeakMap(), G = new WeakMap(), Se = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), $t = new WeakMap(), ut = new WeakMap(); +let Fn = sn; +const ao = async (t, e = "/", n = "") => { + try { + const r = await t.stat(e), i = e === "/" ? "/" : ge.basename(e), o = { title: i, key: n ? `${n}${e}` : e, isLeaf: r.isFile() }; + if (r.isDirectory()) { + 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 ao(t, u, n); + o.children.push(p); + } catch (p) { + console.warn(`Failed to process ${u}:`, p.message); + } + } + } + } + return o; + } catch { + return null; + } +}; +export { + Uo as $, + ai as A, + To as B, + Oo as C, + Ct as D, + Wn as E, + Wt as F, + jo as G, + bi as H, + si as I, + li as J, + $i as K, + Pi as L, + Io as M, + Ao as N, + ue as O, + Ni as P, + Pt as Q, + Jn as R, + er as S, + jt as T, + Lo as U, + Mo as V, + Vo as W, + Do as X, + Ti as Y, + Oi as Z, + Ri as _, + zn as a, + zo as a0, + vt as a1, + Bo as a2, + gt as a3, + Nt as a4, + Wo as a5, + _o as a6, + Fi as a7, + ir as a8, + zi as a9, + Mn as aA, + Ae as aB, + Le as aC, + Q as aD, + no as aE, + ro as aF, + Fn as aG, + ao as aH, + to as aI, + rn as aa, + nn as ab, + or as ac, + ji as ad, + Ii as ae, + Ai as af, + Li as ag, + Mi as ah, + Vi as ai, + qo as aj, + kt as ak, + R as al, + Un as am, + Ki as an, + ie as ao, + pt as ap, + Vn as aq, + Y as ar, + re as as, + Po as at, + vo as au, + No as av, + Z as aw, + an as ax, + io as ay, + U as az, + _n as b, + Ro as c, + qn as d, + en as e, + Gn as f, + ni as g, + Qn as h, + Si as i, + Xn as j, + ki as k, + Fo as l, + Yn as m, + Hn as n, + Kn as o, + fi as p, + mi as q, + gi as r, + tn as s, + se as t, + Ci as u, + wi as v, + Ei as w, + ci as x, + ui as y, + oi as z +}; diff --git a/dist/components.js b/dist/components.js index c1e8186..2860b7f 100644 --- a/dist/components.js +++ b/dist/components.js @@ -1,4 +1,4 @@ -import { at as s, ak as p, au as r, av as t, as as e, aI as n } from "./common/main-DcQsUE57.js"; +import { at as s, ak as p, au as r, av as t, as as e, aI as n } from "./common/main-DsRa-iMx.js"; export { s as Empty, p as Icon, diff --git a/dist/container.js b/dist/container.js index 163c2b3..5e8579b 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-DcQsUE57.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-DsRa-iMx.js"; export { s as Context, e as Empty, diff --git a/dist/data-converter.js b/dist/data-converter.js index 8fa7fe5..d5dda21 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-DcQsUE57.js"; +import { D as i } from "./common/main-DsRa-iMx.js"; import "react-use"; export { i as default diff --git a/dist/data-list.js b/dist/data-list.js index bbd740b..fc5fabb 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-DcQsUE57.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-DsRa-iMx.js"; export { t as DataListContent, e as DataListContext, diff --git a/dist/data-list/utils.js b/dist/data-list/utils.js index d71dbe3..50585bf 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-DcQsUE57.js"; +import { f as a } from "../common/main-DsRa-iMx.js"; export { a as getDefaultExpandRowKeys }; diff --git a/dist/grid-layout-form.js b/dist/grid-layout-form.js index 33900e5..9ca9dd3 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-DcQsUE57.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-DsRa-iMx.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 9211ab2..b411e05 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-DcQsUE57.js"; +import { a as o, g } from "../common/main-DsRa-iMx.js"; export { o as getNormalizeWidget, g as getOptionItemByValue diff --git a/dist/grid-layout.js b/dist/grid-layout.js index 5cd7a9a..9a7e07c 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-DcQsUE57.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-DsRa-iMx.js"; export { u as GridLayout, e as GridLayoutFramework, diff --git a/dist/grid-layout/utils.js b/dist/grid-layout/utils.js index 8f163a0..57370a7 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-DcQsUE57.js"; +import { b as a, d as o, e as s, c as g } from "../common/main-DsRa-iMx.js"; export { a as getBoxStyle, o as getEventProps, diff --git a/dist/hooks.js b/dist/hooks.js index 8f97070..b991b17 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-DcQsUE57.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-DsRa-iMx.js"; import { default as b } from "rc-util/lib/hooks/useMergedState"; import { a as x } from "./common/vender-C5RbewOc.js"; export { diff --git a/dist/iconfont.js b/dist/iconfont.js index a984da0..9a7ef40 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-DcQsUE57.js"; +import { ak as a } from "./common/main-DsRa-iMx.js"; export { a as default }; diff --git a/dist/index.js b/dist/index.js index 483d818..82704cc 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-DcQsUE57.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-DsRa-iMx.js"; export { t as AppContext, e as AppGlobalParamsContext, diff --git a/dist/pages.js b/dist/pages.js index 3898da6..2b3c592 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-DcQsUE57.js"; +import { L as t, K as e, M as o, N as g } from "./common/main-DsRa-iMx.js"; export { t as CustomPage, e as DataListPage, diff --git a/dist/res-ws.js b/dist/res-ws.js index 075c17f..6b76f9e 100644 --- a/dist/res-ws.js +++ b/dist/res-ws.js @@ -1,5 +1,5 @@ import "lodash"; -import { R as a } from "./common/main-DcQsUE57.js"; +import { R as a } from "./common/main-DsRa-iMx.js"; export { a as default }; diff --git a/dist/utils.js b/dist/utils.js index 9e27f07..99724dd 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-DcQsUE57.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-DsRa-iMx.js"; import "./common/vender-C5RbewOc.js"; export { r as deepSome, diff --git a/dist/virtual-fs.js b/dist/virtual-fs.js index 5394a81..05ef93b 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-DcQsUE57.js"; +import { aG as o, aH as r } from "./common/main-DsRa-iMx.js"; export { o as default, r as toTreePaths diff --git a/package.json b/package.json index f977f4e..4ad6999 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff", "private": true, - "version": "0.7.1", + "version": "0.7.2", "author": "www.fsdpf.com", "type": "module", "main": "./dist/index.js",