tile-view.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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 tile_view_1 = require("devextreme/ui/tile_view");
  29. var component_1 = require("../core/component");
  30. var template_host_1 = require("../core/template-host");
  31. var integration_1 = require("../core/integration");
  32. var template_1 = require("../core/template");
  33. var nested_option_1 = require("../core/nested-option");
  34. var watcher_helper_1 = require("../core/watcher-helper");
  35. var iterable_differ_helper_1 = require("../core/iterable-differ-helper");
  36. var item_dxi_1 = require("./nested/item-dxi");
  37. var item_dxi_2 = require("./nested/item-dxi");
  38. /**
  39. * The TileView widget contains a collection of tiles. Tiles can store much more information than ordinary buttons, that is why they are very popular in apps designed for touch devices.
  40. */
  41. var DxTileViewComponent = (function (_super) {
  42. __extends(DxTileViewComponent, _super);
  43. function DxTileViewComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost, transferState, platformId) {
  44. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  45. _this._watcherHelper = _watcherHelper;
  46. _this._idh = _idh;
  47. _this._createEventEmitters([
  48. { subscribe: 'contentReady', emit: 'onContentReady' },
  49. { subscribe: 'disposing', emit: 'onDisposing' },
  50. { subscribe: 'initialized', emit: 'onInitialized' },
  51. { subscribe: 'itemClick', emit: 'onItemClick' },
  52. { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' },
  53. { subscribe: 'itemHold', emit: 'onItemHold' },
  54. { subscribe: 'itemRendered', emit: 'onItemRendered' },
  55. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  56. { emit: 'accessKeyChange' },
  57. { emit: 'activeStateEnabledChange' },
  58. { emit: 'baseItemHeightChange' },
  59. { emit: 'baseItemWidthChange' },
  60. { emit: 'dataSourceChange' },
  61. { emit: 'directionChange' },
  62. { emit: 'disabledChange' },
  63. { emit: 'elementAttrChange' },
  64. { emit: 'focusStateEnabledChange' },
  65. { emit: 'heightChange' },
  66. { emit: 'hintChange' },
  67. { emit: 'hoverStateEnabledChange' },
  68. { emit: 'itemHoldTimeoutChange' },
  69. { emit: 'itemMarginChange' },
  70. { emit: 'itemsChange' },
  71. { emit: 'itemTemplateChange' },
  72. { emit: 'noDataTextChange' },
  73. { emit: 'rtlEnabledChange' },
  74. { emit: 'showScrollbarChange' },
  75. { emit: 'tabIndexChange' },
  76. { emit: 'visibleChange' },
  77. { emit: 'widthChange' }
  78. ]);
  79. _this._idh.setHost(_this);
  80. optionHost.setHost(_this);
  81. return _this;
  82. }
  83. Object.defineProperty(DxTileViewComponent.prototype, "accessKey", {
  84. get: /**
  85. * Specifies the shortcut key that sets focus on the widget.
  86. */
  87. function () {
  88. return this._getOption('accessKey');
  89. },
  90. set: function (value) {
  91. this._setOption('accessKey', value);
  92. },
  93. enumerable: true,
  94. configurable: true
  95. });
  96. Object.defineProperty(DxTileViewComponent.prototype, "activeStateEnabled", {
  97. get: /**
  98. * A Boolean value specifying whether or not the widget changes its state when interacting with a user.
  99. */
  100. function () {
  101. return this._getOption('activeStateEnabled');
  102. },
  103. set: function (value) {
  104. this._setOption('activeStateEnabled', value);
  105. },
  106. enumerable: true,
  107. configurable: true
  108. });
  109. Object.defineProperty(DxTileViewComponent.prototype, "baseItemHeight", {
  110. get: /**
  111. * Specifies the height of the base tile view item.
  112. */
  113. function () {
  114. return this._getOption('baseItemHeight');
  115. },
  116. set: function (value) {
  117. this._setOption('baseItemHeight', value);
  118. },
  119. enumerable: true,
  120. configurable: true
  121. });
  122. Object.defineProperty(DxTileViewComponent.prototype, "baseItemWidth", {
  123. get: /**
  124. * Specifies the width of the base tile view item.
  125. */
  126. function () {
  127. return this._getOption('baseItemWidth');
  128. },
  129. set: function (value) {
  130. this._setOption('baseItemWidth', value);
  131. },
  132. enumerable: true,
  133. configurable: true
  134. });
  135. Object.defineProperty(DxTileViewComponent.prototype, "dataSource", {
  136. get: /**
  137. * Binds the widget to data.
  138. */
  139. function () {
  140. return this._getOption('dataSource');
  141. },
  142. set: function (value) {
  143. this._setOption('dataSource', value);
  144. },
  145. enumerable: true,
  146. configurable: true
  147. });
  148. Object.defineProperty(DxTileViewComponent.prototype, "direction", {
  149. get: /**
  150. * Specifies whether tiles are placed horizontally or vertically.
  151. */
  152. function () {
  153. return this._getOption('direction');
  154. },
  155. set: function (value) {
  156. this._setOption('direction', value);
  157. },
  158. enumerable: true,
  159. configurable: true
  160. });
  161. Object.defineProperty(DxTileViewComponent.prototype, "disabled", {
  162. get: /**
  163. * Specifies whether the widget responds to user interaction.
  164. */
  165. function () {
  166. return this._getOption('disabled');
  167. },
  168. set: function (value) {
  169. this._setOption('disabled', value);
  170. },
  171. enumerable: true,
  172. configurable: true
  173. });
  174. Object.defineProperty(DxTileViewComponent.prototype, "elementAttr", {
  175. get: /**
  176. * Specifies the attributes to be attached to the widget's root element.
  177. */
  178. function () {
  179. return this._getOption('elementAttr');
  180. },
  181. set: function (value) {
  182. this._setOption('elementAttr', value);
  183. },
  184. enumerable: true,
  185. configurable: true
  186. });
  187. Object.defineProperty(DxTileViewComponent.prototype, "focusStateEnabled", {
  188. get: /**
  189. * Specifies whether the widget can be focused using keyboard navigation.
  190. */
  191. function () {
  192. return this._getOption('focusStateEnabled');
  193. },
  194. set: function (value) {
  195. this._setOption('focusStateEnabled', value);
  196. },
  197. enumerable: true,
  198. configurable: true
  199. });
  200. Object.defineProperty(DxTileViewComponent.prototype, "height", {
  201. get: /**
  202. * Specifies the widget's height.
  203. */
  204. function () {
  205. return this._getOption('height');
  206. },
  207. set: function (value) {
  208. this._setOption('height', value);
  209. },
  210. enumerable: true,
  211. configurable: true
  212. });
  213. Object.defineProperty(DxTileViewComponent.prototype, "hint", {
  214. get: /**
  215. * Specifies text for a hint that appears when a user pauses on the widget.
  216. */
  217. function () {
  218. return this._getOption('hint');
  219. },
  220. set: function (value) {
  221. this._setOption('hint', value);
  222. },
  223. enumerable: true,
  224. configurable: true
  225. });
  226. Object.defineProperty(DxTileViewComponent.prototype, "hoverStateEnabled", {
  227. get: /**
  228. * Specifies whether the widget changes its state when a user pauses on it.
  229. */
  230. function () {
  231. return this._getOption('hoverStateEnabled');
  232. },
  233. set: function (value) {
  234. this._setOption('hoverStateEnabled', value);
  235. },
  236. enumerable: true,
  237. configurable: true
  238. });
  239. Object.defineProperty(DxTileViewComponent.prototype, "itemHoldTimeout", {
  240. get: /**
  241. * The time period in milliseconds before the onItemHold event is raised.
  242. */
  243. function () {
  244. return this._getOption('itemHoldTimeout');
  245. },
  246. set: function (value) {
  247. this._setOption('itemHoldTimeout', value);
  248. },
  249. enumerable: true,
  250. configurable: true
  251. });
  252. Object.defineProperty(DxTileViewComponent.prototype, "itemMargin", {
  253. get: /**
  254. * Specifies the distance in pixels between adjacent tiles.
  255. */
  256. function () {
  257. return this._getOption('itemMargin');
  258. },
  259. set: function (value) {
  260. this._setOption('itemMargin', value);
  261. },
  262. enumerable: true,
  263. configurable: true
  264. });
  265. Object.defineProperty(DxTileViewComponent.prototype, "items", {
  266. get: /**
  267. * An array of items displayed by the widget.
  268. */
  269. function () {
  270. return this._getOption('items');
  271. },
  272. set: function (value) {
  273. this._setOption('items', value);
  274. },
  275. enumerable: true,
  276. configurable: true
  277. });
  278. Object.defineProperty(DxTileViewComponent.prototype, "itemTemplate", {
  279. get: /**
  280. * Specifies a custom template for items.
  281. */
  282. function () {
  283. return this._getOption('itemTemplate');
  284. },
  285. set: function (value) {
  286. this._setOption('itemTemplate', value);
  287. },
  288. enumerable: true,
  289. configurable: true
  290. });
  291. Object.defineProperty(DxTileViewComponent.prototype, "noDataText", {
  292. get: /**
  293. * The text or HTML markup displayed by the widget if the item collection is empty.
  294. */
  295. function () {
  296. return this._getOption('noDataText');
  297. },
  298. set: function (value) {
  299. this._setOption('noDataText', value);
  300. },
  301. enumerable: true,
  302. configurable: true
  303. });
  304. Object.defineProperty(DxTileViewComponent.prototype, "rtlEnabled", {
  305. get: /**
  306. * Switches the widget to a right-to-left representation.
  307. */
  308. function () {
  309. return this._getOption('rtlEnabled');
  310. },
  311. set: function (value) {
  312. this._setOption('rtlEnabled', value);
  313. },
  314. enumerable: true,
  315. configurable: true
  316. });
  317. Object.defineProperty(DxTileViewComponent.prototype, "showScrollbar", {
  318. get: /**
  319. * A Boolean value specifying whether or not to display a scrollbar.
  320. */
  321. function () {
  322. return this._getOption('showScrollbar');
  323. },
  324. set: function (value) {
  325. this._setOption('showScrollbar', value);
  326. },
  327. enumerable: true,
  328. configurable: true
  329. });
  330. Object.defineProperty(DxTileViewComponent.prototype, "tabIndex", {
  331. get: /**
  332. * Specifies the number of the element when the Tab key is used for navigating.
  333. */
  334. function () {
  335. return this._getOption('tabIndex');
  336. },
  337. set: function (value) {
  338. this._setOption('tabIndex', value);
  339. },
  340. enumerable: true,
  341. configurable: true
  342. });
  343. Object.defineProperty(DxTileViewComponent.prototype, "visible", {
  344. get: /**
  345. * Specifies whether the widget is visible.
  346. */
  347. function () {
  348. return this._getOption('visible');
  349. },
  350. set: function (value) {
  351. this._setOption('visible', value);
  352. },
  353. enumerable: true,
  354. configurable: true
  355. });
  356. Object.defineProperty(DxTileViewComponent.prototype, "width", {
  357. get: /**
  358. * Specifies the widget's width.
  359. */
  360. function () {
  361. return this._getOption('width');
  362. },
  363. set: function (value) {
  364. this._setOption('width', value);
  365. },
  366. enumerable: true,
  367. configurable: true
  368. });
  369. Object.defineProperty(DxTileViewComponent.prototype, "itemsChildren", {
  370. get: function () {
  371. return this._getOption('items');
  372. },
  373. set: function (value) {
  374. this.setChildren('items', value);
  375. },
  376. enumerable: true,
  377. configurable: true
  378. });
  379. DxTileViewComponent.prototype._createInstance = function (element, options) {
  380. return new tile_view_1.default(element, options);
  381. };
  382. DxTileViewComponent.prototype.ngOnDestroy = function () {
  383. this._destroyWidget();
  384. };
  385. DxTileViewComponent.prototype.ngOnChanges = function (changes) {
  386. _super.prototype.ngOnChanges.call(this, changes);
  387. this.setupChanges('dataSource', changes);
  388. this.setupChanges('items', changes);
  389. };
  390. DxTileViewComponent.prototype.setupChanges = function (prop, changes) {
  391. if (!(prop in this._optionsToUpdate)) {
  392. this._idh.setup(prop, changes);
  393. }
  394. };
  395. DxTileViewComponent.prototype.ngDoCheck = function () {
  396. this._idh.doCheck('dataSource');
  397. this._idh.doCheck('items');
  398. this._watcherHelper.checkWatchers();
  399. _super.prototype.ngDoCheck.call(this);
  400. _super.prototype.clearChangedOptions.call(this);
  401. };
  402. DxTileViewComponent.prototype._setOption = function (name, value) {
  403. var isSetup = this._idh.setupSingle(name, value);
  404. var isChanged = this._idh.getChanges(name, value) !== null;
  405. if (isSetup || isChanged) {
  406. _super.prototype._setOption.call(this, name, value);
  407. }
  408. };
  409. DxTileViewComponent.decorators = [
  410. { type: core_1.Component, args: [{
  411. selector: 'dx-tile-view',
  412. template: '',
  413. providers: [
  414. template_host_1.DxTemplateHost,
  415. watcher_helper_1.WatcherHelper,
  416. nested_option_1.NestedOptionHost,
  417. iterable_differ_helper_1.IterableDifferHelper
  418. ]
  419. },] },
  420. ];
  421. /** @nocollapse */
  422. DxTileViewComponent.ctorParameters = function () { return [
  423. { type: core_1.ElementRef, },
  424. { type: core_1.NgZone, },
  425. { type: template_host_1.DxTemplateHost, },
  426. { type: watcher_helper_1.WatcherHelper, },
  427. { type: iterable_differ_helper_1.IterableDifferHelper, },
  428. { type: nested_option_1.NestedOptionHost, },
  429. { type: platform_browser_2.TransferState, },
  430. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  431. ]; };
  432. DxTileViewComponent.propDecorators = {
  433. "accessKey": [{ type: core_1.Input },],
  434. "activeStateEnabled": [{ type: core_1.Input },],
  435. "baseItemHeight": [{ type: core_1.Input },],
  436. "baseItemWidth": [{ type: core_1.Input },],
  437. "dataSource": [{ type: core_1.Input },],
  438. "direction": [{ type: core_1.Input },],
  439. "disabled": [{ type: core_1.Input },],
  440. "elementAttr": [{ type: core_1.Input },],
  441. "focusStateEnabled": [{ type: core_1.Input },],
  442. "height": [{ type: core_1.Input },],
  443. "hint": [{ type: core_1.Input },],
  444. "hoverStateEnabled": [{ type: core_1.Input },],
  445. "itemHoldTimeout": [{ type: core_1.Input },],
  446. "itemMargin": [{ type: core_1.Input },],
  447. "items": [{ type: core_1.Input },],
  448. "itemTemplate": [{ type: core_1.Input },],
  449. "noDataText": [{ type: core_1.Input },],
  450. "rtlEnabled": [{ type: core_1.Input },],
  451. "showScrollbar": [{ type: core_1.Input },],
  452. "tabIndex": [{ type: core_1.Input },],
  453. "visible": [{ type: core_1.Input },],
  454. "width": [{ type: core_1.Input },],
  455. "onContentReady": [{ type: core_1.Output },],
  456. "onDisposing": [{ type: core_1.Output },],
  457. "onInitialized": [{ type: core_1.Output },],
  458. "onItemClick": [{ type: core_1.Output },],
  459. "onItemContextMenu": [{ type: core_1.Output },],
  460. "onItemHold": [{ type: core_1.Output },],
  461. "onItemRendered": [{ type: core_1.Output },],
  462. "onOptionChanged": [{ type: core_1.Output },],
  463. "accessKeyChange": [{ type: core_1.Output },],
  464. "activeStateEnabledChange": [{ type: core_1.Output },],
  465. "baseItemHeightChange": [{ type: core_1.Output },],
  466. "baseItemWidthChange": [{ type: core_1.Output },],
  467. "dataSourceChange": [{ type: core_1.Output },],
  468. "directionChange": [{ type: core_1.Output },],
  469. "disabledChange": [{ type: core_1.Output },],
  470. "elementAttrChange": [{ type: core_1.Output },],
  471. "focusStateEnabledChange": [{ type: core_1.Output },],
  472. "heightChange": [{ type: core_1.Output },],
  473. "hintChange": [{ type: core_1.Output },],
  474. "hoverStateEnabledChange": [{ type: core_1.Output },],
  475. "itemHoldTimeoutChange": [{ type: core_1.Output },],
  476. "itemMarginChange": [{ type: core_1.Output },],
  477. "itemsChange": [{ type: core_1.Output },],
  478. "itemTemplateChange": [{ type: core_1.Output },],
  479. "noDataTextChange": [{ type: core_1.Output },],
  480. "rtlEnabledChange": [{ type: core_1.Output },],
  481. "showScrollbarChange": [{ type: core_1.Output },],
  482. "tabIndexChange": [{ type: core_1.Output },],
  483. "visibleChange": [{ type: core_1.Output },],
  484. "widthChange": [{ type: core_1.Output },],
  485. "itemsChildren": [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },],
  486. };
  487. return DxTileViewComponent;
  488. }(component_1.DxComponent));
  489. exports.DxTileViewComponent = DxTileViewComponent;
  490. var DxTileViewModule = (function () {
  491. function DxTileViewModule() {
  492. }
  493. DxTileViewModule.decorators = [
  494. { type: core_1.NgModule, args: [{
  495. imports: [
  496. item_dxi_1.DxiItemModule,
  497. integration_1.DxIntegrationModule,
  498. template_1.DxTemplateModule,
  499. platform_browser_1.BrowserTransferStateModule
  500. ],
  501. declarations: [
  502. DxTileViewComponent
  503. ],
  504. exports: [
  505. DxTileViewComponent,
  506. item_dxi_1.DxiItemModule,
  507. template_1.DxTemplateModule
  508. ]
  509. },] },
  510. ];
  511. return DxTileViewModule;
  512. }());
  513. exports.DxTileViewModule = DxTileViewModule;
  514. //# sourceMappingURL=tile-view.js.map