@i2analyze/notebook-sdk 1.3.0 → 1.4.0-dev.0
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/gen/notebook-sdk-public.d.ts +219 -0
- package/lib/index.js +24 -0
- package/package.json +1 -1
|
@@ -119,6 +119,11 @@ export declare namespace app {
|
|
|
119
119
|
* @i2since 1.1
|
|
120
120
|
*/
|
|
121
121
|
runUntrackedMutations(mutationHandler: UntrackedMutationHandler, options?: ITransactionOptions): void;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the command identifiers of the default system dialog actions.
|
|
124
|
+
* @i2since 1.4
|
|
125
|
+
*/
|
|
126
|
+
readonly systemActions: dialog.ISystemDialogActions;
|
|
122
127
|
}
|
|
123
128
|
/**
|
|
124
129
|
* A report on the result of one or more mutations.
|
|
@@ -2969,6 +2974,200 @@ export declare namespace data {
|
|
|
2969
2974
|
}
|
|
2970
2975
|
}
|
|
2971
2976
|
|
|
2977
|
+
/**
|
|
2978
|
+
* The members of the `dialog` namespace enable you to open the dialog over the application that you write for your plug-ins with the i2 Notebook application.
|
|
2979
|
+
*
|
|
2980
|
+
* @public
|
|
2981
|
+
* @i2since 1.4
|
|
2982
|
+
*/
|
|
2983
|
+
export declare namespace dialog {
|
|
2984
|
+
/**
|
|
2985
|
+
* The size of the dialog.
|
|
2986
|
+
* @i2since 1.4
|
|
2987
|
+
*/
|
|
2988
|
+
export type DialogSize = 'small' | 'medium' | 'large';
|
|
2989
|
+
/**
|
|
2990
|
+
* An identifier of dialog action.
|
|
2991
|
+
* @i2since 1.4
|
|
2992
|
+
*/
|
|
2993
|
+
export type DialogActionId = string;
|
|
2994
|
+
/**
|
|
2995
|
+
* A set of information to create dialog action button.
|
|
2996
|
+
* @i2since 1.4
|
|
2997
|
+
*/
|
|
2998
|
+
export interface IDialogAction {
|
|
2999
|
+
/**
|
|
3000
|
+
* Indicates the visibility state of the action button.
|
|
3001
|
+
* @i2since 1.4
|
|
3002
|
+
*/
|
|
3003
|
+
enabled?: boolean;
|
|
3004
|
+
/**
|
|
3005
|
+
* Gets the value to show in the action button.
|
|
3006
|
+
* @i2since 1.4
|
|
3007
|
+
*/
|
|
3008
|
+
label?: string;
|
|
3009
|
+
}
|
|
3010
|
+
/**
|
|
3011
|
+
* A Basic set of information to create dialog action button.
|
|
3012
|
+
* @i2since 1.4
|
|
3013
|
+
*/
|
|
3014
|
+
export interface IDialogActionConfig extends IDialogAction {
|
|
3015
|
+
/**
|
|
3016
|
+
* Gets the identifier of the dialog action.
|
|
3017
|
+
* @i2since 1.4
|
|
3018
|
+
*/
|
|
3019
|
+
readonly id: DialogActionId;
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* A set of information for creating a dialog.
|
|
3023
|
+
*
|
|
3024
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3025
|
+
* @i2since 1.4
|
|
3026
|
+
*/
|
|
3027
|
+
export interface IDialogConfig<TInitialize> {
|
|
3028
|
+
/**
|
|
3029
|
+
* Gets the title of the dialog, which appears as a heading in the user interface.
|
|
3030
|
+
* @i2since 1.4
|
|
3031
|
+
*/
|
|
3032
|
+
readonly name: string;
|
|
3033
|
+
/**
|
|
3034
|
+
* Gets the path to the content to host the dialog content, relative to the plug-in entry point.
|
|
3035
|
+
*
|
|
3036
|
+
* @remarks
|
|
3037
|
+
* For example, if `path` is '`./`', then the server uses the folder that contains the entry point.
|
|
3038
|
+
* @i2since 1.4
|
|
3039
|
+
*/
|
|
3040
|
+
readonly path: string;
|
|
3041
|
+
/**
|
|
3042
|
+
* Gets the size of the dialog.
|
|
3043
|
+
* @i2since 1.4
|
|
3044
|
+
*/
|
|
3045
|
+
readonly size: DialogSize;
|
|
3046
|
+
/**
|
|
3047
|
+
* Gets the information that required to create the dialog content.
|
|
3048
|
+
*
|
|
3049
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3050
|
+
* @i2since 1.4
|
|
3051
|
+
*/
|
|
3052
|
+
readonly initialValue?: TInitialize;
|
|
3053
|
+
/**
|
|
3054
|
+
* Gets the information to show the button like OK, Cancel.
|
|
3055
|
+
*
|
|
3056
|
+
* @i2since 1.4
|
|
3057
|
+
*/
|
|
3058
|
+
readonly actions: (IDialogActionConfig | DialogActionId)[];
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* A collection of methods and properties that allow plug-in dialog to interact with i2 Notebook.
|
|
3062
|
+
*
|
|
3063
|
+
* @i2since 1.4
|
|
3064
|
+
*/
|
|
3065
|
+
export interface IDialogApi extends app.IApplication {
|
|
3066
|
+
/**
|
|
3067
|
+
* Updates the dialog action buttons it could be label or visibility.
|
|
3068
|
+
*
|
|
3069
|
+
* @param id - An id of action which needs to be updated.
|
|
3070
|
+
* @param action - An updated action.
|
|
3071
|
+
* @i2since 1.4
|
|
3072
|
+
*/
|
|
3073
|
+
updateAction(id: DialogActionId, action: IDialogAction): void;
|
|
3074
|
+
/**
|
|
3075
|
+
* Submits the committed value and close the dialog.
|
|
3076
|
+
*
|
|
3077
|
+
* @param value - A value that is committed/expected when the dialog is closed.
|
|
3078
|
+
* @typeParam TResult - The type of data when the dialog is submitted.
|
|
3079
|
+
* @i2since 1.4
|
|
3080
|
+
*/
|
|
3081
|
+
submitAndClose<TResult>(value: TResult): void;
|
|
3082
|
+
/**
|
|
3083
|
+
* Closes the dialog.
|
|
3084
|
+
*
|
|
3085
|
+
* @i2since 1.4
|
|
3086
|
+
*/
|
|
3087
|
+
close(): void;
|
|
3088
|
+
/**
|
|
3089
|
+
* Gets the information that required to create the dialog content.
|
|
3090
|
+
*
|
|
3091
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3092
|
+
* @returns A value to populate the dialog content.
|
|
3093
|
+
* @i2since 1.4
|
|
3094
|
+
*/
|
|
3095
|
+
getInitiaValue<TInitialize>(): TInitialize;
|
|
3096
|
+
/**
|
|
3097
|
+
* Adds a listener for events that might affect the dialog.
|
|
3098
|
+
*
|
|
3099
|
+
* @param type - The type of event to subscribe to.
|
|
3100
|
+
* @param listener - A function to handle the event.
|
|
3101
|
+
* @typeParam K - The type of event to subscribe to.
|
|
3102
|
+
* @returns A function that can be called to remove the listener.
|
|
3103
|
+
* @i2since 1.4
|
|
3104
|
+
*/
|
|
3105
|
+
addEventListener<K extends keyof DialogEventMap>(type: K, listener: DialogEventMap[K]): () => void;
|
|
3106
|
+
/**
|
|
3107
|
+
* Removes a listener for events that might affect the dialog.
|
|
3108
|
+
*
|
|
3109
|
+
* @param type - The type of event to unsubscribe from.
|
|
3110
|
+
* @param listener - A function that was previously added as a listener.
|
|
3111
|
+
* @typeParam K - The type of event to unsubscribe from.
|
|
3112
|
+
* @i2since 1.4
|
|
3113
|
+
*/
|
|
3114
|
+
removeEventListener<K extends keyof DialogEventMap>(type: K, listener: DialogEventMap[K]): void;
|
|
3115
|
+
}
|
|
3116
|
+
/**
|
|
3117
|
+
* A mapping of dialog event types to their listener types.
|
|
3118
|
+
* @i2since 1.0
|
|
3119
|
+
*/
|
|
3120
|
+
export interface DialogEventMap extends app.ApplicationEventMap {
|
|
3121
|
+
/**
|
|
3122
|
+
* Gets the type of the callback method that listens for "action" events.
|
|
3123
|
+
* @i2since 1.4
|
|
3124
|
+
*/
|
|
3125
|
+
readonly action: DialogActionListener;
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* A callback function that handles dialog action button events.
|
|
3129
|
+
*
|
|
3130
|
+
* @remarks
|
|
3131
|
+
* Typically, this listener receieves an event after action button is clicked.
|
|
3132
|
+
*
|
|
3133
|
+
* @param actionId - An identifier of the action button which is clicked
|
|
3134
|
+
* @i2since 1.4
|
|
3135
|
+
*/
|
|
3136
|
+
export type DialogActionListener = (actionId: DialogActionId) => void;
|
|
3137
|
+
/**
|
|
3138
|
+
* A lookup table for the dialog action identifiers of the default actions.
|
|
3139
|
+
* @i2since 1.4
|
|
3140
|
+
*/
|
|
3141
|
+
export interface ISystemDialogActions {
|
|
3142
|
+
/**
|
|
3143
|
+
* Gets the identifier of the "submit" action.
|
|
3144
|
+
* @i2since 1.4
|
|
3145
|
+
*/
|
|
3146
|
+
submit: DialogActionId;
|
|
3147
|
+
/**
|
|
3148
|
+
* Gets the identifier of the "cancel" action.
|
|
3149
|
+
* @i2since 1.4
|
|
3150
|
+
*/
|
|
3151
|
+
cancel: DialogActionId;
|
|
3152
|
+
/**
|
|
3153
|
+
* Gets the identifier of the "close" action.
|
|
3154
|
+
* @i2since 1.4
|
|
3155
|
+
*/
|
|
3156
|
+
close: DialogActionId;
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
/**
|
|
3161
|
+
* Retrieves the plug-in dialog API.
|
|
3162
|
+
*
|
|
3163
|
+
* @returns A promise that resolves to the dialog API.
|
|
3164
|
+
* @throws `Error` (through the promise) if the version of the SDK was incompatible with the deployed version of i2 Notebook.
|
|
3165
|
+
*
|
|
3166
|
+
* @public
|
|
3167
|
+
* @i2since 1.4
|
|
3168
|
+
*/
|
|
3169
|
+
export declare function getDialogApi(): Promise<dialog.IDialogApi>;
|
|
3170
|
+
|
|
2972
3171
|
/**
|
|
2973
3172
|
* Retrieves the plug-in entry point API.
|
|
2974
3173
|
*
|
|
@@ -3036,6 +3235,16 @@ export declare interface IEntryPointApi extends app.IApplication {
|
|
|
3036
3235
|
* @i2since 1.3
|
|
3037
3236
|
*/
|
|
3038
3237
|
createToolView(config: toolview.IToolViewConfig): toolview.IToolView;
|
|
3238
|
+
/**
|
|
3239
|
+
* Opens a dialog with specified configuration.
|
|
3240
|
+
*
|
|
3241
|
+
* @param config - The information to create a modal dialog.
|
|
3242
|
+
* @typeParam TResult - The type of data when the dialog is submitted.
|
|
3243
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
3244
|
+
* @returns The value submitted from the dialog.
|
|
3245
|
+
* @i2since 1.4
|
|
3246
|
+
*/
|
|
3247
|
+
showDialog<TResult, TInitialize>(config: dialog.IDialogConfig<TInitialize>): Promise<TResult>;
|
|
3039
3248
|
/**
|
|
3040
3249
|
* Gets the core API for custom commands.
|
|
3041
3250
|
* @i2since 1.0
|
|
@@ -4364,6 +4573,16 @@ export declare namespace toolview {
|
|
|
4364
4573
|
* @i2since 1.0
|
|
4365
4574
|
*/
|
|
4366
4575
|
removeEventListener<K extends keyof ToolViewApiEventMap>(type: K, listener: ToolViewApiEventMap[K]): void;
|
|
4576
|
+
/**
|
|
4577
|
+
* Opens a dialog with specified configuration.
|
|
4578
|
+
*
|
|
4579
|
+
* @param config - The information to create a modal dialog.
|
|
4580
|
+
* @typeParam TResult - The type of data when the dialog is submitted.
|
|
4581
|
+
* @typeParam TInitialize - The type of data to populate the dialog content.
|
|
4582
|
+
* @returns The value submitted from the dialog.
|
|
4583
|
+
* @i2since 1.4
|
|
4584
|
+
*/
|
|
4585
|
+
showDialog<TResult, TInitialize>(config: dialog.IDialogConfig<TInitialize>): Promise<TResult>;
|
|
4367
4586
|
}
|
|
4368
4587
|
/**
|
|
4369
4588
|
* A mapping of tool view event types to their listener types.
|
package/lib/index.js
CHANGED
|
@@ -39,3 +39,27 @@ export function getToolViewApi() {
|
|
|
39
39
|
scan();
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
//TODO: DOCs REVIEW
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves the plug-in dialog API.
|
|
45
|
+
*
|
|
46
|
+
* @returns A promise that resolves to the dialog API.
|
|
47
|
+
* @throws `Error` (through the promise) if the version of the SDK was incompatible with the deployed version of i2 Notebook.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
* @i2since 1.4
|
|
51
|
+
*/
|
|
52
|
+
export function getDialogApi() {
|
|
53
|
+
return new Promise((resolve) => {
|
|
54
|
+
function scan() {
|
|
55
|
+
const api = window._i2GetPluginDialogApi;
|
|
56
|
+
if (api) {
|
|
57
|
+
clearInterval(handle);
|
|
58
|
+
const result = api(apiVersion);
|
|
59
|
+
resolve(result);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const handle = setInterval(scan, 50);
|
|
63
|
+
scan();
|
|
64
|
+
});
|
|
65
|
+
}
|