diff --git a/README.md b/README.md index 96a9dd409..e24cf16a1 120000 --- a/README.md +++ b/README.md @@ -1 +1 @@ -./packages/core/README.md \ No newline at end of file +./packages/core/README.md diff --git a/packages/core/src/data_sources/model/collection_component/CollectionComponent.ts b/packages/core/src/data_sources/model/collection_component/CollectionComponent.ts index cb62fea0d..b8ab18557 100644 --- a/packages/core/src/data_sources/model/collection_component/CollectionComponent.ts +++ b/packages/core/src/data_sources/model/collection_component/CollectionComponent.ts @@ -1,7 +1,7 @@ import DataVariable, { DataVariableType } from './../DataVariable'; import { isArray } from 'underscore'; -import Component, { keySymbol, keySymbolOvrd, keySymbols } from '../../../dom_components/model/Component'; -import { ComponentDefinition, ComponentOptions, ComponentProperties } from '../../../dom_components/model/types'; +import Component from '../../../dom_components/model/Component'; +import { ComponentOptions } from '../../../dom_components/model/types'; import { toLowerCase } from '../../../utils/mixins'; import DataSource from '../DataSource'; import { ObjectAny } from '../../../common'; @@ -10,7 +10,6 @@ import { keyCollectionsStateMap } from '../../../dom_components/model/Component' import { CollectionComponentDefinition, CollectionDefinition, CollectionState, CollectionsStateMap } from './types'; import { keyCollectionDefinition, keyInnerCollectionState, CollectionComponentType } from './constants'; import DynamicVariableListenerManager from '../DataVariableListenerManager'; -import Components from '../../../dom_components/model/Components'; export default class CollectionComponent extends Component { constructor(props: CollectionComponentDefinition, opt: ComponentOptions) { @@ -103,7 +102,7 @@ function getCollectionItems( parentCollectionStateMap: CollectionsStateMap, opt: ComponentOptions, ) { - const { collection_name, block, config } = collectionDefinition; + const { collectionName, block, config } = collectionDefinition; if (!block) { em.logError('The "block" property is required in the collection definition.'); return []; @@ -117,30 +116,30 @@ function getCollectionItems( const components: Component[] = []; let items: any[] = getDataSourceItems(config.dataSource, em); - const start_index = Math.max(0, config.start_index || 0); - const end_index = Math.min(items.length - 1, config.end_index !== undefined ? config.end_index : Number.MAX_VALUE); + const startIndex = Math.max(0, config.startIndex || 0); + const endIndex = Math.min(items.length - 1, config.endIndex !== undefined ? config.endIndex : Number.MAX_VALUE); - const total_items = end_index - start_index + 1; + const totalItems = endIndex - startIndex + 1; let blockSymbolMain: Component; - for (let index = start_index; index <= end_index; index++) { + for (let index = startIndex; index <= endIndex; index++) { const item = items[index]; const collectionState: CollectionState = { - collection_name, - current_index: index, - current_item: item, - start_index: start_index, - end_index: end_index, - total_items: total_items, - remaining_items: total_items - (index + 1), + collectionName, + currentIndex: index, + currentItem: item, + startIndex: startIndex, + endIndex: endIndex, + totalItems: totalItems, + remainingItems: totalItems - (index + 1), }; const collectionsStateMap: CollectionsStateMap = { ...parentCollectionStateMap, - ...(collection_name && { [collection_name]: collectionState }), + ...(collectionName && { [collectionName]: collectionState }), [keyInnerCollectionState]: collectionState, }; - if (index === start_index) { + if (index === startIndex) { // @ts-ignore const type = em.Components.getType(block?.type || 'default'); const model = type.model; diff --git a/packages/core/src/data_sources/model/collection_component/CollectionVariable.ts b/packages/core/src/data_sources/model/collection_component/CollectionVariable.ts index ccb15a183..97e9b6040 100644 --- a/packages/core/src/data_sources/model/collection_component/CollectionVariable.ts +++ b/packages/core/src/data_sources/model/collection_component/CollectionVariable.ts @@ -63,36 +63,36 @@ function resolveCollectionVariable( collectionsStateMap: CollectionsStateMap, em: EditorModel, ) { - const { collection_name = keyInnerCollectionState, variable_type, path } = collectionVariableDefinition; - const collectionItem = collectionsStateMap[collection_name]; + const { collectionName = keyInnerCollectionState, variableType, path } = collectionVariableDefinition; + const collectionItem = collectionsStateMap[collectionName]; if (!collectionItem) { - em.logError(`Collection not found: ${collection_name}`); + em.logError(`Collection not found: ${collectionName}`); return ''; } - if (!variable_type) { - em.logError(`Missing collection variable type for collection: ${collection_name}`); + if (!variableType) { + em.logError(`Missing collection variable type for collection: ${collectionName}`); return ''; } - if (variable_type === 'current_item') { - return resolveCurrentItem(collectionItem, path, collection_name, em); + if (variableType === 'currentItem') { + return resolveCurrentItem(collectionItem, path, collectionName, em); } - return collectionItem[variable_type]; + return collectionItem[variableType]; } function resolveCurrentItem( collectionItem: CollectionState, path: string | undefined, - collection_name: string, + collectionName: string, em: EditorModel, ) { - const currentItem = collectionItem.current_item; + const currentItem = collectionItem.currentItem; if (!currentItem) { - em.logError(`Current item is missing for collection: ${collection_name}`); + em.logError(`Current item is missing for collection: ${collectionName}`); return ''; } @@ -105,7 +105,7 @@ function resolveCurrentItem( } if (path && !currentItem[path]) { - em.logError(`Path not found in current item: ${path} for collection: ${collection_name}`); + em.logError(`Path not found in current item: ${path} for collection: ${collectionName}`); return ''; } diff --git a/packages/core/src/data_sources/model/collection_component/types.ts b/packages/core/src/data_sources/model/collection_component/types.ts index e7cc14676..17237f1e7 100644 --- a/packages/core/src/data_sources/model/collection_component/types.ts +++ b/packages/core/src/data_sources/model/collection_component/types.ts @@ -6,29 +6,29 @@ import { DataVariableDefinition } from '../DataVariable'; type CollectionDataSource = any[] | DataVariableDefinition | CollectionVariableDefinition; type CollectionConfig = { - start_index?: number; - end_index?: number; + startIndex?: number; + endIndex?: number; dataSource: CollectionDataSource; }; export enum CollectionStateVariableType { - current_index = 'current_index', - start_index = 'start_index', - current_item = 'current_item', - end_index = 'end_index', - collection_name = 'collection_name', - total_items = 'total_items', - remaining_items = 'remaining_items', + currentIndex = 'currentIndex', + startIndex = 'startIndex', + currentItem = 'currentItem', + endIndex = 'endIndex', + collectionName = 'collectionName', + totalItems = 'totalItems', + remainingItems = 'remainingItems', } export type CollectionState = { - [CollectionStateVariableType.current_index]: number; - [CollectionStateVariableType.start_index]: number; - [CollectionStateVariableType.current_item]: any; - [CollectionStateVariableType.end_index]: number; - [CollectionStateVariableType.collection_name]?: string; - [CollectionStateVariableType.total_items]: number; - [CollectionStateVariableType.remaining_items]: number; + [CollectionStateVariableType.currentIndex]: number; + [CollectionStateVariableType.startIndex]: number; + [CollectionStateVariableType.currentItem]: any; + [CollectionStateVariableType.endIndex]: number; + [CollectionStateVariableType.collectionName]?: string; + [CollectionStateVariableType.totalItems]: number; + [CollectionStateVariableType.remainingItems]: number; }; export type CollectionsStateMap = { @@ -41,7 +41,7 @@ export type CollectionComponentDefinition = { export type CollectionDefinition = { type: typeof CollectionComponentType; - collection_name?: string; + collectionName?: string; config: CollectionConfig; block: ComponentDefinition; }; diff --git a/packages/core/test/specs/data_sources/model/collection_component/CollectionComponent.ts b/packages/core/test/specs/data_sources/model/collection_component/CollectionComponent.ts index 81f657ca7..38e468266 100644 --- a/packages/core/test/specs/data_sources/model/collection_component/CollectionComponent.ts +++ b/packages/core/test/specs/data_sources/model/collection_component/CollectionComponent.ts @@ -130,19 +130,19 @@ describe('Collection component', () => { type: 'default', content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, ], content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, custom_property: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -205,7 +205,7 @@ describe('Collection component', () => { firstChild.set('content', { // @ts-ignore type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'age', }); expect(firstChild.get('content')).toBe('12'); @@ -223,7 +223,7 @@ describe('Collection component', () => { firstGrandchild.set('content', { // @ts-ignore type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'age', }); expect(firstGrandchild.get('content')).toBe('new_value_12'); @@ -286,7 +286,7 @@ describe('Collection component', () => { attributes: { content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -295,7 +295,7 @@ describe('Collection component', () => { attributes: { content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -356,7 +356,7 @@ describe('Collection component', () => { content: { // @ts-ignore type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'age', }, }); @@ -376,7 +376,7 @@ describe('Collection component', () => { content: { // @ts-ignore type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'age', }, }); @@ -435,7 +435,7 @@ describe('Collection component', () => { name: 'attribute_trait', value: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -444,7 +444,7 @@ describe('Collection component', () => { changeProp: true, value: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -486,18 +486,18 @@ describe('Collection component', () => { type: 'default', content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, custom_prop: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_index, + variableType: CollectionStateVariableType.currentIndex, path: 'user', }, attributes: { content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -506,7 +506,7 @@ describe('Collection component', () => { name: 'attribute_trait', value: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -515,7 +515,7 @@ describe('Collection component', () => { changeProp: true, value: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, @@ -525,14 +525,14 @@ describe('Collection component', () => { const collectionComponentDefinition = { type: CollectionComponentType, collectionDefinition: { - collection_name: 'my_collection', + collectionName: 'my_collection', block: { ...cmpDefinition, components: [cmpDefinition, cmpDefinition], }, config: { - start_index: 0, - end_index: 1, + startIndex: 0, + endIndex: 1, dataSource: { type: DataVariableType, path: 'my_data_source_id', @@ -552,7 +552,7 @@ describe('Collection component', () => { type: 'default', content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_index, + variableType: CollectionStateVariableType.currentIndex, path: 'user', }, }; @@ -573,7 +573,7 @@ describe('Collection component', () => { type: 'default', content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_index, + variableType: CollectionStateVariableType.currentIndex, path: 'user', }, }; @@ -597,12 +597,12 @@ describe('Collection component', () => { attribute_trait: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, content: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, }, components: [ @@ -611,28 +611,28 @@ describe('Collection component', () => { attribute_trait: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, content: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, }, content: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, custom_prop: { path: 'user', type: CollectionVariableType, - variable_type: 'current_index', + variableType: 'currentIndex', }, property_trait: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, type: 'default', }, @@ -641,28 +641,28 @@ describe('Collection component', () => { attribute_trait: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, content: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, }, content: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, custom_prop: { path: 'user', type: CollectionVariableType, - variable_type: 'current_index', + variableType: 'currentIndex', }, property_trait: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, type: 'default', }, @@ -670,28 +670,28 @@ describe('Collection component', () => { content: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, custom_prop: { path: 'user', type: CollectionVariableType, - variable_type: 'current_index', + variableType: 'currentIndex', }, property_trait: { path: 'user', type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, }, type: 'default', }, - collection_name: 'my_collection', + collectionName: 'my_collection', config: { dataSource: { path: 'my_data_source_id', type: DataVariableType, }, - end_index: 1, - start_index: 0, + endIndex: 1, + startIndex: 0, }, }, type: 'collection-component', @@ -766,13 +766,13 @@ describe('Collection component', () => { type: 'default', content: { type: CollectionVariableType, - variable_type: CollectionStateVariableType.current_item, + variableType: CollectionStateVariableType.currentItem, path: 'user', }, }, config: { - start_index: 1, - end_index: 2, + startIndex: 1, + endIndex: 2, dataSource: { type: DataVariableType, path: 'my_data_source_id', @@ -792,15 +792,15 @@ describe('Collection component', () => { describe('Diffirent Collection variable types', () => { const stateVariableTests = [ - { variableType: CollectionStateVariableType.current_index, expectedValues: [0, 1, 2] }, - { variableType: CollectionStateVariableType.start_index, expectedValues: [0, 0, 0] }, - { variableType: CollectionStateVariableType.end_index, expectedValues: [2, 2, 2] }, + { variableType: CollectionStateVariableType.currentIndex, expectedValues: [0, 1, 2] }, + { variableType: CollectionStateVariableType.startIndex, expectedValues: [0, 0, 0] }, + { variableType: CollectionStateVariableType.endIndex, expectedValues: [2, 2, 2] }, { - variableType: CollectionStateVariableType.collection_name, + variableType: CollectionStateVariableType.collectionName, expectedValues: ['my_collection', 'my_collection', 'my_collection'], }, - { variableType: CollectionStateVariableType.total_items, expectedValues: [3, 3, 3] }, - { variableType: CollectionStateVariableType.remaining_items, expectedValues: [2, 1, 0] }, + { variableType: CollectionStateVariableType.totalItems, expectedValues: [3, 3, 3] }, + { variableType: CollectionStateVariableType.remainingItems, expectedValues: [2, 1, 0] }, ]; stateVariableTests.forEach(({ variableType, expectedValues }) => { @@ -808,17 +808,17 @@ describe('Collection component', () => { const cmp = wrapper.components({ type: CollectionComponentType, collectionDefinition: { - collection_name: 'my_collection', + collectionName: 'my_collection', block: { type: 'default', content: { type: CollectionVariableType, - variable_type: variableType, + variableType: variableType, }, attributes: { custom_attribute: { type: CollectionVariableType, - variable_type: variableType, + variableType: variableType, }, }, traits: [ @@ -826,7 +826,7 @@ describe('Collection component', () => { name: 'attribute_trait', value: { type: CollectionVariableType, - variable_type: variableType, + variableType: variableType, }, }, { @@ -834,7 +834,7 @@ describe('Collection component', () => { changeProp: true, value: { type: CollectionVariableType, - variable_type: variableType, + variableType: variableType, }, }, ], diff --git a/packages/core/test/specs/data_sources/model/collection_component/__snapshots__/CollectionComponent.ts.snap b/packages/core/test/specs/data_sources/model/collection_component/__snapshots__/CollectionComponent.ts.snap index 46f76cdf5..d2d5a8a53 100644 --- a/packages/core/test/specs/data_sources/model/collection_component/__snapshots__/CollectionComponent.ts.snap +++ b/packages/core/test/specs/data_sources/model/collection_component/__snapshots__/CollectionComponent.ts.snap @@ -8,12 +8,12 @@ exports[`Collection component Serialization Saving: Collection with grandchildre "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "components": [ @@ -22,12 +22,12 @@ exports[`Collection component Serialization Saving: Collection with grandchildre "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "components": [ @@ -35,7 +35,7 @@ exports[`Collection component Serialization Saving: Collection with grandchildre "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "type": "default", }, @@ -43,17 +43,17 @@ exports[`Collection component Serialization Saving: Collection with grandchildre "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -62,28 +62,28 @@ exports[`Collection component Serialization Saving: Collection with grandchildre "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -91,28 +91,28 @@ exports[`Collection component Serialization Saving: Collection with grandchildre "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, - "collection_name": "my_collection", + "collectionName": "my_collection", "config": { "dataSource": { "path": "my_data_source_id", "type": "data-variable", }, - "end_index": 1, - "start_index": 0, + "endIndex": 1, + "startIndex": 0, }, }, "type": "collection-component", @@ -127,12 +127,12 @@ exports[`Collection component Serialization Saving: Collection with no grandchil "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "components": [ @@ -141,28 +141,28 @@ exports[`Collection component Serialization Saving: Collection with no grandchil "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -171,28 +171,28 @@ exports[`Collection component Serialization Saving: Collection with no grandchil "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -200,28 +200,28 @@ exports[`Collection component Serialization Saving: Collection with no grandchil "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, - "collection_name": "my_collection", + "collectionName": "my_collection", "config": { "dataSource": { "path": "my_data_source_id", "type": "data-variable", }, - "end_index": 1, - "start_index": 0, + "endIndex": 1, + "startIndex": 0, }, }, "type": "collection-component", @@ -236,12 +236,12 @@ exports[`Collection component Serialization Serializion with Collection Variable "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "components": [ @@ -250,12 +250,12 @@ exports[`Collection component Serialization Serializion with Collection Variable "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "components": [ @@ -263,7 +263,7 @@ exports[`Collection component Serialization Serializion with Collection Variable "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "type": "default", }, @@ -271,17 +271,17 @@ exports[`Collection component Serialization Serializion with Collection Variable "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -290,28 +290,28 @@ exports[`Collection component Serialization Serializion with Collection Variable "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -319,28 +319,28 @@ exports[`Collection component Serialization Serializion with Collection Variable "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, - "collection_name": "my_collection", + "collectionName": "my_collection", "config": { "dataSource": { "path": "my_data_source_id", "type": "data-variable", }, - "end_index": 1, - "start_index": 0, + "endIndex": 1, + "startIndex": 0, }, }, "type": "collection-component", @@ -355,12 +355,12 @@ exports[`Collection component Serialization Serializion with Collection Variable "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "components": [ @@ -369,28 +369,28 @@ exports[`Collection component Serialization Serializion with Collection Variable "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -399,28 +399,28 @@ exports[`Collection component Serialization Serializion with Collection Variable "attribute_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, }, "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, @@ -428,28 +428,28 @@ exports[`Collection component Serialization Serializion with Collection Variable "content": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "custom_prop": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_index", + "variableType": "currentIndex", }, "property_trait": { "path": "user", "type": "parent-collection-variable", - "variable_type": "current_item", + "variableType": "currentItem", }, "type": "default", }, - "collection_name": "my_collection", + "collectionName": "my_collection", "config": { "dataSource": { "path": "my_data_source_id", "type": "data-variable", }, - "end_index": 1, - "start_index": 0, + "endIndex": 1, + "startIndex": 0, }, }, "type": "collection-component", diff --git a/packages/core/test/specs/dom_components/model/ComponentTypes.ts b/packages/core/test/specs/dom_components/model/ComponentTypes.ts index 2cc912b97..f074d4b3b 100644 --- a/packages/core/test/specs/dom_components/model/ComponentTypes.ts +++ b/packages/core/test/specs/dom_components/model/ComponentTypes.ts @@ -101,7 +101,7 @@ describe('Component Types', () => { export type CollectionVariableDefinition = { type: typeof CollectionVariableType; - variable_type: CollectionStateVariableType; - collection_name?: string; + variableType: CollectionStateVariableType; + collectionName?: string; path?: string; };