@cloudtower/eagle 0.35.9 → 481.0.3
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/core/Cascader/cascader.widget.js +12 -12
- package/dist/cjs/core/MediumDialog/MediumDialog.js +1 -1
- package/dist/cjs/core/SearchInput/SearchInput.hook.js +124 -0
- package/dist/cjs/core/SearchInput/SearchInput.js +253 -0
- package/dist/cjs/core/SearchInput/SearchInput.style.js +13 -0
- package/dist/cjs/core/index.js +12 -15
- package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +4 -16
- package/dist/cjs/index.js +245 -253
- package/dist/cjs/legacy-antd.js +89 -89
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +2423 -2578
- package/dist/esm/core/Cascader/cascader.widget.js +1 -1
- package/dist/esm/core/MediumDialog/MediumDialog.js +1 -1
- package/dist/esm/core/SearchInput/SearchInput.hook.js +117 -0
- package/dist/esm/core/SearchInput/SearchInput.js +247 -0
- package/dist/esm/core/SearchInput/SearchInput.style.js +7 -0
- package/dist/esm/core/index.js +2 -4
- package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +4 -16
- package/dist/esm/index.js +1 -5
- package/dist/esm/legacy-antd.js +1 -1
- package/dist/esm/stats1.html +1 -1
- package/dist/linaria.merged.scss +3680 -3841
- package/dist/src/core/Cascader/cascader.type.d.ts +1 -1
- package/dist/src/core/SearchInput/SearchInput.d.ts +2 -0
- package/dist/src/core/SearchInput/SearchInput.hook.d.ts +9 -0
- package/dist/src/core/SearchInput/SearchInput.style.d.ts +5 -0
- package/dist/src/core/SearchInput/{searchInput.type.d.ts → SearchInput.type.d.ts} +18 -2
- package/dist/src/core/SearchInput/index.d.ts +2 -4
- package/dist/src/core/index.d.ts +0 -6
- package/dist/src/coreX/Dialogs/RejectDialog/RejectDialog.type.d.ts +1 -5
- package/dist/src/coreX/index.d.ts +0 -3
- package/dist/src/hooks/index.d.ts +0 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/stories/docs/core/SearchInput.stories.d.ts +6 -1
- package/dist/stories/docs/coreX/Dialogs/RejectDialog.stories.d.ts +1 -3
- package/dist/style.css +2423 -2578
- package/package.json +4 -6
- package/dist/cjs/core/Duration/index.js +0 -78
- package/dist/cjs/core/LocalUpload/LocalUpload.hooks.js +0 -66
- package/dist/cjs/core/LocalUpload/LocalUpload.js +0 -103
- package/dist/cjs/core/LocalUpload/LocalUpload.style.js +0 -13
- package/dist/cjs/core/LocalUpload/LocalUpload.widget.js +0 -379
- package/dist/cjs/core/SearchInput/index.js +0 -164
- package/dist/cjs/coreX/Copy/CopyButton.js +0 -40
- package/dist/cjs/coreX/Copy/CopyTooltip.js +0 -66
- package/dist/cjs/hooks/useFormatDuration.js +0 -35
- package/dist/cjs/utils/formatDuration.js +0 -67
- package/dist/esm/core/Duration/index.js +0 -72
- package/dist/esm/core/LocalUpload/LocalUpload.hooks.js +0 -63
- package/dist/esm/core/LocalUpload/LocalUpload.js +0 -97
- package/dist/esm/core/LocalUpload/LocalUpload.style.js +0 -10
- package/dist/esm/core/LocalUpload/LocalUpload.widget.js +0 -365
- package/dist/esm/core/SearchInput/index.js +0 -157
- package/dist/esm/coreX/Copy/CopyButton.js +0 -34
- package/dist/esm/coreX/Copy/CopyTooltip.js +0 -59
- package/dist/esm/hooks/useFormatDuration.js +0 -33
- package/dist/esm/utils/formatDuration.js +0 -65
- package/dist/src/core/Duration/duration.type.d.ts +0 -42
- package/dist/src/core/Duration/index.d.ts +0 -4
- package/dist/src/core/LocalUpload/LocalUpload.d.ts +0 -15
- package/dist/src/core/LocalUpload/LocalUpload.hooks.d.ts +0 -32
- package/dist/src/core/LocalUpload/LocalUpload.style.d.ts +0 -3
- package/dist/src/core/LocalUpload/LocalUpload.type.d.ts +0 -175
- package/dist/src/core/LocalUpload/LocalUpload.widget.d.ts +0 -23
- package/dist/src/core/LocalUpload/index.d.ts +0 -2
- package/dist/src/coreX/Copy/CopyButton.d.ts +0 -5
- package/dist/src/coreX/Copy/CopyButton.type.d.ts +0 -8
- package/dist/src/coreX/Copy/CopyTooltip.d.ts +0 -5
- package/dist/src/coreX/Copy/CopyTooltip.typs.d.ts +0 -16
- package/dist/src/coreX/Copy/index.d.ts +0 -2
- package/dist/src/hooks/useFormatDuration.d.ts +0 -31
- package/dist/src/utils/__test__/formatDuration.spec.d.ts +0 -1
- package/dist/src/utils/formatDuration.d.ts +0 -28
- package/dist/stories/docs/core/Duration.stories.d.ts +0 -88
- package/dist/stories/docs/core/LocalUpload.stories.d.ts +0 -74
- package/dist/stories/docs/coreX/Copy/CopyButton.stories.d.ts +0 -66
- package/dist/stories/docs/coreX/Copy/CopyTooltip.stories.d.ts +0 -66
- /package/dist/src/{hooks/__tests__/useFormatDuration.test.d.ts → core/SearchInput/__test__/SearchInput.hook.test.d.ts} +0 -0
|
@@ -6,9 +6,9 @@ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
|
6
6
|
import { Flex } from 'antd5';
|
|
7
7
|
import cs from 'classnames';
|
|
8
8
|
import React__default, { useState } from 'react';
|
|
9
|
-
import SearchInput from '../SearchInput/index.js';
|
|
10
9
|
import { Typo } from '../Typo/index.js';
|
|
11
10
|
import { CascaderNotData, CascaderDefaultHeaderContainer, CascaderDefaultHeaderSearch, CascaderDefaultHeader, DoubleRowOptionStyleWrapper, Hide, CascaderDefaultOptionLabel } from './cascader.style.js';
|
|
11
|
+
import { SearchInput } from '../SearchInput/SearchInput.js';
|
|
12
12
|
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
14
14
|
var __defProps = Object.defineProperties;
|
|
@@ -42,7 +42,7 @@ const MediumDialog = _a => {
|
|
|
42
42
|
}) => /* @__PURE__ */React__default.createElement("span", {
|
|
43
43
|
className: Typo.Display.d1s_bold_title
|
|
44
44
|
}, title),
|
|
45
|
-
className: cx(MediumDialogStyle,
|
|
45
|
+
className: cx(MediumDialogStyle, isContentFull && "content-full", className),
|
|
46
46
|
initializingSkeletonRows: 3,
|
|
47
47
|
width: isContentFull ? "calc(100vw - 160px)" : 720
|
|
48
48
|
}, restProps));
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Search24Icon, Search24BlueIcon } from '@cloudtower/icons-react';
|
|
2
|
+
import { cx } from '@linaria/core';
|
|
3
|
+
import Icon from '../Icon/index.js';
|
|
4
|
+
import { Typo } from '../Typo/index.js';
|
|
5
|
+
import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
6
|
+
import { debounce } from 'lodash';
|
|
7
|
+
import React__default, { useState, useEffect, useRef, useMemo } from 'react';
|
|
8
|
+
import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __defProps = Object.defineProperties;
|
|
12
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
13
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
16
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17
|
+
var __spreadValues = (a, b) => {
|
|
18
|
+
for (var prop in b || (b = {}))
|
|
19
|
+
if (__hasOwnProp.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
if (__getOwnPropSymbols)
|
|
22
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
23
|
+
if (__propIsEnum.call(b, prop))
|
|
24
|
+
__defNormalProp(a, prop, b[prop]);
|
|
25
|
+
}
|
|
26
|
+
return a;
|
|
27
|
+
};
|
|
28
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
29
|
+
const searchInputRecentSearchLocalStorageKey = "search-input-recent-search";
|
|
30
|
+
const useRecentSearch = (recentSearchLocalStorageKey, maxRecentCount, setValue, onChange) => {
|
|
31
|
+
const { t } = useParrotTranslation();
|
|
32
|
+
const [recentSearchKeys, setRecentSearchKeys] = useState([]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!recentSearchLocalStorageKey)
|
|
35
|
+
return;
|
|
36
|
+
try {
|
|
37
|
+
const currRecentSearchKeys = JSON.parse(
|
|
38
|
+
localStorage.getItem(searchInputRecentSearchLocalStorageKey) || "{}"
|
|
39
|
+
)[recentSearchLocalStorageKey];
|
|
40
|
+
setRecentSearchKeys(currRecentSearchKeys || []);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
setRecentSearchKeys([]);
|
|
43
|
+
}
|
|
44
|
+
}, [recentSearchLocalStorageKey]);
|
|
45
|
+
const setRecentSearchKeysDebounceRef = useRef();
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!recentSearchLocalStorageKey)
|
|
48
|
+
return;
|
|
49
|
+
const fn = debounce((val) => {
|
|
50
|
+
if (!val || !recentSearchLocalStorageKey)
|
|
51
|
+
return;
|
|
52
|
+
setRecentSearchKeys((preState) => {
|
|
53
|
+
const newState = [...preState].filter((item) => item !== val);
|
|
54
|
+
if (newState.length >= maxRecentCount)
|
|
55
|
+
newState.pop();
|
|
56
|
+
newState.unshift(val);
|
|
57
|
+
try {
|
|
58
|
+
const recentSearchMap = JSON.parse(
|
|
59
|
+
localStorage.getItem(searchInputRecentSearchLocalStorageKey) || "{}"
|
|
60
|
+
);
|
|
61
|
+
localStorage.setItem(
|
|
62
|
+
searchInputRecentSearchLocalStorageKey,
|
|
63
|
+
JSON.stringify(__spreadProps(__spreadValues({}, recentSearchMap), {
|
|
64
|
+
[recentSearchLocalStorageKey]: newState
|
|
65
|
+
}))
|
|
66
|
+
);
|
|
67
|
+
} catch (err) {
|
|
68
|
+
console.error(err);
|
|
69
|
+
}
|
|
70
|
+
return newState;
|
|
71
|
+
});
|
|
72
|
+
}, 400);
|
|
73
|
+
setRecentSearchKeysDebounceRef.current = fn;
|
|
74
|
+
return () => fn.cancel();
|
|
75
|
+
}, [maxRecentCount, recentSearchLocalStorageKey]);
|
|
76
|
+
const antd5DropdownMenu = useMemo(
|
|
77
|
+
() => ({
|
|
78
|
+
onClick: ({ key: val }) => {
|
|
79
|
+
var _a;
|
|
80
|
+
setValue(val);
|
|
81
|
+
onChange == null ? void 0 : onChange(val);
|
|
82
|
+
(_a = setRecentSearchKeysDebounceRef.current) == null ? void 0 : _a.call(setRecentSearchKeysDebounceRef, val);
|
|
83
|
+
},
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
key: "recent-search",
|
|
87
|
+
className: cx("recent-search-menu-item", Typo.Label.l4_regular),
|
|
88
|
+
disabled: true,
|
|
89
|
+
label: /* @__PURE__ */ React__default.createElement("span", null, t("components.recent_search"))
|
|
90
|
+
},
|
|
91
|
+
...recentSearchKeys.map((k) => ({
|
|
92
|
+
key: k,
|
|
93
|
+
label: /* @__PURE__ */ React__default.createElement(
|
|
94
|
+
Icon,
|
|
95
|
+
{
|
|
96
|
+
src: Search24Icon,
|
|
97
|
+
hoverSrc: Search24BlueIcon,
|
|
98
|
+
iconHeight: 24,
|
|
99
|
+
iconWidth: 24
|
|
100
|
+
},
|
|
101
|
+
/* @__PURE__ */ React__default.createElement(OverflowTooltip, { content: k })
|
|
102
|
+
)
|
|
103
|
+
}))
|
|
104
|
+
],
|
|
105
|
+
// 避免 Dropdown 点击时被 Input blur 关闭
|
|
106
|
+
onMouseDown: (e) => e.preventDefault()
|
|
107
|
+
}),
|
|
108
|
+
[onChange, recentSearchKeys, setRecentSearchKeysDebounceRef, setValue, t]
|
|
109
|
+
);
|
|
110
|
+
return {
|
|
111
|
+
recentSearchKeys,
|
|
112
|
+
setRecentSearchKeysDebounceRef,
|
|
113
|
+
antd5DropdownMenu
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export { searchInputRecentSearchLocalStorageKey, useRecentSearch };
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
2
|
+
import { ArrowChevronUp16SecondaryIcon, ArrowChevronUp16BlueIcon, ArrowChevronDown16SecondaryIcon, ArrowChevronDown16BlueIcon, XmarkCloseCircleFill16TertiaryIcon, XmarkCloseCircleFill16SecondaryIcon } from '@cloudtower/icons-react';
|
|
3
|
+
import { cx } from '@linaria/core';
|
|
4
|
+
import Icon from '../Icon/index.js';
|
|
5
|
+
import Input from '../Input/index.js';
|
|
6
|
+
import Tooltip from '../Tooltip/index.js';
|
|
7
|
+
import { Typo } from '../Typo/index.js';
|
|
8
|
+
import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
9
|
+
import { debounce } from 'lodash';
|
|
10
|
+
import React__default, { useState, useRef, useEffect, useCallback } from 'react';
|
|
11
|
+
import { useRecentSearch } from './SearchInput.hook.js';
|
|
12
|
+
import { CountTextStyles, IconContainerStyles, DisabledIconStyles, SearchInputStyles, SearchInputDropdownStyles } from './SearchInput.style.js';
|
|
13
|
+
import { Antd5Dropdown } from '../Antd5Dropdown/Antd5Dropdown.js';
|
|
14
|
+
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
17
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
|
+
var __spreadValues = (a, b) => {
|
|
21
|
+
for (var prop in b || (b = {}))
|
|
22
|
+
if (__hasOwnProp.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
if (__getOwnPropSymbols)
|
|
25
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
+
if (__propIsEnum.call(b, prop))
|
|
27
|
+
__defNormalProp(a, prop, b[prop]);
|
|
28
|
+
}
|
|
29
|
+
return a;
|
|
30
|
+
};
|
|
31
|
+
var __objRest = (source, exclude) => {
|
|
32
|
+
var target = {};
|
|
33
|
+
for (var prop in source)
|
|
34
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
35
|
+
target[prop] = source[prop];
|
|
36
|
+
if (source != null && __getOwnPropSymbols)
|
|
37
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
38
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
39
|
+
target[prop] = source[prop];
|
|
40
|
+
}
|
|
41
|
+
return target;
|
|
42
|
+
};
|
|
43
|
+
const SearchInput = (props) => {
|
|
44
|
+
const _a = props, {
|
|
45
|
+
className,
|
|
46
|
+
debounceWait = 300,
|
|
47
|
+
total = 0,
|
|
48
|
+
onSearchNext,
|
|
49
|
+
onSearchPrev,
|
|
50
|
+
prefixHoverIcon,
|
|
51
|
+
nextHoverIcon,
|
|
52
|
+
clearHoverIcon,
|
|
53
|
+
prefixIcon,
|
|
54
|
+
nextIcon,
|
|
55
|
+
clearIcon,
|
|
56
|
+
width = 276,
|
|
57
|
+
searchIcon,
|
|
58
|
+
enableRecentSearch,
|
|
59
|
+
recentSearchLocalStorageKey,
|
|
60
|
+
maxRecentCount = 5,
|
|
61
|
+
current: externalCurrent,
|
|
62
|
+
onChange,
|
|
63
|
+
onFocus,
|
|
64
|
+
onBlur
|
|
65
|
+
} = _a, restProps = __objRest(_a, [
|
|
66
|
+
"className",
|
|
67
|
+
"debounceWait",
|
|
68
|
+
"total",
|
|
69
|
+
"onSearchNext",
|
|
70
|
+
"onSearchPrev",
|
|
71
|
+
"prefixHoverIcon",
|
|
72
|
+
"nextHoverIcon",
|
|
73
|
+
"clearHoverIcon",
|
|
74
|
+
"prefixIcon",
|
|
75
|
+
"nextIcon",
|
|
76
|
+
"clearIcon",
|
|
77
|
+
"width",
|
|
78
|
+
"searchIcon",
|
|
79
|
+
"enableRecentSearch",
|
|
80
|
+
"recentSearchLocalStorageKey",
|
|
81
|
+
"maxRecentCount",
|
|
82
|
+
"current",
|
|
83
|
+
"onChange",
|
|
84
|
+
"onFocus",
|
|
85
|
+
"onBlur"
|
|
86
|
+
]);
|
|
87
|
+
const [internalCurrent, setInternalCurrent] = useState(0);
|
|
88
|
+
const [value, setValue] = useState(props.value || "");
|
|
89
|
+
const { t } = useParrotTranslation();
|
|
90
|
+
const isNoMatch = total === 0;
|
|
91
|
+
const [inputFocused, setInputFocused] = useState(false);
|
|
92
|
+
const {
|
|
93
|
+
recentSearchKeys,
|
|
94
|
+
setRecentSearchKeysDebounceRef,
|
|
95
|
+
antd5DropdownMenu
|
|
96
|
+
} = useRecentSearch(
|
|
97
|
+
recentSearchLocalStorageKey,
|
|
98
|
+
maxRecentCount,
|
|
99
|
+
setValue,
|
|
100
|
+
onChange
|
|
101
|
+
);
|
|
102
|
+
const debounceOnChangeRef = useRef();
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
const fn = debounce((val) => {
|
|
105
|
+
var _a2;
|
|
106
|
+
onChange == null ? void 0 : onChange(val);
|
|
107
|
+
if (enableRecentSearch && val) {
|
|
108
|
+
(_a2 = setRecentSearchKeysDebounceRef.current) == null ? void 0 : _a2.call(setRecentSearchKeysDebounceRef, val);
|
|
109
|
+
}
|
|
110
|
+
}, debounceWait);
|
|
111
|
+
debounceOnChangeRef.current = fn;
|
|
112
|
+
return () => fn.cancel();
|
|
113
|
+
}, [
|
|
114
|
+
onChange,
|
|
115
|
+
enableRecentSearch,
|
|
116
|
+
debounceWait,
|
|
117
|
+
setRecentSearchKeysDebounceRef
|
|
118
|
+
]);
|
|
119
|
+
const current = externalCurrent !== void 0 ? externalCurrent : internalCurrent;
|
|
120
|
+
const setCurrent = useCallback(
|
|
121
|
+
(newCurrent) => {
|
|
122
|
+
if (externalCurrent === void 0) {
|
|
123
|
+
setInternalCurrent(newCurrent);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
[externalCurrent]
|
|
127
|
+
);
|
|
128
|
+
const next = useCallback(() => {
|
|
129
|
+
if (total) {
|
|
130
|
+
const nextCurrent = current + 1 > total ? 1 : current + 1;
|
|
131
|
+
onSearchNext == null ? void 0 : onSearchNext(value, nextCurrent);
|
|
132
|
+
setCurrent(nextCurrent);
|
|
133
|
+
}
|
|
134
|
+
}, [onSearchNext, current, total, value, setCurrent]);
|
|
135
|
+
const prev = useCallback(() => {
|
|
136
|
+
if (total) {
|
|
137
|
+
const prevCurrent = current - 1 < 1 ? total : current - 1;
|
|
138
|
+
onSearchPrev == null ? void 0 : onSearchPrev(value, prevCurrent);
|
|
139
|
+
setCurrent(prevCurrent);
|
|
140
|
+
}
|
|
141
|
+
}, [onSearchPrev, current, total, value, setCurrent]);
|
|
142
|
+
const suffix = onSearchNext && onSearchPrev && value ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, typeof total === "number" ? /* @__PURE__ */ React__default.createElement(
|
|
143
|
+
"span",
|
|
144
|
+
{
|
|
145
|
+
className: cx(
|
|
146
|
+
Typo.Label.l4_regular,
|
|
147
|
+
"counter-text",
|
|
148
|
+
CountTextStyles
|
|
149
|
+
)
|
|
150
|
+
},
|
|
151
|
+
current,
|
|
152
|
+
"/",
|
|
153
|
+
total
|
|
154
|
+
) : null, /* @__PURE__ */ React__default.createElement("span", { className: IconContainerStyles }, isNoMatch ? /* @__PURE__ */ React__default.createElement(
|
|
155
|
+
Icon,
|
|
156
|
+
{
|
|
157
|
+
className: DisabledIconStyles,
|
|
158
|
+
src: ArrowChevronUp16SecondaryIcon,
|
|
159
|
+
style: { opacity: 0.5 }
|
|
160
|
+
}
|
|
161
|
+
) : /* @__PURE__ */ React__default.createElement(Tooltip, { title: t("components.prev") }, /* @__PURE__ */ React__default.createElement(
|
|
162
|
+
Icon,
|
|
163
|
+
{
|
|
164
|
+
src: prefixIcon != null ? prefixIcon : ArrowChevronUp16SecondaryIcon,
|
|
165
|
+
hoverSrc: prefixHoverIcon != null ? prefixHoverIcon : ArrowChevronUp16BlueIcon,
|
|
166
|
+
onClick: prev
|
|
167
|
+
}
|
|
168
|
+
)), isNoMatch ? /* @__PURE__ */ React__default.createElement(
|
|
169
|
+
Icon,
|
|
170
|
+
{
|
|
171
|
+
className: DisabledIconStyles,
|
|
172
|
+
src: ArrowChevronDown16SecondaryIcon,
|
|
173
|
+
style: { opacity: 0.5 }
|
|
174
|
+
}
|
|
175
|
+
) : /* @__PURE__ */ React__default.createElement(Tooltip, { title: t("components.next") }, /* @__PURE__ */ React__default.createElement(
|
|
176
|
+
Icon,
|
|
177
|
+
{
|
|
178
|
+
src: nextIcon != null ? nextIcon : ArrowChevronDown16SecondaryIcon,
|
|
179
|
+
hoverSrc: nextHoverIcon != null ? nextHoverIcon : ArrowChevronDown16BlueIcon,
|
|
180
|
+
onClick: next
|
|
181
|
+
}
|
|
182
|
+
)), /* @__PURE__ */ React__default.createElement(Tooltip, { title: t("components.clear") }, /* @__PURE__ */ React__default.createElement(
|
|
183
|
+
Icon,
|
|
184
|
+
{
|
|
185
|
+
src: clearIcon != null ? clearIcon : XmarkCloseCircleFill16TertiaryIcon,
|
|
186
|
+
hoverSrc: clearHoverIcon != null ? clearHoverIcon : XmarkCloseCircleFill16SecondaryIcon,
|
|
187
|
+
onClick: () => {
|
|
188
|
+
var _a2;
|
|
189
|
+
setValue("");
|
|
190
|
+
(_a2 = debounceOnChangeRef.current) == null ? void 0 : _a2.call(debounceOnChangeRef, "");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
)))) : null;
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
setValue(props.value || "");
|
|
196
|
+
}, [props.value]);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
if (externalCurrent === void 0) {
|
|
199
|
+
setCurrent(total ? 1 : 0);
|
|
200
|
+
}
|
|
201
|
+
}, [value, total, externalCurrent, setCurrent]);
|
|
202
|
+
const InputComponent = /* @__PURE__ */ React__default.createElement(
|
|
203
|
+
Input,
|
|
204
|
+
__spreadValues({
|
|
205
|
+
className: cx(SearchInputStyles, className),
|
|
206
|
+
style: { width },
|
|
207
|
+
prefix: searchIcon ? /* @__PURE__ */ React__default.createElement(Icon, { src: searchIcon }) : /* @__PURE__ */ React__default.createElement(SearchOutlined, null),
|
|
208
|
+
suffix,
|
|
209
|
+
onPressEnter: next,
|
|
210
|
+
value,
|
|
211
|
+
onChange: (e) => {
|
|
212
|
+
var _a2;
|
|
213
|
+
const newValue = e.target.value || "";
|
|
214
|
+
setValue(newValue);
|
|
215
|
+
(_a2 = debounceOnChangeRef.current) == null ? void 0 : _a2.call(debounceOnChangeRef, newValue);
|
|
216
|
+
},
|
|
217
|
+
onFocus: (e) => {
|
|
218
|
+
setInputFocused(true);
|
|
219
|
+
onFocus == null ? void 0 : onFocus(e);
|
|
220
|
+
},
|
|
221
|
+
onBlur: (e) => {
|
|
222
|
+
setInputFocused(false);
|
|
223
|
+
onBlur == null ? void 0 : onBlur(e);
|
|
224
|
+
}
|
|
225
|
+
}, restProps)
|
|
226
|
+
);
|
|
227
|
+
if (enableRecentSearch)
|
|
228
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
229
|
+
Antd5Dropdown,
|
|
230
|
+
{
|
|
231
|
+
overlayClassName: cx(
|
|
232
|
+
"recent-search-dropdown",
|
|
233
|
+
SearchInputDropdownStyles
|
|
234
|
+
),
|
|
235
|
+
overlayStyle: { width },
|
|
236
|
+
transitionName: "",
|
|
237
|
+
placement: "bottomLeft",
|
|
238
|
+
trigger: ["click"],
|
|
239
|
+
open: inputFocused && !value && !!recentSearchKeys.length,
|
|
240
|
+
menu: antd5DropdownMenu
|
|
241
|
+
},
|
|
242
|
+
InputComponent
|
|
243
|
+
);
|
|
244
|
+
return InputComponent;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export { SearchInput };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const SearchInputStyles = "E_s1n7hav7";
|
|
2
|
+
const CountTextStyles = "E_c1tgpyn0";
|
|
3
|
+
const IconContainerStyles = "E_i1cmbu8m";
|
|
4
|
+
const DisabledIconStyles = "E_dxmfsc9";
|
|
5
|
+
const SearchInputDropdownStyles = "E_slbf45q";
|
|
6
|
+
|
|
7
|
+
export { CountTextStyles, DisabledIconStyles, IconContainerStyles, SearchInputDropdownStyles, SearchInputStyles };
|
package/dist/esm/core/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import BitPerSecond from './BitPerSecond/index.js';
|
|
|
3
3
|
import Bps from './Bps/index.js';
|
|
4
4
|
import Byte from './Byte/index.js';
|
|
5
5
|
import BytePerSecond from './BytePerSecond/index.js';
|
|
6
|
-
import Duration from './Duration/index.js';
|
|
7
6
|
import Frequency from './Frequency/index.js';
|
|
8
7
|
import Percent from './Percent/index.js';
|
|
9
8
|
import Second from './Second/index.js';
|
|
@@ -18,8 +17,7 @@ const units = {
|
|
|
18
17
|
Bps,
|
|
19
18
|
BitPerSecond,
|
|
20
19
|
Bit,
|
|
21
|
-
Second
|
|
22
|
-
Duration
|
|
20
|
+
Second
|
|
23
21
|
};
|
|
24
22
|
|
|
25
|
-
export { Bit, BitPerSecond, Bps, Byte, BytePerSecond,
|
|
23
|
+
export { Bit, BitPerSecond, Bps, Byte, BytePerSecond, Frequency, Percent, Second, Speed, units as Units, units };
|
|
@@ -30,17 +30,8 @@ const SecondaryDesc = "E_srje1h0";
|
|
|
30
30
|
const Divider = "E_di3zi7v";
|
|
31
31
|
const SingleRejectContent = ({
|
|
32
32
|
content,
|
|
33
|
-
listType = "ordered"
|
|
34
|
-
resourceIcon
|
|
33
|
+
listType = "ordered"
|
|
35
34
|
}) => {
|
|
36
|
-
if (listType === "resource" && Array.isArray(content)) {
|
|
37
|
-
return /* @__PURE__ */React__default.createElement("div", {
|
|
38
|
-
className: cx(MultiRejectContentList)
|
|
39
|
-
}, content.map((name, index) => /* @__PURE__ */React__default.createElement("li", {
|
|
40
|
-
className: Typo.Label.l4_regular,
|
|
41
|
-
key: index
|
|
42
|
-
}, resourceIcon, /* @__PURE__ */React__default.createElement("span", null, name))));
|
|
43
|
-
}
|
|
44
35
|
if (Array.isArray(content) && content.length > 1) {
|
|
45
36
|
if (listType === "ordered") {
|
|
46
37
|
return /* @__PURE__ */React__default.createElement("ol", {
|
|
@@ -88,13 +79,10 @@ const RejectDialog = props => {
|
|
|
88
79
|
const renderContent = () => {
|
|
89
80
|
switch (props.type) {
|
|
90
81
|
case RejectDialogType.Single:
|
|
91
|
-
return /* @__PURE__ */React__default.createElement(
|
|
92
|
-
className: cx(SecondaryDesc, Typo.Label.l4_regular)
|
|
93
|
-
}, props.secondaryDesc), /* @__PURE__ */React__default.createElement(SingleRejectContent, {
|
|
82
|
+
return /* @__PURE__ */React__default.createElement(SingleRejectContent, {
|
|
94
83
|
content: props.content,
|
|
95
|
-
listType: props.listType
|
|
96
|
-
|
|
97
|
-
}));
|
|
84
|
+
listType: props.listType
|
|
85
|
+
});
|
|
98
86
|
case RejectDialogType.All:
|
|
99
87
|
case RejectDialogType.Part:
|
|
100
88
|
return /* @__PURE__ */React__default.createElement(React__default.Fragment, null, props.secondaryDesc && /* @__PURE__ */React__default.createElement("div", {
|
package/dist/esm/index.js
CHANGED
|
@@ -31,7 +31,6 @@ export { default as DeprecatedProgress } from './core/DeprecatedProgress/index.j
|
|
|
31
31
|
export { default as DetailCard } from './core/DetailCard/index.js';
|
|
32
32
|
export { default as DonutChart, DonutChartColor, formatChartData, formatCollapse } from './core/DonutChart/index.js';
|
|
33
33
|
export { default as DropdownMenu, RenderMenuItem } from './core/DropdownMenu/index.js';
|
|
34
|
-
export { default as Duration } from './core/Duration/index.js';
|
|
35
34
|
export { default as Empty } from './core/Empty/index.js';
|
|
36
35
|
export { default as Error } from './core/Error/index.js';
|
|
37
36
|
export { default as ErrorBoundary } from './core/ErrorBoundary/index.js';
|
|
@@ -61,7 +60,6 @@ export { ExtraOverflow, default as Overflow } from './core/Overflow/index.js';
|
|
|
61
60
|
export { default as Pagination, PaginationStyle } from './core/Pagination/index.js';
|
|
62
61
|
export { default as Percent } from './core/Percent/index.js';
|
|
63
62
|
export { default as Radio, RadioButton, RadioGroup } from './core/Radio/index.js';
|
|
64
|
-
export { default as SearchInput } from './core/SearchInput/index.js';
|
|
65
63
|
export { default as Second } from './core/Second/index.js';
|
|
66
64
|
export { default as SegmentControl } from './core/SegmentControl/index.js';
|
|
67
65
|
export { default as Select } from './core/Select/index.js';
|
|
@@ -99,7 +97,6 @@ export { ImmersiveDialog } from './core/ImmersiveDialog/index.js';
|
|
|
99
97
|
export { LineChartColorBlock, default as LineChartLegend } from './core/LineChart/LineChartLegend.js';
|
|
100
98
|
export { ILineChartGraphType, ILineChartMetricUnit, ILineChartTimeUnit } from './core/LineChart/type.js';
|
|
101
99
|
export { UNIT_FORMATTER, addMissingDataWithZero, convertLineChartDataStruct, convertLineChartUnit, deletePointsOutOfRange, filterLineChartDataOverlapping, filterLineChartOverlappingMetric, filterLineChartPointsByDateRange, getFirstExpectedTimestamp, getLineChartRangeTimestamp, getLineChartStep, getLineChartXAxisDomain, getLineChartYDataMax, getYAxisDomain, getYAxisUpperBound, lineChartTickFormatter, lineChartXaxisCal, lineChartYaxisTickFormatter, parseLineChartRange } from './core/LineChart/utils.js';
|
|
102
|
-
export { LocalUpload } from './core/LocalUpload/LocalUpload.js';
|
|
103
100
|
export { MediumDialog } from './core/MediumDialog/MediumDialog.js';
|
|
104
101
|
export { Batcher, createBatchMessageMethods, makeUUID } from './core/message-group/index.js';
|
|
105
102
|
export { default as MetricActions } from './core/Metric/MetricActions.js';
|
|
@@ -112,6 +109,7 @@ export { GraphType, TimeUnit } from './core/Metric/type.js';
|
|
|
112
109
|
export { ParrotTrans } from './core/ParrotTrans/index.js';
|
|
113
110
|
export { Area, TitleArea } from './core/Progress/progress.widgets.js';
|
|
114
111
|
export { Progress } from './core/Progress/index.js';
|
|
112
|
+
export { SearchInput } from './core/SearchInput/SearchInput.js';
|
|
115
113
|
export { getOptions } from './core/Select/select.widgets.js';
|
|
116
114
|
export { SidebarMenu } from './core/SidebarMenu/SidebarMenu.js';
|
|
117
115
|
export { default as Skeleton } from './core/Skeleton/index.js';
|
|
@@ -132,8 +130,6 @@ export { default as BarChart, getWidth } from './coreX/BarChart/index.js';
|
|
|
132
130
|
export { default as BatchOperation, renderBatchOperationMenuItem } from './coreX/BatchOperation/index.js';
|
|
133
131
|
export { default as ChartWithTooltip, ChartWithUnit } from './coreX/ChartWithTooltip/index.js';
|
|
134
132
|
export { default as CircleLoading } from './coreX/CircleLoading/index.js';
|
|
135
|
-
export { default as CopyButton } from './coreX/Copy/CopyButton.js';
|
|
136
|
-
export { default as CopyTooltip } from './coreX/Copy/CopyTooltip.js';
|
|
137
133
|
export { default as Counting } from './coreX/Counting/index.js';
|
|
138
134
|
export { default as CronCalendar } from './coreX/CronCalendar/index.js';
|
|
139
135
|
export { default as CronPlan, stringifyPlan } from './coreX/CronPlan/index.js';
|
package/dist/esm/legacy-antd.js
CHANGED
|
@@ -36,7 +36,6 @@ import _message from './core/message/message.js';
|
|
|
36
36
|
import Pagination from './core/Pagination/index.js';
|
|
37
37
|
import Percent from './core/Percent/index.js';
|
|
38
38
|
import Radio, { RadioGroup, RadioButton } from './core/Radio/index.js';
|
|
39
|
-
import SearchInput from './core/SearchInput/index.js';
|
|
40
39
|
import Second from './core/Second/index.js';
|
|
41
40
|
import SegmentControl from './core/SegmentControl/index.js';
|
|
42
41
|
import Select from './core/Select/index.js';
|
|
@@ -72,6 +71,7 @@ import SummaryTable from './coreX/SummaryTable/index.js';
|
|
|
72
71
|
import SwitchWithText from './coreX/SwitchWithText/index.js';
|
|
73
72
|
import UnitWithChart from './coreX/UnitWithChart/index.js';
|
|
74
73
|
import DateRangePicker from './coreX/DateRangePicker/index.js';
|
|
74
|
+
import { SearchInput } from './core/SearchInput/SearchInput.js';
|
|
75
75
|
|
|
76
76
|
function getAntdKit() {
|
|
77
77
|
const kit = {
|