@lemon-fe/kits 1.0.0-58 → 1.0.0-59

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.
@@ -46,7 +46,7 @@ export default class DataGrid<TData> extends Component<DataGridProps<TData>, Dat
46
46
  static Editors: {
47
47
  Text: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any> & import("./typings").TextEditorParams & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
48
48
  Date: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any> & import("./typings").DateEditorParams & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
49
- Number: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any> & import("./typings").NumberEditorParams & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
49
+ Number: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
50
50
  Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "allowClear" | "options" | "virtual" | "showSearch" | "listHeight"> & {
51
51
  fieldNames?: {
52
52
  label: string;
@@ -582,13 +582,18 @@ var DataGrid = /*#__PURE__*/function (_Component) {
582
582
 
583
583
  if (_typeof(editable) === 'object') {
584
584
  var renderer = editable.renderer,
585
- valueSetter = editable.valueSetter;
585
+ valueSetter = editable.valueSetter,
586
+ enable = editable.enable;
586
587
 
587
588
  _opts.editable = function (mParams) {
588
589
  if (mParams.node.isRowPinned()) {
589
590
  return false;
590
591
  }
591
592
 
593
+ if (enable !== undefined) {
594
+ return enable(mParams);
595
+ }
596
+
592
597
  return true;
593
598
  };
594
599
 
@@ -1,5 +1,5 @@
1
1
  import type { AgGridReactProps } from '@ag-grid-community/react';
2
- import type { ColDef, ColGroupDef, ICellEditorParams, ICellRendererParams, IHeaderParams } from '@ag-grid-community/core';
2
+ import type { ColDef, ColGroupDef, EditableCallbackParams, ICellEditorParams, ICellRendererParams, IHeaderParams } from '@ag-grid-community/core';
3
3
  import type { RuleItem } from 'async-validator/dist-types/interface';
4
4
  import type { ReactElement, ReactNode } from 'react';
5
5
  import type { TextEditorParams } from './cell-editors/Text';
@@ -40,6 +40,7 @@ export interface ColType<TData> extends Omit<ColDef<TData>, 'editable'> {
40
40
  * @description 可编辑单元格
41
41
  */
42
42
  editable?: {
43
+ enable?: (params: EditableCallbackParams<TData>) => boolean;
43
44
  rules?: ValidateRule<TData>[];
44
45
  valueSetter?: (val: any, data: TData) => Partial<TData>;
45
46
  renderer: EditorType<TData> | ((params: ICellEditorParams<TData>) => EditorType<TData>);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-58",
3
+ "version": "1.0.0-59",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",