@microsoft/sp-dialog
Version:
SharePoint Framework support for displaying dialog boxes
53 lines • 2.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var office_ui_fabric_react_bundle_1 = require("@ms/office-ui-fabric-react-bundle");
require("./Placeholder.global.scss");
/**
* Component used to display place holder content in the web part display area.
* sealed
* @internal
*/
var PlaceholderSpinner = /** @class */ (function (_super) {
tslib_1.__extends(PlaceholderSpinner, _super);
function PlaceholderSpinner(props) {
var _this = _super.call(this, props) || this;
_this.showSpinner = _this.showSpinner.bind(_this);
_this.state = { showSpinner: !props.hideSpinner };
return _this;
}
PlaceholderSpinner.prototype.componentDidMount = function () {
this._isMounted = true;
};
/**
* Render the place holder user experience.
*/
PlaceholderSpinner.prototype.render = function () {
if (this.state.removePlaceholder) {
// Don't use undefined, react does not work
return null;
}
return (React.createElement(office_ui_fabric_react_bundle_1.Overlay, { className: 'Placeholder-overlay' },
React.createElement("div", { className: 'Placeholder-spinnerContainer' }, this.state.showSpinner && React.createElement(office_ui_fabric_react_bundle_1.Spinner, { type: office_ui_fabric_react_bundle_1.SpinnerType.large, label: this.props.label }))));
};
PlaceholderSpinner.prototype.componentWillUnmount = function () {
this._isMounted = false;
};
PlaceholderSpinner.prototype.showSpinner = function (showSpinner) {
if (this._isMounted) {
this.setState({ showSpinner: showSpinner });
}
};
/**
* Get rid of the placeholder completely from the DOM tree
*/
PlaceholderSpinner.prototype.clearPlaceholder = function () {
if (this._isMounted) {
this.setState({ removePlaceholder: true });
}
};
return PlaceholderSpinner;
}(React.Component));
exports.default = PlaceholderSpinner;
//# sourceMappingURL=PlaceholderSpinner.js.map