|
@@ -15,7 +15,7 @@ import {differenceBy} from 'lodash-es';
|
|
|
import {useLatest} from 'ahooks';
|
|
|
import {Card} from 'antd';
|
|
|
|
|
|
-export type MapValue<S extends Record<string, string>> =
|
|
|
+export type MapValue<S extends Record<string, string | string[]>> =
|
|
|
| {label: string; type: 'field' | 'date'; value: keyof S}
|
|
|
| {
|
|
|
label: string;
|
|
@@ -29,18 +29,19 @@ export type MapValue<S extends Record<string, string>> =
|
|
|
value: keyof S;
|
|
|
options: {label: string; value: string}[];
|
|
|
excludeAll?: boolean;
|
|
|
+ multiple?: boolean;
|
|
|
};
|
|
|
|
|
|
-export type FilterGroupMap<S extends Record<string, string>> = Map<
|
|
|
+export type FilterGroupMap<S extends Record<string, string | string[]>> = Map<
|
|
|
string,
|
|
|
MapValue<S>
|
|
|
>;
|
|
|
|
|
|
-type Props<S extends Record<string, string>> = {
|
|
|
+type Props<S extends Record<string, string | string[]>> = {
|
|
|
filterData: string;
|
|
|
sourceMap: FilterGroupMap<S>;
|
|
|
fixedMap: MapValue<S>[];
|
|
|
- fields: Record<string, string>;
|
|
|
+ fields: Record<string, string | string[]>;
|
|
|
isSearching: boolean;
|
|
|
dates?: RangeValue<Dayjs>;
|
|
|
onReset: () => void;
|
|
@@ -51,7 +52,7 @@ type Props<S extends Record<string, string>> = {
|
|
|
testId?: string;
|
|
|
};
|
|
|
|
|
|
-function FilterTool<S extends Record<string, string>>({
|
|
|
+function FilterTool<S extends Record<string, string | string[]>>({
|
|
|
onChange,
|
|
|
fields,
|
|
|
dates,
|
|
@@ -140,7 +141,7 @@ function FilterTool<S extends Record<string, string>>({
|
|
|
key={state.label}
|
|
|
name={state.value as string}
|
|
|
label={state.label}
|
|
|
- value={fields[state.value as string]}
|
|
|
+ value={fields[state.value as string] as string}
|
|
|
onChange={onChange?.(state.value)}
|
|
|
/>
|
|
|
);
|
|
@@ -163,7 +164,7 @@ function FilterTool<S extends Record<string, string>>({
|
|
|
selectKey={state.selectKey}
|
|
|
name={state.value as string}
|
|
|
label={state.label}
|
|
|
- value={fields[state.value as string]}
|
|
|
+ value={fields[state.value as string] as string}
|
|
|
onChange={onChange?.(state.value as string)}
|
|
|
/>
|
|
|
);
|
|
@@ -179,6 +180,7 @@ function FilterTool<S extends Record<string, string>>({
|
|
|
value={fields[state.value as string]}
|
|
|
onChange={onChange?.(state.value)}
|
|
|
options={options}
|
|
|
+ multiple={state.multiple}
|
|
|
/>
|
|
|
);
|
|
|
}
|