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,30 @@
import React from 'react';
import { getRawValueLabeled } from '../utils/valueUtil';
import { formatStrategyKeys } from '../utils/strategyUtil';
/** Return */
export default function useSelectValues(rawValues, _ref) {
var value = _ref.value,
getEntityByValue = _ref.getEntityByValue,
getEntityByKey = _ref.getEntityByKey,
treeConduction = _ref.treeConduction,
showCheckedStrategy = _ref.showCheckedStrategy,
conductKeyEntities = _ref.conductKeyEntities,
getLabelProp = _ref.getLabelProp;
return React.useMemo(function () {
var mergedRawValues = rawValues;
if (treeConduction) {
var rawKeys = formatStrategyKeys(rawValues.map(function (val) {
var entity = getEntityByValue(val);
return entity ? entity.key : val;
}), showCheckedStrategy, conductKeyEntities);
mergedRawValues = rawKeys.map(function (key) {
var entity = getEntityByKey(key);
return entity ? entity.data.value : key;
});
}
return getRawValueLabeled(mergedRawValues, value, getEntityByValue, getLabelProp);
}, [rawValues, value, treeConduction, showCheckedStrategy, getEntityByValue]);
}