{ "version": 3, "sources": ["src/app/typeahead/_models/typeahead-settings.ts"], "sourcesContent": ["import { Observable } from 'rxjs';\nimport { FormControl } from '@angular/forms';\n\nexport type SelectionCompareFn = (a: T, b: T) => boolean;\n\nexport class TypeaheadSettings {\n /**\n * How many ms between typing actions before pipeline to load data is triggered\n */\n debounce: number = 200;\n /**\n * Multiple options can be selected from dropdown. Will be rendered as tag badges.\n */\n multiple: boolean = false;\n /**\n * Id of the input element, for linking label elements (accessibility)\n */\n id: string = '';\n /**\n * Show a locked icon next to input and provide functionality around locking/unlocking a field\n */\n showLocked: boolean = false;\n /**\n * Data to preload the typeahead with on first load\n */\n /**\n * Data to preload the typeahead with on first load\n */\n savedData!: T[] | T;\n /**\n * Function to compare the elements. Should return all elements that fit the matching criteria. \n * This is only used with non-Observable based fetchFn, but must be defined for all uses of typeahead.\n */\n compareFn!: ((optionList: T[], filter: string) => T[]);\n /**\n * Must be defined when addIfNonExisting is true. Used to ensure no duplicates exist when adding.\n */\n compareFnForAdd!: ((optionList: T[], filter: string) => T[]);\n /**\n * Function which is used for comparing objects when keeping track of state. \n * Useful over shallow equal when you have image urls that have random numbers on them.\n */ \n selectionCompareFn?: SelectionCompareFn;\n /**\n * Function to fetch the data from the server. If data is mainatined in memory, wrap in an observable.\n */\n fetchFn!: (filter: string) => Observable;\n /**\n * Minimum number of characters needed to type to trigger the fetch pipeline\n */\n minCharacters: number = 1;\n /**\n * Optional form Control to tie model to. \n */\n formControl?: FormControl;\n /**\n * If true, typeahead will remove already selected items from fetchFn results. Only appies when multiple=true\n */\n unique: boolean = true;\n /**\n * If true, will fire an event for newItemAdded and will prompt the user to add form model to the list of selected items\n */\n addIfNonExisting: boolean = false;\n /**\n * Required for addIfNonExisting to transform the text from model into the item\n */\n addTransformFn!: (text: string) => T;\n /**\n * An optional, but recommended trackby identity function to help Angular render the list better\n */\n trackByIdentityFn!: (index: number, value: T) => T;\n}"], "mappings": "AAKM,IAAOA,EAAP,KAAwB,CAA9BC,aAAA,CAII,KAAAC,SAAmB,IAInB,KAAAC,SAAoB,GAIpB,KAAAC,GAAa,GAIb,KAAAC,WAAsB,GA6BtB,KAAAC,cAAwB,EAQxB,KAAAC,OAAkB,GAIlB,KAAAC,iBAA4B,EAShC", "names": ["TypeaheadSettings", "constructor", "debounce", "multiple", "id", "showLocked", "minCharacters", "unique", "addIfNonExisting"] }