ngx-bootstrap-utils.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. import { isDevMode } from '@angular/core';
  2. /**
  3. * @fileoverview added by tsickle
  4. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5. */
  6. /**
  7. * @copyright Valor Software
  8. * @copyright Angular ng-bootstrap team
  9. */
  10. var Trigger = /** @class */ (function () {
  11. function Trigger(open, close) {
  12. this.open = open;
  13. this.close = close || open;
  14. }
  15. /**
  16. * @return {?}
  17. */
  18. Trigger.prototype.isManual = /**
  19. * @return {?}
  20. */
  21. function () {
  22. return this.open === 'manual' || this.close === 'manual';
  23. };
  24. return Trigger;
  25. }());
  26. /**
  27. * @fileoverview added by tsickle
  28. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  29. */
  30. /** @type {?} */
  31. var DEFAULT_ALIASES = {
  32. hover: ['mouseover', 'mouseout'],
  33. focus: ['focusin', 'focusout']
  34. };
  35. /* tslint:disable-next-line: no-any */
  36. /**
  37. * @param {?} triggers
  38. * @param {?=} aliases
  39. * @return {?}
  40. */
  41. function parseTriggers(triggers, aliases) {
  42. if (aliases === void 0) { aliases = DEFAULT_ALIASES; }
  43. /** @type {?} */
  44. var trimmedTriggers = (triggers || '').trim();
  45. if (trimmedTriggers.length === 0) {
  46. return [];
  47. }
  48. /** @type {?} */
  49. var parsedTriggers = trimmedTriggers
  50. .split(/\s+/)
  51. .map((/**
  52. * @param {?} trigger
  53. * @return {?}
  54. */
  55. function (trigger) { return trigger.split(':'); }))
  56. .map((/**
  57. * @param {?} triggerPair
  58. * @return {?}
  59. */
  60. function (triggerPair) {
  61. /** @type {?} */
  62. var alias = aliases[triggerPair[0]] || triggerPair;
  63. return new Trigger(alias[0], alias[1]);
  64. }));
  65. /** @type {?} */
  66. var manualTriggers = parsedTriggers.filter((/**
  67. * @param {?} triggerPair
  68. * @return {?}
  69. */
  70. function (triggerPair) {
  71. return triggerPair.isManual();
  72. }));
  73. if (manualTriggers.length > 1) {
  74. throw new Error('Triggers parse error: only one manual trigger is allowed');
  75. }
  76. if (manualTriggers.length === 1 && parsedTriggers.length > 1) {
  77. throw new Error('Triggers parse error: manual trigger can\'t be mixed with other triggers');
  78. }
  79. return parsedTriggers;
  80. }
  81. /**
  82. * @param {?} renderer
  83. * @param {?} target
  84. * @param {?} triggers
  85. * @param {?} showFn
  86. * @param {?} hideFn
  87. * @param {?} toggleFn
  88. * @return {?}
  89. */
  90. function listenToTriggers(renderer,
  91. /* tslint:disable-next-line: no-any */
  92. target, triggers, showFn, hideFn, toggleFn) {
  93. /** @type {?} */
  94. var parsedTriggers = parseTriggers(triggers);
  95. /* tslint:disable-next-line: no-any */
  96. /** @type {?} */
  97. var listeners = [];
  98. if (parsedTriggers.length === 1 && parsedTriggers[0].isManual()) {
  99. return Function.prototype;
  100. }
  101. parsedTriggers.forEach((/**
  102. * @param {?} trigger
  103. * @return {?}
  104. */
  105. function (trigger) {
  106. if (trigger.open === trigger.close) {
  107. listeners.push(renderer.listen(target, trigger.open, toggleFn));
  108. return;
  109. }
  110. listeners.push(renderer.listen(target, trigger.open, showFn), renderer.listen(target, trigger.close, hideFn));
  111. }));
  112. return (/**
  113. * @return {?}
  114. */
  115. function () {
  116. listeners.forEach((/**
  117. * @param {?} unsubscribeFn
  118. * @return {?}
  119. */
  120. function (unsubscribeFn) { return unsubscribeFn(); }));
  121. });
  122. }
  123. /**
  124. * @param {?} renderer
  125. * @param {?} options
  126. * @return {?}
  127. */
  128. function listenToTriggersV2(renderer, options) {
  129. /** @type {?} */
  130. var parsedTriggers = parseTriggers(options.triggers);
  131. /** @type {?} */
  132. var target = options.target;
  133. // do nothing
  134. if (parsedTriggers.length === 1 && parsedTriggers[0].isManual()) {
  135. return Function.prototype;
  136. }
  137. // all listeners
  138. /* tslint:disable-next-line: no-any */
  139. /** @type {?} */
  140. var listeners = [];
  141. // lazy listeners registration
  142. /** @type {?} */
  143. var _registerHide = [];
  144. /** @type {?} */
  145. var registerHide = (/**
  146. * @return {?}
  147. */
  148. function () {
  149. // add hide listeners to unregister array
  150. _registerHide.forEach((/**
  151. * @param {?} fn
  152. * @return {?}
  153. */
  154. function (fn) { return listeners.push(fn()); }));
  155. // register hide events only once
  156. _registerHide.length = 0;
  157. });
  158. // register open\close\toggle listeners
  159. parsedTriggers.forEach((/**
  160. * @param {?} trigger
  161. * @return {?}
  162. */
  163. function (trigger) {
  164. /** @type {?} */
  165. var useToggle = trigger.open === trigger.close;
  166. /** @type {?} */
  167. var showFn = useToggle ? options.toggle : options.show;
  168. if (!useToggle) {
  169. _registerHide.push((/**
  170. * @return {?}
  171. */
  172. function () {
  173. return renderer.listen(target, trigger.close, options.hide);
  174. }));
  175. }
  176. listeners.push(renderer.listen(target, trigger.open, (/**
  177. * @return {?}
  178. */
  179. function () { return showFn(registerHide); })));
  180. }));
  181. return (/**
  182. * @return {?}
  183. */
  184. function () {
  185. listeners.forEach((/**
  186. * @param {?} unsubscribeFn
  187. * @return {?}
  188. */
  189. function (unsubscribeFn) { return unsubscribeFn(); }));
  190. });
  191. }
  192. /**
  193. * @param {?} renderer
  194. * @param {?} options
  195. * @return {?}
  196. */
  197. function registerOutsideClick(renderer, options) {
  198. if (!options.outsideClick) {
  199. return Function.prototype;
  200. }
  201. /* tslint:disable-next-line: no-any */
  202. return renderer.listen('document', 'click', (/**
  203. * @param {?} event
  204. * @return {?}
  205. */
  206. function (event) {
  207. if (options.target && options.target.contains(event.target)) {
  208. return undefined;
  209. }
  210. if (options.targets &&
  211. options.targets.some((/**
  212. * @param {?} target
  213. * @return {?}
  214. */
  215. function (target) { return target.contains(event.target); }))) {
  216. return undefined;
  217. }
  218. options.hide();
  219. }));
  220. }
  221. /**
  222. * @param {?} renderer
  223. * @param {?} options
  224. * @return {?}
  225. */
  226. function registerEscClick(renderer, options) {
  227. if (!options.outsideEsc) {
  228. return Function.prototype;
  229. }
  230. return renderer.listen('document', 'keyup.esc', (/**
  231. * @param {?} event
  232. * @return {?}
  233. */
  234. function (event) {
  235. if (options.target && options.target.contains(event.target)) {
  236. return undefined;
  237. }
  238. if (options.targets &&
  239. options.targets.some((/**
  240. * @param {?} target
  241. * @return {?}
  242. */
  243. function (target) { return target.contains(event.target); }))) {
  244. return undefined;
  245. }
  246. options.hide();
  247. }));
  248. }
  249. /**
  250. * @fileoverview added by tsickle
  251. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  252. */
  253. /**
  254. * @license
  255. * Copyright Google Inc. All Rights Reserved.
  256. *
  257. * Use of this source code is governed by an MIT-style license that can be
  258. * found in the LICENSE file at https://angular.io/license
  259. */
  260. /**
  261. * JS version of browser APIs. This library can only run in the browser.
  262. * @type {?}
  263. */
  264. var win = (typeof window !== 'undefined' && window) || (/** @type {?} */ ({}));
  265. /** @type {?} */
  266. var document$1 = win.document;
  267. /** @type {?} */
  268. var location = win.location;
  269. /** @type {?} */
  270. var gc = win.gc ? (/**
  271. * @return {?}
  272. */
  273. function () { return win.gc(); }) : (/**
  274. * @return {?}
  275. */
  276. function () { return null; });
  277. /** @type {?} */
  278. var performance = win.performance ? win.performance : null;
  279. /** @type {?} */
  280. var Event = win.Event;
  281. /** @type {?} */
  282. var MouseEvent = win.MouseEvent;
  283. /** @type {?} */
  284. var KeyboardEvent = win.KeyboardEvent;
  285. /** @type {?} */
  286. var EventTarget = win.EventTarget;
  287. /** @type {?} */
  288. var History = win.History;
  289. /** @type {?} */
  290. var Location = win.Location;
  291. /** @type {?} */
  292. var EventListener = win.EventListener;
  293. /**
  294. * @fileoverview added by tsickle
  295. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  296. */
  297. /** @type {?} */
  298. var guessedVersion;
  299. /**
  300. * @return {?}
  301. */
  302. function _guessBsVersion() {
  303. if (typeof document === 'undefined') {
  304. return null;
  305. }
  306. /** @type {?} */
  307. var spanEl = document.createElement('span');
  308. spanEl.innerText = 'test bs version';
  309. document.body.appendChild(spanEl);
  310. spanEl.classList.add('d-none');
  311. /** @type {?} */
  312. var rect = spanEl.getBoundingClientRect();
  313. document.body.removeChild(spanEl);
  314. if (!rect) {
  315. return 'bs3';
  316. }
  317. return rect.top === 0 ? 'bs4' : 'bs3';
  318. }
  319. /**
  320. * @param {?} theme
  321. * @return {?}
  322. */
  323. function setTheme(theme) {
  324. guessedVersion = theme;
  325. }
  326. // todo: in ngx-bootstrap, bs4 will became a default one
  327. /**
  328. * @return {?}
  329. */
  330. function isBs3() {
  331. if (typeof win === 'undefined') {
  332. return true;
  333. }
  334. if (typeof win.__theme === 'undefined') {
  335. if (guessedVersion) {
  336. return guessedVersion === 'bs3';
  337. }
  338. guessedVersion = _guessBsVersion();
  339. return guessedVersion === 'bs3';
  340. }
  341. return win.__theme !== 'bs4';
  342. }
  343. /**
  344. * @fileoverview added by tsickle
  345. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  346. */
  347. /**
  348. * @template T
  349. */
  350. var /**
  351. * @template T
  352. */
  353. LinkedList = /** @class */ (function () {
  354. function LinkedList() {
  355. this.length = 0;
  356. this.asArray = [];
  357. // Array methods overriding END
  358. }
  359. /**
  360. * @param {?} position
  361. * @return {?}
  362. */
  363. LinkedList.prototype.get = /**
  364. * @param {?} position
  365. * @return {?}
  366. */
  367. function (position) {
  368. if (this.length === 0 || position < 0 || position >= this.length) {
  369. return void 0;
  370. }
  371. /** @type {?} */
  372. var current = this.head;
  373. for (var index = 0; index < position; index++) {
  374. current = current.next;
  375. }
  376. return current.value;
  377. };
  378. /**
  379. * @param {?} value
  380. * @param {?=} position
  381. * @return {?}
  382. */
  383. LinkedList.prototype.add = /**
  384. * @param {?} value
  385. * @param {?=} position
  386. * @return {?}
  387. */
  388. function (value, position) {
  389. if (position === void 0) { position = this.length; }
  390. if (position < 0 || position > this.length) {
  391. throw new Error('Position is out of the list');
  392. }
  393. /* tslint:disable-next-line: no-any*/
  394. /** @type {?} */
  395. var node = {
  396. value: value,
  397. next: undefined,
  398. previous: undefined
  399. };
  400. if (this.length === 0) {
  401. this.head = node;
  402. this.tail = node;
  403. this.current = node;
  404. }
  405. else {
  406. if (position === 0) {
  407. // first node
  408. node.next = this.head;
  409. this.head.previous = node;
  410. this.head = node;
  411. }
  412. else if (position === this.length) {
  413. // last node
  414. this.tail.next = node;
  415. node.previous = this.tail;
  416. this.tail = node;
  417. }
  418. else {
  419. // node in middle
  420. /** @type {?} */
  421. var currentPreviousNode = this.getNode(position - 1);
  422. /** @type {?} */
  423. var currentNextNode = currentPreviousNode.next;
  424. currentPreviousNode.next = node;
  425. currentNextNode.previous = node;
  426. node.previous = currentPreviousNode;
  427. node.next = currentNextNode;
  428. }
  429. }
  430. this.length++;
  431. this.createInternalArrayRepresentation();
  432. };
  433. /**
  434. * @param {?=} position
  435. * @return {?}
  436. */
  437. LinkedList.prototype.remove = /**
  438. * @param {?=} position
  439. * @return {?}
  440. */
  441. function (position) {
  442. if (position === void 0) { position = 0; }
  443. if (this.length === 0 || position < 0 || position >= this.length) {
  444. throw new Error('Position is out of the list');
  445. }
  446. if (position === 0) {
  447. // first node
  448. this.head = this.head.next;
  449. if (this.head) {
  450. // there is no second node
  451. this.head.previous = undefined;
  452. }
  453. else {
  454. // there is no second node
  455. this.tail = undefined;
  456. }
  457. }
  458. else if (position === this.length - 1) {
  459. // last node
  460. this.tail = this.tail.previous;
  461. this.tail.next = undefined;
  462. }
  463. else {
  464. // middle node
  465. /** @type {?} */
  466. var removedNode = this.getNode(position);
  467. removedNode.next.previous = removedNode.previous;
  468. removedNode.previous.next = removedNode.next;
  469. }
  470. this.length--;
  471. this.createInternalArrayRepresentation();
  472. };
  473. /**
  474. * @param {?} position
  475. * @param {?} value
  476. * @return {?}
  477. */
  478. LinkedList.prototype.set = /**
  479. * @param {?} position
  480. * @param {?} value
  481. * @return {?}
  482. */
  483. function (position, value) {
  484. if (this.length === 0 || position < 0 || position >= this.length) {
  485. throw new Error('Position is out of the list');
  486. }
  487. /** @type {?} */
  488. var node = this.getNode(position);
  489. node.value = value;
  490. this.createInternalArrayRepresentation();
  491. };
  492. /**
  493. * @return {?}
  494. */
  495. LinkedList.prototype.toArray = /**
  496. * @return {?}
  497. */
  498. function () {
  499. return this.asArray;
  500. };
  501. /* tslint:disable-next-line: no-any*/
  502. /* tslint:disable-next-line: no-any*/
  503. /**
  504. * @param {?} fn
  505. * @return {?}
  506. */
  507. LinkedList.prototype.findAll = /* tslint:disable-next-line: no-any*/
  508. /**
  509. * @param {?} fn
  510. * @return {?}
  511. */
  512. function (fn) {
  513. /** @type {?} */
  514. var current = this.head;
  515. /* tslint:disable-next-line: no-any*/
  516. /** @type {?} */
  517. var result = [];
  518. for (var index = 0; index < this.length; index++) {
  519. if (fn(current.value, index)) {
  520. result.push({ index: index, value: current.value });
  521. }
  522. current = current.next;
  523. }
  524. return result;
  525. };
  526. // Array methods overriding start
  527. // Array methods overriding start
  528. /**
  529. * @param {...?} args
  530. * @return {?}
  531. */
  532. LinkedList.prototype.push =
  533. // Array methods overriding start
  534. /**
  535. * @param {...?} args
  536. * @return {?}
  537. */
  538. function () {
  539. var _this = this;
  540. var args = [];
  541. for (var _i = 0; _i < arguments.length; _i++) {
  542. args[_i] = arguments[_i];
  543. }
  544. /* tslint:disable-next-line: no-any*/
  545. args.forEach((/**
  546. * @param {?} arg
  547. * @return {?}
  548. */
  549. function (arg) {
  550. _this.add(arg);
  551. }));
  552. return this.length;
  553. };
  554. /**
  555. * @return {?}
  556. */
  557. LinkedList.prototype.pop = /**
  558. * @return {?}
  559. */
  560. function () {
  561. if (this.length === 0) {
  562. return undefined;
  563. }
  564. /** @type {?} */
  565. var last = this.tail;
  566. this.remove(this.length - 1);
  567. return last.value;
  568. };
  569. /**
  570. * @param {...?} args
  571. * @return {?}
  572. */
  573. LinkedList.prototype.unshift = /**
  574. * @param {...?} args
  575. * @return {?}
  576. */
  577. function () {
  578. var _this = this;
  579. var args = [];
  580. for (var _i = 0; _i < arguments.length; _i++) {
  581. args[_i] = arguments[_i];
  582. }
  583. args.reverse();
  584. /* tslint:disable-next-line: no-any*/
  585. args.forEach((/**
  586. * @param {?} arg
  587. * @return {?}
  588. */
  589. function (arg) {
  590. _this.add(arg, 0);
  591. }));
  592. return this.length;
  593. };
  594. /**
  595. * @return {?}
  596. */
  597. LinkedList.prototype.shift = /**
  598. * @return {?}
  599. */
  600. function () {
  601. if (this.length === 0) {
  602. return undefined;
  603. }
  604. /** @type {?} */
  605. var lastItem = this.head.value;
  606. this.remove();
  607. return lastItem;
  608. };
  609. /* tslint:disable-next-line: no-any*/
  610. /* tslint:disable-next-line: no-any*/
  611. /**
  612. * @param {?} fn
  613. * @return {?}
  614. */
  615. LinkedList.prototype.forEach = /* tslint:disable-next-line: no-any*/
  616. /**
  617. * @param {?} fn
  618. * @return {?}
  619. */
  620. function (fn) {
  621. /** @type {?} */
  622. var current = this.head;
  623. for (var index = 0; index < this.length; index++) {
  624. fn(current.value, index);
  625. current = current.next;
  626. }
  627. };
  628. /**
  629. * @param {?} value
  630. * @return {?}
  631. */
  632. LinkedList.prototype.indexOf = /**
  633. * @param {?} value
  634. * @return {?}
  635. */
  636. function (value) {
  637. /** @type {?} */
  638. var current = this.head;
  639. /** @type {?} */
  640. var position = 0;
  641. for (var index = 0; index < this.length; index++) {
  642. if (current.value === value) {
  643. position = index;
  644. break;
  645. }
  646. current = current.next;
  647. }
  648. return position;
  649. };
  650. /* tslint:disable-next-line: no-any*/
  651. /* tslint:disable-next-line: no-any*/
  652. /**
  653. * @param {?} fn
  654. * @return {?}
  655. */
  656. LinkedList.prototype.some = /* tslint:disable-next-line: no-any*/
  657. /**
  658. * @param {?} fn
  659. * @return {?}
  660. */
  661. function (fn) {
  662. /** @type {?} */
  663. var current = this.head;
  664. /** @type {?} */
  665. var result = false;
  666. while (current && !result) {
  667. if (fn(current.value)) {
  668. result = true;
  669. break;
  670. }
  671. current = current.next;
  672. }
  673. return result;
  674. };
  675. /* tslint:disable-next-line: no-any*/
  676. /* tslint:disable-next-line: no-any*/
  677. /**
  678. * @param {?} fn
  679. * @return {?}
  680. */
  681. LinkedList.prototype.every = /* tslint:disable-next-line: no-any*/
  682. /**
  683. * @param {?} fn
  684. * @return {?}
  685. */
  686. function (fn) {
  687. /** @type {?} */
  688. var current = this.head;
  689. /** @type {?} */
  690. var result = true;
  691. while (current && result) {
  692. if (!fn(current.value)) {
  693. result = false;
  694. }
  695. current = current.next;
  696. }
  697. return result;
  698. };
  699. /**
  700. * @return {?}
  701. */
  702. LinkedList.prototype.toString = /**
  703. * @return {?}
  704. */
  705. function () {
  706. return '[Linked List]';
  707. };
  708. /* tslint:disable-next-line: no-any*/
  709. /* tslint:disable-next-line: no-any*/
  710. /**
  711. * @param {?} fn
  712. * @return {?}
  713. */
  714. LinkedList.prototype.find = /* tslint:disable-next-line: no-any*/
  715. /**
  716. * @param {?} fn
  717. * @return {?}
  718. */
  719. function (fn) {
  720. /** @type {?} */
  721. var current = this.head;
  722. /** @type {?} */
  723. var result;
  724. for (var index = 0; index < this.length; index++) {
  725. if (fn(current.value, index)) {
  726. result = current.value;
  727. break;
  728. }
  729. current = current.next;
  730. }
  731. return result;
  732. };
  733. /* tslint:disable-next-line: no-any*/
  734. /* tslint:disable-next-line: no-any*/
  735. /**
  736. * @param {?} fn
  737. * @return {?}
  738. */
  739. LinkedList.prototype.findIndex = /* tslint:disable-next-line: no-any*/
  740. /**
  741. * @param {?} fn
  742. * @return {?}
  743. */
  744. function (fn) {
  745. /** @type {?} */
  746. var current = this.head;
  747. /** @type {?} */
  748. var result;
  749. for (var index = 0; index < this.length; index++) {
  750. if (fn(current.value, index)) {
  751. result = index;
  752. break;
  753. }
  754. current = current.next;
  755. }
  756. return result;
  757. };
  758. /* tslint:disable-next-line: no-any*/
  759. /* tslint:disable-next-line: no-any*/
  760. /**
  761. * @protected
  762. * @param {?} position
  763. * @return {?}
  764. */
  765. LinkedList.prototype.getNode = /* tslint:disable-next-line: no-any*/
  766. /**
  767. * @protected
  768. * @param {?} position
  769. * @return {?}
  770. */
  771. function (position) {
  772. if (this.length === 0 || position < 0 || position >= this.length) {
  773. throw new Error('Position is out of the list');
  774. }
  775. /** @type {?} */
  776. var current = this.head;
  777. for (var index = 0; index < position; index++) {
  778. current = current.next;
  779. }
  780. return current;
  781. };
  782. /**
  783. * @protected
  784. * @return {?}
  785. */
  786. LinkedList.prototype.createInternalArrayRepresentation = /**
  787. * @protected
  788. * @return {?}
  789. */
  790. function () {
  791. /* tslint:disable-next-line: no-any*/
  792. /** @type {?} */
  793. var outArray = [];
  794. /** @type {?} */
  795. var current = this.head;
  796. while (current) {
  797. outArray.push(current.value);
  798. current = current.next;
  799. }
  800. this.asArray = outArray;
  801. };
  802. return LinkedList;
  803. }());
  804. /**
  805. * @fileoverview added by tsickle
  806. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  807. */
  808. /*tslint:disable:no-invalid-this */
  809. /* tslint:disable-next-line: no-any */
  810. /**
  811. * @param {?=} defaultValue
  812. * @return {?}
  813. */
  814. function OnChange(defaultValue) {
  815. /** @type {?} */
  816. var sufix = 'Change';
  817. /* tslint:disable-next-line: no-any */
  818. return (/**
  819. * @param {?} target
  820. * @param {?} propertyKey
  821. * @return {?}
  822. */
  823. function OnChangeHandler(target, propertyKey) {
  824. /** @type {?} */
  825. var _key = " __" + propertyKey + "Value";
  826. Object.defineProperty(target, propertyKey, {
  827. /* tslint:disable-next-line: no-any */
  828. get: /* tslint:disable-next-line: no-any */
  829. /**
  830. * @return {?}
  831. */
  832. function () {
  833. return this[_key];
  834. },
  835. /* tslint:disable-next-line: no-any */
  836. set: /* tslint:disable-next-line: no-any */
  837. /**
  838. * @param {?} value
  839. * @return {?}
  840. */
  841. function (value) {
  842. /** @type {?} */
  843. var prevValue = this[_key];
  844. this[_key] = value;
  845. if (prevValue !== value && this[propertyKey + sufix]) {
  846. this[propertyKey + sufix].emit(value);
  847. }
  848. }
  849. });
  850. });
  851. }
  852. /**
  853. * @fileoverview added by tsickle
  854. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  855. */
  856. var Utils = /** @class */ (function () {
  857. function Utils() {
  858. }
  859. /* tslint:disable-next-line: no-any */
  860. /* tslint:disable-next-line: no-any */
  861. /**
  862. * @param {?} element
  863. * @return {?}
  864. */
  865. Utils.reflow = /* tslint:disable-next-line: no-any */
  866. /**
  867. * @param {?} element
  868. * @return {?}
  869. */
  870. function (element) {
  871. /* tslint:disable-next-line: no-any */
  872. ((/**
  873. * @param {?} bs
  874. * @return {?}
  875. */
  876. function (bs) { return bs; }))(element.offsetHeight);
  877. };
  878. // source: https://github.com/jquery/jquery/blob/master/src/css/var/getStyles.js
  879. /* tslint:disable-next-line: no-any */
  880. // source: https://github.com/jquery/jquery/blob/master/src/css/var/getStyles.js
  881. /* tslint:disable-next-line: no-any */
  882. /**
  883. * @param {?} elem
  884. * @return {?}
  885. */
  886. Utils.getStyles =
  887. // source: https://github.com/jquery/jquery/blob/master/src/css/var/getStyles.js
  888. /* tslint:disable-next-line: no-any */
  889. /**
  890. * @param {?} elem
  891. * @return {?}
  892. */
  893. function (elem) {
  894. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  895. // IE throws on elements created in popups
  896. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  897. /** @type {?} */
  898. var view = elem.ownerDocument.defaultView;
  899. if (!view || !view.opener) {
  900. view = win;
  901. }
  902. return view.getComputedStyle(elem);
  903. };
  904. return Utils;
  905. }());
  906. /**
  907. * @fileoverview added by tsickle
  908. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  909. */
  910. /** @type {?} */
  911. var _messagesHash = {};
  912. /** @type {?} */
  913. var _hideMsg = typeof console === 'undefined' || !('warn' in console);
  914. /**
  915. * @param {?} msg
  916. * @return {?}
  917. */
  918. function warnOnce(msg) {
  919. if (!isDevMode() || _hideMsg || msg in _messagesHash) {
  920. return;
  921. }
  922. _messagesHash[msg] = true;
  923. /*tslint:disable-next-line*/
  924. console.warn(msg);
  925. }
  926. export { LinkedList, OnChange, Trigger, Utils, document$1 as document, isBs3, listenToTriggers, listenToTriggersV2, parseTriggers, registerEscClick, registerOutsideClick, setTheme, warnOnce, win as window };
  927. //# sourceMappingURL=ngx-bootstrap-utils.js.map