@lemon-fe/kits 1.0.7 → 1.0.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.
@@ -1232,7 +1232,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1232
1232
  })));
1233
1233
  code = mCode;
1234
1234
  } catch (err) {
1235
- console.log('pre check mathmatic expression failed');
1235
+ console.log('pre check mathmatic expression failed:', err.message);
1236
1236
  }
1237
1237
 
1238
1238
  fieldCol.valueGetter = function (params) {
@@ -1300,7 +1300,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1300
1300
  };
1301
1301
 
1302
1302
  fieldCol.valueFormatter = function (params) {
1303
- if (Number.isNaN(params.value) || BigNumber.isBigNumber(params.value) && params.value.isNaN()) {
1303
+ if (Number.isNaN(params.value) || !Number.isFinite(params.value) || BigNumber.isBigNumber(params.value) && (params.value.isNaN() || !params.value.isFinite())) {
1304
1304
  return '-';
1305
1305
  }
1306
1306
 
@@ -1631,8 +1631,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1631
1631
  _this9.store.setState({
1632
1632
  errors: errors
1633
1633
  });
1634
- }).catch(function (_ref7) {
1635
- var fields = _ref7.fields;
1634
+ }).catch(function (res) {
1635
+ var fields = res.fields;
1636
1636
  var errors = new Map(_this9.store.getState().errors);
1637
1637
  var error = new Map();
1638
1638
  Object.entries(fields).forEach(function (item) {
@@ -1659,7 +1659,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1659
1659
  switch (_context4.prev = _context4.next) {
1660
1660
  case 0:
1661
1661
  promises = [];
1662
- this.api.forEachNode(function (rowNode) {
1662
+ this.api.forEachNode(function (rowNode, idx) {
1663
1663
  var record = rowNode.data;
1664
1664
 
1665
1665
  if (record === undefined) {
@@ -1673,11 +1673,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1673
1673
  if (_this10.validator === null) {
1674
1674
  promises.push(Promise.resolve(true));
1675
1675
  } else {
1676
- promises.push(_this10.validator.validate(record).catch(function (_ref8) {
1677
- var fields = _ref8.fields;
1676
+ promises.push(_this10.validator.validate(record).catch(function (_ref7) {
1677
+ var fields = _ref7.fields;
1678
1678
  return Promise.reject({
1679
1679
  id: rowId,
1680
- fields: fields
1680
+ data: record,
1681
+ fields: fields,
1682
+ node: rowNode,
1683
+ index: idx
1681
1684
  });
1682
1685
  }));
1683
1686
  }
@@ -1692,14 +1695,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1692
1695
  failed = [];
1693
1696
  result.forEach(function (item) {
1694
1697
  if (item.status === 'rejected') {
1695
- var _ref9 = item.reason,
1696
- id = _ref9.id,
1697
- fields = _ref9.fields;
1698
+ var _ref8 = item.reason,
1699
+ id = _ref8.id,
1700
+ fields = _ref8.fields;
1698
1701
  var error = new Map();
1699
- Object.entries(fields).forEach(function (_ref10) {
1700
- var _ref11 = _slicedToArray(_ref10, 2),
1701
- field = _ref11[0],
1702
- errs = _ref11[1];
1702
+ Object.entries(fields).forEach(function (_ref9) {
1703
+ var _ref10 = _slicedToArray(_ref9, 2),
1704
+ field = _ref10[0],
1705
+ errs = _ref10[1];
1703
1706
 
1704
1707
  error.set(field, errs.map(function (err) {
1705
1708
  return err.message || "".concat(field, "\u8F93\u5165\u9519\u8BEF");
@@ -1939,8 +1942,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1939
1942
  }
1940
1943
  }], [{
1941
1944
  key: "isSummaryRow",
1942
- value: function isSummaryRow(_ref12) {
1943
- var node = _ref12.node;
1945
+ value: function isSummaryRow(_ref11) {
1946
+ var node = _ref11.node;
1944
1947
 
1945
1948
  if (node && node.data && node.data[DataGrid.SummaryFlag]) {
1946
1949
  return true;
@@ -1,6 +1,6 @@
1
- import type { ColDef, ColGroupDef, EditableCallbackParams, ICellEditorParams, ICellRendererParams, IHeaderParams, AgGridEvent, CheckboxSelectionCallback, ColumnState } from '@ag-grid-community/core';
1
+ import type { ColDef, ColGroupDef, EditableCallbackParams, ICellEditorParams, ICellRendererParams, IHeaderParams, AgGridEvent, CheckboxSelectionCallback, ColumnState, IRowNode } from '@ag-grid-community/core';
2
2
  import type { AgGridReactProps } from '@ag-grid-community/react';
3
- import type { RuleItem } from 'async-validator/dist-types/interface';
3
+ import type { RuleItem, ValidateFieldsError } from 'async-validator/dist-types/interface';
4
4
  import type { ReactElement, ReactNode } from 'react';
5
5
  import type { DateEditorParams } from './cell-editors/Date';
6
6
  import type { NumberEditorParams } from './cell-editors/Number';
@@ -20,6 +20,13 @@ export declare type PathType = string;
20
20
  export declare type ValidateRule<T> = Pick<RuleItem, 'required' | 'message' | 'pattern' | 'min' | 'max' | 'len' | 'type'> & {
21
21
  validator?: (rule: any, val: any, record: T) => void | Promise<void>;
22
22
  };
23
+ export declare type ValidateResult<TData> = {
24
+ id: string;
25
+ node: IRowNode<TData>;
26
+ data: TData;
27
+ index: number;
28
+ fields: ValidateFieldsError;
29
+ }[];
23
30
  interface EditorParamsType<T extends string, K extends Record<string, any>> {
24
31
  type: T;
25
32
  params?: K;
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import React, { type CSSProperties } from 'react';
2
2
  declare const PageLoading: React.FC<{
3
3
  tip?: string;
4
+ style?: CSSProperties;
4
5
  }>;
5
6
  export default PageLoading;
@@ -1,11 +1,13 @@
1
- import React from 'react';
2
1
  import { Spin } from 'antd';
2
+ import React from 'react';
3
3
  import { PREFIX_CLS } from "../../constants";
4
4
 
5
5
  var PageLoading = function PageLoading(_ref) {
6
- var tip = _ref.tip;
6
+ var tip = _ref.tip,
7
+ style = _ref.style;
7
8
  return /*#__PURE__*/React.createElement("div", {
8
- className: "".concat(PREFIX_CLS, "-page-loading")
9
+ className: "".concat(PREFIX_CLS, "-page-loading"),
10
+ style: style
9
11
  }, /*#__PURE__*/React.createElement(Spin, {
10
12
  size: "large",
11
13
  tip: tip
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",