import { override } from '@microsoft/decorators' ; import { Log } from '@microsoft/sp-core-library' ; import { BaseListViewCommandSet , Command , IListViewCommandSetListViewUpdatedParameters , IListViewCommandSetExecuteEventParameters } from '@microsoft/sp-listview-extensibility' ; import PageModelDialog from './components/PageModelDialog' ; import { setup as pnpSetup } from "@pnp/common" ; /**
 * 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 ImodernPageModelCommandSetProperties { } const LOG_SOURCE = 'modernPageModelCommandSet' ; export default class modernPageModelCommandSet extends BaseListViewCommandSet < ImodernPageModelCommandSetProperties > { @ override public onInit ( ) { Log . info ( LOG_SOURCE , 'Initialized modernPageModelCommandSet' ) ; return super . onInit ( ) . then ( _ => { pnpSetup ( { spfxContext : this . context } ) ; } ) ; } @ override public onListViewUpdated ( event ) { } @ override public async onExecute ( event ) { switch ( event . itemId ) { case 'COMMAND_1' : const dialog = new PageModelDialog ( ) ; dialog . show ( ) ; break ; default : throw new Error ( 'Unknown command' ) ; } } }