@frui.ts/data
Advanced tools
Comparing version 1.0.0-alpha.8 to 1.0.0-alpha.9
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.handlePageSizeChanged = exports.pageChangedHandler = exports.handlePageChanged = exports.handlePagingChanged = void 0; | ||
var defaultPageSize = 25; | ||
const defaultPageSize = 25; | ||
function handlePagingChanged(offset, limit, filter, onPageChanged) { | ||
@@ -16,4 +16,4 @@ if (filter) { | ||
function handlePageChanged(newPageNumber, filter, onPageChanged) { | ||
var pageSize = (filter === null || filter === void 0 ? void 0 : filter.limit) || defaultPageSize; | ||
var offset = (newPageNumber - 1) * pageSize; | ||
const pageSize = (filter === null || filter === void 0 ? void 0 : filter.limit) || defaultPageSize; | ||
const offset = (newPageNumber - 1) * pageSize; | ||
handlePagingChanged(offset, pageSize, filter, onPageChanged); | ||
@@ -23,3 +23,3 @@ } | ||
function pageChangedHandler(newPageNumber, filter, onPageChanged) { | ||
return function () { return handlePageChanged(newPageNumber, filter, onPageChanged); }; | ||
return () => handlePageChanged(newPageNumber, filter, onPageChanged); | ||
} | ||
@@ -26,0 +26,0 @@ exports.pageChangedHandler = pageChangedHandler; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.addSort = exports.setSort = exports.getSortingDirection = void 0; | ||
var sortingDirection_1 = require("./sortingDirection"); | ||
const sortingDirection_1 = require("./sortingDirection"); | ||
function getSortingDirection(filter, columnName) { | ||
var _a, _b; | ||
var existingIndex = (_a = filter.sorting) === null || _a === void 0 ? void 0 : _a.findIndex(function (x) { return x.column === columnName; }); | ||
const existingIndex = (_a = filter.sorting) === null || _a === void 0 ? void 0 : _a.findIndex(x => x.column === columnName); | ||
if (existingIndex === undefined || existingIndex < 0) { | ||
@@ -16,4 +16,4 @@ return undefined; | ||
var _a; | ||
var existingSort = ((_a = filter.sorting) === null || _a === void 0 ? void 0 : _a.length) ? filter.sorting[0] : undefined; | ||
var sortDirection = direction !== null && direction !== void 0 ? direction : ((existingSort === null || existingSort === void 0 ? void 0 : existingSort.column) === columnName && existingSort.direction === sortingDirection_1.SortingDirection.Ascending | ||
const existingSort = ((_a = filter.sorting) === null || _a === void 0 ? void 0 : _a.length) ? filter.sorting[0] : undefined; | ||
const sortDirection = direction !== null && direction !== void 0 ? direction : ((existingSort === null || existingSort === void 0 ? void 0 : existingSort.column) === columnName && existingSort.direction === sortingDirection_1.SortingDirection.Ascending | ||
? sortingDirection_1.SortingDirection.Descending | ||
@@ -35,3 +35,3 @@ : sortingDirection_1.SortingDirection.Ascending); | ||
} | ||
var existingIndex = filter.sorting.findIndex(function (x) { return x.column === columnName; }); | ||
const existingIndex = filter.sorting.findIndex(x => x.column === columnName); | ||
if (existingIndex === -1) { | ||
@@ -38,0 +38,0 @@ filter.sorting.push({ column: columnName, direction: direction !== null && direction !== void 0 ? direction : sortingDirection_1.SortingDirection.Ascending }); |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "1.0.0-alpha.8", | ||
"version": "1.0.0-alpha.9", | ||
"description": "Helpers and interfaces for handling paged and sorted data sets", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "e774efd68e7bd49b83461fdcae0d110c2b69da90" | ||
"gitHead": "718298c96617555dd2121f87a2dfefb3ea16d039" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16713