slide-out.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  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 slide_out_1 = require("devextreme/ui/slide_out");
  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 SlideOut widget is a classic slide-out menu paired with a view. An end user opens the menu by swiping away the view.
  40. */
  41. var DxSlideOutComponent = (function (_super) {
  42. __extends(DxSlideOutComponent, _super);
  43. function DxSlideOutComponent(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: 'menuGroupRendered', emit: 'onMenuGroupRendered' },
  56. { subscribe: 'menuItemRendered', emit: 'onMenuItemRendered' },
  57. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  58. { subscribe: 'selectionChanged', emit: 'onSelectionChanged' },
  59. { emit: 'activeStateEnabledChange' },
  60. { emit: 'contentTemplateChange' },
  61. { emit: 'dataSourceChange' },
  62. { emit: 'disabledChange' },
  63. { emit: 'elementAttrChange' },
  64. { emit: 'heightChange' },
  65. { emit: 'hintChange' },
  66. { emit: 'hoverStateEnabledChange' },
  67. { emit: 'itemHoldTimeoutChange' },
  68. { emit: 'itemsChange' },
  69. { emit: 'itemTemplateChange' },
  70. { emit: 'menuGroupedChange' },
  71. { emit: 'menuGroupTemplateChange' },
  72. { emit: 'menuItemTemplateChange' },
  73. { emit: 'menuPositionChange' },
  74. { emit: 'menuVisibleChange' },
  75. { emit: 'noDataTextChange' },
  76. { emit: 'rtlEnabledChange' },
  77. { emit: 'selectedIndexChange' },
  78. { emit: 'selectedItemChange' },
  79. { emit: 'swipeEnabledChange' },
  80. { emit: 'visibleChange' },
  81. { emit: 'widthChange' }
  82. ]);
  83. _this._idh.setHost(_this);
  84. optionHost.setHost(_this);
  85. return _this;
  86. }
  87. Object.defineProperty(DxSlideOutComponent.prototype, "activeStateEnabled", {
  88. get: /**
  89. * A Boolean value specifying whether or not the widget changes its state when interacting with a user.
  90. */
  91. function () {
  92. return this._getOption('activeStateEnabled');
  93. },
  94. set: function (value) {
  95. this._setOption('activeStateEnabled', value);
  96. },
  97. enumerable: true,
  98. configurable: true
  99. });
  100. Object.defineProperty(DxSlideOutComponent.prototype, "contentTemplate", {
  101. get: /**
  102. * Specifies a custom template for the widget content. Rendered only once - when the widget is created.
  103. */
  104. function () {
  105. return this._getOption('contentTemplate');
  106. },
  107. set: function (value) {
  108. this._setOption('contentTemplate', value);
  109. },
  110. enumerable: true,
  111. configurable: true
  112. });
  113. Object.defineProperty(DxSlideOutComponent.prototype, "dataSource", {
  114. get: /**
  115. * Binds the widget to data.
  116. */
  117. function () {
  118. return this._getOption('dataSource');
  119. },
  120. set: function (value) {
  121. this._setOption('dataSource', value);
  122. },
  123. enumerable: true,
  124. configurable: true
  125. });
  126. Object.defineProperty(DxSlideOutComponent.prototype, "disabled", {
  127. get: /**
  128. * Specifies whether the widget responds to user interaction.
  129. */
  130. function () {
  131. return this._getOption('disabled');
  132. },
  133. set: function (value) {
  134. this._setOption('disabled', value);
  135. },
  136. enumerable: true,
  137. configurable: true
  138. });
  139. Object.defineProperty(DxSlideOutComponent.prototype, "elementAttr", {
  140. get: /**
  141. * Specifies the attributes to be attached to the widget's root element.
  142. */
  143. function () {
  144. return this._getOption('elementAttr');
  145. },
  146. set: function (value) {
  147. this._setOption('elementAttr', value);
  148. },
  149. enumerable: true,
  150. configurable: true
  151. });
  152. Object.defineProperty(DxSlideOutComponent.prototype, "height", {
  153. get: /**
  154. * Specifies the widget's height.
  155. */
  156. function () {
  157. return this._getOption('height');
  158. },
  159. set: function (value) {
  160. this._setOption('height', value);
  161. },
  162. enumerable: true,
  163. configurable: true
  164. });
  165. Object.defineProperty(DxSlideOutComponent.prototype, "hint", {
  166. get: /**
  167. * Specifies text for a hint that appears when a user pauses on the widget.
  168. */
  169. function () {
  170. return this._getOption('hint');
  171. },
  172. set: function (value) {
  173. this._setOption('hint', value);
  174. },
  175. enumerable: true,
  176. configurable: true
  177. });
  178. Object.defineProperty(DxSlideOutComponent.prototype, "hoverStateEnabled", {
  179. get: /**
  180. * Specifies whether the widget changes its state when a user pauses on it.
  181. */
  182. function () {
  183. return this._getOption('hoverStateEnabled');
  184. },
  185. set: function (value) {
  186. this._setOption('hoverStateEnabled', value);
  187. },
  188. enumerable: true,
  189. configurable: true
  190. });
  191. Object.defineProperty(DxSlideOutComponent.prototype, "itemHoldTimeout", {
  192. get: /**
  193. * The time period in milliseconds before the onItemHold event is raised.
  194. */
  195. function () {
  196. return this._getOption('itemHoldTimeout');
  197. },
  198. set: function (value) {
  199. this._setOption('itemHoldTimeout', value);
  200. },
  201. enumerable: true,
  202. configurable: true
  203. });
  204. Object.defineProperty(DxSlideOutComponent.prototype, "items", {
  205. get: /**
  206. * An array of items displayed by the widget.
  207. */
  208. function () {
  209. return this._getOption('items');
  210. },
  211. set: function (value) {
  212. this._setOption('items', value);
  213. },
  214. enumerable: true,
  215. configurable: true
  216. });
  217. Object.defineProperty(DxSlideOutComponent.prototype, "itemTemplate", {
  218. get: /**
  219. * Specifies a custom template for items.
  220. */
  221. function () {
  222. return this._getOption('itemTemplate');
  223. },
  224. set: function (value) {
  225. this._setOption('itemTemplate', value);
  226. },
  227. enumerable: true,
  228. configurable: true
  229. });
  230. Object.defineProperty(DxSlideOutComponent.prototype, "menuGrouped", {
  231. get: /**
  232. * A Boolean value specifying whether or not to display a grouped menu.
  233. */
  234. function () {
  235. return this._getOption('menuGrouped');
  236. },
  237. set: function (value) {
  238. this._setOption('menuGrouped', value);
  239. },
  240. enumerable: true,
  241. configurable: true
  242. });
  243. Object.defineProperty(DxSlideOutComponent.prototype, "menuGroupTemplate", {
  244. get: /**
  245. * Specifies a custom template for group captions.
  246. */
  247. function () {
  248. return this._getOption('menuGroupTemplate');
  249. },
  250. set: function (value) {
  251. this._setOption('menuGroupTemplate', value);
  252. },
  253. enumerable: true,
  254. configurable: true
  255. });
  256. Object.defineProperty(DxSlideOutComponent.prototype, "menuItemTemplate", {
  257. get: /**
  258. * Specifies a custom template for menu items.
  259. */
  260. function () {
  261. return this._getOption('menuItemTemplate');
  262. },
  263. set: function (value) {
  264. this._setOption('menuItemTemplate', value);
  265. },
  266. enumerable: true,
  267. configurable: true
  268. });
  269. Object.defineProperty(DxSlideOutComponent.prototype, "menuPosition", {
  270. get: /**
  271. * Specifies the current menu position.
  272. */
  273. function () {
  274. return this._getOption('menuPosition');
  275. },
  276. set: function (value) {
  277. this._setOption('menuPosition', value);
  278. },
  279. enumerable: true,
  280. configurable: true
  281. });
  282. Object.defineProperty(DxSlideOutComponent.prototype, "menuVisible", {
  283. get: /**
  284. * Specifies whether or not the slide-out menu is displayed.
  285. */
  286. function () {
  287. return this._getOption('menuVisible');
  288. },
  289. set: function (value) {
  290. this._setOption('menuVisible', value);
  291. },
  292. enumerable: true,
  293. configurable: true
  294. });
  295. Object.defineProperty(DxSlideOutComponent.prototype, "noDataText", {
  296. get: /**
  297. * The text or HTML markup displayed by the widget if the item collection is empty.
  298. */
  299. function () {
  300. return this._getOption('noDataText');
  301. },
  302. set: function (value) {
  303. this._setOption('noDataText', value);
  304. },
  305. enumerable: true,
  306. configurable: true
  307. });
  308. Object.defineProperty(DxSlideOutComponent.prototype, "rtlEnabled", {
  309. get: /**
  310. * Switches the widget to a right-to-left representation.
  311. */
  312. function () {
  313. return this._getOption('rtlEnabled');
  314. },
  315. set: function (value) {
  316. this._setOption('rtlEnabled', value);
  317. },
  318. enumerable: true,
  319. configurable: true
  320. });
  321. Object.defineProperty(DxSlideOutComponent.prototype, "selectedIndex", {
  322. get: /**
  323. * The index number of the currently selected item.
  324. */
  325. function () {
  326. return this._getOption('selectedIndex');
  327. },
  328. set: function (value) {
  329. this._setOption('selectedIndex', value);
  330. },
  331. enumerable: true,
  332. configurable: true
  333. });
  334. Object.defineProperty(DxSlideOutComponent.prototype, "selectedItem", {
  335. get: /**
  336. * The selected item object.
  337. */
  338. function () {
  339. return this._getOption('selectedItem');
  340. },
  341. set: function (value) {
  342. this._setOption('selectedItem', value);
  343. },
  344. enumerable: true,
  345. configurable: true
  346. });
  347. Object.defineProperty(DxSlideOutComponent.prototype, "swipeEnabled", {
  348. get: /**
  349. * Indicates whether the menu can be shown/hidden by swiping the widget's main panel.
  350. */
  351. function () {
  352. return this._getOption('swipeEnabled');
  353. },
  354. set: function (value) {
  355. this._setOption('swipeEnabled', value);
  356. },
  357. enumerable: true,
  358. configurable: true
  359. });
  360. Object.defineProperty(DxSlideOutComponent.prototype, "visible", {
  361. get: /**
  362. * Specifies whether the widget is visible.
  363. */
  364. function () {
  365. return this._getOption('visible');
  366. },
  367. set: function (value) {
  368. this._setOption('visible', value);
  369. },
  370. enumerable: true,
  371. configurable: true
  372. });
  373. Object.defineProperty(DxSlideOutComponent.prototype, "width", {
  374. get: /**
  375. * Specifies the widget's width.
  376. */
  377. function () {
  378. return this._getOption('width');
  379. },
  380. set: function (value) {
  381. this._setOption('width', value);
  382. },
  383. enumerable: true,
  384. configurable: true
  385. });
  386. Object.defineProperty(DxSlideOutComponent.prototype, "itemsChildren", {
  387. get: function () {
  388. return this._getOption('items');
  389. },
  390. set: function (value) {
  391. this.setChildren('items', value);
  392. },
  393. enumerable: true,
  394. configurable: true
  395. });
  396. DxSlideOutComponent.prototype._createInstance = function (element, options) {
  397. return new slide_out_1.default(element, options);
  398. };
  399. DxSlideOutComponent.prototype.ngOnDestroy = function () {
  400. this._destroyWidget();
  401. };
  402. DxSlideOutComponent.prototype.ngOnChanges = function (changes) {
  403. _super.prototype.ngOnChanges.call(this, changes);
  404. this.setupChanges('dataSource', changes);
  405. this.setupChanges('items', changes);
  406. };
  407. DxSlideOutComponent.prototype.setupChanges = function (prop, changes) {
  408. if (!(prop in this._optionsToUpdate)) {
  409. this._idh.setup(prop, changes);
  410. }
  411. };
  412. DxSlideOutComponent.prototype.ngDoCheck = function () {
  413. this._idh.doCheck('dataSource');
  414. this._idh.doCheck('items');
  415. this._watcherHelper.checkWatchers();
  416. _super.prototype.ngDoCheck.call(this);
  417. _super.prototype.clearChangedOptions.call(this);
  418. };
  419. DxSlideOutComponent.prototype._setOption = function (name, value) {
  420. var isSetup = this._idh.setupSingle(name, value);
  421. var isChanged = this._idh.getChanges(name, value) !== null;
  422. if (isSetup || isChanged) {
  423. _super.prototype._setOption.call(this, name, value);
  424. }
  425. };
  426. DxSlideOutComponent.decorators = [
  427. { type: core_1.Component, args: [{
  428. selector: 'dx-slide-out',
  429. template: '',
  430. providers: [
  431. template_host_1.DxTemplateHost,
  432. watcher_helper_1.WatcherHelper,
  433. nested_option_1.NestedOptionHost,
  434. iterable_differ_helper_1.IterableDifferHelper
  435. ]
  436. },] },
  437. ];
  438. /** @nocollapse */
  439. DxSlideOutComponent.ctorParameters = function () { return [
  440. { type: core_1.ElementRef, },
  441. { type: core_1.NgZone, },
  442. { type: template_host_1.DxTemplateHost, },
  443. { type: watcher_helper_1.WatcherHelper, },
  444. { type: iterable_differ_helper_1.IterableDifferHelper, },
  445. { type: nested_option_1.NestedOptionHost, },
  446. { type: platform_browser_2.TransferState, },
  447. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  448. ]; };
  449. DxSlideOutComponent.propDecorators = {
  450. "activeStateEnabled": [{ type: core_1.Input },],
  451. "contentTemplate": [{ type: core_1.Input },],
  452. "dataSource": [{ type: core_1.Input },],
  453. "disabled": [{ type: core_1.Input },],
  454. "elementAttr": [{ type: core_1.Input },],
  455. "height": [{ type: core_1.Input },],
  456. "hint": [{ type: core_1.Input },],
  457. "hoverStateEnabled": [{ type: core_1.Input },],
  458. "itemHoldTimeout": [{ type: core_1.Input },],
  459. "items": [{ type: core_1.Input },],
  460. "itemTemplate": [{ type: core_1.Input },],
  461. "menuGrouped": [{ type: core_1.Input },],
  462. "menuGroupTemplate": [{ type: core_1.Input },],
  463. "menuItemTemplate": [{ type: core_1.Input },],
  464. "menuPosition": [{ type: core_1.Input },],
  465. "menuVisible": [{ type: core_1.Input },],
  466. "noDataText": [{ type: core_1.Input },],
  467. "rtlEnabled": [{ type: core_1.Input },],
  468. "selectedIndex": [{ type: core_1.Input },],
  469. "selectedItem": [{ type: core_1.Input },],
  470. "swipeEnabled": [{ type: core_1.Input },],
  471. "visible": [{ type: core_1.Input },],
  472. "width": [{ type: core_1.Input },],
  473. "onContentReady": [{ type: core_1.Output },],
  474. "onDisposing": [{ type: core_1.Output },],
  475. "onInitialized": [{ type: core_1.Output },],
  476. "onItemClick": [{ type: core_1.Output },],
  477. "onItemContextMenu": [{ type: core_1.Output },],
  478. "onItemHold": [{ type: core_1.Output },],
  479. "onItemRendered": [{ type: core_1.Output },],
  480. "onMenuGroupRendered": [{ type: core_1.Output },],
  481. "onMenuItemRendered": [{ type: core_1.Output },],
  482. "onOptionChanged": [{ type: core_1.Output },],
  483. "onSelectionChanged": [{ type: core_1.Output },],
  484. "activeStateEnabledChange": [{ type: core_1.Output },],
  485. "contentTemplateChange": [{ type: core_1.Output },],
  486. "dataSourceChange": [{ type: core_1.Output },],
  487. "disabledChange": [{ type: core_1.Output },],
  488. "elementAttrChange": [{ type: core_1.Output },],
  489. "heightChange": [{ type: core_1.Output },],
  490. "hintChange": [{ type: core_1.Output },],
  491. "hoverStateEnabledChange": [{ type: core_1.Output },],
  492. "itemHoldTimeoutChange": [{ type: core_1.Output },],
  493. "itemsChange": [{ type: core_1.Output },],
  494. "itemTemplateChange": [{ type: core_1.Output },],
  495. "menuGroupedChange": [{ type: core_1.Output },],
  496. "menuGroupTemplateChange": [{ type: core_1.Output },],
  497. "menuItemTemplateChange": [{ type: core_1.Output },],
  498. "menuPositionChange": [{ type: core_1.Output },],
  499. "menuVisibleChange": [{ type: core_1.Output },],
  500. "noDataTextChange": [{ type: core_1.Output },],
  501. "rtlEnabledChange": [{ type: core_1.Output },],
  502. "selectedIndexChange": [{ type: core_1.Output },],
  503. "selectedItemChange": [{ type: core_1.Output },],
  504. "swipeEnabledChange": [{ type: core_1.Output },],
  505. "visibleChange": [{ type: core_1.Output },],
  506. "widthChange": [{ type: core_1.Output },],
  507. "itemsChildren": [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },],
  508. };
  509. return DxSlideOutComponent;
  510. }(component_1.DxComponent));
  511. exports.DxSlideOutComponent = DxSlideOutComponent;
  512. var DxSlideOutModule = (function () {
  513. function DxSlideOutModule() {
  514. }
  515. DxSlideOutModule.decorators = [
  516. { type: core_1.NgModule, args: [{
  517. imports: [
  518. item_dxi_1.DxiItemModule,
  519. integration_1.DxIntegrationModule,
  520. template_1.DxTemplateModule,
  521. platform_browser_1.BrowserTransferStateModule
  522. ],
  523. declarations: [
  524. DxSlideOutComponent
  525. ],
  526. exports: [
  527. DxSlideOutComponent,
  528. item_dxi_1.DxiItemModule,
  529. template_1.DxTemplateModule
  530. ]
  531. },] },
  532. ];
  533. return DxSlideOutModule;
  534. }());
  535. exports.DxSlideOutModule = DxSlideOutModule;
  536. //# sourceMappingURL=slide-out.js.map