Compare commits
No commits in common. "master" and "V2.8.3-alpha" have entirely different histories.
master
...
V2.8.3-alp
88
CHANGELOG.md
88
CHANGELOG.md
|
@ -1,89 +1,3 @@
|
|||
# 2.10.0-alpha (2020-09-09)
|
||||
|
||||
### New
|
||||
|
||||
- **decoration12:** New decoration(Radar scan).
|
||||
|
||||
### Optmization
|
||||
|
||||
- **decoration** add `dur` configuration.
|
||||
- **activeRingChart** add `digitalFlopUnit` configuration.
|
||||
|
||||
# 2.9.9-alpha (2020-08-25)
|
||||
|
||||
### Optmization
|
||||
|
||||
- **borderBox:** Canonical class name.
|
||||
- **autoResize(mixin):** Add exception prompt.
|
||||
|
||||
# 2.9.8-alpha (2020-08-20)
|
||||
|
||||
### Optmization
|
||||
|
||||
- **scrollRankingBoard:** Add value formatter.
|
||||
|
||||
# 2.9.7-alpha (2020-08-19)
|
||||
|
||||
### Optmization
|
||||
|
||||
- **scrollBoard:** Optimize the update effect of updateRows.
|
||||
|
||||
# 2.9.6-alpha (2020-08-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **scrollBoard:** Carousel is abnormal when carousel is page.
|
||||
- **scrollRankingBoard:** Carousel is abnormal when carousel is page.
|
||||
|
||||
# 2.9.5-alpha (2020-08-05)
|
||||
|
||||
### Optmization
|
||||
|
||||
- **scrollBoard:** Reduce redundant node rendering.
|
||||
- **scrollRankingBoard:** Reduce redundant node rendering.
|
||||
- **scrollBoard:** Add api to update row data.
|
||||
|
||||
# 2.9.4-alpha (2020-07-03)
|
||||
|
||||
### Optmization
|
||||
|
||||
- **scrollBoard:** Optimize key value [(#8)](https://github.com/DataV-Team/DataV-React/issues/8).
|
||||
|
||||
# 2.9.3-alpha (2020-07-02)
|
||||
|
||||
### Perfect
|
||||
|
||||
- **uuid:** Optimization of `-` in uuid will cause abnormal svg animation [(#108)](https://github.com/DataV-Team/DataV/issues/108).
|
||||
|
||||
# 2.9.2-alpha (2020-06-16)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **scrollBoard:** reset animationIndex when config upate.
|
||||
|
||||
# 2.9.1-alpha (2020-06-16)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **scrollRankingBoard:** Calculation optimization of negative values [(#101)](https://github.com/DataV-Team/DataV/pull/101).
|
||||
|
||||
### Perfect
|
||||
|
||||
- **digitalFlop:** add number formatter.
|
||||
|
||||
# 2.9.0-alpha (2020-06-10)
|
||||
|
||||
### ScrollBoard
|
||||
|
||||
- **hoverPause:** add `hoverPause` configuration [(#96)](https://github.com/DataV-Team/DataV/pull/96).
|
||||
- **mouseover:** add `mouseover` event [(#96)](https://github.com/DataV-Team/DataV/pull/96).
|
||||
|
||||
# 2.8.4-alpha (2020-05-25)
|
||||
|
||||
### Perfect
|
||||
|
||||
- **uuid:** Use uuid to produce unique id.
|
||||
|
||||
# 2.8.3-alpha (2020-05-06)
|
||||
|
||||
### Perfect
|
||||
|
@ -169,7 +83,7 @@
|
|||
|
||||
# 2.4.7-alpha (2019-10-24)
|
||||
|
||||
### Perfect
|
||||
### perfect
|
||||
|
||||
- **charts:** Optimize memory leaks.
|
||||
- **digitalFlop:** Optimize memory leaks.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -83,11 +83,6 @@ export default {
|
|||
* @type {Number}
|
||||
*/
|
||||
digitalFlopToFixed: 0,
|
||||
/**
|
||||
* @description Digital flop unit
|
||||
* @type {String}
|
||||
*/
|
||||
digitalFlopUnit: '',
|
||||
/**
|
||||
* @description CRender animationCurve
|
||||
* @type {String}
|
||||
|
@ -127,8 +122,7 @@ export default {
|
|||
digitalFlopStyle,
|
||||
digitalFlopToFixed,
|
||||
data,
|
||||
showOriginValue,
|
||||
digitalFlopUnit
|
||||
showOriginValue
|
||||
} = mergedConfig
|
||||
|
||||
const value = data.map(({ value }) => value)
|
||||
|
@ -146,7 +140,7 @@ export default {
|
|||
}
|
||||
|
||||
return {
|
||||
content: showOriginValue ? `{nt}${digitalFlopUnit}` : `{nt}${digitalFlopUnit || '%'}`,
|
||||
content: showOriginValue ? '{nt}' : '{nt}%',
|
||||
number: [displayValue],
|
||||
style: digitalFlopStyle,
|
||||
toFixed: digitalFlopToFixed
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
height: 100%;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.dv-border-box-10 .dv-border-svg-container {
|
||||
.dv-border-box-10 .border {
|
||||
position: absolute;
|
||||
display: block;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-10" :ref="ref" :style="`box-shadow: inset 0 0 25px 3px ${mergedColor[0]}`">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="border" :width="width" :height="height">
|
||||
<polygon :fill="backgroundColor" :points="`
|
||||
4, 0 ${width - 4}, 0 ${width}, 4 ${width}, ${height - 4} ${width - 4}, ${height}
|
||||
4, ${height} 0, ${height - 4} 0, 4
|
||||
|
@ -12,7 +12,7 @@
|
|||
height="150px"
|
||||
:key="item"
|
||||
v-for="item in border"
|
||||
:class="`${item} dv-border-svg-container`"
|
||||
:class="`${item} border`"
|
||||
>
|
||||
<polygon
|
||||
:fill="mergedColor[1]"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
.dv-border-box-11 .dv-border-svg-container > polyline {
|
||||
.dv-border-box-11 .dv-border-svg-container polyline {
|
||||
fill: none;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
|
|
@ -216,7 +216,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -246,10 +245,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'border-box-11',
|
||||
filterId: `border-box-11-filterId-${id}`,
|
||||
filterId: `border-box-11-filterId-${timestamp}`,
|
||||
|
||||
defaultColor: ['#8aaafb', '#1f33a2'],
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -114,10 +113,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = +new Date()
|
||||
return {
|
||||
ref: 'border-box-12',
|
||||
filterId: `borderr-box-12-filterId-${id}`,
|
||||
filterId: `borderr-box-12-filterId-${timestamp}`,
|
||||
|
||||
defaultColor: ['#2e6099', '#7ce7fd'],
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = +new Date()
|
||||
return {
|
||||
ref: 'border-box-13',
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
.dv-border-box-2 .dv-border-svg-container > polyline {
|
||||
.dv-border-box-2 .dv-border-svg-container polyline {
|
||||
fill: none;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
.dv-border-box-3 .dv-border-svg-container > polyline {
|
||||
.dv-border-box-3 .dv-border-svg-container polyline {
|
||||
fill: none;
|
||||
}
|
||||
.dv-border-box-3 .dv-bb3-line1 {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
.dv-border-box-4 .dv-border-svg-container > polyline {
|
||||
.dv-border-box-4 .dv-border-svg-container polyline {
|
||||
fill: none;
|
||||
}
|
||||
.dv-border-box-4 .sw1 {
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
.dv-border-box-5 .dv-reverse {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.dv-border-box-5 .dv-border-svg-container {
|
||||
.dv-border-box-5 .dv-svg-container {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dv-border-box-5 .dv-border-svg-container > polyline {
|
||||
.dv-border-box-5 .dv-svg-container polyline {
|
||||
fill: none;
|
||||
}
|
||||
.dv-border-box-5 .dv-bb5-line-1,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-5" :ref="ref">
|
||||
<svg :class="`dv-border-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||
<svg :class="`dv-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||
<polygon :fill="backgroundColor" :points="`
|
||||
10, 22 ${width - 22}, 22 ${width - 22}, ${height - 86} ${width - 84}, ${height - 24} 10, ${height - 24}
|
||||
`" />
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dv-border-box-6 .dv-border-svg-container {
|
||||
.dv-border-box-6 .dv-svg-container {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dv-border-box-6 .dv-border-svg-container > polyline {
|
||||
.dv-border-box-6 .dv-svg-container polyline {
|
||||
fill: none;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-6" :ref="ref">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<polygon :fill="backgroundColor" :points="`
|
||||
9, 7 ${width - 9}, 7 ${width - 9}, ${height - 7} 9, ${height - 7}
|
||||
`" />
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dv-border-box-7 .dv-border-svg-container {
|
||||
.dv-border-box-7 .dv-svg-container {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dv-border-box-7 .dv-border-svg-container > polyline {
|
||||
.dv-border-box-7 .dv-svg-container polyline {
|
||||
fill: none;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:style="`box-shadow: inset 0 0 40px ${mergedColor[0]}; border: 1px solid ${mergedColor[0]}; background-color: ${backgroundColor}`"
|
||||
:ref="ref"
|
||||
>
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<polyline class="dv-bb7-line-width-2" :stroke="mergedColor[0]" :points="`0, 25 0, 0 25, 0`" />
|
||||
<polyline class="dv-bb7-line-width-2" :stroke="mergedColor[0]" :points="`${width - 25}, 0 ${width}, 0 ${width}, 25`" />
|
||||
<polyline class="dv-bb7-line-width-2" :stroke="mergedColor[0]" :points="`${width - 25}, ${height} ${width}, ${height} ${width}, ${height - 25}`" />
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dv-border-box-8 .dv-border-svg-container {
|
||||
.dv-border-box-8 svg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-8" :ref="ref">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<defs>
|
||||
<path
|
||||
:id="path"
|
||||
|
@ -65,7 +65,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -93,12 +92,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'border-box-8',
|
||||
path: `border-box-8-path-${id}`,
|
||||
gradient: `border-box-8-gradient-${id}`,
|
||||
mask: `border-box-8-mask-${id}`,
|
||||
path: `border-box-8-path-${timestamp}`,
|
||||
gradient: `border-box-8-gradient-${timestamp}`,
|
||||
mask: `border-box-8-mask-${timestamp}`,
|
||||
|
||||
defaultColor: ['#235fa7', '#4fd2dd'],
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dv-border-box-9 .dv-border-svg-container {
|
||||
.dv-border-box-9 svg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-9" :ref="ref">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<defs>
|
||||
<linearGradient :id="gradientId" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<animate
|
||||
|
@ -125,7 +125,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -145,12 +144,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'border-box-9',
|
||||
|
||||
gradientId: `border-box-9-gradient-${id}`,
|
||||
maskId: `border-box-9-mask-${id}`,
|
||||
gradientId: `border-box-9-gradient-${timestamp}`,
|
||||
maskId: `border-box-9-mask-${timestamp}`,
|
||||
|
||||
defaultColor: ['#11eefd', '#0078d2'],
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
import Charts from '@jiaminghi/charts'
|
||||
|
@ -21,10 +19,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: `charts-container-${id}`,
|
||||
chartRef: `chart-${id}`,
|
||||
ref: `charts-container-${timestamp}`,
|
||||
chartRef: `chart-${timestamp}`,
|
||||
|
||||
chart: null
|
||||
}
|
||||
|
|
|
@ -147,7 +147,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -163,17 +162,17 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'decoration-10',
|
||||
|
||||
animationId1: `d10ani1${id}`,
|
||||
animationId2: `d10ani2${id}`,
|
||||
animationId3: `d10ani3${id}`,
|
||||
animationId4: `d10ani4${id}`,
|
||||
animationId5: `d10ani5${id}`,
|
||||
animationId6: `d10ani6${id}`,
|
||||
animationId7: `d10ani7${id}`,
|
||||
animationId1: `d10ani1${timestamp}`,
|
||||
animationId2: `d10ani2${timestamp}`,
|
||||
animationId3: `d10ani3${timestamp}`,
|
||||
animationId4: `d10ani4${timestamp}`,
|
||||
animationId5: `d10ani5${timestamp}`,
|
||||
animationId6: `d10ani6${timestamp}`,
|
||||
animationId7: `d10ani7${timestamp}`,
|
||||
|
||||
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'decoration-11',
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import './src/main.css'
|
||||
import Decoration12 from './src/main.vue'
|
||||
|
||||
export default function (Vue) {
|
||||
Vue.component(Decoration12.name, Decoration12)
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
.dv-decoration-12 {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
}
|
||||
.dv-decoration-12 .decoration-content {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
|
@ -1,284 +0,0 @@
|
|||
<template>
|
||||
<div class="dv-decoration-12" :ref="ref">
|
||||
<svg :width="width" :height="height">
|
||||
<defs>
|
||||
<g :id="gId">
|
||||
<path
|
||||
:stroke="pathColor[i]"
|
||||
:stroke-width="width / 2"
|
||||
fill="transparent"
|
||||
v-for="(d, i) in pathD"
|
||||
:key="d"
|
||||
:d="d"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<radialGradient
|
||||
:id="gradientId"
|
||||
cx="50%" cy="50%" r="50%"
|
||||
>
|
||||
<stop offset="0%" stop-color="transparent" stop-opacity="1" />
|
||||
<stop offset="100%" :stop-color="fade(mergedColor[1] || defaultColor[1], 30)" stop-opacity="1" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<circle
|
||||
v-for="r in circleR"
|
||||
:key="r"
|
||||
:r="r"
|
||||
:cx="x"
|
||||
:cy="y"
|
||||
:stroke="mergedColor[1]"
|
||||
:stroke-width="0.5"
|
||||
fill="transparent"
|
||||
/>
|
||||
|
||||
<circle
|
||||
r="1"
|
||||
:cx="x"
|
||||
:cy="y"
|
||||
stroke="transparent"
|
||||
:fill="`url(#${gradientId})`"
|
||||
>
|
||||
<animate
|
||||
attributeName="r"
|
||||
:values="`1;${width / 2}`"
|
||||
:dur="`${haloDur}s`"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
<animate
|
||||
attributeName="opacity"
|
||||
values="1;0"
|
||||
:dur="`${haloDur}s`"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</circle>
|
||||
|
||||
<circle
|
||||
r="2"
|
||||
:cx="x"
|
||||
:cy="y"
|
||||
:fill="mergedColor[1]"
|
||||
/>
|
||||
|
||||
<g v-if="showSplitLine">
|
||||
<polyline
|
||||
v-for="p in splitLinePoints"
|
||||
:key="p"
|
||||
:points="p"
|
||||
:stroke="mergedColor[1]"
|
||||
:stroke-width="0.5"
|
||||
opacity="0.5"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<path
|
||||
v-for="d in arcD"
|
||||
:key="d"
|
||||
:d="d"
|
||||
:stroke="mergedColor[1]"
|
||||
stroke-width="2"
|
||||
fill="transparent"
|
||||
/>
|
||||
|
||||
<use :xlink:href="`#${gId}`">
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
:values="`0, ${x} ${y};360, ${x} ${y}`"
|
||||
:dur="`${scanDur}s`"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</use>
|
||||
</svg>
|
||||
|
||||
<div class="decoration-content">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone, getCircleRadianPoint } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { fade } from '@jiaminghi/color'
|
||||
|
||||
export default {
|
||||
name: 'DvDecoration12',
|
||||
mixins: [autoResize],
|
||||
props: {
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
},
|
||||
/**
|
||||
* @description Scan animation dur
|
||||
*/
|
||||
scanDur: {
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
/**
|
||||
* @description Halo animation dur
|
||||
*/
|
||||
haloDur: {
|
||||
type: Number,
|
||||
default: 2
|
||||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'decoration-12',
|
||||
gId: `decoration-12-g-${id}`,
|
||||
gradientId: `decoration-12-gradient-${id}`,
|
||||
|
||||
defaultColor: ['#2783ce', '#2cf7fe'],
|
||||
|
||||
mergedColor: [],
|
||||
|
||||
pathD: [],
|
||||
|
||||
pathColor: [],
|
||||
|
||||
circleR: [],
|
||||
|
||||
splitLinePoints: [],
|
||||
|
||||
arcD: [],
|
||||
|
||||
segment: 30,
|
||||
|
||||
sectorAngle: Math.PI / 3,
|
||||
|
||||
ringNum: 3,
|
||||
|
||||
ringWidth: 1,
|
||||
|
||||
showSplitLine: true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
color () {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
x () {
|
||||
const { width } = this
|
||||
|
||||
return width / 2
|
||||
},
|
||||
y () {
|
||||
const { height } = this
|
||||
|
||||
return height / 2
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
const { mergeColor, calcPathD, calcPathColor, calcCircleR, calcSplitLinePoints, calcArcD } = this
|
||||
|
||||
mergeColor()
|
||||
|
||||
calcPathD()
|
||||
|
||||
calcPathColor()
|
||||
|
||||
calcCircleR()
|
||||
|
||||
calcSplitLinePoints()
|
||||
|
||||
calcArcD()
|
||||
},
|
||||
mergeColor () {
|
||||
const { color, defaultColor } = this
|
||||
|
||||
this.mergedColor = deepMerge(deepClone(defaultColor, true), color || [])
|
||||
},
|
||||
calcPathD () {
|
||||
const { x, y, width, segment, sectorAngle } = this
|
||||
|
||||
const startAngle = -Math.PI / 2
|
||||
const angleGap = sectorAngle / segment
|
||||
const r = width / 4
|
||||
let lastEndPoints = getCircleRadianPoint(x, y, r, startAngle)
|
||||
|
||||
this.pathD = new Array(segment)
|
||||
.fill('')
|
||||
.map((_, i) => {
|
||||
const endPoints = getCircleRadianPoint(x, y, r, startAngle - (i + 1) * angleGap).map(_ => _.toFixed(5))
|
||||
const d = `M${lastEndPoints.join(',')} A${r}, ${r} 0 0 0 ${endPoints.join(',')}`
|
||||
lastEndPoints = endPoints
|
||||
|
||||
return d
|
||||
})
|
||||
},
|
||||
calcPathColor () {
|
||||
const { mergedColor: [color], segment } = this
|
||||
|
||||
const colorGap = 100 / (segment - 1)
|
||||
|
||||
this.pathColor = new Array(segment)
|
||||
.fill(color)
|
||||
.map((_, i) => fade(color, 100 - i * colorGap))
|
||||
},
|
||||
calcCircleR () {
|
||||
const { segment, ringNum, width, ringWidth } = this
|
||||
|
||||
const radiusGap = (width / 2 - ringWidth / 2) / ringNum
|
||||
|
||||
this.circleR = new Array(ringNum)
|
||||
.fill(0)
|
||||
.map((_, i) => radiusGap * (i + 1))
|
||||
},
|
||||
calcSplitLinePoints () {
|
||||
const { x, y, width } = this
|
||||
|
||||
const angleGap = Math.PI / 6
|
||||
const r = width / 2
|
||||
|
||||
this.splitLinePoints = new Array(6)
|
||||
.fill('')
|
||||
.map((_, i) => {
|
||||
const startAngle = angleGap * (i + 1)
|
||||
const endAngle = startAngle + Math.PI
|
||||
const startPoint = getCircleRadianPoint(x, y, r, startAngle)
|
||||
const endPoint = getCircleRadianPoint(x, y, r, endAngle)
|
||||
|
||||
return `${startPoint.join(',')} ${endPoint.join(',')}`
|
||||
})
|
||||
},
|
||||
calcArcD () {
|
||||
const { x, y, width } = this
|
||||
|
||||
const angleGap = Math.PI / 6
|
||||
const r = width / 2 - 1
|
||||
|
||||
this.arcD = new Array(4)
|
||||
.fill('')
|
||||
.map((_, i) => {
|
||||
const startAngle = angleGap * (3 * i + 1)
|
||||
const endAngle = startAngle + angleGap
|
||||
const startPoint = getCircleRadianPoint(x, y, r, startAngle)
|
||||
const endPoint = getCircleRadianPoint(x, y, r, endAngle)
|
||||
|
||||
return `M${startPoint.join(',')} A${x}, ${y} 0 0 1 ${endPoint.join(',')}`
|
||||
})
|
||||
},
|
||||
afterAutoResizeMixinInit () {
|
||||
const { init } = this
|
||||
|
||||
init()
|
||||
},
|
||||
fade
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -6,7 +6,7 @@
|
|||
:attributeName="reverse ? 'height' : 'width'"
|
||||
from="0"
|
||||
:to="reverse ? height : width"
|
||||
:dur="`${dur}s`"
|
||||
dur="6s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
keySplines=".42,0,.58,1"
|
||||
|
@ -19,7 +19,7 @@
|
|||
:attributeName="reverse ? 'y' : 'x'"
|
||||
from="0"
|
||||
:to="reverse ? height : width"
|
||||
:dur="`${dur}s`"
|
||||
dur="6s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
keySplines="0.42,0,0.58,1"
|
||||
|
@ -48,10 +48,6 @@ export default {
|
|||
reverse: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dur: {
|
||||
type: Number,
|
||||
default: 6
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
|
|
@ -2,11 +2,25 @@
|
|||
<div class="dv-decoration-3" :ref="ref">
|
||||
<svg :width="`${svgWH[0]}px`" :height="`${svgWH[1]}px`" :style="`transform:scale(${svgScale[0]},${svgScale[1]});`">
|
||||
|
||||
<template v-for="(point, i) in points" :key="i">
|
||||
<rect :fill="mergedColor[0]" :x="point[0] - halfPointSideLength" :y="point[1] - halfPointSideLength"
|
||||
:width="pointSideLength" :height="pointSideLength">
|
||||
<animate v-if="Math.random() > 0.6" attributeName="fill" :values="`${mergedColor.join(';')}`"
|
||||
:dur="Math.random() + 1 + 's'" :begin="Math.random() * 2" repeatCount="indefinite" />
|
||||
<template
|
||||
v-for="(point, i) in points"
|
||||
>
|
||||
<rect
|
||||
:key="i"
|
||||
:fill="mergedColor[0]"
|
||||
:x="point[0] - halfPointSideLength"
|
||||
:y="point[1] - halfPointSideLength"
|
||||
:width="pointSideLength"
|
||||
:height="pointSideLength"
|
||||
>
|
||||
<animate
|
||||
v-if="Math.random() > 0.6"
|
||||
attributeName="fill"
|
||||
:values="`${mergedColor.join(';')}`"
|
||||
:dur="Math.random() + 1 + 's'"
|
||||
:begin="Math.random() * 2"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</rect>
|
||||
</template>
|
||||
</svg>
|
||||
|
@ -14,101 +28,101 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
export default {
|
||||
name: 'DvDecoration3',
|
||||
mixins: [autoResize],
|
||||
props: {
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const pointSideLength = 7
|
||||
export default {
|
||||
name: 'DvDecoration3',
|
||||
mixins: [autoResize],
|
||||
props: {
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
}
|
||||
},
|
||||
data () {
|
||||
const pointSideLength = 7
|
||||
|
||||
return {
|
||||
ref: 'decoration-3',
|
||||
return {
|
||||
ref: 'decoration-3',
|
||||
|
||||
svgWH: [300, 35],
|
||||
svgWH: [300, 35],
|
||||
|
||||
svgScale: [1, 1],
|
||||
svgScale: [1, 1],
|
||||
|
||||
rowNum: 2,
|
||||
rowPoints: 25,
|
||||
rowNum: 2,
|
||||
rowPoints: 25,
|
||||
|
||||
pointSideLength,
|
||||
halfPointSideLength: pointSideLength / 2,
|
||||
pointSideLength,
|
||||
halfPointSideLength: pointSideLength / 2,
|
||||
|
||||
points: [],
|
||||
points: [],
|
||||
|
||||
defaultColor: ['#7acaec', 'transparent'],
|
||||
defaultColor: ['#7acaec', 'transparent'],
|
||||
|
||||
mergedColor: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
color() {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
afterAutoResizeMixinInit() {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
calcSVGData() {
|
||||
const { calcPointsPosition, calcScale } = this
|
||||
|
||||
calcPointsPosition()
|
||||
|
||||
calcScale()
|
||||
},
|
||||
calcPointsPosition() {
|
||||
const { svgWH, rowNum, rowPoints } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
const horizontalGap = w / (rowPoints + 1)
|
||||
const verticalGap = h / (rowNum + 1)
|
||||
|
||||
let points = new Array(rowNum).fill(0).map((foo, i) =>
|
||||
new Array(rowPoints).fill(0).map((foo, j) => [
|
||||
horizontalGap * (j + 1), verticalGap * (i + 1)
|
||||
]))
|
||||
|
||||
this.points = points.reduce((all, item) => [...all, ...item], [])
|
||||
},
|
||||
calcScale() {
|
||||
const { width, height, svgWH } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
this.svgScale = [width / w, height / h]
|
||||
},
|
||||
onResize() {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
mergeColor() {
|
||||
const { color, defaultColor } = this
|
||||
|
||||
this.mergedColor = deepMerge(deepClone(defaultColor, true), color || [])
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
mergedColor: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
color () {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
afterAutoResizeMixinInit () {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
calcSVGData () {
|
||||
const { calcPointsPosition, calcScale } = this
|
||||
|
||||
calcPointsPosition()
|
||||
|
||||
calcScale()
|
||||
},
|
||||
calcPointsPosition () {
|
||||
const { svgWH, rowNum, rowPoints } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
const horizontalGap = w / (rowPoints + 1)
|
||||
const verticalGap = h / (rowNum + 1)
|
||||
|
||||
let points = new Array(rowNum).fill(0).map((foo, i) =>
|
||||
new Array(rowPoints).fill(0).map((foo, j) => [
|
||||
horizontalGap * (j + 1), verticalGap * (i + 1)
|
||||
]))
|
||||
|
||||
this.points = points.reduce((all, item) => [...all, ...item], [])
|
||||
},
|
||||
calcScale () {
|
||||
const { width, height, svgWH } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
this.svgScale = [width / w, height / h]
|
||||
},
|
||||
onResize () {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
mergeColor () {
|
||||
const { color, defaultColor } = this
|
||||
|
||||
this.mergedColor = deepMerge(deepClone(defaultColor, true), color || [])
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -7,22 +7,20 @@
|
|||
display: flex;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
flex: 1;
|
||||
}
|
||||
.dv-decoration-4 .normal {
|
||||
animation: ani-height ease-in-out infinite;
|
||||
height: 0% !important;
|
||||
animation: ani-height 3s ease-in-out infinite;
|
||||
left: 50%;
|
||||
margin-left: -2px;
|
||||
}
|
||||
.dv-decoration-4 .reverse {
|
||||
animation: ani-width ease-in-out infinite;
|
||||
width: 0% !important;
|
||||
animation: ani-width 3s ease-in-out infinite;
|
||||
top: 50%;
|
||||
margin-top: -2px;
|
||||
}
|
||||
@keyframes ani-height {
|
||||
0% {
|
||||
height: 0%;
|
||||
}
|
||||
70% {
|
||||
height: 100%;
|
||||
}
|
||||
|
@ -31,9 +29,6 @@
|
|||
}
|
||||
}
|
||||
@keyframes ani-width {
|
||||
0% {
|
||||
width: 0%;
|
||||
}
|
||||
70% {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="dv-decoration-4" :ref="ref">
|
||||
<div
|
||||
:class="`container ${reverse ? 'reverse' : 'normal'}`"
|
||||
:style="reverse ? `width:${width}px;height:5px;animation-duration:${dur}s` : `width:5px;height:${height}px;animation-duration:${dur}s`"
|
||||
:style="reverse ? `width:${width}px;height:5px` : `width:5px;height:${height}px;`"
|
||||
>
|
||||
<svg :width="reverse ? width : 5" :height="reverse ? 5 : height">
|
||||
<polyline
|
||||
|
@ -40,10 +40,6 @@ export default {
|
|||
reverse: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dur: {
|
||||
type: Number,
|
||||
default: 3
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
attributeType="XML"
|
||||
:from="`0, ${line1Length / 2}, 0, ${line1Length / 2}`"
|
||||
:to="`0, 0, ${line1Length}, 0`"
|
||||
:dur="`${dur}s`"
|
||||
dur="1.2s"
|
||||
begin="0s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
|
@ -31,7 +31,7 @@
|
|||
attributeType="XML"
|
||||
:from="`0, ${line2Length / 2}, 0, ${line2Length / 2}`"
|
||||
:to="`0, 0, ${line2Length}, 0`"
|
||||
:dur="`${dur}s`"
|
||||
dur="1.2s"
|
||||
begin="0s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
|
@ -59,10 +59,6 @@ export default {
|
|||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
},
|
||||
dur: {
|
||||
type: Number,
|
||||
default: 1.2
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
|
|
@ -1,16 +1,37 @@
|
|||
<template>
|
||||
<div class="dv-decoration-6" :ref="ref">
|
||||
<svg :width="`${svgWH[0]}px`" :height="`${svgWH[1]}px`" :style="`transform:scale(${svgScale[0]},${svgScale[1]});`">
|
||||
<template v-for="(point, i) in points" :key="i">
|
||||
<rect :fill="mergedColor[Math.random() > 0.5 ? 0 : 1]" :x="point[0] - halfRectWidth"
|
||||
:y="point[1] - heights[i] / 2" :width="rectWidth" :height="heights[i]">
|
||||
<animate attributeName="y"
|
||||
<template
|
||||
v-for="(point, i) in points"
|
||||
>
|
||||
<rect
|
||||
:key="i"
|
||||
:fill="mergedColor[Math.random() > 0.5 ? 0 : 1]"
|
||||
:x="point[0] - halfRectWidth"
|
||||
:y="point[1] - heights[i] / 2"
|
||||
:width="rectWidth"
|
||||
:height="heights[i]"
|
||||
>
|
||||
<animate
|
||||
attributeName="y"
|
||||
:values="`${point[1] - minHeights[i] / 2};${point[1] - heights[i] / 2};${point[1] - minHeights[i] / 2}`"
|
||||
:dur="`${randoms[i]}s`" keyTimes="0;0.5;1" calcMode="spline" keySplines="0.42,0,0.58,1;0.42,0,0.58,1"
|
||||
begin="0s" repeatCount="indefinite" />
|
||||
<animate attributeName="height" :values="`${minHeights[i]};${heights[i]};${minHeights[i]}`"
|
||||
:dur="`${randoms[i]}s`" keyTimes="0;0.5;1" calcMode="spline" keySplines="0.42,0,0.58,1;0.42,0,0.58,1"
|
||||
begin="0s" repeatCount="indefinite" />
|
||||
:dur="`${randoms[i]}s`"
|
||||
keyTimes="0;0.5;1"
|
||||
calcMode="spline"
|
||||
keySplines="0.42,0,0.58,1;0.42,0,0.58,1"
|
||||
begin="0s"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
<animate
|
||||
attributeName="height"
|
||||
:values="`${minHeights[i]};${heights[i]};${minHeights[i]}`"
|
||||
:dur="`${randoms[i]}s`"
|
||||
keyTimes="0;0.5;1"
|
||||
calcMode="spline"
|
||||
keySplines="0.42,0,0.58,1;0.42,0,0.58,1"
|
||||
begin="0s"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</rect>
|
||||
</template>
|
||||
</svg>
|
||||
|
@ -18,115 +39,115 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
import { randomExtend } from '../../../util'
|
||||
import { randomExtend } from '../../../util'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
export default {
|
||||
name: 'DvDecoration6',
|
||||
mixins: [autoResize],
|
||||
props: {
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const rectWidth = 7
|
||||
export default {
|
||||
name: 'DvDecoration6',
|
||||
mixins: [autoResize],
|
||||
props: {
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
}
|
||||
},
|
||||
data () {
|
||||
const rectWidth = 7
|
||||
|
||||
return {
|
||||
ref: 'decoration-6',
|
||||
return {
|
||||
ref: 'decoration-6',
|
||||
|
||||
svgWH: [300, 35],
|
||||
svgWH: [300, 35],
|
||||
|
||||
svgScale: [1, 1],
|
||||
svgScale: [1, 1],
|
||||
|
||||
rowNum: 1,
|
||||
rowPoints: 40,
|
||||
rowNum: 1,
|
||||
rowPoints: 40,
|
||||
|
||||
rectWidth,
|
||||
halfRectWidth: rectWidth / 2,
|
||||
rectWidth,
|
||||
halfRectWidth: rectWidth / 2,
|
||||
|
||||
points: [],
|
||||
heights: [],
|
||||
minHeights: [],
|
||||
randoms: [],
|
||||
points: [],
|
||||
heights: [],
|
||||
minHeights: [],
|
||||
randoms: [],
|
||||
|
||||
defaultColor: ['#7acaec', '#7acaec'],
|
||||
defaultColor: ['#7acaec', '#7acaec'],
|
||||
|
||||
mergedColor: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
color() {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
afterAutoResizeMixinInit() {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
calcSVGData() {
|
||||
const { calcPointsPosition, calcScale } = this
|
||||
|
||||
calcPointsPosition()
|
||||
|
||||
calcScale()
|
||||
},
|
||||
calcPointsPosition() {
|
||||
const { svgWH, rowNum, rowPoints } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
const horizontalGap = w / (rowPoints + 1)
|
||||
const verticalGap = h / (rowNum + 1)
|
||||
|
||||
let points = new Array(rowNum).fill(0).map((foo, i) =>
|
||||
new Array(rowPoints).fill(0).map((foo, j) => [
|
||||
horizontalGap * (j + 1), verticalGap * (i + 1)
|
||||
]))
|
||||
|
||||
this.points = points.reduce((all, item) => [...all, ...item], [])
|
||||
const heights = this.heights = new Array(rowNum * rowPoints)
|
||||
.fill(0).map(foo =>
|
||||
Math.random() > 0.8 ? randomExtend(0.7 * h, h) : randomExtend(0.2 * h, 0.5 * h))
|
||||
|
||||
this.minHeights = new Array(rowNum * rowPoints)
|
||||
.fill(0).map((foo, i) => heights[i] * Math.random())
|
||||
|
||||
this.randoms = new Array(rowNum * rowPoints)
|
||||
.fill(0).map(foo => Math.random() + 1.5)
|
||||
},
|
||||
calcScale() {
|
||||
const { width, height, svgWH } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
this.svgScale = [width / w, height / h]
|
||||
},
|
||||
onResize() {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
mergeColor() {
|
||||
const { color, defaultColor } = this
|
||||
|
||||
this.mergedColor = deepMerge(deepClone(defaultColor, true), color || [])
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
mergedColor: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
color () {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
afterAutoResizeMixinInit () {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
calcSVGData () {
|
||||
const { calcPointsPosition, calcScale } = this
|
||||
|
||||
calcPointsPosition()
|
||||
|
||||
calcScale()
|
||||
},
|
||||
calcPointsPosition () {
|
||||
const { svgWH, rowNum, rowPoints } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
const horizontalGap = w / (rowPoints + 1)
|
||||
const verticalGap = h / (rowNum + 1)
|
||||
|
||||
let points = new Array(rowNum).fill(0).map((foo, i) =>
|
||||
new Array(rowPoints).fill(0).map((foo, j) => [
|
||||
horizontalGap * (j + 1), verticalGap * (i + 1)
|
||||
]))
|
||||
|
||||
this.points = points.reduce((all, item) => [...all, ...item], [])
|
||||
const heights = this.heights = new Array(rowNum * rowPoints)
|
||||
.fill(0).map(foo =>
|
||||
Math.random() > 0.8 ? randomExtend(0.7 * h, h) : randomExtend(0.2 * h, 0.5 * h))
|
||||
|
||||
this.minHeights = new Array(rowNum * rowPoints)
|
||||
.fill(0).map((foo, i) => heights[i] * Math.random())
|
||||
|
||||
this.randoms = new Array(rowNum * rowPoints)
|
||||
.fill(0).map(foo => Math.random() + 1.5)
|
||||
},
|
||||
calcScale () {
|
||||
const { width, height, svgWH } = this
|
||||
|
||||
const [w, h] = svgWH
|
||||
|
||||
this.svgScale = [width / w, height / h]
|
||||
},
|
||||
onResize () {
|
||||
const { calcSVGData } = this
|
||||
|
||||
calcSVGData()
|
||||
},
|
||||
mergeColor () {
|
||||
const { color, defaultColor } = this
|
||||
|
||||
this.mergedColor = deepMerge(deepClone(defaultColor, true), color || [])
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -85,7 +85,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -107,11 +106,11 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'decoration-9',
|
||||
|
||||
polygonId: `decoration-9-polygon-${id}`,
|
||||
polygonId: `decoration-9-polygon-${timestamp}`,
|
||||
|
||||
svgWH: [100, 100],
|
||||
|
||||
|
|
|
@ -67,11 +67,6 @@ export default {
|
|||
fontSize: 30,
|
||||
fill: '#3de7c9'
|
||||
},
|
||||
/**
|
||||
* @description Number formatter
|
||||
* @type {Null|Function}
|
||||
*/
|
||||
formatter: undefined,
|
||||
/**
|
||||
* @description CRender animationCurve
|
||||
* @type {String}
|
||||
|
@ -135,7 +130,7 @@ export default {
|
|||
})
|
||||
},
|
||||
getShape () {
|
||||
const { number, content, toFixed, textAlign, rowGap, formatter } = this.mergedConfig
|
||||
const { number, content, toFixed, textAlign, rowGap } = this.mergedConfig
|
||||
|
||||
const [w, h] = this.renderer.area
|
||||
|
||||
|
@ -149,8 +144,7 @@ export default {
|
|||
content,
|
||||
toFixed,
|
||||
position,
|
||||
rowGap,
|
||||
formatter
|
||||
rowGap
|
||||
}
|
||||
},
|
||||
getStyle () {
|
||||
|
|
|
@ -153,7 +153,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
|
@ -171,14 +171,14 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'dv-flyline-chart',
|
||||
unique: Math.random(),
|
||||
maskId: `flyline-mask-id-${id}`,
|
||||
maskCircleId: `mask-circle-id-${id}`,
|
||||
gradientId: `gradient-id-${id}`,
|
||||
gradient2Id: `gradient2-id-${id}`,
|
||||
maskId: `flyline-mask-id-${timestamp}`,
|
||||
maskCircleId: `mask-circle-id-${timestamp}`,
|
||||
gradientId: `gradient-id-${timestamp}`,
|
||||
gradient2Id: `gradient2-id-${timestamp}`,
|
||||
|
||||
defaultConfig: {
|
||||
/**
|
||||
|
|
|
@ -155,7 +155,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
|
@ -173,12 +173,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'dv-flyline-chart-enhanced',
|
||||
unique: Math.random(),
|
||||
flylineGradientId: `flyline-gradient-id-${id}`,
|
||||
haloGradientId: `halo-gradient-id-${id}`,
|
||||
flylineGradientId: `flyline-gradient-id-${timestamp}`,
|
||||
haloGradientId: `halo-gradient-id-${timestamp}`,
|
||||
/**
|
||||
* @description Type Declaration
|
||||
*
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
@ -59,10 +57,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
gradientId1: `percent-pond-gradientId1-${id}`,
|
||||
gradientId2: `percent-pond-gradientId2-${id}`,
|
||||
gradientId1: `percent-pond-gradientId1-${timestamp}`,
|
||||
gradientId2: `percent-pond-gradientId2-${timestamp}`,
|
||||
|
||||
width: 0,
|
||||
height: 0,
|
||||
|
@ -236,10 +234,10 @@ export default {
|
|||
|
||||
await $nextTick()
|
||||
|
||||
const { clientWidth, clientHeight } = $refs['percent-pond']
|
||||
const dom = $refs['percent-pond']
|
||||
|
||||
this.width = clientWidth
|
||||
this.height = clientHeight
|
||||
this.width = dom.clientWidth
|
||||
this.height = dom.clientHeight
|
||||
},
|
||||
mergeConfig () {
|
||||
const { config, defaultConfig } = this
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div
|
||||
class="header-item"
|
||||
v-for="(headerItem, i) in header"
|
||||
:key="`${headerItem}${i}`"
|
||||
:key="headerItem + i"
|
||||
:style="`
|
||||
height: ${mergedConfig.headerHeight}px;
|
||||
line-height: ${mergedConfig.headerHeight}px;
|
||||
|
@ -23,7 +23,7 @@
|
|||
<div
|
||||
class="row-item"
|
||||
v-for="(row, ri) in rows"
|
||||
:key="`${row.toString()}${row.scroll}`"
|
||||
:key="row.toString() + row.scroll"
|
||||
:style="`
|
||||
height: ${heights[ri]}px;
|
||||
line-height: ${heights[ri]}px;
|
||||
|
@ -33,13 +33,11 @@
|
|||
<div
|
||||
class="ceil"
|
||||
v-for="(ceil, ci) in row.ceils"
|
||||
:key="`${ceil}${ri}${ci}`"
|
||||
:key="ceil + ri + ci"
|
||||
:style="`width: ${widths[ci]}px;`"
|
||||
:align="aligns[ci]"
|
||||
v-html="ceil"
|
||||
@click="emitEvent('click', ri, ci, row, ceil)"
|
||||
@mouseenter="handleHover(true, ri, ci, row, ceil)"
|
||||
@mouseleave="handleHover(false)"
|
||||
@click="emitEvent(ri, ci, row, ceil)"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
@ -148,14 +146,7 @@ export default {
|
|||
* @default carousel = 'single'
|
||||
* @example carousel = 'single' | 'page'
|
||||
*/
|
||||
carousel: 'single',
|
||||
/**
|
||||
* @description Pause scroll when mouse hovered
|
||||
* @type {Boolean}
|
||||
* @default hoverPause = true
|
||||
* @example hoverPause = true | false
|
||||
*/
|
||||
hoverPause: true
|
||||
carousel: 'single'
|
||||
},
|
||||
|
||||
mergedConfig: null,
|
||||
|
@ -178,9 +169,7 @@ export default {
|
|||
|
||||
animationHandler: '',
|
||||
|
||||
updater: 0,
|
||||
|
||||
needCalc: false
|
||||
updater: 0
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -189,24 +178,10 @@ export default {
|
|||
|
||||
stopAnimation()
|
||||
|
||||
this.animationIndex = 0
|
||||
|
||||
calcData()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleHover(enter, ri, ci, row, ceil){
|
||||
const { mergedConfig, emitEvent, stopAnimation, animation } = this
|
||||
|
||||
if (enter) emitEvent('mouseover', ri, ci, row, ceil)
|
||||
if (!mergedConfig.hoverPause) return
|
||||
|
||||
if (enter) {
|
||||
stopAnimation()
|
||||
} else {
|
||||
animation(true)
|
||||
}
|
||||
},
|
||||
afterAutoResizeMixinInit () {
|
||||
const { calcData } = this
|
||||
|
||||
|
@ -337,14 +312,6 @@ export default {
|
|||
this.aligns = deepMerge(aligns, align)
|
||||
},
|
||||
async animation (start = false) {
|
||||
const { needCalc, calcHeights, calcRowsData } = this
|
||||
|
||||
if (needCalc) {
|
||||
calcRowsData()
|
||||
calcHeights()
|
||||
this.needCalc = false
|
||||
}
|
||||
|
||||
let { avgHeight, animationIndex, mergedConfig, rowsData, animation, updater } = this
|
||||
|
||||
const { waitTime, carousel, rowNum } = mergedConfig
|
||||
|
@ -363,7 +330,7 @@ export default {
|
|||
let rows = rowsData.slice(animationIndex)
|
||||
rows.push(...rowsData.slice(0, animationIndex))
|
||||
|
||||
this.rows = rows.slice(0, carousel === 'page' ? rowNum * 2 : rowNum + 1)
|
||||
this.rows = rows
|
||||
this.heights = new Array(rowLength).fill(avgHeight)
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 300))
|
||||
|
@ -388,28 +355,15 @@ export default {
|
|||
|
||||
clearTimeout(animationHandler)
|
||||
},
|
||||
emitEvent (type, ri, ci, row, ceil) {
|
||||
emitEvent (ri, ci, row, ceil) {
|
||||
const { ceils, rowIndex } = row
|
||||
|
||||
this.$emit(type, {
|
||||
this.$emit('click', {
|
||||
row: ceils,
|
||||
ceil,
|
||||
rowIndex,
|
||||
columnIndex: ci
|
||||
})
|
||||
},
|
||||
updateRows(rows, animationIndex) {
|
||||
const { mergedConfig, animationHandler, animation } = this
|
||||
|
||||
this.mergedConfig = {
|
||||
...mergedConfig,
|
||||
data: [...rows]
|
||||
}
|
||||
|
||||
this.needCalc = true
|
||||
|
||||
if (typeof animationIndex === 'number') this.animationIndex = animationIndex
|
||||
if (!animationHandler) animation(true)
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="ranking-info">
|
||||
<div class="rank">No.{{ item.ranking }}</div>
|
||||
<div class="info-name" v-html="item.name" />
|
||||
<div class="ranking-value">{{ mergedConfig.valueFormatter ? mergedConfig.valueFormatter(item) : item.value + mergedConfig.unit }}</div>
|
||||
<div class="ranking-value">{{ item.value + mergedConfig.unit }}</div>
|
||||
</div>
|
||||
|
||||
<div class="ranking-column">
|
||||
|
@ -82,13 +82,7 @@ export default {
|
|||
* @type {Boolean}
|
||||
* @default sort = true
|
||||
*/
|
||||
sort: true,
|
||||
/**
|
||||
* @description Value formatter
|
||||
* @type {Function}
|
||||
* @default valueFormatter = null
|
||||
*/
|
||||
valueFormatter: null
|
||||
sort: true
|
||||
},
|
||||
|
||||
mergedConfig: null,
|
||||
|
@ -158,20 +152,10 @@ export default {
|
|||
})
|
||||
|
||||
const value = data.map(({ value }) => value)
|
||||
|
||||
const min = Math.min(...value) || 0
|
||||
|
||||
// abs of min
|
||||
const minAbs = Math.abs(min)
|
||||
|
||||
const max = Math.max(...value) || 0
|
||||
|
||||
// abs of max
|
||||
const maxAbs = Math.abs(max)
|
||||
|
||||
const total = max + minAbs
|
||||
|
||||
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))
|
||||
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: row.value / max * 100 }))
|
||||
|
||||
const rowLength = data.length
|
||||
|
||||
|
@ -214,7 +198,7 @@ export default {
|
|||
let rows = rowsData.slice(animationIndex)
|
||||
rows.push(...rowsData.slice(0, animationIndex))
|
||||
|
||||
this.rows = rows.slice(0, rowNum + 1)
|
||||
this.rows = rows
|
||||
this.heights = new Array(rowLength).fill(avgHeight)
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 300))
|
||||
|
@ -238,7 +222,7 @@ export default {
|
|||
if (!animationHandler) return
|
||||
|
||||
clearTimeout(animationHandler)
|
||||
},
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
const { stopAnimation } = this
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
@ -55,9 +53,9 @@ export default {
|
|||
default: () => ({})
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
gradientId: `water-level-pond-${id}`,
|
||||
gradientId: `water-level-pond-${timestamp}`,
|
||||
|
||||
defaultConfig: {
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,6 @@ export { default as conicalColumnChart } from './components/conicalColumnChart/i
|
|||
export { default as decoration1 } from './components/decoration1/index'
|
||||
export { default as decoration10 } from './components/decoration10/index'
|
||||
export { default as decoration11 } from './components/decoration11/index'
|
||||
export { default as decoration12 } from './components/decoration12/index'
|
||||
export { default as decoration2 } from './components/decoration2/index'
|
||||
export { default as decoration3 } from './components/decoration3/index'
|
||||
export { default as decoration4 } from './components/decoration4/index'
|
||||
|
@ -72,7 +71,6 @@ import decoration8 from './components/decoration8/index'
|
|||
import decoration9 from './components/decoration9/index'
|
||||
import decoration10 from './components/decoration10/index'
|
||||
import decoration11 from './components/decoration11/index'
|
||||
import decoration12 from './components/decoration12/index'
|
||||
|
||||
// charts
|
||||
import charts from './components/charts/index'
|
||||
|
@ -122,7 +120,6 @@ export default function (Vue) {
|
|||
Vue.use(decoration9)
|
||||
Vue.use(decoration10)
|
||||
Vue.use(decoration11)
|
||||
Vue.use(decoration12)
|
||||
|
||||
// charts
|
||||
Vue.use(charts)
|
||||
|
|
|
@ -29,17 +29,11 @@ export default {
|
|||
const { $nextTick, $refs, ref, onResize } = this
|
||||
|
||||
return new Promise(resolve => {
|
||||
$nextTick(_ => {
|
||||
$nextTick(e => {
|
||||
const dom = this.dom = $refs[ref]
|
||||
|
||||
this.width = dom ? dom.clientWidth : 0
|
||||
this.height = dom ? dom.clientHeight : 0
|
||||
|
||||
if (!dom) {
|
||||
console.warn('DataV: Failed to get dom node, component rendering may be abnormal!')
|
||||
} else if (!this.width || !this.height) {
|
||||
console.warn('DataV: Component width or height is 0px, rendering abnormality may occur!')
|
||||
}
|
||||
this.width = dom.clientWidth
|
||||
this.height = dom.clientHeight
|
||||
|
||||
if (typeof onResize === 'function' && resize) onResize()
|
||||
|
||||
|
@ -62,8 +56,6 @@ export default {
|
|||
unbindDomResizeCallback () {
|
||||
let { domObserver, debounceInitWHFun } = this
|
||||
|
||||
if (!domObserver) return
|
||||
|
||||
domObserver.disconnect()
|
||||
domObserver.takeRecords()
|
||||
domObserver = null
|
||||
|
|
|
@ -37,11 +37,3 @@ export function getPointDistance (pointOne, pointTwo) {
|
|||
|
||||
return Math.sqrt(minusX * minusX + minusY * minusY)
|
||||
}
|
||||
|
||||
export function uuid (hasHyphen) {
|
||||
return (hasHyphen ? 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' : 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx').replace(/[xy]/g, function (c) {
|
||||
const r = Math.random() * 16 | 0
|
||||
const v = c == 'x' ? r : (r & 0x3 | 0x8)
|
||||
return v.toString(16)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@ykxiao/demu-mes-data-v",
|
||||
"version": "1.0.1",
|
||||
"author": "Longlong <long@qq.com>",
|
||||
"name": "@jiaminghi/data-view",
|
||||
"version": "2.8.3",
|
||||
"author": "JiaMing <743192023@qq.com>",
|
||||
"description": "Vue Large screen data display component library",
|
||||
"main": "lib/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.tool.dwoodauto.com/ykxiao/DemuMesDataV.git"
|
||||
"url": "https://github.com/DataV-Team/DataV.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node build/index.js",
|
||||
|
|
|
@ -83,11 +83,6 @@ export default {
|
|||
* @type {Number}
|
||||
*/
|
||||
digitalFlopToFixed: 0,
|
||||
/**
|
||||
* @description Digital flop unit
|
||||
* @type {String}
|
||||
*/
|
||||
digitalFlopUnit: '',
|
||||
/**
|
||||
* @description CRender animationCurve
|
||||
* @type {String}
|
||||
|
@ -127,8 +122,7 @@ export default {
|
|||
digitalFlopStyle,
|
||||
digitalFlopToFixed,
|
||||
data,
|
||||
showOriginValue,
|
||||
digitalFlopUnit
|
||||
showOriginValue
|
||||
} = mergedConfig
|
||||
|
||||
const value = data.map(({ value }) => value)
|
||||
|
@ -146,7 +140,7 @@ export default {
|
|||
}
|
||||
|
||||
return {
|
||||
content: showOriginValue ? `{nt}${digitalFlopUnit}` : `{nt}${digitalFlopUnit || '%'}`,
|
||||
content: showOriginValue ? '{nt}' : '{nt}%',
|
||||
number: [displayValue],
|
||||
style: digitalFlopStyle,
|
||||
toFixed: digitalFlopToFixed
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-10" :ref="ref" :style="`box-shadow: inset 0 0 25px 3px ${mergedColor[0]}`">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="border" :width="width" :height="height">
|
||||
<polygon :fill="backgroundColor" :points="`
|
||||
4, 0 ${width - 4}, 0 ${width}, 4 ${width}, ${height - 4} ${width - 4}, ${height}
|
||||
4, ${height} 0, ${height - 4} 0, 4
|
||||
|
@ -12,7 +12,7 @@
|
|||
height="150px"
|
||||
:key="item"
|
||||
v-for="item in border"
|
||||
:class="`${item} dv-border-svg-container`"
|
||||
:class="`${item} border`"
|
||||
>
|
||||
<polygon
|
||||
:fill="mergedColor[1]"
|
||||
|
@ -86,7 +86,7 @@ export default {
|
|||
height: 100%;
|
||||
border-radius: 6px;
|
||||
|
||||
.dv-border-svg-container {
|
||||
.border {
|
||||
position: absolute;
|
||||
display: block;
|
||||
}
|
||||
|
|
|
@ -216,7 +216,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -246,10 +245,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'border-box-11',
|
||||
filterId: `border-box-11-filterId-${id}`,
|
||||
filterId: `border-box-11-filterId-${timestamp}`,
|
||||
|
||||
defaultColor: ['#8aaafb', '#1f33a2'],
|
||||
|
||||
|
@ -292,7 +291,7 @@ export default {
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
|
||||
& > polyline {
|
||||
polyline {
|
||||
fill: none;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -114,10 +113,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = +new Date()
|
||||
return {
|
||||
ref: 'border-box-12',
|
||||
filterId: `borderr-box-12-filterId-${id}`,
|
||||
filterId: `borderr-box-12-filterId-${timestamp}`,
|
||||
|
||||
defaultColor: ['#2e6099', '#7ce7fd'],
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = +new Date()
|
||||
return {
|
||||
ref: 'border-box-13',
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ export default {
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
|
||||
& > polyline {
|
||||
polyline {
|
||||
fill: none;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ export default {
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
|
||||
& > polyline {
|
||||
polyline {
|
||||
fill: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ export default {
|
|||
top: 0px;
|
||||
left: 0px;
|
||||
|
||||
& > polyline {
|
||||
polyline {
|
||||
fill: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-5" :ref="ref">
|
||||
<svg :class="`dv-border-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||
<svg :class="`dv-svg-container ${reverse && 'dv-reverse'}`" :width="width" :height="height">
|
||||
<polygon :fill="backgroundColor" :points="`
|
||||
10, 22 ${width - 22}, 22 ${width - 22}, ${height - 86} ${width - 84}, ${height - 24} 10, ${height - 24}
|
||||
`" />
|
||||
|
@ -94,14 +94,14 @@ export default {
|
|||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.dv-border-svg-container {
|
||||
.dv-svg-container {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
& > polyline {
|
||||
polyline {
|
||||
fill: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-6" :ref="ref">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<polygon :fill="backgroundColor" :points="`
|
||||
9, 7 ${width - 9}, 7 ${width - 9}, ${height - 7} 9, ${height - 7}
|
||||
`" />
|
||||
|
@ -86,14 +86,14 @@ export default {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.dv-border-svg-container {
|
||||
.dv-svg-container {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
& > polyline {
|
||||
polyline {
|
||||
fill: none;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:style="`box-shadow: inset 0 0 40px ${mergedColor[0]}; border: 1px solid ${mergedColor[0]}; background-color: ${backgroundColor}`"
|
||||
:ref="ref"
|
||||
>
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<polyline class="dv-bb7-line-width-2" :stroke="mergedColor[0]" :points="`0, 25 0, 0 25, 0`" />
|
||||
<polyline class="dv-bb7-line-width-2" :stroke="mergedColor[0]" :points="`${width - 25}, 0 ${width}, 0 ${width}, 25`" />
|
||||
<polyline class="dv-bb7-line-width-2" :stroke="mergedColor[0]" :points="`${width - 25}, ${height} ${width}, ${height} ${width}, ${height - 25}`" />
|
||||
|
@ -80,14 +80,14 @@ export default {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.dv-border-svg-container {
|
||||
.dv-svg-container {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
& > polyline {
|
||||
polyline {
|
||||
fill: none;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-8" :ref="ref">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<defs>
|
||||
<path
|
||||
:id="path"
|
||||
|
@ -65,7 +65,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -93,12 +92,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'border-box-8',
|
||||
path: `border-box-8-path-${id}`,
|
||||
gradient: `border-box-8-gradient-${id}`,
|
||||
mask: `border-box-8-mask-${id}`,
|
||||
path: `border-box-8-path-${timestamp}`,
|
||||
gradient: `border-box-8-gradient-${timestamp}`,
|
||||
mask: `border-box-8-mask-${timestamp}`,
|
||||
|
||||
defaultColor: ['#235fa7', '#4fd2dd'],
|
||||
|
||||
|
@ -147,7 +146,7 @@ export default {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.dv-border-svg-container {
|
||||
svg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="dv-border-box-9" :ref="ref">
|
||||
<svg class="dv-border-svg-container" :width="width" :height="height">
|
||||
<svg class="dv-svg-container" :width="width" :height="height">
|
||||
<defs>
|
||||
<linearGradient :id="gradientId" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<animate
|
||||
|
@ -125,7 +125,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -145,12 +144,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'border-box-9',
|
||||
|
||||
gradientId: `border-box-9-gradient-${id}`,
|
||||
maskId: `border-box-9-mask-${id}`,
|
||||
gradientId: `border-box-9-gradient-${timestamp}`,
|
||||
maskId: `border-box-9-mask-${timestamp}`,
|
||||
|
||||
defaultColor: ['#11eefd', '#0078d2'],
|
||||
|
||||
|
@ -185,7 +184,7 @@ export default {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.dv-border-svg-container {
|
||||
svg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
import Charts from '@jiaminghi/charts'
|
||||
|
@ -21,10 +19,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: `charts-container-${id}`,
|
||||
chartRef: `chart-${id}`,
|
||||
ref: `charts-container-${timestamp}`,
|
||||
chartRef: `chart-${timestamp}`,
|
||||
|
||||
chart: null
|
||||
}
|
||||
|
|
|
@ -147,7 +147,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -163,17 +162,17 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'decoration-10',
|
||||
|
||||
animationId1: `d10ani1${id}`,
|
||||
animationId2: `d10ani2${id}`,
|
||||
animationId3: `d10ani3${id}`,
|
||||
animationId4: `d10ani4${id}`,
|
||||
animationId5: `d10ani5${id}`,
|
||||
animationId6: `d10ani6${id}`,
|
||||
animationId7: `d10ani7${id}`,
|
||||
animationId1: `d10ani1${timestamp}`,
|
||||
animationId2: `d10ani2${timestamp}`,
|
||||
animationId3: `d10ani3${timestamp}`,
|
||||
animationId4: `d10ani4${timestamp}`,
|
||||
animationId5: `d10ani5${timestamp}`,
|
||||
animationId6: `d10ani6${timestamp}`,
|
||||
animationId7: `d10ani7${timestamp}`,
|
||||
|
||||
defaultColor: ['#00c2ff', 'rgba(0, 194, 255, 0.3)'],
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'decoration-11',
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import Decoration12 from './src/main.vue'
|
||||
|
||||
export default function (Vue) {
|
||||
Vue.component(Decoration12.name, Decoration12)
|
||||
}
|
|
@ -1,304 +0,0 @@
|
|||
<template>
|
||||
<div class="dv-decoration-12" :ref="ref">
|
||||
<svg :width="width" :height="height">
|
||||
<defs>
|
||||
<g :id="gId">
|
||||
<path
|
||||
:stroke="pathColor[i]"
|
||||
:stroke-width="width / 2"
|
||||
fill="transparent"
|
||||
v-for="(d, i) in pathD"
|
||||
:key="d"
|
||||
:d="d"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<radialGradient
|
||||
:id="gradientId"
|
||||
cx="50%" cy="50%" r="50%"
|
||||
>
|
||||
<stop offset="0%" stop-color="transparent" stop-opacity="1" />
|
||||
<stop offset="100%" :stop-color="fade(mergedColor[1] || defaultColor[1], 30)" stop-opacity="1" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<circle
|
||||
v-for="r in circleR"
|
||||
:key="r"
|
||||
:r="r"
|
||||
:cx="x"
|
||||
:cy="y"
|
||||
:stroke="mergedColor[1]"
|
||||
:stroke-width="0.5"
|
||||
fill="transparent"
|
||||
/>
|
||||
|
||||
<circle
|
||||
r="1"
|
||||
:cx="x"
|
||||
:cy="y"
|
||||
stroke="transparent"
|
||||
:fill="`url(#${gradientId})`"
|
||||
>
|
||||
<animate
|
||||
attributeName="r"
|
||||
:values="`1;${width / 2}`"
|
||||
:dur="`${haloDur}s`"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
<animate
|
||||
attributeName="opacity"
|
||||
values="1;0"
|
||||
:dur="`${haloDur}s`"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</circle>
|
||||
|
||||
<circle
|
||||
r="2"
|
||||
:cx="x"
|
||||
:cy="y"
|
||||
:fill="mergedColor[1]"
|
||||
/>
|
||||
|
||||
<g v-if="showSplitLine">
|
||||
<polyline
|
||||
v-for="p in splitLinePoints"
|
||||
:key="p"
|
||||
:points="p"
|
||||
:stroke="mergedColor[1]"
|
||||
:stroke-width="0.5"
|
||||
opacity="0.5"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<path
|
||||
v-for="d in arcD"
|
||||
:key="d"
|
||||
:d="d"
|
||||
:stroke="mergedColor[1]"
|
||||
stroke-width="2"
|
||||
fill="transparent"
|
||||
/>
|
||||
|
||||
<use :xlink:href="`#${gId}`">
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
:values="`0, ${x} ${y};360, ${x} ${y}`"
|
||||
:dur="`${scanDur}s`"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</use>
|
||||
</svg>
|
||||
|
||||
<div class="decoration-content">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone, getCircleRadianPoint } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { fade } from '@jiaminghi/color'
|
||||
|
||||
export default {
|
||||
name: 'DvDecoration12',
|
||||
mixins: [autoResize],
|
||||
props: {
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
},
|
||||
/**
|
||||
* @description Scan animation dur
|
||||
*/
|
||||
scanDur: {
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
/**
|
||||
* @description Halo animation dur
|
||||
*/
|
||||
haloDur: {
|
||||
type: Number,
|
||||
default: 2
|
||||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
return {
|
||||
ref: 'decoration-12',
|
||||
gId: `decoration-12-g-${id}`,
|
||||
gradientId: `decoration-12-gradient-${id}`,
|
||||
|
||||
defaultColor: ['#2783ce', '#2cf7fe'],
|
||||
|
||||
mergedColor: [],
|
||||
|
||||
pathD: [],
|
||||
|
||||
pathColor: [],
|
||||
|
||||
circleR: [],
|
||||
|
||||
splitLinePoints: [],
|
||||
|
||||
arcD: [],
|
||||
|
||||
segment: 30,
|
||||
|
||||
sectorAngle: Math.PI / 3,
|
||||
|
||||
ringNum: 3,
|
||||
|
||||
ringWidth: 1,
|
||||
|
||||
showSplitLine: true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
color () {
|
||||
const { mergeColor } = this
|
||||
|
||||
mergeColor()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
x () {
|
||||
const { width } = this
|
||||
|
||||
return width / 2
|
||||
},
|
||||
y () {
|
||||
const { height } = this
|
||||
|
||||
return height / 2
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
const { mergeColor, calcPathD, calcPathColor, calcCircleR, calcSplitLinePoints, calcArcD } = this
|
||||
|
||||
mergeColor()
|
||||
|
||||
calcPathD()
|
||||
|
||||
calcPathColor()
|
||||
|
||||
calcCircleR()
|
||||
|
||||
calcSplitLinePoints()
|
||||
|
||||
calcArcD()
|
||||
},
|
||||
mergeColor () {
|
||||
const { color, defaultColor } = this
|
||||
|
||||
this.mergedColor = deepMerge(deepClone(defaultColor, true), color || [])
|
||||
},
|
||||
calcPathD () {
|
||||
const { x, y, width, segment, sectorAngle } = this
|
||||
|
||||
const startAngle = -Math.PI / 2
|
||||
const angleGap = sectorAngle / segment
|
||||
const r = width / 4
|
||||
let lastEndPoints = getCircleRadianPoint(x, y, r, startAngle)
|
||||
|
||||
this.pathD = new Array(segment)
|
||||
.fill('')
|
||||
.map((_, i) => {
|
||||
const endPoints = getCircleRadianPoint(x, y, r, startAngle - (i + 1) * angleGap).map(_ => _.toFixed(5))
|
||||
const d = `M${lastEndPoints.join(',')} A${r}, ${r} 0 0 0 ${endPoints.join(',')}`
|
||||
lastEndPoints = endPoints
|
||||
|
||||
return d
|
||||
})
|
||||
},
|
||||
calcPathColor () {
|
||||
const { mergedColor: [color], segment } = this
|
||||
|
||||
const colorGap = 100 / (segment - 1)
|
||||
|
||||
this.pathColor = new Array(segment)
|
||||
.fill(color)
|
||||
.map((_, i) => fade(color, 100 - i * colorGap))
|
||||
},
|
||||
calcCircleR () {
|
||||
const { segment, ringNum, width, ringWidth } = this
|
||||
|
||||
const radiusGap = (width / 2 - ringWidth / 2) / ringNum
|
||||
|
||||
this.circleR = new Array(ringNum)
|
||||
.fill(0)
|
||||
.map((_, i) => radiusGap * (i + 1))
|
||||
},
|
||||
calcSplitLinePoints () {
|
||||
const { x, y, width } = this
|
||||
|
||||
const angleGap = Math.PI / 6
|
||||
const r = width / 2
|
||||
|
||||
this.splitLinePoints = new Array(6)
|
||||
.fill('')
|
||||
.map((_, i) => {
|
||||
const startAngle = angleGap * (i + 1)
|
||||
const endAngle = startAngle + Math.PI
|
||||
const startPoint = getCircleRadianPoint(x, y, r, startAngle)
|
||||
const endPoint = getCircleRadianPoint(x, y, r, endAngle)
|
||||
|
||||
return `${startPoint.join(',')} ${endPoint.join(',')}`
|
||||
})
|
||||
},
|
||||
calcArcD () {
|
||||
const { x, y, width } = this
|
||||
|
||||
const angleGap = Math.PI / 6
|
||||
const r = width / 2 - 1
|
||||
|
||||
this.arcD = new Array(4)
|
||||
.fill('')
|
||||
.map((_, i) => {
|
||||
const startAngle = angleGap * (3 * i + 1)
|
||||
const endAngle = startAngle + angleGap
|
||||
const startPoint = getCircleRadianPoint(x, y, r, startAngle)
|
||||
const endPoint = getCircleRadianPoint(x, y, r, endAngle)
|
||||
|
||||
return `M${startPoint.join(',')} A${x}, ${y} 0 0 1 ${endPoint.join(',')}`
|
||||
})
|
||||
},
|
||||
afterAutoResizeMixinInit () {
|
||||
const { init } = this
|
||||
|
||||
init()
|
||||
},
|
||||
fade
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.dv-decoration-12 {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
||||
.decoration-content {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -6,7 +6,7 @@
|
|||
:attributeName="reverse ? 'height' : 'width'"
|
||||
from="0"
|
||||
:to="reverse ? height : width"
|
||||
:dur="`${dur}s`"
|
||||
dur="6s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
keySplines=".42,0,.58,1"
|
||||
|
@ -19,7 +19,7 @@
|
|||
:attributeName="reverse ? 'y' : 'x'"
|
||||
from="0"
|
||||
:to="reverse ? height : width"
|
||||
:dur="`${dur}s`"
|
||||
dur="6s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
keySplines="0.42,0,0.58,1"
|
||||
|
@ -48,10 +48,6 @@ export default {
|
|||
reverse: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dur: {
|
||||
type: Number,
|
||||
default: 6
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="dv-decoration-4" :ref="ref">
|
||||
<div
|
||||
:class="`container ${reverse ? 'reverse' : 'normal'}`"
|
||||
:style="reverse ? `width:${width}px;height:5px;animation-duration:${dur}s` : `width:5px;height:${height}px;animation-duration:${dur}s`"
|
||||
:style="reverse ? `width:${width}px;height:5px` : `width:5px;height:${height}px;`"
|
||||
>
|
||||
<svg :width="reverse ? width : 5" :height="reverse ? 5 : height">
|
||||
<polyline
|
||||
|
@ -40,10 +40,6 @@ export default {
|
|||
reverse: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dur: {
|
||||
type: Number,
|
||||
default: 3
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -87,26 +83,23 @@ export default {
|
|||
display: flex;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.normal {
|
||||
animation: ani-height ease-in-out infinite;
|
||||
height: 0% !important;
|
||||
animation: ani-height 3s ease-in-out infinite;
|
||||
left: 50%;
|
||||
margin-left: -2px;
|
||||
}
|
||||
|
||||
.reverse {
|
||||
animation: ani-width ease-in-out infinite;
|
||||
width: 0% !important;
|
||||
animation: ani-width 3s ease-in-out infinite;
|
||||
top: 50%;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
@keyframes ani-height {
|
||||
0% {
|
||||
height: 0%;
|
||||
}
|
||||
|
||||
70% {
|
||||
height: 100%;
|
||||
}
|
||||
|
@ -117,10 +110,6 @@ export default {
|
|||
}
|
||||
|
||||
@keyframes ani-width {
|
||||
0% {
|
||||
width: 0%;
|
||||
}
|
||||
|
||||
70% {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
attributeType="XML"
|
||||
:from="`0, ${line1Length / 2}, 0, ${line1Length / 2}`"
|
||||
:to="`0, 0, ${line1Length}, 0`"
|
||||
:dur="`${dur}s`"
|
||||
dur="1.2s"
|
||||
begin="0s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
|
@ -31,7 +31,7 @@
|
|||
attributeType="XML"
|
||||
:from="`0, ${line2Length / 2}, 0, ${line2Length / 2}`"
|
||||
:to="`0, 0, ${line2Length}, 0`"
|
||||
:dur="`${dur}s`"
|
||||
dur="1.2s"
|
||||
begin="0s"
|
||||
calcMode="spline"
|
||||
keyTimes="0;1"
|
||||
|
@ -59,10 +59,6 @@ export default {
|
|||
color: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
},
|
||||
dur: {
|
||||
type: Number,
|
||||
default: 1.2
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
|
|
@ -85,7 +85,6 @@
|
|||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
|
@ -107,11 +106,11 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'decoration-9',
|
||||
|
||||
polygonId: `decoration-9-polygon-${id}`,
|
||||
polygonId: `decoration-9-polygon-${timestamp}`,
|
||||
|
||||
svgWH: [100, 100],
|
||||
|
||||
|
|
|
@ -67,11 +67,6 @@ export default {
|
|||
fontSize: 30,
|
||||
fill: '#3de7c9'
|
||||
},
|
||||
/**
|
||||
* @description Number formatter
|
||||
* @type {Null|Function}
|
||||
*/
|
||||
formatter: undefined,
|
||||
/**
|
||||
* @description CRender animationCurve
|
||||
* @type {String}
|
||||
|
@ -135,7 +130,7 @@ export default {
|
|||
})
|
||||
},
|
||||
getShape () {
|
||||
const { number, content, toFixed, textAlign, rowGap, formatter } = this.mergedConfig
|
||||
const { number, content, toFixed, textAlign, rowGap } = this.mergedConfig
|
||||
|
||||
const [w, h] = this.renderer.area
|
||||
|
||||
|
@ -149,8 +144,7 @@ export default {
|
|||
content,
|
||||
toFixed,
|
||||
position,
|
||||
rowGap,
|
||||
formatter
|
||||
rowGap
|
||||
}
|
||||
},
|
||||
getStyle () {
|
||||
|
|
|
@ -153,7 +153,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
|
@ -171,14 +171,14 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'dv-flyline-chart',
|
||||
unique: Math.random(),
|
||||
maskId: `flyline-mask-id-${id}`,
|
||||
maskCircleId: `mask-circle-id-${id}`,
|
||||
gradientId: `gradient-id-${id}`,
|
||||
gradient2Id: `gradient2-id-${id}`,
|
||||
maskId: `flyline-mask-id-${timestamp}`,
|
||||
maskCircleId: `mask-circle-id-${timestamp}`,
|
||||
gradientId: `gradient-id-${timestamp}`,
|
||||
gradient2Id: `gradient2-id-${timestamp}`,
|
||||
|
||||
defaultConfig: {
|
||||
/**
|
||||
|
|
|
@ -155,7 +155,7 @@ import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
||||
import { randomExtend, getPointDistance, uuid } from '../../../util/index'
|
||||
import { randomExtend, getPointDistance } from '../../../util/index'
|
||||
|
||||
import autoResize from '../../../mixin/autoResize'
|
||||
|
||||
|
@ -173,12 +173,12 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
ref: 'dv-flyline-chart-enhanced',
|
||||
unique: Math.random(),
|
||||
flylineGradientId: `flyline-gradient-id-${id}`,
|
||||
haloGradientId: `halo-gradient-id-${id}`,
|
||||
flylineGradientId: `flyline-gradient-id-${timestamp}`,
|
||||
haloGradientId: `halo-gradient-id-${timestamp}`,
|
||||
/**
|
||||
* @description Type Declaration
|
||||
*
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
@ -59,10 +57,10 @@ export default {
|
|||
}
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
gradientId1: `percent-pond-gradientId1-${id}`,
|
||||
gradientId2: `percent-pond-gradientId2-${id}`,
|
||||
gradientId1: `percent-pond-gradientId1-${timestamp}`,
|
||||
gradientId2: `percent-pond-gradientId2-${timestamp}`,
|
||||
|
||||
width: 0,
|
||||
height: 0,
|
||||
|
@ -236,10 +234,10 @@ export default {
|
|||
|
||||
await $nextTick()
|
||||
|
||||
const { clientWidth, clientHeight } = $refs['percent-pond']
|
||||
const dom = $refs['percent-pond']
|
||||
|
||||
this.width = clientWidth
|
||||
this.height = clientHeight
|
||||
this.width = dom.clientWidth
|
||||
this.height = dom.clientHeight
|
||||
},
|
||||
mergeConfig () {
|
||||
const { config, defaultConfig } = this
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div
|
||||
class="header-item"
|
||||
v-for="(headerItem, i) in header"
|
||||
:key="`${headerItem}${i}`"
|
||||
:key="headerItem + i"
|
||||
:style="`
|
||||
height: ${mergedConfig.headerHeight}px;
|
||||
line-height: ${mergedConfig.headerHeight}px;
|
||||
|
@ -23,7 +23,7 @@
|
|||
<div
|
||||
class="row-item"
|
||||
v-for="(row, ri) in rows"
|
||||
:key="`${row.toString()}${row.scroll}`"
|
||||
:key="row.toString() + row.scroll"
|
||||
:style="`
|
||||
height: ${heights[ri]}px;
|
||||
line-height: ${heights[ri]}px;
|
||||
|
@ -33,13 +33,11 @@
|
|||
<div
|
||||
class="ceil"
|
||||
v-for="(ceil, ci) in row.ceils"
|
||||
:key="`${ceil}${ri}${ci}`"
|
||||
:key="ceil + ri + ci"
|
||||
:style="`width: ${widths[ci]}px;`"
|
||||
:align="aligns[ci]"
|
||||
v-html="ceil"
|
||||
@click="emitEvent('click', ri, ci, row, ceil)"
|
||||
@mouseenter="handleHover(true, ri, ci, row, ceil)"
|
||||
@mouseleave="handleHover(false)"
|
||||
@click="emitEvent(ri, ci, row, ceil)"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
@ -148,14 +146,7 @@ export default {
|
|||
* @default carousel = 'single'
|
||||
* @example carousel = 'single' | 'page'
|
||||
*/
|
||||
carousel: 'single',
|
||||
/**
|
||||
* @description Pause scroll when mouse hovered
|
||||
* @type {Boolean}
|
||||
* @default hoverPause = true
|
||||
* @example hoverPause = true | false
|
||||
*/
|
||||
hoverPause: true
|
||||
carousel: 'single'
|
||||
},
|
||||
|
||||
mergedConfig: null,
|
||||
|
@ -178,9 +169,7 @@ export default {
|
|||
|
||||
animationHandler: '',
|
||||
|
||||
updater: 0,
|
||||
|
||||
needCalc: false
|
||||
updater: 0
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -189,24 +178,10 @@ export default {
|
|||
|
||||
stopAnimation()
|
||||
|
||||
this.animationIndex = 0
|
||||
|
||||
calcData()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleHover(enter, ri, ci, row, ceil){
|
||||
const { mergedConfig, emitEvent, stopAnimation, animation } = this
|
||||
|
||||
if (enter) emitEvent('mouseover', ri, ci, row, ceil)
|
||||
if (!mergedConfig.hoverPause) return
|
||||
|
||||
if (enter) {
|
||||
stopAnimation()
|
||||
} else {
|
||||
animation(true)
|
||||
}
|
||||
},
|
||||
afterAutoResizeMixinInit () {
|
||||
const { calcData } = this
|
||||
|
||||
|
@ -337,14 +312,6 @@ export default {
|
|||
this.aligns = deepMerge(aligns, align)
|
||||
},
|
||||
async animation (start = false) {
|
||||
const { needCalc, calcHeights, calcRowsData } = this
|
||||
|
||||
if (needCalc) {
|
||||
calcRowsData()
|
||||
calcHeights()
|
||||
this.needCalc = false
|
||||
}
|
||||
|
||||
let { avgHeight, animationIndex, mergedConfig, rowsData, animation, updater } = this
|
||||
|
||||
const { waitTime, carousel, rowNum } = mergedConfig
|
||||
|
@ -363,7 +330,7 @@ export default {
|
|||
let rows = rowsData.slice(animationIndex)
|
||||
rows.push(...rowsData.slice(0, animationIndex))
|
||||
|
||||
this.rows = rows.slice(0, carousel === 'page' ? rowNum * 2 : rowNum + 1)
|
||||
this.rows = rows
|
||||
this.heights = new Array(rowLength).fill(avgHeight)
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 300))
|
||||
|
@ -388,28 +355,15 @@ export default {
|
|||
|
||||
clearTimeout(animationHandler)
|
||||
},
|
||||
emitEvent (type, ri, ci, row, ceil) {
|
||||
emitEvent (ri, ci, row, ceil) {
|
||||
const { ceils, rowIndex } = row
|
||||
|
||||
this.$emit(type, {
|
||||
this.$emit('click', {
|
||||
row: ceils,
|
||||
ceil,
|
||||
rowIndex,
|
||||
columnIndex: ci
|
||||
})
|
||||
},
|
||||
updateRows(rows, animationIndex) {
|
||||
const { mergedConfig, animationHandler, animation } = this
|
||||
|
||||
this.mergedConfig = {
|
||||
...mergedConfig,
|
||||
data: [...rows]
|
||||
}
|
||||
|
||||
this.needCalc = true
|
||||
|
||||
if (typeof animationIndex === 'number') this.animationIndex = animationIndex
|
||||
if (!animationHandler) animation(true)
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="ranking-info">
|
||||
<div class="rank">No.{{ item.ranking }}</div>
|
||||
<div class="info-name" v-html="item.name" />
|
||||
<div class="ranking-value">{{ mergedConfig.valueFormatter ? mergedConfig.valueFormatter(item) : item.value + mergedConfig.unit }}</div>
|
||||
<div class="ranking-value">{{ item.value + mergedConfig.unit }}</div>
|
||||
</div>
|
||||
|
||||
<div class="ranking-column">
|
||||
|
@ -82,13 +82,7 @@ export default {
|
|||
* @type {Boolean}
|
||||
* @default sort = true
|
||||
*/
|
||||
sort: true,
|
||||
/**
|
||||
* @description Value formatter
|
||||
* @type {Function}
|
||||
* @default valueFormatter = null
|
||||
*/
|
||||
valueFormatter: null
|
||||
sort: true
|
||||
},
|
||||
|
||||
mergedConfig: null,
|
||||
|
@ -158,20 +152,10 @@ export default {
|
|||
})
|
||||
|
||||
const value = data.map(({ value }) => value)
|
||||
|
||||
const min = Math.min(...value) || 0
|
||||
|
||||
// abs of min
|
||||
const minAbs = Math.abs(min)
|
||||
|
||||
const max = Math.max(...value) || 0
|
||||
|
||||
// abs of max
|
||||
const maxAbs = Math.abs(max)
|
||||
|
||||
const total = max + minAbs
|
||||
|
||||
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))
|
||||
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: row.value / max * 100 }))
|
||||
|
||||
const rowLength = data.length
|
||||
|
||||
|
@ -214,7 +198,7 @@ export default {
|
|||
let rows = rowsData.slice(animationIndex)
|
||||
rows.push(...rowsData.slice(0, animationIndex))
|
||||
|
||||
this.rows = rows.slice(0, rowNum + 1)
|
||||
this.rows = rows
|
||||
this.heights = new Array(rowLength).fill(avgHeight)
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 300))
|
||||
|
@ -238,7 +222,7 @@ export default {
|
|||
if (!animationHandler) return
|
||||
|
||||
clearTimeout(animationHandler)
|
||||
},
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
const { stopAnimation } = this
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
</defs>
|
||||
|
||||
<text
|
||||
v-if="renderer"
|
||||
:stroke="`url(#${gradientId})`"
|
||||
:fill="`url(#${gradientId})`"
|
||||
:x="renderer.area[0] / 2 + 8"
|
||||
|
@ -39,8 +40,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { uuid } from '../../../util/index'
|
||||
|
||||
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||
|
||||
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||
|
@ -54,9 +53,9 @@ export default {
|
|||
default: () => ({})
|
||||
},
|
||||
data () {
|
||||
const id = uuid()
|
||||
const timestamp = Date.now()
|
||||
return {
|
||||
gradientId: `water-level-pond-${id}`,
|
||||
gradientId: `water-level-pond-${timestamp}`,
|
||||
|
||||
defaultConfig: {
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,6 @@ import decoration8 from './components/decoration8/index'
|
|||
import decoration9 from './components/decoration9/index'
|
||||
import decoration10 from './components/decoration10/index'
|
||||
import decoration11 from './components/decoration11/index'
|
||||
import decoration12 from './components/decoration12/index'
|
||||
|
||||
// charts
|
||||
import charts from './components/charts/index'
|
||||
|
@ -81,7 +80,6 @@ export default function (Vue) {
|
|||
Vue.use(decoration9)
|
||||
Vue.use(decoration10)
|
||||
Vue.use(decoration11)
|
||||
Vue.use(decoration12)
|
||||
|
||||
// charts
|
||||
Vue.use(charts)
|
||||
|
|
|
@ -29,17 +29,11 @@ export default {
|
|||
const { $nextTick, $refs, ref, onResize } = this
|
||||
|
||||
return new Promise(resolve => {
|
||||
$nextTick(_ => {
|
||||
$nextTick(e => {
|
||||
const dom = this.dom = $refs[ref]
|
||||
|
||||
this.width = dom ? dom.clientWidth : 0
|
||||
this.height = dom ? dom.clientHeight : 0
|
||||
|
||||
if (!dom) {
|
||||
console.warn('DataV: Failed to get dom node, component rendering may be abnormal!')
|
||||
} else if (!this.width || !this.height) {
|
||||
console.warn('DataV: Component width or height is 0px, rendering abnormality may occur!')
|
||||
}
|
||||
this.width = dom.clientWidth
|
||||
this.height = dom.clientHeight
|
||||
|
||||
if (typeof onResize === 'function' && resize) onResize()
|
||||
|
||||
|
@ -62,8 +56,6 @@ export default {
|
|||
unbindDomResizeCallback () {
|
||||
let { domObserver, debounceInitWHFun } = this
|
||||
|
||||
if (!domObserver) return
|
||||
|
||||
domObserver.disconnect()
|
||||
domObserver.takeRecords()
|
||||
domObserver = null
|
||||
|
|
|
@ -37,11 +37,3 @@ export function getPointDistance (pointOne, pointTwo) {
|
|||
|
||||
return Math.sqrt(minusX * minusX + minusY * minusY)
|
||||
}
|
||||
|
||||
export function uuid (hasHyphen) {
|
||||
return (hasHyphen ? 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' : 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx').replace(/[xy]/g, function (c) {
|
||||
const r = Math.random() * 16 | 0
|
||||
const v = c == 'x' ? r : (r & 0x3 | 0x8)
|
||||
return v.toString(16)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue