All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.build.lib.utils.getFacetedMinMaxValues.js.map Maven / Gradle / Ivy

The newest version!
{"version":3,"file":"getFacetedMinMaxValues.js","sources":["../../../src/utils/getFacetedMinMaxValues.ts"],"sourcesContent":["import { Table, RowData } from '../types'\nimport { memo } from '../utils'\n\nexport function getFacetedMinMaxValues(): (\n  table: Table,\n  columnId: string\n) => () => undefined | [number, number] {\n  return (table, columnId) =>\n    memo(\n      () => [table.getColumn(columnId)?.getFacetedRowModel()],\n      facetedRowModel => {\n        if (!facetedRowModel) return undefined\n\n        const firstValue =\n          facetedRowModel.flatRows[0]?.getUniqueValues(columnId)\n\n        if (typeof firstValue === 'undefined') {\n          return undefined\n        }\n\n        let facetedMinMaxValues: [any, any] = [firstValue, firstValue]\n\n        for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n          const values =\n            facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n          for (let j = 0; j < values.length; j++) {\n            const value = values[j]!\n\n            if (value < facetedMinMaxValues[0]) {\n              facetedMinMaxValues[0] = value\n            } else if (value > facetedMinMaxValues[1]) {\n              facetedMinMaxValues[1] = value\n            }\n          }\n        }\n\n        return facetedMinMaxValues\n      },\n      {\n        key:\n          process.env.NODE_ENV === 'development' &&\n          'getFacetedMinMaxValues_' + columnId,\n        debug: () => table.options.debugAll ?? table.options.debugTable,\n        onChange: () => {},\n      }\n    )\n}\n"],"names":["getFacetedMinMaxValues","table","columnId","memo","_table$getColumn","getColumn","getFacetedRowModel","facetedRowModel","_facetedRowModel$flat","undefined","firstValue","flatRows","getUniqueValues","facetedMinMaxValues","i","length","values","j","value","key","process","env","NODE_ENV","debug","_table$options$debugA","options","debugAll","debugTable","onChange"],"mappings":";;;;;;;;;;;;;;;;AAGO,SAASA,sBAAsBA,GAGE;AACtC,EAAA,OAAO,CAACC,KAAK,EAAEC,QAAQ,KACrBC,UAAI,CACF,MAAA;AAAA,IAAA,IAAAC,gBAAA,CAAA;AAA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