@progress/kendo-charts 2.7.2-dev.202502101310 → 2.7.2-develop.1
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/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/barcode/barcode-validator.js +10 -12
- package/dist/es/barcode/barcode.js +84 -96
- package/dist/es/barcode/encodings/code11.js +41 -57
- package/dist/es/barcode/encodings/code128.js +222 -354
- package/dist/es/barcode/encodings/code39-extended.js +20 -34
- package/dist/es/barcode/encodings/code39.js +49 -75
- package/dist/es/barcode/encodings/code93-extended.js +12 -24
- package/dist/es/barcode/encodings/code93.js +52 -70
- package/dist/es/barcode/encodings/ean13.js +28 -42
- package/dist/es/barcode/encodings/ean8.js +8 -18
- package/dist/es/barcode/encodings/encoding.js +18 -24
- package/dist/es/barcode/encodings/main.js +13 -10
- package/dist/es/barcode/encodings/msi.js +56 -112
- package/dist/es/barcode/encodings/postnet.js +31 -45
- package/dist/es/barcode/surface-size.js +2 -2
- package/dist/es/chart/aggregates/aggregates.js +23 -23
- package/dist/es/chart/aggregates/default-aggregates.js +10 -18
- package/dist/es/chart/aggregates/series-aggregator.js +42 -54
- package/dist/es/chart/animations/bar-chart-animation.js +15 -26
- package/dist/es/chart/animations/bubble-animation.js +7 -17
- package/dist/es/chart/animations/clip-animation.js +13 -23
- package/dist/es/chart/animations/fade-in-animation.js +6 -16
- package/dist/es/chart/animations/pie-animation.js +6 -16
- package/dist/es/chart/api-elements/chart-axis.js +14 -22
- package/dist/es/chart/api-elements/chart-pane.js +10 -8
- package/dist/es/chart/api-elements/chart-plotarea.js +4 -10
- package/dist/es/chart/api-elements/find-axis-by-name.js +1 -1
- package/dist/es/chart/area-chart/area-chart.js +46 -60
- package/dist/es/chart/area-chart/area-segment.js +46 -52
- package/dist/es/chart/area-chart/spline-area-segment.js +12 -21
- package/dist/es/chart/area-chart/step-area-segment.js +6 -15
- package/dist/es/chart/axis-group-range-tracker.js +14 -20
- package/dist/es/chart/bar-chart/bar-chart.js +65 -80
- package/dist/es/chart/bar-chart/bar-label.js +25 -32
- package/dist/es/chart/bar-chart/bar.js +76 -91
- package/dist/es/chart/box-plot-chart/box-plot-chart.js +33 -48
- package/dist/es/chart/box-plot-chart/box-plot.js +55 -68
- package/dist/es/chart/box-plot-chart/vertical-box-plot.js +13 -23
- package/dist/es/chart/bubble-chart/bubble-chart.js +51 -64
- package/dist/es/chart/bubble-chart/bubble.js +21 -27
- package/dist/es/chart/bullet-chart/bullet-chart.js +45 -57
- package/dist/es/chart/bullet-chart/bullet.js +48 -57
- package/dist/es/chart/bullet-chart/target.js +1 -11
- package/dist/es/chart/candlestick-chart/candlestick-chart.js +41 -55
- package/dist/es/chart/candlestick-chart/candlestick.js +60 -69
- package/dist/es/chart/categorical-chart.js +178 -206
- package/dist/es/chart/chart-container.js +30 -39
- package/dist/es/chart/chart.js +641 -701
- package/dist/es/chart/constants.js +103 -103
- package/dist/es/chart/crosshair/crosshair-tooltip.js +22 -34
- package/dist/es/chart/crosshair/crosshair.js +39 -47
- package/dist/es/chart/donut-chart/donut-chart.js +36 -48
- package/dist/es/chart/donut-chart/donut-segment.js +12 -24
- package/dist/es/chart/error-bars/categorical-error-bar.js +5 -15
- package/dist/es/chart/error-bars/error-bar-base.js +37 -49
- package/dist/es/chart/error-bars/error-range-calculator.js +46 -56
- package/dist/es/chart/error-bars/scatter-error-bar.js +6 -16
- package/dist/es/chart/funnel-chart/funnel-chart.js +86 -103
- package/dist/es/chart/funnel-chart/funnel-segment.js +46 -54
- package/dist/es/chart/funnel-chart/pyramid-chart.js +5 -11
- package/dist/es/chart/heatmap-chart/color-scale.js +7 -9
- package/dist/es/chart/heatmap-chart/heatmap-chart.js +87 -110
- package/dist/es/chart/heatmap-chart/heatmap-point.js +72 -78
- package/dist/es/chart/highlight.js +26 -36
- package/dist/es/chart/layout/cluster-layout.js +16 -25
- package/dist/es/chart/layout/radar-cluster-layout.js +15 -24
- package/dist/es/chart/layout/radar-stack-layout.js +10 -22
- package/dist/es/chart/layout/stack-wrap.js +12 -24
- package/dist/es/chart/layout/utils.js +2 -2
- package/dist/es/chart/legend/legend-item-line-area.js +8 -19
- package/dist/es/chart/legend/legend-item-line.js +21 -31
- package/dist/es/chart/legend/legend-item-marker.js +18 -28
- package/dist/es/chart/legend/legend-item-square.js +8 -18
- package/dist/es/chart/legend/legend-item.js +91 -105
- package/dist/es/chart/legend/legend-layout.js +18 -25
- package/dist/es/chart/legend/legend.js +68 -92
- package/dist/es/chart/line-chart/line-chart.js +35 -48
- package/dist/es/chart/line-chart/line-point.js +90 -103
- package/dist/es/chart/line-chart/line-segment.js +23 -34
- package/dist/es/chart/line-chart/spline-segment.js +10 -20
- package/dist/es/chart/line-chart/step-line-mixin.js +14 -17
- package/dist/es/chart/line-chart/step-line-segment.js +4 -14
- package/dist/es/chart/mixins/accessibility-attributes-mixin.js +7 -7
- package/dist/es/chart/mixins/clip-animation-mixin.js +7 -7
- package/dist/es/chart/mixins/line-chart-mixin.js +27 -31
- package/dist/es/chart/mixins/note-mixin.js +3 -3
- package/dist/es/chart/mixins/pie-chart-mixin.js +9 -9
- package/dist/es/chart/mixins/plotarea-events-mixin.js +1 -1
- package/dist/es/chart/mixins/point-events-mixin.js +1 -1
- package/dist/es/chart/ohlc-chart/ohlc-chart.js +4 -14
- package/dist/es/chart/ohlc-chart/ohlc-point.js +15 -28
- package/dist/es/chart/pan-and-zoom/accept-key.js +3 -3
- package/dist/es/chart/pan-and-zoom/mousewheel-zoom.js +25 -33
- package/dist/es/chart/pan-and-zoom/pannable.js +29 -37
- package/dist/es/chart/pan-and-zoom/to-chart-axis-ranges.js +3 -3
- package/dist/es/chart/pan-and-zoom/zoom-selection.js +61 -70
- package/dist/es/chart/pane.js +71 -79
- package/dist/es/chart/pie-chart/pie-chart.js +153 -183
- package/dist/es/chart/pie-chart/pie-segment.js +82 -98
- package/dist/es/chart/plotarea/categorical-plotarea.js +285 -318
- package/dist/es/chart/plotarea/donut-plotarea.js +12 -22
- package/dist/es/chart/plotarea/funnel-plotarea.js +17 -27
- package/dist/es/chart/plotarea/heatmap-plotarea.js +139 -167
- package/dist/es/chart/plotarea/pie-plotarea.js +15 -25
- package/dist/es/chart/plotarea/plotarea-base.js +423 -462
- package/dist/es/chart/plotarea/plotarea-factory.js +15 -20
- package/dist/es/chart/plotarea/polar-plotarea-base.js +37 -51
- package/dist/es/chart/plotarea/polar-plotarea.js +39 -49
- package/dist/es/chart/plotarea/radar-plotarea.js +55 -65
- package/dist/es/chart/plotarea/xy-plotarea.js +111 -128
- package/dist/es/chart/polar-area-chart/polar-area-chart.js +22 -36
- package/dist/es/chart/polar-area-chart/polar-area-segment.js +7 -17
- package/dist/es/chart/polar-area-chart/spline-polar-area-segment.js +15 -25
- package/dist/es/chart/polar-line-chart/polar-line-chart.js +2 -11
- package/dist/es/chart/polar-scatter-chart/polar-scatter-chart.js +6 -16
- package/dist/es/chart/radar-area-chart/radar-area-chart.js +11 -21
- package/dist/es/chart/radar-area-chart/radar-area-segment.js +3 -13
- package/dist/es/chart/radar-area-chart/spline-radar-area-segment.js +3 -13
- package/dist/es/chart/radar-bar-chart/radar-bar-chart.js +19 -29
- package/dist/es/chart/radar-bar-chart/radar-segment.js +6 -12
- package/dist/es/chart/radar-line-chart/radar-line-chart.js +26 -35
- package/dist/es/chart/range-area-chart/range-area-chart.js +46 -58
- package/dist/es/chart/range-area-chart/range-area-point.js +55 -66
- package/dist/es/chart/range-area-chart/range-area-segment.js +19 -28
- package/dist/es/chart/range-area-chart/range-line-point.js +4 -14
- package/dist/es/chart/range-area-chart/spline-range-area-segment.js +11 -18
- package/dist/es/chart/range-area-chart/step-range-area-segment.js +7 -16
- package/dist/es/chart/range-bar-chart/range-bar-chart.js +18 -29
- package/dist/es/chart/range-bar-chart/range-bar.js +10 -23
- package/dist/es/chart/register-charts.js +20 -16
- package/dist/es/chart/scatter-charts/scatter-chart.js +100 -122
- package/dist/es/chart/scatter-charts/scatter-line-chart.js +15 -25
- package/dist/es/chart/selection.js +176 -201
- package/dist/es/chart/series-binder.js +55 -66
- package/dist/es/chart/theme/base-theme.js +75 -79
- package/dist/es/chart/theme/load-theme.js +52 -52
- package/dist/es/chart/tooltip/base-tooltip.js +17 -24
- package/dist/es/chart/tooltip/shared-tooltip.js +25 -31
- package/dist/es/chart/tooltip/tooltip.js +10 -20
- package/dist/es/chart/trendlines/calculate-moving-average.js +11 -13
- package/dist/es/chart/trendlines/calculate-polynomial.js +24 -26
- package/dist/es/chart/trendlines/calculate-slope.js +12 -14
- package/dist/es/chart/trendlines/check-all-positive.js +2 -5
- package/dist/es/chart/trendlines/exponential-trendline.js +15 -24
- package/dist/es/chart/trendlines/get-scatter-trendline-data.js +6 -7
- package/dist/es/chart/trendlines/get-trendline-data.js +6 -6
- package/dist/es/chart/trendlines/linear-trendline.js +12 -21
- package/dist/es/chart/trendlines/logarithmic-trendline.js +14 -23
- package/dist/es/chart/trendlines/moving-average.js +15 -26
- package/dist/es/chart/trendlines/polynomial-trendline.js +13 -21
- package/dist/es/chart/trendlines/power-trendline.js +15 -24
- package/dist/es/chart/trendlines/scatter-exponential-trendline.js +15 -24
- package/dist/es/chart/trendlines/scatter-linear-trendline.js +10 -16
- package/dist/es/chart/trendlines/scatter-logarithmic-trendline.js +17 -27
- package/dist/es/chart/trendlines/scatter-moving-average.js +7 -10
- package/dist/es/chart/trendlines/scatter-polynomial-trendline.js +11 -16
- package/dist/es/chart/trendlines/scatter-power-trendline.js +15 -22
- package/dist/es/chart/trendlines/scatter-trendline-registry.js +1 -1
- package/dist/es/chart/trendlines/scatter-value-getter.js +2 -5
- package/dist/es/chart/trendlines/trendline-factory.js +1 -1
- package/dist/es/chart/trendlines/trendline-registry.js +1 -1
- package/dist/es/chart/trendlines/x-value-limits.js +6 -8
- package/dist/es/chart/utils/any-has-z-index.js +1 -1
- package/dist/es/chart/utils/bind-segments.js +8 -8
- package/dist/es/chart/utils/categories-count.js +3 -3
- package/dist/es/chart/utils/count-numbers.js +4 -4
- package/dist/es/chart/utils/create-out-of-range-points.js +13 -22
- package/dist/es/chart/utils/eval-options.js +7 -10
- package/dist/es/chart/utils/filter-series-by-type.js +4 -4
- package/dist/es/chart/utils/get-field.js +1 -1
- package/dist/es/chart/utils/has-gradient-overlay.js +1 -1
- package/dist/es/chart/utils/is-date-axis.js +2 -2
- package/dist/es/chart/utils/parse-date-category.js +2 -2
- package/dist/es/chart/utils/segment-visible.js +2 -2
- package/dist/es/chart/waterfall-chart/waterfall-chart.js +41 -55
- package/dist/es/chart/waterfall-chart/waterfall-segment.js +16 -24
- package/dist/es/chart-wizard/get-wizard-data-from-data-rows.js +5 -6
- package/dist/es/chart-wizard/messages.js +1 -1
- package/dist/es/chart-wizard/state.js +145 -137
- package/dist/es/chart-wizard.js +12 -12
- package/dist/es/common/add-class.js +3 -3
- package/dist/es/common/align-path-to-pixel.js +2 -2
- package/dist/es/common/auto-text-color.js +1 -1
- package/dist/es/common/constants.js +53 -53
- package/dist/es/common/create-hash-set.js +59 -65
- package/dist/es/common/cycleDown.js +1 -1
- package/dist/es/common/deep-extend.js +10 -12
- package/dist/es/common/element-scale.js +9 -9
- package/dist/es/common/element-styles.js +8 -8
- package/dist/es/common/event-map.js +4 -4
- package/dist/es/common/event-utils.js +13 -13
- package/dist/es/common/find.js +2 -2
- package/dist/es/common/font-loader.js +42 -44
- package/dist/es/common/get-aria-template.js +2 -4
- package/dist/es/common/get-spacing.js +2 -4
- package/dist/es/common/get-supported-features.js +7 -7
- package/dist/es/common/get-template.js +2 -4
- package/dist/es/common/getter.js +5 -5
- package/dist/es/common/grep.js +3 -3
- package/dist/es/common/has-classes.js +2 -2
- package/dist/es/common/hash-map.js +11 -11
- package/dist/es/common/instance-observer.js +28 -33
- package/dist/es/common/keys.js +1 -1
- package/dist/es/common/map.js +4 -4
- package/dist/es/common/matrix.js +142 -150
- package/dist/es/common/mousewheel-delta.js +2 -2
- package/dist/es/common/observable.js +40 -52
- package/dist/es/common/remove-class.js +1 -1
- package/dist/es/common/render-icon.js +50 -60
- package/dist/es/common/set-default-options.js +1 -1
- package/dist/es/common/sparse-array-limits.js +4 -4
- package/dist/es/common/user-events.js +124 -150
- package/dist/es/core/axis-label.js +38 -43
- package/dist/es/core/axis.js +293 -345
- package/dist/es/core/box-element.js +36 -46
- package/dist/es/core/box.js +75 -83
- package/dist/es/core/category-axis.js +265 -314
- package/dist/es/core/chart-element.js +98 -109
- package/dist/es/core/constants.js +3 -3
- package/dist/es/core/curve-processor.js +86 -93
- package/dist/es/core/date-category-axis.js +381 -413
- package/dist/es/core/date-value-axis.js +108 -118
- package/dist/es/core/float-element.js +54 -78
- package/dist/es/core/gradients.js +3 -3
- package/dist/es/core/logarithmic-axis.js +134 -186
- package/dist/es/core/mixins/grid-lines-mixin.js +18 -20
- package/dist/es/core/mixins/radar-numeric-axis-mixin.js +46 -51
- package/dist/es/core/note.js +58 -73
- package/dist/es/core/numeric-axis.js +111 -133
- package/dist/es/core/pattern.js +4 -8
- package/dist/es/core/point.js +25 -34
- package/dist/es/core/polar-axis.js +73 -91
- package/dist/es/core/radar-category-axis.js +90 -114
- package/dist/es/core/radar-logarithmic-axis.js +10 -20
- package/dist/es/core/radar-numeric-axis.js +10 -20
- package/dist/es/core/ring.js +61 -68
- package/dist/es/core/root-element.js +40 -48
- package/dist/es/core/sector.js +11 -17
- package/dist/es/core/shape-builder.js +13 -23
- package/dist/es/core/shape-element.js +27 -37
- package/dist/es/core/text-box.js +50 -59
- package/dist/es/core/text.js +13 -24
- package/dist/es/core/title.js +19 -25
- package/dist/es/core/utils/auto-axis-max.js +3 -3
- package/dist/es/core/utils/auto-axis-min.js +3 -3
- package/dist/es/core/utils/auto-major-unit.js +4 -4
- package/dist/es/core/utils/box-diff.js +9 -9
- package/dist/es/core/utils/create-axis-grid-line.js +2 -4
- package/dist/es/core/utils/create-axis-tick.js +2 -4
- package/dist/es/core/utils/guid.js +3 -3
- package/dist/es/core/utils/rect-to-box.js +2 -2
- package/dist/es/date-utils/absolute-date-diff.js +2 -2
- package/dist/es/date-utils/add-duration.js +5 -5
- package/dist/es/date-utils/ceil-date.js +1 -1
- package/dist/es/date-utils/constants.js +17 -17
- package/dist/es/date-utils/date-index.js +3 -3
- package/dist/es/date-utils/duration.js +1 -1
- package/dist/es/date-utils/lte-date-index.js +4 -4
- package/dist/es/date-utils/parse-date.js +1 -1
- package/dist/es/date-utils/parse-dates.js +2 -2
- package/dist/es/date-utils/start-of-week.js +3 -5
- package/dist/es/date-utils/to-date.js +1 -1
- package/dist/es/date-utils/to-time.js +2 -2
- package/dist/es/drawing-utils.js +18 -17
- package/dist/es/gauges/arc/arc-gauge.js +29 -38
- package/dist/es/gauges/arc/arc-scale.js +16 -29
- package/dist/es/gauges/arc/range-pointer-animation.js +16 -25
- package/dist/es/gauges/arc/range-pointer.js +25 -46
- package/dist/es/gauges/circular/circular-gauge.js +7 -17
- package/dist/es/gauges/constants.js +14 -14
- package/dist/es/gauges/gauge.js +84 -96
- package/dist/es/gauges/linear/arrow-linear-pointer-animation.js +13 -25
- package/dist/es/gauges/linear/arrow-linear-pointer.js +23 -35
- package/dist/es/gauges/linear/bar-linear-pointer-animation.js +15 -24
- package/dist/es/gauges/linear/bar-linear-pointer.js +38 -51
- package/dist/es/gauges/linear/linear-gauge.js +61 -83
- package/dist/es/gauges/linear/linear-pointer.js +25 -39
- package/dist/es/gauges/linear/linear-scale.js +57 -74
- package/dist/es/gauges/pointer.js +11 -21
- package/dist/es/gauges/radial/radial-gauge.js +58 -81
- package/dist/es/gauges/radial/radial-pointer-animation.js +9 -15
- package/dist/es/gauges/radial/radial-pointer.js +33 -48
- package/dist/es/gauges/radial/radial-scale.js +154 -186
- package/dist/es/gauges/utils/build-label-element.js +10 -12
- package/dist/es/gauges/utils/get-range.js +2 -2
- package/dist/es/gauges/utils/pad.js +3 -3
- package/dist/es/gauges/utils/unpad.js +1 -1
- package/dist/es/map/attribution.js +42 -52
- package/dist/es/map/constants.js +5 -5
- package/dist/es/map/crs.js +68 -112
- package/dist/es/map/datums.js +3 -3
- package/dist/es/map/extent.js +40 -54
- package/dist/es/map/layers/bubble.js +52 -70
- package/dist/es/map/layers/layer.js +50 -56
- package/dist/es/map/layers/marker.js +109 -129
- package/dist/es/map/layers/shape.js +111 -133
- package/dist/es/map/layers/tile.js +144 -170
- package/dist/es/map/location.js +70 -78
- package/dist/es/map/map.js +261 -291
- package/dist/es/map/navigator.js +33 -39
- package/dist/es/map/scroller/draggable.js +98 -134
- package/dist/es/map/scroller/fx.js +39 -46
- package/dist/es/map/scroller/scroller.js +144 -174
- package/dist/es/map/tooltip/tooltip.js +15 -25
- package/dist/es/map/utils.js +25 -26
- package/dist/es/map/zoom.js +30 -36
- package/dist/es/qrcode/encodings/data-modes/alpha-numeric-data-mode.js +14 -26
- package/dist/es/qrcode/encodings/data-modes/byte-data-mode.js +15 -25
- package/dist/es/qrcode/encodings/data-modes/data-mode-instances.js +8 -7
- package/dist/es/qrcode/encodings/data-modes/numeric-data-mode.js +14 -24
- package/dist/es/qrcode/encodings/data-modes/qr-data-mode.js +15 -21
- package/dist/es/qrcode/encodings/encoders/iso-encoder.js +6 -16
- package/dist/es/qrcode/encodings/encoders/utf8-encoder.js +28 -36
- package/dist/es/qrcode/encodings/encoding-result.js +4 -10
- package/dist/es/qrcode/encodings/encoding.js +68 -192
- package/dist/es/qrcode/encodings/free-cell-visitor.js +16 -24
- package/dist/es/qrcode/encodings/utils/choose-mode.js +44 -0
- package/dist/es/qrcode/encodings/utils/get-data-codewords-count.js +13 -0
- package/dist/es/qrcode/encodings/utils/get-data-string.js +13 -0
- package/dist/es/qrcode/encodings/utils/get-modes.js +35 -0
- package/dist/es/qrcode/encodings/utils/get-version.js +23 -0
- package/dist/es/qrcode/encodings/utils/index.js +5 -0
- package/dist/es/qrcode/encodings/version-codewords.js +1 -1
- package/dist/es/qrcode/qrcode-validator.js +3 -5
- package/dist/es/qrcode/qrcode.js +104 -114
- package/dist/es/qrcode/utils.js +4 -4
- package/dist/es/sankey/calculation.js +286 -307
- package/dist/es/sankey/element.js +15 -23
- package/dist/es/sankey/label.js +29 -44
- package/dist/es/sankey/legend.js +15 -29
- package/dist/es/sankey/link.js +80 -98
- package/dist/es/sankey/node.js +26 -37
- package/dist/es/sankey/sankey.js +318 -385
- package/dist/es/sankey/title.js +9 -20
- package/dist/es/sankey/utils.js +18 -23
- package/dist/es/services/chart-service.js +24 -28
- package/dist/es/services/dom-events-builder.js +15 -15
- package/dist/es/services/format-service.js +30 -35
- package/dist/es/services/intl-service.js +14 -18
- package/dist/es/services/map-service.js +11 -11
- package/dist/es/services/template-service.js +9 -9
- package/dist/es/sparkline/shared-tooltip.js +11 -21
- package/dist/es/sparkline/sparkline.js +50 -60
- package/dist/es/stock/constants.js +3 -3
- package/dist/es/stock/fade-out-animation.js +12 -21
- package/dist/es/stock/navigator-hint.js +37 -49
- package/dist/es/stock/navigator.js +130 -161
- package/dist/es/stock/stock-chart.js +58 -67
- package/dist/es2015/chart/legend/legend-item.js +1 -1
- package/dist/es2015/qrcode/encodings/encoders/iso-encoder.js +1 -1
- package/dist/es2015/qrcode/encodings/encoders/utf8-encoder.js +1 -1
- package/dist/es2015/qrcode/encodings/encoding.js +3 -127
- package/dist/es2015/qrcode/encodings/utils/choose-mode.js +44 -0
- package/dist/es2015/qrcode/encodings/utils/get-data-codewords-count.js +13 -0
- package/dist/es2015/qrcode/encodings/utils/get-data-string.js +13 -0
- package/dist/es2015/qrcode/encodings/utils/get-modes.js +35 -0
- package/dist/es2015/qrcode/encodings/utils/get-version.js +23 -0
- package/dist/es2015/qrcode/encodings/utils/index.js +5 -0
- package/dist/npm/main.js +3222 -3589
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +19 -57
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Code39 } from './code39';
|
|
2
2
|
import deepExtend from '../../common/deep-extend';
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
addCharacter
|
|
4
|
+
export const Code39ExtendedBase = {
|
|
5
|
+
addCharacter(character) {
|
|
6
6
|
if (this.characterMap[character]) {
|
|
7
7
|
this.addBase(this.characterMap[character]);
|
|
8
8
|
} else if (character.charCodeAt(0) > 127) {
|
|
@@ -12,21 +12,19 @@ export var Code39ExtendedBase = {
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
|
|
15
|
-
addExtended
|
|
16
|
-
|
|
15
|
+
addExtended(code) {
|
|
16
|
+
let patterns;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
for (var i = 0; i < this.extendedMappings.length; i++) {
|
|
21
|
-
patterns = this$1.extendedMappings[i].call(this$1, code);
|
|
18
|
+
for (let i = 0; i < this.extendedMappings.length; i++) {
|
|
19
|
+
patterns = this.extendedMappings[i].call(this, code);
|
|
22
20
|
|
|
23
21
|
if (patterns) {
|
|
24
|
-
for (
|
|
25
|
-
|
|
26
|
-
this
|
|
22
|
+
for (let patternIndex = 0; patternIndex < patterns.length; patternIndex++) {
|
|
23
|
+
const pattern = patterns[patternIndex];
|
|
24
|
+
this.addBase(pattern);
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
this
|
|
27
|
+
this.dataLength += patterns.length - 1;
|
|
30
28
|
return;
|
|
31
29
|
}
|
|
32
30
|
}
|
|
@@ -49,10 +47,8 @@ export var Code39ExtendedBase = {
|
|
|
49
47
|
}
|
|
50
48
|
},
|
|
51
49
|
function(code) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var result;
|
|
55
|
-
var dataCharacter;
|
|
50
|
+
let result;
|
|
51
|
+
let dataCharacter;
|
|
56
52
|
|
|
57
53
|
if (!this.specialAsciiCodes[code]) {
|
|
58
54
|
dataCharacter = Math.floor(code / 32) * 6 + (code - 27) % 32 + 64;
|
|
@@ -60,9 +56,9 @@ export var Code39ExtendedBase = {
|
|
|
60
56
|
} else {
|
|
61
57
|
result = [];
|
|
62
58
|
|
|
63
|
-
for (
|
|
64
|
-
result.push(this
|
|
65
|
-
result.push(this
|
|
59
|
+
for (let i = 0; i < this.specialAsciiCodes[code].length; i++) {
|
|
60
|
+
result.push(this.characterMap[this.shiftCharacters[3]]);
|
|
61
|
+
result.push(this.characterMap[this.specialAsciiCodes[code][i]]);
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
64
|
|
|
@@ -90,17 +86,9 @@ export var Code39ExtendedBase = {
|
|
|
90
86
|
shiftCharacters: ["SHIFT0", "SHIFT1", "SHIFT2", "SHIFT3"]
|
|
91
87
|
};
|
|
92
88
|
|
|
93
|
-
export
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if ( Code39 ) Code39Extended.__proto__ = Code39;
|
|
99
|
-
Code39Extended.prototype = Object.create( Code39 && Code39.prototype );
|
|
100
|
-
Code39Extended.prototype.constructor = Code39Extended;
|
|
101
|
-
|
|
102
|
-
Code39Extended.prototype.initProperties = function initProperties () {
|
|
103
|
-
Code39.prototype.initProperties.call(this);
|
|
89
|
+
export class Code39Extended extends Code39 {
|
|
90
|
+
initProperties() {
|
|
91
|
+
super.initProperties();
|
|
104
92
|
|
|
105
93
|
deepExtend(this, Code39ExtendedBase, {
|
|
106
94
|
name: "Code 39 extended",
|
|
@@ -111,7 +99,5 @@ export var Code39Extended = (function (Code39) {
|
|
|
111
99
|
SHIFT3: { "pattern": "bwbWbWbWb", "value": 42 }
|
|
112
100
|
}
|
|
113
101
|
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return Code39Extended;
|
|
117
|
-
}(Code39));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
import { setDefaultOptions } from '../../common';
|
|
2
2
|
import { Encoding } from './encoding';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const extend = Object.assign;
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if ( Encoding ) Code39Base.__proto__ = Encoding;
|
|
12
|
-
Code39Base.prototype = Object.create( Encoding && Encoding.prototype );
|
|
13
|
-
Code39Base.prototype.constructor = Code39Base;
|
|
14
|
-
|
|
15
|
-
Code39Base.prototype.initProperties = function initProperties () {
|
|
16
|
-
Encoding.prototype.initProperties.call(this);
|
|
6
|
+
export class Code39Base extends Encoding {
|
|
7
|
+
initProperties() {
|
|
8
|
+
super.initProperties();
|
|
17
9
|
|
|
18
10
|
extend(this, {
|
|
19
11
|
minBaseUnitLength: 0.7
|
|
20
12
|
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Code39Base.prototype.addData = function addData () {
|
|
24
|
-
var this$1 = this;
|
|
13
|
+
}
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
addData() {
|
|
16
|
+
const value = this.value;
|
|
27
17
|
|
|
28
18
|
this.addStart();
|
|
29
19
|
|
|
30
|
-
for (
|
|
31
|
-
this
|
|
20
|
+
for (let idx = 0; idx < value.length; idx++) {
|
|
21
|
+
this.addCharacter(value.charAt(idx));
|
|
32
22
|
}
|
|
33
23
|
|
|
34
24
|
if (this.options.addCheckSum) {
|
|
@@ -37,34 +27,24 @@ export var Code39Base = (function (Encoding) {
|
|
|
37
27
|
|
|
38
28
|
this.addStop();
|
|
39
29
|
this.prepareValues();
|
|
40
|
-
}
|
|
30
|
+
}
|
|
41
31
|
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
addCharacter(character) {
|
|
33
|
+
const characterData = this.characterMap[character];
|
|
44
34
|
|
|
45
35
|
if (!characterData) {
|
|
46
36
|
this.invalidCharacterError(character);
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
this.addBase(characterData);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
Code39Base.prototype.addBase = function addBase () { };
|
|
53
|
-
|
|
54
|
-
return Code39Base;
|
|
55
|
-
}(Encoding));
|
|
56
|
-
|
|
57
|
-
export var Code39 = (function (Code39Base) {
|
|
58
|
-
function Code39 () {
|
|
59
|
-
Code39Base.apply(this, arguments);
|
|
60
40
|
}
|
|
61
41
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Code39.prototype.constructor = Code39;
|
|
42
|
+
addBase() { }
|
|
43
|
+
}
|
|
65
44
|
|
|
66
|
-
|
|
67
|
-
|
|
45
|
+
export class Code39 extends Code39Base {
|
|
46
|
+
initProperties() {
|
|
47
|
+
super.initProperties();
|
|
68
48
|
|
|
69
49
|
extend(this, {
|
|
70
50
|
name: "Code 39",
|
|
@@ -126,85 +106,79 @@ export var Code39 = (function (Code39Base) {
|
|
|
126
106
|
START: { pattern: "bWbwBwBwb" }
|
|
127
107
|
}
|
|
128
108
|
});
|
|
129
|
-
}
|
|
109
|
+
}
|
|
130
110
|
|
|
131
|
-
|
|
111
|
+
initValue(value, width, height) {
|
|
132
112
|
this.width = width;
|
|
133
113
|
this.height = height;
|
|
134
114
|
this.value = value;
|
|
135
115
|
this.dataLength = value.length;
|
|
136
116
|
this.pattern = [];
|
|
137
117
|
this.patternString = "";
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
Code39.prototype.prepareValues = function prepareValues () {
|
|
141
|
-
var this$1 = this;
|
|
118
|
+
}
|
|
142
119
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
120
|
+
prepareValues() {
|
|
121
|
+
const minBaseUnit = this.minBaseUnitLength;
|
|
122
|
+
const minRatio = this.minRatio;
|
|
123
|
+
const minHeight = Math.ceil(Math.max(0.15 * this.width, 24));
|
|
124
|
+
let baseUnit;
|
|
125
|
+
let ratio = this.maxRatio;
|
|
148
126
|
|
|
149
127
|
if (this.height < minHeight) {
|
|
150
|
-
throw new Error(
|
|
128
|
+
throw new Error(`Insufficient height for Code39 encoding: the current height is ${this.height}px and the minimum height is ${minHeight}px.`);
|
|
151
129
|
}
|
|
152
130
|
|
|
153
131
|
baseUnit = this.getBaseUnit(ratio);
|
|
154
132
|
|
|
155
133
|
while (baseUnit < minBaseUnit && ratio > minRatio) {
|
|
156
134
|
ratio = parseFloat((ratio - 0.1).toFixed(1));
|
|
157
|
-
baseUnit = this
|
|
135
|
+
baseUnit = this.getBaseUnit(ratio);
|
|
158
136
|
}
|
|
159
137
|
|
|
160
138
|
if (baseUnit < minBaseUnit) {
|
|
161
|
-
|
|
162
|
-
throw new Error(
|
|
139
|
+
let minWidth = Math.ceil(this.getBaseWidth(minRatio) * minBaseUnit);
|
|
140
|
+
throw new Error(`Insufficient width for Code39 encoding: the current width is ${this.width}px and the minimum width for value "${this.value}" is ${minWidth}px.`);
|
|
163
141
|
}
|
|
164
142
|
|
|
165
143
|
this.ratio = ratio;
|
|
166
144
|
this.baseUnit = baseUnit;
|
|
167
145
|
this.patternString = this.patternString.substring(0, this.patternString.length - 1);
|
|
168
146
|
this.pattern = this.pattern.concat(this.patternString.replace(/ratio/g, ratio).split(this.splitCharacter));
|
|
169
|
-
}
|
|
147
|
+
}
|
|
170
148
|
|
|
171
|
-
|
|
149
|
+
getBaseUnit(ratio) {
|
|
172
150
|
return this.width / this.getBaseWidth(ratio);
|
|
173
|
-
}
|
|
151
|
+
}
|
|
174
152
|
|
|
175
|
-
|
|
176
|
-
|
|
153
|
+
getBaseWidth(ratio) {
|
|
154
|
+
const characterLength = 3 * (ratio + 2);
|
|
177
155
|
return this.quietZoneLength + characterLength * (this.dataLength + 2) + this.gapWidth * (this.dataLength + 1);
|
|
178
|
-
}
|
|
156
|
+
}
|
|
179
157
|
|
|
180
|
-
|
|
158
|
+
addStart() {
|
|
181
159
|
this.addPattern(this.characterMap.START.pattern);
|
|
182
160
|
this.addCharacterGap();
|
|
183
|
-
}
|
|
161
|
+
}
|
|
184
162
|
|
|
185
|
-
|
|
163
|
+
addBase(character) {
|
|
186
164
|
this.addPattern(character.pattern);
|
|
187
165
|
this.addCharacterGap();
|
|
188
|
-
}
|
|
166
|
+
}
|
|
189
167
|
|
|
190
|
-
|
|
168
|
+
addStop() {
|
|
191
169
|
this.addPattern(this.characterMap.START.pattern);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
Code39.prototype.addPattern = function addPattern (pattern) {
|
|
195
|
-
var this$1 = this;
|
|
170
|
+
}
|
|
196
171
|
|
|
197
|
-
|
|
198
|
-
|
|
172
|
+
addPattern(pattern) {
|
|
173
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
174
|
+
this.patternString += this.patternMappings[pattern.charAt(i)];
|
|
199
175
|
}
|
|
200
|
-
}
|
|
176
|
+
}
|
|
201
177
|
|
|
202
|
-
|
|
178
|
+
addCharacterGap() {
|
|
203
179
|
this.patternString += this.gapWidth + this.splitCharacter;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return Code39;
|
|
207
|
-
}(Code39Base));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
208
182
|
|
|
209
183
|
setDefaultOptions(Code39, {
|
|
210
184
|
addCheckSum: false
|
|
@@ -2,41 +2,29 @@ import { Code93 } from './code93';
|
|
|
2
2
|
import { Code39ExtendedBase } from './code39-extended';
|
|
3
3
|
import deepExtend from '../../common/deep-extend';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if ( Code93 ) Code93Extended.__proto__ = Code93;
|
|
11
|
-
Code93Extended.prototype = Object.create( Code93 && Code93.prototype );
|
|
12
|
-
Code93Extended.prototype.constructor = Code93Extended;
|
|
13
|
-
|
|
14
|
-
Code93Extended.prototype.initProperties = function initProperties () {
|
|
15
|
-
Code93.prototype.initProperties.call(this);
|
|
5
|
+
export class Code93Extended extends Code93 {
|
|
6
|
+
initProperties() {
|
|
7
|
+
super.initProperties();
|
|
16
8
|
|
|
17
9
|
deepExtend(this, Code39ExtendedBase, {
|
|
18
10
|
name: "Code 93 extended",
|
|
19
11
|
pushCheckSum: function() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var checkValues = this._getCheckValues();
|
|
23
|
-
var value;
|
|
12
|
+
const checkValues = this._getCheckValues();
|
|
13
|
+
let value;
|
|
24
14
|
|
|
25
15
|
this.checksum = checkValues.join("");
|
|
26
16
|
|
|
27
|
-
for (
|
|
17
|
+
for (let i = 0; i < checkValues.length; i++) {
|
|
28
18
|
value = checkValues[i];
|
|
29
19
|
|
|
30
|
-
if (this
|
|
31
|
-
this
|
|
20
|
+
if (this.shiftValuesAsciiCodes[value]) {
|
|
21
|
+
this.addExtended(this.shiftValuesAsciiCodes[value]);
|
|
32
22
|
} else {
|
|
33
|
-
|
|
34
|
-
this
|
|
23
|
+
const characterByValue = this._findCharacterByValue(value);
|
|
24
|
+
this.addPattern(this.characterMap[characterByValue].pattern);
|
|
35
25
|
}
|
|
36
26
|
}
|
|
37
27
|
}
|
|
38
28
|
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return Code93Extended;
|
|
42
|
-
}(Code93));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { Code39Base } from './code39';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const extend = Object.assign;
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if ( Code39Base ) Code93.__proto__ = Code39Base;
|
|
11
|
-
Code93.prototype = Object.create( Code39Base && Code39Base.prototype );
|
|
12
|
-
Code93.prototype.constructor = Code93;
|
|
13
|
-
|
|
14
|
-
Code93.prototype.initProperties = function initProperties () {
|
|
15
|
-
Code39Base.prototype.initProperties.call(this);
|
|
5
|
+
export class Code93 extends Code39Base {
|
|
6
|
+
initProperties() {
|
|
7
|
+
super.initProperties();
|
|
16
8
|
|
|
17
9
|
extend(this, {
|
|
18
10
|
name: "Code 93",
|
|
@@ -71,79 +63,75 @@ export var Code93 = (function (Code39Base) {
|
|
|
71
63
|
TERMINATION_BAR: "1"
|
|
72
64
|
}
|
|
73
65
|
});
|
|
74
|
-
}
|
|
66
|
+
}
|
|
75
67
|
|
|
76
|
-
|
|
68
|
+
initValue(value, width, height) {
|
|
77
69
|
this.value = value;
|
|
78
70
|
this.width = width;
|
|
79
71
|
this.height = height;
|
|
80
72
|
this.pattern = [];
|
|
81
73
|
this.values = [];
|
|
82
74
|
this.dataLength = value.length;
|
|
83
|
-
}
|
|
75
|
+
}
|
|
84
76
|
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
prepareValues() {
|
|
78
|
+
let minHeight = Math.ceil(Math.max(0.15 * this.width, 24));
|
|
87
79
|
|
|
88
80
|
if (this.height < minHeight) {
|
|
89
|
-
throw new Error(
|
|
81
|
+
throw new Error(`Insufficient height for Code93 encoding: the current height is ${this.height}px, the minimum required height is ${minHeight}px.`);
|
|
90
82
|
}
|
|
91
83
|
|
|
92
84
|
this.setBaseUnit();
|
|
93
85
|
|
|
94
86
|
if (this.baseUnit < this.minBaseUnitLength) {
|
|
95
|
-
|
|
96
|
-
throw new Error(
|
|
87
|
+
const minWidth = Math.ceil(this.minBaseUnitLength * (this.width / this.baseUnit));
|
|
88
|
+
throw new Error(`Insufficient width for Code93 encoding: the current width is ${this.width}px and the minimum required width for value "${this.value}" is ${minWidth}px.`);
|
|
97
89
|
}
|
|
98
|
-
}
|
|
90
|
+
}
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
setBaseUnit() {
|
|
93
|
+
const checkSumLength = 2;
|
|
102
94
|
|
|
103
95
|
this.baseUnit = this.width / (9 * (this.dataLength + 2 + checkSumLength) + this.quietZoneLength + 1);
|
|
104
|
-
}
|
|
96
|
+
}
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
addStart() {
|
|
99
|
+
let pattern = this.characterMap.START.pattern;
|
|
108
100
|
this.addPattern(pattern);
|
|
109
|
-
}
|
|
101
|
+
}
|
|
110
102
|
|
|
111
|
-
|
|
103
|
+
addStop() {
|
|
112
104
|
this.addStart();
|
|
113
105
|
this.pattern.push(this.characterMap.TERMINATION_BAR);
|
|
114
|
-
}
|
|
106
|
+
}
|
|
115
107
|
|
|
116
|
-
|
|
108
|
+
addBase(charData) {
|
|
117
109
|
this.addPattern(charData.pattern);
|
|
118
110
|
this.values.push(charData.value);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
Code93.prototype.pushCheckSum = function pushCheckSum () {
|
|
122
|
-
var this$1 = this;
|
|
111
|
+
}
|
|
123
112
|
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
pushCheckSum() {
|
|
114
|
+
const checkValues = this._getCheckValues();
|
|
115
|
+
let charData;
|
|
126
116
|
|
|
127
117
|
this.checksum = checkValues.join("");
|
|
128
118
|
|
|
129
|
-
for (
|
|
130
|
-
charData = this
|
|
131
|
-
this
|
|
119
|
+
for (let i = 0; i < checkValues.length; i++) {
|
|
120
|
+
charData = this.characterMap[this._findCharacterByValue(checkValues[i])];
|
|
121
|
+
this.addPattern(charData.pattern);
|
|
132
122
|
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
Code93.prototype._getCheckValues = function _getCheckValues () {
|
|
136
|
-
var this$1 = this;
|
|
123
|
+
}
|
|
137
124
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
125
|
+
_getCheckValues() {
|
|
126
|
+
const values = this.values;
|
|
127
|
+
const length = values.length;
|
|
128
|
+
let wightedSum = 0;
|
|
129
|
+
let cValue;
|
|
130
|
+
let kValue;
|
|
131
|
+
let idx;
|
|
144
132
|
|
|
145
133
|
for (idx = length - 1; idx >= 0; idx--) {
|
|
146
|
-
wightedSum += this
|
|
134
|
+
wightedSum += this.weightedValue(values[idx], length - idx, this.cCheckSumTotal);
|
|
147
135
|
}
|
|
148
136
|
|
|
149
137
|
cValue = wightedSum % this.checkSumMod;
|
|
@@ -151,37 +139,31 @@ export var Code93 = (function (Code39Base) {
|
|
|
151
139
|
wightedSum = this.weightedValue(cValue, 1, this.kCheckSumTotal);
|
|
152
140
|
|
|
153
141
|
for (idx = length - 1; idx >= 0; idx--) {
|
|
154
|
-
wightedSum += this
|
|
142
|
+
wightedSum += this.weightedValue(values[idx], length - idx + 1, this.kCheckSumTotal);
|
|
155
143
|
}
|
|
156
144
|
|
|
157
145
|
kValue = wightedSum % this.checkSumMod;
|
|
158
146
|
return [cValue, kValue];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
Code93.prototype._findCharacterByValue = function _findCharacterByValue (value) {
|
|
162
|
-
var this$1 = this;
|
|
147
|
+
}
|
|
163
148
|
|
|
164
|
-
|
|
165
|
-
|
|
149
|
+
_findCharacterByValue(value) {
|
|
150
|
+
for (let character in this.characterMap) {
|
|
151
|
+
if (this.characterMap[character].value === value) {
|
|
166
152
|
return character;
|
|
167
153
|
}
|
|
168
154
|
}
|
|
169
|
-
}
|
|
155
|
+
}
|
|
170
156
|
|
|
171
|
-
|
|
157
|
+
weightedValue(value, index, total) {
|
|
172
158
|
return (index % total || total) * value;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
Code93.prototype.addPattern = function addPattern (pattern) {
|
|
176
|
-
var this$1 = this;
|
|
159
|
+
}
|
|
177
160
|
|
|
178
|
-
|
|
161
|
+
addPattern(pattern) {
|
|
162
|
+
let value;
|
|
179
163
|
|
|
180
|
-
for (
|
|
164
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
181
165
|
value = parseInt(pattern.charAt(i), 10);
|
|
182
|
-
this
|
|
166
|
+
this.pattern.push(value);
|
|
183
167
|
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return Code93;
|
|
187
|
-
}(Code39Base));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { Encoding } from './encoding';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const extend = Object.assign;
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if ( Encoding ) Ean13.__proto__ = Encoding;
|
|
11
|
-
Ean13.prototype = Object.create( Encoding && Encoding.prototype );
|
|
12
|
-
Ean13.prototype.constructor = Ean13;
|
|
13
|
-
|
|
14
|
-
Ean13.prototype.initProperties = function initProperties () {
|
|
15
|
-
Encoding.prototype.initProperties.call(this);
|
|
5
|
+
export class Ean13 extends Encoding {
|
|
6
|
+
initProperties() {
|
|
7
|
+
super.initProperties();
|
|
16
8
|
|
|
17
9
|
extend(this, {
|
|
18
10
|
name: "EAN 13",
|
|
@@ -45,10 +37,10 @@ export var Ean13 = (function (Encoding) {
|
|
|
45
37
|
middle: [1, 1, 1, 1, 1]
|
|
46
38
|
}
|
|
47
39
|
});
|
|
48
|
-
}
|
|
40
|
+
}
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
initValue(value, width, height) {
|
|
43
|
+
const valueAsString = String(value);
|
|
52
44
|
|
|
53
45
|
if (valueAsString.length !== 12 || /\D/.test(valueAsString)) {
|
|
54
46
|
throw new Error('The value of the "EAN13" encoding should be 12 symbols');
|
|
@@ -62,50 +54,46 @@ export var Ean13 = (function (Encoding) {
|
|
|
62
54
|
this.leftKey = valueAsString[0];
|
|
63
55
|
this.leftPart = valueAsString.substr(1, 6);
|
|
64
56
|
this.rightPart = valueAsString.substr(7) + this.checksum;
|
|
65
|
-
}
|
|
57
|
+
}
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
addData() {
|
|
68
60
|
this.addPieces(this.characterMap.start);
|
|
69
61
|
this.addSide(this.leftPart, this.leftKey);
|
|
70
62
|
this.addPieces(this.characterMap.middle);
|
|
71
63
|
this.addSide(this.rightPart);
|
|
72
64
|
this.addPieces(this.characterMap.start);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Ean13.prototype.addSide = function addSide (leftPart, key) {
|
|
76
|
-
var this$1 = this;
|
|
65
|
+
}
|
|
77
66
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
addSide(leftPart, key) {
|
|
68
|
+
for (let i = 0; i < leftPart.length; i++) {
|
|
69
|
+
if (key && parseInt(this.keyTable[key].charAt(i), 10)) {
|
|
70
|
+
this.addPieces(Array.prototype.slice.call(this.characterMap.digits[leftPart.charAt(i)]).reverse(), true);
|
|
81
71
|
} else {
|
|
82
|
-
this
|
|
72
|
+
this.addPieces(this.characterMap.digits[leftPart.charAt(i)], true);
|
|
83
73
|
}
|
|
84
74
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Ean13.prototype.addPieces = function addPieces (arrToAdd, limitedHeight) {
|
|
88
|
-
var this$1 = this;
|
|
75
|
+
}
|
|
89
76
|
|
|
90
|
-
|
|
77
|
+
addPieces(arrToAdd, limitedHeight) {
|
|
78
|
+
for (let i = 0; i < arrToAdd.length; i++) {
|
|
91
79
|
if (limitedHeight) {
|
|
92
|
-
this
|
|
80
|
+
this.pattern.push({
|
|
93
81
|
y1: 0,
|
|
94
|
-
y2: this
|
|
82
|
+
y2: this.options.height * 0.95,
|
|
95
83
|
width: arrToAdd[i]
|
|
96
84
|
});
|
|
97
85
|
} else {
|
|
98
|
-
this
|
|
86
|
+
this.pattern.push(arrToAdd[i]);
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
|
-
}
|
|
89
|
+
}
|
|
102
90
|
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
calculateChecksum() {
|
|
92
|
+
let odd = 0,
|
|
105
93
|
even = 0,
|
|
106
94
|
value = this.value.split("").reverse().join("");
|
|
107
95
|
|
|
108
|
-
for (
|
|
96
|
+
for (let i = 0; i < value.length; i++) {
|
|
109
97
|
if (i % 2) {
|
|
110
98
|
even += parseInt(value.charAt(i), 10);
|
|
111
99
|
} else {
|
|
@@ -113,10 +101,8 @@ export var Ean13 = (function (Encoding) {
|
|
|
113
101
|
}
|
|
114
102
|
}
|
|
115
103
|
|
|
116
|
-
|
|
104
|
+
let checksum = (10 - ((3 * odd + even) % 10)) % 10;
|
|
117
105
|
|
|
118
106
|
return checksum;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return Ean13;
|
|
122
|
-
}(Encoding));
|
|
107
|
+
}
|
|
108
|
+
}
|