@awsui/collection-hooks
Advanced tools
Comparing version 1.0.32 to 1.0.33
export { useCollection } from './use-collection.js'; | ||
export { CollectionRef, FilteringOptions, UseCollectionOptions, UseCollectionResult } from './interfaces'; | ||
export { CollectionRef, FilteringOptions, UseCollectionOptions, UseCollectionResult, PropertyFilterOperator, PropertyFilterOperation, PropertyFilterToken, PropertyFilterQuery, PropertyFilterProperty, PropertyFilterOption, } from './interfaces'; |
@@ -21,25 +21,2 @@ import * as React from 'react'; | ||
export declare type TrackBy<T> = string | ((item: T) => string); | ||
export declare type Operator = '<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!='; | ||
export declare type Operation = 'and' | 'or'; | ||
export interface Token { | ||
value: string; | ||
propertyKey?: string; | ||
operator: Operator; | ||
} | ||
export interface Query { | ||
tokens: readonly Token[]; | ||
operation: Operation; | ||
} | ||
export interface FilteringProperty { | ||
key: string; | ||
groupValuesLabel: string; | ||
propertyLabel: string; | ||
operators?: readonly Operator[]; | ||
defaultOperator?: Operator; | ||
group?: string; | ||
} | ||
export interface PropertyFilteringOption { | ||
propertyKey: string; | ||
value: string; | ||
} | ||
export interface UseCollectionOptions<T> { | ||
@@ -54,5 +31,5 @@ filtering?: FilteringOptions<T> & { | ||
noMatch?: React.ReactNode; | ||
filteringProperties: readonly FilteringProperty[]; | ||
filteringFunction?: (item: T, query: Query) => boolean; | ||
defaultQuery?: Query; | ||
filteringProperties: readonly PropertyFilterProperty[]; | ||
filteringFunction?: (item: T, query: PropertyFilterQuery) => boolean; | ||
defaultQuery?: PropertyFilterQuery; | ||
}; | ||
@@ -74,3 +51,3 @@ sorting?: { | ||
filteringText: string; | ||
propertyFilteringQuery: Query; | ||
propertyFilteringQuery: PropertyFilterQuery; | ||
currentPageIndex: number; | ||
@@ -85,3 +62,3 @@ sortingState?: SortingState<T>; | ||
setSelectedItems(selectedItems: ReadonlyArray<T>): void; | ||
setPropertyFiltering(query: Query): void; | ||
setPropertyFiltering(query: PropertyFilterQuery): void; | ||
} | ||
@@ -109,6 +86,6 @@ interface UseCollectionResultBase<T> { | ||
propertyFilterProps: { | ||
query: Query; | ||
onChange(event: CustomEvent<Query>): void; | ||
filteringProperties: readonly FilteringProperty[]; | ||
filteringOptions: readonly PropertyFilteringOption[]; | ||
query: PropertyFilterQuery; | ||
onChange(event: CustomEvent<PropertyFilterQuery>): void; | ||
filteringProperties: readonly PropertyFilterProperty[]; | ||
filteringOptions: readonly PropertyFilterOption[]; | ||
}; | ||
@@ -132,2 +109,25 @@ paginationProps: { | ||
} | ||
export declare type PropertyFilterOperator = '<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!='; | ||
export declare type PropertyFilterOperation = 'and' | 'or'; | ||
export interface PropertyFilterToken { | ||
value: string; | ||
propertyKey?: string; | ||
operator: PropertyFilterOperator; | ||
} | ||
export interface PropertyFilterQuery { | ||
tokens: readonly PropertyFilterToken[]; | ||
operation: PropertyFilterOperation; | ||
} | ||
export interface PropertyFilterProperty { | ||
key: string; | ||
groupValuesLabel: string; | ||
propertyLabel: string; | ||
operators?: readonly PropertyFilterOperator[]; | ||
defaultOperator?: PropertyFilterOperator; | ||
group?: string; | ||
} | ||
export interface PropertyFilterOption { | ||
propertyKey: string; | ||
value: string; | ||
} | ||
export {}; |
@@ -1,10 +0,10 @@ | ||
import { UseCollectionOptions, Operator, Query } from '../interfaces'; | ||
import { PropertyFilterOperator, PropertyFilterQuery, UseCollectionOptions } from '../interfaces'; | ||
export declare type FilteringPropertiesMap<T> = { | ||
[key in keyof T]: { | ||
operators: { | ||
[key in Operator]?: true; | ||
[key in PropertyFilterOperator]?: true; | ||
}; | ||
}; | ||
}; | ||
export declare function propertyFilter<T>(items: ReadonlyArray<T>, query: Query, { filteringFunction, filteringProperties }: NonNullable<UseCollectionOptions<T>['propertyFiltering']>): ReadonlyArray<T>; | ||
export declare function propertyFilter<T>(items: ReadonlyArray<T>, query: PropertyFilterQuery, { filteringFunction, filteringProperties }: NonNullable<UseCollectionOptions<T>['propertyFiltering']>): ReadonlyArray<T>; | ||
export declare const fixupFalsyValues: <T>(value: T) => string | T; |
import { Dispatch, Reducer } from 'react'; | ||
import { CollectionActions, UseCollectionOptions, CollectionState, SortingState, UseCollectionResult, CollectionRef, Query } from './interfaces'; | ||
import { CollectionActions, UseCollectionOptions, CollectionState, SortingState, UseCollectionResult, CollectionRef, PropertyFilterQuery } from './interfaces'; | ||
interface SelectionAction<T> { | ||
@@ -21,3 +21,3 @@ type: 'selection'; | ||
type: 'property-filtering'; | ||
query: Query; | ||
query: PropertyFilterQuery; | ||
} | ||
@@ -24,0 +24,0 @@ declare type Action<T> = SelectionAction<T> | SortingAction<T> | PaginationAction | FilteringAction | PropertyFilteringAction; |
export { useCollection } from './use-collection.js'; | ||
export { CollectionRef, FilteringOptions, UseCollectionOptions, UseCollectionResult } from './interfaces'; | ||
export { CollectionRef, FilteringOptions, UseCollectionOptions, UseCollectionResult, PropertyFilterOperator, PropertyFilterOperation, PropertyFilterToken, PropertyFilterQuery, PropertyFilterProperty, PropertyFilterOption, } from './interfaces'; |
@@ -21,25 +21,2 @@ import * as React from 'react'; | ||
export declare type TrackBy<T> = string | ((item: T) => string); | ||
export declare type Operator = '<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!='; | ||
export declare type Operation = 'and' | 'or'; | ||
export interface Token { | ||
value: string; | ||
propertyKey?: string; | ||
operator: Operator; | ||
} | ||
export interface Query { | ||
tokens: readonly Token[]; | ||
operation: Operation; | ||
} | ||
export interface FilteringProperty { | ||
key: string; | ||
groupValuesLabel: string; | ||
propertyLabel: string; | ||
operators?: readonly Operator[]; | ||
defaultOperator?: Operator; | ||
group?: string; | ||
} | ||
export interface PropertyFilteringOption { | ||
propertyKey: string; | ||
value: string; | ||
} | ||
export interface UseCollectionOptions<T> { | ||
@@ -54,5 +31,5 @@ filtering?: FilteringOptions<T> & { | ||
noMatch?: React.ReactNode; | ||
filteringProperties: readonly FilteringProperty[]; | ||
filteringFunction?: (item: T, query: Query) => boolean; | ||
defaultQuery?: Query; | ||
filteringProperties: readonly PropertyFilterProperty[]; | ||
filteringFunction?: (item: T, query: PropertyFilterQuery) => boolean; | ||
defaultQuery?: PropertyFilterQuery; | ||
}; | ||
@@ -74,3 +51,3 @@ sorting?: { | ||
filteringText: string; | ||
propertyFilteringQuery: Query; | ||
propertyFilteringQuery: PropertyFilterQuery; | ||
currentPageIndex: number; | ||
@@ -85,3 +62,3 @@ sortingState?: SortingState<T>; | ||
setSelectedItems(selectedItems: ReadonlyArray<T>): void; | ||
setPropertyFiltering(query: Query): void; | ||
setPropertyFiltering(query: PropertyFilterQuery): void; | ||
} | ||
@@ -109,6 +86,6 @@ interface UseCollectionResultBase<T> { | ||
propertyFilterProps: { | ||
query: Query; | ||
onChange(event: CustomEvent<Query>): void; | ||
filteringProperties: readonly FilteringProperty[]; | ||
filteringOptions: readonly PropertyFilteringOption[]; | ||
query: PropertyFilterQuery; | ||
onChange(event: CustomEvent<PropertyFilterQuery>): void; | ||
filteringProperties: readonly PropertyFilterProperty[]; | ||
filteringOptions: readonly PropertyFilterOption[]; | ||
}; | ||
@@ -132,2 +109,25 @@ paginationProps: { | ||
} | ||
export declare type PropertyFilterOperator = '<' | '<=' | '>' | '>=' | ':' | '!:' | '=' | '!='; | ||
export declare type PropertyFilterOperation = 'and' | 'or'; | ||
export interface PropertyFilterToken { | ||
value: string; | ||
propertyKey?: string; | ||
operator: PropertyFilterOperator; | ||
} | ||
export interface PropertyFilterQuery { | ||
tokens: readonly PropertyFilterToken[]; | ||
operation: PropertyFilterOperation; | ||
} | ||
export interface PropertyFilterProperty { | ||
key: string; | ||
groupValuesLabel: string; | ||
propertyLabel: string; | ||
operators?: readonly PropertyFilterOperator[]; | ||
defaultOperator?: PropertyFilterOperator; | ||
group?: string; | ||
} | ||
export interface PropertyFilterOption { | ||
propertyKey: string; | ||
value: string; | ||
} | ||
export {}; |
@@ -1,10 +0,10 @@ | ||
import { UseCollectionOptions, Operator, Query } from '../interfaces'; | ||
import { PropertyFilterOperator, PropertyFilterQuery, UseCollectionOptions } from '../interfaces'; | ||
export declare type FilteringPropertiesMap<T> = { | ||
[key in keyof T]: { | ||
operators: { | ||
[key in Operator]?: true; | ||
[key in PropertyFilterOperator]?: true; | ||
}; | ||
}; | ||
}; | ||
export declare function propertyFilter<T>(items: ReadonlyArray<T>, query: Query, { filteringFunction, filteringProperties }: NonNullable<UseCollectionOptions<T>['propertyFiltering']>): ReadonlyArray<T>; | ||
export declare function propertyFilter<T>(items: ReadonlyArray<T>, query: PropertyFilterQuery, { filteringFunction, filteringProperties }: NonNullable<UseCollectionOptions<T>['propertyFiltering']>): ReadonlyArray<T>; | ||
export declare const fixupFalsyValues: <T>(value: T) => string | T; |
import { Dispatch, Reducer } from 'react'; | ||
import { CollectionActions, UseCollectionOptions, CollectionState, SortingState, UseCollectionResult, CollectionRef, Query } from './interfaces'; | ||
import { CollectionActions, UseCollectionOptions, CollectionState, SortingState, UseCollectionResult, CollectionRef, PropertyFilterQuery } from './interfaces'; | ||
interface SelectionAction<T> { | ||
@@ -21,3 +21,3 @@ type: 'selection'; | ||
type: 'property-filtering'; | ||
query: Query; | ||
query: PropertyFilterQuery; | ||
} | ||
@@ -24,0 +24,0 @@ declare type Action<T> = SelectionAction<T> | SortingAction<T> | PaginationAction | FilteringAction | PropertyFilteringAction; |
@@ -49,4 +49,4 @@ { | ||
"type": "module", | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"license": "Apache-2.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68916