Géry Debongnie
0931a4dc5b
[FIX] qweb: bind handlers to component
...
Before this commit, the handlers were bound to the current context,
which is often the component but not necessarily. In some cases, a sub
scope can be created (with t-foreach, or slots, or t-call), and the
context is actually an object with the actual component instance it its
prototype chain, but not the component.
2019-12-12 14:32:43 +01:00
Géry Debongnie
4e22dbcad6
[FIX] qweb: accept assignations in qweb expressions
...
closes #560
closes #569
2019-12-12 14:32:43 +01:00
Géry Debongnie
b283e65ad4
[REF] qweb: improve t-on generated code
...
and deduplicate logic between directive t-on applied on a node and on a
component
2019-12-12 14:32:43 +01:00
Lucas Perais (lpe)
08022b49df
[FIX] qweb: conditional t-call with body
...
When a t-call has a condition and a body
the t-if's and its flavors should be ignored when compiling the body of a t-call
2019-12-11 14:09:45 +01:00
Géry Debongnie
b96ea79f2b
[FIX] qweb: renderToString now properly escape
...
closes #565
2019-12-11 12:25:05 +01:00
Géry Debongnie
97d8b3ed8c
[REF] tests: remove Widget common class
...
Bad name, and bad practice to use it. It makes tests less standalone.
2019-12-11 12:25:05 +01:00
Géry Debongnie
41cb5f1abd
[FIX] *: remove useless values to t-else and t-debug
...
The actual value does not matter, only the fact that it is present.
closes #564
2019-12-11 12:25:05 +01:00
Lucas Perais (lpe)
9145799ae9
[FIX] qweb: evaluate body of t-set immediately
2019-12-11 10:07:41 +01:00
Géry Debongnie
ce9c2f8613
[FIX] qweb/component: refactoring of scoping/variables/slots
...
This commit is a significant refactoring of the internal of QWeb. It
simplifies the way variables/scoping and slots interact together. The
main idea is that we use a simple scope object instead of a
context/var/scope object.
This commit also implement the actual correct QWeb semantic for the
t-call directive with a sub body. Before, we simply extracted the
variables from the body and injected them at the top of the sub
template. We now simply compile the body before the sub template.
This is a joint work with Lucas (lpe).
closes #541
closes #544
closes #545
closes #557
closes #556
2019-12-11 10:07:41 +01:00
Géry Debongnie
b890e7ceae
[IMP] qweb: add template name in generated compiled code
2019-12-10 16:14:09 +01:00
Géry Debongnie
e162a6fb6c
[IMP] qweb: add support for arrow functions in expression parser
...
closes #542
2019-12-06 11:49:55 +01:00
Géry Debongnie
a0bfbf6dd0
[FIX] qweb/component: do not call handlers for unmounted components
...
Unmounted components should be considered inactive, at least from the
perspective of Owl itself.
closes #543
2019-12-06 09:58:12 +01:00
Géry Debongnie
b67cb71048
[FIX] slots: propagate vars to correct function
...
closes #529
2019-12-06 09:53:48 +01:00
Géry Debongnie
f12d3373c9
[FIX] qweb: properly handle empty class attribute
...
The classList.add method actually crashes when given an empty string (or
a string with just white spaces).
closes #530
2019-12-03 16:19:09 +01:00
Géry Debongnie
8c17bb0411
[FIX] component: reorganize fiber update algorithm
...
Closes #473
Closes #484
Closes #489
Closes #492
Closes #512
Co-authored-by: Aaron Bohy <aab@odoo.com >
2019-11-29 15:13:37 +01:00
Lucas Perais (lpe)
7f6782d009
[FIX] qweb: cascading t-call and t-raw="0"
...
Have a t-call having a t-raw="0"
that call is made to a template of the same form
i.e. itself as a t-call t-raw="0" structure
Before this commit, there was recursion crash
This was because the caller to which a t-raw="0" referred to
was incorrect. The caller here is the node which makes the t-call.
In particular, the caller was always set to last caller of the context
After this commit, there is no crash and this imbrication
of t-call and t-raw="0" is well rendered.
To sum up, we count the recursive calls to t-raw="0" and fetch
the caller in the context accordingly
closes #510
2019-11-29 13:17:40 +01:00
Aaron Bohy
6c8b401092
[FIX] component: slots: multiple slots with components
...
Closes #508
2019-11-27 15:47:55 +01:00
Aaron Bohy
12be815342
[REF] qweb: use global nextID
...
and reset it to 1 before each test s.t. snapshots are deterministic.
2019-11-27 15:47:55 +01:00
Géry Debongnie
6c753bb49f
[FIX] qweb: scope t-key directive to node and subnodes
...
not to siblings
closes #503
2019-11-27 13:31:40 +01:00
Géry Debongnie
8fb35ed969
[FIX] owl: add prettier to devDependencies
...
also, run prettier on codebase
closes #498
2019-11-27 08:06:17 +01:00
Géry Debongnie
bd39797f17
[FIX] component: propagate errors to caller
...
Errors from mounted/willPatch/patched should be returned to caller
(either mount or render functions)
part of #410
2019-11-18 14:29:54 +01:00
Géry Debongnie
94a595ef5b
[FIX] qweb: add support for typeof expression
...
closes #469
2019-11-18 07:57:43 +01:00
Géry Debongnie
bbdc9d90d7
[FIX] qweb: allow mixing body and expression variables
...
closes #445
2019-11-14 14:54:27 +01:00
Géry Debongnie
c2adb429bd
[FIX] package.json: update node and typescript version
...
closes #414
2019-10-28 13:58:44 +01:00
Géry Debongnie
5614c85b04
[IMP] qweb: implement t-key with a directive
...
closes #331
2019-10-28 11:45:51 +01:00
Géry Debongnie
2279dafbec
[IMP] qweb: add an option to setup a translate function
...
closes #393
2019-10-28 11:32:41 +01:00
Géry Debongnie
9dfcfda365
[DOC] add more info on xml tag and single file component
...
closes #401
2019-10-26 09:10:50 +02:00
Aaron Bohy
9c5cad15c1
[IMP] component: refactor rendering pipeline
...
This commit introduces a brand new rendering system based on a fiber
class and a scheduler.
closes #330
2019-10-25 16:01:52 +02:00
Aaron Bohy
2beb12678e
[IMP] t-on directive: allow empty handler
...
Closes #377
2019-10-25 14:11:44 +02:00
Aaron Bohy
0ea1091692
[IMP] t-on directive: handle inline statements
...
Closes #265
2019-10-25 14:11:44 +02:00
Géry Debongnie
c2f42d3b82
[FIX] qweb: do not format expression twice in t-if
...
closes #392
2019-10-24 14:57:48 +02:00
Géry Debongnie
a3317ab997
[FIX] qweb: handle variable expressions in t-if
...
closes #390
closes #362
2019-10-24 08:55:30 +02:00
Géry Debongnie
be556a970e
[FIX] qweb: properly calls directive finalizers
...
closes #382
2019-10-22 21:56:29 +02:00
Géry Debongnie
f6d6da8393
[FIX] component: fix issues with component internal template key
...
closes #298
2019-10-21 09:41:27 +02:00
Géry Debongnie
0aeebd7b6e
[REF] utils: rename loadTemplates into loadFile
...
closes #351
2019-10-18 08:05:26 +02:00
Géry Debongnie
2825a5a55d
[FIX] qweb: properly handle xml comments
2019-10-15 15:47:50 +02:00
Géry Debongnie
4a346d0615
[FIX] qweb: properly remove t-ref reference
...
when the node is removed from the dom
2019-10-14 11:06:59 +02:00
Géry Debongnie
3e8f60cefa
[FIX] qweb: properly handle t-raw in various situations
...
closes #325
closes #327
2019-10-14 09:59:26 +02:00
Géry Debongnie
41b0618c93
[FIX] qweb: improve generated compiled code
2019-10-11 14:10:44 +02:00
Aaron Bohy
0928c189f4
[FIX] qweb: allow to combine t-esc with other directives
...
With this rev., when a t-esc is not set on a <t> tag, we create
it inside the node on which it is set, to ensure that the t-esc
directive is always set on <t> tags.
Same applies for t-raw.
Closes #324
2019-10-11 14:10:44 +02:00
Aaron Bohy
2f27768be2
[FIX] qweb: event modifier with arg in t-foreach
...
Closes #266
2019-10-11 14:01:07 +02:00
Géry Debongnie
5cdaa7b473
[IMP] hooks: implement useRef hook
...
closes #194
2019-09-27 11:20:08 +02:00
Géry Debongnie
5335fb8fba
[IMP] components: add hooks mechanism
...
part of #194
2019-09-27 11:20:08 +02:00
Géry Debongnie
4513e3f31c
[FIX] qweb: improved svg support for components
...
If we want to generate dynamically svg components, it is useful to be
able to define components with a <g> tag as root, and then getting the
correct namespace.
closes #302
2019-09-26 15:46:42 +02:00
Géry Debongnie
ecf12f6eee
[FIX] qweb: properly supports svg
...
Snabbdom supports svg, but it adds the namespace at the creation of the
virtual node. However, owl works slightly differently: it adds children
after creating the parent virtual node.
So, we need to actually call the addNS method after the children nodes
have been created.
As a bonus, this is slightly faster than snabbdom: we only check at
template compilation time once if a node is a svg.
2019-09-24 21:40:46 +02:00
Géry Debongnie
82a6961b3a
[FIX] component: properly handle wrapper component and slots
...
closes #297
2019-09-23 07:13:51 +02:00
Géry Debongnie
bbbaf95c8e
Merge pull request #296 from odoo/issue-293-owl-fibers
...
[MERGE] component: introduce owl fiber
2019-09-20 13:54:59 +02:00
Géry Debongnie
01eb338e69
[REF] component: move patchqueue management to fiber
...
part of #293
2019-09-20 10:47:58 +02:00
Géry Debongnie
3048c6f961
[REF] component: introduce fiber
...
part of #293
2019-09-20 10:47:55 +02:00
Géry Debongnie
8edc637033
[FIX] qweb: remove comments in xml strings before parsing
...
It was done in loadTemplates, but this does not work if we want to add
templates from another source.
2019-09-19 15:18:59 +02:00