@nokecy/qc-ui 0.1.14 → 0.1.16
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.
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.toTree = exports.flattenTreeDeep = exports.flatten = exports.dateValueFormatter = exports.dateTimeValueFormatter = exports.convertSortModel = exports.convertFilterModel = void 0;
|
|
7
7
|
|
|
8
|
-
var _flattenDeep2 = _interopRequireDefault(require("lodash/flattenDeep"));
|
|
9
|
-
|
|
10
8
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
11
9
|
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -112,11 +110,12 @@ var dateTimeValueFormatter = function dateTimeValueFormatter(params) {
|
|
|
112
110
|
exports.dateTimeValueFormatter = dateTimeValueFormatter;
|
|
113
111
|
|
|
114
112
|
var flatten = function flatten(arr, parentPropName, parentref) {
|
|
115
|
-
|
|
113
|
+
var data = arr ? arr.reduce(function (result, item) {
|
|
116
114
|
return [].concat(_toConsumableArray(result), [_objectSpread(_objectSpread({}, item), {}, {
|
|
117
115
|
hierarchy: parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]]
|
|
118
|
-
})], _toConsumableArray(flatten(item.children, parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]])));
|
|
116
|
+
})], _toConsumableArray(flatten(item.children, parentPropName, parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]])));
|
|
119
117
|
}, []) : [];
|
|
118
|
+
return data;
|
|
120
119
|
};
|
|
121
120
|
|
|
122
121
|
exports.flatten = flatten;
|
|
@@ -151,15 +150,23 @@ exports.toTree = toTree;
|
|
|
151
150
|
var flattenTreeDeep = function flattenTreeDeep(treeData) {
|
|
152
151
|
var childrenName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'childrens';
|
|
153
152
|
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
var flattenData = function flattenData(treeData, res) {
|
|
154
|
+
var childrenName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'childrens';
|
|
155
|
+
treeData.forEach(function (item) {
|
|
156
|
+
res.push(item);
|
|
157
|
+
|
|
158
|
+
if (item[childrenName] && item[childrenName].length !== 0) {
|
|
159
|
+
flattenData(item[childrenName], res);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
delete item[childrenName];
|
|
163
|
+
});
|
|
164
|
+
return res;
|
|
158
165
|
};
|
|
159
166
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
var res = [];
|
|
168
|
+
flattenData(treeData, res, childrenName);
|
|
169
|
+
return res;
|
|
163
170
|
};
|
|
164
171
|
|
|
165
172
|
exports.flattenTreeDeep = flattenTreeDeep;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _flattenDeep from "lodash/flattenDeep";
|
|
2
|
-
|
|
3
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
2
|
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -95,11 +93,12 @@ var dateTimeValueFormatter = function dateTimeValueFormatter(params) {
|
|
|
95
93
|
|
|
96
94
|
|
|
97
95
|
var flatten = function flatten(arr, parentPropName, parentref) {
|
|
98
|
-
|
|
96
|
+
var data = arr ? arr.reduce(function (result, item) {
|
|
99
97
|
return [].concat(_toConsumableArray(result), [_objectSpread(_objectSpread({}, item), {}, {
|
|
100
98
|
hierarchy: parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]]
|
|
101
|
-
})], _toConsumableArray(flatten(item.children, parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]])));
|
|
99
|
+
})], _toConsumableArray(flatten(item.children, parentPropName, parentref ? [].concat(_toConsumableArray(parentref), [item[parentPropName]]) : [item[parentPropName]])));
|
|
102
100
|
}, []) : [];
|
|
101
|
+
return data;
|
|
103
102
|
};
|
|
104
103
|
|
|
105
104
|
var toTree = function toTree(data) {
|
|
@@ -130,15 +129,23 @@ var toTree = function toTree(data) {
|
|
|
130
129
|
var flattenTreeDeep = function flattenTreeDeep(treeData) {
|
|
131
130
|
var childrenName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'childrens';
|
|
132
131
|
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
var flattenData = function flattenData(treeData, res) {
|
|
133
|
+
var childrenName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'childrens';
|
|
134
|
+
treeData.forEach(function (item) {
|
|
135
|
+
res.push(item);
|
|
136
|
+
|
|
137
|
+
if (item[childrenName] && item[childrenName].length !== 0) {
|
|
138
|
+
flattenData(item[childrenName], res);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
delete item[childrenName];
|
|
142
|
+
});
|
|
143
|
+
return res;
|
|
137
144
|
};
|
|
138
145
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
var res = [];
|
|
147
|
+
flattenData(treeData, res, childrenName);
|
|
148
|
+
return res;
|
|
142
149
|
};
|
|
143
150
|
|
|
144
151
|
export { dateValueFormatter, dateTimeValueFormatter, convertFilterModel, convertSortModel, flattenTreeDeep, toTree, flatten };
|