diff --git a/package.json b/package.json index 7ea9347..b7c1324 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kne/column-split", - "version": "1.0.3", + "version": "1.0.4", "description": "通过拖动分隔条分配元素占比", "syntax": { "esmodules": true diff --git a/src/index.js b/src/index.js index 741e2ca..521b7c4 100644 --- a/src/index.js +++ b/src/index.js @@ -99,33 +99,35 @@ const ColumnSplit = ({ columns = [], className, renderItem, readOnly, disabled, ); })} - - {disabledColumns.map((column, index) => { - const itemValue = 0; - const valueStr = typeof column.render === 'function' ? column.render({ value: itemValue }) : `${Math.round(100 * itemValue)}%`; - const el = ( - - ); - return {typeof renderItem === 'function' ? renderItem({ item: column, value: itemValue, valueStr, el, index }) : el}; - })} - + {disabled || readOnly || !allowZero ? null : ( + + {disabledColumns.map((column, index) => { + const itemValue = 0; + const valueStr = typeof column.render === 'function' ? column.render({ value: itemValue }) : `${Math.round(100 * itemValue)}%`; + const el = ( + + ); + return {typeof renderItem === 'function' ? renderItem({ item: column, value: itemValue, valueStr, el, index }) : el}; + })} + + )} ); };