StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.0 KiB
58 lines
2.0 KiB
import identity from './identity';
|
|
import { concat } from './array';
|
|
import { isFunction } from './inspect'; // Note for functional components:
|
|
// In functional components, `slots` is a function so it must be called
|
|
// first before passing to the below methods. `scopedSlots` is always an
|
|
// object and may be undefined (for Vue < 2.6.x)
|
|
|
|
/**
|
|
* Returns true if either scoped or unscoped named slot exists
|
|
*
|
|
* @param {String, Array} name or name[]
|
|
* @param {Object} scopedSlots
|
|
* @param {Object} slots
|
|
* @returns {Array|undefined} VNodes
|
|
*/
|
|
|
|
var hasNormalizedSlot = function hasNormalizedSlot(names) {
|
|
var $scopedSlots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
var $slots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
// Ensure names is an array
|
|
names = concat(names).filter(identity); // Returns true if the either a $scopedSlot or $slot exists with the specified name
|
|
|
|
return names.some(function (name) {
|
|
return $scopedSlots[name] || $slots[name];
|
|
});
|
|
};
|
|
/**
|
|
* Returns VNodes for named slot either scoped or unscoped
|
|
*
|
|
* @param {String, Array} name or name[]
|
|
* @param {String} scope
|
|
* @param {Object} scopedSlots
|
|
* @param {Object} slots
|
|
* @returns {Array|undefined} VNodes
|
|
*/
|
|
|
|
|
|
var normalizeSlot = function normalizeSlot(names) {
|
|
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
var $scopedSlots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
var $slots = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
// Ensure names is an array
|
|
names = concat(names).filter(identity);
|
|
var slot;
|
|
|
|
for (var i = 0; i < names.length && !slot; i++) {
|
|
var name = names[i];
|
|
slot = $scopedSlots[name] || $slots[name];
|
|
} // Note: in Vue 2.6.x, all named slots are also scoped slots
|
|
|
|
|
|
return isFunction(slot) ? slot(scope) : slot;
|
|
}; // Named exports
|
|
|
|
|
|
export { hasNormalizedSlot, normalizeSlot }; // Default export (backwards compatibility)
|
|
|
|
export default normalizeSlot; |