@donglegeyu/company-ui 2.3.0 → 2.4.0
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/dist/cjs/shared-components/IconExplorer/index.js +2 -1
- package/dist/cjs/shared-components/IconParkGallery/index.js +12 -4
- package/dist/cjs/shared-components/IconParkGallery/useIconPark.d.ts +3 -3
- package/dist/cjs/shared-components/IconParkGallery/useIconPark.js +21 -60
- package/dist/cjs/shared-components/SvgIcon/all-icons.d.ts +19 -0
- package/dist/cjs/shared-components/SvgIcon/all-icons.js +137145 -0
- package/dist/cjs/shared-components/SvgIcon/icon-meta.json +1 -1
- package/dist/cjs/shared-components/SvgIcon/icons.js +4 -4
- package/dist/cjs/shared-components/SvgIcon/index.js +2 -1
- package/dist/es/shared-components/IconExplorer/index.js +2 -1
- package/dist/es/shared-components/IconParkGallery/index.js +6 -4
- package/dist/es/shared-components/IconParkGallery/useIconPark.d.ts +3 -3
- package/dist/es/shared-components/IconParkGallery/useIconPark.js +33 -98
- package/dist/es/shared-components/SvgIcon/all-icons.d.ts +19 -0
- package/dist/es/shared-components/SvgIcon/all-icons.js +3 -0
- package/dist/es/shared-components/SvgIcon/icon-meta.json +1 -1
- package/dist/es/shared-components/SvgIcon/icons.js +4 -4
- package/dist/es/shared-components/SvgIcon/index.js +6 -4
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ var import_antd = require("antd");
|
|
|
37
37
|
var import_IconGallery = __toESM(require("../IconGallery"));
|
|
38
38
|
var import_IconParkGallery = __toESM(require("../IconParkGallery"));
|
|
39
39
|
var import_icons = require("../SvgIcon/icons");
|
|
40
|
+
var import_all_icons = require("../SvgIcon/all-icons");
|
|
40
41
|
var import_theme = require("../../theme");
|
|
41
42
|
var import_index = require("./index.scss");
|
|
42
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -70,7 +71,7 @@ function IconExplorer() {
|
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
key: "full",
|
|
73
|
-
label:
|
|
74
|
+
label: `图标库 Full (${import_all_icons.allIconNames.length})`,
|
|
74
75
|
forceRender: true,
|
|
75
76
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: "icon-full", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_IconParkGallery.default, {}) })
|
|
76
77
|
}
|
|
@@ -117,7 +117,7 @@ function IconParkGallery() {
|
|
|
117
117
|
return () => window.removeEventListener("iconpark:reveal", onReveal);
|
|
118
118
|
}, [segments]);
|
|
119
119
|
const handleCopy = (0, import_react.useCallback)(async (name) => {
|
|
120
|
-
const code = `<SvgIcon
|
|
120
|
+
const code = `<SvgIcon name="${name}" size={16} />`;
|
|
121
121
|
try {
|
|
122
122
|
await navigator.clipboard.writeText(code);
|
|
123
123
|
import_basic_components.CompanyMessage.success(`已复制:${code}`);
|
|
@@ -128,7 +128,7 @@ function IconParkGallery() {
|
|
|
128
128
|
if (loading) {
|
|
129
129
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "company-iconpark-gallery-loading", children: [
|
|
130
130
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: token.colorPrimary, fontSize: 24, marginBottom: 12 }, children: "○" }),
|
|
131
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: token.colorTextSecondary, fontSize: 14 }, children: "加载
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: token.colorTextSecondary, fontSize: 14 }, children: "加载 2600+ 图标中..." })
|
|
132
132
|
] });
|
|
133
133
|
}
|
|
134
134
|
if (error || !data) {
|
|
@@ -147,12 +147,20 @@ function IconParkGallery() {
|
|
|
147
147
|
style: { maxWidth: 360 }
|
|
148
148
|
}
|
|
149
149
|
),
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
150
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
151
151
|
"span",
|
|
152
152
|
{
|
|
153
153
|
className: "company-iconpark-gallery-hint",
|
|
154
154
|
style: { color: token.colorTextQuaternary },
|
|
155
|
-
children:
|
|
155
|
+
children: [
|
|
156
|
+
"图标库基于 IconPark,全量 2600+ 图标已编译进 JS 包,业务环境可直接",
|
|
157
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("code", { children: [
|
|
158
|
+
"<SvgIcon name=",
|
|
159
|
+
'"xxx"',
|
|
160
|
+
" />"
|
|
161
|
+
] }),
|
|
162
|
+
" 渲染,无需网络加载。"
|
|
163
|
+
]
|
|
156
164
|
}
|
|
157
165
|
)
|
|
158
166
|
] }),
|
|
@@ -15,8 +15,8 @@ export interface IconParkData {
|
|
|
15
15
|
categories: IconParkCategory[];
|
|
16
16
|
icons: IconParkMetaItem[];
|
|
17
17
|
}
|
|
18
|
-
export declare function useIconPark(
|
|
19
|
-
data: IconParkData
|
|
18
|
+
export declare function useIconPark(): {
|
|
19
|
+
data: IconParkData;
|
|
20
20
|
loading: boolean;
|
|
21
|
-
error:
|
|
21
|
+
error: null;
|
|
22
22
|
};
|
|
@@ -22,66 +22,27 @@ __export(useIconPark_exports, {
|
|
|
22
22
|
useIconPark: () => useIconPark
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(useIconPark_exports);
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} catch {
|
|
47
|
-
resolvePromise(false);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return spriteLoadPromise;
|
|
51
|
-
}, [spriteUrl]);
|
|
52
|
-
(0, import_react.useEffect)(() => {
|
|
53
|
-
let cancelled = false;
|
|
54
|
-
setLoading(true);
|
|
55
|
-
Promise.all([
|
|
56
|
-
injectSprite(),
|
|
57
|
-
fetch(metaUrl).then((res) => res.json()).then((json) => {
|
|
58
|
-
if (cancelled)
|
|
59
|
-
return null;
|
|
60
|
-
return json;
|
|
61
|
-
})
|
|
62
|
-
]).then(([ok, json]) => {
|
|
63
|
-
if (cancelled)
|
|
64
|
-
return;
|
|
65
|
-
if (!ok) {
|
|
66
|
-
setError("图标 sprite 加载失败");
|
|
67
|
-
}
|
|
68
|
-
if (json) {
|
|
69
|
-
setData(json);
|
|
70
|
-
} else {
|
|
71
|
-
setError("图标元数据加载失败");
|
|
72
|
-
}
|
|
73
|
-
}).catch((e) => {
|
|
74
|
-
if (!cancelled)
|
|
75
|
-
setError(String(e));
|
|
76
|
-
}).finally(() => {
|
|
77
|
-
if (!cancelled)
|
|
78
|
-
setLoading(false);
|
|
79
|
-
});
|
|
80
|
-
return () => {
|
|
81
|
-
cancelled = true;
|
|
82
|
-
};
|
|
83
|
-
}, [injectSprite, metaUrl]);
|
|
84
|
-
return { data, loading, error };
|
|
25
|
+
var import_all_icons = require("../SvgIcon/all-icons");
|
|
26
|
+
var BUILTIN_DATA = (() => {
|
|
27
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
28
|
+
for (const icon of import_all_icons.allIconEntries) {
|
|
29
|
+
const key = icon.category || "other";
|
|
30
|
+
if (!categoryMap.has(key)) {
|
|
31
|
+
categoryMap.set(key, {
|
|
32
|
+
key,
|
|
33
|
+
label: icon.categoryCN || icon.category || "其他",
|
|
34
|
+
en: icon.category
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
count: import_all_icons.allIconEntries.length,
|
|
40
|
+
categories: Array.from(categoryMap.values()),
|
|
41
|
+
icons: import_all_icons.allIconEntries
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
function useIconPark() {
|
|
45
|
+
return { data: BUILTIN_DATA, loading: false, error: null };
|
|
85
46
|
}
|
|
86
47
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
48
|
0 && (module.exports = {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface AllIconDefinition {
|
|
3
|
+
name: string;
|
|
4
|
+
viewBox: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
title: string;
|
|
7
|
+
category: string;
|
|
8
|
+
categoryCN: string;
|
|
9
|
+
tag: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function getAllIconDefinition(name: string): AllIconDefinition | undefined;
|
|
12
|
+
export declare const allIconNames: string[];
|
|
13
|
+
export declare const allIconEntries: {
|
|
14
|
+
name: string;
|
|
15
|
+
title: string;
|
|
16
|
+
category: string;
|
|
17
|
+
categoryCN: string;
|
|
18
|
+
tag: string[];
|
|
19
|
+
}[];
|