package.build.lib.utils.getFacetedUniqueValues.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of table-core Show documentation
Show all versions of table-core Show documentation
Headless UI for building powerful tables & datagrids for TS/JS.
The newest version!
{"version":3,"file":"getFacetedUniqueValues.js","sources":["../../../src/utils/getFacetedUniqueValues.ts"],"sourcesContent":["import { Table, RowData } from '../types'\nimport { memo } from '../utils'\n\nexport function getFacetedUniqueValues(): (\n table: Table,\n columnId: string\n) => () => Map {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return new Map()\n\n let facetedUniqueValues = new Map()\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 (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n },\n {\n key:\n process.env.NODE_ENV === 'development' &&\n 'getFacetedUniqueValues_' + columnId,\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {},\n }\n )\n}\n"],"names":["getFacetedUniqueValues","table","columnId","memo","_table$getColumn","getColumn","getFacetedRowModel","facetedRowModel","Map","facetedUniqueValues","i","flatRows","length","values","getUniqueValues","j","value","has","_facetedUniqueValues$","set","get","key","process","env","NODE_ENV","debug","_table$options$debugA","options","debugAll","debugTable","onChange"],"mappings":";;;;;;;;;;;;;;;;AAGO,SAASA,sBAAsBA,GAGV;AAC1B,EAAA,OAAO,CAACC,KAAK,EAAEC,QAAQ,KACrBC,UAAI,CACF,MAAA;AAAA,IAAA,IAAAC,gBAAA,CAAA;AAAA,IAAA,OAAM,CAAAA,CAAAA,gBAAA,GAACH,KAAK,CAACI,SAAS,CAACH,QAAQ,CAAC,qBAAz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