Interface
The extension interface for AppConfigOperations extension point. The methods in this class must return the new appConfig
Properties
| Property | Type | Notes |
|---|---|---|
idinherited | string | The unique ID. For widget's provided extension, the id pattern is: widgetId + extensionName |
indexinherited | number | If an extension point supports multiple extensions, the index is used to determine the extension order. |
labelinherited | string | The extension label. |
nameinherited | string | The extension name. |
widgetIdinherited | string | The widget ID that provides the extension. No widget id means the extension is provided by Jimu. |
id
id: stringThe unique ID. For widget's provided extension, the id pattern is: widgetId + extensionName
index
index: numberIf an extension point supports multiple extensions, the index is used to determine the extension order.
widgetId
widgetId: stringThe widget ID that provides the extension. No widget id means the extension is provided by Jimu.
Methods
| Method | Returns | Notes |
|---|---|---|
afterWidgetCopied(sourceWidgetId, sourceAppConfig, destWidgetId, destAppConfig, contentMap?) | IMAppConfig | Process the widget's internal config after it is copied if necessary. Only the original widget's extension should get invoked with the new copiedWidgetId. |
anyWidgetWillRemove(appConfig, widgetId) | IMAppConfig | This method is invoked when a widget is going to be removed from the app config. This method is invoked before the widget has been removed from the layout. |
appConfigWillChange(appConfig) | IMAppConfig | This method is invoked before the app config is changed. |
dataSourceWillRemove(appConfig, dataSourceId) | IMAppConfig | If a widget saves the data source id in its internal config, it should override this method to do the clean ups. Only the widgets that save the data source id in it's useDataSources will get invoked. |
mapWidgetWillRemove(appConfig, mapWidgetId) | IMAppConfig | If a widget saves some map related data its internal config, it should override this method to do the clean ups. Only the widgets that save the map widget id in it's useMapWidgets will get invoked. |
useDataSourceWillChange(appConfig, oldDataSourceId, newDataSourceId) | IMAppConfig | If a widget saves some config that is related to the data source in its internal config, it should override this method to do the clean ups. In most cases, a widget can just do the clean ups in its setting panel. However, when we remove a used data source from the list, the list internal widgets don't have the chance to do the clean ups. These widgets (Text/Image/Button) should override this method to do the clean ups. Another case is in Express mode, when the map widget de-selects a data source, all related widgets "useDataSources" are cleared. |
utilityWillRemove(appConfig, utilityId) | IMAppConfig | If a widget saves the utility id in its internal config, it should override this method to do the clean ups. Only the widgets that save the utility id in it's useUtilities will get invoked. |
widgetWillRemove(appConfig) | IMAppConfig | Do some cleanup operations before current widget is removed. This method is invoked after the widget has been removed from the layout. |
afterWidgetCopied
afterWidgetCopied(sourceWidgetId: string, sourceAppConfig: IMAppConfig, destWidgetId: string, destAppConfig: IMAppConfig, contentMap?: DuplicateContext): IMAppConfigProcess the widget's internal config after it is copied if necessary. Only the original widget's extension should get invoked with the new copiedWidgetId.
Parameters
| Parameter | Type | Notes |
|---|---|---|
source | string | Id of the widget that is copied. |
source | IMAppConfig | The app config the sourceWidgetId comes from. |
dest | string | Id of the widget that is created in the destAppConfig. |
dest | IMAppConfig | The app config the destWidgetId is created in. |
content | DuplicateContext | The map of content ids after copying. Provided when something (page, widget, section, etc.) is duplicated. The key is the content id in the original app config, and the value is the content id in the new app config. |
Returns
IMAppConfiganyWidgetWillRemove
anyWidgetWillRemove(appConfig: IMAppConfig, widgetId: string): IMAppConfigThis method is invoked when a widget is going to be removed from the app config. This method is invoked before the widget has been removed from the layout.
Parameters
| Parameter | Type | Notes |
|---|---|---|
app | IMAppConfig | |
widget | string | the widget id that is going to be removed |
Returns
IMAppConfigappConfigWillChange
appConfigWillChange(appConfig: IMAppConfig): IMAppConfigThis method is invoked before the app config is changed.
Parameters
| Parameter | Type |
|---|---|
app | IMAppConfig |
Returns
IMAppConfigdataSourceWillRemove
dataSourceWillRemove(appConfig: IMAppConfig, dataSourceId: string): IMAppConfigIf a widget saves the data source id in its internal config, it should override this method to do the clean ups. Only the widgets that save the data source id in it's useDataSources will get invoked.
Parameters
| Parameter | Type | Notes |
|---|---|---|
app | IMAppConfig | The app config. |
data | string | The data source id that is going to be removed. |
Returns
IMAppConfigmapWidgetWillRemove
mapWidgetWillRemove(appConfig: IMAppConfig, mapWidgetId: string): IMAppConfigIf a widget saves some map related data its internal config, it should override this method to do the clean ups. Only the widgets that save the map widget id in it's useMapWidgets will get invoked.
Parameters
| Parameter | Type | Notes |
|---|---|---|
app | IMAppConfig | The app config. |
map | string | The map widget id that is going to be removed. |
Returns
IMAppConfiguseDataSourceWillChange
useDataSourceWillChange(appConfig: IMAppConfig, oldDataSourceId: string, newDataSourceId: string): IMAppConfigIf a widget saves some config that is related to the data source in its internal config, it should override this method to do the clean ups. In most cases, a widget can just do the clean ups in its setting panel. However, when we remove a used data source from the list, the list internal widgets don't have the chance to do the clean ups. These widgets (Text/Image/Button) should override this method to do the clean ups. Another case is in Express mode, when the map widget de-selects a data source, all related widgets "useDataSources" are cleared.
For config in the widget message action and data action, widget can clean up the config in the useDataSourceWillChange method.
For the framework actions, the action can provide the useDataSourceWillChange method to clean up the config.
Parameters
| Parameter | Type | Notes |
|---|---|---|
app | IMAppConfig | The app config. |
old | string | The use data source id that is going to be removed. |
new | string | The new use data source id that is going to be used. |
Returns
IMAppConfigutilityWillRemove
utilityWillRemove(appConfig: IMAppConfig, utilityId: string): IMAppConfigIf a widget saves the utility id in its internal config, it should override this method to do the clean ups. Only the widgets that save the utility id in it's useUtilities will get invoked.
Parameters
| Parameter | Type | Notes |
|---|---|---|
app | IMAppConfig | The app config. |
utility | string | The utility id that is going to be removed. |
Returns
IMAppConfig