@dnb/eufemia 9.16.2 → 9.16.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 +10 -0
- package/cjs/components/input-masked/InputMaskedHooks.js +3 -2
- package/cjs/components/input-masked/InputMaskedUtils.js +2 -2
- package/cjs/components/pagination/Pagination.d.ts +6 -0
- package/cjs/components/pagination/Pagination.js +2 -0
- package/cjs/components/pagination/PaginationBar.js +1 -1
- package/cjs/components/pagination/PaginationInfinity.js +152 -89
- package/cjs/components/pagination/PaginationProvider.js +65 -68
- package/cjs/components/tabs/style/_tabs.scss +5 -1
- package/cjs/components/tabs/style/dnb-tabs.css +4 -1
- package/cjs/components/tabs/style/dnb-tabs.min.css +1 -1
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.css +37 -34
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
- package/cjs/components/tabs/style/themes/dnb-tabs-theme-ui.scss +12 -9
- package/cjs/shared/component-helper.js +3 -1
- package/cjs/shared/helpers.js +23 -12
- package/cjs/style/dnb-ui-components.css +4 -1
- package/cjs/style/dnb-ui-components.min.css +1 -1
- package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.css +37 -34
- package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +37 -34
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/components/input-masked/InputMaskedHooks.js +3 -2
- package/components/input-masked/InputMaskedUtils.js +3 -3
- package/components/pagination/Pagination.d.ts +6 -0
- package/components/pagination/Pagination.js +2 -0
- package/components/pagination/PaginationBar.js +1 -1
- package/components/pagination/PaginationInfinity.js +137 -67
- package/components/pagination/PaginationProvider.js +64 -68
- package/components/tabs/style/_tabs.scss +5 -1
- package/components/tabs/style/dnb-tabs.css +4 -1
- package/components/tabs/style/dnb-tabs.min.css +1 -1
- package/components/tabs/style/themes/dnb-tabs-theme-ui.css +37 -34
- package/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
- package/components/tabs/style/themes/dnb-tabs-theme-ui.scss +12 -9
- package/es/components/input-masked/InputMaskedHooks.js +3 -2
- package/es/components/input-masked/InputMaskedUtils.js +3 -3
- package/es/components/pagination/Pagination.d.ts +6 -0
- package/es/components/pagination/Pagination.js +2 -0
- package/es/components/pagination/PaginationBar.js +1 -1
- package/es/components/pagination/PaginationInfinity.js +110 -37
- package/es/components/pagination/PaginationProvider.js +57 -61
- package/es/components/tabs/style/_tabs.scss +5 -1
- package/es/components/tabs/style/dnb-tabs.css +4 -1
- package/es/components/tabs/style/dnb-tabs.min.css +1 -1
- package/es/components/tabs/style/themes/dnb-tabs-theme-ui.css +37 -34
- package/es/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
- package/es/components/tabs/style/themes/dnb-tabs-theme-ui.scss +12 -9
- package/es/shared/component-helper.js +1 -0
- package/es/shared/helpers.js +18 -11
- package/es/style/dnb-ui-components.css +4 -1
- package/es/style/dnb-ui-components.min.css +1 -1
- package/es/style/themes/theme-open-banking/dnb-theme-open-banking.css +37 -34
- package/es/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/es/style/themes/theme-ui/dnb-theme-ui.css +37 -34
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/esm/components/input-masked/InputMaskedHooks.js +3 -2
- package/esm/components/input-masked/InputMaskedUtils.js +3 -3
- package/esm/components/pagination/Pagination.d.ts +6 -0
- package/esm/components/pagination/Pagination.js +2 -0
- package/esm/components/pagination/PaginationBar.js +1 -1
- package/esm/components/pagination/PaginationInfinity.js +137 -67
- package/esm/components/pagination/PaginationProvider.js +64 -68
- package/esm/components/tabs/style/_tabs.scss +5 -1
- package/esm/components/tabs/style/dnb-tabs.css +4 -1
- package/esm/components/tabs/style/dnb-tabs.min.css +1 -1
- package/esm/components/tabs/style/themes/dnb-tabs-theme-ui.css +37 -34
- package/esm/components/tabs/style/themes/dnb-tabs-theme-ui.min.css +1 -1
- package/esm/components/tabs/style/themes/dnb-tabs-theme-ui.scss +12 -9
- package/esm/dnb-ui-components.min.mjs +3 -3
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +1 -1
- package/esm/dnb-ui-lib.min.mjs +3 -3
- package/esm/dnb-ui-web-components.min.mjs +3 -3
- package/esm/shared/component-helper.js +1 -0
- package/esm/shared/helpers.js +18 -11
- package/esm/style/dnb-ui-components.css +4 -1
- package/esm/style/dnb-ui-components.min.css +1 -1
- package/esm/style/themes/theme-open-banking/dnb-theme-open-banking.css +37 -34
- package/esm/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/esm/style/themes/theme-ui/dnb-theme-ui.css +37 -34
- package/esm/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/package.json +2 -2
- package/shared/component-helper.js +1 -0
- package/shared/helpers.js +18 -11
- package/style/dnb-ui-components.css +4 -1
- package/style/dnb-ui-components.min.css +1 -1
- package/style/themes/theme-open-banking/dnb-theme-open-banking.css +37 -34
- package/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/style/themes/theme-ui/dnb-theme-ui.css +37 -34
- package/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/umd/dnb-ui-components.min.js +4 -4
- package/umd/dnb-ui-elements.min.js +3 -3
- package/umd/dnb-ui-extensions.min.js +1 -1
- package/umd/dnb-ui-lib.min.js +1 -1
- package/umd/dnb-ui-web-components.min.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to @dnb/eufemia will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.16.3](https://github.com/dnbexperience/eufemia/compare/v9.16.2...v9.16.3) (2021-11-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix pagination indicator and load button issue ([c672251](https://github.com/dnbexperience/eufemia/commit/c6722514d990603d5ebf350bf6bda6da1ccf7141))
|
|
12
|
+
* **InputMasked:** enhance handling of decimals with a following zero ([6ed6e75](https://github.com/dnbexperience/eufemia/commit/6ed6e7565d46b60c010c05686e67f07abead60d4))
|
|
13
|
+
* **InputMasked:** fix Android keyCode issue by using the keypress event ([0028e6f](https://github.com/dnbexperience/eufemia/commit/0028e6fd8c1d625d6b5576fcc15dfca8ed2d6de1))
|
|
14
|
+
* **Tabs:** Larger spacing to line + changed focus design ([3f093e6](https://github.com/dnbexperience/eufemia/commit/3f093e6ed79971301d91bf556e6d7e129a3e658f))
|
|
15
|
+
|
|
6
16
|
## [9.16.2](https://github.com/dnbexperience/eufemia/compare/v9.16.1...v9.16.2) (2021-11-20)
|
|
7
17
|
|
|
8
18
|
|
|
@@ -353,8 +353,9 @@ var useCallEvent = function useCallEvent(_ref2) {
|
|
|
353
353
|
value = value || event.target.value;
|
|
354
354
|
var keyCode = (0, _keycode.default)(event);
|
|
355
355
|
var selStart = event.target.selectionStart;
|
|
356
|
+
var isUnidentified = event.which === 229 || keyCode === undefined;
|
|
356
357
|
|
|
357
|
-
if (name === 'on_key_down' && !(maskParams !== null && maskParams !== void 0 && maskParams.allowLeadingZeroes) && (keyCode === '0' || value.replace(/[^\d]/g, '') === '' && decimalSeparators.test(keyCode))) {
|
|
358
|
+
if (name === 'on_key_down' && !isUnidentified && !(maskParams !== null && maskParams !== void 0 && maskParams.allowLeadingZeroes) && (keyCode === '0' || value.replace(/[^\d]/g, '') === '' && decimalSeparators.test(keyCode))) {
|
|
358
359
|
var testValue = (value.slice(0, selStart) + '0' + value.slice(selStart + 1, value.length)).replace(/[^\d]/g, '');
|
|
359
360
|
|
|
360
361
|
if (/^0/.test(testValue)) {
|
|
@@ -363,7 +364,7 @@ var useCallEvent = function useCallEvent(_ref2) {
|
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
366
|
|
|
366
|
-
if (name === 'on_key_down' && maskParams !== null && maskParams !== void 0 && maskParams.decimalSymbol) {
|
|
367
|
+
if (name === 'on_key_down' && !isUnidentified && maskParams !== null && maskParams !== void 0 && maskParams.decimalSymbol) {
|
|
367
368
|
var hasDecimalSymbol = value.includes(maskParams.decimalSymbol);
|
|
368
369
|
var allowedDecimals = maskParams.decimalLimit > 0 || maskParams.allowDecimal !== false;
|
|
369
370
|
|
|
@@ -166,7 +166,7 @@ var correctNumberValue = function correctNumberValue(_ref5) {
|
|
|
166
166
|
|
|
167
167
|
if (endsWithDecimal) {
|
|
168
168
|
value = "".concat(value).concat(decimalSymbol);
|
|
169
|
-
} else if (endsWithZeroAndDecimal) {
|
|
169
|
+
} else if (endsWithZeroAndDecimal && !numberValue.endsWith("".concat(decimalSymbol, "0"))) {
|
|
170
170
|
value = "".concat(value).concat(decimalSymbol, "0");
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -300,7 +300,7 @@ exports.handleNumberMask = handleNumberMask;
|
|
|
300
300
|
function getInputModeFromMask(mask) {
|
|
301
301
|
var maskParams = mask === null || mask === void 0 ? void 0 : mask.maskParams;
|
|
302
302
|
|
|
303
|
-
if (maskParams && (mask === null || mask === void 0 ? void 0 : mask.instanceOf) === 'createNumberMask') {
|
|
303
|
+
if (!_helpers.IS_ANDROID && maskParams && (mask === null || mask === void 0 ? void 0 : mask.instanceOf) === 'createNumberMask') {
|
|
304
304
|
return maskParams.allowDecimal && maskParams.decimalLimit !== 0 ? 'decimal' : 'numeric';
|
|
305
305
|
}
|
|
306
306
|
|
|
@@ -80,6 +80,8 @@ export type PaginationChildren =
|
|
|
80
80
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
81
81
|
*/
|
|
82
82
|
export interface PaginationProps extends React.HTMLProps<HTMLElement> {
|
|
83
|
+
debug?: boolean;
|
|
84
|
+
|
|
83
85
|
/**
|
|
84
86
|
* The page show in the very beginning. If `current_page` is set, then it may not make too much sense to set this as well.
|
|
85
87
|
*/
|
|
@@ -356,6 +358,8 @@ export type PaginationInstanceChildren =
|
|
|
356
358
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
357
359
|
*/
|
|
358
360
|
export interface PaginationInstanceProps {
|
|
361
|
+
debug?: boolean;
|
|
362
|
+
|
|
359
363
|
/**
|
|
360
364
|
* The page show in the very beginning. If `current_page` is set, then it may not make too much sense to set this as well.
|
|
361
365
|
*/
|
|
@@ -634,6 +638,8 @@ export type InfinityMarkerChildren =
|
|
|
634
638
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
635
639
|
*/
|
|
636
640
|
export interface InfinityMarkerProps {
|
|
641
|
+
debug?: boolean;
|
|
642
|
+
|
|
637
643
|
/**
|
|
638
644
|
* The page show in the very beginning. If `current_page` is set, then it may not make too much sense to set this as well.
|
|
639
645
|
*/
|
|
@@ -102,6 +102,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
102
102
|
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; }
|
|
103
103
|
|
|
104
104
|
var paginationPropTypes = process.env.NODE_ENV !== "production" ? _objectSpread(_objectSpread({
|
|
105
|
+
debug: _propTypes.default.bool,
|
|
105
106
|
startup_page: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
106
107
|
current_page: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
107
108
|
page_count: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
@@ -140,6 +141,7 @@ var paginationPropTypes = process.env.NODE_ENV !== "production" ? _objectSpread(
|
|
|
140
141
|
on_end: _propTypes.default.func
|
|
141
142
|
}) : {};
|
|
142
143
|
var paginationDefaultProps = {
|
|
144
|
+
debug: null,
|
|
143
145
|
startup_page: null,
|
|
144
146
|
current_page: null,
|
|
145
147
|
page_count: null,
|
|
@@ -147,7 +147,7 @@ var PaginationBar = function (_React$PureComponent) {
|
|
|
147
147
|
key: "componentDidMount",
|
|
148
148
|
value: function componentDidMount() {
|
|
149
149
|
var context = this.context.pagination;
|
|
150
|
-
var currentPage = context.startupPage || context.currentPage;
|
|
150
|
+
var currentPage = context.startupPage || context.currentPage || 1;
|
|
151
151
|
var items = context.prefillItems(currentPage, {
|
|
152
152
|
skipObserver: true
|
|
153
153
|
});
|
|
@@ -6,8 +6,18 @@ require("core-js/modules/es.object.get-prototype-of.js");
|
|
|
6
6
|
|
|
7
7
|
require("core-js/modules/es.reflect.construct.js");
|
|
8
8
|
|
|
9
|
+
require("core-js/modules/es.object.keys.js");
|
|
10
|
+
|
|
9
11
|
require("core-js/modules/es.symbol.js");
|
|
10
12
|
|
|
13
|
+
require("core-js/modules/es.array.filter.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.object.assign.js");
|
|
20
|
+
|
|
11
21
|
require("core-js/modules/es.symbol.description.js");
|
|
12
22
|
|
|
13
23
|
require("core-js/modules/es.symbol.iterator.js");
|
|
@@ -18,23 +28,13 @@ require("core-js/modules/es.string.iterator.js");
|
|
|
18
28
|
|
|
19
29
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
20
30
|
|
|
21
|
-
require("core-js/modules/es.array.from.js");
|
|
22
|
-
|
|
23
31
|
require("core-js/modules/es.array.slice.js");
|
|
24
32
|
|
|
25
33
|
require("core-js/modules/es.function.name.js");
|
|
26
34
|
|
|
27
|
-
require("core-js/modules/es.
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.object.keys.js");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/es.array.filter.js");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
34
|
-
|
|
35
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
35
|
+
require("core-js/modules/es.array.from.js");
|
|
36
36
|
|
|
37
|
-
require("core-js/modules/es.
|
|
37
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
38
38
|
|
|
39
39
|
require("core-js/modules/es.array.index-of.js");
|
|
40
40
|
|
|
@@ -83,6 +83,10 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
83
83
|
|
|
84
84
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
85
85
|
|
|
86
|
+
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); }
|
|
87
|
+
|
|
88
|
+
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; }
|
|
89
|
+
|
|
86
90
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
87
91
|
|
|
88
92
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
@@ -93,18 +97,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
93
97
|
|
|
94
98
|
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; }
|
|
95
99
|
|
|
96
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
97
|
-
|
|
98
|
-
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."); }
|
|
99
|
-
|
|
100
|
-
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); }
|
|
101
|
-
|
|
102
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
103
|
-
|
|
104
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
105
|
-
|
|
106
|
-
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; }
|
|
107
|
-
|
|
108
100
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
109
101
|
|
|
110
102
|
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); } }
|
|
@@ -144,15 +136,20 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
144
136
|
startupPage = _this$context$paginat.startupPage,
|
|
145
137
|
startup_count = _this$context$paginat.startup_count;
|
|
146
138
|
var startupCount = parseFloat(startup_count);
|
|
139
|
+
var newPageNo, skipObserver, callStartupEvent, preventWaitForDelay;
|
|
147
140
|
|
|
148
|
-
for (var i = 0
|
|
141
|
+
for (var i = 0; i < startupCount; ++i) {
|
|
149
142
|
newPageNo = startupPage + i;
|
|
143
|
+
skipObserver = newPageNo < startupCount;
|
|
144
|
+
callStartupEvent = i === 0;
|
|
145
|
+
preventWaitForDelay = i <= startupCount - 1;
|
|
150
146
|
|
|
151
147
|
_this.getNewContent(newPageNo, {
|
|
152
148
|
position: 'after',
|
|
153
|
-
skipObserver:
|
|
149
|
+
skipObserver: skipObserver
|
|
154
150
|
}, {
|
|
155
|
-
|
|
151
|
+
callStartupEvent: callStartupEvent,
|
|
152
|
+
preventWaitForDelay: preventWaitForDelay
|
|
156
153
|
});
|
|
157
154
|
}
|
|
158
155
|
});
|
|
@@ -161,8 +158,10 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
161
158
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
162
159
|
|
|
163
160
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
164
|
-
_ref$
|
|
165
|
-
|
|
161
|
+
_ref$callStartupEvent = _ref.callStartupEvent,
|
|
162
|
+
callStartupEvent = _ref$callStartupEvent === void 0 ? false : _ref$callStartupEvent,
|
|
163
|
+
_ref$preventWaitForDe = _ref.preventWaitForDelay,
|
|
164
|
+
preventWaitForDelay = _ref$preventWaitForDe === void 0 ? false : _ref$preventWaitForDe;
|
|
166
165
|
|
|
167
166
|
var _this$context$paginat2 = _this.context.pagination,
|
|
168
167
|
pageCount = _this$context$paginat2.pageCount,
|
|
@@ -183,8 +182,9 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
183
182
|
var items = _this.context.pagination.prefillItems(newPageNo, props);
|
|
184
183
|
|
|
185
184
|
_this.context.pagination.setItems(items, function () {
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
_this.callEventHandler(newPageNo, {
|
|
186
|
+
callStartupEvent: callStartupEvent,
|
|
187
|
+
preventWaitForDelay: preventWaitForDelay
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
});
|
|
@@ -207,61 +207,80 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
207
207
|
}
|
|
208
208
|
}, {
|
|
209
209
|
key: "waitForReachedTime",
|
|
210
|
-
value: function waitForReachedTime(fn) {
|
|
210
|
+
value: function waitForReachedTime(fn, params) {
|
|
211
211
|
this.callbackBuffer = this.callbackBuffer || [];
|
|
212
|
-
|
|
213
|
-
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
214
|
-
props[_key - 1] = arguments[_key];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
212
|
this.callbackBuffer.push({
|
|
218
213
|
fn: fn,
|
|
219
|
-
|
|
214
|
+
params: params
|
|
215
|
+
});
|
|
216
|
+
this.callBuffer({
|
|
217
|
+
minTime: params.preventWaitForDelay ? -1 : this.context.pagination.minTime
|
|
220
218
|
});
|
|
221
|
-
this.callBuffer();
|
|
222
219
|
}
|
|
223
220
|
}, {
|
|
224
221
|
key: "callBuffer",
|
|
225
222
|
value: function callBuffer() {
|
|
226
223
|
var _this2 = this;
|
|
227
224
|
|
|
228
|
-
var
|
|
225
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
226
|
+
_ref2$minTime = _ref2.minTime,
|
|
227
|
+
minTime = _ref2$minTime === void 0 ? this.context.pagination.minTime : _ref2$minTime;
|
|
228
|
+
|
|
229
|
+
if (this.callbackBuffer.length === 0) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
229
233
|
var diff = this._lastCall > 0 ? new Date().getTime() - this._lastCall : 0;
|
|
230
234
|
var waitTime = diff < minTime ? minTime : 0;
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
|
|
236
|
+
var nextTick = function nextTick() {
|
|
233
237
|
if (_this2.callbackBuffer.length > 0) {
|
|
234
238
|
_this2._lastCall = new Date().getTime();
|
|
235
239
|
|
|
236
240
|
var _this2$callbackBuffer = _this2.callbackBuffer.shift(),
|
|
237
241
|
fn = _this2$callbackBuffer.fn,
|
|
238
|
-
|
|
242
|
+
params = _this2$callbackBuffer.params;
|
|
239
243
|
|
|
240
|
-
fn
|
|
244
|
+
fn(params);
|
|
241
245
|
|
|
242
|
-
_this2.callBuffer(
|
|
246
|
+
_this2.callBuffer({
|
|
247
|
+
minTime: params.preventWaitForDelay ? -1 : minTime
|
|
248
|
+
});
|
|
243
249
|
}
|
|
244
|
-
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
if (minTime > 0) {
|
|
253
|
+
clearTimeout(this._bufferTimeout);
|
|
254
|
+
this._bufferTimeout = setTimeout(nextTick, waitTime);
|
|
255
|
+
} else {
|
|
256
|
+
nextTick();
|
|
257
|
+
}
|
|
245
258
|
}
|
|
246
259
|
}, {
|
|
247
260
|
key: "callEventHandler",
|
|
248
261
|
value: function callEventHandler(pageNumber) {
|
|
249
262
|
var _this3 = this;
|
|
250
263
|
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
264
|
+
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
265
|
+
_ref3$callStartupEven = _ref3.callStartupEvent,
|
|
266
|
+
callStartupEvent = _ref3$callStartupEven === void 0 ? false : _ref3$callStartupEven,
|
|
267
|
+
_ref3$preventWaitForD = _ref3.preventWaitForDelay,
|
|
268
|
+
preventWaitForDelay = _ref3$preventWaitForD === void 0 ? false : _ref3$preventWaitForD,
|
|
269
|
+
_ref3$callOnEnd = _ref3.callOnEnd,
|
|
270
|
+
callOnEnd = _ref3$callOnEnd === void 0 ? false : _ref3$callOnEnd,
|
|
271
|
+
_ref3$onDispatch = _ref3.onDispatch,
|
|
272
|
+
onDispatch = _ref3$onDispatch === void 0 ? null : _ref3$onDispatch;
|
|
273
|
+
|
|
274
|
+
this.waitForReachedTime(function (_ref4) {
|
|
275
|
+
var pageNumber = _ref4.pageNumber,
|
|
276
|
+
callStartupEvent = _ref4.callStartupEvent;
|
|
262
277
|
var context = _this3.context.pagination;
|
|
263
278
|
|
|
264
279
|
var createEvent = function createEvent(eventName) {
|
|
280
|
+
if (isNaN(pageNumber)) {
|
|
281
|
+
pageNumber = 1;
|
|
282
|
+
}
|
|
283
|
+
|
|
265
284
|
var ret = (0, _componentHelper.dispatchCustomElementEvent)(context, eventName, _objectSpread({
|
|
266
285
|
page: pageNumber,
|
|
267
286
|
pageNo: pageNumber,
|
|
@@ -280,7 +299,7 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
280
299
|
if (callOnEnd) {
|
|
281
300
|
createEvent('on_end');
|
|
282
301
|
} else {
|
|
283
|
-
if (
|
|
302
|
+
if (callStartupEvent) {
|
|
284
303
|
createEvent('on_startup');
|
|
285
304
|
} else {
|
|
286
305
|
createEvent('on_change');
|
|
@@ -290,7 +309,8 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
290
309
|
}
|
|
291
310
|
}, {
|
|
292
311
|
pageNumber: pageNumber,
|
|
293
|
-
|
|
312
|
+
callStartupEvent: callStartupEvent,
|
|
313
|
+
preventWaitForDelay: preventWaitForDelay
|
|
294
314
|
});
|
|
295
315
|
}
|
|
296
316
|
}, {
|
|
@@ -302,35 +322,55 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
302
322
|
var _this$context$paginat3 = this.context.pagination,
|
|
303
323
|
lowerPage = _this$context$paginat3.lowerPage,
|
|
304
324
|
upperPage = _this$context$paginat3.upperPage,
|
|
325
|
+
currentPage = _this$context$paginat3.currentPage,
|
|
305
326
|
pageCount = _this$context$paginat3.pageCount,
|
|
306
327
|
hasEndedInfinity = _this$context$paginat3.hasEndedInfinity,
|
|
307
328
|
parallelLoadCount = _this$context$paginat3.parallelLoadCount,
|
|
329
|
+
debug = _this$context$paginat3.debug,
|
|
330
|
+
current_page = _this$context$paginat3.current_page,
|
|
308
331
|
fallback_element = _this$context$paginat3.fallback_element,
|
|
309
332
|
marker_element = _this$context$paginat3.marker_element,
|
|
310
333
|
indicator_element = _this$context$paginat3.indicator_element;
|
|
311
334
|
|
|
335
|
+
if (debug) {
|
|
336
|
+
console.info('PaginationInfinity.render', {
|
|
337
|
+
current_page: current_page,
|
|
338
|
+
lowerPage: lowerPage,
|
|
339
|
+
upperPage: upperPage,
|
|
340
|
+
currentPage: currentPage,
|
|
341
|
+
pageCount: pageCount
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
312
345
|
var Marker = function Marker() {
|
|
313
346
|
return _react.default.createElement(InteractionMarker, {
|
|
347
|
+
debug: debug,
|
|
314
348
|
pageNumber: upperPage,
|
|
315
349
|
markerElement: marker_element || fallback_element,
|
|
316
350
|
onVisible: function onVisible(pageNumber) {
|
|
317
|
-
|
|
318
|
-
|
|
351
|
+
if (debug) {
|
|
352
|
+
console.info('PaginationInfinity.onVisible', {
|
|
353
|
+
pageNumber: pageNumber
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
var newPageNo;
|
|
358
|
+
|
|
359
|
+
var _loop = function _loop(i) {
|
|
360
|
+
newPageNo = pageNumber + 1 + i;
|
|
319
361
|
|
|
320
362
|
_this4.context.pagination.onPageUpdate(function () {
|
|
321
363
|
_this4.context.pagination.setState({
|
|
322
|
-
upperPage:
|
|
364
|
+
upperPage: newPageNo,
|
|
323
365
|
skipObserver: i + 1 < parallelLoadCount
|
|
324
366
|
});
|
|
325
367
|
});
|
|
326
368
|
|
|
327
|
-
_this4.callEventHandler(
|
|
328
|
-
|
|
329
|
-
newPageNo = _newPageNo;
|
|
369
|
+
_this4.callEventHandler(newPageNo);
|
|
330
370
|
};
|
|
331
371
|
|
|
332
|
-
for (var i = 0
|
|
333
|
-
_loop(i
|
|
372
|
+
for (var i = 0; i < parallelLoadCount; ++i) {
|
|
373
|
+
_loop(i);
|
|
334
374
|
}
|
|
335
375
|
}
|
|
336
376
|
});
|
|
@@ -357,7 +397,7 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
357
397
|
});
|
|
358
398
|
};
|
|
359
399
|
|
|
360
|
-
return _react.default.createElement(_react.default.Fragment, null, lowerPage > 1 && _react.default.createElement(LoadButton, null), children, !hasEndedInfinity && (typeof pageCount === 'undefined' || upperPage < pageCount) && _react.default.createElement(Marker, null), !hasEndedInfinity && !this.hideIndicator && (typeof pageCount === 'undefined' || upperPage < pageCount) && _react.default.createElement(_PaginationHelpers.PaginationIndicator, {
|
|
400
|
+
return _react.default.createElement(_react.default.Fragment, null, parseFloat(current_page) > 0 && lowerPage > 1 && _react.default.createElement(LoadButton, null), children, !hasEndedInfinity && parseFloat(current_page) > 0 && (typeof pageCount === 'undefined' || upperPage < pageCount) && _react.default.createElement(Marker, null), !hasEndedInfinity && !this.hideIndicator && (typeof pageCount === 'undefined' || upperPage < pageCount) && _react.default.createElement(_PaginationHelpers.PaginationIndicator, {
|
|
361
401
|
indicator_element: indicator_element || fallback_element
|
|
362
402
|
}));
|
|
363
403
|
}
|
|
@@ -378,24 +418,24 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
378
418
|
marker_element = _this$context$paginat4.marker_element,
|
|
379
419
|
indicator_element = _this$context$paginat4.indicator_element;
|
|
380
420
|
|
|
381
|
-
if (this.context.pagination.useMarkerOnly) {
|
|
382
|
-
return this.handleInfinityMarker();
|
|
383
|
-
}
|
|
384
|
-
|
|
385
421
|
if (!(items && items.length > 0)) {
|
|
386
422
|
clearTimeout(this._startupTimeout);
|
|
387
423
|
this._startupTimeout = setTimeout(this.startup, 1);
|
|
388
424
|
return null;
|
|
389
425
|
}
|
|
390
426
|
|
|
427
|
+
if (this.context.pagination.useMarkerOnly) {
|
|
428
|
+
return this.handleInfinityMarker();
|
|
429
|
+
}
|
|
430
|
+
|
|
391
431
|
var Element = (0, _PaginationHelpers.preparePageElement)(page_element || _react.default.Fragment);
|
|
392
|
-
return items.map(function (
|
|
393
|
-
var pageNumber =
|
|
394
|
-
hasContent =
|
|
395
|
-
content =
|
|
396
|
-
ref =
|
|
397
|
-
skipObserver =
|
|
398
|
-
ScrollElement =
|
|
432
|
+
return items.map(function (_ref5, idx) {
|
|
433
|
+
var pageNumber = _ref5.pageNumber,
|
|
434
|
+
hasContent = _ref5.hasContent,
|
|
435
|
+
content = _ref5.content,
|
|
436
|
+
ref = _ref5.ref,
|
|
437
|
+
skipObserver = _ref5.skipObserver,
|
|
438
|
+
ScrollElement = _ref5.ScrollElement;
|
|
399
439
|
var isLastItem = idx === items.length - 1;
|
|
400
440
|
var Elem = hasContent && ScrollElement || Element;
|
|
401
441
|
|
|
@@ -403,10 +443,12 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
403
443
|
pageNumber: pageNumber,
|
|
404
444
|
markerElement: marker_element || fallback_element,
|
|
405
445
|
onVisible: function onVisible(pageNumber) {
|
|
406
|
-
|
|
407
|
-
_newPageNo2 = pageNumber + 1 + i;
|
|
446
|
+
var newPageNo;
|
|
408
447
|
|
|
409
|
-
|
|
448
|
+
for (var i = 0; i < parallelLoadCount; ++i) {
|
|
449
|
+
newPageNo = pageNumber + 1 + i;
|
|
450
|
+
|
|
451
|
+
_this5.getNewContent(newPageNo, {
|
|
410
452
|
position: 'after',
|
|
411
453
|
skipObserver: i + 1 < parallelLoadCount
|
|
412
454
|
});
|
|
@@ -414,6 +456,7 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
414
456
|
}
|
|
415
457
|
});
|
|
416
458
|
|
|
459
|
+
var showIndicator = (parallelLoadCount > 1 && idx > 0 ? isLastItem : true) && !hasContent && !_this5.hideIndicator;
|
|
417
460
|
return _react.default.createElement(Elem, {
|
|
418
461
|
key: pageNumber,
|
|
419
462
|
ref: ref
|
|
@@ -427,7 +470,7 @@ var InfinityScroller = function (_React$PureComponent) {
|
|
|
427
470
|
event: event
|
|
428
471
|
});
|
|
429
472
|
}
|
|
430
|
-
}), placeMakerBeforeContent && marker, content, !placeMakerBeforeContent && marker,
|
|
473
|
+
}), placeMakerBeforeContent && marker, content, !placeMakerBeforeContent && marker, showIndicator && _react.default.createElement(_PaginationHelpers.PaginationIndicator, {
|
|
431
474
|
indicator_element: indicator_element || fallback_element
|
|
432
475
|
}), hasContent && _this5.useLoadButton && isLastItem && (typeof pageCount === 'undefined' || pageNumber < pageCount) && _react.default.createElement(InfinityLoadButton, {
|
|
433
476
|
element: fallback_element,
|
|
@@ -528,15 +571,33 @@ var InteractionMarker = function (_React$PureComponent2) {
|
|
|
528
571
|
this._isMounted = true;
|
|
529
572
|
(_this$intersectionObs = this.intersectionObserver) === null || _this$intersectionObs === void 0 ? void 0 : _this$intersectionObs.observe(this._ref.current);
|
|
530
573
|
}
|
|
574
|
+
|
|
575
|
+
if (this.props.debug) {
|
|
576
|
+
var height = this.getContentHeight();
|
|
577
|
+
console.info('PaginationInfinity.getContentHeight', height);
|
|
578
|
+
}
|
|
531
579
|
}
|
|
532
580
|
}, {
|
|
533
581
|
key: "componentWillUnmount",
|
|
534
582
|
value: function componentWillUnmount() {
|
|
535
|
-
var _this$intersectionObs2;
|
|
536
|
-
|
|
537
583
|
this._isMounted = false;
|
|
538
|
-
|
|
539
|
-
(
|
|
584
|
+
|
|
585
|
+
if (this.intersectionObserver) {
|
|
586
|
+
clearTimeout(this._readyTimeout);
|
|
587
|
+
this.intersectionObserver.disconnect();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}, {
|
|
591
|
+
key: "getContentHeight",
|
|
592
|
+
value: function getContentHeight() {
|
|
593
|
+
var height = 0;
|
|
594
|
+
|
|
595
|
+
try {
|
|
596
|
+
var sibling = (0, _componentHelper.getPreviousSibling)('dnb-table', this._ref.current);
|
|
597
|
+
height = parseFloat(window.getComputedStyle(sibling.querySelector('tbody')).height);
|
|
598
|
+
} catch (e) {}
|
|
599
|
+
|
|
600
|
+
return height;
|
|
540
601
|
}
|
|
541
602
|
}, {
|
|
542
603
|
key: "render",
|
|
@@ -562,10 +623,12 @@ var InteractionMarker = function (_React$PureComponent2) {
|
|
|
562
623
|
}(_react.default.PureComponent);
|
|
563
624
|
|
|
564
625
|
_defineProperty(InteractionMarker, "defaultProps", {
|
|
626
|
+
debug: null,
|
|
565
627
|
markerElement: null
|
|
566
628
|
});
|
|
567
629
|
|
|
568
630
|
process.env.NODE_ENV !== "production" ? InteractionMarker.propTypes = {
|
|
631
|
+
debug: _propTypes.default.bool,
|
|
569
632
|
pageNumber: _propTypes.default.number.isRequired,
|
|
570
633
|
onVisible: _propTypes.default.func.isRequired,
|
|
571
634
|
markerElement: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.node, _propTypes.default.func, _propTypes.default.string])
|
|
@@ -581,8 +644,8 @@ var InfinityLoadButton = function (_React$PureComponent3) {
|
|
|
581
644
|
|
|
582
645
|
_classCallCheck(this, InfinityLoadButton);
|
|
583
646
|
|
|
584
|
-
for (var
|
|
585
|
-
args[
|
|
647
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
648
|
+
args[_key] = arguments[_key];
|
|
586
649
|
}
|
|
587
650
|
|
|
588
651
|
_this7 = _super3.call.apply(_super3, [this].concat(args));
|