forked from tsai/budibase
5 changed files with 0 additions and 107 deletions
@ -1,33 +0,0 @@ |
|||||
const buildCodeForSingleScreen = screen => { |
|
||||
let code = "" |
|
||||
const walkProps = props => { |
|
||||
if (props._code && props._code.trim().length > 0) { |
|
||||
code += buildComponentCode(props) |
|
||||
} |
|
||||
|
|
||||
if (!props._children) return |
|
||||
|
|
||||
for (let child of props._children) { |
|
||||
walkProps(child) |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
walkProps(screen.props) |
|
||||
|
|
||||
return code |
|
||||
} |
|
||||
|
|
||||
export const buildCodeForScreens = screens => { |
|
||||
let allfunctions = "" |
|
||||
for (let screen of screens) { |
|
||||
allfunctions += buildCodeForSingleScreen(screen) |
|
||||
} |
|
||||
|
|
||||
return `({ ${allfunctions} });` |
|
||||
} |
|
||||
|
|
||||
const buildComponentCode = componentProps => |
|
||||
`"${componentProps._id}" : (render, context, state, route) => {
|
|
||||
${componentProps._code} |
|
||||
}, |
|
||||
` |
|
||||
@ -1,17 +0,0 @@ |
|||||
export const insertCodeMetadata = props => { |
|
||||
if (props._code && props._code.length > 0) { |
|
||||
props._codeMeta = codeMetaData(props._code) |
|
||||
} |
|
||||
|
|
||||
if (!props._children || props._children.length === 0) return |
|
||||
|
|
||||
for (let child of props._children) { |
|
||||
insertCodeMetadata(child) |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
const codeMetaData = code => { |
|
||||
return { |
|
||||
dependsOnStore: RegExp(/(state.)/g).test(code), |
|
||||
} |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
module.exports = props => { |
|
||||
if (props._codeMeta) { |
|
||||
delete props._codeMeta |
|
||||
} |
|
||||
|
|
||||
for (let child of props._children || []) { |
|
||||
module.exports(child) |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue