@lemon-fe/components 1.2.5 → 1.2.7
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/data-grid/cell-editors/text.js +8 -2
- package/es/data-grid/components/custom-panel/field-modal.d.ts +1 -0
- package/es/data-grid/components/custom-panel/field-modal.js +4 -3
- package/es/data-grid/components/custom-panel/index.d.ts +1 -0
- package/es/data-grid/components/custom-panel/index.js +3 -1
- package/es/data-grid/index.d.ts +1 -1
- package/es/data-grid/index.js +8 -6
- package/es/data-grid/index.less +1 -0
- package/es/data-grid/locale/en_US.js +2 -1
- package/es/data-grid/locale/locale.d.ts +1 -0
- package/es/data-grid/locale/zh_CN.js +2 -1
- package/es/data-grid/utils.d.ts +2 -0
- package/es/data-grid/utils.js +5 -1
- package/package.json +2 -2
|
@@ -11,6 +11,12 @@ import { useLocaleReceiver } from "../../locale-receiver";
|
|
|
11
11
|
import { parseLocalTemplate } from "../../locale/locale";
|
|
12
12
|
import { editorPrefixClass, navigateCell } from "./utils";
|
|
13
13
|
import EditorWrapper from "./wrapper";
|
|
14
|
+
function trimInput(val) {
|
|
15
|
+
if (typeof val === 'string') {
|
|
16
|
+
return val.trim();
|
|
17
|
+
}
|
|
18
|
+
return val;
|
|
19
|
+
}
|
|
14
20
|
export default /*#__PURE__*/forwardRef(function TextEditor(props, ref) {
|
|
15
21
|
var disabled = props.disabled,
|
|
16
22
|
maxLength = props.maxLength,
|
|
@@ -27,7 +33,7 @@ export default /*#__PURE__*/forwardRef(function TextEditor(props, ref) {
|
|
|
27
33
|
if (props.charPress) {
|
|
28
34
|
return [props.charPress, false];
|
|
29
35
|
}
|
|
30
|
-
return [props.value, true];
|
|
36
|
+
return [trimInput(props.value), true];
|
|
31
37
|
}, []),
|
|
32
38
|
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
33
39
|
defaultValue = _useMemo2[0],
|
|
@@ -63,7 +69,7 @@ export default /*#__PURE__*/forwardRef(function TextEditor(props, ref) {
|
|
|
63
69
|
return false;
|
|
64
70
|
},
|
|
65
71
|
getValue: function getValue() {
|
|
66
|
-
return value;
|
|
72
|
+
return trimInput(value);
|
|
67
73
|
}
|
|
68
74
|
};
|
|
69
75
|
});
|
|
@@ -24,7 +24,8 @@ export default function FieldModal(props) {
|
|
|
24
24
|
var openProp = props.open,
|
|
25
25
|
_onCancel = props.onCancel,
|
|
26
26
|
nodes = props.nodes,
|
|
27
|
-
onOk = props.onOk
|
|
27
|
+
onOk = props.onOk,
|
|
28
|
+
enableSummary = props.enableSummary;
|
|
28
29
|
var _useState = useState(false),
|
|
29
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
31
|
open = _useState2[0],
|
|
@@ -188,7 +189,7 @@ export default function FieldModal(props) {
|
|
|
188
189
|
style: {
|
|
189
190
|
height: 120
|
|
190
191
|
}
|
|
191
|
-
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
192
|
+
})), enableSummary ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
|
|
192
193
|
label: " ",
|
|
193
194
|
name: "summary",
|
|
194
195
|
valuePropName: "checked"
|
|
@@ -209,7 +210,7 @@ export default function FieldModal(props) {
|
|
|
209
210
|
label: fieldModal.dataSourceSummaryDataText,
|
|
210
211
|
value: 2
|
|
211
212
|
}]
|
|
212
|
-
}))))), /*#__PURE__*/React.createElement("div", {
|
|
213
|
+
}))) : null))), /*#__PURE__*/React.createElement("div", {
|
|
213
214
|
className: prefix('column-panel-modal-gutter')
|
|
214
215
|
}), /*#__PURE__*/React.createElement("div", {
|
|
215
216
|
className: prefix('column-panel-modal-right')
|
|
@@ -24,7 +24,8 @@ import classNames from 'classnames';
|
|
|
24
24
|
export default function CustomColumnPanel(params) {
|
|
25
25
|
var columnApi = params.columnApi,
|
|
26
26
|
api = params.api,
|
|
27
|
-
enableSave = params.enableSave
|
|
27
|
+
enableSave = params.enableSave,
|
|
28
|
+
enableSummary = params.enableSummary;
|
|
28
29
|
var _useState = useState(false),
|
|
29
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
31
|
searching = _useState2[0],
|
|
@@ -359,6 +360,7 @@ export default function CustomColumnPanel(params) {
|
|
|
359
360
|
size: "small"
|
|
360
361
|
}, dataGridLocale.saveText) : null)), /*#__PURE__*/React.createElement(FieldModal, {
|
|
361
362
|
open: field,
|
|
363
|
+
enableSummary: enableSummary,
|
|
362
364
|
nodes: list,
|
|
363
365
|
onCancel: function onCancel() {
|
|
364
366
|
setField(false);
|
package/es/data-grid/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const Editors: {
|
|
|
16
16
|
Text: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
17
17
|
Date: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
18
18
|
Number: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
|
|
19
|
-
Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "
|
|
19
|
+
Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "allowClear" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
|
|
20
20
|
fieldNames?: {
|
|
21
21
|
label: string;
|
|
22
22
|
value: string;
|
package/es/data-grid/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import CellIndexRender from "./renderer/cell-index-renderer";
|
|
|
62
62
|
import CellRenderer from "./renderer/cell-renderer";
|
|
63
63
|
import DetailCellRenderer from "./renderer/detali-cell-renderer";
|
|
64
64
|
import HeaderRenderer from "./renderer/header-renderer";
|
|
65
|
-
import { prefix, getColField, isColumn, withSyncRender, Store, Selection,
|
|
65
|
+
import { prefix, getColField, isColumn, withSyncRender, Store, Selection, getDefaultColumnTypes } from "./utils";
|
|
66
66
|
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
|
67
67
|
import { ModuleRegistry, GridApi, ColumnApi } from '@ag-grid-community/core';
|
|
68
68
|
import { InfiniteRowModelModule } from '@ag-grid-community/infinite-row-model';
|
|
@@ -182,7 +182,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
182
182
|
iconKey: 'columns',
|
|
183
183
|
toolPanel: CustomColumnPanel,
|
|
184
184
|
toolPanelParams: {
|
|
185
|
-
enableSave: !!_this.props.customColumnPanelStorage
|
|
185
|
+
enableSave: !!_this.props.customColumnPanelStorage,
|
|
186
|
+
enableSummary: _this.isClientMode()
|
|
186
187
|
}
|
|
187
188
|
}]
|
|
188
189
|
});
|
|
@@ -382,7 +383,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
382
383
|
*/
|
|
383
384
|
_defineProperty(_assertThisInitialized(_this), "blurTimer", null);
|
|
384
385
|
_defineProperty(_assertThisInitialized(_this), "handleBlur", function () {
|
|
385
|
-
if (_this.props.stopEditingWhenCellsLoseFocus) {
|
|
386
|
+
if (_this.props.stopEditingWhenCellsLoseFocus && _this.blurTimer === null) {
|
|
386
387
|
_this.blurTimer = setTimeout(function () {
|
|
387
388
|
if (_this.isReady) {
|
|
388
389
|
_this.api.clearFocusedCell();
|
|
@@ -394,6 +395,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
394
395
|
_defineProperty(_assertThisInitialized(_this), "handleFocus", function () {
|
|
395
396
|
if (_this.blurTimer !== null) {
|
|
396
397
|
clearTimeout(_this.blurTimer);
|
|
398
|
+
_this.blurTimer = null;
|
|
397
399
|
}
|
|
398
400
|
});
|
|
399
401
|
_defineProperty(_assertThisInitialized(_this), "handleClearSelected", function () {
|
|
@@ -413,7 +415,8 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
413
415
|
return shallowEqual(prev[0], next[0]);
|
|
414
416
|
}));
|
|
415
417
|
_defineProperty(_assertThisInitialized(_this), "getMemoizedColumnTypes", memoizeOne(function (columnTypesProp) {
|
|
416
|
-
|
|
418
|
+
var locale = _this.props.locale;
|
|
419
|
+
return _objectSpread(_objectSpread({}, getDefaultColumnTypes(locale)), columnTypesProp);
|
|
417
420
|
}));
|
|
418
421
|
_defineProperty(_assertThisInitialized(_this), "getMemoizedLocaleText", memoizeOne(function (localeTextProp) {
|
|
419
422
|
return _objectSpread(_objectSpread({}, _this.props.localeText), localeTextProp);
|
|
@@ -824,8 +827,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
|
|
|
824
827
|
}
|
|
825
828
|
var _this$props6 = this.props,
|
|
826
829
|
mColumnTypes = _this$props6.columnTypes,
|
|
827
|
-
mDefaultColDef = _this$props6.defaultColDef
|
|
828
|
-
locale = _this$props6.locale;
|
|
830
|
+
mDefaultColDef = _this$props6.defaultColDef;
|
|
829
831
|
var colTypes = this.getMemoizedColumnTypes(mColumnTypes);
|
|
830
832
|
var result = {};
|
|
831
833
|
var types;
|
package/es/data-grid/index.less
CHANGED
package/es/data-grid/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataGridLocale } from './locale/locale';
|
|
1
2
|
import type { ColType, ColGroupType, PathType } from './typings';
|
|
2
3
|
import type { ColDef, ColGroupDef } from '@ag-grid-community/core';
|
|
3
4
|
import { Subject } from '@lemon-fe/utils';
|
|
@@ -49,3 +50,4 @@ export declare class Selection<T> {
|
|
|
49
50
|
listen(cb: (keys: string[]) => void): () => void;
|
|
50
51
|
}
|
|
51
52
|
export declare const columnTypes: Record<string, ColDef>;
|
|
53
|
+
export declare function getDefaultColumnTypes(locale: DataGridLocale): Record<string, ColDef<any>>;
|
package/es/data-grid/utils.js
CHANGED
|
@@ -290,4 +290,8 @@ export var columnTypes = {
|
|
|
290
290
|
cellClass: prefix('center-aligned-cell'),
|
|
291
291
|
headerClass: prefix('center-aligned-header')
|
|
292
292
|
}
|
|
293
|
-
};
|
|
293
|
+
};
|
|
294
|
+
export function getDefaultColumnTypes(locale) {
|
|
295
|
+
columnTypes.index.headerName = locale.index;
|
|
296
|
+
return columnTypes;
|
|
297
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"registry": "https://registry.npmjs.org"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "86e212d77dedc2a6c5af2f11ecb19b0e3c8704cf"
|
|
71
71
|
}
|