@ahoo-wang/fetcher-viewer 2.12.8 → 2.13.0
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/dist/components/NumberRange.d.ts +12 -0
- package/dist/components/NumberRange.d.ts.map +1 -0
- package/dist/components/TagInput.d.ts +15 -3
- package/dist/components/TagInput.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/filter/AssemblyFilter.d.ts +12 -0
- package/dist/filter/AssemblyFilter.d.ts.map +1 -0
- package/dist/filter/FallbackFilter.d.ts +6 -0
- package/dist/filter/FallbackFilter.d.ts.map +1 -0
- package/dist/filter/IdFilter.d.ts +7 -0
- package/dist/filter/IdFilter.d.ts.map +1 -0
- package/dist/filter/NumberFilter.d.ts +7 -0
- package/dist/filter/NumberFilter.d.ts.map +1 -0
- package/dist/filter/TextFilter.d.ts +7 -0
- package/dist/filter/TextFilter.d.ts.map +1 -0
- package/dist/filter/TypedFilter.d.ts +10 -0
- package/dist/filter/TypedFilter.d.ts.map +1 -0
- package/dist/filter/filterRegistry.d.ts +50 -0
- package/dist/filter/filterRegistry.d.ts.map +1 -0
- package/dist/filter/index.d.ts +9 -5
- package/dist/filter/index.d.ts.map +1 -1
- package/dist/filter/types.d.ts +17 -17
- package/dist/filter/types.d.ts.map +1 -1
- package/dist/filter/useFilterState.d.ts +19 -0
- package/dist/filter/useFilterState.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +328 -164
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +7 -5
- package/dist/filter/ConditionFilter.d.ts +0 -7
- package/dist/filter/ConditionFilter.d.ts.map +0 -1
- package/dist/filter/FallbackConditionFilter.d.ts +0 -8
- package/dist/filter/FallbackConditionFilter.d.ts.map +0 -1
- package/dist/filter/IdConditionFilter.d.ts +0 -7
- package/dist/filter/IdConditionFilter.d.ts.map +0 -1
- package/dist/filter/conditionFilterRegistry.d.ts +0 -51
- package/dist/filter/conditionFilterRegistry.d.ts.map +0 -1
- package/dist/filter/friendlyCondition.d.ts +0 -3
- package/dist/filter/friendlyCondition.d.ts.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type NumberRangeValue = (number | undefined)[];
|
|
2
|
+
export interface NumberRangeProps {
|
|
3
|
+
defaultValue?: NumberRangeValue;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
precision?: number;
|
|
7
|
+
placeholder?: string[];
|
|
8
|
+
onChange?: (value: NumberRangeValue) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function NumberRange(props: NumberRangeProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=NumberRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberRange.d.ts","sourceRoot":"","sources":["../../src/components/NumberRange.tsx"],"names":[],"mappings":"AAgBA,KAAK,gBAAgB,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAwClD"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { SelectProps } from 'antd';
|
|
1
|
+
import { RefSelectProps, SelectProps } from 'antd';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
import { Optional } from '../types';
|
|
4
|
+
export interface TagValueItemSerializer<ValueItemType = string> {
|
|
5
|
+
serialize(value: ValueItemType[]): string[];
|
|
6
|
+
deserialize(value: string[]): ValueItemType[];
|
|
7
|
+
}
|
|
8
|
+
export declare const StringTagValueItemSerializer: TagValueItemSerializer;
|
|
9
|
+
export declare const NumberTagValueItemSerializer: TagValueItemSerializer<number>;
|
|
2
10
|
/**
|
|
3
11
|
* Props for the TagInput component.
|
|
4
12
|
* Extends SelectProps from Antd, excluding 'mode', 'open', and 'suffixIcon' as they are fixed.
|
|
5
13
|
*/
|
|
6
|
-
export interface TagInputProps extends Omit<SelectProps, 'mode' | 'open' | 'suffixIcon'> {
|
|
14
|
+
export interface TagInputProps<ValueItemType = string> extends Omit<SelectProps, 'mode' | 'open' | 'suffixIcon' | 'onChange' | 'value'> {
|
|
15
|
+
ref?: RefObject<RefSelectProps>;
|
|
16
|
+
serializer?: TagValueItemSerializer<ValueItemType>;
|
|
17
|
+
onChange?: (value: ValueItemType[]) => void;
|
|
18
|
+
value?: Optional<ValueItemType | ValueItemType[]>;
|
|
7
19
|
}
|
|
8
20
|
/**
|
|
9
21
|
* A tag input component based on Antd's Select in tags mode.
|
|
@@ -11,7 +23,7 @@ export interface TagInputProps extends Omit<SelectProps, 'mode' | 'open' | 'suff
|
|
|
11
23
|
* @param props - The props for the TagInput component.
|
|
12
24
|
* @returns The rendered TagInput component.
|
|
13
25
|
*/
|
|
14
|
-
export declare function TagInput(props: TagInputProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function TagInput<ValueItemType = string[]>(props: TagInputProps<ValueItemType>): import("react/jsx-runtime").JSX.Element;
|
|
15
27
|
export declare namespace TagInput {
|
|
16
28
|
var displayName: string;
|
|
17
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagInput.d.ts","sourceRoot":"","sources":["../../src/components/TagInput.tsx"],"names":[],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":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FilterProps } from './types';
|
|
2
|
+
import { Operator } from '@ahoo-wang/fetcher-wow';
|
|
3
|
+
import { UseFilterStateReturn } from './useFilterState';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { Optional } from '../types';
|
|
6
|
+
export interface AssemblyFilterProps<ValueType = any> extends FilterProps {
|
|
7
|
+
supportedOperators: Operator[];
|
|
8
|
+
validate?: (operator: Operator, value: Optional<ValueType>) => boolean;
|
|
9
|
+
valueInputSupplier: (filterState: UseFilterStateReturn<ValueType>) => ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function AssemblyFilter<ValueType = any>(props: AssemblyFilterProps<ValueType>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=AssemblyFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssemblyFilter.d.ts","sourceRoot":"","sources":["../../src/filter/AssemblyFilter.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAEL,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,mBAAmB,CAAC,SAAS,GAAG,GAAG,CAClD,SAAQ,WAAW;IACnB,kBAAkB,EAAE,QAAQ,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC;IACvE,kBAAkB,EAAE,CAClB,WAAW,EAAE,oBAAoB,CAAC,SAAS,CAAC,KACzC,SAAS,CAAC;CAChB;AAED,wBAAgB,cAAc,CAAC,SAAS,GAAG,GAAG,EAC5C,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,2CA0CtC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TypedFilterProps } from './TypedFilter';
|
|
2
|
+
export declare function FallbackFilter(props: TypedFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace FallbackFilter {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=FallbackFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FallbackFilter.d.ts","sourceRoot":"","sources":["../../src/filter/FallbackFilter.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,2CAOrD;yBAPe,cAAc"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FilterProps } from './types';
|
|
2
|
+
export declare const ID_FILTER = "id";
|
|
3
|
+
export declare function IdFilter(props: FilterProps<string | string[]>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare namespace IdFilter {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=IdFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdFilter.d.ts","sourceRoot":"","sources":["../../src/filter/IdFilter.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAUtC,eAAO,MAAM,SAAS,OAAO,CAAC;AAE9B,wBAAgB,QAAQ,CACtB,KAAK,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,2CA+BtC;yBAhCe,QAAQ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FilterProps } from './types';
|
|
2
|
+
export declare const NUMBER_FILTER = "number";
|
|
3
|
+
export declare function NumberFilter(props: FilterProps<number | (number | undefined)[]>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare namespace NumberFilter {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=NumberFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberFilter.d.ts","sourceRoot":"","sources":["../../src/filter/NumberFilter.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAQtC,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC,2CA4D/E;yBA5De,YAAY"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FilterProps } from './types';
|
|
2
|
+
export declare const TEXT_FILTER = "text";
|
|
3
|
+
export declare function TextFilter(props: FilterProps<string | string[]>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare namespace TextFilter {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=TextFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFilter.d.ts","sourceRoot":"","sources":["../../src/filter/TextFilter.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC,wBAAgB,UAAU,CACxB,KAAK,EAAE,WAAW,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,2CA2BtC;yBA5Be,UAAU"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FilterProps } from './types';
|
|
2
|
+
export type FilterType = string;
|
|
3
|
+
export interface TypedFilterProps extends FilterProps {
|
|
4
|
+
type: FilterType;
|
|
5
|
+
}
|
|
6
|
+
export declare function TypedFilter(props: TypedFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare namespace TypedFilter {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=TypedFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedFilter.d.ts","sourceRoot":"","sources":["../../src/filter/TypedFilter.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC,MAAM,MAAO,UAAU,GAAG,MAAM,CAAA;AAEhC,MAAM,WAAW,gBACf,SAAQ,WAAW;IACnB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAGlD;yBAHe,WAAW"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FilterComponent } from './types';
|
|
2
|
+
import { FilterType } from './TypedFilter';
|
|
3
|
+
/**
|
|
4
|
+
* Registry for managing filter components.
|
|
5
|
+
*
|
|
6
|
+
* Provides a centralized way to register, unregister, and retrieve
|
|
7
|
+
* filter components by their type identifiers.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FilterRegistry {
|
|
10
|
+
private readonly filters;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Registers a filter component for a specific type.
|
|
14
|
+
*
|
|
15
|
+
* @param type - The unique identifier for the filter type
|
|
16
|
+
* @param filter - The filter component to register
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* filterRegistry.register('text', TextFilter);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
register(type: FilterType, filter: FilterComponent): void;
|
|
24
|
+
/**
|
|
25
|
+
* Unregisters a filter component for a specific type.
|
|
26
|
+
*
|
|
27
|
+
* @param type - The unique identifier for the filter type to remove
|
|
28
|
+
* @returns true if the filter was successfully removed, false otherwise
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const wasRemoved = filterRegistry.unregister('text');
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
unregister(type: FilterType): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves a filter component for a specific type.
|
|
38
|
+
*
|
|
39
|
+
* @param type - The unique identifier for the filter type
|
|
40
|
+
* @returns The filter component, or undefined if not found
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const TextFilter = filterRegistry.get('text');
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
get(type: FilterType): FilterComponent | undefined;
|
|
48
|
+
}
|
|
49
|
+
export declare const filterRegistry: FilterRegistry;
|
|
50
|
+
//# sourceMappingURL=filterRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterRegistry.d.ts","sourceRoot":"","sources":["../../src/filter/filterRegistry.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGpB;;IAQJ;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe;IAIlD;;;;;;;;;;OAUG;IACH,UAAU,CAAC,IAAI,EAAE,UAAU;IAI3B;;;;;;;;;;OAUG;IACH,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,eAAe,GAAG,SAAS;CAGnD;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
package/dist/filter/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export * from './ConditionFilter';
|
|
2
|
-
export * from './conditionFilterRegistry';
|
|
3
|
-
export * from './IdConditionFilter';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './FallbackConditionFilter';
|
|
6
1
|
export * from './locale';
|
|
2
|
+
export * from './AssemblyFilter';
|
|
3
|
+
export * from './FallbackFilter';
|
|
4
|
+
export * from './filterRegistry';
|
|
5
|
+
export * from './IdFilter';
|
|
6
|
+
export * from './NumberFilter';
|
|
7
|
+
export * from './TextFilter';
|
|
8
|
+
export * from './TypedFilter';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export * from './useFilterState';
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filter/index.ts"],"names":[],"mappings":"AAaA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filter/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
package/dist/filter/types.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { AttributesCapable, NamedCapable } from '@ahoo-wang/fetcher';
|
|
2
|
-
import {
|
|
2
|
+
import { ConditionCapable, Operator, OperatorLocale } from '@ahoo-wang/fetcher-wow';
|
|
3
3
|
import { SelectProps } from 'antd/es/select';
|
|
4
|
+
import { default as React, RefAttributes } from 'react';
|
|
5
|
+
import { StyleCapable } from '../types';
|
|
4
6
|
/**
|
|
5
7
|
* @see {@link Schema}
|
|
6
8
|
*/
|
|
7
|
-
export interface
|
|
9
|
+
export interface FilterField extends NamedCapable {
|
|
8
10
|
label: string;
|
|
9
11
|
type: string;
|
|
10
12
|
format?: string;
|
|
11
13
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
+
export interface FilterRef {
|
|
15
|
+
getValue(): FilterValue | undefined;
|
|
14
16
|
}
|
|
15
|
-
export interface LabelProps extends
|
|
17
|
+
export interface LabelProps extends StyleCapable {
|
|
16
18
|
}
|
|
17
|
-
export interface OperatorProps extends SelectProps<Operator> {
|
|
19
|
+
export interface OperatorProps extends Omit<SelectProps<Operator>, 'value'> {
|
|
18
20
|
locale?: OperatorLocale;
|
|
19
21
|
}
|
|
20
|
-
export interface ValueProps {
|
|
21
|
-
defaultValue?:
|
|
22
|
+
export interface ValueProps<ValueType = any> extends StyleCapable {
|
|
23
|
+
defaultValue?: ValueType;
|
|
22
24
|
placeholder?: string;
|
|
23
25
|
}
|
|
24
|
-
export interface
|
|
25
|
-
condition: Condition;
|
|
26
|
-
friendly: string;
|
|
26
|
+
export interface FilterValue extends ConditionCapable {
|
|
27
27
|
}
|
|
28
|
-
export interface
|
|
29
|
-
field:
|
|
30
|
-
label
|
|
28
|
+
export interface FilterProps<ValueType = any> extends AttributesCapable, RefAttributes<FilterRef> {
|
|
29
|
+
field: FilterField;
|
|
30
|
+
label?: LabelProps;
|
|
31
31
|
operator: OperatorProps;
|
|
32
|
-
value: ValueProps
|
|
33
|
-
onChange?: (value?:
|
|
32
|
+
value: ValueProps<ValueType>;
|
|
33
|
+
onChange?: (value?: FilterValue) => void;
|
|
34
34
|
}
|
|
35
|
-
export type
|
|
35
|
+
export type FilterComponent = React.FC<FilterProps>;
|
|
36
36
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/filter/types.ts"],"names":[],"mappings":"AAaA,OAAO,E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C;IACxB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Operator } from '@ahoo-wang/fetcher-wow';
|
|
2
|
+
import { RefAttributes } from 'react';
|
|
3
|
+
import { FilterRef, FilterValue } from './types';
|
|
4
|
+
import { Optional } from '../types';
|
|
5
|
+
export interface UseFilterStateOptions<ValueType = any> extends RefAttributes<FilterRef> {
|
|
6
|
+
field?: string;
|
|
7
|
+
operator: Operator;
|
|
8
|
+
value: Optional<ValueType>;
|
|
9
|
+
validate?: (operator: Operator, value: Optional<ValueType>) => boolean;
|
|
10
|
+
onChange?: (condition: Optional<FilterValue>) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface UseFilterStateReturn<ValueType = any> {
|
|
13
|
+
operator: Operator;
|
|
14
|
+
value: Optional<ValueType>;
|
|
15
|
+
setOperator: (operator: Operator) => void;
|
|
16
|
+
setValue: (value: Optional<ValueType>) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function useFilterState<ValueType = any>(options: UseFilterStateOptions<ValueType>): UseFilterStateReturn<ValueType>;
|
|
19
|
+
//# sourceMappingURL=useFilterState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilterState.d.ts","sourceRoot":"","sources":["../../src/filter/useFilterState.ts"],"names":[],"mappings":"AAaA,OAAO,EAAa,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAiC,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,MAAM,WAAW,qBAAqB,CAAC,SAAS,GAAG,GAAG,CAAE,SAAQ,aAAa,CAAC,SAAS,CAAC;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC;IACvE,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,GAAG;IACnD,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;CAChD;AAQD,wBAAgB,cAAc,CAAC,SAAS,GAAG,GAAG,EAAE,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAwC1H"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA"}
|