import { override } from '@microsoft/decorators' ; import { Log } from '@microsoft/sp-core-library' ; import { BaseListViewCommandSet , Command , IListViewCommandSetListViewUpdatedParameters , IListViewCommandSetExecuteEventParameters , RowAccessor } from '@microsoft/sp-listview-extensibility' ; /**
 * If your command set uses the ClientSideComponentProperties JSON input,
 * it will be deserialized into the BaseExtension.properties object.
 * You can define an interface to describe it.
 */ export interface IReactCmdSharePnPJsCommandSetProperties { } const LOG_SOURCE = 'ReactCmdSharePnPJsCommandSet' ; export default class ReactCmdSharePnPJsCommandSet extends BaseListViewCommandSet < IReactCmdSharePnPJsCommandSetProperties > { @ override public onInit ( ) { Log . info ( LOG_SOURCE , 'Initialized ReactCmdSharePnPJsCommandSet' ) ; return Promise . resolve ( ) ; } @ override public onListViewUpdated ( event ) { const shareCommand = this . tryGetCommand ( 'SHARE' ) ; if ( shareCommand ) { shareCommand . visible = event . selectedRows . length > 1 ; } } @ override public async onExecute ( event ) { switch ( event . itemId ) { case 'SHARE' : const rows = event . selectedRows ; const component = await import ( './components/MultiShareDialog' ) ; const dialog = new component . MultiShareDialog ; dialog . listItems = rows ; dialog . show ( ) ; break ; default : throw new Error ( 'Unknown command' ) ; } } }