ng-select-ng-select.mjs 143 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066
  1. import * as i0 from '@angular/core';
  2. import { inject, ElementRef, input, effect, Directive, TemplateRef, Injectable, Renderer2, NgZone, booleanAttribute, output, viewChild, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, signal, afterNextRender, InjectionToken, HostAttributeToken, ChangeDetectorRef, numberAttribute, model, contentChild, forwardRef, contentChildren, HostListener, NgModule } from '@angular/core';
  3. import { NG_VALUE_ACCESSOR } from '@angular/forms';
  4. import { animationFrameScheduler, asapScheduler, Subject, fromEvent, merge } from 'rxjs';
  5. import { takeUntil, auditTime, tap, startWith, switchMap, debounceTime, filter, map } from 'rxjs/operators';
  6. import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
  7. import { toObservable } from '@angular/core/rxjs-interop';
  8. const unescapedHTMLExp = /[&<>"']/g;
  9. const hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
  10. const htmlEscapes = {
  11. '&': '&amp;',
  12. '<': '&lt;',
  13. '>': '&gt;',
  14. '"': '&quot;',
  15. "'": '&#39;',
  16. };
  17. function escapeHTML(value) {
  18. return value && hasUnescapedHTMLExp.test(value) ? value.replace(unescapedHTMLExp, (chr) => htmlEscapes[chr]) : value;
  19. }
  20. function isDefined(value) {
  21. return value !== undefined && value !== null;
  22. }
  23. function isObject(value) {
  24. return typeof value === 'object' && isDefined(value);
  25. }
  26. function isPromise(value) {
  27. return value instanceof Promise;
  28. }
  29. function isFunction(value) {
  30. return value instanceof Function;
  31. }
  32. class NgItemLabelDirective {
  33. constructor() {
  34. this.element = inject(ElementRef);
  35. this.ngItemLabel = input();
  36. this.escape = input(true);
  37. effect(() => {
  38. this.element.nativeElement.innerHTML = this.escape()
  39. ? escapeHTML(this.ngItemLabel())
  40. : this.ngItemLabel();
  41. });
  42. }
  43. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgItemLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  44. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.0", type: NgItemLabelDirective, isStandalone: true, selector: "[ngItemLabel]", inputs: { ngItemLabel: { classPropertyName: "ngItemLabel", publicName: "ngItemLabel", isSignal: true, isRequired: false, transformFunction: null }, escape: { classPropertyName: "escape", publicName: "escape", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
  45. }
  46. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgItemLabelDirective, decorators: [{
  47. type: Directive,
  48. args: [{
  49. selector: '[ngItemLabel]',
  50. standalone: true,
  51. }]
  52. }], ctorParameters: () => [] });
  53. class NgOptionTemplateDirective {
  54. constructor() {
  55. this.template = inject((TemplateRef));
  56. }
  57. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgOptionTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  58. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgOptionTemplateDirective, isStandalone: true, selector: "[ng-option-tmp]", ngImport: i0 }); }
  59. }
  60. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgOptionTemplateDirective, decorators: [{
  61. type: Directive,
  62. args: [{
  63. // eslint-disable-next-line @angular-eslint/directive-selector
  64. selector: '[ng-option-tmp]',
  65. standalone: true,
  66. }]
  67. }] });
  68. class NgOptgroupTemplateDirective {
  69. constructor() {
  70. this.template = inject((TemplateRef));
  71. }
  72. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgOptgroupTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  73. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgOptgroupTemplateDirective, isStandalone: true, selector: "[ng-optgroup-tmp]", ngImport: i0 }); }
  74. }
  75. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgOptgroupTemplateDirective, decorators: [{
  76. type: Directive,
  77. args: [{
  78. // eslint-disable-next-line @angular-eslint/directive-selector
  79. selector: '[ng-optgroup-tmp]',
  80. standalone: true,
  81. }]
  82. }] });
  83. class NgLabelTemplateDirective {
  84. constructor() {
  85. this.template = inject((TemplateRef));
  86. }
  87. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgLabelTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  88. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgLabelTemplateDirective, isStandalone: true, selector: "[ng-label-tmp]", ngImport: i0 }); }
  89. }
  90. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgLabelTemplateDirective, decorators: [{
  91. type: Directive,
  92. args: [{
  93. // eslint-disable-next-line @angular-eslint/directive-selector
  94. selector: '[ng-label-tmp]',
  95. standalone: true,
  96. }]
  97. }] });
  98. class NgMultiLabelTemplateDirective {
  99. constructor() {
  100. this.template = inject((TemplateRef));
  101. }
  102. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgMultiLabelTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  103. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgMultiLabelTemplateDirective, isStandalone: true, selector: "[ng-multi-label-tmp]", ngImport: i0 }); }
  104. }
  105. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgMultiLabelTemplateDirective, decorators: [{
  106. type: Directive,
  107. args: [{
  108. // eslint-disable-next-line @angular-eslint/directive-selector
  109. selector: '[ng-multi-label-tmp]',
  110. standalone: true,
  111. }]
  112. }] });
  113. class NgHeaderTemplateDirective {
  114. constructor() {
  115. this.template = inject((TemplateRef));
  116. }
  117. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  118. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgHeaderTemplateDirective, isStandalone: true, selector: "[ng-header-tmp]", ngImport: i0 }); }
  119. }
  120. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgHeaderTemplateDirective, decorators: [{
  121. type: Directive,
  122. args: [{
  123. // eslint-disable-next-line @angular-eslint/directive-selector
  124. selector: '[ng-header-tmp]',
  125. standalone: true,
  126. }]
  127. }] });
  128. class NgFooterTemplateDirective {
  129. constructor() {
  130. this.template = inject((TemplateRef));
  131. }
  132. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  133. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgFooterTemplateDirective, isStandalone: true, selector: "[ng-footer-tmp]", ngImport: i0 }); }
  134. }
  135. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgFooterTemplateDirective, decorators: [{
  136. type: Directive,
  137. args: [{
  138. // eslint-disable-next-line @angular-eslint/directive-selector
  139. selector: '[ng-footer-tmp]',
  140. standalone: true,
  141. }]
  142. }] });
  143. class NgNotFoundTemplateDirective {
  144. constructor() {
  145. this.template = inject((TemplateRef));
  146. }
  147. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgNotFoundTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  148. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgNotFoundTemplateDirective, isStandalone: true, selector: "[ng-notfound-tmp]", ngImport: i0 }); }
  149. }
  150. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgNotFoundTemplateDirective, decorators: [{
  151. type: Directive,
  152. args: [{
  153. // eslint-disable-next-line @angular-eslint/directive-selector
  154. selector: '[ng-notfound-tmp]',
  155. standalone: true,
  156. }]
  157. }] });
  158. class NgPlaceholderTemplateDirective {
  159. constructor() {
  160. this.template = inject((TemplateRef));
  161. }
  162. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgPlaceholderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  163. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgPlaceholderTemplateDirective, isStandalone: true, selector: "[ng-placeholder-tmp]", ngImport: i0 }); }
  164. }
  165. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgPlaceholderTemplateDirective, decorators: [{
  166. type: Directive,
  167. args: [{
  168. // eslint-disable-next-line @angular-eslint/directive-selector
  169. selector: '[ng-placeholder-tmp]',
  170. standalone: true,
  171. }]
  172. }] });
  173. class NgTypeToSearchTemplateDirective {
  174. constructor() {
  175. this.template = inject((TemplateRef));
  176. }
  177. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgTypeToSearchTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  178. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgTypeToSearchTemplateDirective, isStandalone: true, selector: "[ng-typetosearch-tmp]", ngImport: i0 }); }
  179. }
  180. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgTypeToSearchTemplateDirective, decorators: [{
  181. type: Directive,
  182. args: [{
  183. // eslint-disable-next-line @angular-eslint/directive-selector
  184. selector: '[ng-typetosearch-tmp]',
  185. standalone: true,
  186. }]
  187. }] });
  188. class NgLoadingTextTemplateDirective {
  189. constructor() {
  190. this.template = inject((TemplateRef));
  191. }
  192. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgLoadingTextTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  193. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgLoadingTextTemplateDirective, isStandalone: true, selector: "[ng-loadingtext-tmp]", ngImport: i0 }); }
  194. }
  195. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgLoadingTextTemplateDirective, decorators: [{
  196. type: Directive,
  197. args: [{
  198. // eslint-disable-next-line @angular-eslint/directive-selector
  199. selector: '[ng-loadingtext-tmp]',
  200. standalone: true,
  201. }]
  202. }] });
  203. class NgTagTemplateDirective {
  204. constructor() {
  205. this.template = inject((TemplateRef));
  206. }
  207. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgTagTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  208. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgTagTemplateDirective, isStandalone: true, selector: "[ng-tag-tmp]", ngImport: i0 }); }
  209. }
  210. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgTagTemplateDirective, decorators: [{
  211. type: Directive,
  212. args: [{
  213. // eslint-disable-next-line @angular-eslint/directive-selector
  214. selector: '[ng-tag-tmp]',
  215. standalone: true,
  216. }]
  217. }] });
  218. class NgLoadingSpinnerTemplateDirective {
  219. constructor() {
  220. this.template = inject((TemplateRef));
  221. }
  222. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgLoadingSpinnerTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  223. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgLoadingSpinnerTemplateDirective, isStandalone: true, selector: "[ng-loadingspinner-tmp]", ngImport: i0 }); }
  224. }
  225. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgLoadingSpinnerTemplateDirective, decorators: [{
  226. type: Directive,
  227. args: [{
  228. // eslint-disable-next-line @angular-eslint/directive-selector
  229. selector: '[ng-loadingspinner-tmp]',
  230. standalone: true,
  231. }]
  232. }] });
  233. // eslint-disable-next-line @angular-eslint/directive-selector
  234. class NgClearButtonTemplateDirective {
  235. constructor() {
  236. this.template = inject((TemplateRef));
  237. }
  238. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgClearButtonTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  239. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0", type: NgClearButtonTemplateDirective, isStandalone: true, selector: "[ng-clearbutton-tmp]", ngImport: i0 }); }
  240. }
  241. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgClearButtonTemplateDirective, decorators: [{
  242. type: Directive,
  243. args: [{ selector: '[ng-clearbutton-tmp]', standalone: true }]
  244. }] });
  245. class NgSelectConfig {
  246. constructor() {
  247. this.fixedPlaceholder = true;
  248. this.notFoundText = 'No items found';
  249. this.typeToSearchText = 'Type to search';
  250. this.addTagText = 'Add item';
  251. this.loadingText = 'Loading...';
  252. this.clearAllText = 'Clear all';
  253. this.disableVirtualScroll = true;
  254. this.openOnEnter = true;
  255. this.appearance = 'underline';
  256. this.tabFocusOnClear = true;
  257. }
  258. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
  259. static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectConfig, providedIn: 'root' }); }
  260. }
  261. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectConfig, decorators: [{
  262. type: Injectable,
  263. args: [{ providedIn: 'root' }]
  264. }] });
  265. class ConsoleService {
  266. warn(message) {
  267. console.warn(message);
  268. }
  269. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ConsoleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
  270. static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ConsoleService, providedIn: 'root' }); }
  271. }
  272. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ConsoleService, decorators: [{
  273. type: Injectable,
  274. args: [{ providedIn: 'root' }]
  275. }] });
  276. function newId() {
  277. // First character is an 'a', it's good practice to tag id to begin with a letter
  278. return 'axxxxxxxxxxx'.replace(/[x]/g, () => {
  279. // eslint-disable-next-line no-bitwise
  280. const val = (Math.random() * 16) | 0;
  281. return val.toString(16);
  282. });
  283. }
  284. const diacritics = {
  285. '\u24B6': 'A',
  286. '\uFF21': 'A',
  287. '\u00C0': 'A',
  288. '\u00C1': 'A',
  289. '\u00C2': 'A',
  290. '\u1EA6': 'A',
  291. '\u1EA4': 'A',
  292. '\u1EAA': 'A',
  293. '\u1EA8': 'A',
  294. '\u00C3': 'A',
  295. '\u0100': 'A',
  296. '\u0102': 'A',
  297. '\u1EB0': 'A',
  298. '\u1EAE': 'A',
  299. '\u1EB4': 'A',
  300. '\u1EB2': 'A',
  301. '\u0226': 'A',
  302. '\u01E0': 'A',
  303. '\u00C4': 'A',
  304. '\u01DE': 'A',
  305. '\u1EA2': 'A',
  306. '\u00C5': 'A',
  307. '\u01FA': 'A',
  308. '\u01CD': 'A',
  309. '\u0200': 'A',
  310. '\u0202': 'A',
  311. '\u1EA0': 'A',
  312. '\u1EAC': 'A',
  313. '\u1EB6': 'A',
  314. '\u1E00': 'A',
  315. '\u0104': 'A',
  316. '\u023A': 'A',
  317. '\u2C6F': 'A',
  318. '\uA732': 'AA',
  319. '\u00C6': 'AE',
  320. '\u01FC': 'AE',
  321. '\u01E2': 'AE',
  322. '\uA734': 'AO',
  323. '\uA736': 'AU',
  324. '\uA738': 'AV',
  325. '\uA73A': 'AV',
  326. '\uA73C': 'AY',
  327. '\u24B7': 'B',
  328. '\uFF22': 'B',
  329. '\u1E02': 'B',
  330. '\u1E04': 'B',
  331. '\u1E06': 'B',
  332. '\u0243': 'B',
  333. '\u0182': 'B',
  334. '\u0181': 'B',
  335. '\u24B8': 'C',
  336. '\uFF23': 'C',
  337. '\u0106': 'C',
  338. '\u0108': 'C',
  339. '\u010A': 'C',
  340. '\u010C': 'C',
  341. '\u00C7': 'C',
  342. '\u1E08': 'C',
  343. '\u0187': 'C',
  344. '\u023B': 'C',
  345. '\uA73E': 'C',
  346. '\u24B9': 'D',
  347. '\uFF24': 'D',
  348. '\u1E0A': 'D',
  349. '\u010E': 'D',
  350. '\u1E0C': 'D',
  351. '\u1E10': 'D',
  352. '\u1E12': 'D',
  353. '\u1E0E': 'D',
  354. '\u0110': 'D',
  355. '\u018B': 'D',
  356. '\u018A': 'D',
  357. '\u0189': 'D',
  358. '\uA779': 'D',
  359. '\u01F1': 'DZ',
  360. '\u01C4': 'DZ',
  361. '\u01F2': 'Dz',
  362. '\u01C5': 'Dz',
  363. '\u24BA': 'E',
  364. '\uFF25': 'E',
  365. '\u00C8': 'E',
  366. '\u00C9': 'E',
  367. '\u00CA': 'E',
  368. '\u1EC0': 'E',
  369. '\u1EBE': 'E',
  370. '\u1EC4': 'E',
  371. '\u1EC2': 'E',
  372. '\u1EBC': 'E',
  373. '\u0112': 'E',
  374. '\u1E14': 'E',
  375. '\u1E16': 'E',
  376. '\u0114': 'E',
  377. '\u0116': 'E',
  378. '\u00CB': 'E',
  379. '\u1EBA': 'E',
  380. '\u011A': 'E',
  381. '\u0204': 'E',
  382. '\u0206': 'E',
  383. '\u1EB8': 'E',
  384. '\u1EC6': 'E',
  385. '\u0228': 'E',
  386. '\u1E1C': 'E',
  387. '\u0118': 'E',
  388. '\u1E18': 'E',
  389. '\u1E1A': 'E',
  390. '\u0190': 'E',
  391. '\u018E': 'E',
  392. '\u24BB': 'F',
  393. '\uFF26': 'F',
  394. '\u1E1E': 'F',
  395. '\u0191': 'F',
  396. '\uA77B': 'F',
  397. '\u24BC': 'G',
  398. '\uFF27': 'G',
  399. '\u01F4': 'G',
  400. '\u011C': 'G',
  401. '\u1E20': 'G',
  402. '\u011E': 'G',
  403. '\u0120': 'G',
  404. '\u01E6': 'G',
  405. '\u0122': 'G',
  406. '\u01E4': 'G',
  407. '\u0193': 'G',
  408. '\uA7A0': 'G',
  409. '\uA77D': 'G',
  410. '\uA77E': 'G',
  411. '\u24BD': 'H',
  412. '\uFF28': 'H',
  413. '\u0124': 'H',
  414. '\u1E22': 'H',
  415. '\u1E26': 'H',
  416. '\u021E': 'H',
  417. '\u1E24': 'H',
  418. '\u1E28': 'H',
  419. '\u1E2A': 'H',
  420. '\u0126': 'H',
  421. '\u2C67': 'H',
  422. '\u2C75': 'H',
  423. '\uA78D': 'H',
  424. '\u24BE': 'I',
  425. '\uFF29': 'I',
  426. '\u00CC': 'I',
  427. '\u00CD': 'I',
  428. '\u00CE': 'I',
  429. '\u0128': 'I',
  430. '\u012A': 'I',
  431. '\u012C': 'I',
  432. '\u0130': 'I',
  433. '\u00CF': 'I',
  434. '\u1E2E': 'I',
  435. '\u1EC8': 'I',
  436. '\u01CF': 'I',
  437. '\u0208': 'I',
  438. '\u020A': 'I',
  439. '\u1ECA': 'I',
  440. '\u012E': 'I',
  441. '\u1E2C': 'I',
  442. '\u0197': 'I',
  443. '\u24BF': 'J',
  444. '\uFF2A': 'J',
  445. '\u0134': 'J',
  446. '\u0248': 'J',
  447. '\u24C0': 'K',
  448. '\uFF2B': 'K',
  449. '\u1E30': 'K',
  450. '\u01E8': 'K',
  451. '\u1E32': 'K',
  452. '\u0136': 'K',
  453. '\u1E34': 'K',
  454. '\u0198': 'K',
  455. '\u2C69': 'K',
  456. '\uA740': 'K',
  457. '\uA742': 'K',
  458. '\uA744': 'K',
  459. '\uA7A2': 'K',
  460. '\u24C1': 'L',
  461. '\uFF2C': 'L',
  462. '\u013F': 'L',
  463. '\u0139': 'L',
  464. '\u013D': 'L',
  465. '\u1E36': 'L',
  466. '\u1E38': 'L',
  467. '\u013B': 'L',
  468. '\u1E3C': 'L',
  469. '\u1E3A': 'L',
  470. '\u0141': 'L',
  471. '\u023D': 'L',
  472. '\u2C62': 'L',
  473. '\u2C60': 'L',
  474. '\uA748': 'L',
  475. '\uA746': 'L',
  476. '\uA780': 'L',
  477. '\u01C7': 'LJ',
  478. '\u01C8': 'Lj',
  479. '\u24C2': 'M',
  480. '\uFF2D': 'M',
  481. '\u1E3E': 'M',
  482. '\u1E40': 'M',
  483. '\u1E42': 'M',
  484. '\u2C6E': 'M',
  485. '\u019C': 'M',
  486. '\u24C3': 'N',
  487. '\uFF2E': 'N',
  488. '\u01F8': 'N',
  489. '\u0143': 'N',
  490. '\u00D1': 'N',
  491. '\u1E44': 'N',
  492. '\u0147': 'N',
  493. '\u1E46': 'N',
  494. '\u0145': 'N',
  495. '\u1E4A': 'N',
  496. '\u1E48': 'N',
  497. '\u0220': 'N',
  498. '\u019D': 'N',
  499. '\uA790': 'N',
  500. '\uA7A4': 'N',
  501. '\u01CA': 'NJ',
  502. '\u01CB': 'Nj',
  503. '\u24C4': 'O',
  504. '\uFF2F': 'O',
  505. '\u00D2': 'O',
  506. '\u00D3': 'O',
  507. '\u00D4': 'O',
  508. '\u1ED2': 'O',
  509. '\u1ED0': 'O',
  510. '\u1ED6': 'O',
  511. '\u1ED4': 'O',
  512. '\u00D5': 'O',
  513. '\u1E4C': 'O',
  514. '\u022C': 'O',
  515. '\u1E4E': 'O',
  516. '\u014C': 'O',
  517. '\u1E50': 'O',
  518. '\u1E52': 'O',
  519. '\u014E': 'O',
  520. '\u022E': 'O',
  521. '\u0230': 'O',
  522. '\u00D6': 'O',
  523. '\u022A': 'O',
  524. '\u1ECE': 'O',
  525. '\u0150': 'O',
  526. '\u01D1': 'O',
  527. '\u020C': 'O',
  528. '\u020E': 'O',
  529. '\u01A0': 'O',
  530. '\u1EDC': 'O',
  531. '\u1EDA': 'O',
  532. '\u1EE0': 'O',
  533. '\u1EDE': 'O',
  534. '\u1EE2': 'O',
  535. '\u1ECC': 'O',
  536. '\u1ED8': 'O',
  537. '\u01EA': 'O',
  538. '\u01EC': 'O',
  539. '\u00D8': 'O',
  540. '\u01FE': 'O',
  541. '\u0186': 'O',
  542. '\u019F': 'O',
  543. '\uA74A': 'O',
  544. '\uA74C': 'O',
  545. '\u01A2': 'OI',
  546. '\uA74E': 'OO',
  547. '\u0222': 'OU',
  548. '\u24C5': 'P',
  549. '\uFF30': 'P',
  550. '\u1E54': 'P',
  551. '\u1E56': 'P',
  552. '\u01A4': 'P',
  553. '\u2C63': 'P',
  554. '\uA750': 'P',
  555. '\uA752': 'P',
  556. '\uA754': 'P',
  557. '\u24C6': 'Q',
  558. '\uFF31': 'Q',
  559. '\uA756': 'Q',
  560. '\uA758': 'Q',
  561. '\u024A': 'Q',
  562. '\u24C7': 'R',
  563. '\uFF32': 'R',
  564. '\u0154': 'R',
  565. '\u1E58': 'R',
  566. '\u0158': 'R',
  567. '\u0210': 'R',
  568. '\u0212': 'R',
  569. '\u1E5A': 'R',
  570. '\u1E5C': 'R',
  571. '\u0156': 'R',
  572. '\u1E5E': 'R',
  573. '\u024C': 'R',
  574. '\u2C64': 'R',
  575. '\uA75A': 'R',
  576. '\uA7A6': 'R',
  577. '\uA782': 'R',
  578. '\u24C8': 'S',
  579. '\uFF33': 'S',
  580. '\u1E9E': 'S',
  581. '\u015A': 'S',
  582. '\u1E64': 'S',
  583. '\u015C': 'S',
  584. '\u1E60': 'S',
  585. '\u0160': 'S',
  586. '\u1E66': 'S',
  587. '\u1E62': 'S',
  588. '\u1E68': 'S',
  589. '\u0218': 'S',
  590. '\u015E': 'S',
  591. '\u2C7E': 'S',
  592. '\uA7A8': 'S',
  593. '\uA784': 'S',
  594. '\u24C9': 'T',
  595. '\uFF34': 'T',
  596. '\u1E6A': 'T',
  597. '\u0164': 'T',
  598. '\u1E6C': 'T',
  599. '\u021A': 'T',
  600. '\u0162': 'T',
  601. '\u1E70': 'T',
  602. '\u1E6E': 'T',
  603. '\u0166': 'T',
  604. '\u01AC': 'T',
  605. '\u01AE': 'T',
  606. '\u023E': 'T',
  607. '\uA786': 'T',
  608. '\uA728': 'TZ',
  609. '\u24CA': 'U',
  610. '\uFF35': 'U',
  611. '\u00D9': 'U',
  612. '\u00DA': 'U',
  613. '\u00DB': 'U',
  614. '\u0168': 'U',
  615. '\u1E78': 'U',
  616. '\u016A': 'U',
  617. '\u1E7A': 'U',
  618. '\u016C': 'U',
  619. '\u00DC': 'U',
  620. '\u01DB': 'U',
  621. '\u01D7': 'U',
  622. '\u01D5': 'U',
  623. '\u01D9': 'U',
  624. '\u1EE6': 'U',
  625. '\u016E': 'U',
  626. '\u0170': 'U',
  627. '\u01D3': 'U',
  628. '\u0214': 'U',
  629. '\u0216': 'U',
  630. '\u01AF': 'U',
  631. '\u1EEA': 'U',
  632. '\u1EE8': 'U',
  633. '\u1EEE': 'U',
  634. '\u1EEC': 'U',
  635. '\u1EF0': 'U',
  636. '\u1EE4': 'U',
  637. '\u1E72': 'U',
  638. '\u0172': 'U',
  639. '\u1E76': 'U',
  640. '\u1E74': 'U',
  641. '\u0244': 'U',
  642. '\u24CB': 'V',
  643. '\uFF36': 'V',
  644. '\u1E7C': 'V',
  645. '\u1E7E': 'V',
  646. '\u01B2': 'V',
  647. '\uA75E': 'V',
  648. '\u0245': 'V',
  649. '\uA760': 'VY',
  650. '\u24CC': 'W',
  651. '\uFF37': 'W',
  652. '\u1E80': 'W',
  653. '\u1E82': 'W',
  654. '\u0174': 'W',
  655. '\u1E86': 'W',
  656. '\u1E84': 'W',
  657. '\u1E88': 'W',
  658. '\u2C72': 'W',
  659. '\u24CD': 'X',
  660. '\uFF38': 'X',
  661. '\u1E8A': 'X',
  662. '\u1E8C': 'X',
  663. '\u24CE': 'Y',
  664. '\uFF39': 'Y',
  665. '\u1EF2': 'Y',
  666. '\u00DD': 'Y',
  667. '\u0176': 'Y',
  668. '\u1EF8': 'Y',
  669. '\u0232': 'Y',
  670. '\u1E8E': 'Y',
  671. '\u0178': 'Y',
  672. '\u1EF6': 'Y',
  673. '\u1EF4': 'Y',
  674. '\u01B3': 'Y',
  675. '\u024E': 'Y',
  676. '\u1EFE': 'Y',
  677. '\u24CF': 'Z',
  678. '\uFF3A': 'Z',
  679. '\u0179': 'Z',
  680. '\u1E90': 'Z',
  681. '\u017B': 'Z',
  682. '\u017D': 'Z',
  683. '\u1E92': 'Z',
  684. '\u1E94': 'Z',
  685. '\u01B5': 'Z',
  686. '\u0224': 'Z',
  687. '\u2C7F': 'Z',
  688. '\u2C6B': 'Z',
  689. '\uA762': 'Z',
  690. '\u24D0': 'a',
  691. '\uFF41': 'a',
  692. '\u1E9A': 'a',
  693. '\u00E0': 'a',
  694. '\u00E1': 'a',
  695. '\u00E2': 'a',
  696. '\u1EA7': 'a',
  697. '\u1EA5': 'a',
  698. '\u1EAB': 'a',
  699. '\u1EA9': 'a',
  700. '\u00E3': 'a',
  701. '\u0101': 'a',
  702. '\u0103': 'a',
  703. '\u1EB1': 'a',
  704. '\u1EAF': 'a',
  705. '\u1EB5': 'a',
  706. '\u1EB3': 'a',
  707. '\u0227': 'a',
  708. '\u01E1': 'a',
  709. '\u00E4': 'a',
  710. '\u01DF': 'a',
  711. '\u1EA3': 'a',
  712. '\u00E5': 'a',
  713. '\u01FB': 'a',
  714. '\u01CE': 'a',
  715. '\u0201': 'a',
  716. '\u0203': 'a',
  717. '\u1EA1': 'a',
  718. '\u1EAD': 'a',
  719. '\u1EB7': 'a',
  720. '\u1E01': 'a',
  721. '\u0105': 'a',
  722. '\u2C65': 'a',
  723. '\u0250': 'a',
  724. '\uA733': 'aa',
  725. '\u00E6': 'ae',
  726. '\u01FD': 'ae',
  727. '\u01E3': 'ae',
  728. '\uA735': 'ao',
  729. '\uA737': 'au',
  730. '\uA739': 'av',
  731. '\uA73B': 'av',
  732. '\uA73D': 'ay',
  733. '\u24D1': 'b',
  734. '\uFF42': 'b',
  735. '\u1E03': 'b',
  736. '\u1E05': 'b',
  737. '\u1E07': 'b',
  738. '\u0180': 'b',
  739. '\u0183': 'b',
  740. '\u0253': 'b',
  741. '\u24D2': 'c',
  742. '\uFF43': 'c',
  743. '\u0107': 'c',
  744. '\u0109': 'c',
  745. '\u010B': 'c',
  746. '\u010D': 'c',
  747. '\u00E7': 'c',
  748. '\u1E09': 'c',
  749. '\u0188': 'c',
  750. '\u023C': 'c',
  751. '\uA73F': 'c',
  752. '\u2184': 'c',
  753. '\u24D3': 'd',
  754. '\uFF44': 'd',
  755. '\u1E0B': 'd',
  756. '\u010F': 'd',
  757. '\u1E0D': 'd',
  758. '\u1E11': 'd',
  759. '\u1E13': 'd',
  760. '\u1E0F': 'd',
  761. '\u0111': 'd',
  762. '\u018C': 'd',
  763. '\u0256': 'd',
  764. '\u0257': 'd',
  765. '\uA77A': 'd',
  766. '\u01F3': 'dz',
  767. '\u01C6': 'dz',
  768. '\u24D4': 'e',
  769. '\uFF45': 'e',
  770. '\u00E8': 'e',
  771. '\u00E9': 'e',
  772. '\u00EA': 'e',
  773. '\u1EC1': 'e',
  774. '\u1EBF': 'e',
  775. '\u1EC5': 'e',
  776. '\u1EC3': 'e',
  777. '\u1EBD': 'e',
  778. '\u0113': 'e',
  779. '\u1E15': 'e',
  780. '\u1E17': 'e',
  781. '\u0115': 'e',
  782. '\u0117': 'e',
  783. '\u00EB': 'e',
  784. '\u1EBB': 'e',
  785. '\u011B': 'e',
  786. '\u0205': 'e',
  787. '\u0207': 'e',
  788. '\u1EB9': 'e',
  789. '\u1EC7': 'e',
  790. '\u0229': 'e',
  791. '\u1E1D': 'e',
  792. '\u0119': 'e',
  793. '\u1E19': 'e',
  794. '\u1E1B': 'e',
  795. '\u0247': 'e',
  796. '\u025B': 'e',
  797. '\u01DD': 'e',
  798. '\u24D5': 'f',
  799. '\uFF46': 'f',
  800. '\u1E1F': 'f',
  801. '\u0192': 'f',
  802. '\uA77C': 'f',
  803. '\u24D6': 'g',
  804. '\uFF47': 'g',
  805. '\u01F5': 'g',
  806. '\u011D': 'g',
  807. '\u1E21': 'g',
  808. '\u011F': 'g',
  809. '\u0121': 'g',
  810. '\u01E7': 'g',
  811. '\u0123': 'g',
  812. '\u01E5': 'g',
  813. '\u0260': 'g',
  814. '\uA7A1': 'g',
  815. '\u1D79': 'g',
  816. '\uA77F': 'g',
  817. '\u24D7': 'h',
  818. '\uFF48': 'h',
  819. '\u0125': 'h',
  820. '\u1E23': 'h',
  821. '\u1E27': 'h',
  822. '\u021F': 'h',
  823. '\u1E25': 'h',
  824. '\u1E29': 'h',
  825. '\u1E2B': 'h',
  826. '\u1E96': 'h',
  827. '\u0127': 'h',
  828. '\u2C68': 'h',
  829. '\u2C76': 'h',
  830. '\u0265': 'h',
  831. '\u0195': 'hv',
  832. '\u24D8': 'i',
  833. '\uFF49': 'i',
  834. '\u00EC': 'i',
  835. '\u00ED': 'i',
  836. '\u00EE': 'i',
  837. '\u0129': 'i',
  838. '\u012B': 'i',
  839. '\u012D': 'i',
  840. '\u00EF': 'i',
  841. '\u1E2F': 'i',
  842. '\u1EC9': 'i',
  843. '\u01D0': 'i',
  844. '\u0209': 'i',
  845. '\u020B': 'i',
  846. '\u1ECB': 'i',
  847. '\u012F': 'i',
  848. '\u1E2D': 'i',
  849. '\u0268': 'i',
  850. '\u0131': 'i',
  851. '\u24D9': 'j',
  852. '\uFF4A': 'j',
  853. '\u0135': 'j',
  854. '\u01F0': 'j',
  855. '\u0249': 'j',
  856. '\u24DA': 'k',
  857. '\uFF4B': 'k',
  858. '\u1E31': 'k',
  859. '\u01E9': 'k',
  860. '\u1E33': 'k',
  861. '\u0137': 'k',
  862. '\u1E35': 'k',
  863. '\u0199': 'k',
  864. '\u2C6A': 'k',
  865. '\uA741': 'k',
  866. '\uA743': 'k',
  867. '\uA745': 'k',
  868. '\uA7A3': 'k',
  869. '\u24DB': 'l',
  870. '\uFF4C': 'l',
  871. '\u0140': 'l',
  872. '\u013A': 'l',
  873. '\u013E': 'l',
  874. '\u1E37': 'l',
  875. '\u1E39': 'l',
  876. '\u013C': 'l',
  877. '\u1E3D': 'l',
  878. '\u1E3B': 'l',
  879. '\u017F': 'l',
  880. '\u0142': 'l',
  881. '\u019A': 'l',
  882. '\u026B': 'l',
  883. '\u2C61': 'l',
  884. '\uA749': 'l',
  885. '\uA781': 'l',
  886. '\uA747': 'l',
  887. '\u01C9': 'lj',
  888. '\u24DC': 'm',
  889. '\uFF4D': 'm',
  890. '\u1E3F': 'm',
  891. '\u1E41': 'm',
  892. '\u1E43': 'm',
  893. '\u0271': 'm',
  894. '\u026F': 'm',
  895. '\u24DD': 'n',
  896. '\uFF4E': 'n',
  897. '\u01F9': 'n',
  898. '\u0144': 'n',
  899. '\u00F1': 'n',
  900. '\u1E45': 'n',
  901. '\u0148': 'n',
  902. '\u1E47': 'n',
  903. '\u0146': 'n',
  904. '\u1E4B': 'n',
  905. '\u1E49': 'n',
  906. '\u019E': 'n',
  907. '\u0272': 'n',
  908. '\u0149': 'n',
  909. '\uA791': 'n',
  910. '\uA7A5': 'n',
  911. '\u01CC': 'nj',
  912. '\u24DE': 'o',
  913. '\uFF4F': 'o',
  914. '\u00F2': 'o',
  915. '\u00F3': 'o',
  916. '\u00F4': 'o',
  917. '\u1ED3': 'o',
  918. '\u1ED1': 'o',
  919. '\u1ED7': 'o',
  920. '\u1ED5': 'o',
  921. '\u00F5': 'o',
  922. '\u1E4D': 'o',
  923. '\u022D': 'o',
  924. '\u1E4F': 'o',
  925. '\u014D': 'o',
  926. '\u1E51': 'o',
  927. '\u1E53': 'o',
  928. '\u014F': 'o',
  929. '\u022F': 'o',
  930. '\u0231': 'o',
  931. '\u00F6': 'o',
  932. '\u022B': 'o',
  933. '\u1ECF': 'o',
  934. '\u0151': 'o',
  935. '\u01D2': 'o',
  936. '\u020D': 'o',
  937. '\u020F': 'o',
  938. '\u01A1': 'o',
  939. '\u1EDD': 'o',
  940. '\u1EDB': 'o',
  941. '\u1EE1': 'o',
  942. '\u1EDF': 'o',
  943. '\u1EE3': 'o',
  944. '\u1ECD': 'o',
  945. '\u1ED9': 'o',
  946. '\u01EB': 'o',
  947. '\u01ED': 'o',
  948. '\u00F8': 'o',
  949. '\u01FF': 'o',
  950. '\u0254': 'o',
  951. '\uA74B': 'o',
  952. '\uA74D': 'o',
  953. '\u0275': 'o',
  954. '\u01A3': 'oi',
  955. '\u0223': 'ou',
  956. '\uA74F': 'oo',
  957. '\u24DF': 'p',
  958. '\uFF50': 'p',
  959. '\u1E55': 'p',
  960. '\u1E57': 'p',
  961. '\u01A5': 'p',
  962. '\u1D7D': 'p',
  963. '\uA751': 'p',
  964. '\uA753': 'p',
  965. '\uA755': 'p',
  966. '\u24E0': 'q',
  967. '\uFF51': 'q',
  968. '\u024B': 'q',
  969. '\uA757': 'q',
  970. '\uA759': 'q',
  971. '\u24E1': 'r',
  972. '\uFF52': 'r',
  973. '\u0155': 'r',
  974. '\u1E59': 'r',
  975. '\u0159': 'r',
  976. '\u0211': 'r',
  977. '\u0213': 'r',
  978. '\u1E5B': 'r',
  979. '\u1E5D': 'r',
  980. '\u0157': 'r',
  981. '\u1E5F': 'r',
  982. '\u024D': 'r',
  983. '\u027D': 'r',
  984. '\uA75B': 'r',
  985. '\uA7A7': 'r',
  986. '\uA783': 'r',
  987. '\u24E2': 's',
  988. '\uFF53': 's',
  989. '\u00DF': 's',
  990. '\u015B': 's',
  991. '\u1E65': 's',
  992. '\u015D': 's',
  993. '\u1E61': 's',
  994. '\u0161': 's',
  995. '\u1E67': 's',
  996. '\u1E63': 's',
  997. '\u1E69': 's',
  998. '\u0219': 's',
  999. '\u015F': 's',
  1000. '\u023F': 's',
  1001. '\uA7A9': 's',
  1002. '\uA785': 's',
  1003. '\u1E9B': 's',
  1004. '\u24E3': 't',
  1005. '\uFF54': 't',
  1006. '\u1E6B': 't',
  1007. '\u1E97': 't',
  1008. '\u0165': 't',
  1009. '\u1E6D': 't',
  1010. '\u021B': 't',
  1011. '\u0163': 't',
  1012. '\u1E71': 't',
  1013. '\u1E6F': 't',
  1014. '\u0167': 't',
  1015. '\u01AD': 't',
  1016. '\u0288': 't',
  1017. '\u2C66': 't',
  1018. '\uA787': 't',
  1019. '\uA729': 'tz',
  1020. '\u24E4': 'u',
  1021. '\uFF55': 'u',
  1022. '\u00F9': 'u',
  1023. '\u00FA': 'u',
  1024. '\u00FB': 'u',
  1025. '\u0169': 'u',
  1026. '\u1E79': 'u',
  1027. '\u016B': 'u',
  1028. '\u1E7B': 'u',
  1029. '\u016D': 'u',
  1030. '\u00FC': 'u',
  1031. '\u01DC': 'u',
  1032. '\u01D8': 'u',
  1033. '\u01D6': 'u',
  1034. '\u01DA': 'u',
  1035. '\u1EE7': 'u',
  1036. '\u016F': 'u',
  1037. '\u0171': 'u',
  1038. '\u01D4': 'u',
  1039. '\u0215': 'u',
  1040. '\u0217': 'u',
  1041. '\u01B0': 'u',
  1042. '\u1EEB': 'u',
  1043. '\u1EE9': 'u',
  1044. '\u1EEF': 'u',
  1045. '\u1EED': 'u',
  1046. '\u1EF1': 'u',
  1047. '\u1EE5': 'u',
  1048. '\u1E73': 'u',
  1049. '\u0173': 'u',
  1050. '\u1E77': 'u',
  1051. '\u1E75': 'u',
  1052. '\u0289': 'u',
  1053. '\u24E5': 'v',
  1054. '\uFF56': 'v',
  1055. '\u1E7D': 'v',
  1056. '\u1E7F': 'v',
  1057. '\u028B': 'v',
  1058. '\uA75F': 'v',
  1059. '\u028C': 'v',
  1060. '\uA761': 'vy',
  1061. '\u24E6': 'w',
  1062. '\uFF57': 'w',
  1063. '\u1E81': 'w',
  1064. '\u1E83': 'w',
  1065. '\u0175': 'w',
  1066. '\u1E87': 'w',
  1067. '\u1E85': 'w',
  1068. '\u1E98': 'w',
  1069. '\u1E89': 'w',
  1070. '\u2C73': 'w',
  1071. '\u24E7': 'x',
  1072. '\uFF58': 'x',
  1073. '\u1E8B': 'x',
  1074. '\u1E8D': 'x',
  1075. '\u24E8': 'y',
  1076. '\uFF59': 'y',
  1077. '\u1EF3': 'y',
  1078. '\u00FD': 'y',
  1079. '\u0177': 'y',
  1080. '\u1EF9': 'y',
  1081. '\u0233': 'y',
  1082. '\u1E8F': 'y',
  1083. '\u00FF': 'y',
  1084. '\u1EF7': 'y',
  1085. '\u1E99': 'y',
  1086. '\u1EF5': 'y',
  1087. '\u01B4': 'y',
  1088. '\u024F': 'y',
  1089. '\u1EFF': 'y',
  1090. '\u24E9': 'z',
  1091. '\uFF5A': 'z',
  1092. '\u017A': 'z',
  1093. '\u1E91': 'z',
  1094. '\u017C': 'z',
  1095. '\u017E': 'z',
  1096. '\u1E93': 'z',
  1097. '\u1E95': 'z',
  1098. '\u01B6': 'z',
  1099. '\u0225': 'z',
  1100. '\u0240': 'z',
  1101. '\u2C6C': 'z',
  1102. '\uA763': 'z',
  1103. '\u0386': '\u0391',
  1104. '\u0388': '\u0395',
  1105. '\u0389': '\u0397',
  1106. '\u038A': '\u0399',
  1107. '\u03AA': '\u0399',
  1108. '\u038C': '\u039F',
  1109. '\u038E': '\u03A5',
  1110. '\u03AB': '\u03A5',
  1111. '\u038F': '\u03A9',
  1112. '\u03AC': '\u03B1',
  1113. '\u03AD': '\u03B5',
  1114. '\u03AE': '\u03B7',
  1115. '\u03AF': '\u03B9',
  1116. '\u03CA': '\u03B9',
  1117. '\u0390': '\u03B9',
  1118. '\u03CC': '\u03BF',
  1119. '\u03CD': '\u03C5',
  1120. '\u03CB': '\u03C5',
  1121. '\u03B0': '\u03C5',
  1122. '\u03C9': '\u03C9',
  1123. '\u03C2': '\u03C3',
  1124. };
  1125. function stripSpecialChars(text) {
  1126. const match = (a) => diacritics[a] || a;
  1127. return text.replace(/[^\u0000-\u007E]/g, match);
  1128. }
  1129. class ItemsList {
  1130. constructor(_ngSelect, _selectionModel) {
  1131. this._ngSelect = _ngSelect;
  1132. this._selectionModel = _selectionModel;
  1133. this._items = [];
  1134. this._filteredItems = [];
  1135. this._markedIndex = -1;
  1136. }
  1137. get items() {
  1138. return this._items;
  1139. }
  1140. get filteredItems() {
  1141. return this._filteredItems;
  1142. }
  1143. get markedIndex() {
  1144. return this._markedIndex;
  1145. }
  1146. get selectedItems() {
  1147. return this._selectionModel.value;
  1148. }
  1149. get markedItem() {
  1150. return this._filteredItems[this._markedIndex];
  1151. }
  1152. get noItemsToSelect() {
  1153. return this._ngSelect.hideSelected() && this._items.length === this.selectedItems.length;
  1154. }
  1155. get maxItemsSelected() {
  1156. return this._ngSelect.multiple() && this._ngSelect.maxSelectedItems() <= this.selectedItems.length;
  1157. }
  1158. get lastSelectedItem() {
  1159. let i = this.selectedItems.length - 1;
  1160. for (; i >= 0; i--) {
  1161. const item = this.selectedItems[i];
  1162. if (!item.disabled) {
  1163. return item;
  1164. }
  1165. }
  1166. return null;
  1167. }
  1168. setItems(items) {
  1169. this._items = items.map((item, index) => this.mapItem(item, index));
  1170. const groupBy = this._ngSelect.groupBy();
  1171. if (groupBy) {
  1172. this._groups = this._groupBy(this._items, groupBy);
  1173. this._items = this._flatten(this._groups);
  1174. }
  1175. else {
  1176. this._groups = new Map();
  1177. this._groups.set(undefined, this._items);
  1178. }
  1179. this._filteredItems = [...this._items];
  1180. }
  1181. select(item) {
  1182. if (item.selected || this.maxItemsSelected) {
  1183. return;
  1184. }
  1185. const multiple = this._ngSelect.multiple();
  1186. if (!multiple) {
  1187. this.clearSelected();
  1188. }
  1189. this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel());
  1190. if (this._ngSelect.hideSelected()) {
  1191. this._hideSelected(item);
  1192. }
  1193. }
  1194. unselect(item) {
  1195. if (!item.selected) {
  1196. return;
  1197. }
  1198. const multiple = this._ngSelect.multiple();
  1199. this._selectionModel.unselect(item, multiple);
  1200. if (this._ngSelect.hideSelected() && isDefined(item.index) && multiple) {
  1201. this._showSelected(item);
  1202. }
  1203. }
  1204. findItem(value) {
  1205. let findBy;
  1206. if (this._ngSelect.compareWith()) {
  1207. findBy = (item) => this._ngSelect.compareWith()(item.value, value);
  1208. }
  1209. else if (this._ngSelect.bindValue()) {
  1210. findBy = (item) => !item.children && this.resolveNested(item.value, this._ngSelect.bindValue()) === value;
  1211. }
  1212. else {
  1213. findBy = (item) => item.value === value || (!item.children && item.label && item.label === this.resolveNested(value, this._ngSelect.bindLabel()));
  1214. }
  1215. return this._items.find((item) => findBy(item));
  1216. }
  1217. addItem(item) {
  1218. const option = this.mapItem(item, this._items.length);
  1219. this._items.push(option);
  1220. this._filteredItems.push(option);
  1221. return option;
  1222. }
  1223. clearSelected(keepDisabled = false) {
  1224. this._selectionModel.clear(keepDisabled);
  1225. this._items.forEach((item) => {
  1226. item.selected = keepDisabled && item.selected && item.disabled;
  1227. item.marked = false;
  1228. });
  1229. if (this._ngSelect.hideSelected()) {
  1230. this.resetFilteredItems();
  1231. }
  1232. }
  1233. findByLabel(term) {
  1234. term = stripSpecialChars(term).toLocaleLowerCase();
  1235. return this.filteredItems.find((item) => {
  1236. const label = stripSpecialChars(item.label).toLocaleLowerCase();
  1237. return label.substr(0, term.length) === term;
  1238. });
  1239. }
  1240. filter(term) {
  1241. if (!term) {
  1242. this.resetFilteredItems();
  1243. return;
  1244. }
  1245. this._filteredItems = [];
  1246. term = this._ngSelect.searchFn() ? term : stripSpecialChars(term).toLocaleLowerCase();
  1247. const match = this._ngSelect.searchFn() || this._defaultSearchFn;
  1248. const hideSelected = this._ngSelect.hideSelected();
  1249. for (const key of Array.from(this._groups.keys())) {
  1250. const matchedItems = [];
  1251. for (const item of this._groups.get(key)) {
  1252. if (hideSelected && ((item.parent && item.parent.selected) || item.selected)) {
  1253. continue;
  1254. }
  1255. const searchItem = this._ngSelect.searchFn() ? item.value : item;
  1256. if (match(term, searchItem)) {
  1257. matchedItems.push(item);
  1258. }
  1259. }
  1260. if (matchedItems.length > 0) {
  1261. const [last] = matchedItems.slice(-1);
  1262. if (last.parent) {
  1263. const head = this._items.find((x) => x === last.parent);
  1264. this._filteredItems.push(head);
  1265. }
  1266. this._filteredItems.push(...matchedItems);
  1267. }
  1268. }
  1269. }
  1270. resetFilteredItems() {
  1271. if (this._filteredItems.length === this._items.length) {
  1272. return;
  1273. }
  1274. if (this._ngSelect.hideSelected() && this.selectedItems.length > 0) {
  1275. this._filteredItems = this._items.filter((x) => !x.selected);
  1276. }
  1277. else {
  1278. this._filteredItems = this._items;
  1279. }
  1280. }
  1281. unmarkItem() {
  1282. this._markedIndex = -1;
  1283. }
  1284. markNextItem() {
  1285. this._stepToItem(+1);
  1286. }
  1287. markPreviousItem() {
  1288. this._stepToItem(-1);
  1289. }
  1290. markItem(item) {
  1291. this._markedIndex = this._filteredItems.indexOf(item);
  1292. }
  1293. markSelectedOrDefault(markDefault) {
  1294. if (this._filteredItems.length === 0) {
  1295. return;
  1296. }
  1297. const lastMarkedIndex = this._getLastMarkedIndex();
  1298. if (lastMarkedIndex > -1) {
  1299. this._markedIndex = lastMarkedIndex;
  1300. }
  1301. else {
  1302. this._markedIndex = markDefault ? this.filteredItems.findIndex((x) => !x.disabled) : -1;
  1303. }
  1304. }
  1305. resolveNested(option, key) {
  1306. if (!isObject(option)) {
  1307. return option;
  1308. }
  1309. if (key.indexOf('.') === -1) {
  1310. return option[key];
  1311. }
  1312. else {
  1313. const keys = key.split('.');
  1314. let value = option;
  1315. for (let i = 0, len = keys.length; i < len; ++i) {
  1316. if (value == null) {
  1317. return null;
  1318. }
  1319. value = value[keys[i]];
  1320. }
  1321. return value;
  1322. }
  1323. }
  1324. mapItem(item, index) {
  1325. const label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel());
  1326. const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
  1327. return {
  1328. index,
  1329. label: isDefined(label) ? label.toString() : '',
  1330. value,
  1331. disabled: item.disabled,
  1332. htmlId: `${this._ngSelect.dropdownId}-${index}`,
  1333. };
  1334. }
  1335. mapSelectedItems() {
  1336. const multiple = this._ngSelect.multiple();
  1337. for (const selected of this.selectedItems) {
  1338. const bindValue = this._ngSelect.bindValue();
  1339. let item = null;
  1340. // When compareWith is used, we need to find the item using the original selected value rather than the extracted bindValue, since compareWith expects to compare against the original value
  1341. if (this._ngSelect.compareWith()) {
  1342. item = this._items.find((item) => this._ngSelect.compareWith()(item.value, selected.value));
  1343. }
  1344. else {
  1345. const value = bindValue ? this.resolveNested(selected.value, bindValue) : selected.value;
  1346. item = isDefined(value) ? this.findItem(value) : null;
  1347. }
  1348. this._selectionModel.unselect(selected, multiple);
  1349. this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel());
  1350. }
  1351. if (this._ngSelect.hideSelected()) {
  1352. this._filteredItems = this.filteredItems.filter((x) => this.selectedItems.indexOf(x) === -1);
  1353. }
  1354. }
  1355. _showSelected(item) {
  1356. this._filteredItems.push(item);
  1357. if (item.parent) {
  1358. const parent = item.parent;
  1359. const parentExists = this._filteredItems.find((x) => x === parent);
  1360. if (!parentExists) {
  1361. this._filteredItems.push(parent);
  1362. }
  1363. }
  1364. else if (item.children) {
  1365. for (const child of item.children) {
  1366. child.selected = false;
  1367. this._filteredItems.push(child);
  1368. }
  1369. }
  1370. this._filteredItems = [...this._filteredItems.sort((a, b) => a.index - b.index)];
  1371. }
  1372. _hideSelected(item) {
  1373. this._filteredItems = this._filteredItems.filter((x) => x !== item);
  1374. if (item.parent) {
  1375. const children = item.parent.children;
  1376. if (children.every((x) => x.selected)) {
  1377. this._filteredItems = this._filteredItems.filter((x) => x !== item.parent);
  1378. }
  1379. }
  1380. else if (item.children) {
  1381. this._filteredItems = this.filteredItems.filter((x) => x.parent !== item);
  1382. }
  1383. }
  1384. _defaultSearchFn(search, opt) {
  1385. const label = stripSpecialChars(opt.label).toLocaleLowerCase();
  1386. return label.indexOf(search) > -1;
  1387. }
  1388. _getNextItemIndex(steps) {
  1389. if (steps > 0) {
  1390. return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;
  1391. }
  1392. return this._markedIndex <= 0 ? this._filteredItems.length - 1 : this._markedIndex - 1;
  1393. }
  1394. _stepToItem(steps) {
  1395. if (this._filteredItems.length === 0 || this._filteredItems.every((x) => x.disabled)) {
  1396. return;
  1397. }
  1398. this._markedIndex = this._getNextItemIndex(steps);
  1399. if (this.markedItem.disabled) {
  1400. this._stepToItem(steps);
  1401. }
  1402. }
  1403. _getLastMarkedIndex() {
  1404. if (this._ngSelect.hideSelected()) {
  1405. return -1;
  1406. }
  1407. if (this._markedIndex > -1 && this.markedItem === undefined) {
  1408. return -1;
  1409. }
  1410. const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
  1411. if (this.lastSelectedItem && selectedIndex < 0) {
  1412. return -1;
  1413. }
  1414. return Math.max(this.markedIndex, selectedIndex);
  1415. }
  1416. _groupBy(items, prop) {
  1417. const groups = new Map();
  1418. if (items.length === 0) {
  1419. return groups;
  1420. }
  1421. // Check if items are already grouped by given key.
  1422. if (Array.isArray(items[0].value[prop])) {
  1423. for (const item of items) {
  1424. const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));
  1425. groups.set(item, children);
  1426. }
  1427. return groups;
  1428. }
  1429. const isFnKey = isFunction(this._ngSelect.groupBy());
  1430. const keyFn = (item) => {
  1431. const key = isFnKey ? prop(item.value) : item.value[prop];
  1432. return isDefined(key) ? key : undefined;
  1433. };
  1434. // Group items by key.
  1435. for (const item of items) {
  1436. const key = keyFn(item);
  1437. const group = groups.get(key);
  1438. if (group) {
  1439. group.push(item);
  1440. }
  1441. else {
  1442. groups.set(key, [item]);
  1443. }
  1444. }
  1445. return groups;
  1446. }
  1447. _flatten(groups) {
  1448. const isGroupByFn = isFunction(this._ngSelect.groupBy());
  1449. const items = [];
  1450. for (const key of Array.from(groups.keys())) {
  1451. let i = items.length;
  1452. if (key === undefined) {
  1453. const withoutGroup = groups.get(undefined) || [];
  1454. items.push(...withoutGroup.map((x) => {
  1455. x.index = i++;
  1456. return x;
  1457. }));
  1458. continue;
  1459. }
  1460. const isObjectKey = isObject(key);
  1461. const parent = {
  1462. label: isObjectKey ? '' : String(key),
  1463. children: undefined,
  1464. parent: null,
  1465. index: i++,
  1466. disabled: !this._ngSelect.selectableGroup(),
  1467. htmlId: newId(),
  1468. };
  1469. const groupKey = isGroupByFn ? this._ngSelect.bindLabel() : this._ngSelect.groupBy();
  1470. const groupValue = this._ngSelect.groupValue() ||
  1471. (() => {
  1472. if (isObjectKey) {
  1473. return key.value;
  1474. }
  1475. return { [groupKey]: key };
  1476. });
  1477. const children = groups.get(key).map((x) => {
  1478. x.parent = parent;
  1479. x.children = undefined;
  1480. x.index = i++;
  1481. return x;
  1482. });
  1483. parent.children = children;
  1484. parent.value = groupValue(key, children.map((x) => x.value));
  1485. items.push(parent);
  1486. items.push(...children);
  1487. }
  1488. return items;
  1489. }
  1490. }
  1491. class NgDropdownPanelService {
  1492. constructor() {
  1493. this._dimensions = {
  1494. itemHeight: 0,
  1495. panelHeight: 0,
  1496. itemsPerViewport: 0,
  1497. };
  1498. }
  1499. get dimensions() {
  1500. return this._dimensions;
  1501. }
  1502. calculateItems(scrollPos, itemsLength, buffer) {
  1503. const d = this._dimensions;
  1504. const scrollHeight = d.itemHeight * itemsLength;
  1505. const scrollTop = Math.max(0, scrollPos);
  1506. const indexByScrollTop = (scrollTop / scrollHeight) * itemsLength;
  1507. let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
  1508. const maxStartEnd = end;
  1509. const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
  1510. let start = Math.min(maxStart, Math.floor(indexByScrollTop));
  1511. let topPadding = d.itemHeight * Math.ceil(start) - d.itemHeight * Math.min(start, buffer);
  1512. topPadding = !isNaN(topPadding) ? topPadding : 0;
  1513. start = !isNaN(start) ? start : -1;
  1514. end = !isNaN(end) ? end : -1;
  1515. start -= buffer;
  1516. start = Math.max(0, start);
  1517. end += buffer;
  1518. end = Math.min(itemsLength, end);
  1519. return {
  1520. topPadding,
  1521. scrollHeight,
  1522. start,
  1523. end,
  1524. };
  1525. }
  1526. setDimensions(itemHeight, panelHeight) {
  1527. const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
  1528. this._dimensions = {
  1529. itemHeight,
  1530. panelHeight,
  1531. itemsPerViewport,
  1532. };
  1533. }
  1534. getScrollTo(itemTop, itemHeight, lastScroll) {
  1535. const { panelHeight } = this.dimensions;
  1536. const itemBottom = itemTop + itemHeight;
  1537. const top = lastScroll;
  1538. const bottom = top + panelHeight;
  1539. if (panelHeight >= itemBottom && lastScroll === itemTop) {
  1540. return null;
  1541. }
  1542. if (itemBottom > bottom) {
  1543. return top + itemBottom - bottom;
  1544. }
  1545. else if (itemTop <= top) {
  1546. return itemTop;
  1547. }
  1548. return null;
  1549. }
  1550. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgDropdownPanelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
  1551. static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgDropdownPanelService }); }
  1552. }
  1553. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgDropdownPanelService, decorators: [{
  1554. type: Injectable
  1555. }] });
  1556. const CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];
  1557. const SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
  1558. class NgDropdownPanelComponent {
  1559. constructor() {
  1560. this._renderer = inject(Renderer2);
  1561. this._zone = inject(NgZone);
  1562. this._panelService = inject(NgDropdownPanelService);
  1563. this._document = inject(DOCUMENT, { optional: true });
  1564. this._dropdown = inject((ElementRef)).nativeElement;
  1565. this.items = input([]);
  1566. this.markedItem = input(undefined);
  1567. this.position = input('auto');
  1568. this.appendTo = input(undefined);
  1569. this.bufferAmount = input(undefined);
  1570. this.virtualScroll = input(false, { transform: booleanAttribute });
  1571. this.headerTemplate = input(undefined);
  1572. this.footerTemplate = input(undefined);
  1573. this.filterValue = input(null);
  1574. this.ariaLabelDropdown = input(null);
  1575. this.update = output();
  1576. this.scroll = output();
  1577. this.scrollToEnd = output();
  1578. this.outsideClick = output();
  1579. this.contentElementRef = viewChild('content', { read: ElementRef });
  1580. this.scrollElementRef = viewChild('scroll', { read: ElementRef });
  1581. this.paddingElementRef = viewChild('padding', { read: ElementRef });
  1582. this._destroy$ = new Subject();
  1583. this._virtualPadding = computed(() => this.paddingElementRef()?.nativeElement);
  1584. this._scrollablePanel = computed(() => this.scrollElementRef()?.nativeElement);
  1585. this._contentPanel = computed(() => this.contentElementRef()?.nativeElement);
  1586. this._scrollToEndFired = false;
  1587. this._updateScrollHeight = false;
  1588. this._lastScrollPosition = 0;
  1589. }
  1590. get currentPosition() {
  1591. return this._currentPosition;
  1592. }
  1593. get itemsLength() {
  1594. return this._itemsLength;
  1595. }
  1596. set itemsLength(value) {
  1597. if (value !== this._itemsLength) {
  1598. this._itemsLength = value;
  1599. this._onItemsLengthChanged();
  1600. }
  1601. }
  1602. get _startOffset() {
  1603. if (this.markedItem()) {
  1604. const { itemHeight, panelHeight } = this._panelService.dimensions;
  1605. const offset = this.markedItem().index * itemHeight;
  1606. return panelHeight > offset ? 0 : offset;
  1607. }
  1608. return 0;
  1609. }
  1610. ngOnInit() {
  1611. this._select = this._dropdown.parentElement;
  1612. this._handleScroll();
  1613. this._handleOutsideClick();
  1614. this._appendDropdown();
  1615. this._setupMousedownListener();
  1616. }
  1617. ngOnChanges(changes) {
  1618. if (changes.items) {
  1619. const change = changes.items;
  1620. this._onItemsChange(change.currentValue, change.firstChange);
  1621. }
  1622. }
  1623. ngOnDestroy() {
  1624. this._destroy$.next();
  1625. this._destroy$.complete();
  1626. this._destroy$.unsubscribe();
  1627. if (this.appendTo()) {
  1628. this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
  1629. }
  1630. }
  1631. scrollTo(option, startFromOption = false) {
  1632. if (!option) {
  1633. return;
  1634. }
  1635. const index = this.items().indexOf(option);
  1636. if (index < 0 || index >= this.itemsLength) {
  1637. return;
  1638. }
  1639. let scrollTo;
  1640. if (this.virtualScroll()) {
  1641. const itemHeight = this._panelService.dimensions.itemHeight;
  1642. scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
  1643. }
  1644. else {
  1645. const item = this._dropdown.querySelector(`#${option.htmlId}`);
  1646. const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
  1647. scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
  1648. }
  1649. if (isDefined(scrollTo)) {
  1650. this._scrollablePanel().scrollTop = scrollTo;
  1651. }
  1652. }
  1653. scrollToTag() {
  1654. const panel = this._scrollablePanel();
  1655. panel.scrollTop = panel.scrollHeight - panel.clientHeight;
  1656. }
  1657. adjustPosition() {
  1658. this._updateYPosition();
  1659. }
  1660. _handleDropdownPosition() {
  1661. this._currentPosition = this._calculateCurrentPosition(this._dropdown);
  1662. if (CSS_POSITIONS.includes(this._currentPosition)) {
  1663. this._updateDropdownClass(this._currentPosition);
  1664. }
  1665. else {
  1666. this._updateDropdownClass('bottom');
  1667. }
  1668. if (this.appendTo()) {
  1669. this._updateYPosition();
  1670. }
  1671. this._dropdown.style.opacity = '1';
  1672. }
  1673. _updateDropdownClass(currentPosition) {
  1674. CSS_POSITIONS.forEach((position) => {
  1675. const REMOVE_CSS_CLASS = `ng-select-${position}`;
  1676. this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);
  1677. this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);
  1678. });
  1679. const ADD_CSS_CLASS = `ng-select-${currentPosition}`;
  1680. this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);
  1681. this._renderer.addClass(this._select, ADD_CSS_CLASS);
  1682. }
  1683. _handleScroll() {
  1684. this._zone.runOutsideAngular(() => {
  1685. if (!this._scrollablePanel()) {
  1686. return;
  1687. }
  1688. fromEvent(this._scrollablePanel(), 'scroll')
  1689. .pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER))
  1690. .subscribe((e) => {
  1691. const path = e.path || (e.composedPath && e.composedPath());
  1692. if (!path || (path.length === 0 && !e.target)) {
  1693. return;
  1694. }
  1695. const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;
  1696. this._onContentScrolled(scrollTop);
  1697. });
  1698. });
  1699. }
  1700. _handleOutsideClick() {
  1701. if (!this._document) {
  1702. return;
  1703. }
  1704. this._zone.runOutsideAngular(() => {
  1705. merge(fromEvent(this._document, 'touchstart', { capture: true }), fromEvent(this._document, 'click', { capture: true }))
  1706. .pipe(takeUntil(this._destroy$))
  1707. .subscribe(($event) => this._checkToClose($event));
  1708. });
  1709. }
  1710. _checkToClose($event) {
  1711. if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
  1712. return;
  1713. }
  1714. const path = $event.path || ($event.composedPath && $event.composedPath());
  1715. if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
  1716. return;
  1717. }
  1718. this._zone.run(() => this.outsideClick.emit());
  1719. }
  1720. _onItemsChange(items = [], firstChange) {
  1721. this._scrollToEndFired = false;
  1722. this.itemsLength = items.length;
  1723. if (this.virtualScroll()) {
  1724. this._updateItemsRange(firstChange);
  1725. }
  1726. else {
  1727. this._setVirtualHeight();
  1728. this._updateItems(firstChange);
  1729. }
  1730. }
  1731. _updateItems(firstChange) {
  1732. this.update.emit(this.items());
  1733. if (firstChange === false) {
  1734. return;
  1735. }
  1736. this._zone.runOutsideAngular(() => {
  1737. Promise.resolve().then(() => {
  1738. const panelHeight = this._scrollablePanel().clientHeight;
  1739. this._panelService.setDimensions(0, panelHeight);
  1740. this._handleDropdownPosition();
  1741. this.scrollTo(this.markedItem(), firstChange);
  1742. });
  1743. });
  1744. }
  1745. _updateItemsRange(firstChange) {
  1746. this._zone.runOutsideAngular(() => {
  1747. this._measureDimensions().then(() => {
  1748. if (firstChange) {
  1749. this._renderItemsRange(this._startOffset);
  1750. this._handleDropdownPosition();
  1751. }
  1752. else {
  1753. this._renderItemsRange();
  1754. }
  1755. });
  1756. });
  1757. }
  1758. _onContentScrolled(scrollTop) {
  1759. if (this.virtualScroll()) {
  1760. this._renderItemsRange(scrollTop);
  1761. }
  1762. this._lastScrollPosition = scrollTop;
  1763. this._fireScrollToEnd(scrollTop);
  1764. }
  1765. _updateVirtualHeight(height) {
  1766. if (this._updateScrollHeight) {
  1767. this._virtualPadding().style.height = `${height}px`;
  1768. this._updateScrollHeight = false;
  1769. }
  1770. }
  1771. _setVirtualHeight() {
  1772. if (!this._virtualPadding()) {
  1773. return;
  1774. }
  1775. this._virtualPadding().style.height = `0px`;
  1776. }
  1777. _onItemsLengthChanged() {
  1778. this._updateScrollHeight = true;
  1779. }
  1780. _renderItemsRange(scrollTop = null) {
  1781. if (scrollTop && this._lastScrollPosition === scrollTop) {
  1782. return;
  1783. }
  1784. scrollTop = scrollTop || this._scrollablePanel().scrollTop;
  1785. const range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount());
  1786. this._updateVirtualHeight(range.scrollHeight);
  1787. this._contentPanel().style.transform = `translateY(${range.topPadding}px)`;
  1788. this._zone.run(() => {
  1789. this.update.emit(this.items().slice(range.start, range.end));
  1790. this.scroll.emit({ start: range.start, end: range.end });
  1791. });
  1792. if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
  1793. this._scrollablePanel().scrollTop = scrollTop;
  1794. this._lastScrollPosition = scrollTop;
  1795. }
  1796. }
  1797. _measureDimensions() {
  1798. if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {
  1799. return Promise.resolve(this._panelService.dimensions);
  1800. }
  1801. const [first] = this.items();
  1802. this.update.emit([first]);
  1803. return Promise.resolve().then(() => {
  1804. const option = this._dropdown.querySelector(`#${first.htmlId}`);
  1805. const optionHeight = option.clientHeight;
  1806. this._virtualPadding().style.height = `${optionHeight * this.itemsLength}px`;
  1807. const panelHeight = this._scrollablePanel().clientHeight;
  1808. this._panelService.setDimensions(optionHeight, panelHeight);
  1809. return this._panelService.dimensions;
  1810. });
  1811. }
  1812. _fireScrollToEnd(scrollTop) {
  1813. if (this._scrollToEndFired || scrollTop === 0) {
  1814. return;
  1815. }
  1816. const padding = this.virtualScroll() ? this._virtualPadding() : this._contentPanel();
  1817. if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {
  1818. this._zone.run(() => this.scrollToEnd.emit());
  1819. this._scrollToEndFired = true;
  1820. }
  1821. }
  1822. _calculateCurrentPosition(dropdownEl) {
  1823. const position = this.position();
  1824. if (position !== 'auto') {
  1825. return position;
  1826. }
  1827. const selectRect = this._select.getBoundingClientRect();
  1828. const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  1829. const offsetTop = selectRect.top + window.pageYOffset;
  1830. const height = selectRect.height;
  1831. const dropdownHeight = dropdownEl.getBoundingClientRect().height;
  1832. if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
  1833. return 'top';
  1834. }
  1835. else {
  1836. return 'bottom';
  1837. }
  1838. }
  1839. _appendDropdown() {
  1840. if (!this.appendTo()) {
  1841. return;
  1842. }
  1843. this._parent = this._dropdown.shadowRoot
  1844. ? this._dropdown.shadowRoot.querySelector(this.appendTo())
  1845. : document.querySelector(this.appendTo());
  1846. if (!this._parent) {
  1847. throw new Error(`appendTo selector ${this.appendTo()} did not found any parent element`);
  1848. }
  1849. this._updateXPosition();
  1850. this._parent.appendChild(this._dropdown);
  1851. }
  1852. _updateXPosition() {
  1853. const select = this._select.getBoundingClientRect();
  1854. const parent = this._parent.getBoundingClientRect();
  1855. const isRTL = document.documentElement.dir === 'rtl';
  1856. const offsetLeft = select.left - parent.left;
  1857. if (isRTL) {
  1858. const offsetRight = parent.right - select.right;
  1859. this._dropdown.style.right = offsetRight + 'px';
  1860. this._dropdown.style.left = 'auto';
  1861. }
  1862. else {
  1863. this._dropdown.style.left = offsetLeft + 'px';
  1864. this._dropdown.style.right = 'auto';
  1865. }
  1866. this._dropdown.style.width = select.width + 'px';
  1867. this._dropdown.style.minWidth = select.width + 'px';
  1868. }
  1869. _updateYPosition() {
  1870. const select = this._select.getBoundingClientRect();
  1871. const parent = this._parent.getBoundingClientRect();
  1872. const delta = select.height;
  1873. if (this._currentPosition === 'top') {
  1874. const offsetBottom = parent.bottom - select.bottom;
  1875. this._dropdown.style.bottom = offsetBottom + delta + 'px';
  1876. this._dropdown.style.top = 'auto';
  1877. }
  1878. else if (this._currentPosition === 'bottom') {
  1879. const offsetTop = select.top - parent.top;
  1880. this._dropdown.style.top = offsetTop + delta + 'px';
  1881. this._dropdown.style.bottom = 'auto';
  1882. }
  1883. }
  1884. _setupMousedownListener() {
  1885. this._zone.runOutsideAngular(() => {
  1886. fromEvent(this._dropdown, 'mousedown')
  1887. .pipe(takeUntil(this._destroy$))
  1888. .subscribe((event) => {
  1889. const target = event.target;
  1890. if (target.tagName === 'INPUT') {
  1891. return;
  1892. }
  1893. event.preventDefault();
  1894. });
  1895. });
  1896. }
  1897. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgDropdownPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  1898. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: NgDropdownPanelComponent, isStandalone: true, selector: "ng-dropdown-panel", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, markedItem: { classPropertyName: "markedItem", publicName: "markedItem", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, bufferAmount: { classPropertyName: "bufferAmount", publicName: "bufferAmount", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, headerTemplate: { classPropertyName: "headerTemplate", publicName: "headerTemplate", isSignal: true, isRequired: false, transformFunction: null }, footerTemplate: { classPropertyName: "footerTemplate", publicName: "footerTemplate", isSignal: true, isRequired: false, transformFunction: null }, filterValue: { classPropertyName: "filterValue", publicName: "filterValue", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelDropdown: { classPropertyName: "ariaLabelDropdown", publicName: "ariaLabelDropdown", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { update: "update", scroll: "scroll", scrollToEnd: "scrollToEnd", outsideClick: "outsideClick" }, viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "scrollElementRef", first: true, predicate: ["scroll"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "paddingElementRef", first: true, predicate: ["padding"], descendants: true, read: ElementRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `
  1899. @if (headerTemplate()) {
  1900. <div class="ng-dropdown-header">
  1901. <ng-container [ngTemplateOutlet]="headerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
  1902. </div>
  1903. }
  1904. <div #scroll role="listbox" class="ng-dropdown-panel-items scroll-host" [attr.aria-label]="ariaLabelDropdown()">
  1905. <div #padding [class.total-padding]="virtualScroll()"></div>
  1906. <div #content [class.scrollable-content]="virtualScroll() && items().length">
  1907. <ng-content />
  1908. </div>
  1909. </div>
  1910. @if (footerTemplate()) {
  1911. <div class="ng-dropdown-footer">
  1912. <ng-container [ngTemplateOutlet]="footerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
  1913. </div>
  1914. }
  1915. `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
  1916. }
  1917. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgDropdownPanelComponent, decorators: [{
  1918. type: Component,
  1919. args: [{
  1920. changeDetection: ChangeDetectionStrategy.OnPush,
  1921. encapsulation: ViewEncapsulation.None,
  1922. selector: 'ng-dropdown-panel',
  1923. template: `
  1924. @if (headerTemplate()) {
  1925. <div class="ng-dropdown-header">
  1926. <ng-container [ngTemplateOutlet]="headerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
  1927. </div>
  1928. }
  1929. <div #scroll role="listbox" class="ng-dropdown-panel-items scroll-host" [attr.aria-label]="ariaLabelDropdown()">
  1930. <div #padding [class.total-padding]="virtualScroll()"></div>
  1931. <div #content [class.scrollable-content]="virtualScroll() && items().length">
  1932. <ng-content />
  1933. </div>
  1934. </div>
  1935. @if (footerTemplate()) {
  1936. <div class="ng-dropdown-footer">
  1937. <ng-container [ngTemplateOutlet]="footerTemplate()" [ngTemplateOutletContext]="{ searchTerm: filterValue() }" />
  1938. </div>
  1939. }
  1940. `,
  1941. imports: [NgTemplateOutlet]
  1942. }]
  1943. }] });
  1944. class NgOptionComponent {
  1945. constructor() {
  1946. this.value = input();
  1947. this.disabled = input(false, {
  1948. transform: booleanAttribute,
  1949. });
  1950. this.elementRef = inject((ElementRef));
  1951. this.label = signal('');
  1952. this.stateChange = computed(() => ({
  1953. value: this.value(),
  1954. disabled: this.disabled(),
  1955. label: this.label(),
  1956. }));
  1957. this.stateChange$ = toObservable(this.stateChange);
  1958. afterNextRender(() => {
  1959. if (this._label !== this.label()) {
  1960. this.label.set(this._label);
  1961. }
  1962. });
  1963. }
  1964. get _label() {
  1965. return (this.elementRef.nativeElement.innerHTML || '').trim();
  1966. }
  1967. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  1968. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.0", type: NgOptionComponent, isStandalone: true, selector: "ng-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  1969. }
  1970. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgOptionComponent, decorators: [{
  1971. type: Component,
  1972. args: [{
  1973. selector: 'ng-option',
  1974. standalone: true,
  1975. changeDetection: ChangeDetectionStrategy.OnPush,
  1976. template: `<ng-content />`,
  1977. }]
  1978. }], ctorParameters: () => [] });
  1979. var KeyCode;
  1980. (function (KeyCode) {
  1981. KeyCode["Tab"] = "Tab";
  1982. KeyCode["Enter"] = "Enter";
  1983. KeyCode["Esc"] = "Escape";
  1984. KeyCode["Space"] = " ";
  1985. KeyCode["ArrowUp"] = "ArrowUp";
  1986. KeyCode["ArrowDown"] = "ArrowDown";
  1987. KeyCode["Backspace"] = "Backspace";
  1988. })(KeyCode || (KeyCode = {}));
  1989. function DefaultSelectionModelFactory() {
  1990. return new DefaultSelectionModel();
  1991. }
  1992. class DefaultSelectionModel {
  1993. constructor() {
  1994. this._selected = [];
  1995. }
  1996. get value() {
  1997. return this._selected;
  1998. }
  1999. select(item, multiple, groupAsModel) {
  2000. item.selected = true;
  2001. if (!item.children || (!multiple && groupAsModel)) {
  2002. this._selected.push(item);
  2003. }
  2004. if (multiple) {
  2005. if (item.parent) {
  2006. const childrenCount = item.parent.children.length;
  2007. const selectedCount = item.parent.children.filter((x) => x.selected).length;
  2008. item.parent.selected = childrenCount === selectedCount;
  2009. }
  2010. else if (item.children) {
  2011. this._setChildrenSelectedState(item.children, true);
  2012. this._removeChildren(item);
  2013. if (groupAsModel && this._activeChildren(item)) {
  2014. this._selected = [...this._selected.filter((x) => x.parent !== item), item];
  2015. }
  2016. else {
  2017. this._selected = [...this._selected, ...item.children.filter((x) => !x.disabled)];
  2018. }
  2019. }
  2020. }
  2021. }
  2022. unselect(item, multiple) {
  2023. this._selected = this._selected.filter((x) => x !== item);
  2024. item.selected = false;
  2025. if (multiple) {
  2026. if (item.parent && item.parent.selected) {
  2027. const children = item.parent.children;
  2028. this._removeParent(item.parent);
  2029. this._removeChildren(item.parent);
  2030. this._selected.push(...children.filter((x) => x !== item && !x.disabled));
  2031. item.parent.selected = false;
  2032. }
  2033. else if (item.children) {
  2034. this._setChildrenSelectedState(item.children, false);
  2035. this._removeChildren(item);
  2036. }
  2037. }
  2038. }
  2039. clear(keepDisabled) {
  2040. this._selected = keepDisabled ? this._selected.filter((x) => x.disabled) : [];
  2041. }
  2042. _setChildrenSelectedState(children, selected) {
  2043. for (const child of children) {
  2044. if (child.disabled) {
  2045. continue;
  2046. }
  2047. child.selected = selected;
  2048. }
  2049. }
  2050. _removeChildren(parent) {
  2051. this._selected = [
  2052. ...this._selected.filter((x) => x.parent !== parent),
  2053. ...parent.children.filter((x) => x.parent === parent && x.disabled && x.selected),
  2054. ];
  2055. }
  2056. _removeParent(parent) {
  2057. this._selected = this._selected.filter((x) => x !== parent);
  2058. }
  2059. _activeChildren(item) {
  2060. return item.children.every((x) => !x.disabled || x.selected);
  2061. }
  2062. }
  2063. const SELECTION_MODEL_FACTORY = new InjectionToken('ng-select-selection-model');
  2064. class NgSelectComponent {
  2065. constructor() {
  2066. this.classes = inject(new HostAttributeToken('class'), { optional: true });
  2067. this.autoFocus = inject(new HostAttributeToken('autofocus'), { optional: true });
  2068. this.config = inject(NgSelectConfig);
  2069. this._cd = inject(ChangeDetectorRef);
  2070. this._console = inject(ConsoleService);
  2071. // signals
  2072. this._disabled = signal(false);
  2073. // inputs
  2074. this.ariaLabelDropdown = input('Options List');
  2075. this.ariaLabel = input(undefined);
  2076. this.markFirst = input(true, { transform: booleanAttribute });
  2077. this.placeholder = input(this.config.placeholder);
  2078. this.fixedPlaceholder = input(true);
  2079. this.notFoundText = input(undefined);
  2080. this.typeToSearchText = input(undefined);
  2081. this.preventToggleOnRightClick = input(false);
  2082. this.addTagText = input(undefined);
  2083. this.loadingText = input(undefined);
  2084. this.clearAllText = input(undefined);
  2085. this.dropdownPosition = input('auto');
  2086. this.appendTo = input(undefined);
  2087. this.loading = input(false, { transform: booleanAttribute });
  2088. this.closeOnSelect = input(true, { transform: booleanAttribute });
  2089. this.hideSelected = input(false, { transform: booleanAttribute });
  2090. this.selectOnTab = input(false, { transform: booleanAttribute });
  2091. this.openOnEnter = input(undefined, { transform: booleanAttribute });
  2092. this.maxSelectedItems = input(undefined, { transform: numberAttribute });
  2093. this.groupBy = input(undefined);
  2094. this.groupValue = input(undefined);
  2095. this.bufferAmount = input(4, { transform: numberAttribute });
  2096. this.virtualScroll = input(undefined, { transform: booleanAttribute });
  2097. this.selectableGroup = input(false, { transform: booleanAttribute });
  2098. this.tabFocusOnClearButton = input();
  2099. this.selectableGroupAsModel = input(true, { transform: booleanAttribute });
  2100. this.searchFn = input(null);
  2101. this.trackByFn = input(null);
  2102. this.clearOnBackspace = input(true, { transform: booleanAttribute });
  2103. this.labelForId = input(null);
  2104. this.inputAttrs = input({});
  2105. this.tabIndex = input(undefined, { transform: numberAttribute });
  2106. this.readonly = input(false, { transform: booleanAttribute });
  2107. this.searchWhileComposing = input(true, { transform: booleanAttribute });
  2108. this.minTermLength = input(0, { transform: numberAttribute });
  2109. this.editableSearchTerm = input(false, { transform: booleanAttribute });
  2110. this.ngClass = input(null);
  2111. this.typeahead = input(undefined);
  2112. this.multiple = input(false, { transform: booleanAttribute });
  2113. this.addTag = input(false);
  2114. this.searchable = input(true, { transform: booleanAttribute });
  2115. this.clearable = input(true, { transform: booleanAttribute });
  2116. this.deselectOnClick = input();
  2117. this.clearSearchOnAdd = input(undefined);
  2118. this.compareWith = input(undefined, {
  2119. transform: (fn) => {
  2120. if (fn !== undefined && fn !== null && !isFunction(fn)) {
  2121. throw Error('`compareWith` must be a function.');
  2122. }
  2123. return fn;
  2124. },
  2125. });
  2126. // models
  2127. this.bindLabel = model(undefined);
  2128. this.bindValue = model(undefined);
  2129. this.appearance = model(undefined);
  2130. this.isOpen = model(false);
  2131. this.items = model([]);
  2132. // output events
  2133. this.blurEvent = output({ alias: 'blur' });
  2134. this.focusEvent = output({ alias: 'focus' });
  2135. this.changeEvent = output({ alias: 'change' });
  2136. this.openEvent = output({ alias: 'open' });
  2137. this.closeEvent = output({ alias: 'close' });
  2138. this.searchEvent = output({ alias: 'search' });
  2139. this.clearEvent = output({ alias: 'clear' });
  2140. this.addEvent = output({ alias: 'add' });
  2141. this.removeEvent = output({ alias: 'remove' });
  2142. this.scroll = output({ alias: 'scroll' });
  2143. this.scrollToEnd = output({ alias: 'scrollToEnd' });
  2144. // computed
  2145. this.disabled = computed(() => this.readonly() || this._disabled());
  2146. this.clearSearchOnAddValue = computed(() => {
  2147. if (isDefined(this.clearSearchOnAdd())) {
  2148. return this.clearSearchOnAdd();
  2149. }
  2150. if (isDefined(this.config.clearSearchOnAdd)) {
  2151. return this.config.clearSearchOnAdd;
  2152. }
  2153. return this.closeOnSelect();
  2154. });
  2155. this.deselectOnClickValue = computed(() => {
  2156. if (isDefined(this.deselectOnClick())) {
  2157. return this.deselectOnClick();
  2158. }
  2159. if (isDefined(this.config.deselectOnClick)) {
  2160. return this.config.deselectOnClick;
  2161. }
  2162. return this.multiple();
  2163. });
  2164. // content child queries
  2165. this.optionTemplate = contentChild(NgOptionTemplateDirective, { read: TemplateRef });
  2166. this.optgroupTemplate = contentChild(NgOptgroupTemplateDirective, { read: TemplateRef });
  2167. this.labelTemplate = contentChild(NgLabelTemplateDirective, { read: TemplateRef });
  2168. this.multiLabelTemplate = contentChild(NgMultiLabelTemplateDirective, { read: TemplateRef });
  2169. this.headerTemplate = contentChild(NgHeaderTemplateDirective, { read: TemplateRef });
  2170. this.footerTemplate = contentChild(NgFooterTemplateDirective, { read: TemplateRef });
  2171. this.notFoundTemplate = contentChild(NgNotFoundTemplateDirective, { read: TemplateRef });
  2172. this.placeholderTemplate = contentChild(NgPlaceholderTemplateDirective, { read: TemplateRef });
  2173. this.typeToSearchTemplate = contentChild(NgTypeToSearchTemplateDirective, { read: TemplateRef });
  2174. this.loadingTextTemplate = contentChild(NgLoadingTextTemplateDirective, { read: TemplateRef });
  2175. this.tagTemplate = contentChild(NgTagTemplateDirective, { read: TemplateRef });
  2176. this.loadingSpinnerTemplate = contentChild(NgLoadingSpinnerTemplateDirective, { read: TemplateRef });
  2177. this.clearButtonTemplate = contentChild(NgClearButtonTemplateDirective, { read: TemplateRef });
  2178. // view children queries
  2179. this.dropdownPanel = viewChild(forwardRef(() => NgDropdownPanelComponent));
  2180. this.searchInput = viewChild('searchInput');
  2181. this.clearButton = viewChild('clearButton');
  2182. // public variables
  2183. this.ngOptions = contentChildren(NgOptionComponent, { descendants: true });
  2184. this.ngOptionsObservable = toObservable(this.ngOptions);
  2185. this.viewPortItems = [];
  2186. this.searchTerm = null;
  2187. this.dropdownId = newId();
  2188. this.escapeHTML = true;
  2189. this.tabFocusOnClear = signal(true);
  2190. this._defaultLabel = 'label';
  2191. this._pressedKeys = [];
  2192. this._isComposing = false;
  2193. this._destroy$ = new Subject();
  2194. this._keyPress$ = new Subject();
  2195. this.keyDownFn = input((_) => true);
  2196. this.clearItem = (item) => {
  2197. const option = this.selectedItems.find((x) => x.value === item);
  2198. this.unselect(option);
  2199. };
  2200. this.trackByOption = (_, item) => {
  2201. if (this.trackByFn()) {
  2202. return this.trackByFn()(item.value);
  2203. }
  2204. return item;
  2205. };
  2206. this._onChange = (_) => { };
  2207. this._onTouched = () => { };
  2208. const config = this.config;
  2209. const newSelectionModel = inject(SELECTION_MODEL_FACTORY, { optional: true });
  2210. const _elementRef = inject(ElementRef);
  2211. this._mergeGlobalConfig(config);
  2212. this.itemsList = new ItemsList(this, newSelectionModel ? newSelectionModel() : DefaultSelectionModelFactory());
  2213. this.element = _elementRef.nativeElement;
  2214. }
  2215. get filtered() {
  2216. return (!!this.searchTerm && this.searchable()) || this._isComposing;
  2217. }
  2218. get selectedItems() {
  2219. return this.itemsList.selectedItems;
  2220. }
  2221. get selectedValues() {
  2222. return this.selectedItems.map((x) => x.value);
  2223. }
  2224. get hasValue() {
  2225. return this.selectedItems.length > 0;
  2226. }
  2227. get currentPanelPosition() {
  2228. if (this.dropdownPanel()) {
  2229. return this.dropdownPanel().currentPosition;
  2230. }
  2231. return undefined;
  2232. }
  2233. get showAddTag() {
  2234. if (!this._validTerm) {
  2235. return false;
  2236. }
  2237. const term = this.searchTerm.toLowerCase().trim();
  2238. return (this.addTag() &&
  2239. !this.itemsList.filteredItems.some((x) => x.label.toLowerCase() === term) &&
  2240. ((!this.hideSelected() && this.isOpen()) || !this.selectedItems.some((x) => x.label.toLowerCase() === term)) &&
  2241. !this.loading());
  2242. }
  2243. get _editableSearchTerm() {
  2244. return this.editableSearchTerm() && !this.multiple();
  2245. }
  2246. get _isTypeahead() {
  2247. return this.typeahead() && this.typeahead().observed;
  2248. }
  2249. get _validTerm() {
  2250. const term = this.searchTerm?.trim();
  2251. return term && term.length >= this.minTermLength();
  2252. }
  2253. ngOnInit() {
  2254. this._handleKeyPresses();
  2255. this._setInputAttributes();
  2256. }
  2257. ngOnChanges(changes) {
  2258. if (changes.multiple) {
  2259. this.itemsList.clearSelected();
  2260. }
  2261. if (changes.items) {
  2262. this._itemsAreUsed = true;
  2263. this._setItems(changes.items.currentValue || []);
  2264. }
  2265. if (changes.isOpen) {
  2266. this._manualOpen = isDefined(changes.isOpen.currentValue);
  2267. }
  2268. if (changes.groupBy) {
  2269. if (!changes.items) {
  2270. this._setItems([...this.items()]);
  2271. }
  2272. }
  2273. if (changes.inputAttrs) {
  2274. this._setInputAttributes();
  2275. }
  2276. this._setTabFocusOnClear();
  2277. }
  2278. ngAfterViewInit() {
  2279. if (!this._itemsAreUsed) {
  2280. this.escapeHTML = false;
  2281. this._setItemsFromNgOptions();
  2282. }
  2283. if (isDefined(this.autoFocus)) {
  2284. this.focus();
  2285. }
  2286. }
  2287. ngOnDestroy() {
  2288. this._destroy$.next();
  2289. this._destroy$.complete();
  2290. }
  2291. handleKeyDown($event) {
  2292. const keyName = $event.key;
  2293. if (Object.values(KeyCode).includes(keyName)) {
  2294. if (this.keyDownFn()($event) === false) {
  2295. return;
  2296. }
  2297. this.handleKeyCode($event);
  2298. }
  2299. else if (keyName && keyName.length === 1) {
  2300. this._keyPress$.next(keyName.toLocaleLowerCase());
  2301. }
  2302. }
  2303. handleKeyCode($event) {
  2304. const target = $event.target;
  2305. if (this.clearButton() && this.clearButton().nativeElement === target) {
  2306. this.handleKeyCodeClear($event);
  2307. }
  2308. else {
  2309. this.handleKeyCodeInput($event);
  2310. }
  2311. }
  2312. handleKeyCodeInput($event) {
  2313. switch ($event.key) {
  2314. case KeyCode.ArrowDown:
  2315. this._handleArrowDown($event);
  2316. break;
  2317. case KeyCode.ArrowUp:
  2318. this._handleArrowUp($event);
  2319. break;
  2320. case KeyCode.Space:
  2321. this._handleSpace($event);
  2322. break;
  2323. case KeyCode.Enter:
  2324. this._handleEnter($event);
  2325. break;
  2326. case KeyCode.Tab:
  2327. this._handleTab($event);
  2328. break;
  2329. case KeyCode.Esc:
  2330. this.close();
  2331. $event.preventDefault();
  2332. break;
  2333. case KeyCode.Backspace:
  2334. this._handleBackspace();
  2335. break;
  2336. }
  2337. }
  2338. handleKeyCodeClear($event) {
  2339. switch ($event.key) {
  2340. case KeyCode.Enter:
  2341. this.handleClearClick();
  2342. $event.preventDefault();
  2343. break;
  2344. }
  2345. }
  2346. handleMousedown($event) {
  2347. if (this.disabled()) {
  2348. return;
  2349. }
  2350. if (this.preventToggleOnRightClick() && $event.button === 2) {
  2351. return false;
  2352. }
  2353. const target = $event.target;
  2354. if (target.tagName !== 'INPUT') {
  2355. $event.preventDefault();
  2356. }
  2357. if (target.classList.contains('ng-clear-wrapper')) {
  2358. // Don't handle clear on mousedown - let click event handle it
  2359. return;
  2360. }
  2361. if (target.classList.contains('ng-arrow-wrapper')) {
  2362. this.handleArrowClick();
  2363. return;
  2364. }
  2365. if (target.classList.contains('ng-value-icon')) {
  2366. return;
  2367. }
  2368. if (!this.focused) {
  2369. this.focus();
  2370. }
  2371. if (this.searchable()) {
  2372. this.open();
  2373. }
  2374. else {
  2375. this.toggle();
  2376. }
  2377. }
  2378. handleArrowClick() {
  2379. if (this.isOpen()) {
  2380. this.close();
  2381. }
  2382. else {
  2383. this.open();
  2384. }
  2385. }
  2386. handleClearClick(_event) {
  2387. if (this.hasValue) {
  2388. this.itemsList.clearSelected(true);
  2389. this._updateNgModel();
  2390. }
  2391. this._clearSearch();
  2392. this.focus();
  2393. this.clearEvent.emit();
  2394. this._onSelectionChanged();
  2395. }
  2396. clearModel() {
  2397. if (!this.clearable()) {
  2398. return;
  2399. }
  2400. this.itemsList.clearSelected();
  2401. this._updateNgModel();
  2402. }
  2403. writeValue(value) {
  2404. this.itemsList.clearSelected();
  2405. this._handleWriteValue(value);
  2406. if (this._editableSearchTerm) {
  2407. this._setSearchTermFromItems();
  2408. }
  2409. this._cd.markForCheck();
  2410. }
  2411. registerOnChange(fn) {
  2412. this._onChange = fn;
  2413. }
  2414. registerOnTouched(fn) {
  2415. this._onTouched = fn;
  2416. }
  2417. setDisabledState(state) {
  2418. this._disabled.set(state);
  2419. this._cd.markForCheck();
  2420. }
  2421. toggle() {
  2422. if (!this.isOpen()) {
  2423. this.open();
  2424. }
  2425. else {
  2426. this.close();
  2427. }
  2428. }
  2429. open() {
  2430. if (this.disabled() || this.isOpen() || this._manualOpen) {
  2431. return;
  2432. }
  2433. if (!this._isTypeahead && !this.addTag() && this.itemsList.noItemsToSelect) {
  2434. return;
  2435. }
  2436. this.isOpen.set(true);
  2437. this.itemsList.markSelectedOrDefault(this.markFirst());
  2438. this.openEvent.emit();
  2439. if (!this.searchTerm) {
  2440. this.focus();
  2441. }
  2442. this.detectChanges();
  2443. }
  2444. close() {
  2445. if (!this.isOpen() || this._manualOpen) {
  2446. return;
  2447. }
  2448. this.isOpen.set(false);
  2449. this._isComposing = false;
  2450. if (!this._editableSearchTerm) {
  2451. this._clearSearch();
  2452. }
  2453. else {
  2454. this.itemsList.resetFilteredItems();
  2455. }
  2456. this.itemsList.unmarkItem();
  2457. this._onTouched();
  2458. this.closeEvent.emit();
  2459. this._cd.markForCheck();
  2460. }
  2461. toggleItem(item) {
  2462. if (!item || item.disabled || this.disabled()) {
  2463. return;
  2464. }
  2465. if (this.deselectOnClickValue() && item.selected) {
  2466. this.unselect(item);
  2467. }
  2468. else {
  2469. this.select(item);
  2470. }
  2471. if (this._editableSearchTerm) {
  2472. this._setSearchTermFromItems();
  2473. }
  2474. }
  2475. select(item) {
  2476. if (!item.selected) {
  2477. this.itemsList.select(item);
  2478. if (this.clearSearchOnAddValue() && !this._editableSearchTerm) {
  2479. this._clearSearch();
  2480. }
  2481. this._updateNgModel();
  2482. if (this.multiple()) {
  2483. this.addEvent.emit(item.value);
  2484. }
  2485. }
  2486. if (this.closeOnSelect() || this.itemsList.noItemsToSelect) {
  2487. this.close();
  2488. }
  2489. this._onSelectionChanged();
  2490. }
  2491. focus() {
  2492. this.searchInput().nativeElement.focus();
  2493. }
  2494. blur() {
  2495. this.searchInput().nativeElement.blur();
  2496. }
  2497. unselect(item) {
  2498. if (!item) {
  2499. return;
  2500. }
  2501. this.itemsList.unselect(item);
  2502. this.focus();
  2503. this._updateNgModel();
  2504. this.removeEvent.emit(item.value);
  2505. this._onSelectionChanged();
  2506. }
  2507. selectTag() {
  2508. let tag;
  2509. if (isFunction(this.addTag())) {
  2510. tag = this.addTag()(this.searchTerm);
  2511. }
  2512. else {
  2513. tag = this._primitive ? this.searchTerm : { [this.bindLabel()]: this.searchTerm };
  2514. }
  2515. const handleTag = (item) => (this._isTypeahead || !this.isOpen() ? this.itemsList.mapItem(item, null) : this.itemsList.addItem(item));
  2516. if (isPromise(tag)) {
  2517. tag.then((item) => this.select(handleTag(item))).catch(() => { });
  2518. }
  2519. else if (tag) {
  2520. this.select(handleTag(tag));
  2521. }
  2522. }
  2523. showClear() {
  2524. return this.clearable() && (this.hasValue || this.searchTerm) && !this.disabled();
  2525. }
  2526. focusOnClear() {
  2527. this.blur();
  2528. if (this.clearButton()) {
  2529. this.clearButton().nativeElement.focus();
  2530. }
  2531. }
  2532. showNoItemsFound() {
  2533. const empty = this.itemsList.filteredItems.length === 0;
  2534. return (((empty && !this._isTypeahead && !this.loading()) || (empty && this._isTypeahead && this._validTerm && !this.loading())) &&
  2535. !this.showAddTag);
  2536. }
  2537. showTypeToSearch() {
  2538. const empty = this.itemsList.filteredItems.length === 0;
  2539. return empty && this._isTypeahead && !this._validTerm && !this.loading();
  2540. }
  2541. onCompositionStart() {
  2542. this._isComposing = true;
  2543. }
  2544. onCompositionEnd(term) {
  2545. this._isComposing = false;
  2546. if (this.searchWhileComposing()) {
  2547. return;
  2548. }
  2549. this.filter(term);
  2550. }
  2551. filter(term) {
  2552. if (this._isComposing && !this.searchWhileComposing()) {
  2553. return;
  2554. }
  2555. this.searchTerm = term;
  2556. if (this._isTypeahead && (this._validTerm || this.minTermLength() === 0)) {
  2557. this.typeahead().next(term);
  2558. }
  2559. if (!this._isTypeahead) {
  2560. this.itemsList.filter(this.searchTerm);
  2561. if (this.isOpen()) {
  2562. this.itemsList.markSelectedOrDefault(this.markFirst());
  2563. }
  2564. }
  2565. this.searchEvent.emit({ term, items: this.itemsList.filteredItems.map((x) => x.value) });
  2566. this.open();
  2567. }
  2568. onInputFocus($event) {
  2569. if (this.focused) {
  2570. return;
  2571. }
  2572. if (this._editableSearchTerm) {
  2573. this._setSearchTermFromItems();
  2574. }
  2575. this.element.classList.add('ng-select-focused');
  2576. this.focusEvent.emit($event);
  2577. this.focused = true;
  2578. }
  2579. onInputBlur($event) {
  2580. this.element.classList.remove('ng-select-focused');
  2581. this.blurEvent.emit($event);
  2582. if (!this.isOpen() && !this.disabled()) {
  2583. this._onTouched();
  2584. }
  2585. if (this._editableSearchTerm) {
  2586. this._setSearchTermFromItems();
  2587. }
  2588. this.focused = false;
  2589. }
  2590. onItemHover(item) {
  2591. if (item.disabled) {
  2592. return;
  2593. }
  2594. this.itemsList.markItem(item);
  2595. }
  2596. detectChanges() {
  2597. if (!this._cd.destroyed) {
  2598. this._cd.detectChanges();
  2599. }
  2600. }
  2601. _setSearchTermFromItems() {
  2602. const selected = this.selectedItems?.[0];
  2603. this.searchTerm = selected?.label ?? null;
  2604. }
  2605. _setItems(items) {
  2606. const firstItem = items[0];
  2607. this.bindLabel.set(this.bindLabel() || this._defaultLabel);
  2608. this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel() === this._defaultLabel;
  2609. this.itemsList.setItems(items);
  2610. if (items.length > 0 && this.hasValue) {
  2611. this.itemsList.mapSelectedItems();
  2612. }
  2613. if (this.isOpen() && isDefined(this.searchTerm) && !this._isTypeahead) {
  2614. this.itemsList.filter(this.searchTerm);
  2615. }
  2616. if (this._isTypeahead || this.isOpen()) {
  2617. this.itemsList.markSelectedOrDefault(this.markFirst());
  2618. }
  2619. }
  2620. _setItemsFromNgOptions() {
  2621. const mapNgOptions = (options) => {
  2622. const items = options.map((option) => ({
  2623. $ngOptionValue: option.value(),
  2624. $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
  2625. disabled: option.disabled(),
  2626. })) ?? [];
  2627. this.items.set(items);
  2628. this.itemsList.setItems(items);
  2629. if (this.hasValue) {
  2630. this.itemsList.mapSelectedItems();
  2631. }
  2632. };
  2633. const handleOptionChange = (options) => {
  2634. return merge(...options.map((option) => option.stateChange$)).pipe(tap((option) => {
  2635. const item = this.itemsList.findItem(option.value);
  2636. if (item) {
  2637. item.disabled = option.disabled;
  2638. item.label = option.label || item.label;
  2639. }
  2640. }));
  2641. };
  2642. this.ngOptionsObservable
  2643. .pipe(startWith(this.ngOptions()), takeUntil(this._destroy$), tap((options) => {
  2644. this.bindLabel.set(this._defaultLabel);
  2645. mapNgOptions(options);
  2646. this._cd.detectChanges();
  2647. }), switchMap((options) => handleOptionChange(options)))
  2648. .subscribe();
  2649. }
  2650. _isValidWriteValue(value) {
  2651. if (!isDefined(value) || (this.multiple() && value === '') || (Array.isArray(value) && value.length === 0)) {
  2652. return false;
  2653. }
  2654. const validateBinding = (item) => {
  2655. if (!isDefined(this.compareWith()) && isObject(item) && this.bindValue()) {
  2656. this._console.warn(`Setting object(${JSON.stringify(item)}) as your model with bindValue is not allowed unless [compareWith] is used.`);
  2657. return false;
  2658. }
  2659. return true;
  2660. };
  2661. if (this.multiple()) {
  2662. if (!Array.isArray(value)) {
  2663. this._console.warn('Multiple select ngModel should be array.');
  2664. return false;
  2665. }
  2666. return value.every((item) => validateBinding(item));
  2667. }
  2668. else {
  2669. return validateBinding(value);
  2670. }
  2671. }
  2672. _handleWriteValue(ngModel) {
  2673. if (!this._isValidWriteValue(ngModel)) {
  2674. return;
  2675. }
  2676. const select = (val) => {
  2677. let item = this.itemsList.findItem(val);
  2678. if (item) {
  2679. this.itemsList.select(item);
  2680. }
  2681. else {
  2682. const isValObject = isObject(val);
  2683. const isPrimitive = !isValObject && !this.bindValue();
  2684. if (isValObject || isPrimitive) {
  2685. this.itemsList.select(this.itemsList.mapItem(val, null));
  2686. }
  2687. else if (this.bindValue()) {
  2688. item = {
  2689. [this.bindLabel()]: null,
  2690. [this.bindValue()]: val,
  2691. };
  2692. this.itemsList.select(this.itemsList.mapItem(item, null));
  2693. }
  2694. }
  2695. };
  2696. if (this.multiple()) {
  2697. ngModel.forEach((item) => select(item));
  2698. }
  2699. else {
  2700. select(ngModel);
  2701. }
  2702. }
  2703. _handleKeyPresses() {
  2704. if (this.searchable()) {
  2705. return;
  2706. }
  2707. this._keyPress$
  2708. .pipe(takeUntil(this._destroy$), tap((letter) => this._pressedKeys.push(letter)), debounceTime(200), filter(() => this._pressedKeys.length > 0), map(() => this._pressedKeys.join('')))
  2709. .subscribe((term) => {
  2710. const item = this.itemsList.findByLabel(term);
  2711. if (item) {
  2712. if (this.isOpen()) {
  2713. this.itemsList.markItem(item);
  2714. this._scrollToMarked();
  2715. this._cd.markForCheck();
  2716. }
  2717. else {
  2718. this.select(item);
  2719. }
  2720. }
  2721. this._pressedKeys = [];
  2722. });
  2723. }
  2724. _setInputAttributes() {
  2725. const input = this.searchInput().nativeElement;
  2726. const attributes = {
  2727. type: 'text',
  2728. autocorrect: 'off',
  2729. autocapitalize: 'off',
  2730. autocomplete: 'off',
  2731. 'aria-controls': this.dropdownId,
  2732. ...this.inputAttrs(),
  2733. };
  2734. for (const key of Object.keys(attributes)) {
  2735. input.setAttribute(key, attributes[key]);
  2736. }
  2737. }
  2738. _setTabFocusOnClear() {
  2739. this.tabFocusOnClear.set(isDefined(this.tabFocusOnClearButton()) ? !!this.tabFocusOnClearButton() : this.config.tabFocusOnClear);
  2740. }
  2741. _updateNgModel() {
  2742. const model = [];
  2743. for (const item of this.selectedItems) {
  2744. if (this.bindValue()) {
  2745. let value = null;
  2746. if (item.children) {
  2747. const groupKey = this.groupValue() ? this.bindValue() : this.groupBy();
  2748. value = item.value[groupKey || this.groupBy()];
  2749. }
  2750. else {
  2751. value = this.itemsList.resolveNested(item.value, this.bindValue());
  2752. }
  2753. model.push(value);
  2754. }
  2755. else {
  2756. model.push(item.value);
  2757. }
  2758. }
  2759. const selected = this.selectedItems.map((x) => x.value);
  2760. if (this.multiple()) {
  2761. this._onChange(model);
  2762. this.changeEvent.emit(selected);
  2763. }
  2764. else {
  2765. this._onChange(isDefined(model[0]) ? model[0] : null);
  2766. this.changeEvent.emit(selected[0]);
  2767. }
  2768. this._cd.markForCheck();
  2769. }
  2770. _clearSearch() {
  2771. if (!this.searchTerm) {
  2772. return;
  2773. }
  2774. this._changeSearch(null);
  2775. this.itemsList.resetFilteredItems();
  2776. }
  2777. _changeSearch(searchTerm) {
  2778. this.searchTerm = searchTerm;
  2779. if (this._isTypeahead) {
  2780. this.typeahead().next(searchTerm);
  2781. }
  2782. }
  2783. _scrollToMarked() {
  2784. if (!this.isOpen() || !this.dropdownPanel()) {
  2785. return;
  2786. }
  2787. this.dropdownPanel().scrollTo(this.itemsList.markedItem);
  2788. }
  2789. _scrollToTag() {
  2790. if (!this.isOpen() || !this.dropdownPanel()) {
  2791. return;
  2792. }
  2793. this.dropdownPanel().scrollToTag();
  2794. }
  2795. _onSelectionChanged() {
  2796. const appendTo = this.appendTo() ?? this.config.appendTo;
  2797. if (this.isOpen() && this.deselectOnClickValue() && appendTo) {
  2798. // Make sure items are rendered.
  2799. this._cd.detectChanges();
  2800. this.dropdownPanel().adjustPosition();
  2801. }
  2802. }
  2803. _handleTab($event) {
  2804. if (this.isOpen() === false) {
  2805. if (this.showClear() && !$event.shiftKey && this.tabFocusOnClear()) {
  2806. this.focusOnClear();
  2807. $event.preventDefault();
  2808. }
  2809. else if (!this.addTag()) {
  2810. return;
  2811. }
  2812. }
  2813. if (this.selectOnTab()) {
  2814. if (this.itemsList.markedItem) {
  2815. this.toggleItem(this.itemsList.markedItem);
  2816. $event.preventDefault();
  2817. }
  2818. else if (this.showAddTag) {
  2819. this.selectTag();
  2820. $event.preventDefault();
  2821. }
  2822. else {
  2823. this.close();
  2824. }
  2825. }
  2826. else {
  2827. this.close();
  2828. }
  2829. }
  2830. _handleEnter($event) {
  2831. const openOnEnter = this.openOnEnter() ?? this.config.openOnEnter;
  2832. if (this.isOpen() || this._manualOpen) {
  2833. if (this.itemsList.markedItem) {
  2834. this.toggleItem(this.itemsList.markedItem);
  2835. }
  2836. else if (this.showAddTag) {
  2837. this.selectTag();
  2838. }
  2839. }
  2840. else if (openOnEnter) {
  2841. this.open();
  2842. }
  2843. else {
  2844. return;
  2845. }
  2846. $event.preventDefault();
  2847. }
  2848. _handleSpace($event) {
  2849. if (this.isOpen() || this._manualOpen) {
  2850. return;
  2851. }
  2852. this.open();
  2853. $event.preventDefault();
  2854. }
  2855. _handleArrowDown($event) {
  2856. if (this._nextItemIsTag(+1)) {
  2857. this.itemsList.unmarkItem();
  2858. this._scrollToTag();
  2859. }
  2860. else {
  2861. this.itemsList.markNextItem();
  2862. this._scrollToMarked();
  2863. }
  2864. this.open();
  2865. $event.preventDefault();
  2866. }
  2867. _handleArrowUp($event) {
  2868. if (!this.isOpen()) {
  2869. return;
  2870. }
  2871. if (this._nextItemIsTag(-1)) {
  2872. this.itemsList.unmarkItem();
  2873. this._scrollToTag();
  2874. }
  2875. else {
  2876. this.itemsList.markPreviousItem();
  2877. this._scrollToMarked();
  2878. }
  2879. $event.preventDefault();
  2880. }
  2881. _nextItemIsTag(nextStep) {
  2882. const nextIndex = this.itemsList.markedIndex + nextStep;
  2883. return (this.addTag() && this.searchTerm && this.itemsList.markedItem && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length));
  2884. }
  2885. _handleBackspace() {
  2886. if (this.searchTerm || !this.clearable() || !this.clearOnBackspace() || !this.hasValue) {
  2887. return;
  2888. }
  2889. if (this.multiple()) {
  2890. this.unselect(this.itemsList.lastSelectedItem);
  2891. }
  2892. else {
  2893. this.clearModel();
  2894. }
  2895. }
  2896. _mergeGlobalConfig(config) {
  2897. this.bindValue.set(this.bindValue() || config.bindValue);
  2898. this.bindLabel.set(this.bindLabel() || config.bindLabel);
  2899. this.appearance.set(this.appearance() || config.appearance);
  2900. this._setTabFocusOnClear();
  2901. }
  2902. /**
  2903. * Gets virtual scroll value from input or from config
  2904. *
  2905. * @param config NgSelectConfig object
  2906. *
  2907. * @returns `true` if virtual scroll is enabled, `false` otherwise
  2908. */
  2909. getVirtualScroll(config) {
  2910. return isDefined(this.virtualScroll) ? this.virtualScroll() : this.isVirtualScrollDisabled(config);
  2911. }
  2912. /**
  2913. * Gets disableVirtualScroll value from input or from config
  2914. *
  2915. * @param config NgSelectConfig object
  2916. *
  2917. * @returns `true` if disableVirtualScroll is enabled, `false` otherwise
  2918. */
  2919. isVirtualScrollDisabled(config) {
  2920. return isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;
  2921. }
  2922. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  2923. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: NgSelectComponent, isStandalone: true, selector: "ng-select", inputs: { ariaLabelDropdown: { classPropertyName: "ariaLabelDropdown", publicName: "ariaLabelDropdown", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, markFirst: { classPropertyName: "markFirst", publicName: "markFirst", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, fixedPlaceholder: { classPropertyName: "fixedPlaceholder", publicName: "fixedPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, notFoundText: { classPropertyName: "notFoundText", publicName: "notFoundText", isSignal: true, isRequired: false, transformFunction: null }, typeToSearchText: { classPropertyName: "typeToSearchText", publicName: "typeToSearchText", isSignal: true, isRequired: false, transformFunction: null }, preventToggleOnRightClick: { classPropertyName: "preventToggleOnRightClick", publicName: "preventToggleOnRightClick", isSignal: true, isRequired: false, transformFunction: null }, addTagText: { classPropertyName: "addTagText", publicName: "addTagText", isSignal: true, isRequired: false, transformFunction: null }, loadingText: { classPropertyName: "loadingText", publicName: "loadingText", isSignal: true, isRequired: false, transformFunction: null }, clearAllText: { classPropertyName: "clearAllText", publicName: "clearAllText", isSignal: true, isRequired: false, transformFunction: null }, dropdownPosition: { classPropertyName: "dropdownPosition", publicName: "dropdownPosition", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, hideSelected: { classPropertyName: "hideSelected", publicName: "hideSelected", isSignal: true, isRequired: false, transformFunction: null }, selectOnTab: { classPropertyName: "selectOnTab", publicName: "selectOnTab", isSignal: true, isRequired: false, transformFunction: null }, openOnEnter: { classPropertyName: "openOnEnter", publicName: "openOnEnter", isSignal: true, isRequired: false, transformFunction: null }, maxSelectedItems: { classPropertyName: "maxSelectedItems", publicName: "maxSelectedItems", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, groupValue: { classPropertyName: "groupValue", publicName: "groupValue", isSignal: true, isRequired: false, transformFunction: null }, bufferAmount: { classPropertyName: "bufferAmount", publicName: "bufferAmount", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, selectableGroup: { classPropertyName: "selectableGroup", publicName: "selectableGroup", isSignal: true, isRequired: false, transformFunction: null }, tabFocusOnClearButton: { classPropertyName: "tabFocusOnClearButton", publicName: "tabFocusOnClearButton", isSignal: true, isRequired: false, transformFunction: null }, selectableGroupAsModel: { classPropertyName: "selectableGroupAsModel", publicName: "selectableGroupAsModel", isSignal: true, isRequired: false, transformFunction: null }, searchFn: { classPropertyName: "searchFn", publicName: "searchFn", isSignal: true, isRequired: false, transformFunction: null }, trackByFn: { classPropertyName: "trackByFn", publicName: "trackByFn", isSignal: true, isRequired: false, transformFunction: null }, clearOnBackspace: { classPropertyName: "clearOnBackspace", publicName: "clearOnBackspace", isSignal: true, isRequired: false, transformFunction: null }, labelForId: { classPropertyName: "labelForId", publicName: "labelForId", isSignal: true, isRequired: false, transformFunction: null }, inputAttrs: { classPropertyName: "inputAttrs", publicName: "inputAttrs", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, searchWhileComposing: { classPropertyName: "searchWhileComposing", publicName: "searchWhileComposing", isSignal: true, isRequired: false, transformFunction: null }, minTermLength: { classPropertyName: "minTermLength", publicName: "minTermLength", isSignal: true, isRequired: false, transformFunction: null }, editableSearchTerm: { classPropertyName: "editableSearchTerm", publicName: "editableSearchTerm", isSignal: true, isRequired: false, transformFunction: null }, ngClass: { classPropertyName: "ngClass", publicName: "ngClass", isSignal: true, isRequired: false, transformFunction: null }, typeahead: { classPropertyName: "typeahead", publicName: "typeahead", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, addTag: { classPropertyName: "addTag", publicName: "addTag", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, deselectOnClick: { classPropertyName: "deselectOnClick", publicName: "deselectOnClick", isSignal: true, isRequired: false, transformFunction: null }, clearSearchOnAdd: { classPropertyName: "clearSearchOnAdd", publicName: "clearSearchOnAdd", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, bindLabel: { classPropertyName: "bindLabel", publicName: "bindLabel", isSignal: true, isRequired: false, transformFunction: null }, bindValue: { classPropertyName: "bindValue", publicName: "bindValue", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, keyDownFn: { classPropertyName: "keyDownFn", publicName: "keyDownFn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { bindLabel: "bindLabelChange", bindValue: "bindValueChange", appearance: "appearanceChange", isOpen: "isOpenChange", items: "itemsChange", blurEvent: "blur", focusEvent: "focus", changeEvent: "change", openEvent: "open", closeEvent: "close", searchEvent: "search", clearEvent: "clear", addEvent: "add", removeEvent: "remove", scroll: "scroll", scrollToEnd: "scrollToEnd" }, host: { listeners: { "keydown": "handleKeyDown($event)" }, properties: { "class.ng-select": "true", "class.ng-select-single": "!multiple()", "class.ng-select-typeahead": "typeahead()", "class.ng-select-multiple": "multiple()", "class.ng-select-taggable": "addTag()", "class.ng-select-searchable": "searchable()", "class.ng-select-clearable": "clearable()", "class.ng-select-opened": "isOpen()", "class.ng-select-filtered": "filtered", "class.ng-select-disabled": "disabled()" } }, providers: [
  2924. {
  2925. provide: NG_VALUE_ACCESSOR,
  2926. useExisting: forwardRef(() => NgSelectComponent),
  2927. multi: true,
  2928. },
  2929. NgDropdownPanelService,
  2930. ], queries: [{ propertyName: "optionTemplate", first: true, predicate: NgOptionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "optgroupTemplate", first: true, predicate: NgOptgroupTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: NgLabelTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "multiLabelTemplate", first: true, predicate: NgMultiLabelTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: NgHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: NgFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "notFoundTemplate", first: true, predicate: NgNotFoundTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "placeholderTemplate", first: true, predicate: NgPlaceholderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "typeToSearchTemplate", first: true, predicate: NgTypeToSearchTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "loadingTextTemplate", first: true, predicate: NgLoadingTextTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "tagTemplate", first: true, predicate: NgTagTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "loadingSpinnerTemplate", first: true, predicate: NgLoadingSpinnerTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "clearButtonTemplate", first: true, predicate: NgClearButtonTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "ngOptions", predicate: NgOptionComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "dropdownPanel", first: true, predicate: i0.forwardRef(() => NgDropdownPanelComponent), descendants: true, isSignal: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "clearButton", first: true, predicate: ["clearButton"], descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<div\n\t(mousedown)=\"handleMousedown($event)\"\n\t[class.ng-appearance-outline]=\"appearance() === 'outline'\"\n\t[class.ng-has-value]=\"hasValue\"\n\tclass=\"ng-select-container\">\n\t<div class=\"ng-value-container\">\n\t\t@if ((selectedItems.length === 0 && !searchTerm) || (fixedPlaceholder() ?? config.fixedPlaceholder )) {\n\t\t\t<ng-template #defaultPlaceholderTemplate>\n\t\t\t\t<div class=\"ng-placeholder\">{{ placeholder() ?? config.placeholder }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template [ngTemplateOutlet]=\"placeholderTemplate() || defaultPlaceholderTemplate\"> </ng-template>\n\t\t}\n\n\t\t@if ((!multiLabelTemplate() || !multiple()) && selectedItems.length > 0) {\n\t\t\t@for (item of selectedItems; track trackByOption($index, item)) {\n\t\t\t\t<div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\">\n\t\t\t\t\t<ng-template #defaultLabelTemplate>\n\t\t\t\t\t\t<span class=\"ng-value-icon left\" (click)=\"unselect(item)\" aria-hidden=\"true\">\u00D7</span>\n\t\t\t\t\t\t<span class=\"ng-value-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutlet]=\"labelTemplate() || defaultLabelTemplate\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t}\n\n\t\t@if (multiple() && multiLabelTemplate() && selectedValues.length > 0) {\n\t\t\t<ng-template [ngTemplateOutlet]=\"multiLabelTemplate()\" [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n\t\t\t</ng-template>\n\t\t}\n\n\t\t<div class=\"ng-input\">\n\t\t\t<input\n\t\t\t\t#searchInput\n\t\t\t\t(blur)=\"onInputBlur($event)\"\n\t\t\t\t(change)=\"$event.stopPropagation()\"\n\t\t\t\t(compositionend)=\"onCompositionEnd(searchInput.value)\"\n\t\t\t\t(compositionstart)=\"onCompositionStart()\"\n\t\t\t\t(focus)=\"onInputFocus($event)\"\n\t\t\t\t(input)=\"filter(searchInput.value)\"\n\t\t\t\t[attr.aria-activedescendant]=\"isOpen() ? itemsList?.markedItem?.htmlId : null\"\n\t\t\t\t[attr.aria-controls]=\"isOpen() ? dropdownId : null\"\n\t\t\t\t[attr.aria-expanded]=\"isOpen()\"\n\t\t\t\t[attr.aria-label]=\"ariaLabel()\"\n\t\t\t\t[attr.id]=\"labelForId()\"\n\t\t\t\t[attr.tabindex]=\"tabIndex()\"\n\t\t\t\t[disabled]=\"disabled()\"\n\t\t\t\t[readOnly]=\"!searchable() || itemsList.maxItemsSelected\"\n\t\t\t\t[value]=\"searchTerm ?? ''\"\n\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\trole=\"combobox\" />\n\t\t</div>\n\t</div>\n\n\t@if (loading()) {\n\t\t<ng-template #defaultLoadingSpinnerTemplate>\n\t\t\t<div class=\"ng-spinner-loader\"></div>\n\t\t</ng-template>\n\t\t<ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate() || defaultLoadingSpinnerTemplate\"></ng-template>\n\t}\n\n\t@if (showClear()) {\n\t\t@if (clearButtonTemplate()) {\n\t\t\t<ng-container [ngTemplateOutlet]=\"clearButtonTemplate()\"></ng-container>\n\t\t} @else {\n\t\t\t<span\n\t\t\t\tclass=\"ng-clear-wrapper\"\n\t\t\t\trole=\"button\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t[attr.tabindex]=\"tabFocusOnClear() ? 0 : -1\"\n\t\t\t\ttitle=\"{{ clearAllText() || config.clearAllText }}\"\n\t\t\t\t#clearButton\n\t\t\t\t(click)=\"handleClearClick($event)\">\n\t\t\t\t<span class=\"ng-clear\" aria-hidden=\"true\">\u00D7</span>\n\t\t\t</span>\n\t\t}\n\t}\n\n\t<span class=\"ng-arrow-wrapper\">\n\t\t<span class=\"ng-arrow\"></span>\n\t</span>\n</div>\n\n@if (isOpen()) {\n\t@let appendToValue = appendTo() || config.appendTo;\n\t<ng-dropdown-panel\n\t\tclass=\"ng-dropdown-panel\"\n\t\t[virtualScroll]=\"virtualScroll() ?? !config.disableVirtualScroll ?? false\"\n\t\t[bufferAmount]=\"bufferAmount()\"\n\t\t[appendTo]=\"appendToValue\"\n\t\t[position]=\"dropdownPosition()\"\n\t\t[headerTemplate]=\"headerTemplate()\"\n\t\t[footerTemplate]=\"footerTemplate()\"\n\t\t[filterValue]=\"searchTerm\"\n\t\t[items]=\"itemsList.filteredItems\"\n\t\t[markedItem]=\"itemsList.markedItem\"\n\t\t(update)=\"viewPortItems = $event\"\n\t\t(scroll)=\"scroll.emit($event)\"\n\t\t(scrollToEnd)=\"scrollToEnd.emit($event)\"\n\t\t(outsideClick)=\"close()\"\n\t\t[class.ng-select-multiple]=\"multiple()\"\n\t\t[class]=\"appendToValue ? (ngClass() ? ngClass() : classes) : null\"\n\t\t[id]=\"dropdownId\"\n\t\t[ariaLabelDropdown]=\"ariaLabelDropdown()\">\n\t\t<ng-container>\n\t\t\t@for (item of viewPortItems; track trackByOption($index, item)) {\n\t\t\t\t<div\n\t\t\t\t\tclass=\"ng-option\"\n\t\t\t\t\t[attr.role]=\"item.children ? 'group' : 'option'\"\n\t\t\t\t\t(click)=\"toggleItem(item)\"\n\t\t\t\t\t(mouseover)=\"onItemHover(item)\"\n\t\t\t\t\t[class.ng-option-disabled]=\"item.disabled\"\n\t\t\t\t\t[class.ng-option-selected]=\"item.selected\"\n\t\t\t\t\t[class.ng-optgroup]=\"item.children\"\n\t\t\t\t\t[class.ng-option]=\"!item.children\"\n\t\t\t\t\t[class.ng-option-child]=\"!!item.parent\"\n\t\t\t\t\t[class.ng-option-marked]=\"item === itemsList.markedItem\"\n\t\t\t\t\t[attr.aria-selected]=\"item.selected\"\n\t\t\t\t\t[attr.id]=\"item?.htmlId\"\n\t\t\t\t\t[attr.aria-setsize]=\"itemsList.filteredItems.length\"\n\t\t\t\t\t[attr.aria-posinset]=\"item.index + 1\">\n\t\t\t\t\t<ng-template #defaultOptionTemplate>\n\t\t\t\t\t\t<span class=\"ng-option-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutlet]=\"\n\t\t\t\t\t\t\titem.children ? optgroupTemplate() || defaultOptionTemplate : optionTemplate() || defaultOptionTemplate\n\t\t\t\t\t\t\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ item: item.value, item$: item, index: item.index, searchTerm: searchTerm }\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t@if (showAddTag) {\n\t\t\t\t<div\n\t\t\t\t\tclass=\"ng-option\"\n\t\t\t\t\t[class.ng-option-marked]=\"!itemsList.markedItem\"\n\t\t\t\t\t(mouseover)=\"itemsList.unmarkItem()\"\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\t(click)=\"selectTag()\">\n\t\t\t\t\t<ng-template #defaultTagTemplate>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t><span class=\"ng-tag-label\">{{ addTagText() || config.addTagText }}</span\n\t\t\t\t\t\t\t>\"{{ searchTerm }}\"</span\n\t\t\t\t\t\t>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutlet]=\"tagTemplate() || defaultTagTemplate\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</ng-container>\n\t\t@if (showNoItemsFound()) {\n\t\t\t<ng-template #defaultNotFoundTemplate>\n\t\t\t\t<div class=\"ng-option ng-option-disabled\">{{ notFoundText() ?? config.notFoundText }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template\n\t\t\t\t[ngTemplateOutlet]=\"notFoundTemplate() || defaultNotFoundTemplate\"\n\t\t\t\t[ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n\t\t\t</ng-template>\n\t\t}\n\t\t@if (showTypeToSearch()) {\n\t\t\t<ng-template #defaultTypeToSearchTemplate>\n\t\t\t\t<div class=\"ng-option ng-option-disabled\">{{ typeToSearchText() || config.typeToSearchText }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template [ngTemplateOutlet]=\"typeToSearchTemplate() || defaultTypeToSearchTemplate\"></ng-template>\n\t\t}\n\t\t@if (loading() && itemsList.filteredItems.length === 0) {\n\t\t\t<ng-template #defaultLoadingTextTemplate>\n\t\t\t\t<div class=\"ng-option ng-option-disabled\">{{ loadingText() || config.loadingText }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template\n\t\t\t\t[ngTemplateOutlet]=\"loadingTextTemplate() || defaultLoadingTextTemplate\"\n\t\t\t\t[ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n\t\t\t</ng-template>\n\t\t}\n\t</ng-dropdown-panel>\n}\n\n<!-- Always present aria-live region -->\n<div aria-atomic=\"true\" aria-live=\"polite\" class=\"ng-visually-hidden\" role=\"status\">\n\t@if (isOpen && showNoItemsFound()) {\n\t\t{{ notFoundText }}\n\t}\n</div>\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none transparent;border:0 none;box-shadow:none;outline:none;padding:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:unset;user-select:unset;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-option-label:empty:before{content:\"\\200b\"}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}.ng-visually-hidden{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0;white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgItemLabelDirective, selector: "[ngItemLabel]", inputs: ["ngItemLabel", "escape"] }, { kind: "component", type: NgDropdownPanelComponent, selector: "ng-dropdown-panel", inputs: ["items", "markedItem", "position", "appendTo", "bufferAmount", "virtualScroll", "headerTemplate", "footerTemplate", "filterValue", "ariaLabelDropdown"], outputs: ["update", "scroll", "scrollToEnd", "outsideClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
  2931. }
  2932. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectComponent, decorators: [{
  2933. type: Component,
  2934. args: [{ selector: 'ng-select', providers: [
  2935. {
  2936. provide: NG_VALUE_ACCESSOR,
  2937. useExisting: forwardRef(() => NgSelectComponent),
  2938. multi: true,
  2939. },
  2940. NgDropdownPanelService,
  2941. ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, NgItemLabelDirective, NgDropdownPanelComponent], host: {
  2942. '[class.ng-select]': 'true',
  2943. '[class.ng-select-single]': '!multiple()',
  2944. '[class.ng-select-typeahead]': 'typeahead()',
  2945. '[class.ng-select-multiple]': 'multiple()',
  2946. '[class.ng-select-taggable]': 'addTag()',
  2947. '[class.ng-select-searchable]': 'searchable()',
  2948. '[class.ng-select-clearable]': 'clearable()',
  2949. '[class.ng-select-opened]': 'isOpen()',
  2950. '[class.ng-select-filtered]': 'filtered',
  2951. '[class.ng-select-disabled]': 'disabled()',
  2952. }, template: "<div\n\t(mousedown)=\"handleMousedown($event)\"\n\t[class.ng-appearance-outline]=\"appearance() === 'outline'\"\n\t[class.ng-has-value]=\"hasValue\"\n\tclass=\"ng-select-container\">\n\t<div class=\"ng-value-container\">\n\t\t@if ((selectedItems.length === 0 && !searchTerm) || (fixedPlaceholder() ?? config.fixedPlaceholder )) {\n\t\t\t<ng-template #defaultPlaceholderTemplate>\n\t\t\t\t<div class=\"ng-placeholder\">{{ placeholder() ?? config.placeholder }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template [ngTemplateOutlet]=\"placeholderTemplate() || defaultPlaceholderTemplate\"> </ng-template>\n\t\t}\n\n\t\t@if ((!multiLabelTemplate() || !multiple()) && selectedItems.length > 0) {\n\t\t\t@for (item of selectedItems; track trackByOption($index, item)) {\n\t\t\t\t<div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\">\n\t\t\t\t\t<ng-template #defaultLabelTemplate>\n\t\t\t\t\t\t<span class=\"ng-value-icon left\" (click)=\"unselect(item)\" aria-hidden=\"true\">\u00D7</span>\n\t\t\t\t\t\t<span class=\"ng-value-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutlet]=\"labelTemplate() || defaultLabelTemplate\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t}\n\n\t\t@if (multiple() && multiLabelTemplate() && selectedValues.length > 0) {\n\t\t\t<ng-template [ngTemplateOutlet]=\"multiLabelTemplate()\" [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n\t\t\t</ng-template>\n\t\t}\n\n\t\t<div class=\"ng-input\">\n\t\t\t<input\n\t\t\t\t#searchInput\n\t\t\t\t(blur)=\"onInputBlur($event)\"\n\t\t\t\t(change)=\"$event.stopPropagation()\"\n\t\t\t\t(compositionend)=\"onCompositionEnd(searchInput.value)\"\n\t\t\t\t(compositionstart)=\"onCompositionStart()\"\n\t\t\t\t(focus)=\"onInputFocus($event)\"\n\t\t\t\t(input)=\"filter(searchInput.value)\"\n\t\t\t\t[attr.aria-activedescendant]=\"isOpen() ? itemsList?.markedItem?.htmlId : null\"\n\t\t\t\t[attr.aria-controls]=\"isOpen() ? dropdownId : null\"\n\t\t\t\t[attr.aria-expanded]=\"isOpen()\"\n\t\t\t\t[attr.aria-label]=\"ariaLabel()\"\n\t\t\t\t[attr.id]=\"labelForId()\"\n\t\t\t\t[attr.tabindex]=\"tabIndex()\"\n\t\t\t\t[disabled]=\"disabled()\"\n\t\t\t\t[readOnly]=\"!searchable() || itemsList.maxItemsSelected\"\n\t\t\t\t[value]=\"searchTerm ?? ''\"\n\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\trole=\"combobox\" />\n\t\t</div>\n\t</div>\n\n\t@if (loading()) {\n\t\t<ng-template #defaultLoadingSpinnerTemplate>\n\t\t\t<div class=\"ng-spinner-loader\"></div>\n\t\t</ng-template>\n\t\t<ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate() || defaultLoadingSpinnerTemplate\"></ng-template>\n\t}\n\n\t@if (showClear()) {\n\t\t@if (clearButtonTemplate()) {\n\t\t\t<ng-container [ngTemplateOutlet]=\"clearButtonTemplate()\"></ng-container>\n\t\t} @else {\n\t\t\t<span\n\t\t\t\tclass=\"ng-clear-wrapper\"\n\t\t\t\trole=\"button\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t[attr.tabindex]=\"tabFocusOnClear() ? 0 : -1\"\n\t\t\t\ttitle=\"{{ clearAllText() || config.clearAllText }}\"\n\t\t\t\t#clearButton\n\t\t\t\t(click)=\"handleClearClick($event)\">\n\t\t\t\t<span class=\"ng-clear\" aria-hidden=\"true\">\u00D7</span>\n\t\t\t</span>\n\t\t}\n\t}\n\n\t<span class=\"ng-arrow-wrapper\">\n\t\t<span class=\"ng-arrow\"></span>\n\t</span>\n</div>\n\n@if (isOpen()) {\n\t@let appendToValue = appendTo() || config.appendTo;\n\t<ng-dropdown-panel\n\t\tclass=\"ng-dropdown-panel\"\n\t\t[virtualScroll]=\"virtualScroll() ?? !config.disableVirtualScroll ?? false\"\n\t\t[bufferAmount]=\"bufferAmount()\"\n\t\t[appendTo]=\"appendToValue\"\n\t\t[position]=\"dropdownPosition()\"\n\t\t[headerTemplate]=\"headerTemplate()\"\n\t\t[footerTemplate]=\"footerTemplate()\"\n\t\t[filterValue]=\"searchTerm\"\n\t\t[items]=\"itemsList.filteredItems\"\n\t\t[markedItem]=\"itemsList.markedItem\"\n\t\t(update)=\"viewPortItems = $event\"\n\t\t(scroll)=\"scroll.emit($event)\"\n\t\t(scrollToEnd)=\"scrollToEnd.emit($event)\"\n\t\t(outsideClick)=\"close()\"\n\t\t[class.ng-select-multiple]=\"multiple()\"\n\t\t[class]=\"appendToValue ? (ngClass() ? ngClass() : classes) : null\"\n\t\t[id]=\"dropdownId\"\n\t\t[ariaLabelDropdown]=\"ariaLabelDropdown()\">\n\t\t<ng-container>\n\t\t\t@for (item of viewPortItems; track trackByOption($index, item)) {\n\t\t\t\t<div\n\t\t\t\t\tclass=\"ng-option\"\n\t\t\t\t\t[attr.role]=\"item.children ? 'group' : 'option'\"\n\t\t\t\t\t(click)=\"toggleItem(item)\"\n\t\t\t\t\t(mouseover)=\"onItemHover(item)\"\n\t\t\t\t\t[class.ng-option-disabled]=\"item.disabled\"\n\t\t\t\t\t[class.ng-option-selected]=\"item.selected\"\n\t\t\t\t\t[class.ng-optgroup]=\"item.children\"\n\t\t\t\t\t[class.ng-option]=\"!item.children\"\n\t\t\t\t\t[class.ng-option-child]=\"!!item.parent\"\n\t\t\t\t\t[class.ng-option-marked]=\"item === itemsList.markedItem\"\n\t\t\t\t\t[attr.aria-selected]=\"item.selected\"\n\t\t\t\t\t[attr.id]=\"item?.htmlId\"\n\t\t\t\t\t[attr.aria-setsize]=\"itemsList.filteredItems.length\"\n\t\t\t\t\t[attr.aria-posinset]=\"item.index + 1\">\n\t\t\t\t\t<ng-template #defaultOptionTemplate>\n\t\t\t\t\t\t<span class=\"ng-option-label\" [ngItemLabel]=\"item.label\" [escape]=\"escapeHTML\"></span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutlet]=\"\n\t\t\t\t\t\t\titem.children ? optgroupTemplate() || defaultOptionTemplate : optionTemplate() || defaultOptionTemplate\n\t\t\t\t\t\t\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ item: item.value, item$: item, index: item.index, searchTerm: searchTerm }\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t@if (showAddTag) {\n\t\t\t\t<div\n\t\t\t\t\tclass=\"ng-option\"\n\t\t\t\t\t[class.ng-option-marked]=\"!itemsList.markedItem\"\n\t\t\t\t\t(mouseover)=\"itemsList.unmarkItem()\"\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\t(click)=\"selectTag()\">\n\t\t\t\t\t<ng-template #defaultTagTemplate>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t><span class=\"ng-tag-label\">{{ addTagText() || config.addTagText }}</span\n\t\t\t\t\t\t\t>\"{{ searchTerm }}\"</span\n\t\t\t\t\t\t>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutlet]=\"tagTemplate() || defaultTagTemplate\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</ng-container>\n\t\t@if (showNoItemsFound()) {\n\t\t\t<ng-template #defaultNotFoundTemplate>\n\t\t\t\t<div class=\"ng-option ng-option-disabled\">{{ notFoundText() ?? config.notFoundText }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template\n\t\t\t\t[ngTemplateOutlet]=\"notFoundTemplate() || defaultNotFoundTemplate\"\n\t\t\t\t[ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n\t\t\t</ng-template>\n\t\t}\n\t\t@if (showTypeToSearch()) {\n\t\t\t<ng-template #defaultTypeToSearchTemplate>\n\t\t\t\t<div class=\"ng-option ng-option-disabled\">{{ typeToSearchText() || config.typeToSearchText }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template [ngTemplateOutlet]=\"typeToSearchTemplate() || defaultTypeToSearchTemplate\"></ng-template>\n\t\t}\n\t\t@if (loading() && itemsList.filteredItems.length === 0) {\n\t\t\t<ng-template #defaultLoadingTextTemplate>\n\t\t\t\t<div class=\"ng-option ng-option-disabled\">{{ loadingText() || config.loadingText }}</div>\n\t\t\t</ng-template>\n\t\t\t<ng-template\n\t\t\t\t[ngTemplateOutlet]=\"loadingTextTemplate() || defaultLoadingTextTemplate\"\n\t\t\t\t[ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n\t\t\t</ng-template>\n\t\t}\n\t</ng-dropdown-panel>\n}\n\n<!-- Always present aria-live region -->\n<div aria-atomic=\"true\" aria-live=\"polite\" class=\"ng-visually-hidden\" role=\"status\">\n\t@if (isOpen && showNoItemsFound()) {\n\t\t{{ notFoundText }}\n\t}\n</div>\n", styles: ["@charset \"UTF-8\";.ng-select{position:relative;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none transparent;border:0 none;box-shadow:none;outline:none;padding:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:unset;user-select:unset;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-option-label:empty:before{content:\"\\200b\"}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}.ng-visually-hidden{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0;white-space:nowrap}\n"] }]
  2953. }], ctorParameters: () => [], propDecorators: { handleKeyDown: [{
  2954. type: HostListener,
  2955. args: ['keydown', ['$event']]
  2956. }] } });
  2957. class NgSelectModule {
  2958. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
  2959. static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0", ngImport: i0, type: NgSelectModule, imports: [NgDropdownPanelComponent,
  2960. NgOptionComponent,
  2961. NgSelectComponent,
  2962. NgOptgroupTemplateDirective,
  2963. NgOptionTemplateDirective,
  2964. NgLabelTemplateDirective,
  2965. NgMultiLabelTemplateDirective,
  2966. NgHeaderTemplateDirective,
  2967. NgFooterTemplateDirective,
  2968. NgPlaceholderTemplateDirective,
  2969. NgClearButtonTemplateDirective,
  2970. NgNotFoundTemplateDirective,
  2971. NgTypeToSearchTemplateDirective,
  2972. NgLoadingTextTemplateDirective,
  2973. NgTagTemplateDirective,
  2974. NgLoadingSpinnerTemplateDirective,
  2975. NgItemLabelDirective], exports: [NgSelectComponent,
  2976. NgOptionComponent,
  2977. NgOptgroupTemplateDirective,
  2978. NgOptionTemplateDirective,
  2979. NgLabelTemplateDirective,
  2980. NgMultiLabelTemplateDirective,
  2981. NgHeaderTemplateDirective,
  2982. NgFooterTemplateDirective,
  2983. NgPlaceholderTemplateDirective,
  2984. NgNotFoundTemplateDirective,
  2985. NgTypeToSearchTemplateDirective,
  2986. NgLoadingTextTemplateDirective,
  2987. NgTagTemplateDirective,
  2988. NgLoadingSpinnerTemplateDirective,
  2989. NgClearButtonTemplateDirective] }); }
  2990. static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectModule, providers: provideNgSelect() }); }
  2991. }
  2992. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgSelectModule, decorators: [{
  2993. type: NgModule,
  2994. args: [{
  2995. imports: [
  2996. NgDropdownPanelComponent,
  2997. NgOptionComponent,
  2998. NgSelectComponent,
  2999. NgOptgroupTemplateDirective,
  3000. NgOptionTemplateDirective,
  3001. NgLabelTemplateDirective,
  3002. NgMultiLabelTemplateDirective,
  3003. NgHeaderTemplateDirective,
  3004. NgFooterTemplateDirective,
  3005. NgPlaceholderTemplateDirective,
  3006. NgClearButtonTemplateDirective,
  3007. NgNotFoundTemplateDirective,
  3008. NgTypeToSearchTemplateDirective,
  3009. NgLoadingTextTemplateDirective,
  3010. NgTagTemplateDirective,
  3011. NgLoadingSpinnerTemplateDirective,
  3012. NgItemLabelDirective,
  3013. ],
  3014. exports: [
  3015. NgSelectComponent,
  3016. NgOptionComponent,
  3017. NgOptgroupTemplateDirective,
  3018. NgOptionTemplateDirective,
  3019. NgLabelTemplateDirective,
  3020. NgMultiLabelTemplateDirective,
  3021. NgHeaderTemplateDirective,
  3022. NgFooterTemplateDirective,
  3023. NgPlaceholderTemplateDirective,
  3024. NgNotFoundTemplateDirective,
  3025. NgTypeToSearchTemplateDirective,
  3026. NgLoadingTextTemplateDirective,
  3027. NgTagTemplateDirective,
  3028. NgLoadingSpinnerTemplateDirective,
  3029. NgClearButtonTemplateDirective
  3030. ],
  3031. providers: provideNgSelect(),
  3032. }]
  3033. }] });
  3034. function provideNgSelect() {
  3035. return [
  3036. {
  3037. provide: SELECTION_MODEL_FACTORY,
  3038. useValue: DefaultSelectionModelFactory,
  3039. },
  3040. ];
  3041. }
  3042. /*
  3043. * Public API Surface of ng-select
  3044. */
  3045. /**
  3046. * Generated bundle index. Do not edit.
  3047. */
  3048. export { ConsoleService, DefaultSelectionModel, DefaultSelectionModelFactory, NgClearButtonTemplateDirective, NgDropdownPanelComponent, NgDropdownPanelService, NgFooterTemplateDirective, NgHeaderTemplateDirective, NgItemLabelDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgPlaceholderTemplateDirective, NgSelectComponent, NgSelectConfig, NgSelectModule, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, SELECTION_MODEL_FACTORY };
  3049. //# sourceMappingURL=ng-select-ng-select.mjs.map