Latest updates from IceHrmPro

This commit is contained in:
Thilina Pituwala
2020-05-20 18:47:29 +02:00
parent 60c92d7935
commit 7453a58aad
18012 changed files with 2089245 additions and 10173 deletions

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useKeyValueMap;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Return cached Key Value map with DataNode.
* Only re-calculate when `flattenOptions` changed.
*/
function useKeyValueMap(flattenOptions) {
return _react.default.useMemo(function () {
var cacheKeyMap = new Map();
var cacheValueMap = new Map(); // Cache options by key
flattenOptions.forEach(function (dataNode) {
cacheKeyMap.set(dataNode.key, dataNode);
cacheValueMap.set(dataNode.data.value, dataNode);
});
return [cacheKeyMap, cacheValueMap];
}, [flattenOptions]);
}