Skip to content

Commit

Permalink
fix: allow multiple ways of defining scope
Browse files Browse the repository at this point in the history
  • Loading branch information
collinlokken committed Nov 1, 2023
1 parent b553286 commit 884fe36
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/dm-core/src/components/ViewCreator/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { TViewConfig } from '../../types'

export const getTarget = (idReference: string, viewConfig: TViewConfig) => {
if (viewConfig?.scope && viewConfig.scope !== 'self')
return `${idReference}.${viewConfig.scope}`
if (viewConfig.scope.slice(0, 5) == 'self.') {
return `${idReference}.${viewConfig.scope.slice(5, -1)}`
} else if (viewConfig.scope.slice(0, 1) == '^') {
return `${idReference}.${viewConfig.scope.slice(1, -1)}`
} else if (viewConfig.scope.slice(0, 1) == '.') {
return `${idReference}${viewConfig.scope}`
} else {
return `${idReference}.${viewConfig.scope}`
}
return idReference
}

0 comments on commit 884fe36

Please sign in to comment.