@yamcs/opi 1.4.3 → 1.4.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/dist/opi.js +14 -14
- package/dist/opi.js.map +4 -4
- package/dist/opi.standalone.js +14 -14
- package/dist/types/DialogHandler.d.ts +6 -0
- package/dist/types/Display.d.ts +23 -0
- package/dist/types/PostMessageDialogHandler.d.ts +15 -0
- package/dist/types/actions/Action.d.ts +1 -1
- package/dist/types/actions/RunCommandAction.d.ts +2 -1
- package/dist/types/actions/RunProcedureAction.d.ts +2 -1
- package/dist/types/actions/RunStackAction.d.ts +2 -1
- package/dist/types/actions/WritePVAction.d.ts +2 -1
- package/dist/types/events.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/scripting/FileUtil.d.ts +7 -2
- package/dist/types/scripting/GUIUtil.d.ts +5 -1
- package/dist/types/scripting/ScriptUtil.d.ts +2 -1
- package/dist/types/widgets/controls/BooleanButton.d.ts +1 -0
- package/dist/types/widgets/controls/BooleanSwitch.d.ts +1 -0
- package/dist/types/widgets/controls/ImageBooleanButton.d.ts +1 -0
- package/dist/types/widgets/controls/TextInput.d.ts +1 -0
- package/dist/types/widgets/monitors/LinearScale.d.ts +11 -0
- package/package.json +1 -1
- package/dist/types/widgets/graphics/ImageHelper.d.ts +0 -3
|
@@ -4,8 +4,14 @@ export interface DialogHandler {
|
|
|
4
4
|
openWarningDialog(title: string, message: string): void;
|
|
5
5
|
openErrorDialog(title: string, message: string): void;
|
|
6
6
|
openPasswordDialog(title: string, message: string, password: string): boolean;
|
|
7
|
+
openConfirmDialogAsync?(title: string, message: string): Promise<boolean>;
|
|
8
|
+
openPasswordDialogAsync?(title: string, message: string, password: string): Promise<boolean>;
|
|
7
9
|
}
|
|
10
|
+
export declare function confirmAsync(dialogHandler: DialogHandler, title: string, message: string): Promise<boolean>;
|
|
11
|
+
export declare function passwordAsync(dialogHandler: DialogHandler, title: string, message: string, password: string): Promise<boolean>;
|
|
8
12
|
export declare class DefaultDialogHandler implements DialogHandler {
|
|
13
|
+
openConfirmDialogAsync(title: string, message: string): Promise<boolean>;
|
|
14
|
+
openPasswordDialogAsync(title: string, message: string, password: string): Promise<boolean>;
|
|
9
15
|
openConfirmDialog(title: string, message: string): boolean;
|
|
10
16
|
openInformationDialog(title: string, message: string): void;
|
|
11
17
|
openWarningDialog(title: string, message: string): void;
|
package/dist/types/Display.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ export declare class Display {
|
|
|
78
78
|
private imageLoader;
|
|
79
79
|
private consoleHandler;
|
|
80
80
|
private dialogHandler;
|
|
81
|
+
private pendingTask?;
|
|
81
82
|
formatter: Formatter;
|
|
82
83
|
private repaintRequested;
|
|
83
84
|
private _editMode;
|
|
@@ -127,6 +128,14 @@ export declare class Display {
|
|
|
127
128
|
getConsoleHandler(): ConsoleHandler;
|
|
128
129
|
setDialogHandler(dialogHandler: DialogHandler): void;
|
|
129
130
|
getDialogHandler(): DialogHandler;
|
|
131
|
+
/**
|
|
132
|
+
* Runs a user-triggered task (an action, a confirmed write). A task may
|
|
133
|
+
* wait on a non-blocking dialog by returning a promise. Tasks run in
|
|
134
|
+
* order: while one is waiting, later tasks wait too, as they would behind
|
|
135
|
+
* a blocking dialog. Without a waiting task, a task runs immediately.
|
|
136
|
+
*/
|
|
137
|
+
runSequenced(task: () => void | Promise<void>): void;
|
|
138
|
+
private trackTask;
|
|
130
139
|
setFontResolver(fontResolver: FontResolver): void;
|
|
131
140
|
getFontResolver(): FontResolver | undefined;
|
|
132
141
|
private step;
|
|
@@ -147,7 +156,21 @@ export declare class Display {
|
|
|
147
156
|
* calls on a Display that keeps running.
|
|
148
157
|
*/
|
|
149
158
|
destroy(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Resolves a path as written in an OPI file. Relative paths are resolved
|
|
161
|
+
* against the OPI file that defines the widget (which may be a linked OPI
|
|
162
|
+
* in another folder), the same as Yamcs Studio.
|
|
163
|
+
*
|
|
164
|
+
* The result is an absolute URL, so it keeps its meaning when passed on
|
|
165
|
+
* (for example to a loader or to the host application).
|
|
166
|
+
*/
|
|
150
167
|
resolvePath(path: string, widget?: Widget): string;
|
|
168
|
+
/**
|
|
169
|
+
* Expresses a resolved URL as a path from the display root (absPrefix),
|
|
170
|
+
* for example "/folder/display.opi". Returns undefined if the URL is not
|
|
171
|
+
* located under the display root.
|
|
172
|
+
*/
|
|
173
|
+
toRootPath(url: string): string | undefined;
|
|
151
174
|
setSource(href: string, args?: {
|
|
152
175
|
[key: string]: string;
|
|
153
176
|
}): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DefaultDialogHandler } from "./DialogHandler";
|
|
2
|
+
/**
|
|
3
|
+
* Shows non-blocking dialogs in the outer application, via postMessage.
|
|
4
|
+
*
|
|
5
|
+
* Blocking dialogs remain native browser dialogs (inherited), because only
|
|
6
|
+
* those can block the calling script.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PostMessageDialogHandler extends DefaultDialogHandler {
|
|
9
|
+
private nextId;
|
|
10
|
+
private pending;
|
|
11
|
+
openConfirmDialogAsync(title: string, message: string): Promise<boolean>;
|
|
12
|
+
openPasswordDialogAsync(title: string, message: string, password: string): Promise<boolean>;
|
|
13
|
+
receiveResult(id: number, result: boolean): void;
|
|
14
|
+
private request;
|
|
15
|
+
}
|
|
@@ -5,7 +5,7 @@ export declare abstract class Action {
|
|
|
5
5
|
properties: PropertySet;
|
|
6
6
|
constructor();
|
|
7
7
|
parseNode(node: XMLNode): void;
|
|
8
|
-
abstract execute(widget: Widget): void
|
|
8
|
+
abstract execute(widget: Widget): void | Promise<void>;
|
|
9
9
|
get description(): string;
|
|
10
10
|
getDescription(): string;
|
|
11
11
|
getDefaultDescription(): string;
|
|
@@ -2,7 +2,8 @@ import { Widget } from "../Widget";
|
|
|
2
2
|
import { Action } from "./Action";
|
|
3
3
|
export declare class RunCommandAction extends Action {
|
|
4
4
|
constructor();
|
|
5
|
-
execute(widget: Widget): void;
|
|
5
|
+
execute(widget: Widget): Promise<void> | undefined;
|
|
6
|
+
private run;
|
|
6
7
|
get command(): string;
|
|
7
8
|
get args(): {
|
|
8
9
|
[key: string]: string;
|
|
@@ -2,7 +2,8 @@ import { Widget } from "../Widget";
|
|
|
2
2
|
import { Action } from "./Action";
|
|
3
3
|
export declare class RunProcedureAction extends Action {
|
|
4
4
|
constructor();
|
|
5
|
-
execute(widget: Widget): void;
|
|
5
|
+
execute(widget: Widget): Promise<void> | undefined;
|
|
6
|
+
private run;
|
|
6
7
|
get procedure(): string;
|
|
7
8
|
get args(): {
|
|
8
9
|
[key: string]: string;
|
|
@@ -2,7 +2,8 @@ import { Widget } from "../Widget";
|
|
|
2
2
|
import { Action } from "./Action";
|
|
3
3
|
export declare class RunStackAction extends Action {
|
|
4
4
|
constructor();
|
|
5
|
-
execute(widget: Widget): void;
|
|
5
|
+
execute(widget: Widget): Promise<void> | undefined;
|
|
6
|
+
private run;
|
|
6
7
|
get path(): string;
|
|
7
8
|
get confirmMessage(): string;
|
|
8
9
|
getDefaultDescription(): string;
|
|
@@ -2,7 +2,8 @@ import { Widget } from "../Widget";
|
|
|
2
2
|
import { Action } from "./Action";
|
|
3
3
|
export declare class WritePVAction extends Action {
|
|
4
4
|
constructor();
|
|
5
|
-
execute(widget: Widget): void;
|
|
5
|
+
execute(widget: Widget): Promise<void> | undefined;
|
|
6
|
+
private run;
|
|
6
7
|
get pvName(): string;
|
|
7
8
|
get value(): string;
|
|
8
9
|
get timeout(): number;
|
package/dist/types/events.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface SelectionEvent extends OPIEvent {
|
|
|
21
21
|
*/
|
|
22
22
|
export interface OpenDisplayEvent extends OPIEvent {
|
|
23
23
|
path: string;
|
|
24
|
+
absolutePath?: string;
|
|
24
25
|
replace: boolean;
|
|
25
26
|
args?: {
|
|
26
27
|
[key: string]: string;
|
|
@@ -51,6 +52,7 @@ export interface RunCommandEvent extends OPIEvent {
|
|
|
51
52
|
*/
|
|
52
53
|
export interface RunStackEvent extends OPIEvent {
|
|
53
54
|
path: string;
|
|
55
|
+
absolutePath?: string;
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
58
|
* A script or a button requested to run a procedure.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { FontResolver } from "./FontResolver";
|
|
|
7
7
|
export { DefaultImageLoader, ImageLoader } from "./ImageLoader";
|
|
8
8
|
export { DefaultPathResolver, PathResolver } from "./PathResolver";
|
|
9
9
|
export { Dimension, NullablePoint, Point } from "./positioning";
|
|
10
|
+
export { PostMessageDialogHandler } from "./PostMessageDialogHandler";
|
|
10
11
|
export { PostMessageImageLoader } from "./PostMessageImageLoader";
|
|
11
12
|
export { PostMessageScriptLoader } from "./PostMessageScriptLoader";
|
|
12
13
|
export { CompiledFormula, DataSourceStatus, } from "./pv/formulas/CompiledFormula";
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Display } from "../Display";
|
|
2
|
+
import { ScriptEngine } from "./ScriptEngine";
|
|
3
|
+
import { WidgetWrapper } from "./WidgetWrapper";
|
|
2
4
|
export declare class FileUtil {
|
|
3
5
|
private display;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
private scriptEngine;
|
|
7
|
+
constructor(display: Display, scriptEngine: ScriptEngine);
|
|
8
|
+
readTextFile(filePath: string, widget?: WidgetWrapper | null): string;
|
|
9
|
+
readTextFileAsync(filePath: string, widget: WidgetWrapper | null | undefined, onSuccess: (text: string) => void, onError?: (message: string) => void): void;
|
|
10
|
+
private fail;
|
|
6
11
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Display } from "../Display";
|
|
2
|
+
import { ScriptEngine } from "./ScriptEngine";
|
|
2
3
|
export declare class GUIUtil {
|
|
3
4
|
private display;
|
|
4
|
-
|
|
5
|
+
private scriptEngine;
|
|
6
|
+
constructor(display: Display, scriptEngine: ScriptEngine);
|
|
5
7
|
fullScreen(): void;
|
|
6
8
|
openConfirmDialog(message: string): boolean;
|
|
9
|
+
openConfirmDialogAsync(message: string, onResult: (confirmed: boolean) => void): void;
|
|
7
10
|
openInformationDialog(message: string): void;
|
|
8
11
|
openWarningDialog(message: string): void;
|
|
9
12
|
openErrorDialog(message: string): void;
|
|
10
13
|
openPasswordDialog(message: string, password: string): boolean;
|
|
14
|
+
openPasswordDialogAsync(message: string, password: string, onResult: (correct: boolean) => void): void;
|
|
11
15
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Display } from "../Display";
|
|
2
|
+
import { WidgetWrapper } from "./WidgetWrapper";
|
|
2
3
|
export declare class ScriptUtil {
|
|
3
4
|
private display;
|
|
4
5
|
constructor(display: Display);
|
|
5
|
-
openOPI(widget:
|
|
6
|
+
openOPI(widget: WidgetWrapper | null, path: string, target: number, macrosInput: any): void;
|
|
6
7
|
closeCurrentOPI(): void;
|
|
7
8
|
}
|
|
@@ -11,6 +11,7 @@ export declare class BooleanButton extends Widget {
|
|
|
11
11
|
constructor(display: Display, parent: AbstractContainerWidget);
|
|
12
12
|
init(): void;
|
|
13
13
|
private openConfirmDialog;
|
|
14
|
+
private confirmThen;
|
|
14
15
|
private toggleOn;
|
|
15
16
|
private toggleOff;
|
|
16
17
|
get booleanValue(): boolean;
|
|
@@ -13,6 +13,7 @@ export declare class ImageBooleanButton extends Widget {
|
|
|
13
13
|
constructor(display: Display, parent: AbstractContainerWidget);
|
|
14
14
|
init(): void;
|
|
15
15
|
private openConfirmDialog;
|
|
16
|
+
private confirmThen;
|
|
16
17
|
private toggleOn;
|
|
17
18
|
private toggleOff;
|
|
18
19
|
get booleanValue(): boolean;
|
|
@@ -26,6 +26,16 @@ export declare class LinearScale {
|
|
|
26
26
|
timeFormat: number;
|
|
27
27
|
length: number;
|
|
28
28
|
margin: number;
|
|
29
|
+
/**
|
|
30
|
+
* If true, the range is shifted by less than one pixel, such that a value
|
|
31
|
+
* keeps the same sub-pixel offset when the range scrolls. This avoids
|
|
32
|
+
* anti-aliasing flicker of scrolling plots.
|
|
33
|
+
*/
|
|
34
|
+
snapToPixels: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Device pixels per coordinate unit, used by snapToPixels.
|
|
37
|
+
*/
|
|
38
|
+
pixelRatio: number;
|
|
29
39
|
constructor(formatter: Formatter, scale: number, scaleFont: Font, minimum: number, maximum: number, logScale: boolean, majorTickStepHint: number, foregroundColor: Color, showMinorTicks: boolean, showScale: boolean);
|
|
30
40
|
get scaleLength(): number;
|
|
31
41
|
/** Only available post-draw */
|
|
@@ -39,6 +49,7 @@ export declare class LinearScale {
|
|
|
39
49
|
* getValuePosition to work.
|
|
40
50
|
*/
|
|
41
51
|
setDimensions(x: number, y: number, length: number, horizontal: boolean): void;
|
|
52
|
+
private snapRange;
|
|
42
53
|
getValuePosition(value: number): number;
|
|
43
54
|
getMinMax(): Range;
|
|
44
55
|
getPositionValue(absolutePosition: number): number;
|
package/package.json
CHANGED