A ZObject has type Z1, Z2, Z?, and it's loaded with a ZObject component.
However, if ZObject has its type changed into Z12, it doesn't change into a ZMultilingualString component, but shows its data (ID, keys) in the "generic" way.
Problems of current implementation:
- Currently there are two components responsible for checking the types of their children and loading different templates conditionally:
- ZObjectKey
- ZList This means that, if something changes in the way these components work, or if we add more custom components, these two files need to be updated and maintained with the changes. The same thing would probably happen with ZReference once we have it working.
- A ZObject is currently not responsible for its type and its representation in the Vue component tree, but their parent components are. This means that the component ZObject cannot change its type on its own, but must communicate to its parent so that it re-renders the tree, and if the type turns out to be one that has a specific component (such as Z12), the ZObject component would ultimately disappear.
It would be more comprehensible, and would help simplify the app, to have the following tree:
- ZObject: a valid ZObject, independently from its type. A ZObject stores its zobject data and alters its information. Also a ZObject renders different component depending on its type. So, for example, if its type is Z12, then it will render:
- ZMultilingualString, or
- ZString in case of having a type Z6, or
- ZList if it's Z10. This list would be oblivious to its elements' types, and would simply be an array of
- ZObject components, which again will render a different component depending on its type.
- In the case of not having a special type associated to a particular component (like Z6 or Z12), it would render:
- ZObjectGeneric that represents a ZObject in a generic way, by showing its ID, its type and:
- ZObjectKeyList, which is an array of
- ZObjectKey: Each of these would have a key ID and:
- ZObject, that can, again, be represented in the DOM in different ways, depending on its type.
- ZObjectKey: Each of these would have a key ID and:
- ZObjectKeyList, which is an array of
- ZObjectGeneric that represents a ZObject in a generic way, by showing its ID, its type and: