@itwin/appui-abstract
Version:
iTwin.js UI abstractions
65 lines • 3.12 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyChangeStatus = exports.UiDataProvider = exports.SyncPropertiesChangeEvent = void 0;
const core_bentley_1 = require("@itwin/core-bentley");
/** Sync UI Control Properties Event class.
* @public
*/
class SyncPropertiesChangeEvent extends core_bentley_1.BeUiEvent {
}
exports.SyncPropertiesChangeEvent = SyncPropertiesChangeEvent;
/** [[UiDataProvider]] Abstract class that allows property values to be passed between hosting API and UI.
* @public
*/
// istanbul ignore next
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 core_bentley_1.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."));
}
}
exports.UiDataProvider = UiDataProvider;
/** Status of Proposed property changes from UI to UiDataProvider
* @public
*/
var PropertyChangeStatus;
(function (PropertyChangeStatus) {
/** Property Change(s) Succeeded */
PropertyChangeStatus[PropertyChangeStatus["Success"] = 0] = "Success";
/** Error Processing Property Change(s) */
PropertyChangeStatus[PropertyChangeStatus["Error"] = 2] = "Error";
})(PropertyChangeStatus || (exports.PropertyChangeStatus = PropertyChangeStatus = {}));
//# sourceMappingURL=UiDataProvider.js.map