@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/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,EAAE,IAAI,CAAC,SAAS;YAC1B,IAAI,EAAE,WAAW,CAAC,KAAK;YACvB,IAAI,EAAE,IAAI,CAAC,SAAS;YACpB,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,SAAS,EAAE,IAAI,CAAC,cAAc;YAC9B,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,KAAK;SACa,CAAC;IACvB,CAAC;CACF","file":"content-column-model.js","sourcesContent":["import { isNumber, isString, toNumber } from '@visactor/vutils';\nimport {\n defaultKeyStyle,\n defaultContentColumnStyle,\n defaultValueStyle,\n defaultAdaptiveKeyStyle,\n defaultShapeStyle\n} from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport type { ITooltipModelOption } from './interface';\nimport type { IShapeSvgOption } from './shape-model';\n// eslint-disable-next-line no-duplicate-imports\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\nimport { TOOLTIP_EMPTY_STRING } from '../../constants';\nimport { getPixelPropertyStr } from '../utils';\nimport type { ITooltipLineActual } from '../../../../../typings';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport type { TooltipRowAttrs } from '@visactor/vrender-components';\n\nexport type ContentColumnType = 'shape-box' | 'key-box' | 'value-box';\n\n/** 默认的标签样式,覆盖外界对这些属性的预先配置 */\nconst defaultLabelStyle: Partial<CSSStyleDeclaration> = {\n overflowWrap: 'normal',\n wordWrap: 'normal'\n};\n\nexport class ContentColumnModel extends BaseTooltipModel {\n readonly className: ContentColumnType;\n\n constructor(\n parent: BaseTooltipModel | HTMLElement,\n option: ITooltipModelOption,\n className: ContentColumnType,\n childIndex?: number\n ) {\n super(parent, option, childIndex);\n this.className = className;\n }\n\n init(): void {\n if (!this.product) {\n this.product = this.createElement('div', [this.className]);\n }\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n\n if (this.className === 'shape-box' && !renderContent.some(c => c.hasShape && c.shapeType)) {\n // 当有一行配有形状的时候,其他行要对齐。如果没有一行配有形状,则删除所有的行\n Object.keys(this.children).forEach(key => {\n const i = toNumber(key);\n this.children[i].release();\n delete this.children[i];\n });\n } else {\n // 删除多余的行\n Object.keys(this.children).forEach(key => {\n const i = toNumber(key);\n if (i >= renderContent.length) {\n this.children[i].release();\n delete this.children[i];\n }\n });\n // 新增没有的行\n for (let i = 0; i < renderContent.length; i++) {\n if (!this.children[i]) {\n if (this.className === 'key-box' || this.className === 'value-box') {\n const text = new TextModel(this.product!, this._option, i);\n text.init([this.className.substring(0, this.className.indexOf('-'))], undefined, 'div');\n this.children[i] = text;\n } else if (this.className === 'shape-box') {\n const shape = new ShapeModel(this.product!, this._option, i);\n shape.init(['shape'], undefined, 'div');\n this.children[i] = shape;\n }\n }\n }\n }\n }\n\n setStyle() {\n const tooltipStyle = this._option.getTooltipStyle();\n\n super.setStyle(mergeSpec({}, defaultContentColumnStyle, tooltipStyle.content, this._getContentColumnStyle()));\n\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];\n\n const getKeyItemStyle = (\n line: ITooltipLineActual,\n attrs: TooltipRowAttrs,\n i: number\n ): Partial<CSSStyleDeclaration> => {\n const { key, isKeyAdaptive } = line;\n const { height } = attrs;\n const { keyColumn } = tooltipStyle;\n const style: Partial<CSSStyleDeclaration> = mergeSpec(\n {},\n isKeyAdaptive ? defaultAdaptiveKeyStyle : defaultKeyStyle,\n {\n height: getPixelPropertyStr(height),\n ...defaultLabelStyle,\n ...keyColumn.common,\n ...keyColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>\n );\n const hasContent = (isString(key) && key?.trim?.() !== '') || isNumber(key);\n if (!hasContent && !style.visibility) {\n style.visibility = 'hidden';\n } else {\n style.visibility = 'visible';\n }\n return style;\n };\n\n const getValueItemStyle = (\n line: ITooltipLineActual,\n attrs: TooltipRowAttrs,\n i: number\n ): Partial<CSSStyleDeclaration> => {\n const { height } = attrs;\n const { valueColumn } = tooltipStyle;\n const style: Partial<CSSStyleDeclaration> = mergeSpec({}, defaultValueStyle, {\n height: getPixelPropertyStr(height),\n ...defaultLabelStyle,\n ...valueColumn.common,\n ...valueColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>);\n return style;\n };\n\n const getShapeItemStyle = (\n line: ITooltipLineActual,\n attrs: TooltipRowAttrs,\n i: number\n ): Partial<CSSStyleDeclaration> => {\n const { height } = attrs;\n const { shapeColumn } = tooltipStyle;\n const keyStyle = getKeyItemStyle(line, attrs, i);\n const paddingTop = `calc((${keyStyle.lineHeight ?? keyStyle.fontSize ?? '18px'} - ${\n shapeColumn.width ?? '8px'\n }) / 2)`; // shape 和 key 的第一行文字对齐\n const style: Partial<CSSStyleDeclaration> = mergeSpec({}, defaultShapeStyle, {\n height: getPixelPropertyStr(height),\n paddingTop,\n ...shapeColumn.common,\n ...shapeColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>);\n return style;\n };\n\n contentAttributes.forEach((attrs: TooltipRowAttrs, i: number) => {\n const line = renderContent[i];\n\n if (this.className === 'key-box') {\n (this.children[i] as TextModel).setStyle(getKeyItemStyle(line, attrs, i));\n } else if (this.className === 'value-box') {\n (this.children[i] as TextModel).setStyle(getValueItemStyle(line, attrs, i));\n } else if (this.className === 'shape-box') {\n (this.children[i] as ShapeModel)?.setStyle(getShapeItemStyle(line, attrs, i), this._getShapeSvgOption(line, i));\n }\n });\n }\n\n setContent(): void {\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];\n\n contentAttributes.forEach((attributes: TooltipRowAttrs, i: number) => {\n let childContent: any;\n const line = renderContent[i];\n if (this.className === 'key-box') {\n const keyContent = line.key;\n if ((isString(keyContent) && keyContent?.trim?.() !== '') || isNumber(keyContent)) {\n childContent = keyContent;\n } else {\n childContent = TOOLTIP_EMPTY_STRING;\n }\n (this.children[i] as TextModel)?.setContent(childContent, attributes.key?.multiLine);\n } else if (this.className === 'value-box') {\n const valueContent = line.value;\n if ((isString(valueContent) && valueContent?.trim?.() !== '') || isNumber(valueContent)) {\n childContent = valueContent;\n } else {\n childContent = TOOLTIP_EMPTY_STRING;\n }\n (this.children[i] as TextModel)?.setContent(childContent, attributes.value?.multiLine);\n } else if (this.className === 'shape-box') {\n childContent = this._getShapeSvgOption(line, i);\n this.children[i]?.setContent(childContent);\n }\n });\n }\n\n protected _getContentColumnStyle() {\n const tooltipStyle = this._option.getTooltipStyle();\n\n switch (this.className) {\n case 'shape-box':\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n return {\n ...tooltipStyle.shapeColumn,\n ...(this.className === 'shape-box' && !renderContent.some(c => c.hasShape && c.shapeType)\n ? { display: 'none' }\n : {})\n };\n case 'key-box':\n return tooltipStyle.keyColumn;\n case 'value-box':\n return tooltipStyle.valueColumn;\n }\n }\n\n protected _getShapeSvgOption(line: ITooltipLineActual, index: number): IShapeSvgOption {\n const tooltipStyle = this._option.getTooltipStyle();\n const shapeColumn = {\n ...tooltipStyle.shapeColumn,\n ...tooltipStyle.shapeColumn.items?.[index]\n };\n return {\n hasShape: line.hasShape,\n symbolType: line.shapeType,\n size: shapeColumn.width,\n fill: line.shapeFill,\n stroke: line.shapeStroke,\n lineWidth: line.shapeLineWidth,\n hollow: line.shapeHollow,\n index\n } as IShapeSvgOption;\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseTooltipModel } from './base-tooltip-model';
|
|
2
|
-
import { ContentColumnModel } from './content-column-model';
|
|
3
|
-
import type { Maybe } from '@visactor/vutils';
|
|
4
|
-
export declare class ContentModel extends BaseTooltipModel {
|
|
5
|
-
shapeBox: Maybe<ContentColumnModel>;
|
|
6
|
-
keyBox: Maybe<ContentColumnModel>;
|
|
7
|
-
valueBox: Maybe<ContentColumnModel>;
|
|
8
|
-
init(): void;
|
|
9
|
-
private _initBox;
|
|
10
|
-
setStyle(style?: Partial<CSSStyleDeclaration>): void;
|
|
11
|
-
setContent(): void;
|
|
12
|
-
protected _getContentContainerStyle(): Partial<CSSStyleDeclaration>;
|
|
13
|
-
release(): void;
|
|
14
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { BaseTooltipModel } from "./base-tooltip-model";
|
|
2
|
-
|
|
3
|
-
import { ContentColumnModel } from "./content-column-model";
|
|
4
|
-
|
|
5
|
-
import { isValid } from "@visactor/vutils";
|
|
6
|
-
|
|
7
|
-
import { mergeSpec } from "@visactor/vutils-extension";
|
|
8
|
-
|
|
9
|
-
import { getPixelPropertyStr, getScrollbarWidth, pixelPropertyStrToNumber } from "../utils";
|
|
10
|
-
|
|
11
|
-
export class ContentModel extends BaseTooltipModel {
|
|
12
|
-
init() {
|
|
13
|
-
this.product || (this.product = this.createElement("div", [ "container-box" ]));
|
|
14
|
-
const {align: align} = this._option.getTooltipAttributes();
|
|
15
|
-
"right" === align ? (this.valueBox || (this.valueBox = this._initBox("value-box", 0)),
|
|
16
|
-
this.keyBox || (this.keyBox = this._initBox("key-box", 1)), this.shapeBox || (this.shapeBox = this._initBox("shape-box", 2))) : (this.shapeBox || (this.shapeBox = this._initBox("shape-box", 0)),
|
|
17
|
-
this.keyBox || (this.keyBox = this._initBox("key-box", 1)), this.valueBox || (this.valueBox = this._initBox("value-box", 2)));
|
|
18
|
-
}
|
|
19
|
-
_initBox(className, index) {
|
|
20
|
-
const box = new ContentColumnModel(this.product, this._option, className, index);
|
|
21
|
-
return box.init(), this.children[box.childIndex] = box, box;
|
|
22
|
-
}
|
|
23
|
-
setStyle(style) {
|
|
24
|
-
super.setStyle(mergeSpec(this._getContentContainerStyle(), style)), Object.values(this.children).forEach((c => {
|
|
25
|
-
c.setStyle();
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
setContent() {
|
|
29
|
-
Object.values(this.children).forEach((c => {
|
|
30
|
-
c.setContent();
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
_getContentContainerStyle() {
|
|
34
|
-
const defaultStyle = {
|
|
35
|
-
whiteSpace: "nowrap",
|
|
36
|
-
lineHeight: "0px"
|
|
37
|
-
}, {panelDomHeight: panelDomHeight, panel: panelAttribute, maxContentHeight: maxContentHeight} = this._option.getTooltipAttributes();
|
|
38
|
-
if (isValid(maxContentHeight) && panelDomHeight < panelAttribute.height) {
|
|
39
|
-
const {shapeColumn: shapeColumn = {}, keyColumn: keyColumn = {}, valueColumn: valueColumn = {}, panel: panel = {}} = this._option.getTooltipStyle(), width = [ shapeColumn.width, shapeColumn.marginRight, keyColumn.width, keyColumn.marginRight, valueColumn.width, valueColumn.marginRight, panel.paddingRight ].reduce(((sum, cur) => sum + pixelPropertyStrToNumber(cur)), 0);
|
|
40
|
-
return Object.assign(Object.assign({}, defaultStyle), {
|
|
41
|
-
width: `${width + getScrollbarWidth(this._option.getContainer())}px`,
|
|
42
|
-
maxHeight: getPixelPropertyStr(maxContentHeight),
|
|
43
|
-
overflow: "auto"
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return defaultStyle;
|
|
47
|
-
}
|
|
48
|
-
release() {
|
|
49
|
-
super.release(), this.shapeBox = null, this.keyBox = null, this.valueBox = null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=content-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/content-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAE5F,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAKhD,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,C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AAK,CAAC,YAAY;aACnB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAW,wBAAwB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YACvE,uCACK,YAAY,KACf,KAAK,EAAE,GAAG,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,IAAI,EACpE,SAAS,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,EAChD,QAAQ,EAAE,MAAM,IAChB;SACH;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF","file":"content-model.js","sourcesContent":["import { BaseTooltipModel } from './base-tooltip-model';\nimport type { ContentColumnType } from './content-column-model';\nimport { ContentColumnModel } from './content-column-model';\nimport type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isValid } from '@visactor/vutils';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { getPixelPropertyStr, getScrollbarWidth, pixelPropertyStrToNumber } from '../utils';\n\nexport class ContentModel extends BaseTooltipModel {\n shapeBox: Maybe<ContentColumnModel>;\n keyBox: Maybe<ContentColumnModel>;\n valueBox: Maybe<ContentColumnModel>;\n\n init(): void {\n if (!this.product) {\n this.product = this.createElement('div', ['container-box']);\n }\n const { align } = this._option.getTooltipAttributes();\n if (align === 'right') {\n if (!this.valueBox) {\n this.valueBox = this._initBox('value-box', 0);\n }\n if (!this.keyBox) {\n this.keyBox = this._initBox('key-box', 1);\n }\n if (!this.shapeBox) {\n this.shapeBox = this._initBox('shape-box', 2);\n }\n } else {\n if (!this.shapeBox) {\n this.shapeBox = this._initBox('shape-box', 0);\n }\n if (!this.keyBox) {\n this.keyBox = this._initBox('key-box', 1);\n }\n if (!this.valueBox) {\n this.valueBox = this._initBox('value-box', 2);\n }\n }\n }\n\n private _initBox(className: ContentColumnType, index: number) {\n const box = new ContentColumnModel(this.product!, this._option, className, index);\n box.init();\n this.children[box.childIndex] = box;\n return box;\n }\n\n setStyle(style?: Partial<CSSStyleDeclaration>): void {\n super.setStyle(mergeSpec(this._getContentContainerStyle(), style));\n Object.values(this.children).forEach(c => {\n c.setStyle();\n });\n }\n\n setContent(): void {\n Object.values(this.children).forEach(c => {\n c.setContent();\n });\n }\n\n protected _getContentContainerStyle(): Partial<CSSStyleDeclaration> {\n const defaultStyle = {\n whiteSpace: 'nowrap',\n lineHeight: '0px'\n };\n\n const { panelDomHeight, panel: panelAttribute, maxContentHeight } = this._option.getTooltipAttributes();\n if (isValid(maxContentHeight) && panelDomHeight < panelAttribute.height) {\n const { shapeColumn = {}, keyColumn = {}, valueColumn = {}, panel = {} } = this._option.getTooltipStyle();\n const width = [\n shapeColumn.width,\n shapeColumn.marginRight,\n keyColumn.width,\n keyColumn.marginRight,\n valueColumn.width,\n valueColumn.marginRight,\n panel.paddingRight\n ].reduce((sum, cur) => sum + <number>pixelPropertyStrToNumber(cur), 0);\n return {\n ...defaultStyle,\n width: `${width + getScrollbarWidth(this._option.getContainer())}px`,\n maxHeight: getPixelPropertyStr(maxContentHeight),\n overflow: 'auto'\n };\n }\n return defaultStyle;\n }\n\n release(): void {\n super.release();\n this.shapeBox = null;\n this.keyBox = null;\n this.valueBox = null;\n }\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ITooltipActual, Maybe } from '../../../../../typings';
|
|
2
|
-
import type { IDomTooltipStyle } from '../interface';
|
|
3
|
-
import type { ITooltipAttributes } from '../../interface';
|
|
4
|
-
export interface ITooltipModelOption {
|
|
5
|
-
valueToHtml: (value: any) => string;
|
|
6
|
-
getTooltipStyle: () => IDomTooltipStyle;
|
|
7
|
-
getTooltipActual: () => Maybe<ITooltipActual>;
|
|
8
|
-
getTooltipAttributes: () => Maybe<ITooltipAttributes>;
|
|
9
|
-
getContainer: () => HTMLElement;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ITooltipActual, Maybe } from '../../../../../typings';\nimport type { IDomTooltipStyle } from '../interface';\nimport type { ITooltipAttributes } from '../../interface';\n\nexport interface ITooltipModelOption {\n valueToHtml: (value: any) => string;\n getTooltipStyle: () => IDomTooltipStyle;\n getTooltipActual: () => Maybe<ITooltipActual>;\n getTooltipAttributes: () => Maybe<ITooltipAttributes>;\n getContainer: () => HTMLElement;\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { IGradientColor } from '@visactor/vrender-core';
|
|
2
|
-
import type { ShapeType } from '../../../../../typings';
|
|
3
|
-
import { BaseTooltipModel } from './base-tooltip-model';
|
|
4
|
-
export interface IShapeSvgOption {
|
|
5
|
-
hasShape?: boolean;
|
|
6
|
-
symbolType?: ShapeType | string;
|
|
7
|
-
size?: string;
|
|
8
|
-
fill?: string | IGradientColor;
|
|
9
|
-
stroke?: string;
|
|
10
|
-
lineWidth?: number;
|
|
11
|
-
hollow?: boolean;
|
|
12
|
-
marginTop?: string;
|
|
13
|
-
index?: number;
|
|
14
|
-
}
|
|
15
|
-
export declare class ShapeModel extends BaseTooltipModel {
|
|
16
|
-
svg: SVGElement;
|
|
17
|
-
private _svgHtmlCache;
|
|
18
|
-
init(classList?: string[], id?: string, tag?: keyof HTMLElementTagNameMap): void;
|
|
19
|
-
setStyle(style?: Partial<CSSStyleDeclaration>, option?: IShapeSvgOption): void;
|
|
20
|
-
setContent(option: IShapeSvgOption): void;
|
|
21
|
-
setSvg(option?: IShapeSvgOption): void;
|
|
22
|
-
release(): void;
|
|
23
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Symbol } from "@visactor/vrender-core";
|
|
2
|
-
|
|
3
|
-
import { isObject, isString, Bounds } from "@visactor/vutils";
|
|
4
|
-
|
|
5
|
-
import { BaseTooltipModel } from "./base-tooltip-model";
|
|
6
|
-
|
|
7
|
-
import { pixelPropertyStrToNumber } from "../utils";
|
|
8
|
-
|
|
9
|
-
export class ShapeModel extends BaseTooltipModel {
|
|
10
|
-
init(classList, id, tag) {
|
|
11
|
-
if (!this.product) {
|
|
12
|
-
const container = this.createElement(null != tag ? tag : "div", [ ...null != classList ? classList : [], "shape" ], void 0, id);
|
|
13
|
-
this.product = container;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
setStyle(style, option) {
|
|
17
|
-
super.setStyle(style), this.setSvg(option);
|
|
18
|
-
}
|
|
19
|
-
setContent(option) {
|
|
20
|
-
this.setSvg(option);
|
|
21
|
-
}
|
|
22
|
-
setSvg(option) {
|
|
23
|
-
const html = getSvgHtml(option, this._option.valueToHtml);
|
|
24
|
-
this.product && html !== this._svgHtmlCache && (this._svgHtmlCache = html, this.product.innerHTML = html);
|
|
25
|
-
}
|
|
26
|
-
release() {
|
|
27
|
-
super.release(), this._svgHtmlCache = "";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function getSvgHtml(option, valueToHtml) {
|
|
32
|
-
var _a, _b, _c, _d, _e, _f;
|
|
33
|
-
if (!(null == option ? void 0 : option.hasShape) || !option.symbolType) return "";
|
|
34
|
-
const {symbolType: symbolType, fill: fill, stroke: stroke, hollow: hollow = !1} = option, size = option.size ? valueToHtml(option.size) : "8px", lineWidth = option.lineWidth ? valueToHtml(option.lineWidth) + "px" : "0px";
|
|
35
|
-
let fillString = "currentColor";
|
|
36
|
-
const getStroke = () => stroke ? valueToHtml(stroke) : fillString, sizeNumber = pixelPropertyStrToNumber(size), createSymbol = symbolType => new Symbol({
|
|
37
|
-
symbolType: symbolType,
|
|
38
|
-
size: sizeNumber,
|
|
39
|
-
fill: !0
|
|
40
|
-
});
|
|
41
|
-
let symbol = createSymbol(symbolType);
|
|
42
|
-
const parsedPath = symbol.getParsedPath();
|
|
43
|
-
let bounds, path;
|
|
44
|
-
if (!parsedPath.path && parsedPath.pathStr && (symbol = createSymbol(parsedPath.pathStr)),
|
|
45
|
-
symbol.getParsedPath().path) {
|
|
46
|
-
const pathModel = symbol.getParsedPath().path;
|
|
47
|
-
path = pathModel.toString(), bounds = pathModel.bounds;
|
|
48
|
-
} else parsedPath.isSvg && parsedPath.svgCache && (path = parsedPath.svgCache.map((s => s.path.toString())).join(),
|
|
49
|
-
bounds = parsedPath.svgCache.reduce(((acc, cur) => acc.union(cur.path.bounds)), new Bounds));
|
|
50
|
-
let viewBox = `${bounds.x1} ${bounds.y1} ${bounds.width()} ${bounds.height()}`;
|
|
51
|
-
if ("0px" !== lineWidth) {
|
|
52
|
-
const [x, y, w, h] = viewBox.split(" ").map((n => Number(n))), lw = Number(lineWidth.slice(0, -2));
|
|
53
|
-
viewBox = `${x - lw / 2} ${y - lw / 2} ${w + lw} ${h + lw}`;
|
|
54
|
-
}
|
|
55
|
-
if (!fill || isString(fill) || hollow) return fillString = hollow ? "none" : fill ? valueToHtml(fill) : "currentColor",
|
|
56
|
-
`\n <svg width="${size}" height="${size}" viewBox="${viewBox}"\n style="display: block;">\n <path\n d="${path}"\n style="fill: ${fillString}; stroke: ${getStroke()}; stroke-width: ${lineWidth}"\n >\n </path>\n </svg>`;
|
|
57
|
-
if (isObject(fill)) {
|
|
58
|
-
fillString = null !== (_a = "gradientColor" + option.index) && void 0 !== _a ? _a : "";
|
|
59
|
-
let gradient = "";
|
|
60
|
-
const stops = (null !== (_b = fill.stops) && void 0 !== _b ? _b : []).map((s => `<stop offset="${valueToHtml(s.offset.toString())}" stop-color="${valueToHtml(s.color)}"/>`)).join("");
|
|
61
|
-
return "radial" === fill.gradient ? gradient = `<radialGradient id="${fillString}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">\n ${stops}\n </radialGradient>` : "linear" === fill.gradient && (gradient = `<linearGradient id="${fillString}" x1="${100 * (null !== (_c = fill.x0) && void 0 !== _c ? _c : 0)}%" y1="${100 * (null !== (_d = fill.y0) && void 0 !== _d ? _d : 0)}%" x2="${100 * (null !== (_e = fill.x1) && void 0 !== _e ? _e : 0)}%" y2="${100 * (null !== (_f = fill.y1) && void 0 !== _f ? _f : 0)}%">\n ${stops}\n </linearGradient>`),
|
|
62
|
-
`\n <svg width="${size}" height="${size}" viewBox="-0.5 -0.5 1 1"\n style="display: block;">\n ${gradient}\n <path\n d="${path}"\n style="fill: url(#${fillString}); stroke: ${getStroke()}; stroke-width: ${lineWidth}"\n >\n </path>\n </svg>`;
|
|
63
|
-
}
|
|
64
|
-
return "";
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=shape-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/shape-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAcpD,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAK9C,IAAI,CAAC,SAAoB,EAAE,EAAW,EAAE,GAAiC;QACvE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,KAAK,EAAE,CAAC,GAAG,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YACnG,IAAI,CAAC,OAAO,GAAG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AC,KAAK,mCAAI,EAAE,CAAC;aAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,iBAAiB,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;aACrG,IAAI,CAAC,EAAE,CAAC,CAAC;QACZ,IAAK,IAAuB,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAClD,QAAQ,GAAG,uBAAuB,UAAU;QAC1C,KAAK;wBACW,CAAC;SACpB;aAAM,IAAK,IAAuB,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACzD,QAAQ,GAAG,uBAAuB,UAAU,SAC1C,CAAC,MAAE,IAAwB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GACpD,UAAU,CAAC,MAAE,IAAwB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GAAG,UAC7D,CAAC,MAAE,IAAwB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GACpD,UAAU,CAAC,MAAE,IAAwB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GAAG;QAC7D,KAAK;wBACW,CAAC;SACpB;QACD,OAAO;kBACO,IAAI,aAAa,IAAI;;QAE/B,QAAQ;;aAEH,IAAI;4BACW,UAAU,cAAc,SAAS,EAAE,mBAAmB,SAAS;;;WAGhF,CAAC;KACT;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","file":"shape-model.js","sourcesContent":["import type { CustomSymbolClass, IGradientColor, ILinearGradient } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { Symbol } from '@visactor/vrender-core';\n\nimport { isObject, isString, Bounds } from '@visactor/vutils';\nimport type { ShapeType } from '../../../../../typings';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { pixelPropertyStrToNumber } from '../utils';\n\nexport interface IShapeSvgOption {\n hasShape?: boolean;\n symbolType?: ShapeType | string;\n size?: string;\n fill?: string | IGradientColor;\n stroke?: string;\n lineWidth?: number;\n hollow?: boolean;\n marginTop?: string;\n index?: number;\n}\n\nexport class ShapeModel extends BaseTooltipModel {\n svg: SVGElement;\n\n private _svgHtmlCache: string;\n\n init(classList?: string[], id?: string, tag?: keyof HTMLElementTagNameMap): void {\n if (!this.product) {\n const container = this.createElement(tag ?? 'div', [...(classList ?? []), 'shape'], undefined, id);\n this.product = container;\n }\n }\n\n setStyle(style?: Partial<CSSStyleDeclaration>, option?: IShapeSvgOption): void {\n super.setStyle(style);\n this.setSvg(option);\n }\n\n setContent(option: IShapeSvgOption) {\n this.setSvg(option);\n }\n\n setSvg(option?: IShapeSvgOption) {\n const html = getSvgHtml(option, this._option.valueToHtml);\n if (this.product && html !== this._svgHtmlCache) {\n this._svgHtmlCache = html;\n this.product.innerHTML = html;\n }\n }\n\n release(): void {\n super.release();\n this._svgHtmlCache = '';\n }\n}\n\nfunction getSvgHtml(option: IShapeSvgOption | undefined, valueToHtml: (value: any) => string) {\n if (!option?.hasShape || !option.symbolType) {\n return '';\n }\n\n const { symbolType, fill, stroke, hollow = false } = option;\n const size = option.size ? valueToHtml(option.size) : '8px';\n const lineWidth = option.lineWidth ? valueToHtml(option.lineWidth) + 'px' : '0px';\n let fillString: string = 'currentColor';\n const getStroke = () => (stroke ? valueToHtml(stroke) : fillString);\n\n const sizeNumber = pixelPropertyStrToNumber(size) as number;\n const createSymbol = (symbolType: string) => new Symbol({ symbolType, size: sizeNumber, fill: true });\n\n let symbol = createSymbol(symbolType);\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 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\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 (!fill || isString(fill) || hollow) {\n fillString = hollow ? 'none' : fill ? valueToHtml(fill) : 'currentColor';\n return `\n <svg width=\"${size}\" height=\"${size}\" viewBox=\"${viewBox}\"\n style=\"display: block;\">\n <path\n d=\"${path}\"\n style=\"fill: ${fillString}; stroke: ${getStroke()}; stroke-width: ${lineWidth}\"\n >\n </path>\n </svg>`;\n }\n if (isObject(fill)) {\n fillString = 'gradientColor' + option.index ?? '';\n let gradient = '';\n const stops = (fill.stops ?? [])\n .map(s => `<stop offset=\"${valueToHtml(s.offset.toString())}\" stop-color=\"${valueToHtml(s.color)}\"/>`)\n .join('');\n if ((fill 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 ((fill as IGradientColor).gradient === 'linear') {\n gradient = `<linearGradient id=\"${fillString}\" x1=\"${\n (((fill as ILinearGradient).x0 as number) ?? 0) * 100\n }%\" y1=\"${(((fill as ILinearGradient).y0 as number) ?? 0) * 100}%\" x2=\"${\n (((fill as ILinearGradient).x1 as number) ?? 0) * 100\n }%\" y2=\"${(((fill as ILinearGradient).y1 as number) ?? 0) * 100}%\">\n ${stops}\n </linearGradient>`;\n }\n return `\n <svg width=\"${size}\" height=\"${size}\" viewBox=\"-0.5 -0.5 1 1\"\n style=\"display: block;\">\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"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const defaultH2Style: Partial<CSSStyleDeclaration>;
|
|
2
|
-
export declare const defaultContainerStyle: Partial<CSSStyleDeclaration>;
|
|
3
|
-
export declare const defaultContentColumnStyle: Partial<CSSStyleDeclaration>;
|
|
4
|
-
export declare const defaultKeyStyle: Partial<CSSStyleDeclaration>;
|
|
5
|
-
export declare const defaultAdaptiveKeyStyle: Partial<CSSStyleDeclaration>;
|
|
6
|
-
export declare const defaultValueStyle: Partial<CSSStyleDeclaration>;
|
|
7
|
-
export declare const defaultShapeStyle: Partial<CSSStyleDeclaration>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const defaultH2Style = {
|
|
2
|
-
fontSize: "13px",
|
|
3
|
-
marginBottom: "0px",
|
|
4
|
-
fontWeight: "normal"
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const defaultContainerStyle = {
|
|
8
|
-
boxSizing: "border-box"
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const defaultContentColumnStyle = {
|
|
12
|
-
display: "inline-block",
|
|
13
|
-
verticalAlign: "top"
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const defaultKeyStyle = {
|
|
17
|
-
paddingTop: "0px",
|
|
18
|
-
paddingBottom: "0px",
|
|
19
|
-
textAlign: "left",
|
|
20
|
-
fontWeight: "normal"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const defaultAdaptiveKeyStyle = {
|
|
24
|
-
paddingTop: "0px",
|
|
25
|
-
paddingBottom: "0px",
|
|
26
|
-
textAlign: "left",
|
|
27
|
-
fontWeight: "normal"
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const defaultValueStyle = {
|
|
31
|
-
paddingTop: "0px",
|
|
32
|
-
paddingBottom: "0px",
|
|
33
|
-
textAlign: "right",
|
|
34
|
-
fontWeight: "normal"
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const defaultShapeStyle = {
|
|
38
|
-
lineHeight: "normal",
|
|
39
|
-
boxSizing: "border-box"
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=style-constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/style-constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAiC;IAC1D,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAiC;IACjE,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAiC;IACrE,OAAO,EAAE,cAAc;IACvB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAiC;IAC3D,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IAGpB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IAEpB,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,YAAY;CACxB,CAAC","file":"style-constants.js","sourcesContent":["export const defaultH2Style: Partial<CSSStyleDeclaration> = {\n fontSize: '13px',\n marginBottom: '0px',\n fontWeight: 'normal'\n};\n\nexport const defaultContainerStyle: Partial<CSSStyleDeclaration> = {\n boxSizing: 'border-box'\n};\n\nexport const defaultContentColumnStyle: Partial<CSSStyleDeclaration> = {\n display: 'inline-block',\n verticalAlign: 'top'\n};\n\nexport const defaultKeyStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n // overflow: 'hidden',\n // textOverflow: 'ellipsis',\n textAlign: 'left',\n fontWeight: 'normal'\n};\n\nexport const defaultAdaptiveKeyStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n textAlign: 'left',\n fontWeight: 'normal'\n};\n\nexport const defaultValueStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n // overflow: 'hidden',\n textAlign: 'right',\n fontWeight: 'normal'\n};\n\nexport const defaultShapeStyle: Partial<CSSStyleDeclaration> = {\n lineHeight: 'normal',\n boxSizing: 'border-box'\n};\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseTooltipModel } from "./base-tooltip-model";
|
|
2
|
-
|
|
3
|
-
export class TextModel extends BaseTooltipModel {
|
|
4
|
-
init(classList, id, tag) {
|
|
5
|
-
this.product || (this.product = this.createElement(null != tag ? tag : "span", classList, void 0, id));
|
|
6
|
-
}
|
|
7
|
-
setContent(content, multiLine) {
|
|
8
|
-
if (!this.product) return;
|
|
9
|
-
let html = this._option.valueToHtml(content);
|
|
10
|
-
multiLine && (html = html.replaceAll("\n", "<br>")), html !== this.product.innerHTML && (this.product.innerHTML = html);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=text-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/text-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAC7C,IAAI,CAAC,SAAoB,EAAE,EAAW,EAAE,GAAiC;QACvE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;SAC5E;IACH,CAAC;IAED,UAAU,CAAC,OAAa,EAAE,SAAmB;QAC3C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;SACR;QACD,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,SAAS,EAAE;YACb,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SACtC;QACD,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACnC,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;SAC/B;IACH,CAAC;CACF","file":"text-model.js","sourcesContent":["import { BaseTooltipModel } from './base-tooltip-model';\n\nexport class TextModel extends BaseTooltipModel {\n init(classList?: string[], id?: string, tag?: keyof HTMLElementTagNameMap): void {\n if (!this.product) {\n this.product = this.createElement(tag ?? 'span', classList, undefined, id);\n }\n }\n\n setContent(content?: any, multiLine?: boolean): void {\n if (!this.product) {\n return;\n }\n let html = this._option.valueToHtml(content);\n if (multiLine) {\n html = html.replaceAll('\\n', '<br>');\n }\n if (html !== this.product.innerHTML) {\n this.product.innerHTML = html;\n }\n }\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Maybe } from '@visactor/vutils';
|
|
2
|
-
import { BaseTooltipModel } from './base-tooltip-model';
|
|
3
|
-
import { ShapeModel } from './shape-model';
|
|
4
|
-
import { TextModel } from './text-model';
|
|
5
|
-
export declare class TitleModel extends BaseTooltipModel {
|
|
6
|
-
shape: Maybe<ShapeModel>;
|
|
7
|
-
textSpan: Maybe<TextModel>;
|
|
8
|
-
init(): void;
|
|
9
|
-
private _initShape;
|
|
10
|
-
private _releaseShape;
|
|
11
|
-
private _initTextSpan;
|
|
12
|
-
setStyle(style?: Partial<CSSStyleDeclaration>): void;
|
|
13
|
-
setContent(): void;
|
|
14
|
-
release(): void;
|
|
15
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { defaultH2Style } from "./style-constants";
|
|
2
|
-
|
|
3
|
-
import { BaseTooltipModel } from "./base-tooltip-model";
|
|
4
|
-
|
|
5
|
-
import { ShapeModel } from "./shape-model";
|
|
6
|
-
|
|
7
|
-
import { TextModel } from "./text-model";
|
|
8
|
-
|
|
9
|
-
import { mergeSpec } from "@visactor/vutils-extension";
|
|
10
|
-
|
|
11
|
-
export class TitleModel extends BaseTooltipModel {
|
|
12
|
-
init() {
|
|
13
|
-
const tooltipActual = this._option.getTooltipActual();
|
|
14
|
-
this.product || (this.product = this.createElement("h2"));
|
|
15
|
-
const {align: align} = this._option.getTooltipAttributes();
|
|
16
|
-
"right" !== align || this.textSpan || this._initTextSpan(0);
|
|
17
|
-
const {title: title} = tooltipActual;
|
|
18
|
-
(null == title ? void 0 : title.hasShape) && (null == title ? void 0 : title.shapeType) ? this.shape || this._initShape("right" === align ? 1 : 0) : this.shape && this._releaseShape(),
|
|
19
|
-
"right" === align || this.textSpan || this._initTextSpan(1);
|
|
20
|
-
}
|
|
21
|
-
_initShape(index = 0) {
|
|
22
|
-
const shape = new ShapeModel(this.product, this._option, index);
|
|
23
|
-
shape.init(), this.shape = shape, this.children[shape.childIndex] = shape;
|
|
24
|
-
}
|
|
25
|
-
_releaseShape() {
|
|
26
|
-
this.shape && (this.shape.release(), delete this.children[this.shape.childIndex],
|
|
27
|
-
this.shape = null);
|
|
28
|
-
}
|
|
29
|
-
_initTextSpan(index = 1) {
|
|
30
|
-
const textSpan = new TextModel(this.product, this._option, index);
|
|
31
|
-
textSpan.init(), this.textSpan = textSpan, this.children[textSpan.childIndex] = textSpan;
|
|
32
|
-
}
|
|
33
|
-
setStyle(style) {
|
|
34
|
-
var _a, _b, _c, _d;
|
|
35
|
-
const tooltipStyle = this._option.getTooltipStyle(), tooltipActual = this._option.getTooltipActual(), {title: title} = tooltipActual;
|
|
36
|
-
super.setStyle(mergeSpec({}, defaultH2Style, tooltipStyle.title, style)), null === (_a = this.shape) || void 0 === _a || _a.setStyle({
|
|
37
|
-
paddingRight: null === (_b = tooltipStyle.shapeColumn.common) || void 0 === _b ? void 0 : _b.marginRight
|
|
38
|
-
}, {
|
|
39
|
-
hasShape: null == title ? void 0 : title.hasShape,
|
|
40
|
-
symbolType: null == title ? void 0 : title.shapeType,
|
|
41
|
-
size: null === (_c = tooltipStyle.shapeColumn.common) || void 0 === _c ? void 0 : _c.width,
|
|
42
|
-
fill: null == title ? void 0 : title.shapeFill,
|
|
43
|
-
hollow: null == title ? void 0 : title.shapeHollow
|
|
44
|
-
}), null === (_d = this.textSpan) || void 0 === _d || _d.setStyle({
|
|
45
|
-
color: "inherit"
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
setContent() {
|
|
49
|
-
var _a, _b, _c, _d, _e, _f;
|
|
50
|
-
const tooltipStyle = this._option.getTooltipStyle(), tooltipActual = this._option.getTooltipActual(), tooltipAttributes = this._option.getTooltipAttributes(), {title: title} = tooltipActual;
|
|
51
|
-
this.init(), null === (_a = this.shape) || void 0 === _a || _a.setStyle(void 0, {
|
|
52
|
-
hasShape: null == title ? void 0 : title.hasShape,
|
|
53
|
-
symbolType: null == title ? void 0 : title.shapeType,
|
|
54
|
-
size: null === (_b = tooltipStyle.shapeColumn.common) || void 0 === _b ? void 0 : _b.width,
|
|
55
|
-
fill: null == title ? void 0 : title.shapeFill,
|
|
56
|
-
hollow: null == title ? void 0 : title.shapeHollow
|
|
57
|
-
}), null === (_c = this.textSpan) || void 0 === _c || _c.setStyle({
|
|
58
|
-
color: "inherit"
|
|
59
|
-
}), null === (_d = this.textSpan) || void 0 === _d || _d.setContent(null == title ? void 0 : title.value, null === (_f = null === (_e = tooltipAttributes.title) || void 0 === _e ? void 0 : _e.value) || void 0 === _f ? void 0 : _f.multiLine);
|
|
60
|
-
}
|
|
61
|
-
release() {
|
|
62
|
-
super.release(), this.shape = null, this.textSpan = null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=title-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/title-model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAI9C,IAAI;QACF,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACzC;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAEtD,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACvC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;SACvB;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;QAChC,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAA,EAA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AAK,0CAAE,QAAQ,CAAC,SAAS,EAAE;YAC9B,QAAQ,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ;YACzB,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS;YAC5B,IAAI,EAAE,MAAA,YAAY,CAAC,WAAW,CAAC,MAAM,0CAAE,KAAK;YAC5C,IAAI,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS;YACtB,MAAM,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW;SAC3B,CAAC,CAAC;QACH,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,CAAC;YACtB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAAE,MAAA,MAAA,iBAAiB,CAAC,KAAK,0CAAE,KAAK,0CAAE,SAAS,CAAC,CAAC;IACrF,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF","file":"title-model.js","sourcesContent":["import type { Maybe } from '@visactor/vutils';\nimport { defaultH2Style } from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\nimport { mergeSpec } from '@visactor/vutils-extension';\n\nexport class TitleModel extends BaseTooltipModel {\n shape: Maybe<ShapeModel>;\n textSpan: Maybe<TextModel>;\n\n init(): void {\n const tooltipActual = this._option.getTooltipActual();\n\n if (!this.product) {\n this.product = this.createElement('h2');\n }\n const { align } = this._option.getTooltipAttributes();\n\n if (align === 'right' && !this.textSpan) {\n this._initTextSpan(0);\n }\n\n const { title } = tooltipActual;\n if (title?.hasShape && title?.shapeType) {\n if (!this.shape) {\n this._initShape(align === 'right' ? 1 : 0);\n }\n } else if (this.shape) {\n this._releaseShape();\n }\n\n if (align !== 'right' && !this.textSpan) {\n this._initTextSpan(1);\n }\n }\n\n private _initShape(index: number = 0) {\n const shape = new ShapeModel(this.product!, this._option, index);\n shape.init();\n this.shape = shape;\n this.children[shape.childIndex] = shape;\n }\n\n private _releaseShape() {\n if (!this.shape) {\n return;\n }\n this.shape.release();\n delete this.children[this.shape.childIndex];\n this.shape = null;\n }\n\n private _initTextSpan(index: number = 1) {\n const textSpan = new TextModel(this.product!, this._option, index);\n textSpan.init();\n this.textSpan = textSpan;\n this.children[textSpan.childIndex] = textSpan;\n }\n\n setStyle(style?: Partial<CSSStyleDeclaration>): void {\n const tooltipStyle = this._option.getTooltipStyle();\n const tooltipActual = this._option.getTooltipActual();\n\n const { title } = tooltipActual;\n super.setStyle(mergeSpec({}, defaultH2Style, tooltipStyle.title, style));\n\n this.shape?.setStyle(\n {\n paddingRight: tooltipStyle.shapeColumn.common?.marginRight\n },\n {\n hasShape: title?.hasShape,\n symbolType: title?.shapeType,\n size: tooltipStyle.shapeColumn.common?.width,\n fill: title?.shapeFill,\n hollow: title?.shapeHollow\n }\n );\n this.textSpan?.setStyle({\n color: 'inherit'\n });\n }\n\n setContent(): void {\n const tooltipStyle = this._option.getTooltipStyle();\n const tooltipActual = this._option.getTooltipActual();\n const tooltipAttributes = this._option.getTooltipAttributes();\n\n const { title } = tooltipActual;\n this.init();\n this.shape?.setStyle(undefined, {\n hasShape: title?.hasShape,\n symbolType: title?.shapeType,\n size: tooltipStyle.shapeColumn.common?.width,\n fill: title?.shapeFill,\n hollow: title?.shapeHollow\n });\n this.textSpan?.setStyle({\n color: 'inherit'\n });\n this.textSpan?.setContent(title?.value, tooltipAttributes.title?.value?.multiLine);\n }\n\n release(): void {\n super.release();\n this.shape = null;\n this.textSpan = null;\n }\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseTooltipModel } from './base-tooltip-model';
|
|
2
|
-
import { ContentModel } from './content-model';
|
|
3
|
-
import type { ITooltipModelOption } from './interface';
|
|
4
|
-
import { TitleModel } from './title-model';
|
|
5
|
-
export declare class TooltipModel extends BaseTooltipModel {
|
|
6
|
-
title: TitleModel | null;
|
|
7
|
-
content: ContentModel | null;
|
|
8
|
-
private _classList;
|
|
9
|
-
private _id;
|
|
10
|
-
constructor(option: ITooltipModelOption, classList: string[], id: string);
|
|
11
|
-
setVisibility(visibility: boolean): void;
|
|
12
|
-
init(): void;
|
|
13
|
-
private _initPanel;
|
|
14
|
-
private _initTitle;
|
|
15
|
-
private _releaseTitle;
|
|
16
|
-
private _initContent;
|
|
17
|
-
private _releaseContent;
|
|
18
|
-
setStyle(): void;
|
|
19
|
-
setContent(): void;
|
|
20
|
-
release(): void;
|
|
21
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { isValid } from "@visactor/vutils";
|
|
2
|
-
|
|
3
|
-
import { BaseTooltipModel } from "./base-tooltip-model";
|
|
4
|
-
|
|
5
|
-
import { ContentModel } from "./content-model";
|
|
6
|
-
|
|
7
|
-
import { TitleModel } from "./title-model";
|
|
8
|
-
|
|
9
|
-
import { defaultContainerStyle } from "./style-constants";
|
|
10
|
-
|
|
11
|
-
import { mergeSpec } from "@visactor/vutils-extension";
|
|
12
|
-
|
|
13
|
-
import { DEFAULT_TOOLTIP_Z_INDEX } from "../constant";
|
|
14
|
-
|
|
15
|
-
export class TooltipModel extends BaseTooltipModel {
|
|
16
|
-
constructor(option, classList, id) {
|
|
17
|
-
super(option.getContainer(), option, 0), this.title = null, this.content = null,
|
|
18
|
-
this._classList = classList, this._id = id;
|
|
19
|
-
}
|
|
20
|
-
setVisibility(visibility) {
|
|
21
|
-
if (super.setVisibility(visibility), !this.product) return;
|
|
22
|
-
const {classList: classList} = this.product;
|
|
23
|
-
visibility ? classList.add("visible") : classList.remove("visible");
|
|
24
|
-
}
|
|
25
|
-
init() {
|
|
26
|
-
var _a;
|
|
27
|
-
const tooltipActual = this._option.getTooltipActual();
|
|
28
|
-
this.product || this._initPanel(this._classList, this._id);
|
|
29
|
-
const {title: title} = tooltipActual;
|
|
30
|
-
!1 !== (null == title ? void 0 : title.visible) && isValid(null == title ? void 0 : title.value) ? this.title || this._initTitle() : this.title && this._releaseTitle();
|
|
31
|
-
(null !== (_a = tooltipActual.content) && void 0 !== _a ? _a : []).length > 0 ? this.content || this._initContent() : this.content && this._releaseContent();
|
|
32
|
-
}
|
|
33
|
-
_initPanel(classList, id) {
|
|
34
|
-
const panel = this.createElement("div", classList, {
|
|
35
|
-
left: "0",
|
|
36
|
-
top: "0",
|
|
37
|
-
pointerEvents: "none",
|
|
38
|
-
padding: "12px",
|
|
39
|
-
position: "absolute",
|
|
40
|
-
zIndex: DEFAULT_TOOLTIP_Z_INDEX,
|
|
41
|
-
fontFamily: "sans-serif",
|
|
42
|
-
fontSize: "11px",
|
|
43
|
-
borderRadius: "3px",
|
|
44
|
-
borderStyle: "solid",
|
|
45
|
-
lineHeight: "initial",
|
|
46
|
-
background: "#fff",
|
|
47
|
-
boxShadow: "2px 2px 4px rgba(0, 0, 0, 0.1)",
|
|
48
|
-
maxWidth: "100wh",
|
|
49
|
-
maxHeight: "100vh"
|
|
50
|
-
}, id);
|
|
51
|
-
this.product = panel;
|
|
52
|
-
}
|
|
53
|
-
_initTitle() {
|
|
54
|
-
const title = new TitleModel(this.product, this._option, 0);
|
|
55
|
-
title.init(), this.title = title, this.children[title.childIndex] = title;
|
|
56
|
-
}
|
|
57
|
-
_releaseTitle() {
|
|
58
|
-
this.title && (this.title.release(), delete this.children[this.title.childIndex],
|
|
59
|
-
this.title = null);
|
|
60
|
-
}
|
|
61
|
-
_initContent() {
|
|
62
|
-
const content = new ContentModel(this.product, this._option, 1);
|
|
63
|
-
content.init(), this.content = content, this.children[content.childIndex] = content;
|
|
64
|
-
}
|
|
65
|
-
_releaseContent() {
|
|
66
|
-
this.content && (this.content.release(), delete this.children[this.content.childIndex],
|
|
67
|
-
this.content = null);
|
|
68
|
-
}
|
|
69
|
-
setStyle() {
|
|
70
|
-
const tooltipStyle = this._option.getTooltipStyle();
|
|
71
|
-
super.setStyle(mergeSpec({}, defaultContainerStyle, tooltipStyle.panel)), Object.values(this.children).forEach((c => c.setStyle()));
|
|
72
|
-
}
|
|
73
|
-
setContent() {
|
|
74
|
-
Object.values(this.children).forEach((c => {
|
|
75
|
-
c.setContent();
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
release() {
|
|
79
|
-
super.release(), this.title = null, this.content = null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=tooltip-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/tooltip-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAOhD,YAAY,MAA2B,EAAE,SAAmB,EAAE,EAAU;QACtE,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAP1C,UAAK,GAAsB,IAAI,CAAC;QAChC,YAAO,GAAwB,IAAI,CAAC;QAOlC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,aAAa,CAAC,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AO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;IAC9C,CAAC;IAEO,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,QAAQ;QACN,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;QACpD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,qBAAqB,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QACzE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,UAAU;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACvC,CAAC,CAAC,UAAU,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF","file":"tooltip-model.js","sourcesContent":["import { isValid } from '@visactor/vutils';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ContentModel } from './content-model';\nimport type { ITooltipModelOption } from './interface';\nimport { TitleModel } from './title-model';\nimport { defaultContainerStyle } from './style-constants';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { DEFAULT_TOOLTIP_Z_INDEX } from '../constant';\n\nexport class TooltipModel extends BaseTooltipModel {\n title: TitleModel | null = null;\n content: ContentModel | null = null;\n\n private _classList: string[];\n private _id: string;\n\n constructor(option: ITooltipModelOption, classList: string[], id: string) {\n super(option.getContainer(), option, 0);\n this._classList = classList;\n this._id = id;\n }\n\n setVisibility(visibility: boolean) {\n super.setVisibility(visibility);\n if (!this.product) {\n return;\n }\n const { classList } = this.product;\n if (visibility) {\n classList.add('visible');\n } else {\n classList.remove('visible');\n }\n }\n\n init(): void {\n const tooltipActual = this._option.getTooltipActual();\n\n if (!this.product) {\n this._initPanel(this._classList, this._id);\n }\n\n const { title } = tooltipActual;\n if (title?.visible !== false && isValid(title?.value)) {\n if (!this.title) {\n this._initTitle();\n }\n } else if (this.title) {\n this._releaseTitle();\n }\n\n const renderContent = tooltipActual.content ?? [];\n if (renderContent.length > 0) {\n if (!this.content) {\n this._initContent();\n }\n } else if (this.content) {\n this._releaseContent();\n }\n }\n\n private _initPanel(classList?: string[], id?: string) {\n const panel = this.createElement(\n 'div',\n classList,\n {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: DEFAULT_TOOLTIP_Z_INDEX,\n fontFamily: 'sans-serif',\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh'\n },\n id\n );\n this.product = panel;\n }\n\n private _initTitle() {\n const title = new TitleModel(this.product!, this._option, 0);\n title.init();\n this.title = title;\n this.children[title.childIndex] = title;\n }\n\n private _releaseTitle() {\n if (!this.title) {\n return;\n }\n this.title.release();\n delete this.children[this.title.childIndex];\n this.title = null;\n }\n\n private _initContent() {\n const content = new ContentModel(this.product!, this._option, 1);\n content.init();\n this.content = content;\n this.children[content.childIndex] = content;\n }\n\n private _releaseContent() {\n if (!this.content) {\n return;\n }\n this.content.release();\n delete this.children[this.content.childIndex];\n this.content = null;\n }\n\n setStyle(): void {\n const tooltipStyle = this._option.getTooltipStyle();\n super.setStyle(mergeSpec({}, defaultContainerStyle, tooltipStyle.panel));\n Object.values(this.children).forEach(c => c.setStyle());\n }\n\n setContent() {\n Object.values(this.children).forEach(c => {\n c.setContent();\n });\n }\n\n release(): void {\n super.release();\n this.title = null;\n this.content = null;\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { isArray, isNil, isValid } from "@visactor/vutils";
|
|
2
|
-
|
|
3
|
-
export const getPixelPropertyStr = (num, defaultStr) => isValid(num) ? isArray(num) ? num.map((n => `${n}px`)).join(" ") : `${num}px` : null != defaultStr ? defaultStr : "initial";
|
|
4
|
-
|
|
5
|
-
export const pixelPropertyStrToNumber = str => {
|
|
6
|
-
const numArr = str.split(" ").map((n => Number.isNaN(n) ? Number.parseFloat(n.substring(0, n.length - 2)) : Number.parseFloat(n)));
|
|
7
|
-
return 1 === numArr.length ? numArr[0] : numArr;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
let cacheScrollbarWidth;
|
|
11
|
-
|
|
12
|
-
export const getScrollbarWidth = (container = document.body) => {
|
|
13
|
-
if (isNil(cacheScrollbarWidth)) {
|
|
14
|
-
const outer = document.createElement("div");
|
|
15
|
-
outer.style.visibility = "hidden", outer.style.overflow = "scroll", container.appendChild(outer);
|
|
16
|
-
const inner = document.createElement("div");
|
|
17
|
-
outer.appendChild(inner), cacheScrollbarWidth = outer.offsetWidth - inner.offsetWidth,
|
|
18
|
-
outer.parentNode.removeChild(outer);
|
|
19
|
-
}
|
|
20
|
-
return cacheScrollbarWidth;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=common.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MA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AC,KAAK,CAAC,CAAC;QAC5C,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;QAClC,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAChC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC5C,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzB,mBAAmB,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAC5D,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KACrC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC","file":"common.js","sourcesContent":["import { isArray, isNil, isValid } from '@visactor/vutils';\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 pixelPropertyStrToNumber = (str: string): number | number[] => {\n const strArr = str.split(' ');\n const numArr = strArr.map(n => {\n if (!Number.isNaN(n)) {\n return Number.parseFloat(n);\n }\n return Number.parseFloat(n.substring(0, n.length - 2));\n });\n if (numArr.length === 1) {\n return numArr[0];\n }\n return numArr;\n};\n\nlet cacheScrollbarWidth: number | undefined;\nexport const getScrollbarWidth = (container = document.body) => {\n if (isNil(cacheScrollbarWidth)) {\n const outer = document.createElement('div');\n outer.style.visibility = 'hidden';\n outer.style.overflow = 'scroll';\n container.appendChild(outer);\n const inner = document.createElement('div');\n outer.appendChild(inner);\n cacheScrollbarWidth = outer.offsetWidth - inner.offsetWidth;\n outer.parentNode.removeChild(outer);\n }\n return cacheScrollbarWidth;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC","file":"index.js","sourcesContent":["export * from './common';\nexport * from './style';\n"]}
|