Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const yearViewChildProps = yearViewChild ? yearViewChild.props : {};
const tabIndex = yearViewChildProps.tabIndex == null ?
null
:
yearViewChildProps.tabIndex;
yearViewProps.tabIndex = tabIndex;
if (props.focusYearView === false || tabIndex == null) {
yearViewProps.tabIndex = null;
yearViewProps.onFocus = this.onYearViewFocus;
yearViewProps.onMouseDown = this.onYearViewMouseDown;
}
assign(yearViewProps, {
// viewDate: props.moment || props.viewDate,
onViewDateChange: joinFunctions(
this.onViewDateChange,
yearViewChildProps.onViewDateChange
),
onActiveDateChange: joinFunctions(
this.onActiveDateChange,
yearViewChildProps.onActiveDateChange
),
onChange: joinFunctions(
this.handleYearViewOnChange,
yearViewChildProps.onChange
)
});
if (yearViewChild) {
export default function fuelSavingsReducer(state = initialState.fuelSavings, action) {
let newState;
switch (action.type) {
case SAVE_FUEL_SAVINGS:
// For this example, just simulating a save by changing date modified.
// In a real app using Redux, you might use redux-thunk and handle the async call in fuelSavingsActions.js
return objectAssign({}, state, {dateModified: action.dateModified});
case CALCULATE_FUEL_SAVINGS:
newState = objectAssign({}, state);
newState[action.fieldName] = action.value;
newState.necessaryDataIsProvidedToCalculateSavings = calculator().necessaryDataIsProvidedToCalculateSavings(newState);
newState.dateModified = action.dateModified;
if (newState.necessaryDataIsProvidedToCalculateSavings) {
newState.savings = calculator().calculateSavings(newState);
}
return newState;
default:
return state;
}
}
function onSubmit(e) {
e.preventDefault();
const $form = $(this);
const reqData = assign(PTL.captcha.postData, $form.serializeObject());
const successFn = reqData.sfn;
const errorFn = reqData.efn;
const url = $form.attr('action');
$.ajax({
url,
type: 'POST',
data: reqData,
success() {
utils.executeFunctionByName(successFn, window, e);
$.magnificPopup.close();
},
error(xhr) {
onError(xhr, errorFn);
},
});
export function createStore(mixin) {
const store = assign({}, EventEmitter.prototype, {
emitChange() {
this.emit(CHANGE_EVENT);
},
addChangeListener(callback) {
this.on(CHANGE_EVENT, callback);
},
removeChangeListener(callback) {
this.removeChangeListener(CHANGE_EVENT, callback);
}
}, mixin);
return store;
}
Component = MonthPicker;
break;
case 'time':
Component = TimePicker;
break;
}
let _format = "";
if (format) _format = format;
else if (type === 'datetime' || type === 'date~') _format = "YYYY-MM-DD HH:mm:ss";
else if (type === 'time') _format = "HH:mm:ss";
else _format = "YYYY-MM-DD";
return getFieldDecorator(name, formFieldOptions)(
);
};
onChange(dateMoment) {
if (dateMoment != null && !moment.isMoment(dateMoment)) {
dateMoment = this.toMoment(dateMoment);
}
forwardTime(this.time, dateMoment);
const newState = {};
if (this.props.value === undefined) {
assign(newState, {
text: null,
value: dateMoment
});
}
newState.activeDate = dateMoment;
if (!this.pickerView || !this.pickerView.isInView || !this.pickerView.isInView(dateMoment)) {
newState.viewDate = dateMoment;
}
if (this.props.onChange) {
this.props.onChange(this.format(dateMoment), { dateMoment });
}
this.setState(newState);
const bundlesToUrls = bundleImages(components);
const article = {
version: '1.0',
identifier: opts.identifier,
title: articleJson.title,
language: articleJson.language || 'en',
metadata: {
generatorName: 'article-json-to-apple-news',
generatorVersion: packageJson.version
},
documentStyle: opts.documentStyle,
layout: objectAssign({}, defaultStyles.layout, opts.layout),
componentLayouts: objectAssign({}, defaultStyles.componentLayouts, opts.componentLayouts),
componentTextStyles: objectAssign({}, defaultStyles.componentTextStyles, opts.componentTextStyles),
componentStyles: objectAssign({}, defaultStyles.componentStyles, opts.componentStyles),
textStyles: objectAssign({}, defaultStyles.textStyles, opts.textStyles),
components
};
if (articleJson.author && articleJson.author.name) {
article.metadata.authors = [articleJson.author.name];
}
if (articleJson.headerEmbed && articleJson.headerEmbed.type === 'embed' &&
articleJson.headerEmbed.embedType === 'image') {
Object.keys(bundlesToUrls).forEach(function (key) {
const value = bundlesToUrls[key];
if (value === articleJson.headerEmbed.src) {
article.metadata.thumbnailURL = 'bundle://' + key;
}
});
}
updateItem = (item, data) => {
const history = this.getPrevHistory()
const layerIndex = history.findIndex(l => l.id === item.layer.data.id)
const children = history[layerIndex].children
const itemIndex = children.findIndex(i => i.id === item.data.id)
const nextItem = assign({}, children[itemIndex], data)
const nextHistory = update(history, {
[layerIndex]: { children: { [itemIndex]: { $set: nextItem } } }
})
this.addHistory(nextHistory)
return nextItem
}
setNextOptions = (index, value)=> {
let tempState = assign({}, this.state);
let selects = tempState.selects;
for (let i = 0; i < selects.length; i++) {
if (i > index) {
let item = selects[i - 1];
let nextItem = selects[i];
if (nextItem) {
let name = nextItem.name;
let options = [];
if(i-1===index){
options = item.getNextOptions && item.getNextOptions(value);
}
PubSubMsg.publish('setNextOptions' + name, {name, options})
}
}
}
};
const executeThenableCallbacks = ({ registeredCallbacks, originalCallbackArguments }) => {
if (registeredCallbacks.length) {
return executeThenableCallback({
registeredCallbacks: objectAssign([], registeredCallbacks).reverse(),
originalCallbackArguments
})
}
return Promise.resolve()
}