@lemon-fe/kits 1.0.0-164 → 1.0.0-166
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/Date.d.ts +10 -3
- package/es/components/DataGrid/cell-editors/Date.js +12 -3
- package/es/components/DataGrid/index.d.ts +1 -1
- package/es/components/DataGrid/index.js +5 -3
- package/es/components/DataGrid/index.less +16 -0
- package/es/components/DataGrid/typings.d.ts +8 -1
- package/es/components/Filter/index.d.ts +1 -1
- package/es/components/Filter/index.js +4 -1
- package/es/components/Filter/typings.d.ts +1 -1
- package/es/components/Popup/index.js +3 -4
- package/es/components/SelectView/index.d.ts +2 -2
- package/es/components/SelectView/index.js +14 -4
- package/es/components/SelectView/index.less +1 -1
- package/es/styles/overrides.less +2 -2
- package/package.json +1 -1
|
@@ -2,11 +2,18 @@ import type { ICellEditorParams } from '@ag-grid-community/core';
|
|
|
2
2
|
import type { ICellEditorReactComp } from '@ag-grid-community/react';
|
|
3
3
|
import { type Moment } from 'moment';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export interface DateEditorParams {
|
|
6
|
-
format
|
|
5
|
+
export interface DateEditorParams<TData = any> {
|
|
6
|
+
format?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
disabledDate?: (current: Moment) => boolean;
|
|
9
9
|
allowClear?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 可以在不使用disabledDate的情况下,进行数值校验,可以用于错误提示
|
|
12
|
+
* @param newValue
|
|
13
|
+
* @param data
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
isCancelAfterEnd?: (newValue: Moment | null, data: TData) => boolean;
|
|
10
17
|
}
|
|
11
|
-
declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any, any> & DateEditorParams & React.RefAttributes<ICellEditorReactComp>>;
|
|
18
|
+
declare const _default: React.ForwardRefExoticComponent<ICellEditorParams<any, any, any> & DateEditorParams<any> & React.RefAttributes<ICellEditorReactComp>>;
|
|
12
19
|
export default _default;
|
|
@@ -29,7 +29,9 @@ export default /*#__PURE__*/forwardRef(function DateEditor(props, ref) {
|
|
|
29
29
|
api = props.api,
|
|
30
30
|
disabledDate = props.disabledDate,
|
|
31
31
|
_props$allowClear = props.allowClear,
|
|
32
|
-
allowClear = _props$allowClear === void 0 ? false : _props$allowClear
|
|
32
|
+
allowClear = _props$allowClear === void 0 ? false : _props$allowClear,
|
|
33
|
+
_isCancelAfterEnd = props.isCancelAfterEnd,
|
|
34
|
+
node = props.node;
|
|
33
35
|
|
|
34
36
|
var _useState = useState(props.value ? moment(props.value, format) : null),
|
|
35
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -50,12 +52,19 @@ export default /*#__PURE__*/forwardRef(function DateEditor(props, ref) {
|
|
|
50
52
|
|
|
51
53
|
useImperativeHandle(ref, function () {
|
|
52
54
|
return {
|
|
53
|
-
getValue: getValue
|
|
55
|
+
getValue: getValue,
|
|
56
|
+
isCancelAfterEnd: function isCancelAfterEnd() {
|
|
57
|
+
if (_isCancelAfterEnd) {
|
|
58
|
+
return _isCancelAfterEnd(value, node.data);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
54
63
|
};
|
|
55
64
|
});
|
|
56
65
|
return /*#__PURE__*/React.createElement(EditorWrapper, null, /*#__PURE__*/React.createElement(DatePicker, {
|
|
57
66
|
onKeyDown: function onKeyDown(e) {
|
|
58
|
-
if (isEdited) {
|
|
67
|
+
if (isEdited.current) {
|
|
59
68
|
navigateCell(_objectSpread(_objectSpread({}, props), {}, {
|
|
60
69
|
event: e
|
|
61
70
|
}));
|
|
@@ -48,7 +48,7 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
|
|
|
48
48
|
static EmptyCol: ColType<any>;
|
|
49
49
|
static Editors: {
|
|
50
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>>;
|
|
51
|
-
Date: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
51
|
+
Date: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
52
52
|
Number: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
53
53
|
Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "options" | "virtual" | "showSearch" | "listHeight"> & {
|
|
54
54
|
fieldNames?: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["validator"],
|
|
2
2
|
_excluded2 = ["title", "dataIndex", "type", "render", "ellipsis", "cellRenderer", "cellRendererParams", "className", "sorter", "sortable", "editable", "suppressKeyboardEvent"],
|
|
3
3
|
_excluded3 = ["title", "children"],
|
|
4
|
-
_excluded4 = ["rowKey", "fetch", "dataSource", "rowActions", "columns", "autoLoad", "loading", "summary", "detailCell", "pagination", "rowSelection", "columnTypes", "defaultColDef", "components", "sideBar", "detailCellRendererParams", "context", "showSearch"];
|
|
4
|
+
_excluded4 = ["rowKey", "fetch", "dataSource", "rowActions", "columns", "autoLoad", "loading", "summary", "detailCell", "pagination", "rowSelection", "columnTypes", "defaultColDef", "components", "sideBar", "detailCellRendererParams", "context", "showSearch", "cellDisplayFlex"];
|
|
5
5
|
|
|
6
6
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
7
|
|
|
@@ -1315,7 +1315,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1315
1315
|
}, {
|
|
1316
1316
|
key: "render",
|
|
1317
1317
|
value: function render() {
|
|
1318
|
-
var _this10 = this
|
|
1318
|
+
var _this10 = this,
|
|
1319
|
+
_classNames;
|
|
1319
1320
|
|
|
1320
1321
|
var _this$props8 = this.props,
|
|
1321
1322
|
rowKey = _this$props8.rowKey,
|
|
@@ -1336,6 +1337,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1336
1337
|
detailCellRendererParams = _this$props8.detailCellRendererParams,
|
|
1337
1338
|
context = _this$props8.context,
|
|
1338
1339
|
showSearch = _this$props8.showSearch,
|
|
1340
|
+
cellDisplayFlex = _this$props8.cellDisplayFlex,
|
|
1339
1341
|
restProps = _objectWithoutProperties(_this$props8, _excluded4);
|
|
1340
1342
|
|
|
1341
1343
|
var _this$state2 = this.state,
|
|
@@ -1393,7 +1395,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
1393
1395
|
return /*#__PURE__*/React.createElement(GridStoreContext.Provider, {
|
|
1394
1396
|
value: this.store
|
|
1395
1397
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1396
|
-
className: classNames('ag-theme-lemon', "".concat(prefix()),
|
|
1398
|
+
className: classNames('ag-theme-lemon', "".concat(prefix()), (_classNames = {}, _defineProperty(_classNames, prefix('group-rows'), restProps.groupDisplayType === 'groupRows'), _defineProperty(_classNames, prefix('cell-flex'), cellDisplayFlex), _classNames)),
|
|
1397
1399
|
style: restProps.domLayout === 'autoHeight' ? {
|
|
1398
1400
|
height: 'auto'
|
|
1399
1401
|
} : undefined,
|
|
@@ -15,6 +15,21 @@
|
|
|
15
15
|
height: 100%;
|
|
16
16
|
min-height: 0;
|
|
17
17
|
|
|
18
|
+
&-cell-flex {
|
|
19
|
+
.ag-cell {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ag-ltr .ag-right-aligned-cell {
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ag-rtl .ag-right-aligned-cell {
|
|
29
|
+
flex-direction: row-reverse;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
&-column-sorter {
|
|
19
34
|
display: inline-flex;
|
|
20
35
|
flex-direction: column;
|
|
@@ -36,6 +51,7 @@
|
|
|
36
51
|
}
|
|
37
52
|
|
|
38
53
|
&-center-aligned-cell {
|
|
54
|
+
justify-content: center;
|
|
39
55
|
text-align: center;
|
|
40
56
|
}
|
|
41
57
|
|
|
@@ -23,11 +23,14 @@ interface EditorParamsType<T extends string, K extends Record<string, any>> {
|
|
|
23
23
|
params?: K;
|
|
24
24
|
component?: string;
|
|
25
25
|
}
|
|
26
|
-
declare type EditorType<TData> = EditorParamsType<'text-editor', TextEditorParams
|
|
26
|
+
declare type EditorType<TData> = EditorParamsType<'text-editor', TextEditorParams<TData>> | EditorParamsType<'number-editor', NumberEditorParams<TData>> | EditorParamsType<'date-editor', DateEditorParams<TData>> | EditorParamsType<'select-editor', SelectEditorParams> | EditorParamsType<'row-editor', RowEditorParams<TData>>;
|
|
27
27
|
export interface ColType<TData> extends Omit<ColDef<TData>, 'editable'> {
|
|
28
28
|
title?: ReactNode | ((params: IHeaderParams) => ReactNode);
|
|
29
29
|
dataIndex?: string;
|
|
30
30
|
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated
|
|
33
|
+
*/
|
|
31
34
|
sorter?: boolean | ((a: TData, b: TData) => number);
|
|
32
35
|
ellipsis?: boolean;
|
|
33
36
|
/**
|
|
@@ -193,4 +196,8 @@ export interface DataGridProps<TData> extends Omit<AgGridReactProps<TData>, 'row
|
|
|
193
196
|
* @description 显示底部搜索栏,只支持非远程模式
|
|
194
197
|
*/
|
|
195
198
|
showSearch?: boolean | DataGridSearch;
|
|
199
|
+
/**
|
|
200
|
+
* @description 单元格是否表现成弹性盒子,从而便于垂直,此时也会导致文本ellipsis失效
|
|
201
|
+
*/
|
|
202
|
+
cellDisplayFlex?: boolean;
|
|
196
203
|
}
|
|
@@ -7,7 +7,7 @@ declare namespace Filter {
|
|
|
7
7
|
title: string;
|
|
8
8
|
value: Record<string | number, any>;
|
|
9
9
|
}>(getData: (storageKey: string) => T[] | Promise<T[]>, setData: (storageKey: string, data: T[], action: {
|
|
10
|
-
type: "
|
|
10
|
+
type: "delete" | "set";
|
|
11
11
|
target: T;
|
|
12
12
|
}) => void | Promise<void>) => void;
|
|
13
13
|
var defaultProps: Partial<FilterProps<Record<string, any>>>;
|
|
@@ -109,8 +109,11 @@ function setStorage(getData, setData) {
|
|
|
109
109
|
setStorageData = setData;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
var defaultData = [];
|
|
113
|
+
|
|
112
114
|
function Filter(props) {
|
|
113
|
-
var data = props.data,
|
|
115
|
+
var _props$data = props.data,
|
|
116
|
+
data = _props$data === void 0 ? defaultData : _props$data,
|
|
114
117
|
defaultValueProp = props.defaultValue,
|
|
115
118
|
onChange = props.onChange,
|
|
116
119
|
value = props.value,
|
|
@@ -25,7 +25,7 @@ export interface FilterItemType<T = any> {
|
|
|
25
25
|
export type ActionType = 'submit' | 'reset';
|
|
26
26
|
|
|
27
27
|
export interface FilterProps<T extends Record<string, any> = Record<string, any>> {
|
|
28
|
-
data
|
|
28
|
+
data?: FilterItemType<T>[];
|
|
29
29
|
defaultValue?: T;
|
|
30
30
|
value?: T;
|
|
31
31
|
/**
|
|
@@ -213,16 +213,15 @@ function Popup(props) {
|
|
|
213
213
|
destroyOnClose: true,
|
|
214
214
|
open: shouldModalOpen,
|
|
215
215
|
width: 1000,
|
|
216
|
+
bodyStyle: {
|
|
217
|
+
height: 500
|
|
218
|
+
},
|
|
216
219
|
centered: true,
|
|
217
220
|
onCancel: handleCancel,
|
|
218
221
|
afterClose: handleAfterClose,
|
|
219
222
|
onOk: function onOk() {
|
|
220
223
|
return handleOk();
|
|
221
224
|
},
|
|
222
|
-
bodyStyle: {
|
|
223
|
-
height: 550,
|
|
224
|
-
padding: 0
|
|
225
|
-
},
|
|
226
225
|
footer: renderFooter ? renderFooter({
|
|
227
226
|
onCancel: handleCancel,
|
|
228
227
|
onOk: function onOk() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties, ReactElement } from 'react';
|
|
2
|
-
import type { ColType, PaginationType, SortType } from '../DataGrid/typings';
|
|
2
|
+
import type { ColType, DataGridProps, PaginationType, SortType } from '../DataGrid/typings';
|
|
3
3
|
import type { FilterProps } from '../Filter/typings';
|
|
4
|
-
interface Props<RecordType, ParamsType extends Record<string, any>> {
|
|
4
|
+
interface Props<RecordType, ParamsType extends Record<string, any>> extends Pick<DataGridProps<RecordType>, 'defaultColDef' | 'rowHeight' | 'cellDisplayFlex' | 'isRowSelectable'> {
|
|
5
5
|
value?: RecordType[];
|
|
6
6
|
onChange?: (value: RecordType[], rowDoubleClicked?: boolean) => void;
|
|
7
7
|
/**
|
|
@@ -26,7 +26,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
26
26
|
|
|
27
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
28
|
|
|
29
|
-
import { Tabs
|
|
29
|
+
import { Tabs } from 'antd';
|
|
30
30
|
import { get } from 'lodash';
|
|
31
31
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
32
32
|
import DataGrid from "../DataGrid";
|
|
@@ -51,7 +51,11 @@ export default function SelectView(props) {
|
|
|
51
51
|
dataSource = props.dataSource,
|
|
52
52
|
rowFilter = props.rowFilter,
|
|
53
53
|
loading = props.loading,
|
|
54
|
-
readOnly = props.readOnly
|
|
54
|
+
readOnly = props.readOnly,
|
|
55
|
+
defaultColDef = props.defaultColDef,
|
|
56
|
+
rowHeight = props.rowHeight,
|
|
57
|
+
cellDisplayFlex = props.cellDisplayFlex,
|
|
58
|
+
isRowSelectable = props.isRowSelectable;
|
|
55
59
|
var prefixCls = "".concat(PREFIX_CLS, "-select-view");
|
|
56
60
|
|
|
57
61
|
var _useState = useState(value || emptyValue),
|
|
@@ -216,6 +220,10 @@ export default function SelectView(props) {
|
|
|
216
220
|
handleChangeData([node.id], [node.data], true);
|
|
217
221
|
}
|
|
218
222
|
},
|
|
223
|
+
rowHeight: rowHeight,
|
|
224
|
+
defaultColDef: defaultColDef,
|
|
225
|
+
cellDisplayFlex: cellDisplayFlex,
|
|
226
|
+
isRowSelectable: isRowSelectable,
|
|
219
227
|
dataSource: rows,
|
|
220
228
|
columns: columns,
|
|
221
229
|
loading: loading,
|
|
@@ -233,6 +241,9 @@ export default function SelectView(props) {
|
|
|
233
241
|
className: "".concat(prefixCls, "-body")
|
|
234
242
|
}, /*#__PURE__*/React.createElement(DataGrid, {
|
|
235
243
|
dataSource: data,
|
|
244
|
+
defaultColDef: defaultColDef,
|
|
245
|
+
rowHeight: rowHeight,
|
|
246
|
+
cellDisplayFlex: cellDisplayFlex,
|
|
236
247
|
onDataSourceChange: setData,
|
|
237
248
|
columns: mSelectedCols,
|
|
238
249
|
rowKey: rowKey,
|
|
@@ -262,8 +273,7 @@ export default function SelectView(props) {
|
|
|
262
273
|
tabBarGutter: 20,
|
|
263
274
|
onChange: setTabFlag,
|
|
264
275
|
tabBarExtraContent: {
|
|
265
|
-
right: tabFlag === 'selected' && !readOnly ? /*#__PURE__*/React.createElement(
|
|
266
|
-
type: "link",
|
|
276
|
+
right: tabFlag === 'selected' && !readOnly ? /*#__PURE__*/React.createElement("a", {
|
|
267
277
|
onClick: handleClear
|
|
268
278
|
}, "\u6E05\u7A7A") : null
|
|
269
279
|
}
|
package/es/styles/overrides.less
CHANGED
|
@@ -168,7 +168,7 @@ a[title='站长统计'] {
|
|
|
168
168
|
@input-padding-vertical-base: (
|
|
169
169
|
round(((@input-height-base - @font-size-base * @line-height-base) / 2) * 10) / 10
|
|
170
170
|
) - @border-width-base;
|
|
171
|
-
@input-disabled-color: fade(#333,
|
|
171
|
+
@input-disabled-color: fade(#333, 50);
|
|
172
172
|
@input-disabled-bg: #fff;
|
|
173
173
|
|
|
174
174
|
.@{ant-prefix}-input-prefix,
|
|
@@ -189,7 +189,7 @@ a[title='站长统计'] {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
&&-disabled &-suffix {
|
|
192
|
-
color: fade(#333,
|
|
192
|
+
color: fade(#333, 40);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|