responsive-box.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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 responsive_box_1 = require("devextreme/ui/responsive_box");
  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 col_dxi_1 = require("./nested/col-dxi");
  37. var item_dxi_1 = require("./nested/item-dxi");
  38. var location_dxi_1 = require("./nested/location-dxi");
  39. var row_dxi_1 = require("./nested/row-dxi");
  40. var col_dxi_2 = require("./nested/col-dxi");
  41. var item_dxi_2 = require("./nested/item-dxi");
  42. var row_dxi_2 = require("./nested/row-dxi");
  43. /**
  44. * The ResponsiveBox widget allows you to create an application or a website with a layout adapted to different screen sizes.
  45. */
  46. var DxResponsiveBoxComponent = (function (_super) {
  47. __extends(DxResponsiveBoxComponent, _super);
  48. function DxResponsiveBoxComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost, transferState, platformId) {
  49. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  50. _this._watcherHelper = _watcherHelper;
  51. _this._idh = _idh;
  52. _this._createEventEmitters([
  53. { subscribe: 'contentReady', emit: 'onContentReady' },
  54. { subscribe: 'disposing', emit: 'onDisposing' },
  55. { subscribe: 'initialized', emit: 'onInitialized' },
  56. { subscribe: 'itemClick', emit: 'onItemClick' },
  57. { subscribe: 'itemContextMenu', emit: 'onItemContextMenu' },
  58. { subscribe: 'itemHold', emit: 'onItemHold' },
  59. { subscribe: 'itemRendered', emit: 'onItemRendered' },
  60. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  61. { emit: 'colsChange' },
  62. { emit: 'dataSourceChange' },
  63. { emit: 'disabledChange' },
  64. { emit: 'elementAttrChange' },
  65. { emit: 'heightChange' },
  66. { emit: 'hoverStateEnabledChange' },
  67. { emit: 'itemHoldTimeoutChange' },
  68. { emit: 'itemsChange' },
  69. { emit: 'itemTemplateChange' },
  70. { emit: 'rowsChange' },
  71. { emit: 'rtlEnabledChange' },
  72. { emit: 'screenByWidthChange' },
  73. { emit: 'singleColumnScreenChange' },
  74. { emit: 'visibleChange' },
  75. { emit: 'widthChange' }
  76. ]);
  77. _this._idh.setHost(_this);
  78. optionHost.setHost(_this);
  79. return _this;
  80. }
  81. Object.defineProperty(DxResponsiveBoxComponent.prototype, "cols", {
  82. get: /**
  83. * Specifies the collection of columns for the grid used to position layout elements.
  84. */
  85. function () {
  86. return this._getOption('cols');
  87. },
  88. set: function (value) {
  89. this._setOption('cols', value);
  90. },
  91. enumerable: true,
  92. configurable: true
  93. });
  94. Object.defineProperty(DxResponsiveBoxComponent.prototype, "dataSource", {
  95. get: /**
  96. * Binds the widget to data.
  97. */
  98. function () {
  99. return this._getOption('dataSource');
  100. },
  101. set: function (value) {
  102. this._setOption('dataSource', value);
  103. },
  104. enumerable: true,
  105. configurable: true
  106. });
  107. Object.defineProperty(DxResponsiveBoxComponent.prototype, "disabled", {
  108. get: /**
  109. * Specifies whether the widget responds to user interaction.
  110. */
  111. function () {
  112. return this._getOption('disabled');
  113. },
  114. set: function (value) {
  115. this._setOption('disabled', value);
  116. },
  117. enumerable: true,
  118. configurable: true
  119. });
  120. Object.defineProperty(DxResponsiveBoxComponent.prototype, "elementAttr", {
  121. get: /**
  122. * Specifies the attributes to be attached to the widget's root element.
  123. */
  124. function () {
  125. return this._getOption('elementAttr');
  126. },
  127. set: function (value) {
  128. this._setOption('elementAttr', value);
  129. },
  130. enumerable: true,
  131. configurable: true
  132. });
  133. Object.defineProperty(DxResponsiveBoxComponent.prototype, "height", {
  134. get: /**
  135. * Specifies the widget's height.
  136. */
  137. function () {
  138. return this._getOption('height');
  139. },
  140. set: function (value) {
  141. this._setOption('height', value);
  142. },
  143. enumerable: true,
  144. configurable: true
  145. });
  146. Object.defineProperty(DxResponsiveBoxComponent.prototype, "hoverStateEnabled", {
  147. get: /**
  148. * Specifies whether the widget changes its state when a user pauses on it.
  149. */
  150. function () {
  151. return this._getOption('hoverStateEnabled');
  152. },
  153. set: function (value) {
  154. this._setOption('hoverStateEnabled', value);
  155. },
  156. enumerable: true,
  157. configurable: true
  158. });
  159. Object.defineProperty(DxResponsiveBoxComponent.prototype, "itemHoldTimeout", {
  160. get: /**
  161. * The time period in milliseconds before the onItemHold event is raised.
  162. */
  163. function () {
  164. return this._getOption('itemHoldTimeout');
  165. },
  166. set: function (value) {
  167. this._setOption('itemHoldTimeout', value);
  168. },
  169. enumerable: true,
  170. configurable: true
  171. });
  172. Object.defineProperty(DxResponsiveBoxComponent.prototype, "items", {
  173. get: /**
  174. * An array of items displayed by the widget.
  175. */
  176. function () {
  177. return this._getOption('items');
  178. },
  179. set: function (value) {
  180. this._setOption('items', value);
  181. },
  182. enumerable: true,
  183. configurable: true
  184. });
  185. Object.defineProperty(DxResponsiveBoxComponent.prototype, "itemTemplate", {
  186. get: /**
  187. * Specifies a custom template for items.
  188. */
  189. function () {
  190. return this._getOption('itemTemplate');
  191. },
  192. set: function (value) {
  193. this._setOption('itemTemplate', value);
  194. },
  195. enumerable: true,
  196. configurable: true
  197. });
  198. Object.defineProperty(DxResponsiveBoxComponent.prototype, "rows", {
  199. get: /**
  200. * Specifies the collection of rows for the grid used to position layout elements.
  201. */
  202. function () {
  203. return this._getOption('rows');
  204. },
  205. set: function (value) {
  206. this._setOption('rows', value);
  207. },
  208. enumerable: true,
  209. configurable: true
  210. });
  211. Object.defineProperty(DxResponsiveBoxComponent.prototype, "rtlEnabled", {
  212. get: /**
  213. * Switches the widget to a right-to-left representation.
  214. */
  215. function () {
  216. return this._getOption('rtlEnabled');
  217. },
  218. set: function (value) {
  219. this._setOption('rtlEnabled', value);
  220. },
  221. enumerable: true,
  222. configurable: true
  223. });
  224. Object.defineProperty(DxResponsiveBoxComponent.prototype, "screenByWidth", {
  225. get: /**
  226. * Specifies the function returning the size qualifier depending on the screen's width.
  227. */
  228. function () {
  229. return this._getOption('screenByWidth');
  230. },
  231. set: function (value) {
  232. this._setOption('screenByWidth', value);
  233. },
  234. enumerable: true,
  235. configurable: true
  236. });
  237. Object.defineProperty(DxResponsiveBoxComponent.prototype, "singleColumnScreen", {
  238. get: /**
  239. * Specifies on which screens all layout elements should be arranged in a single column. Accepts a single or several size qualifiers separated by a space.
  240. */
  241. function () {
  242. return this._getOption('singleColumnScreen');
  243. },
  244. set: function (value) {
  245. this._setOption('singleColumnScreen', value);
  246. },
  247. enumerable: true,
  248. configurable: true
  249. });
  250. Object.defineProperty(DxResponsiveBoxComponent.prototype, "visible", {
  251. get: /**
  252. * Specifies whether the widget is visible.
  253. */
  254. function () {
  255. return this._getOption('visible');
  256. },
  257. set: function (value) {
  258. this._setOption('visible', value);
  259. },
  260. enumerable: true,
  261. configurable: true
  262. });
  263. Object.defineProperty(DxResponsiveBoxComponent.prototype, "width", {
  264. get: /**
  265. * Specifies the widget's width.
  266. */
  267. function () {
  268. return this._getOption('width');
  269. },
  270. set: function (value) {
  271. this._setOption('width', value);
  272. },
  273. enumerable: true,
  274. configurable: true
  275. });
  276. Object.defineProperty(DxResponsiveBoxComponent.prototype, "colsChildren", {
  277. get: function () {
  278. return this._getOption('cols');
  279. },
  280. set: function (value) {
  281. this.setChildren('cols', value);
  282. },
  283. enumerable: true,
  284. configurable: true
  285. });
  286. Object.defineProperty(DxResponsiveBoxComponent.prototype, "itemsChildren", {
  287. get: function () {
  288. return this._getOption('items');
  289. },
  290. set: function (value) {
  291. this.setChildren('items', value);
  292. },
  293. enumerable: true,
  294. configurable: true
  295. });
  296. Object.defineProperty(DxResponsiveBoxComponent.prototype, "rowsChildren", {
  297. get: function () {
  298. return this._getOption('rows');
  299. },
  300. set: function (value) {
  301. this.setChildren('rows', value);
  302. },
  303. enumerable: true,
  304. configurable: true
  305. });
  306. DxResponsiveBoxComponent.prototype._createInstance = function (element, options) {
  307. return new responsive_box_1.default(element, options);
  308. };
  309. DxResponsiveBoxComponent.prototype.ngOnDestroy = function () {
  310. this._destroyWidget();
  311. };
  312. DxResponsiveBoxComponent.prototype.ngOnChanges = function (changes) {
  313. _super.prototype.ngOnChanges.call(this, changes);
  314. this.setupChanges('cols', changes);
  315. this.setupChanges('dataSource', changes);
  316. this.setupChanges('items', changes);
  317. this.setupChanges('rows', changes);
  318. };
  319. DxResponsiveBoxComponent.prototype.setupChanges = function (prop, changes) {
  320. if (!(prop in this._optionsToUpdate)) {
  321. this._idh.setup(prop, changes);
  322. }
  323. };
  324. DxResponsiveBoxComponent.prototype.ngDoCheck = function () {
  325. this._idh.doCheck('cols');
  326. this._idh.doCheck('dataSource');
  327. this._idh.doCheck('items');
  328. this._idh.doCheck('rows');
  329. this._watcherHelper.checkWatchers();
  330. _super.prototype.ngDoCheck.call(this);
  331. _super.prototype.clearChangedOptions.call(this);
  332. };
  333. DxResponsiveBoxComponent.prototype._setOption = function (name, value) {
  334. var isSetup = this._idh.setupSingle(name, value);
  335. var isChanged = this._idh.getChanges(name, value) !== null;
  336. if (isSetup || isChanged) {
  337. _super.prototype._setOption.call(this, name, value);
  338. }
  339. };
  340. DxResponsiveBoxComponent.decorators = [
  341. { type: core_1.Component, args: [{
  342. selector: 'dx-responsive-box',
  343. template: '',
  344. providers: [
  345. template_host_1.DxTemplateHost,
  346. watcher_helper_1.WatcherHelper,
  347. nested_option_1.NestedOptionHost,
  348. iterable_differ_helper_1.IterableDifferHelper
  349. ]
  350. },] },
  351. ];
  352. /** @nocollapse */
  353. DxResponsiveBoxComponent.ctorParameters = function () { return [
  354. { type: core_1.ElementRef, },
  355. { type: core_1.NgZone, },
  356. { type: template_host_1.DxTemplateHost, },
  357. { type: watcher_helper_1.WatcherHelper, },
  358. { type: iterable_differ_helper_1.IterableDifferHelper, },
  359. { type: nested_option_1.NestedOptionHost, },
  360. { type: platform_browser_2.TransferState, },
  361. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  362. ]; };
  363. DxResponsiveBoxComponent.propDecorators = {
  364. "cols": [{ type: core_1.Input },],
  365. "dataSource": [{ type: core_1.Input },],
  366. "disabled": [{ type: core_1.Input },],
  367. "elementAttr": [{ type: core_1.Input },],
  368. "height": [{ type: core_1.Input },],
  369. "hoverStateEnabled": [{ type: core_1.Input },],
  370. "itemHoldTimeout": [{ type: core_1.Input },],
  371. "items": [{ type: core_1.Input },],
  372. "itemTemplate": [{ type: core_1.Input },],
  373. "rows": [{ type: core_1.Input },],
  374. "rtlEnabled": [{ type: core_1.Input },],
  375. "screenByWidth": [{ type: core_1.Input },],
  376. "singleColumnScreen": [{ type: core_1.Input },],
  377. "visible": [{ type: core_1.Input },],
  378. "width": [{ type: core_1.Input },],
  379. "onContentReady": [{ type: core_1.Output },],
  380. "onDisposing": [{ type: core_1.Output },],
  381. "onInitialized": [{ type: core_1.Output },],
  382. "onItemClick": [{ type: core_1.Output },],
  383. "onItemContextMenu": [{ type: core_1.Output },],
  384. "onItemHold": [{ type: core_1.Output },],
  385. "onItemRendered": [{ type: core_1.Output },],
  386. "onOptionChanged": [{ type: core_1.Output },],
  387. "colsChange": [{ type: core_1.Output },],
  388. "dataSourceChange": [{ type: core_1.Output },],
  389. "disabledChange": [{ type: core_1.Output },],
  390. "elementAttrChange": [{ type: core_1.Output },],
  391. "heightChange": [{ type: core_1.Output },],
  392. "hoverStateEnabledChange": [{ type: core_1.Output },],
  393. "itemHoldTimeoutChange": [{ type: core_1.Output },],
  394. "itemsChange": [{ type: core_1.Output },],
  395. "itemTemplateChange": [{ type: core_1.Output },],
  396. "rowsChange": [{ type: core_1.Output },],
  397. "rtlEnabledChange": [{ type: core_1.Output },],
  398. "screenByWidthChange": [{ type: core_1.Output },],
  399. "singleColumnScreenChange": [{ type: core_1.Output },],
  400. "visibleChange": [{ type: core_1.Output },],
  401. "widthChange": [{ type: core_1.Output },],
  402. "colsChildren": [{ type: core_1.ContentChildren, args: [col_dxi_2.DxiColComponent,] },],
  403. "itemsChildren": [{ type: core_1.ContentChildren, args: [item_dxi_2.DxiItemComponent,] },],
  404. "rowsChildren": [{ type: core_1.ContentChildren, args: [row_dxi_2.DxiRowComponent,] },],
  405. };
  406. return DxResponsiveBoxComponent;
  407. }(component_1.DxComponent));
  408. exports.DxResponsiveBoxComponent = DxResponsiveBoxComponent;
  409. var DxResponsiveBoxModule = (function () {
  410. function DxResponsiveBoxModule() {
  411. }
  412. DxResponsiveBoxModule.decorators = [
  413. { type: core_1.NgModule, args: [{
  414. imports: [
  415. col_dxi_1.DxiColModule,
  416. item_dxi_1.DxiItemModule,
  417. location_dxi_1.DxiLocationModule,
  418. row_dxi_1.DxiRowModule,
  419. integration_1.DxIntegrationModule,
  420. template_1.DxTemplateModule,
  421. platform_browser_1.BrowserTransferStateModule
  422. ],
  423. declarations: [
  424. DxResponsiveBoxComponent
  425. ],
  426. exports: [
  427. DxResponsiveBoxComponent,
  428. col_dxi_1.DxiColModule,
  429. item_dxi_1.DxiItemModule,
  430. location_dxi_1.DxiLocationModule,
  431. row_dxi_1.DxiRowModule,
  432. template_1.DxTemplateModule
  433. ]
  434. },] },
  435. ];
  436. return DxResponsiveBoxModule;
  437. }());
  438. exports.DxResponsiveBoxModule = DxResponsiveBoxModule;
  439. //# sourceMappingURL=responsive-box.js.map