@visactor/vchart 1.12.15 → 1.13.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/build/es5/index.js +1 -1
- package/build/index.js +2381 -1727
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/utils.js +8 -6
- package/cjs/animation/utils.js.map +1 -1
- package/cjs/chart/base/base-chart.d.ts +1 -0
- package/cjs/chart/base/base-chart.js +3 -0
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/index.d.ts +5 -3
- package/cjs/chart/index.js +16 -2
- package/cjs/chart/index.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +1 -0
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/interface/type.d.ts +2 -1
- package/cjs/chart/interface/type.js +1 -1
- package/cjs/chart/interface/type.js.map +1 -1
- package/cjs/chart/pictogram/index.d.ts +3 -0
- package/cjs/{plugin/components/tooltip-handler/canvas → chart/pictogram}/index.js +2 -1
- package/cjs/chart/pictogram/index.js.map +1 -0
- package/cjs/chart/pictogram/interface.d.ts +6 -0
- package/cjs/chart/pictogram/interface.js.map +1 -0
- package/cjs/chart/pictogram/pictogram-transformer.d.ts +8 -0
- package/cjs/chart/pictogram/pictogram-transformer.js +38 -0
- package/cjs/chart/pictogram/pictogram-transformer.js.map +1 -0
- package/cjs/chart/pictogram/pictogram.d.ts +12 -0
- package/cjs/chart/pictogram/pictogram.js +24 -0
- package/cjs/chart/pictogram/pictogram.js.map +1 -0
- package/cjs/chart/sankey/sankey-transformer.js +2 -1
- package/cjs/chart/sankey/sankey-transformer.js.map +1 -1
- package/cjs/chart/sankey/sankey.js +3 -2
- package/cjs/chart/sankey/sankey.js.map +1 -1
- package/cjs/compile/mark/compilable-mark.js +1 -1
- package/cjs/compile/mark/compilable-mark.js.map +1 -1
- package/cjs/component/custom-mark/custom-mark.js +7 -1
- package/cjs/component/custom-mark/custom-mark.js.map +1 -1
- package/cjs/component/geo/geo-coordinate.js +6 -6
- package/cjs/component/geo/geo-coordinate.js.map +1 -1
- package/cjs/component/tooltip/interface/theme.d.ts +2 -2
- package/cjs/component/tooltip/interface/theme.js.map +1 -1
- package/cjs/component/tooltip/utils/get-value.js +3 -1
- package/cjs/component/tooltip/utils/get-value.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/vchart.d.ts +4 -1
- package/cjs/core/vchart.js +21 -7
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/transforms/pictogram.d.ts +84 -0
- package/cjs/data/transforms/pictogram.js +149 -0
- package/cjs/data/transforms/pictogram.js.map +1 -0
- package/cjs/mark/group.d.ts +3 -2
- package/cjs/mark/group.js +12 -2
- package/cjs/mark/group.js.map +1 -1
- package/cjs/mark/interface/type.d.ts +2 -1
- package/cjs/mark/interface/type.js +2 -1
- package/cjs/mark/interface/type.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/base.d.ts +4 -6
- package/cjs/plugin/components/tooltip-handler/base.js +3 -20
- package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.d.ts → canvas-tooltip-handler.d.ts} +8 -3
- package/cjs/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.js → canvas-tooltip-handler.js} +15 -2
- package/cjs/plugin/components/tooltip-handler/canvas-tooltip-handler.js.map +1 -0
- package/cjs/plugin/components/tooltip-handler/constants.d.ts +7 -8
- package/cjs/plugin/components/tooltip-handler/constants.js +6 -9
- package/cjs/plugin/components/tooltip-handler/constants.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/{dom/dom-tooltip-handler.d.ts → dom-tooltip-handler.d.ts} +20 -9
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +187 -0
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -0
- package/cjs/plugin/components/tooltip-handler/index.d.ts +2 -2
- package/cjs/plugin/components/tooltip-handler/index.js +1 -1
- package/cjs/plugin/components/tooltip-handler/index.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/interface/index.d.ts +15 -2
- package/cjs/plugin/components/tooltip-handler/interface/index.js +1 -16
- package/cjs/plugin/components/tooltip-handler/interface/index.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/utils/attribute.d.ts +9 -2
- package/cjs/plugin/components/tooltip-handler/utils/attribute.js +36 -18
- package/cjs/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/utils/common.d.ts +1 -12
- package/cjs/plugin/components/tooltip-handler/utils/common.js +7 -35
- package/cjs/plugin/components/tooltip-handler/utils/common.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/utils/style.d.ts +18 -0
- package/cjs/plugin/components/tooltip-handler/utils/style.js +94 -0
- package/cjs/plugin/components/tooltip-handler/utils/style.js.map +1 -0
- package/cjs/plugin/components/tooltip-handler/utils/svg.d.ts +2 -0
- package/cjs/plugin/components/tooltip-handler/utils/svg.js +48 -0
- package/cjs/plugin/components/tooltip-handler/utils/svg.js.map +1 -0
- package/cjs/series/base/base-series.d.ts +22 -6
- package/cjs/series/base/base-series.js +33 -24
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/interface/type.d.ts +4 -2
- package/cjs/series/interface/type.js +4 -2
- package/cjs/series/interface/type.js.map +1 -1
- package/cjs/series/pictogram/constant.d.ts +2 -0
- package/cjs/series/pictogram/constant.js +15 -0
- package/cjs/series/pictogram/constant.js.map +1 -0
- package/cjs/series/pictogram/interface.d.ts +15 -0
- package/cjs/series/pictogram/interface.js.map +1 -0
- package/cjs/series/pictogram/pictogram-transformer.d.ts +5 -0
- package/cjs/series/pictogram/pictogram-transformer.js +23 -0
- package/cjs/series/pictogram/pictogram-transformer.js.map +1 -0
- package/cjs/series/pictogram/pictogram.d.ts +77 -0
- package/cjs/series/pictogram/pictogram.js +303 -0
- package/cjs/series/pictogram/pictogram.js.map +1 -0
- package/cjs/series/pictogram/svg-source.d.ts +7 -0
- package/cjs/series/pictogram/svg-source.js +38 -0
- package/cjs/series/pictogram/svg-source.js.map +1 -0
- package/cjs/series/pictogram/tooltip-helper.d.ts +9 -0
- package/cjs/series/pictogram/tooltip-helper.js +26 -0
- package/cjs/series/pictogram/tooltip-helper.js.map +1 -0
- package/cjs/series/sankey/interface.d.ts +1 -0
- package/cjs/series/sankey/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.js +4 -0
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/typings/spec/common.d.ts +1 -0
- package/cjs/typings/spec/common.js.map +1 -1
- package/cjs/typings/tooltip/common.d.ts +3 -1
- package/cjs/typings/tooltip/common.js.map +1 -1
- package/esm/animation/utils.js +8 -6
- package/esm/animation/utils.js.map +1 -1
- package/esm/chart/base/base-chart.d.ts +1 -0
- package/esm/chart/base/base-chart.js +3 -0
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/index.d.ts +5 -3
- package/esm/chart/index.js +4 -2
- package/esm/chart/index.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +1 -0
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/interface/type.d.ts +2 -1
- package/esm/chart/interface/type.js +1 -1
- package/esm/chart/interface/type.js.map +1 -1
- package/esm/chart/pictogram/index.d.ts +3 -0
- package/esm/chart/pictogram/index.js +6 -0
- package/esm/chart/pictogram/index.js.map +1 -0
- package/esm/chart/pictogram/interface.d.ts +6 -0
- package/esm/chart/pictogram/interface.js.map +1 -0
- package/esm/chart/pictogram/pictogram-transformer.d.ts +8 -0
- package/esm/chart/pictogram/pictogram-transformer.js +32 -0
- package/esm/chart/pictogram/pictogram-transformer.js.map +1 -0
- package/esm/chart/pictogram/pictogram.d.ts +12 -0
- package/esm/chart/pictogram/pictogram.js +24 -0
- package/esm/chart/pictogram/pictogram.js.map +1 -0
- package/esm/chart/sankey/sankey-transformer.js +2 -1
- package/esm/chart/sankey/sankey-transformer.js.map +1 -1
- package/esm/chart/sankey/sankey.js +3 -1
- package/esm/chart/sankey/sankey.js.map +1 -1
- package/esm/compile/mark/compilable-mark.js +1 -1
- package/esm/compile/mark/compilable-mark.js.map +1 -1
- package/esm/component/custom-mark/custom-mark.js +7 -1
- package/esm/component/custom-mark/custom-mark.js.map +1 -1
- package/esm/component/geo/geo-coordinate.js +6 -6
- package/esm/component/geo/geo-coordinate.js.map +1 -1
- package/esm/component/tooltip/interface/theme.d.ts +2 -2
- package/esm/component/tooltip/interface/theme.js.map +1 -1
- package/esm/component/tooltip/utils/get-value.js +3 -2
- package/esm/component/tooltip/utils/get-value.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/vchart.d.ts +4 -1
- package/esm/core/vchart.js +23 -6
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/transforms/pictogram.d.ts +84 -0
- package/esm/data/transforms/pictogram.js +145 -0
- package/esm/data/transforms/pictogram.js.map +1 -0
- package/esm/mark/group.d.ts +3 -2
- package/esm/mark/group.js +12 -2
- package/esm/mark/group.js.map +1 -1
- package/esm/mark/interface/type.d.ts +2 -1
- package/esm/mark/interface/type.js +2 -1
- package/esm/mark/interface/type.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/base.d.ts +4 -6
- package/esm/plugin/components/tooltip-handler/base.js +3 -22
- package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.d.ts → canvas-tooltip-handler.d.ts} +8 -3
- package/esm/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.js → canvas-tooltip-handler.js} +19 -5
- package/esm/plugin/components/tooltip-handler/canvas-tooltip-handler.js.map +1 -0
- package/esm/plugin/components/tooltip-handler/constants.d.ts +7 -8
- package/esm/plugin/components/tooltip-handler/constants.js +9 -4
- package/esm/plugin/components/tooltip-handler/constants.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/{dom/dom-tooltip-handler.d.ts → dom-tooltip-handler.d.ts} +20 -9
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +191 -0
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -0
- package/esm/plugin/components/tooltip-handler/index.d.ts +2 -2
- package/esm/plugin/components/tooltip-handler/index.js +2 -2
- package/esm/plugin/components/tooltip-handler/index.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/interface/index.d.ts +15 -2
- package/esm/plugin/components/tooltip-handler/interface/index.js +1 -3
- package/esm/plugin/components/tooltip-handler/interface/index.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/utils/attribute.d.ts +9 -2
- package/esm/plugin/components/tooltip-handler/utils/attribute.js +31 -11
- package/esm/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/utils/common.d.ts +1 -12
- package/esm/plugin/components/tooltip-handler/utils/common.js +3 -31
- package/esm/plugin/components/tooltip-handler/utils/common.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/utils/style.d.ts +18 -0
- package/esm/plugin/components/tooltip-handler/utils/style.js +80 -0
- package/esm/plugin/components/tooltip-handler/utils/style.js.map +1 -0
- package/esm/plugin/components/tooltip-handler/utils/svg.d.ts +2 -0
- package/esm/plugin/components/tooltip-handler/utils/svg.js +42 -0
- package/esm/plugin/components/tooltip-handler/utils/svg.js.map +1 -0
- package/esm/series/base/base-series.d.ts +22 -6
- package/esm/series/base/base-series.js +33 -23
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/interface/type.d.ts +4 -2
- package/esm/series/interface/type.js +4 -2
- package/esm/series/interface/type.js.map +1 -1
- package/esm/series/pictogram/constant.d.ts +2 -0
- package/esm/series/pictogram/constant.js +9 -0
- package/esm/series/pictogram/constant.js.map +1 -0
- package/esm/series/pictogram/interface.d.ts +15 -0
- package/esm/series/pictogram/interface.js.map +1 -0
- package/esm/series/pictogram/pictogram-transformer.d.ts +5 -0
- package/esm/series/pictogram/pictogram-transformer.js +19 -0
- package/esm/series/pictogram/pictogram-transformer.js.map +1 -0
- package/esm/series/pictogram/pictogram.d.ts +77 -0
- package/esm/series/pictogram/pictogram.js +329 -0
- package/esm/series/pictogram/pictogram.js.map +1 -0
- package/esm/series/pictogram/svg-source.d.ts +7 -0
- package/esm/series/pictogram/svg-source.js +35 -0
- package/esm/series/pictogram/svg-source.js.map +1 -0
- package/esm/series/pictogram/tooltip-helper.d.ts +9 -0
- package/esm/series/pictogram/tooltip-helper.js +18 -0
- package/esm/series/pictogram/tooltip-helper.js.map +1 -0
- package/esm/series/sankey/interface.d.ts +1 -0
- package/esm/series/sankey/interface.js.map +1 -1
- package/esm/series/sankey/sankey.js +4 -0
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/typings/spec/common.d.ts +1 -0
- package/esm/typings/spec/common.js.map +1 -1
- package/esm/typings/tooltip/common.d.ts +3 -1
- package/esm/typings/tooltip/common.js.map +1 -1
- package/package.json +15 -15
- package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/canvas/index.d.ts +0 -1
- package/cjs/plugin/components/tooltip-handler/canvas/index.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/constant.d.ts +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/constant.js +0 -6
- package/cjs/plugin/components/tooltip-handler/dom/constant.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +0 -98
- package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/index.d.ts +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/index.js +0 -21
- package/cjs/plugin/components/tooltip-handler/dom/index.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/interface.d.ts +0 -58
- package/cjs/plugin/components/tooltip-handler/dom/interface.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/base-tooltip-model.d.ts +0 -25
- package/cjs/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js +0 -73
- package/cjs/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.d.ts +0 -23
- package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js +0 -126
- package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/content-model.d.ts +0 -14
- package/cjs/plugin/components/tooltip-handler/dom/model/content-model.js +0 -54
- package/cjs/plugin/components/tooltip-handler/dom/model/content-model.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/interface.d.ts +0 -10
- package/cjs/plugin/components/tooltip-handler/dom/model/interface.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/shape-model.d.ts +0 -23
- package/cjs/plugin/components/tooltip-handler/dom/model/shape-model.js +0 -69
- package/cjs/plugin/components/tooltip-handler/dom/model/shape-model.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/style-constants.d.ts +0 -7
- package/cjs/plugin/components/tooltip-handler/dom/model/style-constants.js +0 -34
- package/cjs/plugin/components/tooltip-handler/dom/model/style-constants.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/text-model.d.ts +0 -5
- package/cjs/plugin/components/tooltip-handler/dom/model/text-model.js +0 -21
- package/cjs/plugin/components/tooltip-handler/dom/model/text-model.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/title-model.d.ts +0 -15
- package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js +0 -66
- package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/model/tooltip-model.d.ts +0 -21
- package/cjs/plugin/components/tooltip-handler/dom/model/tooltip-model.js +0 -79
- package/cjs/plugin/components/tooltip-handler/dom/model/tooltip-model.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/utils/common.d.ts +0 -3
- package/cjs/plugin/components/tooltip-handler/dom/utils/common.js +0 -33
- package/cjs/plugin/components/tooltip-handler/dom/utils/common.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/utils/index.d.ts +0 -2
- package/cjs/plugin/components/tooltip-handler/dom/utils/index.js +0 -21
- package/cjs/plugin/components/tooltip-handler/dom/utils/index.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/dom/utils/style.d.ts +0 -4
- package/cjs/plugin/components/tooltip-handler/dom/utils/style.js +0 -91
- package/cjs/plugin/components/tooltip-handler/dom/utils/style.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/interface/common.d.ts +0 -4
- package/cjs/plugin/components/tooltip-handler/interface/common.js +0 -6
- package/cjs/plugin/components/tooltip-handler/interface/common.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/interface/style.d.ts +0 -13
- package/cjs/plugin/components/tooltip-handler/interface/style.js +0 -6
- package/cjs/plugin/components/tooltip-handler/interface/style.js.map +0 -1
- package/cjs/plugin/components/tooltip-handler/utils/index.d.ts +0 -3
- package/cjs/plugin/components/tooltip-handler/utils/index.js +0 -22
- package/cjs/plugin/components/tooltip-handler/utils/index.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/canvas/index.d.ts +0 -1
- package/esm/plugin/components/tooltip-handler/canvas/index.js +0 -2
- package/esm/plugin/components/tooltip-handler/canvas/index.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/constant.d.ts +0 -1
- package/esm/plugin/components/tooltip-handler/dom/constant.js +0 -2
- package/esm/plugin/components/tooltip-handler/dom/constant.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +0 -104
- package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/index.d.ts +0 -1
- package/esm/plugin/components/tooltip-handler/dom/index.js +0 -2
- package/esm/plugin/components/tooltip-handler/dom/index.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/interface.d.ts +0 -58
- package/esm/plugin/components/tooltip-handler/dom/interface.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/base-tooltip-model.d.ts +0 -25
- package/esm/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js +0 -67
- package/esm/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.d.ts +0 -23
- package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js +0 -130
- package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/content-model.d.ts +0 -14
- package/esm/plugin/components/tooltip-handler/dom/model/content-model.js +0 -52
- package/esm/plugin/components/tooltip-handler/dom/model/content-model.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/interface.d.ts +0 -10
- package/esm/plugin/components/tooltip-handler/dom/model/interface.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/shape-model.d.ts +0 -23
- package/esm/plugin/components/tooltip-handler/dom/model/shape-model.js +0 -66
- package/esm/plugin/components/tooltip-handler/dom/model/shape-model.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/style-constants.d.ts +0 -7
- package/esm/plugin/components/tooltip-handler/dom/model/style-constants.js +0 -41
- package/esm/plugin/components/tooltip-handler/dom/model/style-constants.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/text-model.d.ts +0 -5
- package/esm/plugin/components/tooltip-handler/dom/model/text-model.js +0 -13
- package/esm/plugin/components/tooltip-handler/dom/model/text-model.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/title-model.d.ts +0 -15
- package/esm/plugin/components/tooltip-handler/dom/model/title-model.js +0 -65
- package/esm/plugin/components/tooltip-handler/dom/model/title-model.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/model/tooltip-model.d.ts +0 -21
- package/esm/plugin/components/tooltip-handler/dom/model/tooltip-model.js +0 -82
- package/esm/plugin/components/tooltip-handler/dom/model/tooltip-model.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/utils/common.d.ts +0 -3
- package/esm/plugin/components/tooltip-handler/dom/utils/common.js +0 -22
- package/esm/plugin/components/tooltip-handler/dom/utils/common.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/utils/index.d.ts +0 -2
- package/esm/plugin/components/tooltip-handler/dom/utils/index.js +0 -4
- package/esm/plugin/components/tooltip-handler/dom/utils/index.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/dom/utils/style.d.ts +0 -4
- package/esm/plugin/components/tooltip-handler/dom/utils/style.js +0 -87
- package/esm/plugin/components/tooltip-handler/dom/utils/style.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/interface/common.d.ts +0 -4
- package/esm/plugin/components/tooltip-handler/interface/common.js +0 -2
- package/esm/plugin/components/tooltip-handler/interface/common.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/interface/style.d.ts +0 -13
- package/esm/plugin/components/tooltip-handler/interface/style.js +0 -2
- package/esm/plugin/components/tooltip-handler/interface/style.js.map +0 -1
- package/esm/plugin/components/tooltip-handler/utils/index.d.ts +0 -3
- package/esm/plugin/components/tooltip-handler/utils/index.js +0 -6
- package/esm/plugin/components/tooltip-handler/utils/index.js.map +0 -1
- /package/cjs/{plugin/components/tooltip-handler/dom → chart/pictogram}/interface.js +0 -0
- /package/cjs/{plugin/components/tooltip-handler/dom/model → series/pictogram}/interface.js +0 -0
- /package/esm/{plugin/components/tooltip-handler/dom → chart/pictogram}/interface.js +0 -0
- /package/esm/{plugin/components/tooltip-handler/dom/model → series/pictogram}/interface.js +0 -0
|
@@ -2,12 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.getTooltipAttributes = exports.getPanelAttributes = exports.getTextAttributes = void 0;
|
|
5
|
+
}), exports.getTooltipAttributes = exports.getPanelAttributes = exports.getTextAttributes = exports.measureTooltipText = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), vutils_extension_1 = require("@visactor/vutils-extension"), space_1 = require("../../../../util/space"),
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vutils_extension_1 = require("@visactor/vutils-extension"), space_1 = require("../../../../util/space"), token_1 = require("../../../../theme/token"), vrender_core_1 = require("@visactor/vrender-core"), DEFAULT_TEXT_ATTRIBUTES = {
|
|
8
8
|
fontFamily: token_1.token.fontFamily,
|
|
9
9
|
spacing: 10,
|
|
10
10
|
wordBreak: "break-word"
|
|
11
|
+
}, measureTooltipText = (text, style) => {
|
|
12
|
+
var _a;
|
|
13
|
+
let textLines, textConfig;
|
|
14
|
+
"rich" !== (null == text ? void 0 : text.type) && "html" !== (null == text ? void 0 : text.type) ? (text = (null != text ? text : "").toString(),
|
|
15
|
+
style.multiLine ? (textLines = text.split("\n"), textLines = textLines.map(((line, i) => i < textLines.length - 1 ? line + "\n" : line))) : textLines = [ text ],
|
|
16
|
+
textConfig = textLines.map((line => Object.assign(Object.assign({}, style), {
|
|
17
|
+
text: line
|
|
18
|
+
})))) : (textConfig = text.text, textLines = text);
|
|
19
|
+
const bound = (0, vrender_core_1.getRichTextBounds)({
|
|
20
|
+
wordBreak: null !== (_a = style.wordBreak) && void 0 !== _a ? _a : "break-word",
|
|
21
|
+
maxWidth: style.maxWidth ? style.maxWidth : void 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0,
|
|
24
|
+
textConfig: textConfig
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
width: bound.width(),
|
|
28
|
+
height: bound.height(),
|
|
29
|
+
text: textLines
|
|
30
|
+
};
|
|
11
31
|
};
|
|
12
32
|
|
|
13
33
|
function getTextAttributes(style = {}, globalTheme, defaultAttributes) {
|
|
@@ -28,7 +48,7 @@ function getTextAttributes(style = {}, globalTheme, defaultAttributes) {
|
|
|
28
48
|
});
|
|
29
49
|
}
|
|
30
50
|
|
|
31
|
-
exports.getTextAttributes = getTextAttributes;
|
|
51
|
+
exports.measureTooltipText = measureTooltipText, exports.getTextAttributes = getTextAttributes;
|
|
32
52
|
|
|
33
53
|
const getPanelAttributes = style => {
|
|
34
54
|
var _a;
|
|
@@ -49,7 +69,7 @@ exports.getPanelAttributes = getPanelAttributes;
|
|
|
49
69
|
|
|
50
70
|
const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
|
|
51
71
|
var _a, _b, _c, _d, _e;
|
|
52
|
-
const {style: style = {}, enterable: enterable, transitionDuration: transitionDuration} = spec, {panel: panel = {}, titleLabel: titleLabel, shape: shape, keyLabel: keyLabel, valueLabel: valueLabel, spaceRow: commonSpaceRow,
|
|
72
|
+
const {style: style = {}, enterable: enterable, transitionDuration: transitionDuration} = spec, {panel: panel = {}, titleLabel: titleLabel, shape: shape, keyLabel: keyLabel, valueLabel: valueLabel, spaceRow: commonSpaceRow, align: align} = style, padding = (0,
|
|
53
73
|
vutils_1.normalizePadding)(panel.padding), paddingSpec = (0, space_1.normalizeLayoutPaddingSpec)(panel.padding), titleStyle = getTextAttributes(Object.assign({
|
|
54
74
|
textAlign: "right" === align ? "right" : "left"
|
|
55
75
|
}, titleLabel), globalTheme), keyStyle = getTextAttributes(Object.assign({
|
|
@@ -76,12 +96,11 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
|
|
|
76
96
|
hasContentShape: !1,
|
|
77
97
|
keyWidth: 0,
|
|
78
98
|
valueWidth: 0,
|
|
79
|
-
maxContentHeight: maxContentHeight,
|
|
80
99
|
enterable: enterable,
|
|
81
100
|
transitionDuration: transitionDuration,
|
|
82
101
|
align: align
|
|
83
102
|
}, {title: title = {}, content: content = []} = actualTooltip;
|
|
84
|
-
let panelWidth = paddingSpec.left + paddingSpec.right, panelHeight = paddingSpec.top + paddingSpec.bottom,
|
|
103
|
+
let panelWidth = paddingSpec.left + paddingSpec.right, panelHeight = paddingSpec.top + paddingSpec.bottom, contentMaxWidth = 0;
|
|
85
104
|
const hasContent = !!content.length;
|
|
86
105
|
let maxKeyWidth = 0, maxAdaptiveKeyWidth = 0, maxValueWidth = 0, maxShapeWidth = 0;
|
|
87
106
|
if (hasContent) {
|
|
@@ -95,7 +114,7 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
|
|
|
95
114
|
};
|
|
96
115
|
if ((0, vutils_1.isValid)(actualKey)) {
|
|
97
116
|
const itemKeyStyle = (0, vutils_extension_1.mergeSpec)({}, keyStyle, getTextAttributes(actualKeyStyle, void 0, {})), {width: width, height: height, text: text} = (0,
|
|
98
|
-
|
|
117
|
+
exports.measureTooltipText)(actualKey, itemKeyStyle);
|
|
99
118
|
itemAttrs.key = Object.assign(Object.assign({
|
|
100
119
|
width: width,
|
|
101
120
|
height: height
|
|
@@ -106,7 +125,7 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
|
|
|
106
125
|
}
|
|
107
126
|
if ((0, vutils_1.isValid)(actualValue)) {
|
|
108
127
|
const itemValueStyle = (0, vutils_extension_1.mergeSpec)({}, valueStyle, getTextAttributes(actualValueStyle, void 0, {})), {width: width, height: height, text: text} = (0,
|
|
109
|
-
|
|
128
|
+
exports.measureTooltipText)(actualValue, itemValueStyle);
|
|
110
129
|
itemAttrs.value = Object.assign(Object.assign({
|
|
111
130
|
width: width,
|
|
112
131
|
height: height
|
|
@@ -129,11 +148,11 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
|
|
|
129
148
|
};
|
|
130
149
|
return itemAttrs.height = itemHeight, contentHeight += itemHeight, i < content.length - 1 && (contentHeight += itemAttrs.spaceRow),
|
|
131
150
|
itemAttrs;
|
|
132
|
-
})), panelHeight += contentHeight,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
151
|
+
})), panelHeight += contentHeight, maxKeyWidth = keyWidths.length ? (0, vutils_1.maxInArray)(keyWidths) : 0,
|
|
152
|
+
maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? (0, vutils_1.maxInArray)(adaptiveKeyWidths) : 0,
|
|
153
|
+
maxValueWidth = valueWidths.length ? (0, vutils_1.maxInArray)(valueWidths) : 0,
|
|
154
|
+
maxShapeWidth = shapeWidths.length ? (0, vutils_1.maxInArray)(shapeWidths) + shapeStyle.spacing : 0,
|
|
155
|
+
contentMaxWidth = Math.max(maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing, maxShapeWidth + maxAdaptiveKeyWidth, contentMaxWidth),
|
|
137
156
|
attributes.hasContentShape = !!shapeWidths.length, attributes.keyWidth = maxKeyWidth,
|
|
138
157
|
attributes.valueWidth = maxValueWidth;
|
|
139
158
|
}
|
|
@@ -146,7 +165,7 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
|
|
|
146
165
|
titleValueStyle = (0, vutils_extension_1.mergeSpec)({}, titleStyle, getTextAttributes(actualTitleValueStyle, void 0, {})),
|
|
147
166
|
isAutoWidthMode() && (titleValueStyle.multiLine = null === (_c = titleValueStyle.multiLine) || void 0 === _c || _c,
|
|
148
167
|
titleValueStyle.maxWidth = null !== (_d = titleValueStyle.maxWidth) && void 0 !== _d ? _d : hasContent ? Math.ceil(contentMaxWidth) : void 0);
|
|
149
|
-
const {text: text, width: width, height: height} = (0,
|
|
168
|
+
const {text: text, width: width, height: height} = (0, exports.measureTooltipText)(actualTitleValue, titleValueStyle);
|
|
150
169
|
attributes.title.value = Object.assign(Object.assign({
|
|
151
170
|
width: isAutoWidthMode() ? Math.min(width, null !== (_e = titleValueStyle.maxWidth) && void 0 !== _e ? _e : Number.MAX_VALUE) : width,
|
|
152
171
|
height: height
|
|
@@ -155,16 +174,15 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
|
|
|
155
174
|
}), titleMaxWidth = attributes.title.value.width, titleMaxHeight = attributes.title.value.height,
|
|
156
175
|
titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);
|
|
157
176
|
}
|
|
158
|
-
return panelHeight += titleHeightWithSpace,
|
|
159
|
-
attributes.title.
|
|
160
|
-
isAutoWidthMode() ? panelWidth += contentMaxWidth || titleMaxWidth : panelWidth += Math.max(titleMaxWidth, contentMaxWidth),
|
|
177
|
+
return panelHeight += titleHeightWithSpace, attributes.title.width = titleMaxWidth,
|
|
178
|
+
attributes.title.height = titleMaxHeight, isAutoWidthMode() ? panelWidth += contentMaxWidth || titleMaxWidth : panelWidth += Math.max(titleMaxWidth, contentMaxWidth),
|
|
161
179
|
hasContent && attributes.content.forEach((item => {
|
|
162
180
|
var _a;
|
|
163
181
|
const value = item.value;
|
|
164
182
|
value && (null === (_a = value.autoWidth) || void 0 === _a || _a) && (value.width = panelWidth - paddingSpec.left - paddingSpec.right - maxShapeWidth - maxKeyWidth - keyStyle.spacing - valueStyle.spacing,
|
|
165
183
|
value.maxWidth || (value.maxWidth = Math.ceil(value.width)), attributes.valueWidth = Math.max(attributes.valueWidth, value.width));
|
|
166
184
|
})), attributes.panel.width = panelWidth, attributes.panel.height = panelHeight,
|
|
167
|
-
attributes
|
|
185
|
+
attributes;
|
|
168
186
|
};
|
|
169
187
|
|
|
170
188
|
exports.getTooltipAttributes = getTooltipAttributes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/attribute.ts"],"names":[],"mappings":";;;AASA,6CAAyE;AACzE,iEAAuD;AACvD,kDAAoE;AACpE,qCAA8C;AAG9C,mDAAgD;AAEhD,MAAM,uBAAuB,GAA+B;IAC1D,UAAU,EAAE,aAAK,CAAC,UAAU;IAC5B,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,QAA2B,EAAE,E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AC,EAAE;;YAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAA6C,CAAC;YAEjE,IAAI,KAAK,IAAI,CAAC,MAAA,KAAK,CAAC,SAAS,mCAAI,IAAI,CAAC,EAAE;gBACtC,KAAK,CAAC,KAAK;oBACT,UAAU;wBACV,WAAW,CAAC,IAAI;wBAChB,WAAW,CAAC,KAAK;wBACjB,aAAa;wBACb,WAAW;wBACX,QAAQ,CAAC,OAAO;wBAChB,UAAU,CAAC,OAAO,CAAC;gBAErB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACnB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBACzC;gBACD,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;aACtE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,UAAU,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACpC,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;IACtC,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAzQW,QAAA,oBAAoB,wBAyQ/B","file":"attribute.js","sourcesContent":["import type {\n TooltipPanelAttrs,\n TooltipRowAttrs,\n TooltipRowStyleAttrs,\n TooltipSymbolAttrs,\n TooltipTextAttrs\n} from '@visactor/vrender-components';\nimport type { IPadding, ITooltipActual } from '../../../../typings';\nimport type { ITooltipAttributes, ITooltipTextStyle } from '../interface';\nimport { isValid, maxInArray, normalizePadding } from '@visactor/vutils';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { normalizeLayoutPaddingSpec } from '../../../../util/space';\nimport { measureTooltipText } from './common';\nimport type { ITheme } from '../../../../theme';\nimport type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';\nimport { token } from '../../../../theme/token';\n\nconst DEFAULT_TEXT_ATTRIBUTES: Partial<ITooltipTextStyle> = {\n fontFamily: token.fontFamily,\n spacing: 10,\n wordBreak: 'break-word'\n};\n\nexport function getTextAttributes(\n style: ITooltipTextTheme = {},\n globalTheme?: ITheme,\n defaultAttributes?: Partial<ITooltipTextStyle>\n): ITooltipTextStyle {\n const attrs: ITooltipTextStyle = {\n ...(defaultAttributes ?? DEFAULT_TEXT_ATTRIBUTES),\n fill: (style.fill ?? style.fontColor) as string,\n textAlign: style.textAlign,\n textBaseline: style.textBaseline,\n fontFamily: style.fontFamily ?? (globalTheme?.fontFamily as string),\n fontSize: style.fontSize as number,\n fontWeight: style.fontWeight,\n lineHeight: style.lineHeight as number,\n spacing: style.spacing,\n multiLine: style.multiLine,\n maxWidth: style.maxWidth,\n wordBreak: style.wordBreak,\n autoWidth: style.autoWidth\n };\n return attrs;\n}\n\nexport const getPanelAttributes = (style: ITooltipTheme['panel']): TooltipPanelAttrs => {\n const { backgroundColor, border, shadow } = style;\n const panelAttrs: TooltipPanelAttrs = {\n lineWidth: border?.width ?? 0,\n shadow: !!shadow\n };\n if (border?.color) {\n panelAttrs.stroke = border.color as string;\n }\n if (backgroundColor) {\n panelAttrs.fill = backgroundColor as string;\n }\n if (shadow) {\n panelAttrs.shadowColor = shadow.color as string;\n panelAttrs.shadowBlur = shadow.blur;\n panelAttrs.shadowOffsetX = shadow.x;\n panelAttrs.shadowOffsetY = shadow.y;\n panelAttrs.shadowSpread = shadow.spread;\n }\n const { radius } = border ?? {};\n if (isValid(radius)) {\n panelAttrs.cornerRadius = [radius, radius, radius, radius];\n }\n return panelAttrs;\n};\n\nexport const getTooltipAttributes = (\n actualTooltip: ITooltipActual,\n spec: ITooltipSpec,\n globalTheme: ITheme\n): ITooltipAttributes => {\n const { style = {}, enterable, transitionDuration } = spec;\n const {\n panel = {},\n titleLabel,\n shape,\n keyLabel,\n valueLabel,\n spaceRow: commonSpaceRow,\n maxContentHeight,\n align\n } = style;\n const padding = normalizePadding(panel.padding);\n const paddingSpec = normalizeLayoutPaddingSpec(panel.padding) as IPadding;\n\n const titleStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...titleLabel\n },\n globalTheme\n );\n const keyStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...keyLabel\n },\n globalTheme\n );\n const valueStyle = getTextAttributes(valueLabel, globalTheme);\n const shapeStyle: TooltipRowStyleAttrs['shape'] = {\n fill: true,\n size: shape?.size ?? 8,\n spacing: shape?.spacing ?? 6\n };\n\n const attributes: ITooltipAttributes = {\n panel: getPanelAttributes(panel),\n padding,\n\n title: {},\n content: [],\n\n titleStyle: {\n value: titleStyle,\n spaceRow: commonSpaceRow\n },\n contentStyle: {\n shape: shapeStyle,\n key: keyStyle,\n value: valueStyle,\n spaceRow: commonSpaceRow\n },\n hasContentShape: false,\n keyWidth: 0,\n valueWidth: 0,\n\n maxContentHeight,\n\n enterable,\n transitionDuration,\n align\n };\n\n const { title = {}, content = [] } = actualTooltip;\n\n let panelWidth = paddingSpec.left + paddingSpec.right;\n let panelHeight = paddingSpec.top + paddingSpec.bottom;\n /** dom tooltip 的高度。由于 canvas tooltip 不支持滚动条,dom tooltip 单独计算高度 */\n let panelDomHeight = paddingSpec.top + paddingSpec.bottom;\n\n // calculate content\n let contentMaxWidth = 0;\n\n const hasContent = !!content.length;\n let maxKeyWidth = 0;\n let maxAdaptiveKeyWidth = 0;\n let maxValueWidth = 0;\n let maxShapeWidth = 0;\n\n if (hasContent) {\n const keyWidths: number[] = [];\n const adaptiveKeyWidths: number[] = [];\n const valueWidths: number[] = [];\n const shapeWidths: number[] = [];\n\n let contentHeight = 0;\n attributes.content = content.map((item, i) => {\n let itemHeight = 0;\n const {\n hasShape: actualHasShape,\n key: actualKey,\n shapeType: actualShapeType = '',\n shapeFill: actualShapeFill,\n shapeStroke: actualShapeStroke,\n shapeLineWidth: actualShapeLineWidth,\n shapeSize: actualShapeSize,\n value: actualValue,\n isKeyAdaptive: actualIsKeyAdaptive,\n spaceRow: actualSpaceRow,\n keyStyle: actualKeyStyle,\n valueStyle: actualValueStyle,\n shapeHollow: actualShapeHollow\n } = item;\n const itemAttrs: TooltipRowAttrs = { height: 0, spaceRow: actualSpaceRow ?? commonSpaceRow };\n if (isValid(actualKey)) {\n const itemKeyStyle: ITooltipTextStyle = mergeSpec(\n {},\n keyStyle,\n getTextAttributes(actualKeyStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualKey, itemKeyStyle);\n itemAttrs.key = {\n width,\n height,\n ...itemKeyStyle,\n text\n };\n if (!actualIsKeyAdaptive) {\n keyWidths.push(width);\n } else {\n adaptiveKeyWidths.push(width);\n }\n itemHeight = Math.max(itemHeight, height);\n }\n if (isValid(actualValue)) {\n const itemValueStyle: ITooltipTextStyle = mergeSpec(\n {},\n valueStyle,\n getTextAttributes(actualValueStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualValue, itemValueStyle);\n itemAttrs.value = {\n width,\n height,\n ...itemValueStyle,\n text\n };\n valueWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (actualHasShape) {\n const shape: TooltipSymbolAttrs = {\n visible: true,\n symbolType: actualShapeType\n };\n if (actualShapeHollow) {\n shape.stroke = actualShapeFill;\n } else {\n shape.fill = actualShapeFill;\n }\n shape.stroke = actualShapeStroke ?? actualShapeFill;\n shape.lineWidth = actualShapeLineWidth;\n itemAttrs.shape = shape;\n\n const shapeWidth = actualShapeSize ?? shapeStyle.size;\n itemHeight = Math.max(shapeWidth, itemHeight);\n shapeWidths.push(shapeWidth);\n } else {\n itemAttrs.shape = { visible: false };\n }\n\n itemAttrs.height = itemHeight;\n contentHeight += itemHeight;\n if (i < content.length - 1) {\n contentHeight += itemAttrs.spaceRow;\n }\n\n return itemAttrs;\n });\n panelHeight += contentHeight;\n panelDomHeight += Math.min(contentHeight, maxContentHeight ?? Infinity);\n\n maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0; // name 需要对齐\n maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0;\n maxValueWidth = valueWidths.length ? maxInArray(valueWidths) : 0; // value 需要对齐\n maxShapeWidth = shapeWidths.length ? maxInArray(shapeWidths) + shapeStyle.spacing : 0; // shape 列宽度\n contentMaxWidth = Math.max(\n maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing,\n maxShapeWidth + maxAdaptiveKeyWidth,\n contentMaxWidth\n );\n attributes.hasContentShape = !!shapeWidths.length;\n attributes.keyWidth = maxKeyWidth;\n attributes.valueWidth = maxValueWidth;\n }\n\n // calculate title\n let titleMaxWidth = 0;\n let titleMaxHeight = 0;\n let titleHeightWithSpace = 0;\n const {\n visible: actualTitleVisible = true,\n value: actualTitleValue = '',\n valueStyle: actualTitleValueStyle,\n spaceRow: actualTitleSpaceRow\n } = title;\n attributes.title.visible = actualTitleVisible;\n attributes.title.spaceRow = actualTitleSpaceRow ?? commonSpaceRow;\n\n let titleValueStyle: ITooltipTextStyle = {};\n // 当前是否处于自适应宽度模式\n const isAutoWidthMode = () => titleValueStyle.autoWidth && titleValueStyle.multiLine !== false;\n if (actualTitleVisible) {\n titleValueStyle = mergeSpec({}, titleStyle, getTextAttributes(actualTitleValueStyle, undefined, {}));\n // 标题默认优化策略:如果 autoWidth 为 true,则宽度默认跟随 content 宽度并开启自动换行\n if (isAutoWidthMode()) {\n titleValueStyle.multiLine = titleValueStyle.multiLine ?? true;\n titleValueStyle.maxWidth = titleValueStyle.maxWidth ?? (hasContent ? Math.ceil(contentMaxWidth) : undefined);\n }\n\n const { text, width, height } = measureTooltipText(actualTitleValue, titleValueStyle);\n attributes.title.value = {\n width: isAutoWidthMode() ? Math.min(width, titleValueStyle.maxWidth ?? Number.MAX_VALUE) : width,\n height,\n ...titleValueStyle,\n text\n };\n titleMaxWidth = attributes.title.value.width;\n titleMaxHeight = attributes.title.value.height;\n\n titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);\n }\n panelHeight += titleHeightWithSpace;\n panelDomHeight += titleHeightWithSpace;\n attributes.title.width = titleMaxWidth;\n attributes.title.height = titleMaxHeight;\n\n if (isAutoWidthMode()) {\n panelWidth += contentMaxWidth ? contentMaxWidth : titleMaxWidth;\n } else {\n panelWidth += Math.max(titleMaxWidth, contentMaxWidth);\n }\n\n // 处理 content 的自动宽度模式\n if (hasContent) {\n attributes.content.forEach(item => {\n const value = item.value as ITooltipTextStyle & TooltipTextAttrs;\n // 最后一列默认自适应宽度\n if (value && (value.autoWidth ?? true)) {\n value.width =\n panelWidth -\n paddingSpec.left -\n paddingSpec.right -\n maxShapeWidth -\n maxKeyWidth -\n keyStyle.spacing -\n valueStyle.spacing;\n //value.multiLine = true; multiLine 需要用户手动开启,不会自动开启\n if (!value.maxWidth) {\n value.maxWidth = Math.ceil(value.width);\n }\n attributes.valueWidth = Math.max(attributes.valueWidth, value.width);\n }\n });\n }\n\n attributes.panel.width = panelWidth;\n attributes.panel.height = panelHeight;\n attributes.panelDomHeight = panelDomHeight;\n return attributes;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/attribute.ts"],"names":[],"mappings":";;;AAUA,6CAAyE;AACzE,iEAAuD;AACvD,kDAAoE;AAGpE,mDAAgD;AAEhD,yDAA2D;AAI3D,MAAM,uBAAuB,GAA+B;IAC1D,UAAU,EAAE,aAAK,CAAC,UAAU;IAC5B,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,YAAY;CACxB,CAAC;AASK,MAAM,kBAAkB,GAAG,CAAC,IAAmC,EAAE,KAAwB,EAAoB,EAAE;;IACpH,IAAI,SAA0C,CAAC;IAC/C,IAAI,UAAgC,CAAC;IACrC,IAAI,CAAC,CAAC,CAAC,IAA6B,aAA7B,IAAI,uBAAJ,IAAI,CAA2B,IAAI,MAAK,MAAM,IAAI,CAAC,IAA6B,aAA7B,IAAI,u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;wBACjB,aAAa;wBACb,WAAW;wBACX,QAAQ,CAAC,OAAO;wBAChB,UAAU,CAAC,OAAO,CAAC;gBAErB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;oBACnB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBACzC;gBACD,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;aACtE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,UAAU,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACpC,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAzPW,QAAA,oBAAoB,wBAyP/B","file":"attribute.js","sourcesContent":["import type {\n TooltipPanelAttrs,\n TooltipRowAttrs,\n TooltipRowStyleAttrs,\n TooltipSymbolAttrs,\n TooltipTextAttrs,\n TooltipRichTextAttrs\n} from '@visactor/vrender-components';\nimport type { IPadding, ITooltipActual, MaybeArray } from '../../../../typings';\nimport type { ITooltipAttributes, ITooltipTextStyle } from '../interface';\nimport { isValid, maxInArray, normalizePadding } from '@visactor/vutils';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { normalizeLayoutPaddingSpec } from '../../../../util/space';\nimport type { ITheme } from '../../../../theme';\nimport type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';\nimport { token } from '../../../../theme/token';\n// eslint-disable-next-line no-duplicate-imports\nimport { getRichTextBounds } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IRichTextCharacter, IRichTextParagraphCharacter } from '@visactor/vrender-core';\n\nconst DEFAULT_TEXT_ATTRIBUTES: Partial<ITooltipTextStyle> = {\n fontFamily: token.fontFamily,\n spacing: 10,\n wordBreak: 'break-word'\n};\n\ninterface ITooltipTextInfo {\n width: number;\n height: number;\n text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;\n}\n\n/** 测量 tooltip 标签文本 */\nexport const measureTooltipText = (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle): ITooltipTextInfo => {\n let textLines: string[] | TooltipRichTextAttrs;\n let textConfig: IRichTextCharacter[];\n if (!((text as TooltipRichTextAttrs)?.type === 'rich' || (text as TooltipRichTextAttrs)?.type === 'html')) {\n text = (text ?? '').toString();\n if (style.multiLine) {\n textLines = text.split('\\n');\n textLines = textLines.map((line, i) => (i < (textLines as string[]).length - 1 ? line + '\\n' : line));\n } else {\n textLines = [text];\n }\n textConfig = textLines.map(\n line =>\n ({\n ...style,\n text: line\n } as unknown as IRichTextParagraphCharacter)\n );\n } else {\n textConfig = (text as TooltipRichTextAttrs).text as IRichTextCharacter[];\n textLines = text as TooltipRichTextAttrs;\n }\n\n const bound = getRichTextBounds({\n wordBreak: (style as any).wordBreak ?? 'break-word',\n maxWidth: style.maxWidth ? style.maxWidth : undefined,\n width: 0,\n height: 0,\n textConfig: textConfig\n });\n return {\n width: bound.width(),\n height: bound.height(),\n text: textLines\n };\n};\n\nexport function getTextAttributes(\n style: ITooltipTextTheme = {},\n globalTheme?: ITheme,\n defaultAttributes?: Partial<ITooltipTextStyle>\n): ITooltipTextStyle {\n const attrs: ITooltipTextStyle = {\n ...(defaultAttributes ?? DEFAULT_TEXT_ATTRIBUTES),\n fill: (style.fill ?? style.fontColor) as string,\n textAlign: style.textAlign,\n textBaseline: style.textBaseline,\n fontFamily: style.fontFamily ?? (globalTheme?.fontFamily as string),\n fontSize: style.fontSize as number,\n fontWeight: style.fontWeight,\n lineHeight: style.lineHeight as number,\n spacing: style.spacing,\n multiLine: style.multiLine,\n maxWidth: style.maxWidth,\n wordBreak: style.wordBreak,\n autoWidth: style.autoWidth\n };\n return attrs;\n}\n\nexport const getPanelAttributes = (style: ITooltipTheme['panel']): TooltipPanelAttrs => {\n const { backgroundColor, border, shadow } = style;\n const panelAttrs: TooltipPanelAttrs = {\n lineWidth: border?.width ?? 0,\n shadow: !!shadow\n };\n if (border?.color) {\n panelAttrs.stroke = border.color as string;\n }\n if (backgroundColor) {\n panelAttrs.fill = backgroundColor as string;\n }\n if (shadow) {\n panelAttrs.shadowColor = shadow.color as string;\n panelAttrs.shadowBlur = shadow.blur;\n panelAttrs.shadowOffsetX = shadow.x;\n panelAttrs.shadowOffsetY = shadow.y;\n panelAttrs.shadowSpread = shadow.spread;\n }\n const { radius } = border ?? {};\n if (isValid(radius)) {\n panelAttrs.cornerRadius = [radius, radius, radius, radius];\n }\n return panelAttrs;\n};\n\nexport const getTooltipAttributes = (\n actualTooltip: ITooltipActual,\n spec: ITooltipSpec,\n globalTheme: ITheme\n): ITooltipAttributes => {\n const { style = {}, enterable, transitionDuration } = spec;\n const { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style;\n const padding = normalizePadding(panel.padding);\n const paddingSpec = normalizeLayoutPaddingSpec(panel.padding) as IPadding;\n\n const titleStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...titleLabel\n },\n globalTheme\n );\n const keyStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...keyLabel\n },\n globalTheme\n );\n const valueStyle = getTextAttributes(valueLabel, globalTheme);\n const shapeStyle: TooltipRowStyleAttrs['shape'] = {\n fill: true,\n size: shape?.size ?? 8,\n spacing: shape?.spacing ?? 6\n };\n\n const attributes: ITooltipAttributes = {\n panel: getPanelAttributes(panel),\n padding,\n\n title: {},\n content: [],\n\n titleStyle: {\n value: titleStyle,\n spaceRow: commonSpaceRow\n },\n contentStyle: {\n shape: shapeStyle,\n key: keyStyle,\n value: valueStyle,\n spaceRow: commonSpaceRow\n },\n hasContentShape: false,\n keyWidth: 0,\n valueWidth: 0,\n\n enterable,\n transitionDuration,\n align\n };\n\n const { title = {}, content = [] } = actualTooltip;\n\n let panelWidth = paddingSpec.left + paddingSpec.right;\n let panelHeight = paddingSpec.top + paddingSpec.bottom;\n\n // calculate content\n let contentMaxWidth = 0;\n\n const hasContent = !!content.length;\n let maxKeyWidth = 0;\n let maxAdaptiveKeyWidth = 0;\n let maxValueWidth = 0;\n let maxShapeWidth = 0;\n\n if (hasContent) {\n const keyWidths: number[] = [];\n const adaptiveKeyWidths: number[] = [];\n const valueWidths: number[] = [];\n const shapeWidths: number[] = [];\n\n let contentHeight = 0;\n attributes.content = content.map((item, i) => {\n let itemHeight = 0;\n const {\n hasShape: actualHasShape,\n key: actualKey,\n shapeType: actualShapeType = '',\n shapeFill: actualShapeFill,\n shapeStroke: actualShapeStroke,\n shapeLineWidth: actualShapeLineWidth,\n shapeSize: actualShapeSize,\n value: actualValue,\n isKeyAdaptive: actualIsKeyAdaptive,\n spaceRow: actualSpaceRow,\n keyStyle: actualKeyStyle,\n valueStyle: actualValueStyle,\n shapeHollow: actualShapeHollow\n } = item;\n const itemAttrs: TooltipRowAttrs = { height: 0, spaceRow: actualSpaceRow ?? commonSpaceRow };\n if (isValid(actualKey)) {\n const itemKeyStyle: ITooltipTextStyle = mergeSpec(\n {},\n keyStyle,\n getTextAttributes(actualKeyStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualKey, itemKeyStyle);\n itemAttrs.key = {\n width,\n height,\n ...itemKeyStyle,\n text\n };\n if (!actualIsKeyAdaptive) {\n keyWidths.push(width);\n } else {\n adaptiveKeyWidths.push(width);\n }\n itemHeight = Math.max(itemHeight, height);\n }\n if (isValid(actualValue)) {\n const itemValueStyle: ITooltipTextStyle = mergeSpec(\n {},\n valueStyle,\n getTextAttributes(actualValueStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualValue, itemValueStyle);\n itemAttrs.value = {\n width,\n height,\n ...itemValueStyle,\n text\n };\n valueWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (actualHasShape) {\n const shape: TooltipSymbolAttrs = {\n visible: true,\n symbolType: actualShapeType\n };\n if (actualShapeHollow) {\n shape.stroke = actualShapeFill;\n } else {\n shape.fill = actualShapeFill;\n }\n shape.stroke = actualShapeStroke ?? actualShapeFill;\n shape.lineWidth = actualShapeLineWidth;\n itemAttrs.shape = shape;\n\n const shapeWidth = actualShapeSize ?? shapeStyle.size;\n itemHeight = Math.max(shapeWidth, itemHeight);\n shapeWidths.push(shapeWidth);\n } else {\n itemAttrs.shape = { visible: false };\n }\n\n itemAttrs.height = itemHeight;\n contentHeight += itemHeight;\n if (i < content.length - 1) {\n contentHeight += itemAttrs.spaceRow;\n }\n\n return itemAttrs;\n });\n panelHeight += contentHeight;\n\n maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0; // name 需要对齐\n maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0;\n maxValueWidth = valueWidths.length ? maxInArray(valueWidths) : 0; // value 需要对齐\n maxShapeWidth = shapeWidths.length ? maxInArray(shapeWidths) + shapeStyle.spacing : 0; // shape 列宽度\n contentMaxWidth = Math.max(\n maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing,\n maxShapeWidth + maxAdaptiveKeyWidth,\n contentMaxWidth\n );\n attributes.hasContentShape = !!shapeWidths.length;\n attributes.keyWidth = maxKeyWidth;\n attributes.valueWidth = maxValueWidth;\n }\n\n // calculate title\n let titleMaxWidth = 0;\n let titleMaxHeight = 0;\n let titleHeightWithSpace = 0;\n const {\n visible: actualTitleVisible = true,\n value: actualTitleValue = '',\n valueStyle: actualTitleValueStyle,\n spaceRow: actualTitleSpaceRow\n } = title;\n attributes.title.visible = actualTitleVisible;\n attributes.title.spaceRow = actualTitleSpaceRow ?? commonSpaceRow;\n\n let titleValueStyle: ITooltipTextStyle = {};\n // 当前是否处于自适应宽度模式\n const isAutoWidthMode = () => titleValueStyle.autoWidth && titleValueStyle.multiLine !== false;\n if (actualTitleVisible) {\n titleValueStyle = mergeSpec({}, titleStyle, getTextAttributes(actualTitleValueStyle, undefined, {}));\n // 标题默认优化策略:如果 autoWidth 为 true,则宽度默认跟随 content 宽度并开启自动换行\n if (isAutoWidthMode()) {\n titleValueStyle.multiLine = titleValueStyle.multiLine ?? true;\n titleValueStyle.maxWidth = titleValueStyle.maxWidth ?? (hasContent ? Math.ceil(contentMaxWidth) : undefined);\n }\n\n const { text, width, height } = measureTooltipText(actualTitleValue, titleValueStyle);\n attributes.title.value = {\n width: isAutoWidthMode() ? Math.min(width, titleValueStyle.maxWidth ?? Number.MAX_VALUE) : width,\n height,\n ...titleValueStyle,\n text\n };\n titleMaxWidth = attributes.title.value.width;\n titleMaxHeight = attributes.title.value.height;\n\n titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);\n }\n panelHeight += titleHeightWithSpace;\n attributes.title.width = titleMaxWidth;\n attributes.title.height = titleMaxHeight;\n\n if (isAutoWidthMode()) {\n panelWidth += contentMaxWidth ? contentMaxWidth : titleMaxWidth;\n } else {\n panelWidth += Math.max(titleMaxWidth, contentMaxWidth);\n }\n\n // 处理 content 的自动宽度模式\n if (hasContent) {\n attributes.content.forEach(item => {\n const value = item.value as ITooltipTextStyle & TooltipTextAttrs;\n // 最后一列默认自适应宽度\n if (value && (value.autoWidth ?? true)) {\n value.width =\n panelWidth -\n paddingSpec.left -\n paddingSpec.right -\n maxShapeWidth -\n maxKeyWidth -\n keyStyle.spacing -\n valueStyle.spacing;\n //value.multiLine = true; multiLine 需要用户手动开启,不会自动开启\n if (!value.maxWidth) {\n value.maxWidth = Math.ceil(value.width);\n }\n attributes.valueWidth = Math.max(attributes.valueWidth, value.width);\n }\n });\n }\n\n attributes.panel.width = panelWidth;\n attributes.panel.height = panelHeight;\n return attributes;\n};\n"]}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import type { MaybeArray } from '../../../../typings';
|
|
2
|
-
import type { ITooltipTextStyle } from '../interface/style';
|
|
3
|
-
import type { TooltipRichTextAttrs } from '@visactor/vrender-components';
|
|
4
1
|
export declare function escapeHTML(value: any): string;
|
|
5
|
-
export declare function pickFirstValidValue<T>(isValid: (element?: T) => any, ...elements: T[]): T | undefined;
|
|
6
|
-
export declare function convertToColorString(color: any, defaultColor?: string): string;
|
|
7
2
|
export declare const getScale: (element: HTMLElement, boundingClientRect?: DOMRect) => number;
|
|
8
|
-
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;
|
|
12
|
-
}
|
|
13
|
-
export declare const measureTooltipText: (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle) => ITooltipTextInfo;
|
|
14
|
-
export {};
|
|
3
|
+
export declare const formatContent: (content: any) => string;
|
|
@@ -2,51 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.
|
|
5
|
+
}), exports.formatContent = exports.getScale = exports.escapeHTML = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"),
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), constants_1 = require("../constants");
|
|
8
8
|
|
|
9
9
|
function escapeHTML(value) {
|
|
10
10
|
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\(/g, "(").replace(/ /g, " ");
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
for (const ele of elements) if (isValid(ele)) return ele;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function convertToColorString(color, defaultColor = "#000") {
|
|
18
|
-
return color ? (0, vutils_1.isString)(color) ? color : (0, vutils_1.isObject)(color) && color.stops && color.stops[0] && color.stops[0].color || defaultColor : defaultColor;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
exports.escapeHTML = escapeHTML, exports.pickFirstValidValue = pickFirstValidValue,
|
|
22
|
-
exports.convertToColorString = convertToColorString;
|
|
13
|
+
exports.escapeHTML = escapeHTML;
|
|
23
14
|
|
|
24
15
|
const getScale = (element, boundingClientRect) => element ? (boundingClientRect || (boundingClientRect = element.getBoundingClientRect()),
|
|
25
16
|
element.offsetWidth > 0 ? boundingClientRect.width / element.offsetWidth : boundingClientRect.height / element.offsetHeight) : 1;
|
|
26
17
|
|
|
27
18
|
exports.getScale = getScale;
|
|
28
19
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
style.multiLine ? (textLines = text.split("\n"), textLines = textLines.map(((line, i) => i < textLines.length - 1 ? line + "\n" : line))) : textLines = [ text ],
|
|
34
|
-
textConfig = textLines.map((line => Object.assign(Object.assign({}, style), {
|
|
35
|
-
text: line
|
|
36
|
-
})))) : (textConfig = text.text, textLines = text);
|
|
37
|
-
const bound = (0, vrender_core_1.getRichTextBounds)({
|
|
38
|
-
wordBreak: null !== (_a = style.wordBreak) && void 0 !== _a ? _a : "break-word",
|
|
39
|
-
maxWidth: style.maxWidth ? style.maxWidth : void 0,
|
|
40
|
-
width: 0,
|
|
41
|
-
height: 0,
|
|
42
|
-
textConfig: textConfig
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
width: bound.width(),
|
|
46
|
-
height: bound.height(),
|
|
47
|
-
text: textLines
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
exports.measureTooltipText = measureTooltipText;
|
|
20
|
+
const formatContent = content => (0, vutils_1.isString)(content) && "" !== (null == content ? void 0 : content.trim()) || (0,
|
|
21
|
+
vutils_1.isNumber)(content) ? escapeHTML(content) : constants_1.TOOLTIP_EMPTY_STRING;
|
|
22
|
+
|
|
23
|
+
exports.formatContent = formatContent;
|
|
52
24
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/common.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AACtD,4CAAoD;AAOpD,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC;SACjB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;SACvB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC;AAPD,gCAOC;AAGM,MAAM,QAAQ,GAAG,CAAC,OAAoB,EAAE,kBAA4B,EAAE,EAAE;IAC7E,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,CAAC;KACV;IACD,IAAI,CAAC,kBAAkB,EAAE;QACvB,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;KACtD;IACD,IAAI,OAAO,CAAC,WAAW,GAAG,CAAC,EAAE;QAC3B,OAAO,kBAAkB,CAAC,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC;KACvD;IACD,OAAO,kBAAkB,CAAC,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;AAC1D,CAAC,CAAC;AAXW,QAAA,QAAQ,YAWnB;AAEK,MAAM,aAAa,GAAG,CAAC,OAAY,EAAE,EAAE;IAC5C,IAAI,CAAC,IAAA,iBAAQ,EAAC,OAAO,CAAC,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE,MAAK,EAAE,CAAC,IAAI,IAAA,iBAAQ,EAAC,OAAO,CAAC,EAAE;QACtE,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;KAC5B;IAED,OAAO,gCAAoB,CAAC;AAC9B,CAAC,CAAC;AANW,QAAA,aAAa,iBAMxB","file":"common.js","sourcesContent":["import { isString, isNumber } from '@visactor/vutils';\nimport { TOOLTIP_EMPTY_STRING } from '../constants';\n\n/**\n * Escape special HTML characters.\n *\n * @param value A value to convert to string and HTML-escape.\n */\nexport function escapeHTML(value: any): string {\n return String(value)\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\\(/g, '(')\n .replace(/ /g, ' '); // 转义符和真空格夹杂,在转义和正常换行之间取得平衡\n}\n\n/** 获取元素的绝对缩放因数(支持外部传入 boundingClientRect 提升性能) */\nexport const getScale = (element: HTMLElement, boundingClientRect?: DOMRect) => {\n if (!element) {\n return 1;\n }\n if (!boundingClientRect) {\n boundingClientRect = element.getBoundingClientRect();\n }\n if (element.offsetWidth > 0) {\n return boundingClientRect.width / element.offsetWidth;\n }\n return boundingClientRect.height / element.offsetHeight;\n};\n\nexport const formatContent = (content: any) => {\n if ((isString(content) && content?.trim() !== '') || isNumber(content)) {\n return escapeHTML(content);\n }\n\n return TOOLTIP_EMPTY_STRING;\n};\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';
|
|
2
|
+
export declare const getPixelPropertyStr: (num?: number | number[], defaultStr?: string) => string;
|
|
3
|
+
export declare const getTextStyle: (style?: ITooltipTextTheme) => Partial<CSSStyleDeclaration>;
|
|
4
|
+
export declare const getDomStyle: (spec?: ITooltipSpec) => {
|
|
5
|
+
panelPadding: number[];
|
|
6
|
+
row: Partial<CSSStyleDeclaration>;
|
|
7
|
+
panel: Partial<CSSStyleDeclaration>;
|
|
8
|
+
title: Partial<CSSStyleDeclaration>;
|
|
9
|
+
shape: Partial<CSSStyleDeclaration>;
|
|
10
|
+
key: Partial<CSSStyleDeclaration>;
|
|
11
|
+
value: Partial<CSSStyleDeclaration>;
|
|
12
|
+
};
|
|
13
|
+
export declare const getPanelStyle: (style: ITooltipTheme['panel']) => {
|
|
14
|
+
panelStyle: Partial<CSSStyleDeclaration>;
|
|
15
|
+
panelPadding?: number[];
|
|
16
|
+
};
|
|
17
|
+
export declare function setStyleToDom(dom: HTMLElement, style: Partial<CSSStyleDeclaration>): void;
|
|
18
|
+
export declare function cssToStyleString(style: Partial<CSSStyleDeclaration>): string;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.cssToStyleString = exports.setStyleToDom = exports.getPanelStyle = exports.getDomStyle = exports.getTextStyle = exports.getPixelPropertyStr = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), DEFAULT_SHAPE_SPACING = 8, DEFAULT_KEY_SPACING = 26, DEFAULT_VALUE_SPACING = 0, getPixelPropertyStr = (num, defaultStr) => (0,
|
|
8
|
+
vutils_1.isValid)(num) ? (0, vutils_1.isArray)(num) ? num.map((n => `${n}px`)).join(" ") : `${num}px` : null != defaultStr ? defaultStr : "initial";
|
|
9
|
+
|
|
10
|
+
exports.getPixelPropertyStr = getPixelPropertyStr;
|
|
11
|
+
|
|
12
|
+
const getTextStyle = (style = {}) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
return {
|
|
15
|
+
color: null !== (_a = style.fill) && void 0 !== _a ? _a : style.fontColor,
|
|
16
|
+
fontFamily: style.fontFamily,
|
|
17
|
+
fontSize: (0, exports.getPixelPropertyStr)(style.fontSize),
|
|
18
|
+
fontWeight: style.fontWeight,
|
|
19
|
+
textAlign: style.textAlign,
|
|
20
|
+
maxWidth: (0, exports.getPixelPropertyStr)(style.maxWidth),
|
|
21
|
+
whiteSpace: style.multiLine ? "initial" : "nowrap",
|
|
22
|
+
wordBreak: style.multiLine ? null !== (_b = style.wordBreak) && void 0 !== _b ? _b : "break-word" : "normal"
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.getTextStyle = getTextStyle;
|
|
27
|
+
|
|
28
|
+
const getDomStyle = (spec = {}) => {
|
|
29
|
+
var _a, _b, _c, _d, _e;
|
|
30
|
+
const {style: style = {}, enterable: enterable, transitionDuration: transitionDuration} = spec, {panel: panel = {}, titleLabel: titleLabel, shape: shape, keyLabel: keyLabel, valueLabel: valueLabel, spaceRow: commonSpaceRow, align: align} = style, {panelStyle: panelStyle, panelPadding: panelPadding} = (0,
|
|
31
|
+
exports.getPanelStyle)(panel), rowStyle = {
|
|
32
|
+
marginTop: "0px",
|
|
33
|
+
marginBottom: "0px"
|
|
34
|
+
};
|
|
35
|
+
panelStyle.pointerEvents = enterable ? "auto" : "none", transitionDuration && (panelStyle.transitionDuration = transitionDuration ? `${transitionDuration}ms` : "initial",
|
|
36
|
+
panelStyle.transitionProperty = transitionDuration ? "transform" : "initial", panelStyle.transitionTimingFunction = transitionDuration ? "ease-out" : "initial"),
|
|
37
|
+
(0, vutils_1.isValidNumber)(commonSpaceRow) && (rowStyle.marginBottom = `${commonSpaceRow}px`);
|
|
38
|
+
const shapeStyle = {
|
|
39
|
+
width: (0, exports.getPixelPropertyStr)(null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8)
|
|
40
|
+
}, titleStyle = (0, exports.getTextStyle)(titleLabel), keyStyle = (0, exports.getTextStyle)(keyLabel), valueStyle = (0,
|
|
41
|
+
exports.getTextStyle)(valueLabel), marginKey = "right" === align ? "marginLeft" : "marginRight";
|
|
42
|
+
"right" === align ? (panelStyle.direction = "rtl", titleStyle.textAlign = "right",
|
|
43
|
+
keyStyle.textAlign = "right", valueStyle.textAlign = "left") : (titleStyle.textAlign = "left",
|
|
44
|
+
keyStyle.textAlign = "left", valueStyle.textAlign = "right"), shapeStyle[marginKey] = (0,
|
|
45
|
+
exports.getPixelPropertyStr)(null !== (_b = shape.spacing) && void 0 !== _b ? _b : 8),
|
|
46
|
+
keyStyle[marginKey] = (0, exports.getPixelPropertyStr)(null !== (_c = keyLabel.spacing) && void 0 !== _c ? _c : 26),
|
|
47
|
+
valueStyle[marginKey] = (0, exports.getPixelPropertyStr)(null !== (_d = valueLabel.spacing) && void 0 !== _d ? _d : 0);
|
|
48
|
+
const lineHeight = null !== (_e = keyStyle.lineHeight) && void 0 !== _e ? _e : valueStyle.lineHeight;
|
|
49
|
+
return (0, vutils_1.isValid)(lineHeight) && (rowStyle.lineHeight = /^[0-9]*$/.test(`${lineHeight}`) ? `${lineHeight}px` : `${lineHeight}`),
|
|
50
|
+
{
|
|
51
|
+
panelPadding: panelPadding,
|
|
52
|
+
row: rowStyle,
|
|
53
|
+
panel: panelStyle,
|
|
54
|
+
title: titleStyle,
|
|
55
|
+
shape: shapeStyle,
|
|
56
|
+
key: keyStyle,
|
|
57
|
+
value: valueStyle
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.getDomStyle = getDomStyle;
|
|
62
|
+
|
|
63
|
+
const getPanelStyle = style => {
|
|
64
|
+
var _a;
|
|
65
|
+
const {backgroundColor: backgroundColor, border: border, shadow: shadow, padding: padding} = style, panelStyle = {
|
|
66
|
+
borderWidth: `${null !== (_a = null == border ? void 0 : border.width) && void 0 !== _a ? _a : 0}px`
|
|
67
|
+
};
|
|
68
|
+
let panelPadding = null;
|
|
69
|
+
(null == border ? void 0 : border.color) && (panelStyle.borderColor = border.color),
|
|
70
|
+
backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial";
|
|
71
|
+
const {radius: radius} = null != border ? border : {};
|
|
72
|
+
return (0, vutils_1.isValid)(radius) && (panelStyle.borderRadius = (0, vutils_1.isValidNumber)(radius) ? `${radius}px` : `${radius}`),
|
|
73
|
+
padding && (panelPadding = (0, vutils_1.normalizePadding)(padding), panelStyle.padding = (0,
|
|
74
|
+
exports.getPixelPropertyStr)(panelPadding)), {
|
|
75
|
+
panelStyle: panelStyle,
|
|
76
|
+
panelPadding: panelPadding
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
function setStyleToDom(dom, style) {
|
|
81
|
+
dom && dom.style && style && Object.keys(style).forEach((key => {
|
|
82
|
+
dom.style[key] = style[key];
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function cssToStyleString(style) {
|
|
87
|
+
let str = "";
|
|
88
|
+
return style && Object.keys(style).forEach((k => {
|
|
89
|
+
(0, vutils_1.isValid)(style[k]) && (str += `${(0, vutils_1.lowerCamelCaseToMiddle)(k)}:${style[k]};`);
|
|
90
|
+
})), str;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
exports.getPanelStyle = getPanelStyle, exports.setStyleToDom = setStyleToDom, exports.cssToStyleString = cssToStyleString;
|
|
94
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/style.ts"],"names":[],"mappings":";;;AAAA,6CAA6G;AAE7G,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,GAAuB,EAAE,UAAmB,EAAE,EAAE;IAClF,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC,EAAE;QAChB,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC,EAAE;YAChB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACzC;QACD,OAAO,GAAG,GAAG,IAAI,CAAC;KACnB;IACD,OAAO,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,SAAS,CAAC;AACjC,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AAEK,MAAM,YAAY,GAAG,CAAC,QAA2B,EAAE,EAAE,EAAE;;IAC5D,MAAM,SAAS,GAAiC;QAC9C,KAAK,EAAE,MAAA,KAAK,CAAC,IAA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AC7B,IAAI,IAAA,gBAAO,EAAE,KAAa,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC9B,GAAG,IAAI,GAAG,IAAA,+BAAsB,EAAC,CAAC,CAAC,IAAK,KAAa,CAAC,CAAC,CAAC,GAAG,CAAC;aAC7D;QACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC;AAXD,4CAWC","file":"style.js","sourcesContent":["import { isArray, isValid, isValidNumber, lowerCamelCaseToMiddle, normalizePadding } from '@visactor/vutils';\nimport type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';\nconst DEFAULT_SHAPE_SPACING = 8;\nconst DEFAULT_KEY_SPACING = 26;\nconst DEFAULT_VALUE_SPACING = 0;\n\nexport const getPixelPropertyStr = (num?: number | number[], defaultStr?: string) => {\n if (isValid(num)) {\n if (isArray(num)) {\n return num.map(n => `${n}px`).join(' ');\n }\n return `${num}px`;\n }\n return defaultStr ?? 'initial';\n};\n\nexport const getTextStyle = (style: ITooltipTextTheme = {}) => {\n const textStyle: Partial<CSSStyleDeclaration> = {\n color: style.fill ?? style.fontColor,\n fontFamily: style.fontFamily,\n fontSize: getPixelPropertyStr(style.fontSize as number),\n fontWeight: style.fontWeight as string,\n textAlign: style.textAlign,\n maxWidth: getPixelPropertyStr(style.maxWidth),\n whiteSpace: style.multiLine ? 'initial' : 'nowrap',\n wordBreak: style.multiLine ? style.wordBreak ?? 'break-word' : 'normal'\n };\n\n return textStyle;\n};\n\nexport const getDomStyle = (spec: ITooltipSpec = {}) => {\n const { style = {}, enterable, transitionDuration } = spec;\n const { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style;\n const { panelStyle, panelPadding } = getPanelStyle(panel);\n const rowStyle: Partial<CSSStyleDeclaration> = {\n marginTop: '0px',\n marginBottom: '0px'\n };\n\n panelStyle.pointerEvents = enterable ? 'auto' : 'none';\n if (transitionDuration) {\n panelStyle.transitionDuration = transitionDuration ? `${transitionDuration}ms` : 'initial';\n panelStyle.transitionProperty = transitionDuration ? 'transform' : 'initial';\n panelStyle.transitionTimingFunction = transitionDuration ? 'ease-out' : 'initial';\n }\n\n if (isValidNumber(commonSpaceRow)) {\n rowStyle.marginBottom = `${commonSpaceRow}px`;\n }\n\n const shapeStyle: Partial<CSSStyleDeclaration> = {\n // TODO 默认值优化\n width: getPixelPropertyStr(shape?.size ?? 8)\n };\n const titleStyle = getTextStyle(titleLabel);\n const keyStyle = getTextStyle(keyLabel);\n const valueStyle = getTextStyle(valueLabel);\n const marginKey = align === 'right' ? 'marginLeft' : 'marginRight';\n\n if (align === 'right') {\n // rtl\n panelStyle.direction = 'rtl';\n titleStyle.textAlign = 'right';\n keyStyle.textAlign = 'right';\n valueStyle.textAlign = 'left';\n } else {\n titleStyle.textAlign = 'left';\n keyStyle.textAlign = 'left';\n valueStyle.textAlign = 'right';\n }\n shapeStyle[marginKey] = getPixelPropertyStr(shape.spacing ?? DEFAULT_SHAPE_SPACING);\n keyStyle[marginKey] = getPixelPropertyStr(keyLabel.spacing ?? DEFAULT_KEY_SPACING);\n valueStyle[marginKey] = getPixelPropertyStr(valueLabel.spacing ?? DEFAULT_VALUE_SPACING);\n\n const lineHeight = keyStyle.lineHeight ?? valueStyle.lineHeight;\n\n if (isValid(lineHeight)) {\n rowStyle.lineHeight = /^[0-9]*$/.test(`${lineHeight}`) ? `${lineHeight}px` : `${lineHeight}`;\n }\n\n return {\n panelPadding,\n row: rowStyle,\n panel: panelStyle,\n title: titleStyle,\n shape: shapeStyle,\n key: keyStyle,\n value: valueStyle\n };\n};\n\nexport const getPanelStyle = (\n style: ITooltipTheme['panel']\n): { panelStyle: Partial<CSSStyleDeclaration>; panelPadding?: number[] } => {\n const { backgroundColor, border, shadow, padding } = style;\n const panelStyle: Partial<CSSStyleDeclaration> = {\n borderWidth: `${border?.width ?? 0}px`\n };\n let panelPadding: number[] = null;\n\n if (border?.color) {\n panelStyle.borderColor = border.color as string;\n }\n if (backgroundColor) {\n panelStyle.backgroundColor = backgroundColor as string;\n }\n panelStyle.boxShadow = shadow\n ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}`\n : 'initial';\n const { radius } = border ?? {};\n\n if (isValid(radius)) {\n panelStyle.borderRadius = isValidNumber(radius) ? `${radius}px` : `${radius}`;\n }\n\n if (padding) {\n panelPadding = normalizePadding(padding);\n panelStyle.padding = getPixelPropertyStr(panelPadding);\n }\n\n return { panelStyle, panelPadding };\n};\n\nexport function setStyleToDom(dom: HTMLElement, style: Partial<CSSStyleDeclaration>) {\n if (!dom || !dom.style || !style) {\n return;\n }\n\n Object.keys(style).forEach(key => {\n (dom.style as any)[key] = (style as any)[key];\n });\n}\n\nexport function cssToStyleString(style: Partial<CSSStyleDeclaration>) {\n let str = '';\n\n style &&\n Object.keys(style).forEach(k => {\n if (isValid((style as any)[k])) {\n str += `${lowerCamelCaseToMiddle(k)}:${(style as any)[k]};`;\n }\n });\n\n return str;\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.getSvgHtml = void 0;
|
|
6
|
+
|
|
7
|
+
const common_1 = require("./common"), vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils");
|
|
8
|
+
|
|
9
|
+
function getSvgHtml(option, index) {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
|
+
if (!option || !option.hasShape || !option.shapeType) return "";
|
|
12
|
+
const styleString = 'style="display:inline-block;vertical-align:middle;"', {shapeType: shapeType, shapeFill: shapeFill, shapeStroke: shapeStroke, shapeHollow: shapeHollow = !1} = option, size = null !== (_a = option.shapeSize) && void 0 !== _a ? _a : 8, lineWidth = option.shapeLineWidth ? (0,
|
|
13
|
+
common_1.escapeHTML)(option.shapeLineWidth) + "px" : "0px";
|
|
14
|
+
let fillString = "currentColor";
|
|
15
|
+
const getStroke = () => shapeStroke ? (0, common_1.escapeHTML)(shapeStroke) : fillString, sizeNumber = size, createSymbol = symbolType => new vrender_core_1.Symbol({
|
|
16
|
+
symbolType: symbolType,
|
|
17
|
+
size: sizeNumber,
|
|
18
|
+
fill: !0
|
|
19
|
+
});
|
|
20
|
+
let symbol = createSymbol(shapeType);
|
|
21
|
+
const parsedPath = symbol.getParsedPath();
|
|
22
|
+
let bounds, path;
|
|
23
|
+
if (!parsedPath.path && parsedPath.pathStr && (symbol = createSymbol(parsedPath.pathStr)),
|
|
24
|
+
symbol.getParsedPath().path) {
|
|
25
|
+
const pathModel = symbol.getParsedPath().path;
|
|
26
|
+
path = pathModel.toString(), bounds = pathModel.bounds;
|
|
27
|
+
} else parsedPath.isSvg && parsedPath.svgCache && (path = parsedPath.svgCache.map((s => s.path.toString())).join(),
|
|
28
|
+
bounds = parsedPath.svgCache.reduce(((acc, cur) => acc.union(cur.path.bounds)), new vutils_1.Bounds));
|
|
29
|
+
let viewBox = `${bounds.x1} ${bounds.y1} ${bounds.width()} ${bounds.height()}`;
|
|
30
|
+
if ("0px" !== lineWidth) {
|
|
31
|
+
const [x, y, w, h] = viewBox.split(" ").map((n => Number(n))), lw = Number(lineWidth.slice(0, -2));
|
|
32
|
+
viewBox = `${x - lw / 2} ${y - lw / 2} ${w + lw} ${h + lw}`;
|
|
33
|
+
}
|
|
34
|
+
if (!shapeFill || (0, vutils_1.isString)(shapeFill) || shapeHollow) return fillString = shapeHollow ? "none" : shapeFill ? (0,
|
|
35
|
+
common_1.escapeHTML)(shapeFill) : "currentColor", `\n <svg ${styleString} width="${size}" height="${size}" viewBox="${viewBox}">\n <path\n d="${path}"\n style="fill: ${fillString}; stroke: ${getStroke()}; stroke-width: ${lineWidth}"\n >\n </path>\n </svg>`;
|
|
36
|
+
if ((0, vutils_1.isObject)(shapeFill)) {
|
|
37
|
+
fillString = "gradientColor" + (null != index ? index : "");
|
|
38
|
+
let gradient = "";
|
|
39
|
+
const stops = (null !== (_b = shapeFill.stops) && void 0 !== _b ? _b : []).map((s => `<stop offset="${(0,
|
|
40
|
+
common_1.escapeHTML)(s.offset.toString())}" stop-color="${(0, common_1.escapeHTML)(s.color)}"/>`)).join("");
|
|
41
|
+
return "radial" === shapeFill.gradient ? gradient = `<radialGradient id="${fillString}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">\n ${stops}\n </radialGradient>` : "linear" === shapeFill.gradient && (gradient = `<linearGradient id="${fillString}" x1="${100 * (null !== (_c = shapeFill.x0) && void 0 !== _c ? _c : 0)}%" y1="${100 * (null !== (_d = shapeFill.y0) && void 0 !== _d ? _d : 0)}%" x2="${100 * (null !== (_e = shapeFill.x1) && void 0 !== _e ? _e : 0)}%" y2="${100 * (null !== (_f = shapeFill.y1) && void 0 !== _f ? _f : 0)}%">\n ${stops}\n </linearGradient>`),
|
|
42
|
+
`\n <svg ${styleString} width="${size}" height="${size}" viewBox="-0.5 -0.5 1 1">\n ${gradient}\n <path\n d="${path}"\n style="fill: url(#${fillString}); stroke: ${getStroke()}; stroke-width: ${lineWidth}"\n >\n </path>\n </svg>`;
|
|
43
|
+
}
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.getSvgHtml = getSvgHtml;
|
|
48
|
+
//# sourceMappingURL=svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/svg.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAGtC,yDAAgD;AAChD,6CAA8D;AAG9D,SAAgB,UAAU,CAAC,MAAuC,EAAE,KAAc;;IAChF,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;QACpD,OAAO,EAAE,CAAC;KACX;IAED,MAAM,WAAW,GAAG,qDAAqD,CAAC;IAC1E,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW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C;AAtFD,gCAsFC","file":"svg.js","sourcesContent":["import { escapeHTML } from './common';\n// eslint-disable-next-line no-duplicate-imports\nimport type { CustomSymbolClass, IGradientColor, ILinearGradient } from '@visactor/vrender-core';\nimport { Symbol } from '@visactor/vrender-core';\nimport { Bounds, isObject, isString } from '@visactor/vutils';\nimport type { ITooltipShapeActual } from '../../../../typings';\n\nexport function getSvgHtml(option: ITooltipShapeActual | undefined, index?: number) {\n if (!option || !option.hasShape || !option.shapeType) {\n return '';\n }\n\n const styleString = `style=\"display:inline-block;vertical-align:middle;\"`;\n const { shapeType, shapeFill, shapeStroke, shapeHollow = false } = option;\n const size = option.shapeSize ?? 8;\n const lineWidth = option.shapeLineWidth ? escapeHTML(option.shapeLineWidth) + 'px' : '0px';\n let fillString: string = 'currentColor';\n const getStroke = () => (shapeStroke ? escapeHTML(shapeStroke) : fillString);\n\n const sizeNumber = size;\n const createSymbol = (symbolType: string) => new Symbol({ symbolType, size: sizeNumber, fill: true });\n\n let symbol = createSymbol(shapeType);\n const parsedPath = symbol.getParsedPath();\n if (!parsedPath.path && parsedPath.pathStr) {\n symbol = createSymbol(parsedPath.pathStr);\n }\n\n let bounds;\n let path;\n if (symbol.getParsedPath().path) {\n const pathModel = symbol.getParsedPath().path;\n\n path = pathModel.toString();\n bounds = pathModel.bounds;\n } else if (parsedPath.isSvg && (parsedPath as unknown as CustomSymbolClass).svgCache) {\n path = (parsedPath as unknown as CustomSymbolClass).svgCache.map(s => s.path.toString()).join();\n bounds = (parsedPath as unknown as CustomSymbolClass).svgCache.reduce(\n (acc, cur) => acc.union(cur.path.bounds),\n new Bounds()\n );\n }\n let viewBox = `${bounds.x1} ${bounds.y1} ${bounds.width()} ${bounds.height()}`;\n\n // svg 不支持内描边,需要手动将描边空间预留在 viewBox 上\n if (lineWidth !== '0px') {\n const [x, y, w, h] = viewBox.split(' ').map(n => Number(n));\n const lw = Number(lineWidth.slice(0, -2));\n viewBox = `${x - lw / 2} ${y - lw / 2} ${w + lw} ${h + lw}`;\n }\n\n if (!shapeFill || isString(shapeFill) || shapeHollow) {\n fillString = shapeHollow ? 'none' : shapeFill ? escapeHTML(shapeFill) : 'currentColor';\n return `\n <svg ${styleString} width=\"${size}\" height=\"${size}\" viewBox=\"${viewBox}\">\n <path\n d=\"${path}\"\n style=\"fill: ${fillString}; stroke: ${getStroke()}; stroke-width: ${lineWidth}\"\n >\n </path>\n </svg>`;\n }\n if (isObject(shapeFill)) {\n fillString = 'gradientColor' + (index ?? '');\n let gradient = '';\n const stops = ((shapeFill as IGradientColor).stops ?? [])\n .map(s => `<stop offset=\"${escapeHTML(s.offset.toString())}\" stop-color=\"${escapeHTML(s.color)}\"/>`)\n .join('');\n if ((shapeFill as IGradientColor).gradient === 'radial') {\n gradient = `<radialGradient id=\"${fillString}\" cx=\"50%\" cy=\"50%\" r=\"50%\" fx=\"0%\" fy=\"0%\">\n ${stops}\n </radialGradient>`;\n } else if ((shapeFill as IGradientColor).gradient === 'linear') {\n gradient = `<linearGradient id=\"${fillString}\" x1=\"${\n (((shapeFill as ILinearGradient).x0 as number) ?? 0) * 100\n }%\" y1=\"${(((shapeFill as ILinearGradient).y0 as number) ?? 0) * 100}%\" x2=\"${\n (((shapeFill as ILinearGradient).x1 as number) ?? 0) * 100\n }%\" y2=\"${(((shapeFill as ILinearGradient).y1 as number) ?? 0) * 100}%\">\n ${stops}\n </linearGradient>`;\n }\n return `\n <svg ${styleString} width=\"${size}\" height=\"${size}\" viewBox=\"-0.5 -0.5 1 1\">\n ${gradient}\n <path\n d=\"${path}\"\n style=\"fill: url(#${fillString}); stroke: ${getStroke()}; stroke-width: ${lineWidth}\"\n >\n </path>\n </svg>`;\n }\n\n return '';\n}\n"]}
|
|
@@ -7,7 +7,7 @@ import { BaseModel } from '../../model/base-model';
|
|
|
7
7
|
import type { ISeriesOption, ISeries, ISeriesMarkInitOption, ISeriesStackData, ISeriesTooltipHelper, SeriesMarkMap, ISeriesMarkInfo, ISeriesSpecInfo, ISeriesStackDataLeaf, ISeriesStackDataMeta, ISeriesSeriesInfo } from '../interface';
|
|
8
8
|
import type { IModelEvaluateOption, IModelRenderOption, IUpdateSpecResult } from '../../model/interface';
|
|
9
9
|
import type { AddVChartPropertyContext } from '../../data/transforms/add-property';
|
|
10
|
-
import type { IBaseInteractionSpec } from '../../interaction/interface';
|
|
10
|
+
import type { IBaseInteractionSpec, IHoverSpec, ISelectSpec } from '../../interaction/interface';
|
|
11
11
|
import type { StatisticOperations } from '../../data/transforms/dimension-statistics';
|
|
12
12
|
import { SeriesData } from './series-data';
|
|
13
13
|
import type { IGroupMark } from '../../mark/group';
|
|
@@ -141,9 +141,6 @@ export declare abstract class BaseSeries<T extends ISeriesSpec> extends BaseMode
|
|
|
141
141
|
triggerOff: EventType;
|
|
142
142
|
blurState: STATE_VALUE_ENUM;
|
|
143
143
|
highlightState: STATE_VALUE_ENUM;
|
|
144
|
-
reverseState?: undefined;
|
|
145
|
-
state?: undefined;
|
|
146
|
-
isMultiple?: undefined;
|
|
147
144
|
} | {
|
|
148
145
|
type: string;
|
|
149
146
|
seriesId: number;
|
|
@@ -154,9 +151,28 @@ export declare abstract class BaseSeries<T extends ISeriesSpec> extends BaseMode
|
|
|
154
151
|
reverseState: STATE_VALUE_ENUM;
|
|
155
152
|
state: STATE_VALUE_ENUM;
|
|
156
153
|
isMultiple: boolean;
|
|
157
|
-
blurState?: undefined;
|
|
158
|
-
highlightState?: undefined;
|
|
159
154
|
})[];
|
|
155
|
+
protected _defaultHoverConfig(selector: string[], finalHoverSpec: IHoverSpec): {
|
|
156
|
+
seriesId: number;
|
|
157
|
+
regionId: number;
|
|
158
|
+
selector: string[];
|
|
159
|
+
type: string;
|
|
160
|
+
trigger: EventType;
|
|
161
|
+
triggerOff: EventType;
|
|
162
|
+
blurState: STATE_VALUE_ENUM;
|
|
163
|
+
highlightState: STATE_VALUE_ENUM;
|
|
164
|
+
};
|
|
165
|
+
protected _defaultSelectConfig(selector: string[], finalSelectSpec: ISelectSpec): {
|
|
166
|
+
type: string;
|
|
167
|
+
seriesId: number;
|
|
168
|
+
regionId: number;
|
|
169
|
+
selector: string[];
|
|
170
|
+
trigger: EventType;
|
|
171
|
+
triggerOff: EventType;
|
|
172
|
+
reverseState: STATE_VALUE_ENUM;
|
|
173
|
+
state: STATE_VALUE_ENUM;
|
|
174
|
+
isMultiple: boolean;
|
|
175
|
+
};
|
|
160
176
|
protected _parseInteractionConfig(mainMarks?: IMark[]): void;
|
|
161
177
|
initInteraction(): void;
|
|
162
178
|
initAnimation(): void;
|