Skip to content

Commit

Permalink
chore: eslint 格式化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
vaemusic committed May 22, 2024
1 parent 5b7f8d4 commit e7e48c7
Showing 23 changed files with 604 additions and 620 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"prettier.enable": false,
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.eslint": "explicit",
},
"files.associations": {
"*.css": "postcss",
Original file line number Diff line number Diff line change
@@ -296,7 +296,7 @@ function ringAnimation() {
state.chart.setOption(option, true)
const { activeTimeGap } = option.series[0]
state.animationHandler = setTimeout((foo) => {
state.animationHandler = setTimeout(() => {
state.activeIndex += 1
if (state.activeIndex >= data.length)
16 changes: 8 additions & 8 deletions packages/datav-vue3/components/Button/src/index.vue
Original file line number Diff line number Diff line change
@@ -29,14 +29,6 @@ interface ButtonProps {
fontSize?: number
}
const props = withDefaults(defineProps<ButtonProps>(), {
color: '#2058c7',
fontColor: '',
bg: true,
border: 'Border1',
fontSize: 14,
})
defineOptions({
components: {
Border1,
@@ -48,6 +40,14 @@ defineOptions({
},
})
const props = withDefaults(defineProps<ButtonProps>(), {
color: '#2058c7',
fontColor: '',
bg: true,
border: 'Border1',
fontSize: 14,
})
const hoverColor = computed(() => lighten(props.color, 40))
const fontColorCalc = computed(() => props.fontColor === '' ? props.color : props.fontColor)
64 changes: 32 additions & 32 deletions packages/datav-vue3/components/ConicalColumnChart/src/index.vue
Original file line number Diff line number Diff line change
@@ -53,52 +53,52 @@ const { width, height } = autoResize(conicalColumnChart, onResize, afterAutoResi
const state = reactive({
defaultConfig: {
/**
* @description Chart data
* @type {Array<Object>}
* @default data = []
*/
* @description Chart data
* @type {Array<object>}
* @default data = []
*/
data: [],
/**
* @description Chart img
* @type {Array<String>}
* @default img = []
*/
* @description Chart img
* @type {Array<string>}
* @default img = []
*/
img: [],
/**
* @description Chart font size
* @type {Number}
* @default fontSize = 12
*/
* @description Chart font size
* @type {number}
* @default fontSize = 12
*/
fontSize: 12,
/**
* @description Img side length
* @type {Number}
* @default imgSideLength = 30
*/
* @description Img side length
* @type {number}
* @default imgSideLength = 30
*/
imgSideLength: 30,
/**
* @description Column color
* @type {String}
* @default columnColor = 'rgba(0, 194, 255, 0.4)'
*/
* @description Column color
* @type {string}
* @default columnColor = 'rgba(0, 194, 255, 0.4)'
*/
columnColor: 'rgba(0, 194, 255, 0.4)',
/**
* @description Text color
* @type {String}
* @default textColor = '#fff'
*/
* @description Text color
* @type {string}
* @default textColor = '#fff'
*/
textColor: '#fff',
/**
* @description Show value
* @type {Boolean}
* @default showValue = false
*/
* @description Show value
* @type {boolean}
* @default showValue = false
*/
showValue: false,
/**
* @description Auto sort by value
* @type {Boolean}
* @default sort = true
*/
* @description Auto sort by value
* @type {boolean}
* @default sort = true
*/
sort: true,
},
21 changes: 9 additions & 12 deletions packages/datav-vue3/components/Decoration1/src/index.vue
Original file line number Diff line number Diff line change
@@ -77,51 +77,49 @@ const state = reactive({
svgScale: [1, 1],
})
const onResize = () => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
function onResize() {
calcSVGData()
}
const afterAutoResizeMixinInit = () => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
function afterAutoResizeMixinInit() {
calcSVGData()
}
const { width, height } = autoResize(dvDecoration1, onResize, afterAutoResizeMixinInit)
const calcPointsPosition = () => {
function calcPointsPosition() {
const [w, h] = svgWH
const horizontalGap = w / (rowPoints.value + 1)
const verticalGap = h / (rowNum.value + 1)
const newPoints: Array<any> = new Array(rowNum.value).fill(0).map((foo, i) =>
new Array(rowPoints.value).fill(0).map((foo, j) => [
const newPoints: Array<any> = Array.from({ length: rowNum.value }).fill(0).map((foo, i) =>
Array.from({ length: rowPoints.value }).fill(0).map((foo, j) => [
horizontalGap * (j + 1), verticalGap * (i + 1),
]))
state.points = newPoints.reduce((all, item) => [...all, ...item], [])
}
const calcRectsPosition = () => {
function calcRectsPosition() {
const rect1 = state.points[rowPoints.value * 2 - 1]
const rect2 = state.points[rowPoints.value * 2 - 3]
state.rects = [rect1, rect2]
}
const calcScale = () => {
function calcScale() {
const [w, h] = svgWH
state.svgScale = [width.value / w, height.value / h]
}
const calcSVGData = () => {
function calcSVGData() {
calcPointsPosition()
calcRectsPosition()
calcScale()
}
const mergeColor = () => {
function mergeColor() {
state.mergedColor = deepMerge(deepClone(defaultColor, true), props.color || [])
}
@@ -132,7 +130,6 @@ watch(() => props.color, () => {
onMounted(() => {
mergeColor()
})
</script>

<style lang="less">
20 changes: 10 additions & 10 deletions packages/datav-vue3/components/Decoration12/src/index.vue
Original file line number Diff line number Diff line change
@@ -110,15 +110,15 @@ const props = defineProps({
default: () => ([]),
},
/**
* @description Scan animation dur
*/
* @description Scan animation dur
*/
scanDur: {
type: Number,
default: 3,
},
/**
* @description Halo animation dur
*/
* @description Halo animation dur
*/
haloDur: {
type: Number,
default: 2,
@@ -195,10 +195,10 @@ function calcPathD() {
const r = width.value / 4
let lastEndPoints = getCircleRadianPoint(x.value, y.value, r, startAngle)
state.pathD = new Array(state.segment)
state.pathD = Array.from({ length: state.segment })
.fill('')
.map((_, i) => {
const endPoints = getCircleRadianPoint(x.value, y.value, r, startAngle - (i + 1) * angleGap).map(_ => parseFloat(_.toFixed(5)))
const endPoints = getCircleRadianPoint(x.value, y.value, r, startAngle - (i + 1) * angleGap).map(_ => Number.parseFloat(_.toFixed(5)))
const d = `M${lastEndPoints.join(',')} A${r}, ${r} 0 0 0 ${endPoints.join(',')}`
lastEndPoints = endPoints
return d
@@ -208,15 +208,15 @@ function calcPathD() {
function calcPathColor() {
const colorGap = 100 / (state.segment - 1)
state.pathColor = new Array(state.segment)
state.pathColor = Array.from({ length: state.segment })
.fill(state.mergedColor[0])
.map((_, i) => fade(state.mergedColor[0], 100 - i * colorGap))
}
function calcCircleR() {
const radiusGap = (width.value / 2 - state.ringWidth / 2) / state.ringNum
state.circleR = new Array(state.ringNum)
state.circleR = Array.from({ length: state.ringNum })
.fill(0)
.map((_, i) => radiusGap * (i + 1))
}
@@ -225,7 +225,7 @@ function calcSplitLinePoints() {
const angleGap = Math.PI / 6
const r = width.value / 2
state.splitLinePoints = new Array(6)
state.splitLinePoints = Array.from({ length: 6 })
.fill('')
.map((_, i) => {
const startAngle = angleGap * (i + 1)
@@ -241,7 +241,7 @@ function calcArcD() {
const angleGap = Math.PI / 6
const r = width.value / 2 - 1
state.arcD = new Array(4)
state.arcD = Array.from({ length: 4 })
.fill('')
.map((_, i) => {
const startAngle = angleGap * (3 * i + 1)
11 changes: 4 additions & 7 deletions packages/datav-vue3/components/Decoration2/src/index.vue
Original file line number Diff line number Diff line change
@@ -47,23 +47,21 @@ const state = reactive({
mergedColor: [],
})
const mergeColor = () => {
function mergeColor() {
state.mergedColor = deepMerge(deepClone(state.defaultColor, true), props.color || [])
}
const onResize = () => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
function onResize() {
calcSVGData()
}
const afterAutoResizeMixinInit = () => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
function afterAutoResizeMixinInit() {
calcSVGData()
}
const { width, height } = autoResize(decoration2, onResize, afterAutoResizeMixinInit)
const calcSVGData = () => {
function calcSVGData() {
if (props.reverse) {
state.w = 1
state.h = height.value
@@ -89,7 +87,6 @@ watch(() => props.reverse, () => {
onMounted(() => {
mergeColor()
})
</script>

<style lang="less">
21 changes: 10 additions & 11 deletions packages/datav-vue3/components/Decoration3/src/index.vue
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
v-if="Math.random() > 0.6"
attributeName="fill"
:values="`${state.mergedColor.join(';')}`"
:dur="Math.random() + 1 + 's'"
:dur="`${Math.random() + 1}s`"
:begin="Math.random() * 2"
repeatCount="indefinite"
/>
@@ -52,44 +52,43 @@ const state = reactive({
mergedColor: [],
})
const calcPointsPosition = () => {
function calcPointsPosition() {
const [w, h] = state.svgWH
const horizontalGap = w / (state.rowPoints + 1)
const verticalGap = h / (state.rowNum + 1)
const points = new Array(state.rowNum).fill(0).map((foo, i) =>
new Array(state.rowPoints).fill(0).map((foo, j) => [
const points = Array.from({ length: state.rowNum }).fill(0).map((foo, i) =>
Array.from({ length: state.rowPoints }).fill(0).map((foo, j) => [
horizontalGap * (j + 1), verticalGap * (i + 1),
]))
state.points = points.reduce((all, item) => [...all, ...item], [])
}
const afterAutoResizeMixinInit = () => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
function afterAutoResizeMixinInit() {
calcSVGData()
}
const calcSVGData = () => {
function calcSVGData() {
calcPointsPosition()
// eslint-disable-next-line @typescript-eslint/no-use-before-define
calcScale()
}
const onResize = () => {
function onResize() {
calcSVGData()
}
const { width, height } = autoResize(decoration3, onResize, afterAutoResizeMixinInit)
const calcScale = () => {
function calcScale() {
const [w, h] = state.svgWH
state.svgScale = [width.value / w, height.value / h]
}
const mergeColor = () => {
function mergeColor() {
state.mergedColor = deepMerge(deepClone(state.defaultColor, true), props.color || [])
}
3 changes: 1 addition & 2 deletions packages/datav-vue3/components/Decoration4/src/index.vue
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ const state = reactive({
mergedColor: [],
})
const mergeColor = () => {
function mergeColor() {
state.mergedColor = deepMerge(deepClone(state.defaultColor, true), props.color || [])
}
@@ -61,7 +61,6 @@ watch(() => props.color, () => {
onMounted(() => {
mergeColor()
})
</script>

<style lang="less">
Loading

0 comments on commit e7e48c7

Please sign in to comment.