Skip to content

Commit

Permalink
Merge pull request #106 from SteJaySulli/feature/always-show-pagination
Browse files Browse the repository at this point in the history
Feature to always show pagination
  • Loading branch information
SteJaySulli authored Sep 6, 2021
2 parents 61d5462 + 2a37c8a commit 94cd51e
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 247 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,16 @@ This delta can be changed by passing a `paginationDelta` prop into `DynamicDataT
/>
```

### Always showing pagination controls

By default the pagination controls are only shown if there are two or more pages of data to be displayed. You can override this behaviour by simply passing the `alwaysShowPagination` prop:

```JSX
<DynamicDataTable
alwaysShowPagination
/>
```

### Per page limiting

Changing the number of entries displaying in the data table is easy. The `totalRows`, `perPage`, `changePerPage` and `perPageRenderer` allow you to customize a per page limit control.
Expand Down
127 changes: 62 additions & 65 deletions dist/AjaxDynamicDataTable.js
Original file line number Diff line number Diff line change
@@ -1,99 +1,96 @@
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

require("core-js/modules/es6.reflect.construct.js");
require("core-js/modules/es6.weak-map");

require("core-js/modules/es6.object.create.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;

require("core-js/modules/es6.object.define-property.js");
require("core-js/modules/es6.function.name");

require("core-js/modules/es6.array.is-array.js");
require("core-js/modules/es6.string.iterator");

require("core-js/modules/es6.symbol.js");
require("core-js/modules/es6.array.from");

require("core-js/modules/es6.string.iterator.js");
require("core-js/modules/es7.symbol.async-iterator");

require("core-js/modules/es6.object.to-string.js");
require("core-js/modules/es6.array.is-array");

require("core-js/modules/es6.array.iterator.js");
require("core-js/modules/es6.object.assign");

require("core-js/modules/web.dom.iterable.js");
require("core-js/modules/es6.array.index-of");

require("core-js/modules/es6.array.from.js");
require("core-js/modules/es6.object.define-properties");

require("core-js/modules/es6.array.slice.js");
require("core-js/modules/es7.object.get-own-property-descriptors");

require("core-js/modules/es6.function.name.js");
require("core-js/modules/es6.array.for-each");

require("core-js/modules/es6.object.keys.js");
require("core-js/modules/es6.array.filter");

require("core-js/modules/es6.array.filter.js");
require("core-js/modules/es6.symbol");

require("core-js/modules/es6.object.get-own-property-descriptor.js");
require("core-js/modules/web.dom.iterable");

require("core-js/modules/es6.array.for-each.js");
require("core-js/modules/es6.array.iterator");

require("core-js/modules/es7.object.get-own-property-descriptors.js");
require("core-js/modules/es6.object.keys");

require("core-js/modules/es6.object.define-properties.js");
require("core-js/modules/es6.object.define-property");

require("core-js/modules/es6.array.index-of.js");
require("core-js/modules/es6.object.create");

require("core-js/modules/es6.object.assign.js");
require("core-js/modules/es6.regexp.to-string");

require("core-js/modules/es6.weak-map.js");
require("core-js/modules/es6.date.to-string");

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
require("core-js/modules/es6.object.to-string");

require("core-js/modules/es6.function.bind.js");
require("core-js/modules/es6.reflect.construct");

require("core-js/modules/es6.object.set-prototype-of.js");
require("core-js/modules/es6.object.set-prototype-of");

require("core-js/modules/es6.object.get-prototype-of.js");
require("core-js/modules/es6.function.bind");

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _DynamicDataTable = _interopRequireDefault(require("./DynamicDataTable"));

var _excluded = ["disallowOrderingBy", "footer", "perPage"],
_excluded2 = ["disallow_ordering_by"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _extends() { _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; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _extends() { _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; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
Expand All @@ -110,7 +107,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

Expand Down Expand Up @@ -160,20 +157,6 @@ var AjaxDynamicDataTable = /*#__PURE__*/function (_Component) {
this.loadPage(1);
}
}
}, {
key: "loading",
get: function get() {
var state = this.state.loading;
var prop = this.props.loading;
return state || prop;
}
}, {
key: "disallowOrderingBy",
get: function get() {
var state = this.state.disallowOrderingBy;
var prop = this.props.disallowOrderingBy;
return [].concat(_toConsumableArray(state), _toConsumableArray(prop));
}
}, {
key: "renderFooter",
value: function renderFooter(args) {
Expand Down Expand Up @@ -203,9 +186,9 @@ var AjaxDynamicDataTable = /*#__PURE__*/function (_Component) {
disallowOrderingBy = _this$props.disallowOrderingBy,
footer = _this$props.footer,
perPage = _this$props.perPage,
props = _objectWithoutProperties(_this$props, _excluded);
props = _objectWithoutProperties(_this$props, ["disallowOrderingBy", "footer", "perPage"]);

return _react["default"].createElement(_DynamicDataTable["default"], _extends({
return /*#__PURE__*/_react["default"].createElement(_DynamicDataTable["default"], _extends({
rows: rows,
totalRows: totalRows,
currentPage: currentPage,
Expand Down Expand Up @@ -264,7 +247,7 @@ var AjaxDynamicDataTable = /*#__PURE__*/function (_Component) {
if (response.meta) {
var _response$meta = response.meta;
disallow_ordering_by = _response$meta.disallow_ordering_by;
meta = _objectWithoutProperties(_response$meta, _excluded2);
meta = _objectWithoutProperties(_response$meta, ["disallow_ordering_by"]);
_response$meta;
}

Expand Down Expand Up @@ -314,6 +297,20 @@ var AjaxDynamicDataTable = /*#__PURE__*/function (_Component) {
_this3.loadPage(1);
});
}
}, {
key: "loading",
get: function get() {
var state = this.state.loading;
var prop = this.props.loading;
return state || prop;
}
}, {
key: "disallowOrderingBy",
get: function get() {
var state = this.state.disallowOrderingBy;
var prop = this.props.disallowOrderingBy;
return [].concat(_toConsumableArray(state), _toConsumableArray(prop));
}
}]);

return AjaxDynamicDataTable;
Expand Down
Loading

0 comments on commit 94cd51e

Please sign in to comment.