Liking cljdoc? Tell your friends :D

workflo.macros.view


+view-config+cljs

source

+view-registry+cljs

source

anonymous-fnclj

(anonymous-fn {:keys [form-args form-body]})

Make a function f anonymous by replacing its name with fn.

Make a function f anonymous by replacing its name with fn.
sourceraw docstring

bind-commandsclj

(bind-commands {:keys [form-body form-args] :as f} command-fns)

Wraps the body of a function in a let that makes the view commands available to the body via their names.

Wraps the body of a function in a let that makes the
view commands available to the body via their names.
sourceraw docstring

bind-query-resultclj

(bind-query-result {:keys [form-body form-args] :as f}
                   props-query
                   computed-query)

Wraps the body of a function, binding the values in props and computed props to the names used in the view query and computed query.

Wraps the body of a function, binding the values in
props and computed props to the names used in the
view query and computed query.
sourceraw docstring

commands-form?clj

(commands-form? {:keys [form-name]})

Returns true if the input form is a declaration of view commands.

Returns true if the input form is a declaration of view
commands.
sourceraw docstring

configure-views!cljs

(configure-views! options)
source

default-run-command!cljs

(default-run-command! cmd-name view params reads)

Default command handler, generating an Om Next transaction with a mutation and queries that correspond 1:1 to the command, its parameters and the optional reads.

Default command handler, generating an Om Next transaction
with a mutation and queries that correspond 1:1 to the
command, its parameters and the optional reads.
sourceraw docstring

defviewclj/smacro

(defview name & forms)

Create a new view with the given name.

Takes an optional query, an optional computed properties "query" and an arbitrary number of Om Next component functions (such as ident, query, query-params, initLocalState or render) and JavaScript object methods, without requiring their protocols or argument bindings (like [this] or [props]) to be included in the definition.

defview will wrap the function bodies of all instance functions (ident, render, lifecycle functions, any object methods) so that the values in the query result and in computed properties are bound to the names appearing in the queries.

Usage:

(defview User
  [name email address [street city zipcode]]
  [clicked-fn]
  (key name)
  (validate ...)
  (ident [:user/by-name name])
  (render
    (html
      [:div.user {:onClick clicked-fn}
       [:h2 name "(" email ")"]
       [:ul.address
        [:li street]
        [:li city]
        [:li zipcode]]])))

The above example would define the following:

  • an Om Next component called User,
  • a component factory called user, with a :keyfn, derived from (key ...), and a :validator, derived from (validate ...).

If the query includes [db [id]], corresponding to the Om Next query attribute :db/id, it is assumed that the view represents data from DataScript or Datomic. In this case, defview will automatically infer (ident ...) and (key ...) functions based on the database ID. This behavior can be overriden by specifically defining both, ident and key.

Create a new view with the given name.

Takes an optional query, an optional computed properties "query"
and an arbitrary number of Om Next component functions (such
as `ident`, `query`, `query-params`, `initLocalState` or `render`)
and JavaScript object methods, without requiring their protocols or
argument bindings (like `[this]` or `[props]`) to be included in
the definition.

`defview` will wrap the function bodies of all instance functions
(`ident`, `render`, lifecycle functions, any object methods) so that
the values in the query result and in computed properties are bound
to the names appearing in the queries.

Usage:

```
(defview User
  [name email address [street city zipcode]]
  [clicked-fn]
  (key name)
  (validate ...)
  (ident [:user/by-name name])
  (render
    (html
      [:div.user {:onClick clicked-fn}
       [:h2 name "(" email ")"]
       [:ul.address
        [:li street]
        [:li city]
        [:li zipcode]]])))
```

The above example would define the following:

  * an Om Next component called `User`,
  * a component factory called `user`, with a `:keyfn`,
    derived from `(key ...)`, and a `:validator`, derived
    from `(validate ...)`.

If the query includes `[db [id]]`, corresponding to the Om Next
query attribute `:db/id`, it is assumed that the view represents
data from DataScript or Datomic. In this case, `defview` will
automatically infer `(ident ...)` and `(key ...)` functions
based on the database ID. This behavior can be overriden by
specifically defining both, `ident` and `key`.
sourceraw docstring

defview*clj

(defview* name forms)
(defview* name forms env)
source

factorycljs

(factory & args)

A wrapper factory around om.next/factory that makes the nil argument for properties optional.

A wrapper factory around om.next/factory that makes the nil
argument for properties optional.
sourceraw docstring

fn-aliasclj

(fn-alias {:keys [form-name]})

Return the alias for a view function or the name of the function itself if no alias is defined.

Return the alias for a view function or the name of the
function itself if no alias is defined.
sourceraw docstring

fn-aliasesclj

A few aliases allowing to define view functions with shorter or more logicial names.

A few aliases allowing to define view functions with shorter or
more logicial names.
sourceraw docstring

fn-argsclj

(fn-args {:keys [form-name]})

Return the arguments (e.g. [this]) for a view function.

Return the arguments (e.g. [this]) for a view function.
sourceraw docstring

fn-protocolclj

(fn-protocol {:keys [form-name]})

Return the scope (e.g. (static om.next/IQuery) for a view function.

Return the scope (e.g. (static om.next/IQuery) for a view function.
sourceraw docstring

fn-scopeclj

(fn-scope {:keys [form-name]})

Return the scope (:static, :instance, :props) for a view function.

Return the scope (:static, :instance, :props) for a view function.
sourceraw docstring

fn-specsclj

Function specifications for all functions that are not Object instance functions taking [this] as the sole argument.

Function specifications for all functions that are not Object
instance functions taking [this] as the sole argument.
sourceraw docstring

generate-command-fnclj

(generate-command-fn cmd-name)

Generate an anonymous wrapper function to call the :run-command hook with a specific command name.

Generate an anonymous wrapper function to call the
`:run-command` hook with a specific command name.
sourceraw docstring

generate-ident-fnclj

(generate-ident-fn props)

Generate a (ident ...) function from the props spec.

Generate a (ident ...) function from the props spec.
sourceraw docstring

generate-key-fnclj

(generate-key-fn props)

Generate a (key ...) function from the props spec.

Generate a (key ...) function from the props spec.
sourceraw docstring

get-view-configcljs

(get-view-config)
(get-view-config option)
source

inject-fn-argsclj

(inject-fn-args f)

Inject a function argument binding vector into f if it doesn't already have one.

Inject a function argument binding vector into f if it doesn't
already have one.
sourceraw docstring

instance-fnclj

(instance-fn {:keys [form-name form-args form-body]})

Make a function to put inside a record or defui expression.

Make a function to put inside a record or defui expression.
sourceraw docstring

instance-fnsclj

(instance-fns fns)
source

maybe-generate-ident-fnclj

(maybe-generate-ident-fn props fns)

If the props spec includes a :db/id property, an (ident ...) function is automatically generated based on this ID.

If the props spec includes a :db/id property, an (ident ...)
function is automatically generated based on this ID.
sourceraw docstring

maybe-generate-key-fnclj

(maybe-generate-key-fn props fns)

If the props spec includes a :db/id property, a (key ...) function is automatically generated based on this ID.

If the props spec includes a :db/id property, a (key ...)
function is automatically generated based on this ID.
sourceraw docstring

maybe-inject-fn-argsclj

(maybe-inject-fn-args f)

Inject a function argument binding vector into f unless it is a raw function that is assumed to define its own arguments.

Inject a function argument binding vector into f unless it
is a raw function that is assumed to define its own arguments.
sourceraw docstring

maybe-wrap-renderclj

(maybe-wrap-render {:keys [form-name form-body] :as f})

If f is the render function, checks whether it has more than one child expression. If so, wraps these children in a wrapper view according to the :wrapper-view option set via workflo.macros.view/configure!.

If f is the render function, checks whether it has more than one
child expression. If so, wraps these children in a wrapper view
according to the :wrapper-view option set via
workflo.macros.view/configure!.
sourceraw docstring

normalize-fn-nameclj

(normalize-fn-name {:keys [form-name] :as f})

Normalize the function name of f. This removes the leading . from the names of raw functions.

Normalize the function name of f. This removes the leading .
from the names of raw functions.
sourceraw docstring

raw-fn?clj

(raw-fn? {:keys [form-name]})

Returns true if f is a raw function, that is if its name starts with a ., indicating that its function signature should be left alone.

Returns true if f is a raw function, that is if its name
starts with a ., indicating that its function signature
should be left alone.
sourceraw docstring

register-view!cljs

(register-view! name def)
source

registered-viewscljs

(registered-views)
source

reset-registered-views!cljs

(reset-registered-views!)
source

resolve-fn-aliasclj

(resolve-fn-alias f)

Resolve the function alias for a view function.

Resolve the function alias for a view function.
sourceraw docstring

resolve-viewcljs

(resolve-view name)
source

run-command!cljs

(run-command! cmd-name view params reads)

Runs a given command using the configured :run-command handler, if defined.

Runs a given command using the configured :run-command
handler, if defined.
sourceraw docstring

transform-query-bodyclj

(transform-query-body f)
source

unregister-view!cljs

(unregister-view! name)
source

wrap-renderclj

(wrap-render {:keys [form-body] :as f})

Wraps the body of the function f in a wrapper view according to the :wrapper-view option set via workflo.macros.view/configure!.

Wraps the body of the function f in a wrapper view according to
the :wrapper-view option set via workflo.macros.view/configure!.
sourceraw docstring

wrap-with-query-bindingsclj

(wrap-with-query-bindings form-body query query-result)
source

wrappercljs

(wrapper)

Returns a wrapper factory for use in render functions. If no wrapper function is defined, issues a warning and returns om.dom/div to avoid breaking apps entirely.

Returns a wrapper factory for use in render functions. If no
wrapper function is defined, issues a warning and returns
om.dom/div to avoid breaking apps entirely.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close