select-box.js 40 KB

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