autocomplete.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6. return function (d, b) {
  7. extendStatics(d, b);
  8. function __() { this.constructor = d; }
  9. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10. };
  11. })();
  12. /*!
  13. * devextreme-angular
  14. * Version: 19.1.16
  15. * Build date: Tue Oct 18 2022
  16. *
  17. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  18. *
  19. * This software may be modified and distributed under the terms
  20. * of the MIT license. See the LICENSE file in the root of the project for details.
  21. *
  22. * https://github.com/DevExpress/devextreme-angular
  23. */
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var platform_browser_1 = require("@angular/platform-browser");
  26. var platform_browser_2 = require("@angular/platform-browser");
  27. var core_1 = require("@angular/core");
  28. var autocomplete_1 = require("devextreme/ui/autocomplete");
  29. var forms_1 = require("@angular/forms");
  30. var component_1 = require("../core/component");
  31. var template_host_1 = require("../core/template-host");
  32. var integration_1 = require("../core/integration");
  33. var template_1 = require("../core/template");
  34. var nested_option_1 = require("../core/nested-option");
  35. var watcher_helper_1 = require("../core/watcher-helper");
  36. var iterable_differ_helper_1 = require("../core/iterable-differ-helper");
  37. var button_dxi_1 = require("./nested/button-dxi");
  38. var options_1 = require("./nested/options");
  39. var item_dxi_1 = require("./nested/item-dxi");
  40. var button_dxi_2 = require("./nested/button-dxi");
  41. var item_dxi_2 = require("./nested/item-dxi");
  42. var CUSTOM_VALUE_ACCESSOR_PROVIDER = {
  43. provide: forms_1.NG_VALUE_ACCESSOR,
  44. useExisting: core_1.forwardRef(function () { return DxAutocompleteComponent; }),
  45. multi: true
  46. };
  47. /**
  48. * The Autocomplete widget is a textbox that provides suggestions while a user types into it.
  49. */
  50. var DxAutocompleteComponent = (function (_super) {
  51. __extends(DxAutocompleteComponent, _super);
  52. function DxAutocompleteComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost, transferState, platformId) {
  53. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  54. _this._watcherHelper = _watcherHelper;
  55. _this._idh = _idh;
  56. _this.touched = function (_) { };
  57. _this._createEventEmitters([
  58. { subscribe: 'change', emit: 'onChange' },
  59. { subscribe: 'closed', emit: 'onClosed' },
  60. { subscribe: 'contentReady', emit: 'onContentReady' },
  61. { subscribe: 'copy', emit: 'onCopy' },
  62. { subscribe: 'cut', emit: 'onCut' },
  63. { subscribe: 'disposing', emit: 'onDisposing' },
  64. { subscribe: 'enterKey', emit: 'onEnterKey' },
  65. { subscribe: 'focusIn', emit: 'onFocusIn' },
  66. { subscribe: 'focusOut', emit: 'onFocusOut' },
  67. { subscribe: 'initialized', emit: 'onInitialized' },
  68. { subscribe: 'input', emit: 'onInput' },
  69. { subscribe: 'itemClick', emit: 'onItemClick' },
  70. { subscribe: 'keyDown', emit: 'onKeyDown' },
  71. { subscribe: 'keyPress', emit: 'onKeyPress' },
  72. { subscribe: 'keyUp', emit: 'onKeyUp' },
  73. { subscribe: 'opened', emit: 'onOpened' },
  74. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  75. { subscribe: 'paste', emit: 'onPaste' },
  76. { subscribe: 'selectionChanged', emit: 'onSelectionChanged' },
  77. { subscribe: 'valueChanged', emit: 'onValueChanged' },
  78. { emit: 'accessKeyChange' },
  79. { emit: 'activeStateEnabledChange' },
  80. { emit: 'buttonsChange' },
  81. { emit: 'dataSourceChange' },
  82. { emit: 'deferRenderingChange' },
  83. { emit: 'disabledChange' },
  84. { emit: 'displayValueChange' },
  85. { emit: 'dropDownButtonTemplateChange' },
  86. { emit: 'elementAttrChange' },
  87. { emit: 'focusStateEnabledChange' },
  88. { emit: 'groupedChange' },
  89. { emit: 'groupTemplateChange' },
  90. { emit: 'heightChange' },
  91. { emit: 'hintChange' },
  92. { emit: 'hoverStateEnabledChange' },
  93. { emit: 'inputAttrChange' },
  94. { emit: 'isValidChange' },
  95. { emit: 'itemsChange' },
  96. { emit: 'itemTemplateChange' },
  97. { emit: 'maxItemCountChange' },
  98. { emit: 'maxLengthChange' },
  99. { emit: 'minSearchLengthChange' },
  100. { emit: 'nameChange' },
  101. { emit: 'openedChange' },
  102. { emit: 'openOnFieldClickChange' },
  103. { emit: 'placeholderChange' },
  104. { emit: 'readOnlyChange' },
  105. { emit: 'rtlEnabledChange' },
  106. { emit: 'searchExprChange' },
  107. { emit: 'searchModeChange' },
  108. { emit: 'searchTimeoutChange' },
  109. { emit: 'selectedItemChange' },
  110. { emit: 'showClearButtonChange' },
  111. { emit: 'showDropDownButtonChange' },
  112. { emit: 'spellcheckChange' },
  113. { emit: 'stylingModeChange' },
  114. { emit: 'tabIndexChange' },
  115. { emit: 'textChange' },
  116. { emit: 'validationErrorChange' },
  117. { emit: 'validationMessageModeChange' },
  118. { emit: 'valueChange' },
  119. { emit: 'valueChangeEventChange' },
  120. { emit: 'valueExprChange' },
  121. { emit: 'visibleChange' },
  122. { emit: 'widthChange' },
  123. { emit: 'onBlur' }
  124. ]);
  125. _this._idh.setHost(_this);
  126. optionHost.setHost(_this);
  127. return _this;
  128. }
  129. Object.defineProperty(DxAutocompleteComponent.prototype, "accessKey", {
  130. get: /**
  131. * Specifies the shortcut key that sets focus on the widget.
  132. */
  133. function () {
  134. return this._getOption('accessKey');
  135. },
  136. set: function (value) {
  137. this._setOption('accessKey', value);
  138. },
  139. enumerable: true,
  140. configurable: true
  141. });
  142. Object.defineProperty(DxAutocompleteComponent.prototype, "activeStateEnabled", {
  143. get: /**
  144. * Specifies whether or not the widget changes its state when interacting with a user.
  145. */
  146. function () {
  147. return this._getOption('activeStateEnabled');
  148. },
  149. set: function (value) {
  150. this._setOption('activeStateEnabled', value);
  151. },
  152. enumerable: true,
  153. configurable: true
  154. });
  155. Object.defineProperty(DxAutocompleteComponent.prototype, "buttons", {
  156. get: /**
  157. * Allows you to add custom buttons to the input text field.
  158. */
  159. function () {
  160. return this._getOption('buttons');
  161. },
  162. set: function (value) {
  163. this._setOption('buttons', value);
  164. },
  165. enumerable: true,
  166. configurable: true
  167. });
  168. Object.defineProperty(DxAutocompleteComponent.prototype, "dataSource", {
  169. get: /**
  170. * Binds the widget to data.
  171. */
  172. function () {
  173. return this._getOption('dataSource');
  174. },
  175. set: function (value) {
  176. this._setOption('dataSource', value);
  177. },
  178. enumerable: true,
  179. configurable: true
  180. });
  181. Object.defineProperty(DxAutocompleteComponent.prototype, "deferRendering", {
  182. get: /**
  183. * Specifies whether to render the drop-down field's content when it is displayed. If false, the content is rendered immediately.
  184. */
  185. function () {
  186. return this._getOption('deferRendering');
  187. },
  188. set: function (value) {
  189. this._setOption('deferRendering', value);
  190. },
  191. enumerable: true,
  192. configurable: true
  193. });
  194. Object.defineProperty(DxAutocompleteComponent.prototype, "disabled", {
  195. get: /**
  196. * Specifies whether the widget responds to user interaction.
  197. */
  198. function () {
  199. return this._getOption('disabled');
  200. },
  201. set: function (value) {
  202. this._setOption('disabled', value);
  203. },
  204. enumerable: true,
  205. configurable: true
  206. });
  207. Object.defineProperty(DxAutocompleteComponent.prototype, "displayValue", {
  208. get: /**
  209. * Returns the value currently displayed by the widget.
  210. */
  211. function () {
  212. return this._getOption('displayValue');
  213. },
  214. set: function (value) {
  215. this._setOption('displayValue', value);
  216. },
  217. enumerable: true,
  218. configurable: true
  219. });
  220. Object.defineProperty(DxAutocompleteComponent.prototype, "dropDownButtonTemplate", {
  221. get: /**
  222. * Specifies a custom template for the drop-down button.
  223. */
  224. function () {
  225. return this._getOption('dropDownButtonTemplate');
  226. },
  227. set: function (value) {
  228. this._setOption('dropDownButtonTemplate', value);
  229. },
  230. enumerable: true,
  231. configurable: true
  232. });
  233. Object.defineProperty(DxAutocompleteComponent.prototype, "elementAttr", {
  234. get: /**
  235. * Specifies the attributes to be attached to the widget's root element.
  236. */
  237. function () {
  238. return this._getOption('elementAttr');
  239. },
  240. set: function (value) {
  241. this._setOption('elementAttr', value);
  242. },
  243. enumerable: true,
  244. configurable: true
  245. });
  246. Object.defineProperty(DxAutocompleteComponent.prototype, "focusStateEnabled", {
  247. get: /**
  248. * Specifies whether the widget can be focused using keyboard navigation.
  249. */
  250. function () {
  251. return this._getOption('focusStateEnabled');
  252. },
  253. set: function (value) {
  254. this._setOption('focusStateEnabled', value);
  255. },
  256. enumerable: true,
  257. configurable: true
  258. });
  259. Object.defineProperty(DxAutocompleteComponent.prototype, "grouped", {
  260. get: /**
  261. * Specifies whether data items should be grouped.
  262. */
  263. function () {
  264. return this._getOption('grouped');
  265. },
  266. set: function (value) {
  267. this._setOption('grouped', value);
  268. },
  269. enumerable: true,
  270. configurable: true
  271. });
  272. Object.defineProperty(DxAutocompleteComponent.prototype, "groupTemplate", {
  273. get: /**
  274. * Specifies a custom template for group captions.
  275. */
  276. function () {
  277. return this._getOption('groupTemplate');
  278. },
  279. set: function (value) {
  280. this._setOption('groupTemplate', value);
  281. },
  282. enumerable: true,
  283. configurable: true
  284. });
  285. Object.defineProperty(DxAutocompleteComponent.prototype, "height", {
  286. get: /**
  287. * Specifies the widget's height.
  288. */
  289. function () {
  290. return this._getOption('height');
  291. },
  292. set: function (value) {
  293. this._setOption('height', value);
  294. },
  295. enumerable: true,
  296. configurable: true
  297. });
  298. Object.defineProperty(DxAutocompleteComponent.prototype, "hint", {
  299. get: /**
  300. * Specifies text for a hint that appears when a user pauses on the widget.
  301. */
  302. function () {
  303. return this._getOption('hint');
  304. },
  305. set: function (value) {
  306. this._setOption('hint', value);
  307. },
  308. enumerable: true,
  309. configurable: true
  310. });
  311. Object.defineProperty(DxAutocompleteComponent.prototype, "hoverStateEnabled", {
  312. get: /**
  313. * Specifies whether the widget changes its state when a user pauses on it.
  314. */
  315. function () {
  316. return this._getOption('hoverStateEnabled');
  317. },
  318. set: function (value) {
  319. this._setOption('hoverStateEnabled', value);
  320. },
  321. enumerable: true,
  322. configurable: true
  323. });
  324. Object.defineProperty(DxAutocompleteComponent.prototype, "inputAttr", {
  325. get: /**
  326. * Specifies the attributes to be passed on to the underlying HTML element.
  327. */
  328. function () {
  329. return this._getOption('inputAttr');
  330. },
  331. set: function (value) {
  332. this._setOption('inputAttr', value);
  333. },
  334. enumerable: true,
  335. configurable: true
  336. });
  337. Object.defineProperty(DxAutocompleteComponent.prototype, "isValid", {
  338. get: /**
  339. * Specifies whether the editor's value is valid.
  340. */
  341. function () {
  342. return this._getOption('isValid');
  343. },
  344. set: function (value) {
  345. this._setOption('isValid', value);
  346. },
  347. enumerable: true,
  348. configurable: true
  349. });
  350. Object.defineProperty(DxAutocompleteComponent.prototype, "items", {
  351. get: /**
  352. * An array of items displayed by the widget.
  353. */
  354. function () {
  355. return this._getOption('items');
  356. },
  357. set: function (value) {
  358. this._setOption('items', value);
  359. },
  360. enumerable: true,
  361. configurable: true
  362. });
  363. Object.defineProperty(DxAutocompleteComponent.prototype, "itemTemplate", {
  364. get: /**
  365. * Specifies a custom template for items.
  366. */
  367. function () {
  368. return this._getOption('itemTemplate');
  369. },
  370. set: function (value) {
  371. this._setOption('itemTemplate', value);
  372. },
  373. enumerable: true,
  374. configurable: true
  375. });
  376. Object.defineProperty(DxAutocompleteComponent.prototype, "maxItemCount", {
  377. get: /**
  378. * Specifies the maximum count of items displayed by the widget.
  379. */
  380. function () {
  381. return this._getOption('maxItemCount');
  382. },
  383. set: function (value) {
  384. this._setOption('maxItemCount', value);
  385. },
  386. enumerable: true,
  387. configurable: true
  388. });
  389. Object.defineProperty(DxAutocompleteComponent.prototype, "maxLength", {
  390. get: /**
  391. * Specifies the maximum number of characters you can enter into the textbox.
  392. */
  393. function () {
  394. return this._getOption('maxLength');
  395. },
  396. set: function (value) {
  397. this._setOption('maxLength', value);
  398. },
  399. enumerable: true,
  400. configurable: true
  401. });
  402. Object.defineProperty(DxAutocompleteComponent.prototype, "minSearchLength", {
  403. get: /**
  404. * The minimum number of characters that must be entered into the text box to begin a search.
  405. */
  406. function () {
  407. return this._getOption('minSearchLength');
  408. },
  409. set: function (value) {
  410. this._setOption('minSearchLength', value);
  411. },
  412. enumerable: true,
  413. configurable: true
  414. });
  415. Object.defineProperty(DxAutocompleteComponent.prototype, "name", {
  416. get: /**
  417. * The value to be assigned to the `name` attribute of the underlying HTML element.
  418. */
  419. function () {
  420. return this._getOption('name');
  421. },
  422. set: function (value) {
  423. this._setOption('name', value);
  424. },
  425. enumerable: true,
  426. configurable: true
  427. });
  428. Object.defineProperty(DxAutocompleteComponent.prototype, "opened", {
  429. get: /**
  430. * Specifies whether or not the drop-down editor is displayed.
  431. */
  432. function () {
  433. return this._getOption('opened');
  434. },
  435. set: function (value) {
  436. this._setOption('opened', value);
  437. },
  438. enumerable: true,
  439. configurable: true
  440. });
  441. Object.defineProperty(DxAutocompleteComponent.prototype, "openOnFieldClick", {
  442. get: /**
  443. * Specifies whether a user can open the drop-down list by clicking a text field.
  444. */
  445. function () {
  446. return this._getOption('openOnFieldClick');
  447. },
  448. set: function (value) {
  449. this._setOption('openOnFieldClick', value);
  450. },
  451. enumerable: true,
  452. configurable: true
  453. });
  454. Object.defineProperty(DxAutocompleteComponent.prototype, "placeholder", {
  455. get: /**
  456. * The text displayed by the widget when the widget value is empty.
  457. */
  458. function () {
  459. return this._getOption('placeholder');
  460. },
  461. set: function (value) {
  462. this._setOption('placeholder', value);
  463. },
  464. enumerable: true,
  465. configurable: true
  466. });
  467. Object.defineProperty(DxAutocompleteComponent.prototype, "readOnly", {
  468. get: /**
  469. * Specifies whether the editor is read-only.
  470. */
  471. function () {
  472. return this._getOption('readOnly');
  473. },
  474. set: function (value) {
  475. this._setOption('readOnly', value);
  476. },
  477. enumerable: true,
  478. configurable: true
  479. });
  480. Object.defineProperty(DxAutocompleteComponent.prototype, "rtlEnabled", {
  481. get: /**
  482. * Switches the widget to a right-to-left representation.
  483. */
  484. function () {
  485. return this._getOption('rtlEnabled');
  486. },
  487. set: function (value) {
  488. this._setOption('rtlEnabled', value);
  489. },
  490. enumerable: true,
  491. configurable: true
  492. });
  493. Object.defineProperty(DxAutocompleteComponent.prototype, "searchExpr", {
  494. get: /**
  495. * Specifies the name of a data source item field or an expression whose value is compared to the search criterion.
  496. */
  497. function () {
  498. return this._getOption('searchExpr');
  499. },
  500. set: function (value) {
  501. this._setOption('searchExpr', value);
  502. },
  503. enumerable: true,
  504. configurable: true
  505. });
  506. Object.defineProperty(DxAutocompleteComponent.prototype, "searchMode", {
  507. get: /**
  508. * Specifies a comparison operation used to search widget items.
  509. */
  510. function () {
  511. return this._getOption('searchMode');
  512. },
  513. set: function (value) {
  514. this._setOption('searchMode', value);
  515. },
  516. enumerable: true,
  517. configurable: true
  518. });
  519. Object.defineProperty(DxAutocompleteComponent.prototype, "searchTimeout", {
  520. get: /**
  521. * Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed.
  522. */
  523. function () {
  524. return this._getOption('searchTimeout');
  525. },
  526. set: function (value) {
  527. this._setOption('searchTimeout', value);
  528. },
  529. enumerable: true,
  530. configurable: true
  531. });
  532. Object.defineProperty(DxAutocompleteComponent.prototype, "selectedItem", {
  533. get: /**
  534. * Gets the currently selected item.
  535. */
  536. function () {
  537. return this._getOption('selectedItem');
  538. },
  539. set: function (value) {
  540. this._setOption('selectedItem', value);
  541. },
  542. enumerable: true,
  543. configurable: true
  544. });
  545. Object.defineProperty(DxAutocompleteComponent.prototype, "showClearButton", {
  546. get: /**
  547. * Specifies whether to display the Clear button in the widget.
  548. */
  549. function () {
  550. return this._getOption('showClearButton');
  551. },
  552. set: function (value) {
  553. this._setOption('showClearButton', value);
  554. },
  555. enumerable: true,
  556. configurable: true
  557. });
  558. Object.defineProperty(DxAutocompleteComponent.prototype, "showDropDownButton", {
  559. get: /**
  560. * Specifies whether the drop-down button is visible.
  561. */
  562. function () {
  563. return this._getOption('showDropDownButton');
  564. },
  565. set: function (value) {
  566. this._setOption('showDropDownButton', value);
  567. },
  568. enumerable: true,
  569. configurable: true
  570. });
  571. Object.defineProperty(DxAutocompleteComponent.prototype, "spellcheck", {
  572. get: /**
  573. * Specifies whether or not the widget checks the inner text for spelling mistakes.
  574. */
  575. function () {
  576. return this._getOption('spellcheck');
  577. },
  578. set: function (value) {
  579. this._setOption('spellcheck', value);
  580. },
  581. enumerable: true,
  582. configurable: true
  583. });
  584. Object.defineProperty(DxAutocompleteComponent.prototype, "stylingMode", {
  585. get: /**
  586. * Specifies how the widget's text field is styled.
  587. */
  588. function () {
  589. return this._getOption('stylingMode');
  590. },
  591. set: function (value) {
  592. this._setOption('stylingMode', value);
  593. },
  594. enumerable: true,
  595. configurable: true
  596. });
  597. Object.defineProperty(DxAutocompleteComponent.prototype, "tabIndex", {
  598. get: /**
  599. * Specifies the number of the element when the Tab key is used for navigating.
  600. */
  601. function () {
  602. return this._getOption('tabIndex');
  603. },
  604. set: function (value) {
  605. this._setOption('tabIndex', value);
  606. },
  607. enumerable: true,
  608. configurable: true
  609. });
  610. Object.defineProperty(DxAutocompleteComponent.prototype, "text", {
  611. get: /**
  612. * The read-only option that holds the text displayed by the widget input element.
  613. */
  614. function () {
  615. return this._getOption('text');
  616. },
  617. set: function (value) {
  618. this._setOption('text', value);
  619. },
  620. enumerable: true,
  621. configurable: true
  622. });
  623. Object.defineProperty(DxAutocompleteComponent.prototype, "validationError", {
  624. get: /**
  625. * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option.
  626. */
  627. function () {
  628. return this._getOption('validationError');
  629. },
  630. set: function (value) {
  631. this._setOption('validationError', value);
  632. },
  633. enumerable: true,
  634. configurable: true
  635. });
  636. Object.defineProperty(DxAutocompleteComponent.prototype, "validationMessageMode", {
  637. get: /**
  638. * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed.
  639. */
  640. function () {
  641. return this._getOption('validationMessageMode');
  642. },
  643. set: function (value) {
  644. this._setOption('validationMessageMode', value);
  645. },
  646. enumerable: true,
  647. configurable: true
  648. });
  649. Object.defineProperty(DxAutocompleteComponent.prototype, "value", {
  650. get: /**
  651. * Specifies the current value displayed by the widget.
  652. */
  653. function () {
  654. return this._getOption('value');
  655. },
  656. set: function (value) {
  657. this._setOption('value', value);
  658. },
  659. enumerable: true,
  660. configurable: true
  661. });
  662. Object.defineProperty(DxAutocompleteComponent.prototype, "valueChangeEvent", {
  663. get: /**
  664. * Specifies the DOM events after which the widget's value should be updated.
  665. */
  666. function () {
  667. return this._getOption('valueChangeEvent');
  668. },
  669. set: function (value) {
  670. this._setOption('valueChangeEvent', value);
  671. },
  672. enumerable: true,
  673. configurable: true
  674. });
  675. Object.defineProperty(DxAutocompleteComponent.prototype, "valueExpr", {
  676. get: /**
  677. * Specifies which data field provides unique values to the widget's value.
  678. */
  679. function () {
  680. return this._getOption('valueExpr');
  681. },
  682. set: function (value) {
  683. this._setOption('valueExpr', value);
  684. },
  685. enumerable: true,
  686. configurable: true
  687. });
  688. Object.defineProperty(DxAutocompleteComponent.prototype, "visible", {
  689. get: /**
  690. * Specifies whether the widget is visible.
  691. */
  692. function () {
  693. return this._getOption('visible');
  694. },
  695. set: function (value) {
  696. this._setOption('visible', value);
  697. },
  698. enumerable: true,
  699. configurable: true
  700. });
  701. Object.defineProperty(DxAutocompleteComponent.prototype, "width", {
  702. get: /**
  703. * Specifies the widget's width.
  704. */
  705. function () {
  706. return this._getOption('width');
  707. },
  708. set: function (value) {
  709. this._setOption('width', value);
  710. },
  711. enumerable: true,
  712. configurable: true
  713. });
  714. DxAutocompleteComponent.prototype.change = function (_) { };
  715. Object.defineProperty(DxAutocompleteComponent.prototype, "buttonsChildren", {
  716. get: function () {
  717. return this._getOption('buttons');
  718. },
  719. set: function (value) {
  720. this.setChildren('buttons', value);
  721. },
  722. enumerable: true,
  723. configurable: true
  724. });
  725. Object.defineProperty(DxAutocompleteComponent.prototype, "itemsChildren", {
  726. get: function () {
  727. return this._getOption('items');
  728. },
  729. set: function (value) {
  730. this.setChildren('items', value);
  731. },
  732. enumerable: true,
  733. configurable: true
  734. });
  735. DxAutocompleteComponent.prototype._createInstance = function (element, options) {
  736. return new autocomplete_1.default(element, options);
  737. };
  738. DxAutocompleteComponent.prototype.writeValue = function (value) {
  739. this.eventHelper.lockedValueChangeEvent = true;
  740. this.value = value;
  741. this.eventHelper.lockedValueChangeEvent = false;
  742. };
  743. DxAutocompleteComponent.prototype.setDisabledState = function (isDisabled) {
  744. this.disabled = isDisabled;
  745. };
  746. DxAutocompleteComponent.prototype.registerOnChange = function (fn) { this.change = fn; };
  747. DxAutocompleteComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; };
  748. DxAutocompleteComponent.prototype._createWidget = function (element) {
  749. var _this = this;
  750. _super.prototype._createWidget.call(this, element);
  751. this.instance.on('focusOut', function (e) {
  752. _this.eventHelper.fireNgEvent('onBlur', [e]);
  753. });
  754. };
  755. DxAutocompleteComponent.prototype.ngOnDestroy = function () {
  756. this._destroyWidget();
  757. };
  758. DxAutocompleteComponent.prototype.ngOnChanges = function (changes) {
  759. _super.prototype.ngOnChanges.call(this, changes);
  760. this.setupChanges('buttons', changes);
  761. this.setupChanges('dataSource', changes);
  762. this.setupChanges('items', changes);
  763. this.setupChanges('searchExpr', changes);
  764. };
  765. DxAutocompleteComponent.prototype.setupChanges = function (prop, changes) {
  766. if (!(prop in this._optionsToUpdate)) {
  767. this._idh.setup(prop, changes);
  768. }
  769. };
  770. DxAutocompleteComponent.prototype.ngDoCheck = function () {
  771. this._idh.doCheck('buttons');
  772. this._idh.doCheck('dataSource');
  773. this._idh.doCheck('items');
  774. this._idh.doCheck('searchExpr');
  775. this._watcherHelper.checkWatchers();
  776. _super.prototype.ngDoCheck.call(this);
  777. _super.prototype.clearChangedOptions.call(this);
  778. };
  779. DxAutocompleteComponent.prototype._setOption = function (name, value) {
  780. var isSetup = this._idh.setupSingle(name, value);
  781. var isChanged = this._idh.getChanges(name, value) !== null;
  782. if (isSetup || isChanged) {
  783. _super.prototype._setOption.call(this, name, value);
  784. }
  785. };
  786. DxAutocompleteComponent.decorators = [
  787. { type: core_1.Component, args: [{
  788. selector: 'dx-autocomplete',
  789. template: '',
  790. providers: [
  791. template_host_1.DxTemplateHost,
  792. watcher_helper_1.WatcherHelper,
  793. CUSTOM_VALUE_ACCESSOR_PROVIDER,
  794. nested_option_1.NestedOptionHost,
  795. iterable_differ_helper_1.IterableDifferHelper
  796. ]
  797. },] },
  798. ];
  799. /** @nocollapse */
  800. DxAutocompleteComponent.ctorParameters = function () { return [
  801. { type: core_1.ElementRef, },
  802. { type: core_1.NgZone, },
  803. { type: template_host_1.DxTemplateHost, },
  804. { type: watcher_helper_1.WatcherHelper, },
  805. { type: iterable_differ_helper_1.IterableDifferHelper, },
  806. { type: nested_option_1.NestedOptionHost, },
  807. { type: platform_browser_2.TransferState, },
  808. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  809. ]; };
  810. DxAutocompleteComponent.propDecorators = {
  811. "accessKey": [{ type: core_1.Input },],
  812. "activeStateEnabled": [{ type: core_1.Input },],
  813. "buttons": [{ type: core_1.Input },],
  814. "dataSource": [{ type: core_1.Input },],
  815. "deferRendering": [{ type: core_1.Input },],
  816. "disabled": [{ type: core_1.Input },],
  817. "displayValue": [{ type: core_1.Input },],
  818. "dropDownButtonTemplate": [{ type: core_1.Input },],
  819. "elementAttr": [{ type: core_1.Input },],
  820. "focusStateEnabled": [{ type: core_1.Input },],
  821. "grouped": [{ type: core_1.Input },],
  822. "groupTemplate": [{ type: core_1.Input },],
  823. "height": [{ type: core_1.Input },],
  824. "hint": [{ type: core_1.Input },],
  825. "hoverStateEnabled": [{ type: core_1.Input },],
  826. "inputAttr": [{ type: core_1.Input },],
  827. "isValid": [{ type: core_1.Input },],
  828. "items": [{ type: core_1.Input },],
  829. "itemTemplate": [{ type: core_1.Input },],
  830. "maxItemCount": [{ type: core_1.Input },],
  831. "maxLength": [{ type: core_1.Input },],
  832. "minSearchLength": [{ type: core_1.Input },],
  833. "name": [{ type: core_1.Input },],
  834. "opened": [{ type: core_1.Input },],
  835. "openOnFieldClick": [{ type: core_1.Input },],
  836. "placeholder": [{ type: core_1.Input },],
  837. "readOnly": [{ type: core_1.Input },],
  838. "rtlEnabled": [{ type: core_1.Input },],
  839. "searchExpr": [{ type: core_1.Input },],
  840. "searchMode": [{ type: core_1.Input },],
  841. "searchTimeout": [{ type: core_1.Input },],
  842. "selectedItem": [{ type: core_1.Input },],
  843. "showClearButton": [{ type: core_1.Input },],
  844. "showDropDownButton": [{ type: core_1.Input },],
  845. "spellcheck": [{ type: core_1.Input },],
  846. "stylingMode": [{ type: core_1.Input },],
  847. "tabIndex": [{ type: core_1.Input },],
  848. "text": [{ type: core_1.Input },],
  849. "validationError": [{ type: core_1.Input },],
  850. "validationMessageMode": [{ type: core_1.Input },],
  851. "value": [{ type: core_1.Input },],
  852. "valueChangeEvent": [{ type: core_1.Input },],
  853. "valueExpr": [{ type: core_1.Input },],
  854. "visible": [{ type: core_1.Input },],
  855. "width": [{ type: core_1.Input },],
  856. "onChange": [{ type: core_1.Output },],
  857. "onClosed": [{ type: core_1.Output },],
  858. "onContentReady": [{ type: core_1.Output },],
  859. "onCopy": [{ type: core_1.Output },],
  860. "onCut": [{ type: core_1.Output },],
  861. "onDisposing": [{ type: core_1.Output },],
  862. "onEnterKey": [{ type: core_1.Output },],
  863. "onFocusIn": [{ type: core_1.Output },],
  864. "onFocusOut": [{ type: core_1.Output },],
  865. "onInitialized": [{ type: core_1.Output },],
  866. "onInput": [{ type: core_1.Output },],
  867. "onItemClick": [{ type: core_1.Output },],
  868. "onKeyDown": [{ type: core_1.Output },],
  869. "onKeyPress": [{ type: core_1.Output },],
  870. "onKeyUp": [{ type: core_1.Output },],
  871. "onOpened": [{ type: core_1.Output },],
  872. "onOptionChanged": [{ type: core_1.Output },],
  873. "onPaste": [{ type: core_1.Output },],
  874. "onSelectionChanged": [{ type: core_1.Output },],
  875. "onValueChanged": [{ type: core_1.Output },],
  876. "accessKeyChange": [{ type: core_1.Output },],
  877. "activeStateEnabledChange": [{ type: core_1.Output },],
  878. "buttonsChange": [{ type: core_1.Output },],
  879. "dataSourceChange": [{ type: core_1.Output },],
  880. "deferRenderingChange": [{ type: core_1.Output },],
  881. "disabledChange": [{ type: core_1.Output },],
  882. "displayValueChange": [{ type: core_1.Output },],
  883. "dropDownButtonTemplateChange": [{ type: core_1.Output },],
  884. "elementAttrChange": [{ type: core_1.Output },],
  885. "focusStateEnabledChange": [{ type: core_1.Output },],
  886. "groupedChange": [{ type: core_1.Output },],
  887. "groupTemplateChange": [{ type: core_1.Output },],
  888. "heightChange": [{ type: core_1.Output },],
  889. "hintChange": [{ type: core_1.Output },],
  890. "hoverStateEnabledChange": [{ type: core_1.Output },],
  891. "inputAttrChange": [{ type: core_1.Output },],
  892. "isValidChange": [{ type: core_1.Output },],
  893. "itemsChange": [{ type: core_1.Output },],
  894. "itemTemplateChange": [{ type: core_1.Output },],
  895. "maxItemCountChange": [{ type: core_1.Output },],
  896. "maxLengthChange": [{ type: core_1.Output },],
  897. "minSearchLengthChange": [{ type: core_1.Output },],
  898. "nameChange": [{ type: core_1.Output },],
  899. "openedChange": [{ type: core_1.Output },],
  900. "openOnFieldClickChange": [{ type: core_1.Output },],
  901. "placeholderChange": [{ type: core_1.Output },],
  902. "readOnlyChange": [{ type: core_1.Output },],
  903. "rtlEnabledChange": [{ type: core_1.Output },],
  904. "searchExprChange": [{ type: core_1.Output },],
  905. "searchModeChange": [{ type: core_1.Output },],
  906. "searchTimeoutChange": [{ type: core_1.Output },],
  907. "selectedItemChange": [{ type: core_1.Output },],
  908. "showClearButtonChange": [{ type: core_1.Output },],
  909. "showDropDownButtonChange": [{ type: core_1.Output },],
  910. "spellcheckChange": [{ type: core_1.Output },],
  911. "stylingModeChange": [{ type: core_1.Output },],
  912. "tabIndexChange": [{ type: core_1.Output },],
  913. "textChange": [{ type: core_1.Output },],
  914. "validationErrorChange": [{ type: core_1.Output },],
  915. "validationMessageModeChange": [{ type: core_1.Output },],
  916. "valueChange": [{ type: core_1.Output },],
  917. "valueChangeEventChange": [{ type: core_1.Output },],
  918. "valueExprChange": [{ type: core_1.Output },],
  919. "visibleChange": [{ type: core_1.Output },],
  920. "widthChange": [{ type: core_1.Output },],
  921. "onBlur": [{ type: core_1.Output },],
  922. "change": [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },],
  923. "touched": [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },],
  924. "buttonsChildren": [{ type: core_1.ContentChildren, args: [button_dxi_2.DxiButtonComponent,] },],
  925. "itemsChildren": [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },],
  926. };
  927. return DxAutocompleteComponent;
  928. }(component_1.DxComponent));
  929. exports.DxAutocompleteComponent = DxAutocompleteComponent;
  930. var DxAutocompleteModule = (function () {
  931. function DxAutocompleteModule() {
  932. }
  933. DxAutocompleteModule.decorators = [
  934. { type: core_1.NgModule, args: [{
  935. imports: [
  936. button_dxi_1.DxiButtonModule,
  937. options_1.DxoOptionsModule,
  938. item_dxi_1.DxiItemModule,
  939. integration_1.DxIntegrationModule,
  940. template_1.DxTemplateModule,
  941. platform_browser_1.BrowserTransferStateModule
  942. ],
  943. declarations: [
  944. DxAutocompleteComponent
  945. ],
  946. exports: [
  947. DxAutocompleteComponent,
  948. button_dxi_1.DxiButtonModule,
  949. options_1.DxoOptionsModule,
  950. item_dxi_1.DxiItemModule,
  951. template_1.DxTemplateModule
  952. ]
  953. },] },
  954. ];
  955. return DxAutocompleteModule;
  956. }());
  957. exports.DxAutocompleteModule = DxAutocompleteModule;
  958. //# sourceMappingURL=autocomplete.js.map