@vaadin/charts 24.7.0-alpha5 → 24.7.0-alpha6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/charts",
3
- "version": "24.7.0-alpha5",
3
+ "version": "24.7.0-alpha6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,14 +36,14 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/component-base": "24.7.0-alpha5",
40
- "@vaadin/vaadin-lumo-styles": "24.7.0-alpha5",
41
- "@vaadin/vaadin-material-styles": "24.7.0-alpha5",
42
- "@vaadin/vaadin-themable-mixin": "24.7.0-alpha5",
39
+ "@vaadin/component-base": "24.7.0-alpha6",
40
+ "@vaadin/vaadin-lumo-styles": "24.7.0-alpha6",
41
+ "@vaadin/vaadin-material-styles": "24.7.0-alpha6",
42
+ "@vaadin/vaadin-themable-mixin": "24.7.0-alpha6",
43
43
  "highcharts": "9.2.2"
44
44
  },
45
45
  "devDependencies": {
46
- "@vaadin/chai-plugins": "24.7.0-alpha5",
46
+ "@vaadin/chai-plugins": "24.7.0-alpha6",
47
47
  "@vaadin/testing-helpers": "^1.1.0",
48
48
  "sinon": "^18.0.0"
49
49
  },
@@ -52,5 +52,5 @@
52
52
  "web-types.json",
53
53
  "web-types.lit.json"
54
54
  ],
55
- "gitHead": "f9fa2bd652780a344d5e0329b8aafbcbd72ebd14"
55
+ "gitHead": "6255a512997a648da91fed37de4d5000809eaebf"
56
56
  }
@@ -166,6 +166,21 @@ export type ChartPointUnselectEvent = CustomEvent<{ point: Point; originalEvent:
166
166
  */
167
167
  export type ChartPointUpdateEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
168
168
 
169
+ /**
170
+ * Fired when starting to drag a point.
171
+ */
172
+ export type ChartPointDragStartEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
173
+
174
+ /**
175
+ * Fired when the point is dropped.
176
+ */
177
+ export type ChartPointDropEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
178
+
179
+ /**
180
+ * Fired while dragging a point.
181
+ */
182
+ export type ChartPointDragEvent = CustomEvent<{ point: Point; originalEvent: ChartPointEvent }>;
183
+
169
184
  /**
170
185
  * Fired when when the minimum and maximum is set for the X axis.
171
186
  */
@@ -245,6 +260,12 @@ export interface ChartCustomEventMap {
245
260
 
246
261
  'point-update': ChartPointUpdateEvent;
247
262
 
263
+ 'point-drag-start': ChartPointDragStartEvent;
264
+
265
+ 'point-drop': ChartPointDropEvent;
266
+
267
+ 'point-drag': ChartPointDragEvent;
268
+
248
269
  'xaxes-extremes-set': ChartXaxesExtremesSetEvent;
249
270
 
250
271
  'yaxes-extremes-set': ChartYaxesExtremesSetEvent;
@@ -404,6 +425,9 @@ export type ChartEventMap = ChartCustomEventMap & HTMLElementEventMap;
404
425
  * @fires {CustomEvent} point-select -Fired when the point is selected either programmatically or by clicking on the point.
405
426
  * @fires {CustomEvent} point-unselect - Fired when the point is unselected either programmatically or by clicking on the point.
406
427
  * @fires {CustomEvent} point-update - Fired when the point is updated programmatically through `.updateConfiguration()` method.
428
+ * @fires {CustomEvent} point-drag-start - Fired when starting to drag a point.
429
+ * @fires {CustomEvent} point-drop - Fired when the point is dropped.
430
+ * @fires {CustomEvent} point-drag - Fired while dragging a point.
407
431
  * @fires {CustomEvent} xaxes-extremes-set - Fired when when the minimum and maximum is set for the X axis.
408
432
  * @fires {CustomEvent} yaxes-extremes-set - Fired when when the minimum and maximum is set for the Y axis.
409
433
  */
@@ -27,6 +27,7 @@ import 'highcharts/es-modules/masters/modules/organization.src.js';
27
27
  import 'highcharts/es-modules/masters/modules/xrange.src.js';
28
28
  import 'highcharts/es-modules/masters/modules/bullet.src.js';
29
29
  import 'highcharts/es-modules/masters/modules/gantt.src.js';
30
+ import 'highcharts/es-modules/masters/modules/draggable-points.src.js';
30
31
  import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
31
32
  import { beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';
32
33
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -250,6 +251,9 @@ Highcharts.setOptions({ lang: { noData: '' } });
250
251
  * @fires {CustomEvent} point-select -Fired when the point is selected either programmatically or by clicking on the point.
251
252
  * @fires {CustomEvent} point-unselect - Fired when the point is unselected either programmatically or by clicking on the point.
252
253
  * @fires {CustomEvent} point-update - Fired when the point is updated programmatically through `.updateConfiguration()` method.
254
+ * @fires {CustomEvent} point-drag-start - Fired when starting to drag a point.
255
+ * @fires {CustomEvent} point-drop - Fired when the point is dropped.
256
+ * @fires {CustomEvent} point-drag - Fired while dragging a point.
253
257
  * @fires {CustomEvent} xaxes-extremes-set - Fired when when the minimum and maximum is set for the X axis.
254
258
  * @fires {CustomEvent} yaxes-extremes-set - Fired when when the minimum and maximum is set for the Y axis.
255
259
  *
@@ -885,6 +889,30 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
885
889
  * @param {Object} point Point object where the event was sent from
886
890
  */
887
891
  update: 'point-update',
892
+
893
+ /**
894
+ * Fired when starting to drag a point.
895
+ * @event point-drag-start
896
+ * @param {Object} detail.originalEvent object with details about the event sent
897
+ * @param {Object} point Point object where the event was sent from
898
+ */
899
+ dragStart: 'point-drag-start',
900
+
901
+ /**
902
+ * Fired when the point is dropped.
903
+ * @event point-drop
904
+ * @param {Object} detail.originalEvent object with details about the event sent
905
+ * @param {Object} point Point object where the event was sent from
906
+ */
907
+ drop: 'point-drop',
908
+
909
+ /**
910
+ * Fired while dragging a point.
911
+ * @event point-drag
912
+ * @param {Object} detail.originalEvent object with details about the event sent
913
+ * @param {Object} point Point object where the event was sent from
914
+ */
915
+ drag: 'point-drag',
888
916
  };
889
917
  }
890
918
 
@@ -1310,11 +1338,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1310
1338
  /** @private */
1311
1339
  __createEventListeners(eventList, configuration, pathToAdd, eventType) {
1312
1340
  const eventObject = this.__ensureObjectPath(configuration, pathToAdd);
1341
+ const self = this;
1313
1342
 
1314
1343
  for (let keys = Object.keys(eventList), i = 0; i < keys.length; i++) {
1315
1344
  const key = keys[i];
1316
1345
  if (!eventObject[key]) {
1317
- eventObject[key] = (event) => {
1346
+ eventObject[key] = function (event) {
1318
1347
  const customEvent = {
1319
1348
  bubbles: false,
1320
1349
  composed: true,
@@ -1324,6 +1353,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1324
1353
  },
1325
1354
  };
1326
1355
 
1356
+ if (key === 'dragStart') {
1357
+ // for dragStart there is no information about point in the
1358
+ // event object. However, 'this' references the point being dragged
1359
+ customEvent.detail[eventType] = this;
1360
+ }
1361
+
1327
1362
  if (event.type === 'afterSetExtremes') {
1328
1363
  if (event.min == null || event.max == null) {
1329
1364
  return;
@@ -1355,17 +1390,17 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1355
1390
  if (['beforePrint', 'beforeExport'].indexOf(event.type) >= 0) {
1356
1391
  // Guard against another print 'before print' event coming before
1357
1392
  // the 'after print' event.
1358
- if (!this.tempBodyStyle) {
1393
+ if (!self.tempBodyStyle) {
1359
1394
  let effectiveCss = '';
1360
1395
 
1361
- [...this.shadowRoot.querySelectorAll('style')].forEach((style) => {
1396
+ [...self.shadowRoot.querySelectorAll('style')].forEach((style) => {
1362
1397
  effectiveCss += style.textContent;
1363
1398
  });
1364
1399
 
1365
1400
  // Strip off host selectors that target individual instances
1366
1401
  effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
1367
1402
  const selector = match.substr(6, match.length - 7);
1368
- return this.matches(selector) ? '' : match;
1403
+ return self.matches(selector) ? '' : match;
1369
1404
  });
1370
1405
 
1371
1406
  // Zoom out a bit to avoid clipping the chart's edge on paper
@@ -1376,10 +1411,10 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1376
1411
  ` zoom: 90%;` + // Webkit
1377
1412
  `}`;
1378
1413
 
1379
- this.tempBodyStyle = document.createElement('style');
1380
- this.tempBodyStyle.textContent = effectiveCss;
1381
- document.body.appendChild(this.tempBodyStyle);
1382
- if (this.options.chart.styledMode) {
1414
+ self.tempBodyStyle = document.createElement('style');
1415
+ self.tempBodyStyle.textContent = effectiveCss;
1416
+ document.body.appendChild(self.tempBodyStyle);
1417
+ if (self.options.chart.styledMode) {
1383
1418
  document.body.setAttribute('styled-mode', '');
1384
1419
  }
1385
1420
  }
@@ -1387,18 +1422,18 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1387
1422
 
1388
1423
  // Hook into afterPrint and afterExport to revert changes made before
1389
1424
  if (['afterPrint', 'afterExport'].indexOf(event.type) >= 0) {
1390
- if (this.tempBodyStyle) {
1391
- document.body.removeChild(this.tempBodyStyle);
1392
- delete this.tempBodyStyle;
1393
- if (this.options.chart.styledMode) {
1425
+ if (self.tempBodyStyle) {
1426
+ document.body.removeChild(self.tempBodyStyle);
1427
+ delete self.tempBodyStyle;
1428
+ if (self.options.chart.styledMode) {
1394
1429
  document.body.removeAttribute('styled-mode');
1395
1430
  }
1396
1431
  }
1397
1432
  }
1398
1433
 
1399
- this.dispatchEvent(new CustomEvent(eventList[key], customEvent));
1434
+ self.dispatchEvent(new CustomEvent(eventList[key], customEvent));
1400
1435
 
1401
- if (event.type === 'legendItemClick' && this._visibilityTogglingDisabled) {
1436
+ if (event.type === 'legendItemClick' && self._visibilityTogglingDisabled) {
1402
1437
  return false;
1403
1438
  }
1404
1439
  };
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "24.7.0-alpha5",
4
+ "version": "24.7.0-alpha6",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -380,6 +380,18 @@
380
380
  "name": "point-click",
381
381
  "description": "Fired when the point is clicked."
382
382
  },
383
+ {
384
+ "name": "point-drag",
385
+ "description": "Fired while dragging a point."
386
+ },
387
+ {
388
+ "name": "point-drag-start",
389
+ "description": "Fired when starting to drag a point."
390
+ },
391
+ {
392
+ "name": "point-drop",
393
+ "description": "Fired when the point is dropped."
394
+ },
383
395
  {
384
396
  "name": "point-legend-item-click",
385
397
  "description": "Fired when the legend item belonging to the point is clicked."
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/charts",
4
- "version": "24.7.0-alpha5",
4
+ "version": "24.7.0-alpha6",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -222,6 +222,27 @@
222
222
  "kind": "expression"
223
223
  }
224
224
  },
225
+ {
226
+ "name": "@point-drag",
227
+ "description": "Fired while dragging a point.",
228
+ "value": {
229
+ "kind": "expression"
230
+ }
231
+ },
232
+ {
233
+ "name": "@point-drag-start",
234
+ "description": "Fired when starting to drag a point.",
235
+ "value": {
236
+ "kind": "expression"
237
+ }
238
+ },
239
+ {
240
+ "name": "@point-drop",
241
+ "description": "Fired when the point is dropped.",
242
+ "value": {
243
+ "kind": "expression"
244
+ }
245
+ },
225
246
  {
226
247
  "name": "@point-legend-item-click",
227
248
  "description": "Fired when the legend item belonging to the point is clicked.",