ebaoferc 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ export declare const Gutter: [number, number];
4
4
  export default function (props: PropsWithChildren<{
5
5
  colProps?: ColProps;
6
6
  width?: number;
7
+ maxColCount?: number;
7
8
  gutter?: number[];
8
9
  lineCountChange?: (count: number) => void;
9
10
  collapsed?: boolean;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["colProps", "width", "gutter", "collapsedLineCount", "collapsed", "lineCountChange"];
2
+ var _excluded = ["colProps", "width", "maxColCount", "gutter", "collapsedLineCount", "collapsed", "lineCountChange"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -20,6 +20,7 @@ export default function (props) {
20
20
  } : _props$colProps,
21
21
  _props$width = props.width,
22
22
  width = _props$width === void 0 ? 250 : _props$width,
23
+ maxColCount = props.maxColCount,
23
24
  _props$gutter = props.gutter,
24
25
  gutter = _props$gutter === void 0 ? Gutter : _props$gutter,
25
26
  _props$collapsedLineC = props.collapsedLineCount,
@@ -37,8 +38,10 @@ export default function (props) {
37
38
  // 包含间隔的宽度
38
39
  var itemWidth = width + gapX;
39
40
 
40
- // 一行能放下的个数
41
- var colCount = Math.floor(((size === null || size === void 0 ? void 0 : size.width) || 0) / itemWidth);
41
+ // 预估一行能放下的列数
42
+ var preColCount = Math.floor(((size === null || size === void 0 ? void 0 : size.width) || 0) / itemWidth);
43
+ // 实际一行放的列数
44
+ var colCount = maxColCount && preColCount > maxColCount ? maxColCount : preColCount;
42
45
 
43
46
  // 展示的个数
44
47
  var renderItemCount = ((_Children$map = Children.map(props.children, function (child) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ebaoferc",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",