vscroll 1.4.4 → 1.5.0
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/dist/bundles/vscroll.esm5.js +102 -75
- package/dist/bundles/vscroll.esm5.js.map +1 -1
- package/dist/bundles/vscroll.esm5.min.js +2 -2
- package/dist/bundles/vscroll.esm5.min.js.map +1 -1
- package/dist/bundles/vscroll.esm6.js +20 -8
- package/dist/bundles/vscroll.esm6.js.map +1 -1
- package/dist/bundles/vscroll.esm6.min.js +2 -2
- package/dist/bundles/vscroll.esm6.min.js.map +1 -1
- package/dist/bundles/vscroll.umd.js +103 -76
- package/dist/bundles/vscroll.umd.js.map +1 -1
- package/dist/bundles/vscroll.umd.min.js +2 -2
- package/dist/bundles/vscroll.umd.min.js.map +1 -1
- package/dist/esm2015/classes/domRoutines.js +12 -2
- package/dist/esm2015/classes/domRoutines.js.map +1 -1
- package/dist/esm2015/classes/logger.js.map +1 -1
- package/dist/esm2015/index.js.map +1 -1
- package/dist/esm2015/interfaces/index.js.map +1 -1
- package/dist/esm2015/interfaces/routines.js.map +1 -1
- package/dist/esm2015/interfaces/workflow.js.map +1 -1
- package/dist/esm2015/scroller.js +2 -2
- package/dist/esm2015/scroller.js.map +1 -1
- package/dist/esm2015/version.js +1 -1
- package/dist/esm2015/version.js.map +1 -1
- package/dist/esm2015/workflow.js +4 -2
- package/dist/esm2015/workflow.js.map +1 -1
- package/dist/esm5/classes/adapter.js +4 -4
- package/dist/esm5/classes/adapter.js.map +1 -1
- package/dist/esm5/classes/buffer/cache.js +1 -1
- package/dist/esm5/classes/buffer/cache.js.map +1 -1
- package/dist/esm5/classes/buffer/checkCall.js +4 -4
- package/dist/esm5/classes/buffer/checkCall.js.map +1 -1
- package/dist/esm5/classes/buffer.js +3 -3
- package/dist/esm5/classes/buffer.js.map +1 -1
- package/dist/esm5/classes/domRoutines.js +26 -5
- package/dist/esm5/classes/domRoutines.js.map +1 -1
- package/dist/esm5/classes/logger.js +19 -19
- package/dist/esm5/classes/logger.js.map +1 -1
- package/dist/esm5/classes/state/cycle.js +2 -2
- package/dist/esm5/classes/state/cycle.js.map +1 -1
- package/dist/esm5/classes/viewport.js +1 -1
- package/dist/esm5/classes/viewport.js.map +1 -1
- package/dist/esm5/index.js.map +1 -1
- package/dist/esm5/inputs/validation.js +4 -4
- package/dist/esm5/inputs/validation.js.map +1 -1
- package/dist/esm5/interfaces/index.js.map +1 -1
- package/dist/esm5/interfaces/routines.js.map +1 -1
- package/dist/esm5/interfaces/workflow.js.map +1 -1
- package/dist/esm5/processes/adapter/remove.js +1 -1
- package/dist/esm5/processes/adapter/remove.js.map +1 -1
- package/dist/esm5/processes/adjust.js +5 -5
- package/dist/esm5/processes/adjust.js.map +1 -1
- package/dist/esm5/processes/clip.js +5 -5
- package/dist/esm5/processes/clip.js.map +1 -1
- package/dist/esm5/processes/fetch.js +2 -2
- package/dist/esm5/processes/fetch.js.map +1 -1
- package/dist/esm5/processes/misc/base.js +1 -1
- package/dist/esm5/processes/misc/base.js.map +1 -1
- package/dist/esm5/processes/preClip.js +2 -2
- package/dist/esm5/processes/preClip.js.map +1 -1
- package/dist/esm5/processes/preFetch.js +5 -5
- package/dist/esm5/processes/preFetch.js.map +1 -1
- package/dist/esm5/processes/scroll.js +2 -2
- package/dist/esm5/processes/scroll.js.map +1 -1
- package/dist/esm5/scroller.js +3 -3
- package/dist/esm5/scroller.js.map +1 -1
- package/dist/esm5/version.js +1 -1
- package/dist/esm5/version.js.map +1 -1
- package/dist/esm5/workflow.js +10 -4
- package/dist/esm5/workflow.js.map +1 -1
- package/dist/typings/classes/domRoutines.d.ts +2 -2
- package/dist/typings/index.d.ts +2 -2
- package/dist/typings/interfaces/index.d.ts +2 -2
- package/dist/typings/interfaces/routines.d.ts +3 -0
- package/dist/typings/interfaces/workflow.d.ts +3 -0
- package/dist/typings/scroller.d.ts +1 -1
- package/dist/typings/workflow.d.ts +1 -1
- package/package.json +18 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vscroll (https://github.com/dhilt/vscroll) FESM5
|
|
3
|
-
* Version: 1.
|
|
3
|
+
* Version: 1.5.0 (2022-02-02T15:07:19.169Z)
|
|
4
4
|
* Author: Denis Hilt
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -343,7 +343,7 @@ var reactiveConfigStorage = new Map();
|
|
|
343
343
|
|
|
344
344
|
var core = {
|
|
345
345
|
name: 'vscroll',
|
|
346
|
-
version: '1.
|
|
346
|
+
version: '1.5.0'
|
|
347
347
|
};
|
|
348
348
|
|
|
349
349
|
var instanceCount$1 = 0;
|
|
@@ -452,7 +452,7 @@ var ValidatorType;
|
|
|
452
452
|
ValidatorType["enum"] = "must belong to {arg1} list";
|
|
453
453
|
})(ValidatorType || (ValidatorType = {}));
|
|
454
454
|
var getError = function (msg, args) {
|
|
455
|
-
return (args || ['']).reduce(function (acc, arg, index) { return acc.replace("{arg"
|
|
455
|
+
return (args || ['']).reduce(function (acc, arg, index) { return acc.replace("{arg".concat(index + 1, "}"), arg); }, msg);
|
|
456
456
|
};
|
|
457
457
|
var getNumber = function (value) {
|
|
458
458
|
return typeof value === 'number' || (typeof value === 'string' && value !== '')
|
|
@@ -617,7 +617,7 @@ var onOneOf = function (tokens, must) { return function (value, context) {
|
|
|
617
617
|
}
|
|
618
618
|
var isAnotherPresent = context && Object.prototype.hasOwnProperty.call(context, token);
|
|
619
619
|
if (isSet && isAnotherPresent) {
|
|
620
|
-
errors.push(getError(err, [tokens.join('", "')]) +
|
|
620
|
+
errors.push(getError(err, [tokens.join('", "')]) + " (".concat(token, " is present)"));
|
|
621
621
|
break;
|
|
622
622
|
}
|
|
623
623
|
if (noOneIsPresent && isAnotherPresent) {
|
|
@@ -742,9 +742,9 @@ var ValidatedData = /** @class */ (function () {
|
|
|
742
742
|
ValidatedData.prototype.setParam = function (token, value) {
|
|
743
743
|
if (!value.isValid) {
|
|
744
744
|
value.errors = !value.isSet
|
|
745
|
-
? ["\""
|
|
745
|
+
? ["\"".concat(token, "\" must be set")]
|
|
746
746
|
: value.errors.map(function (err) {
|
|
747
|
-
return "\""
|
|
747
|
+
return "\"".concat(token, "\" ").concat(err);
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
this.params[token] = value;
|
|
@@ -1332,7 +1332,7 @@ var BaseAdapterProcessFactory = function (process) { var _a; return _a = /** @cl
|
|
|
1332
1332
|
scroller.workflow.call({
|
|
1333
1333
|
process: process,
|
|
1334
1334
|
status: ProcessStatus.error,
|
|
1335
|
-
payload: { error: "Wrong argument of the \""
|
|
1335
|
+
payload: { error: "Wrong argument of the \"".concat(process, "\" method call") }
|
|
1336
1336
|
});
|
|
1337
1337
|
}
|
|
1338
1338
|
}
|
|
@@ -1388,7 +1388,7 @@ var Scroll = /** @class */ (function (_super) {
|
|
|
1388
1388
|
if (!scroll.syntheticFulfill || synthPos === position) {
|
|
1389
1389
|
scroller.logger.log(function () { return [
|
|
1390
1390
|
'skipping scroll', position,
|
|
1391
|
-
"["
|
|
1391
|
+
"[".concat(scroll.syntheticFulfill ? '' : 'pre-', "synthetic]")
|
|
1392
1392
|
]; });
|
|
1393
1393
|
return true;
|
|
1394
1394
|
}
|
|
@@ -1410,7 +1410,7 @@ var Scroll = /** @class */ (function (_super) {
|
|
|
1410
1410
|
direction === Direction.backward ? '\u2934' : '\u2935',
|
|
1411
1411
|
position,
|
|
1412
1412
|
shouldDelay ? (timeDiff + 'ms') : '0ms',
|
|
1413
|
-
shouldDelay ? (alreadyDelayed ? 'delayed' : "/ "
|
|
1413
|
+
shouldDelay ? (alreadyDelayed ? 'delayed' : "/ ".concat(delta, "ms delay")) : ''
|
|
1414
1414
|
]; });
|
|
1415
1415
|
if (!shouldDelay) {
|
|
1416
1416
|
if (scroll.scrollTimer) {
|
|
@@ -1906,7 +1906,7 @@ var Remove = /** @class */ (function (_super) {
|
|
|
1906
1906
|
}
|
|
1907
1907
|
}
|
|
1908
1908
|
// virtual removal
|
|
1909
|
-
scroller.logger.log(function () { return "going to remove "
|
|
1909
|
+
scroller.logger.log(function () { return "going to remove ".concat(toRemove.length, " item(s) virtually"); });
|
|
1910
1910
|
buffer.removeVirtually(toRemove, !!increase);
|
|
1911
1911
|
buffer.checkDefaultSize();
|
|
1912
1912
|
Remove.shiftFirstVisibleIndex(scroller, toRemove, !!increase);
|
|
@@ -2140,8 +2140,8 @@ var PreFetch = /** @class */ (function (_super) {
|
|
|
2140
2140
|
startDelta += buffer.getSizeByIndex(index);
|
|
2141
2141
|
}
|
|
2142
2142
|
scroller.logger.log(function () { return __spreadArray([
|
|
2143
|
-
"start delta is "
|
|
2144
|
-
], __read((offset ? [" (+"
|
|
2143
|
+
"start delta is ".concat(startDelta)
|
|
2144
|
+
], __read((offset ? [" (+".concat(offset, " offset)")] : [])), false); });
|
|
2145
2145
|
return startDelta;
|
|
2146
2146
|
};
|
|
2147
2147
|
PreFetch.setFirstIndex = function (scroller) {
|
|
@@ -2312,17 +2312,17 @@ var PreFetch = /** @class */ (function (_super) {
|
|
|
2312
2312
|
direction_1 = fetch.last.index < buffer.items[0].$index ? Direction.backward : Direction.forward;
|
|
2313
2313
|
}
|
|
2314
2314
|
fetch.direction = direction_1;
|
|
2315
|
-
scroller.logger.log(function () { return "fetch direction is \""
|
|
2315
|
+
scroller.logger.log(function () { return "fetch direction is \"".concat(direction_1, "\""); });
|
|
2316
2316
|
}
|
|
2317
2317
|
};
|
|
2318
2318
|
PreFetch.getStatus = function (scroller) {
|
|
2319
2319
|
var _a = scroller.state, cycle = _a.cycle, fetch = _a.fetch;
|
|
2320
2320
|
if (cycle.initiator === AdapterProcess.clip) {
|
|
2321
|
-
scroller.logger.log(function () { return "going to skip fetch due to \""
|
|
2321
|
+
scroller.logger.log(function () { return "going to skip fetch due to \"".concat(AdapterProcess.clip, "\" process"); });
|
|
2322
2322
|
return ProcessStatus.next;
|
|
2323
2323
|
}
|
|
2324
2324
|
if (fetch.shouldFetch) {
|
|
2325
|
-
scroller.logger.log(function () { return "going to fetch "
|
|
2325
|
+
scroller.logger.log(function () { return "going to fetch ".concat(fetch.count, " items started from index ").concat(fetch.index); });
|
|
2326
2326
|
return ProcessStatus.next;
|
|
2327
2327
|
}
|
|
2328
2328
|
return ProcessStatus.done;
|
|
@@ -2340,8 +2340,8 @@ var Fetch = /** @class */ (function (_super) {
|
|
|
2340
2340
|
var box = {
|
|
2341
2341
|
success: function (data) {
|
|
2342
2342
|
scroller.logger.log(function () {
|
|
2343
|
-
return "resolved "
|
|
2344
|
-
|
|
2343
|
+
return "resolved ".concat(data.length, " items ") +
|
|
2344
|
+
"(index = ".concat(scroller.state.fetch.index, ", count = ").concat(scroller.state.fetch.count, ")");
|
|
2345
2345
|
});
|
|
2346
2346
|
scroller.state.fetch.newItemsData = data;
|
|
2347
2347
|
workflow.call({
|
|
@@ -2688,7 +2688,7 @@ var Adjust = /** @class */ (function (_super) {
|
|
|
2688
2688
|
fwdSize += viewportSizeDiff;
|
|
2689
2689
|
}
|
|
2690
2690
|
scroller.logger.log(function () {
|
|
2691
|
-
return inverse ? 'backward' : 'forward' +
|
|
2691
|
+
return inverse ? 'backward' : 'forward' + " padding will be increased by ".concat(viewportSizeDiff, " to fill the viewport");
|
|
2692
2692
|
});
|
|
2693
2693
|
}
|
|
2694
2694
|
backward.size = bwdSize;
|
|
@@ -2700,7 +2700,7 @@ var Adjust = /** @class */ (function (_super) {
|
|
|
2700
2700
|
var position = viewport.paddings.backward.size;
|
|
2701
2701
|
// increase the position to meet the expectation of the first visible item
|
|
2702
2702
|
if (!isNaN(fetch.firstVisible.index) && !isNaN(buffer.firstIndex)) {
|
|
2703
|
-
scroller.logger.log("first index = "
|
|
2703
|
+
scroller.logger.log("first index = ".concat(fetch.firstVisible.index, ", delta = ").concat(fetch.firstVisible.delta));
|
|
2704
2704
|
var shouldCheckPreSizeExpectation_1 = fetch.shouldCheckPreSizeExpectation(buffer.lastIndex);
|
|
2705
2705
|
buffer.items.forEach(function (item) {
|
|
2706
2706
|
// 1) shift of the buffered items before the first visible item
|
|
@@ -2722,7 +2722,7 @@ var Adjust = /** @class */ (function (_super) {
|
|
|
2722
2722
|
if (scroll.positionBeforeAsync !== null) {
|
|
2723
2723
|
var diff = render.positionBefore - scroll.positionBeforeAsync;
|
|
2724
2724
|
if (diff !== 0) {
|
|
2725
|
-
scroller.logger.log("shift position due to fetch-render difference ("
|
|
2725
|
+
scroller.logger.log("shift position due to fetch-render difference (".concat(diff, ")"));
|
|
2726
2726
|
position += diff;
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
@@ -2753,7 +2753,7 @@ var Adjust = /** @class */ (function (_super) {
|
|
|
2753
2753
|
var shift = Math.min(size, diff);
|
|
2754
2754
|
if (shift) {
|
|
2755
2755
|
viewport.paddings.forward.size += shift;
|
|
2756
|
-
scroller.logger.log("increase fwd padding due to lack of items ("
|
|
2756
|
+
scroller.logger.log("increase fwd padding due to lack of items (".concat(diff, " -> ").concat(shift, ")"));
|
|
2757
2757
|
}
|
|
2758
2758
|
};
|
|
2759
2759
|
Adjust.setPosition = function (scroller, position, done) {
|
|
@@ -2770,7 +2770,7 @@ var Adjust = /** @class */ (function (_super) {
|
|
|
2770
2770
|
if (inertiaDiff > 0) {
|
|
2771
2771
|
position -= inertiaDiff;
|
|
2772
2772
|
scroll.syntheticPosition = position;
|
|
2773
|
-
diffLog = " (-"
|
|
2773
|
+
diffLog = " (-".concat(inertiaDiff, ")");
|
|
2774
2774
|
}
|
|
2775
2775
|
scroll.syntheticFulfill = true;
|
|
2776
2776
|
viewport.scrollPosition = position;
|
|
@@ -2804,8 +2804,8 @@ var PreClip = /** @class */ (function (_super) {
|
|
|
2804
2804
|
var firstIndex = fetch.first.indexBuffer;
|
|
2805
2805
|
var lastIndex = fetch.last.indexBuffer;
|
|
2806
2806
|
scroller.logger.log(function () {
|
|
2807
|
-
return "looking for "
|
|
2808
|
-
|
|
2807
|
+
return "looking for ".concat(fetch.direction ? 'anti-' + fetch.direction + ' ' : '', "items ") +
|
|
2808
|
+
"that are out of [".concat(firstIndex, "..").concat(lastIndex, "] range");
|
|
2809
2809
|
});
|
|
2810
2810
|
if (PreClip.isBackward(scroller, firstIndex)) {
|
|
2811
2811
|
PreClip.prepareClipByDirection(scroller, Direction.backward, firstIndex);
|
|
@@ -2889,7 +2889,7 @@ var Clip = /** @class */ (function (_super) {
|
|
|
2889
2889
|
var _a;
|
|
2890
2890
|
var buffer = scroller.buffer, paddings = scroller.viewport.paddings, clip = scroller.state.clip, logger = scroller.logger;
|
|
2891
2891
|
var size = (_a = {}, _a[Direction.backward] = 0, _a[Direction.forward] = 0, _a);
|
|
2892
|
-
logger.stat("before clip ("
|
|
2892
|
+
logger.stat("before clip (".concat(++clip.callCount, ")"));
|
|
2893
2893
|
var itemsToRemove = buffer.items.filter(function (item) {
|
|
2894
2894
|
if (!item.toRemove) {
|
|
2895
2895
|
return false;
|
|
@@ -2917,10 +2917,10 @@ var Clip = /** @class */ (function (_super) {
|
|
|
2917
2917
|
});
|
|
2918
2918
|
return list.length
|
|
2919
2919
|
? [
|
|
2920
|
-
"clipped "
|
|
2921
|
-
(size.backward ? ", +"
|
|
2922
|
-
(size.forward ? ", +"
|
|
2923
|
-
|
|
2920
|
+
"clipped ".concat(list.length, " item(s) from Buffer") +
|
|
2921
|
+
(size.backward ? ", +".concat(size.backward, " fwd px") : '') +
|
|
2922
|
+
(size.forward ? ", +".concat(size.forward, " bwd px") : '') +
|
|
2923
|
+
", range: [".concat(list[0], "..").concat(list[list.length - 1], "]")
|
|
2924
2924
|
]
|
|
2925
2925
|
: 'clipped 0 items from Buffer';
|
|
2926
2926
|
});
|
|
@@ -2946,19 +2946,19 @@ var Logger = /** @class */ (function () {
|
|
|
2946
2946
|
return arg;
|
|
2947
2947
|
}
|
|
2948
2948
|
else if (Array.isArray(arg)) {
|
|
2949
|
-
return "[of "
|
|
2949
|
+
return "[of ".concat(arg.length, "]");
|
|
2950
2950
|
}
|
|
2951
2951
|
return '{ ' + Object.keys(arg).join(', ') + ' }';
|
|
2952
2952
|
})
|
|
2953
2953
|
.join(', ');
|
|
2954
|
-
_this.log("adapter: "
|
|
2954
|
+
_this.log("adapter: ".concat(methodName, "(").concat(params || '', ")").concat(add || ''));
|
|
2955
2955
|
};
|
|
2956
2956
|
var settings = scroller.settings;
|
|
2957
2957
|
this.debug = settings.debug;
|
|
2958
2958
|
this.immediateLog = settings.immediateLog;
|
|
2959
2959
|
this.logTime = settings.logTime;
|
|
2960
2960
|
this.getTime = function () {
|
|
2961
|
-
return scroller.state && " // time: "
|
|
2961
|
+
return scroller.state && " // time: ".concat(scroller.state.time);
|
|
2962
2962
|
};
|
|
2963
2963
|
this.getStat = function () {
|
|
2964
2964
|
var buffer = scroller.buffer, viewport = scroller.viewport;
|
|
@@ -2970,26 +2970,26 @@ var Logger = /** @class */ (function () {
|
|
|
2970
2970
|
'fwd_p: ' + viewport.paddings.forward.size + ', ' +
|
|
2971
2971
|
'default: ' + (buffer.defaultSize || 'no') + ', ' +
|
|
2972
2972
|
'items: ' + buffer.getVisibleItemsCount() + ', ' +
|
|
2973
|
-
'range: ' + (first && last ? "["
|
|
2973
|
+
'range: ' + (first && last ? "[".concat(first.$index, "..").concat(last.$index, "]") : 'no');
|
|
2974
2974
|
};
|
|
2975
2975
|
this.getFetchRange = function () {
|
|
2976
2976
|
var _a = scroller.state.fetch, first = _a.first.index, last = _a.last.index;
|
|
2977
2977
|
return !Number.isNaN(first) && !Number.isNaN(last)
|
|
2978
|
-
? "["
|
|
2978
|
+
? "[".concat(first, "..").concat(last, "]")
|
|
2979
2979
|
: 'no';
|
|
2980
2980
|
};
|
|
2981
2981
|
this.getLoopId = function () { return scroller.state.cycle.loopId; };
|
|
2982
2982
|
this.getLoopIdNext = function () { return scroller.state.cycle.loopIdNext; };
|
|
2983
2983
|
this.getWorkflowCycleData = function () {
|
|
2984
|
-
return settings.instanceIndex
|
|
2984
|
+
return "".concat(settings.instanceIndex, "-").concat(scroller.state.cycle.count);
|
|
2985
2985
|
};
|
|
2986
2986
|
this.getScrollPosition = function () { return scroller.routines.getScrollPosition(); };
|
|
2987
2987
|
this.log(function () {
|
|
2988
2988
|
return 'vscroll Workflow has been started, ' +
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
(!adapter ? 'is not instantiated' : "instance: "
|
|
2989
|
+
"core: ".concat(packageInfo.core.name, " v").concat(packageInfo.core.version, ", ") +
|
|
2990
|
+
"consumer: ".concat(packageInfo.consumer.name, " v").concat(packageInfo.consumer.version, ", ") +
|
|
2991
|
+
"scroller instance: ".concat(settings.instanceIndex, ", adapter ") +
|
|
2992
|
+
(!adapter ? 'is not instantiated' : "instance: ".concat(adapter.id));
|
|
2993
2993
|
});
|
|
2994
2994
|
}
|
|
2995
2995
|
Logger.prototype.object = function (str, obj, stringify) {
|
|
@@ -3030,15 +3030,15 @@ var Logger = /** @class */ (function () {
|
|
|
3030
3030
|
'color: #888; border: dashed #888 0; border-bottom-width: 0px',
|
|
3031
3031
|
'color: #000; border-width: 0'
|
|
3032
3032
|
];
|
|
3033
|
-
this.log(function () { return __spreadArray(['%cstat' + (str ? " "
|
|
3033
|
+
this.log(function () { return __spreadArray(['%cstat' + (str ? " ".concat(str) : '') + ',%c ' + _this.getStat()], __read(logStyles_1), false); });
|
|
3034
3034
|
}
|
|
3035
3035
|
};
|
|
3036
3036
|
Logger.prototype.fetch = function (str) {
|
|
3037
3037
|
var _this = this;
|
|
3038
3038
|
if (this.debug) {
|
|
3039
|
-
var _text_1 = 'fetch interval' + (str ? " "
|
|
3039
|
+
var _text_1 = 'fetch interval' + (str ? " ".concat(str) : '');
|
|
3040
3040
|
var logStyles_2 = ['color: #888', 'color: #000'];
|
|
3041
|
-
this.log(function () { return __spreadArray(["%c"
|
|
3041
|
+
this.log(function () { return __spreadArray(["%c".concat(_text_1, ": %c").concat(_this.getFetchRange())], __read(logStyles_2), false); });
|
|
3042
3042
|
}
|
|
3043
3043
|
};
|
|
3044
3044
|
Logger.prototype.prepareForLog = function (data) {
|
|
@@ -3054,13 +3054,13 @@ var Logger = /** @class */ (function () {
|
|
|
3054
3054
|
// inner loop start-end log
|
|
3055
3055
|
var loopLog = [];
|
|
3056
3056
|
if (process === CommonProcess.init && status === ProcessStatus.next) {
|
|
3057
|
-
loopLog.push("%c---=== loop "
|
|
3057
|
+
loopLog.push("%c---=== loop ".concat(this.getLoopIdNext(), " start"));
|
|
3058
3058
|
}
|
|
3059
3059
|
else if (process === CommonProcess.end) {
|
|
3060
|
-
loopLog.push("%c---=== loop "
|
|
3060
|
+
loopLog.push("%c---=== loop ".concat(this.getLoopId(), " done"));
|
|
3061
3061
|
var parent_1 = payload && payload.process;
|
|
3062
3062
|
if (status === ProcessStatus.next && (parent_1 !== AdapterProcess.reset && parent_1 !== AdapterProcess.reload)) {
|
|
3063
|
-
loopLog[0] += ", loop "
|
|
3063
|
+
loopLog[0] += ", loop ".concat(this.getLoopIdNext(), " start");
|
|
3064
3064
|
}
|
|
3065
3065
|
}
|
|
3066
3066
|
if (loopLog.length) {
|
|
@@ -3071,14 +3071,14 @@ var Logger = /** @class */ (function () {
|
|
|
3071
3071
|
if (start === void 0) { start = true; }
|
|
3072
3072
|
var logData = this.getWorkflowCycleData();
|
|
3073
3073
|
var border = start ? '1px 0 0 1px' : '0 0 1px 1px';
|
|
3074
|
-
var logStyles = "color: #0000aa; border: solid #555 1px; border-width: "
|
|
3075
|
-
this.log(function () { return ["%c ~~~ WF Cycle "
|
|
3074
|
+
var logStyles = "color: #0000aa; border: solid #555 1px; border-width: ".concat(border, "; margin-left: -2px");
|
|
3075
|
+
this.log(function () { return ["%c ~~~ WF Cycle ".concat(logData, " ").concat(start ? 'STARTED' : 'FINALIZED', " ~~~ "), logStyles]; });
|
|
3076
3076
|
};
|
|
3077
3077
|
Logger.prototype.logError = function (str) {
|
|
3078
3078
|
var _this = this;
|
|
3079
3079
|
if (this.debug) {
|
|
3080
3080
|
var logStyles_3 = ['color: #a00;', 'color: #000'];
|
|
3081
|
-
this.log(function () { return __spreadArray(['error:%c' + (str ? " "
|
|
3081
|
+
this.log(function () { return __spreadArray(['error:%c' + (str ? " ".concat(str) : '') + "%c (loop ".concat(_this.getLoopIdNext(), ")")], __read(logStyles_3), false); });
|
|
3082
3082
|
}
|
|
3083
3083
|
};
|
|
3084
3084
|
Logger.prototype.log = function () {
|
|
@@ -3138,13 +3138,34 @@ var Logger = /** @class */ (function () {
|
|
|
3138
3138
|
}());
|
|
3139
3139
|
|
|
3140
3140
|
var Routines = /** @class */ (function () {
|
|
3141
|
-
function Routines(element, settings) {
|
|
3141
|
+
function Routines(element, settings, CustomRoutines) {
|
|
3142
|
+
var _this = this;
|
|
3143
|
+
this.element = element;
|
|
3142
3144
|
this.settings = {
|
|
3143
3145
|
viewport: settings.viewport,
|
|
3144
3146
|
horizontal: settings.horizontal,
|
|
3145
3147
|
window: settings.windowViewport
|
|
3146
3148
|
};
|
|
3147
|
-
|
|
3149
|
+
// provide custom overrides for IRoutines methods
|
|
3150
|
+
if (CustomRoutines) {
|
|
3151
|
+
var routines_1 = new CustomRoutines(element, this.settings);
|
|
3152
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(routines_1))
|
|
3153
|
+
.filter(function (method) {
|
|
3154
|
+
return method !== 'constructor' &&
|
|
3155
|
+
typeof routines_1[method] === 'function' &&
|
|
3156
|
+
typeof _this[method] === 'function';
|
|
3157
|
+
})
|
|
3158
|
+
.forEach(function (method) {
|
|
3159
|
+
return _this[method] = function () {
|
|
3160
|
+
var args = [];
|
|
3161
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3162
|
+
args[_i] = arguments[_i];
|
|
3163
|
+
}
|
|
3164
|
+
return routines_1[method].apply(_this, args);
|
|
3165
|
+
};
|
|
3166
|
+
});
|
|
3167
|
+
}
|
|
3168
|
+
// initialization
|
|
3148
3169
|
this.viewport = this.getViewportElement();
|
|
3149
3170
|
this.onInit(settings);
|
|
3150
3171
|
}
|
|
@@ -3180,10 +3201,10 @@ var Routines = /** @class */ (function () {
|
|
|
3180
3201
|
return element.querySelector(selector);
|
|
3181
3202
|
};
|
|
3182
3203
|
Routines.prototype.findPaddingElement = function (direction) {
|
|
3183
|
-
return this.findElementBySelector(this.element, "[data-padding-"
|
|
3204
|
+
return this.findElementBySelector(this.element, "[data-padding-".concat(direction, "]"));
|
|
3184
3205
|
};
|
|
3185
3206
|
Routines.prototype.findItemElement = function (id) {
|
|
3186
|
-
return this.findElementBySelector(this.element, "[data-sid=\""
|
|
3207
|
+
return this.findElementBySelector(this.element, "[data-sid=\"".concat(id, "\"]"));
|
|
3187
3208
|
};
|
|
3188
3209
|
Routines.prototype.getScrollPosition = function () {
|
|
3189
3210
|
if (this.settings.window) {
|
|
@@ -3242,7 +3263,7 @@ var Routines = /** @class */ (function () {
|
|
|
3242
3263
|
Routines.prototype.setSizeStyle = function (element, value) {
|
|
3243
3264
|
this.checkElement(element);
|
|
3244
3265
|
value = Math.max(0, Math.round(value));
|
|
3245
|
-
element.style[this.settings.horizontal ? 'width' : 'height'] = value
|
|
3266
|
+
element.style[this.settings.horizontal ? 'width' : 'height'] = "".concat(value, "px");
|
|
3246
3267
|
};
|
|
3247
3268
|
Routines.prototype.getEdge = function (element, direction) {
|
|
3248
3269
|
var horizontal = this.settings.horizontal;
|
|
@@ -3398,7 +3419,7 @@ var Viewport = /** @class */ (function () {
|
|
|
3398
3419
|
var position = this.scrollPosition;
|
|
3399
3420
|
this.logger.log(function () { return __spreadArray([
|
|
3400
3421
|
'setting scroll position at', position
|
|
3401
|
-
], __read((position !== value ? ["("
|
|
3422
|
+
], __read((position !== value ? ["(".concat(value, ")")] : [])), false); });
|
|
3402
3423
|
return position;
|
|
3403
3424
|
};
|
|
3404
3425
|
Object.defineProperty(Viewport.prototype, "scrollPosition", {
|
|
@@ -3644,7 +3665,7 @@ var Cache = /** @class */ (function () {
|
|
|
3644
3665
|
Cache.prototype.recalculateDefaultSize = function () {
|
|
3645
3666
|
var _this = this;
|
|
3646
3667
|
if (this.defaultSize.recalculate(this.size)) {
|
|
3647
|
-
this.logger.log(function () { return "default size has been updated: "
|
|
3668
|
+
this.logger.log(function () { return "default size has been updated: ".concat(_this.defaultSize.get()); });
|
|
3648
3669
|
return true;
|
|
3649
3670
|
}
|
|
3650
3671
|
return false;
|
|
@@ -3863,7 +3884,7 @@ var CheckBufferCall = /** @class */ (function () {
|
|
|
3863
3884
|
this.logger.log('no items to fill the buffer; wrong indexes');
|
|
3864
3885
|
return false;
|
|
3865
3886
|
}
|
|
3866
|
-
this.logger.log(function () { return "going to fill the buffer with "
|
|
3887
|
+
this.logger.log(function () { return "going to fill the buffer with ".concat(items.length, " item(s)"); });
|
|
3867
3888
|
return true;
|
|
3868
3889
|
};
|
|
3869
3890
|
CheckBufferCall.prototype.insertInBuffer = function (predicate, before, after) {
|
|
@@ -3887,18 +3908,18 @@ var CheckBufferCall = /** @class */ (function () {
|
|
|
3887
3908
|
if (index < finiteAbsMinIndex || index > finiteAbsMaxIndex) {
|
|
3888
3909
|
this.logger.log(function () {
|
|
3889
3910
|
return 'no items to insert virtually; ' +
|
|
3890
|
-
|
|
3911
|
+
"selected index (".concat(index, ") does not match virtual area [").concat(finiteAbsMinIndex, "..").concat(finiteAbsMaxIndex, "]");
|
|
3891
3912
|
});
|
|
3892
3913
|
return false;
|
|
3893
3914
|
}
|
|
3894
3915
|
var before = direction === Direction.backward;
|
|
3895
3916
|
if (!(index < firstIndex + (before ? 1 : 0) || index > lastIndex - (before ? 0 : 1))) {
|
|
3896
3917
|
this.logger.log(function () {
|
|
3897
|
-
return "no items to insert virtually; selected index ("
|
|
3918
|
+
return "no items to insert virtually; selected index (".concat(index, ") belongs Buffer [").concat(firstIndex, "..").concat(lastIndex, "]");
|
|
3898
3919
|
});
|
|
3899
3920
|
return false;
|
|
3900
3921
|
}
|
|
3901
|
-
this.logger.log(function () { return "going to insert "
|
|
3922
|
+
this.logger.log(function () { return "going to insert ".concat(items.length, " item(s) virtually"); });
|
|
3902
3923
|
return true;
|
|
3903
3924
|
};
|
|
3904
3925
|
return CheckBufferCall;
|
|
@@ -3942,15 +3963,15 @@ var Buffer = /** @class */ (function () {
|
|
|
3942
3963
|
var start = this.startIndexUser;
|
|
3943
3964
|
var index = Number(newStartIndex);
|
|
3944
3965
|
if (Number.isNaN(index)) {
|
|
3945
|
-
this.logger.log(function () { return "fallback startIndex to settings.startIndex ("
|
|
3966
|
+
this.logger.log(function () { return "fallback startIndex to settings.startIndex (".concat(start, ")"); });
|
|
3946
3967
|
index = start;
|
|
3947
3968
|
}
|
|
3948
3969
|
if (index < min) {
|
|
3949
|
-
this.logger.log(function () { return "setting startIndex to settings.minIndex ("
|
|
3970
|
+
this.logger.log(function () { return "setting startIndex to settings.minIndex (".concat(min, ") because ").concat(index, " < ").concat(min); });
|
|
3950
3971
|
index = min;
|
|
3951
3972
|
}
|
|
3952
3973
|
if (index > max) {
|
|
3953
|
-
this.logger.log(function () { return "setting startIndex to settings.maxIndex ("
|
|
3974
|
+
this.logger.log(function () { return "setting startIndex to settings.maxIndex (".concat(max, ") because ").concat(index, " > ").concat(max); });
|
|
3954
3975
|
index = max;
|
|
3955
3976
|
}
|
|
3956
3977
|
this.startIndex = index;
|
|
@@ -4351,14 +4372,14 @@ var WorkflowCycleModel = /** @class */ (function () {
|
|
|
4351
4372
|
}
|
|
4352
4373
|
Object.defineProperty(WorkflowCycleModel.prototype, "loopId", {
|
|
4353
4374
|
get: function () {
|
|
4354
|
-
return this.instanceIndex
|
|
4375
|
+
return "".concat(this.instanceIndex, "-").concat(this.count, "-").concat(this.innerLoop.total);
|
|
4355
4376
|
},
|
|
4356
4377
|
enumerable: false,
|
|
4357
4378
|
configurable: true
|
|
4358
4379
|
});
|
|
4359
4380
|
Object.defineProperty(WorkflowCycleModel.prototype, "loopIdNext", {
|
|
4360
4381
|
get: function () {
|
|
4361
|
-
return this.instanceIndex
|
|
4382
|
+
return "".concat(this.instanceIndex, "-").concat(this.count, "-").concat(this.innerLoop.total + 1);
|
|
4362
4383
|
},
|
|
4363
4384
|
enumerable: false,
|
|
4364
4385
|
configurable: true
|
|
@@ -4972,7 +4993,7 @@ var Adapter = /** @class */ (function () {
|
|
|
4972
4993
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4973
4994
|
Adapter.prototype.reset = function (options) {
|
|
4974
4995
|
this.reloadCounter++;
|
|
4975
|
-
this.logger.logAdapterMethod('reset', options, " of "
|
|
4996
|
+
this.logger.logAdapterMethod('reset', options, " of ".concat(this.reloadId));
|
|
4976
4997
|
this.workflow.call({
|
|
4977
4998
|
process: AdapterProcess.reset,
|
|
4978
4999
|
status: ProcessStatus.start,
|
|
@@ -4982,7 +5003,7 @@ var Adapter = /** @class */ (function () {
|
|
|
4982
5003
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4983
5004
|
Adapter.prototype.reload = function (options) {
|
|
4984
5005
|
this.reloadCounter++;
|
|
4985
|
-
this.logger.logAdapterMethod('reload', options, " of "
|
|
5006
|
+
this.logger.logAdapterMethod('reload', options, " of ".concat(this.reloadId));
|
|
4986
5007
|
this.workflow.call({
|
|
4987
5008
|
process: AdapterProcess.reload,
|
|
4988
5009
|
status: ProcessStatus.start,
|
|
@@ -5089,7 +5110,7 @@ var Adapter = /** @class */ (function () {
|
|
|
5089
5110
|
});
|
|
5090
5111
|
}).then(function (immediate) {
|
|
5091
5112
|
var success = reloadId === _this.reloadId;
|
|
5092
|
-
_this.logger.log(function () { return !success ? "relax promise cancelled due to "
|
|
5113
|
+
_this.logger.log(function () { return !success ? "relax promise cancelled due to ".concat(reloadId, " != ").concat(_this.reloadId) : void 0; });
|
|
5093
5114
|
return {
|
|
5094
5115
|
immediate: immediate,
|
|
5095
5116
|
success: success,
|
|
@@ -5100,7 +5121,7 @@ var Adapter = /** @class */ (function () {
|
|
|
5100
5121
|
Adapter.prototype.relax = function (callback) {
|
|
5101
5122
|
var _this = this;
|
|
5102
5123
|
var reloadId = this.reloadId;
|
|
5103
|
-
this.logger.logAdapterMethod('relax', callback, " of "
|
|
5124
|
+
this.logger.logAdapterMethod('relax', callback, " of ".concat(reloadId));
|
|
5104
5125
|
if (!this.init) {
|
|
5105
5126
|
return Promise.resolve(methodPreResult);
|
|
5106
5127
|
}
|
|
@@ -5122,10 +5143,10 @@ var INVALID_DATASOURCE_PREFIX = 'Invalid datasource:';
|
|
|
5122
5143
|
var instanceCount = 0;
|
|
5123
5144
|
var Scroller = /** @class */ (function () {
|
|
5124
5145
|
function Scroller(_a) {
|
|
5125
|
-
var datasource = _a.datasource, consumer = _a.consumer, element = _a.element, workflow = _a.workflow, scroller = _a.scroller;
|
|
5146
|
+
var datasource = _a.datasource, consumer = _a.consumer, element = _a.element, workflow = _a.workflow, CustomRoutines = _a.Routines, scroller = _a.scroller;
|
|
5126
5147
|
var get = validate(datasource, DATASOURCE).params.get;
|
|
5127
5148
|
if (!get.isValid) {
|
|
5128
|
-
throw new Error(INVALID_DATASOURCE_PREFIX
|
|
5149
|
+
throw new Error("".concat(INVALID_DATASOURCE_PREFIX, " ").concat(get.errors[0]));
|
|
5129
5150
|
}
|
|
5130
5151
|
var packageInfo = scroller ? scroller.state.packageInfo : { consumer: consumer, core: core };
|
|
5131
5152
|
element = scroller ? scroller.routines.element : element;
|
|
@@ -5133,7 +5154,7 @@ var Scroller = /** @class */ (function () {
|
|
|
5133
5154
|
this.workflow = workflow;
|
|
5134
5155
|
this.settings = new Settings(datasource.settings, datasource.devSettings, ++instanceCount);
|
|
5135
5156
|
this.logger = new Logger(this, packageInfo, datasource.adapter);
|
|
5136
|
-
this.routines = new Routines(element, this.settings);
|
|
5157
|
+
this.routines = new Routines(element, this.settings, CustomRoutines);
|
|
5137
5158
|
this.state = new State(packageInfo, this.settings, scroller ? scroller.state : void 0);
|
|
5138
5159
|
this.buffer = new Buffer(this.settings, workflow.onDataChanged, this.logger);
|
|
5139
5160
|
this.viewport = new Viewport(this.settings, this.routines, this.state, this.logger);
|
|
@@ -5395,7 +5416,7 @@ var runStateMachine = function (_a) {
|
|
|
5395
5416
|
var Workflow = /** @class */ (function () {
|
|
5396
5417
|
function Workflow(_a) {
|
|
5397
5418
|
var _this = this;
|
|
5398
|
-
var element = _a.element, datasource = _a.datasource, consumer = _a.consumer, run = _a.run;
|
|
5419
|
+
var element = _a.element, datasource = _a.datasource, consumer = _a.consumer, run = _a.run, Routines = _a.Routines;
|
|
5399
5420
|
this.isInitialized = false;
|
|
5400
5421
|
this.initTimer = null;
|
|
5401
5422
|
this.adapterRun$ = new Reactive();
|
|
@@ -5410,7 +5431,13 @@ var Workflow = /** @class */ (function () {
|
|
|
5410
5431
|
done: this.done.bind(this),
|
|
5411
5432
|
onError: this.onError.bind(this)
|
|
5412
5433
|
};
|
|
5413
|
-
this.scroller = new Scroller({
|
|
5434
|
+
this.scroller = new Scroller({
|
|
5435
|
+
element: element,
|
|
5436
|
+
datasource: datasource,
|
|
5437
|
+
consumer: consumer,
|
|
5438
|
+
workflow: this.getUpdater(),
|
|
5439
|
+
Routines: Routines
|
|
5440
|
+
});
|
|
5414
5441
|
if (this.scroller.settings.initializeDelay) {
|
|
5415
5442
|
this.initTimer = setTimeout(function () {
|
|
5416
5443
|
_this.initTimer = null;
|
|
@@ -5465,7 +5492,7 @@ var Workflow = /** @class */ (function () {
|
|
|
5465
5492
|
'%cfire%c'
|
|
5466
5493
|
], ['color: #cc7777;', 'color: #000000;'], false), [
|
|
5467
5494
|
process,
|
|
5468
|
-
"\""
|
|
5495
|
+
"\"".concat(status, "\"")
|
|
5469
5496
|
], false), __read((payload !== void 0 ? [payload] : [])), false); });
|
|
5470
5497
|
}
|
|
5471
5498
|
this.scroller.logger.logProcess(data);
|
|
@@ -5521,7 +5548,7 @@ var Workflow = /** @class */ (function () {
|
|
|
5521
5548
|
workflow.call.interrupted = true;
|
|
5522
5549
|
this.scroller.workflow = this.getUpdater();
|
|
5523
5550
|
this.interruptionCount++;
|
|
5524
|
-
logger_1.log(function () { return "workflow had been interrupted by the "
|
|
5551
|
+
logger_1.log(function () { return "workflow had been interrupted by the ".concat(process, " process (").concat(_this.interruptionCount, ")"); });
|
|
5525
5552
|
}
|
|
5526
5553
|
if (datasource) { // Scroller re-initialization case
|
|
5527
5554
|
this.scroller.adapter.relax(function () {
|