MCPcopy
hub / github.com/microsoft/SandDance / PanelBase1

Function PanelBase1

docs/app/js/sanddance-app.js:45208–45316  ·  view source on GitHub ↗
(props1)

Source from the content-addressed store, hash-verified

45206var PanelBase = /** @class */ function(_super) {
45207 (0, _tslib.__extends)(PanelBase1, _super);
45208 function PanelBase1(props1) {
45209 var _this = _super.call(this, props1) || this;
45210 _this._panel = _react.createRef();
45211 _this._animationCallback = null;
45212 _this._hasCustomNavigation = !!(_this.props.onRenderNavigation || _this.props.onRenderNavigationContent);
45213 _this.dismiss = function(ev) {
45214 if (_this.props.onDismiss && _this.isActive) _this.props.onDismiss(ev);
45215 if (!ev || ev && !ev.defaultPrevented) _this.close();
45216 };
45217 // Allow the user to scroll within the panel but not on the body
45218 _this._allowScrollOnPanel = function(elt) {
45219 if (elt) {
45220 if (_this._allowTouchBodyScroll) (0, _utilities.allowOverscrollOnElement)(elt, _this._events);
45221 else (0, _utilities.allowScrollOnElement)(elt, _this._events);
45222 } else _this._events.off(_this._scrollableContent);
45223 _this._scrollableContent = elt;
45224 };
45225 _this._onRenderNavigation = function(props) {
45226 if (!_this.props.onRenderNavigationContent && !_this.props.onRenderNavigation && !_this.props.hasCloseButton) return null;
45227 var _a = _this.props.onRenderNavigationContent, onRenderNavigationContent = _a === void 0 ? _this._onRenderNavigationContent : _a;
45228 return _react.createElement("div", {
45229 className: _this._classNames.navigation
45230 }, onRenderNavigationContent(props, _this._onRenderNavigationContent));
45231 };
45232 _this._onRenderNavigationContent = function(props) {
45233 var _a;
45234 var closeButtonAriaLabel = props.closeButtonAriaLabel, hasCloseButton = props.hasCloseButton, _b = props.onRenderHeader, onRenderHeader = _b === void 0 ? _this._onRenderHeader : _b;
45235 if (hasCloseButton) {
45236 var iconButtonStyles = (_a = _this._classNames.subComponentStyles) === null || _a === void 0 ? void 0 : _a.closeButton();
45237 return _react.createElement(_react.Fragment, null, !_this._hasCustomNavigation && onRenderHeader(_this.props, _this._onRenderHeader, _this._headerTextId), _react.createElement((0, _button.IconButton), {
45238 styles: iconButtonStyles,
45239 // eslint-disable-next-line deprecation/deprecation
45240 className: _this._classNames.closeButton,
45241 onClick: _this._onPanelClick,
45242 ariaLabel: closeButtonAriaLabel,
45243 title: closeButtonAriaLabel,
45244 "data-is-visible": true,
45245 iconProps: {
45246 iconName: "Cancel"
45247 }
45248 }));
45249 }
45250 return null;
45251 };
45252 _this._onRenderHeader = function(props, defaultRender, headerTextId) {
45253 var headerText = props.headerText, _a = props.headerTextProps, headerTextProps = _a === void 0 ? {} : _a;
45254 if (headerText) return _react.createElement("div", {
45255 className: _this._classNames.header
45256 }, _react.createElement("div", (0, _tslib.__assign)({
45257 id: headerTextId,
45258 role: "heading",
45259 "aria-level": 1
45260 }, headerTextProps, {
45261 className: (0, _utilities.css)(_this._classNames.headerText, headerTextProps.className)
45262 }), headerText));
45263 return null;
45264 };
45265 _this._onRenderBody = function(props) {

Callers

nothing calls this directly

Calls 2

closeMethod · 0.65
offMethod · 0.45

Tested by

no test coverage detected