Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// debugger;
if (!isNaN(newValue) && refName != 'meridiem') {
let newDegree;
if (refName == 'clockHandSecond') {
newDegree = Number(newValue) * SECOND_DEGREE_NUMBER;
}
if (refName == 'clockHandMinute') {
newDegree = Number(newValue) * MINUTE_DEGREE_NUMBER;
}
if (refName == 'clockHandHour') {
if (Number(newValue) == 0) {
newValue = 12;
}
newDegree = Number(newValue) * HOUR_DEGREE_NUMBER;
}
elObj = update(elObj, {
value: { $set: newValue },
degree: { $set: newDegree },
startAngle: { $set: newDegree },
angle: { $set: newDegree }
});
this.setState({ [refName]: elObj, slectionRange });
}
if (key == 'ArrowUp' || key == 'ArrowDown') {
if (refName == 'meridiem') {
let meridiem = 'AM';
if (elObj == 'AM') {
meridiem = 'PM';
}
elObj = meridiem;
this.setState({ [refName]: elObj, slectionRange });
const mergeTracks = ({state, tracks}) => {
let existingTracks = state.tracks;
const updateCommand = {};
// don't want to overwrite tracks if already have more info
for (let track of tracks) {
if (existingTracks[track.id]) {
track = {...existingTracks[track.id], ...track};
}
updateCommand[track.id] = {$set: track};
}
return {
...state,
tracks: update(state.tracks, updateCommand)
};
};
addItem() {
let newState = reactUpdate(this.state, {
invoice: {
items: {
$push: [this.newItem]
}
},
openDialogStandardActions: {$set: false}
});
this.setState(newState);
this.newItem = {};
}
handleOperationPath(e) {
const newState = update(this.state, { newOperation: {path: {$set: e.target.value}} })
this.setState(newState)
}
_showScrollY () {
this.setState({
scrollYStyles: update(this.state.scrollYStyles, {
display: { $set: 'block' },
height: { $set: this._getScrollYHeight() }
})
})
}
function updateProductInPhases(phases, phaseId, productId, updateProduct, shouldReplace) {
const phaseIdx = _.findIndex(phases, { id: phaseId })
const productIdx = _.findIndex(phases[phaseIdx].products, { id: productId })
const updatedProduct = shouldReplace ? updateProduct : update(
phases[phaseIdx].products[productIdx],
updateProduct
)
const updatedPhase = update(phases[phaseIdx], {
products: { $splice: [[productIdx, 1, updatedProduct]] }
})
return update(phases, { $splice : [[phaseIdx, 1, updatedPhase]] })
}
deleteImagePreview(name) {
const index = this.state.files.findIndex(
fileObject => fileObject.metaData.name === name,
);
if (index !== -1) {
const newFiles = update(this.state.files, { $splice: [[index, 1]] });
this.safeSetState({
files: newFiles,
});
}
}
onMainEntityNameChanged: function (event) {
let updatedState = update(this.state, {entityName: {$set: event.value}});
this.setState(updatedState, () => {
if (this.state.autoUpdate) {
this.resetMetaform();
}
});
},
_handleTotalTaxChange(e) {
let newState = reactUpdate(this.state, {
invoice: {
totalTax: {$set: e.target.value}
}
});
this.setState(newState);
}
const currentFilter = (state = initialState.currentFilter, action) => {
switch (action.type) {
case SET_EMPLOYEE_FILTER:
return update(state, {
employee: {
$set: action.employee,
},
});
case SET_CUSTOMER_FILTER:
return update(state, {
customer: {
$set: action.customer,
},
});
default: return state;
}
};