Basic design:
- Each component in the palette ("General Info", "Addresses", "Profile 123") corresponds to an AngularJS directive. It accepts arguments (like
{contactId: param.cid}
). - Each custom form (eg "View Individual" page) is effectively an AngularJS HTML document.
This design means:
- We're not responsible for defining all the edge-cases/nuances of how components interact with each other at runtime. This interaction is dictated by upstream's model.
- The structure of the user's configured form matches the structure of an Angular form in developer docs. When looking
at a page, you can drill-down and see a representation of the form which looks the same as the representations you
would have in upstream docs or in your
ang/
folder. - The HTML/JS which defines the form can be bundled and cached. As a user navigates among different contact records, the only thing that needs to change is the ID/data.
There is one key issue not addressed by AngularJS (wherein we need to fill the gap): the palette. AngularJS allows you declare reusable directives (e.g. crm-ui-tabset
or crm-contact-addresses
), but it doesn't provide rich introspection/reflection abilities for browsing available directives. To provide a palette, we need our own listing of acceptable directives.
There is another practical issue -- when implementing the editor (where an admin can drag/drop elements of the palette), you'll need to read/write some data-format. The format for using AngularJS directives is HTML (e.g. <div crm-contact-general="{contactId: param.cid}"></div>
), but you may not be comfortable reading/writing this format. If it's easier, we can use an equivalent JSON data-strcuture. (There are two examples of a custom form described below -- one in canonical HTML, one in equivalent JSON.)