sequential-workflow-designer icon indicating copy to clipboard operation
sequential-workflow-designer copied to clipboard

Detecting step editor unmount

Open tskomudek opened this issue 1 year ago • 8 comments

Hi Bart,

when using a custom step editor in the react designer, i have the problem to loose the current changes in the form when the user accidentally clicks into the editor space and the stepeditor component gets unmounted.

I remember you wrote somewhere that this is currently not possible in the react version, but do you have an idea how to work around this ?

Thanks a lot

Tilo

tskomudek avatar Apr 07 '24 22:04 tskomudek

Hello @tskomudek,

basically you can always save the latest value in the step like:

<input type="text" ... onChange={e => setProperty('x', e.value)} />

So in the definition you will have allways the latest changes.

If you have a save step between changing values and applying them, then you can create a hidden property in the step, such as deltaX.

<input type="text" ... onChange={e => setProperty('deltaX', e.value)} />

During saving changes you need to move values to a final property (deltaX => x).

b4rtaz avatar Apr 08 '24 12:04 b4rtaz

@tskomudek have you resolved the problem?

b4rtaz avatar Apr 29 '24 21:04 b4rtaz

Not really. Yes, i can store the modified data somewhere, but i'd rather ask the user if he wants to navigate away from the current step without saving. Do you have any other idea how to achive this ?

Thx Tilo

tskomudek avatar Apr 30 '24 10:04 tskomudek

It looks like you need a canCloseEditor callback or something like this. Yeah, it's not available now.

Maybe a temporary solution would be to use the isSelectable callback 🤔, something like:

isSelectable: (step) => {
   if (hasUnsavedChanges()) return window.confirm('You have unsaved data in the editor...');
   // ...
}

b4rtaz avatar Apr 30 '24 21:04 b4rtaz

When i integrated sequential-workflow-designer-angular in my existing project in place of router outlet but its not getting initialised properly...svg not taking full height and toolbox not getting initialized 963066D4-C63D-4AE6-B37E-7D8205159105_1_201_a

I followed angular demo example -initialize with angular please let me know what could be the reason thanks a lot!!

ShraddhaFutrey avatar May 24 '24 11:05 ShraddhaFutrey

@ShraddhaFutrey it looks like the parent layers have not set any height constraints. The designer doesn't stretch parents, it adjusts to available space. You can check this theory by setting CSS:

.sqd-designer {height: 900px;}

BTW: please don't add comments to not related threads.

b4rtaz avatar May 24 '24 11:05 b4rtaz

Hi Bart,

the isSelectable callback would help partially, but it doesn´t cover when the user just clicks into the canvas and the root editor appears or the user drags a new step from the toolbox. An isUnselectable or canCloseEditor callback would be more suitable. Also, the onSelectedStepIdChanged event doesn't help here, since when it's called the stepeditor is already unmounted. Maybe its worth considering at least.

Thanks Tilo

tskomudek avatar Jul 31 '24 11:07 tskomudek

@tskomudek yes, this feature is planned but with a low priority. If you need this feature faster you can request it under the consulting service.

b4rtaz avatar Jul 31 '24 14:07 b4rtaz