-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1298 from swissgeol/GSNGM-1161_geoms_remove_confi…
…rmation Geometries | confirmation of delete
- Loading branch information
Showing
12 changed files
with
109 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import {html, PropertyValues} from 'lit'; | ||
import {customElement, property} from 'lit/decorators.js'; | ||
import $ from '../jquery.js'; | ||
import {LitElementI18n} from '../i18n.js'; | ||
|
||
import 'fomantic-ui-css/components/dimmer.js'; | ||
import 'fomantic-ui-css/components/modal.js'; | ||
|
||
@customElement('ngm-confirmation-modal') | ||
export class NgmConfirmationModal extends LitElementI18n { | ||
@property({type: Boolean}) | ||
accessor show = false; | ||
@property({type: Object}) | ||
accessor text: {title: string, description: string, cancelBtn: string, confirmBtn: string} | undefined; | ||
element: HTMLElement & {modal: (key: string) => void} | undefined; | ||
|
||
firstUpdated(_changedProperties: PropertyValues) { | ||
this.element = $(this.querySelector('.ngm-confirmation-modal.ui.modal')).modal({ | ||
centered: true, | ||
onHidden: () => this.show = false, | ||
onApprove: () => this.dispatchEvent(new CustomEvent('onModalConfirmation', {bubbles: true})) | ||
}); | ||
super.firstUpdated(_changedProperties); | ||
} | ||
|
||
updated(changedProperties: PropertyValues) { | ||
if (this.element) { | ||
if (changedProperties.has('show') && this.show) { | ||
this.element.modal('show'); | ||
} else if (!this.show) { | ||
this.element.modal('hide'); | ||
} | ||
} | ||
super.updated(changedProperties); | ||
} | ||
|
||
render() { | ||
if (!this.text) { | ||
this.show = false; | ||
return ''; | ||
} | ||
return html` | ||
<div class="ngm-confirmation-modal ui small modal"> | ||
<div class="content"> | ||
<h3>${this.text.title}</h3> | ||
<p>${this.text.description}</p> | ||
</div> | ||
<div class="actions"> | ||
<div class="ui cancel button ngm-cancel-btn"> | ||
${this.text.cancelBtn} | ||
</div> | ||
<div class="ui ok button ngm-action-btn"> | ||
${this.text.confirmBtn} | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
|
||
createRenderRoot() { | ||
// no shadow dom | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
.ngm-gst-modal.ui.modal embed, | ||
.ngm-delete-warning-modal embed { | ||
.ngm-confirmation-modal embed { | ||
width: 100%; | ||
height: 500px; | ||
} | ||
|
||
.ngm-gst-modal .actions, | ||
.ngm-delete-warning-modal .actions { | ||
.ngm-confirmation-modal .actions { | ||
display: flex; | ||
justify-content: end; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters