redux-paginator-immutable 17.0.39 → 17.0.41
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/lib/Info.d.ts +1 -1
- package/lib/LoadDataItem.d.ts +1 -1
- package/lib/LoadPaginatorTypes.d.ts +6 -6
- package/lib/LoadingButton.d.ts +1 -1
- package/lib/LoadingButton.js +12 -2
- package/lib/LoadingButton.js.map +1 -1
- package/lib/actions.d.ts +3 -3
- package/lib/agent.d.ts +1 -1
- package/lib/createDataReducer.d.ts +2 -2
- package/lib/createItemReducer.d.ts +1 -1
- package/lib/createPaginator.d.ts +4 -4
- package/lib/createPaginator.js +0 -1
- package/lib/createPaginator.js.map +1 -1
- package/lib/reducerItemData.d.ts +1 -1
- package/lib/selectors.d.ts +9 -29
- package/lib/types/actions.d.ts +10 -10
- package/lib/types/index.d.ts +6 -6
- package/lib/types/state.d.ts +3 -3
- package/lib/util.d.ts +4 -4
- package/package.json +14 -13
- package/src/LoadingButton.tsx +15 -1
- package/src/createPaginator.ts +0 -2
package/lib/Info.d.ts
CHANGED
package/lib/LoadDataItem.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
type Settings = {
|
|
3
3
|
key: string;
|
|
4
4
|
rowsPerLoad: number;
|
|
5
5
|
manipulateItems: (items: any) => any;
|
|
@@ -7,18 +7,18 @@ declare type Settings = {
|
|
|
7
7
|
changeView: (data: any) => any;
|
|
8
8
|
requestPage: (page: number, token: string) => any;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type LoadPaginatorPropTypes = {
|
|
11
11
|
token: string;
|
|
12
12
|
settings: Settings;
|
|
13
13
|
children: JSX.Element;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type ChangeView = (info: {
|
|
16
16
|
token: string;
|
|
17
17
|
view: number;
|
|
18
18
|
}) => any;
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
19
|
+
export type ResetView = (token: string) => any;
|
|
20
|
+
export type LoadData = (page: number) => any;
|
|
21
|
+
export type List = {
|
|
22
22
|
token: string;
|
|
23
23
|
settings: Settings;
|
|
24
24
|
paginator: any;
|
package/lib/LoadingButton.d.ts
CHANGED
package/lib/LoadingButton.js
CHANGED
|
@@ -5,12 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const Messages_1 = require("x25/Messages");
|
|
8
|
+
const react_intersection_observer_1 = require("react-intersection-observer");
|
|
8
9
|
const utility_1 = require("x25/utility");
|
|
9
10
|
const LoadingButton = (props) => {
|
|
10
|
-
const { isFetching, hasProblems, onLoadMoreClick } = props
|
|
11
|
+
const { isFetching, hasProblems, onLoadMoreClick } = props, [ref, inView] = (0, react_intersection_observer_1.useInView)({
|
|
12
|
+
// /* Optional options */
|
|
13
|
+
// triggerOnce: true,
|
|
14
|
+
// rootMargin: '0px 0px',
|
|
15
|
+
});
|
|
16
|
+
react_1.default.useEffect(() => {
|
|
17
|
+
if (!isFetching && !hasProblems && inView) {
|
|
18
|
+
onLoadMoreClick();
|
|
19
|
+
}
|
|
20
|
+
}, [isFetching, hasProblems, inView]);
|
|
11
21
|
return (react_1.default.createElement("div", { className: "text-center my-2" },
|
|
12
22
|
hasProblems ? react_1.default.createElement(Messages_1.ErrorMessage, { message: utility_1.words.ThereWasAProblem }) : null,
|
|
13
|
-
isFetching ? react_1.default.createElement(Messages_1.LoadingMessage, { message: utility_1.words.LoadingData, sm: true }) : (react_1.default.createElement("button", { className: "btn btn-outline-info d-print-none", disabled: isFetching, onClick: onLoadMoreClick, type: "button" }, isFetching ? utility_1.words.LoadingData : utility_1.words.LoadMore))));
|
|
23
|
+
isFetching ? react_1.default.createElement(Messages_1.LoadingMessage, { message: utility_1.words.LoadingData, sm: true }) : (react_1.default.createElement("button", { className: "btn btn-outline-info d-print-none", disabled: isFetching, onClick: onLoadMoreClick, ref: ref, type: "button" }, isFetching ? utility_1.words.LoadingData : utility_1.words.LoadMore))));
|
|
14
24
|
};
|
|
15
25
|
exports.default = LoadingButton;
|
|
16
26
|
//# sourceMappingURL=LoadingButton.js.map
|
package/lib/LoadingButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingButton.js","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,2CAA4D;
|
|
1
|
+
{"version":3,"file":"LoadingButton.js","sourceRoot":"","sources":["../src/LoadingButton.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,2CAA4D;AAC5D,6EAAwD;AAOxD,yCAAoC;AAEpC,MAAM,aAAa,GAAG,CAAC,KAA8B,EAAE,EAAE;IACvD,MACE,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,KAAK,EACpD,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,uCAAS,EAAC;IAC1B,yBAAyB;IACzB,qBAAqB;IACrB,yBAAyB;KACxB,CAAC,CAAC;IAEL,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,UAAU,IAAI,CAAC,WAAW,IAAI,MAAM,EAAE;YACzC,eAAe,EAAE,CAAC;SACnB;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtC,OAAO,CACL,uCAAK,SAAS,EAAC,kBAAkB;QAC9B,WAAW,CAAC,CAAC,CAAC,8BAAC,uBAAY,IAAC,OAAO,EAAE,eAAK,CAAC,gBAAgB,GAAI,CAAC,CAAC,CAAC,IAAI;QACtE,UAAU,CAAC,CAAC,CAAC,8BAAC,yBAAc,IAAC,OAAO,EAAE,eAAK,CAAC,WAAW,EAAE,EAAE,SAAG,CAAC,CAAC,CAAC,CAChE,0CACE,SAAS,EAAC,mCAAmC,EAC7C,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,QAAQ,IACZ,UAAU,CAAC,CAAC,CAAC,eAAK,CAAC,WAAW,CAAC,CAAC,CAAC,eAAK,CAAC,QAAQ,CACzC,CACV,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC"}
|
package/lib/actions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Action, EndPointCb } from "./types";
|
|
2
|
-
|
|
2
|
+
type RequestPageArgsTypes = {
|
|
3
3
|
endpoint: string;
|
|
4
4
|
endpointCb: EndPointCb;
|
|
5
5
|
manageEntity: any;
|
|
@@ -10,7 +10,7 @@ declare type RequestPageArgsTypes = {
|
|
|
10
10
|
page: number;
|
|
11
11
|
token: string;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
type ReceivePageArgsTypes = {
|
|
14
14
|
endpoint: string;
|
|
15
15
|
endpointCb: EndPointCb;
|
|
16
16
|
manageEntity: any;
|
|
@@ -22,7 +22,7 @@ declare type ReceivePageArgsTypes = {
|
|
|
22
22
|
total: number;
|
|
23
23
|
error: boolean;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
type FetchDataItem = {
|
|
26
26
|
dataItemURL: string;
|
|
27
27
|
endpoint: string;
|
|
28
28
|
normalizeDataItem: any;
|
package/lib/agent.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PaginatorSettings } from "./types";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Selector = (state: any, id: string) => any;
|
|
3
|
+
type ListSelector = (state: any) => any;
|
|
4
4
|
declare const createDataReducer: ({ key }: PaginatorSettings) => {
|
|
5
5
|
getItems: (state: any) => any;
|
|
6
6
|
getItem: Selector;
|
|
@@ -2,7 +2,7 @@ import type { PaginatorSettings } from "./types";
|
|
|
2
2
|
declare const createReducer: ({ key }: PaginatorSettings) => {
|
|
3
3
|
getItems: (state: any) => any;
|
|
4
4
|
getItem: (state: any, id: string) => any;
|
|
5
|
-
getItemsList: ((state:
|
|
5
|
+
getItemsList: ((state: any) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
6
6
|
clearCache: () => void;
|
|
7
7
|
};
|
|
8
8
|
};
|
package/lib/createPaginator.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PaginatorSettings } from "./types";
|
|
2
|
-
|
|
2
|
+
type EndpointData = {
|
|
3
3
|
path: string;
|
|
4
4
|
cb: () => string;
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
type Endpoint = EndpointData | string;
|
|
7
|
+
type CreatePaginator = (endpoint: Endpoint, info: PaginatorSettings) => any;
|
|
8
|
+
type OnlyForEndpoint = (endpoint: string, reducer: any) => (state: any, action: {
|
|
9
9
|
meta: {
|
|
10
10
|
endpoint: string;
|
|
11
11
|
};
|
package/lib/createPaginator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPaginator.js","sourceRoot":"","sources":["../src/createPaginator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createPaginator.js","sourceRoot":"","sources":["../src/createPaginator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,qDAAuC;AACvC,yCAAyG;AACzG,wDAAgC;AAkBhC,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,EAAE;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO;YACL,IAAI,EAAG,IAAI,CAAC,IAAI;YAChB,EAAE,EAAK,IAAI,CAAC,EAAE;SACf,CAAC;KACH;IAED,OAAO;QACL,IAAI,EAAG,IAAI;QACX,EAAE,EAAK,IAAI;KACZ,CAAC;AACJ,CAAC,CAAC;AAEK,MACL,eAAe,GAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,EAAE;IAC5F,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;QAC3E,OAAO,KAAK,CAAC;KACd;IAED,OAAO,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC,EACD,eAAe,GAAoB,CAAC,YAAsB,EAAE,QAA2B,EAAE,EAAE;IACzF,MACE,EACE,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,UAAU,GACf,GAAG,WAAW,CAAC,YAAY,CAAC,EAC7B,EACE,GAAG,EACH,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,GAAG,OAAO,EAClB,WAAW,GAAG,MAAM,EACpB,KAAK,GAAG,IAAI,EACZ,WAAW,GAAG,kBAAkB,EAChC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GACnC,GAAG,QAAQ,EACZ,iBAAiB,GAAG;QAClB,WAAW,EAAE,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,iBAAO,CAAC,WAAW,CAAC;YAChE,QAAQ;YACR,UAAU;YACV,YAAY;YACZ,UAAU;YACV,QAAQ;YACR,WAAW;YACX,KAAK;YACL,IAAI;YACJ,KAAK;SACN,CAAC;QAEF,SAAS,CAAE,KAAW;YACpB,OAAO,iBAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;QAED,UAAU,CAAE,EAAE,IAAI,EAAE,KAAK,EAAoC;YAC3D,OAAO,iBAAO,CAAC,UAAU,CAAC,QAAQ,EAAE;gBAClC,IAAI;gBACJ,KAAK;aACN,CAAC,CAAC;QACL,CAAC;QAED,SAAS;YACP,OAAO,iBAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;KACF,CAAC;IAEJ,uBACE,GAAG;QACH,iBAAiB;QACjB,WAAW;QACX,eAAe;QACf,WAAW;QACX,YAAY;QACZ,UAAU;QACV,QAAQ,EACR,YAAY,EAAO,IAAA,uBAAe,EAAC,QAAQ,EAAE,gBAAY,CAAC,EAC1D,YAAY,EAAO,IAAA,uBAAe,EAAC,QAAQ,EAAE,gBAAY,CAAC,EAC1D,gBAAgB,EAAG,IAAA,uBAAe,EAAC,QAAQ,EAAE,oBAAgB,CAAC,IAC3D,iBAAiB,EACpB;AACJ,CAAC,CAAC;AApEF,QAAA,eAAe,oBAOf,QAAA,eAAe,mBA6Db"}
|
package/lib/reducerItemData.d.ts
CHANGED
package/lib/selectors.d.ts
CHANGED
|
@@ -1,49 +1,29 @@
|
|
|
1
|
+
import type { State } from "./types";
|
|
1
2
|
declare const _default: {
|
|
2
|
-
getAllResults: ((state: {
|
|
3
|
-
readonly pages: any;
|
|
4
|
-
readonly itemsReducer: any;
|
|
5
|
-
}, params_0: string, params_1: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
|
|
3
|
+
getAllResults: ((state: State, _token: string, items: any) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
|
|
6
4
|
clearCache: () => void;
|
|
7
5
|
};
|
|
8
|
-
getCurrentTotalResultsCount: ((state: {
|
|
9
|
-
readonly pages: any;
|
|
10
|
-
readonly itemsReducer: any;
|
|
11
|
-
}, params_0: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
6
|
+
getCurrentTotalResultsCount: ((state: State, token: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
12
7
|
clearCache: () => void;
|
|
13
8
|
};
|
|
14
|
-
getResultsUpToPage: ((state: {
|
|
15
|
-
readonly pages: any;
|
|
16
|
-
readonly itemsReducer: any;
|
|
17
|
-
}, params_0: string, params_1: {}, params_2: {}, params_3: number) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: number) => any> & {
|
|
9
|
+
getResultsUpToPage: ((state: State, _token: string, _items: any, _target: any, perPage: number) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any, args_2: any, args_3: number) => any> & {
|
|
18
10
|
clearCache: () => void;
|
|
19
11
|
};
|
|
20
|
-
isPageFetching: ((state: {
|
|
21
|
-
readonly pages: any;
|
|
22
|
-
readonly itemsReducer: any;
|
|
23
|
-
}, params_0: string, params_1: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
|
|
12
|
+
isPageFetching: ((state: State, _token: string, target: any) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
|
|
24
13
|
clearCache: () => void;
|
|
25
14
|
};
|
|
26
|
-
isPageFetched: ((state: {
|
|
27
|
-
readonly pages: any;
|
|
28
|
-
readonly itemsReducer: any;
|
|
29
|
-
}, params_0: string, params_1: {}) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
|
|
15
|
+
isPageFetched: ((state: State, _token: string, target: any) => any) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => any> & {
|
|
30
16
|
clearCache: () => void;
|
|
31
17
|
};
|
|
32
|
-
hasPageProblems: ((state: {
|
|
33
|
-
readonly pages: any;
|
|
34
|
-
readonly itemsReducer: any;
|
|
35
|
-
}, params_0: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
18
|
+
hasPageProblems: ((state: State, token: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
36
19
|
clearCache: () => void;
|
|
37
20
|
};
|
|
38
|
-
getCurrentView: ((state: {
|
|
39
|
-
readonly pages: any;
|
|
40
|
-
readonly itemsReducer: any;
|
|
41
|
-
}, params_0: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
21
|
+
getCurrentView: ((state: State, token: string) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
42
22
|
clearCache: () => void;
|
|
43
23
|
};
|
|
44
24
|
getPaginatorPaginations: (state: any, name: string) => any;
|
|
45
25
|
getPaginatorEntities: (state: any, name: string) => any;
|
|
46
|
-
getPaginators: ((state:
|
|
26
|
+
getPaginators: ((state: any, name: string) => {
|
|
47
27
|
list: any;
|
|
48
28
|
entities: any;
|
|
49
29
|
}) & import("reselect").OutputSelectorFields<(args_0: any, args_1: any) => {
|
package/lib/types/actions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EndPointCb } from "./index";
|
|
2
|
-
export
|
|
2
|
+
export type RequestPageAction = {
|
|
3
3
|
type: "@@redux-paginator-immutable/REQUEST_PAGE";
|
|
4
4
|
meta: {
|
|
5
5
|
endpoint: string;
|
|
@@ -15,7 +15,7 @@ export declare type RequestPageAction = {
|
|
|
15
15
|
token: string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type ReceivePageAction = {
|
|
19
19
|
type: "@@redux-paginator-immutable/RECEIVE_PAGE";
|
|
20
20
|
meta: {
|
|
21
21
|
endpoint: string;
|
|
@@ -33,7 +33,7 @@ export declare type ReceivePageAction = {
|
|
|
33
33
|
raw?: string;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type ChangeViewAction = {
|
|
37
37
|
type: "@@redux-paginator-immutable/CHANGE_VIEW";
|
|
38
38
|
meta: {
|
|
39
39
|
endpoint: string;
|
|
@@ -43,7 +43,7 @@ export declare type ChangeViewAction = {
|
|
|
43
43
|
token: string;
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
export
|
|
46
|
+
export type ResetViewAction = {
|
|
47
47
|
type: "@@redux-paginator-immutable/RESET_VIEW";
|
|
48
48
|
meta: {
|
|
49
49
|
endpoint: string;
|
|
@@ -52,28 +52,28 @@ export declare type ResetViewAction = {
|
|
|
52
52
|
token: string;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type ClearDataAction = {
|
|
56
56
|
type: "@@redux-paginator-immutable/CLEAR_DATA";
|
|
57
57
|
meta: {
|
|
58
58
|
endpoint: string;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
export
|
|
61
|
+
export type FetchCurrentCompanyInfoPending = {
|
|
62
62
|
type: "FETCH_CURRENT_COMPANY_INFO_PENDING";
|
|
63
63
|
};
|
|
64
|
-
export
|
|
64
|
+
export type FetchItemDataPending = {
|
|
65
65
|
type: "@@redux-paginator-immutable/FETCH_ITEM_DATA_PENDING";
|
|
66
66
|
meta: {
|
|
67
67
|
id: string;
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
-
export
|
|
70
|
+
export type FetchItemDataRejected = {
|
|
71
71
|
type: "@@redux-paginator-immutable/FETCH_ITEM_DATA_REJECTED";
|
|
72
72
|
meta: {
|
|
73
73
|
id: string;
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
export
|
|
76
|
+
export type FetchItemDataFulFilled = {
|
|
77
77
|
type: "@@redux-paginator-immutable/FETCH_ITEM_DATA_FULFILLED";
|
|
78
78
|
payload: {
|
|
79
79
|
Data: any;
|
|
@@ -82,4 +82,4 @@ export declare type FetchItemDataFulFilled = {
|
|
|
82
82
|
id: string;
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
export
|
|
85
|
+
export type Action = RequestPageAction | ReceivePageAction | ResetViewAction | ChangeViewAction | ClearDataAction | FetchCurrentCompanyInfoPending | FetchItemDataPending | FetchItemDataRejected | FetchItemDataFulFilled;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ export * from "./actions";
|
|
|
2
2
|
export * from "./state";
|
|
3
3
|
import type { State } from "./state";
|
|
4
4
|
import type { Action } from "./actions";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
5
|
+
export type GetState = () => State;
|
|
6
|
+
export type PromiseAction = Promise<Action>;
|
|
7
|
+
export type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
|
|
8
|
+
export type Dispatch = (action: Action | ThunkAction | PromiseAction | Array<Action>) => any;
|
|
9
|
+
export type EndPointCb = ((token?: string) => string) | null;
|
|
10
|
+
export type PaginatorSettings = {
|
|
11
11
|
key: string;
|
|
12
12
|
manageEntity: any;
|
|
13
13
|
resultsKey: string;
|
package/lib/types/state.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type PagesState = any;
|
|
2
|
+
export type ItemsState = any;
|
|
3
|
+
export type State = {
|
|
4
4
|
readonly pages: PagesState;
|
|
5
5
|
readonly itemsReducer: ItemsState;
|
|
6
6
|
};
|
package/lib/util.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
type NormalizrEntity = (data: any) => any;
|
|
2
2
|
import type { Map as ImmutableMap } from "immutable";
|
|
3
|
-
|
|
4
|
-
declare const manageEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateItems: (sortKey?: string) => ((state:
|
|
3
|
+
type ManageDataEntity = ImmutableMap<string, any>;
|
|
4
|
+
declare const manageEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateItems: (sortKey?: string) => ((state: any) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
5
5
|
clearCache: () => void;
|
|
6
|
-
}, manageDataEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateDataItems: (sortKey?: string) => ((state:
|
|
6
|
+
}, manageDataEntity: (normalizrEntity: NormalizrEntity) => (item: any, state: any, keyID: string) => ManageDataEntity, manipulateDataItems: (sortKey?: string) => ((state: any) => any) & import("reselect").OutputSelectorFields<(args_0: any) => any> & {
|
|
7
7
|
clearCache: () => void;
|
|
8
8
|
};
|
|
9
9
|
export { manageDataEntity, manipulateDataItems, manipulateItems, manageEntity };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redux-paginator-immutable",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.41",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"description": "redux-paginator-immutable helps you deal with paginated API by composing your existing reducers",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -76,21 +76,21 @@
|
|
|
76
76
|
},
|
|
77
77
|
"homepage": "https://github.com/cristian-sima/redux-paginator-immutable#readme",
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@babel/preset-env": "^7.
|
|
79
|
+
"@babel/preset-env": "^7.20.2",
|
|
80
80
|
"@babel/preset-typescript": "^7.18.6",
|
|
81
|
-
"@types/superagent": "^4.1.
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
83
|
-
"@typescript-eslint/parser": "^5.
|
|
81
|
+
"@types/superagent": "^4.1.16",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
83
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
84
84
|
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
|
85
85
|
"babel-polyfill": "^6.26.0",
|
|
86
|
-
"chai": "^4.3.
|
|
86
|
+
"chai": "^4.3.7",
|
|
87
87
|
"chai-immutable": "^2.1.0",
|
|
88
88
|
"codecov": "^3.8.1",
|
|
89
89
|
"depcheck": "^1.4.3",
|
|
90
90
|
"es3ify": "^0.2.2",
|
|
91
|
-
"eslint": "^8.
|
|
91
|
+
"eslint": "^8.31.0",
|
|
92
92
|
"eslint-plugin-import": "^2.26.0",
|
|
93
|
-
"eslint-plugin-react": "^7.31.
|
|
93
|
+
"eslint-plugin-react": "^7.31.11",
|
|
94
94
|
"expect": "^28.1.0",
|
|
95
95
|
"flux-standard-action": "^2.1.1",
|
|
96
96
|
"glob": "^8.0.3",
|
|
@@ -99,17 +99,18 @@
|
|
|
99
99
|
"npm-check": "^5.9.2",
|
|
100
100
|
"rimraf": "^3.0.2",
|
|
101
101
|
"ts-mocha": "^10.0.0",
|
|
102
|
-
"typescript": "^4.
|
|
103
|
-
"webpack": "^5.
|
|
102
|
+
"typescript": "^4.9.4",
|
|
103
|
+
"webpack": "^5.75.0"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"immutable": "^3.8.2",
|
|
107
107
|
"query-string": "^7.1.1",
|
|
108
108
|
"react": "^17.0.2",
|
|
109
|
-
"react-
|
|
109
|
+
"react-intersection-observer": "^9.4.1",
|
|
110
|
+
"react-redux": "^8.0.5",
|
|
110
111
|
"redux": "^4.2.0",
|
|
111
|
-
"reselect": "^4.1.
|
|
112
|
+
"reselect": "^4.1.7",
|
|
112
113
|
"superagent": "^7.1.3",
|
|
113
|
-
"x25": "^17.3.
|
|
114
|
+
"x25": "^17.3.13"
|
|
114
115
|
}
|
|
115
116
|
}
|
package/src/LoadingButton.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ErrorMessage, LoadingMessage } from "x25/Messages";
|
|
3
|
+
import { useInView } from "react-intersection-observer";
|
|
3
4
|
|
|
4
5
|
type LoadingButtonPropTypes = {
|
|
5
6
|
isFetching: boolean;
|
|
@@ -9,7 +10,19 @@ type LoadingButtonPropTypes = {
|
|
|
9
10
|
import { words } from "x25/utility";
|
|
10
11
|
|
|
11
12
|
const LoadingButton = (props : LoadingButtonPropTypes) => {
|
|
12
|
-
const
|
|
13
|
+
const
|
|
14
|
+
{ isFetching, hasProblems, onLoadMoreClick } = props,
|
|
15
|
+
[ref, inView] = useInView({
|
|
16
|
+
// /* Optional options */
|
|
17
|
+
// triggerOnce: true,
|
|
18
|
+
// rootMargin: '0px 0px',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
if (!isFetching && !hasProblems && inView) {
|
|
23
|
+
onLoadMoreClick();
|
|
24
|
+
}
|
|
25
|
+
}, [isFetching, hasProblems, inView]);
|
|
13
26
|
|
|
14
27
|
return (
|
|
15
28
|
<div className="text-center my-2">
|
|
@@ -19,6 +32,7 @@ const LoadingButton = (props : LoadingButtonPropTypes) => {
|
|
|
19
32
|
className="btn btn-outline-info d-print-none"
|
|
20
33
|
disabled={isFetching}
|
|
21
34
|
onClick={onLoadMoreClick}
|
|
35
|
+
ref={ref}
|
|
22
36
|
type="button">
|
|
23
37
|
{isFetching ? words.LoadingData : words.LoadMore}
|
|
24
38
|
</button>
|