@lemon-fe/components 0.1.70 → 0.1.74

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.
@@ -408,9 +408,9 @@ function Filter(props) {
408
408
  }
409
409
  });
410
410
  rows.push(currRow);
411
- value += simple ? 180 : 220;
411
+ value += simple ? 208 : 248;
412
412
 
413
- if (currRow.length > 0 && value > width) {
413
+ if (currRow.length > 0 && value >= width + getColStyle(1).width) {
414
414
  rows.push([]);
415
415
  }
416
416
 
@@ -3,13 +3,18 @@ import type { ModalProps } from 'antd/lib/modal';
3
3
  export interface PopupProps<ValueType> extends ModalProps {
4
4
  value?: ValueType;
5
5
  onChange?: (value?: ValueType) => void;
6
+ /**
7
+ * @description 渲染函数,这个函数不是作为组件渲染的,偷懒可以直接传入组件,如果需要考虑优化参考demo的传入方式
8
+ */
6
9
  component: (params: {
7
10
  value?: ValueType;
8
11
  onChange: (value: ValueType) => void;
9
12
  }) => ReactElement | null;
10
13
  formatLabel?: (value: ValueType) => string;
11
14
  beforeOk?: (value: ValueType) => ValueType | PromiseLike<ValueType>;
12
- children?: ReactElement;
15
+ children?: JSX.Element | ((props: {
16
+ value?: ValueType;
17
+ }) => JSX.Element);
13
18
  allowClear?: boolean;
14
19
  disabled?: boolean;
15
20
  autoFocus?: boolean;
@@ -19,7 +24,7 @@ export interface PopupProps<ValueType> extends ModalProps {
19
24
  bordered?: boolean;
20
25
  onClick?: () => void;
21
26
  }
22
- interface ValuedPopupProps<ValueType> extends Omit<PopupProps<ValueType>, 'value' | 'onChange'> {
27
+ interface ValuedPopupProps<ValueType> extends Omit<PopupProps<ValueType>, 'value' | 'onChange' | 'allowClear'> {
23
28
  value: ValueType;
24
29
  onChange?: (value: ValueType) => void;
25
30
  }
package/es/Popup/index.js CHANGED
@@ -26,7 +26,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
26
26
 
27
27
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
28
28
 
29
- import React, { useState, cloneElement, useRef } from 'react';
29
+ import React, { useState, cloneElement, useRef, isValidElement } from 'react';
30
30
  import { Modal, Input, message } from 'antd';
31
31
  import { CloseCircleFilled } from '@ant-design/icons';
32
32
  import { PREFIX_CLS } from '../constants';
@@ -151,7 +151,11 @@ function Popup(props) {
151
151
  var label = valueProp ? formatLabel ? formatLabel(valueProp) : valueProp : undefined;
152
152
  var trigger;
153
153
 
154
- if (children) {
154
+ if (typeof children === 'function') {
155
+ trigger = children({
156
+ value: valueProp
157
+ });
158
+ } else if ( /*#__PURE__*/isValidElement(children)) {
155
159
  trigger = showLabel ? /*#__PURE__*/cloneElement(children, undefined, label) : children;
156
160
  } else {
157
161
  trigger = /*#__PURE__*/React.createElement(Input, {
@@ -13,7 +13,7 @@ interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | '
13
13
  onSelect?: (node: TreeData<KeyType>, info: {
14
14
  event: 'select';
15
15
  selected: boolean;
16
- node: EventDataNode;
16
+ node: EventDataNode<DataNode>;
17
17
  selectedNodes: DataNode[];
18
18
  nativeEvent: MouseEvent;
19
19
  }) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.70",
3
+ "version": "0.1.74",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -36,10 +36,10 @@
36
36
  "@types/color-string": "^1.5.2",
37
37
  "@types/lodash": "^4.14.179",
38
38
  "@types/react-resizable": "^1.7.4",
39
- "antd": "^4.20.2",
39
+ "antd": "^4.21.6",
40
40
  "rc-resize-observer": "^1.2.0",
41
41
  "react": "^17.0.2",
42
42
  "react-dom": "^17.0.2"
43
43
  },
44
- "gitHead": "46b0cf9ea5f30f15b92816311117cfb815a47330"
44
+ "gitHead": "4ee13e359f887a2e5baf92cfbf18e4b8eba8f200"
45
45
  }