@raona/components
Version:
React components used at Raona to work with SPFx
54 lines (53 loc) • 1.87 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Set the section of webparts to full width,
* @param carouselRef - ReactRef
*/
function setFullWidth(carouselRef) {
if (!Element.prototype.matches)
Element.prototype.matches = Element.prototype['msMatchesSelector'];
if (!Element.prototype.closest)
Element.prototype.closest = function (selector) {
var el = this;
while (el) {
if (el.matches('.CanvasZone')) {
return el;
}
el = el.parentElement;
}
el.classList.add("CanvasZone--fullWidth");
};
if (Element.prototype.closest) {
var parent_1 = carouselRef.current.closest('.CanvasZone');
parent_1.classList.add("CanvasZone--fullWidth");
}
}
exports.setFullWidth = setFullWidth;
/**
* Set the section of webparts to full width,
* @param carouselRef - ReactRef
* @param classToMatch - Class to search for
* @param className - Class to add
*/
function setFullWidth_webpart(carouselRef, classToMatch, className) {
if (!Element.prototype.matches)
Element.prototype.matches = Element.prototype['msMatchesSelector'];
if (!Element.prototype.closest)
Element.prototype.closest = function (selector) {
var el = this;
while (el) {
if (el.matches(classToMatch)) {
return el;
}
el = el.parentElement;
}
console.log(el);
el.classList.add(className);
};
if (Element.prototype.closest) {
var parent_2 = carouselRef.current.closest(classToMatch);
parent_2.classList.add(className);
}
}
exports.setFullWidth_webpart = setFullWidth_webpart;
;