@antv/component 2.0.4 → 2.1.1-alpha.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/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 +31 -37
- 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 +30 -43
- package/esm/core/component.js.map +1 -1
- package/esm/shapes/Text.js +13 -21
- package/esm/shapes/Text.js.map +1 -1
- package/esm/ui/axis/axis.d.ts +1 -1
- package/esm/ui/axis/axis.js +25 -31
- package/esm/ui/axis/axis.js.map +1 -1
- package/esm/ui/axis/constant.js +11 -13
- 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 +29 -34
- package/esm/ui/axis/guides/grid.js.map +1 -1
- package/esm/ui/axis/guides/labels.js +76 -83
- package/esm/ui/axis/guides/labels.js.map +1 -1
- package/esm/ui/axis/guides/line.js +74 -87
- 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 +31 -39
- 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 +33 -37
- package/esm/ui/axis/guides/title.js.map +1 -1
- package/esm/ui/axis/guides/utils.js +10 -12
- package/esm/ui/axis/guides/utils.js.map +1 -1
- package/esm/ui/axis/overlap/autoEllipsis.js +12 -19
- package/esm/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/esm/ui/axis/overlap/autoHide.js +20 -24
- package/esm/ui/axis/overlap/autoHide.js.map +1 -1
- package/esm/ui/axis/overlap/autoRotate.js +11 -25
- package/esm/ui/axis/overlap/autoRotate.js.map +1 -1
- package/esm/ui/axis/overlap/autoWrap.js +11 -14
- 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 +48 -75
- 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 +3 -7
- package/esm/ui/axis/utils/index.js.map +1 -1
- package/esm/ui/axis/utils/intersect.js +21 -33
- package/esm/ui/axis/utils/intersect.js.map +1 -1
- package/esm/ui/axis/utils/test.js +29 -41
- package/esm/ui/axis/utils/test.js.map +1 -1
- package/esm/ui/breadcrumb/index.js +64 -72
- 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 +81 -97
- 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 +23 -26
- package/esm/ui/checkbox/index.js.map +1 -1
- package/esm/ui/crosshair/base.js +29 -45
- package/esm/ui/crosshair/base.js.map +1 -1
- package/esm/ui/crosshair/circle.js +25 -34
- 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 +55 -75
- package/esm/ui/crosshair/line.js.map +1 -1
- package/esm/ui/crosshair/polygon.js +54 -70
- package/esm/ui/crosshair/polygon.js.map +1 -1
- package/esm/ui/grid/index.d.ts +1 -1
- package/esm/ui/grid/index.js +73 -95
- 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 +58 -63
- package/esm/ui/indicator/indicator.js.map +1 -1
- package/esm/ui/layout/layout.js +52 -66
- package/esm/ui/layout/layout.js.map +1 -1
- package/esm/ui/legend/base.js +12 -13
- package/esm/ui/legend/base.js.map +1 -1
- package/esm/ui/legend/category/item.js +122 -156
- package/esm/ui/legend/category/item.js.map +1 -1
- package/esm/ui/legend/category/items.js +158 -201
- package/esm/ui/legend/category/items.js.map +1 -1
- package/esm/ui/legend/category.js +46 -56
- 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 +28 -33
- package/esm/ui/legend/continuous/handle.js.map +1 -1
- package/esm/ui/legend/continuous/ribbon.js +34 -38
- package/esm/ui/legend/continuous/ribbon.js.map +1 -1
- package/esm/ui/legend/continuous/utils.js +10 -11
- package/esm/ui/legend/continuous/utils.js.map +1 -1
- package/esm/ui/legend/continuous.js +417 -521
- package/esm/ui/legend/continuous.js.map +1 -1
- package/esm/ui/legend/utils.js +24 -31
- package/esm/ui/legend/utils.js.map +1 -1
- package/esm/ui/marker/index.js +38 -44
- 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 +128 -159
- package/esm/ui/navigator/index.js.map +1 -1
- package/esm/ui/poptip/constant.d.ts +1 -1
- package/esm/ui/poptip/constant.js +68 -69
- package/esm/ui/poptip/constant.js.map +1 -1
- package/esm/ui/poptip/index.js +95 -111
- package/esm/ui/poptip/index.js.map +1 -1
- package/esm/ui/poptip/utils.js +8 -15
- package/esm/ui/poptip/utils.js.map +1 -1
- package/esm/ui/scrollbar/index.js +102 -132
- package/esm/ui/scrollbar/index.js.map +1 -1
- package/esm/ui/select/option.js +48 -58
- package/esm/ui/select/option.js.map +1 -1
- package/esm/ui/select/select.js +142 -164
- 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 +46 -54
- package/esm/ui/slider/handle.js.map +1 -1
- package/esm/ui/slider/index.js +282 -328
- package/esm/ui/slider/index.js.map +1 -1
- package/esm/ui/sparkline/columns.js +25 -34
- package/esm/ui/sparkline/columns.js.map +1 -1
- package/esm/ui/sparkline/index.js +145 -180
- package/esm/ui/sparkline/index.js.map +1 -1
- package/esm/ui/sparkline/lines.js +37 -50
- package/esm/ui/sparkline/lines.js.map +1 -1
- package/esm/ui/sparkline/path.js +36 -40
- package/esm/ui/sparkline/path.js.map +1 -1
- package/esm/ui/sparkline/utils.js +10 -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 +44 -54
- package/esm/ui/switch/index.js.map +1 -1
- package/esm/ui/tag/index.js +29 -32
- package/esm/ui/tag/index.js.map +1 -1
- package/esm/ui/timebar/controller.js +69 -79
- package/esm/ui/timebar/controller.js.map +1 -1
- package/esm/ui/timebar/handle.js +62 -71
- package/esm/ui/timebar/handle.js.map +1 -1
- package/esm/ui/timebar/icons.js +308 -478
- package/esm/ui/timebar/icons.js.map +1 -1
- package/esm/ui/timebar/timebar.js +263 -318
- 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 +2 -6
- package/esm/ui/timeline/index.js.map +1 -1
- package/esm/ui/title/index.js +59 -64
- package/esm/ui/title/index.js.map +1 -1
- package/esm/ui/title/types.d.ts +1 -1
- package/esm/ui/tooltip/constant.js +26 -30
- package/esm/ui/tooltip/constant.js.map +1 -1
- package/esm/ui/tooltip/index.js +109 -126
- package/esm/ui/tooltip/index.js.map +1 -1
- package/esm/util/bbox.js +24 -47
- package/esm/util/bbox.js.map +1 -1
- package/esm/util/callback.js +1 -2
- package/esm/util/callback.js.map +1 -1
- package/esm/util/classnames.js +8 -10
- package/esm/util/classnames.js.map +1 -1
- package/esm/util/deep-assign.js +6 -14
- 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 +1 -2
- 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 +1 -4
- package/esm/util/geometry/line-length.js.map +1 -1
- package/esm/util/geometry/lines-intersection.js +5 -10
- 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 +3 -5
- package/esm/util/if-show.js.map +1 -1
- package/esm/util/in-range.js +1 -3
- package/esm/util/in-range.js.map +1 -1
- package/esm/util/interpolate.js +12 -19
- package/esm/util/interpolate.js.map +1 -1
- package/esm/util/keyframe-interpolate.d.ts +1 -1
- package/esm/util/keyframe-interpolate.js +6 -7
- 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 +24 -26
- 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 +7 -8
- package/esm/util/layout/utils/helper.js.map +1 -1
- package/esm/util/matrix.js +7 -8
- package/esm/util/matrix.js.map +1 -1
- package/esm/util/number.js +6 -7
- package/esm/util/number.js.map +1 -1
- package/esm/util/offscreen.js +9 -17
- 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 +36 -41
- 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 +3 -4
- 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 +4 -5
- package/esm/util/scale-to-pixel.js.map +1 -1
- package/esm/util/selection.js +142 -186
- 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 +15 -27
- package/esm/util/shape.js.map +1 -1
- package/esm/util/string.js +4 -5
- package/esm/util/string.js.map +1 -1
- package/esm/util/style.js +23 -29
- package/esm/util/style.js.map +1 -1
- package/esm/util/svg2marker.js +13 -16
- package/esm/util/svg2marker.js.map +1 -1
- package/esm/util/text.d.ts +1 -9
- package/esm/util/text.js +14 -14
- package/esm/util/text.js.map +1 -1
- package/esm/util/throttle.js +7 -13
- package/esm/util/throttle.js.map +1 -1
- package/esm/util/time.js +22 -24
- package/esm/util/time.js.map +1 -1
- package/esm/util/timer.js +5 -9
- package/esm/util/timer.js.map +1 -1
- package/esm/util/transform.js +5 -6
- 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 +2 -4
- 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 +33 -39
- package/lib/animation/utils.js.map +1 -1
- package/lib/core/component.js +31 -43
- 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 +15 -22
- 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 +34 -39
- package/lib/ui/axis/axis.js.map +1 -1
- package/lib/ui/axis/constant.js +10 -12
- 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 +35 -40
- package/lib/ui/axis/guides/grid.js.map +1 -1
- package/lib/ui/axis/guides/labels.js +82 -89
- package/lib/ui/axis/guides/labels.js.map +1 -1
- package/lib/ui/axis/guides/line.js +79 -92
- 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 +37 -45
- 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 +37 -41
- package/lib/ui/axis/guides/title.js.map +1 -1
- package/lib/ui/axis/guides/utils.js +12 -14
- package/lib/ui/axis/guides/utils.js.map +1 -1
- package/lib/ui/axis/overlap/autoEllipsis.js +15 -22
- package/lib/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/lib/ui/axis/overlap/autoHide.js +23 -27
- package/lib/ui/axis/overlap/autoHide.js.map +1 -1
- package/lib/ui/axis/overlap/autoRotate.js +12 -26
- package/lib/ui/axis/overlap/autoRotate.js.map +1 -1
- package/lib/ui/axis/overlap/autoWrap.js +13 -16
- 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 +49 -75
- 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 +4 -8
- package/lib/ui/axis/utils/index.js.map +1 -1
- package/lib/ui/axis/utils/intersect.js +22 -34
- package/lib/ui/axis/utils/intersect.js.map +1 -1
- package/lib/ui/axis/utils/test.js +35 -47
- package/lib/ui/axis/utils/test.js.map +1 -1
- package/lib/ui/breadcrumb/index.js +70 -77
- package/lib/ui/breadcrumb/index.js.map +1 -1
- package/lib/ui/button/index.js +86 -101
- 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 +26 -28
- package/lib/ui/checkbox/index.js.map +1 -1
- package/lib/ui/crosshair/base.js +33 -48
- package/lib/ui/crosshair/base.js.map +1 -1
- package/lib/ui/crosshair/circle.js +29 -37
- 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 +58 -77
- package/lib/ui/crosshair/line.js.map +1 -1
- package/lib/ui/crosshair/polygon.js +57 -72
- package/lib/ui/crosshair/polygon.js.map +1 -1
- package/lib/ui/grid/index.d.ts +1 -1
- package/lib/ui/grid/index.js +76 -97
- 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 +63 -67
- package/lib/ui/indicator/indicator.js.map +1 -1
- package/lib/ui/layout/layout.js +57 -70
- package/lib/ui/layout/layout.js.map +1 -1
- package/lib/ui/legend/base.js +14 -15
- package/lib/ui/legend/base.js.map +1 -1
- package/lib/ui/legend/category/item.js +126 -159
- package/lib/ui/legend/category/item.js.map +1 -1
- package/lib/ui/legend/category/items.js +166 -208
- package/lib/ui/legend/category/items.js.map +1 -1
- package/lib/ui/legend/category.js +51 -60
- 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 +31 -35
- package/lib/ui/legend/continuous/handle.js.map +1 -1
- package/lib/ui/legend/continuous/ribbon.js +40 -43
- package/lib/ui/legend/continuous/ribbon.js.map +1 -1
- package/lib/ui/legend/continuous/utils.js +10 -11
- package/lib/ui/legend/continuous/utils.js.map +1 -1
- package/lib/ui/legend/continuous.js +432 -535
- 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 +25 -32
- package/lib/ui/legend/utils.js.map +1 -1
- package/lib/ui/marker/index.js +43 -48
- 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 +135 -165
- package/lib/ui/navigator/index.js.map +1 -1
- package/lib/ui/poptip/constant.d.ts +1 -1
- package/lib/ui/poptip/constant.js +66 -67
- package/lib/ui/poptip/constant.js.map +1 -1
- package/lib/ui/poptip/index.js +100 -115
- package/lib/ui/poptip/index.js.map +1 -1
- package/lib/ui/poptip/utils.js +8 -15
- package/lib/ui/poptip/utils.js.map +1 -1
- package/lib/ui/scrollbar/index.js +107 -136
- package/lib/ui/scrollbar/index.js.map +1 -1
- package/lib/ui/select/option.js +52 -61
- package/lib/ui/select/option.js.map +1 -1
- package/lib/ui/select/select.js +148 -169
- 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 +49 -56
- package/lib/ui/slider/handle.js.map +1 -1
- package/lib/ui/slider/index.js +291 -336
- package/lib/ui/slider/index.js.map +1 -1
- package/lib/ui/sparkline/columns.js +28 -36
- package/lib/ui/sparkline/columns.js.map +1 -1
- package/lib/ui/sparkline/index.js +153 -187
- package/lib/ui/sparkline/index.js.map +1 -1
- package/lib/ui/sparkline/lines.js +40 -52
- package/lib/ui/sparkline/lines.js.map +1 -1
- package/lib/ui/sparkline/path.js +38 -42
- package/lib/ui/sparkline/path.js.map +1 -1
- package/lib/ui/sparkline/utils.js +11 -9
- package/lib/ui/sparkline/utils.js.map +1 -1
- package/lib/ui/switch/index.js +49 -58
- package/lib/ui/switch/index.js.map +1 -1
- package/lib/ui/tag/index.js +34 -36
- package/lib/ui/tag/index.js.map +1 -1
- package/lib/ui/timebar/controller.js +73 -82
- package/lib/ui/timebar/controller.js.map +1 -1
- package/lib/ui/timebar/handle.js +67 -74
- package/lib/ui/timebar/handle.js.map +1 -1
- package/lib/ui/timebar/icons.js +312 -466
- package/lib/ui/timebar/icons.js.map +1 -1
- package/lib/ui/timebar/timebar.js +272 -326
- 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 +2 -5
- package/lib/ui/timeline/index.js.map +1 -1
- package/lib/ui/title/index.js +61 -65
- package/lib/ui/title/index.js.map +1 -1
- package/lib/ui/title/types.d.ts +1 -1
- package/lib/ui/tooltip/constant.js +26 -30
- package/lib/ui/tooltip/constant.js.map +1 -1
- package/lib/ui/tooltip/index.js +113 -129
- package/lib/ui/tooltip/index.js.map +1 -1
- package/lib/util/bbox.js +24 -46
- package/lib/util/bbox.js.map +1 -1
- package/lib/util/callback.js +2 -3
- package/lib/util/callback.js.map +1 -1
- package/lib/util/classnames.js +8 -10
- package/lib/util/classnames.js.map +1 -1
- package/lib/util/deep-assign.js +7 -15
- 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 +2 -3
- 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 +1 -4
- package/lib/util/geometry/line-length.js.map +1 -1
- package/lib/util/geometry/lines-intersection.js +5 -10
- 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 +3 -5
- package/lib/util/if-show.js.map +1 -1
- package/lib/util/in-range.js +1 -3
- package/lib/util/in-range.js.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/interpolate.js +12 -19
- package/lib/util/interpolate.js.map +1 -1
- package/lib/util/keyframe-interpolate.d.ts +1 -1
- package/lib/util/keyframe-interpolate.js +7 -8
- 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 +26 -28
- 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 +8 -9
- package/lib/util/layout/utils/helper.js.map +1 -1
- package/lib/util/matrix.js +7 -8
- package/lib/util/matrix.js.map +1 -1
- package/lib/util/number.js +6 -7
- package/lib/util/number.js.map +1 -1
- package/lib/util/offscreen.js +12 -20
- 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 +37 -42
- 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 +3 -4
- 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 +4 -5
- package/lib/util/scale-to-pixel.js.map +1 -1
- package/lib/util/selection.js +144 -187
- 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 +16 -28
- package/lib/util/shape.js.map +1 -1
- package/lib/util/string.js +4 -5
- package/lib/util/string.js.map +1 -1
- package/lib/util/style.js +24 -30
- package/lib/util/style.js.map +1 -1
- package/lib/util/svg2marker.js +15 -17
- package/lib/util/svg2marker.js.map +1 -1
- package/lib/util/text.d.ts +1 -9
- package/lib/util/text.js +16 -16
- package/lib/util/text.js.map +1 -1
- package/lib/util/throttle.js +7 -13
- package/lib/util/throttle.js.map +1 -1
- package/lib/util/time.js +22 -24
- package/lib/util/time.js.map +1 -1
- package/lib/util/timer.js +5 -9
- package/lib/util/timer.js.map +1 -1
- package/lib/util/transform.js +5 -6
- 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 +3 -5
- package/lib/util/wrap.js.map +1 -1
- package/package.json +9 -8
- package/src/ui/poptip/constant.ts +1 -1
- package/src/ui/slider/index.ts +3 -2
- package/src/ui/sparkline/utils.ts +4 -1
- package/src/ui/title/types.ts +1 -1
package/lib/ui/layout/layout.js
CHANGED
|
@@ -1,97 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Layout = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function Layout(options) {
|
|
13
|
-
var _this = _super.call(this, options) || this;
|
|
14
|
-
_this.layoutEvents = [g_1.ElementEvent.BOUNDS_CHANGED, g_1.ElementEvent.INSERTED, g_1.ElementEvent.REMOVED];
|
|
15
|
-
_this.$margin = (0, series_1.parseSeriesAttr)(0);
|
|
16
|
-
_this.$padding = (0, series_1.parseSeriesAttr)(0);
|
|
17
|
-
var _a = options.style || {}, _b = _a.margin, margin = _b === void 0 ? 0 : _b, _c = _a.padding, padding = _c === void 0 ? 0 : _c;
|
|
18
|
-
_this.margin = margin;
|
|
19
|
-
_this.padding = padding;
|
|
20
|
-
_this.isMutationObserved = true;
|
|
21
|
-
_this.bindEvents();
|
|
22
|
-
return _this;
|
|
4
|
+
const g_1 = require("@antv/g");
|
|
5
|
+
const shapes_1 = require("../../shapes");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const layout_1 = require("../../util/layout");
|
|
8
|
+
const series_1 = require("../../util/series");
|
|
9
|
+
class Layout extends shapes_1.Group {
|
|
10
|
+
set margin(value) {
|
|
11
|
+
this.$margin = (0, series_1.parseSeriesAttr)(value);
|
|
23
12
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return this.$padding;
|
|
37
|
-
},
|
|
38
|
-
set: function (value) {
|
|
39
|
-
this.$padding = (0, series_1.parseSeriesAttr)(value);
|
|
40
|
-
},
|
|
41
|
-
enumerable: false,
|
|
42
|
-
configurable: true
|
|
43
|
-
});
|
|
44
|
-
Layout.prototype.getBBox = function () {
|
|
45
|
-
var _a = this.attributes, _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, width = _a.width, height = _a.height;
|
|
46
|
-
var _d = tslib_1.__read(this.$margin, 4), marginTop = _d[0], marginRight = _d[1], marginBottom = _d[2], marginLeft = _d[3];
|
|
13
|
+
get margin() {
|
|
14
|
+
return this.$margin;
|
|
15
|
+
}
|
|
16
|
+
set padding(value) {
|
|
17
|
+
this.$padding = (0, series_1.parseSeriesAttr)(value);
|
|
18
|
+
}
|
|
19
|
+
get padding() {
|
|
20
|
+
return this.$padding;
|
|
21
|
+
}
|
|
22
|
+
getBBox() {
|
|
23
|
+
const { x = 0, y = 0, width, height } = this.attributes;
|
|
24
|
+
const [marginTop, marginRight, marginBottom, marginLeft] = this.$margin;
|
|
47
25
|
return new util_1.BBox(x - marginLeft, y - marginTop, width + marginLeft + marginRight, height + marginTop + marginBottom);
|
|
48
|
-
}
|
|
49
|
-
|
|
26
|
+
}
|
|
27
|
+
appendChild(child, index) {
|
|
50
28
|
child.isMutationObserved = true;
|
|
51
|
-
|
|
29
|
+
super.appendChild(child, index);
|
|
52
30
|
return child;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
31
|
+
}
|
|
32
|
+
getAvailableSpace() {
|
|
33
|
+
const { width, height } = this.attributes;
|
|
34
|
+
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = this.$padding;
|
|
35
|
+
const [marginTop, , , marginLeft] = this.$margin;
|
|
58
36
|
return new util_1.BBox(paddingLeft + marginLeft, paddingTop + marginTop, width - paddingLeft - paddingRight, height - paddingTop - paddingBottom);
|
|
59
|
-
}
|
|
60
|
-
|
|
37
|
+
}
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super(options);
|
|
40
|
+
this.layoutEvents = [g_1.ElementEvent.BOUNDS_CHANGED, g_1.ElementEvent.INSERTED, g_1.ElementEvent.REMOVED];
|
|
41
|
+
this.$margin = (0, series_1.parseSeriesAttr)(0);
|
|
42
|
+
this.$padding = (0, series_1.parseSeriesAttr)(0);
|
|
43
|
+
const { margin = 0, padding = 0 } = options.style || {};
|
|
44
|
+
this.margin = margin;
|
|
45
|
+
this.padding = padding;
|
|
46
|
+
this.isMutationObserved = true;
|
|
47
|
+
this.bindEvents();
|
|
48
|
+
}
|
|
49
|
+
layout() {
|
|
61
50
|
if (!this.attributes.display || !this.isConnected)
|
|
62
51
|
return;
|
|
63
|
-
if (this.children.some(
|
|
52
|
+
if (this.children.some((child) => !child.isConnected))
|
|
64
53
|
return;
|
|
65
54
|
try {
|
|
66
|
-
|
|
67
|
-
this.style.transform =
|
|
68
|
-
|
|
69
|
-
this.children.forEach(
|
|
70
|
-
|
|
71
|
-
child.style.transform =
|
|
55
|
+
const { x, y } = this.attributes;
|
|
56
|
+
this.style.transform = `translate(${x}, ${y})`;
|
|
57
|
+
const bboxes = (0, layout_1.calcLayout)(this.getAvailableSpace(), this.children.map((child) => child.getBBox()), this.attributes);
|
|
58
|
+
this.children.forEach((child, index) => {
|
|
59
|
+
const { x, y } = bboxes[index];
|
|
60
|
+
child.style.transform = `translate(${x}, ${y})`;
|
|
72
61
|
});
|
|
73
62
|
}
|
|
74
63
|
catch (e) {
|
|
75
64
|
// do nothing
|
|
76
65
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
_this.addEventListener(event, function (e) {
|
|
66
|
+
}
|
|
67
|
+
bindEvents() {
|
|
68
|
+
this.layoutEvents.forEach((event) => {
|
|
69
|
+
this.addEventListener(event, (e) => {
|
|
82
70
|
e.target.isMutationObserved = true;
|
|
83
|
-
|
|
71
|
+
this.layout();
|
|
84
72
|
});
|
|
85
73
|
});
|
|
86
|
-
}
|
|
87
|
-
|
|
74
|
+
}
|
|
75
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
88
76
|
if (name === 'margin')
|
|
89
77
|
this.margin = newValue;
|
|
90
78
|
else if (name === 'padding')
|
|
91
79
|
this.padding = newValue;
|
|
92
80
|
this.layout();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
}(shapes_1.Group));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
96
83
|
exports.Layout = Layout;
|
|
97
84
|
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"src/","sources":["ui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ANGED
|
@@ -4,17 +4,16 @@ exports.getTitleShapeBBox = getTitleShapeBBox;
|
|
|
4
4
|
exports.renderTitle = renderTitle;
|
|
5
5
|
exports.renderGroup = renderGroup;
|
|
6
6
|
exports.renderRect = renderRect;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var util_1 = require("../../util");
|
|
7
|
+
const shapes_1 = require("../../shapes");
|
|
8
|
+
const util_1 = require("../../util");
|
|
10
9
|
function getTitleShapeBBox(titleShape) {
|
|
11
|
-
|
|
10
|
+
let box = { left: 0, top: 0, width: 0, height: 0 };
|
|
12
11
|
if ((titleShape === null || titleShape === void 0 ? void 0 : titleShape.tagName) === 'html') {
|
|
13
|
-
|
|
12
|
+
const { width, height } = titleShape.style;
|
|
14
13
|
box = { left: 0, top: 0, width: width, height: height };
|
|
15
14
|
}
|
|
16
15
|
else if (titleShape) {
|
|
17
|
-
|
|
16
|
+
const { min, halfExtents } = titleShape.getLocalBounds();
|
|
18
17
|
box = {
|
|
19
18
|
left: min[0],
|
|
20
19
|
top: min[1],
|
|
@@ -26,15 +25,15 @@ function getTitleShapeBBox(titleShape) {
|
|
|
26
25
|
}
|
|
27
26
|
function renderTitle(container, cfg) {
|
|
28
27
|
if (!cfg) {
|
|
29
|
-
|
|
28
|
+
const shape = container.querySelector('.legend-title');
|
|
30
29
|
if (shape)
|
|
31
30
|
shape.remove();
|
|
32
31
|
return null;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return (0, util_1.maybeAppend)(container,
|
|
37
|
-
.call(
|
|
33
|
+
const { style } = cfg;
|
|
34
|
+
const className = `legend-title`;
|
|
35
|
+
return (0, util_1.maybeAppend)(container, `.${className}`, () => new shapes_1.Text({ className, style }))
|
|
36
|
+
.call((selection) => {
|
|
38
37
|
selection.styles({
|
|
39
38
|
fontSize: 12,
|
|
40
39
|
textBaseline: 'top',
|
|
@@ -45,13 +44,13 @@ function renderTitle(container, cfg) {
|
|
|
45
44
|
.node();
|
|
46
45
|
}
|
|
47
46
|
function renderGroup(container, className, x, y) {
|
|
48
|
-
return (0, util_1.maybeAppend)(container,
|
|
47
|
+
return (0, util_1.maybeAppend)(container, `.${className}`, 'g').styles({ className, x, y }).node();
|
|
49
48
|
}
|
|
50
|
-
function renderRect(container, className, width, height, style) {
|
|
51
|
-
if (style === void 0) { style = {}; }
|
|
49
|
+
function renderRect(container, className, width, height, style = {}) {
|
|
52
50
|
return (0, util_1.select)(container)
|
|
53
51
|
.maybeAppendByClassName(className, 'rect')
|
|
54
|
-
.styles(
|
|
52
|
+
.styles(Object.assign({ zIndex: -1, width,
|
|
53
|
+
height }, style))
|
|
55
54
|
.node();
|
|
56
55
|
}
|
|
57
56
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"src/","sources":["ui/legend/base.ts"],"names":[],"mappings":";;AAGA,8CAoBC;AAED,kCAkBC;AAED,kCAEC;AAED,gCAUC
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"src/","sources":["ui/legend/base.ts"],"names":[],"mappings":";;AAGA,8CAoBC;AAED,kCAkBC;AAED,kCAEC;AAED,gCAUC;AA3DD,yCAAgE;AAChE,qCAAiD;AAEjD,SAAgB,iBAAiB,CAAC,UAA0B;IAM1D,IAAI,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACnD,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,MAAK,MAAM,EAAE,CAAC;QACnC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC;QAC3C,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,KAAe,EAAE,MAAM,EAAE,MAAgB,EAAE,CAAC;IAC9E,CAA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AAW,CAAC,SAAgB,EAAE,SAAiB,EAAE,CAAS,EAAE,CAAS;IACnF,OAAO,IAAA,kBAAW,EAAC,SAAS,EAAE,IAAI,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACzF,CAAC;AAED,SAAgB,UAAU,CAAC,SAAgB,EAAE,SAAiB,EAAE,KAAa,EAAE,MAAc,EAAE,QAAa,EAAE;IAC5G,OAAO,IAAA,aAAM,EAAC,SAAS,CAAC;SACrB,sBAAsB,CAAC,SAAS,EAAE,MAAM,CAAC;SACzC,MAAM,iBACL,MAAM,EAAE,CAAC,CAAC,EACV,KAAK;QACL,MAAM,IACH,KAAK,EACR;SACD,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CategoryItem = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const g_1 = require("@antv/g");
|
|
6
|
+
const marker_1 = require("../../marker");
|
|
7
|
+
const core_1 = require("../../../core");
|
|
8
|
+
const util_1 = require("../../../util");
|
|
9
|
+
const CLASS_NAMES = (0, util_1.classNames)({
|
|
10
10
|
layout: 'flex',
|
|
11
11
|
markerGroup: 'marker-group',
|
|
12
12
|
marker: 'marker',
|
|
@@ -18,17 +18,16 @@ var CLASS_NAMES = (0, util_1.classNames)({
|
|
|
18
18
|
background: 'background',
|
|
19
19
|
}, 'legend-category-item');
|
|
20
20
|
function styleOfMarker(group) {
|
|
21
|
-
|
|
21
|
+
const marker = group.querySelector(CLASS_NAMES.marker.class);
|
|
22
22
|
if (marker)
|
|
23
23
|
return marker.style;
|
|
24
24
|
return {};
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return _super.call(this, options, {
|
|
26
|
+
class CategoryItem extends core_1.Component {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
super(options, {
|
|
30
29
|
span: [1, 1],
|
|
31
|
-
marker:
|
|
30
|
+
marker: () => new g_1.Circle({ style: { r: 6 } }),
|
|
32
31
|
markerSize: 10,
|
|
33
32
|
labelFill: '#646464',
|
|
34
33
|
valueFill: '#646464',
|
|
@@ -36,122 +35,92 @@ var CategoryItem = /** @class */ (function (_super) {
|
|
|
36
35
|
valueFontSize: 12,
|
|
37
36
|
labelTextBaseline: 'middle',
|
|
38
37
|
valueTextBaseline: 'middle',
|
|
39
|
-
})
|
|
38
|
+
});
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var _a = this.shape, markerWidth = _a.markerWidth, labelWidth = _a.labelWidth, valueWidth = _a.valueWidth, width = _a.width, height = _a.height;
|
|
120
|
-
var _b = tslib_1.__read(this.spacing, 2), spacing1 = _b[0], spacing2 = _b[1];
|
|
121
|
-
return {
|
|
122
|
-
height: height,
|
|
123
|
-
width: width,
|
|
124
|
-
markerWidth: markerWidth,
|
|
125
|
-
labelWidth: labelWidth,
|
|
126
|
-
valueWidth: valueWidth,
|
|
127
|
-
position: [markerWidth / 2, markerWidth + spacing1, markerWidth + labelWidth + spacing1 + spacing2],
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
|
-
enumerable: false,
|
|
131
|
-
configurable: true
|
|
132
|
-
});
|
|
133
|
-
Object.defineProperty(CategoryItem.prototype, "scaleSize", {
|
|
134
|
-
get: function () {
|
|
135
|
-
var markerShapeStyle = styleOfMarker(this.markerGroup.node());
|
|
136
|
-
var _a = this.attributes, markerSize = _a.markerSize, _b = _a.markerStrokeWidth, markerStrokeWidth = _b === void 0 ? markerShapeStyle.strokeWidth : _b, _c = _a.markerLineWidth, markerLineWidth = _c === void 0 ? markerShapeStyle.lineWidth : _c, _d = _a.markerStroke, markerStroke = _d === void 0 ? markerShapeStyle.stroke : _d;
|
|
137
|
-
// empirical value
|
|
138
|
-
var strokeWidth = +(markerStrokeWidth || markerLineWidth || (markerStroke ? 1 : 0)) * Math.sqrt(2);
|
|
139
|
-
var _e = this.markerGroup.node().getBBox(), width = _e.width, height = _e.height;
|
|
140
|
-
return (1 - strokeWidth / Math.max(width, height)) * markerSize;
|
|
141
|
-
},
|
|
142
|
-
enumerable: false,
|
|
143
|
-
configurable: true
|
|
144
|
-
});
|
|
145
|
-
CategoryItem.prototype.renderMarker = function (container) {
|
|
146
|
-
var _this = this;
|
|
147
|
-
var marker = this.attributes.marker;
|
|
148
|
-
var style = (0, util_1.subStyleProps)(this.attributes, 'marker');
|
|
40
|
+
get showValue() {
|
|
41
|
+
const { valueText } = this.attributes;
|
|
42
|
+
if (!valueText)
|
|
43
|
+
return false;
|
|
44
|
+
if (typeof valueText === 'string' || typeof valueText === 'number')
|
|
45
|
+
return valueText !== '';
|
|
46
|
+
if (typeof valueText === 'function')
|
|
47
|
+
return true;
|
|
48
|
+
return valueText.attr('text') !== '';
|
|
49
|
+
}
|
|
50
|
+
get actualSpace() {
|
|
51
|
+
const label = this.labelGroup;
|
|
52
|
+
const value = this.valueGroup;
|
|
53
|
+
const { markerSize } = this.attributes;
|
|
54
|
+
const { width: labelWidth, height: labelHeight } = label.node().getBBox();
|
|
55
|
+
const { width: valueWidth, height: valueHeight } = value.node().getBBox();
|
|
56
|
+
return {
|
|
57
|
+
markerWidth: markerSize,
|
|
58
|
+
labelWidth,
|
|
59
|
+
valueWidth,
|
|
60
|
+
height: Math.max(markerSize, labelHeight, valueHeight),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
get span() {
|
|
64
|
+
const { span } = this.attributes;
|
|
65
|
+
if (!span)
|
|
66
|
+
return [1, 1];
|
|
67
|
+
const [span1, innerSpan] = (0, util_1.parseSeriesAttr)(span);
|
|
68
|
+
const span2 = this.showValue ? innerSpan : 0;
|
|
69
|
+
const basis = span1 + span2;
|
|
70
|
+
return [span1 / basis, span2 / basis];
|
|
71
|
+
}
|
|
72
|
+
get shape() {
|
|
73
|
+
const { markerSize, width: fullWidth } = this.attributes;
|
|
74
|
+
const actualSpace = this.actualSpace;
|
|
75
|
+
const { markerWidth, height } = actualSpace;
|
|
76
|
+
let { labelWidth, valueWidth } = this.actualSpace;
|
|
77
|
+
const [spacing1, spacing2] = this.spacing;
|
|
78
|
+
if (fullWidth) {
|
|
79
|
+
const width = fullWidth - markerSize - spacing1 - spacing2;
|
|
80
|
+
const [span1, span2] = this.span;
|
|
81
|
+
[labelWidth, valueWidth] = [span1 * width, span2 * width];
|
|
82
|
+
}
|
|
83
|
+
const width = markerWidth + labelWidth + valueWidth + spacing1 + spacing2;
|
|
84
|
+
return { width, height, markerWidth, labelWidth, valueWidth };
|
|
85
|
+
}
|
|
86
|
+
get spacing() {
|
|
87
|
+
const { spacing } = this.attributes;
|
|
88
|
+
if (!spacing)
|
|
89
|
+
return [0, 0];
|
|
90
|
+
const [spacing1, spacing2] = (0, util_1.parseSeriesAttr)(spacing);
|
|
91
|
+
if (this.showValue)
|
|
92
|
+
return [spacing1, spacing2];
|
|
93
|
+
return [spacing1, 0];
|
|
94
|
+
}
|
|
95
|
+
get layout() {
|
|
96
|
+
const { markerWidth, labelWidth, valueWidth, width, height } = this.shape;
|
|
97
|
+
const [spacing1, spacing2] = this.spacing;
|
|
98
|
+
return {
|
|
99
|
+
height,
|
|
100
|
+
width,
|
|
101
|
+
markerWidth,
|
|
102
|
+
labelWidth,
|
|
103
|
+
valueWidth,
|
|
104
|
+
position: [markerWidth / 2, markerWidth + spacing1, markerWidth + labelWidth + spacing1 + spacing2],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
get scaleSize() {
|
|
108
|
+
const markerShapeStyle = styleOfMarker(this.markerGroup.node());
|
|
109
|
+
const { markerSize, markerStrokeWidth = markerShapeStyle.strokeWidth, markerLineWidth = markerShapeStyle.lineWidth, markerStroke = markerShapeStyle.stroke, } = this.attributes;
|
|
110
|
+
// empirical value
|
|
111
|
+
const strokeWidth = +(markerStrokeWidth || markerLineWidth || (markerStroke ? 1 : 0)) * Math.sqrt(2);
|
|
112
|
+
const { width, height } = this.markerGroup.node().getBBox();
|
|
113
|
+
return (1 - strokeWidth / Math.max(width, height)) * markerSize;
|
|
114
|
+
}
|
|
115
|
+
renderMarker(container) {
|
|
116
|
+
const { marker } = this.attributes;
|
|
117
|
+
const style = (0, util_1.subStyleProps)(this.attributes, 'marker');
|
|
149
118
|
this.markerGroup = container.maybeAppendByClassName(CLASS_NAMES.markerGroup, 'g').style('zIndex', 0);
|
|
150
|
-
(0, util_1.ifShow)(!!marker, this.markerGroup,
|
|
119
|
+
(0, util_1.ifShow)(!!marker, this.markerGroup, () => {
|
|
151
120
|
var _a;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
121
|
+
const parent = this.markerGroup.node();
|
|
122
|
+
const oldMarker = (_a = parent.childNodes) === null || _a === void 0 ? void 0 : _a[0];
|
|
123
|
+
const newMarker = typeof marker === 'string'
|
|
155
124
|
? new marker_1.Marker({ style: { symbol: marker }, className: CLASS_NAMES.marker.name })
|
|
156
125
|
: marker();
|
|
157
126
|
if (!oldMarker) {
|
|
@@ -161,7 +130,7 @@ var CategoryItem = /** @class */ (function (_super) {
|
|
|
161
130
|
}
|
|
162
131
|
else if (newMarker.nodeName === oldMarker.nodeName) {
|
|
163
132
|
if (oldMarker instanceof marker_1.Marker)
|
|
164
|
-
oldMarker.update(
|
|
133
|
+
oldMarker.update(Object.assign(Object.assign({}, style), { symbol: marker }));
|
|
165
134
|
else {
|
|
166
135
|
(0, util_1.copyAttributes)(oldMarker, newMarker);
|
|
167
136
|
(0, util_1.select)(oldMarker).styles(style);
|
|
@@ -173,55 +142,53 @@ var CategoryItem = /** @class */ (function (_super) {
|
|
|
173
142
|
parent.appendChild(newMarker);
|
|
174
143
|
}
|
|
175
144
|
// record the scale of marker
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
145
|
+
this.markerGroup.node().scale(1 / this.markerGroup.node().getScale()[0]);
|
|
146
|
+
const scale = (0, util_1.scaleToPixel)(this.markerGroup.node(), this.scaleSize, true);
|
|
147
|
+
this.markerGroup.node().style._transform = `scale(${scale})`;
|
|
179
148
|
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
149
|
+
}
|
|
150
|
+
renderLabel(container) {
|
|
151
|
+
const _a = (0, util_1.subStyleProps)(this.attributes, 'label'), { text: label } = _a, style = tslib_1.__rest(_a, ["text"]);
|
|
183
152
|
this.labelGroup = container.maybeAppendByClassName(CLASS_NAMES.labelGroup, 'g').style('zIndex', 0);
|
|
184
|
-
this.labelGroup.maybeAppendByClassName(CLASS_NAMES.label,
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
var _a = (0, util_1.subStyleProps)(this.attributes, 'value'), value = _a.text, style = tslib_1.__rest(_a, ["text"]);
|
|
153
|
+
this.labelGroup.maybeAppendByClassName(CLASS_NAMES.label, () => (0, util_1.renderExtDo)(label)).styles(style);
|
|
154
|
+
}
|
|
155
|
+
renderValue(container) {
|
|
156
|
+
const _a = (0, util_1.subStyleProps)(this.attributes, 'value'), { text: value } = _a, style = tslib_1.__rest(_a, ["text"]);
|
|
189
157
|
this.valueGroup = container.maybeAppendByClassName(CLASS_NAMES.valueGroup, 'g').style('zIndex', 0);
|
|
190
|
-
(0, util_1.ifShow)(this.showValue, this.valueGroup,
|
|
191
|
-
|
|
158
|
+
(0, util_1.ifShow)(this.showValue, this.valueGroup, () => {
|
|
159
|
+
this.valueGroup.maybeAppendByClassName(CLASS_NAMES.value, () => (0, util_1.renderExtDo)(value)).styles(style);
|
|
192
160
|
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
161
|
+
}
|
|
162
|
+
renderBackground(container) {
|
|
163
|
+
const { width, height } = this.shape;
|
|
164
|
+
const style = (0, util_1.subStyleProps)(this.attributes, 'background');
|
|
197
165
|
this.background = container.maybeAppendByClassName(CLASS_NAMES.backgroundGroup, 'g').style('zIndex', -1);
|
|
198
|
-
this.background.maybeAppendByClassName(CLASS_NAMES.background, 'rect').styles(
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
166
|
+
this.background.maybeAppendByClassName(CLASS_NAMES.background, 'rect').styles(Object.assign({ width, height }, style));
|
|
167
|
+
}
|
|
168
|
+
adjustLayout() {
|
|
169
|
+
const { layout: { labelWidth, valueWidth, height, position: [markerX, labelX, valueX], }, } = this;
|
|
170
|
+
const halfHeight = height / 2;
|
|
203
171
|
// console.log(this.markerGroup.node().style._transform);
|
|
204
172
|
this.markerGroup.styles({
|
|
205
|
-
transform:
|
|
173
|
+
transform: `translate(${markerX}, ${halfHeight})${this.markerGroup.node().style._transform}`,
|
|
206
174
|
});
|
|
207
|
-
this.labelGroup.styles({ transform:
|
|
175
|
+
this.labelGroup.styles({ transform: `translate(${labelX}, ${halfHeight})` });
|
|
208
176
|
(0, util_1.ellipsisIt)(this.labelGroup.select(CLASS_NAMES.label.class).node(), Math.ceil(labelWidth));
|
|
209
177
|
if (this.showValue) {
|
|
210
|
-
this.valueGroup.styles({ transform:
|
|
178
|
+
this.valueGroup.styles({ transform: `translate(${valueX}, ${halfHeight})` });
|
|
211
179
|
(0, util_1.ellipsisIt)(this.valueGroup.select(CLASS_NAMES.value.class).node(), Math.ceil(valueWidth));
|
|
212
180
|
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
ctn.styles({ transform:
|
|
181
|
+
}
|
|
182
|
+
render(attributes, container) {
|
|
183
|
+
const ctn = (0, util_1.select)(container);
|
|
184
|
+
const { x = 0, y = 0 } = attributes;
|
|
185
|
+
ctn.styles({ transform: `translate(${x}, ${y})` });
|
|
218
186
|
this.renderMarker(ctn);
|
|
219
187
|
this.renderLabel(ctn);
|
|
220
188
|
this.renderValue(ctn);
|
|
221
189
|
this.renderBackground(ctn);
|
|
222
190
|
this.adjustLayout();
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
}(core_1.Component));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
226
193
|
exports.CategoryItem = CategoryItem;
|
|
227
194
|
//# sourceMappingURL=item.js.map
|