@visactor/vgrammar-core 0.7.0
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/README.md +160 -0
- package/README.zh-CN.md +11 -0
- package/cjs/component/axis.d.ts +26 -0
- package/cjs/component/axis.js +164 -0
- package/cjs/component/axis.js.map +1 -0
- package/cjs/component/crosshair.d.ts +50 -0
- package/cjs/component/crosshair.js +281 -0
- package/cjs/component/crosshair.js.map +1 -0
- package/cjs/component/datazoom.d.ts +19 -0
- package/cjs/component/datazoom.js +166 -0
- package/cjs/component/datazoom.js.map +1 -0
- package/cjs/component/grid.d.ts +27 -0
- package/cjs/component/grid.js +190 -0
- package/cjs/component/grid.js.map +1 -0
- package/cjs/component/index.d.ts +11 -0
- package/cjs/component/index.js +105 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/component/label.d.ts +19 -0
- package/cjs/component/label.js +121 -0
- package/cjs/component/label.js.map +1 -0
- package/cjs/component/legend.d.ts +26 -0
- package/cjs/component/legend.js +170 -0
- package/cjs/component/legend.js.map +1 -0
- package/cjs/component/player.d.ts +25 -0
- package/cjs/component/player.js +138 -0
- package/cjs/component/player.js.map +1 -0
- package/cjs/component/scale.d.ts +8 -0
- package/cjs/component/scale.js +25 -0
- package/cjs/component/scale.js.map +1 -0
- package/cjs/component/scrollbar.d.ts +23 -0
- package/cjs/component/scrollbar.js +187 -0
- package/cjs/component/scrollbar.js.map +1 -0
- package/cjs/component/slider.d.ts +19 -0
- package/cjs/component/slider.js +86 -0
- package/cjs/component/slider.js.map +1 -0
- package/cjs/component/title.d.ts +15 -0
- package/cjs/component/title.js +56 -0
- package/cjs/component/title.js.map +1 -0
- package/cjs/component/tooltip.d.ts +62 -0
- package/cjs/component/tooltip.js +305 -0
- package/cjs/component/tooltip.js.map +1 -0
- package/cjs/core/factory.d.ts +35 -0
- package/cjs/core/factory.js +73 -0
- package/cjs/core/factory.js.map +1 -0
- package/cjs/glyph/boxplot.d.ts +10 -0
- package/cjs/glyph/boxplot.js +418 -0
- package/cjs/glyph/boxplot.js.map +1 -0
- package/cjs/glyph/index.d.ts +7 -0
- package/cjs/glyph/index.js +64 -0
- package/cjs/glyph/index.js.map +1 -0
- package/cjs/glyph/link-path.d.ts +7 -0
- package/cjs/glyph/link-path.js +138 -0
- package/cjs/glyph/link-path.js.map +1 -0
- package/cjs/glyph/ripple.d.ts +1 -0
- package/cjs/glyph/ripple.js +44 -0
- package/cjs/glyph/ripple.js.map +1 -0
- package/cjs/glyph/tree-path.d.ts +7 -0
- package/cjs/glyph/tree-path.js +152 -0
- package/cjs/glyph/tree-path.js.map +1 -0
- package/cjs/glyph/violin.d.ts +1 -0
- package/cjs/glyph/violin.js +165 -0
- package/cjs/glyph/violin.js.map +1 -0
- package/cjs/glyph/wave.d.ts +1 -0
- package/cjs/glyph/wave.js +67 -0
- package/cjs/glyph/wave.js.map +1 -0
- package/cjs/graph/animation/animate.d.ts +48 -0
- package/cjs/graph/animation/animate.js +250 -0
- package/cjs/graph/animation/animate.js.map +1 -0
- package/cjs/graph/animation/animation/clip.d.ts +4 -0
- package/cjs/graph/animation/animation/clip.js +54 -0
- package/cjs/graph/animation/animation/clip.js.map +1 -0
- package/cjs/graph/animation/animation/fade.d.ts +4 -0
- package/cjs/graph/animation/animation/fade.js +42 -0
- package/cjs/graph/animation/animation/fade.js.map +1 -0
- package/cjs/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-cartesian.js +288 -0
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/cjs/graph/animation/animation/grow-interval.d.ts +3 -0
- package/cjs/graph/animation/animation/grow-interval.js +194 -0
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -0
- package/cjs/graph/animation/animation/grow-points.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-points.js +118 -0
- package/cjs/graph/animation/animation/grow-points.js.map +1 -0
- package/cjs/graph/animation/animation/grow-polar.d.ts +5 -0
- package/cjs/graph/animation/animation/grow-polar.js +164 -0
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -0
- package/cjs/graph/animation/animation/index.d.ts +11 -0
- package/cjs/graph/animation/animation/index.js +191 -0
- package/cjs/graph/animation/animation/index.js.map +1 -0
- package/cjs/graph/animation/animation/move.d.ts +3 -0
- package/cjs/graph/animation/animation/move.js +90 -0
- package/cjs/graph/animation/animation/move.js.map +1 -0
- package/cjs/graph/animation/animation/rotate.d.ts +3 -0
- package/cjs/graph/animation/animation/rotate.js +42 -0
- package/cjs/graph/animation/animation/rotate.js.map +1 -0
- package/cjs/graph/animation/animation/scale.d.ts +3 -0
- package/cjs/graph/animation/animation/scale.js +84 -0
- package/cjs/graph/animation/animation/scale.js.map +1 -0
- package/cjs/graph/animation/animation/update.d.ts +6 -0
- package/cjs/graph/animation/animation/update.js +22 -0
- package/cjs/graph/animation/animation/update.js.map +1 -0
- package/cjs/graph/animation/animator.d.ts +26 -0
- package/cjs/graph/animation/animator.js +88 -0
- package/cjs/graph/animation/animator.js.map +1 -0
- package/cjs/graph/animation/arranger.d.ts +13 -0
- package/cjs/graph/animation/arranger.js +38 -0
- package/cjs/graph/animation/arranger.js.map +1 -0
- package/cjs/graph/animation/attribute.d.ts +27 -0
- package/cjs/graph/animation/attribute.js +124 -0
- package/cjs/graph/animation/attribute.js.map +1 -0
- package/cjs/graph/animation/config.d.ts +5 -0
- package/cjs/graph/animation/config.js +92 -0
- package/cjs/graph/animation/config.js.map +1 -0
- package/cjs/graph/animation/morph.d.ts +12 -0
- package/cjs/graph/animation/morph.js +174 -0
- package/cjs/graph/animation/morph.js.map +1 -0
- package/cjs/graph/attributes/common.d.ts +2 -0
- package/cjs/graph/attributes/common.js +22 -0
- package/cjs/graph/attributes/common.js.map +1 -0
- package/cjs/graph/attributes/helpers.d.ts +17 -0
- package/cjs/graph/attributes/helpers.js +86 -0
- package/cjs/graph/attributes/helpers.js.map +1 -0
- package/cjs/graph/attributes/index.d.ts +10 -0
- package/cjs/graph/attributes/index.js +257 -0
- package/cjs/graph/attributes/index.js.map +1 -0
- package/cjs/graph/canvas-renderer.d.ts +34 -0
- package/cjs/graph/canvas-renderer.js +121 -0
- package/cjs/graph/canvas-renderer.js.map +1 -0
- package/cjs/graph/constants.d.ts +23 -0
- package/cjs/graph/constants.js +21 -0
- package/cjs/graph/constants.js.map +1 -0
- package/cjs/graph/element.d.ts +66 -0
- package/cjs/graph/element.js +297 -0
- package/cjs/graph/element.js.map +1 -0
- package/cjs/graph/enums.d.ts +153 -0
- package/cjs/graph/enums.js +85 -0
- package/cjs/graph/enums.js.map +1 -0
- package/cjs/graph/glyph-element.d.ts +53 -0
- package/cjs/graph/glyph-element.js +202 -0
- package/cjs/graph/glyph-element.js.map +1 -0
- package/cjs/graph/index.d.ts +3 -0
- package/cjs/graph/index.js +44 -0
- package/cjs/graph/index.js.map +1 -0
- package/cjs/graph/layout/grid.d.ts +3 -0
- package/cjs/graph/layout/grid.js +75 -0
- package/cjs/graph/layout/grid.js.map +1 -0
- package/cjs/graph/layout/layout.d.ts +3 -0
- package/cjs/graph/layout/layout.js +33 -0
- package/cjs/graph/layout/layout.js.map +1 -0
- package/cjs/graph/layout/relative.d.ts +3 -0
- package/cjs/graph/layout/relative.js +86 -0
- package/cjs/graph/layout/relative.js.map +1 -0
- package/cjs/graph/mark/differ.d.ts +20 -0
- package/cjs/graph/mark/differ.js +110 -0
- package/cjs/graph/mark/differ.js.map +1 -0
- package/cjs/graph/mark/encode.d.ts +10 -0
- package/cjs/graph/mark/encode.js +95 -0
- package/cjs/graph/mark/encode.js.map +1 -0
- package/cjs/graph/mark/large-rects.d.ts +10 -0
- package/cjs/graph/mark/large-rects.js +31 -0
- package/cjs/graph/mark/large-rects.js.map +1 -0
- package/cjs/graph/mark/large-symbols.d.ts +11 -0
- package/cjs/graph/mark/large-symbols.js +33 -0
- package/cjs/graph/mark/large-symbols.js.map +1 -0
- package/cjs/graph/mark-tree.d.ts +2 -0
- package/cjs/graph/mark-tree.js +21 -0
- package/cjs/graph/mark-tree.js.map +1 -0
- package/cjs/graph/util/element.d.ts +2 -0
- package/cjs/graph/util/element.js +10 -0
- package/cjs/graph/util/element.js.map +1 -0
- package/cjs/graph/util/env.d.ts +2 -0
- package/cjs/graph/util/env.js +14 -0
- package/cjs/graph/util/env.js.map +1 -0
- package/cjs/graph/util/events-extend.d.ts +5 -0
- package/cjs/graph/util/events-extend.js +18 -0
- package/cjs/graph/util/events-extend.js.map +1 -0
- package/cjs/graph/util/graphic.d.ts +9 -0
- package/cjs/graph/util/graphic.js +59 -0
- package/cjs/graph/util/graphic.js.map +1 -0
- package/cjs/graph/util/point.d.ts +1 -0
- package/cjs/graph/util/point.js +75 -0
- package/cjs/graph/util/point.js.map +1 -0
- package/cjs/index.d.ts +14 -0
- package/cjs/index.js +111 -0
- package/cjs/index.js.map +1 -0
- package/cjs/parse/coordinate.d.ts +7 -0
- package/cjs/parse/coordinate.js +70 -0
- package/cjs/parse/coordinate.js.map +1 -0
- package/cjs/parse/event.d.ts +8 -0
- package/cjs/parse/event.js +33 -0
- package/cjs/parse/event.js.map +1 -0
- package/cjs/parse/mark.d.ts +4 -0
- package/cjs/parse/mark.js +25 -0
- package/cjs/parse/mark.js.map +1 -0
- package/cjs/parse/option.d.ts +3 -0
- package/cjs/parse/option.js +19 -0
- package/cjs/parse/option.js.map +1 -0
- package/cjs/parse/scale.d.ts +8 -0
- package/cjs/parse/scale.js +365 -0
- package/cjs/parse/scale.js.map +1 -0
- package/cjs/parse/transform.d.ts +5 -0
- package/cjs/parse/transform.js +103 -0
- package/cjs/parse/transform.js.map +1 -0
- package/cjs/parse/util.d.ts +13 -0
- package/cjs/parse/util.js +82 -0
- package/cjs/parse/util.js.map +1 -0
- package/cjs/parse/view.d.ts +17 -0
- package/cjs/parse/view.js +108 -0
- package/cjs/parse/view.js.map +1 -0
- package/cjs/semantic-marks/cell.d.ts +13 -0
- package/cjs/semantic-marks/cell.js +61 -0
- package/cjs/semantic-marks/cell.js.map +1 -0
- package/cjs/semantic-marks/interval.d.ts +14 -0
- package/cjs/semantic-marks/interval.js +80 -0
- package/cjs/semantic-marks/interval.js.map +1 -0
- package/cjs/semantic-marks/text.d.ts +10 -0
- package/cjs/semantic-marks/text.js +25 -0
- package/cjs/semantic-marks/text.js.map +1 -0
- package/cjs/theme/common/component.d.ts +15 -0
- package/cjs/theme/common/component.js +493 -0
- package/cjs/theme/common/component.js.map +1 -0
- package/cjs/theme/common/constants.d.ts +1 -0
- package/cjs/theme/common/constants.js +6 -0
- package/cjs/theme/common/constants.js.map +1 -0
- package/cjs/theme/common/mark.d.ts +2 -0
- package/cjs/theme/common/mark.js +15 -0
- package/cjs/theme/common/mark.js.map +1 -0
- package/cjs/theme/dark.d.ts +2 -0
- package/cjs/theme/dark.js +94 -0
- package/cjs/theme/dark.js.map +1 -0
- package/cjs/theme/default.d.ts +2 -0
- package/cjs/theme/default.js +18 -0
- package/cjs/theme/default.js.map +1 -0
- package/cjs/theme/theme-manager.d.ts +8 -0
- package/cjs/theme/theme-manager.js +26 -0
- package/cjs/theme/theme-manager.js.map +1 -0
- package/cjs/transforms/data/bin.d.ts +2 -0
- package/cjs/transforms/data/bin.js +21 -0
- package/cjs/transforms/data/bin.js.map +1 -0
- package/cjs/transforms/data/circular-relation.d.ts +2 -0
- package/cjs/transforms/data/circular-relation.js +56 -0
- package/cjs/transforms/data/circular-relation.js.map +1 -0
- package/cjs/transforms/data/contour.d.ts +2 -0
- package/cjs/transforms/data/contour.js +115 -0
- package/cjs/transforms/data/contour.js.map +1 -0
- package/cjs/transforms/data/filter.d.ts +2 -0
- package/cjs/transforms/data/filter.js +10 -0
- package/cjs/transforms/data/filter.js.map +1 -0
- package/cjs/transforms/data/fold.d.ts +2 -0
- package/cjs/transforms/data/fold.js +24 -0
- package/cjs/transforms/data/fold.js.map +1 -0
- package/cjs/transforms/data/funnel.d.ts +2 -0
- package/cjs/transforms/data/funnel.js +25 -0
- package/cjs/transforms/data/funnel.js.map +1 -0
- package/cjs/transforms/data/join.d.ts +2 -0
- package/cjs/transforms/data/join.js +33 -0
- package/cjs/transforms/data/join.js.map +1 -0
- package/cjs/transforms/data/kde.d.ts +2 -0
- package/cjs/transforms/data/kde.js +90 -0
- package/cjs/transforms/data/kde.js.map +1 -0
- package/cjs/transforms/data/map.d.ts +2 -0
- package/cjs/transforms/data/map.js +23 -0
- package/cjs/transforms/data/map.js.map +1 -0
- package/cjs/transforms/data/pick.d.ts +2 -0
- package/cjs/transforms/data/pick.js +20 -0
- package/cjs/transforms/data/pick.js.map +1 -0
- package/cjs/transforms/data/pie.d.ts +2 -0
- package/cjs/transforms/data/pie.js +24 -0
- package/cjs/transforms/data/pie.js.map +1 -0
- package/cjs/transforms/data/range.d.ts +4 -0
- package/cjs/transforms/data/range.js +15 -0
- package/cjs/transforms/data/range.js.map +1 -0
- package/cjs/transforms/data/sort.d.ts +2 -0
- package/cjs/transforms/data/sort.js +17 -0
- package/cjs/transforms/data/sort.js.map +1 -0
- package/cjs/transforms/data/stack.d.ts +2 -0
- package/cjs/transforms/data/stack.js +74 -0
- package/cjs/transforms/data/stack.js.map +1 -0
- package/cjs/transforms/data/unfold.d.ts +2 -0
- package/cjs/transforms/data/unfold.js +49 -0
- package/cjs/transforms/data/unfold.js.map +1 -0
- package/cjs/transforms/index.d.ts +23 -0
- package/cjs/transforms/index.js +213 -0
- package/cjs/transforms/index.js.map +1 -0
- package/cjs/transforms/mark/dodge.d.ts +2 -0
- package/cjs/transforms/mark/dodge.js +81 -0
- package/cjs/transforms/mark/dodge.js.map +1 -0
- package/cjs/transforms/mark/jitter.d.ts +4 -0
- package/cjs/transforms/mark/jitter.js +53 -0
- package/cjs/transforms/mark/jitter.js.map +1 -0
- package/cjs/transforms/mark/lttb-sample.d.ts +2 -0
- package/cjs/transforms/mark/lttb-sample.js +68 -0
- package/cjs/transforms/mark/lttb-sample.js.map +1 -0
- package/cjs/transforms/mark/mark-overlap.d.ts +2 -0
- package/cjs/transforms/mark/mark-overlap.js +79 -0
- package/cjs/transforms/mark/mark-overlap.js.map +1 -0
- package/cjs/transforms/mark/symmetry.d.ts +2 -0
- package/cjs/transforms/mark/symmetry.js +25 -0
- package/cjs/transforms/mark/symmetry.js.map +1 -0
- package/cjs/transforms/util/util.d.ts +5 -0
- package/cjs/transforms/util/util.js +41 -0
- package/cjs/transforms/util/util.js.map +1 -0
- package/cjs/transforms/view/identifier.d.ts +2 -0
- package/cjs/transforms/view/identifier.js +17 -0
- package/cjs/transforms/view/identifier.js.map +1 -0
- package/cjs/types/animate.d.ts +224 -0
- package/cjs/types/animate.js +6 -0
- package/cjs/types/animate.js.map +1 -0
- package/cjs/types/base.d.ts +36 -0
- package/cjs/types/base.js +6 -0
- package/cjs/types/base.js.map +1 -0
- package/cjs/types/component.d.ts +240 -0
- package/cjs/types/component.js +6 -0
- package/cjs/types/component.js.map +1 -0
- package/cjs/types/coordinate.d.ts +15 -0
- package/cjs/types/coordinate.js +6 -0
- package/cjs/types/coordinate.js.map +1 -0
- package/cjs/types/data.d.ts +55 -0
- package/cjs/types/data.js +5 -0
- package/cjs/types/data.js.map +1 -0
- package/cjs/types/dataflow.d.ts +13 -0
- package/cjs/types/dataflow.js +6 -0
- package/cjs/types/dataflow.js.map +1 -0
- package/cjs/types/element.d.ts +117 -0
- package/cjs/types/element.js +6 -0
- package/cjs/types/element.js.map +1 -0
- package/cjs/types/event.d.ts +58 -0
- package/cjs/types/event.js +6 -0
- package/cjs/types/event.js.map +1 -0
- package/cjs/types/glyph.d.ts +29 -0
- package/cjs/types/glyph.js +6 -0
- package/cjs/types/glyph.js.map +1 -0
- package/cjs/types/grammar.d.ts +184 -0
- package/cjs/types/grammar.js +6 -0
- package/cjs/types/grammar.js.map +1 -0
- package/cjs/types/hooks.d.ts +45 -0
- package/cjs/types/hooks.js +6 -0
- package/cjs/types/hooks.js.map +1 -0
- package/cjs/types/index.d.ts +22 -0
- package/cjs/types/index.js +31 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/layout.d.ts +5 -0
- package/cjs/types/layout.js +6 -0
- package/cjs/types/layout.js.map +1 -0
- package/cjs/types/mark.d.ts +344 -0
- package/cjs/types/mark.js +6 -0
- package/cjs/types/mark.js.map +1 -0
- package/cjs/types/morph.d.ts +29 -0
- package/cjs/types/morph.js +6 -0
- package/cjs/types/morph.js.map +1 -0
- package/cjs/types/plot.d.ts +326 -0
- package/cjs/types/plot.js +6 -0
- package/cjs/types/plot.js.map +1 -0
- package/cjs/types/projection.d.ts +61 -0
- package/cjs/types/projection.js +6 -0
- package/cjs/types/projection.js.map +1 -0
- package/cjs/types/renderer.d.ts +19 -0
- package/cjs/types/renderer.js +6 -0
- package/cjs/types/renderer.js.map +1 -0
- package/cjs/types/scale.d.ts +111 -0
- package/cjs/types/scale.js +6 -0
- package/cjs/types/scale.js.map +1 -0
- package/cjs/types/signal.d.ts +20 -0
- package/cjs/types/signal.js +6 -0
- package/cjs/types/signal.js.map +1 -0
- package/cjs/types/theme.d.ts +41 -0
- package/cjs/types/theme.js +6 -0
- package/cjs/types/theme.js.map +1 -0
- package/cjs/types/transform.d.ts +291 -0
- package/cjs/types/transform.js +6 -0
- package/cjs/types/transform.js.map +1 -0
- package/cjs/types/view.d.ts +217 -0
- package/cjs/types/view.js +6 -0
- package/cjs/types/view.js.map +1 -0
- package/cjs/util/data.d.ts +3 -0
- package/cjs/util/data.js +64 -0
- package/cjs/util/data.js.map +1 -0
- package/cjs/util/grammar-heap.d.ts +14 -0
- package/cjs/util/grammar-heap.js +66 -0
- package/cjs/util/grammar-heap.js.map +1 -0
- package/cjs/util/text.d.ts +19 -0
- package/cjs/util/text.js +32 -0
- package/cjs/util/text.js.map +1 -0
- package/cjs/util/unique-list.d.ts +12 -0
- package/cjs/util/unique-list.js +37 -0
- package/cjs/util/unique-list.js.map +1 -0
- package/cjs/view/View.d.ts +157 -0
- package/cjs/view/View.js +800 -0
- package/cjs/view/View.js.map +1 -0
- package/cjs/view/animate.d.ts +20 -0
- package/cjs/view/animate.js +106 -0
- package/cjs/view/animate.js.map +1 -0
- package/cjs/view/component.d.ts +26 -0
- package/cjs/view/component.js +64 -0
- package/cjs/view/component.js.map +1 -0
- package/cjs/view/constants.d.ts +17 -0
- package/cjs/view/constants.js +13 -0
- package/cjs/view/constants.js.map +1 -0
- package/cjs/view/coordinate.d.ts +23 -0
- package/cjs/view/coordinate.js +59 -0
- package/cjs/view/coordinate.js.map +1 -0
- package/cjs/view/data.d.ts +37 -0
- package/cjs/view/data.js +198 -0
- package/cjs/view/data.js.map +1 -0
- package/cjs/view/dataflow.d.ts +32 -0
- package/cjs/view/dataflow.js +146 -0
- package/cjs/view/dataflow.js.map +1 -0
- package/cjs/view/events.d.ts +4 -0
- package/cjs/view/events.js +34 -0
- package/cjs/view/events.js.map +1 -0
- package/cjs/view/glyph-meta.d.ts +29 -0
- package/cjs/view/glyph-meta.js +45 -0
- package/cjs/view/glyph-meta.js.map +1 -0
- package/cjs/view/glyph.d.ts +14 -0
- package/cjs/view/glyph.js +29 -0
- package/cjs/view/glyph.js.map +1 -0
- package/cjs/view/grammar-base.d.ts +46 -0
- package/cjs/view/grammar-base.js +171 -0
- package/cjs/view/grammar-base.js.map +1 -0
- package/cjs/view/grammar-record.d.ts +39 -0
- package/cjs/view/grammar-record.js +180 -0
- package/cjs/view/grammar-record.js.map +1 -0
- package/cjs/view/group.d.ts +13 -0
- package/cjs/view/group.js +39 -0
- package/cjs/view/group.js.map +1 -0
- package/cjs/view/index.d.ts +1 -0
- package/cjs/view/index.js +21 -0
- package/cjs/view/index.js.map +1 -0
- package/cjs/view/mark.d.ts +112 -0
- package/cjs/view/mark.js +600 -0
- package/cjs/view/mark.js.map +1 -0
- package/cjs/view/scale.d.ts +26 -0
- package/cjs/view/scale.js +86 -0
- package/cjs/view/scale.js.map +1 -0
- package/cjs/view/signal.d.ts +18 -0
- package/cjs/view/signal.js +56 -0
- package/cjs/view/signal.js.map +1 -0
- package/es/component/axis.d.ts +26 -0
- package/es/component/axis.js +162 -0
- package/es/component/axis.js.map +1 -0
- package/es/component/crosshair.d.ts +50 -0
- package/es/component/crosshair.js +275 -0
- package/es/component/crosshair.js.map +1 -0
- package/es/component/datazoom.d.ts +19 -0
- package/es/component/datazoom.js +161 -0
- package/es/component/datazoom.js.map +1 -0
- package/es/component/grid.d.ts +27 -0
- package/es/component/grid.js +193 -0
- package/es/component/grid.js.map +1 -0
- package/es/component/index.d.ts +11 -0
- package/es/component/index.js +22 -0
- package/es/component/index.js.map +1 -0
- package/es/component/label.d.ts +19 -0
- package/es/component/label.js +124 -0
- package/es/component/label.js.map +1 -0
- package/es/component/legend.d.ts +26 -0
- package/es/component/legend.js +169 -0
- package/es/component/legend.js.map +1 -0
- package/es/component/player.d.ts +25 -0
- package/es/component/player.js +136 -0
- package/es/component/player.js.map +1 -0
- package/es/component/scale.d.ts +8 -0
- package/es/component/scale.js +19 -0
- package/es/component/scale.js.map +1 -0
- package/es/component/scrollbar.d.ts +23 -0
- package/es/component/scrollbar.js +184 -0
- package/es/component/scrollbar.js.map +1 -0
- package/es/component/slider.d.ts +19 -0
- package/es/component/slider.js +86 -0
- package/es/component/slider.js.map +1 -0
- package/es/component/title.d.ts +15 -0
- package/es/component/title.js +58 -0
- package/es/component/title.js.map +1 -0
- package/es/component/tooltip.d.ts +62 -0
- package/es/component/tooltip.js +303 -0
- package/es/component/tooltip.js.map +1 -0
- package/es/core/factory.d.ts +35 -0
- package/es/core/factory.js +67 -0
- package/es/core/factory.js.map +1 -0
- package/es/glyph/boxplot.d.ts +10 -0
- package/es/glyph/boxplot.js +410 -0
- package/es/glyph/boxplot.js.map +1 -0
- package/es/glyph/index.d.ts +7 -0
- package/es/glyph/index.js +11 -0
- package/es/glyph/index.js.map +1 -0
- package/es/glyph/link-path.d.ts +7 -0
- package/es/glyph/link-path.js +132 -0
- package/es/glyph/link-path.js.map +1 -0
- package/es/glyph/ripple.d.ts +1 -0
- package/es/glyph/ripple.js +38 -0
- package/es/glyph/ripple.js.map +1 -0
- package/es/glyph/tree-path.d.ts +7 -0
- package/es/glyph/tree-path.js +146 -0
- package/es/glyph/tree-path.js.map +1 -0
- package/es/glyph/violin.d.ts +1 -0
- package/es/glyph/violin.js +163 -0
- package/es/glyph/violin.js.map +1 -0
- package/es/glyph/wave.d.ts +1 -0
- package/es/glyph/wave.js +61 -0
- package/es/glyph/wave.js.map +1 -0
- package/es/graph/animation/animate.d.ts +48 -0
- package/es/graph/animation/animate.js +247 -0
- package/es/graph/animation/animate.js.map +1 -0
- package/es/graph/animation/animation/clip.d.ts +4 -0
- package/es/graph/animation/animation/clip.js +44 -0
- package/es/graph/animation/animation/clip.js.map +1 -0
- package/es/graph/animation/animation/fade.d.ts +4 -0
- package/es/graph/animation/animation/fade.js +32 -0
- package/es/graph/animation/animation/fade.js.map +1 -0
- package/es/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/es/graph/animation/animation/grow-cartesian.js +272 -0
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/es/graph/animation/animation/grow-interval.d.ts +3 -0
- package/es/graph/animation/animation/grow-interval.js +184 -0
- package/es/graph/animation/animation/grow-interval.js.map +1 -0
- package/es/graph/animation/animation/grow-points.d.ts +7 -0
- package/es/graph/animation/animation/grow-points.js +107 -0
- package/es/graph/animation/animation/grow-points.js.map +1 -0
- package/es/graph/animation/animation/grow-polar.d.ts +5 -0
- package/es/graph/animation/animation/grow-polar.js +160 -0
- package/es/graph/animation/animation/grow-polar.js.map +1 -0
- package/es/graph/animation/animation/index.d.ts +11 -0
- package/es/graph/animation/animation/index.js +22 -0
- package/es/graph/animation/animation/index.js.map +1 -0
- package/es/graph/animation/animation/move.d.ts +3 -0
- package/es/graph/animation/animation/move.js +78 -0
- package/es/graph/animation/animation/move.js.map +1 -0
- package/es/graph/animation/animation/rotate.d.ts +3 -0
- package/es/graph/animation/animation/rotate.js +32 -0
- package/es/graph/animation/animation/rotate.js.map +1 -0
- package/es/graph/animation/animation/scale.d.ts +3 -0
- package/es/graph/animation/animation/scale.js +74 -0
- package/es/graph/animation/animation/scale.js.map +1 -0
- package/es/graph/animation/animation/update.d.ts +6 -0
- package/es/graph/animation/animation/update.js +20 -0
- package/es/graph/animation/animation/update.js.map +1 -0
- package/es/graph/animation/animator.d.ts +26 -0
- package/es/graph/animation/animator.js +83 -0
- package/es/graph/animation/animator.js.map +1 -0
- package/es/graph/animation/arranger.d.ts +13 -0
- package/es/graph/animation/arranger.js +29 -0
- package/es/graph/animation/arranger.js.map +1 -0
- package/es/graph/animation/attribute.d.ts +27 -0
- package/es/graph/animation/attribute.js +114 -0
- package/es/graph/animation/attribute.js.map +1 -0
- package/es/graph/animation/config.d.ts +5 -0
- package/es/graph/animation/config.js +84 -0
- package/es/graph/animation/config.js.map +1 -0
- package/es/graph/animation/morph.d.ts +12 -0
- package/es/graph/animation/morph.js +171 -0
- package/es/graph/animation/morph.js.map +1 -0
- package/es/graph/attributes/common.d.ts +2 -0
- package/es/graph/attributes/common.js +13 -0
- package/es/graph/attributes/common.js.map +1 -0
- package/es/graph/attributes/helpers.d.ts +17 -0
- package/es/graph/attributes/helpers.js +75 -0
- package/es/graph/attributes/helpers.js.map +1 -0
- package/es/graph/attributes/index.d.ts +10 -0
- package/es/graph/attributes/index.js +231 -0
- package/es/graph/attributes/index.js.map +1 -0
- package/es/graph/canvas-renderer.d.ts +34 -0
- package/es/graph/canvas-renderer.js +115 -0
- package/es/graph/canvas-renderer.js.map +1 -0
- package/es/graph/constants.d.ts +23 -0
- package/es/graph/constants.js +47 -0
- package/es/graph/constants.js.map +1 -0
- package/es/graph/element.d.ts +66 -0
- package/es/graph/element.js +292 -0
- package/es/graph/element.js.map +1 -0
- package/es/graph/enums.d.ts +153 -0
- package/es/graph/enums.js +129 -0
- package/es/graph/enums.js.map +1 -0
- package/es/graph/glyph-element.d.ts +53 -0
- package/es/graph/glyph-element.js +206 -0
- package/es/graph/glyph-element.js.map +1 -0
- package/es/graph/index.d.ts +3 -0
- package/es/graph/index.js +6 -0
- package/es/graph/index.js.map +1 -0
- package/es/graph/layout/grid.d.ts +3 -0
- package/es/graph/layout/grid.js +66 -0
- package/es/graph/layout/grid.js.map +1 -0
- package/es/graph/layout/layout.d.ts +3 -0
- package/es/graph/layout/layout.js +33 -0
- package/es/graph/layout/layout.js.map +1 -0
- package/es/graph/layout/relative.d.ts +3 -0
- package/es/graph/layout/relative.js +85 -0
- package/es/graph/layout/relative.js.map +1 -0
- package/es/graph/mark/differ.d.ts +20 -0
- package/es/graph/mark/differ.js +104 -0
- package/es/graph/mark/differ.js.map +1 -0
- package/es/graph/mark/encode.d.ts +10 -0
- package/es/graph/mark/encode.js +92 -0
- package/es/graph/mark/encode.js.map +1 -0
- package/es/graph/mark/large-rects.d.ts +10 -0
- package/es/graph/mark/large-rects.js +23 -0
- package/es/graph/mark/large-rects.js.map +1 -0
- package/es/graph/mark/large-symbols.d.ts +11 -0
- package/es/graph/mark/large-symbols.js +27 -0
- package/es/graph/mark/large-symbols.js.map +1 -0
- package/es/graph/mark-tree.d.ts +2 -0
- package/es/graph/mark-tree.js +15 -0
- package/es/graph/mark-tree.js.map +1 -0
- package/es/graph/util/element.d.ts +2 -0
- package/es/graph/util/element.js +8 -0
- package/es/graph/util/element.js.map +1 -0
- package/es/graph/util/env.d.ts +2 -0
- package/es/graph/util/env.js +6 -0
- package/es/graph/util/env.js.map +1 -0
- package/es/graph/util/events-extend.d.ts +5 -0
- package/es/graph/util/events-extend.js +12 -0
- package/es/graph/util/events-extend.js.map +1 -0
- package/es/graph/util/graphic.d.ts +9 -0
- package/es/graph/util/graphic.js +59 -0
- package/es/graph/util/graphic.js.map +1 -0
- package/es/graph/util/point.d.ts +1 -0
- package/es/graph/util/point.js +67 -0
- package/es/graph/util/point.js.map +1 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +27 -0
- package/es/index.js.map +1 -0
- package/es/parse/coordinate.d.ts +7 -0
- package/es/parse/coordinate.js +65 -0
- package/es/parse/coordinate.js.map +1 -0
- package/es/parse/event.d.ts +8 -0
- package/es/parse/event.js +23 -0
- package/es/parse/event.js.map +1 -0
- package/es/parse/mark.d.ts +4 -0
- package/es/parse/mark.js +19 -0
- package/es/parse/mark.js.map +1 -0
- package/es/parse/option.d.ts +3 -0
- package/es/parse/option.js +10 -0
- package/es/parse/option.js.map +1 -0
- package/es/parse/scale.d.ts +8 -0
- package/es/parse/scale.js +347 -0
- package/es/parse/scale.js.map +1 -0
- package/es/parse/transform.d.ts +5 -0
- package/es/parse/transform.js +102 -0
- package/es/parse/transform.js.map +1 -0
- package/es/parse/util.d.ts +13 -0
- package/es/parse/util.js +65 -0
- package/es/parse/util.js.map +1 -0
- package/es/parse/view.d.ts +17 -0
- package/es/parse/view.js +98 -0
- package/es/parse/view.js.map +1 -0
- package/es/semantic-marks/cell.d.ts +13 -0
- package/es/semantic-marks/cell.js +57 -0
- package/es/semantic-marks/cell.js.map +1 -0
- package/es/semantic-marks/interval.d.ts +14 -0
- package/es/semantic-marks/interval.js +87 -0
- package/es/semantic-marks/interval.js.map +1 -0
- package/es/semantic-marks/text.d.ts +10 -0
- package/es/semantic-marks/text.js +22 -0
- package/es/semantic-marks/text.js.map +1 -0
- package/es/theme/common/component.d.ts +15 -0
- package/es/theme/common/component.js +510 -0
- package/es/theme/common/component.js.map +1 -0
- package/es/theme/common/constants.d.ts +1 -0
- package/es/theme/common/constants.js +2 -0
- package/es/theme/common/constants.js.map +1 -0
- package/es/theme/common/mark.d.ts +2 -0
- package/es/theme/common/mark.js +11 -0
- package/es/theme/common/mark.js.map +1 -0
- package/es/theme/dark.d.ts +2 -0
- package/es/theme/dark.js +96 -0
- package/es/theme/dark.js.map +1 -0
- package/es/theme/default.d.ts +2 -0
- package/es/theme/default.js +16 -0
- package/es/theme/default.js.map +1 -0
- package/es/theme/theme-manager.d.ts +8 -0
- package/es/theme/theme-manager.js +22 -0
- package/es/theme/theme-manager.js.map +1 -0
- package/es/transforms/data/bin.d.ts +2 -0
- package/es/transforms/data/bin.js +16 -0
- package/es/transforms/data/bin.js.map +1 -0
- package/es/transforms/data/circular-relation.d.ts +2 -0
- package/es/transforms/data/circular-relation.js +44 -0
- package/es/transforms/data/circular-relation.js.map +1 -0
- package/es/transforms/data/contour.d.ts +2 -0
- package/es/transforms/data/contour.js +111 -0
- package/es/transforms/data/contour.js.map +1 -0
- package/es/transforms/data/filter.d.ts +2 -0
- package/es/transforms/data/filter.js +2 -0
- package/es/transforms/data/filter.js.map +1 -0
- package/es/transforms/data/fold.d.ts +2 -0
- package/es/transforms/data/fold.js +16 -0
- package/es/transforms/data/fold.js.map +1 -0
- package/es/transforms/data/funnel.d.ts +2 -0
- package/es/transforms/data/funnel.js +17 -0
- package/es/transforms/data/funnel.js.map +1 -0
- package/es/transforms/data/join.d.ts +2 -0
- package/es/transforms/data/join.js +26 -0
- package/es/transforms/data/join.js.map +1 -0
- package/es/transforms/data/kde.d.ts +2 -0
- package/es/transforms/data/kde.js +80 -0
- package/es/transforms/data/kde.js.map +1 -0
- package/es/transforms/data/map.d.ts +2 -0
- package/es/transforms/data/map.js +16 -0
- package/es/transforms/data/map.js.map +1 -0
- package/es/transforms/data/pick.d.ts +2 -0
- package/es/transforms/data/pick.js +15 -0
- package/es/transforms/data/pick.js.map +1 -0
- package/es/transforms/data/pie.d.ts +2 -0
- package/es/transforms/data/pie.js +18 -0
- package/es/transforms/data/pie.js.map +1 -0
- package/es/transforms/data/range.d.ts +4 -0
- package/es/transforms/data/range.js +9 -0
- package/es/transforms/data/range.js.map +1 -0
- package/es/transforms/data/sort.d.ts +2 -0
- package/es/transforms/data/sort.js +13 -0
- package/es/transforms/data/sort.js.map +1 -0
- package/es/transforms/data/stack.d.ts +2 -0
- package/es/transforms/data/stack.js +72 -0
- package/es/transforms/data/stack.js.map +1 -0
- package/es/transforms/data/unfold.d.ts +2 -0
- package/es/transforms/data/unfold.js +45 -0
- package/es/transforms/data/unfold.js.map +1 -0
- package/es/transforms/index.d.ts +23 -0
- package/es/transforms/index.js +205 -0
- package/es/transforms/index.js.map +1 -0
- package/es/transforms/mark/dodge.d.ts +2 -0
- package/es/transforms/mark/dodge.js +74 -0
- package/es/transforms/mark/dodge.js.map +1 -0
- package/es/transforms/mark/jitter.d.ts +4 -0
- package/es/transforms/mark/jitter.js +48 -0
- package/es/transforms/mark/jitter.js.map +1 -0
- package/es/transforms/mark/lttb-sample.d.ts +2 -0
- package/es/transforms/mark/lttb-sample.js +60 -0
- package/es/transforms/mark/lttb-sample.js.map +1 -0
- package/es/transforms/mark/mark-overlap.d.ts +2 -0
- package/es/transforms/mark/mark-overlap.js +71 -0
- package/es/transforms/mark/mark-overlap.js.map +1 -0
- package/es/transforms/mark/symmetry.d.ts +2 -0
- package/es/transforms/mark/symmetry.js +20 -0
- package/es/transforms/mark/symmetry.js.map +1 -0
- package/es/transforms/util/util.d.ts +5 -0
- package/es/transforms/util/util.js +33 -0
- package/es/transforms/util/util.js.map +1 -0
- package/es/transforms/view/identifier.d.ts +2 -0
- package/es/transforms/view/identifier.js +13 -0
- package/es/transforms/view/identifier.js.map +1 -0
- package/es/types/animate.d.ts +224 -0
- package/es/types/animate.js +2 -0
- package/es/types/animate.js.map +1 -0
- package/es/types/base.d.ts +36 -0
- package/es/types/base.js +2 -0
- package/es/types/base.js.map +1 -0
- package/es/types/component.d.ts +240 -0
- package/es/types/component.js +2 -0
- package/es/types/component.js.map +1 -0
- package/es/types/coordinate.d.ts +15 -0
- package/es/types/coordinate.js +2 -0
- package/es/types/coordinate.js.map +1 -0
- package/es/types/data.d.ts +55 -0
- package/es/types/data.js +1 -0
- package/es/types/data.js.map +1 -0
- package/es/types/dataflow.d.ts +13 -0
- package/es/types/dataflow.js +2 -0
- package/es/types/dataflow.js.map +1 -0
- package/es/types/element.d.ts +117 -0
- package/es/types/element.js +2 -0
- package/es/types/element.js.map +1 -0
- package/es/types/event.d.ts +58 -0
- package/es/types/event.js +2 -0
- package/es/types/event.js.map +1 -0
- package/es/types/glyph.d.ts +29 -0
- package/es/types/glyph.js +2 -0
- package/es/types/glyph.js.map +1 -0
- package/es/types/grammar.d.ts +184 -0
- package/es/types/grammar.js +2 -0
- package/es/types/grammar.js.map +1 -0
- package/es/types/hooks.d.ts +45 -0
- package/es/types/hooks.js +2 -0
- package/es/types/hooks.js.map +1 -0
- package/es/types/index.d.ts +22 -0
- package/es/types/index.js +44 -0
- package/es/types/index.js.map +1 -0
- package/es/types/layout.d.ts +5 -0
- package/es/types/layout.js +2 -0
- package/es/types/layout.js.map +1 -0
- package/es/types/mark.d.ts +344 -0
- package/es/types/mark.js +2 -0
- package/es/types/mark.js.map +1 -0
- package/es/types/morph.d.ts +29 -0
- package/es/types/morph.js +2 -0
- package/es/types/morph.js.map +1 -0
- package/es/types/plot.d.ts +326 -0
- package/es/types/plot.js +2 -0
- package/es/types/plot.js.map +1 -0
- package/es/types/projection.d.ts +61 -0
- package/es/types/projection.js +2 -0
- package/es/types/projection.js.map +1 -0
- package/es/types/renderer.d.ts +19 -0
- package/es/types/renderer.js +2 -0
- package/es/types/renderer.js.map +1 -0
- package/es/types/scale.d.ts +111 -0
- package/es/types/scale.js +2 -0
- package/es/types/scale.js.map +1 -0
- package/es/types/signal.d.ts +20 -0
- package/es/types/signal.js +2 -0
- package/es/types/signal.js.map +1 -0
- package/es/types/theme.d.ts +41 -0
- package/es/types/theme.js +2 -0
- package/es/types/theme.js.map +1 -0
- package/es/types/transform.d.ts +291 -0
- package/es/types/transform.js +2 -0
- package/es/types/transform.js.map +1 -0
- package/es/types/view.d.ts +217 -0
- package/es/types/view.js +2 -0
- package/es/types/view.js.map +1 -0
- package/es/util/data.d.ts +3 -0
- package/es/util/data.js +60 -0
- package/es/util/data.js.map +1 -0
- package/es/util/grammar-heap.d.ts +14 -0
- package/es/util/grammar-heap.js +58 -0
- package/es/util/grammar-heap.js.map +1 -0
- package/es/util/text.d.ts +19 -0
- package/es/util/text.js +25 -0
- package/es/util/text.js.map +1 -0
- package/es/util/unique-list.d.ts +12 -0
- package/es/util/unique-list.js +29 -0
- package/es/util/unique-list.js.map +1 -0
- package/es/view/View.d.ts +157 -0
- package/es/view/View.js +836 -0
- package/es/view/View.js.map +1 -0
- package/es/view/animate.d.ts +20 -0
- package/es/view/animate.js +98 -0
- package/es/view/animate.js.map +1 -0
- package/es/view/component.d.ts +26 -0
- package/es/view/component.js +64 -0
- package/es/view/component.js.map +1 -0
- package/es/view/constants.d.ts +17 -0
- package/es/view/constants.js +32 -0
- package/es/view/constants.js.map +1 -0
- package/es/view/coordinate.d.ts +23 -0
- package/es/view/coordinate.js +52 -0
- package/es/view/coordinate.js.map +1 -0
- package/es/view/data.d.ts +37 -0
- package/es/view/data.js +195 -0
- package/es/view/data.js.map +1 -0
- package/es/view/dataflow.d.ts +32 -0
- package/es/view/dataflow.js +141 -0
- package/es/view/dataflow.js.map +1 -0
- package/es/view/events.d.ts +4 -0
- package/es/view/events.js +26 -0
- package/es/view/events.js.map +1 -0
- package/es/view/glyph-meta.d.ts +29 -0
- package/es/view/glyph-meta.js +37 -0
- package/es/view/glyph-meta.js.map +1 -0
- package/es/view/glyph.d.ts +14 -0
- package/es/view/glyph.js +27 -0
- package/es/view/glyph.js.map +1 -0
- package/es/view/grammar-base.d.ts +46 -0
- package/es/view/grammar-base.js +165 -0
- package/es/view/grammar-base.js.map +1 -0
- package/es/view/grammar-record.d.ts +39 -0
- package/es/view/grammar-record.js +170 -0
- package/es/view/grammar-record.js.map +1 -0
- package/es/view/group.d.ts +13 -0
- package/es/view/group.js +39 -0
- package/es/view/group.js.map +1 -0
- package/es/view/index.d.ts +1 -0
- package/es/view/index.js +2 -0
- package/es/view/index.js.map +1 -0
- package/es/view/mark.d.ts +112 -0
- package/es/view/mark.js +604 -0
- package/es/view/mark.js.map +1 -0
- package/es/view/scale.d.ts +26 -0
- package/es/view/scale.js +82 -0
- package/es/view/scale.js.map +1 -0
- package/es/view/signal.d.ts +18 -0
- package/es/view/signal.js +52 -0
- package/es/view/signal.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.registerScrollbar = exports.Scrollbar = exports.generateScrollbarAttributes = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), graph_1 = require("../graph"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), factory_1 = require("../core/factory"), scale_1 = require("./scale");
|
|
8
|
+
|
|
9
|
+
function isValidDirection(direction) {
|
|
10
|
+
return "vertical" === direction || "horizontal" === direction;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function isValidPosition(position) {
|
|
14
|
+
return "top" === position || "bottom" === position || "left" === position || "right" === position;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function isHorizontalPosition(position) {
|
|
18
|
+
return "top" === position || "bottom" === position;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const generateScrollbarAttributes = (groupSize, direction, position, theme, addition) => {
|
|
22
|
+
var _a, _b, _c, _d, _e;
|
|
23
|
+
const scrollbarTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.scrollbar;
|
|
24
|
+
let finalDirection = "horizontal", finalPosition = "bottom";
|
|
25
|
+
isValidDirection(direction) || isValidPosition(position) ? !isValidDirection(direction) && isValidPosition(position) ? (finalDirection = isHorizontalPosition(position) ? "horizontal" : "vertical",
|
|
26
|
+
finalPosition = position) : isValidDirection(direction) && !isValidPosition(position) ? (finalDirection = direction,
|
|
27
|
+
finalPosition = "horizontal" === direction ? "bottom" : "right") : (finalDirection = direction,
|
|
28
|
+
finalPosition = "horizontal" !== direction || isHorizontalPosition(position) ? "vertical" === direction && isHorizontalPosition(position) ? "right" : position : "bottom") : (finalDirection = "horizontal",
|
|
29
|
+
finalPosition = "bottom");
|
|
30
|
+
const attributes = {
|
|
31
|
+
direction: finalDirection
|
|
32
|
+
};
|
|
33
|
+
if ("horizontal" === finalDirection) {
|
|
34
|
+
const size = null !== (_c = null !== (_b = addition.height) && void 0 !== _b ? _b : null == scrollbarTheme ? void 0 : scrollbarTheme.height) && void 0 !== _c ? _c : 12;
|
|
35
|
+
"top" === finalPosition ? Object.assign(attributes, {
|
|
36
|
+
width: groupSize.width,
|
|
37
|
+
height: size,
|
|
38
|
+
x: 0,
|
|
39
|
+
y: 0
|
|
40
|
+
}) : Object.assign(attributes, {
|
|
41
|
+
width: groupSize.width,
|
|
42
|
+
height: size,
|
|
43
|
+
x: 0,
|
|
44
|
+
y: groupSize.height - size
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
const size = null !== (_e = null !== (_d = addition.width) && void 0 !== _d ? _d : null == scrollbarTheme ? void 0 : scrollbarTheme.width) && void 0 !== _e ? _e : 12;
|
|
48
|
+
"left" === finalPosition ? Object.assign(attributes, {
|
|
49
|
+
width: size,
|
|
50
|
+
height: groupSize.height,
|
|
51
|
+
x: 0,
|
|
52
|
+
y: 0
|
|
53
|
+
}) : Object.assign(attributes, {
|
|
54
|
+
width: size,
|
|
55
|
+
height: groupSize.height,
|
|
56
|
+
x: groupSize.width - size,
|
|
57
|
+
y: 0
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return (0, vutils_1.merge)({}, scrollbarTheme, attributes, null != addition ? addition : {});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.generateScrollbarAttributes = generateScrollbarAttributes;
|
|
64
|
+
|
|
65
|
+
class Scrollbar extends scale_1.ScaleComponent {
|
|
66
|
+
constructor(view, group) {
|
|
67
|
+
super(view, graph_1.ComponentEnum.scrollbar, group), this.spec.componentType = graph_1.ComponentEnum.scrollbar;
|
|
68
|
+
}
|
|
69
|
+
parseAddition(spec) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
return super.parseAddition(spec), this.target(null === (_a = spec.target) || void 0 === _a ? void 0 : _a.data, null === (_b = spec.target) || void 0 === _b ? void 0 : _b.filter),
|
|
72
|
+
this.container(spec.container), this.direction(spec.direction), this.position(spec.position),
|
|
73
|
+
this;
|
|
74
|
+
}
|
|
75
|
+
target(data, filter) {
|
|
76
|
+
var _a;
|
|
77
|
+
const lastData = null === (_a = this.spec.target) || void 0 === _a ? void 0 : _a.data, lastDataGrammar = (0,
|
|
78
|
+
vutils_1.isString)(lastData) ? this.view.getDataById(lastData) : lastData;
|
|
79
|
+
lastDataGrammar && this.view.removeEventListener("scroll", this._filterCallback),
|
|
80
|
+
this.spec.target = void 0;
|
|
81
|
+
const dataGrammar = (0, vutils_1.isString)(data) ? this.view.getDataById(data) : data, dataFilter = (0,
|
|
82
|
+
vutils_1.isString)(filter) ? (datum, filterValue) => {
|
|
83
|
+
const scale = ((0, vutils_1.isString)(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale).getScale(), range = scale.range(), datumRatio = (scale.scale(datum[filter]) - range[0]) / (range[range.length - 1] - range[0]);
|
|
84
|
+
return filterValue.startRatio <= datumRatio && filterValue.endRatio >= datumRatio;
|
|
85
|
+
} : filter;
|
|
86
|
+
return this._filterData(lastDataGrammar, dataGrammar, graph_1.ComponentDataRank.scrollbar, (event => {
|
|
87
|
+
if ((0, vutils_1.isString)(filter)) {
|
|
88
|
+
const range = event.detail.value, scaleGrammar = (0, vutils_1.isString)(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;
|
|
89
|
+
if (scaleGrammar) {
|
|
90
|
+
const scale = scaleGrammar.getScale(), scaleRange = scale.range();
|
|
91
|
+
return {
|
|
92
|
+
start: scale.invert(range[0] * (scaleRange[1] - scaleRange[0]) + scaleRange[0]),
|
|
93
|
+
end: scale.invert(range[1] * (scaleRange[1] - scaleRange[0]) + scaleRange[0]),
|
|
94
|
+
startRatio: range[0],
|
|
95
|
+
endRatio: range[1]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
startRatio: range[0],
|
|
100
|
+
endRatio: range[1]
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
startRatio: event.detail.value[0],
|
|
105
|
+
endRatio: event.detail.value[1]
|
|
106
|
+
};
|
|
107
|
+
}), dataFilter), dataGrammar && (this.view.addEventListener("scroll", this._filterCallback),
|
|
108
|
+
this.spec.target = {
|
|
109
|
+
data: dataGrammar,
|
|
110
|
+
filter: filter
|
|
111
|
+
}), this;
|
|
112
|
+
}
|
|
113
|
+
container(container) {
|
|
114
|
+
if (this.spec.container) {
|
|
115
|
+
const prevContainer = (0, vutils_1.isString)(this.spec.container) ? this.view.getMarkById(this.spec.container) : this.spec.container;
|
|
116
|
+
this.detach(prevContainer);
|
|
117
|
+
}
|
|
118
|
+
if (this.spec.container = container, container) {
|
|
119
|
+
const nextContainer = (0, vutils_1.isString)(container) ? this.view.getMarkById(container) : container;
|
|
120
|
+
this.attach(nextContainer);
|
|
121
|
+
}
|
|
122
|
+
return this.commit(), this;
|
|
123
|
+
}
|
|
124
|
+
direction(direction) {
|
|
125
|
+
return this.setFunctionSpec(direction, "direction");
|
|
126
|
+
}
|
|
127
|
+
position(position) {
|
|
128
|
+
return this.setFunctionSpec(position, "position");
|
|
129
|
+
}
|
|
130
|
+
setScrollStart(start) {
|
|
131
|
+
var _a, _b, _c;
|
|
132
|
+
const scrollbar = null === (_b = null === (_a = this.elements[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a), range = null === (_c = null == scrollbar ? void 0 : scrollbar.attribute) || void 0 === _c ? void 0 : _c.range;
|
|
133
|
+
if (scrollbar && range) {
|
|
134
|
+
const nextRange = [ start, range[1] - range[0] + start ];
|
|
135
|
+
scrollbar.setScrollRange(nextRange);
|
|
136
|
+
}
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
addGraphicItem(attrs, groupKey) {
|
|
140
|
+
const initialAttributes = (0, vutils_1.merge)({
|
|
141
|
+
range: [ 0, 1 ]
|
|
142
|
+
}, attrs), graphicItem = factory_1.Factory.createGraphicComponent(graph_1.ComponentEnum.scrollbar, initialAttributes), range = initialAttributes.range;
|
|
143
|
+
return range && this._filterCallback && setTimeout((() => this._filterCallback({
|
|
144
|
+
detail: {
|
|
145
|
+
value: range
|
|
146
|
+
}
|
|
147
|
+
}, this.elements[0]))), super.addGraphicItem(initialAttributes, groupKey, graphicItem);
|
|
148
|
+
}
|
|
149
|
+
release() {
|
|
150
|
+
this._filterCallback && this.view.removeEventListener("scroll", this._filterCallback),
|
|
151
|
+
super.release();
|
|
152
|
+
}
|
|
153
|
+
_updateComponentEncoders() {
|
|
154
|
+
const encoders = Object.assign({
|
|
155
|
+
update: {}
|
|
156
|
+
}, this.spec.encode), componentEncoders = Object.keys(encoders).reduce(((res, state) => {
|
|
157
|
+
const encoder = encoders[state];
|
|
158
|
+
return encoder && (res[state] = {
|
|
159
|
+
callback: (datum, element, parameters) => {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
const theme = this.view.getCurrentTheme(), direction = (0, util_1.invokeFunctionType)(this.spec.direction, parameters, datum, element), position = (0,
|
|
162
|
+
util_1.invokeFunctionType)(this.spec.position, parameters, datum, element), addition = (0,
|
|
163
|
+
encode_1.invokeEncoder)(encoder, datum, element, parameters), targetMark = this.spec.container ? (0,
|
|
164
|
+
vutils_1.isString)(this.spec.container) ? this.view.getMarkById(this.spec.container) : this.spec.container : null, groupGraphicItem = (targetMark && targetMark.markType === graph_1.GrammarMarkType.group ? targetMark : this.group).getGroupGraphicItem(), size = groupGraphicItem ? {
|
|
165
|
+
width: null !== (_a = groupGraphicItem.attribute.width) && void 0 !== _a ? _a : groupGraphicItem.AABBBounds.width(),
|
|
166
|
+
height: null !== (_b = groupGraphicItem.attribute.height) && void 0 !== _b ? _b : groupGraphicItem.AABBBounds.height()
|
|
167
|
+
} : {
|
|
168
|
+
width: this.view.width(),
|
|
169
|
+
height: this.view.height()
|
|
170
|
+
};
|
|
171
|
+
return (0, exports.generateScrollbarAttributes)(size, direction, position, theme, addition);
|
|
172
|
+
}
|
|
173
|
+
}), res;
|
|
174
|
+
}), {});
|
|
175
|
+
this._encoders = componentEncoders;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
exports.Scrollbar = Scrollbar, Scrollbar.componentType = graph_1.ComponentEnum.scrollbar;
|
|
180
|
+
|
|
181
|
+
const registerScrollbar = () => {
|
|
182
|
+
factory_1.Factory.registerGraphicComponent(graph_1.ComponentEnum.scrollbar, (attrs => new vrender_components_1.ScrollBar(attrs))),
|
|
183
|
+
factory_1.Factory.registerComponent(graph_1.ComponentEnum.scrollbar, Scrollbar);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
exports.registerScrollbar = registerScrollbar;
|
|
187
|
+
//# sourceMappingURL=scrollbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/component/scrollbar.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AAInD,qEAA+E;AAa/E,oCAA6E;AAE7E,iDAAqD;AACrD,wCAAmD;AACnD,6CAA0C;AAC1C,mCAAyC;AAEzC,SAAS,gBAAgB,CAAC,SAAoB;IAC5C,OAAO,SAAS,KAAK,UAAU,IAAI,SAAS,KAAK,YAAY,CAAC;AAChE,CAAC;AAED,SAAS,eAAe,CAAC,QAAoB;IAC3C,OAAO,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,OAAO,CAAC;AACpG,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAoB;IAChD,OAAO,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,QAAQ,CAAC;AACrD,CAAC;AAEM,MAAM,2BAA2B,GAAG,CACzC,SAA4C,EAC5C,SAAqB,EACrB,QAAqB,EACrB,KAAc,EACd,QAAgD,EAC3B,EAAE;;IACvB,MAAM,cAAc,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CA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;gCAC9E,MAAM,EAAE,MAAA,gBAAgB,CAAC,SAAS,CAAC,MAAM,mCAAI,gBAAgB,CAAC,UAAU,CAAC,MAAM,EAAE;6BAClF;4BACH,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;wBAC7D,OAAO,IAAA,mCAA2B,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBACjF,CAAC;iBACF,CAAC;aACH;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;IACrC,CAAC;;AA9IH,8BA+IC;AA9IiB,uBAAa,GAAW,qBAAa,CAAC,SAAS,CAAC;AAgJ3D,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,iBAAO,CAAC,wBAAwB,CAC9B,qBAAa,CAAC,SAAS,EACvB,CAAC,KAA0B,EAAE,EAAE,CAAC,IAAI,8BAAkB,CAAC,KAAK,CAAwB,CACrF,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAChE,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B","file":"scrollbar.js","sourcesContent":["import { isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender';\nimport type { Direction, OrientType, ScrollBarAttributes } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { ScrollBar as ScrollbarComponent } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IData,\n IElement,\n IGroupMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n RecursivePartial,\n StateEncodeSpec\n} from '../types';\nimport { ComponentDataRank, ComponentEnum, GrammarMarkType } from '../graph';\nimport type { IScrollbar, ScrollbarFilterValue, ScrollbarSpec } from '../types/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\nimport { ScaleComponent } from './scale';\n\nfunction isValidDirection(direction: Direction) {\n return direction === 'vertical' || direction === 'horizontal';\n}\n\nfunction isValidPosition(position: OrientType) {\n return position === 'top' || position === 'bottom' || position === 'left' || position === 'right';\n}\n\nfunction isHorizontalPosition(position: OrientType) {\n return position === 'top' || position === 'bottom';\n}\n\nexport const generateScrollbarAttributes = (\n groupSize: { width: number; height: number },\n direction?: Direction,\n position?: OrientType,\n theme?: ITheme,\n addition?: RecursivePartial<ScrollBarAttributes>\n): ScrollBarAttributes => {\n const scrollbarTheme = theme?.components?.scrollbar;\n\n let finalDirection: Direction = 'horizontal';\n let finalPosition: OrientType = 'bottom';\n if (!isValidDirection(direction) && !isValidPosition(position)) {\n finalDirection = 'horizontal';\n finalPosition = 'bottom';\n } else if (!isValidDirection(direction) && isValidPosition(position)) {\n finalDirection = isHorizontalPosition(position) ? 'horizontal' : 'vertical';\n finalPosition = position;\n } else if (isValidDirection(direction) && !isValidPosition(position)) {\n finalDirection = direction;\n finalPosition = direction === 'horizontal' ? 'bottom' : 'right';\n } else {\n finalDirection = direction;\n finalPosition =\n direction === 'horizontal' && !isHorizontalPosition(position)\n ? 'bottom'\n : direction === 'vertical' && isHorizontalPosition(position)\n ? 'right'\n : position;\n }\n\n const attributes: RecursivePartial<ScrollBarAttributes> = { direction: finalDirection };\n if (finalDirection === 'horizontal') {\n const size = addition.height ?? scrollbarTheme?.height ?? 12;\n\n // top or bottom\n if (finalPosition === 'top') {\n Object.assign(attributes, {\n width: groupSize.width,\n height: size,\n x: 0,\n y: 0\n });\n } else {\n Object.assign(attributes, {\n width: groupSize.width,\n height: size,\n x: 0,\n y: groupSize.height - size\n });\n }\n } else {\n const size = addition.width ?? scrollbarTheme?.width ?? 12;\n\n // left or right\n if (finalPosition === 'left') {\n Object.assign(attributes, {\n width: size,\n height: groupSize.height,\n x: 0,\n y: 0\n });\n } else {\n Object.assign(attributes, {\n width: size,\n height: groupSize.height,\n x: groupSize.width - size,\n y: 0\n });\n }\n }\n\n return merge({}, scrollbarTheme, attributes, addition ?? {});\n};\n\nexport class Scrollbar extends ScaleComponent implements IScrollbar {\n static readonly componentType: string = ComponentEnum.scrollbar;\n protected declare spec: ScrollbarSpec;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.scrollbar, group);\n this.spec.componentType = ComponentEnum.scrollbar;\n }\n\n protected parseAddition(spec: ScrollbarSpec) {\n super.parseAddition(spec);\n this.target(spec.target?.data, spec.target?.filter);\n this.container(spec.container);\n this.direction(spec.direction);\n this.position(spec.position);\n return this;\n }\n\n target(data: IData | string | Nil, filter: string | ((datum: any, value: ScrollbarFilterValue) => boolean) | Nil) {\n const lastData = this.spec.target?.data;\n const lastDataGrammar = isString(lastData) ? this.view.getDataById(lastData) : lastData;\n if (lastDataGrammar) {\n this.view.removeEventListener('scroll', this._filterCallback);\n }\n this.spec.target = undefined;\n const dataGrammar = isString(data) ? this.view.getDataById(data) : data;\n const getFilterValue = (event: any) => {\n if (isString(filter)) {\n const range = event.detail.value;\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n if (scaleGrammar) {\n const scale = scaleGrammar.getScale();\n const scaleRange = scale.range();\n const start = scale.invert(range[0] * (scaleRange[1] - scaleRange[0]) + scaleRange[0]);\n const end = scale.invert(range[1] * (scaleRange[1] - scaleRange[0]) + scaleRange[0]);\n return { start, end, startRatio: range[0], endRatio: range[1] };\n }\n return { startRatio: range[0], endRatio: range[1] };\n }\n return { startRatio: event.detail.value[0], endRatio: event.detail.value[1] };\n };\n const dataFilter = isString(filter)\n ? (datum: any, filterValue: ScrollbarFilterValue) => {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const scale = scaleGrammar.getScale();\n const range = scale.range();\n const datumRatio = (scale.scale(datum[filter]) - range[0]) / (range[range.length - 1] - range[0]);\n return filterValue.startRatio <= datumRatio && filterValue.endRatio >= datumRatio;\n }\n : filter;\n this._filterData(lastDataGrammar, dataGrammar, ComponentDataRank.scrollbar, getFilterValue, dataFilter);\n if (dataGrammar) {\n this.view.addEventListener('scroll', this._filterCallback);\n this.spec.target = { data: dataGrammar, filter };\n }\n return this;\n }\n\n container(container: IGroupMark | string | Nil): this {\n if (this.spec.container) {\n const prevContainer = isString(this.spec.container)\n ? this.view.getMarkById(this.spec.container)\n : this.spec.container;\n this.detach(prevContainer);\n }\n this.spec.container = container;\n if (container) {\n const nextContainer = isString(container) ? this.view.getMarkById(container) : container;\n this.attach(nextContainer);\n }\n this.commit();\n return this;\n }\n\n direction(direction: MarkFunctionType<Direction> | Nil) {\n return this.setFunctionSpec(direction, 'direction');\n }\n\n position(position: MarkFunctionType<OrientType> | Nil) {\n return this.setFunctionSpec(position, 'position');\n }\n\n setScrollStart(start: number) {\n const scrollbar = this.elements[0]?.getGraphicItem?.() as unknown as ScrollbarComponent;\n const range = scrollbar?.attribute?.range;\n if (scrollbar && range) {\n const nextRange: [number, number] = [start, range[1] - range[0] + start];\n scrollbar.setScrollRange(nextRange);\n }\n return this;\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const defaultAttributes = { range: [0, 1] };\n const initialAttributes = merge(defaultAttributes, attrs);\n const graphicItem = Factory.createGraphicComponent(ComponentEnum.scrollbar, initialAttributes);\n const range = initialAttributes.range;\n // Hack for the first evaluation, waiting for components to fix\n if (range && this._filterCallback) {\n setTimeout(() => this._filterCallback({ detail: { value: range } }, this.elements[0]));\n }\n return super.addGraphicItem(initialAttributes, groupKey, graphicItem);\n }\n\n release() {\n if (this._filterCallback) {\n this.view.removeEventListener('scroll', this._filterCallback);\n }\n super.release();\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.view.getCurrentTheme();\n const direction = invokeFunctionType(this.spec.direction, parameters, datum, element);\n const position = invokeFunctionType(this.spec.position, parameters, datum, element);\n const addition = invokeEncoder(encoder as BaseSignleEncodeSpec, datum, element, parameters);\n const targetMark = this.spec.container\n ? isString(this.spec.container)\n ? this.view.getMarkById(this.spec.container)\n : this.spec.container\n : null;\n const groupMark = targetMark && targetMark.markType === GrammarMarkType.group ? targetMark : this.group;\n const groupGraphicItem = groupMark.getGroupGraphicItem();\n const size = groupGraphicItem\n ? {\n width: groupGraphicItem.attribute.width ?? groupGraphicItem.AABBBounds.width(),\n height: groupGraphicItem.attribute.height ?? groupGraphicItem.AABBBounds.height()\n }\n : { width: this.view.width(), height: this.view.height() };\n return generateScrollbarAttributes(size, direction, position, theme, addition);\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerScrollbar = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.scrollbar,\n (attrs: ScrollBarAttributes) => new ScrollbarComponent(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.scrollbar, Scrollbar);\n};\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SliderAttributes } from '@visactor/vrender-components';
|
|
2
|
+
import type { IData, IGroupMark, ITheme, IView, MarkFunctionType, Nil, RecursivePartial } from '../types';
|
|
3
|
+
import type { ISlider, SliderFilterValue, SliderSpec } from '../types/component';
|
|
4
|
+
import { Component } from '../view/component';
|
|
5
|
+
export declare const generateSliderAttributes: (min: number, max: number, theme?: ITheme, addition?: RecursivePartial<SliderAttributes>) => SliderAttributes;
|
|
6
|
+
export declare class Slider extends Component implements ISlider {
|
|
7
|
+
static readonly componentType: string;
|
|
8
|
+
protected spec: SliderSpec;
|
|
9
|
+
protected _filterValue: SliderFilterValue;
|
|
10
|
+
constructor(view: IView, group?: IGroupMark);
|
|
11
|
+
protected parseAddition(spec: SliderSpec): this;
|
|
12
|
+
min(min: MarkFunctionType<number> | Nil): this;
|
|
13
|
+
max(max: MarkFunctionType<number> | Nil): this;
|
|
14
|
+
target(data: IData | string | Nil, filter: string | ((datum: any, value: SliderFilterValue) => boolean) | Nil): this;
|
|
15
|
+
setStartEndValue(start?: number, end?: number): this;
|
|
16
|
+
release(): void;
|
|
17
|
+
protected _updateComponentEncoders(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare const registerSlider: () => void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.registerSlider = exports.Slider = exports.generateSliderAttributes = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), graph_1 = require("../graph"), component_1 = require("../view/component"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), factory_1 = require("../core/factory"), generateSliderAttributes = (min, max, theme, addition) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const sliderTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.slider;
|
|
10
|
+
return (0, vutils_1.merge)({}, sliderTheme, {
|
|
11
|
+
min: min,
|
|
12
|
+
max: max,
|
|
13
|
+
value: [ min, max ]
|
|
14
|
+
}, null != addition ? addition : {});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.generateSliderAttributes = generateSliderAttributes;
|
|
18
|
+
|
|
19
|
+
class Slider extends component_1.Component {
|
|
20
|
+
constructor(view, group) {
|
|
21
|
+
super(view, graph_1.ComponentEnum.slider, group), this.spec.componentType = graph_1.ComponentEnum.slider;
|
|
22
|
+
}
|
|
23
|
+
parseAddition(spec) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return super.parseAddition(spec), this.target(null === (_a = spec.target) || void 0 === _a ? void 0 : _a.data, null === (_b = spec.target) || void 0 === _b ? void 0 : _b.filter),
|
|
26
|
+
this.min(spec.min), this.max(spec.max), this;
|
|
27
|
+
}
|
|
28
|
+
min(min) {
|
|
29
|
+
return this.setFunctionSpec(min, "min");
|
|
30
|
+
}
|
|
31
|
+
max(max) {
|
|
32
|
+
return this.setFunctionSpec(max, "max");
|
|
33
|
+
}
|
|
34
|
+
target(data, filter) {
|
|
35
|
+
var _a;
|
|
36
|
+
const lastData = null === (_a = this.spec.target) || void 0 === _a ? void 0 : _a.data, lastDataGrammar = (0,
|
|
37
|
+
vutils_1.isString)(lastData) ? this.view.getDataById(lastData) : lastData;
|
|
38
|
+
lastDataGrammar && this.view.removeEventListener("change", this._filterCallback),
|
|
39
|
+
this.spec.target = void 0;
|
|
40
|
+
const dataGrammar = (0, vutils_1.isString)(data) ? this.view.getDataById(data) : data, dataFilter = (0,
|
|
41
|
+
vutils_1.isString)(filter) ? (datum, filterValue) => datum[filter] >= filterValue.start && datum[filter] <= filterValue.end : filter;
|
|
42
|
+
return this._filterData(lastDataGrammar, dataGrammar, graph_1.ComponentDataRank.slider, (event => ({
|
|
43
|
+
start: event.detail.value[0],
|
|
44
|
+
end: event.detail.value[1]
|
|
45
|
+
})), dataFilter), dataGrammar && (this.view.addEventListener("change", this._filterCallback),
|
|
46
|
+
this.spec.target = {
|
|
47
|
+
data: dataGrammar,
|
|
48
|
+
filter: filter
|
|
49
|
+
}), this;
|
|
50
|
+
}
|
|
51
|
+
setStartEndValue(start, end) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
return (null === (_b = null === (_a = this.elements[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a)).setValue([ start, end ]),
|
|
54
|
+
this;
|
|
55
|
+
}
|
|
56
|
+
release() {
|
|
57
|
+
this._filterCallback && this.view.removeEventListener("change", this._filterCallback),
|
|
58
|
+
super.release();
|
|
59
|
+
}
|
|
60
|
+
_updateComponentEncoders() {
|
|
61
|
+
const encoders = Object.assign({
|
|
62
|
+
update: {}
|
|
63
|
+
}, this.spec.encode), componentEncoders = Object.keys(encoders).reduce(((res, state) => {
|
|
64
|
+
const encoder = encoders[state];
|
|
65
|
+
return encoder && (res[state] = {
|
|
66
|
+
callback: (datum, element, parameters) => {
|
|
67
|
+
const min = (0, vutils_1.isNil)(this.spec.min) ? 0 : (0, util_1.invokeFunctionType)(this.spec.min, parameters, datum, element), max = (0,
|
|
68
|
+
vutils_1.isNil)(this.spec.max) ? 1 : (0, util_1.invokeFunctionType)(this.spec.max, parameters, datum, element), theme = this.view.getCurrentTheme(), addition = (0,
|
|
69
|
+
encode_1.invokeEncoder)(encoder, datum, element, parameters);
|
|
70
|
+
return (0, exports.generateSliderAttributes)(min, max, theme, addition);
|
|
71
|
+
}
|
|
72
|
+
}), res;
|
|
73
|
+
}), {});
|
|
74
|
+
this._encoders = componentEncoders;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
exports.Slider = Slider, Slider.componentType = graph_1.ComponentEnum.slider;
|
|
79
|
+
|
|
80
|
+
const registerSlider = () => {
|
|
81
|
+
factory_1.Factory.registerGraphicComponent(graph_1.ComponentEnum.slider, (attrs => new vrender_components_1.Slider(attrs))),
|
|
82
|
+
factory_1.Factory.registerComponent(graph_1.ComponentEnum.slider, Slider);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.registerSlider = registerSlider;
|
|
86
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/component/slider.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAI1D,qEAAyE;AAazE,oCAA4D;AAE5D,iDAA8C;AAC9C,iDAAqD;AACrD,wCAAmD;AACnD,6CAA0C;AAEnC,MAAM,wBAAwB,GAAG,CACtC,GAAW,EACX,GAAW,EACX,KAAc,EACd,QAA6C,EAC3B,EAAE;;IACpB,MAAM,WAAW,GA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G,CAAC,CAAC,CAAC,CAAC,IAAA,yBAAkB,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBACtG,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;wBAC1C,MAAM,QAAQ,GAAG,IAAA,sBAAa,EAAC,OAA+B,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;wBAC5F,OAAO,IAAA,gCAAwB,EAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC7D,CAAC;iBACF,CAAC;aACH;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;IACrC,CAAC;;AA9EH,wBA+EC;AA9EiB,oBAAa,GAAW,qBAAa,CAAC,MAAM,CAAC;AAgFxD,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,iBAAO,CAAC,wBAAwB,CAC9B,qBAAa,CAAC,MAAM,EACpB,CAAC,KAAuB,EAAE,EAAE,CAAC,IAAI,2BAAe,CAAC,KAAK,CAAwB,CAC/E,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB","file":"slider.js","sourcesContent":["import { isNil, isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender';\nimport type { SliderAttributes } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { Slider as SliderComponent } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IData,\n IElement,\n IGroupMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n RecursivePartial,\n StateEncodeSpec\n} from '../types';\nimport { ComponentDataRank, ComponentEnum } from '../graph';\nimport type { ISlider, SliderFilterValue, SliderSpec } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\n\nexport const generateSliderAttributes = (\n min: number,\n max: number,\n theme?: ITheme,\n addition?: RecursivePartial<SliderAttributes>\n): SliderAttributes => {\n const sliderTheme = theme?.components?.slider;\n return merge({}, sliderTheme, { min, max, value: [min, max] }, addition ?? {});\n};\n\nexport class Slider extends Component implements ISlider {\n static readonly componentType: string = ComponentEnum.slider;\n protected declare spec: SliderSpec;\n protected declare _filterValue: SliderFilterValue;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.slider, group);\n this.spec.componentType = ComponentEnum.slider;\n }\n\n protected parseAddition(spec: SliderSpec) {\n super.parseAddition(spec);\n this.target(spec.target?.data, spec.target?.filter);\n this.min(spec.min);\n this.max(spec.max);\n return this;\n }\n\n min(min: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(min, 'min');\n }\n\n max(max: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(max, 'max');\n }\n\n target(data: IData | string | Nil, filter: string | ((datum: any, value: SliderFilterValue) => boolean) | Nil) {\n const lastData = this.spec.target?.data;\n const lastDataGrammar = isString(lastData) ? this.view.getDataById(lastData) : lastData;\n if (lastDataGrammar) {\n this.view.removeEventListener('change', this._filterCallback);\n }\n this.spec.target = undefined;\n const dataGrammar = isString(data) ? this.view.getDataById(data) : data;\n const getFilterValue = (event: any) => ({ start: event.detail.value[0], end: event.detail.value[1] });\n const dataFilter = isString(filter)\n ? (datum: any, filterValue: SliderFilterValue) =>\n datum[filter] >= filterValue.start && datum[filter] <= filterValue.end\n : filter;\n this._filterData(lastDataGrammar, dataGrammar, ComponentDataRank.slider, getFilterValue, dataFilter);\n if (dataGrammar) {\n this.view.addEventListener('change', this._filterCallback);\n this.spec.target = { data: dataGrammar, filter };\n }\n return this;\n }\n\n setStartEndValue(start?: number, end?: number) {\n const slider = this.elements[0]?.getGraphicItem?.() as unknown as SliderComponent;\n slider.setValue([start, end]);\n return this;\n }\n\n release() {\n if (this._filterCallback) {\n this.view.removeEventListener('change', this._filterCallback);\n }\n super.release();\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const min = !isNil(this.spec.min) ? invokeFunctionType(this.spec.min, parameters, datum, element) : 0;\n const max = !isNil(this.spec.max) ? invokeFunctionType(this.spec.max, parameters, datum, element) : 1;\n const theme = this.view.getCurrentTheme();\n const addition = invokeEncoder(encoder as BaseSignleEncodeSpec, datum, element, parameters);\n return generateSliderAttributes(min, max, theme, addition);\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerSlider = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.slider,\n (attrs: SliderAttributes) => new SliderComponent(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.slider, Slider);\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TitleAttrs } from '@visactor/vrender-components';
|
|
2
|
+
import type { IGroupMark, ITheme, IView, MarkFunctionType, Nil, RecursivePartial } from '../types';
|
|
3
|
+
import type { ITitle, TitleSpec } from '../types/component';
|
|
4
|
+
import { Component } from '../view/component';
|
|
5
|
+
export declare const generateTitleAttributes: (title?: string | number | number[] | string[], subTitle?: string | number | number[] | string[], theme?: ITheme, addition?: RecursivePartial<TitleAttrs>) => TitleAttrs;
|
|
6
|
+
export declare class Title extends Component implements ITitle {
|
|
7
|
+
static readonly componentType: string;
|
|
8
|
+
protected spec: TitleSpec;
|
|
9
|
+
constructor(view: IView, group?: IGroupMark);
|
|
10
|
+
protected parseAddition(spec: TitleSpec): this;
|
|
11
|
+
title(text: MarkFunctionType<string | number | number[] | string[]> | Nil): this;
|
|
12
|
+
subTitle(text: MarkFunctionType<string | number | number[] | string[]> | Nil): this;
|
|
13
|
+
protected _updateComponentEncoders(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare const registerTitle: () => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.registerTitle = exports.Title = exports.generateTitleAttributes = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), graph_1 = require("../graph"), component_1 = require("../view/component"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), factory_1 = require("../core/factory"), generateTitleAttributes = (title, subTitle, theme, addition) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const titleTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.title, attributes = {};
|
|
10
|
+
return (0, vutils_1.isValid)(title) && (attributes.text = title), (0, vutils_1.isValid)(subTitle) && (attributes.subtext = subTitle),
|
|
11
|
+
(0, vutils_1.merge)({}, titleTheme, attributes, null != addition ? addition : {});
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.generateTitleAttributes = generateTitleAttributes;
|
|
15
|
+
|
|
16
|
+
class Title extends component_1.Component {
|
|
17
|
+
constructor(view, group) {
|
|
18
|
+
super(view, graph_1.ComponentEnum.title, group), this.spec.componentType = graph_1.ComponentEnum.title;
|
|
19
|
+
}
|
|
20
|
+
parseAddition(spec) {
|
|
21
|
+
return super.parseAddition(spec), this.title(spec.title), this.subTitle(spec.subTitle),
|
|
22
|
+
this;
|
|
23
|
+
}
|
|
24
|
+
title(text) {
|
|
25
|
+
return this.setFunctionSpec(text, "title");
|
|
26
|
+
}
|
|
27
|
+
subTitle(text) {
|
|
28
|
+
return this.setFunctionSpec(text, "subTitle");
|
|
29
|
+
}
|
|
30
|
+
_updateComponentEncoders() {
|
|
31
|
+
const encoders = Object.assign({
|
|
32
|
+
update: {}
|
|
33
|
+
}, this.spec.encode), componentEncoders = Object.keys(encoders).reduce(((res, state) => {
|
|
34
|
+
const encoder = encoders[state];
|
|
35
|
+
return encoder && (res[state] = {
|
|
36
|
+
callback: (datum, element, parameters) => {
|
|
37
|
+
const theme = this.view.getCurrentTheme(), title = (0, util_1.invokeFunctionType)(this.spec.title, parameters, datum, element), subTitle = (0,
|
|
38
|
+
util_1.invokeFunctionType)(this.spec.subTitle, parameters, datum, element), addition = (0,
|
|
39
|
+
encode_1.invokeEncoder)(encoder, datum, element, parameters);
|
|
40
|
+
return (0, exports.generateTitleAttributes)(title, subTitle, theme, addition);
|
|
41
|
+
}
|
|
42
|
+
}), res;
|
|
43
|
+
}), {});
|
|
44
|
+
this._encoders = componentEncoders;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.Title = Title, Title.componentType = graph_1.ComponentEnum.title;
|
|
49
|
+
|
|
50
|
+
const registerTitle = () => {
|
|
51
|
+
factory_1.Factory.registerGraphicComponent(graph_1.ComponentEnum.title, (attrs => new vrender_components_1.Title(attrs))),
|
|
52
|
+
factory_1.Factory.registerComponent(graph_1.ComponentEnum.title, Title);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.registerTitle = registerTitle;
|
|
56
|
+
//# sourceMappingURL=title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/component/title.ts"],"names":[],"mappings":";;;AAAA,6CAAkD;AAIlD,qEAAuE;AAYvE,oCAAyC;AAEzC,iDAA8C;AAC9C,iDAAqD;AACrD,wCAAmD;AACnD,6CAA0C;AAEnC,MAAM,uBAAuB,GAAG,CACrC,KAA6C,EAC7C,QAAgD,EAChD,KAAc,EACd,QAAuC,EAC3B,EAAE;;IACd,MAAM,UAAU,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK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AC,qBAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB","file":"title.js","sourcesContent":["import { isValid, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender';\nimport type { TitleAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { Title as TitleComponent } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IElement,\n IGroupMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n RecursivePartial,\n StateEncodeSpec\n} from '../types';\nimport { ComponentEnum } from '../graph';\nimport type { ITitle, TitleSpec } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\n\nexport const generateTitleAttributes = (\n title?: string | number | number[] | string[],\n subTitle?: string | number | number[] | string[],\n theme?: ITheme,\n addition?: RecursivePartial<TitleAttrs>\n): TitleAttrs => {\n const titleTheme = theme?.components?.title;\n const attributes: RecursivePartial<TitleAttrs> = {};\n if (isValid(title)) {\n attributes.text = title;\n }\n if (isValid(subTitle)) {\n attributes.subtext = subTitle;\n }\n return merge({}, titleTheme, attributes, addition ?? {});\n};\n\nexport class Title extends Component implements ITitle {\n static readonly componentType: string = ComponentEnum.title;\n protected declare spec: TitleSpec;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.title, group);\n this.spec.componentType = ComponentEnum.title;\n }\n\n protected parseAddition(spec: TitleSpec) {\n super.parseAddition(spec);\n this.title(spec.title);\n this.subTitle(spec.subTitle);\n return this;\n }\n\n title(text: MarkFunctionType<string | number | number[] | string[]> | Nil) {\n return this.setFunctionSpec(text, 'title');\n }\n\n subTitle(text: MarkFunctionType<string | number | number[] | string[]> | Nil) {\n return this.setFunctionSpec(text, 'subTitle');\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.view.getCurrentTheme();\n const title = invokeFunctionType(this.spec.title, parameters, datum, element);\n const subTitle = invokeFunctionType(this.spec.subTitle, parameters, datum, element);\n const addition = invokeEncoder(encoder as BaseSignleEncodeSpec, datum, element, parameters);\n return generateTitleAttributes(title, subTitle, theme, addition);\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerTitle = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.title,\n (attrs: TitleAttrs) => new TitleComponent(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.title, Title);\n};\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { IBounds, IPointLike } from '@visactor/vutils';
|
|
2
|
+
import type { TooltipAttributes, TooltipRowAttrs } from '@visactor/vrender-components';
|
|
3
|
+
import type { IData, IGrammarBase, IGroupMark, IMark, IScale, ITheme, IView, Nil, RecursivePartial } from '../types';
|
|
4
|
+
import type { BaseTooltipSpec, CustomTooltipCallback, DimensionTooltipSpec, IDimensionTooltip, ITooltip, ITooltipRow, TooltipSpec, TooltipType } from '../types/component';
|
|
5
|
+
import { Component } from '../view/component';
|
|
6
|
+
export declare const generateTooltipAttributes: (point: IPointLike, title: TooltipRowAttrs, content: TooltipRowAttrs[], bounds: IBounds, theme?: ITheme, addition?: RecursivePartial<TooltipAttributes>) => TooltipAttributes;
|
|
7
|
+
export declare abstract class BaseTooltip extends Component {
|
|
8
|
+
static readonly componentType: string;
|
|
9
|
+
protected spec: BaseTooltipSpec;
|
|
10
|
+
protected _additionalEncodeResult: any;
|
|
11
|
+
protected parseAddition(spec: BaseTooltipSpec): this;
|
|
12
|
+
title(title: ITooltipRow | string | CustomTooltipCallback | Nil): this;
|
|
13
|
+
content(content: ITooltipRow | ITooltipRow[] | CustomTooltipCallback | Nil): this;
|
|
14
|
+
configureComponent(config: any): this;
|
|
15
|
+
protected _updateComponentEncoders(): void;
|
|
16
|
+
protected _parseTooltipRow(tooltipRow: ITooltipRow | ITooltipRow[] | Nil): IGrammarBase[];
|
|
17
|
+
protected _computeTooltipRow(row: ITooltipRow, datum: any, parameters: any): {
|
|
18
|
+
visible: boolean;
|
|
19
|
+
key: object;
|
|
20
|
+
value: object;
|
|
21
|
+
shape: object;
|
|
22
|
+
};
|
|
23
|
+
protected _computeTitleContent(datum: any): {
|
|
24
|
+
title: TooltipRowAttrs | {
|
|
25
|
+
visible: boolean;
|
|
26
|
+
key: object;
|
|
27
|
+
value: object;
|
|
28
|
+
shape: object;
|
|
29
|
+
};
|
|
30
|
+
content: any;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export declare class Tooltip extends BaseTooltip implements ITooltip {
|
|
34
|
+
protected spec: TooltipSpec;
|
|
35
|
+
private _targetMarks;
|
|
36
|
+
private _lastElement;
|
|
37
|
+
constructor(view: IView, group?: IGroupMark);
|
|
38
|
+
protected parseAddition(spec: TooltipSpec): this;
|
|
39
|
+
target(mark: IMark | IMark[] | string | string[] | Nil): this;
|
|
40
|
+
release(): void;
|
|
41
|
+
protected init(stage: any, parameters: any): void;
|
|
42
|
+
protected _onTooltipShow: (...args: any[]) => void;
|
|
43
|
+
protected _onTooltipHide: (event: any) => void;
|
|
44
|
+
}
|
|
45
|
+
export declare class DimensionTooltip extends BaseTooltip implements IDimensionTooltip {
|
|
46
|
+
protected spec: DimensionTooltipSpec;
|
|
47
|
+
private _lastGroup;
|
|
48
|
+
private _lastDatum;
|
|
49
|
+
private _avoidMarks;
|
|
50
|
+
private _tooltipDataFilter;
|
|
51
|
+
constructor(view: IView, group?: IGroupMark);
|
|
52
|
+
protected parseAddition(spec: DimensionTooltipSpec): this;
|
|
53
|
+
scale(scale?: IScale | string | Nil): this;
|
|
54
|
+
tooltipType(tooltipType: TooltipType | Nil): this;
|
|
55
|
+
target(data: IData | string | Nil, filter: string | ((datum: any, tooltipValue: any) => boolean) | Nil): this;
|
|
56
|
+
avoidMark(mark: IMark | IMark[] | string | string[] | Nil): this;
|
|
57
|
+
release(): void;
|
|
58
|
+
protected init(stage: any, parameters: any): void;
|
|
59
|
+
protected _onTooltipShow: (...args: any[]) => void;
|
|
60
|
+
protected _onTooltipHide: (event: any) => void;
|
|
61
|
+
}
|
|
62
|
+
export declare const registerTooltip: () => void;
|