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

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

The newest version!
{"version":3,"file":"getFacetedRowModel.js","sources":["../../../src/utils/getFacetedRowModel.ts"],"sourcesContent":["import { Table, RowModel, Row, RowData } from '../types'\nimport { memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFacetedRowModel(): (\n  table: Table,\n  columnId: string\n) => () => RowModel {\n  return (table, columnId) =>\n    memo(\n      () => [\n        table.getPreFilteredRowModel(),\n        table.getState().columnFilters,\n        table.getState().globalFilter,\n        table.getFilteredRowModel(),\n      ],\n      (preRowModel, columnFilters, globalFilter) => {\n        if (\n          !preRowModel.rows.length ||\n          (!columnFilters?.length && !globalFilter)\n        ) {\n          return preRowModel\n        }\n\n        const filterableIds = [\n          ...columnFilters.map(d => d.id).filter(d => d !== columnId),\n          globalFilter ? '__global__' : undefined,\n        ].filter(Boolean) as string[]\n\n        const filterRowsImpl = (row: Row) => {\n          // Horizontally filter rows through each column\n          for (let i = 0; i < filterableIds.length; i++) {\n            if (row.columnFilters[filterableIds[i]!] === false) {\n              return false\n            }\n          }\n          return true\n        }\n\n        return filterRows(preRowModel.rows, filterRowsImpl, table)\n      },\n      {\n        key:\n          process.env.NODE_ENV === 'development' &&\n          'getFacetedRowModel_' + columnId,\n        debug: () => table.options.debugAll ?? table.options.debugTable,\n        onChange: () => {},\n      }\n    )\n}\n"],"names":["getFacetedRowModel","table","columnId","memo","getPreFilteredRowModel","getState","columnFilters","globalFilter","getFilteredRowModel","preRowModel","rows","length","filterableIds","map","d","id","filter","undefined","Boolean","filterRowsImpl","row","i","filterRows","key","process","env","NODE_ENV","debug","_table$options$debugA","options","debugAll","debugTable","onChange"],"mappings":";;;;;;;;;;;;;;;;;AAIO,SAASA,kBAAkBA,GAGP;EACzB,OAAO,CAACC,KAAK,EAAEC,QAAQ,KACrBC,UAAI,CACF,MAAM,CACJF,KAAK,CAACG,sBAAsB,EAAE,EA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