box.js 14 KB

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