Commit Graph

15 Commits

Author SHA1 Message Date
Nicolas Bayet 4385969e2e up 2025-09-26 18:58:15 +02:00
Romain Derie 9b656fd9e4 [IMP] compiler: add prop suffix name in the error message
Without this, you only get the following error:
```
UncaughtPromiseError > OwlError
Uncaught promise > Invalid prop suffix
OwlError: Invalid prop suffix
```

Which is not helping much to find the problematic code.
2025-01-07 13:34:03 -05:00
Samuel Degueldre 0cde4b8737 [IMP] compiler: add support for the .translate suffix
Previously, if you wanted to pass a prop and have it be translated, you
had to either to the translation manually in JS, or use a workaround
with t-set and a body so that Owl would translate it for you, and then
pass the t-set variable as a prop. This is quite inconvenient and is a
common use case.

This commit introduces the `.translate` suffix to solve this issue. When
a prop uses this suffix, it is treated as a string instead of a JS
expression, avoiding the need for quotes as well as their escaping and
allowing extraction tools such as babel to generate a clean string as
the term's translation id. This is also more ergonomic. This suffix is
available for both component props and slot props.

This change will still require some work in Odoo to correctly extract
the terms for props using this suffix.
2024-07-15 10:14:08 +02:00
Samuel Degueldre 0048205636 [IMP] tests: use inline snapshots for lifecycle checks
This allows them to be updated automatically when needed instead of
having to update them by hand.
2023-10-04 12:55:20 +02:00
Géry Debongnie 0024f33fa1 [FIX] components: do not crash when binding anonymous function
It is not really useful, but it is possible to bind an anonymous
function prop. However, with the recent change on how the bind feature
works, it now crashes.

This commit makes sure that we properly apply the `bind` operation to
the function, and not to the last term of the function.
2023-03-09 15:35:13 +01:00
Géry Debongnie a51b286671 [IMP] implement .alike suffix on props
It is common in Owl components to have anonymous function as props.
However, since each rendering create a different (but equivalent)
closure, Owl will consider the props different, so will update the child
component, but this is (often) not necessary.

This commit will help reduce the problem by introducing a new `.alike`
prop suffix, that will let Owl know that each version of that specific
prop should be considered the same, so, will be ignored by the props
comparison code.

closes #1360
2023-03-09 11:14:00 +01:00
Géry Debongnie 89d63ff29a [IMP] components: crash when using unknown suffix/modifiers 2022-02-11 10:46:44 +01:00
Géry Debongnie 416deeb865 [REM] component: remove support for css tag 2022-02-11 10:46:44 +01:00
Géry Debongnie 14a6289f60 [IMP] component: add .bind suffix to props for easy binding 2022-02-11 10:46:44 +01:00
Samuel Degueldre 2943ca3921 [IMP] components: add test for template string in props 2022-02-11 10:46:44 +01:00
Samuel Degueldre 93b88cad8d [FIX] components: allow prop names that are not valid bare property name 2022-02-11 10:46:44 +01:00
Mathieu Duckerts-Antoine b90180a9e0 [FIX] props: prop names can contain - 2022-02-11 10:46:44 +01:00
Samuel Degueldre 7143dd3ff5 [FIX] components: capture context in prop expressions 2022-02-11 10:41:18 +01:00
Lucas Perais (lpe) b902edc1be [IMP] app, compiler: introduce t-out
t-out automatically escaped content when it is a string not marked
with the `markup` function

t-out renders the raw content if it is a Block, or if it has been marked
with the `markup` funtion.

t-esc has been kept since it is safe and is optimized to render text nodes.

all t-raw calls are in fact the same as t-out.
2022-02-11 10:41:18 +01:00
Géry Debongnie e746574a1d [REF] initial prototype of owl 2 2022-02-11 10:18:01 +01:00