Skip to content

Commit

Permalink
feat: 文本筛选单选时支持搜索 (#146)
Browse files Browse the repository at this point in the history
* chore: 时间选择器类型编译问题

* feat: 文本筛选单选时支持搜索
  • Loading branch information
lvisei authored Mar 22, 2024
1 parent 592990b commit e9ae431
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export const FilterDate: React.FC<FilterDateProps> = ({
}
};

const onValueChange = (_: any, dateString: FilterDateValue) => {
const onValueChange = (_: any, dateString: string | string[]) => {
// 处理时间到最小粒度
const _timer = getTimeFormat(dateString, granularity.value, operator);
const _timer = getTimeFormat(dateString as FilterDateValue, granularity.value, operator);
onChange(_timer, granularity.granularity);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const FilterDateConfig: React.FC<FilterDateConfigProps> = (props) => {
};

// 时间区间变化
const onRangePickerChange = (_: any, dateString: [string, string] | string) => {
const onRangePickerChange = (_: any, dateString: string | string[]) => {
let value: string | [string, string] | undefined;

// 点击清空的情况
Expand All @@ -75,7 +75,7 @@ const FilterDateConfig: React.FC<FilterDateConfigProps> = (props) => {
} else if (state.type === 'date') {
value = typeof dateString === 'string' ? getTimeFormat(dateString, state.format) : undefined;
} else {
value = Array.isArray(dateString) ? getTimeFormat(dateString, state.format) : undefined;
value = Array.isArray(dateString) ? getTimeFormat(dateString as [string, string], state.format) : undefined;
}

setState((pre) => ({ ...pre, value }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const FilterStringConfig: React.FC<FilterStringConfigProps> = (props) => {
<>
{filterType === 'single' && (
<Select
showSearch
size={size}
bordered={bordered}
style={{ width: '100%', textAlign: 'left' }}
Expand Down

0 comments on commit e9ae431

Please sign in to comment.