LearnNewsExamplesServices
Frontmatter
id1708
titlemodel.Component: data format for binding strings
stateClosed
labels
enhancement
assigneestobiu
createdAtApr 1, 2021, 5:25 PM
updatedAtApr 1, 2021, 11:50 PM
githubUrlhttps://github.com/neomjs/neo/issues/1708
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 1, 2021, 11:50 PM

model.Component: data format for binding strings

Closed v8.1.0 enhancement
tobiu
tobiu commented on Apr 1, 2021, 5:25 PM

instead of using:

bind: {
    text: 'button1Text'
}

we should switch to the format:

bind: {
    text: '${data.button1Text}'
}

this will make it easier to pass formulas in the future.

todos:

  • adjust the 4 example apps
  • add a value parser to model.Component
tobiu added the enhancement label on Apr 1, 2021, 5:25 PM
tobiu assigned to @tobiu on Apr 1, 2021, 5:25 PM
tobiu referenced in commit 756dd6e - "#1708 current progress => initial binding value replacements work with the new enhanced binding strings" on Apr 1, 2021, 8:15 PM
tobiu referenced in commit 2c350b5 - "#1708 model.Component: getFormatterVariables() => first PoC" on Apr 1, 2021, 10:07 PM
tobiu referenced in commit 707c5c0 - "#1708 model.Component: getFormatterVariables() => store the 2 regex inside top level module variables" on Apr 1, 2021, 10:11 PM
tobiu referenced in commit 1fd40e5 - "#1708 model.Component: getFormatterVariables() => using NeoArray to ensure variables are not added more than once" on Apr 1, 2021, 10:20 PM
tobiu referenced in commit 64f69cf - "#1708 model.Component: resolveBindings() using getFormatterVariables()" on Apr 1, 2021, 10:22 PM
tobiu referenced in commit c664217 - "#1708 model.Component: createBindingByFormatter()" on Apr 1, 2021, 10:51 PM
tobiu referenced in commit 7a74e31 - "#1708 model.Component: createBindingByFormatter(), createBinding() => adjusted the logic to store bindings including the formatter" on Apr 1, 2021, 11:06 PM
tobiu referenced in commit 6502e59 - "#1708 model.Component: fully working version" on Apr 1, 2021, 11:30 PM
tobiu
tobiu Apr 1, 2021, 11:50 PM

it got super nice now, we can already handle complex formulas like:

bind: {
    text: 'Hello ${data.button2Text} ${1+2} ${data.button1Text + data.button2Text}'
}
tobiu closed this issue on Apr 1, 2021, 11:50 PM