progress-bar.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 progress_bar_1 = require("devextreme/ui/progress_bar");
  29. var forms_1 = require("@angular/forms");
  30. var component_1 = require("../core/component");
  31. var template_host_1 = require("../core/template-host");
  32. var integration_1 = require("../core/integration");
  33. var template_1 = require("../core/template");
  34. var nested_option_1 = require("../core/nested-option");
  35. var watcher_helper_1 = require("../core/watcher-helper");
  36. var CUSTOM_VALUE_ACCESSOR_PROVIDER = {
  37. provide: forms_1.NG_VALUE_ACCESSOR,
  38. useExisting: core_1.forwardRef(function () { return DxProgressBarComponent; }),
  39. multi: true
  40. };
  41. /**
  42. * The ProgressBar is a widget that shows current progress.
  43. */
  44. var DxProgressBarComponent = (function (_super) {
  45. __extends(DxProgressBarComponent, _super);
  46. function DxProgressBarComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost, transferState, platformId) {
  47. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  48. _this.touched = function (_) { };
  49. _this._createEventEmitters([
  50. { subscribe: 'complete', emit: 'onComplete' },
  51. { subscribe: 'contentReady', emit: 'onContentReady' },
  52. { subscribe: 'disposing', emit: 'onDisposing' },
  53. { subscribe: 'initialized', emit: 'onInitialized' },
  54. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  55. { subscribe: 'valueChanged', emit: 'onValueChanged' },
  56. { emit: 'disabledChange' },
  57. { emit: 'elementAttrChange' },
  58. { emit: 'heightChange' },
  59. { emit: 'hintChange' },
  60. { emit: 'hoverStateEnabledChange' },
  61. { emit: 'isValidChange' },
  62. { emit: 'maxChange' },
  63. { emit: 'minChange' },
  64. { emit: 'readOnlyChange' },
  65. { emit: 'rtlEnabledChange' },
  66. { emit: 'showStatusChange' },
  67. { emit: 'statusFormatChange' },
  68. { emit: 'validationErrorChange' },
  69. { emit: 'validationMessageModeChange' },
  70. { emit: 'valueChange' },
  71. { emit: 'visibleChange' },
  72. { emit: 'widthChange' },
  73. { emit: 'onBlur' }
  74. ]);
  75. optionHost.setHost(_this);
  76. return _this;
  77. }
  78. Object.defineProperty(DxProgressBarComponent.prototype, "disabled", {
  79. get: /**
  80. * Specifies whether the widget responds to user interaction.
  81. */
  82. function () {
  83. return this._getOption('disabled');
  84. },
  85. set: function (value) {
  86. this._setOption('disabled', value);
  87. },
  88. enumerable: true,
  89. configurable: true
  90. });
  91. Object.defineProperty(DxProgressBarComponent.prototype, "elementAttr", {
  92. get: /**
  93. * Specifies the attributes to be attached to the widget's root element.
  94. */
  95. function () {
  96. return this._getOption('elementAttr');
  97. },
  98. set: function (value) {
  99. this._setOption('elementAttr', value);
  100. },
  101. enumerable: true,
  102. configurable: true
  103. });
  104. Object.defineProperty(DxProgressBarComponent.prototype, "height", {
  105. get: /**
  106. * Specifies the widget's height.
  107. */
  108. function () {
  109. return this._getOption('height');
  110. },
  111. set: function (value) {
  112. this._setOption('height', value);
  113. },
  114. enumerable: true,
  115. configurable: true
  116. });
  117. Object.defineProperty(DxProgressBarComponent.prototype, "hint", {
  118. get: /**
  119. * Specifies text for a hint that appears when a user pauses on the widget.
  120. */
  121. function () {
  122. return this._getOption('hint');
  123. },
  124. set: function (value) {
  125. this._setOption('hint', value);
  126. },
  127. enumerable: true,
  128. configurable: true
  129. });
  130. Object.defineProperty(DxProgressBarComponent.prototype, "hoverStateEnabled", {
  131. get: /**
  132. * Specifies whether the widget changes its state when a user pauses on it.
  133. */
  134. function () {
  135. return this._getOption('hoverStateEnabled');
  136. },
  137. set: function (value) {
  138. this._setOption('hoverStateEnabled', value);
  139. },
  140. enumerable: true,
  141. configurable: true
  142. });
  143. Object.defineProperty(DxProgressBarComponent.prototype, "isValid", {
  144. get: /**
  145. * Specifies whether the editor's value is valid.
  146. */
  147. function () {
  148. return this._getOption('isValid');
  149. },
  150. set: function (value) {
  151. this._setOption('isValid', value);
  152. },
  153. enumerable: true,
  154. configurable: true
  155. });
  156. Object.defineProperty(DxProgressBarComponent.prototype, "max", {
  157. get: /**
  158. * The maximum value the widget can accept.
  159. */
  160. function () {
  161. return this._getOption('max');
  162. },
  163. set: function (value) {
  164. this._setOption('max', value);
  165. },
  166. enumerable: true,
  167. configurable: true
  168. });
  169. Object.defineProperty(DxProgressBarComponent.prototype, "min", {
  170. get: /**
  171. * The minimum value the widget can accept.
  172. */
  173. function () {
  174. return this._getOption('min');
  175. },
  176. set: function (value) {
  177. this._setOption('min', value);
  178. },
  179. enumerable: true,
  180. configurable: true
  181. });
  182. Object.defineProperty(DxProgressBarComponent.prototype, "readOnly", {
  183. get: /**
  184. * Specifies whether the editor is read-only.
  185. */
  186. function () {
  187. return this._getOption('readOnly');
  188. },
  189. set: function (value) {
  190. this._setOption('readOnly', value);
  191. },
  192. enumerable: true,
  193. configurable: true
  194. });
  195. Object.defineProperty(DxProgressBarComponent.prototype, "rtlEnabled", {
  196. get: /**
  197. * Switches the widget to a right-to-left representation.
  198. */
  199. function () {
  200. return this._getOption('rtlEnabled');
  201. },
  202. set: function (value) {
  203. this._setOption('rtlEnabled', value);
  204. },
  205. enumerable: true,
  206. configurable: true
  207. });
  208. Object.defineProperty(DxProgressBarComponent.prototype, "showStatus", {
  209. get: /**
  210. * Specifies whether or not the widget displays a progress status.
  211. */
  212. function () {
  213. return this._getOption('showStatus');
  214. },
  215. set: function (value) {
  216. this._setOption('showStatus', value);
  217. },
  218. enumerable: true,
  219. configurable: true
  220. });
  221. Object.defineProperty(DxProgressBarComponent.prototype, "statusFormat", {
  222. get: /**
  223. * Specifies a format for the progress status.
  224. */
  225. function () {
  226. return this._getOption('statusFormat');
  227. },
  228. set: function (value) {
  229. this._setOption('statusFormat', value);
  230. },
  231. enumerable: true,
  232. configurable: true
  233. });
  234. Object.defineProperty(DxProgressBarComponent.prototype, "validationError", {
  235. get: /**
  236. * Specifies information on the validation error when using a custom validation engine. Should be changed at runtime along with the isValid option.
  237. */
  238. function () {
  239. return this._getOption('validationError');
  240. },
  241. set: function (value) {
  242. this._setOption('validationError', value);
  243. },
  244. enumerable: true,
  245. configurable: true
  246. });
  247. Object.defineProperty(DxProgressBarComponent.prototype, "validationMessageMode", {
  248. get: /**
  249. * Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed.
  250. */
  251. function () {
  252. return this._getOption('validationMessageMode');
  253. },
  254. set: function (value) {
  255. this._setOption('validationMessageMode', value);
  256. },
  257. enumerable: true,
  258. configurable: true
  259. });
  260. Object.defineProperty(DxProgressBarComponent.prototype, "value", {
  261. get: /**
  262. * The current widget value.
  263. */
  264. function () {
  265. return this._getOption('value');
  266. },
  267. set: function (value) {
  268. this._setOption('value', value);
  269. },
  270. enumerable: true,
  271. configurable: true
  272. });
  273. Object.defineProperty(DxProgressBarComponent.prototype, "visible", {
  274. get: /**
  275. * Specifies whether the widget is visible.
  276. */
  277. function () {
  278. return this._getOption('visible');
  279. },
  280. set: function (value) {
  281. this._setOption('visible', value);
  282. },
  283. enumerable: true,
  284. configurable: true
  285. });
  286. Object.defineProperty(DxProgressBarComponent.prototype, "width", {
  287. get: /**
  288. * Specifies the widget's width.
  289. */
  290. function () {
  291. return this._getOption('width');
  292. },
  293. set: function (value) {
  294. this._setOption('width', value);
  295. },
  296. enumerable: true,
  297. configurable: true
  298. });
  299. DxProgressBarComponent.prototype.change = function (_) { };
  300. DxProgressBarComponent.prototype._createInstance = function (element, options) {
  301. return new progress_bar_1.default(element, options);
  302. };
  303. DxProgressBarComponent.prototype.writeValue = function (value) {
  304. this.eventHelper.lockedValueChangeEvent = true;
  305. this.value = value;
  306. this.eventHelper.lockedValueChangeEvent = false;
  307. };
  308. DxProgressBarComponent.prototype.setDisabledState = function (isDisabled) {
  309. this.disabled = isDisabled;
  310. };
  311. DxProgressBarComponent.prototype.registerOnChange = function (fn) { this.change = fn; };
  312. DxProgressBarComponent.prototype.registerOnTouched = function (fn) { this.touched = fn; };
  313. DxProgressBarComponent.prototype._createWidget = function (element) {
  314. var _this = this;
  315. _super.prototype._createWidget.call(this, element);
  316. this.instance.on('focusOut', function (e) {
  317. _this.eventHelper.fireNgEvent('onBlur', [e]);
  318. });
  319. };
  320. DxProgressBarComponent.prototype.ngOnDestroy = function () {
  321. this._destroyWidget();
  322. };
  323. DxProgressBarComponent.decorators = [
  324. { type: core_1.Component, args: [{
  325. selector: 'dx-progress-bar',
  326. template: '',
  327. providers: [
  328. template_host_1.DxTemplateHost,
  329. watcher_helper_1.WatcherHelper,
  330. CUSTOM_VALUE_ACCESSOR_PROVIDER,
  331. nested_option_1.NestedOptionHost
  332. ]
  333. },] },
  334. ];
  335. /** @nocollapse */
  336. DxProgressBarComponent.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. DxProgressBarComponent.propDecorators = {
  346. "disabled": [{ type: core_1.Input },],
  347. "elementAttr": [{ type: core_1.Input },],
  348. "height": [{ type: core_1.Input },],
  349. "hint": [{ type: core_1.Input },],
  350. "hoverStateEnabled": [{ type: core_1.Input },],
  351. "isValid": [{ type: core_1.Input },],
  352. "max": [{ type: core_1.Input },],
  353. "min": [{ type: core_1.Input },],
  354. "readOnly": [{ type: core_1.Input },],
  355. "rtlEnabled": [{ type: core_1.Input },],
  356. "showStatus": [{ type: core_1.Input },],
  357. "statusFormat": [{ type: core_1.Input },],
  358. "validationError": [{ type: core_1.Input },],
  359. "validationMessageMode": [{ type: core_1.Input },],
  360. "value": [{ type: core_1.Input },],
  361. "visible": [{ type: core_1.Input },],
  362. "width": [{ type: core_1.Input },],
  363. "onComplete": [{ type: core_1.Output },],
  364. "onContentReady": [{ type: core_1.Output },],
  365. "onDisposing": [{ type: core_1.Output },],
  366. "onInitialized": [{ type: core_1.Output },],
  367. "onOptionChanged": [{ type: core_1.Output },],
  368. "onValueChanged": [{ type: core_1.Output },],
  369. "disabledChange": [{ type: core_1.Output },],
  370. "elementAttrChange": [{ type: core_1.Output },],
  371. "heightChange": [{ type: core_1.Output },],
  372. "hintChange": [{ type: core_1.Output },],
  373. "hoverStateEnabledChange": [{ type: core_1.Output },],
  374. "isValidChange": [{ type: core_1.Output },],
  375. "maxChange": [{ type: core_1.Output },],
  376. "minChange": [{ type: core_1.Output },],
  377. "readOnlyChange": [{ type: core_1.Output },],
  378. "rtlEnabledChange": [{ type: core_1.Output },],
  379. "showStatusChange": [{ type: core_1.Output },],
  380. "statusFormatChange": [{ type: core_1.Output },],
  381. "validationErrorChange": [{ type: core_1.Output },],
  382. "validationMessageModeChange": [{ type: core_1.Output },],
  383. "valueChange": [{ type: core_1.Output },],
  384. "visibleChange": [{ type: core_1.Output },],
  385. "widthChange": [{ type: core_1.Output },],
  386. "onBlur": [{ type: core_1.Output },],
  387. "change": [{ type: core_1.HostListener, args: ['valueChange', ['$event'],] },],
  388. "touched": [{ type: core_1.HostListener, args: ['onBlur', ['$event'],] },],
  389. };
  390. return DxProgressBarComponent;
  391. }(component_1.DxComponent));
  392. exports.DxProgressBarComponent = DxProgressBarComponent;
  393. var DxProgressBarModule = (function () {
  394. function DxProgressBarModule() {
  395. }
  396. DxProgressBarModule.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. DxProgressBarComponent
  405. ],
  406. exports: [
  407. DxProgressBarComponent,
  408. template_1.DxTemplateModule
  409. ]
  410. },] },
  411. ];
  412. return DxProgressBarModule;
  413. }());
  414. exports.DxProgressBarModule = DxProgressBarModule;
  415. //# sourceMappingURL=progress-bar.js.map