bam32bittheme
Advanced tools
Comparing version 2.1.87 to 2.1.88
@@ -10,2 +10,3 @@ "use strict"; | ||
exports.default = void 0; | ||
require("core-js/modules/es.parse-float.js"); | ||
require("core-js/modules/es.regexp.to-string.js"); | ||
@@ -65,14 +66,25 @@ var _react = _interopRequireWildcard(require("react")); | ||
const theme = (0, _react2.useTheme)(); | ||
const numericSortingFn = (rowA, rowB, columnId) => { | ||
const a = parseFloat(rowA.getValue(columnId)); | ||
const b = parseFloat(rowB.getValue(columnId)); | ||
return a > b ? 1 : a < b ? -1 : 0; | ||
}; | ||
const isNumericColumn = (rows, columnId) => { | ||
return rows.every(row => !isNaN(parseFloat(row[columnId]))); | ||
}; | ||
const tableColumns = (0, _react.useMemo)(() => { | ||
return columns === null || columns === void 0 ? void 0 : columns.map(column => _objectSpread({ | ||
accessorKey: column.field, | ||
header: column.headerName, | ||
sortingFn: !column.sortingFn ? (rowA, rowB, column) => { | ||
var _rowA$original$column, _rowB$original$column; | ||
const numA = (_rowA$original$column = rowA.original[column]) === null || _rowA$original$column === void 0 ? void 0 : _rowA$original$column.toString().toLocaleLowerCase('tr-TR'); | ||
const numB = (_rowB$original$column = rowB.original[column]) === null || _rowB$original$column === void 0 ? void 0 : _rowB$original$column.toString().toLocaleLowerCase('tr-TR'); | ||
return numA === null || numA === void 0 ? void 0 : numA.localeCompare(numB, 'tr-TR'); | ||
} : column.sortingFn | ||
}, column)); | ||
}, [columns]); | ||
return columns === null || columns === void 0 ? void 0 : columns.map(column => { | ||
const isNumeric = isNumericColumn(rows, column.field); | ||
return _objectSpread({ | ||
accessorKey: column.field, | ||
header: column.headerName, | ||
sortingFn: isNumeric ? numericSortingFn : !column.sortingFn ? (rowA, rowB, column) => { | ||
var _rowA$original$column, _rowB$original$column; | ||
const numA = (_rowA$original$column = rowA.original[column]) === null || _rowA$original$column === void 0 ? void 0 : _rowA$original$column.toString().toLocaleLowerCase('tr-TR'); | ||
const numB = (_rowB$original$column = rowB.original[column]) === null || _rowB$original$column === void 0 ? void 0 : _rowB$original$column.toString().toLocaleLowerCase('tr-TR'); | ||
return numA === null || numA === void 0 ? void 0 : numA.localeCompare(numB, 'tr-TR'); | ||
} : column.sortingFn | ||
}, column); | ||
}); | ||
}, [columns, rows]); | ||
const tableInstance = (0, _materialReactTable.useMaterialReactTable)({ | ||
@@ -79,0 +91,0 @@ columns: tableColumns, |
{ | ||
"name": "bam32bittheme", | ||
"version": "2.1.87", | ||
"version": "2.1.88", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "32bit Theme for Material UI v5.x", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1568916
5314