Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

dialog

A modal save / load file picker: the same two-pane Explorer (Z.fs.explorer) inside a Z.modal, plus a filename field (save mode) and Open/Save + Cancel buttons. The panel and the dialog share one Explorer and one controller, so navigating feels identical in both.

Stateless builder: pass the controller model and the dialog options; the host owns open, the filename string, and the confirm/cancel wiring. The module returns the builder function directly.

Builder

build(model, opts?) -> widget node (a Z.modal tree; renders nothing when open is false).

  • model — the Z.fs.controller.model(slot) result for the dialog's own controller slot.
  • opts (DialogOpts) — prefix (callback prefix, default "fsdlg"), open (modal visibility, host-owned), title, mode ("save" for a filename field, "open" default), filename (save-mode field value), confirmLabel (defaults to "Save"/"Open" by mode), width (default 640), height (default 460), treeFrac, id.

Callbacks

Beyond the Explorer's <prefix>-* navigation:

  • <prefix>-filename — filename field changed (value in the event payload)
  • <prefix>-confirm — Open/Save pressed
  • <prefix>-cancel — Cancel pressed or the modal dismissed

Usage

-- host state: state.dlg = {} (controller slot), open, filename
Z.fs.dialog(Z.fs.controller.model(state.dlg), {
    prefix = "savedlg", open = state.open, mode = "save",
    title = "Save Layout", filename = state.filename,
    confirmLabel = "Save",
})
-- host onCallback:
--   Z.fs.controller.handle(state.dlg, "savedlg", cb, data)  -- navigation
--   "savedlg-filename" → state.filename = Z.eventValue(data)
--   "savedlg-confirm"  → path = Z.fs.controller.confirmTarget(state.dlg, "save", state.filename)
--   "savedlg-cancel"   → state.open = false