integration.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. "use strict";
  2. /*!
  3. * devextreme-angular
  4. * Version: 19.1.16
  5. * Build date: Tue Oct 18 2022
  6. *
  7. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  8. *
  9. * This software may be modified and distributed under the terms
  10. * of the MIT license. See the LICENSE file in the root of the project for details.
  11. *
  12. * https://github.com/DevExpress/devextreme-angular
  13. */
  14. Object.defineProperty(exports, "__esModule", { value: true });
  15. var core_1 = require("@angular/core");
  16. var http_1 = require("@angular/common/http");
  17. var httpRequest = require("devextreme/core/http_request");
  18. var common_1 = require("@angular/common");
  19. var domAdapter = require("devextreme/core/dom_adapter");
  20. var readyCallbacks = require("devextreme/core/utils/ready_callbacks");
  21. var eventsEngine = require("devextreme/events/core/events_engine");
  22. var outsideZoneEvents = ['mousemove', 'mouseover', 'mouseout'];
  23. var insideZoneEvents = ['mouseup', 'click', 'mousedown', 'transitionend', 'wheel'];
  24. var originalAdd;
  25. var callbacks = [];
  26. readyCallbacks.inject({
  27. add: function (callback) {
  28. originalAdd = this.callBase.bind(this);
  29. callbacks.push(callback);
  30. }
  31. });
  32. var doInjections = function (document, ngZone, xhrFactory) {
  33. domAdapter.inject({
  34. _document: document,
  35. listen: function () {
  36. var _this = this;
  37. var args = [];
  38. for (var _i = 0; _i < arguments.length; _i++) {
  39. args[_i] = arguments[_i];
  40. }
  41. var eventName = args[1];
  42. if (outsideZoneEvents.indexOf(eventName) !== -1) {
  43. return ngZone.runOutsideAngular(function () {
  44. return _this.callBase.apply(_this, args);
  45. });
  46. }
  47. if (ngZone.isStable && insideZoneEvents.indexOf(eventName) !== -1) {
  48. return ngZone.run(function () {
  49. return _this.callBase.apply(_this, args);
  50. });
  51. }
  52. return this.callBase.apply(this, args);
  53. },
  54. isElementNode: function (element) {
  55. return element && element.nodeType === 1;
  56. },
  57. isTextNode: function (element) {
  58. return element && element.nodeType === 3;
  59. },
  60. isDocument: function (element) {
  61. return element && element.nodeType === 9;
  62. }
  63. });
  64. httpRequest.inject({
  65. getXhr: function () {
  66. if (!xhrFactory) {
  67. return this.callBase.apply(this);
  68. }
  69. var _xhr = xhrFactory.build();
  70. if (!('withCredentials' in _xhr)) {
  71. _xhr['withCredentials'] = false;
  72. }
  73. return _xhr;
  74. }
  75. });
  76. var runReadyCallbacksInZone = function () {
  77. ngZone.run(function () {
  78. eventsEngine.set({});
  79. callbacks.forEach(function (callback) { return originalAdd.call(null, callback); });
  80. callbacks = [];
  81. readyCallbacks.fire();
  82. });
  83. };
  84. runReadyCallbacksInZone();
  85. doInjections = runReadyCallbacksInZone;
  86. };
  87. var ɵ0 = doInjections;
  88. exports.ɵ0 = ɵ0;
  89. var DxIntegrationModule = (function () {
  90. function DxIntegrationModule(document, ngZone, xhrFactory) {
  91. doInjections(document, ngZone, xhrFactory);
  92. }
  93. DxIntegrationModule.decorators = [
  94. { type: core_1.NgModule, args: [{},] },
  95. ];
  96. /** @nocollapse */
  97. DxIntegrationModule.ctorParameters = function () { return [
  98. { type: undefined, decorators: [{ type: core_1.Inject, args: [common_1.DOCUMENT,] },] },
  99. { type: core_1.NgZone, },
  100. { type: http_1.XhrFactory, decorators: [{ type: core_1.Optional },] },
  101. ]; };
  102. return DxIntegrationModule;
  103. }());
  104. exports.DxIntegrationModule = DxIntegrationModule;
  105. //# sourceMappingURL=integration.js.map