@itwin/appui-react 4.16.4 → 4.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.js +10 -5
- package/lib/cjs/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentGroup.js +1 -1
- package/lib/cjs/appui-react/content/ContentGroup.js.map +1 -1
- package/lib/cjs/appui-react/preview/new-toolbars/ToolGroup.scss +4 -0
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +27 -25
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.js +7 -6
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarCornerComponentContext.js +2 -0
- package/lib/cjs/appui-react/statusbar/StatusBarCornerComponentContext.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.d.ts +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +23 -25
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js +16 -12
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/cjs/appui-react/utils/getActiveViewport.d.ts +10 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.d.ts.map +1 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.js +26 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.js.map +1 -0
- package/lib/esm/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.js +8 -3
- package/lib/esm/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/esm/appui-react/content/ContentGroup.js +1 -1
- package/lib/esm/appui-react/content/ContentGroup.js.map +1 -1
- package/lib/esm/appui-react/preview/new-toolbars/ToolGroup.scss +4 -0
- package/lib/esm/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js +27 -25
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarComposer.js +7 -6
- package/lib/esm/appui-react/statusbar/StatusBarComposer.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarCornerComponentContext.js +2 -0
- package/lib/esm/appui-react/statusbar/StatusBarCornerComponentContext.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.d.ts +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js +23 -25
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js +16 -12
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/esm/appui-react/utils/getActiveViewport.d.ts +10 -0
- package/lib/esm/appui-react/utils/getActiveViewport.d.ts.map +1 -0
- package/lib/esm/appui-react/utils/getActiveViewport.js +22 -0
- package/lib/esm/appui-react/utils/getActiveViewport.js.map +1 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItem.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AASH;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yGAAyG;IACzG,6EAAuB,CAAA;IACvB,8EAA8E;IAC9E,mEAAkB,CAAA;AACpB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAiGD;;GAEG;AACH,SAAgB,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC;AAJD,kDAIC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAChC,IAAiB;IAEjB,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAJD,gDAIC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC;AAJD,kDAIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport type {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { BadgeKind, BadgeType, IconSpec } from \"@itwin/core-react\";\nimport { UiItemsProvider } from \"../ui-items-provider/UiItemsProvider\";\n\n/** Used to specify the usage of the toolbar which determine the toolbar position.\n * @public\n */\nexport enum ToolbarUsage {\n /** Contains tools to Create Update and Delete content - in AppUI this is in top left of content area. */\n ContentManipulation = 0,\n /** Manipulate view/camera - in AppUI this is in top right of content area. */\n ViewNavigation = 1,\n}\n\n/** Used to specify the orientation of the toolbar.\n * @public\n */\nexport enum ToolbarOrientation {\n /** Horizontal toolbar. */\n Horizontal = 0,\n /** Vertical toolbar. */\n Vertical = 1,\n}\n\n/** Describes the data needed to insert a UI items into an existing set of UI items.\n * @public\n */\nexport interface CommonToolbarItem {\n /** Require uniqueId for the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */\n readonly id: string;\n /** Icon of a toolbar item. */\n readonly iconNode?: React.ReactNode;\n /** Describes badge. Renders no badge if not specified.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly badge?: BadgeType;\n /** Specifies the kind of badge, if any, to be rendered. */\n readonly badgeKind?: BadgeKind;\n /** Optional description */\n readonly description?: string | ConditionalStringValue;\n /** Defines if the item is active (shown with an active stripe/bar). */\n readonly isActive?: boolean;\n /** Describes if the item is visible or hidden. The default is for the item to be visible. */\n readonly isHidden?: boolean | ConditionalBooleanValue;\n /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */\n readonly isDisabled?: boolean | ConditionalBooleanValue;\n /** Specifies the item's grouping value. Items are sorted by group and then item priority. When\n * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This\n * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.\n */\n readonly groupPriority?: number;\n /** Priority within a toolbar or group. */\n readonly itemPriority: number;\n /** Describes layout specific configuration of a toolbar item.\n * @note Only used by {@link UiItemsProvider.getToolbarItems}.\n */\n readonly layouts?: ToolbarItemLayouts;\n}\n\n/** Describes the data needed to insert an action button into a toolbar.\n * @public\n */\nexport interface ToolbarActionItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on a button or an item label in a group. */\n readonly label: string | ConditionalStringValue;\n /** function to run when the button is pressed. */\n readonly execute: () => void;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a group button into a toolbar.\n * @public\n */\nexport interface ToolbarGroupItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label: string | ConditionalStringValue;\n /** label shown as the title in at top of group panel. */\n readonly panelLabel?: string | ConditionalStringValue;\n /** children of the group */\n readonly items: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a custom button into a toolbar.\n * @public\n */\nexport interface ToolbarCustomItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon?: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label?: string | ConditionalStringValue;\n /** defines the content to display in popup panel */\n readonly panelContent?: React.ReactNode;\n}\n\n/** Any Button Type that can be inserted into a toolbar.\n * @public\n */\nexport type ToolbarItem =\n | ToolbarActionItem\n | ToolbarGroupItem\n | ToolbarCustomItem;\n\n/** ToolbarActionItem type guard.\n * @public\n */\nexport function isToolbarActionItem(\n item: ToolbarItem\n): item is ToolbarActionItem {\n return \"execute\" in item;\n}\n\n/** ToolbarGroupItem type guard.\n * @public\n */\nexport function isToolbarGroupItem(\n item: ToolbarItem\n): item is ToolbarGroupItem {\n return \"items\" in item;\n}\n\n/** ToolbarCustomItem type guard.\n * @public\n */\nexport function isToolbarCustomItem(\n item: ToolbarItem\n): item is ToolbarCustomItem {\n return !isToolbarActionItem(item) && !isToolbarGroupItem(item);\n}\n\n/** Describes toolbar item configuration specific for each layout.\n * @public\n */\nexport interface ToolbarItemLayouts {\n /** Toolbar item configuration in a standard layout. */\n readonly standard?: StandardLayoutToolbarItem;\n}\n\n/** Describes toolbar item configuration specific to a standard layout.\n * @public\n */\nexport interface StandardLayoutToolbarItem {\n /** Describes toolbar usage. */\n readonly usage: ToolbarUsage;\n /** Describes toolbar orientation. */\n readonly orientation: ToolbarOrientation;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItem.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AASH;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yGAAyG;IACzG,6EAAuB,CAAA;IACvB,8EAA8E;IAC9E,mEAAkB,CAAA;AACpB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAiGD;;GAEG;AACH,SAAgB,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC;AAJD,kDAIC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAChC,IAAiB;IAEjB,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAJD,gDAIC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC;AAJD,kDAIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport type {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { BadgeKind, BadgeType, IconSpec } from \"@itwin/core-react\";\nimport { UiItemsProvider } from \"../ui-items-provider/UiItemsProvider\";\n\n/** Used to specify the usage of the toolbar which determine the toolbar position.\n * @public\n */\nexport enum ToolbarUsage {\n /** Contains tools to Create Update and Delete content - in AppUI this is in top left of content area. */\n ContentManipulation = 0,\n /** Manipulate view/camera - in AppUI this is in top right of content area. */\n ViewNavigation = 1,\n}\n\n/** Used to specify the orientation of the toolbar.\n * @public\n */\nexport enum ToolbarOrientation {\n /** Horizontal toolbar. */\n Horizontal = 0,\n /** Vertical toolbar. */\n Vertical = 1,\n}\n\n/** Describes the data needed to insert a UI items into an existing set of UI items.\n * @public\n */\nexport interface CommonToolbarItem {\n /** Require uniqueId for the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */\n readonly id: string;\n /** Icon of a toolbar item. */\n readonly iconNode?: React.ReactNode;\n /** Describes badge. Renders no badge if not specified.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly badge?: BadgeType;\n /** Specifies the kind of badge, if any, to be rendered. */\n readonly badgeKind?: BadgeKind;\n /** Optional description */\n readonly description?: string | ConditionalStringValue;\n /** Defines if the item is active (shown with an active stripe/bar). */\n readonly isActive?: boolean;\n /** Describes if the item is visible or hidden. The default is for the item to be visible. */\n readonly isHidden?: boolean | ConditionalBooleanValue;\n /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */\n readonly isDisabled?: boolean | ConditionalBooleanValue;\n /** Specifies the item's grouping value. Items are sorted by group and then item priority. When\n * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This\n * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.\n */\n readonly groupPriority?: number;\n /** Priority within a toolbar or group. */\n readonly itemPriority: number;\n /** Describes layout specific configuration of a toolbar item.\n * @note Only used by {@link UiItemsProvider.getToolbarItems}.\n */\n readonly layouts?: ToolbarItemLayouts;\n}\n\n/** Describes the data needed to insert an action button into a toolbar.\n * @public\n */\nexport interface ToolbarActionItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead and specify `undefined` for this property. This will be made optional in 5.0.0.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on a button or an item label in a group. */\n readonly label: string | ConditionalStringValue;\n /** function to run when the button is pressed. */\n readonly execute: () => void;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a group button into a toolbar.\n * @public\n */\nexport interface ToolbarGroupItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label: string | ConditionalStringValue;\n /** label shown as the title in at top of group panel. */\n readonly panelLabel?: string | ConditionalStringValue;\n /** children of the group */\n readonly items: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a custom button into a toolbar.\n * @public\n */\nexport interface ToolbarCustomItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon?: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label?: string | ConditionalStringValue;\n /** defines the content to display in popup panel */\n readonly panelContent?: React.ReactNode;\n}\n\n/** Any Button Type that can be inserted into a toolbar.\n * @public\n */\nexport type ToolbarItem =\n | ToolbarActionItem\n | ToolbarGroupItem\n | ToolbarCustomItem;\n\n/** ToolbarActionItem type guard.\n * @public\n */\nexport function isToolbarActionItem(\n item: ToolbarItem\n): item is ToolbarActionItem {\n return \"execute\" in item;\n}\n\n/** ToolbarGroupItem type guard.\n * @public\n */\nexport function isToolbarGroupItem(\n item: ToolbarItem\n): item is ToolbarGroupItem {\n return \"items\" in item;\n}\n\n/** ToolbarCustomItem type guard.\n * @public\n */\nexport function isToolbarCustomItem(\n item: ToolbarItem\n): item is ToolbarCustomItem {\n return !isToolbarActionItem(item) && !isToolbarGroupItem(item);\n}\n\n/** Describes toolbar item configuration specific for each layout.\n * @public\n */\nexport interface ToolbarItemLayouts {\n /** Toolbar item configuration in a standard layout. */\n readonly standard?: StandardLayoutToolbarItem;\n}\n\n/** Describes toolbar item configuration specific to a standard layout.\n * @public\n */\nexport interface StandardLayoutToolbarItem {\n /** Describes toolbar usage. */\n readonly usage: ToolbarUsage;\n /** Describes toolbar orientation. */\n readonly orientation: ToolbarOrientation;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAcpD;;;GAGG;AACH,qBAAa,SAAS;IACpB,WAAkB,yBAAyB,gBAW1C;IAED,WAAkB,cAAc,gBAa/B;IAED,WAAkB,iBAAiB,gBAYlC;IAED,WAAkB,eAAe,gBAYhC;IAED,WAAkB,cAAc,gBAY/B;IAED,WAAkB,iBAAiB,gBAoBlC;IAED,WAAkB,eAAe,gBAoBhC;IAED,WAAkB,oBAAoB,gBAQrC;IAED,WAAkB,mBAAmB,gBAQpC;IAED,WAAkB,uBAAuB,gBA2CxC;IAED,WAAkB,cAAc,gBAY/B;IAID,WAAkB,eAAe,gBAqBhC;IAED,WAAkB,eAAe,gBAqBhC;IAED,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,8BAA8B,gBAc/C;IAGD,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,4BAA4B,gBAc7C;IAED,WAAkB,gBAAgB,iBA0BjC;IAED,WAAkB,yBAAyB,iBAuC1C;IAGD,WAAkB,0BAA0B,gBAU3C;IAGD,WAAkB,0BAA0B,gBAU3C;IAED,WAAkB,gBAAgB,iBAWjC;IAED,WAAkB,qBAAqB,mBAgBtC;IAED,WAAkB,qCAAqC,gBAUtD;CACF"}
|
|
@@ -25,6 +25,7 @@ const section_tool_svg_1 = require("@bentley/icons-generic/icons/section-tool.sv
|
|
|
25
25
|
const selection_clear_svg_1 = require("@bentley/icons-generic/icons/selection-clear.svg");
|
|
26
26
|
const itwinui_icons_react_2 = require("@itwin/itwinui-icons-react");
|
|
27
27
|
const core_react_1 = require("@itwin/core-react");
|
|
28
|
+
const getActiveViewport_1 = require("../utils/getActiveViewport");
|
|
28
29
|
/* eslint-disable deprecation/deprecation */
|
|
29
30
|
/** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.
|
|
30
31
|
* @public
|
|
@@ -81,8 +82,8 @@ class CoreTools {
|
|
|
81
82
|
return new ToolItemDef_1.ToolItemDef({
|
|
82
83
|
toolId: core_frontend_1.RotateViewTool.toolId,
|
|
83
84
|
iconSpec: new appui_abstract_1.ConditionalStringValue(() => {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
85
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
86
|
+
if (viewport?.view.is2d())
|
|
86
87
|
return rotate_left_svg_1.default;
|
|
87
88
|
return gyroscope_svg_1.default;
|
|
88
89
|
}, [
|
|
@@ -102,8 +103,8 @@ class CoreTools {
|
|
|
102
103
|
label: core_frontend_1.WalkViewTool.flyover,
|
|
103
104
|
description: core_frontend_1.WalkViewTool.description,
|
|
104
105
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
105
|
-
const
|
|
106
|
-
return !!
|
|
106
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
107
|
+
return !!viewport?.view.is2d();
|
|
107
108
|
}, [
|
|
108
109
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
109
110
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -134,9 +135,8 @@ class CoreTools {
|
|
|
134
135
|
return new ToolItemDef_1.ToolItemDef({
|
|
135
136
|
toolId: core_frontend_1.ViewToggleCameraTool.toolId,
|
|
136
137
|
iconSpec: new core_react_1.ConditionalIconItem(() => {
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
activeContentControl?.viewport?.isCameraOn) {
|
|
138
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
139
|
+
if (viewport?.view.is3d() && viewport?.isCameraOn) {
|
|
140
140
|
return React.createElement(itwinui_icons_react_1.SvgCameraAnimation, null);
|
|
141
141
|
}
|
|
142
142
|
return React.createElement(itwinui_icons_react_1.SvgCameraAnimationDisabled, null);
|
|
@@ -146,9 +146,8 @@ class CoreTools {
|
|
|
146
146
|
SyncUiEventDispatcher_1.SyncUiEventId.ViewStateChanged,
|
|
147
147
|
]),
|
|
148
148
|
label: new appui_abstract_1.ConditionalStringValue(() => {
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
activeContentControl?.viewport?.isCameraOn) {
|
|
149
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
150
|
+
if (viewport?.view.is3d() && viewport?.isCameraOn) {
|
|
152
151
|
return UiFramework_1.UiFramework.translate("tools.View.ToggleCamera.turnOffFlyover");
|
|
153
152
|
}
|
|
154
153
|
return UiFramework_1.UiFramework.translate("tools.View.ToggleCamera.turnOnFlyover");
|
|
@@ -159,9 +158,8 @@ class CoreTools {
|
|
|
159
158
|
]),
|
|
160
159
|
description: core_frontend_1.ViewToggleCameraTool.description,
|
|
161
160
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
162
|
-
const
|
|
163
|
-
return !(
|
|
164
|
-
activeContentControl?.viewport?.view.supportsCamera());
|
|
161
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
162
|
+
return !(viewport?.view.is3d() && viewport?.view.supportsCamera());
|
|
165
163
|
}, [
|
|
166
164
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
167
165
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -185,10 +183,10 @@ class CoreTools {
|
|
|
185
183
|
return new ToolItemDef_1.ToolItemDef({
|
|
186
184
|
toolId: core_frontend_1.ViewUndoTool.toolId,
|
|
187
185
|
isDisabled: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
191
|
-
return
|
|
186
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
187
|
+
if (!viewport)
|
|
188
|
+
return false;
|
|
189
|
+
return !viewport.isUndoPossible;
|
|
192
190
|
}, [
|
|
193
191
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
194
192
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -208,10 +206,10 @@ class CoreTools {
|
|
|
208
206
|
description: core_frontend_1.ViewRedoTool.description,
|
|
209
207
|
execute: async () => core_frontend_1.IModelApp.tools.run(core_frontend_1.ViewRedoTool.toolId, core_frontend_1.IModelApp.viewManager.selectedView),
|
|
210
208
|
isDisabled: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
return
|
|
214
|
-
return
|
|
209
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
210
|
+
if (!viewport)
|
|
211
|
+
return false;
|
|
212
|
+
return !viewport.isRedoPossible;
|
|
215
213
|
}, [
|
|
216
214
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
217
215
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -288,8 +286,8 @@ class CoreTools {
|
|
|
288
286
|
labelKey: "UiFramework:tools.sectionTools",
|
|
289
287
|
iconSpec: section_tool_svg_1.default,
|
|
290
288
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
291
|
-
const
|
|
292
|
-
return !!
|
|
289
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
290
|
+
return !!viewport?.view.is2d();
|
|
293
291
|
}, [
|
|
294
292
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
295
293
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -315,8 +313,8 @@ class CoreTools {
|
|
|
315
313
|
panelLabelKey: "UiFramework:tools.sectionPanelLabel",
|
|
316
314
|
iconSpec: section_tool_svg_1.default,
|
|
317
315
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
318
|
-
const
|
|
319
|
-
return !!
|
|
316
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
317
|
+
return !!viewport?.view.is2d();
|
|
320
318
|
}, [
|
|
321
319
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
322
320
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreToolDefinitions.js","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B,CAAC,6BAA6B;AAC7D,wDAqB8B;AAC9B,0DAG+B;AAC/B,oEAGoC;AACpC,kFAAuF;AACvF,6DAA0D;AAC1D,uDAAoD;AACpD,2EAAgE;AAChE,oDAAoD;AACpD,2DAAkE;AAClE,gDAA6C;AAC7C,8EAAsE;AACtE,kFAAyE;AACzE,oFAA2E;AAC3E,0FAAiF;AACjF,oEAAoE;AACpE,kDAAwD;AAGxD,4CAA4C;AAE5C;;;GAGG;AACH,MAAa,SAAS;IACb,MAAM,KAAK,yBAAyB;QACzC,OAAO,IAAI,yBAAW,CAAC;YACrB,MAAM,EAAE,kBAAkB;YAC1B,QAAQ,EAAE,oBAAC,gCAAU,OAAG;YACxB,QAAQ,EAAE,gCAAgC;YAC1C,OAAO,EAAE,GAAG,EAAE;gBACZ,yBAAW,CAAC,gBAAgB,CAC1B,yBAAS,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CACrE,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,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AK,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,0BAA0B,CAAC;YACzE,aAAa,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,KAAK,qBAAqB;QACrC,OAAO,IAAI,+BAAc,CAAC;YACxB,SAAS,EAAE,4BAA4B;YACvC,QAAQ,EAAE,6BAAiB;YAC3B,QAAQ,EAAE,oCAAoC;YAC9C,QAAQ,EAAE,IAAA,yDAA+B,GAAE;YAC3C,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,MAAM,gBAAgB,GAAG,yBAAW,CAAC,mBAAmB,EAAE,CAAC;gBAC3D,IAAI,gBAAgB,EAAE,CAAC;oBACrB,gBAAgB,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;gBAC3C,CAAC;gBACD,MAAM,IAAI,GAAG,yBAAS,CAAC,SAAS,CAAC,aAAa,CAAC;gBAC/C,IAAI,IAAI;oBAAE,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;;oBAChC,MAAM,yBAAS,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;YACpD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,KAAK,qCAAqC;QACrD,OAAO,IAAI,yBAAW,CAAC;YACrB,MAAM,EAAE,+CAA2B,CAAC,MAAM;YAC1C,QAAQ,EAAE,+CAA2B,CAAC,QAAQ;YAC9C,KAAK,EAAE,+CAA2B,CAAC,OAAO;YAC1C,WAAW,EAAE,+CAA2B,CAAC,WAAW;YACpD,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,OAAO,yBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,+CAA2B,CAAC,MAAM,CAAC,CAAC;YACjE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF;AA1dD,8BA0dC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tools\n */\n\nimport * as React from \"react\"; // cSpell:ignore keyinbrowser\nimport {\n FitViewTool,\n FlyViewTool,\n IModelApp,\n MeasureDistanceTool,\n MeasureLocationTool,\n PanViewTool,\n RotateViewTool,\n SelectionTool,\n SetupWalkCameraTool,\n ViewClipByElementTool,\n ViewClipByPlaneTool,\n ViewClipByRangeTool,\n ViewClipByShapeTool,\n ViewClipDecorationProvider,\n ViewRedoTool,\n ViewToggleCameraTool,\n ViewUndoTool,\n WalkViewTool,\n WindowAreaTool,\n ZoomViewTool,\n} from \"@itwin/core-frontend\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport {\n SvgCameraAnimation,\n SvgCameraAnimationDisabled,\n} from \"@itwin/itwinui-icons-react\";\nimport { getIsHiddenIfSelectionNotActive } from \"../selection/SelectionContextItemDef\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport { ToolItemDef } from \"../shared/ToolItemDef\";\nimport { SyncUiEventId } from \"../syncui/SyncUiEventDispatcher\";\nimport { GroupItemDef } from \"../toolbar/GroupItem\";\nimport { RestoreFrontstageLayoutTool } from \"./RestoreLayoutTool\";\nimport { UiFramework } from \"../UiFramework\";\nimport svgGyroscope from \"@bentley/icons-generic/icons/gyroscope.svg\";\nimport svgRotateLeft from \"@bentley/icons-generic/icons/rotate-left.svg\";\nimport svgSectionTool from \"@bentley/icons-generic/icons/section-tool.svg\";\nimport svgSelectionClear from \"@bentley/icons-generic/icons/selection-clear.svg\";\nimport { SvgMeasure, SvgProcess } from \"@itwin/itwinui-icons-react\";\nimport { ConditionalIconItem } from \"@itwin/core-react\";\nimport type { ToolbarItems } from \"./ToolbarItems\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.\n * @public\n * @deprecated in 4.15.0. Use {@link ToolbarItems} instead.\n */\nexport class CoreTools {\n public static get keyinPaletteButtonItemDef() {\n return new ToolItemDef({\n toolId: \"uif:keyinpalette\",\n iconSpec: <SvgProcess />,\n labelKey: \"UiFramework:keyinbrowser.label\",\n execute: () => {\n UiFramework.showKeyinPalette(\n IModelApp.tools.getToolList().map((tool) => ({ value: tool.keyin }))\n );\n },\n });\n }\n\n public static get fitViewCommand() {\n return new ToolItemDef({\n toolId: FitViewTool.toolId,\n iconSpec: FitViewTool.iconSpec,\n label: FitViewTool.flyover,\n description: FitViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FitViewTool.toolId,\n IModelApp.viewManager.selectedView,\n true\n ),\n });\n }\n\n public static get windowAreaCommand() {\n return new ToolItemDef({\n toolId: WindowAreaTool.toolId,\n iconSpec: WindowAreaTool.iconSpec,\n label: WindowAreaTool.flyover,\n description: WindowAreaTool.description,\n execute: async () =>\n IModelApp.tools.run(\n WindowAreaTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get zoomViewCommand() {\n return new ToolItemDef({\n toolId: ZoomViewTool.toolId,\n iconSpec: ZoomViewTool.iconSpec,\n label: ZoomViewTool.flyover,\n description: ZoomViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ZoomViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get panViewCommand() {\n return new ToolItemDef({\n toolId: PanViewTool.toolId,\n iconSpec: PanViewTool.iconSpec,\n label: PanViewTool.flyover,\n description: PanViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n PanViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get rotateViewCommand() {\n return new ToolItemDef({\n toolId: RotateViewTool.toolId,\n iconSpec: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl?.viewport?.view.is2d()) return svgRotateLeft;\n return svgGyroscope;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: RotateViewTool.flyover,\n description: RotateViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n RotateViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get walkViewCommand() {\n return new ToolItemDef({\n toolId: WalkViewTool.toolId,\n iconSpec: WalkViewTool.iconSpec,\n label: WalkViewTool.flyover,\n description: WalkViewTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n WalkViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get selectElementCommand() {\n return new ToolItemDef({\n toolId: SelectionTool.toolId,\n iconSpec: SelectionTool.iconSpec,\n label: SelectionTool.flyover,\n description: SelectionTool.description,\n execute: async () => IModelApp.tools.run(SelectionTool.toolId),\n });\n }\n\n public static get setupCameraWalkTool() {\n return new ToolItemDef({\n toolId: SetupWalkCameraTool.toolId,\n iconSpec: SetupWalkCameraTool.iconSpec,\n label: SetupWalkCameraTool.flyover,\n description: SetupWalkCameraTool.description,\n execute: async () => IModelApp.tools.run(SetupWalkCameraTool.toolId),\n });\n }\n\n public static get toggleCameraViewCommand() {\n return new ToolItemDef({\n toolId: ViewToggleCameraTool.toolId,\n iconSpec: new ConditionalIconItem(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.isCameraOn\n ) {\n return <SvgCameraAnimation />;\n }\n return <SvgCameraAnimationDisabled />;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.isCameraOn\n ) {\n return UiFramework.translate(\n \"tools.View.ToggleCamera.turnOffFlyover\"\n );\n }\n return UiFramework.translate(\"tools.View.ToggleCamera.turnOnFlyover\");\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n description: ViewToggleCameraTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !(\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.view.supportsCamera()\n );\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n ViewToggleCameraTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get flyViewCommand() {\n return new ToolItemDef({\n toolId: FlyViewTool.toolId,\n iconSpec: FlyViewTool.iconSpec,\n label: FlyViewTool.flyover,\n description: FlyViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FlyViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n // TODO - Need to provide a sync message that is fired when the Undo/Redo button needs to be refreshed in the\n // active view.\n public static get viewUndoCommand() {\n return new ToolItemDef({\n toolId: ViewUndoTool.toolId,\n isDisabled: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl && activeContentControl.viewport)\n return !activeContentControl.viewport.isUndoPossible;\n return false;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n iconSpec: ViewUndoTool.iconSpec,\n label: ViewUndoTool.flyover,\n description: ViewUndoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewUndoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get viewRedoCommand() {\n return new ToolItemDef({\n toolId: ViewRedoTool.toolId,\n iconSpec: ViewRedoTool.iconSpec,\n label: ViewRedoTool.flyover,\n description: ViewRedoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewRedoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n isDisabled: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl && activeContentControl.viewport)\n return !activeContentControl.viewport.isRedoPossible;\n return false;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n });\n }\n\n private static turnOnClipVolume() {\n const vp = IModelApp.viewManager.selectedView;\n if (!vp || !vp.view.is3d()) return;\n\n // Turn on clip volume flag for section tools\n vp.viewFlags = vp.viewFlags.with(\"clipVolume\", true);\n }\n\n // note current ViewClipByPlaneTool is not automatically registered so the app must call ViewClipByPlaneTool.register();\n public static get sectionByPlaneCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByPlaneTool.toolId,\n iconSpec: ViewClipByPlaneTool.iconSpec,\n label: ViewClipByPlaneTool.flyover,\n description: ViewClipByPlaneTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByPlaneTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByElementTool is not automatically registered so the app must call ViewClipByElementTool.register();\n public static get sectionByElementCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByElementTool.toolId,\n iconSpec: ViewClipByElementTool.iconSpec,\n label: ViewClipByElementTool.flyover,\n description: ViewClipByElementTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByElementTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByRangeTool is not automatically registered so the app must call ViewClipByRangeTool.register();\n public static get sectionByRangeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByRangeTool.toolId,\n iconSpec: ViewClipByRangeTool.iconSpec,\n label: ViewClipByRangeTool.flyover,\n description: ViewClipByRangeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByRangeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByShapeTool is not automatically registered so the app must call ViewClipByShapeTool.register();\n public static get sectionByShapeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByShapeTool.toolId,\n iconSpec: ViewClipByShapeTool.iconSpec,\n label: ViewClipByShapeTool.flyover,\n description: ViewClipByShapeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByShapeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n public static get sectionToolGroup() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group\",\n labelKey: \"UiFramework:tools.sectionTools\",\n iconSpec: svgSectionTool,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n this.sectionByPlaneCommandItemDef,\n this.sectionByElementCommandItemDef,\n this.sectionByRangeCommandItemDef,\n this.sectionByShapeCommandItemDef,\n ],\n itemsInColumn: 4,\n });\n }\n\n public static get sectionToolGroupWithPanel() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group-with-panel\",\n labelKey: \"UiFramework:tools.sectionTools\",\n panelLabelKey: \"UiFramework:tools.sectionPanelLabel\",\n iconSpec: svgSectionTool,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n new ToolItemDef({\n ...this.sectionByPlaneCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByPlane\",\n }),\n new ToolItemDef({\n ...this.sectionByElementCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByElement\",\n }),\n new ToolItemDef({\n ...this.sectionByRangeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByRange\",\n }),\n new ToolItemDef({\n ...this.sectionByShapeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByShape\",\n }),\n ],\n itemsInColumn: 4,\n });\n }\n\n // note current MeasureDistanceTool is not automatically registered so the app must call MeasureDistanceTool.register();\n public static get measureDistanceToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureDistanceTool.toolId,\n iconSpec: MeasureDistanceTool.iconSpec,\n label: MeasureDistanceTool.flyover,\n description: MeasureDistanceTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureDistanceTool.toolId);\n },\n });\n }\n\n // note current MeasureLocationTool is not automatically registered so the app must call MeasureLocationTool.register();\n public static get measureLocationToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureLocationTool.toolId,\n iconSpec: MeasureLocationTool.iconSpec,\n label: MeasureLocationTool.flyover,\n description: MeasureLocationTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureLocationTool.toolId);\n },\n });\n }\n\n public static get measureToolGroup() {\n MeasureDistanceTool.register();\n MeasureLocationTool.register();\n\n return new GroupItemDef({\n groupId: \"measureTools-group\",\n labelKey: \"UiFramework:tools.measureTools\",\n iconSpec: <SvgMeasure />,\n items: [this.measureDistanceToolItemDef, this.measureLocationToolItemDef],\n itemsInColumn: 2,\n });\n }\n\n public static get clearSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.ClearSelection\",\n iconSpec: svgSelectionClear,\n labelKey: \"UiFramework:buttons.clearSelection\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () => {\n const iModelConnection = UiFramework.getIModelConnection();\n if (iModelConnection) {\n iModelConnection.selectionSet.emptyAll();\n }\n const tool = IModelApp.toolAdmin.primitiveTool;\n if (tool) await tool.onRestartTool();\n else await IModelApp.toolAdmin.startDefaultTool();\n },\n });\n }\n\n public static get restoreFrontstageLayoutCommandItemDef() {\n return new ToolItemDef({\n toolId: RestoreFrontstageLayoutTool.toolId,\n iconSpec: RestoreFrontstageLayoutTool.iconSpec,\n label: RestoreFrontstageLayoutTool.flyover,\n description: RestoreFrontstageLayoutTool.description,\n execute: async () => {\n return IModelApp.tools.run(RestoreFrontstageLayoutTool.toolId);\n },\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CoreToolDefinitions.js","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B,CAAC,6BAA6B;AAC7D,wDAqB8B;AAC9B,0DAG+B;AAC/B,oEAGoC;AACpC,kFAAuF;AACvF,6DAA0D;AAC1D,uDAAoD;AACpD,2EAAgE;AAChE,oDAAoD;AACpD,2DAAkE;AAClE,gDAA6C;AAC7C,8EAAsE;AACtE,kFAAyE;AACzE,oFAA2E;AAC3E,0FAAiF;AACjF,oEAAoE;AACpE,kDAAwD;AAExD,kEAA+D;AAE/D,4CAA4C;AAE5C;;;GAGG;AACH,MAAa,SAAS;IACb,MAAM,KAAK,yBAAyB;QACzC,OAAO,IAAI,yBAAW,CAAC;YACrB,MAAM,EAAE,kBAAkB;YAC1B,QAAQ,EAAE,oBAAC,gCAAU,OAAG;YACxB,QAAQ,EAAE,gCAAgC;YAC1C,OAAO,EAAE,GAAG,EAAE;gBACZ,yBAAW,CAAC,gBAAgB,CAC1B,yBAAS,CAAC,KAAK,CAAC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AC3B,QAAQ,EAAE,oCAAoC;YAC9C,QAAQ,EAAE,IAAA,yDAA+B,GAAE;YAC3C,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,MAAM,gBAAgB,GAAG,yBAAW,CAAC,mBAAmB,EAAE,CAAC;gBAC3D,IAAI,gBAAgB,EAAE,CAAC;oBACrB,gBAAgB,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;gBAC3C,CAAC;gBACD,MAAM,IAAI,GAAG,yBAAS,CAAC,SAAS,CAAC,aAAa,CAAC;gBAC/C,IAAI,IAAI;oBAAE,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;;oBAChC,MAAM,yBAAS,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;YACpD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,KAAK,qCAAqC;QACrD,OAAO,IAAI,yBAAW,CAAC;YACrB,MAAM,EAAE,+CAA2B,CAAC,MAAM;YAC1C,QAAQ,EAAE,+CAA2B,CAAC,QAAQ;YAC9C,KAAK,EAAE,+CAA2B,CAAC,OAAO;YAC1C,WAAW,EAAE,+CAA2B,CAAC,WAAW;YACpD,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,OAAO,yBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,+CAA2B,CAAC,MAAM,CAAC,CAAC;YACjE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAvcD,8BAucC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tools\n */\n\nimport * as React from \"react\"; // cSpell:ignore keyinbrowser\nimport {\n FitViewTool,\n FlyViewTool,\n IModelApp,\n MeasureDistanceTool,\n MeasureLocationTool,\n PanViewTool,\n RotateViewTool,\n SelectionTool,\n SetupWalkCameraTool,\n ViewClipByElementTool,\n ViewClipByPlaneTool,\n ViewClipByRangeTool,\n ViewClipByShapeTool,\n ViewClipDecorationProvider,\n ViewRedoTool,\n ViewToggleCameraTool,\n ViewUndoTool,\n WalkViewTool,\n WindowAreaTool,\n ZoomViewTool,\n} from \"@itwin/core-frontend\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport {\n SvgCameraAnimation,\n SvgCameraAnimationDisabled,\n} from \"@itwin/itwinui-icons-react\";\nimport { getIsHiddenIfSelectionNotActive } from \"../selection/SelectionContextItemDef\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport { ToolItemDef } from \"../shared/ToolItemDef\";\nimport { SyncUiEventId } from \"../syncui/SyncUiEventDispatcher\";\nimport { GroupItemDef } from \"../toolbar/GroupItem\";\nimport { RestoreFrontstageLayoutTool } from \"./RestoreLayoutTool\";\nimport { UiFramework } from \"../UiFramework\";\nimport svgGyroscope from \"@bentley/icons-generic/icons/gyroscope.svg\";\nimport svgRotateLeft from \"@bentley/icons-generic/icons/rotate-left.svg\";\nimport svgSectionTool from \"@bentley/icons-generic/icons/section-tool.svg\";\nimport svgSelectionClear from \"@bentley/icons-generic/icons/selection-clear.svg\";\nimport { SvgMeasure, SvgProcess } from \"@itwin/itwinui-icons-react\";\nimport { ConditionalIconItem } from \"@itwin/core-react\";\nimport type { ToolbarItems } from \"./ToolbarItems\";\nimport { getActiveViewport } from \"../utils/getActiveViewport\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.\n * @public\n * @deprecated in 4.15.0. Use {@link ToolbarItems} instead.\n */\nexport class CoreTools {\n public static get keyinPaletteButtonItemDef() {\n return new ToolItemDef({\n toolId: \"uif:keyinpalette\",\n iconSpec: <SvgProcess />,\n labelKey: \"UiFramework:keyinbrowser.label\",\n execute: () => {\n UiFramework.showKeyinPalette(\n IModelApp.tools.getToolList().map((tool) => ({ value: tool.keyin }))\n );\n },\n });\n }\n\n public static get fitViewCommand() {\n return new ToolItemDef({\n toolId: FitViewTool.toolId,\n iconSpec: FitViewTool.iconSpec,\n label: FitViewTool.flyover,\n description: FitViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FitViewTool.toolId,\n IModelApp.viewManager.selectedView,\n true\n ),\n });\n }\n\n public static get windowAreaCommand() {\n return new ToolItemDef({\n toolId: WindowAreaTool.toolId,\n iconSpec: WindowAreaTool.iconSpec,\n label: WindowAreaTool.flyover,\n description: WindowAreaTool.description,\n execute: async () =>\n IModelApp.tools.run(\n WindowAreaTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get zoomViewCommand() {\n return new ToolItemDef({\n toolId: ZoomViewTool.toolId,\n iconSpec: ZoomViewTool.iconSpec,\n label: ZoomViewTool.flyover,\n description: ZoomViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ZoomViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get panViewCommand() {\n return new ToolItemDef({\n toolId: PanViewTool.toolId,\n iconSpec: PanViewTool.iconSpec,\n label: PanViewTool.flyover,\n description: PanViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n PanViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get rotateViewCommand() {\n return new ToolItemDef({\n toolId: RotateViewTool.toolId,\n iconSpec: new ConditionalStringValue(() => {\n const viewport = getActiveViewport();\n if (viewport?.view.is2d()) return svgRotateLeft;\n return svgGyroscope;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: RotateViewTool.flyover,\n description: RotateViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n RotateViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get walkViewCommand() {\n return new ToolItemDef({\n toolId: WalkViewTool.toolId,\n iconSpec: WalkViewTool.iconSpec,\n label: WalkViewTool.flyover,\n description: WalkViewTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const viewport = getActiveViewport();\n return !!viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n WalkViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get selectElementCommand() {\n return new ToolItemDef({\n toolId: SelectionTool.toolId,\n iconSpec: SelectionTool.iconSpec,\n label: SelectionTool.flyover,\n description: SelectionTool.description,\n execute: async () => IModelApp.tools.run(SelectionTool.toolId),\n });\n }\n\n public static get setupCameraWalkTool() {\n return new ToolItemDef({\n toolId: SetupWalkCameraTool.toolId,\n iconSpec: SetupWalkCameraTool.iconSpec,\n label: SetupWalkCameraTool.flyover,\n description: SetupWalkCameraTool.description,\n execute: async () => IModelApp.tools.run(SetupWalkCameraTool.toolId),\n });\n }\n\n public static get toggleCameraViewCommand() {\n return new ToolItemDef({\n toolId: ViewToggleCameraTool.toolId,\n iconSpec: new ConditionalIconItem(() => {\n const viewport = getActiveViewport();\n if (viewport?.view.is3d() && viewport?.isCameraOn) {\n return <SvgCameraAnimation />;\n }\n\n return <SvgCameraAnimationDisabled />;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: new ConditionalStringValue(() => {\n const viewport = getActiveViewport();\n if (viewport?.view.is3d() && viewport?.isCameraOn) {\n return UiFramework.translate(\n \"tools.View.ToggleCamera.turnOffFlyover\"\n );\n }\n return UiFramework.translate(\"tools.View.ToggleCamera.turnOnFlyover\");\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n description: ViewToggleCameraTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const viewport = getActiveViewport();\n return !(viewport?.view.is3d() && viewport?.view.supportsCamera());\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n ViewToggleCameraTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get flyViewCommand() {\n return new ToolItemDef({\n toolId: FlyViewTool.toolId,\n iconSpec: FlyViewTool.iconSpec,\n label: FlyViewTool.flyover,\n description: FlyViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FlyViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n // TODO - Need to provide a sync message that is fired when the Undo/Redo button needs to be refreshed in the\n // active view.\n public static get viewUndoCommand() {\n return new ToolItemDef({\n toolId: ViewUndoTool.toolId,\n isDisabled: new ConditionalBooleanValue(() => {\n const viewport = getActiveViewport();\n if (!viewport) return false;\n return !viewport.isUndoPossible;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n iconSpec: ViewUndoTool.iconSpec,\n label: ViewUndoTool.flyover,\n description: ViewUndoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewUndoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get viewRedoCommand() {\n return new ToolItemDef({\n toolId: ViewRedoTool.toolId,\n iconSpec: ViewRedoTool.iconSpec,\n label: ViewRedoTool.flyover,\n description: ViewRedoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewRedoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n isDisabled: new ConditionalBooleanValue(() => {\n const viewport = getActiveViewport();\n if (!viewport) return false;\n return !viewport.isRedoPossible;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n });\n }\n\n private static turnOnClipVolume() {\n const vp = IModelApp.viewManager.selectedView;\n if (!vp || !vp.view.is3d()) return;\n\n // Turn on clip volume flag for section tools\n vp.viewFlags = vp.viewFlags.with(\"clipVolume\", true);\n }\n\n // note current ViewClipByPlaneTool is not automatically registered so the app must call ViewClipByPlaneTool.register();\n public static get sectionByPlaneCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByPlaneTool.toolId,\n iconSpec: ViewClipByPlaneTool.iconSpec,\n label: ViewClipByPlaneTool.flyover,\n description: ViewClipByPlaneTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByPlaneTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByElementTool is not automatically registered so the app must call ViewClipByElementTool.register();\n public static get sectionByElementCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByElementTool.toolId,\n iconSpec: ViewClipByElementTool.iconSpec,\n label: ViewClipByElementTool.flyover,\n description: ViewClipByElementTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByElementTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByRangeTool is not automatically registered so the app must call ViewClipByRangeTool.register();\n public static get sectionByRangeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByRangeTool.toolId,\n iconSpec: ViewClipByRangeTool.iconSpec,\n label: ViewClipByRangeTool.flyover,\n description: ViewClipByRangeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByRangeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByShapeTool is not automatically registered so the app must call ViewClipByShapeTool.register();\n public static get sectionByShapeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByShapeTool.toolId,\n iconSpec: ViewClipByShapeTool.iconSpec,\n label: ViewClipByShapeTool.flyover,\n description: ViewClipByShapeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByShapeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n public static get sectionToolGroup() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group\",\n labelKey: \"UiFramework:tools.sectionTools\",\n iconSpec: svgSectionTool,\n isHidden: new ConditionalBooleanValue(() => {\n const viewport = getActiveViewport();\n return !!viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n this.sectionByPlaneCommandItemDef,\n this.sectionByElementCommandItemDef,\n this.sectionByRangeCommandItemDef,\n this.sectionByShapeCommandItemDef,\n ],\n itemsInColumn: 4,\n });\n }\n\n public static get sectionToolGroupWithPanel() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group-with-panel\",\n labelKey: \"UiFramework:tools.sectionTools\",\n panelLabelKey: \"UiFramework:tools.sectionPanelLabel\",\n iconSpec: svgSectionTool,\n isHidden: new ConditionalBooleanValue(() => {\n const viewport = getActiveViewport();\n return !!viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n new ToolItemDef({\n ...this.sectionByPlaneCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByPlane\",\n }),\n new ToolItemDef({\n ...this.sectionByElementCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByElement\",\n }),\n new ToolItemDef({\n ...this.sectionByRangeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByRange\",\n }),\n new ToolItemDef({\n ...this.sectionByShapeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByShape\",\n }),\n ],\n itemsInColumn: 4,\n });\n }\n\n // note current MeasureDistanceTool is not automatically registered so the app must call MeasureDistanceTool.register();\n public static get measureDistanceToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureDistanceTool.toolId,\n iconSpec: MeasureDistanceTool.iconSpec,\n label: MeasureDistanceTool.flyover,\n description: MeasureDistanceTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureDistanceTool.toolId);\n },\n });\n }\n\n // note current MeasureLocationTool is not automatically registered so the app must call MeasureLocationTool.register();\n public static get measureLocationToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureLocationTool.toolId,\n iconSpec: MeasureLocationTool.iconSpec,\n label: MeasureLocationTool.flyover,\n description: MeasureLocationTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureLocationTool.toolId);\n },\n });\n }\n\n public static get measureToolGroup() {\n MeasureDistanceTool.register();\n MeasureLocationTool.register();\n\n return new GroupItemDef({\n groupId: \"measureTools-group\",\n labelKey: \"UiFramework:tools.measureTools\",\n iconSpec: <SvgMeasure />,\n items: [this.measureDistanceToolItemDef, this.measureLocationToolItemDef],\n itemsInColumn: 2,\n });\n }\n\n public static get clearSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.ClearSelection\",\n iconSpec: svgSelectionClear,\n labelKey: \"UiFramework:buttons.clearSelection\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () => {\n const iModelConnection = UiFramework.getIModelConnection();\n if (iModelConnection) {\n iModelConnection.selectionSet.emptyAll();\n }\n const tool = IModelApp.toolAdmin.primitiveTool;\n if (tool) await tool.onRestartTool();\n else await IModelApp.toolAdmin.startDefaultTool();\n },\n });\n }\n\n public static get restoreFrontstageLayoutCommandItemDef() {\n return new ToolItemDef({\n toolId: RestoreFrontstageLayoutTool.toolId,\n iconSpec: RestoreFrontstageLayoutTool.iconSpec,\n label: RestoreFrontstageLayoutTool.flyover,\n description: RestoreFrontstageLayoutTool.description,\n execute: async () => {\n return IModelApp.tools.run(RestoreFrontstageLayoutTool.toolId);\n },\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentGenerator.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,SAAS,
|
|
1
|
+
{"version":3,"file":"ComponentGenerator.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAkLvE;;GAEG;AACH,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,SAAS,CAAC;gBADV,eAAe,EAAE,oBAAoB,EACrC,SAAS,CAAC,SAAQ,IAAI,aAAA;IAGhC,IAAW,cAAc,yBAExB;IAED,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,iCAAiC;IA2BzC,OAAO,CAAC,mCAAmC;IAiC3C,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,YAAY;IAKb,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS;IAazD,oBAAoB,CACzB,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,GACf,iBAAiB;IAWpB,6DAA6D;IACtD,sBAAsB,IAAI,iBAAiB,EAAE;CAKrD"}
|
|
@@ -34,7 +34,7 @@ function EditorLabel({ uiDataProvider, item, isLeftmostRecord, }) {
|
|
|
34
34
|
displayLabel,
|
|
35
35
|
":"));
|
|
36
36
|
}
|
|
37
|
-
function PropertyEditor({ uiDataProvider, initialItem, isLock, setFocus, onCancel, }) {
|
|
37
|
+
function PropertyEditor({ uiDataProvider, initialItem, isLock = false, setFocus, onCancel, }) {
|
|
38
38
|
const getLatestRecordValue = React.useCallback((initial) => {
|
|
39
39
|
let newRecord = appui_abstract_1.UiLayoutDataProvider.getPropertyRecord(initial);
|
|
40
40
|
const foundItem = isLock
|
|
@@ -62,7 +62,7 @@ function PropertyEditor({ uiDataProvider, initialItem, isLock, setFocus, onCance
|
|
|
62
62
|
const [propertyRecord, setPropertyRecord] = React.useState(currentRecord);
|
|
63
63
|
// monitor tool for sync UI events
|
|
64
64
|
React.useEffect(() => {
|
|
65
|
-
|
|
65
|
+
return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {
|
|
66
66
|
const mySyncItem = args.properties.find((syncItem) => syncItem.propertyName === initialItem.property.name);
|
|
67
67
|
if (mySyncItem) {
|
|
68
68
|
const newPropertyValue = propertyRecord.copyWithNewValue({
|
|
@@ -84,21 +84,16 @@ function PropertyEditor({ uiDataProvider, initialItem, isLock, setFocus, onCance
|
|
|
84
84
|
setPropertyRecord(newPropertyValue);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
};
|
|
88
|
-
uiDataProvider.onSyncPropertiesChangeEvent.addListener(handleSync);
|
|
89
|
-
return () => {
|
|
90
|
-
uiDataProvider.onSyncPropertiesChangeEvent.removeListener(handleSync);
|
|
91
|
-
};
|
|
87
|
+
});
|
|
92
88
|
}, [uiDataProvider, propertyRecord, initialItem.property.name]);
|
|
93
89
|
React.useEffect(() => {
|
|
94
|
-
|
|
95
|
-
const newItem = uiDataProvider
|
|
90
|
+
return uiDataProvider.onItemsReloadedEvent.addListener(() => {
|
|
91
|
+
const newItem = findDialogItem(uiDataProvider, initialItem.property.name, isLock);
|
|
96
92
|
if (!newItem)
|
|
97
93
|
return;
|
|
98
94
|
setPropertyRecord(getLatestRecordValue(newItem));
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
}, [uiDataProvider, initialItem.property.name, getLatestRecordValue]);
|
|
95
|
+
});
|
|
96
|
+
}, [uiDataProvider, initialItem.property.name, getLatestRecordValue, isLock]);
|
|
102
97
|
const className = React.useMemo(() => (isLock ? "uifw-default-property-lock" : "uifw-default-editor"), [isLock]);
|
|
103
98
|
const handleCommit = React.useCallback((commit) => {
|
|
104
99
|
// UiLayoutDataProvider supports only primitive property types
|
|
@@ -214,4 +209,13 @@ class ComponentGenerator {
|
|
|
214
209
|
}
|
|
215
210
|
}
|
|
216
211
|
exports.ComponentGenerator = ComponentGenerator;
|
|
212
|
+
function findDialogItem(uiDataProvider, propertyName, isLock) {
|
|
213
|
+
const dialogItem = uiDataProvider.items.find((item) => {
|
|
214
|
+
if (isLock) {
|
|
215
|
+
return item.lockProperty?.property.name === propertyName;
|
|
216
|
+
}
|
|
217
|
+
return item.property.name === propertyName;
|
|
218
|
+
});
|
|
219
|
+
return isLock ? dialogItem?.lockProperty : dialogItem;
|
|
220
|
+
}
|
|
217
221
|
//# sourceMappingURL=ComponentGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentGenerator.js","sourceRoot":"","sources":["../../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,6CAA2C;AAC3C,2CAAoC;AACpC,+BAA+B;AAS/B,0DAG+B;AAE/B,8DAA0D;AAE1D,sDAAqD;AACrD,wDAA6C;AAE7C,SAAS,WAAW,CAAC,EACnB,cAAc,EACd,IAAI,EACJ,gBAAgB,GAKjB;IACC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtE,MA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C,CAAC;gBACvE,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;aACnC,CAAC;QACJ,CAAC;IACH,CAAC;IAED,6DAA6D;IACtD,sBAAsB;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAc,EAAE,KAAa,EAAE,EAAE,CACpE,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CACtC,CAAC;IACJ,CAAC;CACF;AA5LD,gDA4LC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\nimport \"./DefaultDialogGridContainer.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n BaseDialogItem,\n DialogItem,\n DialogItemValue,\n DialogPropertySyncItem,\n DialogRow,\n SyncPropertiesChangeEventArgs,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n UiLayoutDataProvider,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"@itwin/components-react\";\nimport { EditorContainer } from \"@itwin/components-react\";\nimport type { ToolSettingsEntry } from \"../widget-panels/ToolSettings\";\nimport { assert, Logger } from \"@itwin/core-bentley\";\nimport { Label } from \"@itwin/itwinui-react\";\n\nfunction EditorLabel({\n uiDataProvider,\n item,\n isLeftmostRecord,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n item: DialogItem;\n isLeftmostRecord?: boolean;\n}) {\n const [isDisabled, setIsDisabled] = React.useState(!!item.isDisabled);\n const displayLabel = React.useMemo(() => {\n return item.property.displayLabel || item.property.name;\n }, [item]);\n\n // listen for tool sync property events and update the isDisabled state\n React.useEffect(() => {\n return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {\n const mySyncItem = args.properties.find(\n (syncItem) => syncItem.propertyName === item.property.name\n );\n if (mySyncItem) {\n setIsDisabled(!!mySyncItem.isDisabled);\n }\n });\n }, [uiDataProvider, item]);\n\n const className = classnames(\n \"uifw-default-label\",\n !!isLeftmostRecord && \"uifw-default-narrow-only-display\"\n );\n return (\n <Label\n className={className}\n htmlFor={item.property.name}\n disabled={isDisabled}\n >\n {displayLabel}:\n </Label>\n );\n}\n\nfunction PropertyEditor({\n uiDataProvider,\n initialItem,\n isLock,\n setFocus,\n onCancel,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n initialItem: BaseDialogItem;\n isLock?: boolean;\n setFocus?: boolean;\n onCancel?: () => void;\n}) {\n const getLatestRecordValue = React.useCallback(\n (initial: BaseDialogItem) => {\n let newRecord = UiLayoutDataProvider.getPropertyRecord(initial);\n\n const foundItem = isLock\n ? uiDataProvider.items.find(\n (item) => item.lockProperty?.property.name === initial.property.name\n )\n : uiDataProvider.items.find(\n (item) => item.property.name === initial.property.name\n );\n if (foundItem) {\n if (isLock) {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.lockProperty!.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.lockProperty!.isDisabled;\n } else {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.isDisabled;\n }\n }\n return newRecord;\n },\n [isLock, uiDataProvider.items]\n );\n\n const currentRecord = getLatestRecordValue(initialItem);\n const [propertyRecord, setPropertyRecord] = React.useState(currentRecord);\n\n // monitor tool for sync UI events\n React.useEffect(() => {\n const handleSync = (args: SyncPropertiesChangeEventArgs) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === initialItem.property.name\n );\n if (mySyncItem) {\n const newPropertyValue = propertyRecord.copyWithNewValue(\n {\n value: mySyncItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n displayValue: mySyncItem.value.displayValue,\n },\n mySyncItem.property\n );\n\n if (mySyncItem.property) {\n if (mySyncItem.property.name === mySyncItem.propertyName) {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n } else {\n Logger.logError(\n \"PropertyEditor\",\n `Error trying to replace propertyName=${mySyncItem.propertyName} with property named ${mySyncItem.property.name}`\n );\n }\n } else {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n }\n }\n };\n uiDataProvider.onSyncPropertiesChangeEvent.addListener(handleSync);\n return () => {\n uiDataProvider.onSyncPropertiesChangeEvent.removeListener(handleSync);\n };\n }, [uiDataProvider, propertyRecord, initialItem.property.name]);\n\n React.useEffect(() => {\n const updateItem = () => {\n const newItem = uiDataProvider.items.find(\n (item) => item.property.name === initialItem.property.name\n );\n if (!newItem) return;\n setPropertyRecord(getLatestRecordValue(newItem));\n };\n\n return uiDataProvider.onItemsReloadedEvent.addListener(updateItem);\n }, [uiDataProvider, initialItem.property.name, getLatestRecordValue]);\n\n const className = React.useMemo(\n () => (isLock ? \"uifw-default-property-lock\" : \"uifw-default-editor\"),\n [isLock]\n );\n const handleCommit = React.useCallback(\n (commit: PropertyUpdatedArgs) => {\n // UiLayoutDataProvider supports only primitive property types\n assert(\n commit.newValue.valueFormat === PropertyValueFormat.Primitive &&\n commit.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n );\n const newPropertyValue = propertyRecord.copyWithNewValue(commit.newValue);\n const syncItem: DialogPropertySyncItem = {\n value: commit.newValue as DialogItemValue,\n propertyName: initialItem.property.name,\n isDisabled: newPropertyValue.isDisabled,\n };\n uiDataProvider.applyUiPropertyChange(syncItem);\n // Now have the uiDataProvider refetch the latest property values from the tool\n uiDataProvider.reloadDialogItems(true);\n },\n [initialItem.property.name, propertyRecord, uiDataProvider]\n );\n const handleCancel = () => {};\n\n return (\n <div key={initialItem.property.name} className={className}>\n <EditorContainer\n key={initialItem.property.name}\n propertyRecord={propertyRecord}\n setFocus={setFocus}\n onCommit={handleCommit}\n onCancel={onCancel ?? handleCancel}\n />\n </div>\n );\n}\n\n/** Utility methods to generate react ui from DialogRow specs\n * @internal\n */\nexport class ComponentGenerator {\n constructor(\n private _uiDataProvider: UiLayoutDataProvider,\n private _onCancel?: () => void\n ) {}\n\n public get uiDataProvider() {\n return this._uiDataProvider;\n }\n\n private getEditor(\n item: BaseDialogItem,\n isLock = false,\n setFocus = false\n ): React.ReactNode {\n return (\n <PropertyEditor\n key={item.property.name}\n uiDataProvider={this.uiDataProvider}\n initialItem={item}\n isLock={isLock}\n setFocus={setFocus}\n onCancel={this._onCancel}\n />\n );\n }\n\n private generateRowWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): React.ReactNode {\n if (1 === row.items.length) {\n return (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n );\n }\n\n return (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n );\n }\n\n private generateEntryWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (1 === row.items.length) {\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n ),\n };\n }\n\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n ),\n };\n }\n\n private getEditorLabel(\n item: DialogItem,\n isLeftmostRecord = false\n ): React.ReactNode {\n return (\n <EditorLabel\n uiDataProvider={this.uiDataProvider}\n item={item}\n isLeftmostRecord={isLeftmostRecord}\n />\n );\n }\n\n private getLeftLockAndLabel(\n rowItem: DialogItem,\n multiplePropertiesOnRow: boolean\n ): React.ReactNode {\n const record = UiLayoutDataProvider.getPropertyRecord(rowItem);\n const lockEditor = UiLayoutDataProvider.hasAssociatedLockProperty(rowItem)\n ? this.getEditor(rowItem.lockProperty!, true)\n : null;\n const label = UiLayoutDataProvider.editorWantsLabel(rowItem)\n ? this.getEditorLabel(rowItem)\n : null;\n const classNames = multiplePropertiesOnRow\n ? \"uifw-default-lock-and-label uifw-default-wide-only-display\"\n : \"uifw-default-lock-and-label\";\n return (\n <div key={`lock-${record.property.name}`} className={classNames}>\n {lockEditor}\n {label}\n </div>\n );\n }\n\n private getInlineLabelAndEditor(\n item: DialogItem,\n isLeftmostRecord: boolean\n ): React.ReactNode {\n const label = UiLayoutDataProvider.editorWantsLabel(item)\n ? this.getEditorLabel(item, isLeftmostRecord)\n : null;\n return (\n <div\n key={item.property.name}\n className=\"uifw-default-inline-label-and-editor\"\n >\n {label}\n {this.getEditor(item)}\n </div>\n );\n }\n\n private getRowWithMultipleEditors(row: DialogRow): React.ReactNode {\n return (\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item: DialogItem, index: number) =>\n this.getInlineLabelAndEditor(item, index === 0)\n )}\n </div>\n );\n }\n\n private getDivForRow(row: DialogRow): React.ReactNode {\n if (row.items.length === 1) return this.getEditor(row.items[0]);\n return this.getRowWithMultipleEditors(row);\n }\n\n public getRow(row: DialogRow, rowIndex: number): React.ReactNode {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateRowWithButtonGroupEditors(row, rowIndex);\n } else {\n return (\n <React.Fragment key={rowIndex}>\n {this.getLeftLockAndLabel(row.items[0], row.items.length > 1)}\n {this.getDivForRow(row)}\n </React.Fragment>\n );\n }\n }\n\n public getToolSettingsEntry(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateEntryWithButtonGroupEditors(row, rowIndex);\n } else {\n return {\n labelNode: this.getLeftLockAndLabel(row.items[0], row.items.length > 1),\n editorNode: this.getDivForRow(row),\n };\n }\n }\n\n /** ToolSettingsEntries are used by the tool settings bar. */\n public getToolSettingsEntries(): ToolSettingsEntry[] {\n return this.uiDataProvider.rows.map((row: DialogRow, index: number) =>\n this.getToolSettingsEntry(row, index)\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ComponentGenerator.js","sourceRoot":"","sources":["../../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,6CAA2C;AAC3C,2CAAoC;AACpC,+BAA+B;AAQ/B,0DAG+B;AAE/B,8DAA0D;AAE1D,sDAAqD;AACrD,wDAA6C;AAE7C,SAAS,WAAW,CAAC,EACnB,cAAc,EACd,IAAI,EACJ,gBAAgB,GAKjB;IACC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC1D,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,uEAAuE;IACvE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,cAAc,CAAC,2BAA2B,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YACrE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CACrC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAC3D,CAAC;YACF,IAAI,UAAU,EAAE,CAAC;gBACf,aAAa,CAAC,CAAC,CAAC,UAAU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sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\nimport \"./DefaultDialogGridContainer.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n BaseDialogItem,\n DialogItem,\n DialogItemValue,\n DialogPropertySyncItem,\n DialogRow,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n UiLayoutDataProvider,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"@itwin/components-react\";\nimport { EditorContainer } from \"@itwin/components-react\";\nimport type { ToolSettingsEntry } from \"../widget-panels/ToolSettings\";\nimport { assert, Logger } from \"@itwin/core-bentley\";\nimport { Label } from \"@itwin/itwinui-react\";\n\nfunction EditorLabel({\n uiDataProvider,\n item,\n isLeftmostRecord,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n item: DialogItem;\n isLeftmostRecord?: boolean;\n}) {\n const [isDisabled, setIsDisabled] = React.useState(!!item.isDisabled);\n const displayLabel = React.useMemo(() => {\n return item.property.displayLabel || item.property.name;\n }, [item]);\n\n // listen for tool sync property events and update the isDisabled state\n React.useEffect(() => {\n return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {\n const mySyncItem = args.properties.find(\n (syncItem) => syncItem.propertyName === item.property.name\n );\n if (mySyncItem) {\n setIsDisabled(!!mySyncItem.isDisabled);\n }\n });\n }, [uiDataProvider, item]);\n\n const className = classnames(\n \"uifw-default-label\",\n !!isLeftmostRecord && \"uifw-default-narrow-only-display\"\n );\n return (\n <Label\n className={className}\n htmlFor={item.property.name}\n disabled={isDisabled}\n >\n {displayLabel}:\n </Label>\n );\n}\n\nfunction PropertyEditor({\n uiDataProvider,\n initialItem,\n isLock = false,\n setFocus,\n onCancel,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n initialItem: BaseDialogItem;\n isLock?: boolean;\n setFocus?: boolean;\n onCancel?: () => void;\n}) {\n const getLatestRecordValue = React.useCallback(\n (initial: BaseDialogItem) => {\n let newRecord = UiLayoutDataProvider.getPropertyRecord(initial);\n\n const foundItem = isLock\n ? uiDataProvider.items.find(\n (item) => item.lockProperty?.property.name === initial.property.name\n )\n : uiDataProvider.items.find(\n (item) => item.property.name === initial.property.name\n );\n if (foundItem) {\n if (isLock) {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.lockProperty!.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.lockProperty!.isDisabled;\n } else {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.isDisabled;\n }\n }\n return newRecord;\n },\n [isLock, uiDataProvider.items]\n );\n\n const currentRecord = getLatestRecordValue(initialItem);\n const [propertyRecord, setPropertyRecord] = React.useState(currentRecord);\n\n // monitor tool for sync UI events\n React.useEffect(() => {\n return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === initialItem.property.name\n );\n if (mySyncItem) {\n const newPropertyValue = propertyRecord.copyWithNewValue(\n {\n value: mySyncItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n displayValue: mySyncItem.value.displayValue,\n },\n mySyncItem.property\n );\n\n if (mySyncItem.property) {\n if (mySyncItem.property.name === mySyncItem.propertyName) {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n } else {\n Logger.logError(\n \"PropertyEditor\",\n `Error trying to replace propertyName=${mySyncItem.propertyName} with property named ${mySyncItem.property.name}`\n );\n }\n } else {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n }\n }\n });\n }, [uiDataProvider, propertyRecord, initialItem.property.name]);\n\n React.useEffect(() => {\n return uiDataProvider.onItemsReloadedEvent.addListener(() => {\n const newItem = findDialogItem(\n uiDataProvider,\n initialItem.property.name,\n isLock\n );\n if (!newItem) return;\n setPropertyRecord(getLatestRecordValue(newItem));\n });\n }, [uiDataProvider, initialItem.property.name, getLatestRecordValue, isLock]);\n\n const className = React.useMemo(\n () => (isLock ? \"uifw-default-property-lock\" : \"uifw-default-editor\"),\n [isLock]\n );\n const handleCommit = React.useCallback(\n (commit: PropertyUpdatedArgs) => {\n // UiLayoutDataProvider supports only primitive property types\n assert(\n commit.newValue.valueFormat === PropertyValueFormat.Primitive &&\n commit.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n );\n const newPropertyValue = propertyRecord.copyWithNewValue(commit.newValue);\n const syncItem: DialogPropertySyncItem = {\n value: commit.newValue as DialogItemValue,\n propertyName: initialItem.property.name,\n isDisabled: newPropertyValue.isDisabled,\n };\n uiDataProvider.applyUiPropertyChange(syncItem);\n // Now have the uiDataProvider refetch the latest property values from the tool\n uiDataProvider.reloadDialogItems(true);\n },\n [initialItem.property.name, propertyRecord, uiDataProvider]\n );\n const handleCancel = () => {};\n\n return (\n <div key={initialItem.property.name} className={className}>\n <EditorContainer\n key={initialItem.property.name}\n propertyRecord={propertyRecord}\n setFocus={setFocus}\n onCommit={handleCommit}\n onCancel={onCancel ?? handleCancel}\n />\n </div>\n );\n}\n\n/** Utility methods to generate react ui from DialogRow specs\n * @internal\n */\nexport class ComponentGenerator {\n constructor(\n private _uiDataProvider: UiLayoutDataProvider,\n private _onCancel?: () => void\n ) {}\n\n public get uiDataProvider() {\n return this._uiDataProvider;\n }\n\n private getEditor(\n item: BaseDialogItem,\n isLock = false,\n setFocus = false\n ): React.ReactNode {\n return (\n <PropertyEditor\n key={item.property.name}\n uiDataProvider={this.uiDataProvider}\n initialItem={item}\n isLock={isLock}\n setFocus={setFocus}\n onCancel={this._onCancel}\n />\n );\n }\n\n private generateRowWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): React.ReactNode {\n if (1 === row.items.length) {\n return (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n );\n }\n\n return (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n );\n }\n\n private generateEntryWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (1 === row.items.length) {\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n ),\n };\n }\n\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n ),\n };\n }\n\n private getEditorLabel(\n item: DialogItem,\n isLeftmostRecord = false\n ): React.ReactNode {\n return (\n <EditorLabel\n uiDataProvider={this.uiDataProvider}\n item={item}\n isLeftmostRecord={isLeftmostRecord}\n />\n );\n }\n\n private getLeftLockAndLabel(\n rowItem: DialogItem,\n multiplePropertiesOnRow: boolean\n ): React.ReactNode {\n const record = UiLayoutDataProvider.getPropertyRecord(rowItem);\n const lockEditor = UiLayoutDataProvider.hasAssociatedLockProperty(rowItem)\n ? this.getEditor(rowItem.lockProperty!, true)\n : null;\n const label = UiLayoutDataProvider.editorWantsLabel(rowItem)\n ? this.getEditorLabel(rowItem)\n : null;\n const classNames = multiplePropertiesOnRow\n ? \"uifw-default-lock-and-label uifw-default-wide-only-display\"\n : \"uifw-default-lock-and-label\";\n return (\n <div key={`lock-${record.property.name}`} className={classNames}>\n {lockEditor}\n {label}\n </div>\n );\n }\n\n private getInlineLabelAndEditor(\n item: DialogItem,\n isLeftmostRecord: boolean\n ): React.ReactNode {\n const label = UiLayoutDataProvider.editorWantsLabel(item)\n ? this.getEditorLabel(item, isLeftmostRecord)\n : null;\n return (\n <div\n key={item.property.name}\n className=\"uifw-default-inline-label-and-editor\"\n >\n {label}\n {this.getEditor(item)}\n </div>\n );\n }\n\n private getRowWithMultipleEditors(row: DialogRow): React.ReactNode {\n return (\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item: DialogItem, index: number) =>\n this.getInlineLabelAndEditor(item, index === 0)\n )}\n </div>\n );\n }\n\n private getDivForRow(row: DialogRow): React.ReactNode {\n if (row.items.length === 1) return this.getEditor(row.items[0]);\n return this.getRowWithMultipleEditors(row);\n }\n\n public getRow(row: DialogRow, rowIndex: number): React.ReactNode {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateRowWithButtonGroupEditors(row, rowIndex);\n } else {\n return (\n <React.Fragment key={rowIndex}>\n {this.getLeftLockAndLabel(row.items[0], row.items.length > 1)}\n {this.getDivForRow(row)}\n </React.Fragment>\n );\n }\n }\n\n public getToolSettingsEntry(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateEntryWithButtonGroupEditors(row, rowIndex);\n } else {\n return {\n labelNode: this.getLeftLockAndLabel(row.items[0], row.items.length > 1),\n editorNode: this.getDivForRow(row),\n };\n }\n }\n\n /** ToolSettingsEntries are used by the tool settings bar. */\n public getToolSettingsEntries(): ToolSettingsEntry[] {\n return this.uiDataProvider.rows.map((row: DialogRow, index: number) =>\n this.getToolSettingsEntry(row, index)\n );\n }\n}\n\nfunction findDialogItem(\n uiDataProvider: UiLayoutDataProvider,\n propertyName: string,\n isLock: boolean\n) {\n const dialogItem = uiDataProvider.items.find((item) => {\n if (isLock) {\n return item.lockProperty?.property.name === propertyName;\n }\n return item.property.name === propertyName;\n });\n return isLock ? dialogItem?.lockProperty : dialogItem;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Utilities
|
|
3
|
+
*/
|
|
4
|
+
/** A helper function used to get the active viewport in conditional definitions.
|
|
5
|
+
* Uses the deprecated active content control APIs to get the active viewport or the selected view of the view manager as a fallback.
|
|
6
|
+
* @note Might need a better strategy for a use case where selected view fallback behavior is not desired (i.e. a map of active content id to a viewport).
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function getActiveViewport(): import("@itwin/core-frontend").ScreenViewport | undefined;
|
|
10
|
+
//# sourceMappingURL=getActiveViewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getActiveViewport.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/utils/getActiveViewport.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH;;;;GAIG;AACH,wBAAgB,iBAAiB,8DAMhC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Utilities
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getActiveViewport = void 0;
|
|
11
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
|
+
const UiFramework_1 = require("../UiFramework");
|
|
13
|
+
/** A helper function used to get the active viewport in conditional definitions.
|
|
14
|
+
* Uses the deprecated active content control APIs to get the active viewport or the selected view of the view manager as a fallback.
|
|
15
|
+
* @note Might need a better strategy for a use case where selected view fallback behavior is not desired (i.e. a map of active content id to a viewport).
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
function getActiveViewport() {
|
|
19
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
20
|
+
const activeContentControl = UiFramework_1.UiFramework.content.getActiveContentControl();
|
|
21
|
+
return activeContentControl
|
|
22
|
+
? activeContentControl.viewport
|
|
23
|
+
: core_frontend_1.IModelApp.viewManager.selectedView;
|
|
24
|
+
}
|
|
25
|
+
exports.getActiveViewport = getActiveViewport;
|
|
26
|
+
//# sourceMappingURL=getActiveViewport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getActiveViewport.js","sourceRoot":"","sources":["../../../../src/appui-react/utils/getActiveViewport.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wDAAiD;AACjD,gDAA6C;AAE7C;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,mDAAmD;IACnD,MAAM,oBAAoB,GAAG,yBAAW,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAC3E,OAAO,oBAAoB;QACzB,CAAC,CAAC,oBAAoB,CAAC,QAAQ;QAC/B,CAAC,CAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;AACzC,CAAC;AAND,8CAMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UiFramework } from \"../UiFramework\";\n\n/** A helper function used to get the active viewport in conditional definitions.\n * Uses the deprecated active content control APIs to get the active viewport or the selected view of the view manager as a fallback.\n * @note Might need a better strategy for a use case where selected view fallback behavior is not desired (i.e. a map of active content id to a viewport).\n * @internal\n */\nexport function getActiveViewport() {\n // eslint-disable-next-line deprecation/deprecation\n const activeContentControl = UiFramework.content.getActiveContentControl();\n return activeContentControl\n ? activeContentControl.viewport\n : IModelApp.viewManager.selectedView;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,QAAQ,EACnB,SAAS,GAAE,QAAmB,mBAoD/B"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Logger } from "@itwin/core-bentley";
|
|
6
|
+
import { UiFramework } from "../UiFramework";
|
|
5
7
|
/** Copies the CSS style sheets from source document into the target document.
|
|
6
8
|
* @internal
|
|
7
9
|
*/
|
|
@@ -16,12 +18,15 @@ export async function copyStyles(targetDoc, sourceDoc = document) {
|
|
|
16
18
|
if (clonedNode instanceof
|
|
17
19
|
(targetDoc.defaultView?.HTMLLinkElement ?? HTMLLinkElement) &&
|
|
18
20
|
clonedNode.href) {
|
|
19
|
-
promises.push(new Promise((resolve
|
|
21
|
+
promises.push(new Promise((resolve) => {
|
|
20
22
|
clonedNode.onload = () => {
|
|
21
23
|
resolve();
|
|
22
24
|
};
|
|
23
|
-
clonedNode.onerror = (
|
|
24
|
-
|
|
25
|
+
clonedNode.onerror = () => {
|
|
26
|
+
Logger.logError(UiFramework.loggerCategory(copyStyles), `Failed to load external resource`, {
|
|
27
|
+
href: clonedNode.href,
|
|
28
|
+
});
|
|
29
|
+
resolve();
|
|
25
30
|
};
|
|
26
31
|
}));
|
|
27
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyStyles.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"A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C,CAAC,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;IAC1E,kBAAkB,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACxC,uFAAuF;QACvF,IAAI,CAAC,SAAS,CAAC,WAAW;YAAE,OAAO;QACnC,MAAM,aAAa,GAAG,IAAI,SAAS,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAChE,QAAQ,CAAC,IAAI,CACX,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CACtE,CAAC;QACF,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,gBAAgB;IAChB,MAAM,eAAe,GAAG,SAAS,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;IACxE,IAAI,eAAe,EAAE,CAAC;QACpB,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,mBAAmB,CAAC,UAAyB;IACpD,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;SACnC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;SAC3B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"../UiFramework\";\n\n/** Copies the CSS style sheets from source document into the target document.\n * @internal\n */\nexport async function copyStyles(\n targetDoc: Document,\n sourceDoc: Document = document\n) {\n const promises: Array<Promise<void>> = [];\n const styleSheets = Array.from(sourceDoc.styleSheets);\n styleSheets.forEach(({ ownerNode }) => {\n // Copy `link` and `style` elements.\n if (!ownerNode) return;\n const clonedNode = targetDoc.importNode(ownerNode, true);\n if (\n clonedNode instanceof\n (targetDoc.defaultView?.HTMLLinkElement ?? HTMLLinkElement) &&\n clonedNode.href\n ) {\n promises.push(\n new Promise((resolve) => {\n clonedNode.onload = () => {\n resolve();\n };\n clonedNode.onerror = () => {\n Logger.logError(\n UiFramework.loggerCategory(copyStyles),\n `Failed to load external resource`,\n {\n href: clonedNode.href,\n }\n );\n resolve();\n };\n })\n );\n }\n targetDoc.head.appendChild(clonedNode);\n });\n\n const adoptedStyleSheets = Array.from(sourceDoc.adoptedStyleSheets ?? []);\n adoptedStyleSheets.forEach((styleSheet) => {\n // Adopted stylesheet have no ownerNode and can't be shared between multiple documents.\n if (!targetDoc.defaultView) return;\n const newStyleSheet = new targetDoc.defaultView.CSSStyleSheet();\n promises.push(\n newStyleSheet.replace(stringifyStyleSheet(styleSheet)).then(() => {})\n );\n targetDoc.adoptedStyleSheets.push(newStyleSheet);\n });\n\n // Copy sprites.\n const svgSymbolParent = sourceDoc.getElementById(\"__SVG_SPRITE_NODE__\");\n if (svgSymbolParent) {\n targetDoc.body.appendChild(svgSymbolParent.cloneNode(true));\n }\n\n return Promise.all(promises);\n}\n\nfunction stringifyStyleSheet(stylesheet: CSSStyleSheet) {\n return Array.from(stylesheet.cssRules)\n .map((rule) => rule.cssText)\n .join(\"\\n\");\n}\n"]}
|
|
@@ -101,7 +101,7 @@ export class ContentGroup {
|
|
|
101
101
|
else
|
|
102
102
|
throw new UiError(// eslint-disable-line deprecation/deprecation
|
|
103
103
|
UiFramework.loggerCategory(this), `toJSON: ContentControl at index ${index} is NOT registered with a string id`);
|
|
104
|
-
if (contentCallback)
|
|
104
|
+
if (typeof contentCallback === "function")
|
|
105
105
|
contentCallback(content);
|
|
106
106
|
}
|
|
107
107
|
});
|