Skip to content

Commit

Permalink
update version to 1.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhiyuyou committed Nov 15, 2020
1 parent e62ab0b commit dc8e44a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# 1.2.5-alpha (2020-11-15)

### New

- **decoration12:** New decoration(Radar scan).

### Optmization

- **ScrollBoard:** Reduce redundant node rendering.
- **ScrollRankingBoard:** Reduce redundant node rendering.
- **ScrollRankingBoard:** Add value formatter.
- **BorderBox:** Canonical class name.
- **useAutoResize(hooks):** Add exception prompt.
- **Decoration** add `dur` configuration.
- **ActiveRingChart** add `digitalFlopUnit` configuration.

# 1.2.4-alpha (2020-7-25)

### Bug 修复
Expand Down Expand Up @@ -70,12 +86,14 @@
### Feature

- **BorderBox & Decoration:** **Configurable** color.

```html
<!-- Example -->
<BorderBox1 color={['red', 'green']} />
<Decoration1 color={['red', 'green']} />
```
- **ScrollBoard:** 配置 header index.

- **ScrollBoard:** 配置 header index.

### New

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jiaminghi/data-view-react",
"version": "1.2.4",
"version": "1.2.5",
"description": "React Large screen data display component library",
"author": "Duan Yu <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -65,4 +65,4 @@
"es",
"umd"
]
}
}
1 change: 1 addition & 0 deletions src/components/scrollBoard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ const ScrollBoard = forwardRef(({ onClick, config = {}, className, style, onMous

let rows = rowsData.slice(animationIndex)
rows.push(...rowsData.slice(0, animationIndex))
rows = rows.slice(0, carousel === 'page' ? rowNum * 2 : rowNum + 1)

const heights = new Array(rowLength).fill(avgHeight)
setState(state => ({ ...state, rows, heights }))
Expand Down
11 changes: 9 additions & 2 deletions src/components/scrollRankingBoard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ const defaultConfig = {
* @type {Boolean}
* @default sort = true
*/
sort: true
sort: true,
/**
* @description Value formatter
* @type {Function}
* @default valueFormatter = null
*/
valueFormatter: null
}

function calcRows({ data, rowNum, sort }) {
Expand Down Expand Up @@ -170,6 +176,7 @@ const ScrollRankingBoard = forwardRef(({ config = {}, className, style }, ref) =

let rows = rowsData.slice(animationIndex)
rows.push(...rowsData.slice(0, animationIndex))
rows = rows.slice(0, rowNum + 1)

const heights = new Array(rowLength).fill(avgHeight)
setState(state => ({ ...state, rows, heights }))
Expand Down Expand Up @@ -244,7 +251,7 @@ const ScrollRankingBoard = forwardRef(({ config = {}, className, style }, ref) =
<div className='rank'>No.{item.ranking}</div>
<div className='info-name' dangerouslySetInnerHTML={{ __html: item.name }} />
<div className='ranking-value'>
{item.value + mergedConfig.unit}
{mergedConfig.valueFormatter ? mergedConfig.valueFormatter(item) : item.value + mergedConfig.unit}
</div>
</div>

Expand Down
16 changes: 13 additions & 3 deletions src/use/autoResize.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ export default function useAutoResize(ref) {
const domRef = useRef(null)

const setWH = useCallback(() => {
const { clientWidth, clientHeight } = domRef.current
const { clientWidth, clientHeight } = domRef.current || { clientWidth: 0, clientHeight: 0 }

setState({ width: clientWidth, height: clientHeight })

if (!domRef.current) {
console.warn('DataV: Failed to get dom node, component rendering may be abnormal!')
} else if (!clientWidth || !clientHeight) {
console.warn('DataV: Component width or height is 0px, rendering abnormality may occur!')
}
}, [])

useImperativeHandle(ref, () => ({ setWH }), [])
Expand All @@ -24,10 +30,14 @@ export default function useAutoResize(ref) {
window.addEventListener('resize', debounceSetWHFun)

return () => {
window.removeEventListener('resize', debounceSetWHFun)

if (!domObserver) {
return
}

domObserver.disconnect()
domObserver.takeRecords()

window.removeEventListener('resize', debounceSetWHFun)
}
}, [])

Expand Down

0 comments on commit dc8e44a

Please sign in to comment.