@websolutespa/bom-mixer-hooks 1.8.1 → 1.8.3
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/CHANGELOG.md +13 -0
- package/dist/index.d.ts +46 -24
- package/dist/index.js +206 -152
- package/dist/index.mjs +184 -134
- package/package.json +1 -1
- package/src/index.ts +3 -2
- package/src/useFilters/useFilters.test.ts +1 -1
- package/src/usePageLoading/usePageLoading.ts +64 -0
- package/src/useSearchParams/useSearchParams.ts +52 -52
- package/src/useSearchParamsEncoded/useSearchParamsEncoded.ts +30 -66
- package/src/useSearchParamsQs/useSearchParamsQs.ts +29 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-hooks
|
|
2
2
|
|
|
3
|
+
## 1.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added: usePageLoading
|
|
8
|
+
- Modified: useSearchParams, useSearchParamsEncoded, useSearchParamsQs
|
|
9
|
+
|
|
10
|
+
## 1.8.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Modified: useSearchParams, useSearchParamsEncoded, useSearchParamsQs added pushParams
|
|
15
|
+
|
|
3
16
|
## 1.8.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -396,6 +396,20 @@ declare function PageProvider({ children, page }: {
|
|
|
396
396
|
page: IPage;
|
|
397
397
|
}): react_jsx_runtime.JSX.Element;
|
|
398
398
|
|
|
399
|
+
type IPageRoute = {
|
|
400
|
+
pathname: string;
|
|
401
|
+
query: Record<string, string>;
|
|
402
|
+
asPath: string;
|
|
403
|
+
};
|
|
404
|
+
declare function usePageLoading(options?: {
|
|
405
|
+
loading: boolean;
|
|
406
|
+
}): {
|
|
407
|
+
loading: boolean;
|
|
408
|
+
error: void | Error | undefined;
|
|
409
|
+
pageRoute: IPageRoute | undefined;
|
|
410
|
+
previousPageRoute: IPageRoute | undefined;
|
|
411
|
+
};
|
|
412
|
+
|
|
399
413
|
type IPaginationInfo<T = any> = {
|
|
400
414
|
items: T[];
|
|
401
415
|
page: number;
|
|
@@ -434,26 +448,19 @@ declare function getRealSize(element: HTMLElement | null): SizeType;
|
|
|
434
448
|
|
|
435
449
|
declare function useResize(callback: () => unknown, immediate?: boolean): void;
|
|
436
450
|
|
|
437
|
-
type SSRState = {
|
|
438
|
-
isBrowser: boolean;
|
|
439
|
-
isServer: boolean;
|
|
440
|
-
};
|
|
441
|
-
declare const detectIsBrowser: () => boolean;
|
|
442
|
-
declare function useSSR(): SSRState;
|
|
443
|
-
|
|
444
451
|
type Scroll = {
|
|
445
452
|
left: number;
|
|
446
453
|
top: number;
|
|
447
454
|
};
|
|
448
455
|
declare function useScroll(): Scroll;
|
|
449
456
|
|
|
457
|
+
declare function useScrolled(callback?: (top: number, left: number) => boolean): boolean;
|
|
458
|
+
|
|
450
459
|
declare function useScrollTo(offset?: number): (event: React.MouseEvent<HTMLElement>) => void;
|
|
451
460
|
declare function scrollToSelector(selector?: string, offset?: number): void;
|
|
452
461
|
declare function scrollToRelativeY(y?: number, offset?: number): void;
|
|
453
462
|
declare function scrollToY(y?: number): void;
|
|
454
463
|
|
|
455
|
-
declare function useScrolled(callback?: (top: number, left: number) => boolean): boolean;
|
|
456
|
-
|
|
457
464
|
declare function getSearchParams(url: string, key?: string): IParams | string | null;
|
|
458
465
|
declare function updateSearchParams(currentPath: string, params: IParams): {
|
|
459
466
|
pathname: string;
|
|
@@ -461,21 +468,23 @@ declare function updateSearchParams(currentPath: string, params: IParams): {
|
|
|
461
468
|
[key: string]: string;
|
|
462
469
|
};
|
|
463
470
|
};
|
|
464
|
-
declare function replaceSearchParams(router: NextRouter, params: IParams): void;
|
|
465
471
|
declare function pushSearchParams(router: NextRouter, params: IParams): void;
|
|
466
|
-
declare function
|
|
467
|
-
declare function
|
|
472
|
+
declare function pushSearchParamsSilently(router: NextRouter, params: IParams): void;
|
|
473
|
+
declare function replaceSearchParams(router: NextRouter, params: IParams): void;
|
|
474
|
+
declare function replaceSearchParamsSilently(router: NextRouter, params: IParams): void;
|
|
468
475
|
type IParams = {
|
|
469
476
|
[key: string]: string;
|
|
470
477
|
};
|
|
471
|
-
type IUseSearchParamsValueResult = {
|
|
472
|
-
params: string | null;
|
|
473
|
-
replaceParamsSilently: (params: IParams) => void;
|
|
474
|
-
};
|
|
475
478
|
type IUseSearchParamsResult = {
|
|
476
479
|
params: IParams;
|
|
477
|
-
|
|
480
|
+
pushParams: (params: IParams) => void;
|
|
481
|
+
pushParamsSilently: (params: IParams) => void;
|
|
478
482
|
replaceParams: (params: IParams) => void;
|
|
483
|
+
replaceParamsSilently: (params: IParams) => void;
|
|
484
|
+
};
|
|
485
|
+
declare function useSearchParams(): IUseSearchParamsResult;
|
|
486
|
+
type IUseSearchParamsValueResult = Omit<IUseSearchParamsResult, 'params'> & {
|
|
487
|
+
params: string | null;
|
|
479
488
|
};
|
|
480
489
|
declare function useSearchParamsValue(key: string): IUseSearchParamsValueResult;
|
|
481
490
|
|
|
@@ -486,33 +495,39 @@ declare function updateSearchParamsEncoded(currentPath: string, value: IParamsEn
|
|
|
486
495
|
[key: string]: string;
|
|
487
496
|
};
|
|
488
497
|
};
|
|
489
|
-
declare function replaceSearchParamsEncoded(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
490
498
|
declare function pushSearchParamsEncoded(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
491
|
-
declare function
|
|
499
|
+
declare function pushSearchParamsEncodedSilently(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
500
|
+
declare function replaceSearchParamsEncoded(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
501
|
+
declare function replaceSearchParamsEncodedSilently(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
492
502
|
type IParamsEncoded = {
|
|
493
503
|
[key: string]: any;
|
|
494
504
|
} | null;
|
|
495
505
|
type IUseSearchParamsEncodedResult = {
|
|
496
506
|
params: IParamsEncoded;
|
|
497
|
-
|
|
507
|
+
pushParams: (params: IParamsEncoded) => void;
|
|
508
|
+
pushParamsSilently: (params: IParamsEncoded) => void;
|
|
498
509
|
replaceParams: (params: IParamsEncoded) => void;
|
|
510
|
+
replaceParamsSilently: (params: IParamsEncoded) => void;
|
|
499
511
|
};
|
|
500
512
|
declare function useSearchParamsEncoded(key?: string): IUseSearchParamsEncodedResult;
|
|
501
513
|
|
|
502
514
|
type IParamsQs = Record<string, any>;
|
|
503
515
|
type IUseSearchParamsQsResult = {
|
|
504
516
|
params: IParamsQs;
|
|
505
|
-
|
|
517
|
+
pushParams: (params: IParamsQs) => void;
|
|
518
|
+
pushParamsSilently: (params: IParamsQs) => void;
|
|
506
519
|
replaceParams: (params: IParamsQs) => void;
|
|
520
|
+
replaceParamsSilently: (params: IParamsQs) => void;
|
|
507
521
|
};
|
|
508
522
|
declare function getSearchParamsQs(url: string, key?: string): IParamsQs;
|
|
509
523
|
declare function updateSearchParamsQs(url: string, value: IParamsQs, key?: string): {
|
|
510
524
|
pathname: string;
|
|
511
525
|
query: string;
|
|
512
526
|
};
|
|
513
|
-
declare function replaceSearchParamsQs(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
514
527
|
declare function pushSearchParamsQs(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
515
|
-
declare function
|
|
528
|
+
declare function pushSearchParamsQsSilently(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
529
|
+
declare function replaceSearchParamsQs(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
530
|
+
declare function replaceSearchParamsQsSilently(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
516
531
|
declare function useSearchParamsQs(key?: string): IUseSearchParamsQsResult;
|
|
517
532
|
|
|
518
533
|
type Sorting<T> = {
|
|
@@ -525,6 +540,13 @@ declare function useSorting<T>(items_: T[], callback_: (items: T[], sort?: IEqua
|
|
|
525
540
|
setSort: (sort?: IEquatable) => void;
|
|
526
541
|
};
|
|
527
542
|
|
|
543
|
+
type SSRState = {
|
|
544
|
+
isBrowser: boolean;
|
|
545
|
+
isServer: boolean;
|
|
546
|
+
};
|
|
547
|
+
declare const detectIsBrowser: () => boolean;
|
|
548
|
+
declare function useSSR(): SSRState;
|
|
549
|
+
|
|
528
550
|
/**
|
|
529
551
|
* Like `useRef`, but it returns immutable ref that contains actual value.
|
|
530
552
|
*
|
|
@@ -549,4 +571,4 @@ type WindowSize = {
|
|
|
549
571
|
};
|
|
550
572
|
declare function useWindowSize(): WindowSize;
|
|
551
573
|
|
|
552
|
-
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPaginationInfo, IParams, IParamsEncoded, IParamsQs, IUseSearchParamsEncodedResult, IUseSearchParamsQsResult, IUseSearchParamsResult, IUseSearchParamsValueResult, KeyCode, KeyMod, KeyboardOptions, KeyboardResult, LabelProvider, LabelService, LayoutProvider, LazyModulesProvider, PageProvider, SSRState, SizeResult, SizeType, Sorting, UIReducer, UIValue, UseFiltersResultType, UseKeyboard, UseKeyboardHandler, createElementWithId, createGenericContext, detectIsBrowser, filtersToParams, getCurrentPosition, getFilteredItems, getFilters, getOwnerPaddingRight, getOwnerScrollbarWidth, getPagedItems, getPaginationInfo, getRealSize, getSearchParams, getSearchParamsEncoded, getSearchParamsQs, getUID, hasGeolocation, isElement, isPaginationInfo, localCollectionDelete, localCollectionFetch, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut, parseLabel, parseParams, pushSearchParams, pushSearchParamsEncoded, pushSearchParamsQs, replaceSearchParams, replaceSearchParamsEncoded, replaceSearchParamsEncodedSilently, replaceSearchParamsQs, replaceSearchParamsQsSilently, replaceSearchParamsSilently, scrollToRelativeY, scrollToSelector, scrollToY, setFilters, updateSearchParams, updateSearchParamsEncoded, updateSearchParamsQs, useApi, useApiDelete, useApiFetch, useApiGet, useApiPatch, useApiPost, useApiPut, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePagination, usePortal, usePrevious, useRealSize, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|
|
574
|
+
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPageRoute, IPaginationInfo, IParams, IParamsEncoded, IParamsQs, IUseSearchParamsEncodedResult, IUseSearchParamsQsResult, IUseSearchParamsResult, IUseSearchParamsValueResult, KeyCode, KeyMod, KeyboardOptions, KeyboardResult, LabelProvider, LabelService, LayoutProvider, LazyModulesProvider, PageProvider, SSRState, SizeResult, SizeType, Sorting, UIReducer, UIValue, UseFiltersResultType, UseKeyboard, UseKeyboardHandler, createElementWithId, createGenericContext, detectIsBrowser, filtersToParams, getCurrentPosition, getFilteredItems, getFilters, getOwnerPaddingRight, getOwnerScrollbarWidth, getPagedItems, getPaginationInfo, getRealSize, getSearchParams, getSearchParamsEncoded, getSearchParamsQs, getUID, hasGeolocation, isElement, isPaginationInfo, localCollectionDelete, localCollectionFetch, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut, parseLabel, parseParams, pushSearchParams, pushSearchParamsEncoded, pushSearchParamsEncodedSilently, pushSearchParamsQs, pushSearchParamsQsSilently, pushSearchParamsSilently, replaceSearchParams, replaceSearchParamsEncoded, replaceSearchParamsEncodedSilently, replaceSearchParamsQs, replaceSearchParamsQsSilently, replaceSearchParamsSilently, scrollToRelativeY, scrollToSelector, scrollToY, setFilters, updateSearchParams, updateSearchParamsEncoded, updateSearchParamsQs, useApi, useApiDelete, useApiFetch, useApiGet, useApiPatch, useApiPost, useApiPut, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePageLoading, usePagination, usePortal, usePrevious, useRealSize, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|