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