Skip to content

Commit

Permalink
update dist and lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaming743 committed Sep 9, 2020
1 parent fdd1117 commit ebf1354
Show file tree
Hide file tree
Showing 12 changed files with 956 additions and 213 deletions.
820 changes: 618 additions & 202 deletions dist/datav.map.vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/datav.min.vue.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions lib/components/activeRingChart/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export default {
* @type {Number}
*/
digitalFlopToFixed: 0,
/**
* @description Digital flop unit
* @type {String}
*/
digitalFlopUnit: '',
/**
* @description CRender animationCurve
* @type {String}
Expand Down Expand Up @@ -122,7 +127,8 @@ export default {
digitalFlopStyle,
digitalFlopToFixed,
data,
showOriginValue
showOriginValue,
digitalFlopUnit
} = mergedConfig
const value = data.map(({ value }) => value)
Expand All @@ -140,7 +146,7 @@ export default {
}
return {
content: showOriginValue ? '{nt}' : '{nt}%',
content: showOriginValue ? `{nt}${digitalFlopUnit}` : `{nt}${digitalFlopUnit || '%'}`,
number: [displayValue],
style: digitalFlopStyle,
toFixed: digitalFlopToFixed
Expand Down
6 changes: 6 additions & 0 deletions lib/components/decoration12/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './src/main.css'
import Decoration12 from './src/main.vue'

export default function (Vue) {
Vue.component(Decoration12.name, Decoration12)
}
16 changes: 16 additions & 0 deletions lib/components/decoration12/src/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.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;
}
284 changes: 284 additions & 0 deletions lib/components/decoration12/src/main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
<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>
8 changes: 6 additions & 2 deletions lib/components/decoration2/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:attributeName="reverse ? 'height' : 'width'"
from="0"
:to="reverse ? height : width"
dur="6s"
:dur="`${dur}s`"
calcMode="spline"
keyTimes="0;1"
keySplines=".42,0,.58,1"
Expand All @@ -19,7 +19,7 @@
:attributeName="reverse ? 'y' : 'x'"
from="0"
:to="reverse ? height : width"
dur="6s"
:dur="`${dur}s`"
calcMode="spline"
keyTimes="0;1"
keySplines="0.42,0,0.58,1"
Expand Down Expand Up @@ -48,6 +48,10 @@ export default {
reverse: {
type: Boolean,
default: false
},
dur: {
type: Number,
default: 6
}
},
data () {
Expand Down
4 changes: 2 additions & 2 deletions lib/components/decoration4/src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
flex: 1;
}
.dv-decoration-4 .normal {
animation: ani-height 3s ease-in-out infinite;
animation: ani-height ease-in-out infinite;
left: 50%;
margin-left: -2px;
}
.dv-decoration-4 .reverse {
animation: ani-width 3s ease-in-out infinite;
animation: ani-width ease-in-out infinite;
top: 50%;
margin-top: -2px;
}
Expand Down
Loading

0 comments on commit ebf1354

Please sign in to comment.