button.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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 button_1 = require("devextreme/ui/button");
  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. /**
  36. * The Button widget is a simple button that performs specified commands when a user clicks it.
  37. */
  38. var DxButtonComponent = (function (_super) {
  39. __extends(DxButtonComponent, _super);
  40. function DxButtonComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost, transferState, platformId) {
  41. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  42. _this._createEventEmitters([
  43. { subscribe: 'click', emit: 'onClick' },
  44. { subscribe: 'contentReady', emit: 'onContentReady' },
  45. { subscribe: 'disposing', emit: 'onDisposing' },
  46. { subscribe: 'initialized', emit: 'onInitialized' },
  47. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  48. { emit: 'accessKeyChange' },
  49. { emit: 'activeStateEnabledChange' },
  50. { emit: 'disabledChange' },
  51. { emit: 'elementAttrChange' },
  52. { emit: 'focusStateEnabledChange' },
  53. { emit: 'heightChange' },
  54. { emit: 'hintChange' },
  55. { emit: 'hoverStateEnabledChange' },
  56. { emit: 'iconChange' },
  57. { emit: 'rtlEnabledChange' },
  58. { emit: 'stylingModeChange' },
  59. { emit: 'tabIndexChange' },
  60. { emit: 'templateChange' },
  61. { emit: 'textChange' },
  62. { emit: 'typeChange' },
  63. { emit: 'useSubmitBehaviorChange' },
  64. { emit: 'validationGroupChange' },
  65. { emit: 'visibleChange' },
  66. { emit: 'widthChange' }
  67. ]);
  68. optionHost.setHost(_this);
  69. return _this;
  70. }
  71. Object.defineProperty(DxButtonComponent.prototype, "accessKey", {
  72. get: /**
  73. * Specifies the shortcut key that sets focus on the widget.
  74. */
  75. function () {
  76. return this._getOption('accessKey');
  77. },
  78. set: function (value) {
  79. this._setOption('accessKey', value);
  80. },
  81. enumerable: true,
  82. configurable: true
  83. });
  84. Object.defineProperty(DxButtonComponent.prototype, "activeStateEnabled", {
  85. get: /**
  86. * A Boolean value specifying whether or not the widget changes its state when interacting with a user.
  87. */
  88. function () {
  89. return this._getOption('activeStateEnabled');
  90. },
  91. set: function (value) {
  92. this._setOption('activeStateEnabled', value);
  93. },
  94. enumerable: true,
  95. configurable: true
  96. });
  97. Object.defineProperty(DxButtonComponent.prototype, "disabled", {
  98. get: /**
  99. * Specifies whether the widget responds to user interaction.
  100. */
  101. function () {
  102. return this._getOption('disabled');
  103. },
  104. set: function (value) {
  105. this._setOption('disabled', value);
  106. },
  107. enumerable: true,
  108. configurable: true
  109. });
  110. Object.defineProperty(DxButtonComponent.prototype, "elementAttr", {
  111. get: /**
  112. * Specifies the attributes to be attached to the widget's root element.
  113. */
  114. function () {
  115. return this._getOption('elementAttr');
  116. },
  117. set: function (value) {
  118. this._setOption('elementAttr', value);
  119. },
  120. enumerable: true,
  121. configurable: true
  122. });
  123. Object.defineProperty(DxButtonComponent.prototype, "focusStateEnabled", {
  124. get: /**
  125. * Specifies whether the widget can be focused using keyboard navigation.
  126. */
  127. function () {
  128. return this._getOption('focusStateEnabled');
  129. },
  130. set: function (value) {
  131. this._setOption('focusStateEnabled', value);
  132. },
  133. enumerable: true,
  134. configurable: true
  135. });
  136. Object.defineProperty(DxButtonComponent.prototype, "height", {
  137. get: /**
  138. * Specifies the widget's height.
  139. */
  140. function () {
  141. return this._getOption('height');
  142. },
  143. set: function (value) {
  144. this._setOption('height', value);
  145. },
  146. enumerable: true,
  147. configurable: true
  148. });
  149. Object.defineProperty(DxButtonComponent.prototype, "hint", {
  150. get: /**
  151. * Specifies text for a hint that appears when a user pauses on the widget.
  152. */
  153. function () {
  154. return this._getOption('hint');
  155. },
  156. set: function (value) {
  157. this._setOption('hint', value);
  158. },
  159. enumerable: true,
  160. configurable: true
  161. });
  162. Object.defineProperty(DxButtonComponent.prototype, "hoverStateEnabled", {
  163. get: /**
  164. * Specifies whether the widget changes its state when a user pauses on it.
  165. */
  166. function () {
  167. return this._getOption('hoverStateEnabled');
  168. },
  169. set: function (value) {
  170. this._setOption('hoverStateEnabled', value);
  171. },
  172. enumerable: true,
  173. configurable: true
  174. });
  175. Object.defineProperty(DxButtonComponent.prototype, "icon", {
  176. get: /**
  177. * Specifies the icon to be displayed on the button.
  178. */
  179. function () {
  180. return this._getOption('icon');
  181. },
  182. set: function (value) {
  183. this._setOption('icon', value);
  184. },
  185. enumerable: true,
  186. configurable: true
  187. });
  188. Object.defineProperty(DxButtonComponent.prototype, "rtlEnabled", {
  189. get: /**
  190. * Switches the widget to a right-to-left representation.
  191. */
  192. function () {
  193. return this._getOption('rtlEnabled');
  194. },
  195. set: function (value) {
  196. this._setOption('rtlEnabled', value);
  197. },
  198. enumerable: true,
  199. configurable: true
  200. });
  201. Object.defineProperty(DxButtonComponent.prototype, "stylingMode", {
  202. get: /**
  203. * Specifies how the button is styled.
  204. */
  205. function () {
  206. return this._getOption('stylingMode');
  207. },
  208. set: function (value) {
  209. this._setOption('stylingMode', value);
  210. },
  211. enumerable: true,
  212. configurable: true
  213. });
  214. Object.defineProperty(DxButtonComponent.prototype, "tabIndex", {
  215. get: /**
  216. * Specifies the number of the element when the Tab key is used for navigating.
  217. */
  218. function () {
  219. return this._getOption('tabIndex');
  220. },
  221. set: function (value) {
  222. this._setOption('tabIndex', value);
  223. },
  224. enumerable: true,
  225. configurable: true
  226. });
  227. Object.defineProperty(DxButtonComponent.prototype, "template", {
  228. get: /**
  229. * Specifies a custom template for the Button widget.
  230. */
  231. function () {
  232. return this._getOption('template');
  233. },
  234. set: function (value) {
  235. this._setOption('template', value);
  236. },
  237. enumerable: true,
  238. configurable: true
  239. });
  240. Object.defineProperty(DxButtonComponent.prototype, "text", {
  241. get: /**
  242. * The text displayed on the button.
  243. */
  244. function () {
  245. return this._getOption('text');
  246. },
  247. set: function (value) {
  248. this._setOption('text', value);
  249. },
  250. enumerable: true,
  251. configurable: true
  252. });
  253. Object.defineProperty(DxButtonComponent.prototype, "type", {
  254. get: /**
  255. * Specifies the button type.
  256. */
  257. function () {
  258. return this._getOption('type');
  259. },
  260. set: function (value) {
  261. this._setOption('type', value);
  262. },
  263. enumerable: true,
  264. configurable: true
  265. });
  266. Object.defineProperty(DxButtonComponent.prototype, "useSubmitBehavior", {
  267. get: /**
  268. * Specifies whether or not the button must submit an HTML form.
  269. */
  270. function () {
  271. return this._getOption('useSubmitBehavior');
  272. },
  273. set: function (value) {
  274. this._setOption('useSubmitBehavior', value);
  275. },
  276. enumerable: true,
  277. configurable: true
  278. });
  279. Object.defineProperty(DxButtonComponent.prototype, "validationGroup", {
  280. get: /**
  281. * Specifies the name of the validation group to be accessed in the click event handler.
  282. */
  283. function () {
  284. return this._getOption('validationGroup');
  285. },
  286. set: function (value) {
  287. this._setOption('validationGroup', value);
  288. },
  289. enumerable: true,
  290. configurable: true
  291. });
  292. Object.defineProperty(DxButtonComponent.prototype, "visible", {
  293. get: /**
  294. * Specifies whether the widget is visible.
  295. */
  296. function () {
  297. return this._getOption('visible');
  298. },
  299. set: function (value) {
  300. this._setOption('visible', value);
  301. },
  302. enumerable: true,
  303. configurable: true
  304. });
  305. Object.defineProperty(DxButtonComponent.prototype, "width", {
  306. get: /**
  307. * Specifies the widget's width.
  308. */
  309. function () {
  310. return this._getOption('width');
  311. },
  312. set: function (value) {
  313. this._setOption('width', value);
  314. },
  315. enumerable: true,
  316. configurable: true
  317. });
  318. DxButtonComponent.prototype._createInstance = function (element, options) {
  319. return new button_1.default(element, options);
  320. };
  321. DxButtonComponent.prototype.ngOnDestroy = function () {
  322. this._destroyWidget();
  323. };
  324. DxButtonComponent.decorators = [
  325. { type: core_1.Component, args: [{
  326. selector: 'dx-button',
  327. template: '<ng-content></ng-content>',
  328. providers: [
  329. template_host_1.DxTemplateHost,
  330. watcher_helper_1.WatcherHelper,
  331. nested_option_1.NestedOptionHost
  332. ]
  333. },] },
  334. ];
  335. /** @nocollapse */
  336. DxButtonComponent.ctorParameters = function () { return [
  337. { type: core_1.ElementRef, },
  338. { type: core_1.NgZone, },
  339. { type: template_host_1.DxTemplateHost, },
  340. { type: watcher_helper_1.WatcherHelper, },
  341. { type: nested_option_1.NestedOptionHost, },
  342. { type: platform_browser_2.TransferState, },
  343. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  344. ]; };
  345. DxButtonComponent.propDecorators = {
  346. "accessKey": [{ type: core_1.Input },],
  347. "activeStateEnabled": [{ type: core_1.Input },],
  348. "disabled": [{ type: core_1.Input },],
  349. "elementAttr": [{ type: core_1.Input },],
  350. "focusStateEnabled": [{ type: core_1.Input },],
  351. "height": [{ type: core_1.Input },],
  352. "hint": [{ type: core_1.Input },],
  353. "hoverStateEnabled": [{ type: core_1.Input },],
  354. "icon": [{ type: core_1.Input },],
  355. "rtlEnabled": [{ type: core_1.Input },],
  356. "stylingMode": [{ type: core_1.Input },],
  357. "tabIndex": [{ type: core_1.Input },],
  358. "template": [{ type: core_1.Input },],
  359. "text": [{ type: core_1.Input },],
  360. "type": [{ type: core_1.Input },],
  361. "useSubmitBehavior": [{ type: core_1.Input },],
  362. "validationGroup": [{ type: core_1.Input },],
  363. "visible": [{ type: core_1.Input },],
  364. "width": [{ type: core_1.Input },],
  365. "onClick": [{ type: core_1.Output },],
  366. "onContentReady": [{ type: core_1.Output },],
  367. "onDisposing": [{ type: core_1.Output },],
  368. "onInitialized": [{ type: core_1.Output },],
  369. "onOptionChanged": [{ type: core_1.Output },],
  370. "accessKeyChange": [{ type: core_1.Output },],
  371. "activeStateEnabledChange": [{ type: core_1.Output },],
  372. "disabledChange": [{ type: core_1.Output },],
  373. "elementAttrChange": [{ type: core_1.Output },],
  374. "focusStateEnabledChange": [{ type: core_1.Output },],
  375. "heightChange": [{ type: core_1.Output },],
  376. "hintChange": [{ type: core_1.Output },],
  377. "hoverStateEnabledChange": [{ type: core_1.Output },],
  378. "iconChange": [{ type: core_1.Output },],
  379. "rtlEnabledChange": [{ type: core_1.Output },],
  380. "stylingModeChange": [{ type: core_1.Output },],
  381. "tabIndexChange": [{ type: core_1.Output },],
  382. "templateChange": [{ type: core_1.Output },],
  383. "textChange": [{ type: core_1.Output },],
  384. "typeChange": [{ type: core_1.Output },],
  385. "useSubmitBehaviorChange": [{ type: core_1.Output },],
  386. "validationGroupChange": [{ type: core_1.Output },],
  387. "visibleChange": [{ type: core_1.Output },],
  388. "widthChange": [{ type: core_1.Output },],
  389. };
  390. return DxButtonComponent;
  391. }(component_1.DxComponent));
  392. exports.DxButtonComponent = DxButtonComponent;
  393. var DxButtonModule = (function () {
  394. function DxButtonModule() {
  395. }
  396. DxButtonModule.decorators = [
  397. { type: core_1.NgModule, args: [{
  398. imports: [
  399. integration_1.DxIntegrationModule,
  400. template_1.DxTemplateModule,
  401. platform_browser_1.BrowserTransferStateModule
  402. ],
  403. declarations: [
  404. DxButtonComponent
  405. ],
  406. exports: [
  407. DxButtonComponent,
  408. template_1.DxTemplateModule
  409. ]
  410. },] },
  411. ];
  412. return DxButtonModule;
  413. }());
  414. exports.DxButtonModule = DxButtonModule;
  415. //# sourceMappingURL=button.js.map