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

Function OverflowSetBase1

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

Source from the content-addressed store, hash-verified

41750var OverflowSetBase = /** @class */ function(_super) {
41751 (0, _tslib.__extends)(OverflowSetBase1, _super);
41752 function OverflowSetBase1(props) {
41753 var _this = _super.call(this, props) || this;
41754 _this._focusZone = _react.createRef();
41755 _this._persistedKeytips = {};
41756 _this._keytipManager = (0, _keytipManager.KeytipManager).getInstance();
41757 _this._divContainer = _react.createRef();
41758 _this._onRenderItems = function(items) {
41759 return items.map(function(item, i) {
41760 return _react.createElement("div", {
41761 key: item.key,
41762 className: _this._classNames.item
41763 }, _this.props.onRenderItem(item));
41764 });
41765 };
41766 _this._onRenderOverflowButtonWrapper = function(items) {
41767 var wrapperDivProps = {
41768 className: _this._classNames.overflowButton
41769 };
41770 var overflowKeytipSequences = _this.props.keytipSequences;
41771 var newOverflowItems = [];
41772 if (overflowKeytipSequences) items.forEach(function(overflowItem) {
41773 var keytip = overflowItem.keytipProps;
41774 if (keytip) {
41775 // Create persisted keytip
41776 var persistedKeytip = {
41777 content: keytip.content,
41778 keySequences: keytip.keySequences,
41779 disabled: keytip.disabled || !!(overflowItem.disabled || overflowItem.isDisabled),
41780 hasDynamicChildren: keytip.hasDynamicChildren,
41781 hasMenu: keytip.hasMenu
41782 };
41783 if (keytip.hasDynamicChildren || _this._getSubMenuForItem(overflowItem)) // If the keytip has a submenu or children nodes, change onExecute to persistedKeytipExecute
41784 persistedKeytip.onExecute = _this._keytipManager.menuExecute.bind(_this._keytipManager, overflowKeytipSequences, overflowItem.keytipProps.keySequences);
41785 else // If the keytip doesn't have a submenu, just execute the original function
41786 persistedKeytip.onExecute = keytip.onExecute;
41787 // Add this persisted keytip to our internal list, use a temporary uniqueID (its content)
41788 // uniqueID will get updated on register
41789 _this._persistedKeytips[persistedKeytip.content] = persistedKeytip;
41790 // Add the overflow sequence to this item
41791 var newOverflowItem = (0, _tslib.__assign)((0, _tslib.__assign)({}, overflowItem), {
41792 keytipProps: (0, _tslib.__assign)((0, _tslib.__assign)({}, keytip), {
41793 overflowSetSequence: overflowKeytipSequences
41794 })
41795 });
41796 newOverflowItems.push(newOverflowItem);
41797 } else // Nothing to change, add overflowItem to list
41798 newOverflowItems.push(overflowItem);
41799 });
41800 else newOverflowItems = items;
41801 return _react.createElement("div", (0, _tslib.__assign)({}, wrapperDivProps), _this.props.onRenderOverflowButton(newOverflowItems));
41802 };
41803 (0, _utilities.initializeComponentRef)(_this);
41804 (0, _utilities.warnMutuallyExclusive)(COMPONENT_NAME, props, {
41805 doNotContainWithinFocusZone: "focusZoneProps"
41806 });
41807 return _this;
41808 }
41809 OverflowSetBase1.prototype.render = function() {

Callers

nothing calls this directly

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected