@rainbow-oh/yee-c 0.8.1 → 0.8.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/Cascader/cascader.js +38 -30
- package/dist/cjs/Cascader/column.js +17 -9
- package/dist/cjs/Cascader/search-list.js +30 -22
- package/dist/cjs/Cascader/utils/index.js +1 -5
- package/dist/cjs/Checkbox/checkbox-group.js +23 -14
- package/dist/cjs/Dialog/dialog.js +1 -1
- package/dist/cjs/Dialog/interface.d.ts +1 -1
- package/dist/cjs/Dialog/style/index.less +2 -1
- package/dist/cjs/Drawer/drawer.js +9 -1
- package/dist/cjs/Form/Group.js +1 -1
- package/dist/cjs/Form/demo/tooltip.js +1 -3
- package/dist/cjs/Input/style/index.less +1 -0
- package/dist/cjs/List/hooks/useListKeyboard.js +3 -1
- package/dist/cjs/Menu/menu.js +18 -2
- package/dist/cjs/Pagination/items.js +54 -26
- package/dist/cjs/Pagination/pagination.js +25 -9
- package/dist/cjs/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.js +7 -1
- package/dist/cjs/Rate/star.js +27 -3
- package/dist/cjs/Segmented/demo/variant.js +15 -1
- package/dist/cjs/Segmented/index.d.ts +1 -1
- package/dist/cjs/Segmented/segmented.js +12 -15
- package/dist/cjs/Select/option.js +8 -1
- package/dist/cjs/Select/options.js +9 -1
- package/dist/cjs/Select/select.js +3 -1
- package/dist/cjs/Selector/style/index.less +1 -0
- package/dist/cjs/Steps/step.js +14 -2
- package/dist/cjs/Steps/steps.js +11 -1
- package/dist/cjs/Table/demo/components-override.js +31 -2
- package/dist/cjs/Table/demo/grouping.js +7 -1
- package/dist/cjs/Table/hooks/useColumns.d.ts +3 -3
- package/dist/cjs/Table/hooks/useColumns.js +11 -14
- package/dist/cjs/Table/icon/arrow-icon.js +1 -1
- package/dist/cjs/Table/index.d.ts +1 -1
- package/dist/cjs/Table/style/index.less +2 -4
- package/dist/cjs/Table/tbody/row.js +1 -4
- package/dist/cjs/Table/theader/cell.js +6 -3
- package/dist/cjs/Table/theader/index.js +12 -4
- package/dist/cjs/TextArea/style/index.less +1 -0
- package/dist/cjs/Tour/index.d.ts +1 -1
- package/dist/cjs/Tree/style/index.less +1 -5
- package/dist/cjs/Tree/tree.js +38 -35
- package/dist/cjs/VerificationCode/style/index.less +1 -0
- package/dist/cjs/hooks/useCountdown.d.ts +2 -1
- package/dist/cjs/hooks/useCountdown.js +46 -23
- package/dist/cjs/hooks/useEvent.js +1 -4
- package/dist/cjs/locale/interface.d.ts +3 -0
- package/dist/cjs/locale/lang/en_US.js +4 -1
- package/dist/cjs/locale/lang/ja_JP.js +4 -1
- package/dist/cjs/locale/lang/zh_CN.js +4 -1
- package/dist/cjs/locale/lang/zh_TW.js +4 -1
- package/dist/cjs/message/demo/base.js +1 -1
- package/dist/cjs/message/index.d.ts +1 -1
- package/dist/cjs/message/interface.d.ts +16 -7
- package/dist/cjs/message/message-provider.d.ts +2 -1
- package/dist/cjs/message/message-provider.js +1 -1
- package/dist/cjs/message/message.js +14 -9
- package/dist/cjs/message/style/index.less +3 -1
- package/dist/cjs/message/use-message.d.ts +3 -12
- package/dist/cjs/message/use-message.js +103 -45
- package/dist/cjs/message/wrapper.d.ts +21 -27
- package/dist/cjs/message/wrapper.js +49 -19
- package/dist/cjs/notice/index.d.ts +1 -1
- package/dist/cjs/notice/interface.d.ts +17 -7
- package/dist/cjs/notice/notice-list.d.ts +3 -3
- package/dist/cjs/notice/notice-provider.d.ts +2 -1
- package/dist/cjs/notice/notice-provider.js +1 -1
- package/dist/cjs/notice/notice.js +63 -20
- package/dist/cjs/notice/style/index.less +13 -1
- package/dist/cjs/notice/use-notice.d.ts +2 -11
- package/dist/cjs/notice/use-notice.js +156 -71
- package/dist/cjs/notice/wrapper.d.ts +19 -15
- package/dist/cjs/notice/wrapper.js +122 -52
- package/dist/cjs/style/size.css +5 -3
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +6 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Dialog/dialog.js +2 -2
- package/dist/esm/Dialog/interface.d.ts +1 -1
- package/dist/esm/Dialog/style/index.less +2 -1
- package/dist/esm/Form/Group.js +1 -1
- package/dist/esm/Input/style/index.less +1 -0
- package/dist/esm/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/esm/Segmented/index.d.ts +1 -1
- package/dist/esm/Segmented/segmented.js +1 -1
- package/dist/esm/Selector/style/index.less +1 -0
- package/dist/esm/Table/demo/components-override.js +1 -0
- package/dist/esm/Table/hooks/useColumns.d.ts +3 -3
- package/dist/esm/Table/hooks/useColumns.js +13 -16
- package/dist/esm/Table/icon/arrow-icon.js +1 -1
- package/dist/esm/Table/index.d.ts +1 -1
- package/dist/esm/Table/style/index.less +2 -4
- package/dist/esm/Table/theader/cell.js +7 -3
- package/dist/esm/TextArea/style/index.less +1 -0
- package/dist/esm/Tour/index.d.ts +1 -1
- package/dist/esm/Tree/style/index.less +1 -5
- package/dist/esm/Tree/tree.js +1 -1
- package/dist/esm/VerificationCode/style/index.less +1 -0
- package/dist/esm/hooks/useCountdown.d.ts +2 -1
- package/dist/esm/hooks/useCountdown.js +44 -14
- package/dist/esm/locale/interface.d.ts +3 -0
- package/dist/esm/locale/lang/en_US.js +4 -1
- package/dist/esm/locale/lang/ja_JP.js +4 -1
- package/dist/esm/locale/lang/zh_CN.js +4 -1
- package/dist/esm/locale/lang/zh_TW.js +4 -1
- package/dist/esm/message/demo/base.js +4 -1
- package/dist/esm/message/index.d.ts +1 -1
- package/dist/esm/message/interface.d.ts +16 -7
- package/dist/esm/message/message-provider.d.ts +2 -1
- package/dist/esm/message/message-provider.js +1 -1
- package/dist/esm/message/message.js +22 -9
- package/dist/esm/message/style/index.less +3 -1
- package/dist/esm/message/use-message.d.ts +3 -12
- package/dist/esm/message/use-message.js +129 -79
- package/dist/esm/message/wrapper.d.ts +21 -27
- package/dist/esm/message/wrapper.js +60 -18
- package/dist/esm/notice/index.d.ts +1 -1
- package/dist/esm/notice/interface.d.ts +17 -7
- package/dist/esm/notice/notice-list.d.ts +3 -3
- package/dist/esm/notice/notice-provider.d.ts +2 -1
- package/dist/esm/notice/notice-provider.js +1 -1
- package/dist/esm/notice/notice.js +73 -21
- package/dist/esm/notice/style/index.less +13 -1
- package/dist/esm/notice/use-notice.d.ts +2 -11
- package/dist/esm/notice/use-notice.js +180 -100
- package/dist/esm/notice/wrapper.d.ts +19 -15
- package/dist/esm/notice/wrapper.js +144 -62
- package/dist/esm/style/size.css +5 -3
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +6 -4
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +2 -2
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Anchor/anchor.tsx +2 -2
- package/src/Carousel/carousel.tsx +1 -2
- package/src/Cascader/cascader.tsx +5 -1
- package/src/Cascader/column.tsx +5 -1
- package/src/Cascader/search-list.tsx +10 -3
- package/src/Cascader/utils/index.ts +3 -6
- package/src/Checkbox/checkbox-group.tsx +6 -1
- package/src/Dialog/dialog.tsx +7 -3
- package/src/Dialog/interface.ts +1 -1
- package/src/Dialog/style/index.less +2 -1
- package/src/Drawer/drawer.tsx +7 -1
- package/src/Form/Group.tsx +2 -4
- package/src/Form/demo/tooltip.tsx +2 -11
- package/src/Form/utils/validate.ts +1 -4
- package/src/Input/style/index.less +1 -0
- package/src/List/hooks/useListKeyboard.ts +3 -3
- package/src/List/list.tsx +2 -1
- package/src/Menu/menu.tsx +14 -3
- package/src/Pagination/items.tsx +16 -4
- package/src/Pagination/pagination.tsx +18 -4
- package/src/PickerPanel/panels/DatePanel/DateBody.tsx +1 -1
- package/src/PickerPanel/panels/DateTimePanel/index.tsx +1 -1
- package/src/PickerPanel/panels/MonthPanel/MonthHeader.tsx +7 -2
- package/src/PickerPanel/panels/PanelBody.tsx +1 -1
- package/src/PickerPanel/panels/QuarterPanel/QuarterHeader.tsx +1 -1
- package/src/PickerPanel/panels/RangePanel/index.tsx +1 -1
- package/src/PickerPanel/panels/TimePanel/TimeBody.tsx +1 -1
- package/src/PickerPanel/panels/YearPanel/YearHeader.tsx +1 -1
- package/src/PickerPanel/utils/pickerUtils.ts +2 -1
- package/src/RangePicker/range-picker-mobile.tsx +1 -3
- package/src/Rate/star.tsx +16 -4
- package/src/Segmented/demo/variant.tsx +10 -2
- package/src/Segmented/index.ts +2 -2
- package/src/Segmented/segmented.tsx +4 -11
- package/src/Select/interface.ts +0 -1
- package/src/Select/option.tsx +8 -2
- package/src/Select/options.tsx +11 -4
- package/src/Select/select.tsx +4 -4
- package/src/Selector/style/index.less +1 -0
- package/src/Steps/step.tsx +11 -3
- package/src/Steps/steps.tsx +8 -1
- package/src/Table/demo/components-override.tsx +34 -7
- package/src/Table/demo/grouping.tsx +8 -4
- package/src/Table/hooks/useColumns.ts +14 -18
- package/src/Table/icon/arrow-icon.tsx +1 -1
- package/src/Table/index.ts +3 -3
- package/src/Table/style/index.less +2 -4
- package/src/Table/table.tsx +2 -4
- package/src/Table/tbody/row.tsx +1 -3
- package/src/Table/theader/cell.tsx +6 -3
- package/src/Table/theader/index.tsx +9 -10
- package/src/TextArea/style/index.less +1 -0
- package/src/Tour/demo/placement.tsx +2 -1
- package/src/Tour/index.ts +1 -1
- package/src/Tree/style/index.less +1 -5
- package/src/Tree/tree.tsx +16 -11
- package/src/Tree/utils/tree-tools.ts +4 -1
- package/src/VerificationCode/style/index.less +1 -0
- package/src/hooks/useCountdown.ts +52 -21
- package/src/hooks/useEvent.ts +1 -3
- package/src/locale/context.tsx +5 -1
- package/src/locale/interface.ts +6 -1
- package/src/locale/lang/en_US.ts +3 -0
- package/src/locale/lang/ja_JP.ts +3 -0
- package/src/locale/lang/zh_CN.ts +3 -0
- package/src/locale/lang/zh_TW.ts +3 -0
- package/src/message/demo/base.tsx +1 -1
- package/src/message/index.ts +1 -1
- package/src/message/interface.ts +22 -7
- package/src/message/message-provider.tsx +3 -2
- package/src/message/message.test.tsx +283 -0
- package/src/message/message.tsx +14 -9
- package/src/message/style/index.less +3 -1
- package/src/message/use-message.tsx +144 -67
- package/src/message/wrapper.tsx +62 -20
- package/src/notice/index.en-US.md +76 -75
- package/src/notice/index.ts +6 -1
- package/src/notice/index.zh-CN.md +3 -2
- package/src/notice/interface.ts +31 -14
- package/src/notice/notice-list.tsx +3 -9
- package/src/notice/notice-provider.tsx +3 -2
- package/src/notice/notice.test.tsx +450 -0
- package/src/notice/notice.tsx +69 -21
- package/src/notice/style/index.less +13 -1
- package/src/notice/use-notice.tsx +210 -94
- package/src/notice/wrapper.tsx +159 -71
- package/src/style/size.css +5 -3
- package/src/utils/debounce.ts +1 -3
- package/src/version.ts +1 -1
package/src/Select/option.tsx
CHANGED
|
@@ -7,8 +7,14 @@ import { OptionsCtx } from './options';
|
|
|
7
7
|
|
|
8
8
|
const Option = (props: OptionProps) => {
|
|
9
9
|
const { label, value, disabled, title, dataTestId, style } = props;
|
|
10
|
-
const {
|
|
11
|
-
|
|
10
|
+
const {
|
|
11
|
+
prefixCls,
|
|
12
|
+
selectedKeys,
|
|
13
|
+
focusedKey,
|
|
14
|
+
multiple,
|
|
15
|
+
looseMatch,
|
|
16
|
+
onSelect,
|
|
17
|
+
} = useContext(OptionsCtx);
|
|
12
18
|
|
|
13
19
|
const handleClick = (e: React.MouseEvent | React.KeyboardEvent) => {
|
|
14
20
|
if (!disabled) {
|
package/src/Select/options.tsx
CHANGED
|
@@ -117,13 +117,20 @@ const Options = forwardRef<HTMLDivElement, OptionsProps>(
|
|
|
117
117
|
const containerRect = container.getBoundingClientRect();
|
|
118
118
|
const targetRect = targetElement.getBoundingClientRect();
|
|
119
119
|
if (targetRect.bottom > containerRect.bottom) {
|
|
120
|
-
container.scrollTop +=
|
|
121
|
-
targetRect.bottom - containerRect.bottom;
|
|
120
|
+
container.scrollTop += targetRect.bottom - containerRect.bottom;
|
|
122
121
|
} else if (targetRect.top < containerRect.top) {
|
|
123
122
|
container.scrollTop -= containerRect.top - targetRect.top;
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
|
-
}, [
|
|
125
|
+
}, [
|
|
126
|
+
focusedKey,
|
|
127
|
+
virtual,
|
|
128
|
+
options,
|
|
129
|
+
scrollToIndex,
|
|
130
|
+
rootRef,
|
|
131
|
+
multiColumn,
|
|
132
|
+
columns,
|
|
133
|
+
]);
|
|
127
134
|
|
|
128
135
|
const isEmpty = options.length === 0;
|
|
129
136
|
const ctxValue = {
|
|
@@ -257,7 +264,7 @@ const Options = forwardRef<HTMLDivElement, OptionsProps>(
|
|
|
257
264
|
style={{
|
|
258
265
|
...popupStyle,
|
|
259
266
|
...(multiColumn
|
|
260
|
-
? { '--yee-select-columns': columns } as React.CSSProperties
|
|
267
|
+
? ({ '--yee-select-columns': columns } as React.CSSProperties)
|
|
261
268
|
: undefined),
|
|
262
269
|
}}
|
|
263
270
|
ref={rootRef}
|
package/src/Select/select.tsx
CHANGED
|
@@ -97,9 +97,7 @@ const Select = (baseprops: SelectProps) => {
|
|
|
97
97
|
virtualApiRef.current?.scrollToIndex(index);
|
|
98
98
|
}, []);
|
|
99
99
|
|
|
100
|
-
const getOptions = (
|
|
101
|
-
keys: string | number | Array<string | number>,
|
|
102
|
-
) => {
|
|
100
|
+
const getOptions = (keys: string | number | Array<string | number>) => {
|
|
103
101
|
if (keys === '' || keys === null) {
|
|
104
102
|
return undefined;
|
|
105
103
|
}
|
|
@@ -133,7 +131,9 @@ const Select = (baseprops: SelectProps) => {
|
|
|
133
131
|
setOpen(false);
|
|
134
132
|
} else {
|
|
135
133
|
if (keysIncludes(mergedValue, key, looseMatch)) {
|
|
136
|
-
keys = mergedValue.filter(
|
|
134
|
+
keys = mergedValue.filter(
|
|
135
|
+
(k: string | number) => !matchValue(k, key, looseMatch),
|
|
136
|
+
);
|
|
137
137
|
} else {
|
|
138
138
|
keys = [...mergedValue, key];
|
|
139
139
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
box-sizing: border-box;
|
|
6
6
|
width: 100%;
|
|
7
7
|
padding: var(--yee-selector-padding);
|
|
8
|
+
background-color: var(--yee-input-content-bg-color);
|
|
8
9
|
border: var(--yee-selector-border-width) solid var(--yee-input-border-color);
|
|
9
10
|
border-radius: var(--yee-selector-border-radius);
|
|
10
11
|
|
package/src/Steps/step.tsx
CHANGED
|
@@ -98,7 +98,10 @@ const Step: React.FC<StepProps> = (props) => {
|
|
|
98
98
|
return (
|
|
99
99
|
<>
|
|
100
100
|
{type === 'ribbon' && (
|
|
101
|
-
<div
|
|
101
|
+
<div
|
|
102
|
+
className={`${prefixCls}-item-ribbon-end ${ribbonStatus}`}
|
|
103
|
+
aria-hidden="true"
|
|
104
|
+
/>
|
|
102
105
|
)}
|
|
103
106
|
<div
|
|
104
107
|
className={cls}
|
|
@@ -111,7 +114,9 @@ const Step: React.FC<StepProps> = (props) => {
|
|
|
111
114
|
aria-current={index === current ? 'step' : undefined}
|
|
112
115
|
aria-label={`Step ${index + 1}${typeof title === 'string' ? `: ${title}` : ''}, ${statusLabel}`}
|
|
113
116
|
>
|
|
114
|
-
<div className={`${prefixCls}-item-icon`} aria-hidden="true">
|
|
117
|
+
<div className={`${prefixCls}-item-icon`} aria-hidden="true">
|
|
118
|
+
{renderIcon}
|
|
119
|
+
</div>
|
|
115
120
|
<div className={`${prefixCls}-item-content`}>
|
|
116
121
|
<div className={`${prefixCls}-item-title`}>
|
|
117
122
|
<span title={typeof title === 'string' ? title : undefined}>
|
|
@@ -132,7 +137,10 @@ const Step: React.FC<StepProps> = (props) => {
|
|
|
132
137
|
</div>
|
|
133
138
|
)}
|
|
134
139
|
{type === 'ribbon' && (
|
|
135
|
-
<div
|
|
140
|
+
<div
|
|
141
|
+
className={`${prefixCls}-item-ribbon-head ${ribbonStatus}`}
|
|
142
|
+
aria-hidden="true"
|
|
143
|
+
/>
|
|
136
144
|
)}
|
|
137
145
|
</>
|
|
138
146
|
);
|
package/src/Steps/steps.tsx
CHANGED
|
@@ -71,7 +71,14 @@ const Steps = forwardRef<HTMLDivElement, StepsProps>((baseprops, ref) => {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
|
-
<div
|
|
74
|
+
<div
|
|
75
|
+
{...rest}
|
|
76
|
+
className={cls}
|
|
77
|
+
style={style}
|
|
78
|
+
ref={ref}
|
|
79
|
+
role="list"
|
|
80
|
+
aria-label="Steps"
|
|
81
|
+
>
|
|
75
82
|
<StepsContext.Provider value={contextValue}>
|
|
76
83
|
{renderSteps()}
|
|
77
84
|
</StepsContext.Provider>
|
|
@@ -7,21 +7,41 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Table 本身不依赖任何拖拽库;本 demo 不引入 dnd,仅证明替换点生效。
|
|
9
9
|
*/
|
|
10
|
-
import { Table } from '@rainbow-oh/yee-c';
|
|
11
10
|
import type { TableComponents, TableRowRendererProps } from '@rainbow-oh/yee-c';
|
|
11
|
+
import { Table } from '@rainbow-oh/yee-c';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
|
|
14
14
|
// 替换 <tbody>:保持渲染 <tbody>,外部库可在此包 SortableContext。
|
|
15
|
-
const CustomTbody = (props: {
|
|
15
|
+
const CustomTbody = (props: {
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}) => (
|
|
16
19
|
<tbody className={props.className} data-custom-tbody>
|
|
17
20
|
{props.children}
|
|
18
21
|
</tbody>
|
|
19
22
|
);
|
|
20
23
|
|
|
21
24
|
// 整行接管:消费方渲染整 <tr> + 单元格,可在此放拖拽手柄等任意内容。
|
|
22
|
-
const CustomRow = ({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const CustomRow = ({
|
|
26
|
+
record,
|
|
27
|
+
index,
|
|
28
|
+
columns,
|
|
29
|
+
rowKey,
|
|
30
|
+
}: TableRowRendererProps) => (
|
|
31
|
+
<tr
|
|
32
|
+
data-row-key={rowKey}
|
|
33
|
+
style={{ background: index % 2 === 0 ? '#f8fafc' : undefined }}
|
|
34
|
+
>
|
|
35
|
+
<td
|
|
36
|
+
style={{
|
|
37
|
+
width: 40,
|
|
38
|
+
textAlign: 'center',
|
|
39
|
+
color: '#2563eb',
|
|
40
|
+
fontWeight: 700,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{index + 1}
|
|
44
|
+
</td>
|
|
25
45
|
{columns.map((col) => (
|
|
26
46
|
<td key={String(col.key)}>{record[col.dataIndex || '']}</td>
|
|
27
47
|
))}
|
|
@@ -36,7 +56,12 @@ export default () => {
|
|
|
36
56
|
];
|
|
37
57
|
|
|
38
58
|
const dataSource = [
|
|
39
|
-
{
|
|
59
|
+
{
|
|
60
|
+
key: '1',
|
|
61
|
+
name: 'John Brown',
|
|
62
|
+
age: 32,
|
|
63
|
+
address: 'New York No. 1 Lake Park',
|
|
64
|
+
},
|
|
40
65
|
{ key: '2', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park' },
|
|
41
66
|
{ key: '3', name: 'Joe Black', age: 32, address: 'Sidney No. 1 Lake Park' },
|
|
42
67
|
];
|
|
@@ -45,5 +70,7 @@ export default () => {
|
|
|
45
70
|
body: { tbody: CustomTbody, row: CustomRow },
|
|
46
71
|
};
|
|
47
72
|
|
|
48
|
-
return
|
|
73
|
+
return (
|
|
74
|
+
<Table columns={columns} dataSource={dataSource} components={components} />
|
|
75
|
+
);
|
|
49
76
|
};
|
|
@@ -20,7 +20,13 @@ export default () => {
|
|
|
20
20
|
title: 'Info',
|
|
21
21
|
key: 'info',
|
|
22
22
|
children: [
|
|
23
|
-
{
|
|
23
|
+
{
|
|
24
|
+
title: 'Age',
|
|
25
|
+
dataIndex: 'age',
|
|
26
|
+
key: 'age',
|
|
27
|
+
width: 100,
|
|
28
|
+
sorter: true,
|
|
29
|
+
},
|
|
24
30
|
{
|
|
25
31
|
title: 'Address',
|
|
26
32
|
dataIndex: 'address',
|
|
@@ -52,9 +58,7 @@ export default () => {
|
|
|
52
58
|
key: 'action',
|
|
53
59
|
fixed: 'right',
|
|
54
60
|
width: 100,
|
|
55
|
-
render: (record) => (
|
|
56
|
-
<a onClick={() => console.log(record)}>Edit</a>
|
|
57
|
-
),
|
|
61
|
+
render: (record) => <a onClick={() => console.log(record)}>Edit</a>,
|
|
58
62
|
},
|
|
59
63
|
];
|
|
60
64
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import useDeepCompareMemo from '../../hooks/useDeepCompareMemo';
|
|
3
2
|
import deepClone from '../../utils/deepClone';
|
|
4
3
|
import { handleColumns } from '../util';
|
|
5
4
|
import {
|
|
@@ -15,6 +14,18 @@ import type {
|
|
|
15
14
|
WrapedColumnProps,
|
|
16
15
|
} from '../interface';
|
|
17
16
|
|
|
17
|
+
const getColumnsFromChild = (
|
|
18
|
+
childs: React.ReactElement<ColumnProps>[],
|
|
19
|
+
): Array<ColumnProps> | null => {
|
|
20
|
+
const cols: ColumnProps[] = [];
|
|
21
|
+
React.Children.forEach(childs, (child) => {
|
|
22
|
+
if (child) {
|
|
23
|
+
cols.push({ ...(child.props as ColumnProps) });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return cols.length ? cols : null;
|
|
27
|
+
};
|
|
28
|
+
|
|
18
29
|
export default function useColumns({
|
|
19
30
|
children,
|
|
20
31
|
columns,
|
|
@@ -28,21 +39,6 @@ export default function useColumns({
|
|
|
28
39
|
rowSelection?: RowSelectionType;
|
|
29
40
|
expandable?: ExpandableType;
|
|
30
41
|
}) {
|
|
31
|
-
const shouldRenderSelection = !!rowSelection;
|
|
32
|
-
const shouldRenderExpand = !!expandable;
|
|
33
|
-
|
|
34
|
-
const getColumnsFromChild = (
|
|
35
|
-
childs: React.ReactElement<ColumnProps>[],
|
|
36
|
-
): Array<ColumnProps> | null => {
|
|
37
|
-
const cols: ColumnProps[] = [];
|
|
38
|
-
React.Children.forEach(childs, (child) => {
|
|
39
|
-
if (child) {
|
|
40
|
-
cols.push({ ...(child.props as ColumnProps) });
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return cols.length ? cols : null;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
42
|
const childColumns: Array<ColumnProps> | null = useMemo(() => {
|
|
47
43
|
return children
|
|
48
44
|
? getColumnsFromChild(children as React.ReactElement<ColumnProps>[])
|
|
@@ -52,7 +48,7 @@ export default function useColumns({
|
|
|
52
48
|
// Build the column tree (with selection/expand injected at the top level),
|
|
53
49
|
// then derive both the flat leaf columns (body/colgroup/summary/sorter) and
|
|
54
50
|
// the 2D header rows (thead multi-level rendering).
|
|
55
|
-
const { wrapedColumns, headerRows } =
|
|
51
|
+
const { wrapedColumns, headerRows } = useMemo(() => {
|
|
56
52
|
const base = (deepClone(childColumns || columns || []) ||
|
|
57
53
|
[]) as WrapedColumnProps[];
|
|
58
54
|
const tree = injectSelectionExpand(base, rowSelection, expandable);
|
|
@@ -60,7 +56,7 @@ export default function useColumns({
|
|
|
60
56
|
const wraped = handleColumns(leaves);
|
|
61
57
|
const rows = parseHeaderRows(tree, wraped);
|
|
62
58
|
return { wrapedColumns: wraped, headerRows: rows };
|
|
63
|
-
}, [childColumns, columns,
|
|
59
|
+
}, [childColumns, columns, rowSelection, expandable]);
|
|
64
60
|
|
|
65
61
|
return {
|
|
66
62
|
wrapedColumns,
|
package/src/Table/index.ts
CHANGED
|
@@ -5,13 +5,13 @@ import Head from './theader';
|
|
|
5
5
|
|
|
6
6
|
export type {
|
|
7
7
|
ColumnProps,
|
|
8
|
+
HeaderCell,
|
|
8
9
|
PaginationType,
|
|
9
10
|
RowSelectionType,
|
|
10
|
-
TableProps,
|
|
11
|
-
TableComponents,
|
|
12
11
|
TableBodyComponents,
|
|
12
|
+
TableComponents,
|
|
13
|
+
TableProps,
|
|
13
14
|
TableRowRendererProps,
|
|
14
|
-
HeaderCell,
|
|
15
15
|
onChangeParams,
|
|
16
16
|
} from './interface';
|
|
17
17
|
|
|
@@ -92,13 +92,11 @@
|
|
|
92
92
|
width: 100%;
|
|
93
93
|
|
|
94
94
|
&-scroll-left @{pls}-cell-fixed-left-last {
|
|
95
|
-
box-shadow: 6px 0 6px -4px
|
|
96
|
-
var(--yee-table-fixed-left-after-bs-color);
|
|
95
|
+
box-shadow: 6px 0 6px -4px var(--yee-table-fixed-left-after-bs-color);
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
&-scroll-right @{pls}-cell-fixed-right-first {
|
|
100
|
-
box-shadow: -6px 0 6px -4px
|
|
101
|
-
var(--yee-table-fixed-right-after-bs-color);
|
|
99
|
+
box-shadow: -6px 0 6px -4px var(--yee-table-fixed-right-after-bs-color);
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
|
package/src/Table/table.tsx
CHANGED
|
@@ -146,8 +146,7 @@ const Table = React.forwardRef<HTMLDivElement, TableProps>((baseprops, ref) => {
|
|
|
146
146
|
const next = {
|
|
147
147
|
left: hasHorizontalScroll && scrollContainer.scrollLeft > 1,
|
|
148
148
|
right:
|
|
149
|
-
hasHorizontalScroll &&
|
|
150
|
-
scrollContainer.scrollLeft < maxScrollLeft - 1,
|
|
149
|
+
hasHorizontalScroll && scrollContainer.scrollLeft < maxScrollLeft - 1,
|
|
151
150
|
};
|
|
152
151
|
|
|
153
152
|
setHorizontalScroll((current) =>
|
|
@@ -312,8 +311,7 @@ const Table = React.forwardRef<HTMLDivElement, TableProps>((baseprops, ref) => {
|
|
|
312
311
|
ref={contentWrapperRef}
|
|
313
312
|
className={clsx(`${prefixCls}-content-wrapper`, {
|
|
314
313
|
[`${prefixCls}-content-wrapper-scroll-left`]: horizontalScroll.left,
|
|
315
|
-
[`${prefixCls}-content-wrapper-scroll-right`]:
|
|
316
|
-
horizontalScroll.right,
|
|
314
|
+
[`${prefixCls}-content-wrapper-scroll-right`]: horizontalScroll.right,
|
|
317
315
|
})}
|
|
318
316
|
onScroll={updateHorizontalScroll}
|
|
319
317
|
>
|
package/src/Table/tbody/row.tsx
CHANGED
|
@@ -82,9 +82,7 @@ const TableRow: React.FC<TableRowProps> = (props) => {
|
|
|
82
82
|
|
|
83
83
|
if (type === 'checkbox') {
|
|
84
84
|
return (
|
|
85
|
-
<Checkbox
|
|
86
|
-
{...(commonProps as React.ComponentProps<typeof Checkbox>)}
|
|
87
|
-
/>
|
|
85
|
+
<Checkbox {...(commonProps as React.ComponentProps<typeof Checkbox>)} />
|
|
88
86
|
);
|
|
89
87
|
}
|
|
90
88
|
return <Radio {...(commonProps as React.ComponentProps<typeof Radio>)} />;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
|
+
import { useLocale } from '../../locale';
|
|
3
4
|
import Tooltip from '../../Tooltip';
|
|
4
5
|
import ArrowIcon from '../icon/arrow-icon';
|
|
5
6
|
import { HeadCellProps } from '../interface';
|
|
@@ -35,6 +36,8 @@ const HeadCell: React.FC<HeadCellProps> = (props) => {
|
|
|
35
36
|
} = props;
|
|
36
37
|
|
|
37
38
|
const { prefixCls } = useContext(TableCtx);
|
|
39
|
+
const { locale } = useLocale();
|
|
40
|
+
const { table: tableLocale } = locale;
|
|
38
41
|
|
|
39
42
|
const showFilter = !!filter;
|
|
40
43
|
|
|
@@ -80,11 +83,11 @@ const HeadCell: React.FC<HeadCellProps> = (props) => {
|
|
|
80
83
|
if (showSorterTooltip && sorter) {
|
|
81
84
|
let title = '';
|
|
82
85
|
if (displaySortOrder === 0) {
|
|
83
|
-
title = 'Click to sort ascending';
|
|
86
|
+
title = tableLocale.sortAscending || 'Click to sort ascending';
|
|
84
87
|
} else if (displaySortOrder === 1) {
|
|
85
|
-
title = 'Click to sort descending';
|
|
88
|
+
title = tableLocale.sortDescending || 'Click to sort descending';
|
|
86
89
|
} else if (displaySortOrder === 2) {
|
|
87
|
-
title = 'Click to cancel sorting';
|
|
90
|
+
title = tableLocale.sortCancel || 'Click to cancel sorting';
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
return <Tooltip title={title}>{trigger}</Tooltip>;
|
|
@@ -13,16 +13,17 @@ export interface TableHeadProps {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const TableHead: React.FC<any> = (props) => {
|
|
16
|
-
const {
|
|
17
|
-
|
|
16
|
+
const {
|
|
17
|
+
headerRows = [],
|
|
18
|
+
onCheckAll,
|
|
19
|
+
checkedAll,
|
|
20
|
+
onHeaderRow,
|
|
21
|
+
...rest
|
|
22
|
+
} = props;
|
|
18
23
|
|
|
19
24
|
const { prefixCls } = useContext(TableCtx);
|
|
20
25
|
|
|
21
|
-
const renderCell = (
|
|
22
|
-
cell: HeaderCell,
|
|
23
|
-
rowIndex: number,
|
|
24
|
-
colIndex: number,
|
|
25
|
-
) => {
|
|
26
|
+
const renderCell = (cell: HeaderCell, rowIndex: number, colIndex: number) => {
|
|
26
27
|
const { column, colSpan, rowSpan } = cell;
|
|
27
28
|
const { key, type, visible } = column;
|
|
28
29
|
const cellKey =
|
|
@@ -73,9 +74,7 @@ const TableHead: React.FC<any> = (props) => {
|
|
|
73
74
|
const rowProps = onHeaderRow ? onHeaderRow(rowColumns) : {};
|
|
74
75
|
return (
|
|
75
76
|
<tr {...rowProps} key={`thead-row-${rowIndex}`}>
|
|
76
|
-
{row.map((cell, colIndex) =>
|
|
77
|
-
renderCell(cell, rowIndex, colIndex),
|
|
78
|
-
)}
|
|
77
|
+
{row.map((cell, colIndex) => renderCell(cell, rowIndex, colIndex))}
|
|
79
78
|
</tr>
|
|
80
79
|
);
|
|
81
80
|
})}
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
padding: 4px 8px;
|
|
67
67
|
font-size: var(--yee-textarea-font-size);
|
|
68
68
|
line-height: var(--yee-textarea-line-height);
|
|
69
|
+
background-color: var(--yee-input-content-bg-color);
|
|
69
70
|
border-radius: var(--yee-textarea-border-radius, 4px);
|
|
70
71
|
font-family: var(--yee-font-family);
|
|
71
72
|
width: 100%;
|
package/src/Tour/index.ts
CHANGED
package/src/Tree/tree.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
2
3
|
import React, {
|
|
3
4
|
ChangeEvent,
|
|
4
5
|
createContext,
|
|
@@ -7,7 +8,6 @@ import React, {
|
|
|
7
8
|
useRef,
|
|
8
9
|
useState,
|
|
9
10
|
} from 'react';
|
|
10
|
-
import { AnimatePresence, motion } from 'motion/react';
|
|
11
11
|
import { GlobalContext } from '../Config-Provider';
|
|
12
12
|
import useEvent from '../hooks/useEvent';
|
|
13
13
|
import useMergedState from '../hooks/useMergedState';
|
|
@@ -228,9 +228,15 @@ const Tree = <T extends Record<string, unknown> = any>(
|
|
|
228
228
|
// useStableUidArray ensures stable references to prevent infinite re-render loops.
|
|
229
229
|
|
|
230
230
|
const stableExpandedValue = useStableUidArray(expandedKeys, flatItems);
|
|
231
|
-
const stableExpandedDefault = useStableUidArray(
|
|
231
|
+
const stableExpandedDefault = useStableUidArray(
|
|
232
|
+
defaultExpandedKeys,
|
|
233
|
+
flatItems,
|
|
234
|
+
);
|
|
232
235
|
const stableSelectedValue = useStableUidArray(selectedKeys, flatItems);
|
|
233
|
-
const stableSelectedDefault = useStableUidArray(
|
|
236
|
+
const stableSelectedDefault = useStableUidArray(
|
|
237
|
+
defaultSelectedKeys,
|
|
238
|
+
flatItems,
|
|
239
|
+
);
|
|
234
240
|
const stableCheckedValue = useStableUidArray(checkedKeys, flatItems);
|
|
235
241
|
const stableCheckedDefault = useStableUidArray(defaultCheckedKeys, flatItems);
|
|
236
242
|
|
|
@@ -248,13 +254,10 @@ const Tree = <T extends Record<string, unknown> = any>(
|
|
|
248
254
|
);
|
|
249
255
|
|
|
250
256
|
// --- Selected ---
|
|
251
|
-
const [selectedUidArray, setSelectedUidArray] = useMergedState<string[]>(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
defaultValue: stableSelectedDefault,
|
|
256
|
-
},
|
|
257
|
-
);
|
|
257
|
+
const [selectedUidArray, setSelectedUidArray] = useMergedState<string[]>([], {
|
|
258
|
+
value: stableSelectedValue,
|
|
259
|
+
defaultValue: stableSelectedDefault,
|
|
260
|
+
});
|
|
258
261
|
const selectedUidSet = useMemo(
|
|
259
262
|
() => arrayToSet(selectedUidArray),
|
|
260
263
|
[selectedUidArray],
|
|
@@ -678,7 +681,9 @@ const Tree = <T extends Record<string, unknown> = any>(
|
|
|
678
681
|
<AnimatePresence initial={false}>
|
|
679
682
|
{segments.map((segment) => {
|
|
680
683
|
if (segment.type === 'node') {
|
|
681
|
-
return
|
|
684
|
+
return (
|
|
685
|
+
<TreeNodeComp node={segment.node} key={segment.node.uid} />
|
|
686
|
+
);
|
|
682
687
|
}
|
|
683
688
|
// Keep the wrapper mounted throughout native drag operations.
|
|
684
689
|
// Replacing this tree after dragStart removes the browser's drag
|
|
@@ -114,7 +114,10 @@ export function moveTreeNode<T extends Record<string, unknown>>(
|
|
|
114
114
|
if (!dragNode) return root;
|
|
115
115
|
|
|
116
116
|
// Phase 2: insert per position.
|
|
117
|
-
const insert = (
|
|
117
|
+
const insert = (
|
|
118
|
+
nodes: T[],
|
|
119
|
+
depth: number,
|
|
120
|
+
): { inserted: boolean; nodes: T[] } => {
|
|
118
121
|
const next: T[] = [];
|
|
119
122
|
let inserted = false;
|
|
120
123
|
for (const n of nodes) {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
width: var(--yee-verification-code-item-width);
|
|
10
10
|
height: var(--yee-verification-code-item-height);
|
|
11
11
|
text-align: center;
|
|
12
|
+
background-color: var(--yee-input-content-bg-color);
|
|
12
13
|
border: var(--yee-verification-code-item-border-width) solid
|
|
13
14
|
var(--yee-input-border-color);
|
|
14
15
|
border-radius: var(--yee-verification-code-item-border-radius);
|