@rainbow-oh/yee-c 0.8.0 → 0.8.2
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/LICENSE +1 -1
- package/README.md +40 -25
- package/dist/cjs/Card/card.js +7 -3
- package/dist/cjs/Carousel/carousel-item.js +7 -2
- package/dist/cjs/Carousel/carousel.js +31 -4
- package/dist/cjs/Cascader/cascader.js +38 -30
- package/dist/cjs/Cascader/column.js +17 -9
- package/dist/cjs/Cascader/node.js +16 -4
- package/dist/cjs/Cascader/search-list.js +31 -14
- package/dist/cjs/Cascader/utils/index.js +1 -5
- package/dist/cjs/Checkbox/checkbox-group.js +23 -14
- package/dist/cjs/Checkbox/checkbox.js +6 -3
- package/dist/cjs/Collapse/panel.js +10 -1
- package/dist/cjs/Dialog/dialog.js +22 -7
- package/dist/cjs/Dialog/interface.d.ts +1 -1
- package/dist/cjs/Dialog/style/index.less +2 -1
- package/dist/cjs/Drawer/drawer.js +22 -5
- package/dist/cjs/Form/Group.js +1 -1
- package/dist/cjs/Form/demo/tooltip.js +1 -3
- package/dist/cjs/List/hooks/useListKeyboard.js +3 -1
- package/dist/cjs/Menu/menu-item.js +14 -5
- package/dist/cjs/Menu/menu.js +26 -2
- package/dist/cjs/Pagination/items.js +60 -27
- package/dist/cjs/Pagination/pagination.js +33 -11
- package/dist/cjs/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.js +7 -1
- package/dist/cjs/Radio/radio-group.js +6 -5
- package/dist/cjs/Radio/radio.js +39 -29
- package/dist/cjs/Rate/rate.js +6 -1
- package/dist/cjs/Rate/star.js +31 -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/Steps/step.js +19 -5
- 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/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/index.js +12 -4
- package/dist/cjs/Tabs/tab-content.js +3 -1
- package/dist/cjs/Tabs/tab-header/index.js +3 -1
- package/dist/cjs/Tabs/tab-header/tab-header-title.js +3 -1
- 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/hooks/useDelayState.js +3 -2
- package/dist/cjs/hooks/useEvent.js +1 -4
- package/dist/cjs/hooks/useFocusManage.d.ts +1 -1
- package/dist/cjs/hooks/useFocusManage.js +27 -22
- package/dist/cjs/style/size.css +2 -0
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +3 -1
- package/dist/cjs/utils/focusStack.d.ts +6 -2
- package/dist/cjs/utils/focusStack.js +40 -11
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Card/card.js +7 -3
- package/dist/esm/Carousel/carousel-item.js +7 -2
- package/dist/esm/Carousel/carousel.js +31 -4
- package/dist/esm/Cascader/cascader.js +3 -1
- package/dist/esm/Cascader/column.js +2 -1
- package/dist/esm/Cascader/node.js +18 -4
- package/dist/esm/Cascader/search-list.js +18 -4
- package/dist/esm/Checkbox/checkbox-group.js +3 -1
- package/dist/esm/Checkbox/checkbox.js +6 -3
- package/dist/esm/Collapse/panel.js +11 -2
- package/dist/esm/Dialog/dialog.js +28 -11
- package/dist/esm/Dialog/interface.d.ts +1 -1
- package/dist/esm/Dialog/style/index.less +2 -1
- package/dist/esm/Drawer/drawer.js +16 -7
- package/dist/esm/Form/Group.js +1 -1
- package/dist/esm/Menu/menu-item.js +16 -5
- package/dist/esm/Menu/menu.js +11 -5
- package/dist/esm/Pagination/items.js +14 -5
- package/dist/esm/Pagination/pagination.js +16 -4
- package/dist/esm/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/esm/Radio/radio-group.js +5 -4
- package/dist/esm/Radio/radio.js +5 -4
- package/dist/esm/Rate/rate.js +6 -1
- package/dist/esm/Rate/star.js +12 -4
- package/dist/esm/Segmented/index.d.ts +1 -1
- package/dist/esm/Segmented/segmented.js +1 -1
- package/dist/esm/Steps/step.js +12 -6
- package/dist/esm/Steps/steps.js +3 -1
- 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/index.d.ts +1 -1
- package/dist/esm/Table/style/index.less +2 -4
- package/dist/esm/Tabs/tab-content.js +3 -1
- package/dist/esm/Tabs/tab-header/index.js +3 -1
- package/dist/esm/Tabs/tab-header/tab-header-title.js +3 -1
- 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/hooks/useDelayState.js +5 -2
- package/dist/esm/hooks/useFocusManage.d.ts +1 -1
- package/dist/esm/hooks/useFocusManage.js +31 -13
- package/dist/esm/style/size.css +2 -0
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +3 -1
- package/dist/esm/utils/focusStack.d.ts +6 -2
- package/dist/esm/utils/focusStack.js +37 -14
- 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 +10 -6
- package/src/Anchor/anchor.tsx +2 -2
- package/src/Card/card.tsx +5 -1
- package/src/Carousel/carousel-item.tsx +7 -1
- package/src/Carousel/carousel.tsx +29 -3
- package/src/Cascader/cascader.tsx +5 -1
- package/src/Cascader/column.tsx +5 -1
- package/src/Cascader/node.tsx +14 -2
- package/src/Cascader/search-list.tsx +19 -3
- package/src/Cascader/utils/index.ts +3 -6
- package/src/Checkbox/checkbox-group.tsx +6 -1
- package/src/Checkbox/checkbox.tsx +3 -0
- package/src/Collapse/panel.tsx +11 -1
- package/src/Dialog/dialog.tsx +35 -6
- package/src/Dialog/interface.ts +1 -1
- package/src/Dialog/style/index.less +2 -1
- package/src/Drawer/drawer.tsx +18 -3
- 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/List/hooks/useListKeyboard.ts +3 -3
- package/src/List/list.tsx +2 -1
- package/src/Menu/menu-item.tsx +12 -3
- package/src/Menu/menu.tsx +22 -5
- package/src/Pagination/items.tsx +21 -4
- package/src/Pagination/pagination.tsx +24 -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/Radio/radio-group.tsx +2 -1
- package/src/Radio/radio.tsx +7 -2
- package/src/RangePicker/range-picker-mobile.tsx +1 -3
- package/src/Rate/rate.tsx +5 -0
- package/src/Rate/star.tsx +20 -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/Steps/step.tsx +23 -5
- 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/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/index.tsx +9 -10
- package/src/Tabs/tab-content.tsx +2 -0
- package/src/Tabs/tab-header/index.tsx +2 -0
- package/src/Tabs/tab-header/tab-header-title.tsx +3 -1
- 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/hooks/useDelayState.ts +4 -2
- package/src/hooks/useEvent.ts +1 -3
- package/src/hooks/useFocusManage.ts +33 -17
- package/src/locale/context.tsx +5 -1
- package/src/locale/interface.ts +3 -1
- package/src/style/size.css +2 -0
- package/src/utils/debounce.ts +1 -3
- package/src/utils/focusStack.ts +55 -12
- package/src/version.ts +1 -1
package/src/Steps/step.tsx
CHANGED
|
@@ -43,6 +43,15 @@ const Step: React.FC<StepProps> = (props) => {
|
|
|
43
43
|
status ??
|
|
44
44
|
(index < current ? 'finish' : index === current ? 'process' : 'wait');
|
|
45
45
|
|
|
46
|
+
const statusLabel =
|
|
47
|
+
mergedStatus === 'finish'
|
|
48
|
+
? 'completed'
|
|
49
|
+
: mergedStatus === 'process'
|
|
50
|
+
? 'in progress'
|
|
51
|
+
: mergedStatus === 'error'
|
|
52
|
+
? 'error'
|
|
53
|
+
: 'pending';
|
|
54
|
+
|
|
46
55
|
const renderIcon = useMemo(() => {
|
|
47
56
|
if (dot) return <span className={`${prefixCls}-item-dot`}></span>;
|
|
48
57
|
|
|
@@ -89,7 +98,10 @@ const Step: React.FC<StepProps> = (props) => {
|
|
|
89
98
|
return (
|
|
90
99
|
<>
|
|
91
100
|
{type === 'ribbon' && (
|
|
92
|
-
<div
|
|
101
|
+
<div
|
|
102
|
+
className={`${prefixCls}-item-ribbon-end ${ribbonStatus}`}
|
|
103
|
+
aria-hidden="true"
|
|
104
|
+
/>
|
|
93
105
|
)}
|
|
94
106
|
<div
|
|
95
107
|
className={cls}
|
|
@@ -97,11 +109,14 @@ const Step: React.FC<StepProps> = (props) => {
|
|
|
97
109
|
onClick={handleClick}
|
|
98
110
|
onKeyDown={handleKeyDown}
|
|
99
111
|
tabIndex={disabled ? -1 : onChange ? 0 : undefined}
|
|
100
|
-
role={onChange ? 'button' :
|
|
112
|
+
role={onChange ? 'button' : 'listitem'}
|
|
101
113
|
aria-disabled={disabled}
|
|
102
114
|
aria-current={index === current ? 'step' : undefined}
|
|
115
|
+
aria-label={`Step ${index + 1}${typeof title === 'string' ? `: ${title}` : ''}, ${statusLabel}`}
|
|
103
116
|
>
|
|
104
|
-
<div className={`${prefixCls}-item-icon`}>
|
|
117
|
+
<div className={`${prefixCls}-item-icon`} aria-hidden="true">
|
|
118
|
+
{renderIcon}
|
|
119
|
+
</div>
|
|
105
120
|
<div className={`${prefixCls}-item-content`}>
|
|
106
121
|
<div className={`${prefixCls}-item-title`}>
|
|
107
122
|
<span title={typeof title === 'string' ? title : undefined}>
|
|
@@ -117,12 +132,15 @@ const Step: React.FC<StepProps> = (props) => {
|
|
|
117
132
|
</div>
|
|
118
133
|
</div>
|
|
119
134
|
{type === 'navigation' && (
|
|
120
|
-
<div className={`${prefixCls}-item-navi-arrow`}>
|
|
135
|
+
<div className={`${prefixCls}-item-navi-arrow`} aria-hidden="true">
|
|
121
136
|
<ChevronRight />
|
|
122
137
|
</div>
|
|
123
138
|
)}
|
|
124
139
|
{type === 'ribbon' && (
|
|
125
|
-
<div
|
|
140
|
+
<div
|
|
141
|
+
className={`${prefixCls}-item-ribbon-head ${ribbonStatus}`}
|
|
142
|
+
aria-hidden="true"
|
|
143
|
+
/>
|
|
126
144
|
)}
|
|
127
145
|
</>
|
|
128
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>)} />;
|
|
@@ -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
|
})}
|
package/src/Tabs/tab-content.tsx
CHANGED
|
@@ -67,9 +67,11 @@ const TabContent: React.FC<TabContentProps> = ({
|
|
|
67
67
|
className={`${prefixCls}-tab-content`}
|
|
68
68
|
style={{ display: activeKey === key ? 'block' : 'none' }}
|
|
69
69
|
key={key}
|
|
70
|
+
id={`tabpanel-${key}`}
|
|
70
71
|
role="tabpanel"
|
|
71
72
|
aria-labelledby={`tab-${key}`}
|
|
72
73
|
aria-hidden={activeKey !== key}
|
|
74
|
+
tabIndex={activeKey === key ? 0 : -1}
|
|
73
75
|
>
|
|
74
76
|
{children}
|
|
75
77
|
</div>
|
|
@@ -170,6 +170,8 @@ const TabHeader: React.FC<TabHeaderProps> = (props) => {
|
|
|
170
170
|
className={clsx(`${prefixCls}-nav-list`, classNames?.list)}
|
|
171
171
|
style={styles?.list}
|
|
172
172
|
ref={navList}
|
|
173
|
+
role="tablist"
|
|
174
|
+
aria-orientation={direction}
|
|
173
175
|
>
|
|
174
176
|
{items?.map((item: TabItemType, index: number) => (
|
|
175
177
|
<TabHeaderTitle
|
|
@@ -166,10 +166,12 @@ const TabHeaderTitle: React.FC<TabsItemProps> = (props) => {
|
|
|
166
166
|
{...rest}
|
|
167
167
|
ref={tabRef}
|
|
168
168
|
role="tab"
|
|
169
|
+
id={`tab-${$key}`}
|
|
169
170
|
aria-selected={activeKey === $key}
|
|
170
171
|
aria-disabled={disabled}
|
|
172
|
+
aria-controls={`tabpanel-${$key}`}
|
|
171
173
|
className={cls}
|
|
172
|
-
tabIndex={disabled ? -1 : 0}
|
|
174
|
+
tabIndex={disabled ? -1 : activeKey === $key ? 0 : -1}
|
|
173
175
|
onClick={handleTabClick}
|
|
174
176
|
onKeyDown={handleKeyDown}
|
|
175
177
|
>
|
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) {
|
|
@@ -4,10 +4,12 @@ export default function useDelayState<T>(state: T, delay = 0): T {
|
|
|
4
4
|
const [delayState, setDelayState] = useState<T>();
|
|
5
5
|
|
|
6
6
|
useEffect(() => {
|
|
7
|
-
setTimeout(() => {
|
|
7
|
+
const timer = window.setTimeout(() => {
|
|
8
8
|
setDelayState(state);
|
|
9
9
|
}, delay * 1000);
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
return () => window.clearTimeout(timer);
|
|
12
|
+
}, [delay, state]);
|
|
11
13
|
|
|
12
14
|
return delayState as T;
|
|
13
15
|
}
|
package/src/hooks/useEvent.ts
CHANGED
|
@@ -7,9 +7,7 @@ export default function useEvent<T extends Function>(callback?: T): T {
|
|
|
7
7
|
|
|
8
8
|
const memoFn = React.useCallback(
|
|
9
9
|
(...args: unknown[]) =>
|
|
10
|
-
(ref.current as ((...args: unknown[]) => unknown) | undefined)?.(
|
|
11
|
-
...args,
|
|
12
|
-
),
|
|
10
|
+
(ref.current as ((...args: unknown[]) => unknown) | undefined)?.(...args),
|
|
13
11
|
[],
|
|
14
12
|
) as unknown as T;
|
|
15
13
|
|
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { popFocus, pushFocus } from '../utils/focusStack';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { type FocusStackEntry, popFocus, pushFocus } from '../utils/focusStack';
|
|
3
|
+
export default function useFocusManage(
|
|
4
|
+
element: HTMLElement | null,
|
|
5
|
+
open: boolean,
|
|
6
|
+
) {
|
|
7
|
+
const entryRef = useRef<FocusStackEntry | null>(null);
|
|
8
|
+
const previousFocusRef = useRef<HTMLElement | null>(null);
|
|
9
|
+
const openCycleRef = useRef(false);
|
|
10
|
+
const releaseEntry = () => {
|
|
11
|
+
if (entryRef.current) {
|
|
12
|
+
popFocus(entryRef.current);
|
|
13
|
+
entryRef.current = null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const endOpenCycle = () => {
|
|
17
|
+
releaseEntry();
|
|
18
|
+
previousFocusRef.current = null;
|
|
19
|
+
openCycleRef.current = false;
|
|
20
|
+
};
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (open && !openCycleRef.current) {
|
|
23
|
+
openCycleRef.current = true;
|
|
24
|
+
previousFocusRef.current = document.activeElement as HTMLElement | null;
|
|
25
|
+
} else if (!open && openCycleRef.current) {
|
|
26
|
+
endOpenCycle();
|
|
27
|
+
}
|
|
28
|
+
}, [open]);
|
|
8
29
|
useEffect(() => {
|
|
9
|
-
if (!
|
|
10
|
-
|
|
11
|
-
pushFocus(ele);
|
|
12
|
-
} else {
|
|
13
|
-
popFocus();
|
|
30
|
+
if (!open || !openCycleRef.current || !element || entryRef.current) {
|
|
31
|
+
return;
|
|
14
32
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
}, [ele, delayOpen]);
|
|
33
|
+
entryRef.current = pushFocus(element, previousFocusRef.current);
|
|
34
|
+
}, [element, open]);
|
|
35
|
+
useEffect(() => releaseEntry, []);
|
|
20
36
|
}
|
package/src/locale/context.tsx
CHANGED
|
@@ -7,7 +7,11 @@ import React, {
|
|
|
7
7
|
useMemo,
|
|
8
8
|
useState,
|
|
9
9
|
} from 'react';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
DEFAULT_LOCALE,
|
|
12
|
+
DEFAULT_LOCALE_CONFIG,
|
|
13
|
+
LOCALE_CONFIGS,
|
|
14
|
+
} from './constants';
|
|
11
15
|
import type { Locale, LocaleConfigInput, TFunction } from './interface';
|
|
12
16
|
import defaultLocaleData from './lang/en_US';
|
|
13
17
|
import { deepMerge, isValidLocale, translate } from './util';
|
package/src/locale/interface.ts
CHANGED
|
@@ -220,4 +220,6 @@ export type DeepPartial<T> = T extends (...args: any[]) => any
|
|
|
220
220
|
* so the provider knows which built-in pack to merge the overrides onto;
|
|
221
221
|
* only the keys you specify are overridden, everything else is inherited.
|
|
222
222
|
*/
|
|
223
|
-
export type LocaleConfigInput =
|
|
223
|
+
export type LocaleConfigInput =
|
|
224
|
+
| string
|
|
225
|
+
| (DeepPartial<Locale> & { locale: string });
|
package/src/style/size.css
CHANGED
|
@@ -224,6 +224,8 @@
|
|
|
224
224
|
/* --Dialog-- */
|
|
225
225
|
--yee-dialog-z-index: var(--yee-z-index-overlay);
|
|
226
226
|
--yee-dialog-mask-z-index: var(--yee-z-index-mask);
|
|
227
|
+
--yee-dialog-title-font-size: 18px;
|
|
228
|
+
--yee-dialog-title-font-weight: 600;
|
|
227
229
|
--yee-dialog-content-wrapper-z-index: var(--yee-z-index-overlay);
|
|
228
230
|
--yee-dialog-header-margin-bottom: 12px;
|
|
229
231
|
--yee-dialog-content-margin-top: 10%;
|
package/src/utils/debounce.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
type AnyFn = (...args: any[]) => any;
|
|
2
2
|
|
|
3
|
-
export type Debounced<T extends AnyFn> = ((
|
|
4
|
-
...args: Parameters<T>
|
|
5
|
-
) => void) & {
|
|
3
|
+
export type Debounced<T extends AnyFn> = ((...args: Parameters<T>) => void) & {
|
|
6
4
|
/** Cancel any pending invocation. */
|
|
7
5
|
cancel: () => void;
|
|
8
6
|
};
|