@itwin/appui-abstract
Version:
iTwin.js UI abstractions
60 lines • 2.79 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Dialog
*/
import { BeUiEvent } from "@itwin/core-bentley";
/** Sync UI Control Properties Event class.
* @public
*/
export class SyncPropertiesChangeEvent extends BeUiEvent {
}
/** [[UiDataProvider]] Abstract class that allows property values to be passed between hosting API and UI.
* @public
*/
// istanbul ignore next
export class UiDataProvider {
/** Called by UI to inform data provider of changes. */
processChangesInUi(_properties) {
throw (new Error("Derived UiDataProvider must implement this method to apply changes to a bulk set of properties."));
}
/** Get Sync UI Control Properties Event */
onSyncPropertiesChangeEvent = new SyncPropertiesChangeEvent();
onItemsReloadedEvent = new BeUiEvent();
/** Called by UI to validate a property value */
validateProperty(_item) {
return { status: PropertyChangeStatus.Success };
}
/** Called to sync properties synchronously if a UiDataProvider is active for the UI */
syncProperties(syncProperties) {
this.fireSyncPropertiesEvent(syncProperties);
}
/** Called to inform listener that the UiDataProvider has updated values for the UI */
fireSyncPropertiesEvent(syncProperties) {
this.onSyncPropertiesChangeEvent.emit({ properties: syncProperties });
}
/** Called to inform listeners that new properties are ready for display in UI.
*/
fireItemsReloadedEvent() {
this.onItemsReloadedEvent.emit();
}
/** Used to pass properties between a tool and an explicity defined UI dialog. See method supplyDialogItems in [[UiLayoutDataProvider]] for supplying
* properties that will be used to dynamically create and layout control in a Dialog or Widget.
*/
supplyAvailableProperties() {
throw (new Error("Derived UiDataProvider that want to use DialogPropertyItems must implement this method. Not for use with dynamic UI controls."));
}
}
/** Status of Proposed property changes from UI to UiDataProvider
* @public
*/
export var PropertyChangeStatus;
(function (PropertyChangeStatus) {
/** Property Change(s) Succeeded */
PropertyChangeStatus[PropertyChangeStatus["Success"] = 0] = "Success";
/** Error Processing Property Change(s) */
PropertyChangeStatus[PropertyChangeStatus["Error"] = 2] = "Error";
})(PropertyChangeStatus || (PropertyChangeStatus = {}));
//# sourceMappingURL=UiDataProvider.js.map