How to use the @appbaseio/reactivecore/lib/utils/helper.isEqual function in @appbaseio/reactivecore

To help you get started, we’ve selected a few @appbaseio/reactivecore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appbaseio / reactivesearch / packages / web / src / components / list / ToggleButton.js View on Github external
componentDidUpdate(prevProps) {
		checkSomePropChange(this.props, prevProps, getValidPropsKeys(this.props), () => {
			this.props.updateComponentProps(this.props.componentId, this.props);
		});
		checkPropChange(this.props.react, prevProps.react, () => {
			this.setReact(this.props);
		});

		checkSomePropChange(this.props, prevProps, ['dataField', 'nestedField'], () => {
			this.updateQuery(this.state.currentValue, this.props);
		});

		if (!isEqual(this.props.value, prevProps.value)) {
			this.handleToggle(this.props.value, true, this.props);
		} else if (this.props.multiSelect) {
			// for multiselect selectedValue will be an array
			if (
				!isEqual(this.state.currentValue, this.props.selectedValue)
				&& !isEqual(prevProps.selectedValue, this.props.selectedValue)
			) {
				const { value, onChange } = this.props;
				if (value === undefined) {
					this.handleToggle(this.props.selectedValue || [], true, this.props);
				} else if (onChange) {
					// value prop exists
					onChange(this.props.selectedValue || '');
				} else {
					// value prop exists and onChange is not defined:
					// we need to put the current value back into the store
github appbaseio / reactivesearch / packages / web / src / components / range / SingleDropdownRange.js View on Github external
componentDidUpdate(prevProps) {
		checkSomePropChange(this.props, prevProps, getValidPropsKeys(this.props), () => {
			this.props.updateComponentProps(this.props.componentId, this.props);
		});
		checkPropChange(this.props.react, prevProps.react, () => this.setReact(this.props));

		checkSomePropChange(this.props, prevProps, ['dataField', 'nestedField'], () => {
			this.updateQuery(this.state.currentValue, prevProps);
		});

		if (!isEqual(this.props.value, prevProps.value)) {
			this.setValue(this.props.value, true);
		} else if (
			!isEqual(this.state.currentValue, this.props.selectedValue)
			&& !isEqual(this.props.selectedValue, prevProps.selectedValue)
		) {
			const { value, onChange } = this.props;
			if (value === undefined) {
				this.setValue(this.props.selectedValue || null, true);
			} else if (onChange) {
				onChange(this.props.selectedValue || null);
			} else {
				const selectedItem = this.state.currentValue.label;
				this.setValue(selectedItem, true);
			}
		}
	}
github appbaseio / reactivesearch / packages / web / lib / components / basic / TextField.js View on Github external
TextField.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
		if (!isEqual(nextProps.react, this.props.react)) {
			this.setReact(nextProps);
		}
		if (this.props.defaultSelected !== nextProps.defaultSelected) {
			this.setValue(nextProps.defaultSelected, true);
		} else if (this.state.currentValue !== nextProps.selectedValue) {
			this.setValue(nextProps.selectedValue || "", true);
		}
	};
github appbaseio / reactivesearch / packages / web / src / components / range / SingleRange.js View on Github external
componentDidUpdate(prevProps) {
		checkSomePropChange(this.props, prevProps, getValidPropsKeys(this.props), () => {
			this.props.updateComponentProps(this.props.componentId, this.props);
		});
		checkPropChange(this.props.react, prevProps.react, () => this.setReact(this.props));

		checkSomePropChange(this.props, prevProps, ['dataField', 'nestedField'], () => {
			this.updateQuery(this.state.currentValue, this.props);
		});

		if (!isEqual(this.props.value, prevProps.value)) {
			this.setValue(this.props.value);
		} else if (
			!isEqual(this.state.currentValue, this.props.selectedValue)
			&& !isEqual(this.props.selectedValue, prevProps.selectedValue)
		) {
			const { value, onChange } = this.props;
			if (value === undefined) {
				this.setValue(this.props.selectedValue || null);
			} else if (onChange) {
				onChange(this.props.selectedValue || null);
			} else {
				this.setValue(this.state.currentValue);
			}
		}
	}
github appbaseio / reactivesearch / packages / web / src / components / range / MultiRange.js View on Github external
this.props.updateComponentProps(this.props.componentId, this.props);
		});
		checkPropChange(this.props.react, prevProps.react, () => this.setReact(this.props));

		checkSomePropChange(this.props, prevProps, ['dataField', 'nestedField'], () => {
			this.updateQuery(this.state.currentValue, this.props);
		});

		if (!isEqual(this.props.value, prevProps.value)) {
			this.selectItem({
				item: this.props.value,
				isDefaultValue: true,
			});
		} else if (
			!isEqual(this.state.currentValue, this.props.selectedValue)
			&& !isEqual(this.props.selectedValue, prevProps.selectedValue)
		) {
			const { value, onChange } = this.props;

			if (value === undefined) {
				this.selectItem({ item: this.props.selectedValue || null, isDefaultValue: true });
			} else if (onChange) {
				this.selectItem({
					item: this.props.selectedValue || null,
				});
			} else {
				const selectedValuesArray = Object.keys(this.state.selectedValues);
				this.selectItem({
					item: selectedValuesArray,
					isDefaultValue: true,
				});
			}
github appbaseio / reactivesearch / packages / native / src / components / range / MultiDropdownRange.js View on Github external
componentWillReceiveProps(nextProps) {
		checkPropChange(this.props.react, nextProps.react, () => this.setReact(nextProps));

		checkPropChange(this.props.dataField, nextProps.dataField, () => {
			this.updateQuery(this.state.currentValue, nextProps);
		});

		if (!isEqual(this.props.defaultSelected, nextProps.defaultSelected)) {
			this.selectItem(nextProps.defaultSelected, true);
		} else if (
			!isEqual(this.state.currentValue, nextProps.selectedValue) &&
			(nextProps.selectedValue || nextProps.selectedValue === null)
		) {
			this.selectItem(nextProps.selectedValue, true);
		}
	}
github appbaseio / reactivesearch / packages / web / lib / components / list / MultiList.js View on Github external
if (!isEqual(nextProps.react, this.props.react)) {
			this.setReact(nextProps);
		}
		if (!isEqual(nextProps.options, this.props.options)) {
			this.setState({
				options: nextProps.options[nextProps.dataField].buckets || []
			});
		}

		var selectedValue = Object.keys(this.state.currentValue).filter(function (item) {
			return _this2.state.currentValue[item];
		});

		if (this.props.defaultSelected !== nextProps.defaultSelected) {
			this.setValue(nextProps.defaultSelected, true);
		} else if (!isEqual(selectedValue, nextProps.selectedValue)) {
			this.setValue(nextProps.selectedValue, true);
		}
	};
github appbaseio / reactivesearch / packages / maps / src / components / result / ReactiveMap.js View on Github external
componentDidUpdate(prevProps) {
		const updatedState = {};
		if (
			this.props.sortBy !== prevProps.sortBy
			|| this.props.size !== prevProps.size
			|| !isEqual(this.props.dataField, prevProps.dataField)
		) {
			const options = getQueryOptions(this.props);
			options.from = 0;
			if (this.props.sortBy) {
				options.sort = [
					{
						[this.props.dataField]: {
							order: this.props.sortBy,
						},
					},
				];
			}

			updatedState.from = 0;
			updatedState.currentPage = 0;
			this.props.setQueryOptions(this.props.componentId, options, true);
github appbaseio / reactivesearch / packages / web / src / components / date / DatePicker.js View on Github external
checkSomePropChange(this.props, prevProps, getValidPropsKeys(this.props), () => {
			this.props.updateComponentProps(this.props.componentId, this.props);
		});
		checkPropChange(this.props.react, prevProps.react, () => this.setReact(this.props));
		checkSomePropChange(this.props, prevProps, ['dataField', 'nestedField'], () =>
			this.updateQuery(
				this.state.currentDate ? this.formatInputDate(this.state.currentDate) : null,
				this.props,
			),
		);

		if (!isEqual(this.props.value, prevProps.value)) {
			this.handleDateChange(this.props.value, true, this.props);
		} else if (
			!isEqual(this.formatInputDate(this.state.currentDate), this.props.selectedValue)
			&& !isEqual(this.props.selectedValue, prevProps.selectedValue)
		) {
			this.handleDateChange(this.props.selectedValue || '', true, this.props);
		}
	}
github appbaseio / reactivesearch / packages / native / src / components / list / MultiDropdownList.js View on Github external
this.updateQuery(Object.keys(this.state.currentValue), nextProps);
		});

		let selectedValue = Object.keys(this.state.currentValue);

		if (this.props.selectAllLabel) {
			selectedValue = selectedValue.filter(val => val !== this.props.selectAllLabel);

			if (this.state.currentValue[this.props.selectAllLabel]) {
				selectedValue = [this.props.selectAllLabel];
			}
		}

		if (!isEqual(this.props.defaultSelected, nextProps.defaultSelected)) {
			this.setValue(nextProps.defaultSelected, true);
		} else if (!isEqual(selectedValue, nextProps.selectedValue)) {
			this.setValue(nextProps.selectedValue || [], true);
		}
	}