@progress/kendo-charts 1.19.1 → 1.20.0-dev.202111121622

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.
Files changed (61) hide show
  1. package/dist/cdn/js/kendo-charts.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/chart/chart.js +15 -6
  4. package/dist/es/chart/constants.js +3 -1
  5. package/dist/es/chart/pan-and-zoom/mousewheel-zoom.js +8 -4
  6. package/dist/es/chart/selection.js +41 -1
  7. package/dist/es/common/mousewheel-delta.js +4 -7
  8. package/dist/es/core/axis.js +47 -0
  9. package/dist/es/core/category-axis.js +62 -20
  10. package/dist/es/core/date-category-axis.js +26 -38
  11. package/dist/es/core/date-value-axis.js +37 -40
  12. package/dist/es/core/logarithmic-axis.js +62 -88
  13. package/dist/es/core/numeric-axis.js +57 -81
  14. package/dist/es/main.js +1 -0
  15. package/dist/es/qrcode/encodings/data-modes/alpha-numeric-data-mode.js +103 -0
  16. package/dist/es/qrcode/encodings/data-modes/byte-data-mode.js +51 -0
  17. package/dist/es/qrcode/encodings/data-modes/data-mode-instances.js +12 -0
  18. package/dist/es/qrcode/encodings/data-modes/numeric-data-mode.js +49 -0
  19. package/dist/es/qrcode/encodings/data-modes/qr-data-mode.js +50 -0
  20. package/dist/es/qrcode/encodings/encoders/iso-encoder.js +29 -0
  21. package/dist/es/qrcode/encodings/encoders/utf8-encoder.js +91 -0
  22. package/dist/es/qrcode/encodings/encoding-result.js +16 -0
  23. package/dist/es/qrcode/encodings/encoding.js +701 -0
  24. package/dist/es/qrcode/encodings/free-cell-visitor.js +57 -0
  25. package/dist/es/qrcode/encodings/version-codewords.js +1289 -0
  26. package/dist/es/qrcode/qrcode.js +403 -0
  27. package/dist/es/qrcode/utils.js +28 -0
  28. package/dist/es/qrcode.js +1 -0
  29. package/dist/es/stock/navigator.js +3 -2
  30. package/dist/es2015/chart/chart.js +15 -6
  31. package/dist/es2015/chart/constants.js +3 -1
  32. package/dist/es2015/chart/pan-and-zoom/mousewheel-zoom.js +6 -4
  33. package/dist/es2015/chart/selection.js +40 -1
  34. package/dist/es2015/common/mousewheel-delta.js +4 -7
  35. package/dist/es2015/core/axis.js +39 -0
  36. package/dist/es2015/core/category-axis.js +56 -18
  37. package/dist/es2015/core/date-category-axis.js +27 -36
  38. package/dist/es2015/core/date-value-axis.js +35 -40
  39. package/dist/es2015/core/logarithmic-axis.js +52 -83
  40. package/dist/es2015/core/numeric-axis.js +47 -78
  41. package/dist/es2015/main.js +1 -0
  42. package/dist/es2015/qrcode/encodings/data-modes/alpha-numeric-data-mode.js +91 -0
  43. package/dist/es2015/qrcode/encodings/data-modes/byte-data-mode.js +41 -0
  44. package/dist/es2015/qrcode/encodings/data-modes/data-mode-instances.js +13 -0
  45. package/dist/es2015/qrcode/encodings/data-modes/numeric-data-mode.js +39 -0
  46. package/dist/es2015/qrcode/encodings/data-modes/qr-data-mode.js +44 -0
  47. package/dist/es2015/qrcode/encodings/encoders/iso-encoder.js +19 -0
  48. package/dist/es2015/qrcode/encodings/encoders/utf8-encoder.js +83 -0
  49. package/dist/es2015/qrcode/encodings/encoding-result.js +10 -0
  50. package/dist/es2015/qrcode/encodings/encoding.js +701 -0
  51. package/dist/es2015/qrcode/encodings/free-cell-visitor.js +49 -0
  52. package/dist/es2015/qrcode/encodings/version-codewords.js +1289 -0
  53. package/dist/es2015/qrcode/qrcode.js +395 -0
  54. package/dist/es2015/qrcode/utils.js +28 -0
  55. package/dist/es2015/qrcode.js +1 -0
  56. package/dist/es2015/stock/navigator.js +3 -2
  57. package/dist/npm/main.d.ts +1 -0
  58. package/dist/npm/main.js +3172 -283
  59. package/dist/npm/qrcode.d.ts +5 -0
  60. package/dist/systemjs/kendo-charts.js +1 -1
  61. package/package.json +1 -1
@@ -7,10 +7,11 @@ import createAxisTick from './utils/create-axis-tick';
7
7
  import createAxisGridLine from './utils/create-axis-grid-line';
8
8
  import limitCoordinate from './utils/limit-coordinate';
9
9
 
10
- import { DEFAULT_PRECISION, BLACK, X, Y } from '../common/constants';
11
- import { deepExtend, defined, inArray, limitValue, round, setDefaultOptions } from '../common';
10
+ import { DEFAULT_PRECISION, BLACK } from '../common/constants';
11
+ import { deepExtend, defined, inArray, limitValue, round, setDefaultOptions, valueOrDefault } from '../common';
12
12
 
13
13
  var DEFAULT_MAJOR_UNIT = 10;
14
+ var MIN_VALUE_RANGE = 1e-6;
14
15
 
15
16
  var LogarithmicAxis = (function (Axis) {
16
17
  function LogarithmicAxis(seriesMin, seriesMax, options, chartService) {
@@ -59,51 +60,37 @@ var LogarithmicAxis = (function (Axis) {
59
60
  var options = ref.options;
60
61
  var logMin = ref.logMin;
61
62
  var logMax = ref.logMax;
62
- var reverse = options.reverse;
63
- var vertical = options.vertical;
64
63
  var base = options.majorUnit;
65
- var valueAxis = vertical ? Y : X;
66
- var lineBox = this.lineBox();
67
- var lineStart = lineBox[valueAxis + (reverse ? 2 : 1)];
68
- var lineSize = vertical ? lineBox.height() : lineBox.width();
69
- var dir = reverse ? -1 : 1;
70
- var step = dir * (lineSize / (logMax - logMin));
71
- var slotBox = new Box(lineBox.x1, lineBox.y1, lineBox.x1, lineBox.y1);
72
- var start = a;
73
- var end = b;
74
-
75
- if (!defined(start)) {
76
- start = end || 1;
77
- }
78
-
79
- if (!defined(end)) {
80
- end = start || 1;
81
- }
64
+ var min = options.min;
65
+ var max = options.max;
66
+ var ref$1 = this.lineInfo();
67
+ var axis = ref$1.axis;
68
+ var axisDir = ref$1.axisDir;
69
+ var lineBox = ref$1.lineBox;
70
+ var lineSize = ref$1.lineSize;
71
+ var lineStart = ref$1.lineStart;
72
+ var step = axisDir * (lineSize / (logMax - logMin));
73
+ var start = valueOrDefault(a, b || 1);
74
+ var end = valueOrDefault(b, a || 1);
82
75
 
83
76
  if (start <= 0 || end <= 0) {
84
77
  return null;
85
78
  }
86
79
 
87
80
  if (limit) {
88
- start = Math.max(Math.min(start, options.max), options.min);
89
- end = Math.max(Math.min(end, options.max), options.min);
81
+ start = limitValue(start, min, max);
82
+ end = limitValue(end, min, max);
90
83
  }
91
84
 
92
85
  start = log(start, base);
93
86
  end = log(end, base);
94
87
 
95
- var p1, p2;
96
-
97
- if (vertical) {
98
- p1 = logMax - Math.max(start, end);
99
- p2 = logMax - Math.min(start, end);
100
- } else {
101
- p1 = Math.min(start, end) - logMin;
102
- p2 = Math.max(start, end) - logMin;
103
- }
88
+ var p1 = Math.min(start, end) - logMin;
89
+ var p2 = Math.max(start, end) - logMin;
104
90
 
105
- slotBox[valueAxis + 1] = limitCoordinate(lineStart + step * (reverse ? p2 : p1));
106
- slotBox[valueAxis + 2] = limitCoordinate(lineStart + step * (reverse ? p1 : p2));
91
+ var slotBox = new Box(lineBox.x1, lineBox.y1, lineBox.x1, lineBox.y1);
92
+ slotBox[axis + 1] = limitCoordinate(lineStart + step * (axisDir > 0 ? p1 : p2));
93
+ slotBox[axis + 2] = limitCoordinate(lineStart + step * (axisDir > 0 ? p2 : p1));
107
94
 
108
95
  return slotBox;
109
96
  };
@@ -113,17 +100,14 @@ var LogarithmicAxis = (function (Axis) {
113
100
  var options = ref.options;
114
101
  var logMin = ref.logMin;
115
102
  var logMax = ref.logMax;
116
- var reverse = options.reverse;
117
- var vertical = options.vertical;
118
103
  var base = options.majorUnit;
119
- var lineBox = this.lineBox();
120
- var dir = vertical === reverse ? 1 : -1;
121
- var startEdge = dir === 1 ? 1 : 2;
122
- var lineSize = vertical ? lineBox.height() : lineBox.width();
104
+ var ref$1 = this.lineInfo();
105
+ var axis = ref$1.axis;
106
+ var axisDir = ref$1.axisDir;
107
+ var lineStart = ref$1.lineStart;
108
+ var lineSize = ref$1.lineSize;
123
109
  var step = ((logMax - logMin) / lineSize);
124
- var valueAxis = vertical ? Y : X;
125
- var lineStart = lineBox[valueAxis + startEdge];
126
- var offset = dir * (point[valueAxis] - lineStart);
110
+ var offset = axisDir * (point[axis] - lineStart);
127
111
  var valueOffset = offset * step;
128
112
 
129
113
  if (offset < 0 || offset > lineSize) {
@@ -140,16 +124,6 @@ var LogarithmicAxis = (function (Axis) {
140
124
  return { min: options.min, max: options.max };
141
125
  };
142
126
 
143
- LogarithmicAxis.prototype.scaleRange = function scaleRange (delta) {
144
- var base = this.options.majorUnit;
145
- var offset = -delta;
146
-
147
- return {
148
- min: Math.pow(base, this.logMin - offset),
149
- max: Math.pow(base, this.logMax + offset)
150
- };
151
- };
152
-
153
127
  LogarithmicAxis.prototype.translateRange = function translateRange (delta) {
154
128
  var ref = this;
155
129
  var options = ref.options;
@@ -259,7 +233,7 @@ var LogarithmicAxis = (function (Axis) {
259
233
  };
260
234
 
261
235
  LogarithmicAxis.prototype.traverseMajorTicksPositions = function traverseMajorTicksPositions (callback, tickOptions) {
262
- var ref = this._lineOptions();
236
+ var ref = this.lineInfo();
263
237
  var lineStart = ref.lineStart;
264
238
  var step = ref.step;
265
239
  var ref$1 = this;
@@ -280,7 +254,7 @@ var LogarithmicAxis = (function (Axis) {
280
254
  var max = ref.max;
281
255
  var minorUnit = ref.minorUnit;
282
256
  var base = ref.majorUnit;
283
- var ref$1 = this._lineOptions();
257
+ var ref$1 = this.lineInfo();
284
258
  var lineStart = ref$1.lineStart;
285
259
  var step = ref$1.step;
286
260
  var ref$2 = this;
@@ -333,24 +307,36 @@ var LogarithmicAxis = (function (Axis) {
333
307
  };
334
308
  };
335
309
 
336
- LogarithmicAxis.prototype.zoomRange = function zoomRange (delta) {
310
+ LogarithmicAxis.prototype.scaleRange = function scaleRange (scale, cursor) {
311
+ var ref = this.options;
312
+ var base = ref.majorUnit;
313
+ var logMin = log(this.options.min, base);
314
+ var logMax = log(this.options.max, base);
315
+ var position = Math.abs(this.pointOffset(cursor));
316
+ var delta = (logMax - logMin) * Math.min(1, scale);
317
+ var min = Math.pow(base, logMin + position * delta);
318
+ var max = Math.pow(base, logMax - (1 - position) * delta);
319
+
320
+ if (max - min < MIN_VALUE_RANGE) {
321
+ max = min + MIN_VALUE_RANGE;
322
+ }
323
+
324
+ return {
325
+ min: min,
326
+ max: max
327
+ };
328
+ };
329
+
330
+ LogarithmicAxis.prototype.zoomRange = function zoomRange (scale, cursor) {
331
+ var range = this.scaleRange(scale, cursor);
337
332
  var ref = this;
338
- var options = ref.options;
339
333
  var totalMin = ref.totalMin;
340
334
  var totalMax = ref.totalMax;
341
- var newRange = this.scaleRange(delta);
342
- var min = limitValue(newRange.min, totalMin, totalMax);
343
- var max = limitValue(newRange.max, totalMin, totalMax);
344
- var base = options.majorUnit;
345
- var acceptOptionsRange = max > min && options.min && options.max && (round(log(options.max, base) - log(options.min, base), DEFAULT_PRECISION) < 1);
346
- var acceptNewRange = !(options.min === totalMin && options.max === totalMax) && round(log(max, base) - log(min, base), DEFAULT_PRECISION) >= 1;
347
-
348
- if (acceptOptionsRange || acceptNewRange) {
349
- return {
350
- min: min,
351
- max: max
352
- };
353
- }
335
+
336
+ return {
337
+ min: limitValue(range.min, totalMin, totalMax),
338
+ max: limitValue(range.max, totalMin, totalMax)
339
+ };
354
340
  };
355
341
 
356
342
  LogarithmicAxis.prototype._minorIntervalOptions = function _minorIntervalOptions (power) {
@@ -368,23 +354,11 @@ var LogarithmicAxis = (function (Axis) {
368
354
  };
369
355
  };
370
356
 
371
- LogarithmicAxis.prototype._lineOptions = function _lineOptions () {
372
- var ref = this.options;
373
- var reverse = ref.reverse;
374
- var vertical = ref.vertical;
375
- var valueAxis = vertical ? Y : X;
376
- var lineBox = this.lineBox();
377
- var dir = vertical === reverse ? 1 : -1;
378
- var startEdge = dir === 1 ? 1 : 2;
379
- var lineSize = vertical ? lineBox.height() : lineBox.width();
380
- var step = dir * (lineSize / (this.logMax - this.logMin));
381
- var lineStart = lineBox[valueAxis + startEdge];
357
+ LogarithmicAxis.prototype.lineInfo = function lineInfo () {
358
+ var info = Axis.prototype.lineInfo.call(this);
359
+ info.step = info.axisDir * (info.lineSize / (this.logMax - this.logMin));
382
360
 
383
- return {
384
- step: step,
385
- lineStart: lineStart,
386
- lineBox: lineBox
387
- };
361
+ return info;
388
362
  };
389
363
 
390
364
  return LogarithmicAxis;
@@ -445,8 +419,8 @@ function throwNegativeValuesError() {
445
419
  throw new Error("Non positive values cannot be used for a logarithmic axis");
446
420
  }
447
421
 
448
- function log(y, x) {
449
- return Math.log(y) / Math.log(x);
422
+ function log(x, base) {
423
+ return Math.log(x) / Math.log(base);
450
424
  }
451
425
 
452
426
  setDefaultOptions(LogarithmicAxis, {
@@ -3,8 +3,8 @@ import Axis from './axis';
3
3
  import AxisLabel from './axis-label';
4
4
  import Box from './box';
5
5
 
6
- import { BLACK, DEFAULT_PRECISION, COORD_PRECISION, X, Y } from '../common/constants';
7
- import { deepExtend, defined, limitValue, round, setDefaultOptions } from '../common';
6
+ import { BLACK, DEFAULT_PRECISION, COORD_PRECISION } from '../common/constants';
7
+ import { deepExtend, defined, limitValue, round, setDefaultOptions, valueOrDefault } from '../common';
8
8
 
9
9
  import autoMajorUnit from './utils/auto-major-unit';
10
10
  import autoAxisMin from './utils/auto-axis-min';
@@ -73,18 +73,17 @@ var NumericAxis = (function (Axis) {
73
73
 
74
74
  NumericAxis.prototype.getTickPositions = function getTickPositions (unit, skipUnit) {
75
75
  var options = this.options;
76
- var vertical = options.vertical;
77
- var reverse = options.reverse;
78
- var lineBox = this.lineBox();
79
- var lineSize = vertical ? lineBox.height() : lineBox.width();
76
+ var ref = this.lineInfo();
77
+ var axisDir = ref.axisDir;
78
+ var axisOrigin = ref.axisOrigin;
79
+ var lineBox = ref.lineBox;
80
+ var lineSize = ref.lineSize;
80
81
  var range = options.max - options.min;
81
82
  var scale = lineSize / range;
82
83
  var step = unit * scale;
83
84
  var divisions = this.getDivisions(unit);
84
- var dir = (vertical ? -1 : 1) * (reverse ? -1 : 1);
85
- var startEdge = dir === 1 ? 1 : 2;
86
85
  var positions = [];
87
- var pos = lineBox[(vertical ? Y : X) + startEdge];
86
+ var pos = lineBox[axisOrigin];
88
87
  var skipStep = 0;
89
88
 
90
89
  if (skipUnit) {
@@ -96,7 +95,7 @@ var NumericAxis = (function (Axis) {
96
95
  positions.push(round(pos, COORD_PRECISION));
97
96
  }
98
97
 
99
- pos = pos + step * dir;
98
+ pos = pos + step * axisDir;
100
99
  }
101
100
 
102
101
  return positions;
@@ -114,71 +113,44 @@ var NumericAxis = (function (Axis) {
114
113
  if ( limit === void 0 ) limit = false;
115
114
 
116
115
  var options = this.options;
117
- var vertical = options.vertical;
118
- var reverse = options.reverse;
119
- var valueAxis = vertical ? Y : X;
120
- var lineBox = this.lineBox();
121
- var lineStart = lineBox[valueAxis + (reverse ? 2 : 1)];
122
- var lineSize = vertical ? lineBox.height() : lineBox.width();
123
- var dir = reverse ? -1 : 1;
124
- var step = dir * (lineSize / (options.max - options.min));
125
- var slotBox = new Box(lineBox.x1, lineBox.y1, lineBox.x1, lineBox.y1);
116
+ var ref = this.lineInfo();
117
+ var axis = ref.axis;
118
+ var axisDir = ref.axisDir;
119
+ var lineBox = ref.lineBox;
120
+ var lineSize = ref.lineSize;
121
+ var lineStart = ref.lineStart;
122
+ var step = axisDir * (lineSize / (options.max - options.min));
126
123
 
127
- var start = a;
128
- var end = b;
129
-
130
- if (!defined(start)) {
131
- start = end || 0;
132
- }
133
-
134
- if (!defined(end)) {
135
- end = start || 0;
136
- }
124
+ var start = valueOrDefault(a, b || 0);
125
+ var end = valueOrDefault(b, a || 0);
137
126
 
138
127
  if (limit) {
139
- start = Math.max(Math.min(start, options.max), options.min);
140
- end = Math.max(Math.min(end, options.max), options.min);
128
+ start = limitValue(start, options.min, options.max);
129
+ end = limitValue(end, options.min, options.max);
141
130
  }
142
131
 
143
- var p1, p2;
132
+ var p1 = Math.min(start, end) - options.min;
133
+ var p2 = Math.max(start, end) - options.min;
144
134
 
145
- if (vertical) {
146
- p1 = options.max - Math.max(start, end);
147
- p2 = options.max - Math.min(start, end);
148
- } else {
149
- p1 = Math.min(start, end) - options.min;
150
- p2 = Math.max(start, end) - options.min;
151
- }
152
-
153
- slotBox[valueAxis + 1] = limitCoordinate(lineStart + step * (reverse ? p2 : p1));
154
- slotBox[valueAxis + 2] = limitCoordinate(lineStart + step * (reverse ? p1 : p2));
135
+ var slotBox = new Box(lineBox.x1, lineBox.y1, lineBox.x1, lineBox.y1);
136
+ slotBox[axis + 1] = limitCoordinate(lineStart + step * (axisDir > 0 ? p1 : p2));
137
+ slotBox[axis + 2] = limitCoordinate(lineStart + step * (axisDir > 0 ? p2 : p1));
155
138
 
156
139
  return slotBox;
157
140
  };
158
141
 
159
142
  NumericAxis.prototype.getValue = function getValue (point) {
160
143
  var options = this.options;
161
- var vertical = options.vertical;
162
- var reverse = options.reverse;
163
144
  var max = Number(options.max);
164
145
  var min = Number(options.min);
165
- var valueAxis = vertical ? Y : X;
166
- var lineBox = this.lineBox();
167
- var lineStart = lineBox[valueAxis + (reverse ? 2 : 1)];
168
- var lineSize = vertical ? lineBox.height() : lineBox.width();
169
- var dir = reverse ? -1 : 1;
170
- var offset = dir * (point[valueAxis] - lineStart);
171
- var step = (max - min) / lineSize;
172
- var valueOffset = offset * step;
173
-
174
- if (offset < 0 || offset > lineSize) {
146
+ var offset = this.pointOffset(point);
147
+ var valueOffset = offset * (max - min);
148
+
149
+ if (offset < 0 || offset > 1) {
175
150
  return null;
176
151
  }
177
152
 
178
- var value = vertical ?
179
- max - valueOffset :
180
- min + valueOffset;
181
-
153
+ var value = min + valueOffset;
182
154
  return round(value, DEFAULT_PRECISION);
183
155
  };
184
156
 
@@ -188,10 +160,10 @@ var NumericAxis = (function (Axis) {
188
160
  var reverse = options.reverse;
189
161
  var max = options.max;
190
162
  var min = options.min;
191
- var lineBox = this.lineBox();
192
- var size = vertical ? lineBox.height() : lineBox.width();
163
+ var ref = this.lineInfo();
164
+ var lineSize = ref.lineSize;
193
165
  var range = max - min;
194
- var scale = size / range;
166
+ var scale = lineSize / range;
195
167
  var offset = round(delta / scale, DEFAULT_PRECISION);
196
168
 
197
169
  if ((vertical || reverse) && !(vertical && reverse )) {
@@ -205,16 +177,6 @@ var NumericAxis = (function (Axis) {
205
177
  };
206
178
  };
207
179
 
208
- NumericAxis.prototype.scaleRange = function scaleRange (delta) {
209
- var options = this.options;
210
- var offset = -delta * options.majorUnit;
211
-
212
- return {
213
- min: options.min - offset,
214
- max: options.max + offset
215
- };
216
- };
217
-
218
180
  NumericAxis.prototype.labelsCount = function labelsCount () {
219
181
  return this.getDivisions(this.options.majorUnit);
220
182
  };
@@ -251,20 +213,34 @@ var NumericAxis = (function (Axis) {
251
213
  }
252
214
  };
253
215
 
254
- NumericAxis.prototype.zoomRange = function zoomRange (delta) {
216
+ NumericAxis.prototype.scaleRange = function scaleRange (scale, cursor) {
217
+ var position = Math.abs(this.pointOffset(cursor));
218
+ var delta = (this.options.max - this.options.min) * Math.min(1, scale);
219
+ var minDelta = position * delta;
220
+ var maxDelta = (1 - position) * delta;
221
+ var min = this.options.min + minDelta;
222
+ var max = this.options.max - maxDelta;
223
+
224
+ if (max - min < MIN_VALUE_RANGE) {
225
+ max = min + MIN_VALUE_RANGE;
226
+ }
227
+
228
+ return {
229
+ min: min,
230
+ max: max
231
+ };
232
+ };
233
+
234
+ NumericAxis.prototype.zoomRange = function zoomRange (scale, cursor) {
255
235
  var ref = this;
256
236
  var totalMin = ref.totalMin;
257
237
  var totalMax = ref.totalMax;
258
- var newRange = this.scaleRange(delta);
259
- var min = limitValue(newRange.min, totalMin, totalMax);
260
- var max = limitValue(newRange.max, totalMin, totalMax);
238
+ var range = this.scaleRange(scale, cursor);
261
239
 
262
- if (this.isValidRange(min, max)) {
263
- return {
264
- min: min,
265
- max: max
266
- };
267
- }
240
+ return {
241
+ min: limitValue(range.min, totalMin, totalMax),
242
+ max: limitValue(range.max, totalMin, totalMax)
243
+ };
268
244
  };
269
245
 
270
246
  NumericAxis.prototype.isValidRange = function isValidRange (min, max) {
package/dist/es/main.js CHANGED
@@ -5,6 +5,7 @@ export * from './sparkline';
5
5
  export * from './stock';
6
6
  export * from './gauges';
7
7
  export * from './barcode';
8
+ export * from './qrcode';
8
9
  export * from './common';
9
10
 
10
11
  export { baseTheme as chartBaseTheme } from './chart/base-theme';
@@ -0,0 +1,103 @@
1
+ import { QRDataMode } from './qr-data-mode';
2
+ import { extend } from '../../utils';
3
+ import {
4
+ toBitsString,
5
+ splitInto
6
+ } from '../../utils';
7
+
8
+ export var AlphaNumericQRDataMode = (function (QRDataMode) {
9
+ function AlphaNumericQRDataMode () {
10
+ QRDataMode.apply(this, arguments);
11
+ }
12
+
13
+ if ( QRDataMode ) AlphaNumericQRDataMode.__proto__ = QRDataMode;
14
+ AlphaNumericQRDataMode.prototype = Object.create( QRDataMode && QRDataMode.prototype );
15
+ AlphaNumericQRDataMode.prototype.constructor = AlphaNumericQRDataMode;
16
+
17
+ AlphaNumericQRDataMode.prototype.initProperties = function initProperties () {
18
+ QRDataMode.prototype.initProperties.call(this);
19
+
20
+ extend(this, {
21
+ characters: {
22
+ "0": 0,
23
+ "1": 1,
24
+ "2": 2,
25
+ "3": 3,
26
+ "4": 4,
27
+ "5": 5,
28
+ "6": 6,
29
+ "7": 7,
30
+ "8": 8,
31
+ "9": 9,
32
+ "A": 10,
33
+ "B": 11,
34
+ "C": 12,
35
+ "D": 13,
36
+ "E": 14,
37
+ "F": 15,
38
+ "G": 16,
39
+ "H": 17,
40
+ "I": 18,
41
+ "J": 19,
42
+ "K": 20,
43
+ "L": 21,
44
+ "M": 22,
45
+ "N": 23,
46
+ "O": 24,
47
+ "P": 25,
48
+ "Q": 26,
49
+ "R": 27,
50
+ "S": 28,
51
+ "T": 29,
52
+ "U": 30,
53
+ "V": 31,
54
+ "W": 32,
55
+ "X": 33,
56
+ "Y": 34,
57
+ "Z": 35,
58
+ " ": 36,
59
+ "$": 37,
60
+ "%": 38,
61
+ "*": 39,
62
+ "+": 40,
63
+ "-": 41,
64
+ ".": 42,
65
+ "/": 43,
66
+ ":": 44
67
+ },
68
+ bitsInCharacterCount: [9, 11, 13],
69
+ modeIndicator: "0010"
70
+ });
71
+ };
72
+
73
+ AlphaNumericQRDataMode.prototype.getValue = function getValue (character) {
74
+ return this.characters[character];
75
+ };
76
+
77
+ AlphaNumericQRDataMode.prototype.encode = function encode (str, version) {
78
+ var this$1 = this;
79
+
80
+ var
81
+ parts = splitInto(str, 2),
82
+ result = this.getModeCountString(str.length, version),
83
+ value;
84
+ var i;
85
+
86
+ for (i = 0; i < parts.length - 1; i++) {
87
+ value = 45 * this$1.getValue(parts[i].charAt(0)) + this$1.getValue(parts[i].charAt(1));
88
+ result += toBitsString(value, 11);
89
+ }
90
+
91
+ value = parts[i].length === 2 ?
92
+ 45 * this.getValue(parts[i].charAt(0)) + this.getValue(parts[i].charAt(1)) :
93
+ this.getValue(parts[i].charAt(0));
94
+
95
+ return result + toBitsString(value, 1 + 5 * parts[i].length);
96
+ };
97
+
98
+ AlphaNumericQRDataMode.prototype.getStringBitsLength = function getStringBitsLength (inputLength, version) {
99
+ return 4 + this.getBitsCharacterCount(version) + 11 * Math.floor(inputLength / 2) + 6 * (inputLength % 2);
100
+ };
101
+
102
+ return AlphaNumericQRDataMode;
103
+ }(QRDataMode));
@@ -0,0 +1,51 @@
1
+ import { QRDataMode } from './qr-data-mode';
2
+ import { extend } from '../../utils';
3
+ import {
4
+ toBitsString
5
+ } from '../../utils';
6
+
7
+ export var ByteQRDataMode = (function (QRDataMode) {
8
+ function ByteQRDataMode () {
9
+ QRDataMode.apply(this, arguments);
10
+ }
11
+
12
+ if ( QRDataMode ) ByteQRDataMode.__proto__ = QRDataMode;
13
+ ByteQRDataMode.prototype = Object.create( QRDataMode && QRDataMode.prototype );
14
+ ByteQRDataMode.prototype.constructor = ByteQRDataMode;
15
+
16
+ ByteQRDataMode.prototype.initProperties = function initProperties () {
17
+ QRDataMode.prototype.initProperties.call(this);
18
+
19
+ extend(this, {
20
+ bitsInCharacterCount: [8, 16, 16],
21
+ modeIndicator: "0100"
22
+ });
23
+ };
24
+
25
+ ByteQRDataMode.prototype.getValue = function getValue (character) {
26
+ var code = character.charCodeAt(0);
27
+
28
+ if (code <= 127 || (160 <= code && code <= 255)) {
29
+ return code;
30
+ }
31
+
32
+ throw new Error("Unsupported character: " + character);
33
+ };
34
+
35
+ ByteQRDataMode.prototype.encode = function encode (str, version) {
36
+ var mode = this,
37
+ result = mode.getModeCountString(str.length, version);
38
+
39
+ for (var i = 0; i < str.length; i++) {
40
+ result += toBitsString(mode.getValue(str.charAt(i)), 8);
41
+ }
42
+
43
+ return result;
44
+ };
45
+
46
+ ByteQRDataMode.prototype.getStringBitsLength = function getStringBitsLength (inputLength, version) {
47
+ return 4 + this.getBitsCharacterCount(version) + 8 * inputLength;
48
+ };
49
+
50
+ return ByteQRDataMode;
51
+ }(QRDataMode));
@@ -0,0 +1,12 @@
1
+ import { NumericQRDataMode } from './numeric-data-mode';
2
+ import { AlphaNumericQRDataMode } from './alpha-numeric-data-mode';
3
+ import { ByteQRDataMode } from './byte-data-mode';
4
+
5
+ var NUMERIC = "numeric";
6
+ var ALPHA_NUMERIC = "alphanumeric";
7
+ var BYTE = "byte";
8
+
9
+ export var DataModeInstances = {};
10
+ DataModeInstances[NUMERIC] = new NumericQRDataMode();
11
+ DataModeInstances[ALPHA_NUMERIC] = new AlphaNumericQRDataMode();
12
+ DataModeInstances[BYTE] = new ByteQRDataMode();
@@ -0,0 +1,49 @@
1
+ import { QRDataMode } from './qr-data-mode';
2
+ import { extend } from '../../utils';
3
+ import {
4
+ toBitsString,
5
+ splitInto
6
+ } from '../../utils';
7
+
8
+ export var NumericQRDataMode = (function (QRDataMode) {
9
+ function NumericQRDataMode () {
10
+ QRDataMode.apply(this, arguments);
11
+ }
12
+
13
+ if ( QRDataMode ) NumericQRDataMode.__proto__ = QRDataMode;
14
+ NumericQRDataMode.prototype = Object.create( QRDataMode && QRDataMode.prototype );
15
+ NumericQRDataMode.prototype.constructor = NumericQRDataMode;
16
+
17
+ NumericQRDataMode.prototype.initProperties = function initProperties () {
18
+ QRDataMode.prototype.initProperties.call(this);
19
+
20
+ extend(this, {
21
+ bitsInCharacterCount: [10, 12, 14],
22
+ modeIndicator: "0001"
23
+ });
24
+ };
25
+
26
+ NumericQRDataMode.prototype.getValue = function getValue (character) {
27
+ return parseInt(character, 10);
28
+ };
29
+
30
+ NumericQRDataMode.prototype.encode = function encode (str, version) {
31
+ var mode = this,
32
+ parts = splitInto(str, 3),
33
+ result = mode.getModeCountString(str.length, version);
34
+ var i;
35
+
36
+ for (i = 0; i < parts.length - 1; i++) {
37
+ result += toBitsString(parts[i], 10);
38
+ }
39
+
40
+ return result + toBitsString(parts[i], 1 + 3 * parts[i].length);
41
+ };
42
+
43
+ NumericQRDataMode.prototype.getStringBitsLength = function getStringBitsLength (inputLength, version) {
44
+ var mod3 = inputLength % 3;
45
+ return 4 + this.getBitsCharacterCount(version) + 10 * Math.floor(inputLength / 3) + 3 * mod3 + (mod3 === 0 ? 0 : 1);
46
+ };
47
+
48
+ return NumericQRDataMode;
49
+ }(QRDataMode));