Browse Source

Fix collection component symbols

collection-component
mohamedsalem401 2 years ago
parent
commit
374dbc4ffa
  1. 40
      packages/core/src/data_sources/model/data_collection/ComponentDataCollection.ts
  2. 10
      packages/core/src/dom_components/model/Component.ts
  3. 1
      packages/core/src/dom_components/model/types.ts
  4. 2
      packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts
  5. 62
      packages/core/test/specs/data_sources/model/data_collection/__snapshots__/ComponentDataCollection.ts.snap

40
packages/core/src/data_sources/model/data_collection/ComponentDataCollection.ts

@ -19,6 +19,12 @@ import DynamicVariableListenerManager from '../DataVariableListenerManager';
export default class ComponentDataCollection extends Component { export default class ComponentDataCollection extends Component {
constructor(props: ComponentDataCollectionDefinition, opt: ComponentOptions) { constructor(props: ComponentDataCollectionDefinition, opt: ComponentOptions) {
const collectionDef = props[keyCollectionDefinition];
if (opt.forCloning) {
// @ts-ignore
return super(props, opt);
}
const em = opt.em; const em = opt.em;
// @ts-ignore // @ts-ignore
const cmp: ComponentDataCollection = super( const cmp: ComponentDataCollection = super(
@ -31,7 +37,6 @@ export default class ComponentDataCollection extends Component {
opt, opt,
); );
const collectionDef = props[keyCollectionDefinition];
if (!collectionDef) { if (!collectionDef) {
em.logError('missing collection definition'); em.logError('missing collection definition');
@ -41,11 +46,11 @@ export default class ComponentDataCollection extends Component {
const parentCollectionStateMap = (props[keyCollectionsStateMap] || {}) as DataCollectionStateMap; const parentCollectionStateMap = (props[keyCollectionsStateMap] || {}) as DataCollectionStateMap;
const components: Component[] = getCollectionItems(em, collectionDef, parentCollectionStateMap, opt); const components: Component[] = getCollectionItems(em, collectionDef, parentCollectionStateMap, opt);
cmp.components(components);
if (this.hasDynamicDataSource()) { if (this.hasDynamicDataSource()) {
this.watchDataSource(em, collectionDef, parentCollectionStateMap, opt); this.watchDataSource(em, collectionDef, parentCollectionStateMap, opt);
} }
cmp.components(components);
return cmp; return cmp;
} }
@ -60,7 +65,7 @@ export default class ComponentDataCollection extends Component {
} }
toJSON(opts?: ObjectAny) { toJSON(opts?: ObjectAny) {
const json = super.toJSON(opts) as ComponentDataCollectionDefinition; const json = super.toJSON.call(this, opts) as ComponentDataCollectionDefinition;
const firstChild = this.getBlockDefinition(); const firstChild = this.getBlockDefinition();
json[keyCollectionDefinition].componentDef = firstChild; json[keyCollectionDefinition].componentDef = firstChild;
@ -166,9 +171,8 @@ function getCollectionItems(
}, },
opt, opt,
); );
blockSymbolMain!.setSymbolOverride([keyCollectionsStateMap]); setCollectionStateMapAndPropagate(collectionsStateMap, collectionId)(blockSymbolMain);
} }
blockSymbolMain!.set(keyCollectionsStateMap, collectionsStateMap);
const instance = blockSymbolMain!.clone({ symbol: true }); const instance = blockSymbolMain!.clone({ symbol: true });
setCollectionStateMapAndPropagate(collectionsStateMap, collectionId)(instance); setCollectionStateMapAndPropagate(collectionsStateMap, collectionId)(instance);
@ -183,6 +187,7 @@ function setCollectionStateMapAndPropagate(
collectionId: string | undefined, collectionId: string | undefined,
) { ) {
return (model: Component) => { return (model: Component) => {
// Set the collectionStateMap on the current model
setCollectionStateMap(collectionsStateMap)(model); setCollectionStateMap(collectionsStateMap)(model);
// Listener function for the 'add' event // Listener function for the 'add' event
@ -199,13 +204,16 @@ function setCollectionStateMapAndPropagate(
model.collectionStateListeners.push(listenerKey); model.collectionStateListeners.push(listenerKey);
// Add a 'remove' listener to clean up // Add a 'remove' listener to clean up
model.listenTo(model.components(), 'remove', () => { const removeListener = () => {
model.stopListening(model.components(), 'add', addListener); // Remove the 'add' listener model.stopListening(model.components(), 'add', addListener); // Remove the 'add' listener
model.off(`change:${keyCollectionsStateMap}`, handleCollectionStateMapChange); // Remove the change listener
const index = model.collectionStateListeners.indexOf(listenerKey); const index = model.collectionStateListeners.indexOf(listenerKey);
if (index > -1) { if (index > -1) {
model.collectionStateListeners.splice(index, 1); // Remove the listener key model.collectionStateListeners.splice(index, 1); // Remove the listener key
} }
}); };
model.listenTo(model.components(), 'remove', removeListener);
} }
// Recursively apply to all child components // Recursively apply to all child components
@ -215,9 +223,21 @@ function setCollectionStateMapAndPropagate(
.forEach((component: Component) => { .forEach((component: Component) => {
setCollectionStateMapAndPropagate(collectionsStateMap, collectionId)(component); setCollectionStateMapAndPropagate(collectionsStateMap, collectionId)(component);
}); });
// Listen for changes in the collectionStateMap and propagate to children
model.on(`change:${keyCollectionsStateMap}`, handleCollectionStateMapChange);
}; };
} }
function handleCollectionStateMapChange(this: Component) {
const updatedCollectionsStateMap = this.get(keyCollectionsStateMap);
this.components()
?.toArray()
.forEach((component: Component) => {
setCollectionStateMap(updatedCollectionsStateMap)(component);
});
}
function logErrorIfMissing(property: any, propertyPath: string, em: EditorModel) { function logErrorIfMissing(property: any, propertyPath: string, em: EditorModel) {
if (!property) { if (!property) {
em.logError(`The "${propertyPath}" property is required in the collection definition.`); em.logError(`The "${propertyPath}" property is required in the collection definition.`);
@ -250,10 +270,12 @@ function validateCollectionConfig(
function setCollectionStateMap(collectionsStateMap: DataCollectionStateMap) { function setCollectionStateMap(collectionsStateMap: DataCollectionStateMap) {
return (cmp: Component) => { return (cmp: Component) => {
cmp.set(keyIsCollectionItem, true); cmp.set(keyIsCollectionItem, true);
cmp.set(keyCollectionsStateMap, { const updatedCollectionStateMap = {
...cmp.get(keyCollectionsStateMap), ...cmp.get(keyCollectionsStateMap),
...collectionsStateMap, ...collectionsStateMap,
}); };
cmp.set(keyCollectionsStateMap, updatedCollectionStateMap);
cmp.componentDVListener.updateCollectionStateMap(updatedCollectionStateMap);
}; };
} }

10
packages/core/src/dom_components/model/Component.ts

@ -311,7 +311,6 @@ export default class Component extends StyleableModel<ComponentProperties> {
this.ccid = Component.createId(this, opt); this.ccid = Component.createId(this, opt);
this.preInit(); this.preInit();
this.initClasses(); this.initClasses();
this.listenTo(this, `change:${keyCollectionsStateMap}`, this.handleCollectionsMapStateChange);
this.initComponents(); this.initComponents();
this.initTraits(); this.initTraits();
this.initToolbar(); this.initToolbar();
@ -1358,6 +1357,7 @@ export default class Component extends StyleableModel<ComponentProperties> {
attr.status = ''; attr.status = '';
// @ts-ignore // @ts-ignore
opts.collection = null; opts.collection = null;
opts.forCloning = true;
// @ts-ignore // @ts-ignore
const cloned = new this.constructor(attr, opts); const cloned = new this.constructor(attr, opts);
@ -1588,7 +1588,6 @@ export default class Component extends StyleableModel<ComponentProperties> {
let obj = Model.prototype.toJSON.call(this, opts); let obj = Model.prototype.toJSON.call(this, opts);
obj = { ...obj, ...this.componentDVListener.getDynamicPropsDefs() }; obj = { ...obj, ...this.componentDVListener.getDynamicPropsDefs() };
obj.attributes = this.componentDVListener.getAttributesDefsOrValues(this.getAttributes()); obj.attributes = this.componentDVListener.getAttributesDefsOrValues(this.getAttributes());
delete obj.componentDVListener;
delete obj.attributes.class; delete obj.attributes.class;
delete obj.toolbar; delete obj.toolbar;
delete obj.traits; delete obj.traits;
@ -1977,13 +1976,6 @@ export default class Component extends StyleableModel<ComponentProperties> {
selector && selector.set({ name: id, label: id }); selector && selector.set({ name: id, label: id });
} }
private handleCollectionsMapStateChange(m: any, v: DataCollectionStateMap, opts = {}) {
this.componentDVListener.updateCollectionStateMap(v);
this.components()?.forEach((child) => {
child.set?.(keyCollectionsStateMap, v);
});
}
static typeExtends = new Set<string>(); static typeExtends = new Set<string>();
static getDefaults() { static getDefaults() {

1
packages/core/src/dom_components/model/types.ts

@ -322,4 +322,5 @@ export interface ComponentOptions {
frame?: Frame; frame?: Frame;
temporary?: boolean; temporary?: boolean;
avoidChildren?: boolean; avoidChildren?: boolean;
forCloning?: boolean;
} }

2
packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts

@ -232,6 +232,7 @@ describe('Collection component', () => {
// @ts-ignore // @ts-ignore
type: CollectionVariableType, type: CollectionVariableType,
variableType: DataCollectionStateVariableType.currentItem, variableType: DataCollectionStateVariableType.currentItem,
collectionId: 'my_collection',
path: 'age', path: 'age',
}); });
expect(firstGrandchild.get('name')).toBe('new_value_12'); expect(firstGrandchild.get('name')).toBe('new_value_12');
@ -368,6 +369,7 @@ describe('Collection component', () => {
// @ts-ignore // @ts-ignore
type: CollectionVariableType, type: CollectionVariableType,
variableType: DataCollectionStateVariableType.currentItem, variableType: DataCollectionStateVariableType.currentItem,
collectionId: 'my_collection',
path: 'age', path: 'age',
}, },
}); });

62
packages/core/test/specs/data_sources/model/data_collection/__snapshots__/ComponentDataCollection.ts.snap

@ -15,11 +15,13 @@ exports[`Collection component Serialization Saving: Collection with grandchildre
"componentDef": { "componentDef": {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -29,11 +31,13 @@ exports[`Collection component Serialization Saving: Collection with grandchildre
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -42,6 +46,7 @@ exports[`Collection component Serialization Saving: Collection with grandchildre
"components": [ "components": [
{ {
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
@ -50,16 +55,19 @@ exports[`Collection component Serialization Saving: Collection with grandchildre
}, },
], ],
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -69,27 +77,32 @@ exports[`Collection component Serialization Saving: Collection with grandchildre
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
}, },
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -98,16 +111,19 @@ exports[`Collection component Serialization Saving: Collection with grandchildre
}, },
], ],
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -134,11 +150,13 @@ exports[`Collection component Serialization Saving: Collection with no grandchil
"componentDef": { "componentDef": {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -148,27 +166,32 @@ exports[`Collection component Serialization Saving: Collection with no grandchil
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
}, },
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -178,27 +201,32 @@ exports[`Collection component Serialization Saving: Collection with no grandchil
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
}, },
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -207,16 +235,19 @@ exports[`Collection component Serialization Saving: Collection with no grandchil
}, },
], ],
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -243,11 +274,13 @@ exports[`Collection component Serialization Serializion with Collection Variable
"componentDef": { "componentDef": {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -257,11 +290,13 @@ exports[`Collection component Serialization Serializion with Collection Variable
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -270,6 +305,7 @@ exports[`Collection component Serialization Serializion with Collection Variable
"components": [ "components": [
{ {
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
@ -278,16 +314,19 @@ exports[`Collection component Serialization Serializion with Collection Variable
}, },
], ],
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -297,27 +336,32 @@ exports[`Collection component Serialization Serializion with Collection Variable
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
}, },
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -326,16 +370,19 @@ exports[`Collection component Serialization Serializion with Collection Variable
}, },
], ],
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -362,11 +409,13 @@ exports[`Collection component Serialization Serializion with Collection Variable
"componentDef": { "componentDef": {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -376,27 +425,32 @@ exports[`Collection component Serialization Serializion with Collection Variable
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
}, },
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -406,27 +460,32 @@ exports[`Collection component Serialization Serializion with Collection Variable
{ {
"attributes": { "attributes": {
"attribute_trait": { "attribute_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
}, },
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
@ -435,16 +494,19 @@ exports[`Collection component Serialization Serializion with Collection Variable
}, },
], ],
"custom_prop": { "custom_prop": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentIndex", "variableType": "currentIndex",
}, },
"name": { "name": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",
}, },
"property_trait": { "property_trait": {
"collectionId": "my_collection",
"path": "user", "path": "user",
"type": "parent-collection-variable", "type": "parent-collection-variable",
"variableType": "currentItem", "variableType": "currentItem",

Loading…
Cancel
Save