com-angel-authorization 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +149 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +31 -1
- package/dist/react/index.d.ts +31 -1
- package/dist/react/index.js +146 -0
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +187 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +74 -1
- package/dist/vue/index.d.ts +74 -1
- package/dist/vue/index.js +184 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -39,6 +39,9 @@ __export(react_exports, {
|
|
|
39
39
|
RESOURCE_TYPE_API: () => RESOURCE_TYPE_API,
|
|
40
40
|
ROOT_PARENT_ID: () => ROOT_PARENT_ID,
|
|
41
41
|
ResourceManager: () => ResourceManager,
|
|
42
|
+
SYSTEM_ADMIN_DEFAULT_KEY: () => SYSTEM_ADMIN_DEFAULT_KEY,
|
|
43
|
+
SYSTEM_ADMIN_MENU: () => SYSTEM_ADMIN_MENU,
|
|
44
|
+
SystemAdmin: () => SystemAdmin,
|
|
42
45
|
appendQueryParam: () => appendQueryParam,
|
|
43
46
|
buildCreateBody: () => buildCreateBody,
|
|
44
47
|
buildCreateMenuBody: () => buildCreateMenuBody,
|
|
@@ -1836,6 +1839,149 @@ var styles2 = {
|
|
|
1836
1839
|
paddingTop: 4
|
|
1837
1840
|
}
|
|
1838
1841
|
};
|
|
1842
|
+
|
|
1843
|
+
// src/react/SystemAdmin.tsx
|
|
1844
|
+
var import_react4 = require("react");
|
|
1845
|
+
|
|
1846
|
+
// src/admin/menu.ts
|
|
1847
|
+
var SYSTEM_ADMIN_MENU = {
|
|
1848
|
+
key: "system",
|
|
1849
|
+
label: "\u7CFB\u7EDF\u7BA1\u7406",
|
|
1850
|
+
children: [
|
|
1851
|
+
{ key: "menu", label: "\u83DC\u5355\u7BA1\u7406" },
|
|
1852
|
+
{ key: "resource", label: "\u6743\u9650\u70B9\u7BA1\u7406" }
|
|
1853
|
+
]
|
|
1854
|
+
};
|
|
1855
|
+
var SYSTEM_ADMIN_DEFAULT_KEY = "menu";
|
|
1856
|
+
|
|
1857
|
+
// src/react/SystemAdmin.tsx
|
|
1858
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1859
|
+
function SystemAdmin({
|
|
1860
|
+
menuApi,
|
|
1861
|
+
resourceApi,
|
|
1862
|
+
defaultActiveKey = SYSTEM_ADMIN_DEFAULT_KEY,
|
|
1863
|
+
activeKey: controlledKey,
|
|
1864
|
+
onActiveKeyChange,
|
|
1865
|
+
title = SYSTEM_ADMIN_MENU.label,
|
|
1866
|
+
toolbarExtra
|
|
1867
|
+
}) {
|
|
1868
|
+
const [innerKey, setInnerKey] = (0, import_react4.useState)(defaultActiveKey);
|
|
1869
|
+
const activeKey = controlledKey ?? innerKey;
|
|
1870
|
+
const setActiveKey = (key) => {
|
|
1871
|
+
if (controlledKey === void 0) setInnerKey(key);
|
|
1872
|
+
onActiveKeyChange?.(key);
|
|
1873
|
+
};
|
|
1874
|
+
const activeLabel = (0, import_react4.useMemo)(
|
|
1875
|
+
() => SYSTEM_ADMIN_MENU.children.find((item) => item.key === activeKey)?.label ?? "",
|
|
1876
|
+
[activeKey]
|
|
1877
|
+
);
|
|
1878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles3.root, children: [
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("aside", { style: styles3.sidebar, children: [
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles3.sidebarTitle, children: title }),
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("nav", { style: styles3.nav, children: SYSTEM_ADMIN_MENU.children.map((item) => {
|
|
1882
|
+
const active = item.key === activeKey;
|
|
1883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1884
|
+
"button",
|
|
1885
|
+
{
|
|
1886
|
+
type: "button",
|
|
1887
|
+
style: {
|
|
1888
|
+
...styles3.navItem,
|
|
1889
|
+
...active ? styles3.navItemActive : null
|
|
1890
|
+
},
|
|
1891
|
+
onClick: () => setActiveKey(item.key),
|
|
1892
|
+
children: item.label
|
|
1893
|
+
},
|
|
1894
|
+
item.key
|
|
1895
|
+
);
|
|
1896
|
+
}) })
|
|
1897
|
+
] }),
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("main", { style: styles3.content, children: [
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles3.contentHeader, children: [
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles3.breadcrumb, children: [
|
|
1901
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles3.breadcrumbParent, children: title }),
|
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles3.breadcrumbSep, children: "/" }),
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles3.breadcrumbCurrent, children: activeLabel })
|
|
1904
|
+
] }),
|
|
1905
|
+
toolbarExtra
|
|
1906
|
+
] }),
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles3.panel, children: activeKey === "menu" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MenuManager, { api: menuApi, title: "\u83DC\u5355\u7BA1\u7406" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ResourceManager, { api: resourceApi, title: "\u6743\u9650\u70B9\u7BA1\u7406" }) })
|
|
1908
|
+
] })
|
|
1909
|
+
] });
|
|
1910
|
+
}
|
|
1911
|
+
var styles3 = {
|
|
1912
|
+
root: {
|
|
1913
|
+
display: "flex",
|
|
1914
|
+
minHeight: 560,
|
|
1915
|
+
border: "1px solid #eaecf0",
|
|
1916
|
+
borderRadius: 12,
|
|
1917
|
+
overflow: "hidden",
|
|
1918
|
+
background: "#fff",
|
|
1919
|
+
fontFamily: '"PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif',
|
|
1920
|
+
color: "#101828"
|
|
1921
|
+
},
|
|
1922
|
+
sidebar: {
|
|
1923
|
+
width: 200,
|
|
1924
|
+
flexShrink: 0,
|
|
1925
|
+
borderRight: "1px solid #eaecf0",
|
|
1926
|
+
background: "#f9fafb",
|
|
1927
|
+
padding: "16px 12px"
|
|
1928
|
+
},
|
|
1929
|
+
sidebarTitle: {
|
|
1930
|
+
fontSize: 14,
|
|
1931
|
+
fontWeight: 600,
|
|
1932
|
+
color: "#344054",
|
|
1933
|
+
padding: "4px 10px 12px"
|
|
1934
|
+
},
|
|
1935
|
+
nav: {
|
|
1936
|
+
display: "flex",
|
|
1937
|
+
flexDirection: "column",
|
|
1938
|
+
gap: 4
|
|
1939
|
+
},
|
|
1940
|
+
navItem: {
|
|
1941
|
+
border: "none",
|
|
1942
|
+
background: "transparent",
|
|
1943
|
+
textAlign: "left",
|
|
1944
|
+
padding: "10px 12px",
|
|
1945
|
+
borderRadius: 8,
|
|
1946
|
+
fontSize: 14,
|
|
1947
|
+
color: "#475467",
|
|
1948
|
+
cursor: "pointer"
|
|
1949
|
+
},
|
|
1950
|
+
navItemActive: {
|
|
1951
|
+
background: "#e6f7f9",
|
|
1952
|
+
color: "#049BAD",
|
|
1953
|
+
fontWeight: 600
|
|
1954
|
+
},
|
|
1955
|
+
content: {
|
|
1956
|
+
flex: 1,
|
|
1957
|
+
minWidth: 0,
|
|
1958
|
+
display: "flex",
|
|
1959
|
+
flexDirection: "column",
|
|
1960
|
+
background: "#fff"
|
|
1961
|
+
},
|
|
1962
|
+
contentHeader: {
|
|
1963
|
+
display: "flex",
|
|
1964
|
+
alignItems: "center",
|
|
1965
|
+
justifyContent: "space-between",
|
|
1966
|
+
gap: 12,
|
|
1967
|
+
padding: "12px 16px",
|
|
1968
|
+
borderBottom: "1px solid #f2f4f7"
|
|
1969
|
+
},
|
|
1970
|
+
breadcrumb: {
|
|
1971
|
+
display: "flex",
|
|
1972
|
+
alignItems: "center",
|
|
1973
|
+
gap: 8,
|
|
1974
|
+
fontSize: 13
|
|
1975
|
+
},
|
|
1976
|
+
breadcrumbParent: { color: "#98a2b3" },
|
|
1977
|
+
breadcrumbSep: { color: "#d0d5dd" },
|
|
1978
|
+
breadcrumbCurrent: { color: "#344054", fontWeight: 600 },
|
|
1979
|
+
panel: {
|
|
1980
|
+
flex: 1,
|
|
1981
|
+
minHeight: 0,
|
|
1982
|
+
overflow: "auto"
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1839
1985
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1840
1986
|
0 && (module.exports = {
|
|
1841
1987
|
Can,
|
|
@@ -1856,6 +2002,9 @@ var styles2 = {
|
|
|
1856
2002
|
RESOURCE_TYPE_API,
|
|
1857
2003
|
ROOT_PARENT_ID,
|
|
1858
2004
|
ResourceManager,
|
|
2005
|
+
SYSTEM_ADMIN_DEFAULT_KEY,
|
|
2006
|
+
SYSTEM_ADMIN_MENU,
|
|
2007
|
+
SystemAdmin,
|
|
1859
2008
|
appendQueryParam,
|
|
1860
2009
|
buildCreateBody,
|
|
1861
2010
|
buildCreateMenuBody,
|