Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bentley/ui-abstract

Package Overview
Dependencies
Maintainers
4
Versions
508
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bentley/ui-abstract - npm Package Compare versions

Comparing version 1.14.1 to 2.0.0

lib/public/locales/en-PSEUDO/UiAbstract.json

84

CHANGELOG.json

@@ -5,2 +5,86 @@ {

{
"version": "2.0.0",
"tag": "@bentley/ui-abstract_v2.0.0",
"date": "Wed, 06 May 2020 13:17:49 GMT",
"comments": {
"none": [
{
"comment": "Add support for groupPriority for ToolbarItems. If specified then a group separator is shown when the priority changes."
},
{
"comment": "Plugins: Update API for app/plugin negotiation at load time."
},
{
"comment": "Add ConditionStringValue support. Used to define labels and icons."
},
{
"comment": "update icon package version"
},
{
"comment": "Update GroupButton definition to use ReadonlyArray for child items."
},
{
"comment": "Documentation fixes"
},
{
"comment": "Slider component tooltipBelow prop & tooltip styling"
},
{
"comment": " Updates to remove need for svg-sprite-loader, use defualt CRA svgr loader instead."
},
{
"comment": "Upgrade to Rush 5.23.2"
},
{
"comment": "Rename CustomDefinition to CustomButtonDefinition,"
},
{
"comment": "Learning docs for UiAdmin & UiItemsArbiter"
},
{
"comment": "Promoted some @beta to @public in Ui packages & ToolAssistance for 2.0 release."
},
{
"comment": "Added `PropertyRecord.fromString()`"
},
{
"comment": "In source documentation. Some learning docs & API changes."
},
{
"comment": "TOC for UI 2.0 Docs, @alpha to @beta, Components Examples"
},
{
"comment": "Started ui-components Learning doc section"
},
{
"comment": "Update doc tags for automatic UI creation "
},
{
"comment": "Refactor to remove duplicate ComponentGenerator instantiation. Rename files and components to remove React reference."
},
{
"comment": "Update auto-generated dialog items to work with the Tool Settings Bar."
},
{
"comment": "Add ConditionalBoolean support for isHidden and isDisabled properties."
},
{
"comment": "Moved Property classes and interface from frontend package. Added generic \"DialogItemManager\" to generate UI based on data from an app."
},
{
"comment": "Create a BaseDialogItem so that a lock toggle associated with another tool settings or dialog item does not require unnecessary members such as EditorPosition."
},
{
"comment": "Refactor DefaultToolSettingsProvider to use the DialogItem interfaces in place of ToolSettings classes."
},
{
"comment": "Defaulting to IModelApp.i18n in UI packages and cascading initialize() calls"
},
{
"comment": "Remove support for the iModel.js module system by no longer delivering modules."
}
]
}
},
{
"version": "1.14.1",

@@ -7,0 +91,0 @@ "tag": "@bentley/ui-abstract_v1.14.1",

33

CHANGELOG.md
# Change Log - @bentley/ui-abstract
This log was last generated on Wed, 22 Apr 2020 19:04:00 GMT and should not be manually modified.
This log was last generated on Wed, 06 May 2020 13:17:49 GMT and should not be manually modified.
## 2.0.0
Wed, 06 May 2020 13:17:49 GMT
### Updates
- Add support for groupPriority for ToolbarItems. If specified then a group separator is shown when the priority changes.
- Plugins: Update API for app/plugin negotiation at load time.
- Add ConditionStringValue support. Used to define labels and icons.
- update icon package version
- Update GroupButton definition to use ReadonlyArray for child items.
- Documentation fixes
- Slider component tooltipBelow prop & tooltip styling
- Updates to remove need for svg-sprite-loader, use defualt CRA svgr loader instead.
- Upgrade to Rush 5.23.2
- Rename CustomDefinition to CustomButtonDefinition,
- Learning docs for UiAdmin & UiItemsArbiter
- Promoted some @beta to @public in Ui packages & ToolAssistance for 2.0 release.
- Added `PropertyRecord.fromString()`
- In source documentation. Some learning docs & API changes.
- TOC for UI 2.0 Docs, @alpha to @beta, Components Examples
- Started ui-components Learning doc section
- Update doc tags for automatic UI creation
- Refactor to remove duplicate ComponentGenerator instantiation. Rename files and components to remove React reference.
- Update auto-generated dialog items to work with the Tool Settings Bar.
- Add ConditionalBoolean support for isHidden and isDisabled properties.
- Moved Property classes and interface from frontend package. Added generic "DialogItemManager" to generate UI based on data from an app.
- Create a BaseDialogItem so that a lock toggle associated with another tool settings or dialog item does not require unnecessary members such as EditorPosition.
- Refactor DefaultToolSettingsProvider to use the DialogItem interfaces in place of ToolSettings classes.
- Defaulting to IModelApp.i18n in UI packages and cascading initialize() calls
- Remove support for the iModel.js module system by no longer delivering modules.
## 1.14.1

@@ -6,0 +37,0 @@ Wed, 22 Apr 2020 19:04:00 GMT

@@ -5,3 +5,9 @@ {

"technicalPreview": "Technical Preview"
},
"Properties": {
"Angle": "Angle",
"Length": "Length",
"UnableToParseAngle": "Unable to parse angle value",
"UnableToParseLength": "Unable to parse length value"
}
}

61

lib/ui-abstract.d.ts
export * from "./ui-abstract/UiAbstract";
export * from "./ui-abstract/UiAdmin";
export * from "./ui-abstract/UiItemsManager";
export * from "./ui-abstract/UiItemsArbiter";
export * from "./ui-abstract/backstage/BackstageItem";
export * from "./ui-abstract/backstage/BackstageItemsManager";
export * from "./ui-abstract/items/AbstractConditionalItemProps";
export * from "./ui-abstract/items/AbstractGroupItemProps";
export * from "./ui-abstract/dialogs/DialogItem";
export * from "./ui-abstract/dialogs/DialogItemsManager";
export * from "./ui-abstract/dialogs/UiDataProvider";
export * from "./ui-abstract/items/AbstractItemProps";
export * from "./ui-abstract/items/AbstractMenuItemProps";
export * from "./ui-abstract/items/ProvidedItem";
export * from "./ui-abstract/items/AbstractToolbarProps";
export * from "./ui-abstract/items/AnyItemProps";
export * from "./ui-abstract/items/BadgeType";
export * from "./ui-abstract/items/BaseItemState";
export * from "./ui-abstract/items/ConditionalDisplayType";
export * from "./ui-abstract/items/ConditionalBooleanValue";
export * from "./ui-abstract/items/ConditionalStringValue";
export * from "./ui-abstract/items/RelativePosition";
export * from "./ui-abstract/items/ProvidedItem";
export * from "./ui-abstract/items/RelativePosition";
export * from "./ui-abstract/items/StageUsage";
export * from "./ui-abstract/properties/Description";
export * from "./ui-abstract/properties/EditorParams";
export * from "./ui-abstract/properties/PrimitiveTypes";
export * from "./ui-abstract/properties/Record";
export * from "./ui-abstract/properties/Value";
export * from "./ui-abstract/quantity/BaseQuantityDescription";
export * from "./ui-abstract/statusbar/StatusBarItem";
export * from "./ui-abstract/statusbar/StatusBarItemsManager";
export * from "./ui-abstract/plugins/PluginUi";
export * from "./ui-abstract/plugins/PluginUiManager";
export * from "./ui-abstract/stage/Stage";
export * from "./ui-abstract/toolbars/ToolbarItem";
export * from "./ui-abstract/toolbars/ToolbarItemsManager";
export * from "./ui-abstract/statusbar/StatusBarItem";
export * from "./ui-abstract/statusbar/StatusBarItemsManager";
export * from "./ui-abstract/utils/getClassName";

@@ -24,10 +37,10 @@ export * from "./ui-abstract/utils/IconSpecUtilities";

export * from "./ui-abstract/utils/UiError";
export * from "./ui-abstract/widget/AbstractWidgetProps";
export * from "./ui-abstract/widget/StagePanel";
export * from "./ui-abstract/widget/WidgetState";
/** @docs-package-description
* The ui-abstract package contains abstractions for UI controls, such as toolbars, buttons and menus.
* For more information, see [learning about ui-abstract]($docs/learning/ui/abstract/index.md).
*/
/**
* @docs-group-description Admin
* Abstractions for UI controls, such as toolbars, buttons and menus and are callable from IModelApp.uiAdmin in imodeljs-frontend.
*/
/**
* @docs-group-description Backstage

@@ -37,2 +50,6 @@ * Abstractions used by ui-framework package to create and manage the display Backstage menu items.

/**
* @docs-group-description Dialog
* Interfaces and classes for generating UI items for Dialogs.
*/
/**
* @docs-group-description Item

@@ -42,4 +59,4 @@ * Classes for working with an Item in a Toolbar, Widget, Backstage or Context Menu

/**
* @docs-group-description Plugins
* Classes for creating and managing runtime [Plugins]($docs/learning/frontend/Plugins.md)
* @docs-group-description Properties
* Properties system for data input and formatting.
*/

@@ -51,5 +68,21 @@ /**

/**
* @docs-group-description Toolbar
* Classes for creating and managing items in a toolbar.
*/
/**
* @docs-group-description UiAdmin
* Abstractions for UI controls, such as toolbars, buttons and menus and are callable from IModelApp.uiAdmin in imodeljs-frontend.
*/
/**
* @docs-group-description UiItemsProvider
* Interface for specifying UI items to be inserted at runtime.
*/
/**
* @docs-group-description Utilities
* Various utility classes for working with a UI.
*/
/**
* @docs-group-description Widget
* Classes for creating and providing Widgets.
*/
//# sourceMappingURL=ui-abstract.d.ts.map

@@ -12,30 +12,34 @@ "use strict";

__export(require("./ui-abstract/UiAdmin"));
__export(require("./ui-abstract/UiItemsManager"));
__export(require("./ui-abstract/UiItemsArbiter"));
__export(require("./ui-abstract/backstage/BackstageItem"));
__export(require("./ui-abstract/backstage/BackstageItemsManager"));
__export(require("./ui-abstract/items/AbstractGroupItemProps"));
__export(require("./ui-abstract/dialogs/DialogItemsManager"));
__export(require("./ui-abstract/dialogs/UiDataProvider"));
__export(require("./ui-abstract/items/BadgeType"));
__export(require("./ui-abstract/items/ConditionalDisplayType"));
__export(require("./ui-abstract/items/ConditionalBooleanValue"));
__export(require("./ui-abstract/items/ConditionalStringValue"));
__export(require("./ui-abstract/items/RelativePosition"));
__export(require("./ui-abstract/items/RelativePosition"));
__export(require("./ui-abstract/items/StageUsage"));
__export(require("./ui-abstract/properties/EditorParams"));
__export(require("./ui-abstract/properties/Record"));
__export(require("./ui-abstract/properties/Value"));
__export(require("./ui-abstract/quantity/BaseQuantityDescription"));
__export(require("./ui-abstract/statusbar/StatusBarItem"));
__export(require("./ui-abstract/statusbar/StatusBarItemsManager"));
__export(require("./ui-abstract/plugins/PluginUi"));
__export(require("./ui-abstract/plugins/PluginUiManager"));
__export(require("./ui-abstract/stage/Stage"));
__export(require("./ui-abstract/toolbars/ToolbarItem"));
__export(require("./ui-abstract/toolbars/ToolbarItemsManager"));
__export(require("./ui-abstract/statusbar/StatusBarItem"));
__export(require("./ui-abstract/statusbar/StatusBarItemsManager"));
__export(require("./ui-abstract/utils/getClassName"));
__export(require("./ui-abstract/utils/IconSpecUtilities"));
__export(require("./ui-abstract/utils/UiError"));
// istanbul ignore next
if ((typeof (BUILD_SEMVER) !== "undefined") && (typeof window !== "undefined") && window) {
if (!window.iModelJsVersions)
window.iModelJsVersions = new Map();
window.iModelJsVersions.set("ui-abstract", BUILD_SEMVER);
}
__export(require("./ui-abstract/widget/StagePanel"));
__export(require("./ui-abstract/widget/WidgetState"));
/** @docs-package-description
* The ui-abstract package contains abstractions for UI controls, such as toolbars, buttons and menus.
* For more information, see [learning about ui-abstract]($docs/learning/ui/abstract/index.md).
*/
/**
* @docs-group-description Admin
* Abstractions for UI controls, such as toolbars, buttons and menus and are callable from IModelApp.uiAdmin in imodeljs-frontend.
*/
/**
* @docs-group-description Backstage

@@ -45,2 +49,6 @@ * Abstractions used by ui-framework package to create and manage the display Backstage menu items.

/**
* @docs-group-description Dialog
* Interfaces and classes for generating UI items for Dialogs.
*/
/**
* @docs-group-description Item

@@ -50,4 +58,4 @@ * Classes for working with an Item in a Toolbar, Widget, Backstage or Context Menu

/**
* @docs-group-description Plugins
* Classes for creating and managing runtime [Plugins]($docs/learning/frontend/Plugins.md)
* @docs-group-description Properties
* Properties system for data input and formatting.
*/

@@ -59,5 +67,21 @@ /**

/**
* @docs-group-description Toolbar
* Classes for creating and managing items in a toolbar.
*/
/**
* @docs-group-description UiAdmin
* Abstractions for UI controls, such as toolbars, buttons and menus and are callable from IModelApp.uiAdmin in imodeljs-frontend.
*/
/**
* @docs-group-description UiItemsProvider
* Interface for specifying UI items to be inserted at runtime.
*/
/**
* @docs-group-description Utilities
* Various utility classes for working with a UI.
*/
/**
* @docs-group-description Widget
* Classes for creating and providing Widgets.
*/
//# sourceMappingURL=ui-abstract.js.map
/** @packageDocumentation
* @module Backstage
*/
import { BadgeType } from "../../ui-abstract";
import { BadgeType } from "../items/BadgeType";
import { ConditionalBooleanValue } from "../items/ConditionalBooleanValue";
import { ConditionalStringValue } from "../items/ConditionalStringValue";
import { ProvidedItem } from "../items/ProvidedItem";
/** Used to specify the item type added to the backstage menu.

@@ -17,27 +20,30 @@ * @beta

*/
export interface CommonBackstageItem {
export interface CommonBackstageItem extends ProvidedItem {
/** can be used by application to store miscellaneous data. */
applicationData?: any;
/** Describes badge. Renders no badge if not specified. */
readonly badge?: BadgeType;
/** GroupPriority specifies the group an item is in (recommend using values 1 through 100). Items are sorted by group and then item priority. When
* group priority changes a separator is inserted.
readonly badgeType?: BadgeType;
/** Specifies the item's grouping value. Items are sorted by group and then item priority. When
* group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This
* allows extensions enough gaps to insert their own groups.
*/
readonly groupPriority: number;
/** Name of icon WebFont entry or if specifying an SVG symbol added by plug on use "svg:" prefix to imported symbol Id. */
readonly icon?: string;
/** Required unique id of the item. To ensure uniqueness it is suggested that a namespace prefix of the plugin name be used. */
readonly icon?: string | ConditionalStringValue;
/** Required unique id of the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */
readonly id: string;
/** Describes if the item is enabled. */
readonly isEnabled: boolean;
/** Describes if the item is visible. */
readonly isVisible: boolean;
/** optional data to be used by item implementor. */
readonly internalData?: Map<string, any>;
/** Describes if the item is visible or hidden. The default is for the item to be visible. */
readonly isHidden?: boolean | ConditionalBooleanValue;
/** Describes if the item is enabled or disabled. The default is for the item to be enabled. */
readonly isDisabled?: boolean | ConditionalBooleanValue;
/** Priority within a group (recommend using values 1 through 100). */
readonly itemPriority: number;
/** Label. */
readonly label: string;
readonly label: string | ConditionalStringValue;
/** Subtitle. */
readonly subtitle?: string;
readonly subtitle?: string | ConditionalStringValue;
/** Tooltip. */
readonly tooltip?: string;
/** Type of item to be inserted. ('itemType' used to avoid conflict with 'type' in ui-framework) */
readonly itemType: BackstageItemType;
readonly tooltip?: string | ConditionalStringValue;
}

@@ -48,3 +54,2 @@ /** Describes the data needed to insert an action button into the backstage menu.

export interface BackstageActionItem extends CommonBackstageItem {
readonly itemType: BackstageItemType.ActionItem;
readonly execute: () => void;

@@ -56,3 +61,2 @@ }

export interface BackstageStageLauncher extends CommonBackstageItem {
readonly itemType: BackstageItemType.StageLauncher;
readonly stageId: string;

@@ -77,6 +81,6 @@ }

/** Creates a stage launcher backstage item */
static createStageLauncher: (frontstageId: string, groupPriority: number, itemPriority: number, label: string, subtitle?: string | undefined, iconSpec?: string | undefined) => BackstageStageLauncher;
static createStageLauncher: (frontstageId: string, groupPriority: number, itemPriority: number, label: string | ConditionalStringValue, subtitle?: string | ConditionalStringValue | undefined, icon?: string | ConditionalStringValue | undefined, overrides?: Partial<BackstageStageLauncher> | undefined) => BackstageStageLauncher;
/** Creates an action backstage item */
static createActionItem: (itemId: string, groupPriority: number, itemPriority: number, execute: () => void, label: string, subtitle?: string | undefined, iconSpec?: string | undefined) => BackstageActionItem;
static createActionItem: (itemId: string, groupPriority: number, itemPriority: number, execute: () => void, label: string | ConditionalStringValue, subtitle?: string | ConditionalStringValue | undefined, icon?: string | ConditionalStringValue | undefined, overrides?: Partial<BackstageActionItem> | undefined) => BackstageActionItem;
}
//# sourceMappingURL=BackstageItem.d.ts.map

@@ -24,3 +24,3 @@ "use strict";

exports.isActionItem = (item) => {
return item.itemType === BackstageItemType.ActionItem;
return item.execute !== undefined;
};

@@ -31,3 +31,3 @@ /** BackstageStageLauncher type guard.

exports.isStageLauncher = (item) => {
return item.itemType === BackstageItemType.StageLauncher;
return item.stageId !== undefined;
};

@@ -41,27 +41,11 @@ /** Utilities for creating and maintaining backstage items

/** Creates a stage launcher backstage item */
BackstageItemUtilities.createStageLauncher = (frontstageId, groupPriority, itemPriority, label, subtitle, iconSpec) => ({
groupPriority,
icon: iconSpec,
isEnabled: true,
isVisible: true,
id: frontstageId,
itemPriority,
itemType: BackstageItemType.StageLauncher,
label,
stageId: frontstageId,
subtitle,
});
BackstageItemUtilities.createStageLauncher = (frontstageId, groupPriority, itemPriority, label, subtitle, icon, overrides) => (Object.assign({ groupPriority,
icon, id: frontstageId, itemPriority,
label, stageId: frontstageId, subtitle }, overrides));
/** Creates an action backstage item */
BackstageItemUtilities.createActionItem = (itemId, groupPriority, itemPriority, execute, label, subtitle, iconSpec) => ({
execute,
BackstageItemUtilities.createActionItem = (itemId, groupPriority, itemPriority, execute, label, subtitle, icon, overrides) => (Object.assign({ execute,
groupPriority,
icon: iconSpec,
isEnabled: true,
isVisible: true,
id: itemId,
itemPriority,
itemType: BackstageItemType.ActionItem,
icon, id: itemId, itemPriority,
label,
subtitle,
});
subtitle }, overrides));
//# sourceMappingURL=BackstageItem.js.map

@@ -14,17 +14,27 @@ /** @packageDocumentation

* Controls backstage items.
* @beta
* @internal
*/
export declare class BackstageItemsManager {
private _items;
constructor(items?: ReadonlyArray<BackstageItem>);
private loadItemsInternal;
/** load items but do not fire onItemsChanged
* @internal
*/
loadItems(items: ReadonlyArray<BackstageItem>): void;
/** Event raised when backstage items are changed.
* @internal
*/
readonly onChanged: BeEvent<(args: BackstageItemsChangedArgs) => void>;
readonly onItemsChanged: BeEvent<(args: BackstageItemsChangedArgs) => void>;
get items(): ReadonlyArray<BackstageItem>;
set items(items: ReadonlyArray<BackstageItem>);
setIsVisible(id: BackstageItem["id"], isVisible: boolean): void;
setIsEnabled(id: BackstageItem["id"], isEnabled: boolean): void;
/** @internal */
add(itemOrItems: BackstageItem | ReadonlyArray<BackstageItem>): void;
/** @internal */
remove(itemIdOrItemIds: BackstageItem["id"] | ReadonlyArray<BackstageItem["id"]>): void;
/** @internal */
static getSyncIdsOfInterest(items: readonly BackstageItem[]): string[];
private internalRefreshAffectedItems;
refreshAffectedItems(eventIds: Set<string>): void;
}
//# sourceMappingURL=BackstageItemsManager.d.ts.map

@@ -11,2 +11,4 @@ "use strict";

const bentleyjs_core_1 = require("@bentley/bentleyjs-core");
const ConditionalBooleanValue_1 = require("../items/ConditionalBooleanValue");
const ConditionalStringValue_1 = require("../items/ConditionalStringValue");
const isInstance = (args) => {

@@ -17,6 +19,6 @@ return !Array.isArray(args);

* Controls backstage items.
* @beta
* @internal
*/
class BackstageItemsManager {
constructor() {
constructor(items) {
this._items = [];

@@ -26,4 +28,27 @@ /** Event raised when backstage items are changed.

*/
this.onChanged = new bentleyjs_core_1.BeEvent();
this.onItemsChanged = new bentleyjs_core_1.BeEvent();
// istanbul ignore else
if (items)
this.loadItemsInternal(items, true, false);
}
loadItemsInternal(items, processConditions, sendItemChanged) {
if (processConditions && items) {
const eventIds = BackstageItemsManager.getSyncIdsOfInterest(items);
if (0 !== eventIds.length) {
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));
// istanbul ignore else
if (itemsUpdated)
items = updatedItems;
}
}
this._items = items;
if (sendItemChanged)
this.onItemsChanged.raiseEvent({ items });
}
/** load items but do not fire onItemsChanged
* @internal
*/
loadItems(items) {
this.loadItemsInternal(items, true, false);
}
get items() {

@@ -33,35 +58,7 @@ return this._items;

set items(items) {
if (this._items === items)
return;
this._items = items;
this.onChanged.raiseEvent({ items });
// istanbul ignore else
if (items !== this._items)
this.loadItemsInternal(items, true, true);
}
setIsVisible(id, isVisible) {
const itemIndex = this._items.findIndex((i) => i.id === id);
if (itemIndex < 0)
return;
const prevItem = this._items[itemIndex];
if (prevItem.isVisible === isVisible)
return;
const item = Object.assign(Object.assign({}, prevItem), { isVisible });
this.items = [
...this._items.slice(0, itemIndex),
item,
...this._items.slice(itemIndex + 1),
];
}
setIsEnabled(id, isEnabled) {
const itemIndex = this._items.findIndex((i) => i.id === id);
if (itemIndex < 0)
return;
const prevItem = this._items[itemIndex];
if (prevItem.isEnabled === isEnabled)
return;
const item = Object.assign(Object.assign({}, prevItem), { isEnabled });
this.items = [
...this._items.slice(0, itemIndex),
item,
...this._items.slice(itemIndex + 1),
];
}
/** @internal */
add(itemOrItems) {

@@ -83,2 +80,3 @@ let itemsToAdd;

}
/** @internal */
remove(itemIdOrItemIds) {

@@ -90,4 +88,52 @@ const items = this._items.filter((item) => {

}
/** @internal */
static getSyncIdsOfInterest(items) {
const eventIds = new Set();
items.forEach((item) => {
for (const [, entry] of Object.entries(item)) {
if (entry instanceof ConditionalBooleanValue_1.ConditionalBooleanValue) {
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId));
}
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue_1.ConditionalStringValue) {
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId));
}
}
});
return [...eventIds.values()];
}
internalRefreshAffectedItems(items, eventIds) {
// istanbul ignore next
if (0 === eventIds.size)
return { itemsUpdated: false, updatedItems: [] };
let updateRequired = false;
const newItems = [];
for (const item of items) {
const updatedItem = Object.assign({}, item);
for (const [, entry] of Object.entries(updatedItem)) {
if (entry instanceof ConditionalBooleanValue_1.ConditionalBooleanValue) {
// istanbul ignore else
if (ConditionalBooleanValue_1.ConditionalBooleanValue.refreshValue(entry, eventIds))
updateRequired = true;
}
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue_1.ConditionalStringValue) {
// istanbul ignore else
if (ConditionalStringValue_1.ConditionalStringValue.refreshValue(entry, eventIds))
updateRequired = true;
}
}
newItems.push(updatedItem);
}
return { itemsUpdated: updateRequired, updatedItems: newItems };
}
refreshAffectedItems(eventIds) {
// istanbul ignore next
if (0 === eventIds.size)
return;
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(this.items, eventIds);
// istanbul ignore else
if (itemsUpdated)
this.loadItemsInternal(updatedItems, false, true);
}
}
exports.BackstageItemsManager = BackstageItemsManager;
//# sourceMappingURL=BackstageItemsManager.js.map
/** @packageDocumentation
* @module Item
*/
import { BaseItemState } from "./BaseItemState";
import { BadgeType } from "./BadgeType";
/** Definition that allows component to register to monitor SyncUi events.
* @beta
*/
export interface SyncUiProps {
/** Function called to get the new items state */
stateFunc?: (state: Readonly<BaseItemState>) => BaseItemState;
/** Synchronize Ids to listen for */
stateSyncIds?: string[];
}
import { ConditionalBooleanValue } from "./ConditionalBooleanValue";
/** Prototype for string getter function.

@@ -19,44 +10,20 @@ * @beta

export declare type StringGetter = () => string;
/** Properties for an icon in an item
/** Definition that specifies properties shared between many ConfigurableUi components.
* @beta
*/
export interface AbstractIconProps {
export interface CommonItemProps {
/** can be used by application to store miscellaneous data. */
applicationData?: any;
/** Badge to be overlaid on the item. */
badgeType?: BadgeType;
/** if set, it is used to explicitly set the description shown by components that support a description. */
description?: string;
/** Name of icon WebFont entry or if specifying an SVG symbol added by plug on use "svg:" prefix to imported symbol Id. */
iconSpec?: string;
}
/** Properties for a label in an item
* @beta
*/
export interface LabelProps {
/** if set, it is used to explicitly set the label shown by a component. */
label?: string | StringGetter;
/** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */
labelKey?: string;
}
/** Properties for a description in an item
* @beta
*/
export interface DescriptionProps {
/** if set, it is used to explicitly set the description shown by a component. */
description?: string | StringGetter;
/** if set, it is used to define a key that is used to look up a localized string. This value is used only if description is not explicitly set. */
descriptionKey?: string;
}
/** Properties for a tooltip in an item
* @beta
*/
export interface TooltipProps {
/** used to explicitly set the tooltip shown by a component. */
tooltip?: string | StringGetter;
/** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */
tooltipKey?: string;
}
/** Definition that specifies properties shared between many ConfigurableUi components.
* @beta
*/
export interface AbstractItemProps extends AbstractIconProps, LabelProps, SyncUiProps, TooltipProps, DescriptionProps {
/** if set, component will be visible - defaults to true */
isVisible?: boolean;
/** if set, component will be enabled - defaults to true */
isEnabled?: boolean;
icon?: string;
/** optional data to used by item implementor. */
readonly internalData?: Map<string, any>;
/** if true component will be hidden - defaults to false */
isHidden?: boolean | ConditionalBooleanValue;
/** if true component will be disabled - defaults to false */
isDisabled?: boolean | ConditionalBooleanValue;
/** if set, component will be considered "active" an will display an "active stripe" - defaults to false */

@@ -66,6 +33,6 @@ isActive?: boolean;

isPressed?: boolean;
/** can be used by application to store miscellaneous data. */
applicationData?: any;
/** Badge to be overlaid on the item. */
badgeType?: BadgeType;
/** if set, it is used to explicitly set the label shown by a component. */
label?: string;
/** used to explicitly set the tooltip shown by a component. */
tooltip?: string;
}

@@ -83,16 +50,7 @@ /** Definition for a command handler used by [[CommandItemProps]].

}
/** Definition for a Tool item with a tool id.
/** Definition for an item that executes and action.
* @beta
*/
export interface AbstractToolItemProps extends AbstractItemProps, CommandHandler {
/** Id of Tool item */
toolId: string;
export interface AbstractActionItemProps extends CommonItemProps, CommandHandler {
}
/** Definition for a Command item.
* @beta
*/
export interface AbstractCommandItemProps extends AbstractItemProps, CommandHandler {
/** Id of Command item */
commandId?: string;
}
//# sourceMappingURL=AbstractItemProps.d.ts.map
/** @packageDocumentation
* @module Item
*/
import { AbstractItemProps, AbstractCommandItemProps, AbstractToolItemProps } from "./AbstractItemProps";
import { AbstractActionItemProps, CommonItemProps } from "./AbstractItemProps";
/** Properties for a Menu item
* @beta
*/
export interface AbstractMenuItemProps extends AbstractItemProps {
export interface AbstractMenuItemProps extends CommonItemProps {
/** The id for the menu item. */
id: string;
/** The item to execute when this item is invoked. Either 'item' or 'submenu' must be specified. */
item?: AbstractCommandItemProps | AbstractToolItemProps;
item?: AbstractActionItemProps;
/** Nested array of item props. Either 'item' or 'submenu' must be specified. */

@@ -14,0 +14,0 @@ submenu?: AbstractMenuItemProps[];

/** @packageDocumentation
* @module Item
*/
import { AbstractItemProps } from "./AbstractItemProps";
import { AnyItemProps } from "./AnyItemProps";
import { AbstractConditionalItemProps } from "./AbstractConditionalItemProps";
/** Union of all Item definitions that can be specified in a GroupButton or ConditionalGroup
* @beta
*/
export declare type AnyToolbarItemProps = AnyItemProps | AbstractConditionalItemProps;
import { CommonToolbarItem } from "../toolbars/ToolbarItem";
/** Definition for a Toolbar.
* @beta
*/
export interface AbstractToolbarProps extends AbstractItemProps {
export interface AbstractToolbarProps {
/** Id of Toolbar */
toolbarId?: string;
/** Items shown in the Toolbar */
items: AnyToolbarItemProps[];
items: CommonToolbarItem[];
}
//# sourceMappingURL=AbstractToolbarProps.d.ts.map

@@ -5,3 +5,3 @@ /** @packageDocumentation

/** Specifies type of badge, if any, that should be overlaid on UI component.
* @beta
* @public
*/

@@ -8,0 +8,0 @@ export declare enum BadgeType {

@@ -11,3 +11,3 @@ "use strict";

/** Specifies type of badge, if any, that should be overlaid on UI component.
* @beta
* @public
*/

@@ -14,0 +14,0 @@ var BadgeType;

/** @packageDocumentation
* @module StatusBar
*/
import { BadgeType } from "../../ui-abstract";
/** Used to specify the item type added to the status bar.
* @beta
*/
export declare enum StatusBarItemType {
/** Item that executes an action function */
ActionItem = 1,
/** Item that displays a label and optional icon in status bar. */
Label = 2,
/** Item that provides its own custom component */
CustomItem = 3
}
import { BadgeType } from "../items/BadgeType";
import { ConditionalBooleanValue } from "../items/ConditionalBooleanValue";
import { ConditionalStringValue } from "../items/ConditionalStringValue";
import { ProvidedItem } from "../items/ProvidedItem";
/** Status bar Groups/Sections from Left to Right

@@ -40,3 +32,3 @@ * @beta

*/
export declare enum StatusbarLabelSide {
export declare enum StatusBarLabelSide {
/** Label is placed left side of icon. This is the default if not specified */

@@ -54,9 +46,15 @@ Left = 0,

*/
export interface AbstractStatusBarItem {
export interface AbstractStatusBarItem extends ProvidedItem {
/** can be used by application to store miscellaneous data. */
applicationData?: any;
/** Describes badge. Renders no badge if not specified. */
readonly badge?: BadgeType;
/** Required unique id of the item. To ensure uniqueness it is suggested that a namespace prefix of the plugin name be used. */
readonly badgeType?: BadgeType;
/** Required unique id of the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */
readonly id: string;
/** Describes if the item is visible. */
readonly isVisible: boolean;
/** optional data to used by item implementor. */
readonly internalData?: Map<string, any>;
/** Describes if the item is visible or hidden. The default is for the item to be visible. */
readonly isHidden?: boolean | ConditionalBooleanValue;
/** Describes if the item is enabled or disabled. The default is for the item to be enabled. */
readonly isDisabled?: boolean | ConditionalBooleanValue;
/** Priority within a section (recommend using values 1 through 100). */

@@ -66,4 +64,2 @@ readonly itemPriority: number;

readonly section: StatusBarSection;
/** Type of item to be inserted. */
readonly type: StatusBarItemType;
}

@@ -77,9 +73,7 @@ /** Describes the data needed to insert an action item into the status bar.

/** Name of icon WebFont entry or if specifying an SVG symbol added by plug on use "svg:" prefix to imported symbol Id. */
readonly icon?: string;
readonly icon?: string | ConditionalStringValue;
/** Label. */
readonly label?: string;
readonly label?: string | ConditionalStringValue;
/** tooltip. */
readonly tooltip?: string;
/** Type of item to be inserted. */
readonly type: StatusBarItemType.ActionItem;
readonly tooltip?: string | ConditionalStringValue;
}

@@ -91,11 +85,9 @@ /** Describes the data needed to insert a label item with an optional icon into the status bar.

/** Name of icon WebFont entry or if specifying an SVG symbol added by plug on use "svg:" prefix to imported symbol Id. */
readonly icon?: string;
readonly icon?: string | ConditionalStringValue;
/** Label. */
readonly label: string;
readonly label: string | ConditionalStringValue;
/** Defines which side of icon to display label if icon is defined. */
readonly labelSide?: StatusbarLabelSide;
/** Type of item to be inserted. */
readonly type: StatusBarItemType.Label;
readonly labelSide?: StatusBarLabelSide;
}
/** Describes the data needed to insert a custom item into the status bar. This is used to allow plugin
/** Describes the data needed to insert a custom item into the status bar. This is used to allow extension
* implementer to create a framework specific component.

@@ -105,3 +97,3 @@ * @beta

export interface AbstractStatusBarCustomItem extends AbstractStatusBarItem {
readonly type: StatusBarItemType.CustomItem;
readonly isCustom: true;
}

@@ -129,6 +121,6 @@ /** Describes the data needed to insert a button into the status bar.

/** Creates a StatusBar item to perform an action */
static createActionItem: (id: string, section: StatusBarSection, itemPriority: number, icon: string, tooltip: string, execute: () => void) => AbstractStatusBarActionItem;
static createActionItem: (id: string, section: StatusBarSection, itemPriority: number, icon: string | ConditionalStringValue, tooltip: string | ConditionalStringValue, execute: () => void, overrides?: Partial<AbstractStatusBarCustomItem> | undefined) => AbstractStatusBarActionItem;
/** Creates a StatusBar item to display a label */
static createLabelItem: (id: string, section: StatusBarSection, itemPriority: number, icon: string, label: string, labelSide?: StatusbarLabelSide) => AbstractStatusBarLabelItem;
static createLabelItem: (id: string, section: StatusBarSection, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, labelSide?: StatusBarLabelSide, overrides?: Partial<AbstractStatusBarLabelItem> | undefined) => AbstractStatusBarLabelItem;
}
//# sourceMappingURL=StatusBarItem.d.ts.map

@@ -10,16 +10,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/** Used to specify the item type added to the status bar.
* @beta
*/
var StatusBarItemType;
(function (StatusBarItemType) {
/** Item that executes an action function */
StatusBarItemType[StatusBarItemType["ActionItem"] = 1] = "ActionItem";
/** Item that displays a label and optional icon in status bar. */
StatusBarItemType[StatusBarItemType["Label"] = 2] = "Label";
/** Item that provides its own custom component */
StatusBarItemType[StatusBarItemType["CustomItem"] = 3] = "CustomItem";
// Opens a modal pop-up dialog
// PopupItem
})(StatusBarItemType = exports.StatusBarItemType || (exports.StatusBarItemType = {}));
/** Status bar Groups/Sections from Left to Right

@@ -50,9 +36,9 @@ * @beta

*/
var StatusbarLabelSide;
(function (StatusbarLabelSide) {
var StatusBarLabelSide;
(function (StatusBarLabelSide) {
/** Label is placed left side of icon. This is the default if not specified */
StatusbarLabelSide[StatusbarLabelSide["Left"] = 0] = "Left";
StatusBarLabelSide[StatusBarLabelSide["Left"] = 0] = "Left";
/** Label is placed on right side of icon. */
StatusbarLabelSide[StatusbarLabelSide["Right"] = 1] = "Right";
})(StatusbarLabelSide = exports.StatusbarLabelSide || (exports.StatusbarLabelSide = {}));
StatusBarLabelSide[StatusBarLabelSide["Right"] = 1] = "Right";
})(StatusBarLabelSide = exports.StatusBarLabelSide || (exports.StatusBarLabelSide = {}));
/** AbstractStatusBarActionItem type guard.

@@ -62,3 +48,3 @@ * @beta

exports.isAbstractStatusBarActionItem = (item) => {
return item.type === StatusBarItemType.ActionItem;
return item.execute !== undefined;
};

@@ -69,3 +55,3 @@ /** AbstractStatusBarLabelItem type guard.

exports.isAbstractStatusBarLabelItem = (item) => {
return item.type === StatusBarItemType.Label;
return item.label !== undefined && item.execute === undefined;
};

@@ -76,10 +62,4 @@ /** AbstractStatusBarCustomItem type guard.

exports.isAbstractStatusBarCustomItem = (item) => {
return item.type === StatusBarItemType.CustomItem;
return !!item.isCustom;
};
// /** AbstractStatusBarPopupItem type guard.
// * @beta
// */
// export const isAbstractStatusBarPopupItem = (item: CommonStatusBarItem): item is AbstractStatusBarPopupItem => {
// return item.type === StatusBarItemType.Popup;
// };
/** Helper class to create Abstract StatusBar Item definitions.

@@ -92,17 +72,9 @@ * @beta

/** Creates a StatusBar item to perform an action */
AbstractStatusBarItemUtilities.createActionItem = (id, section, itemPriority, icon, tooltip, execute) => ({
id, section, itemPriority,
AbstractStatusBarItemUtilities.createActionItem = (id, section, itemPriority, icon, tooltip, execute, overrides) => (Object.assign({ id, section, itemPriority,
icon, tooltip,
isVisible: true,
execute,
type: StatusBarItemType.ActionItem,
});
execute }, overrides));
/** Creates a StatusBar item to display a label */
AbstractStatusBarItemUtilities.createLabelItem = (id, section, itemPriority, icon, label, labelSide = StatusbarLabelSide.Right) => ({
id, section, itemPriority,
AbstractStatusBarItemUtilities.createLabelItem = (id, section, itemPriority, icon, label, labelSide = StatusBarLabelSide.Right, overrides) => (Object.assign({ id, section, itemPriority,
icon, label,
isVisible: true,
type: StatusBarItemType.Label,
labelSide,
});
labelSide }, overrides));
//# sourceMappingURL=StatusBarItem.js.map

@@ -14,6 +14,7 @@ /** @packageDocumentation

* Controls status bar items.
* @beta
* @internal
*/
export declare class StatusBarItemsManager {
private _items;
constructor(items?: ReadonlyArray<CommonStatusBarItem>);
/** Event raised when StatusBar items are changed.

@@ -23,2 +24,3 @@ * @internal

readonly onItemsChanged: BeEvent<(args: StatusBarItemsChangedArgs) => void>;
private loadItemsInternal;
/** load items but do not fire onItemsChanged

@@ -36,9 +38,6 @@ * @internal

removeAll(): void;
/** Set the visibility of a StatusBar item */
setIsVisible(id: StatusBarItemId, isVisible: boolean): void;
/** Set Label on statusbar items that support labels */
setLabel(id: StatusBarItemId, label: string): void;
/** Set Tooltip on statusbar items that support tooltip string. */
setTooltip(id: StatusBarItemId, tooltip: string): void;
static getSyncIdsOfInterest(items: readonly CommonStatusBarItem[]): string[];
private internalRefreshAffectedItems;
refreshAffectedItems(eventIds: Set<string>): void;
}
//# sourceMappingURL=StatusBarItemsManager.d.ts.map

@@ -11,2 +11,4 @@ "use strict";

const bentleyjs_core_1 = require("@bentley/bentleyjs-core");
const ConditionalBooleanValue_1 = require("../items/ConditionalBooleanValue");
const ConditionalStringValue_1 = require("../items/ConditionalStringValue");
const isInstance = (args) => {

@@ -17,6 +19,6 @@ return !Array.isArray(args);

* Controls status bar items.
* @beta
* @internal
*/
class StatusBarItemsManager {
constructor() {
constructor(items) {
this._items = [];

@@ -27,3 +29,19 @@ /** Event raised when StatusBar items are changed.

this.onItemsChanged = new bentleyjs_core_1.BeEvent();
if (items)
this.loadItemsInternal(items, true, false);
}
loadItemsInternal(items, processConditions, sendItemChanged) {
if (processConditions && items) {
const eventIds = StatusBarItemsManager.getSyncIdsOfInterest(items);
if (0 !== eventIds.length) {
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));
// istanbul ignore else
if (itemsUpdated)
items = updatedItems;
}
}
this._items = items;
if (sendItemChanged)
this.onItemsChanged.raiseEvent({ items });
}
/** load items but do not fire onItemsChanged

@@ -33,3 +51,3 @@ * @internal

loadItems(items) {
this._items = items;
this.loadItemsInternal(items, true, false);
}

@@ -41,6 +59,5 @@ /** Get an array of the StatusBar items */

set items(items) {
if (this._items === items)
return;
this._items = items;
this.onItemsChanged.raiseEvent({ items });
// istanbul ignore else
if (items !== this._items)
this.loadItemsInternal(items, true, true);
}

@@ -74,46 +91,48 @@ add(itemOrItems) {

}
/** Set the visibility of a StatusBar item */
setIsVisible(id, isVisible) {
const itemIndex = this._items.findIndex((i) => i.id === id);
if (itemIndex < 0)
return;
const prevItem = this._items[itemIndex];
if (prevItem.isVisible === isVisible)
return;
const item = Object.assign(Object.assign({}, prevItem), { isVisible });
this.items = [
...this._items.slice(0, itemIndex),
item,
...this._items.slice(itemIndex + 1),
];
static getSyncIdsOfInterest(items) {
const eventIds = new Set();
items.forEach((item) => {
for (const [, entry] of Object.entries(item)) {
if (entry instanceof ConditionalBooleanValue_1.ConditionalBooleanValue) {
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId));
}
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue_1.ConditionalStringValue) {
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId));
}
}
});
return [...eventIds.values()];
}
/** Set Label on statusbar items that support labels */
setLabel(id, label) {
const itemIndex = this._items.findIndex((i) => i.id === id);
if (itemIndex < 0)
return;
const prevItem = this._items[itemIndex];
if (!("label" in prevItem) || (prevItem.label === label))
return;
const item = Object.assign(Object.assign({}, prevItem), { label });
this.items = [
...this._items.slice(0, itemIndex),
item,
...this._items.slice(itemIndex + 1),
];
internalRefreshAffectedItems(items, eventIds) {
// istanbul ignore next
if (0 === eventIds.size)
return { itemsUpdated: false, updatedItems: [] };
let updateRequired = false;
const newItems = [];
for (const item of items) {
const updatedItem = Object.assign({}, item);
for (const [, entry] of Object.entries(updatedItem)) {
if (entry instanceof ConditionalBooleanValue_1.ConditionalBooleanValue) {
// istanbul ignore else
if (ConditionalBooleanValue_1.ConditionalBooleanValue.refreshValue(entry, eventIds))
updateRequired = true;
}
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue_1.ConditionalStringValue) {
// istanbul ignore else
if (ConditionalStringValue_1.ConditionalStringValue.refreshValue(entry, eventIds))
updateRequired = true;
}
}
newItems.push(updatedItem);
}
return { itemsUpdated: updateRequired, updatedItems: newItems };
}
/** Set Tooltip on statusbar items that support tooltip string. */
setTooltip(id, tooltip) {
const itemIndex = this._items.findIndex((i) => i.id === id);
if (itemIndex < 0)
refreshAffectedItems(eventIds) {
// istanbul ignore next
if (0 === eventIds.size)
return;
const prevItem = this._items[itemIndex];
if (!("tooltip" in prevItem) || (prevItem.tooltip === tooltip))
return;
const item = Object.assign(Object.assign({}, prevItem), { tooltip });
this.items = [
...this._items.slice(0, itemIndex),
item,
...this._items.slice(itemIndex + 1),
];
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(this.items, eventIds);
// istanbul ignore else
if (itemsUpdated)
this.loadItemsInternal(updatedItems, false, true);
}

@@ -120,0 +139,0 @@ }

/** @packageDocumentation
* @module Utilities
*/
import { I18N, TranslationOptions } from "@bentley/imodeljs-i18n";
import { I18N } from "@bentley/imodeljs-i18n";
/**

@@ -10,6 +10,7 @@ * Entry point for static initialization required by various components used in the package.

export declare class UiAbstract {
private static _initialized;
private static _i18n?;
/**
* Called by IModelApp to initialize the UiAbstract
* @param i18n The internationalization service created by the IModelApp.
* Registers the I18N service namespace for UiAbstract
* @param i18n The internationalization service created by the application.
*/

@@ -19,3 +20,5 @@ static initialize(i18n: I18N): Promise<void>;

static terminate(): void;
/** The internationalization service created by the IModelApp. */
/** Determines if UiAbstract has been initialized */
static get initialized(): boolean;
/** The internationalization service created by the application. */
static get i18n(): I18N;

@@ -27,3 +30,3 @@ /** The internationalization service namespace. */

*/
static translate(key: string | string[], options?: TranslationOptions): string;
static translate(key: string | string[]): string;
/** @internal */

@@ -30,0 +33,0 @@ static get packageName(): string;

@@ -10,4 +10,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const bentleyjs_core_1 = require("@bentley/bentleyjs-core");
const getClassName_1 = require("./utils/getClassName");
const UiError_1 = require("./utils/UiError");
const getClassName_1 = require("./utils/getClassName");
/**

@@ -19,8 +20,13 @@ * Entry point for static initialization required by various components used in the package.

/**
* Called by IModelApp to initialize the UiAbstract
* @param i18n The internationalization service created by the IModelApp.
* Registers the I18N service namespace for UiAbstract
* @param i18n The internationalization service created by the application.
*/
static async initialize(i18n) {
if (UiAbstract._initialized) {
bentleyjs_core_1.Logger.logInfo(UiAbstract.loggerCategory(UiAbstract), `UiAbstract.initialize already called`);
return;
}
UiAbstract._i18n = i18n;
await UiAbstract._i18n.registerNamespace(UiAbstract.i18nNamespace).readFinished;
UiAbstract._initialized = true;
}

@@ -32,4 +38,7 @@ /** Unregisters the UiAbstract internationalization service namespace */

UiAbstract._i18n = undefined;
UiAbstract._initialized = false;
}
/** The internationalization service created by the IModelApp. */
/** Determines if UiAbstract has been initialized */
static get initialized() { return UiAbstract._initialized; }
/** The internationalization service created by the application. */
static get i18n() {

@@ -47,4 +56,4 @@ if (!UiAbstract._i18n)

*/
static translate(key, options) {
return UiAbstract.i18n.translateWithNamespace(UiAbstract.i18nNamespace, key, options);
static translate(key) {
return UiAbstract.i18n.translateWithNamespace(UiAbstract.i18nNamespace, key);
}

@@ -63,2 +72,3 @@ /** @internal */

exports.UiAbstract = UiAbstract;
UiAbstract._initialized = false;
//# sourceMappingURL=UiAbstract.js.map
/** @packageDocumentation
* @module Admin
* @module UiAdmin
*/

@@ -8,3 +8,5 @@ import { XAndY } from "@bentley/geometry-core";

import { RelativePosition } from "./items/RelativePosition";
import { OnCancelFunc, OnItemExecutedFunc, OnNumberCommitFunc } from "./utils/callbacks";
import { PropertyDescription } from "./properties/Description";
import { Primitives } from "./properties/PrimitiveTypes";
import { OnCancelFunc, OnItemExecutedFunc, OnNumberCommitFunc, OnValueCommitFunc } from "./utils/callbacks";
/** The UiAdmin controls various UI components and is callable from IModelApp.uiAdmin in the imodeljs-frontend package.

@@ -92,2 +94,12 @@ * @beta

showHeightEditor(_initialValue: number, _location: XAndY, _onCommit: OnNumberCommitFunc, _onCancel: OnCancelFunc, _htmlElement?: HTMLElement): boolean;
/** Show an input editor for a primitive value at a particular location.
* @param _initialValue Value initially displayed in the editor.
* @param _propertyDescription Description of the primitive value property.
* @param _location Location of the editor, relative to the origin of htmlElement or the window.
* @param _onCommit Function called when the OK button or the Enter key is pressed.
* @param _onCancel Function called when the Cancel button or the Escape key is pressed.
* @param _htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.
* @return true if the editor was displayed, false if the editor could not be displayed.
*/
showInputEditor(_initialValue: Primitives.Value, _propertyDescription: PropertyDescription, _location: XAndY, _onCommit: OnValueCommitFunc, _onCancel: OnCancelFunc, _htmlElement?: HTMLElement): boolean;
/** Hides the input editor. */

@@ -94,0 +106,0 @@ hideInputEditor(): boolean;

@@ -7,3 +7,3 @@ "use strict";

/** @packageDocumentation
* @module Admin
* @module UiAdmin
*/

@@ -107,2 +107,14 @@ Object.defineProperty(exports, "__esModule", { value: true });

}
/** Show an input editor for a primitive value at a particular location.
* @param _initialValue Value initially displayed in the editor.
* @param _propertyDescription Description of the primitive value property.
* @param _location Location of the editor, relative to the origin of htmlElement or the window.
* @param _onCommit Function called when the OK button or the Enter key is pressed.
* @param _onCancel Function called when the Cancel button or the Escape key is pressed.
* @param _htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.
* @return true if the editor was displayed, false if the editor could not be displayed.
*/
showInputEditor(_initialValue, _propertyDescription, _location, _onCommit, _onCancel, _htmlElement) {
return false;
}
/** Hides the input editor. */

@@ -109,0 +121,0 @@ hideInputEditor() { return false; }

/** @packageDocumentation
* @module Utilities
*/
import { Primitives } from "../properties/PrimitiveTypes";
/** Signature for number onCommit function.

@@ -8,2 +9,6 @@ * @beta

export declare type OnNumberCommitFunc = (value: number) => void;
/** Signature for value onCommit function.
* @beta
*/
export declare type OnValueCommitFunc = (value: Primitives.Value) => void;
/** Signature for onCancel function.

@@ -10,0 +15,0 @@ * @beta

/** @packageDocumentation
* @module Utilities
*/
/** Various IconSpec utilities.
/** Creates an IconSpec with an SVG source and gets the SVG source from an IconSpec.
* @beta

@@ -6,0 +6,0 @@ */

@@ -10,3 +10,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/** Various IconSpec utilities.
/** Creates an IconSpec with an SVG source and gets the SVG source from an IconSpec.
* @beta

@@ -21,7 +21,6 @@ */

static getSvgSource(iconSpec) {
let svgSource;
if (iconSpec.startsWith(IconSpecUtilities.SVG_PREFIX) && iconSpec.length > 4) {
svgSource = iconSpec.slice(4);
return iconSpec.slice(4);
}
return svgSource;
return undefined;
}

@@ -28,0 +27,0 @@ }

/** @packageDocumentation
* @module Utilities
*/
import { BentleyError, LogFunction, GetMetaDataFunction } from "@bentley/bentleyjs-core";
import { BentleyError, GetMetaDataFunction, LogFunction } from "@bentley/bentleyjs-core";
/** iModel.js UI UiError class is a subclass of BentleyError. Errors are logged.

@@ -6,0 +6,0 @@ * @public

{
"name": "@bentley/ui-abstract",
"version": "1.14.1",
"version": "2.0.0",
"description": "iModel.js UI abstractions",
"main": "lib/ui-abstract.js",
"typings": "lib/ui-abstract",
"imodeljsSharedLibrary": true,
"license": "MIT",

@@ -10,40 +13,14 @@ "repository": {

},
"main": "lib/ui-abstract.js",
"typings": "lib/ui-abstract",
"scripts": {
"build": "buildIModelJsModule",
"clean": "rimraf ./lib package-deps.json",
"copy:assets": "cpx \"./src/**/*.{*css,svg}\" ./lib && cpx \"./public/**/*\" ./lib/public",
"pseudolocalize": "betools pseudolocalize --englishDir ./public/locales/en --out ./lib/public/locales/en-PSEUDO",
"build": "npm run copy:assets && npm run pseudolocalize && tsc 1>&2",
"clean": "rimraf lib .rush/temp/package-deps*.json",
"cover": "nyc npm test",
"docs": "node ./node_modules/@bentley/build-tools/scripts/docs.js --includes=../../generated-docs/extract --json=../../generated-docs/ui/ui-abstract/file.json --tsIndexFile=./ui-abstract.ts --onlyJson %TYPEDOC_THEME%",
"docs": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/ui/ui-abstract/file.json --tsIndexFile=./ui-abstract.ts --onlyJson",
"lint": "tslint --project . 1>&2",
"pack": "node ../../scripts/pack.js",
"extract-api": "node ./node_modules/@bentley/build-tools/scripts/extract-api.js --entry=ui-abstract",
"extract-api": "betools extract-api --entry=ui-abstract",
"test": "mocha --opts ../mocha.opts \"./lib/test/**/*.test.js\"",
"test:watch": "npm test -- --reporter min --watch-extensions ts,tsx --watch"
},
"iModelJs": {
"buildModule": {
"type": "system",
"sourceResources": [
{
"source": "./src/**/*.*css",
"dest": "./lib"
},
{
"source": "./src/**/*.svg",
"dest": "./lib"
},
{
"source": "./public/**/*",
"dest": "./lib/public"
}
],
"webpack": {
"dest": "./lib/module",
"entry": "./lib/ui-abstract.js",
"bundleName": "ui-abstract",
"styleSheets": true
}
}
},
"keywords": [

@@ -59,5 +36,5 @@ "Bentley",

"peerDependencies": {
"@bentley/bentleyjs-core": "^1.14.1",
"@bentley/geometry-core": "^1.14.1",
"@bentley/imodeljs-i18n": "^1.14.1"
"@bentley/bentleyjs-core": "^2.0.0",
"@bentley/geometry-core": "^2.0.0",
"@bentley/imodeljs-i18n": "^2.0.0"
},

@@ -69,7 +46,6 @@ "//devDependencies": [

"devDependencies": {
"@bentley/build-tools": "1.14.1",
"@bentley/bentleyjs-core": "1.14.1",
"@bentley/geometry-core": "1.14.1",
"@bentley/imodeljs-i18n": "1.14.1",
"@bentley/webpack-tools": "1.14.1",
"@bentley/build-tools": "2.0.0",
"@bentley/bentleyjs-core": "2.0.0",
"@bentley/geometry-core": "2.0.0",
"@bentley/imodeljs-i18n": "2.0.0",
"@types/chai": "^4.1.4",

@@ -79,6 +55,5 @@ "@types/chai-as-promised": "^7",

"@types/chai-spies": "^1.0.0",
"@types/classnames": "^2.2.3",
"@types/mocha": "^5.2.5",
"@types/node": "10.14.1",
"@types/sinon": "^7.5.1",
"@types/sinon": "^9.0.0",
"@types/sinon-chai": "^3.2.0",

@@ -89,3 +64,3 @@ "chai": "^4.1.2",

"chai-spies": "1.0.0",
"cross-env": "^5.1.4",
"cpx": "^1.5.0",
"csstype": "^2.5.7",

@@ -98,4 +73,4 @@ "ignore-styles": "^5.0.1",

"raf": "^3.4.0",
"rimraf": "^2.6.2",
"sinon": "^7.5.0",
"rimraf": "^3.0.2",
"sinon": "^9.0.2",
"sinon-chai": "^3.2.0",

@@ -114,5 +89,3 @@ "typescript": "~3.7.4",

"dependencies": {
"@bentley/icons-generic-webfont": "^1.0.0",
"classnames": "^2.2.5",
"prop-types": "^15.7.2"
"@bentley/icons-generic-webfont": "^1.0.5"
},

@@ -119,0 +92,0 @@ "nyc": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc