@itwin/appui-react 4.16.2 → 4.16.4

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts +1 -1
  3. package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
  4. package/lib/cjs/appui-react/childwindow/CopyStyles.js +21 -5
  5. package/lib/cjs/appui-react/childwindow/CopyStyles.js.map +1 -1
  6. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts +1 -1
  7. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
  8. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +3 -3
  9. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  10. package/lib/cjs/appui-react/shared/MenuItem.d.ts +2 -2
  11. package/lib/cjs/appui-react/shared/MenuItem.d.ts.map +1 -1
  12. package/lib/cjs/appui-react/shared/MenuItem.js +4 -11
  13. package/lib/cjs/appui-react/shared/MenuItem.js.map +1 -1
  14. package/lib/esm/appui-react/childwindow/CopyStyles.d.ts +1 -1
  15. package/lib/esm/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
  16. package/lib/esm/appui-react/childwindow/CopyStyles.js +21 -5
  17. package/lib/esm/appui-react/childwindow/CopyStyles.js.map +1 -1
  18. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts +1 -1
  19. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
  20. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +3 -3
  21. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  22. package/lib/esm/appui-react/shared/MenuItem.d.ts +2 -2
  23. package/lib/esm/appui-react/shared/MenuItem.d.ts.map +1 -1
  24. package/lib/esm/appui-react/shared/MenuItem.js +4 -11
  25. package/lib/esm/appui-react/shared/MenuItem.js.map +1 -1
  26. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log - @itwin/appui-react
2
2
 
3
- This log was last generated on Wed, 28 Aug 2024 06:32:12 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 04 Sep 2024 08:10:19 GMT and should not be manually modified.
4
+
5
+ ## 4.16.4
6
+ Wed, 04 Sep 2024 08:10:19 GMT
7
+
8
+ ### Updates
9
+
10
+ - Fix link style load timing issue in window popups.
11
+
12
+ ## 4.16.3
13
+ Tue, 03 Sep 2024 14:32:22 GMT
14
+
15
+ ### Updates
16
+
17
+ - Render `MenuItem` without `item` or `submenu` props.
4
18
 
5
19
  ## 4.16.2
6
20
  Wed, 28 Aug 2024 06:32:12 GMT
@@ -1,5 +1,5 @@
1
1
  /** Copies the CSS style sheets from source document into the target document.
2
2
  * @internal
3
3
  */
4
- export declare function copyStyles(targetDoc: Document, sourceDoc?: Document): void;
4
+ export declare function copyStyles(targetDoc: Document, sourceDoc?: Document): Promise<void[]>;
5
5
  //# sourceMappingURL=CopyStyles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,QAAQ,EACnB,SAAS,GAAE,QAAmB,QA2B/B"}
1
+ {"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,QAAQ,EACnB,SAAS,GAAE,QAAmB,mBA6C/B"}
@@ -8,13 +8,26 @@ exports.copyStyles = void 0;
8
8
  /** Copies the CSS style sheets from source document into the target document.
9
9
  * @internal
10
10
  */
11
- function copyStyles(targetDoc, sourceDoc = document) {
11
+ async function copyStyles(targetDoc, sourceDoc = document) {
12
+ const promises = [];
12
13
  const styleSheets = Array.from(sourceDoc.styleSheets);
13
14
  styleSheets.forEach(({ ownerNode }) => {
14
15
  // Copy `link` and `style` elements.
15
16
  if (!ownerNode)
16
17
  return;
17
18
  const clonedNode = targetDoc.importNode(ownerNode, true);
19
+ if (clonedNode instanceof
20
+ (targetDoc.defaultView?.HTMLLinkElement ?? HTMLLinkElement) &&
21
+ clonedNode.href) {
22
+ promises.push(new Promise((resolve, reject) => {
23
+ clonedNode.onload = () => {
24
+ resolve();
25
+ };
26
+ clonedNode.onerror = (error) => {
27
+ reject(error);
28
+ };
29
+ }));
30
+ }
18
31
  targetDoc.head.appendChild(clonedNode);
19
32
  });
20
33
  const adoptedStyleSheets = Array.from(sourceDoc.adoptedStyleSheets ?? []);
@@ -23,10 +36,7 @@ function copyStyles(targetDoc, sourceDoc = document) {
23
36
  if (!targetDoc.defaultView)
24
37
  return;
25
38
  const newStyleSheet = new targetDoc.defaultView.CSSStyleSheet();
26
- Array.from(styleSheet.cssRules).forEach((rule, index) => {
27
- // `cssText` might not serialize complex shorthand properties correctly: https://github.com/iTwin/appui/issues/893
28
- newStyleSheet.insertRule(rule.cssText, index);
29
- });
39
+ promises.push(newStyleSheet.replace(stringifyStyleSheet(styleSheet)).then(() => { }));
30
40
  targetDoc.adoptedStyleSheets.push(newStyleSheet);
31
41
  });
32
42
  // Copy sprites.
@@ -34,6 +44,12 @@ function copyStyles(targetDoc, sourceDoc = document) {
34
44
  if (svgSymbolParent) {
35
45
  targetDoc.body.appendChild(svgSymbolParent.cloneNode(true));
36
46
  }
47
+ return Promise.all(promises);
37
48
  }
38
49
  exports.copyStyles = copyStyles;
50
+ function stringifyStyleSheet(stylesheet) {
51
+ return Array.from(stylesheet.cssRules)
52
+ .map((rule) => rule.cssText)
53
+ .join("\n");
54
+ }
39
55
  //# sourceMappingURL=CopyStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyStyles.js","sourceRoot":"","sources":["../../../../src/appui-react/child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AC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AA7BD,gCA6BC","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\n/** Copies the CSS style sheets from source document into the target document.\n * @internal\n */\nexport function copyStyles(\n targetDoc: Document,\n sourceDoc: Document = document\n) {\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 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 Array.from(styleSheet.cssRules).forEach((rule, index) => {\n // `cssText` might not serialize complex shorthand properties correctly: https://github.com/iTwin/appui/issues/893\n newStyleSheet.insertRule(rule.cssText, index);\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"]}
1
+ {"version":3,"file":"CopyStyles.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;GAEG;AACI,KAAK,UAAU,UAAU,CAC9B,SAAmB,EACnB,YAAsB,QAAQ;IAE9B,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACtD,W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,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;AA/CD,gCA+CC;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 *--------------------------------------------------------------------------------------------*/\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, reject) => {\n clonedNode.onload = () => {\n resolve();\n };\n clonedNode.onerror = (error) => {\n reject(error);\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"]}
@@ -1,9 +1,9 @@
1
1
  /** @packageDocumentation
2
2
  * @module ChildWindowManager
3
3
  */
4
+ import "./InternalChildWindowManager.scss";
4
5
  import * as React from "react";
5
6
  import type { ChildWindowLocationProps, FrameworkChildWindows, OpenChildWindowInfo } from "../framework/FrameworkChildWindows";
6
- import "./InternalChildWindowManager.scss";
7
7
  /**
8
8
  * Simplification of non exported CreateRoot parameter, only to be used
9
9
  * in InternalChildWindowManager and ChildWindowManager
@@ -1 +1 @@
1
- {"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAO5C,OAAO,mCAAmC,CAAC;AA2B3C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,MAAM,CAAwC;IAEtD,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IACI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAqBd;;;;OAIG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,mBAAmB,GAAG,SAAS;IAQlC;;;;OAIG;IACI,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAS3E,OAAO,CAAC,yBAAyB;IAmFjC,gGAAgG;IACzF,QAAQ;IAOf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,2CAkBnC;IAEF,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;OAQG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,CAAC,EAAE,OAAO;CA2DhC"}
1
+ {"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAiC5C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,MAAM,CAAwC;IAEtD,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IACI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAqBd;;;;OAIG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,mBAAmB,GAAG,SAAS;IAQlC;;;;OAIG;IACI,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAS3E,OAAO,CAAC,yBAAyB;IAmFjC,gGAAgG;IACzF,QAAQ;IAOf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,2CAkBnC;IAEF,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;OAQG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,CAAC,EAAE,OAAO;CA2DhC"}
@@ -8,6 +8,7 @@ exports.InternalChildWindowManager = void 0;
8
8
  /** @packageDocumentation
9
9
  * @module ChildWindowManager
10
10
  */
11
+ require("./InternalChildWindowManager.scss");
11
12
  const React = require("react");
12
13
  const ReactDOM = require("react-dom");
13
14
  const react_redux_1 = require("react-redux");
@@ -20,7 +21,6 @@ const PopupManager_1 = require("../popup/PopupManager");
20
21
  const ThemeManager_1 = require("../theme/ThemeManager");
21
22
  const useUiStateStorage_1 = require("../uistate/useUiStateStorage");
22
23
  const CopyStyles_1 = require("./CopyStyles");
23
- require("./InternalChildWindowManager.scss");
24
24
  const usePopoutsStore_1 = require("../preview/reparent-popout-widgets/usePopoutsStore");
25
25
  const childHtml = `<!DOCTYPE html>
26
26
  <html>
@@ -160,8 +160,8 @@ class InternalChildWindowManager {
160
160
  React.createElement(CursorMenu_1.CursorPopupMenu, null),
161
161
  React.createElement("div", { className: "uifw-child-window-container nz-widget-widget" }, content)),
162
162
  React.createElement("div", { className: "uifw-childwindow-internalChildWindowManager_portalContainer" }))))));
163
- setTimeout(() => {
164
- (0, CopyStyles_1.copyStyles)(childWindow.document);
163
+ setTimeout(async () => {
164
+ await (0, CopyStyles_1.copyStyles)(childWindow.document);
165
165
  setTimeout(() => {
166
166
  this.render(element, reactConnectionDiv);
167
167
  if (childWindow.expectedHeight && childWindow.expectedWidth) {
@@ -1 +1 @@
1
- {"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;GAEG;AAEH,+BAA+B;AAC/B,sCAAsC;AACtC,6CAAuC;AACvC,gDAA6C;AAC7C,gEAAkE;AAClE,qEAAmE;AACnE,2EAAyE;AAMzE,sEAAgE;AAChE,wDAAsD;AACtD,wDAAqD;AACrD,oEAAqE;AAErE,6CAA0C;AAC1C,6CAA2C;AAC3C,wFAAqF;AAGrF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;QAqBV,CAAC;AAST;;;;KAIK;AACL,MAAa,0BAA0B;IAAvC;QACU,sBAAiB,GAA0B,EAAE,CAAC;QAE9C,WAAM,GAAqC,EAAE,CAAC;QAqKtD;;;;;WAKG;QACI,UAAK,GAAG,CAAC,aAAqB,EAAE,kBAAkB,GAAG,IAAI,EAAE,EAAE;YAClE,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CACjD,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,KAAK,aAAa,CAC3D,CAAC;YACF,IAAI,WAAW,KAAK,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;YACrC,MAAM,EAAE,mBAAmB,EAAE,GAAG,iCAAe,CAAC,QAAQ,EAAE,CAAC;YAC3D,mBAAmB,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;YAE5D,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACvD,I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ArRD,gEAqRC","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Provider } from \"react-redux\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\nimport { TabIdContext } from \"../layout/widget/ContentRenderer\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport type { ChildWindow } from \"./ChildWindowConfig\";\nimport { copyStyles } from \"./CopyStyles\";\nimport \"./InternalChildWindowManager.scss\";\nimport { usePopoutsStore } from \"../preview/reparent-popout-widgets/usePopoutsStore\";\nimport type { WidgetDef } from \"../widgets/WidgetDef\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n private _roots: { [childwindowId: string]: any } = {};\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React 18, the `createRoot` function must be provided in order to render Popout content with React 18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to React 18 is complete.\n */\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n // If createRoot is passed in for React 18 we have to render differently\n // than without it. React 17 vs React 18. We need to save the root to\n // unmount it.\n if (this._createRoot) {\n const childWindowId = UiFramework.childWindows.findId(\n container.ownerDocument.defaultView\n );\n if (childWindowId) {\n this._roots[childWindowId] = this._createRoot(container);\n this._roots[childWindowId].render(element);\n }\n } else {\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n private renderChildWindowContents(\n childWindow: ChildWindow,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv && content && React.isValidElement(content)) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n const widgetDef = content.props.widgetDef as WidgetDef | undefined;\n const tabId = widgetDef?.id;\n const element = (\n // eslint-disable-next-line deprecation/deprecation\n <Provider store={UiFramework.store}>\n <TabIdContext.Provider value={tabId}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n <div className=\"uifw-childwindow-internalChildWindowManager_portalContainer\" />\n </ThemeManager>\n </UiStateStorageHandler>\n </TabIdContext.Provider>\n </Provider>\n );\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(element, reactConnectionDiv);\n\n if (childWindow.expectedHeight && childWindow.expectedWidth) {\n childWindow.deltaWidth =\n childWindow.expectedWidth - childWindow.innerWidth;\n childWindow.deltaHeight =\n childWindow.expectedHeight - childWindow.innerHeight;\n }\n\n if (childWindow.expectedLeft && childWindow.expectedTop) {\n childWindow.deltaLeft =\n childWindow.expectedLeft - childWindow.screenLeft;\n childWindow.deltaTop =\n childWindow.expectedTop - childWindow.screenTop;\n }\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n\n // Trigger first so popout can be converted back to main window widget\n this.close(childWindowId, false);\n\n // UnmountComponentAtNode is deprecated in React 18, so if they are\n // using React 18 and passing in a createRoot function, unmount()\n // will be used\n if (this._roots[childWindowId]) {\n this._roots[childWindowId].unmount();\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n } else ReactDOM.unmountComponentAtNode(reactConnectionDiv);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close.\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true).\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (windowIndex === -1) return false;\n const { onClosePopoutWidget } = usePopoutsStore.getState();\n onClosePopoutWidget.raiseEvent({ windowId: childWindowId });\n\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef?.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n private adjustWindowLocation(location: ChildWindowLocationProps) {\n // If no location is provided, child window will open in the center of the current window.\n if (location.top === 0 && location.left === 0) {\n location.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n location.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n if (\n this.openChildWindows.some(\n (openWindow) => openWindow.childWindowId === childWindowId\n )\n ) {\n return false;\n }\n\n this.adjustWindowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow: ChildWindow | null = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n childWindow.expectedHeight = location.height;\n childWindow.expectedWidth = location.width;\n childWindow.expectedLeft = location.left;\n childWindow.expectedTop = location.top;\n\n if (url.length === 0) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"DOMContentLoaded\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;GAEG;AAEH,6CAA2C;AAC3C,+BAA+B;AAC/B,sCAAsC;AACtC,6CAAuC;AACvC,gDAA6C;AAC7C,gEAAkE;AAClE,qEAAmE;AACnE,2EAAyE;AAMzE,sEAAgE;AAChE,wDAAsD;AACtD,wDAAqD;AACrD,oEAAqE;AAErE,6CAA0C;AAC1C,wFAAqF;AAGrF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;QAqBV,CAAC;AAST;;;;KAIK;AACL,MAAa,0BAA0B;IAAvC;QACU,sBAAiB,GAA0B,EAAE,CAAC;QAE9C,WAAM,GAAqC,EAAE,CAAC;QAqKtD;;;;;WAKG;QACI,UAAK,GAAG,CAAC,aAAqB,EAAE,kBAAkB,GAAG,IAAI,EAAE,EAAE;YAClE,MAAM,WAAW,GAAG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CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC,EACD,KAAK,CACN,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,yBAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArRD,gEAqRC","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport \"./InternalChildWindowManager.scss\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Provider } from \"react-redux\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\nimport { TabIdContext } from \"../layout/widget/ContentRenderer\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport type { ChildWindow } from \"./ChildWindowConfig\";\nimport { copyStyles } from \"./CopyStyles\";\nimport { usePopoutsStore } from \"../preview/reparent-popout-widgets/usePopoutsStore\";\nimport type { WidgetDef } from \"../widgets/WidgetDef\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n private _roots: { [childwindowId: string]: any } = {};\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React 18, the `createRoot` function must be provided in order to render Popout content with React 18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to React 18 is complete.\n */\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n // If createRoot is passed in for React 18 we have to render differently\n // than without it. React 17 vs React 18. We need to save the root to\n // unmount it.\n if (this._createRoot) {\n const childWindowId = UiFramework.childWindows.findId(\n container.ownerDocument.defaultView\n );\n if (childWindowId) {\n this._roots[childWindowId] = this._createRoot(container);\n this._roots[childWindowId].render(element);\n }\n } else {\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n private renderChildWindowContents(\n childWindow: ChildWindow,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv && content && React.isValidElement(content)) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n const widgetDef = content.props.widgetDef as WidgetDef | undefined;\n const tabId = widgetDef?.id;\n const element = (\n // eslint-disable-next-line deprecation/deprecation\n <Provider store={UiFramework.store}>\n <TabIdContext.Provider value={tabId}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n <div className=\"uifw-childwindow-internalChildWindowManager_portalContainer\" />\n </ThemeManager>\n </UiStateStorageHandler>\n </TabIdContext.Provider>\n </Provider>\n );\n\n setTimeout(async () => {\n await copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(element, reactConnectionDiv);\n\n if (childWindow.expectedHeight && childWindow.expectedWidth) {\n childWindow.deltaWidth =\n childWindow.expectedWidth - childWindow.innerWidth;\n childWindow.deltaHeight =\n childWindow.expectedHeight - childWindow.innerHeight;\n }\n\n if (childWindow.expectedLeft && childWindow.expectedTop) {\n childWindow.deltaLeft =\n childWindow.expectedLeft - childWindow.screenLeft;\n childWindow.deltaTop =\n childWindow.expectedTop - childWindow.screenTop;\n }\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n\n // Trigger first so popout can be converted back to main window widget\n this.close(childWindowId, false);\n\n // UnmountComponentAtNode is deprecated in React 18, so if they are\n // using React 18 and passing in a createRoot function, unmount()\n // will be used\n if (this._roots[childWindowId]) {\n this._roots[childWindowId].unmount();\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n } else ReactDOM.unmountComponentAtNode(reactConnectionDiv);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close.\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true).\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (windowIndex === -1) return false;\n const { onClosePopoutWidget } = usePopoutsStore.getState();\n onClosePopoutWidget.raiseEvent({ windowId: childWindowId });\n\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef?.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n private adjustWindowLocation(location: ChildWindowLocationProps) {\n // If no location is provided, child window will open in the center of the current window.\n if (location.top === 0 && location.left === 0) {\n location.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n location.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n if (\n this.openChildWindows.some(\n (openWindow) => openWindow.childWindowId === childWindowId\n )\n ) {\n return false;\n }\n\n this.adjustWindowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow: ChildWindow | null = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n childWindow.expectedHeight = location.height;\n childWindow.expectedWidth = location.width;\n childWindow.expectedLeft = location.left;\n childWindow.expectedTop = location.top;\n\n if (url.length === 0) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"DOMContentLoaded\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
@@ -21,13 +21,13 @@ export interface CursorMenuItemProps extends CommonProps {
21
21
  * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.
22
22
  */
23
23
  iconSpec?: IconSpec;
24
- /** The item to execute when this item is invoked. Either 'item' or 'submenu' must be specified.
24
+ /** The item to execute when this item is invoked. Either 'item', 'submenu' or `execute` must be specified.
25
25
  * @deprecated in 4.15.0. Use properties of this object instead.
26
26
  */
27
27
  item?: CommandItemProps;
28
28
  /** Function to execute. */
29
29
  execute?: () => any;
30
- /** Nested array of item props. Either 'item' or 'submenu' must be specified. */
30
+ /** Nested array of item props. Either 'item', 'submenu' or 'execute' must be specified. */
31
31
  submenu?: CursorMenuItemProps[];
32
32
  /** Icon to display on right side of the menu item.
33
33
  * Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id.
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/shared/MenuItem.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAW,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;GAEG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,uBAAuB;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IAEH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IAEH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,GAA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M,aAAa,GAAG,qBAAqB,CAAC;AAElD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACvC,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,WAAW,CAAC,CAAsB;IAC1C,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,YAAY,CAAC,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,CAAa;IAE9B,uIAAuI;gBAC3H,KAAK,EAAE,mBAAmB,EAAE,WAAW,CAAC,EAAE,MAAM,IAAI;IAkChE,IAAW,EAAE,IAAI,MAAM,CAEtB;IAED,IAAW,OAAO,IAAI,QAAQ,EAAE,CAE/B;IAED,IAAW,UAAU,IAAI,mBAAmB,GAAG,SAAS,CAEvD;IAEM,aAAa,CAAC,EAAE,QAAQ,CAAC;IAEzB,UAAU,IAAI,IAAI;CAQ1B;AAED;;;GAGG;AACH,qBAAa,eAAe;WACZ,eAAe,CAC3B,aAAa,EAAE,mBAAmB,EAAE,EACpC,WAAW,CAAC,EAAE,MAAM,IAAI,GACvB,QAAQ,EAAE;WAQC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE;IAW1E,OAAO,CAAC,MAAM,CAAC,kBAAkB;CA4ClC"}
@@ -98,24 +98,17 @@ class MenuItemHelpers {
98
98
  return itemNodes;
99
99
  }
100
100
  static createMenuItemNode(item, index) {
101
- let node = null;
102
101
  const label = item.label;
103
102
  const iconSpec = item.iconSpec;
104
103
  const iconRightSpec = item.iconRightSpec;
105
104
  const badgeType = item.badgeType;
106
105
  const badgeKind = item.badgeKind;
107
106
  const isDisabled = appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled);
108
- if (item.actionItem) {
109
- const sel = () => item.itemPicked();
110
- node = (React.createElement(core_react_1.ContextMenuItem, { key: index, onSelect: sel, icon: iconSpec, iconRight: iconRightSpec, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, label));
107
+ if (item.submenu && item.submenu.length > 0) {
108
+ const items = this.createMenuItemNodes(item.submenu);
109
+ return (React.createElement(core_react_1.ContextSubMenu, { key: index, icon: iconSpec, label: label, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, items));
111
110
  }
112
- else {
113
- if (item.submenu && item.submenu.length > 0) {
114
- const items = this.createMenuItemNodes(item.submenu);
115
- node = (React.createElement(core_react_1.ContextSubMenu, { key: index, icon: iconSpec, label: label, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, items));
116
- }
117
- }
118
- return node;
111
+ return (React.createElement(core_react_1.ContextMenuItem, { key: index, onSelect: () => item.itemPicked(), icon: iconSpec, iconRight: iconRightSpec, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, label));
119
112
  }
120
113
  }
121
114
  exports.MenuItemHelpers = MenuItemHelpers;
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../../src/appui-react/shared/MenuItem.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAK/B,0DAAyE;AAOzE,kDAAoE;AACpE,gDAA6C;AAE7C,qDAAkD;AAClD,+CAA4C;AAkF5C;;;GAGG;AACH,MAAa,QAAS,SAAQ,yBAAW;IAOvC,uIAAuI;IACvI,YAAY,KAA0B,EAAE,WAAwB;QAC9D,KAAK,CAAC,KAAK,CAAC,CAAC;QARP,QAAG,GAAG,EAAE,CAAC;QAUf,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,KAAK,EAAY,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAEhC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,GAAG,IAAI,+BAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAElD,kDAAkD;YAClD,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAAE,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,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,MAAM,UAAU,GAAY,wCAAuB,CAAC,QAAQ,CAC1D,IAAI,CAAC,UAAU,CAChB,CAAC;QAEF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACpC,IAAI,GAAG,CACL,oBAAC,4BAAe,IACd,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,GAAG,EACb,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACU,CACnB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAErD,IAAI,GAAG,CACL,oBAAC,2BAAc,IACb,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACS,CAClB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzED,0CAyEC","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 Item\n */\n\nimport * as React from \"react\";\nimport type {\n AbstractMenuItemProps,\n StringGetter,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue, UiError } from \"@itwin/appui-abstract\";\nimport type {\n BadgeKind,\n BadgeType,\n CommonProps,\n IconSpec,\n} from \"@itwin/core-react\";\nimport { ContextMenuItem, ContextSubMenu } from \"@itwin/core-react\";\nimport { UiFramework } from \"../UiFramework\";\nimport type { ActionButtonItemDef } from \"./ActionButtonItemDef\";\nimport { CommandItemDef } from \"./CommandItemDef\";\nimport { ItemDefBase } from \"./ItemDefBase\";\nimport type { CommandItemProps } from \"./ItemProps\";\nimport type { ConditionalStringValue } from \"./ConditionalValue\";\n\n/** Properties for context menu items.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface CursorMenuItemProps extends CommonProps {\n /** The id for the menu item. */\n id: string;\n /** Icon to display. */\n iconNode?: React.ReactNode;\n /** Icon to display.\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n iconSpec?: IconSpec;\n /** The item to execute when this item is invoked. Either 'item' or 'submenu' must be specified.\n * @deprecated in 4.15.0. Use properties of this object instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n item?: CommandItemProps;\n /** Function to execute. */\n execute?: () => any;\n /** Nested array of item props. Either 'item' or 'submenu' must be specified. */\n submenu?: CursorMenuItemProps[];\n /** Icon to display on right side of the menu item.\n * Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n */\n iconRight?: string | ConditionalStringValue;\n\n // #region \"ItemProps\" properties previously extended from deprecated type.\n\n /** if true component will be hidden - defaults to false */\n isHidden?: boolean | ConditionalBooleanValue;\n /** if true component will be disabled - defaults to false */\n isDisabled?: boolean | ConditionalBooleanValue;\n /** if set, component will be considered \"active\" an will display an \"active stripe\" - defaults to false */\n isActive?: boolean;\n /** if set, component will be considered selected but will NOT display an \"active stripe\" - defaults to false. Typically used by buttons that toggle between two states. */\n isPressed?: boolean;\n /** can be used by application to store miscellaneous data. */\n applicationData?: any;\n /** Badge to be overlaid on the item.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n badgeType?: BadgeType;\n /** Specifies the kind of badge, if any, to be overlaid on the item. */\n badgeKind?: BadgeKind;\n /** Abstract icon definition. Used when creating itemDef from abstract item (ie. MenuItem).\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n icon?: IconSpec;\n\n /** if set, it is used to explicitly set the label shown by a component. */\n label?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n labelKey?: string;\n\n /** if set, it is used to explicitly set the description shown by a component. */\n description?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if description is not explicitly set. */\n descriptionKey?: string;\n /** used to explicitly set the tooltip shown by a component. */\n tooltip?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n tooltipKey?: string;\n\n // #endregion \"ItemProps\"\n}\n\n/* eslint-disable deprecation/deprecation */\n\n/** Menu Item Properties\n * @public\n * @deprecated in 4.11.0. Please use {@link CursorMenuItemProps}.\n */\nexport type MenuItemProps = AbstractMenuItemProps;\n\n/** Menu Item\n * @alpha\n * @deprecated in 4.15.0. Used in a deprecated class {@link MenuItemHelpers}.\n */\nexport class MenuItem extends ItemDefBase {\n private _id = \"\";\n private _actionItem?: ActionButtonItemDef;\n private _submenu: MenuItem[];\n private _onSelection?: () => void;\n private _execute?: () => void;\n\n /** onSelection is an optional parameter typically supplied to allow menu parent to close context menu when a menu item is selected. */\n constructor(props: CursorMenuItemProps, onSelection?: () => void) {\n super(props);\n\n this._id = props.id;\n this._submenu = new Array<MenuItem>();\n this._onSelection = onSelection;\n\n if (props.item) {\n this._actionItem = new CommandItemDef(props.item);\n\n // Copy over icon, label & badgeType from the item\n if (!this.iconSpec) this.iconSpec = this._actionItem.iconSpec;\n if (!this.label) this.setLabel(this._actionItem.label);\n if (!this.badgeType) this.badgeType = this._actionItem.badgeType;\n if (!this.badgeKind) this.badgeKind = this._actionItem.badgeKind;\n if (!this.isDisabled) this.isDisabled = this._actionItem.isDisabled;\n } else if (props.execute) {\n this._execute = props.execute;\n } else if (props.submenu) {\n props.submenu.forEach((childProps: CursorMenuItemProps) => {\n const childItem = new MenuItem(childProps, onSelection);\n this._submenu.push(childItem);\n });\n } else {\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiFramework.loggerCategory(this),\n `Either 'item', 'execute' or 'submenu' must be specified for '${props.id}'.`\n );\n }\n\n this.iconRightSpec = props.iconRight;\n }\n\n public get id(): string {\n return this._id;\n }\n\n public get submenu(): MenuItem[] {\n return this._submenu;\n }\n\n public get actionItem(): ActionButtonItemDef | undefined {\n return this._actionItem;\n }\n\n public iconRightSpec?: IconSpec;\n\n public itemPicked(): void {\n setTimeout(() => {\n if (this._actionItem) this._actionItem.execute();\n else if (this._execute) this._execute();\n });\n\n if (this._onSelection) this._onSelection();\n }\n}\n\n/** Menu Item helper methods\n * @alpha\n * @deprecated in 4.15.0. Use {@link @itwin/core-react#ContextMenuItem} and {@link @itwin/core-react#ContextSubMenu} components.\n */\nexport class MenuItemHelpers {\n public static createMenuItems(\n itemPropsList: CursorMenuItemProps[],\n onSelection?: () => void\n ): MenuItem[] {\n const menuItems = new Array<MenuItem>();\n itemPropsList.forEach((itemProps: CursorMenuItemProps) => {\n menuItems.push(new MenuItem(itemProps, onSelection));\n });\n return menuItems;\n }\n\n public static createMenuItemNodes(itemList: MenuItem[]): React.ReactNode[] {\n const itemNodes: React.ReactNode[] = [];\n\n itemList.forEach((item: MenuItem, index: number) => {\n const reactItem = this.createMenuItemNode(item, index);\n if (reactItem) itemNodes.push(reactItem);\n });\n\n return itemNodes;\n }\n\n private static createMenuItemNode(\n item: MenuItem,\n index: number\n ): React.ReactNode {\n let node: React.ReactNode = null;\n const label = item.label;\n const iconSpec = item.iconSpec;\n const iconRightSpec = item.iconRightSpec;\n const badgeType = item.badgeType;\n const badgeKind = item.badgeKind;\n const isDisabled: boolean = ConditionalBooleanValue.getValue(\n item.isDisabled\n );\n\n if (item.actionItem) {\n const sel = () => item.itemPicked();\n node = (\n <ContextMenuItem\n key={index}\n onSelect={sel}\n icon={iconSpec}\n iconRight={iconRightSpec}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {label}\n </ContextMenuItem>\n );\n } else {\n if (item.submenu && item.submenu.length > 0) {\n const items = this.createMenuItemNodes(item.submenu);\n\n node = (\n <ContextSubMenu\n key={index}\n icon={iconSpec}\n label={label}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {items}\n </ContextSubMenu>\n );\n }\n }\n\n return node;\n }\n}\n"]}
1
+ {"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../../src/appui-react/shared/MenuItem.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAK/B,0DAAyE;AAOzE,kDAAoE;AACpE,gDAA6C;AAE7C,qDAAkD;AAClD,+CAA4C;AAkF5C;;;GAGG;AACH,MAAa,QAAS,SAAQ,yBAAW;IAOvC,uIAAuI;IACvI,YAAY,KAA0B,EAAE,WAAwB;QAC9D,KAAK,CAAC,KAAK,CAAC,CAAC;QARP,QAAG,GAAG,EAAE,CAAC;QAUf,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,KAAK,EAAY,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAEhC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,GAAG,IAAI,+BAAc,CAAC,KAAK,CAAC,IAAI,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AK,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,MAAM,UAAU,GAAY,wCAAuB,CAAC,QAAQ,CAC1D,IAAI,CAAC,UAAU,CAChB,CAAC;QAEF,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAErD,OAAO,CACL,oBAAC,2BAAc,IACb,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACS,CAClB,CAAC;QACJ,CAAC;QAED,OAAO,CACL,oBAAC,4BAAe,IACd,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,EACjC,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACU,CACnB,CAAC;IACJ,CAAC;CACF;AAnED,0CAmEC","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 Item\n */\n\nimport * as React from \"react\";\nimport type {\n AbstractMenuItemProps,\n StringGetter,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue, UiError } from \"@itwin/appui-abstract\";\nimport type {\n BadgeKind,\n BadgeType,\n CommonProps,\n IconSpec,\n} from \"@itwin/core-react\";\nimport { ContextMenuItem, ContextSubMenu } from \"@itwin/core-react\";\nimport { UiFramework } from \"../UiFramework\";\nimport type { ActionButtonItemDef } from \"./ActionButtonItemDef\";\nimport { CommandItemDef } from \"./CommandItemDef\";\nimport { ItemDefBase } from \"./ItemDefBase\";\nimport type { CommandItemProps } from \"./ItemProps\";\nimport type { ConditionalStringValue } from \"./ConditionalValue\";\n\n/** Properties for context menu items.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface CursorMenuItemProps extends CommonProps {\n /** The id for the menu item. */\n id: string;\n /** Icon to display. */\n iconNode?: React.ReactNode;\n /** Icon to display.\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n iconSpec?: IconSpec;\n /** The item to execute when this item is invoked. Either 'item', 'submenu' or `execute` must be specified.\n * @deprecated in 4.15.0. Use properties of this object instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n item?: CommandItemProps;\n /** Function to execute. */\n execute?: () => any;\n /** Nested array of item props. Either 'item', 'submenu' or 'execute' must be specified. */\n submenu?: CursorMenuItemProps[];\n /** Icon to display on right side of the menu item.\n * Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n */\n iconRight?: string | ConditionalStringValue;\n\n // #region \"ItemProps\" properties previously extended from deprecated type.\n\n /** if true component will be hidden - defaults to false */\n isHidden?: boolean | ConditionalBooleanValue;\n /** if true component will be disabled - defaults to false */\n isDisabled?: boolean | ConditionalBooleanValue;\n /** if set, component will be considered \"active\" an will display an \"active stripe\" - defaults to false */\n isActive?: boolean;\n /** if set, component will be considered selected but will NOT display an \"active stripe\" - defaults to false. Typically used by buttons that toggle between two states. */\n isPressed?: boolean;\n /** can be used by application to store miscellaneous data. */\n applicationData?: any;\n /** Badge to be overlaid on the item.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n badgeType?: BadgeType;\n /** Specifies the kind of badge, if any, to be overlaid on the item. */\n badgeKind?: BadgeKind;\n /** Abstract icon definition. Used when creating itemDef from abstract item (ie. MenuItem).\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n icon?: IconSpec;\n\n /** if set, it is used to explicitly set the label shown by a component. */\n label?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n labelKey?: string;\n\n /** if set, it is used to explicitly set the description shown by a component. */\n description?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if description is not explicitly set. */\n descriptionKey?: string;\n /** used to explicitly set the tooltip shown by a component. */\n tooltip?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n tooltipKey?: string;\n\n // #endregion \"ItemProps\"\n}\n\n/* eslint-disable deprecation/deprecation */\n\n/** Menu Item Properties\n * @public\n * @deprecated in 4.11.0. Please use {@link CursorMenuItemProps}.\n */\nexport type MenuItemProps = AbstractMenuItemProps;\n\n/** Menu Item\n * @alpha\n * @deprecated in 4.15.0. Used in a deprecated class {@link MenuItemHelpers}.\n */\nexport class MenuItem extends ItemDefBase {\n private _id = \"\";\n private _actionItem?: ActionButtonItemDef;\n private _submenu: MenuItem[];\n private _onSelection?: () => void;\n private _execute?: () => void;\n\n /** onSelection is an optional parameter typically supplied to allow menu parent to close context menu when a menu item is selected. */\n constructor(props: CursorMenuItemProps, onSelection?: () => void) {\n super(props);\n\n this._id = props.id;\n this._submenu = new Array<MenuItem>();\n this._onSelection = onSelection;\n\n if (props.item) {\n this._actionItem = new CommandItemDef(props.item);\n\n // Copy over icon, label & badgeType from the item\n if (!this.iconSpec) this.iconSpec = this._actionItem.iconSpec;\n if (!this.label) this.setLabel(this._actionItem.label);\n if (!this.badgeType) this.badgeType = this._actionItem.badgeType;\n if (!this.badgeKind) this.badgeKind = this._actionItem.badgeKind;\n if (!this.isDisabled) this.isDisabled = this._actionItem.isDisabled;\n } else if (props.execute) {\n this._execute = props.execute;\n } else if (props.submenu) {\n props.submenu.forEach((childProps: CursorMenuItemProps) => {\n const childItem = new MenuItem(childProps, onSelection);\n this._submenu.push(childItem);\n });\n } else {\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiFramework.loggerCategory(this),\n `Either 'item', 'execute' or 'submenu' must be specified for '${props.id}'.`\n );\n }\n\n this.iconRightSpec = props.iconRight;\n }\n\n public get id(): string {\n return this._id;\n }\n\n public get submenu(): MenuItem[] {\n return this._submenu;\n }\n\n public get actionItem(): ActionButtonItemDef | undefined {\n return this._actionItem;\n }\n\n public iconRightSpec?: IconSpec;\n\n public itemPicked(): void {\n setTimeout(() => {\n if (this._actionItem) this._actionItem.execute();\n else if (this._execute) this._execute();\n });\n\n if (this._onSelection) this._onSelection();\n }\n}\n\n/** Menu Item helper methods\n * @alpha\n * @deprecated in 4.15.0. Use {@link @itwin/core-react#ContextMenuItem} and {@link @itwin/core-react#ContextSubMenu} components.\n */\nexport class MenuItemHelpers {\n public static createMenuItems(\n itemPropsList: CursorMenuItemProps[],\n onSelection?: () => void\n ): MenuItem[] {\n const menuItems = new Array<MenuItem>();\n itemPropsList.forEach((itemProps: CursorMenuItemProps) => {\n menuItems.push(new MenuItem(itemProps, onSelection));\n });\n return menuItems;\n }\n\n public static createMenuItemNodes(itemList: MenuItem[]): React.ReactNode[] {\n const itemNodes: React.ReactNode[] = [];\n\n itemList.forEach((item: MenuItem, index: number) => {\n const reactItem = this.createMenuItemNode(item, index);\n if (reactItem) itemNodes.push(reactItem);\n });\n\n return itemNodes;\n }\n\n private static createMenuItemNode(\n item: MenuItem,\n index: number\n ): React.ReactNode {\n const label = item.label;\n const iconSpec = item.iconSpec;\n const iconRightSpec = item.iconRightSpec;\n const badgeType = item.badgeType;\n const badgeKind = item.badgeKind;\n const isDisabled: boolean = ConditionalBooleanValue.getValue(\n item.isDisabled\n );\n\n if (item.submenu && item.submenu.length > 0) {\n const items = this.createMenuItemNodes(item.submenu);\n\n return (\n <ContextSubMenu\n key={index}\n icon={iconSpec}\n label={label}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {items}\n </ContextSubMenu>\n );\n }\n\n return (\n <ContextMenuItem\n key={index}\n onSelect={() => item.itemPicked()}\n icon={iconSpec}\n iconRight={iconRightSpec}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {label}\n </ContextMenuItem>\n );\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /** Copies the CSS style sheets from source document into the target document.
2
2
  * @internal
3
3
  */
4
- export declare function copyStyles(targetDoc: Document, sourceDoc?: Document): void;
4
+ export declare function copyStyles(targetDoc: Document, sourceDoc?: Document): Promise<void[]>;
5
5
  //# sourceMappingURL=CopyStyles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,QAAQ,EACnB,SAAS,GAAE,QAAmB,QA2B/B"}
1
+ {"version":3,"file":"CopyStyles.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,QAAQ,EACnB,SAAS,GAAE,QAAmB,mBA6C/B"}
@@ -5,13 +5,26 @@
5
5
  /** Copies the CSS style sheets from source document into the target document.
6
6
  * @internal
7
7
  */
8
- export function copyStyles(targetDoc, sourceDoc = document) {
8
+ export async function copyStyles(targetDoc, sourceDoc = document) {
9
+ const promises = [];
9
10
  const styleSheets = Array.from(sourceDoc.styleSheets);
10
11
  styleSheets.forEach(({ ownerNode }) => {
11
12
  // Copy `link` and `style` elements.
12
13
  if (!ownerNode)
13
14
  return;
14
15
  const clonedNode = targetDoc.importNode(ownerNode, true);
16
+ if (clonedNode instanceof
17
+ (targetDoc.defaultView?.HTMLLinkElement ?? HTMLLinkElement) &&
18
+ clonedNode.href) {
19
+ promises.push(new Promise((resolve, reject) => {
20
+ clonedNode.onload = () => {
21
+ resolve();
22
+ };
23
+ clonedNode.onerror = (error) => {
24
+ reject(error);
25
+ };
26
+ }));
27
+ }
15
28
  targetDoc.head.appendChild(clonedNode);
16
29
  });
17
30
  const adoptedStyleSheets = Array.from(sourceDoc.adoptedStyleSheets ?? []);
@@ -20,10 +33,7 @@ export function copyStyles(targetDoc, sourceDoc = document) {
20
33
  if (!targetDoc.defaultView)
21
34
  return;
22
35
  const newStyleSheet = new targetDoc.defaultView.CSSStyleSheet();
23
- Array.from(styleSheet.cssRules).forEach((rule, index) => {
24
- // `cssText` might not serialize complex shorthand properties correctly: https://github.com/iTwin/appui/issues/893
25
- newStyleSheet.insertRule(rule.cssText, index);
26
- });
36
+ promises.push(newStyleSheet.replace(stringifyStyleSheet(styleSheet)).then(() => { }));
27
37
  targetDoc.adoptedStyleSheets.push(newStyleSheet);
28
38
  });
29
39
  // Copy sprites.
@@ -31,5 +41,11 @@ export function copyStyles(targetDoc, sourceDoc = document) {
31
41
  if (svgSymbolParent) {
32
42
  targetDoc.body.appendChild(svgSymbolParent.cloneNode(true));
33
43
  }
44
+ return Promise.all(promises);
45
+ }
46
+ function stringifyStyleSheet(stylesheet) {
47
+ return Array.from(stylesheet.cssRules)
48
+ .map((rule) => rule.cssText)
49
+ .join("\n");
34
50
  }
35
51
  //# sourceMappingURL=CopyStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyStyles.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,MAAM,UAAU,UAAU,C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------------------------------------------------------\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\n/** Copies the CSS style sheets from source document into the target document.\n * @internal\n */\nexport function copyStyles(\n targetDoc: Document,\n sourceDoc: Document = document\n) {\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 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 Array.from(styleSheet.cssRules).forEach((rule, index) => {\n // `cssText` might not serialize complex shorthand properties correctly: https://github.com/iTwin/appui/issues/893\n newStyleSheet.insertRule(rule.cssText, index);\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"]}
1
+ {"version":3,"file":"CopyStyles.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/CopyStyles.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,SAAmB,EACnB,YAAsB,QAAQ;IAE9B,MAAM,QAAQ,GAAyB,EAAE,CAAC;IAC1C,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACtD,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;QACpC,oCAAoC;QACpC,IAAI,CAAC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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 *--------------------------------------------------------------------------------------------*/\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, reject) => {\n clonedNode.onload = () => {\n resolve();\n };\n clonedNode.onerror = (error) => {\n reject(error);\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"]}
@@ -1,9 +1,9 @@
1
1
  /** @packageDocumentation
2
2
  * @module ChildWindowManager
3
3
  */
4
+ import "./InternalChildWindowManager.scss";
4
5
  import * as React from "react";
5
6
  import type { ChildWindowLocationProps, FrameworkChildWindows, OpenChildWindowInfo } from "../framework/FrameworkChildWindows";
6
- import "./InternalChildWindowManager.scss";
7
7
  /**
8
8
  * Simplification of non exported CreateRoot parameter, only to be used
9
9
  * in InternalChildWindowManager and ChildWindowManager
@@ -1 +1 @@
1
- {"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAO5C,OAAO,mCAAmC,CAAC;AA2B3C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,MAAM,CAAwC;IAEtD,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IACI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAqBd;;;;OAIG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,mBAAmB,GAAG,SAAS;IAQlC;;;;OAIG;IACI,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAS3E,OAAO,CAAC,yBAAyB;IAmFjC,gGAAgG;IACzF,QAAQ;IAOf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,2CAkBnC;IAEF,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;OAQG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,CAAC,EAAE,OAAO;CA2DhC"}
1
+ {"version":3,"file":"InternalChildWindowManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAiC5C;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;KAIK;AACL,qBAAa,0BAA2B,YAAW,qBAAqB;IACtE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,MAAM,CAAwC;IAEtD,IAAW,gBAAgB,0BAE1B;IAED;;;;;;;;OAQG;IACI,aAAa,CAAC,YAAY,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAqBd;;;;OAIG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,mBAAmB,GAAG,SAAS;IAQlC;;;;OAIG;IACI,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAS3E,OAAO,CAAC,yBAAyB;IAmFjC,gGAAgG;IACzF,QAAQ;IAOf;;;;;OAKG;IACI,KAAK,kBAAmB,MAAM,2CAkBnC;IAEF,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;OAQG;IACI,IAAI,CACT,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,CAAC,EAAE,OAAO;CA2DhC"}
@@ -5,6 +5,7 @@
5
5
  /** @packageDocumentation
6
6
  * @module ChildWindowManager
7
7
  */
8
+ import "./InternalChildWindowManager.scss";
8
9
  import * as React from "react";
9
10
  import * as ReactDOM from "react-dom";
10
11
  import { Provider } from "react-redux";
@@ -17,7 +18,6 @@ import { PopupRenderer } from "../popup/PopupManager";
17
18
  import { ThemeManager } from "../theme/ThemeManager";
18
19
  import { UiStateStorageHandler } from "../uistate/useUiStateStorage";
19
20
  import { copyStyles } from "./CopyStyles";
20
- import "./InternalChildWindowManager.scss";
21
21
  import { usePopoutsStore } from "../preview/reparent-popout-widgets/usePopoutsStore";
22
22
  const childHtml = `<!DOCTYPE html>
23
23
  <html>
@@ -157,8 +157,8 @@ export class InternalChildWindowManager {
157
157
  React.createElement(CursorPopupMenu, null),
158
158
  React.createElement("div", { className: "uifw-child-window-container nz-widget-widget" }, content)),
159
159
  React.createElement("div", { className: "uifw-childwindow-internalChildWindowManager_portalContainer" }))))));
160
- setTimeout(() => {
161
- copyStyles(childWindow.document);
160
+ setTimeout(async () => {
161
+ await copyStyles(childWindow.document);
162
162
  setTimeout(() => {
163
163
  this.render(element, reactConnectionDiv);
164
164
  if (childWindow.expectedHeight && childWindow.expectedWidth) {
@@ -1 +1 @@
1
- {"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAMzE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AAGrF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;QAqBV,CAAC;AAST;;;;KAIK;AACL,MAAM,OAAO,0BAA0B;IAAvC;QACU,sBAAiB,GAA0B,EAAE,CAAC;QAE9C,WAAM,GAAqC,EAAE,CAAC;QAqKtD;;;;;WAKG;QACI,UAAK,GAAG,CAAC,aAAqB,EAAE,kBAAkB,GAAG,IAAI,EAAE,EAAE;YAClE,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CACjD,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,KAAK,aAAa,CAC3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AgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Provider } from \"react-redux\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\nimport { TabIdContext } from \"../layout/widget/ContentRenderer\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport type { ChildWindow } from \"./ChildWindowConfig\";\nimport { copyStyles } from \"./CopyStyles\";\nimport \"./InternalChildWindowManager.scss\";\nimport { usePopoutsStore } from \"../preview/reparent-popout-widgets/usePopoutsStore\";\nimport type { WidgetDef } from \"../widgets/WidgetDef\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n private _roots: { [childwindowId: string]: any } = {};\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React 18, the `createRoot` function must be provided in order to render Popout content with React 18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to React 18 is complete.\n */\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n // If createRoot is passed in for React 18 we have to render differently\n // than without it. React 17 vs React 18. We need to save the root to\n // unmount it.\n if (this._createRoot) {\n const childWindowId = UiFramework.childWindows.findId(\n container.ownerDocument.defaultView\n );\n if (childWindowId) {\n this._roots[childWindowId] = this._createRoot(container);\n this._roots[childWindowId].render(element);\n }\n } else {\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n private renderChildWindowContents(\n childWindow: ChildWindow,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv && content && React.isValidElement(content)) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n const widgetDef = content.props.widgetDef as WidgetDef | undefined;\n const tabId = widgetDef?.id;\n const element = (\n // eslint-disable-next-line deprecation/deprecation\n <Provider store={UiFramework.store}>\n <TabIdContext.Provider value={tabId}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n <div className=\"uifw-childwindow-internalChildWindowManager_portalContainer\" />\n </ThemeManager>\n </UiStateStorageHandler>\n </TabIdContext.Provider>\n </Provider>\n );\n\n setTimeout(() => {\n copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(element, reactConnectionDiv);\n\n if (childWindow.expectedHeight && childWindow.expectedWidth) {\n childWindow.deltaWidth =\n childWindow.expectedWidth - childWindow.innerWidth;\n childWindow.deltaHeight =\n childWindow.expectedHeight - childWindow.innerHeight;\n }\n\n if (childWindow.expectedLeft && childWindow.expectedTop) {\n childWindow.deltaLeft =\n childWindow.expectedLeft - childWindow.screenLeft;\n childWindow.deltaTop =\n childWindow.expectedTop - childWindow.screenTop;\n }\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n\n // Trigger first so popout can be converted back to main window widget\n this.close(childWindowId, false);\n\n // UnmountComponentAtNode is deprecated in React 18, so if they are\n // using React 18 and passing in a createRoot function, unmount()\n // will be used\n if (this._roots[childWindowId]) {\n this._roots[childWindowId].unmount();\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n } else ReactDOM.unmountComponentAtNode(reactConnectionDiv);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close.\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true).\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (windowIndex === -1) return false;\n const { onClosePopoutWidget } = usePopoutsStore.getState();\n onClosePopoutWidget.raiseEvent({ windowId: childWindowId });\n\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef?.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n private adjustWindowLocation(location: ChildWindowLocationProps) {\n // If no location is provided, child window will open in the center of the current window.\n if (location.top === 0 && location.left === 0) {\n location.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n location.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n if (\n this.openChildWindows.some(\n (openWindow) => openWindow.childWindowId === childWindowId\n )\n ) {\n return false;\n }\n\n this.adjustWindowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow: ChildWindow | null = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n childWindow.expectedHeight = location.height;\n childWindow.expectedWidth = location.width;\n childWindow.expectedLeft = location.left;\n childWindow.expectedTop = location.top;\n\n if (url.length === 0) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"DOMContentLoaded\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalChildWindowManager.js","sourceRoot":"","sources":["../../../../src/appui-react/childwindow/InternalChildWindowManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAA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GAAG,EACH,EAAE,EACF,SAAS,QAAQ,CAAC,KAAK,WAAW,QAAQ,CAAC,MAAM,SAAS,QAAQ,CAAC,IAAI,QAAQ,QAAQ,CAAC,GAAG,+DAA+D,CAC3J,CAAC;QACF,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QAC/B,WAAW,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC7C,WAAW,CAAC,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC3C,WAAW,CAAC,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;QACzC,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC;QAEvC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,gBAAgB,CAC1B,kBAAkB,EAClB,GAAG,EAAE;gBACH,IAAI,CAAC,yBAAyB,CAC5B,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,CACN,CAAC;YACJ,CAAC,EACD,KAAK,CACN,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EACR,GAAG,EAAE;YACH,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,EACD,KAAK,CACN,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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\n/** @packageDocumentation\n * @module ChildWindowManager\n */\n\nimport \"./InternalChildWindowManager.scss\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Provider } from \"react-redux\";\nimport { UiFramework } from \"../UiFramework\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager\";\nimport type {\n ChildWindowLocationProps,\n FrameworkChildWindows,\n OpenChildWindowInfo,\n} from \"../framework/FrameworkChildWindows\";\nimport { TabIdContext } from \"../layout/widget/ContentRenderer\";\nimport { PopupRenderer } from \"../popup/PopupManager\";\nimport { ThemeManager } from \"../theme/ThemeManager\";\nimport { UiStateStorageHandler } from \"../uistate/useUiStateStorage\";\nimport type { ChildWindow } from \"./ChildWindowConfig\";\nimport { copyStyles } from \"./CopyStyles\";\nimport { usePopoutsStore } from \"../preview/reparent-popout-widgets/usePopoutsStore\";\nimport type { WidgetDef } from \"../widgets/WidgetDef\";\n\nconst childHtml = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <style>\n html,\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n overflow: hidden;\n }\n #root {\n height: 100%;\n }\n </style>\n</head>\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n</body>\n</html>`;\n\n/**\n * Simplification of non exported CreateRoot parameter, only to be used\n * in InternalChildWindowManager and ChildWindowManager\n * @internal\n */\nexport type CreateRoot = Parameters<FrameworkChildWindows[\"useCreateRoot\"]>[0];\n\n/** Supports opening a child browser window from the main application window. The child window is managed by the main application\n * and is running in the same security context. The application must deliver the html file iTwinPopup.html along side its index.html.\n * See also: [Child Window Manager]($docs/learning/ui/appui-react/ChildWindows.md)\n * @internal\n * */\nexport class InternalChildWindowManager implements FrameworkChildWindows {\n private _openChildWindows: OpenChildWindowInfo[] = [];\n private _createRoot?: CreateRoot;\n private _roots: { [childwindowId: string]: any } = {};\n\n public get openChildWindows() {\n return this._openChildWindows;\n }\n\n /**\n * When using React 18, the `createRoot` function must be provided in order to render Popout content with React 18.\n * Do not call if using React 17 or before.\n *\n * Note: The type of the function is intentionally simplified here.\n *\n * @param createRootFn Function imported from `import { createRoot } from \"react-dom/client\";`\n * @beta Will be removed once the transition to React 18 is complete.\n */\n public useCreateRoot(createRootFn: CreateRoot): void {\n this._createRoot = createRootFn;\n }\n\n /**\n * Abstracts ReactDOM.render to use either the _createRoot method or the default ReactDOM.render.\n * @param element Element to render.\n * @param container Container to render to.\n */\n private render(\n element: React.FunctionComponentElement<any>,\n container: Element | DocumentFragment\n ) {\n // If createRoot is passed in for React 18 we have to render differently\n // than without it. React 17 vs React 18. We need to save the root to\n // unmount it.\n if (this._createRoot) {\n const childWindowId = UiFramework.childWindows.findId(\n container.ownerDocument.defaultView\n );\n if (childWindowId) {\n this._roots[childWindowId] = this._createRoot(container);\n this._roots[childWindowId].render(element);\n }\n } else {\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n ReactDOM.render(element, container);\n }\n }\n\n /**\n * Returns the OpenChildWindowInfo for the related id.\n * @param childWindowId Id of the window to retrieve.\n * @returns undefined if not found.\n */\n public find(\n childWindowId: string | undefined\n ): OpenChildWindowInfo | undefined {\n if (undefined === childWindowId) return undefined;\n\n return this.openChildWindows.find(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n }\n\n /**\n * Return the childWindowId of the provided window.\n * @param contentWindow Window element to identify\n * @returns undefined if not found\n */\n public findId(contentWindow: Window | undefined | null): string | undefined {\n if (!contentWindow) return undefined;\n\n const childWindow = this.openChildWindows.find(\n (openWindow) => openWindow.window === contentWindow\n );\n return childWindow?.childWindowId;\n }\n\n private renderChildWindowContents(\n childWindow: ChildWindow,\n childWindowId: string,\n content: React.ReactNode,\n title: string\n ) {\n childWindow.document.title = title;\n\n const reactConnectionDiv = childWindow.document.getElementById(\"root\");\n if (reactConnectionDiv && content && React.isValidElement(content)) {\n // set openChildWindows now so components can use it when they mount\n this._openChildWindows.push({\n childWindowId,\n window: childWindow,\n parentWindow: window,\n });\n const widgetDef = content.props.widgetDef as WidgetDef | undefined;\n const tabId = widgetDef?.id;\n const element = (\n // eslint-disable-next-line deprecation/deprecation\n <Provider store={UiFramework.store}>\n <TabIdContext.Provider value={tabId}>\n <UiStateStorageHandler>\n <ThemeManager>\n <div className=\"uifw-child-window-container-host\">\n <PopupRenderer />\n <ModalDialogRenderer />\n <ModelessDialogRenderer />\n <CursorPopupMenu />\n <div className=\"uifw-child-window-container nz-widget-widget\">\n {content}\n </div>\n </div>\n <div className=\"uifw-childwindow-internalChildWindowManager_portalContainer\" />\n </ThemeManager>\n </UiStateStorageHandler>\n </TabIdContext.Provider>\n </Provider>\n );\n\n setTimeout(async () => {\n await copyStyles(childWindow.document);\n setTimeout(() => {\n this.render(element, reactConnectionDiv);\n\n if (childWindow.expectedHeight && childWindow.expectedWidth) {\n childWindow.deltaWidth =\n childWindow.expectedWidth - childWindow.innerWidth;\n childWindow.deltaHeight =\n childWindow.expectedHeight - childWindow.innerHeight;\n }\n\n if (childWindow.expectedLeft && childWindow.expectedTop) {\n childWindow.deltaLeft =\n childWindow.expectedLeft - childWindow.screenLeft;\n childWindow.deltaTop =\n childWindow.expectedTop - childWindow.screenTop;\n }\n });\n });\n\n childWindow.addEventListener(\"pagehide\", () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (!frontStageDef) return;\n frontStageDef.saveChildWindowSizeAndPosition(\n childWindowId,\n childWindow\n );\n\n // Trigger first so popout can be converted back to main window widget\n this.close(childWindowId, false);\n\n // UnmountComponentAtNode is deprecated in React 18, so if they are\n // using React 18 and passing in a createRoot function, unmount()\n // will be used\n if (this._roots[childWindowId]) {\n this._roots[childWindowId].unmount();\n // eslint-disable-next-line react/no-deprecated, deprecation/deprecation\n } else ReactDOM.unmountComponentAtNode(reactConnectionDiv);\n });\n }\n }\n\n /** Close all child/pop-out windows. This typically is called when the frontstage is changed. */\n public closeAll() {\n this.openChildWindows.forEach((openChildWindow) =>\n openChildWindow.window.close()\n );\n this._openChildWindows = [];\n }\n\n /**\n * Close a specific child window.\n * @param childWindowId Id of the window to close.\n * @param processWindowClose should the `close` method be called on the closing window. (defaults to true).\n * @returns false if the window could not be found.\n */\n public close = (childWindowId: string, processWindowClose = true) => {\n const windowIndex = this.openChildWindows.findIndex(\n (openWindow) => openWindow.childWindowId === childWindowId\n );\n if (windowIndex === -1) return false;\n const { onClosePopoutWidget } = usePopoutsStore.getState();\n onClosePopoutWidget.raiseEvent({ windowId: childWindowId });\n\n const childWindow = this.openChildWindows[windowIndex];\n this.openChildWindows.splice(windowIndex, 1);\n if (processWindowClose) {\n childWindow.window.close();\n } else {\n // call the following to convert popout to docked widget\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n frontStageDef?.dockWidgetContainerByContainerId(childWindowId);\n }\n return true;\n };\n\n private adjustWindowLocation(location: ChildWindowLocationProps) {\n // If no location is provided, child window will open in the center of the current window.\n if (location.top === 0 && location.left === 0) {\n location.left =\n window.outerWidth / 2 + window.screenX - location.width / 2;\n location.top =\n window.outerHeight / 2 + window.screenY - location.height / 2;\n }\n }\n\n /**\n * Open a new child window.\n * @param childWindowId Id to assign to the newly created window.\n * @param title Title to display on the window.\n * @param content ReactNode to be rendered in the window.\n * @param location Position and size information\n * @param useDefaultPopoutUrl use \"/iTwinPopup.html\" as the window Url, \"\" otherwise.\n * @returns true if the window is opened successfully.\n */\n public open(\n childWindowId: string,\n title: string,\n content: React.ReactNode,\n location: ChildWindowLocationProps,\n useDefaultPopoutUrl?: boolean\n ) {\n if (\n this.openChildWindows.some(\n (openWindow) => openWindow.childWindowId === childWindowId\n )\n ) {\n return false;\n }\n\n this.adjustWindowLocation(location);\n const url = useDefaultPopoutUrl ? \"/iTwinPopup.html\" : \"\";\n const childWindow: ChildWindow | null = window.open(\n url,\n \"\",\n `width=${location.width},height=${location.height},left=${location.left},top=${location.top},menubar=no,resizable=yes,scrollbars=no,status=no,location=no`\n );\n if (!childWindow) return false;\n childWindow.expectedHeight = location.height;\n childWindow.expectedWidth = location.width;\n childWindow.expectedLeft = location.left;\n childWindow.expectedTop = location.top;\n\n if (url.length === 0) {\n childWindow.document.write(childHtml);\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n } else {\n childWindow.addEventListener(\n \"DOMContentLoaded\",\n () => {\n this.renderChildWindowContents(\n childWindow,\n childWindowId,\n content,\n title\n );\n },\n false\n );\n }\n\n window.addEventListener(\n \"unload\",\n () => {\n const frontStageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontStageDef) {\n this.close(childWindowId, true);\n }\n },\n false\n );\n\n return true;\n }\n}\n"]}
@@ -21,13 +21,13 @@ export interface CursorMenuItemProps extends CommonProps {
21
21
  * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.
22
22
  */
23
23
  iconSpec?: IconSpec;
24
- /** The item to execute when this item is invoked. Either 'item' or 'submenu' must be specified.
24
+ /** The item to execute when this item is invoked. Either 'item', 'submenu' or `execute` must be specified.
25
25
  * @deprecated in 4.15.0. Use properties of this object instead.
26
26
  */
27
27
  item?: CommandItemProps;
28
28
  /** Function to execute. */
29
29
  execute?: () => any;
30
- /** Nested array of item props. Either 'item' or 'submenu' must be specified. */
30
+ /** Nested array of item props. Either 'item', 'submenu' or 'execute' must be specified. */
31
31
  submenu?: CursorMenuItemProps[];
32
32
  /** Icon to display on right side of the menu item.
33
33
  * Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id.
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/shared/MenuItem.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACb,MAAM,u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ED;;;GAGG;AACH,qBAAa,eAAe;WACZ,eAAe,CAC3B,aAAa,EAAE,mBAAmB,EAAE,EACpC,WAAW,CAAC,EAAE,MAAM,IAAI,GACvB,QAAQ,EAAE;WAQC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE;IAW1E,OAAO,CAAC,MAAM,CAAC,kBAAkB;CA4ClC"}
@@ -94,24 +94,17 @@ export class MenuItemHelpers {
94
94
  return itemNodes;
95
95
  }
96
96
  static createMenuItemNode(item, index) {
97
- let node = null;
98
97
  const label = item.label;
99
98
  const iconSpec = item.iconSpec;
100
99
  const iconRightSpec = item.iconRightSpec;
101
100
  const badgeType = item.badgeType;
102
101
  const badgeKind = item.badgeKind;
103
102
  const isDisabled = ConditionalBooleanValue.getValue(item.isDisabled);
104
- if (item.actionItem) {
105
- const sel = () => item.itemPicked();
106
- node = (React.createElement(ContextMenuItem, { key: index, onSelect: sel, icon: iconSpec, iconRight: iconRightSpec, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, label));
103
+ if (item.submenu && item.submenu.length > 0) {
104
+ const items = this.createMenuItemNodes(item.submenu);
105
+ return (React.createElement(ContextSubMenu, { key: index, icon: iconSpec, label: label, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, items));
107
106
  }
108
- else {
109
- if (item.submenu && item.submenu.length > 0) {
110
- const items = this.createMenuItemNodes(item.submenu);
111
- node = (React.createElement(ContextSubMenu, { key: index, icon: iconSpec, label: label, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, items));
112
- }
113
- }
114
- return node;
107
+ return (React.createElement(ContextMenuItem, { key: index, onSelect: () => item.itemPicked(), icon: iconSpec, iconRight: iconRightSpec, badgeType: badgeType, badgeKind: badgeKind, disabled: isDisabled }, label));
115
108
  }
116
109
  }
117
110
  //# sourceMappingURL=MenuItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../../src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U,EAAE,CAAC;YACpC,IAAI,GAAG,CACL,oBAAC,eAAe,IACd,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,GAAG,EACb,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACU,CACnB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAErD,IAAI,GAAG,CACL,oBAAC,cAAc,IACb,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACS,CAClB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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 Item\n */\n\nimport * as React from \"react\";\nimport type {\n AbstractMenuItemProps,\n StringGetter,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue, UiError } from \"@itwin/appui-abstract\";\nimport type {\n BadgeKind,\n BadgeType,\n CommonProps,\n IconSpec,\n} from \"@itwin/core-react\";\nimport { ContextMenuItem, ContextSubMenu } from \"@itwin/core-react\";\nimport { UiFramework } from \"../UiFramework\";\nimport type { ActionButtonItemDef } from \"./ActionButtonItemDef\";\nimport { CommandItemDef } from \"./CommandItemDef\";\nimport { ItemDefBase } from \"./ItemDefBase\";\nimport type { CommandItemProps } from \"./ItemProps\";\nimport type { ConditionalStringValue } from \"./ConditionalValue\";\n\n/** Properties for context menu items.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface CursorMenuItemProps extends CommonProps {\n /** The id for the menu item. */\n id: string;\n /** Icon to display. */\n iconNode?: React.ReactNode;\n /** Icon to display.\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n iconSpec?: IconSpec;\n /** The item to execute when this item is invoked. Either 'item' or 'submenu' must be specified.\n * @deprecated in 4.15.0. Use properties of this object instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n item?: CommandItemProps;\n /** Function to execute. */\n execute?: () => any;\n /** Nested array of item props. Either 'item' or 'submenu' must be specified. */\n submenu?: CursorMenuItemProps[];\n /** Icon to display on right side of the menu item.\n * Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n */\n iconRight?: string | ConditionalStringValue;\n\n // #region \"ItemProps\" properties previously extended from deprecated type.\n\n /** if true component will be hidden - defaults to false */\n isHidden?: boolean | ConditionalBooleanValue;\n /** if true component will be disabled - defaults to false */\n isDisabled?: boolean | ConditionalBooleanValue;\n /** if set, component will be considered \"active\" an will display an \"active stripe\" - defaults to false */\n isActive?: boolean;\n /** if set, component will be considered selected but will NOT display an \"active stripe\" - defaults to false. Typically used by buttons that toggle between two states. */\n isPressed?: boolean;\n /** can be used by application to store miscellaneous data. */\n applicationData?: any;\n /** Badge to be overlaid on the item.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n badgeType?: BadgeType;\n /** Specifies the kind of badge, if any, to be overlaid on the item. */\n badgeKind?: BadgeKind;\n /** Abstract icon definition. Used when creating itemDef from abstract item (ie. MenuItem).\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n icon?: IconSpec;\n\n /** if set, it is used to explicitly set the label shown by a component. */\n label?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n labelKey?: string;\n\n /** if set, it is used to explicitly set the description shown by a component. */\n description?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if description is not explicitly set. */\n descriptionKey?: string;\n /** used to explicitly set the tooltip shown by a component. */\n tooltip?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n tooltipKey?: string;\n\n // #endregion \"ItemProps\"\n}\n\n/* eslint-disable deprecation/deprecation */\n\n/** Menu Item Properties\n * @public\n * @deprecated in 4.11.0. Please use {@link CursorMenuItemProps}.\n */\nexport type MenuItemProps = AbstractMenuItemProps;\n\n/** Menu Item\n * @alpha\n * @deprecated in 4.15.0. Used in a deprecated class {@link MenuItemHelpers}.\n */\nexport class MenuItem extends ItemDefBase {\n private _id = \"\";\n private _actionItem?: ActionButtonItemDef;\n private _submenu: MenuItem[];\n private _onSelection?: () => void;\n private _execute?: () => void;\n\n /** onSelection is an optional parameter typically supplied to allow menu parent to close context menu when a menu item is selected. */\n constructor(props: CursorMenuItemProps, onSelection?: () => void) {\n super(props);\n\n this._id = props.id;\n this._submenu = new Array<MenuItem>();\n this._onSelection = onSelection;\n\n if (props.item) {\n this._actionItem = new CommandItemDef(props.item);\n\n // Copy over icon, label & badgeType from the item\n if (!this.iconSpec) this.iconSpec = this._actionItem.iconSpec;\n if (!this.label) this.setLabel(this._actionItem.label);\n if (!this.badgeType) this.badgeType = this._actionItem.badgeType;\n if (!this.badgeKind) this.badgeKind = this._actionItem.badgeKind;\n if (!this.isDisabled) this.isDisabled = this._actionItem.isDisabled;\n } else if (props.execute) {\n this._execute = props.execute;\n } else if (props.submenu) {\n props.submenu.forEach((childProps: CursorMenuItemProps) => {\n const childItem = new MenuItem(childProps, onSelection);\n this._submenu.push(childItem);\n });\n } else {\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiFramework.loggerCategory(this),\n `Either 'item', 'execute' or 'submenu' must be specified for '${props.id}'.`\n );\n }\n\n this.iconRightSpec = props.iconRight;\n }\n\n public get id(): string {\n return this._id;\n }\n\n public get submenu(): MenuItem[] {\n return this._submenu;\n }\n\n public get actionItem(): ActionButtonItemDef | undefined {\n return this._actionItem;\n }\n\n public iconRightSpec?: IconSpec;\n\n public itemPicked(): void {\n setTimeout(() => {\n if (this._actionItem) this._actionItem.execute();\n else if (this._execute) this._execute();\n });\n\n if (this._onSelection) this._onSelection();\n }\n}\n\n/** Menu Item helper methods\n * @alpha\n * @deprecated in 4.15.0. Use {@link @itwin/core-react#ContextMenuItem} and {@link @itwin/core-react#ContextSubMenu} components.\n */\nexport class MenuItemHelpers {\n public static createMenuItems(\n itemPropsList: CursorMenuItemProps[],\n onSelection?: () => void\n ): MenuItem[] {\n const menuItems = new Array<MenuItem>();\n itemPropsList.forEach((itemProps: CursorMenuItemProps) => {\n menuItems.push(new MenuItem(itemProps, onSelection));\n });\n return menuItems;\n }\n\n public static createMenuItemNodes(itemList: MenuItem[]): React.ReactNode[] {\n const itemNodes: React.ReactNode[] = [];\n\n itemList.forEach((item: MenuItem, index: number) => {\n const reactItem = this.createMenuItemNode(item, index);\n if (reactItem) itemNodes.push(reactItem);\n });\n\n return itemNodes;\n }\n\n private static createMenuItemNode(\n item: MenuItem,\n index: number\n ): React.ReactNode {\n let node: React.ReactNode = null;\n const label = item.label;\n const iconSpec = item.iconSpec;\n const iconRightSpec = item.iconRightSpec;\n const badgeType = item.badgeType;\n const badgeKind = item.badgeKind;\n const isDisabled: boolean = ConditionalBooleanValue.getValue(\n item.isDisabled\n );\n\n if (item.actionItem) {\n const sel = () => item.itemPicked();\n node = (\n <ContextMenuItem\n key={index}\n onSelect={sel}\n icon={iconSpec}\n iconRight={iconRightSpec}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {label}\n </ContextMenuItem>\n );\n } else {\n if (item.submenu && item.submenu.length > 0) {\n const items = this.createMenuItemNodes(item.submenu);\n\n node = (\n <ContextSubMenu\n key={index}\n icon={iconSpec}\n label={label}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {items}\n </ContextSubMenu>\n );\n }\n }\n\n return node;\n }\n}\n"]}
1
+ {"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../../src/appui-react/shared/MenuItem.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAOzE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkF5C;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IAOvC,uIAAuI;IACvI,YAAY,KAA0B,EAAE,WAAwB;QAC9D,KAAK,CAAC,KAAK,CAAC,CAAC;QARP,QAAG,GAAG,EAAE,CAAC;QAUf,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,KAAK,EAAY,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAEhC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAElD,kDAAkD;YAClD,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;YAC9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S,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,MAAM,UAAU,GAAY,uBAAuB,CAAC,QAAQ,CAC1D,IAAI,CAAC,UAAU,CAChB,CAAC;QAEF,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAErD,OAAO,CACL,oBAAC,cAAc,IACb,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACS,CAClB,CAAC;QACJ,CAAC;QAED,OAAO,CACL,oBAAC,eAAe,IACd,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,EACjC,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,IAEnB,KAAK,CACU,CACnB,CAAC;IACJ,CAAC;CACF","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 Item\n */\n\nimport * as React from \"react\";\nimport type {\n AbstractMenuItemProps,\n StringGetter,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue, UiError } from \"@itwin/appui-abstract\";\nimport type {\n BadgeKind,\n BadgeType,\n CommonProps,\n IconSpec,\n} from \"@itwin/core-react\";\nimport { ContextMenuItem, ContextSubMenu } from \"@itwin/core-react\";\nimport { UiFramework } from \"../UiFramework\";\nimport type { ActionButtonItemDef } from \"./ActionButtonItemDef\";\nimport { CommandItemDef } from \"./CommandItemDef\";\nimport { ItemDefBase } from \"./ItemDefBase\";\nimport type { CommandItemProps } from \"./ItemProps\";\nimport type { ConditionalStringValue } from \"./ConditionalValue\";\n\n/** Properties for context menu items.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface CursorMenuItemProps extends CommonProps {\n /** The id for the menu item. */\n id: string;\n /** Icon to display. */\n iconNode?: React.ReactNode;\n /** Icon to display.\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n iconSpec?: IconSpec;\n /** The item to execute when this item is invoked. Either 'item', 'submenu' or `execute` must be specified.\n * @deprecated in 4.15.0. Use properties of this object instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n item?: CommandItemProps;\n /** Function to execute. */\n execute?: () => any;\n /** Nested array of item props. Either 'item', 'submenu' or 'execute' must be specified. */\n submenu?: CursorMenuItemProps[];\n /** Icon to display on right side of the menu item.\n * Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n */\n iconRight?: string | ConditionalStringValue;\n\n // #region \"ItemProps\" properties previously extended from deprecated type.\n\n /** if true component will be hidden - defaults to false */\n isHidden?: boolean | ConditionalBooleanValue;\n /** if true component will be disabled - defaults to false */\n isDisabled?: boolean | ConditionalBooleanValue;\n /** if set, component will be considered \"active\" an will display an \"active stripe\" - defaults to false */\n isActive?: boolean;\n /** if set, component will be considered selected but will NOT display an \"active stripe\" - defaults to false. Typically used by buttons that toggle between two states. */\n isPressed?: boolean;\n /** can be used by application to store miscellaneous data. */\n applicationData?: any;\n /** Badge to be overlaid on the item.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n badgeType?: BadgeType;\n /** Specifies the kind of badge, if any, to be overlaid on the item. */\n badgeKind?: BadgeKind;\n /** Abstract icon definition. Used when creating itemDef from abstract item (ie. MenuItem).\n * @deprecated in 4.16.0. Use {@link CursorMenuItemProps.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n icon?: IconSpec;\n\n /** if set, it is used to explicitly set the label shown by a component. */\n label?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n labelKey?: string;\n\n /** if set, it is used to explicitly set the description shown by a component. */\n description?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if description is not explicitly set. */\n descriptionKey?: string;\n /** used to explicitly set the tooltip shown by a component. */\n tooltip?: string | StringGetter | ConditionalStringValue;\n /** if set, it is used to define a key that is used to look up a localized string. This value is used only if label is not explicitly set. */\n tooltipKey?: string;\n\n // #endregion \"ItemProps\"\n}\n\n/* eslint-disable deprecation/deprecation */\n\n/** Menu Item Properties\n * @public\n * @deprecated in 4.11.0. Please use {@link CursorMenuItemProps}.\n */\nexport type MenuItemProps = AbstractMenuItemProps;\n\n/** Menu Item\n * @alpha\n * @deprecated in 4.15.0. Used in a deprecated class {@link MenuItemHelpers}.\n */\nexport class MenuItem extends ItemDefBase {\n private _id = \"\";\n private _actionItem?: ActionButtonItemDef;\n private _submenu: MenuItem[];\n private _onSelection?: () => void;\n private _execute?: () => void;\n\n /** onSelection is an optional parameter typically supplied to allow menu parent to close context menu when a menu item is selected. */\n constructor(props: CursorMenuItemProps, onSelection?: () => void) {\n super(props);\n\n this._id = props.id;\n this._submenu = new Array<MenuItem>();\n this._onSelection = onSelection;\n\n if (props.item) {\n this._actionItem = new CommandItemDef(props.item);\n\n // Copy over icon, label & badgeType from the item\n if (!this.iconSpec) this.iconSpec = this._actionItem.iconSpec;\n if (!this.label) this.setLabel(this._actionItem.label);\n if (!this.badgeType) this.badgeType = this._actionItem.badgeType;\n if (!this.badgeKind) this.badgeKind = this._actionItem.badgeKind;\n if (!this.isDisabled) this.isDisabled = this._actionItem.isDisabled;\n } else if (props.execute) {\n this._execute = props.execute;\n } else if (props.submenu) {\n props.submenu.forEach((childProps: CursorMenuItemProps) => {\n const childItem = new MenuItem(childProps, onSelection);\n this._submenu.push(childItem);\n });\n } else {\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiFramework.loggerCategory(this),\n `Either 'item', 'execute' or 'submenu' must be specified for '${props.id}'.`\n );\n }\n\n this.iconRightSpec = props.iconRight;\n }\n\n public get id(): string {\n return this._id;\n }\n\n public get submenu(): MenuItem[] {\n return this._submenu;\n }\n\n public get actionItem(): ActionButtonItemDef | undefined {\n return this._actionItem;\n }\n\n public iconRightSpec?: IconSpec;\n\n public itemPicked(): void {\n setTimeout(() => {\n if (this._actionItem) this._actionItem.execute();\n else if (this._execute) this._execute();\n });\n\n if (this._onSelection) this._onSelection();\n }\n}\n\n/** Menu Item helper methods\n * @alpha\n * @deprecated in 4.15.0. Use {@link @itwin/core-react#ContextMenuItem} and {@link @itwin/core-react#ContextSubMenu} components.\n */\nexport class MenuItemHelpers {\n public static createMenuItems(\n itemPropsList: CursorMenuItemProps[],\n onSelection?: () => void\n ): MenuItem[] {\n const menuItems = new Array<MenuItem>();\n itemPropsList.forEach((itemProps: CursorMenuItemProps) => {\n menuItems.push(new MenuItem(itemProps, onSelection));\n });\n return menuItems;\n }\n\n public static createMenuItemNodes(itemList: MenuItem[]): React.ReactNode[] {\n const itemNodes: React.ReactNode[] = [];\n\n itemList.forEach((item: MenuItem, index: number) => {\n const reactItem = this.createMenuItemNode(item, index);\n if (reactItem) itemNodes.push(reactItem);\n });\n\n return itemNodes;\n }\n\n private static createMenuItemNode(\n item: MenuItem,\n index: number\n ): React.ReactNode {\n const label = item.label;\n const iconSpec = item.iconSpec;\n const iconRightSpec = item.iconRightSpec;\n const badgeType = item.badgeType;\n const badgeKind = item.badgeKind;\n const isDisabled: boolean = ConditionalBooleanValue.getValue(\n item.isDisabled\n );\n\n if (item.submenu && item.submenu.length > 0) {\n const items = this.createMenuItemNodes(item.submenu);\n\n return (\n <ContextSubMenu\n key={index}\n icon={iconSpec}\n label={label}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {items}\n </ContextSubMenu>\n );\n }\n\n return (\n <ContextMenuItem\n key={index}\n onSelect={() => item.itemPicked()}\n icon={iconSpec}\n iconRight={iconRightSpec}\n badgeType={badgeType}\n badgeKind={badgeKind}\n disabled={isDisabled}\n >\n {label}\n </ContextMenuItem>\n );\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/appui-react",
3
- "version": "4.16.2",
3
+ "version": "4.16.4",
4
4
  "description": "UI framework",
5
5
  "main": "lib/cjs/appui-react.js",
6
6
  "module": "lib/esm/appui-react.js",
@@ -23,15 +23,15 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@itwin/appui-abstract": "^3.7.0 || ^4.0.0",
26
- "@itwin/components-react": "^4.16.2",
26
+ "@itwin/components-react": "^4.16.4",
27
27
  "@itwin/core-bentley": "^3.7.0 || ^4.0.0",
28
28
  "@itwin/core-common": "^3.7.0 || ^4.0.0",
29
29
  "@itwin/core-frontend": "^3.7.0 || ^4.0.0",
30
30
  "@itwin/core-geometry": "^3.7.0 || ^4.0.0",
31
31
  "@itwin/core-quantity": "^3.7.0 || ^4.0.0",
32
- "@itwin/core-react": "^4.16.2",
32
+ "@itwin/core-react": "^4.16.4",
33
33
  "@itwin/core-telemetry": "^3.7.0 || ^4.0.0",
34
- "@itwin/imodel-components-react": "^4.16.2",
34
+ "@itwin/imodel-components-react": "^4.16.4",
35
35
  "react": "^17.0.0 || ^18.0.0",
36
36
  "react-dom": "^17.0.0 || ^18.0.0",
37
37
  "react-redux": "^7.2.2",
@@ -85,9 +85,9 @@
85
85
  "typescript": "~5.3.3",
86
86
  "upath": "^2.0.1",
87
87
  "vitest": "^1.6.0",
88
- "@itwin/components-react": "4.16.2",
89
- "@itwin/core-react": "4.16.2",
90
- "@itwin/imodel-components-react": "4.16.2"
88
+ "@itwin/components-react": "4.16.4",
89
+ "@itwin/core-react": "4.16.4",
90
+ "@itwin/imodel-components-react": "4.16.4"
91
91
  },
92
92
  "//dependencies": [
93
93
  "NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API",