@lemon-fe/components 1.4.7-alpha.0 → 1.4.8

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.
@@ -17,7 +17,7 @@ declare const Editors: {
17
17
  Text: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
18
18
  Date: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
19
19
  Number: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
20
- Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "allowClear" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
20
+ Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
21
21
  fieldNames?: {
22
22
  label: string;
23
23
  value: string;
@@ -2,5 +2,9 @@
2
2
  import type { ICellRendererParams } from 'ag-grid-community';
3
3
  export default function CellIndexRender<TData>(props: ICellRendererParams<TData> & {
4
4
  useChildIndex?: boolean;
5
+ /**
6
+ * 此validator:校验整行数据并实时显示错误信息,红色叹号图标。
7
+ * rules里的validator:只校验单元格自己,在提交时展示错误信息,右上角标红。
8
+ */
5
9
  validator?: (data: ICellRendererParams<TData>) => string | undefined;
6
10
  }): number | JSX.Element | null;
@@ -41,12 +41,20 @@ export default function CellIndexRender(props) {
41
41
  };
42
42
  }, [type]);
43
43
  useEffect(function () {
44
- var handler = function handler(evt) {
44
+ var cellHandler = function cellHandler(evt) {
45
+ /** 单元格修改,始终都是在同一个对象上对字段的值直接修改,对象的引用没有变,不会触发渲染 */
46
+ setRow(function () {
47
+ return _objectSpread({}, evt.node.data);
48
+ });
49
+ };
50
+ var dataHandler = function dataHandler(evt) {
45
51
  setRow(evt.newData);
46
52
  };
47
- node.addEventListener('cellChanged', handler);
53
+ node.addEventListener('cellChanged', cellHandler);
54
+ node.addEventListener('dataChanged', dataHandler);
48
55
  return function () {
49
- node.removeEventListener('cellChanged', handler);
56
+ node.removeEventListener('cellChanged', cellHandler);
57
+ node.removeEventListener('dataChanged', dataHandler);
50
58
  };
51
59
  }, []);
52
60
  var render = function render(idx) {
@@ -81,7 +81,6 @@ var getStorageData = function getData(storageKey) {
81
81
  return null;
82
82
  };
83
83
  var setStorageData = function setData(storageKey, data, action) {
84
- console.log(action);
85
84
  localStorage.setItem("filter-storage-".concat(storageKey), JSON.stringify(data));
86
85
  };
87
86
  var DEFAULT_TAB_ALIAS = '$$default';
@@ -499,7 +498,7 @@ function Filter(originalProps) {
499
498
  };
500
499
  var handleSubmit = useDebounce(function (val) {
501
500
  return handleFinish(val, 'submit');
502
- }, 1000, {
501
+ }, 666, {
503
502
  leading: true,
504
503
  trailing: false
505
504
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.4.7-alpha.0",
3
+ "version": "1.4.8",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "09e7aef5d176eb8495585b67e3eb807ff43116b0"
61
+ "gitHead": "5efd8dc6fe627450229c376bea96040c882ac430"
62
62
  }