redux-paginator-immutable 17.0.0 → 17.0.4

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.js CHANGED
@@ -17,7 +17,7 @@ var getNumberForm = function getNumberForm(value, one, all) {
17
17
  return "1 " + one;
18
18
  }
19
19
 
20
- return (0, _utility.numberToLocaleForm)(value) + " " + all;
20
+ return _utility.words.getNumberTense(value) + " " + all;
21
21
  };
22
22
 
23
23
  var Info = function Info(_ref) {
@@ -28,8 +28,8 @@ var Info = function Info(_ref) {
28
28
  return _react2.default.createElement(
29
29
  "div",
30
30
  { className: "text-muted" },
31
- "Afișez ",
32
- shown === total ? "tot - " : shown + " din",
31
+ _utility.words.Showing + " ",
32
+ shown === total ? _utility.words.All + " - " : shown + " " + _utility.words.Of,
33
33
  " " + getNumberForm(total, one, all)
34
34
  );
35
35
  };
@@ -6,18 +6,49 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
8
8
 
9
+ // import {
10
+ // useLocation,
11
+ // useNavigate,
12
+ // useParams,
13
+ // } from "react-router-dom";
14
+
15
+ // const withRouter = (Component) => {
16
+ // const ComponentWithRouterProp = (props) => {
17
+ // const location = useLocation();
18
+ // const navigate = useNavigate();
19
+ // const params = useParams();
20
+
21
+ // return (
22
+ // <Component
23
+ // {...props}
24
+ // router={{
25
+ // location,
26
+ // navigate,
27
+ // params,
28
+ // }}
29
+ // />
30
+ // );
31
+ // };
32
+
33
+ // return ComponentWithRouterProp;
34
+ // };
35
+
9
36
  var _react = require("react");
10
37
 
11
38
  var React = _interopRequireWildcard(_react);
12
39
 
13
- var _reactRouterDom = require("react-router-dom");
14
-
15
40
  var _reactRedux = require("react-redux");
16
41
 
17
42
  var _actions = require("./actions");
18
43
 
19
44
  var _Messages = require("x25/Messages");
20
45
 
46
+ var _words = require("./words");
47
+
48
+ var _words2 = _interopRequireDefault(_words);
49
+
50
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
51
+
21
52
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
22
53
 
23
54
  var mapStateToProps = function mapStateToProps(state, _ref) {
@@ -59,12 +90,12 @@ var LoadDataItem = function LoadDataItem(props) {
59
90
  }, [shouldFetch, isFetching, hasError]);
60
91
 
61
92
  if (isFetching) {
62
- return React.createElement(_Messages.LoadingMessage, { message: "Preiau datele..." });
93
+ return React.createElement(_Messages.LoadingMessage, { message: _words2.default.LoadingData });
63
94
  }
64
95
 
65
96
  if (hasError) {
66
97
  return React.createElement(_Messages.LargeErrorMessage, {
67
- message: "Nu am putut stabili conexiunea cu server-ul",
98
+ message: _words2.default.ThereWasAProblem,
68
99
  onRetry: fetchItem
69
100
  });
70
101
  }
@@ -76,4 +107,4 @@ var LoadDataItem = function LoadDataItem(props) {
76
107
  return children;
77
108
  };
78
109
 
79
- exports.default = (0, _reactRouterDom.withRouter)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(LoadDataItem));
110
+ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(LoadDataItem);
@@ -31,6 +31,10 @@ var _LoadingButton2 = _interopRequireDefault(_LoadingButton);
31
31
 
32
32
  var _Messages = require("x25/Messages");
33
33
 
34
+ var _words = require("./words");
35
+
36
+ var _words2 = _interopRequireDefault(_words);
37
+
34
38
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
35
39
 
36
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -183,12 +187,12 @@ var LoadPaginator = function (_Component) {
183
187
  showLoading = total !== items.size;
184
188
 
185
189
  if (isEmpty && isFetching) {
186
- return _react2.default.createElement(_Messages.LoadingMessage, { message: "Preiau datele..." });
190
+ return _react2.default.createElement(_Messages.LoadingMessage, { message: _words2.default.LoadingData });
187
191
  }
188
192
 
189
193
  if (hasProblems && currentPage === 1) {
190
194
  return _react2.default.createElement(_Messages.LargeErrorMessage, {
191
- message: "Nu pot prelua datele",
195
+ message: _words2.default.ThereWasAProblem,
192
196
  onRetry: this.handleLoadMoreClick
193
197
  });
194
198
  }
@@ -12,6 +12,10 @@ var _react2 = _interopRequireDefault(_react);
12
12
 
13
13
  var _Messages = require("x25/Messages");
14
14
 
15
+ var _words = require("./words");
16
+
17
+ var _words2 = _interopRequireDefault(_words);
18
+
15
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
20
 
17
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -51,15 +55,15 @@ var LoadingButton = function (_React$Component) {
51
55
  return _react2.default.createElement(
52
56
  "div",
53
57
  { className: "text-center my-2" },
54
- hasProblems ? _react2.default.createElement(_Messages.ErrorMessage, { message: "Nu am putut prelua. \xCEncearc\u0103 \xEEnc\u0103 o dat\u0103..." }) : null,
55
- isFetching ? _react2.default.createElement(_Messages.LoadingMessage, { message: "Preiau date...", sm: true }) : _react2.default.createElement(
58
+ hasProblems ? _react2.default.createElement(_Messages.ErrorMessage, { message: _words2.default.ThereWasAProblem }) : null,
59
+ isFetching ? _react2.default.createElement(_Messages.LoadingMessage, { message: _words2.default.LoadingData, sm: true }) : _react2.default.createElement(
56
60
  "button",
57
61
  {
58
62
  className: "btn btn-outline-info d-print-none",
59
63
  disabled: isFetching,
60
64
  onClick: onLoadMoreClick,
61
65
  type: "button" },
62
- isFetching ? "Încarc..." : "Încarcă mai mule"
66
+ isFetching ? _words2.default.Loading : _words2.default.LoadMore
63
67
  )
64
68
  );
65
69
  }
package/lib/words.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var words = {
7
+ ThereWasAProblem: "There was a problem. Try again",
8
+ Showing: "Showing",
9
+ All: "all",
10
+ Of: "of",
11
+ LoadingData: "Loading data...",
12
+ LoadMore: "Load more"
13
+ };
14
+
15
+ exports.default = words;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redux-paginator-immutable",
3
- "version": "17.0.0",
3
+ "version": "17.0.4",
4
4
  "description": "redux-paginator-immutable helps you deal with paginated API by composing your existing reducers",
5
5
  "main": "./lib/index.js",
6
6
  "babel": {
@@ -103,6 +103,6 @@
103
103
  "redux": "^4.1.2",
104
104
  "reselect": "^4.1.5",
105
105
  "superagent": "^7.1.1",
106
- "x25": "^17.0.0"
106
+ "x25": "^17.0.15"
107
107
  }
108
108
  }
package/src/Info.jsx CHANGED
@@ -1,5 +1,6 @@
1
1
  // @flow
2
2
 
3
+
3
4
  type InfoPropTypes = {
4
5
  shown: number;
5
6
  total: number;
@@ -8,21 +9,21 @@ type InfoPropTypes = {
8
9
  };
9
10
 
10
11
  import React from "react";
11
- import { numberToLocaleForm } from "x25/utility";
12
+ import { words } from "x25/utility";
12
13
 
13
14
  const getNumberForm = (value : number, one : string, all : string) : string => {
14
15
  if (value === 1) {
15
16
  return `1 ${one}`;
16
17
  }
17
18
 
18
- return `${numberToLocaleForm(value)} ${all}`;
19
+ return `${words.getNumberTense(value)} ${all}`;
19
20
  };
20
21
 
21
22
  const Info = ({ shown, total, one, all } : InfoPropTypes) => (
22
23
  <div className="text-muted">
23
- {"Afișez "}
24
+ {`${words.Showing} `}
24
25
  {
25
- (shown === total) ? "tot - " : `${shown} din`
26
+ (shown === total) ? `${words.All} - ` : `${shown} ${words.Of}`
26
27
  }
27
28
  {` ${getNumberForm(total, one, all)}`}
28
29
  </div>
@@ -25,12 +25,39 @@ type OwnProps = {
25
25
  }
26
26
  };
27
27
 
28
- import { withRouter } from "react-router-dom";
29
28
  import { connect } from "react-redux";
30
29
 
30
+ // import {
31
+ // useLocation,
32
+ // useNavigate,
33
+ // useParams,
34
+ // } from "react-router-dom";
35
+
36
+ // const withRouter = (Component) => {
37
+ // const ComponentWithRouterProp = (props) => {
38
+ // const location = useLocation();
39
+ // const navigate = useNavigate();
40
+ // const params = useParams();
41
+
42
+ // return (
43
+ // <Component
44
+ // {...props}
45
+ // router={{
46
+ // location,
47
+ // navigate,
48
+ // params,
49
+ // }}
50
+ // />
51
+ // );
52
+ // };
53
+
54
+ // return ComponentWithRouterProp;
55
+ // };
56
+
31
57
  import { fetchItem as fetchItemAction } from "./actions";
32
58
 
33
59
  import { LargeErrorMessage, LoadingMessage } from "x25/Messages";
60
+ import words from "./words";
34
61
 
35
62
  const
36
63
  mapStateToProps = (state : any, { settings : { selectors }, id } : OwnProps) => ({
@@ -64,14 +91,14 @@ const LoadDataItem = (props : LoadDataItemPropTypes) => {
64
91
 
65
92
  if (isFetching) {
66
93
  return (
67
- <LoadingMessage message="Preiau datele..." />
94
+ <LoadingMessage message={words.LoadingData} />
68
95
  );
69
96
  }
70
97
 
71
98
  if (hasError) {
72
99
  return (
73
100
  <LargeErrorMessage
74
- message="Nu am putut stabili conexiunea cu server-ul"
101
+ message={words.ThereWasAProblem}
75
102
  onRetry={fetchItem}
76
103
  />
77
104
  );
@@ -86,4 +113,4 @@ const LoadDataItem = (props : LoadDataItemPropTypes) => {
86
113
  );
87
114
  };
88
115
 
89
- export default withRouter(connect(mapStateToProps, mapDispatchToProps)(LoadDataItem));
116
+ export default connect(mapStateToProps, mapDispatchToProps)(LoadDataItem);
@@ -47,6 +47,7 @@ import selectors from "./selectors";
47
47
  import LoadingButton from "./LoadingButton";
48
48
 
49
49
  import { LargeErrorMessage, LoadingMessage } from "x25/Messages";
50
+ import words from "./words";
50
51
 
51
52
  const mapStateToProps = (state, { token, settings } : OwnProps) => {
52
53
 
@@ -175,14 +176,14 @@ class LoadPaginator extends Component<LoadPaginatorPropTypes> {
175
176
 
176
177
  if (isEmpty && isFetching) {
177
178
  return (
178
- <LoadingMessage message="Preiau datele..." />
179
+ <LoadingMessage message={words.LoadingData} />
179
180
  );
180
181
  }
181
182
 
182
183
  if (hasProblems && currentPage === 1) {
183
184
  return (
184
185
  <LargeErrorMessage
185
- message="Nu pot prelua datele"
186
+ message={words.ThereWasAProblem}
186
187
  onRetry={this.handleLoadMoreClick}
187
188
  />
188
189
  );
@@ -1,6 +1,7 @@
1
1
  // @flow
2
2
 
3
3
  import React from "react";
4
+ import { ErrorMessage, LoadingMessage } from "x25/Messages";
4
5
 
5
6
  type LoadingButtonPropTypes = {
6
7
  isFetching: bool;
@@ -9,7 +10,7 @@ type LoadingButtonPropTypes = {
9
10
  onLoadMoreClick: () => void;
10
11
  };
11
12
 
12
- import { ErrorMessage, LoadingMessage } from "x25/Messages";
13
+ import words from "./words";
13
14
 
14
15
  class LoadingButton extends React.Component<LoadingButtonPropTypes> {
15
16
  props: LoadingButtonPropTypes;
@@ -30,19 +31,19 @@ class LoadingButton extends React.Component<LoadingButtonPropTypes> {
30
31
  <div className="text-center my-2">
31
32
  {
32
33
  hasProblems ? (
33
- <ErrorMessage message="Nu am putut prelua. Încearcă încă o dată..." />
34
+ <ErrorMessage message={words.ThereWasAProblem} />
34
35
  ) : null
35
36
  }
36
37
  {
37
38
  isFetching ? (
38
- <LoadingMessage message="Preiau date..." sm />
39
+ <LoadingMessage message={words.LoadingData} sm />
39
40
  ) : (
40
41
  <button
41
42
  className="btn btn-outline-info d-print-none"
42
43
  disabled={isFetching}
43
44
  onClick={onLoadMoreClick}
44
45
  type="button">
45
- {isFetching ? "Încarc..." : "Încarcă mai mule"}
46
+ {isFetching ? words.Loading : words.LoadMore}
46
47
  </button>
47
48
  )
48
49
  }
package/src/words.js ADDED
@@ -0,0 +1,12 @@
1
+ // @flow
2
+
3
+ const words = {
4
+ ThereWasAProblem : "There was a problem. Try again",
5
+ Showing : "Showing",
6
+ All : "all",
7
+ Of : "of",
8
+ LoadingData : "Loading data...",
9
+ LoadMore : "Load more",
10
+ };
11
+
12
+ export default words;