44 class =" w-100 h-100 position-relative"
55 role =" region"
66 tabindex =" 0"
7- :aria-label =" translate('WORKFLOW_CANVAS_REGION ')"
7+ :aria-label =" translate('COM_WORKFLOW_GRAPH_CANVAS_REGION ')"
88 ref =" canvasRegion"
99 >
1010 <VueFlow
3333 zoomable
3434 :node-color =" (node) => node.data?.stage?.color || '#0d6efd'"
3535 :mask-color =" 'rgba(255, 255, 255, 0.6)'"
36- :aria-label =" translate('WORKFLOW_GRAPH_MINIMAP ')"
36+ :aria-label =" translate('COM_WORKFLOW_GRAPH_MINIMAP ')"
3737 />
3838 <CustomControls aria-label =" Graph controls" />
3939 <ControlsPanel
4545 />
4646 </VueFlow >
4747
48+ <div id =" delete-dialog-template" >
49+ <div class =" p-3" >
50+ <p >{{ deleteModal.message }}</p >
51+ <div class =" d-flex justify-content-end gap-2 mt-3" >
52+ <button class =" btn btn-secondary" data-dialog-close >
53+ {{ translate('JCANCEL') }}
54+ </button >
55+ <button class =" btn btn-danger" data-dialog-confirm >
56+ {{ translate('DELETE') }}
57+ </button >
58+ </div >
59+ </div >
60+ </div >
61+
4862 <button
4963 ref =" ModalDialog"
5064 class =" d-none"
5165 data-joomla-dialog =" "
5266 data-checkin-url =" "
5367 data-close-on-message =" "
54- data-reload-on-close =" "
5568 aria-hidden =" true"
5669 ></button >
70+ <button
71+ ref =" deleteDialog"
72+ class =" d-none"
73+ data-joomla-dialog =" "
74+ aria-hidden =" true"
75+ />
5776
5877 <div ref =" liveRegion" aria-live =" polite" role =" status" class =" visually-hidden" ></div >
5978 </div >
60- <ConfirmModal
61- :visible =" deleteModal.visible"
62- :title =" deleteModal.title"
63- :message =" deleteModal.message"
64- :confirmText =" translate('DELETE')"
65- :cancelText =" translate('CANCEL')"
66- @confirm =" handleDeleteConfirm"
67- @cancel =" handleDeleteCancel"
68- />
6979</template >
7080
7181<script >
72- import { ref , computed , onMounted , onUnmounted , getCurrentInstance } from ' vue' ;
82+ import { ref , computed , onMounted , onUnmounted } from ' vue' ;
7383import { useStore } from ' vuex' ;
7484import { VueFlow , useVueFlow } from ' @vue-flow/core' ;
7585import { Background } from ' @vue-flow/background' ;
7686import { MiniMap } from ' @vue-flow/minimap' ;
7787import stageNode from ' ../nodes/StageNode.vue' ;
7888import customEdge from ' ../edges/CustomEdge.vue' ;
7989import CustomControls from ' ./CustomControls.vue' ;
80- import ConfirmModal from ' ../modals/ConfirmModal.vue' ;
8190import ControlsPanel from ' ./ControlsPanel.vue' ;
8291import { announce , setupDialogFocusHandlers } from ' ../utils/focus-utils.js' ;
8392import { generatePositionedNodes , createSpecialNode } from ' ../utils/positioning.js' ;
@@ -92,7 +101,6 @@ export default {
92101 Background,
93102 MiniMap,
94103 CustomControls,
95- ConfirmModal,
96104 ControlsPanel
97105 },
98106 props: {
@@ -110,14 +118,13 @@ export default {
110118 setup () {
111119 const store = useStore ();
112120 const { fitView ,zoomIn , zoomOut , viewport } = useVueFlow ();
113- const instance = getCurrentInstance ();
114- const translate = instance? .proxy ? .$translate || ((x ) => x);
115121
116122 const isTransitionMode = ref (false );
117123 const selectedStage = ref (null );
118124 const selectedTransition = ref (null );
119125 const liveRegion = ref (null );
120126 const ModalDialog = ref (null );
127+ const deleteDialog = ref (null );
121128 const saveStatus = ref (' upToDate' );
122129 const previouslyFocusedElement = ref (null );
123130 const deleteModal = ref ({ visible: false , type: ' ' , id: null , title: ' ' , message: ' ' });
@@ -156,6 +163,10 @@ export default {
156163 }
157164 })));
158165
166+ function translate (key ){
167+ return Joomla .Text ._ (key);
168+ }
169+
159170 function selectStage (id ) {
160171 selectedStage .value = parseInt (id);
161172 selectedTransition .value = null ;
@@ -171,19 +182,19 @@ export default {
171182 function clearSelection () { selectedStage .value = null ; selectedTransition .value = null ; }
172183 function addStage () {
173184 openModal (' stage' );
174- announce (liveRegion .value , translate (' WORKFLOW_GRAPH_ADD_STAGE_DIALOG_OPENED ' ));
185+ announce (liveRegion .value , translate (' COM_WORKFLOW_GRAPH_ADD_STAGE_DIALOG_OPENED ' ));
175186 }
176187 function addTransition () {
177188 openModal (' transition' );
178- announce (liveRegion .value , translate (' WORKFLOW_GRAPH_ADD_TRANSITION_DIALOG_OPENED ' ));
189+ announce (liveRegion .value , translate (' COM_WORKFLOW_GRAPH_ADD_TRANSITION_DIALOG_OPENED ' ));
179190 }
180191 function toggleTransitionMode () {
181192 isTransitionMode .value = ! isTransitionMode .value ;
182193 announce (
183194 liveRegion .value ,
184195 isTransitionMode .value
185- ? translate (' WORKFLOW_GRAPH_TRANSITION_MODE_ON ' )
186- : translate (' WORKFLOW_GRAPH_TRANSITION_MODE_OFF ' )
196+ ? translate (' COM_WORKFLOW_GRAPH_TRANSITION_MODE_ON ' )
197+ : translate (' COM_WORKFLOW_GRAPH_TRANSITION_MODE_OFF ' )
187198 );
188199 }
189200
@@ -192,9 +203,20 @@ export default {
192203 visible: true ,
193204 type,
194205 id,
195- title: translate (type === ' stage' ? ' DELETE_STAGE_TITLE ' : ' DELETE_TRANSITION_TITLE ' ),
196- message: translate (type === ' stage' ? ' DELETE_STAGE_CONFIRM ' : ' DELETE_TRANSITION_CONFIRM ' )
206+ title: translate (type === ' stage' ? ' COM_WORKFLOW_GRAPH_DELETE_STAGE_TITLE ' : ' COM_WORKFLOW_GRAPH_DELETE_TRANSITION_TITLE ' ),
207+ message: translate (type === ' stage' ? ' COM_WORKFLOW_GRAPH_DELETE_STAGE_CONFIRM ' : ' COM_WORKFLOW_GRAPH_DELETE_TRANSITION_CONFIRM ' )
197208 };
209+
210+ const popupOptions = {
211+ src: ` #delete-dialog-template` ,
212+ width: ' 800px' ,
213+ height: ' fit-content' ,
214+ textHeader: deleteModal .value .title ,
215+ preferredParent: ' body'
216+ };
217+
218+ deleteDialog? .value .setAttribute (' data-joomla-dialog' , JSON .stringify (popupOptions));
219+ deleteDialog? .value .click ();
198220 }
199221 function handleDeleteConfirm () {
200222 if (deleteModal .value .type === ' stage' ) deleteStage (deleteModal .value .id .toString ());
@@ -217,10 +239,10 @@ export default {
217239 if (! el) return ;
218240 if (saveStatus .value === ' unsaved' ) {
219241 el .classList .add (' text-warning' );
220- el .textContent = translate (' WORKFLOW_GRAPH_UNSAVED_CHANGES ' );
242+ el .textContent = translate (' COM_WORKFLOW_GRAPH_UNSAVED_CHANGES ' );
221243 } else {
222244 el .classList .remove (' text-warning' );
223- el .textContent = translate (' WORKFLOW_GRAPH_UP_TO_DATE ' );
245+ el .textContent = translate (' COM_WORKFLOW_GRAPH_UP_TO_DATE ' );
224246 }
225247 }
226248 async function handleNodeDragStop ({ node }) {
@@ -304,6 +326,13 @@ export default {
304326 saveNodePosition,
305327 store,
306328 });
329+ document .addEventListener (' joomla:confirm' , (e ) => {
330+ if (e .detail .confirm && deleteModal .value .visible ) {
331+ handleDeleteConfirm ();
332+ }
333+ deleteModal .value .visible = false ;
334+ });
335+
307336 onUnmounted (detach);
308337 });
309338
@@ -313,6 +342,7 @@ export default {
313342 positionedNodes,
314343 styledEdges,
315344 ModalDialog,
345+ deleteDialog,
316346 liveRegion,
317347 deleteModal,
318348 isTransitionMode,
0 commit comments