Skip to content

Commit 7e3d37b

Browse files
authored
Merge pull request #67 from 1Byte-Software/develop
Update version 1.12.0
2 parents bd6e83b + f858c97 commit 7e3d37b

File tree

13 files changed

+489
-29
lines changed

13 files changed

+489
-29
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.12.0]
9+
10+
### Added
11+
12+
- Added `QuickRangePicker` component.
13+
14+
### Changed
15+
16+
- Improve `Filter` component.
17+
18+
### Fixed
19+
20+
- Fixed `localization` props in `Filter` component.
21+
822
## [1.11.3]
923

1024
### Remove

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "1byte-react-design",
3-
"version": "1.11.3",
3+
"version": "1.12.0",
44
"description": "A simple React UI library",
55
"main": "dist/index.js",
66
"module": "dist/index.js",
@@ -18,7 +18,8 @@
1818
"peerDependencies": {
1919
"react": "^18.0.0",
2020
"react-router": "^7.0.0",
21-
"yup": "1.7.0"
21+
"yup": "1.7.0",
22+
"i18next": "^25.5.3"
2223
},
2324
"dependencies": {
2425
"@ant-design/cssinjs": "^1.24.0",
@@ -34,7 +35,6 @@
3435
"antd": "^5.21.2",
3536
"clsx": "^2.1.1",
3637
"dayjs": "^1.11.13",
37-
"i18next": "^25.5.3",
3838
"polished": "^4.3.1",
3939
"rc-field-form": "^2.7.0",
4040
"rc-image": "^7.12.0",

src/organisms/Filter/components/Footer/index.tsx

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ import { Flex, Typography } from '../../../../atomics';
66
import { Form, Select, Space, Tooltip } from '../../../../molecules';
77
import { FilterFooterWrapper } from './styles';
88
import { RdFilterFooterProps } from './types';
9+
import { localize } from '../../../../utils/localize';
10+
11+
// export const rdI118next = i18next;
12+
// (rdI118next as any).fromLib = '1byte-react-design';
13+
14+
// export const useRdLocation = useLocation;
15+
// (useRdLocation as any).fromLib = '1byte-react-design';
16+
17+
// export const rdReact = React;
18+
// (rdReact as any).fromLib = '1byte-react-design';
19+
20+
// export const rdYup = Yup;
21+
// (rdYup as any).fromLib = '1byte-react-design';
922

1023
export const FilterFooter = <T extends Record<string, string>>(props: RdFilterFooterProps<T>) => {
1124
const {
@@ -16,6 +29,7 @@ export const FilterFooter = <T extends Record<string, string>>(props: RdFilterFo
1629
isLoading,
1730
filterValue,
1831
localization,
32+
children,
1933
onChangeFilterValue,
2034
} = props;
2135

@@ -39,38 +53,46 @@ export const FilterFooter = <T extends Record<string, string>>(props: RdFilterFo
3953
<Flex justify="space-between" wrap>
4054
{Boolean(fields?.length) && (
4155
<Space>
42-
{fields?.map(field => (
43-
<Form.Item
44-
key={field.name as string}
45-
label={field.label}
46-
disableMargin
47-
// labelCol={{
48-
// flex: 1,
49-
// }}
50-
// wrapperCol={false}
51-
>
52-
<Select
53-
options={field.options}
54-
value={filterValue?.[field.name] || null}
55-
onChange={e => {
56-
const newFilterValue = { ...filterValue } as T;
57-
newFilterValue[field.name] = e;
56+
{fields?.map(field => {
57+
return (
58+
<Form.Item
59+
key={field.name as string}
60+
label={field.label}
61+
disableMargin
62+
// labelCol={{
63+
// flex: 1,
64+
// }}
65+
// wrapperCol={false}
66+
>
67+
{field?.render ? (
68+
field.render()
69+
) : (
70+
<Select
71+
options={field.options}
72+
value={filterValue?.[field.name] || null}
73+
onChange={e => {
74+
const newFilterValue = { ...filterValue } as T;
75+
newFilterValue[field.name] = e;
5876

59-
onChangeFilterValue?.(newFilterValue);
60-
}}
61-
popupMatchSelectWidth={false}
62-
/>
63-
</Form.Item>
64-
))}
77+
onChangeFilterValue?.(newFilterValue);
78+
}}
79+
popupMatchSelectWidth={false}
80+
/>
81+
)}
82+
</Form.Item>
83+
);
84+
})}
6585
</Space>
6686
)}
6787

88+
{children}
89+
6890
{Boolean(totalItems || showTotalItemsCount) && (
6991
<Space size={'small'} style={{ marginLeft: 'auto' }} align="end">
7092
{isLoading && <LoadingOutlined />}
7193
<Typography.Text>
72-
{i18next.t(showing, { total: totalItems, count: showTotalItemsCount })}{' '}
73-
<Tooltip title={i18next.t(showing_tooltip)}>
94+
{localize(showing, { total: totalItems, count: showTotalItemsCount })}{' '}
95+
<Tooltip title={localize(showing_tooltip)}>
7496
<Typography.Text type="secondary">
7597
<InfoCircleFilled />
7698
</Typography.Text>

src/organisms/Filter/components/Footer/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type RdFilterFooterComponent = <T extends {}>(
2424
interface IFieldItem<T extends {}> extends RdSelectProps {
2525
name: keyof T;
2626
label: ReactNode;
27+
render?: () => ReactNode;
2728
}
2829

2930
export interface FilterFooterLocalization {

src/organisms/Filter/components/Header/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { RdSearchProps, Space } from '../../../../molecules';
33
import { FilterHeaderWrapper, InputFilterStyles } from './styles';
44
import { RdFilterHeaderProps } from './types';
55
import i18next from 'i18next';
6+
import { localize } from '../../../../utils/localize';
67

78
export const FilterHeader = (props: RdFilterHeaderProps) => {
89
const { defaultKeywords, className, localization, onChangeKeywords } = props;
@@ -17,7 +18,7 @@ export const FilterHeader = (props: RdFilterHeaderProps) => {
1718
<Space size="small" direction="vertical" block>
1819
<InputFilterStyles
1920
defaultValue={defaultKeywords}
20-
placeholder={i18next.t(search_placeholder)}
21+
placeholder={localize(search_placeholder)}
2122
onSearch={handleChangeKeywords}
2223
/>
2324

src/organisms/Filter/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from './components/Footer';
12
export * from './Filter';

0 commit comments

Comments
 (0)