Skip to content

Commit

Permalink
Fix js expression generation for LOOP.COUNTER
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Feb 26, 2023
1 parent 583886c commit 5b8e255
Show file tree
Hide file tree
Showing 3 changed files with 2,078 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ftd/src/interpreter2/things/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,17 @@ impl ftd::evalexpr::ExprNode {
) -> ftd::evalexpr::ExprNode {
let mut operator = self.operator().clone();
if let ftd::evalexpr::Operator::VariableIdentifierRead { ref identifier } = operator {
if let Some(ftd::interpreter2::PropertyValue::Reference { name, .. }) =
if format!("${}", ftd::interpreter2::FTD_LOOP_COUNTER).eq(identifier) {
if let Some(ftd::interpreter2::PropertyValue::Value {
value: ftd::interpreter2::Value::Integer { value },
..
}) = references.get(identifier)
{
operator = ftd::evalexpr::Operator::VariableIdentifierRead {
identifier: value.to_string(),
}
}
} else if let Some(ftd::interpreter2::PropertyValue::Reference { name, .. }) =
references.get(identifier)
{
operator = ftd::evalexpr::Operator::VariableIdentifierRead {
Expand Down
81 changes: 81 additions & 0 deletions ftd/t/html/73-complex-ftd-ui.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
-- switcher:
s: $c











-- switches list c:

-- switches: me
-- switches.elements:

-- ftd.text: Me component

-- ftd.text: Me component 2

-- end: switches.elements


-- switches: me22
-- switches.elements:

-- ftd.text: Me component22

-- ftd.text: Me component22 2

-- end: switches.elements

-- end: c






-- record switches:
caption name:
ftd.ui list elements:



-- component switcher:
switches list s:
integer $is-active: 0

-- ftd.column:

-- ftd.text: $obj.name
color if { switcher.is-active == $LOOP.COUNTER }: red
color: $inherited.colors.text
$on-click$: $ftd.set-integer($a = $switcher.is-active, v = $LOOP.COUNTER)
$loop$: $switcher.s as $obj

-- box:
if: { switcher.is-active == $LOOP.COUNTER }
child: $obj.elements
$loop$: $switcher.s as $obj

-- end: ftd.column

-- end: switcher







-- component box:
ftd.ui list child:

-- ftd.column:
children: $box.child

-- end: box
Loading

0 comments on commit 5b8e255

Please sign in to comment.