@antv/component 2.1.1-alpha.1 → 2.1.1-alpha.2
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/component.min.js +1 -1
- package/esm/animation/fadeIn.d.ts +1 -1
- package/esm/animation/fadeOut.d.ts +1 -1
- package/esm/animation/utils.d.ts +3 -3
- package/esm/animation/utils.js +37 -31
- package/esm/animation/utils.js.map +1 -1
- package/esm/constant.js +1 -1
- package/esm/constant.js.map +1 -1
- package/esm/core/component.js +43 -30
- package/esm/core/component.js.map +1 -1
- package/esm/shapes/Text.js +21 -13
- package/esm/shapes/Text.js.map +1 -1
- package/esm/ui/axis/axis.d.ts +1 -1
- package/esm/ui/axis/axis.js +31 -25
- package/esm/ui/axis/axis.js.map +1 -1
- package/esm/ui/axis/constant.js +13 -11
- package/esm/ui/axis/constant.js.map +1 -1
- package/esm/ui/axis/guides/grid.d.ts +1 -1
- package/esm/ui/axis/guides/grid.js +34 -29
- package/esm/ui/axis/guides/grid.js.map +1 -1
- package/esm/ui/axis/guides/labels.js +83 -76
- package/esm/ui/axis/guides/labels.js.map +1 -1
- package/esm/ui/axis/guides/line.js +87 -74
- package/esm/ui/axis/guides/line.js.map +1 -1
- package/esm/ui/axis/guides/ticks.d.ts +1 -1
- package/esm/ui/axis/guides/ticks.js +39 -31
- package/esm/ui/axis/guides/ticks.js.map +1 -1
- package/esm/ui/axis/guides/title.d.ts +1 -1
- package/esm/ui/axis/guides/title.js +37 -33
- package/esm/ui/axis/guides/title.js.map +1 -1
- package/esm/ui/axis/guides/utils.js +12 -10
- package/esm/ui/axis/guides/utils.js.map +1 -1
- package/esm/ui/axis/overlap/autoEllipsis.js +19 -12
- package/esm/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/esm/ui/axis/overlap/autoHide.js +24 -20
- package/esm/ui/axis/overlap/autoHide.js.map +1 -1
- package/esm/ui/axis/overlap/autoRotate.js +25 -11
- package/esm/ui/axis/overlap/autoRotate.js.map +1 -1
- package/esm/ui/axis/overlap/autoWrap.js +14 -11
- package/esm/ui/axis/overlap/autoWrap.js.map +1 -1
- package/esm/ui/axis/overlap/index.js +7 -7
- package/esm/ui/axis/overlap/index.js.map +1 -1
- package/esm/ui/axis/utils/bounds.js +75 -48
- package/esm/ui/axis/utils/bounds.js.map +1 -1
- package/esm/ui/axis/utils/contain.js +14 -14
- package/esm/ui/axis/utils/contain.js.map +1 -1
- package/esm/ui/axis/utils/index.js +7 -3
- package/esm/ui/axis/utils/index.js.map +1 -1
- package/esm/ui/axis/utils/intersect.js +33 -21
- package/esm/ui/axis/utils/intersect.js.map +1 -1
- package/esm/ui/axis/utils/test.js +41 -29
- package/esm/ui/axis/utils/test.js.map +1 -1
- package/esm/ui/breadcrumb/index.js +72 -64
- package/esm/ui/breadcrumb/index.js.map +1 -1
- package/esm/ui/button/constant.js +3 -3
- package/esm/ui/button/constant.js.map +1 -1
- package/esm/ui/button/index.js +97 -81
- package/esm/ui/button/index.js.map +1 -1
- package/esm/ui/checkbox/constant.js +4 -4
- package/esm/ui/checkbox/constant.js.map +1 -1
- package/esm/ui/checkbox/index.js +26 -23
- package/esm/ui/checkbox/index.js.map +1 -1
- package/esm/ui/crosshair/base.js +45 -29
- package/esm/ui/crosshair/base.js.map +1 -1
- package/esm/ui/crosshair/circle.js +34 -25
- package/esm/ui/crosshair/circle.js.map +1 -1
- package/esm/ui/crosshair/constant.js +4 -4
- package/esm/ui/crosshair/constant.js.map +1 -1
- package/esm/ui/crosshair/line.js +75 -55
- package/esm/ui/crosshair/line.js.map +1 -1
- package/esm/ui/crosshair/polygon.js +70 -54
- package/esm/ui/crosshair/polygon.js.map +1 -1
- package/esm/ui/grid/index.d.ts +1 -1
- package/esm/ui/grid/index.js +95 -73
- package/esm/ui/grid/index.js.map +1 -1
- package/esm/ui/indicator/constant.js +2 -2
- package/esm/ui/indicator/constant.js.map +1 -1
- package/esm/ui/indicator/indicator.js +63 -58
- package/esm/ui/indicator/indicator.js.map +1 -1
- package/esm/ui/layout/layout.js +66 -52
- package/esm/ui/layout/layout.js.map +1 -1
- package/esm/ui/legend/base.js +13 -12
- package/esm/ui/legend/base.js.map +1 -1
- package/esm/ui/legend/category/item.js +156 -122
- package/esm/ui/legend/category/item.js.map +1 -1
- package/esm/ui/legend/category/items.js +201 -158
- package/esm/ui/legend/category/items.js.map +1 -1
- package/esm/ui/legend/category.js +56 -46
- package/esm/ui/legend/category.js.map +1 -1
- package/esm/ui/legend/constant.js +6 -6
- package/esm/ui/legend/constant.js.map +1 -1
- package/esm/ui/legend/continuous/handle.js +33 -28
- package/esm/ui/legend/continuous/handle.js.map +1 -1
- package/esm/ui/legend/continuous/ribbon.js +38 -34
- package/esm/ui/legend/continuous/ribbon.js.map +1 -1
- package/esm/ui/legend/continuous/utils.js +11 -10
- package/esm/ui/legend/continuous/utils.js.map +1 -1
- package/esm/ui/legend/continuous.js +521 -417
- package/esm/ui/legend/continuous.js.map +1 -1
- package/esm/ui/legend/utils.js +31 -24
- package/esm/ui/legend/utils.js.map +1 -1
- package/esm/ui/marker/index.js +44 -38
- package/esm/ui/marker/index.js.map +1 -1
- package/esm/ui/marker/symbol.js +24 -24
- package/esm/ui/marker/symbol.js.map +1 -1
- package/esm/ui/marker/utils.js +2 -2
- package/esm/ui/marker/utils.js.map +1 -1
- package/esm/ui/navigator/index.js +159 -128
- package/esm/ui/navigator/index.js.map +1 -1
- package/esm/ui/poptip/constant.js +68 -67
- package/esm/ui/poptip/constant.js.map +1 -1
- package/esm/ui/poptip/index.js +111 -95
- package/esm/ui/poptip/index.js.map +1 -1
- package/esm/ui/poptip/utils.js +15 -8
- package/esm/ui/poptip/utils.js.map +1 -1
- package/esm/ui/scrollbar/index.js +132 -102
- package/esm/ui/scrollbar/index.js.map +1 -1
- package/esm/ui/select/option.js +58 -48
- package/esm/ui/select/option.js.map +1 -1
- package/esm/ui/select/select.js +164 -142
- package/esm/ui/select/select.js.map +1 -1
- package/esm/ui/slider/constant.js +4 -4
- package/esm/ui/slider/constant.js.map +1 -1
- package/esm/ui/slider/handle.js +54 -46
- package/esm/ui/slider/handle.js.map +1 -1
- package/esm/ui/slider/index.js +326 -280
- package/esm/ui/slider/index.js.map +1 -1
- package/esm/ui/sparkline/columns.js +34 -25
- package/esm/ui/sparkline/columns.js.map +1 -1
- package/esm/ui/sparkline/index.js +180 -145
- package/esm/ui/sparkline/index.js.map +1 -1
- package/esm/ui/sparkline/lines.js +50 -37
- package/esm/ui/sparkline/lines.js.map +1 -1
- package/esm/ui/sparkline/path.js +40 -36
- package/esm/ui/sparkline/path.js.map +1 -1
- package/esm/ui/sparkline/utils.js +9 -8
- package/esm/ui/sparkline/utils.js.map +1 -1
- package/esm/ui/switch/constant.js +1 -1
- package/esm/ui/switch/constant.js.map +1 -1
- package/esm/ui/switch/index.js +54 -44
- package/esm/ui/switch/index.js.map +1 -1
- package/esm/ui/tag/index.js +32 -29
- package/esm/ui/tag/index.js.map +1 -1
- package/esm/ui/timebar/controller.js +79 -69
- package/esm/ui/timebar/controller.js.map +1 -1
- package/esm/ui/timebar/handle.js +71 -62
- package/esm/ui/timebar/handle.js.map +1 -1
- package/esm/ui/timebar/icons.js +478 -308
- package/esm/ui/timebar/icons.js.map +1 -1
- package/esm/ui/timebar/timebar.js +318 -263
- package/esm/ui/timebar/timebar.js.map +1 -1
- package/esm/ui/timebar/utils.js +7 -7
- package/esm/ui/timebar/utils.js.map +1 -1
- package/esm/ui/timeline/index.js +6 -2
- package/esm/ui/timeline/index.js.map +1 -1
- package/esm/ui/title/index.js +64 -59
- package/esm/ui/title/index.js.map +1 -1
- package/esm/ui/tooltip/constant.js +30 -26
- package/esm/ui/tooltip/constant.js.map +1 -1
- package/esm/ui/tooltip/index.js +126 -109
- package/esm/ui/tooltip/index.js.map +1 -1
- package/esm/util/bbox.js +47 -24
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/callback.js +2 -1
- package/esm/util/callback.js.map +1 -1
- package/esm/util/classnames.js +10 -8
- package/esm/util/classnames.js.map +1 -1
- package/esm/util/deep-assign.js +14 -6
- package/esm/util/deep-assign.js.map +1 -1
- package/esm/util/defined.js +1 -1
- package/esm/util/defined.js.map +1 -1
- package/esm/util/ellipsis.js +2 -1
- package/esm/util/ellipsis.js.map +1 -1
- package/esm/util/event.js +3 -3
- package/esm/util/event.js.map +1 -1
- package/esm/util/geometry/line-length.js +4 -1
- package/esm/util/geometry/line-length.js.map +1 -1
- package/esm/util/geometry/lines-intersection.js +10 -5
- package/esm/util/geometry/lines-intersection.js.map +1 -1
- package/esm/util/group-by.js +1 -1
- package/esm/util/group-by.js.map +1 -1
- package/esm/util/group.js +3 -3
- package/esm/util/group.js.map +1 -1
- package/esm/util/html.js +1 -1
- package/esm/util/html.js.map +1 -1
- package/esm/util/if-show.js +5 -3
- package/esm/util/if-show.js.map +1 -1
- package/esm/util/in-range.js +3 -1
- package/esm/util/in-range.js.map +1 -1
- package/esm/util/interpolate.js +19 -12
- package/esm/util/interpolate.js.map +1 -1
- package/esm/util/keyframe-interpolate.d.ts +1 -1
- package/esm/util/keyframe-interpolate.js +7 -6
- package/esm/util/keyframe-interpolate.js.map +1 -1
- package/esm/util/layout/executer.js +4 -4
- package/esm/util/layout/executer.js.map +1 -1
- package/esm/util/layout/flex/index.js +26 -24
- package/esm/util/layout/flex/index.js.map +1 -1
- package/esm/util/layout/grid/index.js +1 -1
- package/esm/util/layout/grid/index.js.map +1 -1
- package/esm/util/layout/utils/helper.js +8 -7
- package/esm/util/layout/utils/helper.js.map +1 -1
- package/esm/util/matrix.js +8 -7
- package/esm/util/matrix.js.map +1 -1
- package/esm/util/number.js +7 -6
- package/esm/util/number.js.map +1 -1
- package/esm/util/offscreen.js +17 -9
- package/esm/util/offscreen.js.map +1 -1
- package/esm/util/omit.js +3 -3
- package/esm/util/omit.js.map +1 -1
- package/esm/util/path.js +41 -36
- package/esm/util/path.js.map +1 -1
- package/esm/util/primitive.js +3 -3
- package/esm/util/primitive.js.map +1 -1
- package/esm/util/replace-children.js +4 -3
- package/esm/util/replace-children.js.map +1 -1
- package/esm/util/sampling.js +3 -3
- package/esm/util/sampling.js.map +1 -1
- package/esm/util/scale-to-pixel.js +5 -4
- package/esm/util/scale-to-pixel.js.map +1 -1
- package/esm/util/selection.js +186 -142
- package/esm/util/selection.js.map +1 -1
- package/esm/util/series.js +1 -1
- package/esm/util/series.js.map +1 -1
- package/esm/util/shape.js +27 -15
- package/esm/util/shape.js.map +1 -1
- package/esm/util/string.js +5 -4
- package/esm/util/string.js.map +1 -1
- package/esm/util/style.js +29 -23
- package/esm/util/style.js.map +1 -1
- package/esm/util/svg2marker.js +16 -13
- package/esm/util/svg2marker.js.map +1 -1
- package/esm/util/text.js +14 -14
- package/esm/util/text.js.map +1 -1
- package/esm/util/throttle.js +13 -7
- package/esm/util/throttle.js.map +1 -1
- package/esm/util/time.js +24 -22
- package/esm/util/time.js.map +1 -1
- package/esm/util/timer.js +9 -5
- package/esm/util/timer.js.map +1 -1
- package/esm/util/transform.js +6 -5
- package/esm/util/transform.js.map +1 -1
- package/esm/util/transpose.js +1 -1
- package/esm/util/transpose.js.map +1 -1
- package/esm/util/traverse.js +1 -1
- package/esm/util/traverse.js.map +1 -1
- package/esm/util/visibility.js +2 -2
- package/esm/util/visibility.js.map +1 -1
- package/esm/util/wrap.js +4 -2
- package/esm/util/wrap.js.map +1 -1
- package/lib/animation/fadeIn.d.ts +1 -1
- package/lib/animation/fadeIn.js +1 -1
- package/lib/animation/fadeIn.js.map +1 -1
- package/lib/animation/fadeOut.d.ts +1 -1
- package/lib/animation/fadeOut.js +1 -1
- package/lib/animation/fadeOut.js.map +1 -1
- package/lib/animation/index.js +1 -1
- package/lib/animation/utils.d.ts +3 -3
- package/lib/animation/utils.js +39 -33
- package/lib/animation/utils.js.map +1 -1
- package/lib/core/component.js +43 -31
- package/lib/core/component.js.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/shapes/Text.js +22 -15
- package/lib/shapes/Text.js.map +1 -1
- package/lib/shapes/index.js +1 -1
- package/lib/types/index.js +1 -1
- package/lib/ui/axis/axis.d.ts +1 -1
- package/lib/ui/axis/axis.js +39 -34
- package/lib/ui/axis/axis.js.map +1 -1
- package/lib/ui/axis/constant.js +12 -10
- package/lib/ui/axis/constant.js.map +1 -1
- package/lib/ui/axis/guides/grid.d.ts +1 -1
- package/lib/ui/axis/guides/grid.js +40 -35
- package/lib/ui/axis/guides/grid.js.map +1 -1
- package/lib/ui/axis/guides/labels.js +89 -82
- package/lib/ui/axis/guides/labels.js.map +1 -1
- package/lib/ui/axis/guides/line.js +92 -79
- package/lib/ui/axis/guides/line.js.map +1 -1
- package/lib/ui/axis/guides/ticks.d.ts +1 -1
- package/lib/ui/axis/guides/ticks.js +45 -37
- package/lib/ui/axis/guides/ticks.js.map +1 -1
- package/lib/ui/axis/guides/title.d.ts +1 -1
- package/lib/ui/axis/guides/title.js +41 -37
- package/lib/ui/axis/guides/title.js.map +1 -1
- package/lib/ui/axis/guides/utils.js +14 -12
- package/lib/ui/axis/guides/utils.js.map +1 -1
- package/lib/ui/axis/overlap/autoEllipsis.js +22 -15
- package/lib/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/lib/ui/axis/overlap/autoHide.js +27 -23
- package/lib/ui/axis/overlap/autoHide.js.map +1 -1
- package/lib/ui/axis/overlap/autoRotate.js +26 -12
- package/lib/ui/axis/overlap/autoRotate.js.map +1 -1
- package/lib/ui/axis/overlap/autoWrap.js +16 -13
- package/lib/ui/axis/overlap/autoWrap.js.map +1 -1
- package/lib/ui/axis/overlap/index.js +12 -12
- package/lib/ui/axis/overlap/index.js.map +1 -1
- package/lib/ui/axis/utils/bounds.js +75 -49
- package/lib/ui/axis/utils/bounds.js.map +1 -1
- package/lib/ui/axis/utils/contain.js +15 -15
- package/lib/ui/axis/utils/contain.js.map +1 -1
- package/lib/ui/axis/utils/index.js +8 -4
- package/lib/ui/axis/utils/index.js.map +1 -1
- package/lib/ui/axis/utils/intersect.js +34 -22
- package/lib/ui/axis/utils/intersect.js.map +1 -1
- package/lib/ui/axis/utils/test.js +47 -35
- package/lib/ui/axis/utils/test.js.map +1 -1
- package/lib/ui/breadcrumb/index.js +77 -70
- package/lib/ui/breadcrumb/index.js.map +1 -1
- package/lib/ui/button/index.js +101 -86
- package/lib/ui/button/index.js.map +1 -1
- package/lib/ui/checkbox/constant.js +2 -2
- package/lib/ui/checkbox/constant.js.map +1 -1
- package/lib/ui/checkbox/index.js +28 -26
- package/lib/ui/checkbox/index.js.map +1 -1
- package/lib/ui/crosshair/base.js +48 -33
- package/lib/ui/crosshair/base.js.map +1 -1
- package/lib/ui/crosshair/circle.js +37 -29
- package/lib/ui/crosshair/circle.js.map +1 -1
- package/lib/ui/crosshair/constant.js +1 -1
- package/lib/ui/crosshair/constant.js.map +1 -1
- package/lib/ui/crosshair/index.js +1 -1
- package/lib/ui/crosshair/line.js +77 -58
- package/lib/ui/crosshair/line.js.map +1 -1
- package/lib/ui/crosshair/polygon.js +72 -57
- package/lib/ui/crosshair/polygon.js.map +1 -1
- package/lib/ui/grid/index.d.ts +1 -1
- package/lib/ui/grid/index.js +97 -76
- package/lib/ui/grid/index.js.map +1 -1
- package/lib/ui/indicator/constant.js +1 -1
- package/lib/ui/indicator/constant.js.map +1 -1
- package/lib/ui/indicator/index.js +1 -1
- package/lib/ui/indicator/indicator.js +67 -63
- package/lib/ui/indicator/indicator.js.map +1 -1
- package/lib/ui/layout/layout.js +70 -57
- package/lib/ui/layout/layout.js.map +1 -1
- package/lib/ui/legend/base.js +15 -14
- package/lib/ui/legend/base.js.map +1 -1
- package/lib/ui/legend/category/item.js +159 -126
- package/lib/ui/legend/category/item.js.map +1 -1
- package/lib/ui/legend/category/items.js +208 -166
- package/lib/ui/legend/category/items.js.map +1 -1
- package/lib/ui/legend/category.js +60 -51
- package/lib/ui/legend/category.js.map +1 -1
- package/lib/ui/legend/constant.js +2 -2
- package/lib/ui/legend/constant.js.map +1 -1
- package/lib/ui/legend/continuous/handle.js +35 -31
- package/lib/ui/legend/continuous/handle.js.map +1 -1
- package/lib/ui/legend/continuous/ribbon.js +43 -40
- package/lib/ui/legend/continuous/ribbon.js.map +1 -1
- package/lib/ui/legend/continuous/utils.js +11 -10
- package/lib/ui/legend/continuous/utils.js.map +1 -1
- package/lib/ui/legend/continuous.js +535 -432
- package/lib/ui/legend/continuous.js.map +1 -1
- package/lib/ui/legend/index.js +2 -2
- package/lib/ui/legend/index.js.map +1 -1
- package/lib/ui/legend/utils.js +32 -25
- package/lib/ui/legend/utils.js.map +1 -1
- package/lib/ui/marker/index.js +48 -43
- package/lib/ui/marker/index.js.map +1 -1
- package/lib/ui/marker/symbol.js +22 -22
- package/lib/ui/marker/symbol.js.map +1 -1
- package/lib/ui/marker/utils.js +3 -3
- package/lib/ui/marker/utils.js.map +1 -1
- package/lib/ui/navigator/index.js +165 -135
- package/lib/ui/navigator/index.js.map +1 -1
- package/lib/ui/poptip/constant.js +66 -65
- package/lib/ui/poptip/constant.js.map +1 -1
- package/lib/ui/poptip/index.js +115 -100
- package/lib/ui/poptip/index.js.map +1 -1
- package/lib/ui/poptip/utils.js +15 -8
- package/lib/ui/poptip/utils.js.map +1 -1
- package/lib/ui/scrollbar/index.js +136 -107
- package/lib/ui/scrollbar/index.js.map +1 -1
- package/lib/ui/select/option.js +61 -52
- package/lib/ui/select/option.js.map +1 -1
- package/lib/ui/select/select.js +169 -148
- package/lib/ui/select/select.js.map +1 -1
- package/lib/ui/slider/constant.js +1 -1
- package/lib/ui/slider/constant.js.map +1 -1
- package/lib/ui/slider/handle.js +56 -49
- package/lib/ui/slider/handle.js.map +1 -1
- package/lib/ui/slider/index.js +334 -289
- package/lib/ui/slider/index.js.map +1 -1
- package/lib/ui/sparkline/columns.js +36 -28
- package/lib/ui/sparkline/columns.js.map +1 -1
- package/lib/ui/sparkline/index.js +187 -153
- package/lib/ui/sparkline/index.js.map +1 -1
- package/lib/ui/sparkline/lines.js +52 -40
- package/lib/ui/sparkline/lines.js.map +1 -1
- package/lib/ui/sparkline/path.js +42 -38
- package/lib/ui/sparkline/path.js.map +1 -1
- package/lib/ui/sparkline/utils.js +10 -9
- package/lib/ui/sparkline/utils.js.map +1 -1
- package/lib/ui/switch/index.js +58 -49
- package/lib/ui/switch/index.js.map +1 -1
- package/lib/ui/tag/index.js +36 -34
- package/lib/ui/tag/index.js.map +1 -1
- package/lib/ui/timebar/controller.js +82 -73
- package/lib/ui/timebar/controller.js.map +1 -1
- package/lib/ui/timebar/handle.js +74 -67
- package/lib/ui/timebar/handle.js.map +1 -1
- package/lib/ui/timebar/icons.js +466 -312
- package/lib/ui/timebar/icons.js.map +1 -1
- package/lib/ui/timebar/timebar.js +326 -272
- package/lib/ui/timebar/timebar.js.map +1 -1
- package/lib/ui/timebar/utils.js +8 -8
- package/lib/ui/timebar/utils.js.map +1 -1
- package/lib/ui/timeline/index.js +5 -2
- package/lib/ui/timeline/index.js.map +1 -1
- package/lib/ui/title/index.js +65 -61
- package/lib/ui/title/index.js.map +1 -1
- package/lib/ui/tooltip/constant.js +30 -26
- package/lib/ui/tooltip/constant.js.map +1 -1
- package/lib/ui/tooltip/index.js +129 -113
- package/lib/ui/tooltip/index.js.map +1 -1
- package/lib/util/bbox.js +46 -24
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/callback.js +3 -2
- package/lib/util/callback.js.map +1 -1
- package/lib/util/classnames.js +10 -8
- package/lib/util/classnames.js.map +1 -1
- package/lib/util/deep-assign.js +15 -7
- package/lib/util/deep-assign.js.map +1 -1
- package/lib/util/defined.js +1 -1
- package/lib/util/defined.js.map +1 -1
- package/lib/util/ellipsis.js +3 -2
- package/lib/util/ellipsis.js.map +1 -1
- package/lib/util/event.js +3 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/extend-display-object.js +2 -2
- package/lib/util/extend-display-object.js.map +1 -1
- package/lib/util/geometry/index.js +1 -1
- package/lib/util/geometry/line-length.js +4 -1
- package/lib/util/geometry/line-length.js.map +1 -1
- package/lib/util/geometry/lines-intersection.js +10 -5
- package/lib/util/geometry/lines-intersection.js.map +1 -1
- package/lib/util/group-by.js +1 -1
- package/lib/util/group-by.js.map +1 -1
- package/lib/util/group.js +3 -3
- package/lib/util/group.js.map +1 -1
- package/lib/util/html.js +1 -1
- package/lib/util/html.js.map +1 -1
- package/lib/util/if-show.js +5 -3
- package/lib/util/if-show.js.map +1 -1
- package/lib/util/in-range.js +3 -1
- package/lib/util/in-range.js.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/interpolate.js +19 -12
- package/lib/util/interpolate.js.map +1 -1
- package/lib/util/keyframe-interpolate.d.ts +1 -1
- package/lib/util/keyframe-interpolate.js +8 -7
- package/lib/util/keyframe-interpolate.js.map +1 -1
- package/lib/util/layout/executer.js +6 -6
- package/lib/util/layout/executer.js.map +1 -1
- package/lib/util/layout/flex/index.js +28 -26
- package/lib/util/layout/flex/index.js.map +1 -1
- package/lib/util/layout/grid/index.js +1 -1
- package/lib/util/layout/grid/index.js.map +1 -1
- package/lib/util/layout/index.js +1 -1
- package/lib/util/layout/utils/helper.js +9 -8
- package/lib/util/layout/utils/helper.js.map +1 -1
- package/lib/util/matrix.js +8 -7
- package/lib/util/matrix.js.map +1 -1
- package/lib/util/number.js +7 -6
- package/lib/util/number.js.map +1 -1
- package/lib/util/offscreen.js +20 -12
- package/lib/util/offscreen.js.map +1 -1
- package/lib/util/omit.js +3 -3
- package/lib/util/omit.js.map +1 -1
- package/lib/util/path.js +42 -37
- package/lib/util/path.js.map +1 -1
- package/lib/util/primitive.js +2 -2
- package/lib/util/primitive.js.map +1 -1
- package/lib/util/replace-children.js +4 -3
- package/lib/util/replace-children.js.map +1 -1
- package/lib/util/sampling.js +3 -3
- package/lib/util/sampling.js.map +1 -1
- package/lib/util/scale-to-pixel.js +5 -4
- package/lib/util/scale-to-pixel.js.map +1 -1
- package/lib/util/selection.js +187 -144
- package/lib/util/selection.js.map +1 -1
- package/lib/util/series.js +2 -2
- package/lib/util/series.js.map +1 -1
- package/lib/util/shape.js +28 -16
- package/lib/util/shape.js.map +1 -1
- package/lib/util/string.js +5 -4
- package/lib/util/string.js.map +1 -1
- package/lib/util/style.js +30 -24
- package/lib/util/style.js.map +1 -1
- package/lib/util/svg2marker.js +17 -15
- package/lib/util/svg2marker.js.map +1 -1
- package/lib/util/text.js +16 -16
- package/lib/util/text.js.map +1 -1
- package/lib/util/throttle.js +13 -7
- package/lib/util/throttle.js.map +1 -1
- package/lib/util/time.js +24 -22
- package/lib/util/time.js.map +1 -1
- package/lib/util/timer.js +9 -5
- package/lib/util/timer.js.map +1 -1
- package/lib/util/transform.js +6 -5
- package/lib/util/transform.js.map +1 -1
- package/lib/util/transpose.js +1 -1
- package/lib/util/transpose.js.map +1 -1
- package/lib/util/traverse.js +1 -1
- package/lib/util/traverse.js.map +1 -1
- package/lib/util/visibility.js +3 -3
- package/lib/util/visibility.js.map +1 -1
- package/lib/util/wrap.js +5 -3
- package/lib/util/wrap.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,189 +1,264 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Timebar = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var util_1 = require("@antv/util");
|
|
6
|
+
var core_1 = require("../../core");
|
|
7
|
+
var shapes_1 = require("../../shapes");
|
|
8
|
+
var util_2 = require("../../util");
|
|
9
|
+
var axis_1 = require("../axis");
|
|
10
|
+
var slider_1 = require("../slider");
|
|
11
|
+
var controller_1 = require("./controller");
|
|
12
|
+
var handle_1 = require("./handle");
|
|
13
|
+
var utils_1 = require("./utils");
|
|
14
|
+
var Timebar = /** @class */ (function (_super) {
|
|
15
|
+
tslib_1.__extends(Timebar, _super);
|
|
16
|
+
function Timebar(options) {
|
|
17
|
+
var _this = _super.call(this, (0, util_2.deepAssign)({}, Timebar.defaultOptions, options)) || this;
|
|
18
|
+
_this.axis = _this.appendChild(new axis_1.Axis({
|
|
19
|
+
style: { type: 'linear', startPos: [0, 0], endPos: [0, 0], data: [], showArrow: false, animate: false },
|
|
20
|
+
}));
|
|
21
|
+
/** 时间线 group,用于放置 timeline 或者 chart */
|
|
22
|
+
_this.timeline = _this.appendChild(new slider_1.Slider({
|
|
23
|
+
style: {
|
|
24
|
+
onChange: function (values) {
|
|
25
|
+
_this.handleSliderChange(values);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
_this.controller = _this.appendChild(new controller_1.Controller({}));
|
|
30
|
+
_this.states = {};
|
|
31
|
+
_this.handleSliderChange = function (values) {
|
|
32
|
+
var prevValues = (function () {
|
|
33
|
+
var val = _this.states.values;
|
|
34
|
+
if (Array.isArray(val))
|
|
35
|
+
return tslib_1.__spreadArray([], tslib_1.__read(val), false);
|
|
36
|
+
return val;
|
|
37
|
+
})();
|
|
38
|
+
_this.setBySliderValues(values);
|
|
39
|
+
_this.dispatchOnChange(prevValues);
|
|
23
40
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
var _a = _this.attributes, selectionType = _a.selectionType, chartType = _a.chartType, speed = _a.speed, state = _a.state, playMode = _a.playMode, values = _a.values;
|
|
42
|
+
_this.states = { chartType: chartType, playMode: playMode, selectionType: selectionType, speed: speed, state: state };
|
|
43
|
+
_this.setByTimebarValues(values);
|
|
44
|
+
return _this;
|
|
45
|
+
}
|
|
46
|
+
Object.defineProperty(Timebar.prototype, "data", {
|
|
47
|
+
get: function () {
|
|
48
|
+
var data = this.attributes.data;
|
|
49
|
+
var compareFn = function (a, b) {
|
|
50
|
+
if (a.time < b.time)
|
|
51
|
+
return -1;
|
|
52
|
+
if (a.time > b.time)
|
|
53
|
+
return 1;
|
|
54
|
+
return 0;
|
|
55
|
+
};
|
|
56
|
+
return data.sort(compareFn);
|
|
57
|
+
},
|
|
58
|
+
enumerable: false,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(Timebar.prototype, "space", {
|
|
62
|
+
/** 计算空间分配 */
|
|
63
|
+
get: function () {
|
|
64
|
+
var _a = this.attributes, x = _a.x, y = _a.y, width = _a.width, height = _a.height, type = _a.type, controllerHeight = _a.controllerHeight;
|
|
65
|
+
var availableTimelineHeight = (0, util_1.clamp)(+height - controllerHeight, 0, +height);
|
|
66
|
+
var controllerBBox = new util_2.BBox(x, y + +height - controllerHeight, +width, controllerHeight);
|
|
67
|
+
// chart 模式下可用
|
|
68
|
+
var axisBBox;
|
|
69
|
+
var axisHeight = 0;
|
|
70
|
+
if (type === 'chart') {
|
|
71
|
+
// axis 默认分配高度为 35
|
|
72
|
+
axisHeight = 35;
|
|
73
|
+
axisBBox = new util_2.BBox(x, y + availableTimelineHeight - axisHeight, +width, axisHeight);
|
|
74
|
+
}
|
|
75
|
+
else
|
|
76
|
+
axisBBox = new util_2.BBox();
|
|
77
|
+
var timelineHeight = type === 'time' ? 10 : availableTimelineHeight;
|
|
78
|
+
var timelineBBox = new util_2.BBox(x, y + (type === 'time' ? availableTimelineHeight : availableTimelineHeight - timelineHeight), +width, timelineHeight - axisHeight);
|
|
79
|
+
return { axisBBox: axisBBox, controllerBBox: controllerBBox, timelineBBox: timelineBBox };
|
|
80
|
+
},
|
|
81
|
+
enumerable: false,
|
|
82
|
+
configurable: true
|
|
83
|
+
});
|
|
84
|
+
Timebar.prototype.setBySliderValues = function (val) {
|
|
46
85
|
var _a, _b;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
86
|
+
var data = this.data;
|
|
87
|
+
var _c = tslib_1.__read(Array.isArray(val) ? val : [0, val], 2), startRatio = _c[0], endRatio = _c[1];
|
|
88
|
+
var length = data.length;
|
|
89
|
+
var startDatum = data[Math.floor(startRatio * length)];
|
|
90
|
+
var endDatum = data[Math.ceil(endRatio * length) - (Array.isArray(val) ? 0 : 1)];
|
|
52
91
|
// 如果 endDatum 不存在,则其已经比最大的时间范围更大
|
|
53
92
|
this.states.values = [(_a = startDatum === null || startDatum === void 0 ? void 0 : startDatum.time) !== null && _a !== void 0 ? _a : data[0].time, (_b = endDatum === null || endDatum === void 0 ? void 0 : endDatum.time) !== null && _b !== void 0 ? _b : Infinity];
|
|
54
|
-
}
|
|
55
|
-
setByTimebarValues(val) {
|
|
93
|
+
};
|
|
94
|
+
Timebar.prototype.setByTimebarValues = function (val) {
|
|
56
95
|
var _a, _b, _c;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
96
|
+
var data = this.data;
|
|
97
|
+
var _d = tslib_1.__read(Array.isArray(val) ? val : [undefined, val], 2), start = _d[0], end = _d[1];
|
|
98
|
+
var startDatum = data.find(function (_a) {
|
|
99
|
+
var time = _a.time;
|
|
100
|
+
return time === start;
|
|
101
|
+
});
|
|
102
|
+
var endDatum = data.find(function (_a) {
|
|
103
|
+
var time = _a.time;
|
|
104
|
+
return time === end;
|
|
105
|
+
});
|
|
61
106
|
this.states.values = [(_a = startDatum === null || startDatum === void 0 ? void 0 : startDatum.time) !== null && _a !== void 0 ? _a : (_b = data[0]) === null || _b === void 0 ? void 0 : _b.time, (_c = endDatum === null || endDatum === void 0 ? void 0 : endDatum.time) !== null && _c !== void 0 ? _c : Infinity];
|
|
62
|
-
}
|
|
63
|
-
setByIndex(index) {
|
|
107
|
+
};
|
|
108
|
+
Timebar.prototype.setByIndex = function (index) {
|
|
64
109
|
var _a, _b, _c, _d;
|
|
65
|
-
|
|
66
|
-
|
|
110
|
+
var data = this.data;
|
|
111
|
+
var _e = tslib_1.__read(index, 2), startIndex = _e[0], endIndex = _e[1];
|
|
67
112
|
this.states.values = [(_b = (_a = data[startIndex]) === null || _a === void 0 ? void 0 : _a.time) !== null && _b !== void 0 ? _b : data[0].time, (_d = (_c = this.data[endIndex]) === null || _c === void 0 ? void 0 : _c.time) !== null && _d !== void 0 ? _d : Infinity];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
113
|
+
};
|
|
114
|
+
Object.defineProperty(Timebar.prototype, "sliderValues", {
|
|
115
|
+
/**
|
|
116
|
+
* 获取 timebar 的 values
|
|
117
|
+
*/
|
|
118
|
+
get: function () {
|
|
119
|
+
var _a = this.states, values = _a.values, selectionType = _a.selectionType;
|
|
120
|
+
var _b = tslib_1.__read(Array.isArray(values) ? values : [undefined, values], 2), start = _b[0], end = _b[1];
|
|
121
|
+
var data = this.data;
|
|
122
|
+
var length = data.length;
|
|
123
|
+
var isValue = selectionType === 'value';
|
|
124
|
+
var getStartValue = function () {
|
|
125
|
+
var startDatumIndex = data.findIndex(function (_a) {
|
|
126
|
+
var time = _a.time;
|
|
127
|
+
return time === start;
|
|
128
|
+
});
|
|
129
|
+
if (isValue)
|
|
130
|
+
return 0;
|
|
131
|
+
if (startDatumIndex > -1)
|
|
132
|
+
return startDatumIndex / length;
|
|
133
|
+
// value 模式下默认取 0
|
|
81
134
|
return 0;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
135
|
+
};
|
|
136
|
+
var getEndValue = function () {
|
|
137
|
+
if (end === Infinity)
|
|
138
|
+
return 1;
|
|
139
|
+
var endDatumIndex = data.findIndex(function (_a) {
|
|
140
|
+
var time = _a.time;
|
|
141
|
+
return time === end;
|
|
142
|
+
});
|
|
143
|
+
if (endDatumIndex > -1)
|
|
144
|
+
return endDatumIndex / length;
|
|
145
|
+
// range 模式下默认取 1,value 模式下默认取 0.5
|
|
146
|
+
if (isValue)
|
|
147
|
+
return 0.5;
|
|
89
148
|
return 1;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
getDatumByRatio(ratio) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
149
|
+
};
|
|
150
|
+
return [getStartValue(), getEndValue()];
|
|
151
|
+
},
|
|
152
|
+
enumerable: false,
|
|
153
|
+
configurable: true
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(Timebar.prototype, "values", {
|
|
156
|
+
get: function () {
|
|
157
|
+
var _a = this.states, values = _a.values, selectionType = _a.selectionType;
|
|
158
|
+
var _b = tslib_1.__read(Array.isArray(values) ? values : [this.data[0].time, values], 2), start = _b[0], end = _b[1];
|
|
159
|
+
if (selectionType === 'value')
|
|
160
|
+
return end;
|
|
161
|
+
return [start, end];
|
|
162
|
+
},
|
|
163
|
+
enumerable: false,
|
|
164
|
+
configurable: true
|
|
165
|
+
});
|
|
166
|
+
Timebar.prototype.getDatumByRatio = function (ratio) {
|
|
167
|
+
var data = this.data;
|
|
168
|
+
var length = data.length;
|
|
169
|
+
var index = Math.floor(ratio * (length - 1));
|
|
111
170
|
return data[index];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
171
|
+
};
|
|
172
|
+
Object.defineProperty(Timebar.prototype, "chartHandleIconShape", {
|
|
173
|
+
get: function () {
|
|
174
|
+
var selectionType = this.states.selectionType;
|
|
175
|
+
var height = this.space.timelineBBox.height;
|
|
176
|
+
if (selectionType === 'range')
|
|
177
|
+
return function (type) { return new handle_1.ChartModeHandle({ style: { type: type, height: height, iconSize: height / 6 } }); };
|
|
178
|
+
return function () {
|
|
179
|
+
return new shapes_1.Line({ style: { x1: 0, y1: -height / 2, x2: 0, y2: height / 2, lineWidth: 2, stroke: '#c8c8c8' } });
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
enumerable: false,
|
|
183
|
+
configurable: true
|
|
184
|
+
});
|
|
185
|
+
Timebar.prototype.getChartStyle = function (bbox) {
|
|
186
|
+
var _this = this;
|
|
187
|
+
var x = bbox.x, y = bbox.y, width = bbox.width, height = bbox.height;
|
|
188
|
+
var _a = this.states, selectionType = _a.selectionType, chartType = _a.chartType;
|
|
189
|
+
var data = this.data;
|
|
190
|
+
var _b = this.attributes, type = _b.type, userDefinedLabelFormatter = _b.labelFormatter;
|
|
191
|
+
var _c = (0, util_2.subStyleProps)(this.attributes, 'chart'), ignoreType = _c.type, userDefinedChartStyle = tslib_1.__rest(_c, ["type"]);
|
|
192
|
+
var isRange = selectionType === 'range';
|
|
127
193
|
if (type === 'time') {
|
|
128
|
-
return
|
|
194
|
+
return tslib_1.__assign({ handleIconShape: function () { return new handle_1.TimeModeHandle({}); }, selectionFill: '#2e7ff8', selectionFillOpacity: 1, showLabelOnInteraction: true, handleLabelDy: isRange ? -15 : 0, autoFitLabel: isRange, handleSpacing: isRange ? -15 : 0, trackFill: '#edeeef', trackLength: width, trackOpacity: 0.5, trackRadius: height / 2, trackSize: height / 2, type: selectionType, values: this.sliderValues, formatter: function (value) {
|
|
129
195
|
if (userDefinedLabelFormatter)
|
|
130
196
|
return userDefinedLabelFormatter(value);
|
|
131
|
-
|
|
197
|
+
var time = _this.getDatumByRatio(value).time;
|
|
132
198
|
if (typeof time === 'number')
|
|
133
199
|
return (0, utils_1.parseBySeries)(time);
|
|
134
200
|
return (0, util_2.formatTime)(time, 'YYYY-MM-DD HH:mm:ss');
|
|
135
|
-
}, transform:
|
|
201
|
+
}, transform: "translate(".concat(x, ", ").concat(y, ")"),
|
|
136
202
|
// x,
|
|
137
203
|
// y,
|
|
138
204
|
zIndex: 1 }, userDefinedChartStyle);
|
|
139
205
|
}
|
|
140
206
|
// type === 'chart'
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
207
|
+
var handleIconOffset = selectionType === 'range' ? 5 : 0;
|
|
208
|
+
var sparklineData = data.map(function (_a) {
|
|
209
|
+
var value = _a.value;
|
|
210
|
+
return value;
|
|
211
|
+
});
|
|
212
|
+
return tslib_1.__assign({ handleIconOffset: handleIconOffset, handleIconShape: this.chartHandleIconShape, selectionFill: '#fff', selectionFillOpacity: 0.5, selectionType: 'invert', sparklineSpacing: 0.1, sparklineColumnLineWidth: 0, sparklineColor: '#d4e5fd', sparklineAreaOpacity: 1, sparklineAreaLineWidth: 0, sparklineData: sparklineData, sparklineType: chartType, sparklineScale: 0.8, trackLength: width, trackSize: height, type: selectionType, values: this.sliderValues,
|
|
144
213
|
// x,
|
|
145
214
|
// y,
|
|
146
|
-
transform:
|
|
147
|
-
}
|
|
148
|
-
renderChart
|
|
215
|
+
transform: "translate(".concat(x, ", ").concat(y, ")"), zIndex: 1 }, userDefinedChartStyle);
|
|
216
|
+
};
|
|
217
|
+
Timebar.prototype.renderChart = function (bbox) {
|
|
218
|
+
if (bbox === void 0) { bbox = this.space.timelineBBox; }
|
|
149
219
|
this.timeline.update(this.getChartStyle(bbox));
|
|
150
|
-
}
|
|
151
|
-
updateSelection() {
|
|
220
|
+
};
|
|
221
|
+
Timebar.prototype.updateSelection = function () {
|
|
152
222
|
this.timeline.setValues(this.sliderValues, true);
|
|
153
223
|
this.handleSliderChange(this.sliderValues);
|
|
154
|
-
}
|
|
155
|
-
getAxisStyle(bbox) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
224
|
+
};
|
|
225
|
+
Timebar.prototype.getAxisStyle = function (bbox) {
|
|
226
|
+
var data = this.data;
|
|
227
|
+
var _a = this.attributes, interval = _a.interval, userDefinedLabelFormatter = _a.labelFormatter;
|
|
228
|
+
var userDefinedAxisStyle = (0, util_2.subStyleProps)(this.attributes, 'axis');
|
|
229
|
+
var x = bbox.x, y = bbox.y, width = bbox.width;
|
|
160
230
|
// 需要补一个刻度
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
231
|
+
var axisData = tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(data), false), [{ time: 0 }], false).map(function (_a, index, arr) {
|
|
232
|
+
var time = _a.time;
|
|
233
|
+
return ({
|
|
234
|
+
label: "".concat(time),
|
|
235
|
+
value: index / (arr.length - 1),
|
|
236
|
+
time: time,
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
var style = tslib_1.__assign({ startPos: [x, y], endPos: [x + width, y], data: axisData,
|
|
167
240
|
// hide last label
|
|
168
|
-
labelFilter: (_datum, index)
|
|
241
|
+
labelFilter: function (_datum, index) { return index < axisData.length - 1; }, labelFormatter: function (_a) {
|
|
242
|
+
var time = _a.time;
|
|
243
|
+
return userDefinedLabelFormatter ? userDefinedLabelFormatter(time) : (0, utils_1.labelFormatter)(time, interval);
|
|
244
|
+
} }, userDefinedAxisStyle);
|
|
169
245
|
return style;
|
|
170
|
-
}
|
|
171
|
-
renderAxis
|
|
172
|
-
|
|
246
|
+
};
|
|
247
|
+
Timebar.prototype.renderAxis = function (bbox) {
|
|
248
|
+
if (bbox === void 0) { bbox = this.space.axisBBox; }
|
|
249
|
+
var type = this.attributes.type;
|
|
173
250
|
if (type !== 'chart')
|
|
174
251
|
return;
|
|
175
252
|
this.axis.update(this.getAxisStyle(bbox));
|
|
176
|
-
}
|
|
177
|
-
renderController
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
chartType,
|
|
186
|
-
onChange(type, { value }) {
|
|
253
|
+
};
|
|
254
|
+
Timebar.prototype.renderController = function (bbox) {
|
|
255
|
+
if (bbox === void 0) { bbox = this.space.controllerBBox; }
|
|
256
|
+
var type = this.attributes.type;
|
|
257
|
+
var _a = this.states, state = _a.state, speed = _a.speed, selectionType = _a.selectionType, chartType = _a.chartType;
|
|
258
|
+
var userDefinedControllerStyle = (0, util_2.subStyleProps)(this.attributes, 'controller');
|
|
259
|
+
var that = this;
|
|
260
|
+
var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, bbox), { iconSize: 20, speed: speed, state: state, selectionType: selectionType, chartType: chartType, onChange: function (type, _a) {
|
|
261
|
+
var value = _a.value;
|
|
187
262
|
switch (type) {
|
|
188
263
|
case 'reset':
|
|
189
264
|
that.internalReset();
|
|
@@ -217,15 +292,15 @@ class Timebar extends core_1.Component {
|
|
|
217
292
|
style.functions = [['reset', 'speed'], ['backward', 'playPause', 'forward'], ['selectionType']];
|
|
218
293
|
}
|
|
219
294
|
this.controller.update(style);
|
|
220
|
-
}
|
|
221
|
-
dispatchOnChange(prevValues) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
295
|
+
};
|
|
296
|
+
Timebar.prototype.dispatchOnChange = function (prevValues) {
|
|
297
|
+
var data = this.data;
|
|
298
|
+
var onChange = this.attributes.onChange;
|
|
299
|
+
var _a = this.states, values = _a.values, selectionType = _a.selectionType;
|
|
300
|
+
var _b = tslib_1.__read(values, 2), start = _b[0], end = _b[1];
|
|
301
|
+
var endTime = end === Infinity ? data.at(-1).time : end;
|
|
302
|
+
var newValues = selectionType === 'range' ? [start, endTime] : endTime;
|
|
303
|
+
var isEqual = function (val1, val2) {
|
|
229
304
|
if (Array.isArray(val1)) {
|
|
230
305
|
if (!Array.isArray(val2))
|
|
231
306
|
return false;
|
|
@@ -245,10 +320,10 @@ class Timebar extends core_1.Component {
|
|
|
245
320
|
if (!prevValues || !isEqual(prevValues, newValues)) {
|
|
246
321
|
onChange === null || onChange === void 0 ? void 0 : onChange(selectionType === 'range' ? [start, endTime] : endTime);
|
|
247
322
|
}
|
|
248
|
-
}
|
|
249
|
-
internalReset(preventEvent) {
|
|
323
|
+
};
|
|
324
|
+
Timebar.prototype.internalReset = function (preventEvent) {
|
|
250
325
|
var _a, _b;
|
|
251
|
-
|
|
326
|
+
var selectionType = this.states.selectionType;
|
|
252
327
|
this.internalPause();
|
|
253
328
|
this.setBySliderValues(selectionType === 'range' ? [0, 1] : [0, 0]);
|
|
254
329
|
this.renderController();
|
|
@@ -257,21 +332,27 @@ class Timebar extends core_1.Component {
|
|
|
257
332
|
(_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onReset) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
258
333
|
this.dispatchOnChange();
|
|
259
334
|
}
|
|
260
|
-
}
|
|
261
|
-
reset() {
|
|
335
|
+
};
|
|
336
|
+
Timebar.prototype.reset = function () {
|
|
262
337
|
this.internalReset();
|
|
263
|
-
}
|
|
264
|
-
moveSelection(direction, preventEvent) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
338
|
+
};
|
|
339
|
+
Timebar.prototype.moveSelection = function (direction, preventEvent) {
|
|
340
|
+
var data = this.data;
|
|
341
|
+
var length = data.length;
|
|
342
|
+
var _a = this.states, values = _a.values, selectionType = _a.selectionType, playMode = _a.playMode;
|
|
343
|
+
var _b = tslib_1.__read(values, 2), startTime = _b[0], endTime = _b[1];
|
|
344
|
+
var startIndex = data.findIndex(function (_a) {
|
|
345
|
+
var time = _a.time;
|
|
346
|
+
return time === startTime;
|
|
347
|
+
});
|
|
348
|
+
var endIndex = data.findIndex(function (_a) {
|
|
349
|
+
var time = _a.time;
|
|
350
|
+
return time === endTime;
|
|
351
|
+
});
|
|
271
352
|
if (endIndex === -1)
|
|
272
353
|
endIndex = length;
|
|
273
|
-
|
|
274
|
-
|
|
354
|
+
var diff = direction === 'backward' ? -1 : 1;
|
|
355
|
+
var currentIndexes;
|
|
275
356
|
if (selectionType === 'range') {
|
|
276
357
|
// end 后移一个时间间隔
|
|
277
358
|
if (playMode === 'acc') {
|
|
@@ -288,11 +369,11 @@ class Timebar extends core_1.Component {
|
|
|
288
369
|
// end 后移一个时间间隔
|
|
289
370
|
else
|
|
290
371
|
currentIndexes = [startIndex, endIndex + diff];
|
|
291
|
-
|
|
372
|
+
var normalizeIndexes = function (indexes) {
|
|
292
373
|
// 先进行排序
|
|
293
|
-
|
|
374
|
+
var _a = tslib_1.__read(indexes.sort(function (a, b) { return a - b; }), 2), start = _a[0], end = _a[1];
|
|
294
375
|
// 保证 index 在 [0, length]
|
|
295
|
-
|
|
376
|
+
var clampIndex = function (index) { return (0, util_1.clamp)(index, 0, length); };
|
|
296
377
|
// 如果 end 超出最大值
|
|
297
378
|
if (end > length) {
|
|
298
379
|
// value 模式下,重置到 0
|
|
@@ -312,153 +393,126 @@ class Timebar extends core_1.Component {
|
|
|
312
393
|
}
|
|
313
394
|
return [clampIndex(start), clampIndex(end)];
|
|
314
395
|
};
|
|
315
|
-
|
|
396
|
+
var normalizedIndexes = normalizeIndexes(currentIndexes);
|
|
316
397
|
this.setByIndex(normalizedIndexes);
|
|
317
398
|
this.updateSelection();
|
|
318
399
|
return normalizedIndexes;
|
|
319
|
-
}
|
|
320
|
-
internalBackward(preventEvent) {
|
|
400
|
+
};
|
|
401
|
+
Timebar.prototype.internalBackward = function (preventEvent) {
|
|
321
402
|
var _a, _b;
|
|
322
|
-
|
|
403
|
+
var indexes = this.moveSelection('backward', preventEvent);
|
|
323
404
|
if (!preventEvent) {
|
|
324
405
|
(_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onBackward) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
325
406
|
this.dispatchOnChange();
|
|
326
407
|
}
|
|
327
408
|
return indexes;
|
|
328
|
-
}
|
|
329
|
-
backward() {
|
|
409
|
+
};
|
|
410
|
+
Timebar.prototype.backward = function () {
|
|
330
411
|
this.internalBackward();
|
|
331
|
-
}
|
|
332
|
-
internalPlay(preventEvent) {
|
|
412
|
+
};
|
|
413
|
+
Timebar.prototype.internalPlay = function (preventEvent) {
|
|
414
|
+
var _this = this;
|
|
333
415
|
var _a, _b;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
this.playInterval = window.setInterval(()
|
|
338
|
-
|
|
416
|
+
var data = this.data;
|
|
417
|
+
var loop = this.attributes.loop;
|
|
418
|
+
var _c = this.states.speed, speed = _c === void 0 ? 1 : _c;
|
|
419
|
+
this.playInterval = window.setInterval(function () {
|
|
420
|
+
var indexes = _this.internalForward();
|
|
339
421
|
// 如果不是循环播放,则播放到最后一个值时暂停
|
|
340
422
|
if (indexes[1] === data.length && !loop) {
|
|
341
423
|
// 这里需要抛出暂停事件
|
|
342
|
-
|
|
343
|
-
|
|
424
|
+
_this.internalPause();
|
|
425
|
+
_this.renderController();
|
|
344
426
|
}
|
|
345
427
|
}, 1000 / speed);
|
|
346
428
|
this.states.state = 'play';
|
|
347
429
|
!preventEvent && ((_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onPlay) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
348
|
-
}
|
|
349
|
-
play() {
|
|
430
|
+
};
|
|
431
|
+
Timebar.prototype.play = function () {
|
|
350
432
|
this.internalPlay();
|
|
351
|
-
}
|
|
352
|
-
internalPause(preventEvent) {
|
|
433
|
+
};
|
|
434
|
+
Timebar.prototype.internalPause = function (preventEvent) {
|
|
353
435
|
var _a, _b;
|
|
354
436
|
clearInterval(this.playInterval);
|
|
355
437
|
this.states.state = 'pause';
|
|
356
438
|
!preventEvent && ((_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onPause) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
357
|
-
}
|
|
358
|
-
pause() {
|
|
439
|
+
};
|
|
440
|
+
Timebar.prototype.pause = function () {
|
|
359
441
|
this.internalPause();
|
|
360
|
-
}
|
|
361
|
-
internalForward(preventEvent) {
|
|
442
|
+
};
|
|
443
|
+
Timebar.prototype.internalForward = function (preventEvent) {
|
|
362
444
|
var _a, _b;
|
|
363
|
-
|
|
445
|
+
var indexes = this.moveSelection('forward', preventEvent);
|
|
364
446
|
if (!preventEvent) {
|
|
365
447
|
(_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onForward) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
366
448
|
this.dispatchOnChange();
|
|
367
449
|
}
|
|
368
450
|
return indexes;
|
|
369
|
-
}
|
|
370
|
-
forward() {
|
|
451
|
+
};
|
|
452
|
+
Timebar.prototype.forward = function () {
|
|
371
453
|
this.internalForward();
|
|
372
|
-
}
|
|
373
|
-
handleSpeedChange(value) {
|
|
454
|
+
};
|
|
455
|
+
Timebar.prototype.handleSpeedChange = function (value) {
|
|
374
456
|
var _a, _b;
|
|
375
457
|
this.states.speed = value;
|
|
376
|
-
|
|
458
|
+
var state = this.states.state;
|
|
377
459
|
if (state === 'play') {
|
|
378
460
|
// 重新设定 interval
|
|
379
461
|
this.internalPause(true);
|
|
380
462
|
this.internalPlay(true);
|
|
381
463
|
}
|
|
382
464
|
(_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onSpeedChange) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
383
|
-
}
|
|
384
|
-
handleSelectionTypeChange(type) {
|
|
465
|
+
};
|
|
466
|
+
Timebar.prototype.handleSelectionTypeChange = function (type) {
|
|
385
467
|
var _a, _b;
|
|
386
468
|
this.states.selectionType = type;
|
|
387
469
|
this.renderChart();
|
|
388
470
|
(_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onSelectionTypeChange) === null || _b === void 0 ? void 0 : _b.call(_a, type);
|
|
389
|
-
}
|
|
390
|
-
handleChartTypeChange(type) {
|
|
471
|
+
};
|
|
472
|
+
Timebar.prototype.handleChartTypeChange = function (type) {
|
|
391
473
|
var _a, _b;
|
|
392
474
|
this.states.chartType = type;
|
|
393
475
|
this.renderChart();
|
|
394
476
|
(_b = (_a = this.attributes) === null || _a === void 0 ? void 0 : _a.onChartTypeChange) === null || _b === void 0 ? void 0 : _b.call(_a, type);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
this.axis = this.appendChild(new axis_1.Axis({
|
|
399
|
-
style: { type: 'linear', startPos: [0, 0], endPos: [0, 0], data: [], showArrow: false, animate: false },
|
|
400
|
-
}));
|
|
401
|
-
/** 时间线 group,用于放置 timeline 或者 chart */
|
|
402
|
-
this.timeline = this.appendChild(new slider_1.Slider({
|
|
403
|
-
style: {
|
|
404
|
-
onChange: (values) => {
|
|
405
|
-
this.handleSliderChange(values);
|
|
406
|
-
},
|
|
407
|
-
},
|
|
408
|
-
}));
|
|
409
|
-
this.controller = this.appendChild(new controller_1.Controller({}));
|
|
410
|
-
this.states = {};
|
|
411
|
-
this.handleSliderChange = (values) => {
|
|
412
|
-
const prevValues = (() => {
|
|
413
|
-
const val = this.states.values;
|
|
414
|
-
if (Array.isArray(val))
|
|
415
|
-
return [...val];
|
|
416
|
-
return val;
|
|
417
|
-
})();
|
|
418
|
-
this.setBySliderValues(values);
|
|
419
|
-
this.dispatchOnChange(prevValues);
|
|
420
|
-
};
|
|
421
|
-
const { selectionType, chartType, speed, state, playMode, values } = this.attributes;
|
|
422
|
-
this.states = { chartType, playMode, selectionType, speed, state };
|
|
423
|
-
this.setByTimebarValues(values);
|
|
424
|
-
}
|
|
425
|
-
render() {
|
|
426
|
-
const { axisBBox, controllerBBox, timelineBBox } = this.space;
|
|
477
|
+
};
|
|
478
|
+
Timebar.prototype.render = function () {
|
|
479
|
+
var _a = this.space, axisBBox = _a.axisBBox, controllerBBox = _a.controllerBBox, timelineBBox = _a.timelineBBox;
|
|
427
480
|
this.renderController(controllerBBox);
|
|
428
481
|
this.renderAxis(axisBBox);
|
|
429
482
|
this.renderChart(timelineBBox);
|
|
430
483
|
if (this.states.state === 'play')
|
|
431
484
|
this.internalPlay();
|
|
432
|
-
}
|
|
433
|
-
destroy() {
|
|
434
|
-
|
|
485
|
+
};
|
|
486
|
+
Timebar.prototype.destroy = function () {
|
|
487
|
+
_super.prototype.destroy.call(this);
|
|
435
488
|
this.internalPause(true);
|
|
436
|
-
}
|
|
437
|
-
|
|
489
|
+
};
|
|
490
|
+
Timebar.defaultOptions = {
|
|
491
|
+
style: {
|
|
492
|
+
x: 0,
|
|
493
|
+
y: 0,
|
|
494
|
+
axisLabelFill: '#6e6e6e',
|
|
495
|
+
axisLabelTextAlign: 'left',
|
|
496
|
+
axisLabelTextBaseline: 'top',
|
|
497
|
+
axisLabelTransform: 'translate(5, -12)',
|
|
498
|
+
axisLineLineWidth: 1,
|
|
499
|
+
axisLineStroke: '#cacdd1',
|
|
500
|
+
axisTickLength: 15,
|
|
501
|
+
axisTickLineWidth: 1,
|
|
502
|
+
axisTickStroke: '#cacdd1',
|
|
503
|
+
chartShowLabel: false,
|
|
504
|
+
chartType: 'line',
|
|
505
|
+
controllerAlign: 'center',
|
|
506
|
+
controllerHeight: 40,
|
|
507
|
+
data: [],
|
|
508
|
+
interval: 'day',
|
|
509
|
+
loop: false,
|
|
510
|
+
playMode: 'acc',
|
|
511
|
+
selectionType: 'range',
|
|
512
|
+
type: 'time',
|
|
513
|
+
},
|
|
514
|
+
};
|
|
515
|
+
return Timebar;
|
|
516
|
+
}(core_1.Component));
|
|
438
517
|
exports.Timebar = Timebar;
|
|
439
|
-
Timebar.defaultOptions = {
|
|
440
|
-
style: {
|
|
441
|
-
x: 0,
|
|
442
|
-
y: 0,
|
|
443
|
-
axisLabelFill: '#6e6e6e',
|
|
444
|
-
axisLabelTextAlign: 'left',
|
|
445
|
-
axisLabelTextBaseline: 'top',
|
|
446
|
-
axisLabelTransform: 'translate(5, -12)',
|
|
447
|
-
axisLineLineWidth: 1,
|
|
448
|
-
axisLineStroke: '#cacdd1',
|
|
449
|
-
axisTickLength: 15,
|
|
450
|
-
axisTickLineWidth: 1,
|
|
451
|
-
axisTickStroke: '#cacdd1',
|
|
452
|
-
chartShowLabel: false,
|
|
453
|
-
chartType: 'line',
|
|
454
|
-
controllerAlign: 'center',
|
|
455
|
-
controllerHeight: 40,
|
|
456
|
-
data: [],
|
|
457
|
-
interval: 'day',
|
|
458
|
-
loop: false,
|
|
459
|
-
playMode: 'acc',
|
|
460
|
-
selectionType: 'range',
|
|
461
|
-
type: 'time',
|
|
462
|
-
},
|
|
463
|
-
};
|
|
464
518
|
//# sourceMappingURL=timebar.js.map
|