@nokecy/qc-ui 0.1.34 → 0.1.35

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.
@@ -33,7 +33,7 @@ var _utils = require("./utils");
33
33
 
34
34
  var _setting = _interopRequireDefault(require("./setting"));
35
35
 
36
- var _excluded = ["style", "params", "request", "dataSource", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "gridColumnState", "children"];
36
+ var _excluded = ["style", "loading", "params", "request", "dataSource", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "gridColumnState", "children"];
37
37
 
38
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
39
 
@@ -71,6 +71,7 @@ var getSort = function getSort(columnState) {
71
71
 
72
72
  function AgGridPlus(props) {
73
73
  var style = props.style,
74
+ loadingProps = props.loading,
74
75
  gridParams = props.params,
75
76
  request = props.request,
76
77
  dataSource = props.dataSource,
@@ -96,7 +97,7 @@ function AgGridPlus(props) {
96
97
  ready = _useState2[0],
97
98
  setReady = _useState2[1];
98
99
 
99
- var _useState3 = (0, _react.useState)(false),
100
+ var _useState3 = (0, _react.useState)(loadingProps ? loadingProps : false),
100
101
  _useState4 = _slicedToArray(_useState3, 2),
101
102
  loading = _useState4[0],
102
103
  setLoading = _useState4[1];
@@ -167,7 +168,11 @@ function AgGridPlus(props) {
167
168
  }, [gridColumnState, columnsRef.current]);
168
169
  (0, _react.useEffect)(function () {
169
170
  setRowData(dataSource || propRowData || []);
170
- }, [dataSource, propRowData]);
171
+ }, [dataSource, propRowData]); //外部loading
172
+
173
+ (0, _react.useEffect)(function () {
174
+ loadingProps !== undefined && setLoading(loadingProps);
175
+ }, [loadingProps]);
171
176
  var onGridReady = (0, _react.useCallback)(function (params) {
172
177
  var _columnsRef$current;
173
178
 
@@ -9,6 +9,7 @@ interface GridProps extends AgGridReactProps {
9
9
  style?: CSSProperties;
10
10
  params?: any;
11
11
  initParams?: any;
12
+ loading?: boolean;
12
13
  request?: (params: any, sort: any, filter: any) => Promise<any>;
13
14
  dataSource?: any[];
14
15
  treeParentName?: string;
@@ -1,4 +1,4 @@
1
- var _excluded = ["style", "params", "request", "dataSource", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "gridColumnState", "children"];
1
+ var _excluded = ["style", "loading", "params", "request", "dataSource", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "gridColumnState", "children"];
2
2
 
3
3
  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); }
4
4
 
@@ -44,6 +44,7 @@ var getSort = function getSort(columnState) {
44
44
 
45
45
  function AgGridPlus(props) {
46
46
  var style = props.style,
47
+ loadingProps = props.loading,
47
48
  gridParams = props.params,
48
49
  request = props.request,
49
50
  dataSource = props.dataSource,
@@ -69,7 +70,7 @@ function AgGridPlus(props) {
69
70
  ready = _useState2[0],
70
71
  setReady = _useState2[1];
71
72
 
72
- var _useState3 = useState(false),
73
+ var _useState3 = useState(loadingProps ? loadingProps : false),
73
74
  _useState4 = _slicedToArray(_useState3, 2),
74
75
  loading = _useState4[0],
75
76
  setLoading = _useState4[1];
@@ -140,7 +141,11 @@ function AgGridPlus(props) {
140
141
  }, [gridColumnState, columnsRef.current]);
141
142
  useEffect(function () {
142
143
  setRowData(dataSource || propRowData || []);
143
- }, [dataSource, propRowData]);
144
+ }, [dataSource, propRowData]); //外部loading
145
+
146
+ useEffect(function () {
147
+ loadingProps !== undefined && setLoading(loadingProps);
148
+ }, [loadingProps]);
144
149
  var onGridReady = useCallback(function (params) {
145
150
  var _columnsRef$current;
146
151
 
@@ -9,6 +9,7 @@ interface GridProps extends AgGridReactProps {
9
9
  style?: CSSProperties;
10
10
  params?: any;
11
11
  initParams?: any;
12
+ loading?: boolean;
12
13
  request?: (params: any, sort: any, filter: any) => Promise<any>;
13
14
  dataSource?: any[];
14
15
  treeParentName?: string;