@zcomponent/core 0.0.1 → 0.0.4
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/lib/actionbehavior.d.ts +10 -13
- package/lib/actionbehavior.js +17 -27
- package/lib/behavior.d.ts +22 -25
- package/lib/behavior.js +33 -5
- package/lib/behaviors/LaunchURL.d.ts +18 -7
- package/lib/behaviors/LaunchURL.js +14 -9
- package/lib/behaviors/LogAnalyticsEvent.d.ts +11 -5
- package/lib/behaviors/LogAnalyticsEvent.js +12 -7
- package/lib/behaviors/PlaySound.d.ts +15 -3
- package/lib/behaviors/PlaySound.js +35 -15
- package/lib/component.d.ts +28 -20
- package/lib/component.js +55 -3
- package/lib/components/DefaultLoader.d.ts +23 -16
- package/lib/components/DefaultLoader.js +63 -94
- package/lib/contexts/canvascontext.d.ts +1 -1
- package/lib/contexts/cookieconsentcontext.d.ts +5 -5
- package/lib/contexts/loadcontext.d.ts +4 -4
- package/lib/event.d.ts +1 -1
- package/lib/observable.d.ts +9 -6
- package/lib/observable.js +5 -2
- package/lib/selectors.js +10 -10
- package/lib/types.d.ts +2 -1
- package/lib/types.js +6 -1
- package/lib/zcomponent.d.ts +10 -12
- package/lib/zcomponent.js +135 -116
- package/package.json +1 -1
- package/lib/props.d.ts +0 -0
- package/lib/props.js +0 -4
package/lib/actionbehavior.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InstanceOfComponent } from "./component";
|
|
1
|
+
import { Behavior, BehaviorConstructorProps } from "./behavior";
|
|
3
2
|
import { ContextManager } from "./context";
|
|
4
|
-
export
|
|
5
|
-
export interface ActionBehaviorConstructorProps {
|
|
3
|
+
export interface ActionBehaviorConstructorProps extends BehaviorConstructorProps {
|
|
6
4
|
/** @zprop
|
|
7
5
|
* @zvalues events
|
|
8
6
|
*/
|
|
9
7
|
event: string;
|
|
10
|
-
instance: InstanceOfComponent<any>;
|
|
11
8
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
export declare abstract class ActionBehavior<ConstructorProps extends ActionBehaviorConstructorProps = ActionBehaviorConstructorProps> extends Behavior<any, ConstructorProps> {
|
|
10
|
+
/**
|
|
11
|
+
* @zprop
|
|
12
|
+
* @zdefault true
|
|
13
|
+
*/
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
constructor(props: ConstructorProps, contextManager: ContextManager);
|
|
16
|
+
abstract perform(): any;
|
|
18
17
|
}
|
|
19
|
-
export declare function defineActionBehavior<ActionConstructorProps extends {}>(a: ActionConstructorType<ActionConstructorProps>): ConcreteBehavior<any, ActionConstructorProps & ActionBehaviorConstructorProps, ActionBehaviorProps>;
|
|
20
|
-
export declare function defineActionBehavior<ActionConstructorProps extends {}>(a: ActionConstructorType<ActionConstructorProps>, preview: true): ConcreteBehavior<any, ActionConstructorProps & ActionBehaviorConstructorProps, PreviewableActionBehaviorProps>;
|
package/lib/actionbehavior.js
CHANGED
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Behavior } from "./behavior";
|
|
2
2
|
import { isEditTime } from "./contexts/environmentcontext";
|
|
3
3
|
import { Event } from "./event";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
export class ActionBehavior extends Behavior {
|
|
5
|
+
constructor(props, contextManager) {
|
|
6
|
+
super(props, contextManager);
|
|
7
|
+
/**
|
|
8
|
+
* @zprop
|
|
9
|
+
* @zdefault true
|
|
10
|
+
*/
|
|
11
|
+
this.enabled = true;
|
|
12
|
+
const evt = props.instance[props.event];
|
|
13
|
+
if (evt instanceof Event && !isEditTime(contextManager)) {
|
|
14
|
+
this.register(evt, e => {
|
|
15
|
+
this.perform();
|
|
16
|
+
if (e && typeof e === 'object' && typeof e['stopPropagation'] === 'function') {
|
|
17
|
+
e['stopPropagation'].call(e);
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
evt.bindfn(handler);
|
|
19
|
+
});
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
/** @zprop */
|
|
23
|
-
preview: preview ? () => {
|
|
24
|
-
upstreamHandler?.();
|
|
25
|
-
} : undefined,
|
|
26
|
-
dispose: () => {
|
|
27
|
-
if (handler)
|
|
28
|
-
evt?.unbindfn(handler);
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}, true);
|
|
21
|
+
}
|
|
32
22
|
}
|
package/lib/behavior.d.ts
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import { Component
|
|
1
|
+
import { Component } from './component';
|
|
2
2
|
import { ContextManager } from './context';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare
|
|
23
|
-
export declare
|
|
24
|
-
export declare function shouldBehaviorRunAtDesignTime(b: Behavior): boolean;
|
|
25
|
-
/** Register a new custom behavior */
|
|
26
|
-
export declare function defineBehavior<BehaviorType extends Behavior>(c: BehaviorType, runAtDesignTime?: boolean): BehaviorType;
|
|
3
|
+
import { Event } from './event';
|
|
4
|
+
import { Observable } from './observable';
|
|
5
|
+
export declare type BehaviorConstructor<BehaviorType = Behavior> = BehaviorType extends Behavior<any, infer ConstructorPropsType> ? new (props: ConstructorPropsType, contextManager: ContextManager) => BehaviorType : never;
|
|
6
|
+
export declare type ConstructorPropsOfBehavior<BehaviorType> = BehaviorType extends Behavior<infer R> ? R : never;
|
|
7
|
+
export interface BehaviorConstructorProps<InstanceType extends Component = Component> {
|
|
8
|
+
instance: InstanceType;
|
|
9
|
+
}
|
|
10
|
+
export declare class Behavior<InstanceType extends Component = any, ConstructorPropsType extends BehaviorConstructorProps<InstanceType> = BehaviorConstructorProps<InstanceType>> {
|
|
11
|
+
constructorProps: ConstructorPropsType;
|
|
12
|
+
contextManager: ContextManager;
|
|
13
|
+
private static callSuperDispose;
|
|
14
|
+
onDispose: Event<[]>;
|
|
15
|
+
instance: InstanceType;
|
|
16
|
+
private _registered;
|
|
17
|
+
constructor(constructorProps: ConstructorPropsType, contextManager: ContextManager);
|
|
18
|
+
register<Args extends Array<any>>(evt: Event<Args>, fn: (...args: Args) => void): any;
|
|
19
|
+
register<Type>(observable: Observable<Type>, fn: (v: Type) => void): any;
|
|
20
|
+
dispose(): never;
|
|
21
|
+
}
|
|
22
|
+
export declare function shouldBehaviorRunAtDesignTime(b: BehaviorConstructor): boolean;
|
|
23
|
+
export declare function registerBehaviorRunAtDesignTime(b: BehaviorConstructor): Set<new (props: BehaviorConstructorProps<any>, contextManager: ContextManager) => Behavior<any, BehaviorConstructorProps<any>>>;
|
package/lib/behavior.js
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
|
+
import { Event } from './event';
|
|
2
|
+
import { Observable } from './observable';
|
|
3
|
+
export class Behavior {
|
|
4
|
+
constructor(constructorProps, contextManager) {
|
|
5
|
+
this.constructorProps = constructorProps;
|
|
6
|
+
this.contextManager = contextManager;
|
|
7
|
+
this.onDispose = new Event();
|
|
8
|
+
this._registered = [];
|
|
9
|
+
this.instance = this.constructorProps.instance;
|
|
10
|
+
}
|
|
11
|
+
register(e, fn) {
|
|
12
|
+
if (e instanceof Event)
|
|
13
|
+
e.bindfn(fn);
|
|
14
|
+
else if (e instanceof Observable)
|
|
15
|
+
e.withValue(fn);
|
|
16
|
+
this._registered.push([e, fn]);
|
|
17
|
+
}
|
|
18
|
+
dispose() {
|
|
19
|
+
for (const entry of this._registered) {
|
|
20
|
+
if (entry[0] instanceof Event)
|
|
21
|
+
entry[0].unbindfn(entry[1]);
|
|
22
|
+
else if (entry[0] instanceof Observable)
|
|
23
|
+
entry[0].removeWithValue(entry[1]);
|
|
24
|
+
}
|
|
25
|
+
this._registered = [];
|
|
26
|
+
this.onDispose.emit();
|
|
27
|
+
this.onDispose.clear();
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
Behavior.callSuperDispose = Symbol('Calling super.dispose() is mandatory');
|
|
1
32
|
const behaviorsToRunAtDesignTime = new Set();
|
|
2
33
|
export function shouldBehaviorRunAtDesignTime(b) {
|
|
3
34
|
return behaviorsToRunAtDesignTime.has(b);
|
|
4
35
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (runAtDesignTime)
|
|
8
|
-
behaviorsToRunAtDesignTime.add(c);
|
|
9
|
-
return c;
|
|
36
|
+
export function registerBehaviorRunAtDesignTime(b) {
|
|
37
|
+
return behaviorsToRunAtDesignTime.add(b);
|
|
10
38
|
}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ActionBehavior } from "../actionbehavior";
|
|
2
|
+
/**
|
|
3
|
+
* Navigates the user to the provided URL.
|
|
4
|
+
*
|
|
5
|
+
* **Important Note**: Safari on iOS will not open URLs in new tabs for pointer events except `onPointerUp`.
|
|
6
|
+
*
|
|
7
|
+
* @zbehavior
|
|
8
|
+
* @zgroup Actions
|
|
9
|
+
*/
|
|
10
|
+
export declare class LaunchURL extends ActionBehavior {
|
|
11
|
+
/**
|
|
12
|
+
* The URL to open
|
|
13
|
+
* @zprop
|
|
14
|
+
*/
|
|
3
15
|
url: string;
|
|
4
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* If true, the URL will be opened in a new tab (using target '_blank')
|
|
18
|
+
* @zprop
|
|
5
19
|
* @zdefault true
|
|
6
20
|
*/
|
|
7
21
|
openInNew: boolean;
|
|
22
|
+
perform(): void;
|
|
8
23
|
}
|
|
9
|
-
/** @zbehavior
|
|
10
|
-
* @zgroup Actions
|
|
11
|
-
*/
|
|
12
|
-
export declare const LaunchURL: import("..").ConcreteBehavior<any, LaunchURLProps & import("../actionbehavior").ActionBehaviorConstructorProps, import("../actionbehavior").ActionBehaviorProps>;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
1
|
+
import { ActionBehavior } from "../actionbehavior";
|
|
2
|
+
/**
|
|
3
|
+
* Navigates the user to the provided URL.
|
|
4
|
+
*
|
|
5
|
+
* **Important Note**: Safari on iOS will not open URLs in new tabs for pointer events except `onPointerUp`.
|
|
6
|
+
*
|
|
7
|
+
* @zbehavior
|
|
3
8
|
* @zgroup Actions
|
|
4
9
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
window.open(
|
|
10
|
+
export class LaunchURL extends ActionBehavior {
|
|
11
|
+
perform() {
|
|
12
|
+
if (this.openInNew ?? true)
|
|
13
|
+
window.open(this.url, '_blank', 'noopener noreferrer');
|
|
9
14
|
else
|
|
10
|
-
window.location.href =
|
|
11
|
-
}
|
|
12
|
-
}
|
|
15
|
+
window.location.href = this.url;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { ActionBehavior } from "../actionbehavior";
|
|
2
|
+
/**
|
|
3
|
+
* Logs an event through the currently configured analytics provider(s).
|
|
4
|
+
*
|
|
5
|
+
* Note: you must have added an analytics provider to the Hierarchy in one of your components for this behavior to have any effect.
|
|
6
|
+
*
|
|
7
|
+
* @zbehavior
|
|
8
|
+
* @zgroup Actions
|
|
9
|
+
*/
|
|
10
|
+
export declare class LogAnalyticsEvent extends ActionBehavior {
|
|
2
11
|
/** @zprop */
|
|
3
12
|
name: string;
|
|
4
13
|
/** @zprop */
|
|
5
14
|
params: any;
|
|
15
|
+
perform(): void;
|
|
6
16
|
}
|
|
7
|
-
/** @zbehavior
|
|
8
|
-
* @zgroup Actions
|
|
9
|
-
*/
|
|
10
|
-
export declare const LogAnalyticsEvent: import("..").ConcreteBehavior<any, LogAnalyticsEventProps & import("../actionbehavior").ActionBehaviorConstructorProps, import("../actionbehavior").ActionBehaviorProps>;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionBehavior } from "../actionbehavior";
|
|
2
2
|
import { logEvent } from "../contexts/analyticscontext";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Logs an event through the currently configured analytics provider(s).
|
|
5
|
+
*
|
|
6
|
+
* Note: you must have added an analytics provider to the Hierarchy in one of your components for this behavior to have any effect.
|
|
7
|
+
*
|
|
8
|
+
* @zbehavior
|
|
4
9
|
* @zgroup Actions
|
|
5
10
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
logEvent(
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
+
export class LogAnalyticsEvent extends ActionBehavior {
|
|
12
|
+
perform() {
|
|
13
|
+
logEvent(this.contextManager, this.name, this.params);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ActionBehavior, ActionBehaviorConstructorProps } from "../actionbehavior";
|
|
2
|
+
import { ContextManager } from "../context";
|
|
3
|
+
export interface PlaySoundProps extends ActionBehaviorConstructorProps {
|
|
2
4
|
/** The URL of the file to play
|
|
3
5
|
* @zprop
|
|
4
6
|
* @zvalues files *.wav
|
|
@@ -6,7 +8,17 @@ export interface PlaySoundProps {
|
|
|
6
8
|
*/
|
|
7
9
|
source: string;
|
|
8
10
|
}
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Plays a sound
|
|
13
|
+
*
|
|
14
|
+
* @zbehavior
|
|
10
15
|
* @zgroup Actions
|
|
11
16
|
*/
|
|
12
|
-
export declare
|
|
17
|
+
export declare class PlaySound extends ActionBehavior<PlaySoundProps> {
|
|
18
|
+
private _elm;
|
|
19
|
+
constructor(props: PlaySoundProps, contextManager: ContextManager);
|
|
20
|
+
perform(): void;
|
|
21
|
+
/** @zprop */
|
|
22
|
+
preview(): void;
|
|
23
|
+
dispose(): never;
|
|
24
|
+
}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionBehavior, } from "../actionbehavior";
|
|
2
|
+
import { registerBehaviorRunAtDesignTime } from "../behavior";
|
|
2
3
|
import { registerLoadable } from "../contexts/loadcontext";
|
|
3
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Plays a sound
|
|
6
|
+
*
|
|
7
|
+
* @zbehavior
|
|
4
8
|
* @zgroup Actions
|
|
5
9
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
export class PlaySound extends ActionBehavior {
|
|
11
|
+
constructor(props, contextManager) {
|
|
12
|
+
super(props, contextManager);
|
|
13
|
+
this._elm = document.createElement('audio');
|
|
14
|
+
this._elm.preload = 'auto';
|
|
15
|
+
registerLoadable(contextManager, new Promise((resolve, reject) => {
|
|
16
|
+
this._elm.addEventListener('canplaythrough', () => resolve());
|
|
17
|
+
this._elm.addEventListener('error', err => {
|
|
18
|
+
console.error('Unable to create PlaySound', err);
|
|
19
|
+
reject(err);
|
|
20
|
+
});
|
|
21
|
+
}));
|
|
22
|
+
this._elm.src = props.source;
|
|
23
|
+
}
|
|
24
|
+
perform() {
|
|
25
|
+
this._elm.currentTime = 0;
|
|
26
|
+
this._elm.play();
|
|
27
|
+
}
|
|
28
|
+
/** @zprop */
|
|
29
|
+
preview() {
|
|
30
|
+
this.perform();
|
|
31
|
+
}
|
|
32
|
+
dispose() {
|
|
33
|
+
this._elm.pause();
|
|
34
|
+
this._elm.src = '';
|
|
35
|
+
return super.dispose();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
registerBehaviorRunAtDesignTime(PlaySound);
|
package/lib/component.d.ts
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { ContextManager } from './context';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare type ComponentChildren = [Component, {
|
|
10
|
-
[id: string]: any;
|
|
11
|
-
}][];
|
|
12
|
-
export declare type Component<ConstructorPropsType extends {
|
|
13
|
-
children?: ComponentChildren;
|
|
14
|
-
} = {
|
|
15
|
-
[id: string]: any;
|
|
2
|
+
import { Event } from './event';
|
|
3
|
+
import { Observable } from './observable';
|
|
4
|
+
export declare type ComponentConstructor<ComponentType = Component> = ComponentType extends Component<infer ConstructorPropsType> ? new (props: ConstructorPropsType, contextManager: ContextManager) => ComponentType : never;
|
|
5
|
+
export declare type ConstructorPropsOfComponent<ComponentType> = ComponentType extends Component<infer R> ? R : never;
|
|
6
|
+
export declare type ComponentChild<ComponentType extends Component> = [ComponentConstructor<ComponentType>, ConstructorPropsOfComponent<ComponentType>];
|
|
7
|
+
export declare type ComponentChildren = ComponentChild<any>[];
|
|
8
|
+
export interface ConstructorProps {
|
|
16
9
|
children?: ComponentChildren;
|
|
17
|
-
}
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
}
|
|
11
|
+
export interface ComponentOptions {
|
|
12
|
+
dontConstructChildren?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class Component<ConstructorPropsType extends ConstructorProps = ConstructorProps, RootType = any> {
|
|
15
|
+
constructorProps: ConstructorPropsType;
|
|
16
|
+
contextManager: ContextManager;
|
|
17
|
+
private _options?;
|
|
18
|
+
root?: RootType;
|
|
19
|
+
onDispose: Event<[]>;
|
|
20
|
+
children: Component[];
|
|
21
|
+
disposed: boolean;
|
|
22
|
+
private _registered;
|
|
23
|
+
constructor(constructorProps: ConstructorPropsType, contextManager: ContextManager, _options?: ComponentOptions | undefined);
|
|
24
|
+
forEachRoot(fn: (root: any) => void): void;
|
|
25
|
+
protected _constructChildren(children?: ComponentChildren): void;
|
|
26
|
+
protected register<Args extends Array<any>>(evt: Event<Args>, fn: (...args: Args) => void): any;
|
|
27
|
+
protected register<Type>(observable: Observable<Type>, fn: (v: Type) => void): any;
|
|
28
|
+
dispose(): never;
|
|
29
|
+
private static callSuperDispose;
|
|
30
|
+
}
|
package/lib/component.js
CHANGED
|
@@ -1,4 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Event } from './event';
|
|
2
|
+
import { Observable } from './observable';
|
|
3
|
+
export class Component {
|
|
4
|
+
constructor(constructorProps, contextManager, _options) {
|
|
5
|
+
this.constructorProps = constructorProps;
|
|
6
|
+
this.contextManager = contextManager;
|
|
7
|
+
this._options = _options;
|
|
8
|
+
this.onDispose = new Event();
|
|
9
|
+
this.children = [];
|
|
10
|
+
this.disposed = false;
|
|
11
|
+
this._registered = [];
|
|
12
|
+
if (this._options?.dontConstructChildren !== true)
|
|
13
|
+
this._constructChildren(this.constructorProps.children);
|
|
14
|
+
}
|
|
15
|
+
forEachRoot(fn) {
|
|
16
|
+
if (Array.isArray(this.root))
|
|
17
|
+
this.root.forEach(fn);
|
|
18
|
+
else if (this.root !== undefined)
|
|
19
|
+
fn(this.root);
|
|
20
|
+
}
|
|
21
|
+
_constructChildren(children) {
|
|
22
|
+
if (Array.isArray(children)) {
|
|
23
|
+
for (const child of children) {
|
|
24
|
+
this.children.push(new child[0](child[1], this.contextManager));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
register(e, fn) {
|
|
29
|
+
if (e instanceof Event)
|
|
30
|
+
e.bindfn(fn);
|
|
31
|
+
else if (e instanceof Observable)
|
|
32
|
+
e.withValue(fn);
|
|
33
|
+
this._registered.push([e, fn]);
|
|
34
|
+
}
|
|
35
|
+
dispose() {
|
|
36
|
+
this.disposed = true;
|
|
37
|
+
for (const child of this.children) {
|
|
38
|
+
try {
|
|
39
|
+
child.dispose();
|
|
40
|
+
}
|
|
41
|
+
catch (err) { }
|
|
42
|
+
}
|
|
43
|
+
this.children = [];
|
|
44
|
+
for (const entry of this._registered) {
|
|
45
|
+
if (entry[0] instanceof Event)
|
|
46
|
+
entry[0].unbindfn(entry[1]);
|
|
47
|
+
else if (entry[0] instanceof Observable)
|
|
48
|
+
entry[0].removeWithValue(entry[1]);
|
|
49
|
+
}
|
|
50
|
+
this._registered = [];
|
|
51
|
+
this.onDispose.emit();
|
|
52
|
+
this.onDispose.clear();
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
4
55
|
}
|
|
56
|
+
Component.callSuperDispose = Symbol('Calling super.dispose() is mandatory');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable } from "
|
|
2
|
-
export interface DefaultLoaderConstructorProps {
|
|
1
|
+
import { Component, Observable, ConstructorProps, ContextManager } from "..";
|
|
2
|
+
export interface DefaultLoaderConstructorProps extends ConstructorProps {
|
|
3
3
|
/** @zprop
|
|
4
4
|
* @zgroup Appearance
|
|
5
5
|
* @zgrouppriority 10
|
|
@@ -16,23 +16,23 @@ export interface DefaultLoaderConstructorProps {
|
|
|
16
16
|
* @zicon loader
|
|
17
17
|
* @zgroup Advanced
|
|
18
18
|
*/
|
|
19
|
-
export declare
|
|
20
|
-
|
|
19
|
+
export declare class DefaultLoader extends Component<DefaultLoaderConstructorProps> {
|
|
20
|
+
root: HTMLDivElement;
|
|
21
21
|
/** @zprop
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
preview: Observable<boolean>;
|
|
22
|
+
* @zdefault false
|
|
23
|
+
* @zgroup Design Time
|
|
24
|
+
* @zgrouppriority 30
|
|
25
|
+
*/
|
|
26
|
+
preview: Observable<boolean, never>;
|
|
27
27
|
/** @zprop
|
|
28
28
|
* @zgroup Text
|
|
29
29
|
* @zgrouppriority 20
|
|
30
|
-
|
|
30
|
+
*/
|
|
31
31
|
title: Observable<string>;
|
|
32
32
|
/** @zprop
|
|
33
33
|
* @zgroup Text
|
|
34
34
|
* @zgrouppriority 20
|
|
35
|
-
|
|
35
|
+
*/
|
|
36
36
|
subtitle: Observable<string>;
|
|
37
37
|
/** @zprop
|
|
38
38
|
* @zdefault black
|
|
@@ -47,9 +47,16 @@ export declare const DefaultLoader: (props: DefaultLoaderConstructorProps, mgr:
|
|
|
47
47
|
*/
|
|
48
48
|
textColor: Observable<string>;
|
|
49
49
|
/** @zprop
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
* @zdefault 1000
|
|
51
|
+
* @zgroup Appearance
|
|
52
|
+
* @zgrouppriority 10
|
|
53
|
+
*/
|
|
54
54
|
zIndex: Observable<number>;
|
|
55
|
-
|
|
55
|
+
private _percentageElement;
|
|
56
|
+
private _attached;
|
|
57
|
+
constructor(props: DefaultLoaderConstructorProps, contextManager: ContextManager);
|
|
58
|
+
private _updatePercentage;
|
|
59
|
+
private _updateVisibility;
|
|
60
|
+
private _update;
|
|
61
|
+
dispose(): never;
|
|
62
|
+
}
|