@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
32 lines (31 loc) • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.omitDataValueReadProps = omitDataValueReadProps;
exports.omitDataValueReadWriteProps = omitDataValueReadWriteProps;
exports.omitDataValueWriteProps = omitDataValueWriteProps;
exports.pickDataValueReadProps = pickDataValueReadProps;
exports.pickDataValueReadWriteProps = pickDataValueReadWriteProps;
exports.pickDataValueWriteProps = pickDataValueWriteProps;
const dataValueReadProps = ['path', 'itemPath', 'value'];
function pickDataValueReadProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => dataValueReadProps.includes(key)));
}
function omitDataValueReadProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => !dataValueReadProps.includes(key)));
}
const dataValueWriteProps = ['emptyValue', 'onFocus', 'onBlur', 'onChange'];
function pickDataValueWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => dataValueWriteProps.includes(key)));
}
function omitDataValueWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => !dataValueWriteProps.includes(key)));
}
function pickDataValueReadWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => dataValueReadProps.includes(key) || dataValueWriteProps.includes(key)));
}
function omitDataValueReadWriteProps(props) {
return Object.fromEntries(Object.entries(props !== null && props !== void 0 ? props : {}).filter(([key]) => !dataValueReadProps.includes(key) && !dataValueWriteProps.includes(key)));
}
//# sourceMappingURL=types.js.map