bullet.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 bullet_1 = require("devextreme/viz/bullet");
  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 margin_1 = require("./nested/margin");
  36. var size_1 = require("./nested/size");
  37. var tooltip_1 = require("./nested/tooltip");
  38. var border_1 = require("./nested/border");
  39. var font_1 = require("./nested/font");
  40. var format_1 = require("./nested/format");
  41. var shadow_1 = require("./nested/shadow");
  42. /**
  43. * The Bullet widget is useful when you need to compare a single measure to a target value. The widget comprises a horizontal bar indicating the measure and a vertical line indicating the target value.
  44. */
  45. var DxBulletComponent = (function (_super) {
  46. __extends(DxBulletComponent, _super);
  47. function DxBulletComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost, transferState, platformId) {
  48. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  49. _this._createEventEmitters([
  50. { subscribe: 'disposing', emit: 'onDisposing' },
  51. { subscribe: 'drawn', emit: 'onDrawn' },
  52. { subscribe: 'exported', emit: 'onExported' },
  53. { subscribe: 'exporting', emit: 'onExporting' },
  54. { subscribe: 'fileSaving', emit: 'onFileSaving' },
  55. { subscribe: 'incidentOccurred', emit: 'onIncidentOccurred' },
  56. { subscribe: 'initialized', emit: 'onInitialized' },
  57. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  58. { subscribe: 'tooltipHidden', emit: 'onTooltipHidden' },
  59. { subscribe: 'tooltipShown', emit: 'onTooltipShown' },
  60. { emit: 'colorChange' },
  61. { emit: 'disabledChange' },
  62. { emit: 'elementAttrChange' },
  63. { emit: 'endScaleValueChange' },
  64. { emit: 'marginChange' },
  65. { emit: 'pathModifiedChange' },
  66. { emit: 'rtlEnabledChange' },
  67. { emit: 'showTargetChange' },
  68. { emit: 'showZeroLevelChange' },
  69. { emit: 'sizeChange' },
  70. { emit: 'startScaleValueChange' },
  71. { emit: 'targetChange' },
  72. { emit: 'targetColorChange' },
  73. { emit: 'targetWidthChange' },
  74. { emit: 'themeChange' },
  75. { emit: 'tooltipChange' },
  76. { emit: 'valueChange' }
  77. ]);
  78. optionHost.setHost(_this);
  79. return _this;
  80. }
  81. Object.defineProperty(DxBulletComponent.prototype, "color", {
  82. get: /**
  83. * Specifies a color for the bullet bar.
  84. */
  85. function () {
  86. return this._getOption('color');
  87. },
  88. set: function (value) {
  89. this._setOption('color', value);
  90. },
  91. enumerable: true,
  92. configurable: true
  93. });
  94. Object.defineProperty(DxBulletComponent.prototype, "disabled", {
  95. get: /**
  96. * Specifies whether the widget responds to the user interaction.
  97. */
  98. function () {
  99. return this._getOption('disabled');
  100. },
  101. set: function (value) {
  102. this._setOption('disabled', value);
  103. },
  104. enumerable: true,
  105. configurable: true
  106. });
  107. Object.defineProperty(DxBulletComponent.prototype, "elementAttr", {
  108. get: /**
  109. * Specifies the attributes to be attached to the widget's root element.
  110. */
  111. function () {
  112. return this._getOption('elementAttr');
  113. },
  114. set: function (value) {
  115. this._setOption('elementAttr', value);
  116. },
  117. enumerable: true,
  118. configurable: true
  119. });
  120. Object.defineProperty(DxBulletComponent.prototype, "endScaleValue", {
  121. get: /**
  122. * Specifies an end value for the invisible scale.
  123. */
  124. function () {
  125. return this._getOption('endScaleValue');
  126. },
  127. set: function (value) {
  128. this._setOption('endScaleValue', value);
  129. },
  130. enumerable: true,
  131. configurable: true
  132. });
  133. Object.defineProperty(DxBulletComponent.prototype, "margin", {
  134. get: /**
  135. * Generates space around the widget.
  136. */
  137. function () {
  138. return this._getOption('margin');
  139. },
  140. set: function (value) {
  141. this._setOption('margin', value);
  142. },
  143. enumerable: true,
  144. configurable: true
  145. });
  146. Object.defineProperty(DxBulletComponent.prototype, "pathModified", {
  147. get: /**
  148. * Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path.
  149. */
  150. function () {
  151. return this._getOption('pathModified');
  152. },
  153. set: function (value) {
  154. this._setOption('pathModified', value);
  155. },
  156. enumerable: true,
  157. configurable: true
  158. });
  159. Object.defineProperty(DxBulletComponent.prototype, "rtlEnabled", {
  160. get: /**
  161. * Switches the widget to a right-to-left representation.
  162. */
  163. function () {
  164. return this._getOption('rtlEnabled');
  165. },
  166. set: function (value) {
  167. this._setOption('rtlEnabled', value);
  168. },
  169. enumerable: true,
  170. configurable: true
  171. });
  172. Object.defineProperty(DxBulletComponent.prototype, "showTarget", {
  173. get: /**
  174. * Specifies whether or not to show the target line.
  175. */
  176. function () {
  177. return this._getOption('showTarget');
  178. },
  179. set: function (value) {
  180. this._setOption('showTarget', value);
  181. },
  182. enumerable: true,
  183. configurable: true
  184. });
  185. Object.defineProperty(DxBulletComponent.prototype, "showZeroLevel", {
  186. get: /**
  187. * Specifies whether or not to show the line indicating zero on the invisible scale.
  188. */
  189. function () {
  190. return this._getOption('showZeroLevel');
  191. },
  192. set: function (value) {
  193. this._setOption('showZeroLevel', value);
  194. },
  195. enumerable: true,
  196. configurable: true
  197. });
  198. Object.defineProperty(DxBulletComponent.prototype, "size", {
  199. get: /**
  200. * Specifies the widget's size in pixels.
  201. */
  202. function () {
  203. return this._getOption('size');
  204. },
  205. set: function (value) {
  206. this._setOption('size', value);
  207. },
  208. enumerable: true,
  209. configurable: true
  210. });
  211. Object.defineProperty(DxBulletComponent.prototype, "startScaleValue", {
  212. get: /**
  213. * Specifies a start value for the invisible scale.
  214. */
  215. function () {
  216. return this._getOption('startScaleValue');
  217. },
  218. set: function (value) {
  219. this._setOption('startScaleValue', value);
  220. },
  221. enumerable: true,
  222. configurable: true
  223. });
  224. Object.defineProperty(DxBulletComponent.prototype, "target", {
  225. get: /**
  226. * Specifies the value indicated by the target line.
  227. */
  228. function () {
  229. return this._getOption('target');
  230. },
  231. set: function (value) {
  232. this._setOption('target', value);
  233. },
  234. enumerable: true,
  235. configurable: true
  236. });
  237. Object.defineProperty(DxBulletComponent.prototype, "targetColor", {
  238. get: /**
  239. * Specifies a color for both the target and zero level lines.
  240. */
  241. function () {
  242. return this._getOption('targetColor');
  243. },
  244. set: function (value) {
  245. this._setOption('targetColor', value);
  246. },
  247. enumerable: true,
  248. configurable: true
  249. });
  250. Object.defineProperty(DxBulletComponent.prototype, "targetWidth", {
  251. get: /**
  252. * Specifies the width of the target line.
  253. */
  254. function () {
  255. return this._getOption('targetWidth');
  256. },
  257. set: function (value) {
  258. this._setOption('targetWidth', value);
  259. },
  260. enumerable: true,
  261. configurable: true
  262. });
  263. Object.defineProperty(DxBulletComponent.prototype, "theme", {
  264. get: /**
  265. * Sets the name of the theme the widget uses.
  266. */
  267. function () {
  268. return this._getOption('theme');
  269. },
  270. set: function (value) {
  271. this._setOption('theme', value);
  272. },
  273. enumerable: true,
  274. configurable: true
  275. });
  276. Object.defineProperty(DxBulletComponent.prototype, "tooltip", {
  277. get: /**
  278. * Configures the tooltip.
  279. */
  280. function () {
  281. return this._getOption('tooltip');
  282. },
  283. set: function (value) {
  284. this._setOption('tooltip', value);
  285. },
  286. enumerable: true,
  287. configurable: true
  288. });
  289. Object.defineProperty(DxBulletComponent.prototype, "value", {
  290. get: /**
  291. * Specifies the primary value indicated by the bullet bar.
  292. */
  293. function () {
  294. return this._getOption('value');
  295. },
  296. set: function (value) {
  297. this._setOption('value', value);
  298. },
  299. enumerable: true,
  300. configurable: true
  301. });
  302. DxBulletComponent.prototype._createInstance = function (element, options) {
  303. return new bullet_1.default(element, options);
  304. };
  305. DxBulletComponent.prototype.ngOnDestroy = function () {
  306. this._destroyWidget();
  307. };
  308. DxBulletComponent.decorators = [
  309. { type: core_1.Component, args: [{
  310. selector: 'dx-bullet',
  311. template: '',
  312. styles: [' :host { display: block; }'],
  313. providers: [
  314. template_host_1.DxTemplateHost,
  315. watcher_helper_1.WatcherHelper,
  316. nested_option_1.NestedOptionHost
  317. ]
  318. },] },
  319. ];
  320. /** @nocollapse */
  321. DxBulletComponent.ctorParameters = function () { return [
  322. { type: core_1.ElementRef, },
  323. { type: core_1.NgZone, },
  324. { type: template_host_1.DxTemplateHost, },
  325. { type: watcher_helper_1.WatcherHelper, },
  326. { type: nested_option_1.NestedOptionHost, },
  327. { type: platform_browser_2.TransferState, },
  328. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  329. ]; };
  330. DxBulletComponent.propDecorators = {
  331. "color": [{ type: core_1.Input },],
  332. "disabled": [{ type: core_1.Input },],
  333. "elementAttr": [{ type: core_1.Input },],
  334. "endScaleValue": [{ type: core_1.Input },],
  335. "margin": [{ type: core_1.Input },],
  336. "pathModified": [{ type: core_1.Input },],
  337. "rtlEnabled": [{ type: core_1.Input },],
  338. "showTarget": [{ type: core_1.Input },],
  339. "showZeroLevel": [{ type: core_1.Input },],
  340. "size": [{ type: core_1.Input },],
  341. "startScaleValue": [{ type: core_1.Input },],
  342. "target": [{ type: core_1.Input },],
  343. "targetColor": [{ type: core_1.Input },],
  344. "targetWidth": [{ type: core_1.Input },],
  345. "theme": [{ type: core_1.Input },],
  346. "tooltip": [{ type: core_1.Input },],
  347. "value": [{ type: core_1.Input },],
  348. "onDisposing": [{ type: core_1.Output },],
  349. "onDrawn": [{ type: core_1.Output },],
  350. "onExported": [{ type: core_1.Output },],
  351. "onExporting": [{ type: core_1.Output },],
  352. "onFileSaving": [{ type: core_1.Output },],
  353. "onIncidentOccurred": [{ type: core_1.Output },],
  354. "onInitialized": [{ type: core_1.Output },],
  355. "onOptionChanged": [{ type: core_1.Output },],
  356. "onTooltipHidden": [{ type: core_1.Output },],
  357. "onTooltipShown": [{ type: core_1.Output },],
  358. "colorChange": [{ type: core_1.Output },],
  359. "disabledChange": [{ type: core_1.Output },],
  360. "elementAttrChange": [{ type: core_1.Output },],
  361. "endScaleValueChange": [{ type: core_1.Output },],
  362. "marginChange": [{ type: core_1.Output },],
  363. "pathModifiedChange": [{ type: core_1.Output },],
  364. "rtlEnabledChange": [{ type: core_1.Output },],
  365. "showTargetChange": [{ type: core_1.Output },],
  366. "showZeroLevelChange": [{ type: core_1.Output },],
  367. "sizeChange": [{ type: core_1.Output },],
  368. "startScaleValueChange": [{ type: core_1.Output },],
  369. "targetChange": [{ type: core_1.Output },],
  370. "targetColorChange": [{ type: core_1.Output },],
  371. "targetWidthChange": [{ type: core_1.Output },],
  372. "themeChange": [{ type: core_1.Output },],
  373. "tooltipChange": [{ type: core_1.Output },],
  374. "valueChange": [{ type: core_1.Output },],
  375. };
  376. return DxBulletComponent;
  377. }(component_1.DxComponent));
  378. exports.DxBulletComponent = DxBulletComponent;
  379. var DxBulletModule = (function () {
  380. function DxBulletModule() {
  381. }
  382. DxBulletModule.decorators = [
  383. { type: core_1.NgModule, args: [{
  384. imports: [
  385. margin_1.DxoMarginModule,
  386. size_1.DxoSizeModule,
  387. tooltip_1.DxoTooltipModule,
  388. border_1.DxoBorderModule,
  389. font_1.DxoFontModule,
  390. format_1.DxoFormatModule,
  391. shadow_1.DxoShadowModule,
  392. integration_1.DxIntegrationModule,
  393. template_1.DxTemplateModule,
  394. platform_browser_1.BrowserTransferStateModule
  395. ],
  396. declarations: [
  397. DxBulletComponent
  398. ],
  399. exports: [
  400. DxBulletComponent,
  401. margin_1.DxoMarginModule,
  402. size_1.DxoSizeModule,
  403. tooltip_1.DxoTooltipModule,
  404. border_1.DxoBorderModule,
  405. font_1.DxoFontModule,
  406. format_1.DxoFormatModule,
  407. shadow_1.DxoShadowModule,
  408. template_1.DxTemplateModule
  409. ]
  410. },] },
  411. ];
  412. return DxBulletModule;
  413. }());
  414. exports.DxBulletModule = DxBulletModule;
  415. //# sourceMappingURL=bullet.js.map