superdesk-ui-framework 3.0.16 → 3.0.18
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.
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import {Icon} from '../components/Icon';
|
3
3
|
|
4
4
|
interface IProps<T> {
|
5
|
-
getItems(pageNo: number, signal: AbortSignal): Promise<{items: Array<T>, itemCount: number}>;
|
5
|
+
getItems(pageNo: number, pageSize: number, signal: AbortSignal): Promise<{items: Array<T>, itemCount: number}>;
|
6
6
|
children: (items: Array<T>) => JSX.Element;
|
7
7
|
pageSize?: number;
|
8
8
|
}
|
@@ -98,7 +98,7 @@ export class WithPagination<T> extends React.PureComponent<IProps<T>, IState<T>>
|
|
98
98
|
}
|
99
99
|
|
100
100
|
getPageSize() {
|
101
|
-
return this.props.pageSize ??
|
101
|
+
return this.props.pageSize ?? 100;
|
102
102
|
}
|
103
103
|
|
104
104
|
switchPage(page: number) {
|
@@ -107,7 +107,7 @@ export class WithPagination<T> extends React.PureComponent<IProps<T>, IState<T>>
|
|
107
107
|
}
|
108
108
|
|
109
109
|
this.inProgress = true;
|
110
|
-
this.props.getItems(page, this.abortController.signal).then((res) => {
|
110
|
+
this.props.getItems(page, this.getPageSize(), this.abortController.signal).then((res) => {
|
111
111
|
this.inProgress = false;
|
112
112
|
this.setState({items: res.items, currentPage: page}, () => {
|
113
113
|
const scrollableEl = getScrollParent(this.ref);
|
@@ -123,7 +123,7 @@ export class WithPagination<T> extends React.PureComponent<IProps<T>, IState<T>>
|
|
123
123
|
}
|
124
124
|
|
125
125
|
componentDidMount(): void {
|
126
|
-
this.props.getItems(1, this.abortController.signal).then((res) => {
|
126
|
+
this.props.getItems(1, this.getPageSize(), this.abortController.signal).then((res) => {
|
127
127
|
this.pageCount = Math.ceil(res.itemCount / this.getPageSize());
|
128
128
|
this.setState({items: res.items});
|
129
129
|
});
|
@@ -222,9 +222,17 @@ export class WithPagination<T> extends React.PureComponent<IProps<T>, IState<T>>
|
|
222
222
|
this.ref = element;
|
223
223
|
}}
|
224
224
|
>
|
225
|
-
|
226
|
-
|
227
|
-
|
225
|
+
{
|
226
|
+
this.pageCount > 1 ? (
|
227
|
+
<>
|
228
|
+
<StyledPagination />
|
229
|
+
{this.props.children(this.state.items)}
|
230
|
+
<StyledPagination />
|
231
|
+
</>
|
232
|
+
) : (
|
233
|
+
this.props.children(this.state.items)
|
234
|
+
)
|
235
|
+
}
|
228
236
|
</div>
|
229
237
|
);
|
230
238
|
}
|
package/dist/examples.bundle.js
CHANGED
@@ -69400,7 +69400,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
69400
69400
|
}
|
69401
69401
|
WithPagination.prototype.getPageSize = function () {
|
69402
69402
|
var _a;
|
69403
|
-
return (_a = this.props.pageSize) !== null && _a !== void 0 ? _a :
|
69403
|
+
return (_a = this.props.pageSize) !== null && _a !== void 0 ? _a : 100;
|
69404
69404
|
};
|
69405
69405
|
WithPagination.prototype.switchPage = function (page) {
|
69406
69406
|
var _this = this;
|
@@ -69408,7 +69408,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
69408
69408
|
this.abortController.abort();
|
69409
69409
|
}
|
69410
69410
|
this.inProgress = true;
|
69411
|
-
this.props.getItems(page, this.abortController.signal).then(function (res) {
|
69411
|
+
this.props.getItems(page, this.getPageSize(), this.abortController.signal).then(function (res) {
|
69412
69412
|
_this.inProgress = false;
|
69413
69413
|
_this.setState({ items: res.items, currentPage: page }, function () {
|
69414
69414
|
var _a;
|
@@ -69424,7 +69424,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
69424
69424
|
};
|
69425
69425
|
WithPagination.prototype.componentDidMount = function () {
|
69426
69426
|
var _this = this;
|
69427
|
-
this.props.getItems(1, this.abortController.signal).then(function (res) {
|
69427
|
+
this.props.getItems(1, this.getPageSize(), this.abortController.signal).then(function (res) {
|
69428
69428
|
_this.pageCount = Math.ceil(res.itemCount / _this.getPageSize());
|
69429
69429
|
_this.setState({ items: res.items });
|
69430
69430
|
});
|
@@ -69466,10 +69466,10 @@ var WithPagination = /** @class */ (function (_super) {
|
|
69466
69466
|
flexDirection: 'column',
|
69467
69467
|
}, ref: function (element) {
|
69468
69468
|
_this.ref = element;
|
69469
|
-
} },
|
69469
|
+
} }, this.pageCount > 1 ? (React.createElement(React.Fragment, null,
|
69470
69470
|
React.createElement(StyledPagination, null),
|
69471
69471
|
this.props.children(this.state.items),
|
69472
|
-
React.createElement(StyledPagination, null)));
|
69472
|
+
React.createElement(StyledPagination, null))) : (this.props.children(this.state.items))));
|
69473
69473
|
};
|
69474
69474
|
return WithPagination;
|
69475
69475
|
}(React.PureComponent));
|
@@ -142075,7 +142075,7 @@ exports.ResizablePanelsDoc = ResizablePanelsDoc;
|
|
142075
142075
|
/* 670 */
|
142076
142076
|
/***/ (function(module, exports) {
|
142077
142077
|
|
142078
|
-
module.exports = {"name":"superdesk-ui-framework","version":"3.0.
|
142078
|
+
module.exports = {"name":"superdesk-ui-framework","version":"3.0.18","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build","unit-test":"mocha","debug-unit-tests":"mocha --inspect-brk"},"devDependencies":{"@types/assert":"^1.5.6","@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.12","@types/lodash":"^4.14.161","@types/mocha":"^9.1.1","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"^5.58.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","jsdom":"20.0.3","jsdom-global":"3.0.2","lodash":"4.17.21","mocha":"^8.4.0","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-bootstrap":"^0.31.2","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","ts-node":"^10.9.1","tslint":"^5.18.0","typescript":"4.9.5","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@material-ui/lab":"^4.0.0-alpha.56","@popperjs/core":"^2.4.0","@superdesk/primereact":"^5.0.2-10","@superdesk/react-resizable-panels":"0.0.39","@types/enzyme-adapter-react-16":"^1.0.6","@types/node":"^14.10.2","chart.js":"^2.9.3","date-fns":"2.7.0","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","moment":"^2.29.3","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-popper":"^2.2.3","react-scrollspy":"^3.4.3"}}
|
142079
142079
|
|
142080
142080
|
/***/ }),
|
142081
142081
|
/* 671 */
|
@@ -68661,7 +68661,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
68661
68661
|
}
|
68662
68662
|
WithPagination.prototype.getPageSize = function () {
|
68663
68663
|
var _a;
|
68664
|
-
return (_a = this.props.pageSize) !== null && _a !== void 0 ? _a :
|
68664
|
+
return (_a = this.props.pageSize) !== null && _a !== void 0 ? _a : 100;
|
68665
68665
|
};
|
68666
68666
|
WithPagination.prototype.switchPage = function (page) {
|
68667
68667
|
var _this = this;
|
@@ -68669,7 +68669,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
68669
68669
|
this.abortController.abort();
|
68670
68670
|
}
|
68671
68671
|
this.inProgress = true;
|
68672
|
-
this.props.getItems(page, this.abortController.signal).then(function (res) {
|
68672
|
+
this.props.getItems(page, this.getPageSize(), this.abortController.signal).then(function (res) {
|
68673
68673
|
_this.inProgress = false;
|
68674
68674
|
_this.setState({ items: res.items, currentPage: page }, function () {
|
68675
68675
|
var _a;
|
@@ -68685,7 +68685,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
68685
68685
|
};
|
68686
68686
|
WithPagination.prototype.componentDidMount = function () {
|
68687
68687
|
var _this = this;
|
68688
|
-
this.props.getItems(1, this.abortController.signal).then(function (res) {
|
68688
|
+
this.props.getItems(1, this.getPageSize(), this.abortController.signal).then(function (res) {
|
68689
68689
|
_this.pageCount = Math.ceil(res.itemCount / _this.getPageSize());
|
68690
68690
|
_this.setState({ items: res.items });
|
68691
68691
|
});
|
@@ -68727,10 +68727,10 @@ var WithPagination = /** @class */ (function (_super) {
|
|
68727
68727
|
flexDirection: 'column',
|
68728
68728
|
}, ref: function (element) {
|
68729
68729
|
_this.ref = element;
|
68730
|
-
} },
|
68730
|
+
} }, this.pageCount > 1 ? (React.createElement(React.Fragment, null,
|
68731
68731
|
React.createElement(StyledPagination, null),
|
68732
68732
|
this.props.children(this.state.items),
|
68733
|
-
React.createElement(StyledPagination, null)));
|
68733
|
+
React.createElement(StyledPagination, null))) : (this.props.children(this.state.items))));
|
68734
68734
|
};
|
68735
68735
|
return WithPagination;
|
68736
68736
|
}(React.PureComponent));
|
package/package.json
CHANGED
@@ -115,7 +115,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
115
115
|
}
|
116
116
|
WithPagination.prototype.getPageSize = function () {
|
117
117
|
var _a;
|
118
|
-
return (_a = this.props.pageSize) !== null && _a !== void 0 ? _a :
|
118
|
+
return (_a = this.props.pageSize) !== null && _a !== void 0 ? _a : 100;
|
119
119
|
};
|
120
120
|
WithPagination.prototype.switchPage = function (page) {
|
121
121
|
var _this = this;
|
@@ -123,7 +123,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
123
123
|
this.abortController.abort();
|
124
124
|
}
|
125
125
|
this.inProgress = true;
|
126
|
-
this.props.getItems(page, this.abortController.signal).then(function (res) {
|
126
|
+
this.props.getItems(page, this.getPageSize(), this.abortController.signal).then(function (res) {
|
127
127
|
_this.inProgress = false;
|
128
128
|
_this.setState({ items: res.items, currentPage: page }, function () {
|
129
129
|
var _a;
|
@@ -139,7 +139,7 @@ var WithPagination = /** @class */ (function (_super) {
|
|
139
139
|
};
|
140
140
|
WithPagination.prototype.componentDidMount = function () {
|
141
141
|
var _this = this;
|
142
|
-
this.props.getItems(1, this.abortController.signal).then(function (res) {
|
142
|
+
this.props.getItems(1, this.getPageSize(), this.abortController.signal).then(function (res) {
|
143
143
|
_this.pageCount = Math.ceil(res.itemCount / _this.getPageSize());
|
144
144
|
_this.setState({ items: res.items });
|
145
145
|
});
|
@@ -181,10 +181,10 @@ var WithPagination = /** @class */ (function (_super) {
|
|
181
181
|
flexDirection: 'column',
|
182
182
|
}, ref: function (element) {
|
183
183
|
_this.ref = element;
|
184
|
-
} },
|
184
|
+
} }, this.pageCount > 1 ? (React.createElement(React.Fragment, null,
|
185
185
|
React.createElement(StyledPagination, null),
|
186
186
|
this.props.children(this.state.items),
|
187
|
-
React.createElement(StyledPagination, null)));
|
187
|
+
React.createElement(StyledPagination, null))) : (this.props.children(this.state.items))));
|
188
188
|
};
|
189
189
|
return WithPagination;
|
190
190
|
}(React.PureComponent));
|