office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
65 lines • 3.97 kB
JavaScript
define(["require", "exports", "tslib", "react", "office-ui-fabric-react/lib/Utilities", "office-ui-fabric-react/lib/Dialog", "office-ui-fabric-react/lib/Button", "office-ui-fabric-react/lib/Panel"], function (require, exports, tslib_1, React, Utilities_1, Dialog_1, Button_1, Panel_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelLightDismissCustomExample = /** @class */ (function (_super) {
tslib_1.__extends(PanelLightDismissCustomExample, _super);
function PanelLightDismissCustomExample(props) {
var _this = _super.call(this, props) || this;
_this.state = { showPanel: false, hideDialog: true };
return _this;
}
PanelLightDismissCustomExample.prototype.render = function () {
return (React.createElement("div", null,
React.createElement(Button_1.DefaultButton, { text: 'Open panel', onClick: this._showPanel }),
React.createElement(Panel_1.Panel, { isOpen: this.state.showPanel, isLightDismiss: true, headerText: 'Light Dismiss Panel', onDismiss: this._hidePanel, onLightDismissClick: this._showDialog },
React.createElement("span", null, "Light Dismiss usage is meant for the Contextual Menu on mobile sized breakpoints.")),
React.createElement(Dialog_1.Dialog, { hidden: this.state.hideDialog, onDismiss: this._closeDialog, dialogContentProps: {
type: Dialog_1.DialogType.normal,
title: 'Are you sure you want to close the panel?'
}, modalProps: {
titleAriaId: 'myLabelId',
subtitleAriaId: 'mySubTextId',
isBlocking: true,
containerClassName: 'ms-dialogMainOverride'
} },
null /** You can also include null values as the result of conditionals */,
React.createElement(Dialog_1.DialogFooter, null,
React.createElement(Button_1.PrimaryButton, { onClick: this._closeDialogAndHidePanel, text: 'Yes' }),
React.createElement(Button_1.DefaultButton, { onClick: this._closeDialog, text: 'No' })))));
};
PanelLightDismissCustomExample.prototype._showPanel = function () {
this.setState({ showPanel: true });
};
PanelLightDismissCustomExample.prototype._hidePanel = function () {
this.setState({ showPanel: false });
};
PanelLightDismissCustomExample.prototype._showDialog = function () {
this.setState({ hideDialog: false });
};
PanelLightDismissCustomExample.prototype._closeDialog = function () {
this.setState({ hideDialog: true });
};
PanelLightDismissCustomExample.prototype._closeDialogAndHidePanel = function () {
this._hidePanel();
this._closeDialog();
};
tslib_1.__decorate([
Utilities_1.autobind
], PanelLightDismissCustomExample.prototype, "_showPanel", null);
tslib_1.__decorate([
Utilities_1.autobind
], PanelLightDismissCustomExample.prototype, "_hidePanel", null);
tslib_1.__decorate([
Utilities_1.autobind
], PanelLightDismissCustomExample.prototype, "_showDialog", null);
tslib_1.__decorate([
Utilities_1.autobind
], PanelLightDismissCustomExample.prototype, "_closeDialog", null);
tslib_1.__decorate([
Utilities_1.autobind
], PanelLightDismissCustomExample.prototype, "_closeDialogAndHidePanel", null);
return PanelLightDismissCustomExample;
}(React.Component));
exports.PanelLightDismissCustomExample = PanelLightDismissCustomExample;
});
//# sourceMappingURL=Panel.LightDismissCustom.Example.js.map