@progress/kendo-charts 1.33.0-dev.202311231312 → 1.33.0-dev.202312010652

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.
@@ -335,7 +335,7 @@ var CategoricalChart = (function (ChartElement) {
335
335
  excluded: [
336
336
  "data", "aggregate", "_events", "tooltip", "content", "template",
337
337
  "visual", "toggle", "_outOfRangeMinPoint", "_outOfRangeMaxPoint",
338
- "drilldownSeriesFactory", "ariaTemplate"
338
+ "drilldownSeriesFactory", "ariaTemplate", "ariaContent"
339
339
  ]
340
340
  };
341
341
 
@@ -37,6 +37,7 @@ import './register-charts';
37
37
 
38
38
  var AXIS_NAMES = [ CATEGORY, VALUE, X, Y ];
39
39
 
40
+ var MOUSEDOWN = "mousedown";
40
41
  var MOUSEMOVE = "mousemove";
41
42
  var CONTEXTMENU = "contextmenu";
42
43
  var MOUSELEAVE = "mouseleave";
@@ -570,6 +571,7 @@ var Chart = (function (Class) {
570
571
  this._keydownHandler = this._keydown.bind(this);
571
572
  this._focusHandler = this._focus.bind(this);
572
573
  this._blurHandler = this._blur.bind(this);
574
+ this._mousedownHandler = this._mousedown.bind(this);
573
575
  this._mousewheelHandler = this._mousewheel.bind(this);
574
576
  this._mouseleaveHandler = this._mouseleave.bind(this);
575
577
  this._surfaceMouseenterHandler = this._mouseover.bind(this);
@@ -639,7 +641,7 @@ var Chart = (function (Class) {
639
641
 
640
642
  this._touchAction = element.style.touchAction;
641
643
 
642
- bindEvents(element, ( obj = {}, obj[ CONTEXTMENU ] = this._clickHandler, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj[ MOUSELEAVE ] = this._mouseleaveHandler, obj[ KEYDOWN ] = this._keydownHandler, obj[ FOCUS ] = this._focusHandler, obj[ BLUR] = this._blurHandler, obj ));
644
+ bindEvents(element, ( obj = {}, obj[ CONTEXTMENU ] = this._clickHandler, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj[ MOUSELEAVE ] = this._mouseleaveHandler, obj[ KEYDOWN ] = this._keydownHandler, obj[ MOUSEDOWN ] = this._mousedownHandler, obj[ FOCUS ] = this._focusHandler, obj[ BLUR] = this._blurHandler, obj ));
643
645
 
644
646
  if (this._shouldAttachMouseMove()) {
645
647
  bindEvents(element, ( obj$1 = {}, obj$1[ MOUSEMOVE ] = this._mousemove, obj$1 ));
@@ -1115,6 +1117,8 @@ var Chart = (function (Class) {
1115
1117
  this._focusFirstPoint();
1116
1118
  }
1117
1119
  }
1120
+
1121
+ this._preventInitialPointFocus = false;
1118
1122
  };
1119
1123
 
1120
1124
  Chart.prototype._keydown = function _keydown (e) {
@@ -1229,11 +1233,20 @@ var Chart = (function (Class) {
1229
1233
  }
1230
1234
  };
1231
1235
 
1236
+ Chart.prototype._hasFocus = function _hasFocus () {
1237
+ return this.element.ownerDocument.activeElement === this.element;
1238
+ };
1239
+
1240
+ Chart.prototype._mousedown = function _mousedown () {
1241
+ if (!this._hasFocus()) {
1242
+ this._preventInitialPointFocus = true;
1243
+ }
1244
+ };
1245
+
1232
1246
  Chart.prototype._focusChart = function _focusChart () {
1233
- if (document.activeElement !== this.element) {
1247
+ if (!this._hasFocus()) {
1234
1248
  this._preventInitialPointFocus = true;
1235
1249
  this.element.focus();
1236
- this._preventInitialPointFocus = false;
1237
1250
  }
1238
1251
  };
1239
1252
 
@@ -87,7 +87,10 @@ var FunnelChart = (function (ChartElement) {
87
87
  series: series,
88
88
  dataItem: fields.dataItem,
89
89
  index: fields.index
90
- }, { defaults: series._defaults, excluded: [ "data", "content", "template", "toggle", "visual", "ariaTemplate" ] });
90
+ }, { defaults: series._defaults, excluded: [
91
+ "data", "content", "template", "toggle", "visual",
92
+ "ariaTemplate", "ariaContent"
93
+ ] });
91
94
  };
92
95
 
93
96
  FunnelChart.prototype.createSegment = function createSegment (value, fields) {
@@ -72,7 +72,7 @@ var HeatmapChart = (function (ChartElement) {
72
72
  excluded: [
73
73
  "data", "tooltip", "content", "template",
74
74
  "visual", "toggle", "drilldownSeriesFactory",
75
- "ariaTemplate"
75
+ "ariaTemplate", "ariaContent"
76
76
  ]
77
77
  };
78
78
 
@@ -7,8 +7,7 @@ import NoteMixin from '../mixins/note-mixin';
7
7
  import { LINE_MARKER_SIZE, FADEIN, INITIAL_ANIMATION_DURATION, BORDER_BRIGHTNESS, TOOLTIP_OFFSET, ABOVE, BELOW, CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
8
8
 
9
9
  import { WHITE, CIRCLE, CENTER, TOP, BOTTOM, LEFT, HIGHLIGHT_ZINDEX } from '../../common/constants';
10
- import { deepExtend, defined, getTemplate, valueOrDefault, getSpacing } from '../../common';
11
- import TemplateService from '../../services/template-service';
10
+ import { deepExtend, defined, getTemplate, getAriaTemplate, valueOrDefault, getSpacing } from '../../common';
12
11
  import guid from '../../core/utils/guid';
13
12
 
14
13
  var LinePoint = (function (ChartElement) {
@@ -87,9 +86,10 @@ var LinePoint = (function (ChartElement) {
87
86
 
88
87
  LinePoint.prototype.getAriaLabelText = function getAriaLabelText () {
89
88
  var labels = this.options.labels;
89
+ var ariaTemplate = getAriaTemplate(labels);
90
90
 
91
- if (labels.ariaTemplate) {
92
- return TemplateService.compile(labels.ariaTemplate)(this.pointData());
91
+ if (ariaTemplate) {
92
+ return ariaTemplate(this.pointData());
93
93
  }
94
94
 
95
95
  return this.getLabelText(labels);
@@ -1,7 +1,6 @@
1
1
  import addAccessibilityAttributesToVisual from "../../core/utils/add-accessibility-attributes-to-visual";
2
- import { deepExtend } from "../../common";
2
+ import { deepExtend, getAriaTemplate } from "../../common";
3
3
  import guid from '../../core/utils/guid';
4
- import TemplateService from "../../services/template-service";
5
4
 
6
5
  var AccessibilityAttributesMixin = {
7
6
  addAccessibilityAttributesToVisual: function() {
@@ -12,9 +11,10 @@ var AccessibilityAttributesMixin = {
12
11
 
13
12
  getAriaLabelText: function getAriaLabelText() {
14
13
  var labels = this.options.labels;
14
+ var ariaTemplate = getAriaTemplate(labels);
15
15
 
16
- if (labels.ariaTemplate) {
17
- return TemplateService.compile(labels.ariaTemplate)(this.pointData());
16
+ if (ariaTemplate) {
17
+ return ariaTemplate(this.pointData());
18
18
  }
19
19
 
20
20
  return this.getLabelText(labels);
@@ -33,4 +33,4 @@ var AccessibilityAttributesMixin = {
33
33
  }
34
34
  };
35
35
 
36
- export default AccessibilityAttributesMixin;
36
+ export default AccessibilityAttributesMixin;
@@ -114,7 +114,10 @@ var PieChart = (function (ChartElement) {
114
114
  dataItem: fields.dataItem,
115
115
  category: fields.category,
116
116
  percentage: fields.percentage
117
- }, { defaults: series._defaults, excluded: [ "data", "content", "template", "visual", "toggle", "ariaTemplate" ] });
117
+ }, { defaults: series._defaults, excluded: [
118
+ "data", "content", "template", "visual", "toggle",
119
+ "ariaTemplate", "ariaContent"
120
+ ] });
118
121
  };
119
122
 
120
123
  PieChart.prototype.addValue = function addValue (value, sector, fields) {
@@ -172,7 +172,7 @@ var ScatterChart = (function (ChartElement) {
172
172
  excluded: [
173
173
  "data", "tooltip", "content", "template", "visual", "toggle",
174
174
  "_outOfRangeMinPoint", "_outOfRangeMaxPoint",
175
- "drilldownSeriesFactory", "ariaTemplate"
175
+ "drilldownSeriesFactory", "ariaTemplate", "ariaContent"
176
176
  ]
177
177
  };
178
178
 
@@ -0,0 +1,15 @@
1
+ import TemplateService from '../services/template-service';
2
+ import isFunction from './is-function';
3
+
4
+ export default function getTemplate(options) {
5
+ if ( options === void 0 ) options = {};
6
+
7
+ var ariaTemplate;
8
+ if (options.ariaTemplate) {
9
+ options.ariaTemplate = ariaTemplate = TemplateService.compile(options.ariaTemplate);
10
+ } else if (isFunction(options.ariaContent)) {
11
+ ariaTemplate = options.ariaContent;
12
+ }
13
+
14
+ return ariaTemplate;
15
+ }
package/dist/es/common.js CHANGED
@@ -10,6 +10,7 @@ export { default as deepExtend } from './common/deep-extend';
10
10
  export { default as elementStyles } from './common/element-styles';
11
11
  export { default as getSpacing } from './common/get-spacing';
12
12
  export { default as getTemplate } from './common/get-template';
13
+ export { default as getAriaTemplate } from './common/get-aria-template';
13
14
  export { default as getter } from './common/getter';
14
15
  export { default as grep } from './common/grep';
15
16
  export { default as hasClasses } from './common/has-classes';
@@ -316,7 +316,7 @@ class CategoricalChart extends ChartElement {
316
316
  excluded: [
317
317
  "data", "aggregate", "_events", "tooltip", "content", "template",
318
318
  "visual", "toggle", "_outOfRangeMinPoint", "_outOfRangeMaxPoint",
319
- "drilldownSeriesFactory", "ariaTemplate"
319
+ "drilldownSeriesFactory", "ariaTemplate", "ariaContent"
320
320
  ]
321
321
  };
322
322
 
@@ -37,6 +37,7 @@ import './register-charts';
37
37
 
38
38
  const AXIS_NAMES = [ CATEGORY, VALUE, X, Y ];
39
39
 
40
+ const MOUSEDOWN = "mousedown";
40
41
  const MOUSEMOVE = "mousemove";
41
42
  const CONTEXTMENU = "contextmenu";
42
43
  const MOUSELEAVE = "mouseleave";
@@ -557,6 +558,7 @@ class Chart extends Class {
557
558
  this._keydownHandler = this._keydown.bind(this);
558
559
  this._focusHandler = this._focus.bind(this);
559
560
  this._blurHandler = this._blur.bind(this);
561
+ this._mousedownHandler = this._mousedown.bind(this);
560
562
  this._mousewheelHandler = this._mousewheel.bind(this);
561
563
  this._mouseleaveHandler = this._mouseleave.bind(this);
562
564
  this._surfaceMouseenterHandler = this._mouseover.bind(this);
@@ -627,6 +629,7 @@ class Chart extends Class {
627
629
  [ MOUSEWHEEL ]: this._mousewheelHandler,
628
630
  [ MOUSELEAVE ]: this._mouseleaveHandler,
629
631
  [ KEYDOWN ]: this._keydownHandler,
632
+ [ MOUSEDOWN ]: this._mousedownHandler,
630
633
  [ FOCUS ]: this._focusHandler,
631
634
  [ BLUR]: this._blurHandler
632
635
  });
@@ -1093,6 +1096,8 @@ class Chart extends Class {
1093
1096
  this._focusFirstPoint();
1094
1097
  }
1095
1098
  }
1099
+
1100
+ this._preventInitialPointFocus = false;
1096
1101
  }
1097
1102
 
1098
1103
  _keydown(e) {
@@ -1197,11 +1202,20 @@ class Chart extends Class {
1197
1202
  }
1198
1203
  }
1199
1204
 
1205
+ _hasFocus() {
1206
+ return this.element.ownerDocument.activeElement === this.element;
1207
+ }
1208
+
1209
+ _mousedown() {
1210
+ if (!this._hasFocus()) {
1211
+ this._preventInitialPointFocus = true;
1212
+ }
1213
+ }
1214
+
1200
1215
  _focusChart() {
1201
- if (document.activeElement !== this.element) {
1216
+ if (!this._hasFocus()) {
1202
1217
  this._preventInitialPointFocus = true;
1203
1218
  this.element.focus();
1204
- this._preventInitialPointFocus = false;
1205
1219
  }
1206
1220
  }
1207
1221
 
@@ -77,7 +77,10 @@ class FunnelChart extends ChartElement {
77
77
  series: series,
78
78
  dataItem: fields.dataItem,
79
79
  index: fields.index
80
- }, { defaults: series._defaults, excluded: [ "data", "content", "template", "toggle", "visual", "ariaTemplate" ] });
80
+ }, { defaults: series._defaults, excluded: [
81
+ "data", "content", "template", "toggle", "visual",
82
+ "ariaTemplate", "ariaContent"
83
+ ] });
81
84
  }
82
85
 
83
86
  createSegment(value, fields) {
@@ -63,7 +63,7 @@ class HeatmapChart extends ChartElement {
63
63
  excluded: [
64
64
  "data", "tooltip", "content", "template",
65
65
  "visual", "toggle", "drilldownSeriesFactory",
66
- "ariaTemplate"
66
+ "ariaTemplate", "ariaContent"
67
67
  ]
68
68
  };
69
69
 
@@ -7,8 +7,7 @@ import NoteMixin from '../mixins/note-mixin';
7
7
  import { LINE_MARKER_SIZE, FADEIN, INITIAL_ANIMATION_DURATION, BORDER_BRIGHTNESS, TOOLTIP_OFFSET, ABOVE, BELOW, CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
8
8
 
9
9
  import { WHITE, CIRCLE, CENTER, TOP, BOTTOM, LEFT, HIGHLIGHT_ZINDEX } from '../../common/constants';
10
- import { deepExtend, defined, getTemplate, valueOrDefault, getSpacing } from '../../common';
11
- import TemplateService from '../../services/template-service';
10
+ import { deepExtend, defined, getTemplate, getAriaTemplate, valueOrDefault, getSpacing } from '../../common';
12
11
  import guid from '../../core/utils/guid';
13
12
 
14
13
  class LinePoint extends ChartElement {
@@ -82,9 +81,10 @@ class LinePoint extends ChartElement {
82
81
 
83
82
  getAriaLabelText() {
84
83
  const labels = this.options.labels;
84
+ const ariaTemplate = getAriaTemplate(labels);
85
85
 
86
- if (labels.ariaTemplate) {
87
- return TemplateService.compile(labels.ariaTemplate)(this.pointData());
86
+ if (ariaTemplate) {
87
+ return ariaTemplate(this.pointData());
88
88
  }
89
89
 
90
90
  return this.getLabelText(labels);
@@ -1,7 +1,6 @@
1
1
  import addAccessibilityAttributesToVisual from "../../core/utils/add-accessibility-attributes-to-visual";
2
- import { deepExtend } from "../../common";
2
+ import { deepExtend, getAriaTemplate } from "../../common";
3
3
  import guid from '../../core/utils/guid';
4
- import TemplateService from "../../services/template-service";
5
4
 
6
5
  const AccessibilityAttributesMixin = {
7
6
  addAccessibilityAttributesToVisual: function() {
@@ -12,9 +11,10 @@ const AccessibilityAttributesMixin = {
12
11
 
13
12
  getAriaLabelText() {
14
13
  const labels = this.options.labels;
14
+ const ariaTemplate = getAriaTemplate(labels);
15
15
 
16
- if (labels.ariaTemplate) {
17
- return TemplateService.compile(labels.ariaTemplate)(this.pointData());
16
+ if (ariaTemplate) {
17
+ return ariaTemplate(this.pointData());
18
18
  }
19
19
 
20
20
  return this.getLabelText(labels);
@@ -33,4 +33,4 @@ const AccessibilityAttributesMixin = {
33
33
  }
34
34
  };
35
35
 
36
- export default AccessibilityAttributesMixin;
36
+ export default AccessibilityAttributesMixin;
@@ -101,7 +101,10 @@ class PieChart extends ChartElement {
101
101
  dataItem: fields.dataItem,
102
102
  category: fields.category,
103
103
  percentage: fields.percentage
104
- }, { defaults: series._defaults, excluded: [ "data", "content", "template", "visual", "toggle", "ariaTemplate" ] });
104
+ }, { defaults: series._defaults, excluded: [
105
+ "data", "content", "template", "visual", "toggle",
106
+ "ariaTemplate", "ariaContent"
107
+ ] });
105
108
  }
106
109
 
107
110
  addValue(value, sector, fields) {
@@ -161,7 +161,7 @@ class ScatterChart extends ChartElement {
161
161
  excluded: [
162
162
  "data", "tooltip", "content", "template", "visual", "toggle",
163
163
  "_outOfRangeMinPoint", "_outOfRangeMaxPoint",
164
- "drilldownSeriesFactory", "ariaTemplate"
164
+ "drilldownSeriesFactory", "ariaTemplate", "ariaContent"
165
165
  ]
166
166
  };
167
167
 
@@ -0,0 +1,13 @@
1
+ import TemplateService from '../services/template-service';
2
+ import isFunction from './is-function';
3
+
4
+ export default function getTemplate(options = {}) {
5
+ let ariaTemplate;
6
+ if (options.ariaTemplate) {
7
+ options.ariaTemplate = ariaTemplate = TemplateService.compile(options.ariaTemplate);
8
+ } else if (isFunction(options.ariaContent)) {
9
+ ariaTemplate = options.ariaContent;
10
+ }
11
+
12
+ return ariaTemplate;
13
+ }
@@ -10,6 +10,7 @@ export { default as deepExtend } from './common/deep-extend';
10
10
  export { default as elementStyles } from './common/element-styles';
11
11
  export { default as getSpacing } from './common/get-spacing';
12
12
  export { default as getTemplate } from './common/get-template';
13
+ export { default as getAriaTemplate } from './common/get-aria-template';
13
14
  export { default as getter } from './common/getter';
14
15
  export { default as grep } from './common/grep';
15
16
  export { default as hasClasses } from './common/has-classes';