UNPKG

vuetify

Version:

Vue Material Component Framework

1 lines 2.32 kB
{"version":3,"file":"filterTreeItems.mjs","names":["getObjectValueByPath","filterTreeItem","item","search","textKey","text","toLocaleLowerCase","indexOf","filterTreeItems","filter","idKey","childrenKey","excluded","children","match","i","length","add"],"sources":["../../../../src/components/VTreeview/util/filterTreeItems.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable */\n\nimport { getObjectValueByPath } from '../../../util/helpers'\nimport { TreeviewItemFunction } from 'vuetify/types'\n\nexport function filterTreeItem (item: object, search: string, textKey: string): boolean {\n const text = getObjectValueByPath(item, textKey)\n\n return text.toLocaleLowerCase().indexOf(search.toLocaleLowerCase()) > -1\n}\n\nexport function filterTreeItems (\n filter: TreeviewItemFunction,\n item: any,\n search: string,\n idKey: string,\n textKey: string,\n childrenKey: string,\n excluded: Set<string | number>\n): boolean {\n if (filter(item, search, textKey)) {\n return true\n }\n\n const children = getObjectValueByPath(item, childrenKey)\n\n if (children) {\n let match = false\n for (let i = 0; i < children.length; i++) {\n if (filterTreeItems(filter, children[i], search, idKey, textKey, childrenKey, excluded)) {\n match = true\n }\n }\n\n if (match) return true\n }\n\n excluded.add(getObjectValueByPath(item, idKey))\n\n return false\n}\n"],"mappings":"AAAA;AACA;AAAA,SAESA,oBAAoB;AAG7B,OAAO,SAASC,cAAc,CAAEC,IAAY,EAAEC,MAAc,EAAEC,OAAe,EAAW;EACtF,MAAMC,IAAI,GAAGL,oBAAoB,CAACE,IAAI,EAAEE,OAAO,CAAC;EAEhD,OAAOC,IAAI,CAACC,iBAAiB,EAAE,CAACC,OAAO,CAACJ,MAAM,CAACG,iBAAiB,EAAE,CAAC,GAAG,CAAC,CAAC;AAC1E;AAEA,OAAO,SAASE,eAAe,CAC7BC,MAA4B,EAC5BP,IAAS,EACTC,MAAc,EACdO,KAAa,EACbN,OAAe,EACfO,WAAmB,EACnBC,QAA8B,EACrB;EACT,IAAIH,MAAM,CAACP,IAAI,EAAEC,MAAM,EAAEC,OAAO,CAAC,EAAE;IACjC,OAAO,IAAI;EACb;EAEA,MAAMS,QAAQ,GAAGb,oBAAoB,CAACE,IAAI,EAAES,WAAW,CAAC;EAExD,IAAIE,QAAQ,EAAE;IACZ,IAAIC,KAAK,GAAG,KAAK;IACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,QAAQ,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;MACxC,IAAIP,eAAe,CAACC,MAAM,EAAEI,QAAQ,CAACE,CAAC,CAAC,EAAEZ,MAAM,EAAEO,KAAK,EAAEN,OAAO,EAAEO,WAAW,EAAEC,QAAQ,CAAC,EAAE;QACvFE,KAAK,GAAG,IAAI;MACd;IACF;IAEA,IAAIA,KAAK,EAAE,OAAO,IAAI;EACxB;EAEAF,QAAQ,CAACK,GAAG,CAACjB,oBAAoB,CAACE,IAAI,EAAEQ,KAAK,CAAC,CAAC;EAE/C,OAAO,KAAK;AACd"}