diff --git a/CHANGELOG.md b/CHANGELOG.md index eadb398..dbcb88f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.0.10-alpha (2019-12-27) + +### Perfect + +- **ScrollRankingBoard:** 配置项 sort 控制是否自动排序. +- **ScrollRankingBoard:** 通过 dangerouslySetInnerHTML 渲染 name 数据. + # 1.0.8-alpha (2019-12-17) ### Feature diff --git a/package.json b/package.json index 66e5b68..49416de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jiaminghi/data-view-react", - "version": "1.0.9", + "version": "1.0.10", "description": "React Large screen data display component library", "author": "Duan Yu <949267840@qq.com>", "license": "MIT", @@ -20,7 +20,7 @@ "prepare": "yarn run build" }, "dependencies": { - "@jiaminghi/charts": "^0.2.8" + "@jiaminghi/charts": "^0.2.10" }, "peerDependencies": { "react": "^16.8.0", diff --git a/src/components/scrollRankingBoard/index.js b/src/components/scrollRankingBoard/index.js index 70a43dc..6b1871f 100644 --- a/src/components/scrollRankingBoard/index.js +++ b/src/components/scrollRankingBoard/index.js @@ -45,11 +45,17 @@ const defaultConfig = { * @default unit = '' * @example unit = 'ton' */ - unit: '' + unit: '', + /** + * @description Auto sort by value + * @type {Boolean} + * @default sort = true + */ + sort: true } -function calcRows({ data, rowNum }) { - data.sort(({ value: a }, { value: b }) => { +function calcRows({ data, rowNum, sort }) { + sort && data.sort(({ value: a }, { value: b }) => { if (a > b) return -1 if (a < b) return 1 if (a === b) return 0 @@ -137,7 +143,7 @@ const ScrollRankingBoard = ({ config, className, style }) => { } } - function * animation(start = false) { + function* animation(start = false) { let { avgHeight, animationIndex, @@ -176,9 +182,9 @@ const ScrollRankingBoard = ({ config, className, style }) => { let start = true - function * loop() { + function* loop() { while (true) { - yield * animation(start) + yield* animation(start) start = false @@ -225,7 +231,7 @@ const ScrollRankingBoard = ({ config, className, style }) => { >
No.{item.ranking}
-
{item.name}
+
{item.value + mergedConfig.unit}