@nokecy/qc-ui 0.1.10 → 0.1.12
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/dist/cjs/ag-grid-plus/ag-gridPlus.js +3 -2
- package/dist/cjs/ag-grid-plus/interface.d.ts +1 -0
- package/dist/cjs/ag-grid-plus/utils.d.ts +2 -2
- package/dist/cjs/ag-grid-plus/utils.js +6 -4
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +6 -0
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +3 -2
- package/dist/esm/ag-grid-plus/interface.d.ts +1 -0
- package/dist/esm/ag-grid-plus/utils.d.ts +2 -2
- package/dist/esm/ag-grid-plus/utils.js +6 -4
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +3 -2
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -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", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideRedo", "onGridReady", "gridKey", "gridColumnState", "children"];
|
|
36
|
+
var _excluded = ["style", "params", "request", "dataSource", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideRedo", "onGridReady", "gridKey", "gridColumnState", "children"];
|
|
37
37
|
|
|
38
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
39
|
|
|
@@ -74,6 +74,7 @@ function AgGridPlus(props) {
|
|
|
74
74
|
gridParams = props.params,
|
|
75
75
|
request = props.request,
|
|
76
76
|
dataSource = props.dataSource,
|
|
77
|
+
treeParentName = props.treeParentName,
|
|
77
78
|
propRowData = props.rowData,
|
|
78
79
|
propsGridRef = props.gridRef,
|
|
79
80
|
headerTitle = props.headerTitle,
|
|
@@ -282,7 +283,7 @@ function AgGridPlus(props) {
|
|
|
282
283
|
}, rest, {
|
|
283
284
|
//指定客户端模式
|
|
284
285
|
rowModelType: "clientSide",
|
|
285
|
-
rowData: props.treeData ? (0, _utils.flatten)((0, _utils.toTree)(rowData)) : rowData,
|
|
286
|
+
rowData: props.treeData ? (0, _utils.flatten)((0, _utils.toTree)(rowData), treeParentName) : rowData,
|
|
286
287
|
onGridReady: onGridReady,
|
|
287
288
|
defaultColDef: defaultColDef,
|
|
288
289
|
onSortChanged: function onSortChanged(event) {
|
|
@@ -11,6 +11,7 @@ interface GridProps extends AgGridReactProps {
|
|
|
11
11
|
initParams?: any;
|
|
12
12
|
request?: (params: any, sort: any, filter: any) => Promise<any>;
|
|
13
13
|
dataSource?: any[];
|
|
14
|
+
treeParentName?: string;
|
|
14
15
|
search?: boolean;
|
|
15
16
|
headerTitle?: React.ReactNode;
|
|
16
17
|
toolBarRender?: (gridApi?: GridApi, filter?: string, queryFilter?: any) => React.ReactNode[];
|
|
@@ -3,7 +3,7 @@ declare const convertFilterModel: (filterModel: any) => string;
|
|
|
3
3
|
declare const convertSortModel: (sortModel: any[]) => string;
|
|
4
4
|
declare const dateValueFormatter: (params: ValueFormatterParams) => string;
|
|
5
5
|
declare const dateTimeValueFormatter: (params: ValueFormatterParams) => string;
|
|
6
|
-
declare const flatten: (arr: any[], parentref?: any[]) => any;
|
|
6
|
+
declare const flatten: (arr: any[], parentPropName: any, parentref?: any[]) => any;
|
|
7
7
|
declare const toTree: (data: any[]) => any[];
|
|
8
|
-
declare const flattenTreeDeep: (treeData: any[]) => any[];
|
|
8
|
+
declare const flattenTreeDeep: (treeData: any[], childrenName?: string) => any[];
|
|
9
9
|
export { dateValueFormatter, dateTimeValueFormatter, convertFilterModel, convertSortModel, flattenTreeDeep, toTree, flatten };
|
|
@@ -111,11 +111,11 @@ var dateTimeValueFormatter = function dateTimeValueFormatter(params) {
|
|
|
111
111
|
|
|
112
112
|
exports.dateTimeValueFormatter = dateTimeValueFormatter;
|
|
113
113
|
|
|
114
|
-
var flatten = function flatten(arr, parentref) {
|
|
114
|
+
var flatten = function flatten(arr, parentPropName, parentref) {
|
|
115
115
|
return arr ? arr.reduce(function (result, item) {
|
|
116
116
|
return [].concat(_toConsumableArray(result), [_objectSpread(_objectSpread({}, item), {}, {
|
|
117
|
-
|
|
118
|
-
})], _toConsumableArray(flatten(item.children, parentref ? [].concat(_toConsumableArray(parentref), [item
|
|
117
|
+
hierarchya: parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]]
|
|
118
|
+
})], _toConsumableArray(flatten(item.children, parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]])));
|
|
119
119
|
}, []) : [];
|
|
120
120
|
};
|
|
121
121
|
|
|
@@ -149,8 +149,10 @@ var toTree = function toTree(data) {
|
|
|
149
149
|
exports.toTree = toTree;
|
|
150
150
|
|
|
151
151
|
var flattenTreeDeep = function flattenTreeDeep(treeData) {
|
|
152
|
+
var childrenName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'childrens';
|
|
153
|
+
|
|
152
154
|
var getTail = function getTail(item) {
|
|
153
|
-
return item
|
|
155
|
+
return item[childrenName] && item.item[childrenName].length > 0 ? item.item[childrenName].map(function (m) {
|
|
154
156
|
return getTail(m);
|
|
155
157
|
}) : [item];
|
|
156
158
|
};
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ArrayTable from "./array-table";
|
|
2
2
|
import ArrayTableIndex from "./array-table-index";
|
|
3
|
-
import { AgGridColumn, AgGridPlus } from "./ag-grid-plus";
|
|
3
|
+
import { AgGridColumn, AgGridPlus, flattenTreeDeep } from "./ag-grid-plus";
|
|
4
4
|
import ExtensibleGrid from "./extensible-grid";
|
|
5
5
|
import Dashboard from "./dashboard";
|
|
6
6
|
import Elsa from "./elsa";
|
|
7
7
|
export { ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, ExtensibleGrid, Dashboard, Elsa };
|
|
8
|
+
export { flattenTreeDeep };
|
package/dist/cjs/index.js
CHANGED
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "ExtensibleGrid", {
|
|
|
45
45
|
return _extensibleGrid.default;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "flattenTreeDeep", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _agGridPlus.flattenTreeDeep;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
|
|
49
55
|
var _arrayTable = _interopRequireDefault(require("./array-table"));
|
|
50
56
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["style", "params", "request", "dataSource", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideRedo", "onGridReady", "gridKey", "gridColumnState", "children"];
|
|
1
|
+
var _excluded = ["style", "params", "request", "dataSource", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideRedo", "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
|
|
|
@@ -47,6 +47,7 @@ function AgGridPlus(props) {
|
|
|
47
47
|
gridParams = props.params,
|
|
48
48
|
request = props.request,
|
|
49
49
|
dataSource = props.dataSource,
|
|
50
|
+
treeParentName = props.treeParentName,
|
|
50
51
|
propRowData = props.rowData,
|
|
51
52
|
propsGridRef = props.gridRef,
|
|
52
53
|
headerTitle = props.headerTitle,
|
|
@@ -255,7 +256,7 @@ function AgGridPlus(props) {
|
|
|
255
256
|
}, rest, {
|
|
256
257
|
//指定客户端模式
|
|
257
258
|
rowModelType: "clientSide",
|
|
258
|
-
rowData: props.treeData ? flatten(toTree(rowData)) : rowData,
|
|
259
|
+
rowData: props.treeData ? flatten(toTree(rowData), treeParentName) : rowData,
|
|
259
260
|
onGridReady: onGridReady,
|
|
260
261
|
defaultColDef: defaultColDef,
|
|
261
262
|
onSortChanged: function onSortChanged(event) {
|
|
@@ -11,6 +11,7 @@ interface GridProps extends AgGridReactProps {
|
|
|
11
11
|
initParams?: any;
|
|
12
12
|
request?: (params: any, sort: any, filter: any) => Promise<any>;
|
|
13
13
|
dataSource?: any[];
|
|
14
|
+
treeParentName?: string;
|
|
14
15
|
search?: boolean;
|
|
15
16
|
headerTitle?: React.ReactNode;
|
|
16
17
|
toolBarRender?: (gridApi?: GridApi, filter?: string, queryFilter?: any) => React.ReactNode[];
|
|
@@ -3,7 +3,7 @@ declare const convertFilterModel: (filterModel: any) => string;
|
|
|
3
3
|
declare const convertSortModel: (sortModel: any[]) => string;
|
|
4
4
|
declare const dateValueFormatter: (params: ValueFormatterParams) => string;
|
|
5
5
|
declare const dateTimeValueFormatter: (params: ValueFormatterParams) => string;
|
|
6
|
-
declare const flatten: (arr: any[], parentref?: any[]) => any;
|
|
6
|
+
declare const flatten: (arr: any[], parentPropName: any, parentref?: any[]) => any;
|
|
7
7
|
declare const toTree: (data: any[]) => any[];
|
|
8
|
-
declare const flattenTreeDeep: (treeData: any[]) => any[];
|
|
8
|
+
declare const flattenTreeDeep: (treeData: any[], childrenName?: string) => any[];
|
|
9
9
|
export { dateValueFormatter, dateTimeValueFormatter, convertFilterModel, convertSortModel, flattenTreeDeep, toTree, flatten };
|
|
@@ -94,11 +94,11 @@ var dateTimeValueFormatter = function dateTimeValueFormatter(params) {
|
|
|
94
94
|
}; //@ts-ignore
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
var flatten = function flatten(arr, parentref) {
|
|
97
|
+
var flatten = function flatten(arr, parentPropName, parentref) {
|
|
98
98
|
return arr ? arr.reduce(function (result, item) {
|
|
99
99
|
return [].concat(_toConsumableArray(result), [_objectSpread(_objectSpread({}, item), {}, {
|
|
100
|
-
|
|
101
|
-
})], _toConsumableArray(flatten(item.children, parentref ? [].concat(_toConsumableArray(parentref), [item
|
|
100
|
+
hierarchya: parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]]
|
|
101
|
+
})], _toConsumableArray(flatten(item.children, parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]])));
|
|
102
102
|
}, []) : [];
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -128,8 +128,10 @@ var toTree = function toTree(data) {
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
var flattenTreeDeep = function flattenTreeDeep(treeData) {
|
|
131
|
+
var childrenName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'childrens';
|
|
132
|
+
|
|
131
133
|
var getTail = function getTail(item) {
|
|
132
|
-
return item
|
|
134
|
+
return item[childrenName] && item.item[childrenName].length > 0 ? item.item[childrenName].map(function (m) {
|
|
133
135
|
return getTail(m);
|
|
134
136
|
}) : [item];
|
|
135
137
|
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ArrayTable from "./array-table";
|
|
2
2
|
import ArrayTableIndex from "./array-table-index";
|
|
3
|
-
import { AgGridColumn, AgGridPlus } from "./ag-grid-plus";
|
|
3
|
+
import { AgGridColumn, AgGridPlus, flattenTreeDeep } from "./ag-grid-plus";
|
|
4
4
|
import ExtensibleGrid from "./extensible-grid";
|
|
5
5
|
import Dashboard from "./dashboard";
|
|
6
6
|
import Elsa from "./elsa";
|
|
7
7
|
export { ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, ExtensibleGrid, Dashboard, Elsa };
|
|
8
|
+
export { flattenTreeDeep };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ArrayTable from "./array-table";
|
|
2
2
|
import ArrayTableIndex from "./array-table-index";
|
|
3
|
-
import { AgGridColumn, AgGridPlus } from "./ag-grid-plus";
|
|
3
|
+
import { AgGridColumn, AgGridPlus, flattenTreeDeep } from "./ag-grid-plus";
|
|
4
4
|
import ExtensibleGrid from "./extensible-grid";
|
|
5
5
|
import Dashboard from "./dashboard";
|
|
6
6
|
import Elsa from "./elsa";
|
|
7
|
-
export { ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, ExtensibleGrid, Dashboard, Elsa };
|
|
7
|
+
export { ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, ExtensibleGrid, Dashboard, Elsa };
|
|
8
|
+
export { flattenTreeDeep };
|