@lemon-fe/kits 1.0.0-22 → 1.0.0-24
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/cell-editors/Combination.d.ts +8 -0
- package/es/components/DataGrid/cell-editors/Combination.js +25 -0
- package/es/components/DataGrid/cell-editors/Custom.d.ts +10 -5
- package/es/components/DataGrid/cell-editors/Custom.js +65 -10
- package/es/components/DataGrid/cell-editors/Select.d.ts +5 -2
- package/es/components/DataGrid/index.js +36 -28
- package/es/components/DataGrid/index.less +4 -12
- package/es/components/DataGrid/typings.d.ts +39 -12
- package/es/init.js +16 -2
- package/es/styles/empty.png +0 -0
- package/package.json +1 -1
- package/es/components/DataGrid/empty.png +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ICellEditorReactComp } from '@ag-grid-community/react';
|
|
2
|
+
import type { ICellEditorParams } from '@ag-grid-community/core';
|
|
3
|
+
import { type ForwardedRef, type ReactElement } from 'react';
|
|
4
|
+
export interface CombinationEditorParams<T = any> {
|
|
5
|
+
render: (props: ICellEditorParams<T>, ref: ForwardedRef<ICellEditorReactComp>) => ReactElement | null;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("react").ForwardRefExoticComponent<ICellEditorParams<any, any> & CombinationEditorParams<any> & import("react").RefAttributes<ICellEditorReactComp>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var _excluded = ["render"];
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
import { forwardRef } from 'react';
|
|
14
|
+
import { useGridStore } from "../hooks";
|
|
15
|
+
export default /*#__PURE__*/forwardRef(function CombinationEditor(props, ref) {
|
|
16
|
+
var render = props.render,
|
|
17
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
18
|
+
|
|
19
|
+
var context = useGridStore(function (state) {
|
|
20
|
+
return state.context;
|
|
21
|
+
});
|
|
22
|
+
return render(_objectSpread(_objectSpread({}, restProps), {}, {
|
|
23
|
+
context: context
|
|
24
|
+
}), ref);
|
|
25
|
+
});
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { MutableRefObject, ReactElement } from 'react';
|
|
2
2
|
import type { ICellEditorReactComp } from '@ag-grid-community/react';
|
|
3
3
|
import type { ICellEditorParams } from '@ag-grid-community/core';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export interface CustomEditorParams<T = any, K = any> {
|
|
5
|
+
render: (val: K, data: T, params: ICellEditorParams<T, K> & {
|
|
6
|
+
ref: MutableRefObject<{
|
|
7
|
+
select?: () => void;
|
|
8
|
+
focus?: () => void;
|
|
9
|
+
} | null>;
|
|
10
|
+
onChange: (val: Partial<T>, action?: 'stop' | 'next') => void;
|
|
11
|
+
}) => ReactElement | null;
|
|
7
12
|
}
|
|
8
|
-
declare const _default:
|
|
13
|
+
declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any> & CustomEditorParams<any, any> & React.RefAttributes<ICellEditorReactComp>>;
|
|
9
14
|
export default _default;
|
|
@@ -1,25 +1,80 @@
|
|
|
1
|
-
var _excluded = ["render"];
|
|
2
|
-
|
|
3
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
2
|
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
4
|
|
|
7
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
6
|
|
|
9
|
-
function
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
12
|
|
|
11
|
-
function
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
import React, { useEffect, useRef } from 'react';
|
|
20
|
+
import { get } from 'lodash';
|
|
21
|
+
import { forwardRef, useImperativeHandle, useState } from 'react';
|
|
22
|
+
import EditorWrapper from "./Wrapper";
|
|
14
23
|
import { useGridStore } from "../hooks";
|
|
15
24
|
export default /*#__PURE__*/forwardRef(function CustomEditor(props, ref) {
|
|
16
|
-
var
|
|
17
|
-
|
|
25
|
+
var api = props.api,
|
|
26
|
+
cellStartedEdit = props.cellStartedEdit,
|
|
27
|
+
stopEditing = props.stopEditing,
|
|
28
|
+
data = props.data,
|
|
29
|
+
render = props.render,
|
|
30
|
+
field = props.colDef.field;
|
|
31
|
+
|
|
32
|
+
var _useState = useState(data),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
value = _useState2[0],
|
|
35
|
+
setValue = _useState2[1];
|
|
18
36
|
|
|
19
37
|
var context = useGridStore(function (state) {
|
|
20
38
|
return state.context;
|
|
21
39
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
var elm = useRef(null);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if (cellStartedEdit && elm.current !== null) {
|
|
43
|
+
if (elm.current.select !== undefined) {
|
|
44
|
+
elm.current.select();
|
|
45
|
+
} else if (elm.current.focus !== undefined) {
|
|
46
|
+
elm.current.focus();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [cellStartedEdit]);
|
|
50
|
+
useImperativeHandle(ref, function () {
|
|
51
|
+
return {
|
|
52
|
+
getValue: function getValue() {
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
var handleChange = function handleChange(val, action) {
|
|
59
|
+
setValue(val);
|
|
60
|
+
|
|
61
|
+
if (action !== undefined) {
|
|
62
|
+
requestAnimationFrame(function () {
|
|
63
|
+
switch (action) {
|
|
64
|
+
case 'stop':
|
|
65
|
+
stopEditing();
|
|
66
|
+
break;
|
|
67
|
+
|
|
68
|
+
case 'next':
|
|
69
|
+
api.tabToNextCell();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return /*#__PURE__*/React.createElement(EditorWrapper, null, render(field ? get(value, field) : null, data, _objectSpread(_objectSpread({}, props), {}, {
|
|
76
|
+
context: context,
|
|
77
|
+
ref: elm,
|
|
78
|
+
onChange: handleChange
|
|
79
|
+
})));
|
|
25
80
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import type { ICellEditorReactComp } from '@ag-grid-community/react';
|
|
3
3
|
import type { ICellEditorParams } from '@ag-grid-community/core';
|
|
4
4
|
import type { SelectProps } from 'antd/lib/select';
|
|
5
|
-
export declare type SelectEditorParams = Pick<SelectProps,
|
|
5
|
+
export declare type SelectEditorParams = Pick<SelectProps<any, {
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
value?: string | number | null | boolean;
|
|
8
|
+
}>, 'disabled' | 'options' | 'fieldNames' | 'virtual' | 'showSearch' | 'listHeight' | 'listItemHeight' | 'allowClear' | 'mode' | 'labelInValue'>;
|
|
6
9
|
declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any> & SelectEditorParams & React.RefAttributes<ICellEditorReactComp>>;
|
|
7
10
|
export default _default;
|
|
@@ -70,7 +70,7 @@ import { ColumnsToolPanelModule } from "./modules/column-tool-panel";
|
|
|
70
70
|
import { SideBarModule } from "./modules/side-bar";
|
|
71
71
|
import { ServerSideRowModelModule } from "./modules/server-side-row-model";
|
|
72
72
|
import { ClientSideRowModelModule } from "./modules/client-side-row-model";
|
|
73
|
-
import { Spin, Pagination } from 'antd';
|
|
73
|
+
import { Spin, Pagination, Empty } from 'antd';
|
|
74
74
|
import { prefix, getColField, isColumnType, withSyncRender, ColMethod, Store, Selection, columnTypes } from "./utils";
|
|
75
75
|
import HeaderRenderer from "./HeaderRenderer";
|
|
76
76
|
import CellRenderer from "./CellRenderer";
|
|
@@ -81,7 +81,7 @@ import NumberEditor from "./cell-editors/Number";
|
|
|
81
81
|
import SelectEditor from "./cell-editors/Select";
|
|
82
82
|
import Custom from "./cell-editors/Custom";
|
|
83
83
|
import EditorWrapper from "./cell-editors/Wrapper";
|
|
84
|
-
import
|
|
84
|
+
import Combination from "./cell-editors/Combination";
|
|
85
85
|
export { AgGridReact } from '@ag-grid-community/react';
|
|
86
86
|
ModuleRegistry.registerModules([ClientSideRowModelModule, RowGroupingModule, InfiniteRowModelModule, ClipboardModule, MenuModule, SideBarModule, ColumnsToolPanelModule, ServerSideRowModelModule], false);
|
|
87
87
|
var defaultColDef = {
|
|
@@ -367,17 +367,27 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
367
367
|
var id = getColField(item);
|
|
368
368
|
|
|
369
369
|
if (id !== undefined) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
370
|
+
var path = id.split('.');
|
|
371
|
+
var node = {};
|
|
372
|
+
|
|
373
|
+
for (var i = path.length - 1; i >= 0; i -= 1) {
|
|
374
|
+
node = _defineProperty({}, path[i], i === path.length - 1 ? rules.map(function (rule) {
|
|
375
|
+
var validator = rule.validator,
|
|
376
|
+
restRule = _objectWithoutProperties(rule, _excluded);
|
|
377
|
+
|
|
378
|
+
return _objectSpread(_objectSpread({}, restRule), {}, {
|
|
379
|
+
asyncValidator: validator ? function (mRule, value, _, record) {
|
|
380
|
+
return validator(mRule, value, record);
|
|
381
|
+
} : undefined,
|
|
382
|
+
validator: undefined
|
|
383
|
+
});
|
|
384
|
+
}) : {
|
|
385
|
+
type: 'object',
|
|
386
|
+
fields: node
|
|
379
387
|
});
|
|
380
|
-
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
Object.assign(descriptor, node);
|
|
381
391
|
}
|
|
382
392
|
}
|
|
383
393
|
|
|
@@ -533,9 +543,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
533
543
|
if (_typeof(editable) === 'object') {
|
|
534
544
|
var _type = editable.type,
|
|
535
545
|
params = editable.params,
|
|
536
|
-
_render = editable.render,
|
|
537
546
|
valueSetter = editable.valueSetter;
|
|
538
547
|
_opts.editable = true;
|
|
548
|
+
_opts.cellEditorParams = params;
|
|
539
549
|
_opts.cellClassRules = _defineProperty({}, prefix('editor-cell'), function () {
|
|
540
550
|
return true;
|
|
541
551
|
});
|
|
@@ -563,17 +573,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
563
573
|
switch (_type) {
|
|
564
574
|
case 'text':
|
|
565
575
|
_opts.cellEditor = TextEditor;
|
|
566
|
-
_opts.cellEditorParams = params;
|
|
567
576
|
break;
|
|
568
577
|
|
|
569
578
|
case 'number':
|
|
570
579
|
_opts.cellEditor = NumberEditor;
|
|
571
|
-
_opts.cellEditorParams = params;
|
|
572
580
|
break;
|
|
573
581
|
|
|
574
582
|
case 'date':
|
|
575
583
|
_opts.cellEditor = DateEditor;
|
|
576
|
-
_opts.cellEditorParams = params;
|
|
577
584
|
|
|
578
585
|
_opts.suppressKeyboardEvent = function (_ref2) {
|
|
579
586
|
var editing = _ref2.editing,
|
|
@@ -590,7 +597,6 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
590
597
|
|
|
591
598
|
case 'select':
|
|
592
599
|
_opts.cellEditor = SelectEditor;
|
|
593
|
-
_opts.cellEditorParams = params;
|
|
594
600
|
|
|
595
601
|
_opts.suppressKeyboardEvent = function (_ref3) {
|
|
596
602
|
var editing = _ref3.editing,
|
|
@@ -605,13 +611,19 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
605
611
|
|
|
606
612
|
break;
|
|
607
613
|
|
|
614
|
+
case 'combination':
|
|
615
|
+
_opts.cellEditor = Combination;
|
|
616
|
+
break;
|
|
617
|
+
|
|
608
618
|
case 'custom':
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
619
|
+
_opts.cellEditor = Custom;
|
|
620
|
+
|
|
621
|
+
_opts.valueSetter = function (mParams) {
|
|
622
|
+
Object.assign(mParams.data, mParams.newValue);
|
|
623
|
+
return true;
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
break;
|
|
615
627
|
|
|
616
628
|
default:
|
|
617
629
|
}
|
|
@@ -853,11 +865,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
853
865
|
}, {
|
|
854
866
|
key: "NoRowsOverlay",
|
|
855
867
|
value: function NoRowsOverlay() {
|
|
856
|
-
return /*#__PURE__*/React.createElement(
|
|
857
|
-
className: prefix('empty')
|
|
858
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
859
|
-
src: empty
|
|
860
|
-
}), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"));
|
|
868
|
+
return /*#__PURE__*/React.createElement(Empty, null);
|
|
861
869
|
}
|
|
862
870
|
}, {
|
|
863
871
|
key: "getMainMenuItems",
|
|
@@ -190,18 +190,6 @@
|
|
|
190
190
|
transform: rotate(135deg);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
&-empty {
|
|
194
|
-
display: inline-block;
|
|
195
|
-
text-align: center;
|
|
196
|
-
color: rgba(51, 51, 51, 0.533);
|
|
197
|
-
|
|
198
|
-
& > img {
|
|
199
|
-
width: 120px;
|
|
200
|
-
height: 120px;
|
|
201
|
-
vertical-align: top;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
193
|
&-spin {
|
|
206
194
|
position: absolute;
|
|
207
195
|
top: 0;
|
|
@@ -360,4 +348,8 @@
|
|
|
360
348
|
color: var(--ag-foreground-color);
|
|
361
349
|
opacity: 0.75;
|
|
362
350
|
}
|
|
351
|
+
|
|
352
|
+
.ag-overlay-no-rows-wrapper .@{ant-prefix}-empty-description {
|
|
353
|
+
color: rgba(51, 51, 51, 0.533);
|
|
354
|
+
}
|
|
363
355
|
}
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
import type { AgGridReactProps
|
|
2
|
-
import type { ColDef, ColGroupDef,
|
|
1
|
+
import type { AgGridReactProps } from '@ag-grid-community/react';
|
|
2
|
+
import type { ColDef, ColGroupDef, ICellRendererParams, IHeaderParams } from '@ag-grid-community/core';
|
|
3
3
|
import type { RuleItem } from 'async-validator/dist-types/interface';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
5
5
|
export type { ColDef, ColGroupDef, ColumnState, GridApi, ICellEditorParams, ICellRendererParams, } from '@ag-grid-community/core';
|
|
6
|
+
export type { AgGridReactProps, ICellEditorReactComp } from '@ag-grid-community/react';
|
|
7
|
+
import type { TextEditorParams } from './cell-editors/Text';
|
|
8
|
+
import type { NumberEditorParams } from './cell-editors/Number';
|
|
9
|
+
import type { DateEditorParams } from './cell-editors/Date';
|
|
10
|
+
import type { SelectEditorParams } from './cell-editors/Select';
|
|
11
|
+
import type { CustomEditorParams } from './cell-editors/Custom';
|
|
12
|
+
import type { CombinationEditorParams } from './cell-editors/Combination';
|
|
6
13
|
export type { TextEditorParams } from './cell-editors/Text';
|
|
7
14
|
export type { NumberEditorParams } from './cell-editors/Number';
|
|
8
15
|
export type { DateEditorParams } from './cell-editors/Date';
|
|
9
16
|
export type { SelectEditorParams } from './cell-editors/Select';
|
|
17
|
+
export type { CombinationEditorParams } from './cell-editors/Combination';
|
|
18
|
+
export type { CustomEditorParams } from './cell-editors/Custom';
|
|
10
19
|
export declare type GetRowKey<T> = string | ((data: T) => string);
|
|
11
20
|
export declare type PathType = string | (string | number)[];
|
|
12
21
|
export declare type ValidateRule<T> = Pick<RuleItem, 'required' | 'message' | 'pattern' | 'min' | 'max' | 'len' | 'type'> & {
|
|
13
22
|
validator?: (rule: any, val: any, record: T) => void | Promise<void>;
|
|
14
23
|
};
|
|
15
|
-
export declare type
|
|
24
|
+
export declare type EditableParams<T extends {
|
|
25
|
+
type: string;
|
|
26
|
+
params?: any;
|
|
27
|
+
}, K> = T & {
|
|
28
|
+
rules?: ValidateRule<K>[];
|
|
29
|
+
valueSetter?: (val: any, data: K) => Partial<K>;
|
|
30
|
+
};
|
|
16
31
|
export interface ColumnType<TData> extends Omit<ColDef<TData>, 'editable'> {
|
|
17
32
|
title?: ReactNode | ((params: IHeaderParams) => ReactNode);
|
|
18
33
|
dataIndex?: PathType;
|
|
@@ -25,19 +40,31 @@ export interface ColumnType<TData> extends Omit<ColDef<TData>, 'editable'> {
|
|
|
25
40
|
/**
|
|
26
41
|
* @description
|
|
27
42
|
* @en cell renderer. it should be a pure function, do not use the state from the closure but from cellContext
|
|
28
|
-
* @zh 单元格渲染函数.
|
|
43
|
+
* @zh 单元格渲染函数. 需要是一个纯函数,不使用外部组件的状态变量,而是通过context引入
|
|
29
44
|
*/
|
|
30
45
|
render?: (val: any, record: TData, index: number, params: ICellRendererParams) => ReactElement | string | number | null;
|
|
31
46
|
/**
|
|
32
47
|
* @description 可编辑单元格
|
|
33
48
|
*/
|
|
34
|
-
editable?: boolean | {
|
|
35
|
-
type
|
|
36
|
-
params?:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
49
|
+
editable?: boolean | EditableParams<{
|
|
50
|
+
type: 'text';
|
|
51
|
+
params?: TextEditorParams;
|
|
52
|
+
}, TData> | EditableParams<{
|
|
53
|
+
type: 'number';
|
|
54
|
+
params?: NumberEditorParams;
|
|
55
|
+
}, TData> | EditableParams<{
|
|
56
|
+
type: 'date';
|
|
57
|
+
params?: DateEditorParams;
|
|
58
|
+
}, TData> | EditableParams<{
|
|
59
|
+
type: 'select';
|
|
60
|
+
params?: SelectEditorParams;
|
|
61
|
+
}, TData> | EditableParams<{
|
|
62
|
+
type: 'combination';
|
|
63
|
+
params?: CombinationEditorParams<TData>;
|
|
64
|
+
}, TData> | EditableParams<{
|
|
65
|
+
type: 'custom';
|
|
66
|
+
params?: CustomEditorParams<TData>;
|
|
67
|
+
}, TData>;
|
|
41
68
|
}
|
|
42
69
|
export interface ColumnGroupType<T> extends Omit<ColGroupDef<T>, 'children'> {
|
|
43
70
|
title?: string | number;
|
package/es/init.js
CHANGED
|
@@ -7,10 +7,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { message, Modal, Select, ConfigProvider, Result, Button, version, DatePicker, Cascader, TreeSelect } from 'antd';
|
|
10
|
+
import { message, Modal, Select, ConfigProvider, Result, Button, version, DatePicker, Cascader, TreeSelect, Empty } from 'antd';
|
|
11
11
|
import { config } from '@lemon-fe/hooks';
|
|
12
12
|
import PageLoading from "./components/PageLoading";
|
|
13
13
|
import Icons from "./components/Icons";
|
|
14
|
+
import empty from "./styles/empty.png";
|
|
14
15
|
var Tip = Icons.Tip,
|
|
15
16
|
Down = Icons.Down,
|
|
16
17
|
BigTip = Icons.BigTip,
|
|
@@ -95,15 +96,28 @@ export default function init() {
|
|
|
95
96
|
marginRight: -1,
|
|
96
97
|
pointerEvents: 'none'
|
|
97
98
|
}
|
|
98
|
-
});
|
|
99
|
+
});
|
|
100
|
+
Empty.defaultProps = {
|
|
101
|
+
image: empty
|
|
102
|
+
}; //@ts-ignore
|
|
99
103
|
|
|
100
104
|
Select.defaultProps = {
|
|
105
|
+
notFoundContent: /*#__PURE__*/React.createElement(Empty, {
|
|
106
|
+
imageStyle: {
|
|
107
|
+
height: 60
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
101
110
|
suffixIcon: version >= '4.18.9' ? node : function () {
|
|
102
111
|
return node;
|
|
103
112
|
}
|
|
104
113
|
}; //@ts-ignore
|
|
105
114
|
|
|
106
115
|
TreeSelect.defaultProps = {
|
|
116
|
+
notFoundContent: /*#__PURE__*/React.createElement(Empty, {
|
|
117
|
+
imageStyle: {
|
|
118
|
+
height: 60
|
|
119
|
+
}
|
|
120
|
+
}),
|
|
107
121
|
suffixIcon: version >= '4.18.9' ? node : function () {
|
|
108
122
|
return node;
|
|
109
123
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|