@rainbow-oh/yee-c 0.8.19 → 0.8.20
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/Anchor/anchor.js +4 -1
- package/dist/cjs/Checkbox/checkbox.js +2 -1
- package/dist/cjs/Checkbox/style/index.less +3 -0
- package/dist/cjs/Progress/circle.js +46 -35
- package/dist/cjs/Progress/line.js +20 -11
- package/dist/cjs/Search/demo/basic.js +38 -3
- package/dist/cjs/Search/interface.d.ts +2 -2
- package/dist/cjs/Search/search.js +52 -32
- package/dist/cjs/Search/style/index.less +20 -3
- package/dist/cjs/Table/style/index.less +4 -2
- package/dist/cjs/Table/tbody/cell.js +2 -2
- package/dist/cjs/Transfer/interface.d.ts +0 -1
- package/dist/cjs/Transfer/style/index.less +4 -0
- package/dist/cjs/Transfer/transfer-list.js +1 -0
- package/dist/cjs/message/use-message.js +1 -3
- package/dist/cjs/notice/notice.js +1 -1
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Checkbox/checkbox.js +2 -1
- package/dist/esm/Checkbox/style/index.less +3 -0
- package/dist/esm/Search/demo/basic.js +61 -7
- package/dist/esm/Search/interface.d.ts +2 -2
- package/dist/esm/Search/search.js +22 -15
- package/dist/esm/Search/style/index.less +20 -3
- package/dist/esm/Table/style/index.less +4 -2
- package/dist/esm/Table/tbody/cell.js +2 -2
- package/dist/esm/Transfer/interface.d.ts +0 -1
- package/dist/esm/Transfer/style/index.less +4 -0
- package/dist/esm/Transfer/transfer-list.js +1 -0
- package/dist/esm/notice/notice.js +1 -1
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +1 -1
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Anchor/anchor.tsx +9 -5
- package/src/Checkbox/checkbox.tsx +1 -0
- package/src/Checkbox/style/index.less +3 -0
- package/src/Progress/circle.tsx +5 -1
- package/src/Progress/line.tsx +5 -1
- package/src/Progress/progress.tsx +5 -1
- package/src/Search/demo/basic.tsx +43 -7
- package/src/Search/index.en-US.md +1 -1
- package/src/Search/index.zh-CN.md +1 -1
- package/src/Search/interface.ts +2 -2
- package/src/Search/search.tsx +40 -23
- package/src/Search/style/index.less +20 -3
- package/src/Spin/indicator.tsx +1 -1
- package/src/Table/style/index.less +4 -2
- package/src/Table/tbody/cell.tsx +2 -2
- package/src/Transfer/interface.ts +0 -1
- package/src/Transfer/style/index.less +4 -0
- package/src/Transfer/transfer-list.tsx +1 -0
- package/src/Tree/interface.ts +6 -1
- package/src/Tree/tree-node.tsx +7 -6
- package/src/Tree/utils/tree-tools.ts +4 -1
- package/src/Trigger/interface.ts +2 -1
- package/src/message/demo/base.tsx +1 -1
- package/src/message/interface.ts +1 -5
- package/src/message/message.test.tsx +15 -5
- package/src/message/message.tsx +10 -4
- package/src/message/use-message.tsx +2 -8
- package/src/message/wrapper.tsx +1 -2
- package/src/notice/interface.ts +1 -5
- package/src/notice/notice.test.tsx +14 -6
- package/src/notice/notice.tsx +12 -6
- package/src/notice/wrapper.tsx +1 -2
- package/src/version.ts +1 -1
- package/dist/cjs/Search/style/index.d.ts +0 -1
- package/dist/cjs/Search/style/index.js +0 -2
- package/dist/esm/Search/style/index.d.ts +0 -1
- package/dist/esm/Search/style/index.js +0 -1
- package/src/Search/style/index.ts +0 -1
package/package.json
CHANGED
package/src/Anchor/anchor.tsx
CHANGED
|
@@ -78,9 +78,9 @@ const Anchor = forwardRef<HTMLDivElement, AnchorProps>((baseprops, ref) => {
|
|
|
78
78
|
const navigationTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(
|
|
79
79
|
null,
|
|
80
80
|
);
|
|
81
|
-
const navigationSettleTimeoutRef = useRef<
|
|
82
|
-
|
|
83
|
-
>(null);
|
|
81
|
+
const navigationSettleTimeoutRef = useRef<ReturnType<
|
|
82
|
+
typeof setTimeout
|
|
83
|
+
> | null>(null);
|
|
84
84
|
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
activeKeyRef.current = mergedActiveKey;
|
|
@@ -361,7 +361,10 @@ const Anchor = forwardRef<HTMLDivElement, AnchorProps>((baseprops, ref) => {
|
|
|
361
361
|
'pointerdown',
|
|
362
362
|
onUserInterrupt as EventListener,
|
|
363
363
|
);
|
|
364
|
-
container.removeEventListener(
|
|
364
|
+
container.removeEventListener(
|
|
365
|
+
'keydown',
|
|
366
|
+
onUserInterrupt as EventListener,
|
|
367
|
+
);
|
|
365
368
|
if (rafId !== null) {
|
|
366
369
|
cancelAnimationFrame(rafId);
|
|
367
370
|
}
|
|
@@ -419,7 +422,8 @@ const Anchor = forwardRef<HTMLDivElement, AnchorProps>((baseprops, ref) => {
|
|
|
419
422
|
|
|
420
423
|
// Handles instant scrolling and targets that are already in position.
|
|
421
424
|
handleScroll();
|
|
422
|
-
},
|
|
425
|
+
},
|
|
426
|
+
[
|
|
423
427
|
startNavigationLock,
|
|
424
428
|
commitActiveKey,
|
|
425
429
|
scrollToAnchor,
|
package/src/Progress/circle.tsx
CHANGED
|
@@ -111,7 +111,11 @@ const Circle = React.forwardRef<HTMLDivElement, CircleProps>((props, ref) => {
|
|
|
111
111
|
style={{ width, height: width }}
|
|
112
112
|
ref={ref}
|
|
113
113
|
>
|
|
114
|
-
<svg
|
|
114
|
+
<svg
|
|
115
|
+
className={`${prefixCls}-circle`}
|
|
116
|
+
viewBox="0 0 120 120"
|
|
117
|
+
aria-hidden="true"
|
|
118
|
+
>
|
|
115
119
|
<circle
|
|
116
120
|
className={`${prefixCls}-circle-trail`}
|
|
117
121
|
cx="60"
|
package/src/Progress/line.tsx
CHANGED
|
@@ -36,7 +36,11 @@ const Line = React.forwardRef<HTMLDivElement, LineProps>((props, ref) => {
|
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<div className={`${prefixCls}-outer`} ref={ref}>
|
|
39
|
-
<div
|
|
39
|
+
<div
|
|
40
|
+
className={`${prefixCls}-inner`}
|
|
41
|
+
style={{ height: strokeWidth }}
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
>
|
|
40
44
|
<div
|
|
41
45
|
className={`${prefixCls}-bg`}
|
|
42
46
|
style={{ width: percent + '%', ...progressColor }}
|
|
@@ -107,7 +107,11 @@ const Progress = React.forwardRef<HTMLDivElement, ProgressProps>(
|
|
|
107
107
|
aria-valuemin={0}
|
|
108
108
|
aria-valuemax={100}
|
|
109
109
|
aria-valuetext={`${percent}%`}
|
|
110
|
-
aria-label={
|
|
110
|
+
aria-label={
|
|
111
|
+
status === 'error'
|
|
112
|
+
? `Progress: ${percent}%, error`
|
|
113
|
+
: `Progress: ${percent}%`
|
|
114
|
+
}
|
|
111
115
|
ref={ref}
|
|
112
116
|
{...dataAttrs}
|
|
113
117
|
>
|
|
@@ -1,14 +1,50 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import Search from '../index';
|
|
3
|
-
|
|
3
|
+
import type { SearchOption } from '../interface';
|
|
4
|
+
const people: SearchOption[] = [
|
|
5
|
+
{ key: 'ada', value: 'ada', label: 'Ada Lovelace' },
|
|
6
|
+
{ key: 'grace', value: 'grace', label: 'Grace Hopper' },
|
|
7
|
+
{ key: 'alan', value: 'alan', label: 'Alan Turing' },
|
|
8
|
+
{ key: 'margaret', value: 'margaret', label: 'Margaret Hamilton' },
|
|
9
|
+
];
|
|
4
10
|
export default () => {
|
|
5
|
-
const
|
|
6
|
-
|
|
11
|
+
const [keyword, setKeyword] = useState('');
|
|
12
|
+
const [selected, setSelected] = useState<SearchOption | null>(null);
|
|
13
|
+
const results = useMemo(() => {
|
|
14
|
+
const normalizedKeyword = keyword.trim().toLowerCase();
|
|
15
|
+
const matched = people.filter((person) =>
|
|
16
|
+
String(person.label).toLowerCase().includes(normalizedKeyword),
|
|
17
|
+
);
|
|
18
|
+
return matched.length > 0
|
|
19
|
+
? matched
|
|
20
|
+
: [
|
|
21
|
+
{
|
|
22
|
+
key: 'empty',
|
|
23
|
+
value: 'empty',
|
|
24
|
+
label: 'No results found',
|
|
25
|
+
disabled: true,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}, [keyword]);
|
|
29
|
+
const handleSelect = (option: SearchOption | null) => {
|
|
30
|
+
setSelected(option);
|
|
31
|
+
if (option) {
|
|
32
|
+
setKeyword(String(option.label));
|
|
33
|
+
}
|
|
7
34
|
};
|
|
8
|
-
|
|
9
35
|
return (
|
|
10
|
-
<div style={{ width:
|
|
11
|
-
<Search
|
|
36
|
+
<div style={{ width: 320 }}>
|
|
37
|
+
<Search
|
|
38
|
+
allowClear
|
|
39
|
+
value={keyword}
|
|
40
|
+
options={results}
|
|
41
|
+
placeholder="Search people"
|
|
42
|
+
onSearch={setKeyword}
|
|
43
|
+
onChange={handleSelect}
|
|
44
|
+
/>
|
|
45
|
+
<div style={{ marginTop: 12 }}>
|
|
46
|
+
Selected: {selected ? String(selected.label) : 'None'}
|
|
47
|
+
</div>
|
|
12
48
|
</div>
|
|
13
49
|
);
|
|
14
50
|
};
|
|
@@ -14,7 +14,7 @@ A search input component for querying data.
|
|
|
14
14
|
|
|
15
15
|
## Code Demo
|
|
16
16
|
|
|
17
|
-
<code src="./demo/basic.tsx" title="Basic" description="
|
|
17
|
+
<code src="./demo/basic.tsx" title="Basic" description="Filter results as you type and select from the dropdown"></code>
|
|
18
18
|
<code src="./demo/size.tsx" title="Size" description="Different sizes of Search"></code>
|
|
19
19
|
<code src="./demo/allowClear.tsx" title="Allow Clear" description="Search with clear icon"></code>
|
|
20
20
|
<code src="./demo/borderless.tsx" title="Borderless" description="Search without border"></code>
|
|
@@ -14,7 +14,7 @@ toc: 'content'
|
|
|
14
14
|
|
|
15
15
|
## 代码演示
|
|
16
16
|
|
|
17
|
-
<code src="./demo/basic.tsx" title="基础用法" description="
|
|
17
|
+
<code src="./demo/basic.tsx" title="基础用法" description="输入关键词筛选结果,并从下拉列表中选择"></code>
|
|
18
18
|
<code src="./demo/size.tsx" title="尺寸" description="不同尺寸的搜索框"></code>
|
|
19
19
|
<code src="./demo/allowClear.tsx" title="可清空" description="带清空图标的搜索框"></code>
|
|
20
20
|
<code src="./demo/borderless.tsx" title="无边框" description="无边框的搜索框"></code>
|
package/src/Search/interface.ts
CHANGED
|
@@ -68,7 +68,7 @@ export interface SearchProps
|
|
|
68
68
|
/**
|
|
69
69
|
* @description Suffix content
|
|
70
70
|
*/
|
|
71
|
-
suffix?: React.ReactNode;
|
|
71
|
+
suffix?: React.ReactNode | false;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @description Whether disabled
|
|
@@ -96,7 +96,7 @@ export interface SearchProps
|
|
|
96
96
|
* @description trigger search event
|
|
97
97
|
* @default 'typing'
|
|
98
98
|
*/
|
|
99
|
-
searchOnAction?: 'typing' | 'enter';
|
|
99
|
+
searchOnAction?: 'typing' | 'enter' | 'button';
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* @description suggest data
|
package/src/Search/search.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import { X } from 'lucide-react';
|
|
2
|
+
import { Search as SearchIcon, X } from 'lucide-react';
|
|
3
3
|
import React, {
|
|
4
4
|
startTransition,
|
|
5
5
|
useContext,
|
|
@@ -86,25 +86,12 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
86
86
|
}
|
|
87
87
|
}, [open]);
|
|
88
88
|
|
|
89
|
-
const handleSearch = (
|
|
90
|
-
e?:
|
|
91
|
-
| React.ChangeEvent<HTMLInputElement>
|
|
92
|
-
| React.MouseEvent<HTMLSpanElement>
|
|
93
|
-
| React.KeyboardEvent<HTMLInputElement>,
|
|
94
|
-
) => {
|
|
95
|
-
if (disabled) return;
|
|
96
|
-
onSearch?.(searchValue);
|
|
97
|
-
if (e?.type === 'click') {
|
|
98
|
-
(e.target as HTMLElement).blur?.();
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
89
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
103
90
|
const newValue = e.target.value;
|
|
104
91
|
setSearchValue(newValue);
|
|
105
92
|
startTransition(() => {
|
|
106
93
|
if (searchOnAction === 'typing') {
|
|
107
|
-
|
|
94
|
+
onSearch?.(newValue);
|
|
108
95
|
}
|
|
109
96
|
});
|
|
110
97
|
};
|
|
@@ -116,10 +103,28 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
116
103
|
onSearch?.('');
|
|
117
104
|
};
|
|
118
105
|
|
|
106
|
+
const handleSearchClick = (e: React.MouseEvent<HTMLSpanElement>) => {
|
|
107
|
+
e.stopPropagation();
|
|
108
|
+
if (searchOnAction === 'button') {
|
|
109
|
+
onSearch?.(searchValue);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const renderSearchIcon = () => {
|
|
114
|
+
if (suffix === false) return null;
|
|
115
|
+
return (
|
|
116
|
+
<span
|
|
117
|
+
className={`${prefixCls}-search-icon`}
|
|
118
|
+
onClick={handleSearchClick}
|
|
119
|
+
>
|
|
120
|
+
{suffix || <SearchIcon size={14} />}
|
|
121
|
+
</span>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
119
125
|
const renderSuffix = () => {
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const showSuffix = suffix || showClearIcon;
|
|
126
|
+
const showClearIcon = allowClear && !disabled && !rest.readOnly;
|
|
127
|
+
const showSuffix = suffix !== false || suffix !== null || showClearIcon;
|
|
123
128
|
|
|
124
129
|
if (!showSuffix) {
|
|
125
130
|
return null;
|
|
@@ -138,14 +143,16 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
138
143
|
onKeyDown={(e) => {
|
|
139
144
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
140
145
|
e.preventDefault();
|
|
141
|
-
handleClear(
|
|
146
|
+
handleClear(
|
|
147
|
+
e as unknown as React.MouseEvent<HTMLSpanElement>,
|
|
148
|
+
);
|
|
142
149
|
}
|
|
143
150
|
}}
|
|
144
151
|
>
|
|
145
152
|
<X size={14} aria-hidden="true" />
|
|
146
153
|
</span>
|
|
147
154
|
)}
|
|
148
|
-
{
|
|
155
|
+
{renderSearchIcon()}
|
|
149
156
|
</div>
|
|
150
157
|
);
|
|
151
158
|
};
|
|
@@ -177,6 +184,7 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
177
184
|
prefixCls,
|
|
178
185
|
{
|
|
179
186
|
[`${prefixCls}-disabled`]: disabled,
|
|
187
|
+
[`${prefixCls}-with-clear`]: allowClear && searchValue,
|
|
180
188
|
[`${prefixCls}-borderless`]: !bordered,
|
|
181
189
|
[`${prefixCls}-small`]: size === 'small',
|
|
182
190
|
[`${prefixCls}-large`]: size === 'large',
|
|
@@ -188,7 +196,12 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
188
196
|
const hasPopup = Array.isArray(options) || Array.isArray(suggestions);
|
|
189
197
|
|
|
190
198
|
const popup = (
|
|
191
|
-
<div
|
|
199
|
+
<div
|
|
200
|
+
className={`${prefixCls}-popup`}
|
|
201
|
+
tabIndex={0}
|
|
202
|
+
id={listboxId}
|
|
203
|
+
role="listbox"
|
|
204
|
+
>
|
|
192
205
|
{Array.isArray(options) ? (
|
|
193
206
|
<List
|
|
194
207
|
focusedKey={focusedKey}
|
|
@@ -208,7 +221,7 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
208
221
|
);
|
|
209
222
|
|
|
210
223
|
return (
|
|
211
|
-
<Trigger popup={popup} open={open} onOpenChange={setOpen}>
|
|
224
|
+
<Trigger popup={popup} open={open} stretch="width" onOpenChange={setOpen}>
|
|
212
225
|
<div
|
|
213
226
|
className={getRootClassName()}
|
|
214
227
|
style={style}
|
|
@@ -238,7 +251,11 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
|
|
|
238
251
|
: undefined
|
|
239
252
|
}
|
|
240
253
|
/>
|
|
241
|
-
{loading ?
|
|
254
|
+
{loading ? (
|
|
255
|
+
<Spin variant="ring" size="small" aria-label="Loading" />
|
|
256
|
+
) : (
|
|
257
|
+
renderSuffix()
|
|
258
|
+
)}
|
|
242
259
|
</div>
|
|
243
260
|
</Trigger>
|
|
244
261
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @import '../../style/index.less';
|
|
2
2
|
|
|
3
|
-
@
|
|
3
|
+
@cls: ~'yee-search';
|
|
4
4
|
|
|
5
|
-
.@{
|
|
5
|
+
.@{cls} {
|
|
6
6
|
position: relative;
|
|
7
7
|
display: inline-flex;
|
|
8
8
|
align-items: center;
|
|
@@ -69,9 +69,10 @@
|
|
|
69
69
|
border: none;
|
|
70
70
|
outline: none;
|
|
71
71
|
transition: all 0.2s;
|
|
72
|
+
line-height: var(--yee-input-line-height);
|
|
72
73
|
|
|
73
74
|
&::placeholder {
|
|
74
|
-
color: var(--yee-
|
|
75
|
+
color: var(--yee-placeholder-color);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
&-disabled {
|
|
@@ -99,7 +100,17 @@
|
|
|
99
100
|
color: var(--yee-input-fix-icon-color);
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
&-search-icon {
|
|
104
|
+
display: inline-flex;
|
|
105
|
+
}
|
|
106
|
+
|
|
102
107
|
&-clear-icon {
|
|
108
|
+
display: inline-flex;
|
|
109
|
+
padding: var(--yee-input-clear-padding);
|
|
110
|
+
color: var(--yee-input-clear-color);
|
|
111
|
+
background-color: var(--yee-input-clear-bg-color);
|
|
112
|
+
border-radius: 50%;
|
|
113
|
+
visibility: hidden;
|
|
103
114
|
cursor: pointer;
|
|
104
115
|
transition: color 0.2s;
|
|
105
116
|
|
|
@@ -108,6 +119,12 @@
|
|
|
108
119
|
}
|
|
109
120
|
}
|
|
110
121
|
|
|
122
|
+
&&-with-clear:not(.@{cls}-disabled):hover {
|
|
123
|
+
.@{cls}-clear-icon {
|
|
124
|
+
visibility: visible;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
111
128
|
&-button {
|
|
112
129
|
display: flex;
|
|
113
130
|
align-items: center;
|
package/src/Spin/indicator.tsx
CHANGED
|
@@ -97,7 +97,8 @@
|
|
|
97
97
|
width: 15px;
|
|
98
98
|
right: -15px;
|
|
99
99
|
top: 0;
|
|
100
|
-
box-shadow: inset 4px 0 8px -4px
|
|
100
|
+
box-shadow: inset 4px 0 8px -4px
|
|
101
|
+
var(--yee-table-fixed-left-after-bs-color);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -111,7 +112,8 @@
|
|
|
111
112
|
width: 15px;
|
|
112
113
|
left: -15px;
|
|
113
114
|
top: 0;
|
|
114
|
-
box-shadow: inset -4px 0 8px -4px
|
|
115
|
+
box-shadow: inset -4px 0 8px -4px
|
|
116
|
+
var(--yee-table-fixed-right-after-bs-color);
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
}
|
package/src/Table/tbody/cell.tsx
CHANGED
|
@@ -66,13 +66,13 @@ const TableCell: React.FC<BodyCellProps> = (props) => {
|
|
|
66
66
|
className,
|
|
67
67
|
);
|
|
68
68
|
|
|
69
|
-
const
|
|
69
|
+
const _style = { ...style, width, maxWidth: width, textAlign: align };
|
|
70
70
|
const _title = typeof title === 'string' ? title : undefined;
|
|
71
71
|
|
|
72
72
|
return {
|
|
73
73
|
...cellProperty,
|
|
74
74
|
className: cls,
|
|
75
|
-
style:
|
|
75
|
+
style: _style,
|
|
76
76
|
title: _title,
|
|
77
77
|
};
|
|
78
78
|
};
|
|
@@ -124,7 +124,6 @@ export interface TransferListProps {
|
|
|
124
124
|
oneWay?: boolean;
|
|
125
125
|
pagination?: Omit<PaginationProps, 'total'> & { total?: number };
|
|
126
126
|
draggable?: boolean;
|
|
127
|
-
targetMinCountLimit?: number;
|
|
128
127
|
onDrop?: (dropObj: Record<string, any>, dataSource: DataSource[]) => void;
|
|
129
128
|
onDelete?: (key: string | number) => void;
|
|
130
129
|
onItemSelect: (keys: Array<string | number>) => void;
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
line-height: var(--yee-transfer-list-item-height, 32px);
|
|
67
67
|
padding: var(--yee-transfer-list-item-padding, 0 11px);
|
|
68
68
|
|
|
69
|
+
&-checkbox {
|
|
70
|
+
width: 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
&:hover:not(.yee-one-way):not(.disabled) {
|
|
70
74
|
color: var(--yee-transfer-list-content-item-hover-color);
|
|
71
75
|
background-color: var(--yee-transfer-list-content-item-hover-bg-color);
|
|
@@ -199,6 +199,7 @@ const TransferList: React.FC<TransferListProps> = (props) => {
|
|
|
199
199
|
{checkboxOptions.map((option, index) => (
|
|
200
200
|
<li className={`${prefixCls}-list-item`} key={option.value || index}>
|
|
201
201
|
<Checkbox
|
|
202
|
+
className={`${prefixCls}-list-item-checkbox`}
|
|
202
203
|
value={option.value}
|
|
203
204
|
disabled={option.disabled || disabled}
|
|
204
205
|
checked={checkedKeys.includes(option.value)}
|
package/src/Tree/interface.ts
CHANGED
|
@@ -180,7 +180,12 @@ export interface TreeProps<T> extends DataAttributeProps {
|
|
|
180
180
|
/**
|
|
181
181
|
* Customize node key, title, children field names
|
|
182
182
|
*/
|
|
183
|
-
fieldNames?: {
|
|
183
|
+
fieldNames?: {
|
|
184
|
+
key?: keyof T;
|
|
185
|
+
label?: keyof T;
|
|
186
|
+
children?: keyof T;
|
|
187
|
+
extra?: keyof T;
|
|
188
|
+
};
|
|
184
189
|
/**
|
|
185
190
|
* Asynchronous data loading
|
|
186
191
|
*/
|
package/src/Tree/tree-node.tsx
CHANGED
|
@@ -111,9 +111,12 @@ const Node = <T extends Record<string, unknown> = any>(
|
|
|
111
111
|
const content = labelRender ? labelRender(node) : label;
|
|
112
112
|
|
|
113
113
|
// extra: appended after the label content (only when labelRender is NOT used)
|
|
114
|
-
const _extra =
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const _extra =
|
|
115
|
+
!labelRender && extra
|
|
116
|
+
? typeof extra === 'function'
|
|
117
|
+
? extra(original)
|
|
118
|
+
: extra
|
|
119
|
+
: null;
|
|
117
120
|
|
|
118
121
|
return (
|
|
119
122
|
<Button
|
|
@@ -127,9 +130,7 @@ const Node = <T extends Record<string, unknown> = any>(
|
|
|
127
130
|
onClick={disabled ? undefined : () => onSelect(uid)}
|
|
128
131
|
>
|
|
129
132
|
{content}
|
|
130
|
-
{_extra &&
|
|
131
|
-
<span className={`${prefixCls}-node-extra`}>{_extra}</span>
|
|
132
|
-
)}
|
|
133
|
+
{_extra && <span className={`${prefixCls}-node-extra`}>{_extra}</span>}
|
|
133
134
|
</Button>
|
|
134
135
|
);
|
|
135
136
|
};
|
|
@@ -229,7 +229,10 @@ export function tree2array<T extends Record<string, unknown>>(
|
|
|
229
229
|
key: rawKey,
|
|
230
230
|
label: _label as string,
|
|
231
231
|
title: node.title as string | undefined,
|
|
232
|
-
extra: _extra as
|
|
232
|
+
extra: _extra as
|
|
233
|
+
| React.ReactNode
|
|
234
|
+
| ((node: T) => React.ReactNode)
|
|
235
|
+
| undefined,
|
|
233
236
|
path,
|
|
234
237
|
pUid,
|
|
235
238
|
depth,
|
package/src/Trigger/interface.ts
CHANGED
|
@@ -32,7 +32,8 @@ export type Point =
|
|
|
32
32
|
| 'cl'
|
|
33
33
|
| 'cr';
|
|
34
34
|
|
|
35
|
-
export interface TriggerProps
|
|
35
|
+
export interface TriggerProps
|
|
36
|
+
extends Omit<RcTriggerProps, 'children'>, DataAttributeProps {
|
|
36
37
|
/**
|
|
37
38
|
* Custom class name prefix
|
|
38
39
|
*/
|
|
@@ -6,7 +6,7 @@ const BaseDemo = () => {
|
|
|
6
6
|
const showMessage = (type: string) => {
|
|
7
7
|
switch (type) {
|
|
8
8
|
case 'info':
|
|
9
|
-
messageApi.open({content: 'This is an info message', duration: 0});
|
|
9
|
+
messageApi.open({ content: 'This is an info message', duration: 0 });
|
|
10
10
|
break;
|
|
11
11
|
case 'success':
|
|
12
12
|
message.success('This is a success message');
|
package/src/message/interface.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// @vitest-environment jsdom
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
act,
|
|
5
|
+
cleanup,
|
|
6
|
+
render,
|
|
7
|
+
renderHook,
|
|
8
|
+
screen,
|
|
9
|
+
} from '@testing-library/react';
|
|
4
10
|
import React from 'react';
|
|
5
11
|
import { renderToString } from 'react-dom/server';
|
|
6
12
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
@@ -227,7 +233,11 @@ describe('message', () => {
|
|
|
227
233
|
|
|
228
234
|
act(() => {
|
|
229
235
|
currentApi.info({ content: 'first', duration: 0, onClose: firstOnClose });
|
|
230
|
-
currentApi.info({
|
|
236
|
+
currentApi.info({
|
|
237
|
+
content: 'second',
|
|
238
|
+
duration: 0,
|
|
239
|
+
onClose: secondOnClose,
|
|
240
|
+
});
|
|
231
241
|
currentApi.clear();
|
|
232
242
|
});
|
|
233
243
|
|
|
@@ -276,8 +286,8 @@ describe('message', () => {
|
|
|
276
286
|
expect(element?.getAttribute('role')).toBe('alert');
|
|
277
287
|
expect(element?.getAttribute('aria-live')).toBe('assertive');
|
|
278
288
|
expect(element?.querySelector('.yee-message-content')?.tagName).toBe('DIV');
|
|
279
|
-
expect(
|
|
280
|
-
'
|
|
281
|
-
);
|
|
289
|
+
expect(
|
|
290
|
+
element?.querySelector('.yee-message-icon')?.getAttribute('aria-hidden'),
|
|
291
|
+
).toBe('true');
|
|
282
292
|
});
|
|
283
293
|
});
|
package/src/message/message.tsx
CHANGED
|
@@ -5,10 +5,16 @@ import Spin from '../Spin';
|
|
|
5
5
|
import type { MessageProps } from './interface';
|
|
6
6
|
|
|
7
7
|
const icons = {
|
|
8
|
-
info: <Info size={22} fill=
|
|
9
|
-
success:
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
info: <Info size={22} fill="currentColor" stroke="#FFF" strokeWidth={2} />,
|
|
9
|
+
success: (
|
|
10
|
+
<CircleCheck size={22} fill="currentColor" stroke="#FFF" strokeWidth={2} />
|
|
11
|
+
),
|
|
12
|
+
warning: (
|
|
13
|
+
<CircleAlert size={22} fill="currentColor" stroke="#FFF" strokeWidth={2} />
|
|
14
|
+
),
|
|
15
|
+
error: (
|
|
16
|
+
<CircleX size={22} fill="currentColor" stroke="#FFF" strokeWidth={2} />
|
|
17
|
+
),
|
|
12
18
|
loading: <Spin className="loading" type="spin" size="small" height="auto" />,
|
|
13
19
|
};
|
|
14
20
|
|
|
@@ -6,11 +6,7 @@ import React, {
|
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
|
-
import {
|
|
10
|
-
MessageApi,
|
|
11
|
-
MessageType,
|
|
12
|
-
WrapperedMessageConfig,
|
|
13
|
-
} from './interface';
|
|
9
|
+
import { MessageApi, MessageType, WrapperedMessageConfig } from './interface';
|
|
14
10
|
import Message from './message';
|
|
15
11
|
|
|
16
12
|
const useMessage = () => {
|
|
@@ -78,9 +74,7 @@ const useMessage = () => {
|
|
|
78
74
|
updateMessages((current) => {
|
|
79
75
|
const exists = current.some((item) => item.key === key);
|
|
80
76
|
if (exists) {
|
|
81
|
-
return current.map((item) =>
|
|
82
|
-
item.key === key ? nextMessage : item,
|
|
83
|
-
);
|
|
77
|
+
return current.map((item) => (item.key === key ? nextMessage : item));
|
|
84
78
|
}
|
|
85
79
|
return [...current, nextMessage];
|
|
86
80
|
});
|
package/src/message/wrapper.tsx
CHANGED
|
@@ -93,8 +93,7 @@ class MessageWrapper {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
const key = params.key ?? this.uuid();
|
|
96
|
-
const keyGeneration =
|
|
97
|
-
this.generationByKey.get(key) ?? this.generation++;
|
|
96
|
+
const keyGeneration = this.generationByKey.get(key) ?? this.generation++;
|
|
98
97
|
this.generationByKey.set(key, keyGeneration);
|
|
99
98
|
const nextMessage = {
|
|
100
99
|
...params,
|
package/src/notice/interface.ts
CHANGED
|
@@ -7,11 +7,7 @@ export type PlacementType =
|
|
|
7
7
|
| 'bottom';
|
|
8
8
|
|
|
9
9
|
export type NoticeConfig = {
|
|
10
|
-
[dataAttribute: `data-${string}`]:
|
|
11
|
-
| string
|
|
12
|
-
| number
|
|
13
|
-
| boolean
|
|
14
|
-
| undefined;
|
|
10
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
15
11
|
/**
|
|
16
12
|
* Custom prefix class name
|
|
17
13
|
*/
|