Skip to content

Commit 2124e4f

Browse files
author
mumiao
committed
chore: 4.3.0
2 parents 6b8da91 + 2723267 commit 2124e4f

File tree

14 files changed

+16801
-13644
lines changed

14 files changed

+16801
-13644
lines changed

.dumi/theme/slots/Sidebar/index.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
@import "../../style/const.scss";
22

3+
@media only screen and (max-width: 767px) {
4+
.dt-theme-filter {
5+
display: none;
6+
}
7+
}
8+
39
@media only screen and (min-width: 767px) {
10+
.dt-theme-filter {
11+
width: calc(100% - 24px);
12+
margin: 0 12px;
13+
height: 40px;
14+
padding: 16px;
15+
color: #30363F;
16+
font-size: 14px;
17+
border: 1px solid #D0D5D8;
18+
border-radius: 20px;
19+
outline: none;
20+
transition: all 0.3s;
21+
background-color: transparent;
22+
}
423
.dumi-default-sidebar {
524
height: 100vh;
625
max-height: calc(100vh - 64px);

.dumi/theme/slots/Sidebar/index.tsx

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,64 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import { Tooltip } from 'antd';
33
import { NavLink, useSidebarData } from 'dumi';
44

55
import { useMobile } from '../../hooks';
66
import 'dumi/theme-default/slots/Sidebar/index.less';
77
import './index.scss';
88

9+
function filterSideBar(arr: ReturnType<typeof useSidebarData>, search: string) {
10+
if (!search) return arr;
11+
return arr
12+
.map((item) => {
13+
const children = item.children.filter((child) =>
14+
child.title.toLocaleLowerCase().includes(search.toLocaleLowerCase())
15+
);
16+
return { ...item, children };
17+
})
18+
.filter((i) => i.children.length);
19+
}
20+
921
export default function Sidebar() {
1022
const sidebar = useSidebarData();
1123
const isMobile = useMobile();
24+
const [search, setSearch] = useState('');
25+
26+
const isRenderSearch = sidebar.some((s) => s.title === '组件');
1227

1328
if (!sidebar) return null;
1429

1530
return (
1631
<div className="dumi-default-sidebar">
17-
{sidebar.map((item, i) => (
32+
{isRenderSearch && (
33+
<input
34+
className="dt-theme-filter"
35+
placeholder="搜索组件..."
36+
value={search}
37+
onChange={(e) => setSearch(e.target.value)}
38+
onKeyDown={(e) => {
39+
if (e.key === 'Enter') {
40+
const firstLink = document.querySelector(
41+
'.dumi-default-sidebar-group dd a'
42+
);
43+
if (firstLink) {
44+
(firstLink as HTMLAnchorElement).click();
45+
}
46+
}
47+
}}
48+
/>
49+
)}
50+
{filterSideBar(sidebar, isRenderSearch ? search : '').map((item, i) => (
1851
<dl className="dumi-default-sidebar-group" key={String(i)}>
1952
{item.title && <dt>{item.title}</dt>}
2053
{item.children.map((child) => {
2154
const link = (
2255
<dd key={child.link}>
23-
<NavLink to={child.link} title={child.title} end>
56+
<NavLink
57+
to={child.link}
58+
title={child.title}
59+
end
60+
onClick={() => setSearch('')}
61+
>
2462
{child.title}
2563
</NavLink>
2664
</dd>

.dumi/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"include": ["**/*"]
4+
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/dist
22
*.yaml
3+
.dumi/tmp

.stylelintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.dumi/tmp

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. See [standa
44

55
## [4.3.0](https://github.com/DTStack/dt-react-component/compare/v4.2.0...v4.3.0) (2023-11-03)
66

7+
### [4.2.1](https://github.com/DTStack/dt-react-component/compare/v4.2.0...v4.2.1) (2023-09-13)
8+
9+
### Features
10+
11+
- add spreadSheet columnSort and columnTypes ([#373](https://github.com/DTStack/dt-react-component/issues/373)) ([f6a14f3](https://github.com/DTStack/dt-react-component/commit/f6a14f317376678d86e021846c5fc5d1b0e703cb))
12+
13+
### Bug Fixes
14+
15+
- fix immediate option in userList ([#378](https://github.com/DTStack/dt-react-component/issues/378)) ([b8992f3](https://github.com/DTStack/dt-react-component/commit/b8992f38f918dde10cb6349e39aca2c524e70853))
16+
> > > > > > > 272326794683ecd3ed1846ad38fd4258b23dc0f7
17+
718
## [4.2.0](https://github.com/DTStack/dt-react-component/compare/v4.1.0...v4.2.0) (2023-08-24)
819

920
### Bug Fixes

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
"lib",
3333
"esm"
3434
],
35+
"sideEffects": [
36+
"lib/*",
37+
"*.scss"
38+
],
3539
"keywords": [
3640
"react",
3741
"react-component",
@@ -86,9 +90,9 @@
8690
"babel-types": "^6.26.0",
8791
"conventional-changelog-cli": "^2.2.2",
8892
"cz-conventional-changelog": "^3.3.0",
89-
"dumi": "^2.1.13",
93+
"dumi": "^2.2.12",
9094
"eslint": "^8.23.0",
91-
"father": "^4.1.0",
95+
"father": "~4.1.0",
9296
"fetch-jsonp": "^1.2.3",
9397
"gh-pages": "^4.0.0",
9498
"husky": "^8.0.1",
@@ -125,5 +129,8 @@
125129
"commitizen": {
126130
"path": "./node_modules/cz-conventional-changelog"
127131
}
132+
},
133+
"resolutions": {
134+
"rc-motion": "2.6.2"
128135
}
129136
}

0 commit comments

Comments
 (0)