@progress/kendo-angular-charts 16.3.0-develop.1 → 16.3.0-develop.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,7 @@
2
2
  * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { DomEventsBuilder } from './events/dom-events-builder';
6
- import { DomEventsBuilder as ChartDomEventsBuilder, DateCategoryAxis, DateValueAxis } from '@progress/kendo-charts';
5
+ import { DateCategoryAxis, DateValueAxis } from '@progress/kendo-charts';
7
6
  const dateCategoryAxisFormats = DateCategoryAxis.prototype.options.labels.dateFormats;
8
7
  const dateValueAxisFormats = DateValueAxis.prototype.options.labels.dateFormats;
9
8
  const dateFormats = {
@@ -18,4 +17,3 @@ const dateFormats = {
18
17
  };
19
18
  Object.assign(dateCategoryAxisFormats, dateFormats);
20
19
  Object.assign(dateValueAxisFormats, dateFormats);
21
- ChartDomEventsBuilder.register(DomEventsBuilder);
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-charts',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1718181838,
13
- version: '16.3.0-develop.1',
12
+ publishDate: 1718186667,
13
+ version: '16.3.0-develop.3',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
15
15
  };
@@ -3,12 +3,12 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
- import { isDevMode, Directive, Optional, Injectable, SimpleChange, TemplateRef, Component, ChangeDetectionStrategy, Input, ContentChild, ElementRef, ViewChild, ViewChildren, EventEmitter, Output, ContentChildren, LOCALE_ID, Inject, InjectionToken, NgModule, HostBinding, forwardRef } from '@angular/core';
6
+ import { Directive, Optional, Injectable, SimpleChange, TemplateRef, Component, ChangeDetectionStrategy, Input, ContentChild, ElementRef, ViewChild, ViewChildren, EventEmitter, Output, ContentChildren, LOCALE_ID, Inject, isDevMode, InjectionToken, NgModule, HostBinding, forwardRef } from '@angular/core';
7
7
  import * as i9 from '@progress/kendo-angular-common';
8
8
  import { isDocumentAvailable, shouldShowValidationUI, ResizeSensorModule, WatermarkModule, PreventableEvent as PreventableEvent$1, isChanged } from '@progress/kendo-angular-common';
9
9
  import * as i4 from '@progress/kendo-angular-l10n';
10
10
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
11
- import { DateCategoryAxis, DateValueAxis, DomEventsBuilder as DomEventsBuilder$1, InstanceObserver, chartBaseTheme, Chart, StockChart, Sparkline, Sankey, createSankeyData } from '@progress/kendo-charts';
11
+ import { DateCategoryAxis, DateValueAxis, InstanceObserver, chartBaseTheme, Chart, StockChart, Sparkline, Sankey, createSankeyData } from '@progress/kendo-charts';
12
12
  import { exportImage, exportSVG } from '@progress/kendo-drawing';
13
13
  import { validatePackage } from '@progress/kendo-licensing';
14
14
  import { Subject, BehaviorSubject, combineLatest, Subscription } from 'rxjs';
@@ -25,194 +25,6 @@ import * as i6 from '@progress/kendo-angular-icons';
25
25
  import { IconsModule } from '@progress/kendo-angular-icons';
26
26
  import { getter } from '@progress/kendo-common';
27
27
 
28
- const getTouch = (domEvent) => {
29
- return {
30
- x: {
31
- location: domEvent.pageX
32
- },
33
- y: {
34
- location: domEvent.pageY
35
- }
36
- };
37
- };
38
- const eventArgs = (e, previousArgs) => {
39
- const pointers = e.pointers;
40
- const pointer = pointers[0];
41
- const xLocation = pointer.pageX;
42
- const yLocation = pointer.pageY;
43
- let distance = 0;
44
- if (pointers.length > 1) {
45
- const pointer1 = pointers[0];
46
- const pointer2 = pointers[1];
47
- distance = Math.sqrt(Math.pow(pointer1.pageX - pointer2.pageX, 2) + Math.pow(pointer1.pageY - pointer2.pageY, 2));
48
- }
49
- return {
50
- distance: distance,
51
- event: e.srcEvent,
52
- preventDefault: function () {
53
- e.preventDefault();
54
- },
55
- target: e.target,
56
- touches: pointers.map(getTouch),
57
- type: e.type,
58
- x: {
59
- delta: previousArgs ? xLocation - previousArgs.x.location : 0,
60
- initialDelta: e.deltaX,
61
- location: xLocation,
62
- startLocation: xLocation - e.deltaX
63
- },
64
- y: {
65
- delta: previousArgs ? yLocation - previousArgs.y.location : 0,
66
- initialDelta: e.deltaY,
67
- location: yLocation,
68
- startLocation: yLocation - e.deltaY
69
- }
70
- };
71
- };
72
- function shouldBindGroup(groupNames, events) {
73
- for (let idx = 0; idx < groupNames.length; idx++) {
74
- if (events[groupNames[idx]]) {
75
- return true;
76
- }
77
- }
78
- return false;
79
- }
80
- const eventGroups = [{
81
- end: 'panend',
82
- move: 'panmove',
83
- start: 'panstart'
84
- }, {
85
- gesturechange: 'pinchmove',
86
- gestureend: 'pinchend',
87
- gesturestart: 'pinchstart'
88
- }, {
89
- press: 'press'
90
- }, {
91
- tap: 'tap'
92
- }];
93
- /**
94
- * @hidden
95
- */
96
- class DomEvents {
97
- constructor(hammerInstance, events) {
98
- this.hammerInstance = hammerInstance;
99
- this.eventHandlers = {};
100
- this.tap = this.tap.bind(this);
101
- this.press = this.press.bind(this);
102
- this.panstart = this.panstart.bind(this);
103
- this.panmove = this.panmove.bind(this);
104
- this.panend = this.panend.bind(this);
105
- this.pinchstart = this.pinchstart.bind(this);
106
- this.pinchmove = this.pinchmove.bind(this);
107
- this.pinchend = this.pinchend.bind(this);
108
- if (events) {
109
- this.bind(events);
110
- }
111
- }
112
- tap(e) {
113
- this.trigger('tap', e);
114
- }
115
- press(e) {
116
- this.trigger('press', e);
117
- }
118
- panstart(e) {
119
- delete this.previous;
120
- this.previous = this.trigger('start', e);
121
- }
122
- panmove(e) {
123
- this.previous = this.trigger('move', e);
124
- }
125
- panend(e) {
126
- this.trigger('end', e);
127
- delete this.previous;
128
- }
129
- pinchstart(e) {
130
- this.trigger('gesturestart', e);
131
- }
132
- pinchmove(e) {
133
- this.trigger('gesturechange', e);
134
- }
135
- pinchend(e) {
136
- this.trigger('gestureend', e);
137
- }
138
- trigger(name, e) {
139
- const args = eventArgs(e, this.previous);
140
- if (this.eventHandlers[name]) {
141
- this.eventHandlers[name](args);
142
- }
143
- return args;
144
- }
145
- bind(events = {}) {
146
- this.unbind();
147
- this.eventHandlers = events;
148
- for (let idx = 0; idx < eventGroups.length; idx++) {
149
- const eventGroup = eventGroups[idx];
150
- const groupNames = Object.keys(eventGroup);
151
- if (shouldBindGroup(groupNames, events)) {
152
- for (let nameIdx = 0; nameIdx < groupNames.length; nameIdx++) {
153
- const name = eventGroup[groupNames[nameIdx]];
154
- this.hammerInstance.on(name, this[name]);
155
- }
156
- }
157
- }
158
- }
159
- unbind() {
160
- if (this.hammerInstance) {
161
- this.hammerInstance.off();
162
- }
163
- this.eventHandlers = {};
164
- }
165
- destroy() {
166
- if (this.hammerInstance) {
167
- this.hammerInstance.destroy();
168
- delete this.hammerInstance;
169
- }
170
- delete this.eventHandlers;
171
- }
172
- toggleDrag(enable) {
173
- this.toggle('pan', enable);
174
- }
175
- toggleZoom(enable) {
176
- this.toggle('pinch', enable);
177
- }
178
- toggle(recognizer, enable) {
179
- if (this.hammerInstance) {
180
- const instanceRecognizer = this.hammerInstance.get(recognizer);
181
- instanceRecognizer.set({
182
- enable: enable
183
- });
184
- }
185
- }
186
- }
187
-
188
- const MISSING_HAMMER_MESSAGE = 'Hammerjs is not loaded.' +
189
- 'Solution: https://www.telerik.com/kendo-angular-ui/components/knowledge-base/chart-hammerjs-error';
190
- /**
191
- * @hidden
192
- */
193
- class DomEventsBuilder {
194
- static create(element, events) {
195
- if (typeof window !== 'undefined') {
196
- const HAMMER = window.Hammer;
197
- if (!HAMMER) {
198
- if (isDevMode()) {
199
- throw new Error(MISSING_HAMMER_MESSAGE);
200
- }
201
- return;
202
- }
203
- const hammerInstance = new HAMMER(element, {
204
- recognizers: [
205
- [HAMMER.Tap],
206
- [HAMMER.Pan],
207
- [HAMMER.Pinch],
208
- [HAMMER.Press, { time: 0 }]
209
- ]
210
- });
211
- return new DomEvents(hammerInstance, events);
212
- }
213
- }
214
- }
215
-
216
28
  const dateCategoryAxisFormats = DateCategoryAxis.prototype.options.labels.dateFormats;
217
29
  const dateValueAxisFormats = DateValueAxis.prototype.options.labels.dateFormats;
218
30
  const dateFormats = {
@@ -227,7 +39,6 @@ const dateFormats = {
227
39
  };
228
40
  Object.assign(dateCategoryAxisFormats, dateFormats);
229
41
  Object.assign(dateValueAxisFormats, dateFormats);
230
- DomEventsBuilder$1.register(DomEventsBuilder);
231
42
 
232
43
  /**
233
44
  * A directive which selects a [template](link:site.data.urls.angular['templatesyntax'])
@@ -1876,8 +1687,8 @@ const packageMetadata = {
1876
1687
  name: '@progress/kendo-angular-charts',
1877
1688
  productName: 'Kendo UI for Angular',
1878
1689
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
1879
- publishDate: 1718181838,
1880
- version: '16.3.0-develop.1',
1690
+ publishDate: 1718186667,
1691
+ version: '16.3.0-develop.3',
1881
1692
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
1882
1693
  };
1883
1694
 
@@ -3,13 +3,13 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
- import { isDevMode, Directive, Optional, Injectable, SimpleChange, TemplateRef, Component, ChangeDetectionStrategy, Input, ContentChild, ElementRef, ViewChild, ViewChildren, EventEmitter, Output, ContentChildren, LOCALE_ID, Inject, InjectionToken, NgModule, HostBinding, forwardRef } from '@angular/core';
6
+ import { Directive, Optional, Injectable, SimpleChange, TemplateRef, Component, ChangeDetectionStrategy, Input, ContentChild, ElementRef, ViewChild, ViewChildren, EventEmitter, Output, ContentChildren, LOCALE_ID, Inject, isDevMode, InjectionToken, NgModule, HostBinding, forwardRef } from '@angular/core';
7
7
  import * as i9 from '@progress/kendo-angular-common';
8
8
  import { isDocumentAvailable, shouldShowValidationUI, ResizeSensorModule, WatermarkModule, PreventableEvent as PreventableEvent$1, isChanged } from '@progress/kendo-angular-common';
9
9
  import * as i3 from '@progress/kendo-angular-intl';
10
10
  import * as i4 from '@progress/kendo-angular-l10n';
11
11
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
12
- import { DateCategoryAxis, DateValueAxis, DomEventsBuilder as DomEventsBuilder$1, InstanceObserver, chartBaseTheme, Chart, StockChart, Sparkline, Sankey, createSankeyData } from '@progress/kendo-charts';
12
+ import { DateCategoryAxis, DateValueAxis, InstanceObserver, chartBaseTheme, Chart, StockChart, Sparkline, Sankey, createSankeyData } from '@progress/kendo-charts';
13
13
  import { exportImage, exportSVG } from '@progress/kendo-drawing';
14
14
  import { validatePackage } from '@progress/kendo-licensing';
15
15
  import { Subject, BehaviorSubject, combineLatest, Subscription } from 'rxjs';
@@ -25,194 +25,6 @@ import * as i6 from '@progress/kendo-angular-icons';
25
25
  import { IconsModule } from '@progress/kendo-angular-icons';
26
26
  import { getter } from '@progress/kendo-common';
27
27
 
28
- const getTouch = (domEvent) => {
29
- return {
30
- x: {
31
- location: domEvent.pageX
32
- },
33
- y: {
34
- location: domEvent.pageY
35
- }
36
- };
37
- };
38
- const eventArgs = (e, previousArgs) => {
39
- const pointers = e.pointers;
40
- const pointer = pointers[0];
41
- const xLocation = pointer.pageX;
42
- const yLocation = pointer.pageY;
43
- let distance = 0;
44
- if (pointers.length > 1) {
45
- const pointer1 = pointers[0];
46
- const pointer2 = pointers[1];
47
- distance = Math.sqrt(Math.pow(pointer1.pageX - pointer2.pageX, 2) + Math.pow(pointer1.pageY - pointer2.pageY, 2));
48
- }
49
- return {
50
- distance: distance,
51
- event: e.srcEvent,
52
- preventDefault: function () {
53
- e.preventDefault();
54
- },
55
- target: e.target,
56
- touches: pointers.map(getTouch),
57
- type: e.type,
58
- x: {
59
- delta: previousArgs ? xLocation - previousArgs.x.location : 0,
60
- initialDelta: e.deltaX,
61
- location: xLocation,
62
- startLocation: xLocation - e.deltaX
63
- },
64
- y: {
65
- delta: previousArgs ? yLocation - previousArgs.y.location : 0,
66
- initialDelta: e.deltaY,
67
- location: yLocation,
68
- startLocation: yLocation - e.deltaY
69
- }
70
- };
71
- };
72
- function shouldBindGroup(groupNames, events) {
73
- for (let idx = 0; idx < groupNames.length; idx++) {
74
- if (events[groupNames[idx]]) {
75
- return true;
76
- }
77
- }
78
- return false;
79
- }
80
- const eventGroups = [{
81
- end: 'panend',
82
- move: 'panmove',
83
- start: 'panstart'
84
- }, {
85
- gesturechange: 'pinchmove',
86
- gestureend: 'pinchend',
87
- gesturestart: 'pinchstart'
88
- }, {
89
- press: 'press'
90
- }, {
91
- tap: 'tap'
92
- }];
93
- /**
94
- * @hidden
95
- */
96
- class DomEvents {
97
- constructor(hammerInstance, events) {
98
- this.hammerInstance = hammerInstance;
99
- this.eventHandlers = {};
100
- this.tap = this.tap.bind(this);
101
- this.press = this.press.bind(this);
102
- this.panstart = this.panstart.bind(this);
103
- this.panmove = this.panmove.bind(this);
104
- this.panend = this.panend.bind(this);
105
- this.pinchstart = this.pinchstart.bind(this);
106
- this.pinchmove = this.pinchmove.bind(this);
107
- this.pinchend = this.pinchend.bind(this);
108
- if (events) {
109
- this.bind(events);
110
- }
111
- }
112
- tap(e) {
113
- this.trigger('tap', e);
114
- }
115
- press(e) {
116
- this.trigger('press', e);
117
- }
118
- panstart(e) {
119
- delete this.previous;
120
- this.previous = this.trigger('start', e);
121
- }
122
- panmove(e) {
123
- this.previous = this.trigger('move', e);
124
- }
125
- panend(e) {
126
- this.trigger('end', e);
127
- delete this.previous;
128
- }
129
- pinchstart(e) {
130
- this.trigger('gesturestart', e);
131
- }
132
- pinchmove(e) {
133
- this.trigger('gesturechange', e);
134
- }
135
- pinchend(e) {
136
- this.trigger('gestureend', e);
137
- }
138
- trigger(name, e) {
139
- const args = eventArgs(e, this.previous);
140
- if (this.eventHandlers[name]) {
141
- this.eventHandlers[name](args);
142
- }
143
- return args;
144
- }
145
- bind(events = {}) {
146
- this.unbind();
147
- this.eventHandlers = events;
148
- for (let idx = 0; idx < eventGroups.length; idx++) {
149
- const eventGroup = eventGroups[idx];
150
- const groupNames = Object.keys(eventGroup);
151
- if (shouldBindGroup(groupNames, events)) {
152
- for (let nameIdx = 0; nameIdx < groupNames.length; nameIdx++) {
153
- const name = eventGroup[groupNames[nameIdx]];
154
- this.hammerInstance.on(name, this[name]);
155
- }
156
- }
157
- }
158
- }
159
- unbind() {
160
- if (this.hammerInstance) {
161
- this.hammerInstance.off();
162
- }
163
- this.eventHandlers = {};
164
- }
165
- destroy() {
166
- if (this.hammerInstance) {
167
- this.hammerInstance.destroy();
168
- delete this.hammerInstance;
169
- }
170
- delete this.eventHandlers;
171
- }
172
- toggleDrag(enable) {
173
- this.toggle('pan', enable);
174
- }
175
- toggleZoom(enable) {
176
- this.toggle('pinch', enable);
177
- }
178
- toggle(recognizer, enable) {
179
- if (this.hammerInstance) {
180
- const instanceRecognizer = this.hammerInstance.get(recognizer);
181
- instanceRecognizer.set({
182
- enable: enable
183
- });
184
- }
185
- }
186
- }
187
-
188
- const MISSING_HAMMER_MESSAGE = 'Hammerjs is not loaded.' +
189
- 'Solution: https://www.telerik.com/kendo-angular-ui/components/knowledge-base/chart-hammerjs-error';
190
- /**
191
- * @hidden
192
- */
193
- class DomEventsBuilder {
194
- static create(element, events) {
195
- if (typeof window !== 'undefined') {
196
- const HAMMER = window.Hammer;
197
- if (!HAMMER) {
198
- if (isDevMode()) {
199
- throw new Error(MISSING_HAMMER_MESSAGE);
200
- }
201
- return;
202
- }
203
- const hammerInstance = new HAMMER(element, {
204
- recognizers: [
205
- [HAMMER.Tap],
206
- [HAMMER.Pan],
207
- [HAMMER.Pinch],
208
- [HAMMER.Press, { time: 0 }]
209
- ]
210
- });
211
- return new DomEvents(hammerInstance, events);
212
- }
213
- }
214
- }
215
-
216
28
  const dateCategoryAxisFormats = DateCategoryAxis.prototype.options.labels.dateFormats;
217
29
  const dateValueAxisFormats = DateValueAxis.prototype.options.labels.dateFormats;
218
30
  const dateFormats = {
@@ -227,7 +39,6 @@ const dateFormats = {
227
39
  };
228
40
  Object.assign(dateCategoryAxisFormats, dateFormats);
229
41
  Object.assign(dateValueAxisFormats, dateFormats);
230
- DomEventsBuilder$1.register(DomEventsBuilder);
231
42
 
232
43
  /**
233
44
  * A directive which selects a [template](link:site.data.urls.angular['templatesyntax'])
@@ -2262,8 +2073,8 @@ const packageMetadata = {
2262
2073
  name: '@progress/kendo-angular-charts',
2263
2074
  productName: 'Kendo UI for Angular',
2264
2075
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
2265
- publishDate: 1718181838,
2266
- version: '16.3.0-develop.1',
2076
+ publishDate: 1718186667,
2077
+ version: '16.3.0-develop.3',
2267
2078
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
2268
2079
  };
2269
2080
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-charts",
3
- "version": "16.3.0-develop.1",
3
+ "version": "16.3.0-develop.3",
4
4
  "description": "Kendo UI Charts for Angular - A comprehensive package for creating beautiful and interactive data visualization. Every chart type, stock charts, and sparklines are included.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -47,19 +47,18 @@
47
47
  "@angular/platform-browser": "15 - 18",
48
48
  "@progress/kendo-drawing": "^1.19.0",
49
49
  "@progress/kendo-licensing": "^1.0.2",
50
- "@progress/kendo-angular-common": "16.3.0-develop.1",
51
- "@progress/kendo-angular-intl": "16.3.0-develop.1",
52
- "@progress/kendo-angular-icons": "16.3.0-develop.1",
53
- "@progress/kendo-angular-l10n": "16.3.0-develop.1",
54
- "@progress/kendo-angular-popup": "16.3.0-develop.1",
55
- "@progress/kendo-angular-navigation": "16.3.0-develop.1",
56
- "hammerjs": "^2.0.0",
50
+ "@progress/kendo-angular-common": "16.3.0-develop.3",
51
+ "@progress/kendo-angular-intl": "16.3.0-develop.3",
52
+ "@progress/kendo-angular-icons": "16.3.0-develop.3",
53
+ "@progress/kendo-angular-l10n": "16.3.0-develop.3",
54
+ "@progress/kendo-angular-popup": "16.3.0-develop.3",
55
+ "@progress/kendo-angular-navigation": "16.3.0-develop.3",
57
56
  "rxjs": "^6.5.3 || ^7.0.0"
58
57
  },
59
58
  "dependencies": {
60
59
  "tslib": "^2.3.1",
61
- "@progress/kendo-angular-schematics": "16.3.0-develop.1",
62
- "@progress/kendo-charts": "2.3.0",
60
+ "@progress/kendo-angular-schematics": "16.3.0-develop.3",
61
+ "@progress/kendo-charts": "2.4.0",
63
62
  "@progress/kendo-svg-icons": "^2.0.0"
64
63
  },
65
64
  "schematics": "./schematics/collection.json",
@@ -2,7 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const schematics_1 = require("@angular-devkit/schematics");
4
4
  function default_1(options) {
5
- const finalOptions = Object.assign(Object.assign({}, options), { mainNgModule: 'ChartsModule', package: 'charts', importHammerjs: true });
5
+ const finalOptions = Object.assign(Object.assign({}, options), { mainNgModule: 'ChartsModule', package: 'charts' //package name, e.g grid
6
+ });
6
7
  return (0, schematics_1.externalSchematic)('@progress/kendo-angular-schematics', 'ng-add', finalOptions);
7
8
  }
8
9
  exports.default = default_1;
@@ -1,33 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { isDevMode } from '@angular/core';
6
- import { DomEvents } from './dom-events';
7
- const MISSING_HAMMER_MESSAGE = 'Hammerjs is not loaded.' +
8
- 'Solution: https://www.telerik.com/kendo-angular-ui/components/knowledge-base/chart-hammerjs-error';
9
- /**
10
- * @hidden
11
- */
12
- export class DomEventsBuilder {
13
- static create(element, events) {
14
- if (typeof window !== 'undefined') {
15
- const HAMMER = window.Hammer;
16
- if (!HAMMER) {
17
- if (isDevMode()) {
18
- throw new Error(MISSING_HAMMER_MESSAGE);
19
- }
20
- return;
21
- }
22
- const hammerInstance = new HAMMER(element, {
23
- recognizers: [
24
- [HAMMER.Tap],
25
- [HAMMER.Pan],
26
- [HAMMER.Pinch],
27
- [HAMMER.Press, { time: 0 }]
28
- ]
29
- });
30
- return new DomEvents(hammerInstance, events);
31
- }
32
- }
33
- }
@@ -1,163 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- const getTouch = (domEvent) => {
6
- return {
7
- x: {
8
- location: domEvent.pageX
9
- },
10
- y: {
11
- location: domEvent.pageY
12
- }
13
- };
14
- };
15
- const eventArgs = (e, previousArgs) => {
16
- const pointers = e.pointers;
17
- const pointer = pointers[0];
18
- const xLocation = pointer.pageX;
19
- const yLocation = pointer.pageY;
20
- let distance = 0;
21
- if (pointers.length > 1) {
22
- const pointer1 = pointers[0];
23
- const pointer2 = pointers[1];
24
- distance = Math.sqrt(Math.pow(pointer1.pageX - pointer2.pageX, 2) + Math.pow(pointer1.pageY - pointer2.pageY, 2));
25
- }
26
- return {
27
- distance: distance,
28
- event: e.srcEvent,
29
- preventDefault: function () {
30
- e.preventDefault();
31
- },
32
- target: e.target,
33
- touches: pointers.map(getTouch),
34
- type: e.type,
35
- x: {
36
- delta: previousArgs ? xLocation - previousArgs.x.location : 0,
37
- initialDelta: e.deltaX,
38
- location: xLocation,
39
- startLocation: xLocation - e.deltaX
40
- },
41
- y: {
42
- delta: previousArgs ? yLocation - previousArgs.y.location : 0,
43
- initialDelta: e.deltaY,
44
- location: yLocation,
45
- startLocation: yLocation - e.deltaY
46
- }
47
- };
48
- };
49
- function shouldBindGroup(groupNames, events) {
50
- for (let idx = 0; idx < groupNames.length; idx++) {
51
- if (events[groupNames[idx]]) {
52
- return true;
53
- }
54
- }
55
- return false;
56
- }
57
- const eventGroups = [{
58
- end: 'panend',
59
- move: 'panmove',
60
- start: 'panstart'
61
- }, {
62
- gesturechange: 'pinchmove',
63
- gestureend: 'pinchend',
64
- gesturestart: 'pinchstart'
65
- }, {
66
- press: 'press'
67
- }, {
68
- tap: 'tap'
69
- }];
70
- /**
71
- * @hidden
72
- */
73
- export class DomEvents {
74
- constructor(hammerInstance, events) {
75
- this.hammerInstance = hammerInstance;
76
- this.eventHandlers = {};
77
- this.tap = this.tap.bind(this);
78
- this.press = this.press.bind(this);
79
- this.panstart = this.panstart.bind(this);
80
- this.panmove = this.panmove.bind(this);
81
- this.panend = this.panend.bind(this);
82
- this.pinchstart = this.pinchstart.bind(this);
83
- this.pinchmove = this.pinchmove.bind(this);
84
- this.pinchend = this.pinchend.bind(this);
85
- if (events) {
86
- this.bind(events);
87
- }
88
- }
89
- tap(e) {
90
- this.trigger('tap', e);
91
- }
92
- press(e) {
93
- this.trigger('press', e);
94
- }
95
- panstart(e) {
96
- delete this.previous;
97
- this.previous = this.trigger('start', e);
98
- }
99
- panmove(e) {
100
- this.previous = this.trigger('move', e);
101
- }
102
- panend(e) {
103
- this.trigger('end', e);
104
- delete this.previous;
105
- }
106
- pinchstart(e) {
107
- this.trigger('gesturestart', e);
108
- }
109
- pinchmove(e) {
110
- this.trigger('gesturechange', e);
111
- }
112
- pinchend(e) {
113
- this.trigger('gestureend', e);
114
- }
115
- trigger(name, e) {
116
- const args = eventArgs(e, this.previous);
117
- if (this.eventHandlers[name]) {
118
- this.eventHandlers[name](args);
119
- }
120
- return args;
121
- }
122
- bind(events = {}) {
123
- this.unbind();
124
- this.eventHandlers = events;
125
- for (let idx = 0; idx < eventGroups.length; idx++) {
126
- const eventGroup = eventGroups[idx];
127
- const groupNames = Object.keys(eventGroup);
128
- if (shouldBindGroup(groupNames, events)) {
129
- for (let nameIdx = 0; nameIdx < groupNames.length; nameIdx++) {
130
- const name = eventGroup[groupNames[nameIdx]];
131
- this.hammerInstance.on(name, this[name]);
132
- }
133
- }
134
- }
135
- }
136
- unbind() {
137
- if (this.hammerInstance) {
138
- this.hammerInstance.off();
139
- }
140
- this.eventHandlers = {};
141
- }
142
- destroy() {
143
- if (this.hammerInstance) {
144
- this.hammerInstance.destroy();
145
- delete this.hammerInstance;
146
- }
147
- delete this.eventHandlers;
148
- }
149
- toggleDrag(enable) {
150
- this.toggle('pan', enable);
151
- }
152
- toggleZoom(enable) {
153
- this.toggle('pinch', enable);
154
- }
155
- toggle(recognizer, enable) {
156
- if (this.hammerInstance) {
157
- const instanceRecognizer = this.hammerInstance.get(recognizer);
158
- instanceRecognizer.set({
159
- enable: enable
160
- });
161
- }
162
- }
163
- }
@@ -1,11 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { DomEvents } from './dom-events';
6
- /**
7
- * @hidden
8
- */
9
- export declare class DomEventsBuilder {
10
- static create(element: HTMLElement, events: any): DomEvents;
11
- }
@@ -1,28 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export declare class DomEvents {
9
- private hammerInstance;
10
- private eventHandlers;
11
- private previous;
12
- constructor(hammerInstance: any, events: any);
13
- tap(e: any): void;
14
- press(e: any): void;
15
- panstart(e: any): void;
16
- panmove(e: any): void;
17
- panend(e: any): void;
18
- pinchstart(e: any): void;
19
- pinchmove(e: any): void;
20
- pinchend(e: any): void;
21
- trigger(name: string, e: any): any;
22
- bind(events?: any): void;
23
- unbind(): void;
24
- destroy(): void;
25
- toggleDrag(enable: boolean): void;
26
- toggleZoom(enable: boolean): void;
27
- private toggle;
28
- }