mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
rename base_widget -> component
This commit is contained in:
@@ -23,8 +23,8 @@ interface Meta<T extends WEnv> {
|
||||
isStarted: boolean;
|
||||
isMounted: boolean;
|
||||
isDestroyed: boolean;
|
||||
parent: BaseWidget<T, any, any> | null;
|
||||
children: { [key: number]: BaseWidget<T, any, any> };
|
||||
parent: Component<T, any, any> | null;
|
||||
children: { [key: number]: Component<T, any, any> };
|
||||
// children mapping: from templateID to widgetID
|
||||
// should it be a map number => Widget?
|
||||
cmap: { [key: number]: number };
|
||||
@@ -40,7 +40,7 @@ export interface Type<T> extends Function {
|
||||
// Widget
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
export class BaseWidget<
|
||||
export class Component<
|
||||
T extends WEnv,
|
||||
Props,
|
||||
State extends {}
|
||||
@@ -57,14 +57,14 @@ export class BaseWidget<
|
||||
state: State = <State>{};
|
||||
props: Props;
|
||||
refs: {
|
||||
[key: string]: BaseWidget<T, any, any> | HTMLElement | undefined;
|
||||
[key: string]: Component<T, any, any> | HTMLElement | undefined;
|
||||
} = {};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Lifecycle
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
constructor(parent: BaseWidget<T, any, any> | T, props?: Props) {
|
||||
constructor(parent: Component<T, any, any> | T, props?: Props) {
|
||||
super();
|
||||
wl.push(this);
|
||||
|
||||
@@ -74,8 +74,8 @@ export class BaseWidget<
|
||||
// Pro: but creating widget (by a template) is always unsafe anyway
|
||||
this.props = <Props>props;
|
||||
let id: number;
|
||||
let p: BaseWidget<T, any, any> | null = null;
|
||||
if (parent instanceof BaseWidget) {
|
||||
let p: Component<T, any, any> | null = null;
|
||||
if (parent instanceof Component) {
|
||||
p = parent;
|
||||
this.env = parent.env;
|
||||
id = this.env.getID();
|
||||
@@ -259,7 +259,7 @@ export class BaseWidget<
|
||||
}
|
||||
}
|
||||
|
||||
private visitSubTree(callback: (w: BaseWidget<T, any, any>) => boolean) {
|
||||
private visitSubTree(callback: (w: Component<T, any, any>) => boolean) {
|
||||
const shouldVisitChildren = callback(this);
|
||||
if (shouldVisitChildren) {
|
||||
const children = this.__widget__.children;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Ajax, IAjax } from "./core/ajax";
|
||||
import { WEnv } from "./core/base_widget";
|
||||
import { WEnv } from "./core/component";
|
||||
import {
|
||||
INotificationManager,
|
||||
NotificationManager
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Type } from "../core/base_widget";
|
||||
import { Type } from "../core/component";
|
||||
import { EventBus } from "../core/event_bus";
|
||||
import { Registry } from "../core/registry";
|
||||
import { Widget } from "../widgets/widget";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { BaseWidget } from "../core/base_widget";
|
||||
import { Component } from "../core/component";
|
||||
import { Env } from "../env";
|
||||
|
||||
export class Widget<Props, State> extends BaseWidget<Env, Props, State> {}
|
||||
export class Widget<Props, State> extends Component<Env, Props, State> {}
|
||||
|
||||
// TODO: move this to PureComponent in core
|
||||
export class PureWidget<Props, State> extends Widget<Props, State> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseWidget, WEnv } from "../../src/ts/core/base_widget";
|
||||
import { Component, WEnv } from "../../src/ts/core/component";
|
||||
import { makeTestFixture, makeTestWEnv, normalize } from "../helpers";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -33,7 +33,7 @@ function nextTick(): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
class Widget extends BaseWidget<WEnv, {}, {}> {}
|
||||
class Widget extends Component<WEnv, {}, {}> {}
|
||||
|
||||
function children(w: Widget): Widget[] {
|
||||
const childrenMap = w.__widget__.children;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { QWeb } from "../src/ts/core/qweb_vdom";
|
||||
import { idGenerator } from "../src/ts/core/utils";
|
||||
import { WEnv } from "../src/ts/core/base_widget";
|
||||
import { WEnv } from "../src/ts/core/component";
|
||||
import { Env } from "../src/ts/env";
|
||||
import { IAjax, RPCQuery } from "../src/ts/core/ajax";
|
||||
import { Registry } from "../src/ts/core/registry";
|
||||
|
||||
Reference in New Issue
Block a user