@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
package/dist/es/core/text-box.js
CHANGED
|
@@ -10,11 +10,12 @@ import rectToBox from './utils/rect-to-box';
|
|
|
10
10
|
import { getSpacing, deepExtend, defined } from '../common';
|
|
11
11
|
import { X, Y } from '../common/constants';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const ROWS_SPLIT_REGEX = /\n/m;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
class TextBox extends BoxElement {
|
|
16
|
+
|
|
17
|
+
constructor(content, options, data) {
|
|
18
|
+
super(options);
|
|
18
19
|
this.content = content;
|
|
19
20
|
this.data = data;
|
|
20
21
|
|
|
@@ -24,39 +25,35 @@ var TextBox = (function (BoxElement) {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var options = this.options;
|
|
33
|
-
var rows = String(this.content).split(ROWS_SPLIT_REGEX);
|
|
34
|
-
var floatElement = new FloatElement({ vertical: true, align: options.align, wrap: false });
|
|
35
|
-
var textOptions = deepExtend({ }, options, { opacity: 1, animation: null });
|
|
28
|
+
_initContainer() {
|
|
29
|
+
const options = this.options;
|
|
30
|
+
const rows = String(this.content).split(ROWS_SPLIT_REGEX);
|
|
31
|
+
const floatElement = new FloatElement({ vertical: true, align: options.align, wrap: false });
|
|
32
|
+
const textOptions = deepExtend({ }, options, { opacity: 1, animation: null });
|
|
36
33
|
|
|
37
34
|
this.container = floatElement;
|
|
38
35
|
this.append(floatElement);
|
|
39
36
|
|
|
40
|
-
for (
|
|
41
|
-
|
|
37
|
+
for (let rowIdx = 0; rowIdx < rows.length; rowIdx++) {
|
|
38
|
+
let text = new Text(rows[rowIdx].trim(), textOptions);
|
|
42
39
|
floatElement.append(text);
|
|
43
40
|
}
|
|
44
|
-
}
|
|
41
|
+
}
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
reflow(targetBox) {
|
|
44
|
+
const options = this.options;
|
|
45
|
+
const visualFn = options.visual;
|
|
49
46
|
this.container.options.align = options.align;
|
|
50
47
|
|
|
51
48
|
if (visualFn && !this._boxReflow) {
|
|
52
|
-
|
|
49
|
+
let visualBox = targetBox;
|
|
53
50
|
if (!visualBox.hasSize()) {
|
|
54
51
|
this._boxReflow = true;
|
|
55
52
|
this.reflow(visualBox);
|
|
56
53
|
this._boxReflow = false;
|
|
57
54
|
visualBox = this.box;
|
|
58
55
|
}
|
|
59
|
-
|
|
56
|
+
const visual = this.visual = visualFn(this.visualContext(visualBox));
|
|
60
57
|
|
|
61
58
|
if (visual) {
|
|
62
59
|
visualBox = rectToBox(visual.clippedBBox() || new geom.Rect());
|
|
@@ -66,11 +63,11 @@ var TextBox = (function (BoxElement) {
|
|
|
66
63
|
|
|
67
64
|
this.box = this.contentBox = this.paddingBox = visualBox;
|
|
68
65
|
} else {
|
|
69
|
-
|
|
66
|
+
super.reflow(targetBox);
|
|
70
67
|
|
|
71
68
|
if (options.rotation) {
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
const margin = getSpacing(options.margin);
|
|
70
|
+
let box = this.box.unpad(margin);
|
|
74
71
|
|
|
75
72
|
this.targetBox = targetBox;
|
|
76
73
|
this.normalBox = box.clone();
|
|
@@ -83,10 +80,10 @@ var TextBox = (function (BoxElement) {
|
|
|
83
80
|
box.pad(margin);
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
|
-
}
|
|
83
|
+
}
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
createVisual() {
|
|
86
|
+
const options = this.options;
|
|
90
87
|
|
|
91
88
|
this.visual = new draw.Group({
|
|
92
89
|
transform: this.rotationTransform(),
|
|
@@ -95,41 +92,39 @@ var TextBox = (function (BoxElement) {
|
|
|
95
92
|
});
|
|
96
93
|
|
|
97
94
|
if (this.hasBox()) {
|
|
98
|
-
|
|
95
|
+
const box = draw.Path.fromRect(this.paddingBox.toRect(), this.visualStyle());
|
|
99
96
|
this.visual.append(box);
|
|
100
97
|
}
|
|
101
|
-
}
|
|
98
|
+
}
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
renderVisual() {
|
|
104
101
|
if (!this.options.visible) {
|
|
105
102
|
return;
|
|
106
103
|
}
|
|
107
104
|
|
|
108
105
|
if (this.options.visual) {
|
|
109
|
-
|
|
106
|
+
const visual = this.visual;
|
|
110
107
|
if (visual && !defined(visual.options.noclip)) {
|
|
111
108
|
visual.options.noclip = this.options.noclip;
|
|
112
109
|
}
|
|
113
110
|
this.addVisual();
|
|
114
111
|
this.createAnimation();
|
|
115
112
|
} else {
|
|
116
|
-
|
|
113
|
+
super.renderVisual();
|
|
117
114
|
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
TextBox.prototype.visualContext = function visualContext (targetBox) {
|
|
121
|
-
var this$1 = this;
|
|
115
|
+
}
|
|
122
116
|
|
|
123
|
-
|
|
117
|
+
visualContext(targetBox) {
|
|
118
|
+
const context = {
|
|
124
119
|
text: this.content,
|
|
125
120
|
rect: targetBox.toRect(),
|
|
126
121
|
sender: this.getSender(),
|
|
127
122
|
options: this.options,
|
|
128
|
-
createVisual:
|
|
129
|
-
this
|
|
130
|
-
this
|
|
131
|
-
this
|
|
132
|
-
return this
|
|
123
|
+
createVisual: () => {
|
|
124
|
+
this._boxReflow = true;
|
|
125
|
+
this.reflow(targetBox);
|
|
126
|
+
this._boxReflow = false;
|
|
127
|
+
return this.getDefaultVisual();
|
|
133
128
|
}
|
|
134
129
|
};
|
|
135
130
|
if (this.data) {
|
|
@@ -137,41 +132,37 @@ var TextBox = (function (BoxElement) {
|
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
return context;
|
|
140
|
-
}
|
|
135
|
+
}
|
|
141
136
|
|
|
142
|
-
|
|
137
|
+
getDefaultVisual() {
|
|
143
138
|
this.createVisual();
|
|
144
139
|
this.renderChildren();
|
|
145
|
-
|
|
140
|
+
const visual = this.visual;
|
|
146
141
|
delete this.visual;
|
|
147
142
|
return visual;
|
|
148
|
-
}
|
|
143
|
+
}
|
|
149
144
|
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
rotate() {
|
|
146
|
+
const options = this.options;
|
|
152
147
|
this.box.rotate(options.rotation);
|
|
153
148
|
this.align(this.targetBox, X, options.align);
|
|
154
149
|
this.align(this.targetBox, Y, options.vAlign);
|
|
155
150
|
return this.box;
|
|
156
|
-
}
|
|
151
|
+
}
|
|
157
152
|
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
rotationTransform() {
|
|
154
|
+
const rotation = this.options.rotation;
|
|
160
155
|
if (!rotation) {
|
|
161
156
|
return null;
|
|
162
157
|
}
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
var cy = ref.y;
|
|
167
|
-
var boxCenter = this.rotatedBox.center();
|
|
159
|
+
const { x: cx, y: cy } = this.normalBox.center();
|
|
160
|
+
const boxCenter = this.rotatedBox.center();
|
|
168
161
|
|
|
169
162
|
return geom.transform()
|
|
170
163
|
.translate(boxCenter.x - cx, boxCenter.y - cy)
|
|
171
164
|
.rotate(rotation, [ cx, cy ]);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return TextBox;
|
|
175
|
-
}(BoxElement));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
176
167
|
|
|
177
168
|
export default TextBox;
|
package/dist/es/core/text.js
CHANGED
|
@@ -6,11 +6,12 @@ import Box from './box';
|
|
|
6
6
|
import { DEFAULT_FONT, BLACK } from '../common/constants';
|
|
7
7
|
import { setDefaultOptions } from '../common';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const DrawingText = draw.Text;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
class Text extends ChartElement {
|
|
12
|
+
|
|
13
|
+
constructor(content, options) {
|
|
14
|
+
super(options);
|
|
14
15
|
|
|
15
16
|
this.content = content;
|
|
16
17
|
|
|
@@ -18,28 +19,18 @@ var Text = (function (ChartElement) {
|
|
|
18
19
|
this.reflow(new Box());
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Text.prototype.reflow = function reflow (targetBox) {
|
|
26
|
-
var options = this.options;
|
|
27
|
-
var size = options.size = draw.util.measureText(this.content, { font: options.font });
|
|
22
|
+
reflow(targetBox) {
|
|
23
|
+
const options = this.options;
|
|
24
|
+
const size = options.size = draw.util.measureText(this.content, { font: options.font });
|
|
28
25
|
|
|
29
26
|
this.baseline = size.baseline;
|
|
30
27
|
|
|
31
28
|
this.box = new Box(targetBox.x1, targetBox.y1,
|
|
32
29
|
targetBox.x1 + size.width, targetBox.y1 + size.height);
|
|
33
|
-
}
|
|
30
|
+
}
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var font = ref.font;
|
|
38
|
-
var color = ref.color;
|
|
39
|
-
var opacity = ref.opacity;
|
|
40
|
-
var cursor = ref.cursor;
|
|
41
|
-
var stroke = ref.stroke;
|
|
42
|
-
var paintOrder = ref.paintOrder;
|
|
32
|
+
createVisual() {
|
|
33
|
+
const { font, color, opacity, cursor, stroke, paintOrder } = this.options;
|
|
43
34
|
|
|
44
35
|
this.visual = new DrawingText(this.content, this.box.toRect().topLeft(), {
|
|
45
36
|
font: font,
|
|
@@ -48,10 +39,8 @@ var Text = (function (ChartElement) {
|
|
|
48
39
|
stroke: stroke,
|
|
49
40
|
paintOrder: paintOrder
|
|
50
41
|
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return Text;
|
|
54
|
-
}(ChartElement));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
55
44
|
|
|
56
45
|
setDefaultOptions(Text, {
|
|
57
46
|
font: DEFAULT_FONT,
|
package/dist/es/core/title.js
CHANGED
|
@@ -4,9 +4,9 @@ import TextBox from './text-box';
|
|
|
4
4
|
import { X, BLACK, TOP, CENTER, BOTTOM } from '../common/constants';
|
|
5
5
|
import { getSpacing, setDefaultOptions } from '../common';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
class Title extends ChartElement {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super(options);
|
|
10
10
|
|
|
11
11
|
this._textBox = new TextBox(this.options.text, Object.assign({}, this.options, {
|
|
12
12
|
vAlign: this.options.position
|
|
@@ -15,17 +15,13 @@ var Title = (function (ChartElement) {
|
|
|
15
15
|
this.append(this._textBox);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Title.prototype.constructor = Title;
|
|
21
|
-
|
|
22
|
-
Title.prototype.reflow = function reflow (targetBox) {
|
|
23
|
-
ChartElement.prototype.reflow.call(this, targetBox);
|
|
18
|
+
reflow(targetBox) {
|
|
19
|
+
super.reflow(targetBox);
|
|
24
20
|
this.box.snapTo(targetBox, X);
|
|
25
|
-
}
|
|
21
|
+
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
static buildTitle(options, defaultOptions) {
|
|
24
|
+
let titleOptions = options;
|
|
29
25
|
|
|
30
26
|
if (typeof options === "string") {
|
|
31
27
|
titleOptions = { text: options };
|
|
@@ -33,33 +29,31 @@ var Title = (function (ChartElement) {
|
|
|
33
29
|
|
|
34
30
|
titleOptions = Object.assign({ visible: true }, defaultOptions, titleOptions);
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
let title;
|
|
37
33
|
if (titleOptions && titleOptions.visible && titleOptions.text) {
|
|
38
34
|
title = new Title(titleOptions);
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
return title;
|
|
42
|
-
}
|
|
38
|
+
}
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
static orderTitles(titles) {
|
|
41
|
+
const items = [].concat(titles);
|
|
42
|
+
const top = items.filter(item => item && item.options.position !== BOTTOM);
|
|
43
|
+
const bottom = items.filter(item => item && item.options.position === BOTTOM);
|
|
48
44
|
|
|
49
45
|
collapseVerticalMargins(top);
|
|
50
46
|
collapseVerticalMargins(bottom);
|
|
51
47
|
|
|
52
48
|
bottom.reverse();
|
|
53
49
|
return top.concat(bottom);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return Title;
|
|
57
|
-
}(ChartElement));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
58
52
|
|
|
59
53
|
function collapseVerticalMargins(items) {
|
|
60
|
-
for (
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
for (let i = 1; i < items.length; i++) {
|
|
55
|
+
const box = items[i]._textBox;
|
|
56
|
+
const prevBox = items[i - 1]._textBox;
|
|
63
57
|
prevBox.options.margin = Object.assign(getSpacing(prevBox.options.margin), { bottom: 0 });
|
|
64
58
|
box.options.margin = Object.assign(getSpacing(box.options.margin), { top: 0 });
|
|
65
59
|
}
|
|
@@ -5,12 +5,12 @@ export default function autoAxisMax(min, max, narrow) {
|
|
|
5
5
|
return 1;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
let axisMax;
|
|
9
9
|
|
|
10
10
|
if (min <= 0 && max <= 0) {
|
|
11
|
-
|
|
11
|
+
const maxValue = min === max ? 0 : max;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
let diff = Math.abs((maxValue - min) / maxValue);
|
|
14
14
|
if (narrow === false || (!narrow && diff > ZERO_THRESHOLD)) {
|
|
15
15
|
return 0;
|
|
16
16
|
}
|
|
@@ -5,12 +5,12 @@ export default function autoAxisMin(min, max, narrow) {
|
|
|
5
5
|
return 0;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
let axisMin;
|
|
9
9
|
|
|
10
10
|
if (min >= 0 && max >= 0) {
|
|
11
|
-
|
|
11
|
+
const minValue = min === max ? 0 : min;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
let diff = (max - minValue) / max;
|
|
14
14
|
if (narrow === false || (!narrow && diff > ZERO_THRESHOLD)) {
|
|
15
15
|
return 0;
|
|
16
16
|
}
|
|
@@ -2,7 +2,7 @@ import { DEFAULT_PRECISION } from '../../common/constants';
|
|
|
2
2
|
import { round } from '../../common';
|
|
3
3
|
|
|
4
4
|
export default function autoMajorUnit(min, max) {
|
|
5
|
-
|
|
5
|
+
let diff = round(max - min, DEFAULT_PRECISION - 1);
|
|
6
6
|
|
|
7
7
|
if (diff === 0) {
|
|
8
8
|
if (max === 0) {
|
|
@@ -12,9 +12,9 @@ export default function autoMajorUnit(min, max) {
|
|
|
12
12
|
diff = Math.abs(max);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const scale = Math.pow(10, Math.floor(Math.log(diff) / Math.log(10)));
|
|
16
|
+
const relativeValue = round((diff / scale), DEFAULT_PRECISION);
|
|
17
|
+
let scaleMultiplier = 1;
|
|
18
18
|
|
|
19
19
|
if (relativeValue < 1.904762) {
|
|
20
20
|
scaleMultiplier = 0.2;
|
|
@@ -6,15 +6,15 @@ export default function boxDiff(r, s) {
|
|
|
6
6
|
return s;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const a = Math.min(r.x1, s.x1);
|
|
10
|
+
const b = Math.max(r.x1, s.x1);
|
|
11
|
+
const c = Math.min(r.x2, s.x2);
|
|
12
|
+
const d = Math.max(r.x2, s.x2);
|
|
13
|
+
const e = Math.min(r.y1, s.y1);
|
|
14
|
+
const f = Math.max(r.y1, s.y1);
|
|
15
|
+
const g = Math.min(r.y2, s.y2);
|
|
16
|
+
const h = Math.max(r.y2, s.y2);
|
|
17
|
+
const boxes = [];
|
|
18
18
|
|
|
19
19
|
// X = intersection, 0-7 = possible difference areas
|
|
20
20
|
// h +-+-+-+
|
|
@@ -3,11 +3,9 @@ import { drawing as draw } from '@progress/kendo-drawing';
|
|
|
3
3
|
import { alignPathToPixel } from '../../common';
|
|
4
4
|
|
|
5
5
|
export default function createAxisGridLine(options, gridLine) {
|
|
6
|
-
|
|
7
|
-
var lineEnd = options.lineEnd;
|
|
8
|
-
var position = options.position;
|
|
6
|
+
const { lineStart, lineEnd, position } = options;
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
const line = new draw.Path({
|
|
11
9
|
stroke: {
|
|
12
10
|
width: gridLine.width,
|
|
13
11
|
color: gridLine.color,
|
|
@@ -3,11 +3,9 @@ import { drawing as draw } from '@progress/kendo-drawing';
|
|
|
3
3
|
import { alignPathToPixel } from '../../common';
|
|
4
4
|
|
|
5
5
|
export default function createAxisTick(options, tickOptions) {
|
|
6
|
-
|
|
7
|
-
var tickY = options.tickY;
|
|
8
|
-
var position = options.position;
|
|
6
|
+
const { tickX, tickY, position } = options;
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
const tick = new draw.Path({
|
|
11
9
|
stroke: {
|
|
12
10
|
width: tickOptions.width,
|
|
13
11
|
color: tickOptions.color
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Box from '../box';
|
|
2
2
|
|
|
3
3
|
export default function rectToBox(rect) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const origin = rect.origin;
|
|
5
|
+
const bottomRight = rect.bottomRight();
|
|
6
6
|
|
|
7
7
|
return new Box(origin.x, origin.y, bottomRight.x, bottomRight.y);
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TIME_PER_MINUTE } from './constants';
|
|
2
2
|
|
|
3
3
|
export default function absoluteDateDiff(a, b) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const diff = a.getTime() - b;
|
|
5
|
+
const offsetDiff = a.getTimezoneOffset() - b.getTimezoneOffset();
|
|
6
6
|
|
|
7
7
|
return diff - (offsetDiff * TIME_PER_MINUTE);
|
|
8
8
|
}
|
|
@@ -14,21 +14,21 @@ function adjustDST(date, hours) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function addHours(date, hours) {
|
|
17
|
-
|
|
17
|
+
const roundedDate = new Date(date);
|
|
18
18
|
|
|
19
19
|
roundedDate.setMinutes(0, 0, 0);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const tzDiff = (date.getTimezoneOffset() - roundedDate.getTimezoneOffset()) * TIME_PER_MINUTE;
|
|
22
22
|
|
|
23
23
|
return addTicks(roundedDate, tzDiff + hours * TIME_PER_HOUR);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export default function addDuration(dateValue, value, unit, weekStartDay) {
|
|
27
|
-
|
|
27
|
+
let result = dateValue;
|
|
28
28
|
|
|
29
29
|
if (dateValue) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
let date = toDate(dateValue);
|
|
31
|
+
const hours = date.getHours();
|
|
32
32
|
|
|
33
33
|
if (unit === YEARS) {
|
|
34
34
|
result = new Date(date.getFullYear() + value, 0, 1);
|
|
@@ -3,7 +3,7 @@ import addDuration from './add-duration';
|
|
|
3
3
|
import toDate from './to-date';
|
|
4
4
|
|
|
5
5
|
export default function ceilDate(dateValue, unit, weekStartDay) {
|
|
6
|
-
|
|
6
|
+
const date = toDate(dateValue);
|
|
7
7
|
|
|
8
8
|
if (date && floorDate(date, unit, weekStartDay).getTime() === date.getTime()) {
|
|
9
9
|
return date;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
1
|
+
export const MILLISECONDS = "milliseconds";
|
|
2
|
+
export const SECONDS = "seconds";
|
|
3
|
+
export const MINUTES = "minutes";
|
|
4
|
+
export const HOURS = "hours";
|
|
5
|
+
export const DAYS = "days";
|
|
6
|
+
export const WEEKS = "weeks";
|
|
7
|
+
export const MONTHS = "months";
|
|
8
|
+
export const YEARS = "years";
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
10
|
+
export const TIME_PER_MILLISECOND = 1;
|
|
11
|
+
export const TIME_PER_SECOND = 1000;
|
|
12
|
+
export const TIME_PER_MINUTE = 60 * TIME_PER_SECOND;
|
|
13
|
+
export const TIME_PER_HOUR = 60 * TIME_PER_MINUTE;
|
|
14
|
+
export const TIME_PER_DAY = 24 * TIME_PER_HOUR;
|
|
15
|
+
export const TIME_PER_WEEK = 7 * TIME_PER_DAY;
|
|
16
|
+
export const TIME_PER_MONTH = 31 * TIME_PER_DAY;
|
|
17
|
+
export const TIME_PER_YEAR = 365 * TIME_PER_DAY;
|
|
18
|
+
export const TIME_PER_UNIT = {
|
|
19
19
|
"years": TIME_PER_YEAR,
|
|
20
20
|
"months": TIME_PER_MONTH,
|
|
21
21
|
"weeks": TIME_PER_WEEK,
|
|
@@ -8,9 +8,9 @@ function timeIndex(date, start, baseUnit) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export default function dateIndex(value, start, baseUnit, baseUnitStep) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const date = toDate(value);
|
|
12
|
+
const startDate = toDate(start);
|
|
13
|
+
let index;
|
|
14
14
|
|
|
15
15
|
if (baseUnit === MONTHS) {
|
|
16
16
|
index = (date.getMonth() - startDate.getMonth() + (date.getFullYear() - startDate.getFullYear()) * 12) +
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import dateEquals from './date-equals';
|
|
2
2
|
|
|
3
3
|
export default function lteDateIndex(date, sortedDates) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
let low = 0;
|
|
5
|
+
let high = sortedDates.length - 1;
|
|
6
|
+
let index;
|
|
7
7
|
|
|
8
8
|
while (low <= high) {
|
|
9
9
|
index = Math.floor((low + high) / 2);
|
|
10
|
-
|
|
10
|
+
const currentDate = sortedDates[index];
|
|
11
11
|
|
|
12
12
|
if (currentDate < date) {
|
|
13
13
|
low = index + 1;
|
|
@@ -4,8 +4,8 @@ import { isArray } from '../common';
|
|
|
4
4
|
|
|
5
5
|
export default function parseDates(intlService, dates) {
|
|
6
6
|
if (isArray(dates)) {
|
|
7
|
-
|
|
8
|
-
for (
|
|
7
|
+
const result = [];
|
|
8
|
+
for (let idx = 0; idx < dates.length; idx++) {
|
|
9
9
|
result.push(parseDate(intlService, dates[idx]));
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { TIME_PER_DAY } from './constants';
|
|
2
2
|
import addTicks from './add-ticks';
|
|
3
3
|
|
|
4
|
-
export default function startOfWeek(date, weekStartDay) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var daysToSubtract = 0;
|
|
8
|
-
var day = date.getDay();
|
|
4
|
+
export default function startOfWeek(date, weekStartDay = 0) {
|
|
5
|
+
let daysToSubtract = 0;
|
|
6
|
+
let day = date.getDay();
|
|
9
7
|
|
|
10
8
|
if (!isNaN(day)) {
|
|
11
9
|
while (day !== weekStartDay) {
|