@ozen-ui/kit
Version:
React component library
8 lines (7 loc) • 720 B
JavaScript
import { __assign } from "tslib";
export var defaultGetOptionKey = function (option) { var _a; return (_a = option.id) !== null && _a !== void 0 ? _a : option; };
export var defaultGetOptionLabel = function (option) { var _a; return (_a = option.label) !== null && _a !== void 0 ? _a : option; };
export var defaultGetOptionDisabled = function (option) { var _a; return (_a = option.disabled) !== null && _a !== void 0 ? _a : false; };
export function withDefaultGetters(props) {
return __assign(__assign({}, props), { getOptionLabel: props.getOptionLabel || defaultGetOptionLabel, getOptionKey: props.getOptionKey || defaultGetOptionKey, getOptionDisabled: props.getOptionDisabled || defaultGetOptionDisabled });
}