UNPKG

@raona/components

Version:

React components used at Raona to work with SPFx

55 lines (54 loc) 1.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Removes full width of the section of webparts * @param carouselRef - ReactRef */ function removeFullWidth(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; } console.log(el); el.classList.remove("CanvasZone--fullWidth"); }; if (Element.prototype.closest) { var parent_1 = carouselRef.current.closest('.CanvasZone'); parent_1.classList.remove("CanvasZone--fullWidth"); } } exports.removeFullWidth = removeFullWidth; /** * Removes full width of the section of webparts * @param carouselRef - ReactRef * @param classToMatch - Class to search for * @param className - Class to remove */ function removeFullWidth_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.remove(className); }; if (Element.prototype.closest) { var parent_2 = carouselRef.current.closest(classToMatch); parent_2.classList.remove(className); } } exports.removeFullWidth_webpart = removeFullWidth_webpart;