rails_modal_manager 1.0.10 → 1.0.12
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 +4 -4
- data/README.md +18 -1
- data/app/javascript/rails_modal_manager/controllers/rmm_sidebar_controller.js +25 -11
- data/app/javascript/rails_modal_manager/controllers/rmm_submenu_controller.js +18 -2
- data/app/javascript/rails_modal_manager/index.js +13 -3
- data/lib/rails_modal_manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3731afb3a3d006cd6256e0e19780bb24e433153ca2f459807137ef52e0cfaf7
|
|
4
|
+
data.tar.gz: 6acd94d81d76b5490185a8675b8ddacd3a2759fe5f039f765ed23e31f17d4020
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e81f5871bc33494bd283ac5adb41ca84571bfb9e3f9a23597e8a1b37ab1dfd62cd4033958030d2aaca80becc305593a68a0762d92d3d88c394d3ae80b693e22d
|
|
7
|
+
data.tar.gz: d87f1982e1dd5cb3df4c50f3ceea6a9fe1605ea789711528a89e942de5533d25fbdb8673d55a2d4b2e06ebc3305d9aeed27f58307c285887135f20bb873dd1ea
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Rails 애플리케이션을 위한 고급 모달 매니저입니다.
|
|
4
4
|
`@reshacs/react-modal-manager`에서 포팅되었습니다.
|
|
5
5
|
|
|
6
|
-
**Version:** 1.0.
|
|
6
|
+
**Version:** 1.0.12
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -784,3 +784,20 @@ MIT License
|
|
|
784
784
|
## 기여
|
|
785
785
|
|
|
786
786
|
버그 리포트와 기능 제안은 GitHub Issues를 이용해주세요.
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
## 변경 이력
|
|
791
|
+
|
|
792
|
+
### v1.0.12
|
|
793
|
+
|
|
794
|
+
- **최소화된 모달 자동 복원**: `openModal()` 호출 시 해당 모달이 이미 열려있고 최소화된 상태라면 자동으로 복원되도록 개선
|
|
795
|
+
|
|
796
|
+
### v1.0.11
|
|
797
|
+
|
|
798
|
+
- **사이드바-서브메뉴 AJAX 연동 개선**: 사이드바 메뉴 전환 시 활성화된 서브메뉴의 콘텐츠가 자동으로 로드되도록 개선
|
|
799
|
+
- **서브메뉴 컨트롤러에 `forceReloadActive()` 메서드 추가**: 외부에서 현재 활성 탭의 콘텐츠를 강제로 다시 로드할 수 있는 메서드 추가
|
|
800
|
+
|
|
801
|
+
### v1.0.10
|
|
802
|
+
|
|
803
|
+
- 초기 안정화 버전
|
|
@@ -154,22 +154,36 @@ export default class extends Controller {
|
|
|
154
154
|
if (targetSubmenu) {
|
|
155
155
|
targetSubmenu.classList.add('rmm-submenu-group-active')
|
|
156
156
|
|
|
157
|
-
//
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
const activeSubmenuItem =
|
|
157
|
+
// Find the submenu controller element
|
|
158
|
+
const submenuElement = targetSubmenu.querySelector('[data-controller*="rmm-submenu"]')
|
|
159
|
+
if (submenuElement) {
|
|
160
|
+
const activeSubmenuItem = submenuElement.querySelector('.rmm-submenu-item.rmm-active')
|
|
161
|
+
|
|
161
162
|
if (!activeSubmenuItem) {
|
|
162
|
-
|
|
163
|
+
// No active item - click the first one
|
|
164
|
+
const firstItem = submenuElement.querySelector('.rmm-submenu-item')
|
|
163
165
|
if (firstItem) {
|
|
164
166
|
firstItem.click()
|
|
165
167
|
}
|
|
166
168
|
} else {
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
// Active item exists - trigger content reload
|
|
170
|
+
// Get the Stimulus controller instance and call forceReloadActive
|
|
171
|
+
const submenuController = this.application.getControllerForElementAndIdentifier(
|
|
172
|
+
submenuElement,
|
|
173
|
+
'rmm-submenu'
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
if (submenuController && typeof submenuController.forceReloadActive === 'function') {
|
|
177
|
+
// Use the new forceReloadActive method
|
|
178
|
+
submenuController.forceReloadActive()
|
|
179
|
+
} else {
|
|
180
|
+
// Fallback: handle preload mode panel switching
|
|
181
|
+
const panelId = activeSubmenuItem.dataset.panelId
|
|
182
|
+
if (panelId) {
|
|
183
|
+
modal.querySelectorAll('.rmm-tab-panel').forEach(p => p.classList.remove('rmm-tab-panel-active'))
|
|
184
|
+
const panel = modal.querySelector(`#${panelId}`)
|
|
185
|
+
if (panel) panel.classList.add('rmm-tab-panel-active')
|
|
186
|
+
}
|
|
173
187
|
}
|
|
174
188
|
}
|
|
175
189
|
}
|
|
@@ -55,9 +55,10 @@ export default class extends Controller {
|
|
|
55
55
|
selectItem(e) {
|
|
56
56
|
const item = e.currentTarget
|
|
57
57
|
const itemId = item.dataset.itemId
|
|
58
|
+
const forceReload = e.detail?.forceReload || false
|
|
58
59
|
|
|
59
|
-
// Skip if already active
|
|
60
|
-
if (itemId === this.currentItemId) {
|
|
60
|
+
// Skip if already active (unless force reload is requested)
|
|
61
|
+
if (itemId === this.currentItemId && !forceReload) {
|
|
61
62
|
return
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -88,6 +89,21 @@ export default class extends Controller {
|
|
|
88
89
|
})
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Force reload the active submenu item's content
|
|
94
|
+
* Called by sidebar controller when switching sidebar items
|
|
95
|
+
*/
|
|
96
|
+
forceReloadActive() {
|
|
97
|
+
const activeItem = this.element.querySelector('.rmm-submenu-item.rmm-active')
|
|
98
|
+
if (activeItem) {
|
|
99
|
+
if (this.loadModeValue === 'ajax') {
|
|
100
|
+
this.loadAjaxContent(activeItem)
|
|
101
|
+
} else {
|
|
102
|
+
this.switchPanel(activeItem)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
91
107
|
/**
|
|
92
108
|
* Preload mode: Switch between pre-rendered panels
|
|
93
109
|
*/
|
|
@@ -80,14 +80,24 @@ export function initGlobalClickHandler() {
|
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Open a modal by ID
|
|
83
|
+
* If the modal is already open but minimized, it will be restored instead
|
|
83
84
|
* @param {string} modalId - The modal's ID
|
|
84
85
|
*/
|
|
85
86
|
export function openModal(modalId) {
|
|
86
87
|
const modalElement = document.getElementById(modalId)
|
|
87
|
-
if (modalElement)
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (!modalElement) return
|
|
89
|
+
|
|
90
|
+
// Check if the modal is already open and minimized
|
|
91
|
+
const config = modalStore.getModalConfig(modalId)
|
|
92
|
+
if (config && config.isMinimized) {
|
|
93
|
+
// Restore the minimized modal
|
|
94
|
+
modalStore.restoreModalGroup(modalId)
|
|
95
|
+
return
|
|
90
96
|
}
|
|
97
|
+
|
|
98
|
+
// Open the modal normally
|
|
99
|
+
modalElement.setAttribute('data-rmm-modal-open-value', 'true')
|
|
100
|
+
modalElement.dispatchEvent(new CustomEvent('rmm:open'))
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
/**
|