saasufy-components 3.15.0 → 3.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/confirm-modal.js +5 -5
- package/overlay-modal.js +1 -0
- package/package.json +1 -1
- package/styles.css +13 -0
package/README.md
CHANGED
|
@@ -315,7 +315,8 @@ OR (with confirmation step)
|
|
|
315
315
|
**Attributes**
|
|
316
316
|
|
|
317
317
|
- `model-id` (required): Specifies the ID of the resource to delete from the parent collection when this component is activated. This can be achieved by invoking either the `deleteItem()` or `confirmDeleteItem()` function from inside an event handler. The example above shows how to achieve deletion via the `onclick` event. You can either invoke `deleteItem()` to delete the resource immediately or you can invoke `confirmDeleteItem()` to require additional confirmation prior to deletion.
|
|
318
|
-
- `
|
|
318
|
+
- `onclick` (required): The logic to execute to delete the item. Should be either `deleteItem()` or `confirmDeleteItem()`.
|
|
319
|
+
- `confirm-message`: The confirmation message to show the user when this component's `confirmDeleteItem()` function is invoked.
|
|
319
320
|
|
|
320
321
|
If `confirmDeleteItem()` is used, then the parent `collection-browser` must have a `confirm-modal` element slotted into it as shown here:
|
|
321
322
|
|
package/confirm-modal.js
CHANGED
|
@@ -24,7 +24,7 @@ class ConfirmModal extends HTMLElement {
|
|
|
24
24
|
show(message, confirmCallback) {
|
|
25
25
|
let overlayModal = this.querySelector('overlay-modal');
|
|
26
26
|
if (overlayModal) {
|
|
27
|
-
overlayModal.
|
|
27
|
+
overlayModal.removeAttribute('style');
|
|
28
28
|
}
|
|
29
29
|
this.confirmCallback = confirmCallback;
|
|
30
30
|
this.hidden = false;
|
|
@@ -38,7 +38,7 @@ class ConfirmModal extends HTMLElement {
|
|
|
38
38
|
let cancelButtonLabel = this.getAttribute('cancel-button-label') || 'Cancel';
|
|
39
39
|
|
|
40
40
|
this.innerHTML = `
|
|
41
|
-
<overlay-modal
|
|
41
|
+
<overlay-modal${this.hidden ? ' style="display: none;"' : ''}>
|
|
42
42
|
<div slot="title">${title}</div>
|
|
43
43
|
<div class="confirm-modal-content" slot="content">
|
|
44
44
|
<div>${message}</div>
|
|
@@ -52,16 +52,16 @@ class ConfirmModal extends HTMLElement {
|
|
|
52
52
|
|
|
53
53
|
let overlayModal = this.querySelector('overlay-modal');
|
|
54
54
|
overlayModal.addEventListener('close', () => {
|
|
55
|
-
overlayModal.
|
|
55
|
+
overlayModal.style.display = 'none';
|
|
56
56
|
});
|
|
57
57
|
let cancelButton = this.querySelector('.modal-cancel-button');
|
|
58
58
|
cancelButton.addEventListener('click', () => {
|
|
59
|
-
overlayModal.
|
|
59
|
+
overlayModal.style.display = 'none';
|
|
60
60
|
this.dispatchEvent(new CustomEvent('cancel'));
|
|
61
61
|
});
|
|
62
62
|
let confirmButton = this.querySelector('.modal-confirm-button');
|
|
63
63
|
confirmButton.addEventListener('click', () => {
|
|
64
|
-
overlayModal.
|
|
64
|
+
overlayModal.style.display = 'none';
|
|
65
65
|
this.dispatchEvent(new CustomEvent('confirm'));
|
|
66
66
|
this.confirmCallback && this.confirmCallback();
|
|
67
67
|
});
|
package/overlay-modal.js
CHANGED
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -178,6 +178,19 @@ collection-browser > [slot=next-page] {
|
|
|
178
178
|
width: auto;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
.confirm-modal-content {
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
align-items: center;
|
|
185
|
+
gap: 20px;
|
|
186
|
+
padding: 20px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.confirm-modal-buttons-container {
|
|
190
|
+
display: flex;
|
|
191
|
+
gap: 5px;
|
|
192
|
+
}
|
|
193
|
+
|
|
181
194
|
.container-vertical {
|
|
182
195
|
display: flex;
|
|
183
196
|
flex-direction: column;
|