fix(ivy): support separate creation mode and update mode execution in runtime (#23292)
PR Close #23292
This commit is contained in:

committed by
Victor Berchet

parent
764760ba63
commit
de3ca56769
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵC as C, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as detectChanges, ɵe as e, ɵsn as sn, ɵt as t, ɵv as v} from '@angular/core';
|
||||
import {ɵC as C, ɵE as E, ɵRenderFlags as RenderFlags, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as detectChanges, ɵe as e, ɵsn as sn, ɵt as t, ɵv as v} from '@angular/core';
|
||||
import {ComponentDef} from '@angular/core/src/render3/interfaces/definition';
|
||||
|
||||
import {TableCell, buildTable, emptyTable} from '../util';
|
||||
@ -18,8 +18,8 @@ export class LargeTableComponent {
|
||||
static ngComponentDef: ComponentDef<LargeTableComponent> = defineComponent({
|
||||
type: LargeTableComponent,
|
||||
selectors: [['largetable']],
|
||||
template: function(ctx: LargeTableComponent, cm: boolean) {
|
||||
if (cm) {
|
||||
template: function(rf: RenderFlags, ctx: LargeTableComponent) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
E(0, 'table');
|
||||
{
|
||||
E(1, 'tbody');
|
||||
@ -28,38 +28,44 @@ export class LargeTableComponent {
|
||||
}
|
||||
e();
|
||||
}
|
||||
cR(2);
|
||||
{
|
||||
for (let row of ctx.data) {
|
||||
let cm1 = V(1);
|
||||
{
|
||||
if (cm1) {
|
||||
E(0, 'tr');
|
||||
C(1);
|
||||
e();
|
||||
}
|
||||
cR(1);
|
||||
if (rf & RenderFlags.Update) {
|
||||
cR(2);
|
||||
{
|
||||
for (let row of ctx.data) {
|
||||
let rf1 = V(1);
|
||||
{
|
||||
for (let cell of row) {
|
||||
let cm2 = V(2);
|
||||
if (rf1 & RenderFlags.Create) {
|
||||
E(0, 'tr');
|
||||
C(1);
|
||||
e();
|
||||
}
|
||||
if (rf1 & RenderFlags.Update) {
|
||||
cR(1);
|
||||
{
|
||||
if (cm2) {
|
||||
E(0, 'td');
|
||||
{ T(1); }
|
||||
e();
|
||||
for (let cell of row) {
|
||||
let rf2 = V(2);
|
||||
{
|
||||
if (rf2 & RenderFlags.Create) {
|
||||
E(0, 'td');
|
||||
{ T(1); }
|
||||
e();
|
||||
}
|
||||
if (rf2 & RenderFlags.Update) {
|
||||
sn(0, 'background-color', b(cell.row % 2 ? '' : 'grey'));
|
||||
t(1, b(cell.value));
|
||||
}
|
||||
}
|
||||
v();
|
||||
}
|
||||
sn(0, 'background-color', b(cell.row % 2 ? '' : 'grey'));
|
||||
t(1, b(cell.value));
|
||||
}
|
||||
v();
|
||||
cr();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
v();
|
||||
}
|
||||
v();
|
||||
}
|
||||
cr();
|
||||
}
|
||||
cr();
|
||||
},
|
||||
factory: () => new LargeTableComponent(),
|
||||
inputs: {data: 'data'}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵC as C, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵi1 as i1, ɵp as p, ɵsn as sn, ɵt as t, ɵv as v} from '@angular/core';
|
||||
import {ɵC as C, ɵE as E, ɵRenderFlags as RenderFlags, ɵT as T, ɵV as V, ɵb as b, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵi1 as i1, ɵp as p, ɵsn as sn, ɵt as t, ɵv as v} from '@angular/core';
|
||||
import {ComponentDef} from '@angular/core/src/render3/interfaces/definition';
|
||||
|
||||
import {TreeNode, buildTree, emptyTree} from '../util';
|
||||
@ -38,46 +38,52 @@ export class TreeComponent {
|
||||
static ngComponentDef: ComponentDef<TreeComponent> = defineComponent({
|
||||
type: TreeComponent,
|
||||
selectors: [['tree']],
|
||||
template: function(ctx: TreeComponent, cm: boolean) {
|
||||
if (cm) {
|
||||
template: function(rf: RenderFlags, ctx: TreeComponent) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
E(0, 'span');
|
||||
{ T(1); }
|
||||
e();
|
||||
C(2);
|
||||
C(3);
|
||||
}
|
||||
sn(0, 'background-color', b(ctx.data.depth % 2 ? '' : 'grey'));
|
||||
t(1, i1(' ', ctx.data.value, ' '));
|
||||
cR(2);
|
||||
{
|
||||
if (ctx.data.left != null) {
|
||||
let cm0 = V(0);
|
||||
{
|
||||
if (cm0) {
|
||||
E(0, 'tree');
|
||||
e();
|
||||
if (rf & RenderFlags.Update) {
|
||||
sn(0, 'background-color', b(ctx.data.depth % 2 ? '' : 'grey'));
|
||||
t(1, i1(' ', ctx.data.value, ' '));
|
||||
cR(2);
|
||||
{
|
||||
if (ctx.data.left != null) {
|
||||
let rf0 = V(0);
|
||||
{
|
||||
if (rf0 & RenderFlags.Create) {
|
||||
E(0, 'tree');
|
||||
e();
|
||||
}
|
||||
if (rf0 & RenderFlags.Update) {
|
||||
p(0, 'data', b(ctx.data.left));
|
||||
}
|
||||
}
|
||||
p(0, 'data', b(ctx.data.left));
|
||||
v();
|
||||
}
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
cR(3);
|
||||
{
|
||||
if (ctx.data.right != null) {
|
||||
let cm0 = V(0);
|
||||
{
|
||||
if (cm0) {
|
||||
E(0, 'tree');
|
||||
e();
|
||||
cr();
|
||||
cR(3);
|
||||
{
|
||||
if (ctx.data.right != null) {
|
||||
let rf0 = V(0);
|
||||
{
|
||||
if (rf0 & RenderFlags.Create) {
|
||||
E(0, 'tree');
|
||||
e();
|
||||
}
|
||||
if (rf0 & RenderFlags.Update) {
|
||||
p(0, 'data', b(ctx.data.right));
|
||||
}
|
||||
}
|
||||
p(0, 'data', b(ctx.data.right));
|
||||
v();
|
||||
}
|
||||
v();
|
||||
}
|
||||
cr();
|
||||
}
|
||||
cr();
|
||||
},
|
||||
factory: () => new TreeComponent,
|
||||
inputs: {data: 'data'},
|
||||
@ -92,17 +98,17 @@ export class TreeFunction {
|
||||
static ngComponentDef: ComponentDef<TreeFunction> = defineComponent({
|
||||
type: TreeFunction,
|
||||
selectors: [['tree']],
|
||||
template: function(ctx: TreeFunction, cm: boolean) {
|
||||
template: function(rf: RenderFlags, ctx: TreeFunction) {
|
||||
// bit of a hack
|
||||
TreeTpl(ctx.data, cm);
|
||||
TreeTpl(rf, ctx.data);
|
||||
},
|
||||
factory: () => new TreeFunction,
|
||||
inputs: {data: 'data'}
|
||||
});
|
||||
}
|
||||
|
||||
export function TreeTpl(ctx: TreeNode, cm: boolean) {
|
||||
if (cm) {
|
||||
export function TreeTpl(rf: RenderFlags, ctx: TreeNode) {
|
||||
if (rf & RenderFlags.Create) {
|
||||
E(0, 'tree');
|
||||
{
|
||||
E(1, 'span');
|
||||
@ -113,24 +119,26 @@ export function TreeTpl(ctx: TreeNode, cm: boolean) {
|
||||
}
|
||||
e();
|
||||
}
|
||||
sn(1, 'background-color', b(ctx.depth % 2 ? '' : 'grey'));
|
||||
t(2, i1(' ', ctx.value, ' '));
|
||||
cR(3);
|
||||
{
|
||||
if (ctx.left != null) {
|
||||
let cm0 = V(0);
|
||||
{ TreeTpl(ctx.left, cm0); }
|
||||
v();
|
||||
if (rf & RenderFlags.Update) {
|
||||
sn(1, 'background-color', b(ctx.depth % 2 ? '' : 'grey'));
|
||||
t(2, i1(' ', ctx.value, ' '));
|
||||
cR(3);
|
||||
{
|
||||
if (ctx.left != null) {
|
||||
let rf0 = V(0);
|
||||
{ TreeTpl(rf0, ctx.left); }
|
||||
v();
|
||||
}
|
||||
}
|
||||
}
|
||||
cr();
|
||||
cR(4);
|
||||
{
|
||||
if (ctx.right != null) {
|
||||
let cm0 = V(0);
|
||||
{ TreeTpl(ctx.right, cm0); }
|
||||
v();
|
||||
cr();
|
||||
cR(4);
|
||||
{
|
||||
if (ctx.right != null) {
|
||||
let rf0 = V(0);
|
||||
{ TreeTpl(rf0, ctx.right); }
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
}
|
||||
cr();
|
||||
}
|
||||
|
Reference in New Issue
Block a user