-
v0.22.0 Stable
released this
2026-09-16 01:19:41 +00:00 | 95 commits to main since this releaseAdded
RecordFormtracks whether the record has unsaved edits.baselineis
the last saved state; without one the firstmodelValuethe form sees
stands in, so a create form is clean until the first edit.dirtyis a
structural comparison ofmodelValueagainst that baseline
(isEqualRecordinutils/cms, so key order does not matter), always
falseinreadonlymode, emitted asupdate:dirtyforv-model:dirty
and exposed on the component instance. Consumers setbaselineto a clone
of the model after load and after a successful save, before navigating.useUnsavedChanges(dirty)(@[secure]/ui/composables/useUnsavedChanges)
turns that flag into a leave guard: while dirty,beforeunloadhas the
browser confirm a reload or tab close, and a vue-routeronBeforeRouteLeave
guard asks throughconfirmLeave(), which resolvestrueat once when
clean and otherwise raisespendinguntilresolve(leave)answers it. The
consumer bindspendingto anAlertDialogand answers with
resolve(true)on confirm,resolve(false)on cancel; a second question
while one is pending shares its promise. Requires the optionalvue-router
peer dependency, likeuseUrlTab.
Downloads
-
Source code (ZIP)
0 downloads
-
Source code (TAR.GZ)
0 downloads