New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ddata-ui-dialog

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddata-ui-dialog

This module has two components for handle dialogs easier in `ddata` world.

latest
npmnpm
Version
0.1.20
Version published
Maintainers
1
Created
Source

DData UI Dialog

This module has two components for handle dialogs easier in ddata world.

Modal dialog with component

If you want to show a component in dialog and then handle events in dialog, you should use this component.

Usage

HTML

<button (click)="showDialog = true">Show dialog</button>

<dd-modal-dialog
  title="My awesome dialog title"
  [model]="model"
  [dialogContent]="dialogContent"
  [showDialog]="showDialog"
  [overlayClickCloseDialog]="false"
  closeButtonText="Close"
  (success)="save()"
  (fail)="cancel()"
  ></dd-modal-dialog>

TypeScript

@Component({
  selector: 'app-awesome-component',
  templateUrl: './awesome.component.html',
  styleUrls: ['./awesome.component.scss']
})
export class AwesomeComponent implements OnInit {
  model: BaseModelInterface = new BaseModel(); // your model definition
  showDialog = false;
  dialogContent: DialogContentInterface = {
    createEditComponent: ProductCreateEditComponent,
    createEditOptions: {
      // ...
    },
    listComponent: ProductListComponent,
    listOptions: {
      // ...
    },
  };

  ngOnInit(): void {
    // ...
  }

  save(): void {
    // ...
    this.showDialog = false;
  }

  cancel(): void {
    this.showDialog = false;
  }
}

API

InputTypeDefaultDescription
titlestringempty stringTitle of the dialog.
modelBaseModelWithoutTypeDefinitionInterfacenew BaseModel()Model of the dialog.
dialogContentDialogContentItemnew DialogContentItem(DdataUiNoDataComponent, {})Dialog type. Can be message, delete, warning or any other string.
showDialogfalsefalseDialog is visible or not.
overlayClickCloseDialogbooleantrueThe ovrelay div is clickable or not. If clickable it cause a pressed event with false.
closeButtonTextstringCloseTitle text of the close button.
OutputTypeDescription
successEventEmitter<BaseModelWithoutTypeDefinitionInterface>Emit when user clicks on the success button (OK, Yes, Agree, Allow, etc.) in your component.
failEventEmitter<string>Emit when user clicks on any button. The emitted value is depends on user clicked on success button (value is true) or not (value is false).

DialogContentInterface

NameRequiredTypeDefaultDescription
saveModelnoObservable<any>nullYou can define a custom observable what is emit when user click on your component's save button.
selectnoObservable<any>nullYou can define a custom observable what is emit when user select an element in your list.
isModalnobooleanfalseSet true if this is a modal dialog.
multipleSelectEnablednobooleanfalseIf this is a list component, you can control single select or multiple select lists behavioir.
isSelectionListnobooleanfalseIf this is a list component, you can control this is a selectable list component.
selectedElementsnoany[][]Define previously selected models.
modelsnoany[][]Define preloaded models.
loadDatanobooleanfalseControl data loading when your component is showed in the dialog. Set false if you have preloaded models to list component.
filternoany{}Control your search/filter parameters on the listed models.
datasArrivednonumber0Set a random number is datas arrived from the backend on the parent component.

Confirm dialog

If you wan to open a simple confirm or message dialog to the user, you should to use this component.

Usage

HTML

<dd-confirm-dialog
  title="Are you sure?"
  content="Are you sure to delete this element?"
  type="delete"
  successButtonText="Delete"
  cancelButtonText="Cancel"
  closeButtonText="Close"
  [isModalVisible]="showDeleteDialog"
  [overlayClickCloseDialog]="false"
  (confirm)="deleteIsConfirmed()"
  (pressed)="buttonPressedOnDialog($event)"
  ></dd-confirm-dialog>

TypeScript

@Component({
  selector: 'app-awesome-component',
  templateUrl: './awesome.component.html',
  styleUrls: ['./awesome.component.scss']
})
export class AwesomeComponent implements OnInit {
  showDeleteDialog = false;

  ngOnInit(): void {
    // ...
  }

  deleteIsConfirmed(): void {
    // delete button pressed...
  }

  buttonPressedOnDialog(isConfirmed: boolean): void {
    if (isConfirmed) {
      // delete button pressed...
    } else {
      // cancel or close button pressed...
    }
  }
}

API

InputTypeDefaultDescription
titlestringempty stringTitle of the dialog.
contentstringempty stringContent of the dialog.
typeDialogTypemessageDialog type. Can be message, delete, warning or any other string.
showDialogbooleanfalseDialog is visible or not.
overlayClickCloseDialogbooleantrueThe ovrelay div is clickable or not. If clickable it cause a pressed event with false.
successButtonTextstringOKText on the success button.
cancelButtonTextstringCancelText on the cancel button.
closeButtonTextstringCloseTitle text of the close button.
OutputTypeDescription
confirmEventEmitter<any>Emit when user clicks on the success button (OK, Yes, Agree, Allow, etc.)
pressedEventEmitter<boolean>Emit when user clicks on any button. The emitted value is depends on user clicked on success button (value is true) or not (value is false).

FAQs

Package last updated on 26 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts