tooltip.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  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 tooltip_1 = require("devextreme/ui/tooltip");
  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 animation_1 = require("./nested/animation");
  36. var hide_1 = require("./nested/hide");
  37. var show_1 = require("./nested/show");
  38. var hide_event_1 = require("./nested/hide-event");
  39. var position_1 = require("./nested/position");
  40. var at_1 = require("./nested/at");
  41. var boundary_offset_1 = require("./nested/boundary-offset");
  42. var collision_1 = require("./nested/collision");
  43. var my_1 = require("./nested/my");
  44. var offset_1 = require("./nested/offset");
  45. var show_event_1 = require("./nested/show-event");
  46. /**
  47. * The Tooltip widget displays a tooltip for a specified element on the page.
  48. */
  49. var DxTooltipComponent = (function (_super) {
  50. __extends(DxTooltipComponent, _super);
  51. function DxTooltipComponent(elementRef, ngZone, templateHost, _watcherHelper, optionHost, transferState, platformId) {
  52. var _this = _super.call(this, elementRef, ngZone, templateHost, _watcherHelper, transferState, platformId) || this;
  53. _this._createEventEmitters([
  54. { subscribe: 'contentReady', emit: 'onContentReady' },
  55. { subscribe: 'disposing', emit: 'onDisposing' },
  56. { subscribe: 'hidden', emit: 'onHidden' },
  57. { subscribe: 'hiding', emit: 'onHiding' },
  58. { subscribe: 'initialized', emit: 'onInitialized' },
  59. { subscribe: 'optionChanged', emit: 'onOptionChanged' },
  60. { subscribe: 'showing', emit: 'onShowing' },
  61. { subscribe: 'shown', emit: 'onShown' },
  62. { emit: 'animationChange' },
  63. { emit: 'closeOnOutsideClickChange' },
  64. { emit: 'containerChange' },
  65. { emit: 'contentTemplateChange' },
  66. { emit: 'deferRenderingChange' },
  67. { emit: 'disabledChange' },
  68. { emit: 'elementAttrChange' },
  69. { emit: 'heightChange' },
  70. { emit: 'hideEventChange' },
  71. { emit: 'hintChange' },
  72. { emit: 'hoverStateEnabledChange' },
  73. { emit: 'maxHeightChange' },
  74. { emit: 'maxWidthChange' },
  75. { emit: 'minHeightChange' },
  76. { emit: 'minWidthChange' },
  77. { emit: 'positionChange' },
  78. { emit: 'rtlEnabledChange' },
  79. { emit: 'shadingChange' },
  80. { emit: 'shadingColorChange' },
  81. { emit: 'showEventChange' },
  82. { emit: 'targetChange' },
  83. { emit: 'visibleChange' },
  84. { emit: 'widthChange' }
  85. ]);
  86. optionHost.setHost(_this);
  87. return _this;
  88. }
  89. Object.defineProperty(DxTooltipComponent.prototype, "animation", {
  90. get: /**
  91. * Configures widget visibility animations. This object contains two fields: show and hide.
  92. */
  93. function () {
  94. return this._getOption('animation');
  95. },
  96. set: function (value) {
  97. this._setOption('animation', value);
  98. },
  99. enumerable: true,
  100. configurable: true
  101. });
  102. Object.defineProperty(DxTooltipComponent.prototype, "closeOnOutsideClick", {
  103. get: /**
  104. * A Boolean value specifying whether or not the widget is closed if a user clicks outside of the popover window and outside the target element.
  105. */
  106. function () {
  107. return this._getOption('closeOnOutsideClick');
  108. },
  109. set: function (value) {
  110. this._setOption('closeOnOutsideClick', value);
  111. },
  112. enumerable: true,
  113. configurable: true
  114. });
  115. Object.defineProperty(DxTooltipComponent.prototype, "container", {
  116. get: /**
  117. * Specifies the container in which to place the widget.
  118. */
  119. function () {
  120. return this._getOption('container');
  121. },
  122. set: function (value) {
  123. this._setOption('container', value);
  124. },
  125. enumerable: true,
  126. configurable: true
  127. });
  128. Object.defineProperty(DxTooltipComponent.prototype, "contentTemplate", {
  129. get: /**
  130. * Specifies a custom template for the widget content.
  131. */
  132. function () {
  133. return this._getOption('contentTemplate');
  134. },
  135. set: function (value) {
  136. this._setOption('contentTemplate', value);
  137. },
  138. enumerable: true,
  139. configurable: true
  140. });
  141. Object.defineProperty(DxTooltipComponent.prototype, "deferRendering", {
  142. get: /**
  143. * Specifies whether to render the widget's content when it is displayed. If false, the content is rendered immediately.
  144. */
  145. function () {
  146. return this._getOption('deferRendering');
  147. },
  148. set: function (value) {
  149. this._setOption('deferRendering', value);
  150. },
  151. enumerable: true,
  152. configurable: true
  153. });
  154. Object.defineProperty(DxTooltipComponent.prototype, "disabled", {
  155. get: /**
  156. * Specifies whether the widget responds to user interaction.
  157. */
  158. function () {
  159. return this._getOption('disabled');
  160. },
  161. set: function (value) {
  162. this._setOption('disabled', value);
  163. },
  164. enumerable: true,
  165. configurable: true
  166. });
  167. Object.defineProperty(DxTooltipComponent.prototype, "elementAttr", {
  168. get: /**
  169. * Specifies the attributes to be attached to the widget's root element.
  170. */
  171. function () {
  172. return this._getOption('elementAttr');
  173. },
  174. set: function (value) {
  175. this._setOption('elementAttr', value);
  176. },
  177. enumerable: true,
  178. configurable: true
  179. });
  180. Object.defineProperty(DxTooltipComponent.prototype, "height", {
  181. get: /**
  182. * Specifies the widget's height.
  183. */
  184. function () {
  185. return this._getOption('height');
  186. },
  187. set: function (value) {
  188. this._setOption('height', value);
  189. },
  190. enumerable: true,
  191. configurable: true
  192. });
  193. Object.defineProperty(DxTooltipComponent.prototype, "hideEvent", {
  194. get: /**
  195. * Specifies options of popover hiding.
  196. */
  197. function () {
  198. return this._getOption('hideEvent');
  199. },
  200. set: function (value) {
  201. this._setOption('hideEvent', value);
  202. },
  203. enumerable: true,
  204. configurable: true
  205. });
  206. Object.defineProperty(DxTooltipComponent.prototype, "hint", {
  207. get: /**
  208. * Specifies text for a hint that appears when a user pauses on the widget.
  209. */
  210. function () {
  211. return this._getOption('hint');
  212. },
  213. set: function (value) {
  214. this._setOption('hint', value);
  215. },
  216. enumerable: true,
  217. configurable: true
  218. });
  219. Object.defineProperty(DxTooltipComponent.prototype, "hoverStateEnabled", {
  220. get: /**
  221. * Specifies whether the widget changes its state when a user pauses on it.
  222. */
  223. function () {
  224. return this._getOption('hoverStateEnabled');
  225. },
  226. set: function (value) {
  227. this._setOption('hoverStateEnabled', value);
  228. },
  229. enumerable: true,
  230. configurable: true
  231. });
  232. Object.defineProperty(DxTooltipComponent.prototype, "maxHeight", {
  233. get: /**
  234. * Specifies the maximum height the widget can reach while resizing.
  235. */
  236. function () {
  237. return this._getOption('maxHeight');
  238. },
  239. set: function (value) {
  240. this._setOption('maxHeight', value);
  241. },
  242. enumerable: true,
  243. configurable: true
  244. });
  245. Object.defineProperty(DxTooltipComponent.prototype, "maxWidth", {
  246. get: /**
  247. * Specifies the maximum width the widget can reach while resizing.
  248. */
  249. function () {
  250. return this._getOption('maxWidth');
  251. },
  252. set: function (value) {
  253. this._setOption('maxWidth', value);
  254. },
  255. enumerable: true,
  256. configurable: true
  257. });
  258. Object.defineProperty(DxTooltipComponent.prototype, "minHeight", {
  259. get: /**
  260. * Specifies the minimum height the widget can reach while resizing.
  261. */
  262. function () {
  263. return this._getOption('minHeight');
  264. },
  265. set: function (value) {
  266. this._setOption('minHeight', value);
  267. },
  268. enumerable: true,
  269. configurable: true
  270. });
  271. Object.defineProperty(DxTooltipComponent.prototype, "minWidth", {
  272. get: /**
  273. * Specifies the minimum width the widget can reach while resizing.
  274. */
  275. function () {
  276. return this._getOption('minWidth');
  277. },
  278. set: function (value) {
  279. this._setOption('minWidth', value);
  280. },
  281. enumerable: true,
  282. configurable: true
  283. });
  284. Object.defineProperty(DxTooltipComponent.prototype, "position", {
  285. get: /**
  286. * An object defining widget positioning options.
  287. */
  288. function () {
  289. return this._getOption('position');
  290. },
  291. set: function (value) {
  292. this._setOption('position', value);
  293. },
  294. enumerable: true,
  295. configurable: true
  296. });
  297. Object.defineProperty(DxTooltipComponent.prototype, "rtlEnabled", {
  298. get: /**
  299. * Switches the widget to a right-to-left representation.
  300. */
  301. function () {
  302. return this._getOption('rtlEnabled');
  303. },
  304. set: function (value) {
  305. this._setOption('rtlEnabled', value);
  306. },
  307. enumerable: true,
  308. configurable: true
  309. });
  310. Object.defineProperty(DxTooltipComponent.prototype, "shading", {
  311. get: /**
  312. * Specifies whether to shade the background when the widget is active.
  313. */
  314. function () {
  315. return this._getOption('shading');
  316. },
  317. set: function (value) {
  318. this._setOption('shading', value);
  319. },
  320. enumerable: true,
  321. configurable: true
  322. });
  323. Object.defineProperty(DxTooltipComponent.prototype, "shadingColor", {
  324. get: /**
  325. * Specifies the shading color.
  326. */
  327. function () {
  328. return this._getOption('shadingColor');
  329. },
  330. set: function (value) {
  331. this._setOption('shadingColor', value);
  332. },
  333. enumerable: true,
  334. configurable: true
  335. });
  336. Object.defineProperty(DxTooltipComponent.prototype, "showEvent", {
  337. get: /**
  338. * Specifies options for displaying the widget.
  339. */
  340. function () {
  341. return this._getOption('showEvent');
  342. },
  343. set: function (value) {
  344. this._setOption('showEvent', value);
  345. },
  346. enumerable: true,
  347. configurable: true
  348. });
  349. Object.defineProperty(DxTooltipComponent.prototype, "target", {
  350. get: /**
  351. * The target element associated with the widget.
  352. */
  353. function () {
  354. return this._getOption('target');
  355. },
  356. set: function (value) {
  357. this._setOption('target', value);
  358. },
  359. enumerable: true,
  360. configurable: true
  361. });
  362. Object.defineProperty(DxTooltipComponent.prototype, "visible", {
  363. get: /**
  364. * A Boolean value specifying whether or not the widget is visible.
  365. */
  366. function () {
  367. return this._getOption('visible');
  368. },
  369. set: function (value) {
  370. this._setOption('visible', value);
  371. },
  372. enumerable: true,
  373. configurable: true
  374. });
  375. Object.defineProperty(DxTooltipComponent.prototype, "width", {
  376. get: /**
  377. * Specifies the widget's width.
  378. */
  379. function () {
  380. return this._getOption('width');
  381. },
  382. set: function (value) {
  383. this._setOption('width', value);
  384. },
  385. enumerable: true,
  386. configurable: true
  387. });
  388. DxTooltipComponent.prototype._createInstance = function (element, options) {
  389. return new tooltip_1.default(element, options);
  390. };
  391. DxTooltipComponent.prototype.ngOnDestroy = function () {
  392. this._destroyWidget();
  393. };
  394. DxTooltipComponent.decorators = [
  395. { type: core_1.Component, args: [{
  396. selector: 'dx-tooltip',
  397. template: '<ng-content></ng-content>',
  398. providers: [
  399. template_host_1.DxTemplateHost,
  400. watcher_helper_1.WatcherHelper,
  401. nested_option_1.NestedOptionHost
  402. ]
  403. },] },
  404. ];
  405. /** @nocollapse */
  406. DxTooltipComponent.ctorParameters = function () { return [
  407. { type: core_1.ElementRef, },
  408. { type: core_1.NgZone, },
  409. { type: template_host_1.DxTemplateHost, },
  410. { type: watcher_helper_1.WatcherHelper, },
  411. { type: nested_option_1.NestedOptionHost, },
  412. { type: platform_browser_2.TransferState, },
  413. { type: undefined, decorators: [{ type: core_1.Inject, args: [core_1.PLATFORM_ID,] },] },
  414. ]; };
  415. DxTooltipComponent.propDecorators = {
  416. "animation": [{ type: core_1.Input },],
  417. "closeOnOutsideClick": [{ type: core_1.Input },],
  418. "container": [{ type: core_1.Input },],
  419. "contentTemplate": [{ type: core_1.Input },],
  420. "deferRendering": [{ type: core_1.Input },],
  421. "disabled": [{ type: core_1.Input },],
  422. "elementAttr": [{ type: core_1.Input },],
  423. "height": [{ type: core_1.Input },],
  424. "hideEvent": [{ type: core_1.Input },],
  425. "hint": [{ type: core_1.Input },],
  426. "hoverStateEnabled": [{ type: core_1.Input },],
  427. "maxHeight": [{ type: core_1.Input },],
  428. "maxWidth": [{ type: core_1.Input },],
  429. "minHeight": [{ type: core_1.Input },],
  430. "minWidth": [{ type: core_1.Input },],
  431. "position": [{ type: core_1.Input },],
  432. "rtlEnabled": [{ type: core_1.Input },],
  433. "shading": [{ type: core_1.Input },],
  434. "shadingColor": [{ type: core_1.Input },],
  435. "showEvent": [{ type: core_1.Input },],
  436. "target": [{ type: core_1.Input },],
  437. "visible": [{ type: core_1.Input },],
  438. "width": [{ type: core_1.Input },],
  439. "onContentReady": [{ type: core_1.Output },],
  440. "onDisposing": [{ type: core_1.Output },],
  441. "onHidden": [{ type: core_1.Output },],
  442. "onHiding": [{ type: core_1.Output },],
  443. "onInitialized": [{ type: core_1.Output },],
  444. "onOptionChanged": [{ type: core_1.Output },],
  445. "onShowing": [{ type: core_1.Output },],
  446. "onShown": [{ type: core_1.Output },],
  447. "animationChange": [{ type: core_1.Output },],
  448. "closeOnOutsideClickChange": [{ type: core_1.Output },],
  449. "containerChange": [{ type: core_1.Output },],
  450. "contentTemplateChange": [{ type: core_1.Output },],
  451. "deferRenderingChange": [{ type: core_1.Output },],
  452. "disabledChange": [{ type: core_1.Output },],
  453. "elementAttrChange": [{ type: core_1.Output },],
  454. "heightChange": [{ type: core_1.Output },],
  455. "hideEventChange": [{ type: core_1.Output },],
  456. "hintChange": [{ type: core_1.Output },],
  457. "hoverStateEnabledChange": [{ type: core_1.Output },],
  458. "maxHeightChange": [{ type: core_1.Output },],
  459. "maxWidthChange": [{ type: core_1.Output },],
  460. "minHeightChange": [{ type: core_1.Output },],
  461. "minWidthChange": [{ type: core_1.Output },],
  462. "positionChange": [{ type: core_1.Output },],
  463. "rtlEnabledChange": [{ type: core_1.Output },],
  464. "shadingChange": [{ type: core_1.Output },],
  465. "shadingColorChange": [{ type: core_1.Output },],
  466. "showEventChange": [{ type: core_1.Output },],
  467. "targetChange": [{ type: core_1.Output },],
  468. "visibleChange": [{ type: core_1.Output },],
  469. "widthChange": [{ type: core_1.Output },],
  470. };
  471. return DxTooltipComponent;
  472. }(component_1.DxComponent));
  473. exports.DxTooltipComponent = DxTooltipComponent;
  474. var DxTooltipModule = (function () {
  475. function DxTooltipModule() {
  476. }
  477. DxTooltipModule.decorators = [
  478. { type: core_1.NgModule, args: [{
  479. imports: [
  480. animation_1.DxoAnimationModule,
  481. hide_1.DxoHideModule,
  482. show_1.DxoShowModule,
  483. hide_event_1.DxoHideEventModule,
  484. position_1.DxoPositionModule,
  485. at_1.DxoAtModule,
  486. boundary_offset_1.DxoBoundaryOffsetModule,
  487. collision_1.DxoCollisionModule,
  488. my_1.DxoMyModule,
  489. offset_1.DxoOffsetModule,
  490. show_event_1.DxoShowEventModule,
  491. integration_1.DxIntegrationModule,
  492. template_1.DxTemplateModule,
  493. platform_browser_1.BrowserTransferStateModule
  494. ],
  495. declarations: [
  496. DxTooltipComponent
  497. ],
  498. exports: [
  499. DxTooltipComponent,
  500. animation_1.DxoAnimationModule,
  501. hide_1.DxoHideModule,
  502. show_1.DxoShowModule,
  503. hide_event_1.DxoHideEventModule,
  504. position_1.DxoPositionModule,
  505. at_1.DxoAtModule,
  506. boundary_offset_1.DxoBoundaryOffsetModule,
  507. collision_1.DxoCollisionModule,
  508. my_1.DxoMyModule,
  509. offset_1.DxoOffsetModule,
  510. show_event_1.DxoShowEventModule,
  511. template_1.DxTemplateModule
  512. ]
  513. },] },
  514. ];
  515. return DxTooltipModule;
  516. }());
  517. exports.DxTooltipModule = DxTooltipModule;
  518. //# sourceMappingURL=tooltip.js.map