linear-gauge.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  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 linear_gauge_1 = require("devextreme/viz/linear_gauge");
  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 animation_1 = require("./nested/animation");
  37. var export_1 = require("./nested/export");
  38. var geometry_1 = require("./nested/geometry");
  39. var loading_indicator_1 = require("./nested/loading-indicator");
  40. var font_1 = require("./nested/font");
  41. var margin_1 = require("./nested/margin");
  42. var range_container_1 = require("./nested/range-container");
  43. var range_dxi_1 = require("./nested/range-dxi");
  44. var width_1 = require("./nested/width");
  45. var scale_1 = require("./nested/scale");
  46. var label_1 = require("./nested/label");
  47. var format_1 = require("./nested/format");
  48. var minor_tick_1 = require("./nested/minor-tick");
  49. var tick_1 = require("./nested/tick");
  50. var size_1 = require("./nested/size");
  51. var subvalue_indicator_1 = require("./nested/subvalue-indicator");
  52. var text_1 = require("./nested/text");
  53. var title_1 = require("./nested/title");
  54. var subtitle_1 = require("./nested/subtitle");
  55. var tooltip_1 = require("./nested/tooltip");
  56. var border_1 = require("./nested/border");
  57. var shadow_1 = require("./nested/shadow");
  58. var value_indicator_1 = require("./nested/value-indicator");
  59. /**
  60. * The LinearGauge is a widget that indicates values on a linear numeric scale.
  61. */
  62. var DxLinearGaugeComponent = (function (_super) {
  63. __extends(DxLinearGaugeComponent, _super);
  64. function DxLinearGaugeComponent(elementRef, ngZone, templateHost, _watcherHelper, _idh, optionHost, transferState, platformId) {
  65. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  66. _this._watcherHelper = _watcherHelper;
  67. _this._idh = _idh;
  68. _this._createEventEmitters([
  69. { subscribe: 'disposing', emit: 'onDisposing' },
  70. { subscribe: 'drawn', emit: 'onDrawn' },
  71. { subscribe: 'exported', emit: 'onExported' },
  72. { subscribe: 'exporting', emit: 'onExporting' },
  73. { subscribe: 'fileSaving', emit: 'onFileSaving' },
  74. { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' },
  75. { subscribe: 'initialized', emit: 'onInitialized' },
  76. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  77. { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' },
  78. { subscribe: 'tooltipShown', emit: 'onTooltipShown' },
  79. { emit: 'animationChange' },
  80. { emit: 'containerBackgroundColorChange' },
  81. { emit: 'disabledChange' },
  82. { emit: 'elementAttrChange' },
  83. { emit: 'exportChange' },
  84. { emit: 'geometryChange' },
  85. { emit: 'loadingIndicatorChange' },
  86. { emit: 'marginChange' },
  87. { emit: 'pathModifiedChange' },
  88. { emit: 'rangeContainerChange' },
  89. { emit: 'redrawOnResizeChange' },
  90. { emit: 'rtlEnabledChange' },
  91. { emit: 'scaleChange' },
  92. { emit: 'sizeChange' },
  93. { emit: 'subvalueIndicatorChange' },
  94. { emit: 'subvaluesChange' },
  95. { emit: 'themeChange' },
  96. { emit: 'titleChange' },
  97. { emit: 'tooltipChange' },
  98. { emit: 'valueChange' },
  99. { emit: 'valueIndicatorChange' }
  100. ]);
  101. _this._idh.setHost(_this);
  102. optionHost.setHost(_this);
  103. return _this;
  104. }
  105. Object.defineProperty(DxLinearGaugeComponent.prototype, "animation", {
  106. get: /**
  107. * Specifies animation options.
  108. */
  109. function () {
  110. return this._getOption('animation');
  111. },
  112. set: function (value) {
  113. this._setOption('animation', value);
  114. },
  115. enumerable: true,
  116. configurable: true
  117. });
  118. Object.defineProperty(DxLinearGaugeComponent.prototype, "containerBackgroundColor", {
  119. get: /**
  120. * Specifies the color of the parent page element.
  121. */
  122. function () {
  123. return this._getOption('containerBackgroundColor');
  124. },
  125. set: function (value) {
  126. this._setOption('containerBackgroundColor', value);
  127. },
  128. enumerable: true,
  129. configurable: true
  130. });
  131. Object.defineProperty(DxLinearGaugeComponent.prototype, "disabled", {
  132. get: /**
  133. * Specifies whether the widget responds to the user interaction.
  134. */
  135. function () {
  136. return this._getOption('disabled');
  137. },
  138. set: function (value) {
  139. this._setOption('disabled', value);
  140. },
  141. enumerable: true,
  142. configurable: true
  143. });
  144. Object.defineProperty(DxLinearGaugeComponent.prototype, "elementAttr", {
  145. get: /**
  146. * Specifies the attributes to be attached to the widget's root element.
  147. */
  148. function () {
  149. return this._getOption('elementAttr');
  150. },
  151. set: function (value) {
  152. this._setOption('elementAttr', value);
  153. },
  154. enumerable: true,
  155. configurable: true
  156. });
  157. Object.defineProperty(DxLinearGaugeComponent.prototype, "export", {
  158. get: /**
  159. * Configures the exporting and printing features.
  160. */
  161. function () {
  162. return this._getOption('export');
  163. },
  164. set: function (value) {
  165. this._setOption('export', value);
  166. },
  167. enumerable: true,
  168. configurable: true
  169. });
  170. Object.defineProperty(DxLinearGaugeComponent.prototype, "geometry", {
  171. get: /**
  172. * Specifies the options required to set the geometry of the LinearGauge widget.
  173. */
  174. function () {
  175. return this._getOption('geometry');
  176. },
  177. set: function (value) {
  178. this._setOption('geometry', value);
  179. },
  180. enumerable: true,
  181. configurable: true
  182. });
  183. Object.defineProperty(DxLinearGaugeComponent.prototype, "loadingIndicator", {
  184. get: /**
  185. * Configures the loading indicator.
  186. */
  187. function () {
  188. return this._getOption('loadingIndicator');
  189. },
  190. set: function (value) {
  191. this._setOption('loadingIndicator', value);
  192. },
  193. enumerable: true,
  194. configurable: true
  195. });
  196. Object.defineProperty(DxLinearGaugeComponent.prototype, "margin", {
  197. get: /**
  198. * Generates space around the widget.
  199. */
  200. function () {
  201. return this._getOption('margin');
  202. },
  203. set: function (value) {
  204. this._setOption('margin', value);
  205. },
  206. enumerable: true,
  207. configurable: true
  208. });
  209. Object.defineProperty(DxLinearGaugeComponent.prototype, "pathModified", {
  210. get: /**
  211. * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path.
  212. */
  213. function () {
  214. return this._getOption('pathModified');
  215. },
  216. set: function (value) {
  217. this._setOption('pathModified', value);
  218. },
  219. enumerable: true,
  220. configurable: true
  221. });
  222. Object.defineProperty(DxLinearGaugeComponent.prototype, "rangeContainer", {
  223. get: /**
  224. * Specifies gauge range container options.
  225. */
  226. function () {
  227. return this._getOption('rangeContainer');
  228. },
  229. set: function (value) {
  230. this._setOption('rangeContainer', value);
  231. },
  232. enumerable: true,
  233. configurable: true
  234. });
  235. Object.defineProperty(DxLinearGaugeComponent.prototype, "redrawOnResize", {
  236. get: /**
  237. * Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates.
  238. */
  239. function () {
  240. return this._getOption('redrawOnResize');
  241. },
  242. set: function (value) {
  243. this._setOption('redrawOnResize', value);
  244. },
  245. enumerable: true,
  246. configurable: true
  247. });
  248. Object.defineProperty(DxLinearGaugeComponent.prototype, "rtlEnabled", {
  249. get: /**
  250. * Switches the widget to a right-to-left representation.
  251. */
  252. function () {
  253. return this._getOption('rtlEnabled');
  254. },
  255. set: function (value) {
  256. this._setOption('rtlEnabled', value);
  257. },
  258. enumerable: true,
  259. configurable: true
  260. });
  261. Object.defineProperty(DxLinearGaugeComponent.prototype, "scale", {
  262. get: /**
  263. * Specifies the gauge's scale options.
  264. */
  265. function () {
  266. return this._getOption('scale');
  267. },
  268. set: function (value) {
  269. this._setOption('scale', value);
  270. },
  271. enumerable: true,
  272. configurable: true
  273. });
  274. Object.defineProperty(DxLinearGaugeComponent.prototype, "size", {
  275. get: /**
  276. * Specifies the widget's size in pixels.
  277. */
  278. function () {
  279. return this._getOption('size');
  280. },
  281. set: function (value) {
  282. this._setOption('size', value);
  283. },
  284. enumerable: true,
  285. configurable: true
  286. });
  287. Object.defineProperty(DxLinearGaugeComponent.prototype, "subvalueIndicator", {
  288. get: /**
  289. * Specifies the appearance options of subvalue indicators.
  290. */
  291. function () {
  292. return this._getOption('subvalueIndicator');
  293. },
  294. set: function (value) {
  295. this._setOption('subvalueIndicator', value);
  296. },
  297. enumerable: true,
  298. configurable: true
  299. });
  300. Object.defineProperty(DxLinearGaugeComponent.prototype, "subvalues", {
  301. get: /**
  302. * Specifies a set of subvalues to be designated by the subvalue indicators.
  303. */
  304. function () {
  305. return this._getOption('subvalues');
  306. },
  307. set: function (value) {
  308. this._setOption('subvalues', value);
  309. },
  310. enumerable: true,
  311. configurable: true
  312. });
  313. Object.defineProperty(DxLinearGaugeComponent.prototype, "theme", {
  314. get: /**
  315. * Sets the name of the theme the widget uses.
  316. */
  317. function () {
  318. return this._getOption('theme');
  319. },
  320. set: function (value) {
  321. this._setOption('theme', value);
  322. },
  323. enumerable: true,
  324. configurable: true
  325. });
  326. Object.defineProperty(DxLinearGaugeComponent.prototype, "title", {
  327. get: /**
  328. * Configures the widget's title.
  329. */
  330. function () {
  331. return this._getOption('title');
  332. },
  333. set: function (value) {
  334. this._setOption('title', value);
  335. },
  336. enumerable: true,
  337. configurable: true
  338. });
  339. Object.defineProperty(DxLinearGaugeComponent.prototype, "tooltip", {
  340. get: /**
  341. * Configures tooltips.
  342. */
  343. function () {
  344. return this._getOption('tooltip');
  345. },
  346. set: function (value) {
  347. this._setOption('tooltip', value);
  348. },
  349. enumerable: true,
  350. configurable: true
  351. });
  352. Object.defineProperty(DxLinearGaugeComponent.prototype, "value", {
  353. get: /**
  354. * Specifies the main value on a gauge.
  355. */
  356. function () {
  357. return this._getOption('value');
  358. },
  359. set: function (value) {
  360. this._setOption('value', value);
  361. },
  362. enumerable: true,
  363. configurable: true
  364. });
  365. Object.defineProperty(DxLinearGaugeComponent.prototype, "valueIndicator", {
  366. get: /**
  367. * Specifies the appearance options of the value indicator.
  368. */
  369. function () {
  370. return this._getOption('valueIndicator');
  371. },
  372. set: function (value) {
  373. this._setOption('valueIndicator', value);
  374. },
  375. enumerable: true,
  376. configurable: true
  377. });
  378. DxLinearGaugeComponent.prototype._createInstance = function (element, options) {
  379. return new linear_gauge_1.default(element, options);
  380. };
  381. DxLinearGaugeComponent.prototype.ngOnDestroy = function () {
  382. this._destroyWidget();
  383. };
  384. DxLinearGaugeComponent.prototype.ngOnChanges = function (changes) {
  385. _super.prototype.ngOnChanges.call(this, changes);
  386. this.setupChanges('subvalues', changes);
  387. };
  388. DxLinearGaugeComponent.prototype.setupChanges = function (prop, changes) {
  389. if (!(prop in this._optionsToUpdate)) {
  390. this._idh.setup(prop, changes);
  391. }
  392. };
  393. DxLinearGaugeComponent.prototype.ngDoCheck = function () {
  394. this._idh.doCheck('subvalues');
  395. this._watcherHelper.checkWatchers();
  396. _super.prototype.ngDoCheck.call(this);
  397. _super.prototype.clearChangedOptions.call(this);
  398. };
  399. DxLinearGaugeComponent.prototype._setOption = function (name, value) {
  400. var isSetup = this._idh.setupSingle(name, value);
  401. var isChanged = this._idh.getChanges(name, value) !== null;
  402. if (isSetup || isChanged) {
  403. _super.prototype._setOption.call(this, name, value);
  404. }
  405. };
  406. DxLinearGaugeComponent.decorators = [
  407. { type: core_1.Component, args: [{
  408. selector: 'dx-linear-gauge',
  409. template: '',
  410. styles: [' :host { display: block; }'],
  411. providers: [
  412. template_host_1.DxTemplateHost,
  413. watcher_helper_1.WatcherHelper,
  414. nested_option_1.NestedOptionHost,
  415. iterable_differ_helper_1.IterableDifferHelper
  416. ]
  417. },] },
  418. ];
  419. /** @nocollapse */
  420. DxLinearGaugeComponent.ctorParameters = function () { return [
  421. { type: core_1.ElementRef, },
  422. { type: core_1.NgZone, },
  423. { type: template_host_1.DxTemplateHost, },
  424. { type: watcher_helper_1.WatcherHelper, },
  425. { type: iterable_differ_helper_1.IterableDifferHelper, },
  426. { type: nested_option_1.NestedOptionHost, },
  427. { type: platform_browser_2.TransferState, },
  428. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  429. ]; };
  430. DxLinearGaugeComponent.propDecorators = {
  431. "animation": [{ type: core_1.Input },],
  432. "containerBackgroundColor": [{ type: core_1.Input },],
  433. "disabled": [{ type: core_1.Input },],
  434. "elementAttr": [{ type: core_1.Input },],
  435. "export": [{ type: core_1.Input },],
  436. "geometry": [{ type: core_1.Input },],
  437. "loadingIndicator": [{ type: core_1.Input },],
  438. "margin": [{ type: core_1.Input },],
  439. "pathModified": [{ type: core_1.Input },],
  440. "rangeContainer": [{ type: core_1.Input },],
  441. "redrawOnResize": [{ type: core_1.Input },],
  442. "rtlEnabled": [{ type: core_1.Input },],
  443. "scale": [{ type: core_1.Input },],
  444. "size": [{ type: core_1.Input },],
  445. "subvalueIndicator": [{ type: core_1.Input },],
  446. "subvalues": [{ type: core_1.Input },],
  447. "theme": [{ type: core_1.Input },],
  448. "title": [{ type: core_1.Input },],
  449. "tooltip": [{ type: core_1.Input },],
  450. "value": [{ type: core_1.Input },],
  451. "valueIndicator": [{ type: core_1.Input },],
  452. "onDisposing": [{ type: core_1.Output },],
  453. "onDrawn": [{ type: core_1.Output },],
  454. "onExported": [{ type: core_1.Output },],
  455. "onExporting": [{ type: core_1.Output },],
  456. "onFileSaving": [{ type: core_1.Output },],
  457. "onIncidentOccurred": [{ type: core_1.Output },],
  458. "onInitialized": [{ type: core_1.Output },],
  459. "onOptionChanged": [{ type: core_1.Output },],
  460. "onTooltipHidden": [{ type: core_1.Output },],
  461. "onTooltipShown": [{ type: core_1.Output },],
  462. "animationChange": [{ type: core_1.Output },],
  463. "containerBackgroundColorChange": [{ type: core_1.Output },],
  464. "disabledChange": [{ type: core_1.Output },],
  465. "elementAttrChange": [{ type: core_1.Output },],
  466. "exportChange": [{ type: core_1.Output },],
  467. "geometryChange": [{ type: core_1.Output },],
  468. "loadingIndicatorChange": [{ type: core_1.Output },],
  469. "marginChange": [{ type: core_1.Output },],
  470. "pathModifiedChange": [{ type: core_1.Output },],
  471. "rangeContainerChange": [{ type: core_1.Output },],
  472. "redrawOnResizeChange": [{ type: core_1.Output },],
  473. "rtlEnabledChange": [{ type: core_1.Output },],
  474. "scaleChange": [{ type: core_1.Output },],
  475. "sizeChange": [{ type: core_1.Output },],
  476. "subvalueIndicatorChange": [{ type: core_1.Output },],
  477. "subvaluesChange": [{ type: core_1.Output },],
  478. "themeChange": [{ type: core_1.Output },],
  479. "titleChange": [{ type: core_1.Output },],
  480. "tooltipChange": [{ type: core_1.Output },],
  481. "valueChange": [{ type: core_1.Output },],
  482. "valueIndicatorChange": [{ type: core_1.Output },],
  483. };
  484. return DxLinearGaugeComponent;
  485. }(component_1.DxComponent));
  486. exports.DxLinearGaugeComponent = DxLinearGaugeComponent;
  487. var DxLinearGaugeModule = (function () {
  488. function DxLinearGaugeModule() {
  489. }
  490. DxLinearGaugeModule.decorators = [
  491. { type: core_1.NgModule, args: [{
  492. imports: [
  493. animation_1.DxoAnimationModule,
  494. export_1.DxoExportModule,
  495. geometry_1.DxoGeometryModule,
  496. loading_indicator_1.DxoLoadingIndicatorModule,
  497. font_1.DxoFontModule,
  498. margin_1.DxoMarginModule,
  499. range_container_1.DxoRangeContainerModule,
  500. range_dxi_1.DxiRangeModule,
  501. width_1.DxoWidthModule,
  502. scale_1.DxoScaleModule,
  503. label_1.DxoLabelModule,
  504. format_1.DxoFormatModule,
  505. minor_tick_1.DxoMinorTickModule,
  506. tick_1.DxoTickModule,
  507. size_1.DxoSizeModule,
  508. subvalue_indicator_1.DxoSubvalueIndicatorModule,
  509. text_1.DxoTextModule,
  510. title_1.DxoTitleModule,
  511. subtitle_1.DxoSubtitleModule,
  512. tooltip_1.DxoTooltipModule,
  513. border_1.DxoBorderModule,
  514. shadow_1.DxoShadowModule,
  515. value_indicator_1.DxoValueIndicatorModule,
  516. integration_1.DxIntegrationModule,
  517. template_1.DxTemplateModule,
  518. platform_browser_1.BrowserTransferStateModule
  519. ],
  520. declarations: [
  521. DxLinearGaugeComponent
  522. ],
  523. exports: [
  524. DxLinearGaugeComponent,
  525. animation_1.DxoAnimationModule,
  526. export_1.DxoExportModule,
  527. geometry_1.DxoGeometryModule,
  528. loading_indicator_1.DxoLoadingIndicatorModule,
  529. font_1.DxoFontModule,
  530. margin_1.DxoMarginModule,
  531. range_container_1.DxoRangeContainerModule,
  532. range_dxi_1.DxiRangeModule,
  533. width_1.DxoWidthModule,
  534. scale_1.DxoScaleModule,
  535. label_1.DxoLabelModule,
  536. format_1.DxoFormatModule,
  537. minor_tick_1.DxoMinorTickModule,
  538. tick_1.DxoTickModule,
  539. size_1.DxoSizeModule,
  540. subvalue_indicator_1.DxoSubvalueIndicatorModule,
  541. text_1.DxoTextModule,
  542. title_1.DxoTitleModule,
  543. subtitle_1.DxoSubtitleModule,
  544. tooltip_1.DxoTooltipModule,
  545. border_1.DxoBorderModule,
  546. shadow_1.DxoShadowModule,
  547. value_indicator_1.DxoValueIndicatorModule,
  548. template_1.DxTemplateModule
  549. ]
  550. },] },
  551. ];
  552. return DxLinearGaugeModule;
  553. }());
  554. exports.DxLinearGaugeModule = DxLinearGaugeModule;
  555. //# sourceMappingURL=linear-gauge.js.map