@lemon-fe/kits 1.0.0-7 → 1.0.0-9
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.
|
@@ -181,7 +181,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
181
181
|
|
|
182
182
|
_defineProperty(_assertThisInitialized(_this), "getRowId", function (params) {
|
|
183
183
|
var rowKey = _this.props.rowKey;
|
|
184
|
-
|
|
184
|
+
var result = typeof rowKey === 'function' ? rowKey(params.data) : get(params.data, rowKey);
|
|
185
|
+
return String(result !== null && result !== void 0 ? result : '').toString();
|
|
185
186
|
});
|
|
186
187
|
|
|
187
188
|
_defineProperty(_assertThisInitialized(_this), "cellValueChanged", function (evt) {
|
|
@@ -200,7 +201,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
200
201
|
|
|
201
202
|
_this.state = _objectSpread({
|
|
202
203
|
colDefs: _this.getColumDefs(),
|
|
203
|
-
loading:
|
|
204
|
+
loading: props.loading
|
|
204
205
|
}, _this.getPagination());
|
|
205
206
|
_this.store = new Store({
|
|
206
207
|
errors: new Map(),
|
|
@@ -261,7 +262,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
261
262
|
columns = _this$props3.columns,
|
|
262
263
|
rowSelection = _this$props3.rowSelection,
|
|
263
264
|
dataSource = _this$props3.dataSource,
|
|
264
|
-
context = _this$props3.context
|
|
265
|
+
context = _this$props3.context,
|
|
266
|
+
loading = _this$props3.loading;
|
|
265
267
|
|
|
266
268
|
if (columns !== prevProps.columns) {
|
|
267
269
|
this.syncColRender();
|
|
@@ -280,6 +282,12 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
280
282
|
context: context
|
|
281
283
|
});
|
|
282
284
|
}
|
|
285
|
+
|
|
286
|
+
if (loading !== prevProps.loading) {
|
|
287
|
+
this.setState({
|
|
288
|
+
loading: loading
|
|
289
|
+
});
|
|
290
|
+
}
|
|
283
291
|
}
|
|
284
292
|
}, {
|
|
285
293
|
key: "syncColRender",
|
|
@@ -659,8 +667,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
|
|
|
659
667
|
var _this5 = this;
|
|
660
668
|
|
|
661
669
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
662
|
-
this.dataSource = data;
|
|
663
670
|
this.afterReady(function () {
|
|
671
|
+
_this5.dataSource = data;
|
|
672
|
+
|
|
664
673
|
_this5.api.setRowData(data);
|
|
665
674
|
|
|
666
675
|
_this5.api.forEachNode(function (node) {
|
|
@@ -1072,7 +1081,8 @@ _defineProperty(DataGrid, "defaultProps", {
|
|
|
1072
1081
|
collapseAll: '折叠所有'
|
|
1073
1082
|
},
|
|
1074
1083
|
columnTypes: {},
|
|
1075
|
-
defaultColDef: {}
|
|
1084
|
+
defaultColDef: {},
|
|
1085
|
+
loading: false
|
|
1076
1086
|
});
|
|
1077
1087
|
|
|
1078
1088
|
_defineProperty(DataGrid, "EmptyCol", {
|
|
@@ -33,6 +33,7 @@ import Filter from "../Filter";
|
|
|
33
33
|
import DataGrid from "../DataGrid";
|
|
34
34
|
import { PREFIX_CLS } from "../../constants";
|
|
35
35
|
import { DeleteTwoTone } from '@ant-design/icons';
|
|
36
|
+
var defaultRows = [];
|
|
36
37
|
export default function SelectView(props) {
|
|
37
38
|
var emptyValue = useMemo(function () {
|
|
38
39
|
return [];
|
|
@@ -68,11 +69,14 @@ export default function SelectView(props) {
|
|
|
68
69
|
tabFlag = _useState6[0],
|
|
69
70
|
setTabFlag = _useState6[1];
|
|
70
71
|
|
|
71
|
-
var _useState7 = useState(dataSource ||
|
|
72
|
+
var _useState7 = useState(dataSource || defaultRows),
|
|
72
73
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
73
74
|
rows = _useState8[0],
|
|
74
75
|
setRows = _useState8[1];
|
|
75
76
|
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
setRows(dataSource || defaultRows);
|
|
79
|
+
}, [dataSource]);
|
|
76
80
|
useEffect(function () {
|
|
77
81
|
if (list.current !== null) {
|
|
78
82
|
if (dataSource !== undefined && rowFilter !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/kits",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-9",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"test": "umi-test",
|
|
12
12
|
"test:coverage": "umi-test --coverage",
|
|
13
13
|
"prepublishOnly": "npm run build",
|
|
14
|
-
"
|
|
14
|
+
"prerelease": "npm version prerelease --no-git-tag-version && npm publish --tag next"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"es"
|