MCPcopy Create free account
hub / github.com/microsoft/SandDance / CalloutContentBase1

Function CalloutContentBase1

docs/app/js/sanddance-app.js:31320–31383  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

31318var CalloutContentBase = /** @class */ function(_super) {
31319 (0, _tslib.__extends)(CalloutContentBase1, _super);
31320 function CalloutContentBase1(props) {
31321 var _this = _super.call(this, props) || this;
31322 _this._hostElement = _react.createRef();
31323 _this._calloutElement = _react.createRef();
31324 _this._hasListeners = false;
31325 _this._disposables = [];
31326 _this.dismiss = function(ev) {
31327 var onDismiss = _this.props.onDismiss;
31328 if (onDismiss) onDismiss(ev);
31329 };
31330 _this._dismissOnScroll = function(ev) {
31331 // eslint-disable-next-line deprecation/deprecation
31332 var _a1 = _this.props, preventDismissOnEvent = _a1.preventDismissOnEvent, preventDismissOnScroll = _a1.preventDismissOnScroll;
31333 if (_this.state.positions && (preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnScroll)) _this._dismissOnClickOrScroll(ev);
31334 };
31335 _this._dismissOnResize = function(ev) {
31336 // eslint-disable-next-line deprecation/deprecation
31337 var _a2 = _this.props, preventDismissOnEvent = _a2.preventDismissOnEvent, preventDismissOnResize = _a2.preventDismissOnResize;
31338 if (preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnResize) _this.dismiss(ev);
31339 };
31340 _this._dismissOnLostFocus = function(ev) {
31341 // eslint-disable-next-line deprecation/deprecation
31342 var _a3 = _this.props, preventDismissOnEvent = _a3.preventDismissOnEvent, preventDismissOnLostFocus = _a3.preventDismissOnLostFocus;
31343 if (preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnLostFocus) _this._dismissOnClickOrScroll(ev);
31344 };
31345 _this._setInitialFocus = function() {
31346 if (_this.props.setInitialFocus && !_this._didSetInitialFocus && _this.state.positions && _this._calloutElement.current) {
31347 _this._didSetInitialFocus = true;
31348 _this._async.requestAnimationFrame(function() {
31349 return (0, _utilities.focusFirstChild)(_this._calloutElement.current);
31350 }, _this._calloutElement.current);
31351 }
31352 };
31353 _this._onComponentDidMount = function() {
31354 _this._addListeners();
31355 if (_this.props.onLayerMounted) _this.props.onLayerMounted();
31356 _this._updateAsyncPosition();
31357 _this._setHeightOffsetEveryFrame();
31358 };
31359 _this._dismissOnTargetWindowBlur = function(ev) {
31360 // eslint-disable-next-line deprecation/deprecation
31361 var _a4 = _this.props, preventDismissOnEvent = _a4.preventDismissOnEvent, preventDismissOnLostFocus = _a4.preventDismissOnLostFocus, shouldDismissOnWindowFocus = _a4.shouldDismissOnWindowFocus;
31362 // Do nothing
31363 if (!shouldDismissOnWindowFocus) return;
31364 if ((preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnLostFocus) && !_this._targetWindow.document.hasFocus() && ev.relatedTarget === null) _this.dismiss(ev);
31365 };
31366 _this._mouseDownOnPopup = function() {
31367 _this._isMouseDownOnPopup = true;
31368 };
31369 _this._mouseUpOnPopup = function() {
31370 _this._isMouseDownOnPopup = false;
31371 };
31372 _this._async = new (0, _utilities.Async)(_this);
31373 _this._didSetInitialFocus = false;
31374 _this.state = {
31375 positions: undefined,
31376 slideDirectionalClassName: undefined,
31377 // @TODO it looks like this is not even being used anymore.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected