Repository URL to install this package:
|
Version:
2.7.11 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
/* eslint-disable max-statements */
const makeMultiState_1 = tslib_1.__importDefault(require("./makeMultiState"));
const fromSelectionToAttributes = (props, name) => {
let {
/**
* @todo @fixme - does not need to be like this!!!
* @description defaults
*/
list = [],
type
} = props;
/**
* @fixme - should be done in data later
*/
if (type === 'fit' || type === 'style1') {
type = 'style';
}
const state = makeMultiState_1.default(name); // selectableOptions.fit
const selectedForType = list[type];
const shouldBeSelected = selectedForType === name; // selectedForType.includes(name)
const shouldBeDisabled = false;
if (shouldBeSelected) {
state.select();
} else if (shouldBeDisabled) {
state.disable();
}
/**
* @todo this logic is very confusing
* @todo @deepak #help
*/
return state;
};
exports.fromSelectionToAttributes = fromSelectionToAttributes;
exports.default = fromSelectionToAttributes; //# sourceMappingURL=fromSelectionToAttributes.js.map