mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
85ef873ce5
Summary: Adding configuration options for CustomWidgets. Custom widgets can now store options (in JSON) in viewSection metadata. Changes in grist-plugin-api: - Adding onOptions handler, that will be invoked when the widget is ready and when the configuration is changed - Adding WidgetAPI - new API to read and save a configuration for widget. Changes in Grist: - Rewriting CustomView code, and extracting code that is responsible for showing the iframe and registering Rpc. - Adding Open Configuration button to Widget section in the Creator panel and in the section menu. - Custom Widgets can implement "configure" method, to show configuration screen when requested. Test Plan: Browser tests. Reviewers: paulfitz, dsagal Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3185
34 lines
836 B
TypeScript
34 lines
836 B
TypeScript
/**
|
|
* API definitions for CustomSection plugins.
|
|
*/
|
|
|
|
/**
|
|
* Initial message sent by the CustomWidget with initial requirements.
|
|
*/
|
|
export interface InteractionOptionsRequest {
|
|
/**
|
|
* Required access level. If it wasn't granted already, Grist will prompt user to change the current access
|
|
* level.
|
|
*/
|
|
requiredAccess?: string,
|
|
/**
|
|
* Instructs Grist to show additional menu options that will trigger onEditOptions callback, that Widget
|
|
* can use to show custom options screen.
|
|
*/
|
|
hasCustomOptions?: boolean,
|
|
}
|
|
|
|
/**
|
|
* Widget configuration set and approved by Grist, sent as part of ready message.
|
|
*/
|
|
export interface InteractionOptions {
|
|
/**
|
|
* Granted access level.
|
|
*/
|
|
accessLevel: string
|
|
}
|
|
|
|
export interface CustomSectionAPI {
|
|
configure(customOptions: InteractionOptionsRequest): Promise<void>;
|
|
}
|