MCPcopy Index your code
hub / github.com/microsoft/SandDance / BaseButton1

Function BaseButton1

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

Source from the content-addressed store, hash-verified

19555 */ var BaseButton = /** @class */ function(_super) {
19556 (0, _tslib.__extends)(BaseButton1, _super);
19557 function BaseButton1(props1) {
19558 var _this = _super.call(this, props1) || this;
19559 _this._buttonElement = _react.createRef();
19560 _this._splitButtonContainer = _react.createRef();
19561 _this._mergedRef = (0, _utilities.createMergedRef)();
19562 _this._renderedVisibleMenu = false;
19563 _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) {
19564 return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), {
19565 hasMenu: true
19566 });
19567 });
19568 _this._onRenderIcon = function(buttonProps, defaultRender) {
19569 var iconProps = _this.props.iconProps;
19570 if (iconProps && (iconProps.iconName !== undefined || iconProps.imageProps)) {
19571 var className = iconProps.className, imageProps = iconProps.imageProps, rest = (0, _tslib.__rest)(iconProps, [
19572 "className",
19573 "imageProps"
19574 ]);
19575 // If the styles prop is specified as part of iconProps, fall back to regular Icon as FontIcon and ImageIcon
19576 // do not have this prop.
19577 if (iconProps.styles) return _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({
19578 className: (0, _utilities.css)(_this._classNames.icon, className),
19579 imageProps: imageProps
19580 }, rest));
19581 if (iconProps.iconName) return _react.createElement((0, _icon.FontIcon), (0, _tslib.__assign)({
19582 className: (0, _utilities.css)(_this._classNames.icon, className)
19583 }, rest));
19584 if (imageProps) return _react.createElement((0, _icon.ImageIcon), (0, _tslib.__assign)({
19585 className: (0, _utilities.css)(_this._classNames.icon, className),
19586 imageProps: imageProps
19587 }, rest));
19588 }
19589 return null;
19590 };
19591 _this._onRenderTextContents = function() {
19592 var _a = _this.props, text = _a.text, children = _a.children, // eslint-disable-next-line deprecation/deprecation
19593 _b = _a.secondaryText, // eslint-disable-next-line deprecation/deprecation
19594 secondaryText = _b === void 0 ? _this.props.description : _b, _c = _a.onRenderText, onRenderText = _c === void 0 ? _this._onRenderText : _c, _d = _a.onRenderDescription, onRenderDescription = _d === void 0 ? _this._onRenderDescription : _d;
19595 if (text || typeof children === "string" || secondaryText) return _react.createElement("span", {
19596 className: _this._classNames.textContainer
19597 }, onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription));
19598 return [
19599 onRenderText(_this.props, _this._onRenderText),
19600 onRenderDescription(_this.props, _this._onRenderDescription)
19601 ];
19602 };
19603 _this._onRenderText = function() {
19604 var text = _this.props.text;
19605 var children = _this.props.children;
19606 // For backwards compat, we should continue to take in the text content from children.
19607 if (text === undefined && typeof children === "string") text = children;
19608 if (_this._hasText()) return _react.createElement("span", {
19609 key: _this._labelId,
19610 className: _this._classNames.label,
19611 id: _this._labelId
19612 }, text);
19613 return null;
19614 };

Callers

nothing calls this directly

Calls 3

focusMethod · 0.45
onClickMethod · 0.45
stopPropagationMethod · 0.45

Tested by

no test coverage detected