@odoo/owl 3.0.0-alpha.3 → 3.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -117
- package/dist/owl.cjs.js +6522 -6686
- package/dist/owl.es.js +6501 -6640
- package/dist/owl.iife.js +6525 -6691
- package/dist/owl.iife.min.js +27 -1
- package/dist/types/owl.d.ts +763 -668
- package/package.json +22 -79
- package/dist/compile_templates.mjs +0 -2553
- package/dist/owl-devtools.zip +0 -0
- package/dist/types/common/owl_error.d.ts +0 -3
- package/dist/types/common/types.d.ts +0 -29
- package/dist/types/common/utils.d.ts +0 -8
- package/dist/types/compiler/code_generator.d.ts +0 -152
- package/dist/types/compiler/index.d.ts +0 -13
- package/dist/types/compiler/inline_expressions.d.ts +0 -59
- package/dist/types/compiler/parser.d.ts +0 -178
- package/dist/types/compiler/standalone/index.d.ts +0 -2
- package/dist/types/compiler/standalone/setup_jsdom.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/runtime/app.d.ts +0 -62
- package/dist/types/runtime/blockdom/attributes.d.ts +0 -6
- package/dist/types/runtime/blockdom/block_compiler.d.ts +0 -21
- package/dist/types/runtime/blockdom/config.d.ts +0 -8
- package/dist/types/runtime/blockdom/event_catcher.d.ts +0 -7
- package/dist/types/runtime/blockdom/events.d.ts +0 -8
- package/dist/types/runtime/blockdom/html.d.ts +0 -17
- package/dist/types/runtime/blockdom/index.d.ts +0 -26
- package/dist/types/runtime/blockdom/list.d.ts +0 -18
- package/dist/types/runtime/blockdom/multi.d.ts +0 -17
- package/dist/types/runtime/blockdom/text.d.ts +0 -26
- package/dist/types/runtime/blockdom/toggler.d.ts +0 -17
- package/dist/types/runtime/cancellableContext.d.ts +0 -15
- package/dist/types/runtime/cancellablePromise.d.ts +0 -15
- package/dist/types/runtime/component.d.ts +0 -28
- package/dist/types/runtime/component_node.d.ts +0 -83
- package/dist/types/runtime/error_handling.d.ts +0 -13
- package/dist/types/runtime/event_handling.d.ts +0 -1
- package/dist/types/runtime/executionContext.d.ts +0 -0
- package/dist/types/runtime/fibers.d.ts +0 -37
- package/dist/types/runtime/hooks.d.ts +0 -57
- package/dist/types/runtime/index.d.ts +0 -35
- package/dist/types/runtime/lifecycle_hooks.d.ts +0 -12
- package/dist/types/runtime/listOperation.d.ts +0 -1
- package/dist/types/runtime/plugins.d.ts +0 -39
- package/dist/types/runtime/portal.d.ts +0 -15
- package/dist/types/runtime/reactivity.d.ts +0 -46
- package/dist/types/runtime/registry.d.ts +0 -15
- package/dist/types/runtime/relationalModel/discussModel.d.ts +0 -19
- package/dist/types/runtime/relationalModel/discussModelTypes.d.ts +0 -22
- package/dist/types/runtime/relationalModel/field.d.ts +0 -20
- package/dist/types/runtime/relationalModel/model.d.ts +0 -59
- package/dist/types/runtime/relationalModel/modelData.d.ts +0 -18
- package/dist/types/runtime/relationalModel/modelRegistry.d.ts +0 -3
- package/dist/types/runtime/relationalModel/modelUtils.d.ts +0 -4
- package/dist/types/runtime/relationalModel/store.d.ts +0 -16
- package/dist/types/runtime/relationalModel/types.d.ts +0 -83
- package/dist/types/runtime/relationalModel/util.d.ts +0 -1
- package/dist/types/runtime/relationalModel/web/WebDataPoint.d.ts +0 -25
- package/dist/types/runtime/relationalModel/web/WebRecord.d.ts +0 -131
- package/dist/types/runtime/relationalModel/web/WebStaticList.d.ts +0 -63
- package/dist/types/runtime/relationalModel/web/webModel.d.ts +0 -5
- package/dist/types/runtime/relationalModel/web/webModelTypes.d.ts +0 -139
- package/dist/types/runtime/scheduler.d.ts +0 -21
- package/dist/types/runtime/signals.d.ts +0 -17
- package/dist/types/runtime/status.d.ts +0 -10
- package/dist/types/runtime/task.d.ts +0 -12
- package/dist/types/runtime/template_helpers.d.ts +0 -58
- package/dist/types/runtime/template_set.d.ts +0 -40
- package/dist/types/runtime/utils.d.ts +0 -25
- package/dist/types/runtime/validation.d.ts +0 -36
- package/dist/types/utils/registry.d.ts +0 -15
- package/dist/types/version.d.ts +0 -1
- package/tools/compile_owl_templates.mjs +0 -31
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { VNode } from "./index";
|
|
2
|
-
declare abstract class VSimpleNode {
|
|
3
|
-
text: string | String;
|
|
4
|
-
parentEl?: HTMLElement | undefined;
|
|
5
|
-
el?: any;
|
|
6
|
-
constructor(text: string | String);
|
|
7
|
-
mountNode(node: Node, parent: HTMLElement, afterNode: Node | null): void;
|
|
8
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement | undefined): void;
|
|
9
|
-
moveBeforeVNode(other: VText | null, afterNode: Node | null): void;
|
|
10
|
-
beforeRemove(): void;
|
|
11
|
-
remove(): void;
|
|
12
|
-
firstNode(): Node;
|
|
13
|
-
toString(): string | String;
|
|
14
|
-
}
|
|
15
|
-
declare class VText extends VSimpleNode {
|
|
16
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
17
|
-
patch(other: VText): void;
|
|
18
|
-
}
|
|
19
|
-
declare class VComment extends VSimpleNode {
|
|
20
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
21
|
-
patch(): void;
|
|
22
|
-
}
|
|
23
|
-
export declare function text(str: string | String): VNode<VText>;
|
|
24
|
-
export declare function comment(str: string): VNode<VComment>;
|
|
25
|
-
export declare function toText(value: any): string;
|
|
26
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { VNode } from "./index";
|
|
2
|
-
declare class VToggler {
|
|
3
|
-
key: string;
|
|
4
|
-
child: VNode;
|
|
5
|
-
parentEl?: HTMLElement | undefined;
|
|
6
|
-
constructor(key: string, child: VNode);
|
|
7
|
-
mount(parent: HTMLElement, afterNode: Node | null): void;
|
|
8
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
9
|
-
moveBeforeVNode(other: VToggler | null, afterNode: Node | null): void;
|
|
10
|
-
patch(other: VToggler, withBeforeRemove: boolean): void;
|
|
11
|
-
beforeRemove(): void;
|
|
12
|
-
remove(): void;
|
|
13
|
-
firstNode(): Node | undefined;
|
|
14
|
-
toString(): string;
|
|
15
|
-
}
|
|
16
|
-
export declare function toggler(key: string, child: VNode): VNode<VToggler>;
|
|
17
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare type TaskContext = {
|
|
2
|
-
isCancelled: boolean;
|
|
3
|
-
cancel: () => void;
|
|
4
|
-
meta: Record<string, any>;
|
|
5
|
-
};
|
|
6
|
-
export declare const taskContextStack: TaskContext[];
|
|
7
|
-
export declare function getTaskContext(): TaskContext;
|
|
8
|
-
export declare function makeTaskContext(): TaskContext;
|
|
9
|
-
export declare function useTaskContext(ctx?: TaskContext): {
|
|
10
|
-
ctx: TaskContext;
|
|
11
|
-
cleanup: () => void;
|
|
12
|
-
};
|
|
13
|
-
export declare function pushTaskContext(context: TaskContext): void;
|
|
14
|
-
export declare function popTaskContext(): void;
|
|
15
|
-
export declare function taskEffect(fn: Function): TaskContext;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare type PromiseExecContext = {
|
|
2
|
-
cancelled: boolean;
|
|
3
|
-
};
|
|
4
|
-
export declare type CancellablePromise<T = any> = Promise<T> & {
|
|
5
|
-
execContext?: PromiseExecContext;
|
|
6
|
-
};
|
|
7
|
-
export declare const setCancellableContext: (ctx: PromiseExecContext | undefined) => PromiseExecContext | undefined;
|
|
8
|
-
export declare const resetCancellableContext: (ctx: PromiseExecContext | undefined) => void;
|
|
9
|
-
export declare const _exec: (execContext: PromiseExecContext | undefined, cb: Function, args: any[]) => any;
|
|
10
|
-
export declare function patchPromise(): void;
|
|
11
|
-
export declare function restorePromise(): void;
|
|
12
|
-
export declare function getCancellableTask(cb: Function): {
|
|
13
|
-
cancel: () => boolean;
|
|
14
|
-
readonly isCancel: boolean;
|
|
15
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Schema } from "./validation";
|
|
2
|
-
import type { ComponentNode } from "./component_node";
|
|
3
|
-
import type { PluginManager } from "./plugins";
|
|
4
|
-
export declare type Props = {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
};
|
|
7
|
-
interface StaticComponentProperties {
|
|
8
|
-
template: string;
|
|
9
|
-
defaultProps?: any;
|
|
10
|
-
props?: Schema;
|
|
11
|
-
components?: {
|
|
12
|
-
[componentName: string]: ComponentConstructor;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare type ComponentConstructor<P extends Props = any, Plugins = any, E = any> = (new (props: P, env: E, plugins: Plugins, node: ComponentNode) => Component<P, Plugins, E>) & StaticComponentProperties;
|
|
16
|
-
export declare class Component<Props = any, Plugins = PluginManager["plugins"], Env = any> {
|
|
17
|
-
static template: string;
|
|
18
|
-
static props?: Schema;
|
|
19
|
-
static defaultProps?: any;
|
|
20
|
-
props: Props;
|
|
21
|
-
env: Env;
|
|
22
|
-
plugins: Plugins;
|
|
23
|
-
__owl__: ComponentNode;
|
|
24
|
-
constructor(props: Props, env: Env, plugins: Plugins, node: ComponentNode);
|
|
25
|
-
setup(): void;
|
|
26
|
-
render(deep?: boolean): void;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Computation } from "../common/types";
|
|
2
|
-
import type { App, Env } from "./app";
|
|
3
|
-
import { BDom, VNode } from "./blockdom";
|
|
4
|
-
import { Component, ComponentConstructor, Props } from "./component";
|
|
5
|
-
import { Fiber, MountFiber, MountOptions } from "./fibers";
|
|
6
|
-
import { PluginManager } from "./plugins";
|
|
7
|
-
import { STATUS } from "./status";
|
|
8
|
-
export declare function saveCurrent(): () => void;
|
|
9
|
-
export declare function getCurrent(): ComponentNode;
|
|
10
|
-
export declare function useComponent(): Component;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a reactive object that will be observed by the current component.
|
|
13
|
-
* Reading data from the returned object (eg during rendering) will cause the
|
|
14
|
-
* component to subscribe to that data and be rerendered when it changes.
|
|
15
|
-
*
|
|
16
|
-
* @param state the state to observe
|
|
17
|
-
* @returns a reactive object that will cause the component to re-render on
|
|
18
|
-
* relevant changes
|
|
19
|
-
* @see reactive
|
|
20
|
-
*/
|
|
21
|
-
export declare function useState<T extends object>(state: T): T;
|
|
22
|
-
declare type LifecycleHook = Function;
|
|
23
|
-
export declare class ComponentNode<P extends Props = any, Plugins = any, E = any> implements VNode<ComponentNode<P, E>> {
|
|
24
|
-
el?: HTMLElement | Text | undefined;
|
|
25
|
-
app: App;
|
|
26
|
-
fiber: Fiber | null;
|
|
27
|
-
component: Component<P, Plugins, E>;
|
|
28
|
-
bdom: BDom | null;
|
|
29
|
-
status: STATUS;
|
|
30
|
-
forceNextRender: boolean;
|
|
31
|
-
parentKey: string | null;
|
|
32
|
-
props: P;
|
|
33
|
-
nextProps: P | null;
|
|
34
|
-
renderFn: Function;
|
|
35
|
-
parent: ComponentNode | null;
|
|
36
|
-
childEnv: Env;
|
|
37
|
-
children: {
|
|
38
|
-
[key: string]: ComponentNode;
|
|
39
|
-
};
|
|
40
|
-
refs: any;
|
|
41
|
-
willStart: LifecycleHook[];
|
|
42
|
-
willUpdateProps: LifecycleHook[];
|
|
43
|
-
willUnmount: LifecycleHook[];
|
|
44
|
-
mounted: LifecycleHook[];
|
|
45
|
-
willPatch: LifecycleHook[];
|
|
46
|
-
patched: LifecycleHook[];
|
|
47
|
-
willDestroy: LifecycleHook[];
|
|
48
|
-
signalComputation: Computation;
|
|
49
|
-
pluginManager: PluginManager;
|
|
50
|
-
constructor(C: ComponentConstructor<P, Plugins, E>, props: P, app: App, parent: ComponentNode | null, parentKey: string | null);
|
|
51
|
-
mountComponent(target: any, options?: MountOptions): void;
|
|
52
|
-
initiateRender(fiber: Fiber | MountFiber): Promise<void>;
|
|
53
|
-
render(deep: boolean): Promise<void>;
|
|
54
|
-
cancel(): void;
|
|
55
|
-
_cancel(): void;
|
|
56
|
-
destroy(): void;
|
|
57
|
-
_destroy(): void;
|
|
58
|
-
updateAndRender(props: P, parentFiber: Fiber): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Finds a child that has dom that is not yet updated, and update it. This
|
|
61
|
-
* method is meant to be used only in the context of repatching the dom after
|
|
62
|
-
* a mounted hook failed and was handled.
|
|
63
|
-
*/
|
|
64
|
-
updateDom(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Sets a ref to a given HTMLElement.
|
|
67
|
-
*
|
|
68
|
-
* @param name the name of the ref to set
|
|
69
|
-
* @param el the HTMLElement to set the ref to. The ref is not set if the el
|
|
70
|
-
* is null, but useRef will not return elements that are not in the DOM
|
|
71
|
-
*/
|
|
72
|
-
setRef(name: string, el: HTMLElement | null): void;
|
|
73
|
-
firstNode(): Node | undefined;
|
|
74
|
-
mount(parent: HTMLElement, anchor: ChildNode): void;
|
|
75
|
-
moveBeforeDOMNode(node: Node | null, parent?: HTMLElement): void;
|
|
76
|
-
moveBeforeVNode(other: ComponentNode<P, E> | null, afterNode: Node | null): void;
|
|
77
|
-
patch(): void;
|
|
78
|
-
_patch(): void;
|
|
79
|
-
beforeRemove(): void;
|
|
80
|
-
remove(): void;
|
|
81
|
-
get name(): string;
|
|
82
|
-
}
|
|
83
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ComponentNode } from "./component_node";
|
|
2
|
-
import type { Fiber } from "./fibers";
|
|
3
|
-
export declare const fibersInError: WeakMap<Fiber, any>;
|
|
4
|
-
export declare const nodeErrorHandlers: WeakMap<ComponentNode, ((error: any) => void)[]>;
|
|
5
|
-
declare type ErrorParams = {
|
|
6
|
-
error: any;
|
|
7
|
-
} & ({
|
|
8
|
-
node: ComponentNode;
|
|
9
|
-
} | {
|
|
10
|
-
fiber: Fiber;
|
|
11
|
-
});
|
|
12
|
-
export declare function handleError(params: ErrorParams): void;
|
|
13
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null | undefined) => boolean;
|
|
File without changes
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BDom } from "./blockdom";
|
|
2
|
-
import type { ComponentNode } from "./component_node";
|
|
3
|
-
export declare function makeChildFiber(node: ComponentNode, parent: Fiber): Fiber;
|
|
4
|
-
export declare function makeRootFiber(node: ComponentNode): Fiber;
|
|
5
|
-
export declare class Fiber {
|
|
6
|
-
node: ComponentNode;
|
|
7
|
-
bdom: BDom | null;
|
|
8
|
-
root: RootFiber | null;
|
|
9
|
-
parent: Fiber | null;
|
|
10
|
-
children: Fiber[];
|
|
11
|
-
appliedToDom: boolean;
|
|
12
|
-
deep: boolean;
|
|
13
|
-
childrenMap: ComponentNode["children"];
|
|
14
|
-
constructor(node: ComponentNode, parent: Fiber | null);
|
|
15
|
-
render(): void;
|
|
16
|
-
_render(): void;
|
|
17
|
-
}
|
|
18
|
-
export declare class RootFiber extends Fiber {
|
|
19
|
-
counter: number;
|
|
20
|
-
willPatch: Fiber[];
|
|
21
|
-
patched: Fiber[];
|
|
22
|
-
mounted: Fiber[];
|
|
23
|
-
locked: boolean;
|
|
24
|
-
complete(): void;
|
|
25
|
-
setCounter(newValue: number): void;
|
|
26
|
-
}
|
|
27
|
-
declare type Position = "first-child" | "last-child";
|
|
28
|
-
export interface MountOptions {
|
|
29
|
-
position?: Position;
|
|
30
|
-
}
|
|
31
|
-
export declare class MountFiber extends RootFiber {
|
|
32
|
-
target: HTMLElement;
|
|
33
|
-
position: Position;
|
|
34
|
-
constructor(node: ComponentNode, target: HTMLElement, options?: MountOptions);
|
|
35
|
-
complete(): void;
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Env } from "./app";
|
|
2
|
-
/**
|
|
3
|
-
* The purpose of this hook is to allow components to get a reference to a sub
|
|
4
|
-
* html node or component.
|
|
5
|
-
*/
|
|
6
|
-
export declare function useRef<T extends HTMLElement = HTMLElement>(name: string): {
|
|
7
|
-
el: T | null;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* This hook is useful as a building block for some customized hooks, that may
|
|
11
|
-
* need a reference to the env of the component calling them.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useEnv<E extends Env>(): E;
|
|
14
|
-
/**
|
|
15
|
-
* This hook is a simple way to let components use a sub environment. Note that
|
|
16
|
-
* like for all hooks, it is important that this is only called in the
|
|
17
|
-
* constructor method.
|
|
18
|
-
*/
|
|
19
|
-
export declare function useSubEnv(envExtension: Env): void;
|
|
20
|
-
export declare function useChildSubEnv(envExtension: Env): void;
|
|
21
|
-
declare type EffectDeps<T extends unknown[]> = T | (T extends [...infer H, never] ? EffectDeps<H> : never);
|
|
22
|
-
/**
|
|
23
|
-
* @template T
|
|
24
|
-
* @param {...T} dependencies the dependencies computed by computeDependencies
|
|
25
|
-
* @returns {void|(()=>void)} a cleanup function that reverses the side
|
|
26
|
-
* effects of the effect callback.
|
|
27
|
-
*/
|
|
28
|
-
declare type Effect<T extends unknown[]> = (...dependencies: EffectDeps<T>) => void | (() => void);
|
|
29
|
-
/**
|
|
30
|
-
* This hook will run a callback when a component is mounted and patched, and
|
|
31
|
-
* will run a cleanup function before patching and before unmounting the
|
|
32
|
-
* the component.
|
|
33
|
-
*
|
|
34
|
-
* @template T
|
|
35
|
-
* @param {Effect<T>} effect the effect to run on component mount and/or patch
|
|
36
|
-
* @param {()=>[...T]} [computeDependencies=()=>[NaN]] a callback to compute
|
|
37
|
-
* dependencies that will decide if the effect needs to be cleaned up and
|
|
38
|
-
* run again. If the dependencies did not change, the effect will not run
|
|
39
|
-
* again. The default value returns an array containing only NaN because
|
|
40
|
-
* NaN !== NaN, which will cause the effect to rerun on every patch.
|
|
41
|
-
*/
|
|
42
|
-
export declare function useEffect<T extends unknown[]>(effect: Effect<T>, computeDependencies?: () => [...T]): void;
|
|
43
|
-
/**
|
|
44
|
-
* When a component needs to listen to DOM Events on element(s) that are not
|
|
45
|
-
* part of his hierarchy, we can use the `useExternalListener` hook.
|
|
46
|
-
* It will correctly add and remove the event listener, whenever the
|
|
47
|
-
* component is mounted and unmounted.
|
|
48
|
-
*
|
|
49
|
-
* Example:
|
|
50
|
-
* a menu needs to listen to the click on window to be closed automatically
|
|
51
|
-
*
|
|
52
|
-
* Usage:
|
|
53
|
-
* in the constructor of the OWL component that needs to be notified,
|
|
54
|
-
* `useExternalListener(window, 'click', this._doSomething);`
|
|
55
|
-
* */
|
|
56
|
-
export declare function useExternalListener(target: EventTarget, eventName: string, handler: EventListener, eventParams?: AddEventListenerOptions): void;
|
|
57
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createBlock, html, list, mount as blockMount, multi, patch, remove, text, toggler, comment } from "./blockdom";
|
|
2
|
-
export { Registry } from "./registry";
|
|
3
|
-
export declare const blockDom: {
|
|
4
|
-
config: {
|
|
5
|
-
shouldNormalizeDom: boolean;
|
|
6
|
-
mainEventHandler: (data: any, ev: Event, currentTarget?: EventTarget | null | undefined) => boolean;
|
|
7
|
-
};
|
|
8
|
-
mount: typeof blockMount;
|
|
9
|
-
patch: typeof patch;
|
|
10
|
-
remove: typeof remove;
|
|
11
|
-
list: typeof list;
|
|
12
|
-
multi: typeof multi;
|
|
13
|
-
text: typeof text;
|
|
14
|
-
toggler: typeof toggler;
|
|
15
|
-
createBlock: typeof createBlock;
|
|
16
|
-
html: typeof html;
|
|
17
|
-
comment: typeof comment;
|
|
18
|
-
};
|
|
19
|
-
export { App, mount } from "./app";
|
|
20
|
-
export { xml } from "./template_set";
|
|
21
|
-
export { Component } from "./component";
|
|
22
|
-
export type { ComponentConstructor } from "./component";
|
|
23
|
-
export { useComponent, useState } from "./component_node";
|
|
24
|
-
export { status } from "./status";
|
|
25
|
-
export { reactive, markRaw, toRaw } from "./reactivity";
|
|
26
|
-
export { effect, withoutReactivity, derived, signal } from "./signals";
|
|
27
|
-
export { useEffect, useEnv, useExternalListener, useRef, useChildSubEnv, useSubEnv } from "./hooks";
|
|
28
|
-
export { batched, EventBus, htmlEscape, whenReady, loadFile, markup } from "./utils";
|
|
29
|
-
export { onWillStart, onMounted, onWillUnmount, onWillUpdateProps, onWillPatch, onPatched, onWillRender, onRendered, onWillDestroy, onError, } from "./lifecycle_hooks";
|
|
30
|
-
export { validate, validateType } from "./validation";
|
|
31
|
-
export { OwlError } from "../common/owl_error";
|
|
32
|
-
export declare const __info__: {
|
|
33
|
-
version: string;
|
|
34
|
-
};
|
|
35
|
-
export { Plugin, PluginManager, usePlugins } from "./plugins";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare function onWillStart(fn: () => Promise<void> | void | any): void;
|
|
2
|
-
export declare function onWillUpdateProps(fn: (nextProps: any) => Promise<void> | void | any): void;
|
|
3
|
-
export declare function onMounted(fn: () => void | any): void;
|
|
4
|
-
export declare function onWillPatch(fn: () => any | void): void;
|
|
5
|
-
export declare function onPatched(fn: () => void | any): void;
|
|
6
|
-
export declare function onWillUnmount(fn: () => void | any): void;
|
|
7
|
-
export declare function onWillDestroy(fn: () => void | any): void;
|
|
8
|
-
export declare function onWillRender(fn: () => void | any): void;
|
|
9
|
-
export declare function onRendered(fn: () => void | any): void;
|
|
10
|
-
declare type OnErrorCallback = (error: any) => void | any;
|
|
11
|
-
export declare function onError(callback: OnErrorCallback): void;
|
|
12
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function reactiveMap<A, B>(arr: A[], fn: (a: A, index: number) => B): any;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export interface PluginCtor {
|
|
2
|
-
new (deps: any): Plugin<any>;
|
|
3
|
-
id: string;
|
|
4
|
-
dependencies: string[];
|
|
5
|
-
}
|
|
6
|
-
interface PluginMetaData {
|
|
7
|
-
isDestroyed: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare class Plugin<Deps = {
|
|
10
|
-
[name: string]: Plugin;
|
|
11
|
-
}> {
|
|
12
|
-
static id: string;
|
|
13
|
-
static dependencies: string[];
|
|
14
|
-
readonly plugins: Deps;
|
|
15
|
-
static resources: {};
|
|
16
|
-
resources: {
|
|
17
|
-
[name: string]: any;
|
|
18
|
-
};
|
|
19
|
-
__meta__: PluginMetaData;
|
|
20
|
-
setup(): void;
|
|
21
|
-
destroy(): void;
|
|
22
|
-
get isDestroyed(): boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare class PluginManager {
|
|
25
|
-
_parent: PluginManager | null;
|
|
26
|
-
_children: PluginManager[];
|
|
27
|
-
plugins: {
|
|
28
|
-
[id: string]: Plugin;
|
|
29
|
-
};
|
|
30
|
-
resources: {
|
|
31
|
-
[id: string]: any;
|
|
32
|
-
};
|
|
33
|
-
constructor(parent: PluginManager | null, Plugins: PluginCtor[] | (() => PluginCtor[]));
|
|
34
|
-
destroy(): void;
|
|
35
|
-
getPlugin(name: string): Plugin | null;
|
|
36
|
-
getResource(name: string): any[];
|
|
37
|
-
}
|
|
38
|
-
export declare function usePlugins(Plugins: PluginCtor[]): void;
|
|
39
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Component } from "./component";
|
|
2
|
-
/**
|
|
3
|
-
* kind of similar to <t t-slot="default"/>, but it wraps it around a VPortal
|
|
4
|
-
*/
|
|
5
|
-
export declare function portalTemplate(app: any, bdom: any, helpers: any): (ctx: any, node: any, key?: string) => any;
|
|
6
|
-
export declare class Portal extends Component {
|
|
7
|
-
static template: string;
|
|
8
|
-
static props: {
|
|
9
|
-
readonly target: {
|
|
10
|
-
readonly type: StringConstructor;
|
|
11
|
-
};
|
|
12
|
-
readonly slots: true;
|
|
13
|
-
};
|
|
14
|
-
setup(): void;
|
|
15
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
declare type Target = object;
|
|
2
|
-
declare type Reactive<T extends Target> = T;
|
|
3
|
-
/**
|
|
4
|
-
* Mark an object or array so that it is ignored by the reactivity system
|
|
5
|
-
*
|
|
6
|
-
* @param value the value to mark
|
|
7
|
-
* @returns the object itself
|
|
8
|
-
*/
|
|
9
|
-
export declare function markRaw<T extends Target>(value: T): T;
|
|
10
|
-
/**
|
|
11
|
-
* Given a reactive objet, return the raw (non reactive) underlying object
|
|
12
|
-
*
|
|
13
|
-
* @param value a reactive value
|
|
14
|
-
* @returns the underlying value
|
|
15
|
-
*/
|
|
16
|
-
export declare function toRaw<T extends Target, U extends Reactive<T>>(value: U | T): T;
|
|
17
|
-
export declare const targets: WeakMap<object, object>;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a reactive proxy for an object. Reading data on the reactive object
|
|
20
|
-
* subscribes to changes to the data. Writing data on the object will cause the
|
|
21
|
-
* notify callback to be called if there are suscriptions to that data. Nested
|
|
22
|
-
* objects and arrays are automatically made reactive as well.
|
|
23
|
-
*
|
|
24
|
-
* Whenever you are notified of a change, all subscriptions are cleared, and if
|
|
25
|
-
* you would like to be notified of any further changes, you should go read
|
|
26
|
-
* the underlying data again. We assume that if you don't go read it again after
|
|
27
|
-
* being notified, it means that you are no longer interested in that data.
|
|
28
|
-
*
|
|
29
|
-
* Subscriptions:
|
|
30
|
-
* + Reading a property on an object will subscribe you to changes in the value
|
|
31
|
-
* of that property.
|
|
32
|
-
* + Accessing an object's keys (eg with Object.keys or with `for..in`) will
|
|
33
|
-
* subscribe you to the creation/deletion of keys. Checking the presence of a
|
|
34
|
-
* key on the object with 'in' has the same effect.
|
|
35
|
-
* - getOwnPropertyDescriptor does not currently subscribe you to the property.
|
|
36
|
-
* This is a choice that was made because changing a key's value will trigger
|
|
37
|
-
* this trap and we do not want to subscribe by writes. This also means that
|
|
38
|
-
* Object.hasOwnProperty doesn't subscribe as it goes through this trap.
|
|
39
|
-
*
|
|
40
|
-
* @param target the object for which to create a reactive proxy
|
|
41
|
-
* @param callback the function to call when an observed property of the
|
|
42
|
-
* reactive has changed
|
|
43
|
-
* @returns a proxy that tracks changes to it
|
|
44
|
-
*/
|
|
45
|
-
export declare function reactive<T extends Target>(target: T): T;
|
|
46
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TypeDescription } from "./validation";
|
|
2
|
-
declare type Fn<T> = () => T;
|
|
3
|
-
export declare class Registry<T> {
|
|
4
|
-
_map: {
|
|
5
|
-
[key: string]: [number, T];
|
|
6
|
-
};
|
|
7
|
-
_name: string;
|
|
8
|
-
_type?: TypeDescription;
|
|
9
|
-
items: Fn<T[]>;
|
|
10
|
-
entries: Fn<[string, T][]>;
|
|
11
|
-
constructor(name?: string, type?: TypeDescription);
|
|
12
|
-
set(key: string, value: T, sequence?: number): void;
|
|
13
|
-
get(key: string, defaultValue?: T): T;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AttrParams, DateParams, DatetimeParams, HtmlParams, ManyParams, RelationParams } from "./discussModelTypes";
|
|
2
|
-
import { Model } from "./model";
|
|
3
|
-
import { FieldDefinition } from "./types";
|
|
4
|
-
export declare class DiscussRecord {
|
|
5
|
-
static Model: typeof Model;
|
|
6
|
-
static fields: Record<string, FieldDefinition>;
|
|
7
|
-
static register(): void;
|
|
8
|
-
static insert(data: Partial<any>): any;
|
|
9
|
-
record: Model;
|
|
10
|
-
constructor();
|
|
11
|
-
}
|
|
12
|
-
export declare const fields: {
|
|
13
|
-
One: (modelName: string, params?: RelationParams) => import("./types").FieldDefinitionMany2One;
|
|
14
|
-
Many: (modelName: string, params?: ManyParams) => FieldDefinition;
|
|
15
|
-
Attr: (defaultValue: string, params?: AttrParams) => import("./types").FieldDefinitionAny;
|
|
16
|
-
Html: (defaultValue: string, params?: HtmlParams) => import("./types").FieldDefinitionAny;
|
|
17
|
-
Date: (params?: DateParams) => import("./types").FieldDefinitionAny;
|
|
18
|
-
Datetime: (params?: DatetimeParams) => import("./types").FieldDefinitionAny;
|
|
19
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DiscussRecord } from "./discussModel";
|
|
2
|
-
export declare type FieldCommonParams = {
|
|
3
|
-
compute?: (record: DiscussRecord) => any;
|
|
4
|
-
eager?: boolean;
|
|
5
|
-
onUpdate?: (record: DiscussRecord) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare type RelationParams = FieldCommonParams & {
|
|
8
|
-
inverse?: string;
|
|
9
|
-
onAdd?: (record: DiscussRecord) => void;
|
|
10
|
-
onDelete?: (record: DiscussRecord) => void;
|
|
11
|
-
};
|
|
12
|
-
export declare type ManyParams = RelationParams & {
|
|
13
|
-
sort?: (a: DiscussRecord, b: DiscussRecord) => number;
|
|
14
|
-
};
|
|
15
|
-
export declare type AttrParams = FieldCommonParams & {
|
|
16
|
-
sort?: (a: DiscussRecord, b: DiscussRecord) => number;
|
|
17
|
-
type?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare type HtmlParams = FieldCommonParams;
|
|
20
|
-
export declare type DateParams = FieldCommonParams;
|
|
21
|
-
export declare type DatetimeParams = FieldCommonParams;
|
|
22
|
-
export declare type DManyFn<T extends DiscussRecord> = () => T[];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FieldDefinition, FieldDefinitionAny, FieldDefinitionChar, FieldDefinitionDate, FieldDefinitionDatetime, FieldDefinitionHtml, FieldDefinitionMany2One, FieldDefinitionMany2OneReference, FieldDefinitionNumber, FieldDefinitionOne2Many, FieldDefinitionProperties, FieldDefinitionReference, FieldDefinitionSelection, FieldDefinitionText, FieldTypes, ModelId } from "./types";
|
|
2
|
-
export declare const fieldAny: () => FieldDefinitionAny;
|
|
3
|
-
export declare const fieldNumber: () => FieldDefinitionNumber;
|
|
4
|
-
export declare const fieldChar: () => FieldDefinitionChar;
|
|
5
|
-
export declare const fieldText: () => FieldDefinitionText;
|
|
6
|
-
export declare const fieldHtml: () => FieldDefinitionHtml;
|
|
7
|
-
export declare const fieldDate: () => FieldDefinitionDate;
|
|
8
|
-
export declare const fieldDatetime: () => FieldDefinitionDatetime;
|
|
9
|
-
export declare const fieldSelection: (selection: any) => FieldDefinitionSelection;
|
|
10
|
-
export declare const fieldReference: () => FieldDefinitionReference;
|
|
11
|
-
export declare const fieldProperties: () => FieldDefinitionProperties;
|
|
12
|
-
export declare const fieldOne2Many: (modelId: ModelId, { relatedField }?: {
|
|
13
|
-
relatedField?: string | undefined;
|
|
14
|
-
}) => FieldDefinitionOne2Many;
|
|
15
|
-
export declare const fieldMany2One: (modelId: ModelId) => FieldDefinitionMany2One;
|
|
16
|
-
export declare const fieldMany2Many: (modelId: ModelId, opts?: {
|
|
17
|
-
relationTableName?: string;
|
|
18
|
-
}) => FieldDefinition;
|
|
19
|
-
export declare const fieldMany2OneReference: () => FieldDefinitionMany2OneReference;
|
|
20
|
-
export declare const field: (type: FieldTypes, opts?: any) => FieldDefinition;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { MakeGetSet } from "../../common/types";
|
|
2
|
-
import { ModelId, InstanceId, FieldDefinition, RecordItem, RelationChanges, DraftContext } from "./types";
|
|
3
|
-
export declare class Model {
|
|
4
|
-
static id: ModelId;
|
|
5
|
-
static fields: Record<string, FieldDefinition>;
|
|
6
|
-
static relatedFields: Record<string, string>;
|
|
7
|
-
static recordsItems: Record<InstanceId, RecordItem>;
|
|
8
|
-
static create<T extends typeof Model>(this: T, data: Partial<InstanceType<T>>): InstanceType<T>;
|
|
9
|
-
static get<T extends typeof Model>(this: T, id: InstanceId, context?: DraftContext): InstanceType<T>;
|
|
10
|
-
static getAll<T extends typeof Model>(this: T): InstanceType<T>[];
|
|
11
|
-
static register<T extends typeof Model>(this: T): T;
|
|
12
|
-
static getRecordItem(id: InstanceId, defaultData?: Record<string, any>): RecordItem;
|
|
13
|
-
static getGlobalInstance<T extends typeof Model>(this: T, id: InstanceId): InstanceType<T>;
|
|
14
|
-
static getContextInstance<T extends typeof Model>(this: T, id: InstanceId, draftContext?: DraftContext): InstanceType<T>;
|
|
15
|
-
id?: InstanceId;
|
|
16
|
-
data: RecordItem["data"];
|
|
17
|
-
reactiveData: RecordItem["reactiveData"];
|
|
18
|
-
changes: RelationChanges;
|
|
19
|
-
reactiveChanges: RelationChanges;
|
|
20
|
-
parentRecord?: Model;
|
|
21
|
-
childRecords: Model[];
|
|
22
|
-
draftContext?: DraftContext;
|
|
23
|
-
constructor(idOrParentRecord?: InstanceId | Model, params?: {
|
|
24
|
-
createData?: Record<string, any>;
|
|
25
|
-
draftContext?: DraftContext;
|
|
26
|
-
});
|
|
27
|
-
delete(): void;
|
|
28
|
-
isNew(): boolean;
|
|
29
|
-
hasChanges(): boolean;
|
|
30
|
-
makeDraft(): this;
|
|
31
|
-
saveDraft(): void;
|
|
32
|
-
_saveDraft(parentDraftContext: DraftContext): void;
|
|
33
|
-
withContext(fn: () => void): void;
|
|
34
|
-
_setDraftItem(id: InstanceId): void;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Define a lazy property on an object that computes its getter and setter on first access.
|
|
38
|
-
* Allowing to delay some computation until the property is actually used.
|
|
39
|
-
*
|
|
40
|
-
* @param object The object on which to define the property.
|
|
41
|
-
* @param property The name of the property to define.
|
|
42
|
-
* @param makeGetSet A function that returns a tuple containing the getter and optional setter.
|
|
43
|
-
* @example
|
|
44
|
-
* defineLazyProperty(MyClass.prototype, "myProperty", function() {
|
|
45
|
-
* // Some computing that will only run once, on first access.
|
|
46
|
-
* return [
|
|
47
|
-
* () => this._myProperty,
|
|
48
|
-
* (value) => { this._myProperty = value; }
|
|
49
|
-
* ];
|
|
50
|
-
* });
|
|
51
|
-
*/
|
|
52
|
-
export declare function defineLazyProperty<T, V>(object: object, property: string, makeGetSet: MakeGetSet<T, V>): void;
|
|
53
|
-
export declare function combineLists(listA: InstanceId[], deleteList: InstanceId[], addList: InstanceId[]): InstanceId[];
|
|
54
|
-
export declare function ensureContext(context: DraftContext, record: Model): Model | undefined;
|
|
55
|
-
export declare function withDraftContext<T>(context: DraftContext, fn: () => T): T;
|
|
56
|
-
export declare function saveDraftContext(context: DraftContext): void;
|
|
57
|
-
export declare function makeDraftContext(parent?: DraftContext): DraftContext;
|
|
58
|
-
export declare function formatId(number: number): string;
|
|
59
|
-
export declare function resetIdCounter(): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Model } from "./model";
|
|
2
|
-
import { InstanceId, ModelId, RelationChanges } from "./types";
|
|
3
|
-
export declare type DataToSave = Record<ModelId, Record<InstanceId, RelationChanges>>;
|
|
4
|
-
export declare const saveHooks: {
|
|
5
|
-
onSave: (data: DataToSave) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare const x2ManyCommands: {
|
|
8
|
-
CREATE: number;
|
|
9
|
-
UPDATE: number;
|
|
10
|
-
DELETE: number;
|
|
11
|
-
UNLINK: number;
|
|
12
|
-
LINK: number;
|
|
13
|
-
CLEAR: number;
|
|
14
|
-
SET: number;
|
|
15
|
-
};
|
|
16
|
-
export declare function getRecordChanges(record: Model, dataToSave?: DataToSave, processedRecords?: Set<Model>): Record<string, any>;
|
|
17
|
-
export declare function saveModels(): void;
|
|
18
|
-
export declare function commitRecordChanges(record: Model): void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function isRelatedField(fieldType: string): boolean;
|
|
2
|
-
export declare function isX2ManyField(fieldType: string): boolean;
|
|
3
|
-
export declare function isOne2ManyField(fieldType: string): boolean;
|
|
4
|
-
export declare function isMany2OneField(fieldType: string): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Model } from "./model";
|
|
2
|
-
import { ModelId, InstanceId, RecordItem, NormalizedDomain, SearchEntry, DraftContextStore } from "./types";
|
|
3
|
-
export declare type StoreData = Record<ModelId, Record<InstanceId, RecordItem>>;
|
|
4
|
-
declare class Store {
|
|
5
|
-
searches: Record<ModelId, Record<NormalizedDomain, SearchEntry>>;
|
|
6
|
-
data: Record<ModelId, Record<InstanceId, RecordItem>>;
|
|
7
|
-
getModelData(modelId: ModelId): Record<InstanceId, RecordItem>;
|
|
8
|
-
}
|
|
9
|
-
export declare const globalStore: Store;
|
|
10
|
-
export declare function setStore(store: any): void;
|
|
11
|
-
export declare function destroyStore(): void;
|
|
12
|
-
export declare function loadRecord(modelId: ModelId, instanceId: InstanceId, data: Record<string, any>): void;
|
|
13
|
-
export declare function loadRecordWithRelated(Mod: typeof Model, instanceData: Record<string, any>): Model;
|
|
14
|
-
export declare function flushDataToLoad(): void;
|
|
15
|
-
export declare function getStoreChanges(store: DraftContextStore): any;
|
|
16
|
-
export {};
|