Skip to content

Rocket View

Ian Rothmann edited this page Aug 10, 2017 · 2 revisions

RocketForm implements a rocket-view-renderer for a ManipulationDefinition and ManipulationHandler. These are currently implemented as in the RocketData Laravel package. Please note that RocketData automatically creates a ManipulationDefinition and ManipulationHandler from your model metadata. In RocketData it is referred to as the ViewDefinition, even though it is at its core a ManipulationDefinition.

Rocketview takes the following properties:

  • url - Which is the route to the ManipulationHandler or the RocketData route.
  • id - The record id.

Rocketview will get its own definition and data.

<rocket-view url="{{ route('rocketform.basic') }}"
                             v-model="id"
>
</rocket-view>
 data : {
    id : 1484,
 }

Modifiers

It is possible to modify any of the rocket-view-renderer field definitions by specifying the following modifier:

:view-modifiers="modifiers"
 modifiers : {
                name : {
                    options : {
                        prependIcon : 'person',
                        md : 6
                    }
                },
                email : {
                    options : {
                        prependIcon : 'mail',
                        md : 6
                    }
                },
                isadmin : {
                    show : (data)=>{
                        return data.name==='';
                    }
                }
            }

The modifier object key is the field name. The rocket-view-definition objects are merged with the provided objects.

Scoped slots

You may inject scoped slots for the create or edit definition. The following steps should be taken:

  • Bind view-slots to an object.
  • The object should contain the slot names and position (see example).
  • Put the scoped slot template inside the rocket-view tag.
<rocket-view url="{{ route('rocketform.basic') }}"
                             v-model="id"
                :view-modifiers="modifiers"
                :view-slots="scopedSlots"
                >
                <template scope="data" slot="custom">
                  <vcode>{{data}}</code>
                </template>
                <template scope="data" slot="custom_files">
                  <vcode>{{data}}</code>
                </template>
</rocket-view>
scopedSlots : [ //after: is before fieldId or groupId
                {after:'company',name:'custom'},
                {after:'filesgroup',name:'custom_files'},
            ],

Rocket Forms in Vue

Form handlers

View handlers

Combination handlers

Delete handlers

Technical

Clone this wiki locally