All files / platform/core/src/services/UIViewportDialogService UIViewportDialogService.ts

86.66% Statements 13/15
66.66% Branches 2/3
71.42% Functions 5/7
84.61% Lines 11/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53    34x           34x                   34x 34x           19x                         17x       68x 68x   68x 68x     34x      
import { PubSubService } from '../_shared/pubSubServiceInterface';
 
class UIViewportDialogService extends PubSubService {
  public static readonly EVENTS = {};
  public static REGISTRATION = {
    name: 'uiViewportDialogService',
    altName: 'UIViewportDialogService',
    create: ({ configuration = {} }) => {
      return new UIViewportDialogService();
    },
  };
 
  serviceImplementation = {
    _hide: () => console.warn('hide() NOT IMPLEMENTED'),
    _show: () => console.warn('show() NOT IMPLEMENTED'),
  };
 
  constructor() {
    super(UIViewportDialogService.EVENTS);
    this.serviceImplementation = {
      ...this.serviceImplementation,
    };
  }
 
  public show({ viewportId, id, type, message, actions, onSubmit, onOutsideClick, onKeyPress }) {
    return this.serviceImplementation._show({
      viewportId,
      id,
      type,
      message,
      actions,
      onSubmit,
      onOutsideClick,
      onKeyPress,
    });
  }
 
  public hide() {
    return this.serviceImplementation._hide();
  }
 
  public setServiceImplementation({ hide: hideImplementation, show: showImplementation }) {
    if (hideImplementation) {
      this.serviceImplementation._hide = hideImplementation;
    }
    if (showImplementation) {
      this.serviceImplementation._show = showImplementation;
    }
  }
}
 
export default UIViewportDialogService;