|
1 | 1 | import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
2 | 2 | import type { IconDefinition } from "@fortawesome/free-regular-svg-icons";
|
3 | 3 | // import type { IconDefinition as IconDefinitionBrands } from "@fortawesome/free-brands-svg-icons";
|
4 |
| -import { Popover } from "antd"; |
5 |
| -import { ActionType } from "@rc-component/trigger/lib/interface"; |
| 4 | +import { default as Popover } from "antd/lib/popover"; |
| 5 | +import type { ActionType } from "@rc-component/trigger/lib/interface"; |
6 | 6 | import { TacoInput } from "components/tacoInput";
|
7 | 7 | import { Tooltip } from "components/toolTip";
|
8 | 8 | import { trans } from "i18n/design";
|
9 |
| -import _ from "lodash"; |
| 9 | +import { upperFirst, sortBy } from "lodash"; |
10 | 10 | import {
|
11 | 11 | ReactNode,
|
12 | 12 | useEffect,
|
13 | 13 | useCallback,
|
14 | 14 | useMemo,
|
15 | 15 | useRef,
|
16 | 16 | useState,
|
| 17 | + Suspense |
17 | 18 | } from "react";
|
18 | 19 | import Draggable from "react-draggable";
|
19 |
| -import { default as List, ListRowProps } from "react-virtualized/dist/es/List"; |
| 20 | +import { default as List, type ListRowProps } from "react-virtualized/dist/es/List"; |
20 | 21 | import styled from "styled-components";
|
21 | 22 | import { CloseIcon, SearchIcon } from "icons";
|
22 | 23 | import { ANTDICON } from "icons/antIcon";
|
23 |
| -import { Divider } from "antd-mobile"; |
24 | 24 |
|
25 | 25 | const PopupContainer = styled.div`
|
26 | 26 | width: 580px;
|
@@ -141,7 +141,7 @@ class Icon {
|
141 | 141 | readonly title: string;
|
142 | 142 | constructor(readonly def: IconDefinition | any, readonly names: string[]) {
|
143 | 143 | if (def?.iconName) {
|
144 |
| - this.title = def.iconName.split("-").map(_.upperFirst).join(" "); |
| 144 | + this.title = def.iconName.split("-").map(upperFirst).join(" "); |
145 | 145 | } else {
|
146 | 146 | this.title = names[0].slice(5);
|
147 | 147 | this.def = def;
|
@@ -231,7 +231,7 @@ function search(
|
231 | 231 | .toLowerCase()
|
232 | 232 | .split(/\s+/g)
|
233 | 233 | .filter((t) => t);
|
234 |
| - return _.sortBy( |
| 234 | + return sortBy( |
235 | 235 | Object.entries(allIcons).filter(([key, icon]) => {
|
236 | 236 | if (icon.names.length === 0) {
|
237 | 237 | return false;
|
@@ -297,7 +297,11 @@ const IconPopup = (props: {
|
297 | 297 | onChangeIcon(key);
|
298 | 298 | }}
|
299 | 299 | >
|
300 |
| - <IconWrapper>{icon.getView()}</IconWrapper> |
| 300 | + <IconWrapper> |
| 301 | + <Suspense fallback={null}> |
| 302 | + {icon.getView()} |
| 303 | + </Suspense> |
| 304 | + </IconWrapper> |
301 | 305 | <IconKeyDisplay>{key}</IconKeyDisplay>
|
302 | 306 | </IconItemContainer>
|
303 | 307 | </Tooltip>
|
|
0 commit comments