rails_modal_manager 1.0.25 → 1.0.27
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e919b275fd361881663b301cd23661d0ac6bb593c2798eb2a77b0bb231e4f4c1
|
|
4
|
+
data.tar.gz: 553fe6e5cc9235cd0c87997d07c630795893c235a79983416d8423d65a4f013d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18794e80fb189d47781ba21e1a673499f459cabcc835509c97d87748d5ad16781634a2341796b3e14c45f6442a0af1643b80c0a534dbf3075696bf690a785396
|
|
7
|
+
data.tar.gz: 2f26034a4577fba61a50ab77292203df2c2f4916f4b9dbe8b9879ea30e93baeae66b896dd75f23d73f9713e80cee0f8171fcb24dab7d50b93348a18b95891b84
|
|
@@ -28,6 +28,8 @@ export default class extends Controller {
|
|
|
28
28
|
collapsed: { type: Boolean, default: false },
|
|
29
29
|
// 모바일+최대화 상태에서의 사이드바 모드: 'expanded' | 'icons' | 'hidden'
|
|
30
30
|
sidebarMode: { type: String, default: 'icons' },
|
|
31
|
+
// 이미 선택된 항목을 다시 클릭했을 때 이벤트 발생 여부
|
|
32
|
+
refreshOnReselect: { type: Boolean, default: true },
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
connect() {
|
|
@@ -194,9 +196,31 @@ export default class extends Controller {
|
|
|
194
196
|
|
|
195
197
|
const item = e.currentTarget
|
|
196
198
|
const itemId = item.dataset.itemId
|
|
199
|
+
const isReselect = itemId === this.currentItemId
|
|
197
200
|
|
|
198
|
-
//
|
|
199
|
-
if (
|
|
201
|
+
// 이미 선택된 항목을 다시 클릭한 경우
|
|
202
|
+
if (isReselect) {
|
|
203
|
+
// refreshOnReselect가 false면 무시
|
|
204
|
+
if (!this.refreshOnReselectValue) {
|
|
205
|
+
return
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// 서브메뉴가 있는 경우 forceReloadActive 호출하여 콘텐츠 새로고침
|
|
209
|
+
const submenuId = item.dataset.submenuId
|
|
210
|
+
if (submenuId) {
|
|
211
|
+
this.triggerSubmenuReload(submenuId)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// 이벤트 발생
|
|
215
|
+
this.dispatch('itemSelect', {
|
|
216
|
+
detail: {
|
|
217
|
+
modalId: this.modalIdValue,
|
|
218
|
+
itemId: item.dataset.itemId,
|
|
219
|
+
itemLabel: item.dataset.itemLabel,
|
|
220
|
+
hasSubmenu: !!submenuId,
|
|
221
|
+
isReselect: true,
|
|
222
|
+
}
|
|
223
|
+
})
|
|
200
224
|
return
|
|
201
225
|
}
|
|
202
226
|
|
|
@@ -234,6 +258,7 @@ export default class extends Controller {
|
|
|
234
258
|
itemId: item.dataset.itemId,
|
|
235
259
|
itemLabel: item.dataset.itemLabel,
|
|
236
260
|
hasSubmenu: !!item.dataset.submenuId,
|
|
261
|
+
isReselect: false,
|
|
237
262
|
}
|
|
238
263
|
})
|
|
239
264
|
}
|
|
@@ -375,6 +400,29 @@ export default class extends Controller {
|
|
|
375
400
|
})
|
|
376
401
|
}
|
|
377
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Trigger submenu reload for reselected sidebar item
|
|
405
|
+
*/
|
|
406
|
+
triggerSubmenuReload(submenuId) {
|
|
407
|
+
const modal = this.element.closest('.rmm-modal')
|
|
408
|
+
if (!modal) return
|
|
409
|
+
|
|
410
|
+
const targetSubmenu = modal.querySelector(`#${submenuId}`)
|
|
411
|
+
if (!targetSubmenu) return
|
|
412
|
+
|
|
413
|
+
const submenuElement = targetSubmenu.querySelector('[data-controller*="rmm-submenu"]')
|
|
414
|
+
if (!submenuElement) return
|
|
415
|
+
|
|
416
|
+
const submenuController = this.application.getControllerForElementAndIdentifier(
|
|
417
|
+
submenuElement,
|
|
418
|
+
'rmm-submenu'
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
if (submenuController && typeof submenuController.forceReloadActive === 'function') {
|
|
422
|
+
submenuController.forceReloadActive()
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
378
426
|
/**
|
|
379
427
|
* Switch submenu group for reset (without triggering content reload)
|
|
380
428
|
* This version doesn't call forceReloadActive to avoid duplicate loads
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
modal_id: String - The modal ID
|
|
6
6
|
items: Array - Menu items [{id:, label:, icon_svg:, badge:, active:, disabled:, panel_id:, submenu_id:, title:}]
|
|
7
7
|
collapsed: Boolean - Initially collapsed (default: false)
|
|
8
|
+
refresh_on_reselect: Boolean - Dispatch event when clicking already selected item (default: true)
|
|
8
9
|
|
|
9
10
|
Item options:
|
|
10
11
|
- panel_id: ID of the content panel to show when selected
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
modal_id ||= ""
|
|
16
17
|
items ||= []
|
|
17
18
|
collapsed ||= false
|
|
19
|
+
refresh_on_reselect = true if local_assigns[:refresh_on_reselect].nil?
|
|
18
20
|
|
|
19
21
|
sidebar_classes = ["rmm-sidebar"]
|
|
20
22
|
sidebar_classes << "rmm-sidebar-collapsed" if collapsed
|
|
@@ -22,7 +24,8 @@
|
|
|
22
24
|
<div class="<%= sidebar_classes.join(' ') %>"
|
|
23
25
|
data-controller="rmm-sidebar"
|
|
24
26
|
data-rmm-sidebar-modal-id-value="<%= modal_id %>"
|
|
25
|
-
data-rmm-sidebar-collapsed-value="<%= collapsed %>"
|
|
27
|
+
data-rmm-sidebar-collapsed-value="<%= collapsed %>"
|
|
28
|
+
data-rmm-sidebar-refresh-on-reselect-value="<%= refresh_on_reselect %>">
|
|
26
29
|
<nav class="rmm-sidebar-nav" data-rmm-sidebar-target="nav">
|
|
27
30
|
<% items.each do |item| %>
|
|
28
31
|
<%
|