@lemon-fe/kits 1.0.0-150 → 1.0.0-151
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.
- package/es/components/DataGrid/index.d.ts +3 -2
- package/es/components/DataGrid/index.js +5 -3
- package/es/components/DataGrid/index.less +5 -1
- package/es/components/DataGrid/utils.d.ts +1 -1
- package/es/components/DataGrid/utils.js +15 -5
- package/es/hooks/useBatchOperator/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ColDef,
|
|
1
|
+
import type { ColDef, IRowNode } from '@ag-grid-community/core';
|
|
2
2
|
import { GridApi, ColumnApi } from '@ag-grid-community/core';
|
|
3
3
|
import React, { Component } from 'react';
|
|
4
4
|
import EditorWrapper from './cell-editors/Wrapper';
|
|
@@ -44,6 +44,7 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
|
|
|
44
44
|
components: Record<string, any>;
|
|
45
45
|
};
|
|
46
46
|
static SummaryFlag: symbol;
|
|
47
|
+
static IndexColId: string;
|
|
47
48
|
static EmptyCol: ColType<any>;
|
|
48
49
|
static Editors: {
|
|
49
50
|
Text: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
@@ -74,7 +75,7 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
|
|
|
74
75
|
private isPreserveSelected;
|
|
75
76
|
private updateRowData;
|
|
76
77
|
isSummaryRow({ node }: {
|
|
77
|
-
node?:
|
|
78
|
+
node?: IRowNode<any>;
|
|
78
79
|
}): boolean;
|
|
79
80
|
private getSummaryRowData;
|
|
80
81
|
private getDataFromServer;
|
|
@@ -822,7 +822,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
822
822
|
if (checkboxSelection) {
|
|
823
823
|
result.unshift({
|
|
824
824
|
width: 32,
|
|
825
|
-
colId: '
|
|
825
|
+
colId: '$$selection',
|
|
826
826
|
checkboxSelection: checkboxSelection,
|
|
827
827
|
showDisabledCheckboxes: true,
|
|
828
828
|
headerCheckboxSelection: rowSelection.type !== 'radio',
|
|
@@ -841,7 +841,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
841
841
|
|
|
842
842
|
if (rowActions !== undefined) {
|
|
843
843
|
result.push({
|
|
844
|
-
colId: '
|
|
844
|
+
colId: '$$actions',
|
|
845
845
|
pinned: 'right',
|
|
846
846
|
cellRenderer: CellRenderer,
|
|
847
847
|
width: 1,
|
|
@@ -1472,8 +1472,10 @@ _defineProperty(DataGrid, "defaultProps", {
|
|
|
1472
1472
|
|
|
1473
1473
|
_defineProperty(DataGrid, "SummaryFlag", Symbol('summary'));
|
|
1474
1474
|
|
|
1475
|
+
_defineProperty(DataGrid, "IndexColId", '$$index');
|
|
1476
|
+
|
|
1475
1477
|
_defineProperty(DataGrid, "EmptyCol", {
|
|
1476
|
-
|
|
1478
|
+
colId: '$$empty',
|
|
1477
1479
|
flex: 1,
|
|
1478
1480
|
resizable: false,
|
|
1479
1481
|
suppressMovable: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ColDef } from '@ag-grid-community/core';
|
|
1
2
|
import { Subject } from '@lemon-fe/utils';
|
|
2
3
|
import type { ColType, ColGroupType, PathType } from './typings';
|
|
3
|
-
import type { ColDef } from '@ag-grid-community/core';
|
|
4
4
|
export declare const prefix: (val?: string | undefined) => string;
|
|
5
5
|
export declare function isColumn<T>(col: ColGroupType<T> | ColType<T>): col is ColType<T>;
|
|
6
6
|
export declare function getColField(col: {
|
|
@@ -26,8 +26,8 @@ import { Subject } from '@lemon-fe/utils';
|
|
|
26
26
|
import { get as _get, set as _set } from 'lodash';
|
|
27
27
|
import moment from 'moment';
|
|
28
28
|
import { prefixClassName } from "../utils";
|
|
29
|
-
import CellIndexRender from "./renderer/CellIndexRenderer";
|
|
30
29
|
import CellDeleteRender from "./renderer/CellDeleteRenderer";
|
|
30
|
+
import CellIndexRender from "./renderer/CellIndexRenderer";
|
|
31
31
|
export var prefix = prefixClassName('grid');
|
|
32
32
|
export function isColumn(col) {
|
|
33
33
|
return col.children === undefined;
|
|
@@ -301,23 +301,33 @@ export var columnTypes = {
|
|
|
301
301
|
initialWidth: 120
|
|
302
302
|
},
|
|
303
303
|
index: {
|
|
304
|
-
colId: '
|
|
304
|
+
colId: '$$index',
|
|
305
305
|
headerName: '序号',
|
|
306
306
|
cellRenderer: CellIndexRender,
|
|
307
307
|
initialWidth: 45,
|
|
308
308
|
suppressMenu: true,
|
|
309
309
|
valueGetter: function valueGetter(_ref4) {
|
|
310
310
|
var node = _ref4.node;
|
|
311
|
-
|
|
311
|
+
|
|
312
|
+
if (node && node.rowIndex !== null) {
|
|
313
|
+
return node.rowIndex + 1;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return null;
|
|
312
317
|
},
|
|
313
|
-
cellClass: prefix('
|
|
318
|
+
cellClass: prefix('center-aligned-cell'),
|
|
319
|
+
headerClass: prefix('center-aligned-header'),
|
|
314
320
|
sortable: false
|
|
315
321
|
},
|
|
316
322
|
delete: {
|
|
317
|
-
colId: '
|
|
323
|
+
colId: '$$delete',
|
|
318
324
|
initialWidth: 30,
|
|
319
325
|
sortable: false,
|
|
320
326
|
suppressMenu: true,
|
|
321
327
|
cellRenderer: CellDeleteRender
|
|
328
|
+
},
|
|
329
|
+
centerAligned: {
|
|
330
|
+
cellClass: prefix('center-aligned-cell'),
|
|
331
|
+
headerClass: prefix('center-aligned-header')
|
|
322
332
|
}
|
|
323
333
|
};
|