@fe-free/core 6.0.7 → 6.0.9
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @fe-free/core
|
|
2
2
|
|
|
3
|
+
## 6.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: tabs
|
|
8
|
+
- @fe-free/icons@6.0.9
|
|
9
|
+
- @fe-free/tool@6.0.9
|
|
10
|
+
|
|
11
|
+
## 6.0.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- feat: version
|
|
16
|
+
- @fe-free/icons@6.0.8
|
|
17
|
+
- @fe-free/tool@6.0.8
|
|
18
|
+
|
|
3
19
|
## 6.0.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.9",
|
|
4
4
|
"description": "React 业务核心组件库:CRUD、ProForm 扩展、布局、路由、树、上传等(Antd + ProComponents)",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -17,30 +17,21 @@
|
|
|
17
17
|
"@codemirror/lang-json": "^6.0.1",
|
|
18
18
|
"@codemirror/lang-markdown": "^6.3.2",
|
|
19
19
|
"@codemirror/lang-python": "^6.2.1",
|
|
20
|
-
"@codemirror/lang-sql": "^6.8.0",
|
|
21
|
-
"@codemirror/lang-xml": "^6.1.0",
|
|
22
20
|
"@codemirror/language": "^6.10.3",
|
|
23
21
|
"@codemirror/view": "^6.33.0",
|
|
24
22
|
"@lezer/highlight": "^1.2.1",
|
|
25
23
|
"@uiw/codemirror-theme-basic": "^4.23.12",
|
|
26
24
|
"@uiw/codemirror-themes": "^4.23.12",
|
|
27
25
|
"@uiw/react-codemirror": "^4.23.12",
|
|
28
|
-
"ahooks": "^3.
|
|
26
|
+
"ahooks": "^3.9.6",
|
|
29
27
|
"axios": "^1.6.5",
|
|
30
28
|
"classnames": "^2.5.1",
|
|
31
29
|
"file-saver": "^2.0.5",
|
|
32
|
-
"github-markdown-css": "^5.8.1",
|
|
33
30
|
"localforage": "^1.10.0",
|
|
34
31
|
"lodash-es": "^4.17.21",
|
|
35
|
-
"react-ace": "^11.0.1",
|
|
36
|
-
"react-markdown": "^9.1.0",
|
|
37
32
|
"react-router-dom": "^6.16.0",
|
|
38
|
-
"react-syntax-highlighter": "^15.5.0",
|
|
39
|
-
"rehype-raw": "^7.0.0",
|
|
40
|
-
"remark-gfm": "^4.0.1",
|
|
41
33
|
"safe-stable-stringify": "^2.5.0",
|
|
42
|
-
"vanilla-jsoneditor": "^0.23.1"
|
|
43
|
-
"zustand": "^4.5.4"
|
|
34
|
+
"vanilla-jsoneditor": "^0.23.1"
|
|
44
35
|
},
|
|
45
36
|
"peerDependencies": {
|
|
46
37
|
"@ant-design/plots": "^2.5.0",
|
|
@@ -52,8 +43,8 @@
|
|
|
52
43
|
"i18next-icu": "^2.4.1",
|
|
53
44
|
"react": "^19.2.0",
|
|
54
45
|
"react-i18next": "^16.4.0",
|
|
55
|
-
"@fe-free/icons": "6.0.
|
|
56
|
-
"@fe-free/tool": "6.0.
|
|
46
|
+
"@fe-free/icons": "6.0.9",
|
|
47
|
+
"@fe-free/tool": "6.0.9"
|
|
57
48
|
},
|
|
58
49
|
"scripts": {
|
|
59
50
|
"i18n-extract": "rm -rf ./src/locales/zh-CN && npx i18next-cli extract"
|
|
@@ -3,8 +3,10 @@ import { Input } from 'antd';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
|
|
6
7
|
import type { CRUDProps } from '../crud';
|
|
7
8
|
import { CRUD } from '../crud';
|
|
9
|
+
|
|
8
10
|
import './style.scss';
|
|
9
11
|
|
|
10
12
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
@@ -35,7 +37,7 @@ function useTips(props) {
|
|
|
35
37
|
),
|
|
36
38
|
);
|
|
37
39
|
}
|
|
38
|
-
}, [t]);
|
|
40
|
+
}, [t]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
function SearchRender(props: {
|
|
@@ -91,7 +93,7 @@ function CRUDOfList(props: CRUDOfListProps) {
|
|
|
91
93
|
|
|
92
94
|
const newParams = useMemo(() => {
|
|
93
95
|
return {
|
|
94
|
-
...
|
|
96
|
+
...tableProps.params,
|
|
95
97
|
[searchDataIndex]: debouncedSearchValue,
|
|
96
98
|
};
|
|
97
99
|
}, [debouncedSearchValue, searchDataIndex, tableProps.params]);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TabsProps as AntdTabsProps } from 'antd';
|
|
1
2
|
import classNames from 'classnames';
|
|
2
3
|
import { Fragment, useMemo } from 'react';
|
|
3
4
|
import { useSearchParams } from 'react-router-dom';
|
|
@@ -94,47 +95,55 @@ function PageLayout({
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
interface PageLayoutTabsProps extends PageLayoutProps {
|
|
97
|
-
tabsProps: Omit<TabsProps, '
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
tabsProps: Omit<TabsProps, 'withSearchParams' | 'tabsProps'> & {
|
|
99
|
+
tabsProps: Omit<AntdTabsProps, 'items'> & {
|
|
100
|
+
items: {
|
|
101
|
+
key: string;
|
|
102
|
+
label: React.ReactNode;
|
|
103
|
+
children: React.ReactNode;
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
103
106
|
};
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
function PageLayoutTabs(props: PageLayoutTabsProps) {
|
|
107
110
|
const { tabsProps, ...rest } = props;
|
|
111
|
+
const { tabsProps: antdTabsProps, ...tabsPropsRest } = tabsProps;
|
|
112
|
+
const { items: antdItems, ...antdTabsPropsRest } = antdTabsProps;
|
|
108
113
|
|
|
109
114
|
const [searchParams] = useSearchParams();
|
|
110
115
|
const tab = searchParams.get(tabsProps.tabKey || 'tab') || undefined;
|
|
111
116
|
|
|
112
117
|
const { children, newItems } = useMemo(() => {
|
|
113
|
-
const items =
|
|
118
|
+
const items = antdItems ?? [];
|
|
114
119
|
|
|
115
|
-
const item = items.find((
|
|
116
|
-
const
|
|
120
|
+
const item = items.find((v) => v.key === tab);
|
|
121
|
+
const child = item?.children || items[0]?.children;
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
return {
|
|
124
|
+
children: child,
|
|
125
|
+
newItems: items.map((v) => ({
|
|
126
|
+
...v,
|
|
127
|
+
children: undefined,
|
|
128
|
+
})),
|
|
129
|
+
};
|
|
130
|
+
}, [antdItems, tab]);
|
|
125
131
|
|
|
126
132
|
return (
|
|
127
133
|
<PageLayout
|
|
128
134
|
direction="vertical"
|
|
129
135
|
start={
|
|
130
136
|
<Tabs
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
tabsProps={{
|
|
138
|
+
tabBarExtraContent: {
|
|
139
|
+
left: <div className="w-4" />,
|
|
140
|
+
right: <div className="w-4" />,
|
|
141
|
+
},
|
|
142
|
+
...antdTabsPropsRest,
|
|
143
|
+
items: newItems,
|
|
134
144
|
}}
|
|
135
|
-
{...tabsProps}
|
|
136
|
-
items={newItems}
|
|
137
145
|
withSearchParams
|
|
146
|
+
{...tabsPropsRest}
|
|
138
147
|
/>
|
|
139
148
|
}
|
|
140
149
|
{...rest}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PageLayoutTabs } from '@fe-free/core';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof PageLayoutTabs> = {
|
|
5
|
+
title: '@fe-free/core/PageLayoutTabs',
|
|
6
|
+
component: PageLayoutTabs,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof PageLayoutTabs>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
render: () => {
|
|
15
|
+
return <div>依赖 react-router-dom 的 Route 组件,暂不提供 demo</div>;
|
|
16
|
+
},
|
|
17
|
+
};
|
package/src/tabs/index.tsx
CHANGED
|
@@ -12,15 +12,15 @@ interface TabsProps {
|
|
|
12
12
|
withSearchParams?: boolean;
|
|
13
13
|
/** 设置 searchParams 的类型,默认 set */
|
|
14
14
|
searchParamsType?: 'set' | 'change';
|
|
15
|
-
/**
|
|
15
|
+
/** url 上字段的名字,默认 tab */
|
|
16
16
|
tabKey?: string;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/** antd Tabs 的 props */
|
|
18
|
+
tabsProps?: AntdTabsProps;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function Tabs(props: TabsProps) {
|
|
22
|
-
const { withSearchParams, searchParamsType = 'set', tabKey = 'tab',
|
|
23
|
-
const { className, activeKey, onChange, ...rest } =
|
|
22
|
+
const { withSearchParams, searchParamsType = 'set', tabKey = 'tab', tabsProps } = props;
|
|
23
|
+
const { className, activeKey, onChange, ...rest } = tabsProps || {};
|
|
24
24
|
|
|
25
25
|
const [searchParams] = useSearchParams();
|
|
26
26
|
const tab = searchParams.get(tabKey) || undefined;
|