Compare commits
23 Commits
V2.0.0-alp
...
V2.3.0-alp
Author | SHA1 | Date | |
---|---|---|---|
3e5b960abd | |||
52889640ad | |||
3f22338861 | |||
070a47011b | |||
ca392ba2f7 | |||
3fb3936aa9 | |||
bfc7cc7c57 | |||
f7d702588c | |||
ee62dae22c | |||
23e19af8b9 | |||
6c5b5593d4 | |||
376d723a2b | |||
562a262bf4 | |||
addf491d2b | |||
a842010afd | |||
7b55614d43 | |||
d586db9176 | |||
ad090aca3b | |||
b9a1f667ee | |||
14c5ba753d | |||
a8ef114cc2 | |||
16a31ed68f | |||
3cde8e553a |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
|
/lib
|
||||||
/dist
|
/dist
|
||||||
/.svn
|
/.svn
|
||||||
/DataV
|
/DataV
|
||||||
@ -12,6 +13,7 @@ node_modules
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.idea
|
.idea
|
||||||
|
7
.npmignore
Normal file
7
.npmignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
src/
|
||||||
|
publish/
|
||||||
|
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
|
prepublish.js
|
||||||
|
publish.js
|
95
CHANGELOG.md
95
CHANGELOG.md
@ -1,3 +1,98 @@
|
|||||||
|
# 2.3.0-alpha (2019-07-04)
|
||||||
|
|
||||||
|
### Directory Structure Change
|
||||||
|
|
||||||
|
* **before**
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── components
|
||||||
|
│ ├── borderBox1
|
||||||
|
│ │ └── index.vue
|
||||||
|
│ ├── borderBox2
|
||||||
|
│ │ └── index.vue
|
||||||
|
│ ├── etc.
|
||||||
|
│ └── index.js
|
||||||
|
├── mixins
|
||||||
|
│ └── autoResize.js
|
||||||
|
├── util
|
||||||
|
│ └── index.js
|
||||||
|
│
|
||||||
|
├── index.js
|
||||||
|
│
|
||||||
|
├── package.json // main: 'index.js'
|
||||||
|
└── etc.
|
||||||
|
```
|
||||||
|
|
||||||
|
* **after**
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── lib // After compilation
|
||||||
|
│ ├── components
|
||||||
|
│ │ ├── borderBox1
|
||||||
|
│ │ | ├── src
|
||||||
|
│ │ | | ├── main.vue
|
||||||
|
│ │ | | └── main.css
|
||||||
|
│ │ | └── index.js
|
||||||
|
│ │ ├── etc.
|
||||||
|
│ │ └── index.js
|
||||||
|
│ ├── mixin
|
||||||
|
│ │ └── autoResize.js
|
||||||
|
│ ├── util
|
||||||
|
│ │ └── index.js
|
||||||
|
│ └── index.js
|
||||||
|
│
|
||||||
|
├── publish // For pre-publish process
|
||||||
|
│
|
||||||
|
├── src // For development environments
|
||||||
|
│ ├── components
|
||||||
|
│ │ ├── borderBox1
|
||||||
|
│ │ | ├── src
|
||||||
|
│ │ | | └── main.vue
|
||||||
|
│ │ | └── index.js
|
||||||
|
│ │ ├── etc.
|
||||||
|
│ │ └── index.js
|
||||||
|
│ ├── mixin
|
||||||
|
│ │ └── autoResize.js
|
||||||
|
│ ├── util
|
||||||
|
│ │ └── index.js
|
||||||
|
│ └── index.js
|
||||||
|
│
|
||||||
|
├── package.json // main: '/lib/index.js'
|
||||||
|
├── publish.js
|
||||||
|
└── etc.
|
||||||
|
```
|
||||||
|
|
||||||
|
* **Introduced on demand**
|
||||||
|
|
||||||
|
```js
|
||||||
|
import borderBox1 from '@jiaminghi/data-view/lib/components/borderBox1'
|
||||||
|
|
||||||
|
Vue.use(borderBox1)
|
||||||
|
```
|
||||||
|
|
||||||
|
# 2.2.0-alpha (2019-06-29)
|
||||||
|
|
||||||
|
### New
|
||||||
|
|
||||||
|
- **borderBox**
|
||||||
|
- **decoration**
|
||||||
|
|
||||||
|
# 2.1.1-alpha (2019-06-28)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- **autoResize:** Exception caused by `autoResize` mixin.
|
||||||
|
- **charts:** `Legend` is blocked by slot and can't click.
|
||||||
|
|
||||||
|
# 2.1.0-alpha (2019-06-27)
|
||||||
|
|
||||||
|
### New
|
||||||
|
|
||||||
|
- **conicalColumnChart**
|
||||||
|
- **scrollRankingBoard**
|
||||||
|
|
||||||
# 2.0.0-alpha (2019-06-26)
|
# 2.0.0-alpha (2019-06-26)
|
||||||
|
|
||||||
### Perfect
|
### Perfect
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
import fullScreenContainer from './fullScreenContainer'
|
|
||||||
import loading from './loading/index.vue'
|
|
||||||
|
|
||||||
// border box
|
|
||||||
import borderBox1 from './borderBox1/index'
|
|
||||||
import borderBox2 from './borderBox2/index'
|
|
||||||
import borderBox3 from './borderBox3/index'
|
|
||||||
import borderBox4 from './borderBox4/index'
|
|
||||||
import borderBox5 from './borderBox5/index'
|
|
||||||
import borderBox6 from './borderBox6/index'
|
|
||||||
import borderBox7 from './borderBox7/index'
|
|
||||||
import borderBox8 from './borderBox8/index'
|
|
||||||
|
|
||||||
// decoration
|
|
||||||
import decoration1 from './decoration1/index'
|
|
||||||
import decoration2 from './decoration2/index'
|
|
||||||
import decoration3 from './decoration3/index'
|
|
||||||
import decoration4 from './decoration4/index'
|
|
||||||
import decoration5 from './decoration5/index'
|
|
||||||
import decoration6 from './decoration6/index'
|
|
||||||
import decoration7 from './decoration7/index'
|
|
||||||
import decoration8 from './decoration8/index'
|
|
||||||
|
|
||||||
// charts
|
|
||||||
import charts from './charts/index.vue'
|
|
||||||
|
|
||||||
import activeRingChart from './activeRingChart'
|
|
||||||
import waterLevelPond from './waterLevelPond/index.vue'
|
|
||||||
import percentPond from './percentPond/index.vue'
|
|
||||||
import flylineChart from './flylineChart'
|
|
||||||
import digitalFlop from './digitalFlop'
|
|
||||||
import scrollBoard from './scrollBoard/index.vue'
|
|
||||||
|
|
||||||
export default function (Vue) {
|
|
||||||
Vue.component('dvFullScreenContainer', fullScreenContainer)
|
|
||||||
|
|
||||||
Vue.component('dvLoading', loading)
|
|
||||||
|
|
||||||
// border box
|
|
||||||
Vue.component('dvBorderBox1', borderBox1)
|
|
||||||
Vue.component('dvBorderBox2', borderBox2)
|
|
||||||
Vue.component('dvBorderBox3', borderBox3)
|
|
||||||
Vue.component('dvBorderBox4', borderBox4)
|
|
||||||
Vue.component('dvBorderBox5', borderBox5)
|
|
||||||
Vue.component('dvBorderBox6', borderBox6)
|
|
||||||
Vue.component('dvBorderBox7', borderBox7)
|
|
||||||
Vue.component('dvBorderBox8', borderBox8)
|
|
||||||
|
|
||||||
// decoration
|
|
||||||
Vue.component('dvDecoration1', decoration1)
|
|
||||||
Vue.component('dvDecoration2', decoration2)
|
|
||||||
Vue.component('dvDecoration3', decoration3)
|
|
||||||
Vue.component('dvDecoration4', decoration4)
|
|
||||||
Vue.component('dvDecoration5', decoration5)
|
|
||||||
Vue.component('dvDecoration6', decoration6)
|
|
||||||
Vue.component('dvDecoration7', decoration7)
|
|
||||||
Vue.component('dvDecoration8', decoration8)
|
|
||||||
|
|
||||||
// charts
|
|
||||||
Vue.component('dvCharts', charts)
|
|
||||||
|
|
||||||
Vue.component('dvActiveRingChart', activeRingChart)
|
|
||||||
Vue.component('dvWaterLevelPond', waterLevelPond)
|
|
||||||
Vue.component('dvPercentPond', percentPond)
|
|
||||||
Vue.component('dvFlylineChart', flylineChart)
|
|
||||||
Vue.component('dvDigitalFlop', digitalFlop)
|
|
||||||
|
|
||||||
Vue.component('dvScrollBoard', scrollBoard)
|
|
||||||
}
|
|
10
package.json
10
package.json
@ -1,14 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@jiaminghi/data-view",
|
"name": "@jiaminghi/data-view",
|
||||||
"version": "2.0.0",
|
"version": "2.3.0",
|
||||||
"author": "JiaMing <743192023@qq.com>",
|
"author": "JiaMing <743192023@qq.com>",
|
||||||
"description": "Vue Large screen data display component library",
|
"description": "Vue Large screen data display component library",
|
||||||
"main": "index.js",
|
"main": "/lib/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/jiaming743/DataV.git"
|
"url": "https://github.com/jiaming743/DataV.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"compile": "node publish.js",
|
||||||
|
"prepublish": "npm run compile",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -20,10 +22,6 @@
|
|||||||
"chart",
|
"chart",
|
||||||
"dataview"
|
"dataview"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
|
||||||
"less": "^3.9.0",
|
|
||||||
"less-loader": "^4.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jiaminghi/charts": "*"
|
"@jiaminghi/charts": "*"
|
||||||
},
|
},
|
||||||
|
3
publish.js
Normal file
3
publish.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const start = require('./publish/index')
|
||||||
|
|
||||||
|
start()
|
151
publish/index.js
Normal file
151
publish/index.js
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
const { copyDir, fileForEach, readFile, writeFile, unlinkDirFileByExtname } = require('./plugin/fs')
|
||||||
|
const print = require('./plugin/print')
|
||||||
|
const path = require('path')
|
||||||
|
const doExec = require('./plugin/exec')
|
||||||
|
|
||||||
|
const PACKAGE_SRC = './src'
|
||||||
|
const COMPILE_SRC = './lib'
|
||||||
|
|
||||||
|
async function start () {
|
||||||
|
const copyPackage = await copyDir(PACKAGE_SRC, COMPILE_SRC)
|
||||||
|
|
||||||
|
if (!copyPackage) {
|
||||||
|
print.error('Exception in file copy!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
print.success('Complete file copy!')
|
||||||
|
|
||||||
|
const abstract = await abstractLessFromVue()
|
||||||
|
|
||||||
|
if (!abstract) {
|
||||||
|
print.error('Exception in less file extraction!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
print.success('Complete less file extraction!')
|
||||||
|
|
||||||
|
await compileLessToCss()
|
||||||
|
|
||||||
|
print.success('Complete less compilation to css!')
|
||||||
|
|
||||||
|
const unlink = await unlinkDirFileByExtname(COMPILE_SRC, ['.less'])
|
||||||
|
|
||||||
|
if (!unlink) {
|
||||||
|
print.error('Exception in less file deletion!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
print.success('Complete less file deletion!')
|
||||||
|
|
||||||
|
const addImport = await addCssImport()
|
||||||
|
|
||||||
|
if (!addImport) {
|
||||||
|
print.error('Exception in adding css import statement!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
print.success('Finish adding css import statement!')
|
||||||
|
|
||||||
|
print.yellow('-------------------------------------')
|
||||||
|
print.success(' DataV lib Compile Success! ')
|
||||||
|
print.yellow('-------------------------------------')
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function abstractLessFromVue () {
|
||||||
|
let abstractSuccess = true
|
||||||
|
|
||||||
|
await fileForEach(COMPILE_SRC, async src => {
|
||||||
|
if (path.extname(src) !== '.vue') return
|
||||||
|
|
||||||
|
let template = await readFile(src)
|
||||||
|
|
||||||
|
let style = template.match(/<style[ \S\n\r]*/g)
|
||||||
|
if (style) style = style[0]
|
||||||
|
if (!style) return
|
||||||
|
|
||||||
|
style = style.replace(/<style[ a-z="']*>(\n|\r)?|<\/style>/g, '')
|
||||||
|
style = style.replace(/[\n\r]*$/, '')
|
||||||
|
|
||||||
|
const styleSrc = src.replace('.vue', '.less')
|
||||||
|
let write = await writeFile(styleSrc, style)
|
||||||
|
|
||||||
|
if (!write) {
|
||||||
|
print.error(styleSrc + ' write error!')
|
||||||
|
|
||||||
|
abstractSuccess = false
|
||||||
|
}
|
||||||
|
|
||||||
|
template = template.replace(/<style[ \S\n\r]*/g, '')
|
||||||
|
template = template.replace(/[\n\r]*$/, '')
|
||||||
|
write = await writeFile(src, template)
|
||||||
|
|
||||||
|
if (!write) {
|
||||||
|
print.error(src + ' rewrite error!')
|
||||||
|
|
||||||
|
abstractSuccess = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return abstractSuccess
|
||||||
|
}
|
||||||
|
|
||||||
|
async function compileLessToCss () {
|
||||||
|
let compileSuccess = true
|
||||||
|
|
||||||
|
await fileForEach(COMPILE_SRC, async src => {
|
||||||
|
if (path.extname(src) !== '.less') return
|
||||||
|
|
||||||
|
src = src.replace('./', '')
|
||||||
|
|
||||||
|
const execString = `lessc ${src} ${src.replace('less', 'css')}`
|
||||||
|
|
||||||
|
print.yellow(execString, {
|
||||||
|
maxBuffer: 1024 ** 5
|
||||||
|
})
|
||||||
|
|
||||||
|
const compile = await doExec(execString)
|
||||||
|
|
||||||
|
if (!compile) {
|
||||||
|
print.error(execString + ' Error!')
|
||||||
|
|
||||||
|
compileSuccess = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return compileSuccess
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addCssImport () {
|
||||||
|
let importSuccess = true
|
||||||
|
|
||||||
|
await fileForEach(COMPILE_SRC + '/components', async src => {
|
||||||
|
if (path.extname(src) !== '.js') return
|
||||||
|
|
||||||
|
let content = await readFile(src)
|
||||||
|
|
||||||
|
if (content.search(/import[ \S]* from '[\S]*\.vue'/) === -1) return
|
||||||
|
|
||||||
|
content = `import './src/main.css'\n` + content
|
||||||
|
|
||||||
|
let write = await writeFile(src, content)
|
||||||
|
|
||||||
|
if (!write) {
|
||||||
|
print.error(src + ' write import error!')
|
||||||
|
|
||||||
|
importSuccess = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return importSuccess
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = start
|
||||||
|
|
||||||
|
|
19
publish/plugin/exec.js
Normal file
19
publish/plugin/exec.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
const { exec } = require('child_process')
|
||||||
|
|
||||||
|
function doExec (execString, maxBuffer = 1024 ** 5) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
exec(execString, {
|
||||||
|
maxBuffer
|
||||||
|
}, err => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
resolve(false)
|
||||||
|
} else {
|
||||||
|
resolve(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = doExec
|
323
publish/plugin/fs.js
Normal file
323
publish/plugin/fs.js
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
function readDir (src) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.readdir(src, (err, paths) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
resolve(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(paths)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function stat (src) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.stat(src, (err, stats) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
resolve(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(stats)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function mkdir (src) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.mkdir(src, err => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
resolve(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function access (src, mode = fs.constants.F_OK) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.access(src, mode, err => {
|
||||||
|
if (err) {
|
||||||
|
resolve(false)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function unlink (src) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.unlink(src, err => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
resolve(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmDir (src) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.rmdir(src, err => {
|
||||||
|
if (err) {
|
||||||
|
resolve(false)
|
||||||
|
} else {
|
||||||
|
resolve(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function clearDir (src) {
|
||||||
|
const isExists = await access(src)
|
||||||
|
|
||||||
|
if (!isExists) {
|
||||||
|
await mkdir(src)
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return await emptyDir(src)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function emptyDir (src) {
|
||||||
|
const paths = await readDir(src)
|
||||||
|
if (!paths) {
|
||||||
|
console.error('Exception in emptyDir: paths!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
const fullSrc = src + '/' + paths[i]
|
||||||
|
const stats = await stat(fullSrc)
|
||||||
|
|
||||||
|
if (!stats) {
|
||||||
|
console.error('Exception in emptyDir: stats!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.isFile()) {
|
||||||
|
const isUnlink = await unlink(fullSrc)
|
||||||
|
|
||||||
|
if (!isUnlink) {
|
||||||
|
console.error('Exception in emptyDir: isUnlink!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (stats.isDirectory()) {
|
||||||
|
const isEmpty = await emptyDir(fullSrc)
|
||||||
|
|
||||||
|
if (!isEmpty) {
|
||||||
|
console.error('Exception in emptyDir: isEmpty!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!await rmDir(fullSrc)) {
|
||||||
|
console.error('Exception in emptyDir: rmDir!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function unlinkDirFileByExtname (src, extnames = []) {
|
||||||
|
const paths = await readDir(src)
|
||||||
|
|
||||||
|
if (!paths) {
|
||||||
|
console.error('Exception in unlinkDirFileByExtname: paths!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
const fullSrc = src + '/' + paths[i]
|
||||||
|
const stats = await stat(fullSrc)
|
||||||
|
|
||||||
|
if (!stats) {
|
||||||
|
console.error('Exception in unlinkDirFileByExtname: stats!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.isFile()) {
|
||||||
|
const cxtname = path.extname(fullSrc)
|
||||||
|
if (extnames.findIndex(name => name === cxtname) === -1) continue
|
||||||
|
|
||||||
|
const isUnlink = await unlink(fullSrc)
|
||||||
|
if (!isUnlink) {
|
||||||
|
console.error('Exception in unlinkDirFileByExtname: isUnlink!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (stats.isDirectory()) {
|
||||||
|
const recursive = await unlinkDirFileByExtname(fullSrc, extnames)
|
||||||
|
|
||||||
|
if (!recursive) {
|
||||||
|
console.error('Exception in unlinkDirFileByExtname: recursive!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyDir (src, target) {
|
||||||
|
if (!src || !target) {
|
||||||
|
console.error('copyDir missing parameters!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const isClear = await clearDir(target)
|
||||||
|
|
||||||
|
if (!isClear) {
|
||||||
|
console.error('Exception in copyDir: isClear!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const paths = await readDir(src)
|
||||||
|
if (!paths) {
|
||||||
|
console.error('Exception in copyDir: paths!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
const fullSrc = src + '/' + paths[i]
|
||||||
|
const fullTarget = target + '/' + paths[i]
|
||||||
|
const stats = await stat(fullSrc)
|
||||||
|
|
||||||
|
if (!stats) {
|
||||||
|
console.error('Exception in copyDir: stats!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.isFile()) {
|
||||||
|
fs.createReadStream(fullSrc).pipe(fs.createWriteStream(fullTarget))
|
||||||
|
} else if (stats.isDirectory()) {
|
||||||
|
const isMkdir = await mkdir(fullTarget)
|
||||||
|
|
||||||
|
if (!isMkdir) {
|
||||||
|
console.error('Exception in copyDir: isMkdir!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const isCopy = await copyDir(fullSrc, fullTarget)
|
||||||
|
|
||||||
|
if (!isCopy) {
|
||||||
|
console.error('Exception in copyDir: isCopy!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fileForEach (src, callback) {
|
||||||
|
if (!src || !callback) {
|
||||||
|
console.error('fileForEach missing parameters!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const paths = await readDir(src)
|
||||||
|
if (!paths) {
|
||||||
|
console.error('Exception in fileForEach: paths!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
const fullSrc = src + '/' + paths[i]
|
||||||
|
const stats = await stat(fullSrc)
|
||||||
|
|
||||||
|
if (!stats) {
|
||||||
|
console.error('Exception in fileForEach: stats!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.isFile()) {
|
||||||
|
await callback(fullSrc)
|
||||||
|
} else if (stats.isDirectory()) {
|
||||||
|
const recursive = await fileForEach(fullSrc, callback)
|
||||||
|
|
||||||
|
if (!recursive) {
|
||||||
|
console.error('Exception in fileForEach: recursive!')
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readFile (src, encoding = 'utf8') {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.readFile(src, encoding, (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
resolve(false)
|
||||||
|
} else {
|
||||||
|
resolve(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function writeFile (src, string, encoding = 'utf8') {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
fs.writeFile(src, string, encoding, err => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err)
|
||||||
|
|
||||||
|
resolve(false)
|
||||||
|
} else {
|
||||||
|
resolve(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
readDir,
|
||||||
|
stat,
|
||||||
|
mkdir,
|
||||||
|
clearDir,
|
||||||
|
emptyDir,
|
||||||
|
unlinkDirFileByExtname,
|
||||||
|
copyDir,
|
||||||
|
fileForEach,
|
||||||
|
readFile,
|
||||||
|
writeFile
|
||||||
|
}
|
22
publish/plugin/print.js
Normal file
22
publish/plugin/print.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const print = {
|
||||||
|
log (info) {
|
||||||
|
console.log(info)
|
||||||
|
},
|
||||||
|
warn (info) {
|
||||||
|
console.log('\033[31;33m' + info + '\033[0m')
|
||||||
|
},
|
||||||
|
error (info) {
|
||||||
|
console.log('\033[31;40m' + info + '\033[0m')
|
||||||
|
},
|
||||||
|
tip (info) {
|
||||||
|
console.log('\033[40;32m' + info + '\033[0m')
|
||||||
|
},
|
||||||
|
success (info) {
|
||||||
|
console.log('\033[42;30m' + info + '\033[0m')
|
||||||
|
},
|
||||||
|
yellow (info) {
|
||||||
|
console.log('\033[31;33m' + info + '\033[0m')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = print
|
5
src/components/activeRingChart/index.js
Normal file
5
src/components/activeRingChart/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ActiveRingChart from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(ActiveRingChart.name, ActiveRingChart)
|
||||||
|
}
|
@ -11,14 +11,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import Charts from '@jiaminghi/charts'
|
import Charts from '@jiaminghi/charts'
|
||||||
|
|
||||||
import dvDigitalFlop from '../digitalFlop'
|
import dvDigitalFlop from '../../digitalFlop/src/main'
|
||||||
|
|
||||||
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 {
|
export default {
|
||||||
name: 'ActiveRingChart',
|
name: 'DvActiveRingChart',
|
||||||
components: {
|
components: {
|
||||||
dvDigitalFlop
|
dvDigitalFlop
|
||||||
},
|
},
|
||||||
@ -128,7 +128,7 @@ export default {
|
|||||||
return mergedConfig.data[activeIndex].name
|
return mergedConfig.data[activeIndex].name
|
||||||
},
|
},
|
||||||
fontSize () {
|
fontSize () {
|
||||||
const { mergedConfig, activeIndex } = this
|
const { mergedConfig } = this
|
||||||
|
|
||||||
if (!mergedConfig) return ''
|
if (!mergedConfig) return ''
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ export default {
|
|||||||
ringAnimation()
|
ringAnimation()
|
||||||
},
|
},
|
||||||
getRingOption () {
|
getRingOption () {
|
||||||
const { mergedConfig, getRealRadius, chart } = this
|
const { mergedConfig, getRealRadius } = this
|
||||||
|
|
||||||
const radius = getRealRadius()
|
const radius = getRealRadius()
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ export default {
|
|||||||
return [insideRadius, outSideRadius]
|
return [insideRadius, outSideRadius]
|
||||||
},
|
},
|
||||||
ringAnimation () {
|
ringAnimation () {
|
||||||
let { animation, activeIndex, getRingOption, chart, getRealRadius } = this
|
let { activeIndex, getRingOption, chart, getRealRadius } = this
|
||||||
|
|
||||||
const radius = getRealRadius()
|
const radius = getRealRadius()
|
||||||
const active = getRealRadius(true)
|
const active = getRealRadius(true)
|
5
src/components/borderBox1/index.js
Normal file
5
src/components/borderBox1/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox1 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox1.name, BorderBox1)
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-border-box-1" :ref="ref">
|
<div class="dv-border-box-1">
|
||||||
<svg
|
<svg
|
||||||
width="150px"
|
width="150px"
|
||||||
height="150px"
|
height="150px"
|
||||||
@ -53,11 +53,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox1',
|
name: 'DvBorderBox1',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
ref: 'border-box-1',
|
|
||||||
|
|
||||||
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom']
|
border: ['left-top', 'right-top', 'left-bottom', 'right-bottom']
|
||||||
}
|
}
|
||||||
}
|
}
|
5
src/components/borderBox2/index.js
Normal file
5
src/components/borderBox2/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox2 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox2.name, BorderBox2)
|
||||||
|
}
|
@ -18,10 +18,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox2',
|
name: 'DvBorderBox2',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
5
src/components/borderBox3/index.js
Normal file
5
src/components/borderBox3/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox3 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox3.name, BorderBox3)
|
||||||
|
}
|
@ -18,10 +18,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox3',
|
name: 'DvBorderBox3',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
5
src/components/borderBox4/index.js
Normal file
5
src/components/borderBox4/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox4 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox4.name, BorderBox4)
|
||||||
|
}
|
@ -22,10 +22,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox4',
|
name: 'DvBorderBox4',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -41,7 +41,7 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less">
|
||||||
.dv-border-box-4 {
|
.dv-border-box-4 {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
5
src/components/borderBox5/index.js
Normal file
5
src/components/borderBox5/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox5 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox5.name, BorderBox5)
|
||||||
|
}
|
@ -18,10 +18,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox5',
|
name: 'DvBorderBox5',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
5
src/components/borderBox6/index.js
Normal file
5
src/components/borderBox6/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox6 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox6.name, BorderBox6)
|
||||||
|
}
|
@ -26,10 +26,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox6',
|
name: 'DvBorderBox6',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
5
src/components/borderBox7/index.js
Normal file
5
src/components/borderBox7/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox7 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox7.name, BorderBox7)
|
||||||
|
}
|
@ -19,10 +19,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox7',
|
name: 'DvBorderBox7',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
5
src/components/borderBox8/index.js
Normal file
5
src/components/borderBox8/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox8 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox8.name, BorderBox8)
|
||||||
|
}
|
@ -34,7 +34,7 @@
|
|||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
<use
|
<use
|
||||||
stroke="#235fa7"
|
stroke="#235fa7"
|
||||||
stroke-width="1"
|
stroke-width="1"
|
||||||
:xlink:href="`#${path}`"
|
:xlink:href="`#${path}`"
|
||||||
/>
|
/>
|
||||||
@ -62,10 +62,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BorderBox8',
|
name: 'DvBorderBox8',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
5
src/components/borderBox9/index.js
Normal file
5
src/components/borderBox9/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import BorderBox9 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(BorderBox9.name, BorderBox9)
|
||||||
|
}
|
122
src/components/borderBox9/src/main.vue
Normal file
122
src/components/borderBox9/src/main.vue
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dv-border-box-9" :ref="ref">
|
||||||
|
<svg class="dv-svg-container">
|
||||||
|
<defs>
|
||||||
|
<linearGradient :id="gradientId" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||||
|
<stop offset="0%" stop-color="#11eefd" />
|
||||||
|
<stop offset="100%" stop-color="#0078d2" />
|
||||||
|
</linearGradient>
|
||||||
|
|
||||||
|
<mask :id="maskId">
|
||||||
|
<polyline
|
||||||
|
stroke="#fff"
|
||||||
|
stroke-width="3"
|
||||||
|
fill="transparent"
|
||||||
|
:points="`8, ${height * 0.4} 8, 3, ${width * 0.4 + 7}, 3`"
|
||||||
|
/>
|
||||||
|
<polyline
|
||||||
|
fill="#fff"
|
||||||
|
:points="
|
||||||
|
`8, ${height * 0.15} 8, 3, ${width * 0.1 + 7}, 3
|
||||||
|
${width * 0.1}, 8 14, 8 14, ${height * 0.15 - 7}
|
||||||
|
`"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<polyline
|
||||||
|
stroke="#fff"
|
||||||
|
stroke-width="3"
|
||||||
|
fill="transparent"
|
||||||
|
:points="`${width * 0.5}, 3 ${width - 3}, 3, ${width - 3}, ${height * 0.25}`"
|
||||||
|
/>
|
||||||
|
<polyline
|
||||||
|
fill="#fff"
|
||||||
|
:points="`
|
||||||
|
${width * 0.52}, 3 ${width * 0.58}, 3
|
||||||
|
${width * 0.58 - 7}, 9 ${width * 0.52 + 7}, 9
|
||||||
|
`"
|
||||||
|
/>
|
||||||
|
<polyline
|
||||||
|
fill="#fff"
|
||||||
|
:points="`
|
||||||
|
${width * 0.9}, 3 ${width - 3}, 3 ${width - 3}, ${height * 0.1}
|
||||||
|
${width - 9}, ${height * 0.1 - 7} ${width - 9}, 9 ${width * 0.9 + 7}, 9
|
||||||
|
`"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<polyline
|
||||||
|
stroke="#fff"
|
||||||
|
stroke-width="3"
|
||||||
|
fill="transparent"
|
||||||
|
:points="`8, ${height * 0.5} 8, ${height - 3} ${width * 0.3 + 7}, ${height - 3}`"
|
||||||
|
/>
|
||||||
|
<polyline
|
||||||
|
fill="#fff"
|
||||||
|
:points="`
|
||||||
|
8, ${height * 0.55} 8, ${height * 0.7}
|
||||||
|
2, ${height * 0.7 - 7} 2, ${height * 0.55 + 7}
|
||||||
|
`"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<polyline
|
||||||
|
stroke="#fff"
|
||||||
|
stroke-width="3"
|
||||||
|
fill="transparent"
|
||||||
|
:points="`${width * 0.35}, ${height - 3} ${width - 3}, ${height - 3} ${width - 3}, ${height * 0.35}`"
|
||||||
|
/>
|
||||||
|
<polyline
|
||||||
|
fill="#fff"
|
||||||
|
:points="`
|
||||||
|
${width * 0.92}, ${height - 3} ${width - 3}, ${height - 3} ${width - 3}, ${height * 0.8}
|
||||||
|
${width - 9}, ${height * 0.8 + 7} ${width - 9}, ${height - 9} ${width * 0.92 + 7}, ${height - 9}
|
||||||
|
`"
|
||||||
|
/>
|
||||||
|
</mask>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<rect x="0" y="0" :width="width" :height="height" :fill="`url(#${gradientId})`" :mask="`url(#${maskId})`" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<div class="border-box-content">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DvBorderBox9',
|
||||||
|
mixins: [autoResize],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
ref: 'border-box-9',
|
||||||
|
|
||||||
|
gradientId: `border-box-9-gradient-${(new Date()).getTime()}`,
|
||||||
|
maskId: `border-box-9-mask-${(new Date()).getTime()}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.dv-border-box-9 {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
left: 0px;
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-box-content {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
5
src/components/charts/index.js
Normal file
5
src/components/charts/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Charts from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Charts.name, Charts)
|
||||||
|
}
|
@ -1,25 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dv-charts-container" :ref="ref">
|
<div class="dv-charts-container" :ref="ref">
|
||||||
<div class="charts" :ref="chartRef" />
|
<div class="charts" :ref="chartRef" />
|
||||||
|
|
||||||
<div class="charts-slot-content">
|
|
||||||
<slot></slot>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import Charts from '@jiaminghi/charts'
|
import Charts from '@jiaminghi/charts'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Charts',
|
name: 'DvCharts',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
option: {
|
option: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {}
|
default: () => ({})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@ -42,7 +38,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
afterAutoResizeMixinInit () {
|
afterAutoResizeMixinInit () {
|
||||||
const { initChart } = this
|
const { initChart } = this
|
||||||
|
|
||||||
initChart()
|
initChart()
|
||||||
},
|
},
|
||||||
initChart () {
|
initChart () {
|
||||||
@ -75,13 +71,5 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.charts-slot-content {
|
|
||||||
position: absolute;
|
|
||||||
left: 0px;
|
|
||||||
top: 0px;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
5
src/components/conicalColumnChart/index.js
Normal file
5
src/components/conicalColumnChart/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ConicalColumnChart from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(ConicalColumnChart.name, ConicalColumnChart)
|
||||||
|
}
|
219
src/components/conicalColumnChart/src/main.vue
Normal file
219
src/components/conicalColumnChart/src/main.vue
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dv-conical-column-chart" :ref="ref">
|
||||||
|
<svg :width="width" :height="height">
|
||||||
|
<g
|
||||||
|
v-for="(item, i) in column"
|
||||||
|
:key="i"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
:d="item.d"
|
||||||
|
:fill="mergedConfig.columnColor"
|
||||||
|
/>
|
||||||
|
<text
|
||||||
|
:style="`fontSize:${mergedConfig.fontSize}px`"
|
||||||
|
:fill="mergedConfig.textColor"
|
||||||
|
:x="item.x"
|
||||||
|
:y="height - 4"
|
||||||
|
>
|
||||||
|
{{ item.name }}
|
||||||
|
</text>
|
||||||
|
<image
|
||||||
|
v-if="mergedConfig.img.length"
|
||||||
|
:xlink:href="mergedConfig.img[i % mergedConfig.img.length]"
|
||||||
|
:width="mergedConfig.imgSideLength"
|
||||||
|
:height="mergedConfig.imgSideLength"
|
||||||
|
:x="item.x - mergedConfig.imgSideLength / 2"
|
||||||
|
:y="item.y - mergedConfig.imgSideLength"
|
||||||
|
/>
|
||||||
|
<text
|
||||||
|
v-if="mergedConfig.showValue"
|
||||||
|
:style="`fontSize:${mergedConfig.fontSize}px`"
|
||||||
|
:fill="mergedConfig.textColor"
|
||||||
|
:x="item.x"
|
||||||
|
:y="item.textY"
|
||||||
|
>
|
||||||
|
{{ item.value }}
|
||||||
|
</text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DvConicalColumnChart',
|
||||||
|
mixins: [autoResize],
|
||||||
|
props: {
|
||||||
|
config: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
ref: 'conical-column-chart',
|
||||||
|
|
||||||
|
defaultConfig: {
|
||||||
|
/**
|
||||||
|
* @description Chart data
|
||||||
|
* @type {Array<Object>}
|
||||||
|
* @default data = []
|
||||||
|
*/
|
||||||
|
data: [],
|
||||||
|
/**
|
||||||
|
* @description Chart img
|
||||||
|
* @type {Array<String>}
|
||||||
|
* @default img = []
|
||||||
|
*/
|
||||||
|
img: [],
|
||||||
|
/**
|
||||||
|
* @description Chart font size
|
||||||
|
* @type {Number}
|
||||||
|
* @default fontSize = 12
|
||||||
|
*/
|
||||||
|
fontSize: 12,
|
||||||
|
/**
|
||||||
|
* @description Img side length
|
||||||
|
* @type {Number}
|
||||||
|
* @default imgSideLength = 30
|
||||||
|
*/
|
||||||
|
imgSideLength: 30,
|
||||||
|
/**
|
||||||
|
* @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'
|
||||||
|
*/
|
||||||
|
textColor: '#fff',
|
||||||
|
/**
|
||||||
|
* @description Show value
|
||||||
|
* @type {Boolean}
|
||||||
|
* @default showValue = false
|
||||||
|
*/
|
||||||
|
showValue: false
|
||||||
|
},
|
||||||
|
|
||||||
|
mergedConfig: null,
|
||||||
|
|
||||||
|
column: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
config () {
|
||||||
|
const { calcData } = this
|
||||||
|
|
||||||
|
calcData()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
afterAutoResizeMixinInit () {
|
||||||
|
const { calcData } = this
|
||||||
|
|
||||||
|
calcData()
|
||||||
|
},
|
||||||
|
onResize () {
|
||||||
|
const { calcData } = this
|
||||||
|
|
||||||
|
calcData()
|
||||||
|
},
|
||||||
|
calcData () {
|
||||||
|
const { mergeConfig, initData, calcSVGPath } = this
|
||||||
|
|
||||||
|
mergeConfig()
|
||||||
|
|
||||||
|
initData()
|
||||||
|
|
||||||
|
calcSVGPath()
|
||||||
|
},
|
||||||
|
mergeConfig () {
|
||||||
|
const { defaultConfig, config } = this
|
||||||
|
|
||||||
|
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
|
||||||
|
},
|
||||||
|
initData () {
|
||||||
|
const { mergedConfig } = this
|
||||||
|
let { data } = mergedConfig
|
||||||
|
|
||||||
|
data = deepClone(data, true)
|
||||||
|
|
||||||
|
data.sort(({ value: a }, { value: b }) => {
|
||||||
|
if (a > b) return -1
|
||||||
|
if (a < b) return 1
|
||||||
|
if (a === b) return 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const max = data[0] ? data[0].value : 10
|
||||||
|
|
||||||
|
data = data.map(item => ({
|
||||||
|
...item,
|
||||||
|
percent: item.value / max
|
||||||
|
}))
|
||||||
|
|
||||||
|
mergedConfig.data = data
|
||||||
|
},
|
||||||
|
calcSVGPath () {
|
||||||
|
const { mergedConfig, width, height } = this
|
||||||
|
|
||||||
|
const { imgSideLength, fontSize, data } = mergedConfig
|
||||||
|
|
||||||
|
const itemNum = data.length
|
||||||
|
const gap = width / (itemNum + 1)
|
||||||
|
|
||||||
|
const useAbleHeight = height - imgSideLength - fontSize - 5
|
||||||
|
const svgBottom = height - fontSize - 5
|
||||||
|
|
||||||
|
this.column = data.map((item, i) => {
|
||||||
|
const { percent } = item
|
||||||
|
|
||||||
|
const middleXPos = gap * (i + 1)
|
||||||
|
const leftXPos = gap * i
|
||||||
|
const rightXpos = gap * (i + 2)
|
||||||
|
|
||||||
|
const middleYPos = svgBottom - useAbleHeight * percent
|
||||||
|
const controlYPos = useAbleHeight * percent * 0.6 + middleYPos
|
||||||
|
|
||||||
|
const d = `
|
||||||
|
M${leftXPos}, ${svgBottom}
|
||||||
|
Q${middleXPos}, ${controlYPos} ${middleXPos},${middleYPos}
|
||||||
|
M${middleXPos},${middleYPos}
|
||||||
|
Q${middleXPos}, ${controlYPos} ${rightXpos},${svgBottom}
|
||||||
|
L${leftXPos}, ${svgBottom}
|
||||||
|
Z
|
||||||
|
`
|
||||||
|
|
||||||
|
const textY = (svgBottom + middleYPos) / 2 + fontSize / 2
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
d,
|
||||||
|
x: middleXPos,
|
||||||
|
y: middleYPos,
|
||||||
|
textY
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.dv-conical-column-chart {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
text {
|
||||||
|
text-anchor: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
5
src/components/decoration1/index.js
Normal file
5
src/components/decoration1/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration1 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration1.name, Decoration1)
|
||||||
|
}
|
@ -85,10 +85,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration1',
|
name: 'DvDecoration1',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
const pointSideLength = 2.5
|
const pointSideLength = 2.5
|
||||||
@ -114,7 +114,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
afterAutoResizeMixinInit () {
|
afterAutoResizeMixinInit () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
},
|
},
|
||||||
calcSVGData () {
|
calcSVGData () {
|
||||||
@ -158,7 +158,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onResize () {
|
onResize () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
}
|
}
|
||||||
}
|
}
|
5
src/components/decoration10/index.js
Normal file
5
src/components/decoration10/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration10 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration10.name, Decoration10)
|
||||||
|
}
|
176
src/components/decoration10/src/main.vue
Normal file
176
src/components/decoration10/src/main.vue
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dv-decoration-10" :ref="ref">
|
||||||
|
<svg :width="width" :height="height">
|
||||||
|
<polyline
|
||||||
|
stroke="rgba(0, 194, 255, 0.3)"
|
||||||
|
stroke-width="2"
|
||||||
|
:points="`0, ${height / 2} ${width}, ${height / 2}`"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<polyline
|
||||||
|
stroke="rgba(0, 194, 255, 1)"
|
||||||
|
stroke-width="2"
|
||||||
|
:points="`5, ${height / 2} ${width * 0.2 - 3}, ${height / 2}`"
|
||||||
|
:stroke-dasharray="`0, ${width * 0.2}`"
|
||||||
|
fill="freeze"
|
||||||
|
>
|
||||||
|
<animate
|
||||||
|
:id="animationId2"
|
||||||
|
attributeName="stroke-dasharray"
|
||||||
|
:values="`0, ${width * 0.2};${width * 0.2}, 0;`"
|
||||||
|
dur="3s"
|
||||||
|
:begin="`${animationId1}.end`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
<animate
|
||||||
|
attributeName="stroke-dasharray"
|
||||||
|
:values="`${width * 0.2}, 0;0, ${width * 0.2}`"
|
||||||
|
dur="0.01s"
|
||||||
|
:begin="`${animationId7}.end`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
</polyline>
|
||||||
|
|
||||||
|
<polyline
|
||||||
|
stroke="rgba(0, 194, 255, 1)"
|
||||||
|
stroke-width="2"
|
||||||
|
:points="`${width * 0.2 + 3}, ${height / 2} ${width * 0.8 - 3}, ${height / 2}`"
|
||||||
|
:stroke-dasharray="`0, ${width * 0.6}`"
|
||||||
|
>
|
||||||
|
<animate
|
||||||
|
:id="animationId4"
|
||||||
|
attributeName="stroke-dasharray"
|
||||||
|
:values="`0, ${width * 0.6};${width * 0.6}, 0`"
|
||||||
|
dur="3s"
|
||||||
|
:begin="`${animationId3}.end + 1s`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
<animate
|
||||||
|
attributeName="stroke-dasharray"
|
||||||
|
:values="`${width * 0.6}, 0;0, ${width * 0.6}`"
|
||||||
|
dur="0.01s"
|
||||||
|
:begin="`${animationId7}.end`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
</polyline>
|
||||||
|
|
||||||
|
<polyline
|
||||||
|
stroke="rgba(0, 194, 255, 1)"
|
||||||
|
stroke-width="2"
|
||||||
|
:points="`${width * 0.8 + 3}, ${height / 2} ${width - 5}, ${height / 2}`"
|
||||||
|
:stroke-dasharray="`0, ${width * 0.2}`"
|
||||||
|
>
|
||||||
|
<animate
|
||||||
|
:id="animationId6"
|
||||||
|
attributeName="stroke-dasharray"
|
||||||
|
:values="`0, ${width * 0.2};${width * 0.2}, 0`"
|
||||||
|
dur="3s"
|
||||||
|
:begin="`${animationId5}.end + 1s`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
<animate
|
||||||
|
attributeName="stroke-dasharray"
|
||||||
|
:values="`${width * 0.2}, 0;0, ${width * 0.3}`"
|
||||||
|
dur="0.01s"
|
||||||
|
:begin="`${animationId7}.end`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
</polyline>
|
||||||
|
|
||||||
|
<circle cx="2" :cy="height / 2" r="2" fill="#03709f">
|
||||||
|
<animate
|
||||||
|
:id="animationId1"
|
||||||
|
attributeName="fill"
|
||||||
|
values="#03709f;#00c2ff"
|
||||||
|
:begin="`0s;${animationId7}.end`"
|
||||||
|
dur="0.3s"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
</circle>
|
||||||
|
|
||||||
|
<circle :cx="width * 0.2" :cy="height / 2" r="2" fill="#03709f">
|
||||||
|
<animate
|
||||||
|
:id="animationId3"
|
||||||
|
attributeName="fill"
|
||||||
|
values="#03709f;#00c2ff"
|
||||||
|
:begin="`${animationId2}.end`"
|
||||||
|
dur="0.3s"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
<animate
|
||||||
|
attributeName="fill"
|
||||||
|
values="#03709f;#03709f"
|
||||||
|
dur="0.01s"
|
||||||
|
:begin="`${animationId7}.end`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
</circle>
|
||||||
|
|
||||||
|
<circle :cx="width * 0.8" :cy="height / 2" r="2" fill="#03709f">
|
||||||
|
<animate
|
||||||
|
:id="animationId5"
|
||||||
|
attributeName="fill"
|
||||||
|
values="#03709f;#00c2ff"
|
||||||
|
:begin="`${animationId4}.end`"
|
||||||
|
dur="0.3s"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
<animate
|
||||||
|
attributeName="fill"
|
||||||
|
values="#03709f;#03709f"
|
||||||
|
dur="0.01s"
|
||||||
|
:begin="`${animationId7}.end`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
</circle>
|
||||||
|
|
||||||
|
<circle :cx="width - 2" :cy="height / 2" r="2" fill="#03709f">
|
||||||
|
<animate
|
||||||
|
:id="animationId7"
|
||||||
|
attributeName="fill"
|
||||||
|
values="#03709f;#00c2ff"
|
||||||
|
:begin="`${animationId6}.end`"
|
||||||
|
dur="0.3s"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
<animate
|
||||||
|
attributeName="fill"
|
||||||
|
values="#03709f;#03709f"
|
||||||
|
dur="0.01s"
|
||||||
|
:begin="`${animationId7}.end`"
|
||||||
|
fill="freeze"
|
||||||
|
/>
|
||||||
|
</circle>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DvDecoration10',
|
||||||
|
mixins: [autoResize],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
ref: 'decoration-10',
|
||||||
|
|
||||||
|
animationId1: `d10ani1${(new Date()).getTime()}`,
|
||||||
|
animationId2: `d10ani2${(new Date()).getTime()}`,
|
||||||
|
animationId3: `d10ani3${(new Date()).getTime()}`,
|
||||||
|
animationId4: `d10ani4${(new Date()).getTime()}`,
|
||||||
|
animationId5: `d10ani5${(new Date()).getTime()}`,
|
||||||
|
animationId6: `d10ani6${(new Date()).getTime()}`,
|
||||||
|
animationId7: `d10ani7${(new Date()).getTime()}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.dv-decoration-10 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
</style>
|
5
src/components/decoration2/index.js
Normal file
5
src/components/decoration2/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration2 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration2.name, Decoration2)
|
||||||
|
}
|
@ -31,10 +31,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration2',
|
name: 'DvDecoration2',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
reverse: {
|
reverse: {
|
5
src/components/decoration3/index.js
Normal file
5
src/components/decoration3/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration3 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration3.name, Decoration3)
|
||||||
|
}
|
@ -28,10 +28,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration3',
|
name: 'DvDecoration3',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
const pointSideLength = 7
|
const pointSideLength = 7
|
||||||
@ -55,7 +55,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
afterAutoResizeMixinInit () {
|
afterAutoResizeMixinInit () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
},
|
},
|
||||||
calcSVGData () {
|
calcSVGData () {
|
||||||
@ -89,7 +89,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onResize () {
|
onResize () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
}
|
}
|
||||||
}
|
}
|
5
src/components/decoration4/index.js
Normal file
5
src/components/decoration4/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration4 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration4.name, Decoration4)
|
||||||
|
}
|
@ -23,10 +23,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration4',
|
name: 'DvDecoration4',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
props: ['reverse'],
|
props: ['reverse'],
|
||||||
data () {
|
data () {
|
5
src/components/decoration5/index.js
Normal file
5
src/components/decoration5/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration5 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration5.name, Decoration5)
|
||||||
|
}
|
@ -44,12 +44,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import { getPolylineLength } from '@jiaminghi/charts/lib/util'
|
import { getPolylineLength } from '@jiaminghi/charts/lib/util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration5',
|
name: 'DvDecoration5',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -59,13 +59,13 @@ export default {
|
|||||||
line2Points: '',
|
line2Points: '',
|
||||||
|
|
||||||
line1Length: 0,
|
line1Length: 0,
|
||||||
line2Length: 0,
|
line2Length: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
afterAutoResizeMixinInit () {
|
afterAutoResizeMixinInit () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
},
|
},
|
||||||
calcSVGData () {
|
calcSVGData () {
|
||||||
@ -95,7 +95,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onResize () {
|
onResize () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
}
|
}
|
||||||
}
|
}
|
5
src/components/decoration6/index.js
Normal file
5
src/components/decoration6/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration6 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration6.name, Decoration6)
|
||||||
|
}
|
@ -39,12 +39,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
import { randomExtend } from '../../util'
|
import { randomExtend } from '../../../util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration6',
|
name: 'DvDecoration6',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
data () {
|
data () {
|
||||||
const rectWidth = 7
|
const rectWidth = 7
|
||||||
@ -71,7 +71,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
afterAutoResizeMixinInit () {
|
afterAutoResizeMixinInit () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
},
|
},
|
||||||
calcSVGData () {
|
calcSVGData () {
|
||||||
@ -114,7 +114,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onResize () {
|
onResize () {
|
||||||
const { calcSVGData } = this
|
const { calcSVGData } = this
|
||||||
|
|
||||||
calcSVGData()
|
calcSVGData()
|
||||||
}
|
}
|
||||||
}
|
}
|
5
src/components/decoration7/index.js
Normal file
5
src/components/decoration7/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration7 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration7.name, Decoration7)
|
||||||
|
}
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration7'
|
name: 'DvDecoration7'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
5
src/components/decoration8/index.js
Normal file
5
src/components/decoration8/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration8 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration8.name, Decoration8)
|
||||||
|
}
|
@ -26,10 +26,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Decoration8',
|
name: 'DvDecoration8',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
reverse: {
|
reverse: {
|
||||||
@ -39,7 +39,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
ref: 'decoration-8',
|
ref: 'decoration-8'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
5
src/components/decoration9/index.js
Normal file
5
src/components/decoration9/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Decoration9 from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Decoration9.name, Decoration9)
|
||||||
|
}
|
141
src/components/decoration9/src/main.vue
Normal file
141
src/components/decoration9/src/main.vue
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dv-decoration-9" :ref="ref">
|
||||||
|
<svg :width="`${svgWH[0]}px`" :height="`${svgWH[1]}px`" :style="`transform:scale(${svgScale[0]},${svgScale[1]});`">
|
||||||
|
<defs>
|
||||||
|
<polygon :id="polygonId" points="15, 46.5, 21, 47.5, 21, 52.5, 15, 53.5" />
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<circle
|
||||||
|
cx="50"
|
||||||
|
cy="50"
|
||||||
|
r="45"
|
||||||
|
fill="transparent"
|
||||||
|
stroke="rgba(3, 166, 224, 0.5)"
|
||||||
|
stroke-width="10"
|
||||||
|
stroke-dasharray="80, 100, 30, 100"
|
||||||
|
>
|
||||||
|
<animateTransform
|
||||||
|
attributeName="transform"
|
||||||
|
type="rotate"
|
||||||
|
values="0 50 50;360 50 50"
|
||||||
|
dur="3s"
|
||||||
|
repeatCount="indefinite"
|
||||||
|
/>
|
||||||
|
</circle>
|
||||||
|
|
||||||
|
<circle
|
||||||
|
cx="50"
|
||||||
|
cy="50"
|
||||||
|
r="45"
|
||||||
|
fill="transparent"
|
||||||
|
stroke="rgba(3, 166, 224, 0.8)"
|
||||||
|
stroke-width="6"
|
||||||
|
stroke-dasharray="50, 66, 100, 66"
|
||||||
|
>
|
||||||
|
<animateTransform
|
||||||
|
attributeName="transform"
|
||||||
|
type="rotate"
|
||||||
|
values="0 50 50;-360 50 50"
|
||||||
|
dur="3s"
|
||||||
|
repeatCount="indefinite"
|
||||||
|
/>
|
||||||
|
</circle>
|
||||||
|
|
||||||
|
<circle
|
||||||
|
cx="50"
|
||||||
|
cy="50"
|
||||||
|
r="38"
|
||||||
|
fill="transparent"
|
||||||
|
stroke="rgba(3, 166, 224, 0.2)"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke-dasharray="5, 1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<use
|
||||||
|
v-for="(foo, i) in new Array(20).fill(0)"
|
||||||
|
:key="i"
|
||||||
|
:xlink:href="`#${polygonId}`"
|
||||||
|
stroke="rgba(3, 166, 224, 0.6)"
|
||||||
|
:fill="Math.random() > 0.4 ? 'transparent' : 'rgba(3, 166, 224, 0.8)'"
|
||||||
|
>
|
||||||
|
<animateTransform
|
||||||
|
attributeName="transform"
|
||||||
|
type="rotate"
|
||||||
|
values="0 50 50;360 50 50"
|
||||||
|
dur="3s"
|
||||||
|
:begin="`${i * 0.15}s`"
|
||||||
|
repeatCount="indefinite"
|
||||||
|
/>
|
||||||
|
</use>
|
||||||
|
|
||||||
|
<circle
|
||||||
|
cx="50"
|
||||||
|
cy="50"
|
||||||
|
r="26"
|
||||||
|
fill="transparent"
|
||||||
|
stroke="rgba(3, 166, 224, 0.2)"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke-dasharray="5, 1"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DvDecoration9',
|
||||||
|
mixins: [autoResize],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
ref: 'decoration-9',
|
||||||
|
|
||||||
|
polygonId: `decoration-9-polygon-${(new Date()).getTime()}`,
|
||||||
|
|
||||||
|
svgWH: [100, 100],
|
||||||
|
|
||||||
|
svgScale: [1, 1]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
afterAutoResizeMixinInit () {
|
||||||
|
const { calcScale } = this
|
||||||
|
|
||||||
|
calcScale()
|
||||||
|
},
|
||||||
|
calcScale () {
|
||||||
|
const { width, height, svgWH } = this
|
||||||
|
|
||||||
|
const [w, h] = svgWH
|
||||||
|
|
||||||
|
this.svgScale = [width / w, height / h]
|
||||||
|
},
|
||||||
|
onResize () {
|
||||||
|
const { calcScale } = this
|
||||||
|
|
||||||
|
calcScale()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.dv-decoration-9 {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
position: absolute;
|
||||||
|
left: 0px;
|
||||||
|
top: 0px;
|
||||||
|
transform-origin: left top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
5
src/components/digitalFlop/index.js
Normal file
5
src/components/digitalFlop/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import DigitalFlop from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(DigitalFlop.name, DigitalFlop)
|
||||||
|
}
|
@ -14,7 +14,7 @@ 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 {
|
export default {
|
||||||
name: 'DigitalFlop',
|
name: 'DvDigitalFlop',
|
||||||
props: {
|
props: {
|
||||||
config: {
|
config: {
|
||||||
type: Object,
|
type: Object,
|
5
src/components/flylineChart/index.js
Normal file
5
src/components/flylineChart/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import FlylineChart from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(FlylineChart.name, FlylineChart)
|
||||||
|
}
|
@ -153,17 +153,17 @@ 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'
|
||||||
|
|
||||||
import { randomExtend, getPointDistance } from '../../util/index'
|
import { randomExtend, getPointDistance } from '../../../util/index'
|
||||||
|
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PercentPond',
|
name: 'DvFlylineChart',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
config: {
|
config: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {}
|
default: () => ({})
|
||||||
},
|
},
|
||||||
dev: {
|
dev: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -239,7 +239,7 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* @description Relative points position
|
* @description Relative points position
|
||||||
* @type {Boolean}
|
* @type {Boolean}
|
||||||
* @default relative = true
|
* @default relative = true
|
||||||
*/
|
*/
|
||||||
relative: true,
|
relative: true,
|
||||||
/**
|
/**
|
||||||
@ -375,7 +375,6 @@ export default {
|
|||||||
const { calcData } = this
|
const { calcData } = this
|
||||||
|
|
||||||
calcData()
|
calcData()
|
||||||
|
|
||||||
},
|
},
|
||||||
onResize () {
|
onResize () {
|
||||||
const { calcData } = this
|
const { calcData } = this
|
5
src/components/fullScreenContainer/index.js
Normal file
5
src/components/fullScreenContainer/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import FullScreenContainer from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(FullScreenContainer.name, FullScreenContainer)
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'FullScreenContainer',
|
name: 'DvFullScreenContainer',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
scale: 0,
|
scale: 0,
|
77
src/components/index.js
Normal file
77
src/components/index.js
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import fullScreenContainer from './fullScreenContainer/index'
|
||||||
|
import loading from './loading/index'
|
||||||
|
|
||||||
|
// border box
|
||||||
|
import borderBox1 from './borderBox1/index'
|
||||||
|
import borderBox2 from './borderBox2/index'
|
||||||
|
import borderBox3 from './borderBox3/index'
|
||||||
|
import borderBox4 from './borderBox4/index'
|
||||||
|
import borderBox5 from './borderBox5/index'
|
||||||
|
import borderBox6 from './borderBox6/index'
|
||||||
|
import borderBox7 from './borderBox7/index'
|
||||||
|
import borderBox8 from './borderBox8/index'
|
||||||
|
import borderBox9 from './borderBox9/index'
|
||||||
|
|
||||||
|
// decoration
|
||||||
|
import decoration1 from './decoration1/index'
|
||||||
|
import decoration2 from './decoration2/index'
|
||||||
|
import decoration3 from './decoration3/index'
|
||||||
|
import decoration4 from './decoration4/index'
|
||||||
|
import decoration5 from './decoration5/index'
|
||||||
|
import decoration6 from './decoration6/index'
|
||||||
|
import decoration7 from './decoration7/index'
|
||||||
|
import decoration8 from './decoration8/index'
|
||||||
|
import decoration9 from './decoration9/index'
|
||||||
|
import decoration10 from './decoration10/index'
|
||||||
|
|
||||||
|
// charts
|
||||||
|
import charts from './charts/index'
|
||||||
|
|
||||||
|
import activeRingChart from './activeRingChart'
|
||||||
|
import waterLevelPond from './waterLevelPond/index'
|
||||||
|
import percentPond from './percentPond/index'
|
||||||
|
import flylineChart from './flylineChart'
|
||||||
|
import conicalColumnChart from './conicalColumnChart'
|
||||||
|
import digitalFlop from './digitalFlop'
|
||||||
|
import scrollBoard from './scrollBoard/index'
|
||||||
|
import scrollRankingBoard from './scrollRankingBoard/index'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.use(fullScreenContainer)
|
||||||
|
Vue.use(loading)
|
||||||
|
|
||||||
|
// border box
|
||||||
|
Vue.use(borderBox1)
|
||||||
|
Vue.use(borderBox2)
|
||||||
|
Vue.use(borderBox3)
|
||||||
|
Vue.use(borderBox4)
|
||||||
|
Vue.use(borderBox5)
|
||||||
|
Vue.use(borderBox6)
|
||||||
|
Vue.use(borderBox7)
|
||||||
|
Vue.use(borderBox8)
|
||||||
|
Vue.use(borderBox9)
|
||||||
|
|
||||||
|
// decoration
|
||||||
|
Vue.use(decoration1)
|
||||||
|
Vue.use(decoration2)
|
||||||
|
Vue.use(decoration3)
|
||||||
|
Vue.use(decoration4)
|
||||||
|
Vue.use(decoration5)
|
||||||
|
Vue.use(decoration6)
|
||||||
|
Vue.use(decoration7)
|
||||||
|
Vue.use(decoration8)
|
||||||
|
Vue.use(decoration9)
|
||||||
|
Vue.use(decoration10)
|
||||||
|
|
||||||
|
// charts
|
||||||
|
Vue.use(charts)
|
||||||
|
|
||||||
|
Vue.use(activeRingChart)
|
||||||
|
Vue.use(waterLevelPond)
|
||||||
|
Vue.use(percentPond)
|
||||||
|
Vue.use(flylineChart)
|
||||||
|
Vue.use(conicalColumnChart)
|
||||||
|
Vue.use(digitalFlop)
|
||||||
|
Vue.use(scrollBoard)
|
||||||
|
Vue.use(scrollRankingBoard)
|
||||||
|
}
|
5
src/components/loading/index.js
Normal file
5
src/components/loading/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Loading from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(Loading.name, Loading)
|
||||||
|
}
|
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Loading'
|
name: 'DvLoading'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -74,7 +74,6 @@ export default {
|
|||||||
|
|
||||||
.loading-tip {
|
.loading-tip {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #fff;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
5
src/components/percentPond/index.js
Normal file
5
src/components/percentPond/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import PercentPond from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(PercentPond.name, PercentPond)
|
||||||
|
}
|
@ -49,7 +49,7 @@ 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 {
|
export default {
|
||||||
name: 'PercentPond',
|
name: 'DvPercentPond',
|
||||||
props: {
|
props: {
|
||||||
config: {
|
config: {
|
||||||
type: Object,
|
type: Object,
|
5
src/components/scrollBoard/index.js
Normal file
5
src/components/scrollBoard/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ScrollBoard from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(ScrollBoard.name, ScrollBoard)
|
||||||
|
}
|
@ -24,7 +24,7 @@
|
|||||||
<div
|
<div
|
||||||
class="row-item"
|
class="row-item"
|
||||||
v-for="(row, ri) in rows"
|
v-for="(row, ri) in rows"
|
||||||
:key="row.toString() + row.rowIndex"
|
:key="row.toString() + row.scroll"
|
||||||
:style="`
|
:style="`
|
||||||
height: ${heights[ri]}px;
|
height: ${heights[ri]}px;
|
||||||
line-height: ${heights[ri]}px;
|
line-height: ${heights[ri]}px;
|
||||||
@ -47,14 +47,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import autoResize from '../../mixins/autoResize.js'
|
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 {
|
export default {
|
||||||
name: 'ScrollBoard',
|
name: 'DvScrollBoard',
|
||||||
mixins: [autoResize],
|
mixins: [autoResize],
|
||||||
props: {
|
props: {
|
||||||
config: {
|
config: {
|
||||||
@ -78,7 +78,6 @@ export default {
|
|||||||
* @description Board data
|
* @description Board data
|
||||||
* @type {Array<Array>}
|
* @type {Array<Array>}
|
||||||
* @default data = []
|
* @default data = []
|
||||||
* @example header = [['column1Row1', 'column2Row1', 'column3Row1']]
|
|
||||||
*/
|
*/
|
||||||
data: [],
|
data: [],
|
||||||
/**
|
/**
|
||||||
@ -232,7 +231,7 @@ export default {
|
|||||||
this.header = header
|
this.header = header
|
||||||
},
|
},
|
||||||
calcRowsData () {
|
calcRowsData () {
|
||||||
let { data, index, headerBGC } = this.mergedConfig
|
let { data, index, headerBGC, rowNum } = this.mergedConfig
|
||||||
|
|
||||||
if (index) {
|
if (index) {
|
||||||
data = data.map((row, i) => {
|
data = data.map((row, i) => {
|
||||||
@ -248,6 +247,14 @@ export default {
|
|||||||
|
|
||||||
data = data.map((ceils, i) => ({ ceils, rowIndex: i }))
|
data = data.map((ceils, i) => ({ ceils, rowIndex: i }))
|
||||||
|
|
||||||
|
const rowLength = data.length
|
||||||
|
|
||||||
|
if (rowLength > rowNum && rowLength < 2 * rowNum) {
|
||||||
|
data = [...data, ...data]
|
||||||
|
}
|
||||||
|
|
||||||
|
data = data.map((d, i) => ({ ...d, scroll: i }))
|
||||||
|
|
||||||
this.rowsData = data
|
this.rowsData = data
|
||||||
this.rows = data
|
this.rows = data
|
||||||
},
|
},
|
5
src/components/scrollRankingBoard/index.js
Normal file
5
src/components/scrollRankingBoard/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import ScrollRankingBoard from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(ScrollRankingBoard.name, ScrollRankingBoard)
|
||||||
|
}
|
283
src/components/scrollRankingBoard/src/main.vue
Normal file
283
src/components/scrollRankingBoard/src/main.vue
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
<template>
|
||||||
|
<div class="dv-scroll-ranking-board" :ref="ref">
|
||||||
|
<div
|
||||||
|
class="row-item"
|
||||||
|
v-for="(item, i) in rows"
|
||||||
|
:key="item.toString() + item.scroll"
|
||||||
|
:style="`height: ${heights[i]}px;`"
|
||||||
|
>
|
||||||
|
<div class="ranking-info">
|
||||||
|
<div class="rank">No.{{ item.ranking }}</div>
|
||||||
|
<div class="info-name">{{ item.name }}</div>
|
||||||
|
<div class="ranking-value">{{ item.value }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ranking-column">
|
||||||
|
<div
|
||||||
|
class="inside-column"
|
||||||
|
:style="`width: ${item.percent}%;`"
|
||||||
|
>
|
||||||
|
<div class="shine" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import autoResize from '../../../mixin/autoResize'
|
||||||
|
|
||||||
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
||||||
|
|
||||||
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DvScrollRankingBoard',
|
||||||
|
mixins: [autoResize],
|
||||||
|
props: {
|
||||||
|
config: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
ref: 'scroll-ranking-board',
|
||||||
|
|
||||||
|
defaultConfig: {
|
||||||
|
/**
|
||||||
|
* @description Board data
|
||||||
|
* @type {Array<Object>}
|
||||||
|
* @default data = []
|
||||||
|
*/
|
||||||
|
data: [],
|
||||||
|
/**
|
||||||
|
* @description Row num
|
||||||
|
* @type {Number}
|
||||||
|
* @default rowNum = 5
|
||||||
|
*/
|
||||||
|
rowNum: 5,
|
||||||
|
/**
|
||||||
|
* @description Scroll wait time
|
||||||
|
* @type {Number}
|
||||||
|
* @default waitTime = 2000
|
||||||
|
*/
|
||||||
|
waitTime: 2000,
|
||||||
|
/**
|
||||||
|
* @description Carousel type
|
||||||
|
* @type {String}
|
||||||
|
* @default carousel = 'single'
|
||||||
|
* @example carousel = 'single' | 'page'
|
||||||
|
*/
|
||||||
|
carousel: 'single'
|
||||||
|
},
|
||||||
|
|
||||||
|
mergedConfig: null,
|
||||||
|
|
||||||
|
rowsData: [],
|
||||||
|
|
||||||
|
rows: [],
|
||||||
|
|
||||||
|
heights: [],
|
||||||
|
|
||||||
|
animationIndex: 0,
|
||||||
|
|
||||||
|
animationHandler: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
config () {
|
||||||
|
const { stopAnimation, calcData } = this
|
||||||
|
|
||||||
|
stopAnimation()
|
||||||
|
|
||||||
|
calcData()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
afterAutoResizeMixinInit () {
|
||||||
|
const { calcData } = this
|
||||||
|
|
||||||
|
calcData()
|
||||||
|
},
|
||||||
|
onResize () {
|
||||||
|
const { mergedConfig, calcHeights } = this
|
||||||
|
|
||||||
|
if (!mergedConfig) return
|
||||||
|
|
||||||
|
calcHeights(true)
|
||||||
|
},
|
||||||
|
calcData () {
|
||||||
|
const { mergeConfig, calcRowsData } = this
|
||||||
|
|
||||||
|
mergeConfig()
|
||||||
|
|
||||||
|
calcRowsData()
|
||||||
|
|
||||||
|
const { calcHeights } = this
|
||||||
|
|
||||||
|
calcHeights()
|
||||||
|
|
||||||
|
const { animation } = this
|
||||||
|
|
||||||
|
animation(true)
|
||||||
|
},
|
||||||
|
mergeConfig () {
|
||||||
|
let { config, defaultConfig } = this
|
||||||
|
|
||||||
|
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
|
||||||
|
},
|
||||||
|
calcRowsData () {
|
||||||
|
let { data, rowNum } = this.mergedConfig
|
||||||
|
|
||||||
|
data.sort(({ value: a }, { value: b }) => {
|
||||||
|
if (a > b) return -1
|
||||||
|
if (a < b) return 1
|
||||||
|
if (a === b) return 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const value = data.map(({ value }) => value)
|
||||||
|
|
||||||
|
const max = Math.max(...value) || 0
|
||||||
|
|
||||||
|
data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: row.value / max * 100 }))
|
||||||
|
|
||||||
|
const rowLength = data.length
|
||||||
|
|
||||||
|
if (rowLength > rowNum && rowLength < 2 * rowNum) {
|
||||||
|
data = [...data, ...data]
|
||||||
|
}
|
||||||
|
|
||||||
|
data = data.map((d, i) => ({ ...d, scroll: i }))
|
||||||
|
|
||||||
|
this.rowsData = data
|
||||||
|
this.rows = data
|
||||||
|
},
|
||||||
|
calcHeights (onresize = false) {
|
||||||
|
const { height, mergedConfig } = this
|
||||||
|
|
||||||
|
const { rowNum, data } = mergedConfig
|
||||||
|
|
||||||
|
const avgHeight = height / rowNum
|
||||||
|
|
||||||
|
this.avgHeight = avgHeight
|
||||||
|
|
||||||
|
if (!onresize) this.heights = new Array(data.length).fill(avgHeight)
|
||||||
|
},
|
||||||
|
async animation (start = false) {
|
||||||
|
let { avgHeight, animationIndex, mergedConfig, rowsData, animation } = this
|
||||||
|
|
||||||
|
const { waitTime, carousel, rowNum } = mergedConfig
|
||||||
|
|
||||||
|
const rowLength = rowsData.length
|
||||||
|
|
||||||
|
if (rowNum >= rowLength) return
|
||||||
|
|
||||||
|
if (start) await new Promise(resolve => setTimeout(resolve, waitTime))
|
||||||
|
|
||||||
|
const animationNum = carousel === 'single' ? 1 : rowNum
|
||||||
|
|
||||||
|
let rows = rowsData.slice(animationIndex)
|
||||||
|
rows.push(...rowsData.slice(0, animationIndex))
|
||||||
|
|
||||||
|
this.rows = rows
|
||||||
|
this.heights = new Array(rowLength).fill(avgHeight)
|
||||||
|
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 300))
|
||||||
|
|
||||||
|
this.heights.splice(0, animationNum, ...new Array(animationNum).fill(0))
|
||||||
|
|
||||||
|
animationIndex += animationNum
|
||||||
|
|
||||||
|
const back = animationIndex - rowLength
|
||||||
|
if (back >= 0) animationIndex = back
|
||||||
|
|
||||||
|
this.animationIndex = animationIndex
|
||||||
|
this.animationHandler = setTimeout(animation, waitTime - 300)
|
||||||
|
},
|
||||||
|
stopAnimation () {
|
||||||
|
const { animationHandler } = this
|
||||||
|
|
||||||
|
if (!animationHandler) return
|
||||||
|
|
||||||
|
clearTimeout(animationHandler)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroyed () {
|
||||||
|
const { stopAnimation } = this
|
||||||
|
|
||||||
|
stopAnimation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
@color: #1370fb;
|
||||||
|
|
||||||
|
.dv-scroll-ranking-board {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
color: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.row-item {
|
||||||
|
transition: all 0.3s;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ranking-info {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
.rank {
|
||||||
|
width: 40px;
|
||||||
|
color: @color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-name {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ranking-column {
|
||||||
|
border-bottom: 2px solid fade(@color, 50);
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
|
.inside-column {
|
||||||
|
position: relative;
|
||||||
|
height: 6px;
|
||||||
|
background-color: @color;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
border-radius: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shine {
|
||||||
|
position: absolute;
|
||||||
|
left: 0%;
|
||||||
|
top: 2px;
|
||||||
|
height: 2px;
|
||||||
|
width: 50px;
|
||||||
|
transform: translateX(-100%);
|
||||||
|
background: radial-gradient(rgb(40, 248, 255) 5%, transparent 80%);
|
||||||
|
animation: shine 3s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes shine {
|
||||||
|
80% {
|
||||||
|
left: 0%;
|
||||||
|
transform: translateX(-100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
left: 100%;
|
||||||
|
transform: translateX(0%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
5
src/components/waterLevelPond/index.js
Normal file
5
src/components/waterLevelPond/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import WaterLevelPond from './src/main.vue'
|
||||||
|
|
||||||
|
export default function (Vue) {
|
||||||
|
Vue.component(WaterLevelPond.name, WaterLevelPond)
|
||||||
|
}
|
@ -47,7 +47,7 @@ import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
|||||||
import CRender from '@jiaminghi/c-render'
|
import CRender from '@jiaminghi/c-render'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'waterLevelPond',
|
name: 'DvWaterLevelPond',
|
||||||
props: {
|
props: {
|
||||||
config: Object,
|
config: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
@ -266,7 +266,7 @@ export default {
|
|||||||
const firstPoint = points[0]
|
const firstPoint = points[0]
|
||||||
const lastPoint = points.slice(-1)[0]
|
const lastPoint = points.slice(-1)[0]
|
||||||
|
|
||||||
const [w, h] = area
|
const h = area[1]
|
||||||
|
|
||||||
ctx.lineTo(lastPoint[0], h)
|
ctx.lineTo(lastPoint[0], h)
|
||||||
ctx.lineTo(firstPoint[0], h)
|
ctx.lineTo(firstPoint[0], h)
|
||||||
@ -285,8 +285,6 @@ export default {
|
|||||||
const w = render.area[0]
|
const w = render.area[0]
|
||||||
|
|
||||||
waves.forEach(graph => {
|
waves.forEach(graph => {
|
||||||
const reset = repeat % 2 === 0
|
|
||||||
|
|
||||||
graph.attr('style', { translate: [0, 0] })
|
graph.attr('style', { translate: [0, 0] })
|
||||||
|
|
||||||
graph.animation('style', {
|
graph.animation('style', {
|
||||||
@ -309,7 +307,7 @@ export default {
|
|||||||
init()
|
init()
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
const { calcData, render } = this
|
const { render } = this
|
||||||
|
|
||||||
render.delAllGraph()
|
render.delAllGraph()
|
||||||
|
|
@ -54,7 +54,7 @@ export default {
|
|||||||
window.addEventListener('resize', debounceInitWHFun)
|
window.addEventListener('resize', debounceInitWHFun)
|
||||||
},
|
},
|
||||||
unbindDomResizeCallback () {
|
unbindDomResizeCallback () {
|
||||||
const { domObserver, debounceInitWHFun } = this
|
let { domObserver, debounceInitWHFun } = this
|
||||||
|
|
||||||
domObserver.disconnect()
|
domObserver.disconnect()
|
||||||
domObserver.takeRecords()
|
domObserver.takeRecords()
|
||||||
@ -68,9 +68,9 @@ export default {
|
|||||||
|
|
||||||
autoResizeMixinInit()
|
autoResizeMixinInit()
|
||||||
},
|
},
|
||||||
beforeDestroyed () {
|
beforeDestroy () {
|
||||||
const { unbindDomResizeCallback } = this
|
const { unbindDomResizeCallback } = this
|
||||||
|
|
||||||
unbindDomResizeCallback()
|
unbindDomResizeCallback()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -36,4 +36,4 @@ export function getPointDistance (pointOne, pointTwo) {
|
|||||||
const minusY = Math.abs(pointOne[1] - pointTwo[1])
|
const minusY = Math.abs(pointOne[1] - pointTwo[1])
|
||||||
|
|
||||||
return Math.sqrt(minusX * minusX + minusY * minusY)
|
return Math.sqrt(minusX * minusX + minusY * minusY)
|
||||||
}
|
}
|
Reference in New Issue
Block a user