How to use metal - 10 common examples

To help you get started, we’ve selected a few metal 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 peerkar / liferay-gsearch / gsearch-web / src / main / resources / META-INF / resources / view-templates / GSearchResultsLayouts.es.js View on Github external
if (this.debug) {
			console.log("GSearchResultsLayout.rendered()");
		}
	}
}
	
/** 
 * State definition.
 * 
 * @type {!Object}
 * @static
 */
GSearchResultsLayouts.STATE = {
	getQueryParam: {
		validator: core.isFunction
	},
	templateParameters: {
		value: ['resultsLayout']
	},
	setQueryParam: {
		validator: core.isFunction
	}
};

// Register component

Soy.register(GSearchResultsLayouts, templates);

export default GSearchResultsLayouts;
github metal / metal.js / packages / metal-dom / src / domNamed.js View on Github external
if (defaultListener) {
		// Wrap callback so we don't set property directly on it.
		callback = callback.bind();
		callback.defaultListener_ = true;
	}

	attachDelegateEvent_(element, eventName);
	if (isString(selectorOrTarget)) {
		addSelectorListener_(element, eventName, selectorOrTarget, callback);
	} else {
		addElementListener_(selectorOrTarget, eventName, callback);
	}

	return new DomDelegatedEventHandle(
		isString(selectorOrTarget) ? element : selectorOrTarget,
		eventName,
		callback,
		isString(selectorOrTarget) ? selectorOrTarget : null
	);
}
github metal / metal.js / packages / metal-dom / src / domNamed.js View on Github external
defaultListener
) {
	const customConfig = customEvents[eventName];
	if (customConfig && customConfig.delegate) {
		eventName = customConfig.originalEvent;
		callback = customConfig.handler.bind(customConfig, callback);
	}

	if (defaultListener) {
		// Wrap callback so we don't set property directly on it.
		callback = callback.bind();
		callback.defaultListener_ = true;
	}

	attachDelegateEvent_(element, eventName);
	if (isString(selectorOrTarget)) {
		addSelectorListener_(element, eventName, selectorOrTarget, callback);
	} else {
		addElementListener_(selectorOrTarget, eventName, callback);
	}

	return new DomDelegatedEventHandle(
		isString(selectorOrTarget) ? element : selectorOrTarget,
		eventName,
		callback,
		isString(selectorOrTarget) ? selectorOrTarget : null
	);
}
github metal / metal.js / packages / metal-incremental-dom / src / render / render.js View on Github external
function updateContext_(comp, parent) {
	const context = comp.context;
	const childContext = parent.getChildContext
		? parent.getChildContext()
		: null; // eslint-disable-line
	object.mixin(context, parent.context, childContext);
	comp.context = context;
}
github metal / metal.js / src / SoyRenderer.js View on Github external
var component = this.component_;
		var names = component.getAttrNames().filter(function(name) {
			// Get all attribute values except for "element", since it helps performance and this
			// attribute shouldn't be referenced inside a soy template anyway.
			return name !== 'element';
		});
		var surface = this.getSurface(component.id);
		var data = (surface && surface.componentData) ? surface.componentData : {};
		var attrs = object.map(component.getAttrs(names), function(key, value) {
			if (component.getAttrConfig(key).isHtml && core.isString(value)) {
				return SoyRenderer.sanitizeHtml(value);
			} else {
				return value;
			}
		});
		return object.mixin(data, attrs);
	}
github metal / metal.js / packages / metal-component / src / Component.js View on Github external
setUpDataManager_() {
		this.dataManager_ = getStaticProperty(this.constructor, 'DATA_MANAGER');
		this.dataManager_.setUp(
			this,
			object.mixin(
				{},
				this.renderer_.getExtraDataConfig(this),
				Component.DATA
			) // eslint-disable-line
		);
	}
github peerkar / liferay-gsearch / gsearch-web / src / main / resources / META-INF / resources / view-templates / GSearchPaging.es.js View on Github external
_self.setQueryParam('start', value, true, false);
			    }
			}
		});			
	}
}

/** 
 * State definition.
 * 
 * @type {!Object}
 * @static
 */
GSearchPaging.STATE = {
	getQueryParam: {
		validator: core.isFunction
	},
	setQueryParam: {
		validator: core.isFunction
	}
};

// Register component

Soy.register(GSearchPaging, templates);

export default GSearchPaging;
github peerkar / liferay-gsearch / gsearch-web / src / main / resources / META-INF / resources / view-templates / GSearchResultsLayouts.es.js View on Github external
/** 
 * State definition.
 * 
 * @type {!Object}
 * @static
 */
GSearchResultsLayouts.STATE = {
	getQueryParam: {
		validator: core.isFunction
	},
	templateParameters: {
		value: ['resultsLayout']
	},
	setQueryParam: {
		validator: core.isFunction
	}
};

// Register component

Soy.register(GSearchResultsLayouts, templates);

export default GSearchResultsLayouts;
github peerkar / liferay-gsearch / gsearch-web / src / main / resources / META-INF / resources / view-templates / GSearchFacets.es.js View on Github external
}

/**
 * State definition.
 * @type {!Object}
 * @static
 */
GSearchFacets.STATE = {
	debug: {
		value: false
	},
	facetFields: {
		value: null
	},
	getQueryParam: {
		validator: core.isFunction
	},
	initialQueryParameters: {
		value: null
	},
	setQueryParam: {
		validator: core.isFunction
	}
};

// Register component

Soy.register(GSearchFacets, templates);

export default GSearchFacets;
github peerkar / liferay-gsearch / gsearch-web / src / main / resources / META-INF / resources / view-templates / GSearchField.es.js View on Github external
},
	initialQueryParameters: {
		value: null
	},
	isSearching: {
		internal: true,
		value: false
	},
	getQueryParam: {
		validator: core.isFunction
	},
	queryMinLength: {
		value: 3
	},
	setQueryParam: {
		validator: core.isFunction
	},
	suggestionsURL: {
		value: null
	}
};

// Register component

Soy.register(GSearchField, templates);

export default GSearchField;