@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 1.11 kB
Source Map (JSON)
{"version":3,"file":"get-cascader-path-options.mjs","names":[],"sources":["../../../src/components/Cascader/get-cascader-path-options.ts"],"sourcesContent":["import type { CascaderOption } from './Cascader';\n\nexport function getCascaderPathOptions(\n data: CascaderOption[],\n value: string[] | null | undefined\n): CascaderOption[] {\n if (!value || value.length === 0) {\n return [];\n }\n\n const options: CascaderOption[] = [];\n let level: CascaderOption[] | undefined = data;\n\n for (const currentValue of value) {\n if (!level) {\n break;\n }\n\n const node: CascaderOption | undefined = level.find((option) => option.value === currentValue);\n\n if (!node) {\n break;\n }\n\n options.push(node);\n level = node.children;\n }\n\n return options;\n}\n"],"mappings":";;AAEA,SAAgB,uBACd,MACA,OACkB;CAClB,IAAI,CAAC,SAAS,MAAM,WAAW,GAC7B,OAAO,CAAC;CAGV,MAAM,UAA4B,CAAC;CACnC,IAAI,QAAsC;CAE1C,KAAK,MAAM,gBAAgB,OAAO;EAChC,IAAI,CAAC,OACH;EAGF,MAAM,OAAmC,MAAM,MAAM,WAAW,OAAO,UAAU,YAAY;EAE7F,IAAI,CAAC,MACH;EAGF,QAAQ,KAAK,IAAI;EACjB,QAAQ,KAAK;CACf;CAEA,OAAO;AACT"}