vscroll
Version:
Virtual scroll engine
45 lines • 1.72 kB
JavaScript
import { __assign, __extends, __read } from "tslib";
import { ProcessStatus } from './enums';
import { ADAPTER_METHODS, validate } from '../../inputs/index';
export var BaseProcessFactory = function (process) { var _a; return _a = /** @class */ (function () {
function BaseProcess() {
}
return BaseProcess;
}()),
_a.process = process,
_a; };
export var BaseAdapterProcessFactory = function (process) { var _a; return _a = /** @class */ (function (_super) {
__extends(BaseAdapterProcess, _super);
function BaseAdapterProcess() {
return _super !== null && _super.apply(this, arguments) || this;
}
BaseAdapterProcess.parseInput = function (scroller, options, ignoreErrors, _process) {
if (ignoreErrors === void 0) { ignoreErrors = false; }
var result = {
data: validate(options, ADAPTER_METHODS[_process || process])
};
if (result.data.isValid) {
result.params = Object.entries(result.data.params)
.reduce(function (acc, _b) {
var _c;
var _d = __read(_b, 2), key = _d[0], value = _d[1].value;
return (__assign(__assign({}, acc), (_c = {}, _c[key] = value, _c)));
}, {});
}
else {
scroller.logger.log(function () { return result.data.showErrors(); });
if (!ignoreErrors) {
scroller.workflow.call({
process: process,
status: ProcessStatus.error,
payload: { error: "Wrong argument of the \"".concat(process, "\" method call") }
});
}
}
return result;
};
return BaseAdapterProcess;
}(BaseProcessFactory(process))),
_a.process = process,
_a; };
//# sourceMappingURL=base.js.map