Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@frui.ts/data

Package Overview
Dependencies
Maintainers
5
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frui.ts/data - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

83

dist/fruits-data.es.js

@@ -1,59 +0,44 @@

const defaultPageSize = 25;
function handlePagingChanged(offset, limit, filter, onPageChanged) {
if (filter) {
filter.offset = offset;
filter.limit = limit;
}
if (onPageChanged) {
onPageChanged(offset, limit);
}
function u(n, g, s, o) {
s && (s.offset = n, s.limit = g), o && o(n, g);
}
function handlePageChanged(newPageNumber, filter, onPageChanged) {
const pageSize = (filter == null ? void 0 : filter.limit) || defaultPageSize;
const offset = (newPageNumber - 1) * pageSize;
handlePagingChanged(offset, pageSize, filter, onPageChanged);
function t(n, g, s) {
const o = (g == null ? void 0 : g.limit) || 25, d = (n - 1) * o;
u(d, o, g, s);
}
function pageChangedHandler(newPageNumber, filter, onPageChanged) {
return () => handlePageChanged(newPageNumber, filter, onPageChanged);
function a(n, g, s) {
return () => t(n, g, s);
}
function handlePageSizeChanged(newPageSize, filter, onPageChanged) {
handlePagingChanged(0, newPageSize, filter, onPageChanged);
function i(n, g, s) {
u(0, n, g, s);
}
var SortingDirection = /* @__PURE__ */ ((SortingDirection2) => {
SortingDirection2[SortingDirection2["Ascending"] = 1] = "Ascending";
SortingDirection2[SortingDirection2["Descending"] = -1] = "Descending";
return SortingDirection2;
})(SortingDirection || {});
function getSortingDirection(filter, columnName) {
var _a, _b;
const existingIndex = (_a = filter.sorting) == null ? void 0 : _a.findIndex((x) => x.column === columnName);
if (existingIndex === void 0 || existingIndex < 0) {
return void 0;
}
return (_b = filter.sorting) == null ? void 0 : _b[existingIndex].direction;
var e = /* @__PURE__ */ ((n) => (n[n.Ascending = 1] = "Ascending", n[n.Descending = -1] = "Descending", n))(e || {});
function h(n, g) {
var o, d;
const s = (o = n.sorting) == null ? void 0 : o.findIndex((c) => c.column === g);
if (!(s === void 0 || s < 0))
return (d = n.sorting) == null ? void 0 : d[s].direction;
}
function setSort(filter, columnName, direction) {
var _a;
const existingSort = ((_a = filter.sorting) == null ? void 0 : _a.length) ? filter.sorting[0] : void 0;
const sortDirection = direction != null ? direction : (existingSort == null ? void 0 : existingSort.column) === columnName && existingSort.direction === SortingDirection.Ascending ? SortingDirection.Descending : SortingDirection.Ascending;
if (filter.sorting) {
filter.sorting[0] = { column: columnName, direction: sortDirection };
filter.sorting.length = 1;
} else {
filter.sorting = [{ column: columnName, direction: sortDirection }];
}
function A(n, g, s) {
var c;
const o = (c = n.sorting) != null && c.length ? n.sorting[0] : void 0, d = s != null ? s : (o == null ? void 0 : o.column) === g && o.direction === e.Ascending ? e.Descending : e.Ascending;
n.sorting ? (n.sorting[0] = { column: g, direction: d }, n.sorting.length = 1) : n.sorting = [{ column: g, direction: d }];
}
function addSort(filter, columnName, direction) {
if (!filter.sorting) {
filter.sorting = [{ column: columnName, direction: direction != null ? direction : SortingDirection.Ascending }];
function x(n, g, s) {
if (!n.sorting) {
n.sorting = [{ column: g, direction: s != null ? s : e.Ascending }];
return;
}
const existingIndex = filter.sorting.findIndex((x) => x.column === columnName);
if (existingIndex === -1) {
filter.sorting.push({ column: columnName, direction: direction != null ? direction : SortingDirection.Ascending });
} else {
filter.sorting[existingIndex].direction = direction != null ? direction : filter.sorting[existingIndex].direction === SortingDirection.Ascending ? SortingDirection.Descending : SortingDirection.Ascending;
}
const o = n.sorting.findIndex((d) => d.column === g);
o === -1 ? n.sorting.push({ column: g, direction: s != null ? s : e.Ascending }) : n.sorting[o].direction = s != null ? s : n.sorting[o].direction === e.Ascending ? e.Descending : e.Ascending;
}
export { SortingDirection, addSort, getSortingDirection, handlePageChanged, handlePageSizeChanged, handlePagingChanged, pageChangedHandler, setSort };
export {
e as SortingDirection,
x as addSort,
h as getSortingDirection,
t as handlePageChanged,
i as handlePageSizeChanged,
u as handlePagingChanged,
a as pageChangedHandler,
A as setSort
};
//# sourceMappingURL=fruits-data.es.js.map

@@ -1,2 +0,2 @@

(function(s,t){typeof exports=="object"&&typeof module!="undefined"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis!="undefined"?globalThis:s||self,t(s["fruits-data"]={}))})(this,function(s){"use strict";function a(n,g,e,d){e&&(e.offset=n,e.limit=g),d&&d(n,g)}function c(n,g,e){const d=(g==null?void 0:g.limit)||25,i=(n-1)*d;a(i,d,g,e)}function h(n,g,e){return()=>c(n,g,e)}function f(n,g,e){a(0,n,g,e)}var o=(n=>(n[n.Ascending=1]="Ascending",n[n.Descending=-1]="Descending",n))(o||{});function S(n,g){var d,i;const e=(d=n.sorting)==null?void 0:d.findIndex(u=>u.column===g);if(!(e===void 0||e<0))return(i=n.sorting)==null?void 0:i[e].direction}function A(n,g,e){var u;const d=(u=n.sorting)!=null&&u.length?n.sorting[0]:void 0,i=e!=null?e:(d==null?void 0:d.column)===g&&d.direction===o.Ascending?o.Descending:o.Ascending;n.sorting?(n.sorting[0]={column:g,direction:i},n.sorting.length=1):n.sorting=[{column:g,direction:i}]}function P(n,g,e){if(!n.sorting){n.sorting=[{column:g,direction:e!=null?e:o.Ascending}];return}const d=n.sorting.findIndex(i=>i.column===g);d===-1?n.sorting.push({column:g,direction:e!=null?e:o.Ascending}):n.sorting[d].direction=e!=null?e:n.sorting[d].direction===o.Ascending?o.Descending:o.Ascending}s.SortingDirection=o,s.addSort=P,s.getSortingDirection=S,s.handlePageChanged=c,s.handlePageSizeChanged=f,s.handlePagingChanged=a,s.pageChangedHandler=h,s.setSort=A,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s["fruits-data"]={}))})(this,function(s){"use strict";function a(n,g,e,d){e&&(e.offset=n,e.limit=g),d&&d(n,g)}function c(n,g,e){const d=(g==null?void 0:g.limit)||25,i=(n-1)*d;a(i,d,g,e)}function h(n,g,e){return()=>c(n,g,e)}function f(n,g,e){a(0,n,g,e)}var o=(n=>(n[n.Ascending=1]="Ascending",n[n.Descending=-1]="Descending",n))(o||{});function S(n,g){var d,i;const e=(d=n.sorting)==null?void 0:d.findIndex(u=>u.column===g);if(!(e===void 0||e<0))return(i=n.sorting)==null?void 0:i[e].direction}function A(n,g,e){var u;const d=(u=n.sorting)!=null&&u.length?n.sorting[0]:void 0,i=e!=null?e:(d==null?void 0:d.column)===g&&d.direction===o.Ascending?o.Descending:o.Ascending;n.sorting?(n.sorting[0]={column:g,direction:i},n.sorting.length=1):n.sorting=[{column:g,direction:i}]}function P(n,g,e){if(!n.sorting){n.sorting=[{column:g,direction:e!=null?e:o.Ascending}];return}const d=n.sorting.findIndex(i=>i.column===g);d===-1?n.sorting.push({column:g,direction:e!=null?e:o.Ascending}):n.sorting[d].direction=e!=null?e:n.sorting[d].direction===o.Ascending?o.Descending:o.Ascending}s.SortingDirection=o,s.addSort=P,s.getSortingDirection=S,s.handlePageChanged=c,s.handlePageSizeChanged=f,s.handlePagingChanged=a,s.pageChangedHandler=h,s.setSort=A,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
//# sourceMappingURL=fruits-data.umd.js.map

@@ -6,3 +6,3 @@ {

},
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "Helpers and interfaces for handling paged and sorted data sets",

@@ -41,3 +41,3 @@ "keywords": [

},
"gitHead": "1a7897ad15a6a5be5adc7e67725f174a1dbc6394"
"gitHead": "5d7b8915490794c56dcad28698a47e6e2a904e4e"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc