forcedotcom / aura

This project is archived, please see the readme for additional resources.
Apache License 2.0
674 stars 333 forks source link

Support for concept of child components #109

Closed datasert closed 5 years ago

datasert commented 7 years ago

While developing some components, we would need to create bunch of other components. However those other components are not meant to be used independently outside of parent component, even within the same namespace.

Concept of creating child components (one level below a component), which can only be used in that parent component would be helpful.

Please share your thoughts on feasibility of such feature.

ruslan-kurchenko commented 7 years ago

@datasert Hello. With SalesforceDX you can create custom folders structure which allows you to easily manage components:

aura
  - RelatedList
  -- RelatedListTable
  ---- RelatedListRow
  ---- RelatedListColumn
  -- RelatedListFilter
  -- RelatedListButtons
datasert commented 7 years ago

Thanks @ruslan-kurchenko. Is that a Aura feature or Salesforce enhancement on top of Aura?

If I use Aura in our internal project, will we be able to create components in hierarchy like that?

lukeis commented 7 years ago

essentially that's creating a namespace, which is a feature of Aura and if you are using Aura externally from Salesforce, then yes you can create as many different namespaces as you'd like. Communicating between those namespaces may be tricky as AccessChecks will apply similarly to salesforce's Org boundaries, in which you'd be able to label something as access="public" to be available only to that namespace.

If you really want something to only be available to the component you can set access="private" https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/access_attr.htm

datasert commented 7 years ago

I understand namespacing aura feature. Does that include multi level namespacing? For ex., in that example that full namespace for RelatedListRow is aura:RelatedListTable:RelatedListRow. Is that how it works?

How do I set access to private if I have to limit a component to be used in its parent?

For ex., in that example above, how do I make RelatedListRow can only be used inside RelatedListTable? Do I set access="private" in RelatedListRow component?