@itwin/components-react 3.1.0-dev.8 → 3.1.2

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 (68) hide show
  1. package/CHANGELOG.md +98 -5
  2. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +1 -1
  3. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  4. package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +2 -0
  5. package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts.map +1 -1
  6. package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
  7. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +6 -0
  8. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
  9. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  10. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts.map +1 -1
  11. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -0
  12. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  13. package/lib/cjs/components-react/toolbar/Item.d.ts +6 -0
  14. package/lib/cjs/components-react/toolbar/Item.d.ts.map +1 -1
  15. package/lib/cjs/components-react/toolbar/Item.js +1 -1
  16. package/lib/cjs/components-react/toolbar/Item.js.map +1 -1
  17. package/lib/cjs/components-react/toolbar/Overflow.d.ts.map +1 -1
  18. package/lib/cjs/components-react/toolbar/Overflow.js +3 -1
  19. package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
  20. package/lib/cjs/components-react/toolbar/Overflow.scss +7 -0
  21. package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
  22. package/lib/cjs/components-react/toolbar/PopupItem.js +4 -2
  23. package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
  24. package/lib/cjs/components-react/toolbar/PopupItem.scss +13 -2
  25. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  26. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -1
  27. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  28. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +10 -0
  29. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  30. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +18 -4
  31. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  32. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
  33. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js +1 -1
  34. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  35. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +1 -1
  36. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  37. package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +2 -0
  38. package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts.map +1 -1
  39. package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
  40. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +6 -0
  41. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
  42. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  43. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts.map +1 -1
  44. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -0
  45. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  46. package/lib/esm/components-react/toolbar/Item.d.ts +6 -0
  47. package/lib/esm/components-react/toolbar/Item.d.ts.map +1 -1
  48. package/lib/esm/components-react/toolbar/Item.js +1 -1
  49. package/lib/esm/components-react/toolbar/Item.js.map +1 -1
  50. package/lib/esm/components-react/toolbar/Overflow.d.ts.map +1 -1
  51. package/lib/esm/components-react/toolbar/Overflow.js +4 -2
  52. package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
  53. package/lib/esm/components-react/toolbar/Overflow.scss +7 -0
  54. package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
  55. package/lib/esm/components-react/toolbar/PopupItem.js +5 -3
  56. package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
  57. package/lib/esm/components-react/toolbar/PopupItem.scss +13 -2
  58. package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  59. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +1 -1
  60. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  61. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +10 -0
  62. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  63. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +16 -3
  64. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  65. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
  66. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js +1 -1
  67. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
  68. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -1,6 +1,99 @@
1
1
  # Change Log - @itwin/components-react
2
2
 
3
- This log was last generated on Wed, 12 Jan 2022 14:52:38 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 06 Apr 2022 22:27:56 GMT and should not be manually modified.
4
+
5
+ ## 3.1.2
6
+ Wed, 06 Apr 2022 22:27:56 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.1.1
11
+ Thu, 31 Mar 2022 15:55:48 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 3.1.0
16
+ Tue, 29 Mar 2022 20:53:47 GMT
17
+
18
+ ### Updates
19
+
20
+ - Add data attributes to identify item and its UI provider.
21
+ - Update to itwinui-css version "0.44.0".
22
+ - Update to @itwin/itwinui-react: 1.32.0
23
+ - Update to latest itwinui-react.
24
+
25
+ ## 3.0.3
26
+ Fri, 25 Mar 2022 15:10:01 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 3.0.2
31
+ Thu, 10 Mar 2022 21:18:13 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 3.0.1
36
+ Thu, 24 Feb 2022 15:26:55 GMT
37
+
38
+ ### Updates
39
+
40
+ - Use ToolbarAutoHidePopupContext to monitor widgets' authoidden state.
41
+
42
+ ## 3.0.0
43
+ Mon, 24 Jan 2022 14:00:52 GMT
44
+
45
+ ### Updates
46
+
47
+ - Upgrade target to ES2019 and deliver both a CommonJs and ESModule version of package
48
+ - Update CustomNumberEditor to use size='small' itwinUi style.
49
+ - rename to @itwin/components-react
50
+ - remove ClientRequestContext and its subclasses
51
+ - Removed SignIn component
52
+ - Replace usage of I18N with generic Localization interface.
53
+ - Update snapshots
54
+ - Renamed an iModel's parent container to iTwin
55
+ - Support for TypeDoc v0.22.7. Fix various broken docs links.
56
+ - Refactored part of AccuDraw UI & Providing AccuDraw UI documentation
57
+ - Create empty frontstage and UiItemsProviders to populate it and update how ContentGroups are defined.
58
+ - Add missing public/beta types to the barrel file.
59
+ - Updated recommendation for using Breadcrumbs from itwinui-react instead of deprecated Breadcrumb
60
+ - Change `ControlledTree` to take `TreeModel` instead of `VisibleTreeNodes`.
61
+ - Replace `useVisibleTreeNodes` with `useTreeModel` since consumers don't need to create `VisibleTreeNodes` anymore.
62
+ - Rename `ControlledTreeProps.treeEvents` to `eventsHandler`.
63
+ - Make `width` and `height` required props for `ControlledTree` and `TreeRenderer`.
64
+ - Clean up deprecated Tree and Drag & Drop related APIs
65
+ - Clean up deprecated FilteringInput and PropertyGrid props
66
+ - Make `width` and `height` props required for `VirtualizedPropertyGrid` and `VirtualizedPropertyGridWithDataProvider`
67
+ - Update CustomNumberEditor resetting of bad values.
68
+ - update immer to fix security warning
69
+ - Deprecated Breadcrumb component
70
+ - Deprecate and promote apis
71
+ - Deprecate Table component.
72
+ - Deprecate obsolete APIs. Publish beta APIs from last release.
73
+ - Export BeDragDropContext
74
+ - Upgraded itwinui-react to 1.16.2. Fixed editor sizes.
75
+ - Remove files generated by bad merge
76
+ - Make ToolbarPopupContext public so user can call closePanel from their popup panels.
77
+ - Update props on iTwinUi-react Select so it works properly in auto-sized floating widgets.
78
+ - Deprecated HorizontalTabs in ui-core. Removed older deprecated items. Updated NextVersion.md.
79
+ - Update to latest itwinui-react
80
+ - Clean up css for status bar entries to avoid unwanted text wrapping.
81
+ - Incorporating iTwinUI-CSS and iTwinUI-React into iModel.js
82
+ - iTwinUI-react Table demo
83
+ - Moved iTwinUI style overrides to ui-core from ui-framework
84
+ - Rename ui directories to match new package names.
85
+ - Remove native key handling in React editor components because it's not longer needed with React 17.
86
+ - Add prop that prevents popup button panel from unmounting when closed.
87
+ - Promote property grid related APIs
88
+ - Update to React 17.
89
+ - Created imodel-components folder & package and moved color, lineweight, navigationaids, quantity, timeline & viewport. Deprecated MessageSeverity in ui-core & added it ui-abstract. Added MessagePresenter interface to ui-abstract.
90
+ - Remove react 16 peer dependency.
91
+ - Remove itwinUi css overrides.
92
+ - UiFramework and UiIModelComponent initialize method no longer take localization argument, uses IModelApp.localization internally.
93
+ - Replaced ui-core Slider with one from iTwinUi-react.
94
+ - Update to latest types/react package
95
+ - Skip test causing CI job failures
96
+ - Lock down and update version numbers so docs will build.
4
97
 
5
98
  ## 2.19.28
6
99
  Wed, 12 Jan 2022 14:52:38 GMT
@@ -295,7 +388,7 @@ Mon, 24 May 2021 15:58:39 GMT
295
388
  - Improved Multi-Value column filtering in the Table component
296
389
  - Move `VirtualizedPropertyGrid` related types from @alpha to @beta.
297
390
  - Fixed getting distinct values when Table rows are updated
298
- - Update to latest classnames package
391
+ - Update to latest classnames package
299
392
 
300
393
  ## 2.15.6
301
394
  Wed, 26 May 2021 15:55:19 GMT
@@ -761,7 +854,7 @@ Thu, 28 May 2020 22:48:59 GMT
761
854
  ### Updates
762
855
 
763
856
  - Fix toolbar overflow panel display.
764
- - Update to only show group separators if toolbar is not transparent.
857
+ - Update to only show group separators if toolbar is not transparent.
765
858
  - Fix toolbar error when scaling up UI.
766
859
  - Property grid horizontal layout updated according to UX requirements.
767
860
  - Fixed Table filter renderers after react-select version upgrade
@@ -1233,7 +1326,7 @@ Wed, 19 Dec 2018 18:26:14 GMT
1233
1326
  - Added DragDrop tests, added component withDragDrop HOC tests
1234
1327
  - Synchronizing navigation aids with view definition changes
1235
1328
  - Simplified property pane tooltips and improved Property Pane performance.
1236
- - Simplified struct and array tooltips in Table component.
1329
+ - Simplified struct and array tooltips in Table component.
1237
1330
  - Fix BeInspireTree's event listening functions to handle array inputs
1238
1331
  - Fix BeInspireTree's muting events with allowed number of triggers
1239
1332
  - Cache BeInspireTree.visible() result for better performance
@@ -1363,7 +1456,7 @@ Thu, 08 Nov 2018 17:59:21 GMT
1363
1456
 
1364
1457
  ### Updates
1365
1458
 
1366
- - Deprecated dev-cors-proxy-server and use of it.
1459
+ - Deprecated dev-cors-proxy-server and use of it.
1367
1460
  - Fix: Do not start search if input field is empty
1368
1461
  - Use strongly typed enums for identifying keyboard keys
1369
1462
  - PropertyGrid property editing and unit tests
@@ -157,7 +157,7 @@ class EnumButtonGroupEditor extends React.Component {
157
157
  isDisabled = !isEnabledFunction();
158
158
  }
159
159
  const className = (0, classnames_1.default)("components-enumbuttongroup-button", isDisabled && "nz-is-disabled", isActive && "nz-is-active");
160
- return (React.createElement("button", { ref: (ref) => this._btnRefs.set(choiceValue, ref), "data-testid": choice.label, className: className, title: choice.label, key: choice.label, onClick: () => this._handleButtonClick(index) },
160
+ return (React.createElement("button", { ref: (ref) => ref && this._btnRefs.set(choiceValue, ref), "data-testid": choice.label, className: className, title: choice.label, key: choice.label, onClick: () => this._handleButtonClick(index) },
161
161
  React.createElement(core_react_1.Icon, { iconSpec: this.state.enumIcons[index].iconSpec })));
162
162
  }
163
163
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAyC;AAEzC,mEAAoF;AAWpF;;GAEG;AACH,MAAa,qBAAsB,SAAQ,KAAK,CAAC,SAA0D;IAA3G;;QACU,aAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;QACzD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAyC;YACrE,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QA2FM,uBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE;gBAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;gBAEpD,IAAI,CAAC,QAAQ,CAAC;oBACZ,WAAW;iBACZ,EAAE,KAAK,IAAI,EAAE;oBACZ,uBAAuB;oBACvB,IAAI,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;wBACzC,MAAM,aAAa,GAAG,MAAM,IAAI,CAA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*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyEditors\r\n */\r\n\r\nimport \"./EnumButtonGroupEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ButtonGroupEditorParams, EnumerationChoice, IconDefinition, PropertyEditorParams, PropertyEditorParamTypes, PropertyRecord,\r\n PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames,\r\n} from \"@itwin/appui-abstract\";\r\nimport { Icon } from \"@itwin/core-react\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\n\r\n// cspell:ignore buttongroup enumbuttongroup\r\n\r\n/** @internal */\r\ninterface EnumButtonGroupEditorState {\r\n selectValue: string | number;\r\n enumIcons: IconDefinition[];\r\n choices: EnumerationChoice[];\r\n}\r\n\r\n/** EnumButtonGroupEditor React component that is a property editor with select input\r\n * @public\r\n */\r\nexport class EnumButtonGroupEditor extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState> implements TypeEditor {\r\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\r\n private _divElement = React.createRef<HTMLDivElement>();\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\r\n selectValue: \"\",\r\n enumIcons: [],\r\n choices: [],\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: this.state.selectValue,\r\n displayValue: \"\",\r\n };\r\n }\r\n\r\n return propertyValue;\r\n }\r\n\r\n public get htmlElement(): HTMLElement | null {\r\n return this._divElement.current;\r\n }\r\n\r\n public get hasFocus(): boolean {\r\n let containsFocus = false;\r\n // istanbul ignore else\r\n if (this._divElement.current)\r\n containsFocus = this._divElement.current.contains(document.activeElement);\r\n return containsFocus;\r\n }\r\n\r\n /** @internal */\r\n public override componentDidMount() {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\r\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n\r\n private async setStateFromProps() {\r\n const { propertyRecord } = this.props;\r\n\r\n // istanbul ignore else\r\n if (propertyRecord && propertyRecord.property.enum && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const primitiveValue = propertyRecord.value.value;\r\n let selectValue: string | number;\r\n\r\n if (typeof primitiveValue === \"string\") {\r\n selectValue = primitiveValue;\r\n } else {\r\n selectValue = primitiveValue as number;\r\n }\r\n\r\n let choices: EnumerationChoice[] = [];\r\n // istanbul ignore else\r\n if (propertyRecord && propertyRecord.property.enum) {\r\n if (propertyRecord.property.enum.choices instanceof Promise) {\r\n choices = await propertyRecord.property.enum.choices;\r\n } else {\r\n choices = propertyRecord.property.enum.choices;\r\n }\r\n }\r\n\r\n const numChoices = choices.length;\r\n const enumIcons = new Array<IconDefinition>(numChoices);\r\n enumIcons.fill({ iconSpec: \"icon icon-placeholder\" });\r\n\r\n // istanbul ignore else\r\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\r\n // istanbul ignore else\r\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\r\n const bgParams = propertyRecord.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.ButtonGroupData) as ButtonGroupEditorParams;\r\n // istanbul ignore else\r\n if (bgParams) {\r\n bgParams.buttons.forEach((iconDef: IconDefinition, index: number) => {\r\n // istanbul ignore else\r\n if (index < numChoices) {\r\n enumIcons[index] = iconDef;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n this.setState({ selectValue, enumIcons, choices });\r\n }\r\n }\r\n\r\n private _handleButtonClick = (index: number) => {\r\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\r\n\r\n // istanbul ignore else\r\n if (this.state.choices && this.state.choices.length > index) {\r\n const selectValue = this.state.choices[index].value;\r\n\r\n this.setState({\r\n selectValue,\r\n }, async () => {\r\n // istanbul ignore else\r\n if (propertyRecord && this.props.onCommit) {\r\n const propertyValue = await this.getPropertyValue();\r\n // istanbul ignore else\r\n if (propertyValue !== undefined) {\r\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\r\n }\r\n }\r\n });\r\n }\r\n };\r\n\r\n private getButton(choice: EnumerationChoice, index: number) {\r\n const choiceValue = this.state.choices ? this.state.choices[index].value : /* istanbul ignore next */ 0;\r\n const isActive = (choiceValue === this.state.selectValue) ? true : false;\r\n let isDisabled = false;\r\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\r\n // istanbul ignore else\r\n if (isEnabledFunction) {\r\n isDisabled = !isEnabledFunction();\r\n }\r\n\r\n const className = classnames(\r\n \"components-enumbuttongroup-button\",\r\n isDisabled && \"nz-is-disabled\",\r\n isActive && \"nz-is-active\",\r\n );\r\n\r\n return (\r\n <button\r\n ref={(ref: HTMLButtonElement) => this._btnRefs.set(choiceValue, ref)}\r\n data-testid={choice.label}\r\n className={className}\r\n title={choice.label}\r\n key={choice.label}\r\n onClick={() => this._handleButtonClick(index)}\r\n >\r\n <Icon iconSpec={this.state.enumIcons[index].iconSpec} />\r\n </button >\r\n );\r\n }\r\n\r\n /** @internal */\r\n public override render() {\r\n return (\r\n <div className={classnames(\"components-enumbuttongroup-editor\", this.props.className)} style={this.props.style} ref={this._divElement}>\r\n {this.state.choices && this.state.enumIcons.length && this.state.choices.map((choice: EnumerationChoice, index: number) => this.getButton(choice, index))}\r\n </div>);\r\n }\r\n}\r\n\r\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\r\n * It uses the [[EnumButtonGroupEditor]] React component.\r\n * @public\r\n */\r\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase { // istanbul ignore next\r\n public get reactNode(): React.ReactNode {\r\n return <EnumButtonGroupEditor />;\r\n }\r\n}\r\n\r\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, EnumPropertyButtonGroupEditor, StandardEditorNames.EnumButtonGroup);\r\n"]}
1
+ {"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAyC;AAEzC,mEAAoF;AAWpF;;GAEG;AACH,MAAa,qBAAsB,SAAQ,KAAK,CAAC,SAA0D;IAA3G;;QACU,aAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;QACzD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAAyC;YACrE,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QA2FM,uBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE;gBAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;gBAEpD,IAAI,CAAC,QAAQ,CAAC;oBACZ,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C,qBAAqB,OAAG,CAAC;IACnC,CAAC;CACF;AAJD,sEAIC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,6BAA6B,EAAE,oCAAmB,CAAC,eAAe,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyEditors\r\n */\r\n\r\nimport \"./EnumButtonGroupEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ButtonGroupEditorParams, EnumerationChoice, IconDefinition, PropertyEditorParams, PropertyEditorParamTypes, PropertyRecord,\r\n PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames,\r\n} from \"@itwin/appui-abstract\";\r\nimport { Icon } from \"@itwin/core-react\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\n\r\n// cspell:ignore buttongroup enumbuttongroup\r\n\r\n/** @internal */\r\ninterface EnumButtonGroupEditorState {\r\n selectValue: string | number;\r\n enumIcons: IconDefinition[];\r\n choices: EnumerationChoice[];\r\n}\r\n\r\n/** EnumButtonGroupEditor React component that is a property editor with select input\r\n * @public\r\n */\r\nexport class EnumButtonGroupEditor extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState> implements TypeEditor {\r\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\r\n private _divElement = React.createRef<HTMLDivElement>();\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\r\n selectValue: \"\",\r\n enumIcons: [],\r\n choices: [],\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: this.state.selectValue,\r\n displayValue: \"\",\r\n };\r\n }\r\n\r\n return propertyValue;\r\n }\r\n\r\n public get htmlElement(): HTMLElement | null {\r\n return this._divElement.current;\r\n }\r\n\r\n public get hasFocus(): boolean {\r\n let containsFocus = false;\r\n // istanbul ignore else\r\n if (this._divElement.current)\r\n containsFocus = this._divElement.current.contains(document.activeElement);\r\n return containsFocus;\r\n }\r\n\r\n /** @internal */\r\n public override componentDidMount() {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\r\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n\r\n private async setStateFromProps() {\r\n const { propertyRecord } = this.props;\r\n\r\n // istanbul ignore else\r\n if (propertyRecord && propertyRecord.property.enum && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const primitiveValue = propertyRecord.value.value;\r\n let selectValue: string | number;\r\n\r\n if (typeof primitiveValue === \"string\") {\r\n selectValue = primitiveValue;\r\n } else {\r\n selectValue = primitiveValue as number;\r\n }\r\n\r\n let choices: EnumerationChoice[] = [];\r\n // istanbul ignore else\r\n if (propertyRecord && propertyRecord.property.enum) {\r\n if (propertyRecord.property.enum.choices instanceof Promise) {\r\n choices = await propertyRecord.property.enum.choices;\r\n } else {\r\n choices = propertyRecord.property.enum.choices;\r\n }\r\n }\r\n\r\n const numChoices = choices.length;\r\n const enumIcons = new Array<IconDefinition>(numChoices);\r\n enumIcons.fill({ iconSpec: \"icon icon-placeholder\" });\r\n\r\n // istanbul ignore else\r\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\r\n // istanbul ignore else\r\n if (propertyRecord.property.editor && propertyRecord.property.editor.params) {\r\n const bgParams = propertyRecord.property.editor.params.find((param: PropertyEditorParams) => param.type === PropertyEditorParamTypes.ButtonGroupData) as ButtonGroupEditorParams;\r\n // istanbul ignore else\r\n if (bgParams) {\r\n bgParams.buttons.forEach((iconDef: IconDefinition, index: number) => {\r\n // istanbul ignore else\r\n if (index < numChoices) {\r\n enumIcons[index] = iconDef;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n\r\n this.setState({ selectValue, enumIcons, choices });\r\n }\r\n }\r\n\r\n private _handleButtonClick = (index: number) => {\r\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\r\n\r\n // istanbul ignore else\r\n if (this.state.choices && this.state.choices.length > index) {\r\n const selectValue = this.state.choices[index].value;\r\n\r\n this.setState({\r\n selectValue,\r\n }, async () => {\r\n // istanbul ignore else\r\n if (propertyRecord && this.props.onCommit) {\r\n const propertyValue = await this.getPropertyValue();\r\n // istanbul ignore else\r\n if (propertyValue !== undefined) {\r\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\r\n }\r\n }\r\n });\r\n }\r\n };\r\n\r\n private getButton(choice: EnumerationChoice, index: number) {\r\n const choiceValue = this.state.choices ? this.state.choices[index].value : /* istanbul ignore next */ 0;\r\n const isActive = (choiceValue === this.state.selectValue) ? true : false;\r\n let isDisabled = false;\r\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\r\n // istanbul ignore else\r\n if (isEnabledFunction) {\r\n isDisabled = !isEnabledFunction();\r\n }\r\n\r\n const className = classnames(\r\n \"components-enumbuttongroup-button\",\r\n isDisabled && \"nz-is-disabled\",\r\n isActive && \"nz-is-active\",\r\n );\r\n\r\n return (\r\n <button\r\n ref={(ref: HTMLButtonElement|null) => ref && this._btnRefs.set(choiceValue, ref)}\r\n data-testid={choice.label}\r\n className={className}\r\n title={choice.label}\r\n key={choice.label}\r\n onClick={() => this._handleButtonClick(index)}\r\n >\r\n <Icon iconSpec={this.state.enumIcons[index].iconSpec} />\r\n </button >\r\n );\r\n }\r\n\r\n /** @internal */\r\n public override render() {\r\n return (\r\n <div className={classnames(\"components-enumbuttongroup-editor\", this.props.className)} style={this.props.style} ref={this._divElement}>\r\n {this.state.choices && this.state.enumIcons.length && this.state.choices.map((choice: EnumerationChoice, index: number) => this.getButton(choice, index))}\r\n </div>);\r\n }\r\n}\r\n\r\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\r\n * It uses the [[EnumButtonGroupEditor]] React component.\r\n * @public\r\n */\r\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase { // istanbul ignore next\r\n public get reactNode(): React.ReactNode {\r\n return <EnumButtonGroupEditor />;\r\n }\r\n}\r\n\r\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, EnumPropertyButtonGroupEditor, StandardEditorNames.EnumButtonGroup);\r\n"]}
@@ -32,7 +32,9 @@ export interface GridCategoryItem extends FlatGridItemBase {
32
32
  readonly type: FlatGridItemType.Category;
33
33
  readonly name: string;
34
34
  readonly derivedCategory: PropertyCategory;
35
+ /** @deprecated Use [[getChildren]] and filter categories yourself. */
35
36
  getChildCategories(): GridCategoryItem[];
37
+ /** @deprecated Use [[getDescendantsAndSelf]] and filter categories yourself. */
36
38
  getDescendantCategoriesAndSelf(): GridCategoryItem[];
37
39
  }
38
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"FlatGridItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/FlatGridItem.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,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tD;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;IACvC,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAEpC,WAAW,IAAI,uBAAuB,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,oBAAY,YAAY,GAAG,uBAAuB,GAAG,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FlatGridItem.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/FlatGridItem.ts"],"names":[],"mappings":";AAAA;;;+FAG+F","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module PropertyGrid\r\n */\r\nimport { CategorizedPropertyTypes, FlatGridItemType } from \"./MutableFlatGridItem\";\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { PropertyCategory } from \"../../PropertyDataProvider\";\r\n\r\n/**\r\n * Base immutable data structure defining common methods and properties for categories and categorized properties\r\n * @beta\r\n */\r\nexport interface FlatGridItemBase {\r\n readonly isExpanded: boolean;\r\n readonly key: string;\r\n readonly selectionKey: string;\r\n readonly parentSelectionKey: string | undefined;\r\n readonly parentCategorySelectionKey: string | undefined;\r\n readonly depth: number;\r\n readonly label: string;\r\n readonly type: FlatGridItemType;\r\n readonly lastInNumberOfCategories: number;\r\n readonly isLastInRootCategory: boolean;\r\n getDescendantsAndSelf(): FlatGridItem[];\r\n getVisibleDescendantsAndSelf(): FlatGridItem[];\r\n getChildren(): FlatGridItem[];\r\n getLastVisibleDescendantOrSelf(): FlatGridItem;\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties present on immutable [[GridCategoryItem]]\r\n * @beta\r\n */\r\nexport interface GridCategoryItem extends FlatGridItemBase {\r\n readonly type: FlatGridItemType.Category;\r\n readonly name: string;\r\n readonly derivedCategory: PropertyCategory;\r\n\r\n getChildCategories(): GridCategoryItem[];\r\n getDescendantCategoriesAndSelf(): GridCategoryItem[];\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties present on immutable [[CategorizedPropertyItem]] objects\r\n * @beta\r\n */\r\nexport interface CategorizedPropertyItem extends FlatGridItemBase {\r\n readonly type: CategorizedPropertyTypes;\r\n readonly derivedRecord: PropertyRecord;\r\n readonly parentCategorySelectionKey: string;\r\n readonly parentSelectionKey: string;\r\n\r\n getChildren(): CategorizedPropertyItem[];\r\n}\r\n\r\n/**\r\n * Type which describes immutable [[GridCategoryItem]] or [[CategorizedPropertyItem]]\r\n * @beta\r\n */\r\nexport type FlatGridItem = CategorizedPropertyItem | GridCategoryItem;\r\n"]}
1
+ {"version":3,"file":"FlatGridItem.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/FlatGridItem.ts"],"names":[],"mappings":";AAAA;;;+FAG+F","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module PropertyGrid\r\n */\r\nimport { CategorizedPropertyTypes, FlatGridItemType } from \"./MutableFlatGridItem\";\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { PropertyCategory } from \"../../PropertyDataProvider\";\r\n\r\n/**\r\n * Base immutable data structure defining common methods and properties for categories and categorized properties\r\n * @beta\r\n */\r\nexport interface FlatGridItemBase {\r\n readonly isExpanded: boolean;\r\n readonly key: string;\r\n readonly selectionKey: string;\r\n readonly parentSelectionKey: string | undefined;\r\n readonly parentCategorySelectionKey: string | undefined;\r\n readonly depth: number;\r\n readonly label: string;\r\n readonly type: FlatGridItemType;\r\n readonly lastInNumberOfCategories: number;\r\n readonly isLastInRootCategory: boolean;\r\n getDescendantsAndSelf(): FlatGridItem[];\r\n getVisibleDescendantsAndSelf(): FlatGridItem[];\r\n getChildren(): FlatGridItem[];\r\n getLastVisibleDescendantOrSelf(): FlatGridItem;\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties present on immutable [[GridCategoryItem]]\r\n * @beta\r\n */\r\nexport interface GridCategoryItem extends FlatGridItemBase {\r\n readonly type: FlatGridItemType.Category;\r\n readonly name: string;\r\n readonly derivedCategory: PropertyCategory;\r\n\r\n /** @deprecated Use [[getChildren]] and filter categories yourself. */\r\n getChildCategories(): GridCategoryItem[];\r\n /** @deprecated Use [[getDescendantsAndSelf]] and filter categories yourself. */\r\n getDescendantCategoriesAndSelf(): GridCategoryItem[];\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties present on immutable [[CategorizedPropertyItem]] objects\r\n * @beta\r\n */\r\nexport interface CategorizedPropertyItem extends FlatGridItemBase {\r\n readonly type: CategorizedPropertyTypes;\r\n readonly derivedRecord: PropertyRecord;\r\n readonly parentCategorySelectionKey: string;\r\n readonly parentSelectionKey: string;\r\n\r\n getChildren(): CategorizedPropertyItem[];\r\n}\r\n\r\n/**\r\n * Type which describes immutable [[GridCategoryItem]] or [[CategorizedPropertyItem]]\r\n * @beta\r\n */\r\nexport type FlatGridItem = CategorizedPropertyItem | GridCategoryItem;\r\n"]}
@@ -104,7 +104,13 @@ export interface IMutableGridCategoryItem extends IMutableFlatPropertyGridItem {
104
104
  name: string;
105
105
  derivedCategory: PropertyCategory;
106
106
  isRootCategory: boolean;
107
+ /**
108
+ * @deprecated Use [[getChildren]] and filter categories yourself. Do not use this method to mutate the grid model, as this may lead to unexpected outcomes.
109
+ */
107
110
  getChildCategories(): IMutableGridCategoryItem[];
111
+ /**
112
+ * @deprecated Use [[getDescendantsAndSelf]] and filter categories yourself. Do not use this method to mutate the grid model, as this may lead to unexpected outcomes.
113
+ */
108
114
  getDescendantCategoriesAndSelf(): IMutableGridCategoryItem[];
109
115
  }
110
116
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"MutableFlatGridItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAuB,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;GAKG;AACH,oBAAY,gBAAgB;IAC1B,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,KAAK,IAAA;IACL,MAAM,IAAA;CACP;AAED;;;GAGG;AACH,oBAAY,wBAAwB,GAAG,gBAAgB,CAAC,KAAK,GAAG,gBAAgB,CAAC,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC;AAErH;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,0BAA0B,EAAE,MAAM,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB,IAAI,oBAAoB,EAAE,CAAC;IAChD,4BAA4B,IAAI,oBAAoB,EAAE,CAAC;IACvD,WAAW,IAAI,oBAAoB,EAAE,CAAC;IACtC,8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;IAED,IAAoB,kBAAkB,WAErC;IAED;;OAEG;IACH,IAAW,YAAY,WAEtB;IAED,IAAW,KAAK,WAEf;IAED;;OAEG;IACH,IAAW,aAAa,mBAEvB;CACF"}
1
+ {"version":3,"file":"MutableFlatGridItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAuB,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;GAKG;AACH,oBAAY,gBAAgB;IAC1B,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,KAAK,IAAA;IACL,MAAM,IAAA;CACP;AAED;;;GAGG;AACH,oBAAY,wBAAwB,GAAG,gBAAgB,CAAC,KAAK,GAAG,gBAAgB,CAAC,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC;AAErH;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,0BAA0B,EAAE,MAAM,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB,IAAI,oBAAoB,EAAE,CAAC;IAChD,4BAA4B,IAAI,oBAAoB,EAAE,CAAC;IACvD,WAAW,IAAI,oBAAoB,EAAE,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+BAA+B;IAIjD,IAAoB,0BAA0B,WAE7C;IAED,IAAoB,kBAAkB,WAErC;IAED;;OAEG;IACH,IAAW,YAAY,WAEtB;IAED,IAAW,KAAK,WAEf;IAED;;OAEG;IACH,IAAW,aAAa,mBAEvB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableFlatGridItem.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":";;;;;;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,iCAAkC;AAClC,sDAA8B;AAC9B,0DAAiG;AAGjG;;;;;GAKG;AACH,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,+DAAQ,CAAA;IACR,iEAAS,CAAA;IACT,yDAAK,CAAA;IACL,2DAAM,CAAA;AACR,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B;AA6BD;;;GAGG;AACH,MAAsB,2BAA2B;IAQ/C,YAA2B,MAAc,EAAU,mBAAuC,EAAU,2BAA+C;QAAxH,WAAM,GAAN,MAAM,CAAQ;QAAU,wBAAmB,GAAnB,mBAAmB,CAAoB;QAAU,gCAA2B,GAA3B,2BAA2B,CAAoB;QAP5I,QAAW,GAAG,IAAI,CAAC;QAEV,QAAG,GAAW,iBAAO,CAAC,QAAQ,EAAE,CAAC;QACvC,gBAAW,GAAY,KAAK,CAAC;QAC7B,8BAAyB,GAAW,CAAC,CAAC;QACtC,0BAAqB,GAAY,KAAK,CAAC;QAG/C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAChD,CAAC;IAMD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAW,0BAA0B;QACnC,OAAO,IAAI,CAAC,2BAA2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,EAAE,YAAqB,EAAE,eAAwB;QACrH,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,mBAAmB,EAAE,CAAC;QACvE,MAAM,OAAO,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,IAAI,CAAC;QACrC,MAAM,eAAe,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,YAAY,CAAC;QAExD,OAAO,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;IACvE,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,MAAsB,EAAE,4BAAiD;QACjG,6DAA6D;QAC7D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,+BAAc,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,0BAA0B;QAC5C,OAAO,KAAK,CAAC,0BAA2B,CAAC;IAC3C,CAAC;IAED,IAAoB,kBAAkB;QACpC,OAAO,KAAK,CAAC,kBAAmB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AA1GD,gEA0GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyGrid\r\n */\r\nimport { immerable } from \"immer\";\r\nimport shortid from \"shortid\";\r\nimport { PropertyDescription, PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\r\nimport { PropertyCategory } from \"../../PropertyDataProvider\";\r\n\r\n/**\r\n * Types of FlatGridItems for differentiating what property FlatGridItem is wrapping.\r\n * Category for PropertyCategory\r\n * (Primitive, Array, Struct) for PropertyRecord with valueFormats: (Primitive, Array, Struct)\r\n * @beta\r\n */\r\nexport enum FlatGridItemType {\r\n Category,\r\n Primitive,\r\n Array,\r\n Struct,\r\n}\r\n\r\n/**\r\n * Type which extracts FlatGridItemTypes relevant for working with CategorizedProperties\r\n * @beta\r\n */\r\nexport type CategorizedPropertyTypes = FlatGridItemType.Array | FlatGridItemType.Primitive | FlatGridItemType.Struct;\r\n\r\n/**\r\n * Base mutable data structure defining common methods and properties for both CategorizedProperties and GridCategoryItems\r\n * @beta\r\n */\r\nexport interface IMutableFlatPropertyGridItem {\r\n readonly type: FlatGridItemType;\r\n readonly key: string;\r\n readonly selectionKey: string;\r\n readonly parentSelectionKey: string | undefined;\r\n readonly parentCategorySelectionKey: string | undefined;\r\n readonly depth: number;\r\n readonly label: string;\r\n lastInNumberOfCategories: number;\r\n isLastInRootCategory: boolean;\r\n isExpanded: boolean;\r\n getDescendantsAndSelf(): IMutableFlatGridItem[];\r\n getVisibleDescendantsAndSelf(): IMutableFlatGridItem[];\r\n getChildren(): IMutableFlatGridItem[];\r\n getLastVisibleDescendantOrSelf(): IMutableFlatGridItem;\r\n}\r\n\r\n/**\r\n * Base class for all FlatPropertyGrid items\r\n * @beta\r\n */\r\nexport abstract class MutableFlatPropertyGridItem implements IMutableFlatPropertyGridItem {\r\n public [immerable] = true;\r\n\r\n public readonly key: string = shortid.generate();\r\n protected _isExpanded: boolean = false;\r\n protected _lastInNumberOfCategories: number = 0;\r\n protected _isLastInRootCategory: boolean = false;\r\n\r\n public constructor(private _depth: number, private _parentSelectionKey: string | undefined, private _parentCategorySelectionKey: string | undefined) {\r\n if (this._depth < 0)\r\n throw new Error(\"Depth cannot be negative\");\r\n }\r\n\r\n public abstract type: FlatGridItemType;\r\n public abstract label: string;\r\n public abstract selectionKey: string;\r\n\r\n public get depth() {\r\n return this._depth;\r\n }\r\n\r\n public get parentSelectionKey() {\r\n return this._parentSelectionKey;\r\n }\r\n\r\n public get parentCategorySelectionKey() {\r\n return this._parentCategorySelectionKey;\r\n }\r\n\r\n public get isExpanded() {\r\n return this._isExpanded;\r\n }\r\n\r\n public set isExpanded(value: boolean) {\r\n this._isExpanded = value;\r\n }\r\n\r\n public abstract getChildren(): IMutableFlatGridItem[];\r\n public abstract getSelf(): IMutableFlatGridItem;\r\n\r\n protected getDescendants() {\r\n const descendants: IMutableFlatGridItem[] = [];\r\n this.getChildren().forEach((child) => descendants.push(...child.getDescendantsAndSelf()));\r\n\r\n return descendants;\r\n }\r\n\r\n /**\r\n * Gets a flat list of all FlatGridItems beneath this flat grid item including itself in depth first visiting order.\r\n */\r\n public getDescendantsAndSelf(): IMutableFlatGridItem[] {\r\n return [this.getSelf(), ...this.getDescendants()];\r\n }\r\n\r\n /**\r\n * Gets a flat list of visible FlatGridItems beneath this flat grid item.\r\n */\r\n public getVisibleDescendants(): IMutableFlatGridItem[] {\r\n const descendants: IMutableFlatGridItem[] = [];\r\n if (this.isExpanded)\r\n this.getChildren().forEach((child) => descendants.push(...child.getVisibleDescendantsAndSelf()));\r\n return descendants;\r\n }\r\n\r\n /**\r\n * Gets a flat list of visible FlatGridItems beneath this flat grid item and itself in depth first visiting order.\r\n */\r\n public getVisibleDescendantsAndSelf(): IMutableFlatGridItem[] {\r\n return [this.getSelf(), ...this.getVisibleDescendants()];\r\n }\r\n\r\n /**\r\n * @returns self if item is not expanded, last visible descendant of this item otherwise.\r\n */\r\n public getLastVisibleDescendantOrSelf(): IMutableFlatGridItem {\r\n if (!this.isExpanded)\r\n return this.getSelf();\r\n\r\n const children = this.getChildren();\r\n if (children.length < 1)\r\n return this.getSelf();\r\n\r\n return children[children.length - 1].getLastVisibleDescendantOrSelf();\r\n }\r\n\r\n /**\r\n * Sets lastInNumberOfCategories value and sends it down to this items last child\r\n * @internal\r\n */\r\n public get lastInNumberOfCategories(): number {\r\n if (this.isExpanded && this.getChildren().length > 0)\r\n return 0;\r\n\r\n return this._lastInNumberOfCategories;\r\n }\r\n\r\n public set lastInNumberOfCategories(value: number) {\r\n this._lastInNumberOfCategories = value;\r\n const children = this.getChildren();\r\n if (children.length < 1)\r\n return;\r\n\r\n children[children.length - 1].lastInNumberOfCategories = value;\r\n }\r\n\r\n /**\r\n * Gets and sets isLastInRootCategory value and sends it down to this items last child\r\n * @internal\r\n */\r\n public get isLastInRootCategory(): boolean {\r\n if (this.isExpanded && this.getChildren().length > 0)\r\n return false;\r\n\r\n return this._isLastInRootCategory;\r\n }\r\n\r\n public set isLastInRootCategory(value: boolean) {\r\n this._isLastInRootCategory = value;\r\n const children = this.getChildren();\r\n if (children.length < 1)\r\n return;\r\n\r\n children[children.length - 1].isLastInRootCategory = value;\r\n }\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties to be held by Mutable GridCategoryItems\r\n * @beta\r\n */\r\nexport interface IMutableGridCategoryItem extends IMutableFlatPropertyGridItem {\r\n type: FlatGridItemType.Category;\r\n name: string;\r\n derivedCategory: PropertyCategory;\r\n isRootCategory: boolean;\r\n\r\n getChildCategories(): IMutableGridCategoryItem[];\r\n getDescendantCategoriesAndSelf(): IMutableGridCategoryItem[];\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties to be held by Mutable CategorizedPropertyItems\r\n * @beta\r\n */\r\nexport interface IMutableCategorizedPropertyItem extends IMutableFlatPropertyGridItem {\r\n readonly type: CategorizedPropertyTypes;\r\n readonly derivedRecord: PropertyRecord;\r\n readonly parentCategorySelectionKey: string;\r\n readonly parentSelectionKey: string;\r\n\r\n getChildren(): IMutableCategorizedPropertyItem[];\r\n}\r\n\r\n/**\r\n * Type which describes mutable GridCategoryItem or CategorizedProperty\r\n * @beta\r\n */\r\nexport type IMutableFlatGridItem = IMutableCategorizedPropertyItem | IMutableGridCategoryItem;\r\n\r\n/**\r\n * Base class for all Mutable CategorizedProperties\r\n * @beta\r\n */\r\nexport abstract class MutableCategorizedProperty extends MutableFlatPropertyGridItem implements Partial<IMutableCategorizedPropertyItem> {\r\n private _derivedRecord: PropertyRecord;\r\n private _selectionKey: string;\r\n\r\n public constructor(\r\n type: CategorizedPropertyTypes,\r\n record: PropertyRecord,\r\n parentSelectionKey: string,\r\n parentCategorySelectionKey: string,\r\n depth: number,\r\n overrideName?: string,\r\n overrideDisplayLabel?: string,\r\n ) {\r\n super(depth, parentSelectionKey, parentCategorySelectionKey);\r\n\r\n const recordType = this.valueTypeToFlatGridType(record.value.valueFormat);\r\n if (recordType !== type) {\r\n const expectedTypeStr = FlatGridItemType[type];\r\n const actualTypeStr = FlatGridItemType[recordType];\r\n throw Error(`Record with incorrect value format passed to property: expected ${expectedTypeStr}, got ${actualTypeStr}`);\r\n }\r\n\r\n const overridenProperty = this.makeOverridenProperty(record.property, overrideName, overrideDisplayLabel);\r\n this._derivedRecord = this.makeDerivedRecord(record, overridenProperty);\r\n\r\n this._selectionKey = `${this.parentSelectionKey}_${this.derivedRecord.property.name}`;\r\n this._isExpanded = !!record.autoExpand;\r\n }\r\n\r\n public abstract override type: CategorizedPropertyTypes;\r\n public abstract override getChildren(): IMutableCategorizedPropertyItem[];\r\n\r\n /**\r\n * Maps PropertyRecord valueFormat to FlatGridItemType\r\n * @param valueType valueFormat to map\r\n * @returns mapped FlatGridItemType\r\n */\r\n private valueTypeToFlatGridType(valueType: PropertyValueFormat) {\r\n switch (valueType) {\r\n case PropertyValueFormat.Primitive:\r\n return FlatGridItemType.Primitive;\r\n case PropertyValueFormat.Array:\r\n return FlatGridItemType.Array;\r\n case PropertyValueFormat.Struct:\r\n return FlatGridItemType.Struct;\r\n /* istanbul ignore next */\r\n default:\r\n const unhandledType: never = valueType;\r\n throw Error(`Property Value Format not handled: ${unhandledType}`);\r\n }\r\n }\r\n\r\n /**\r\n * Make new property description with overriden fields.\r\n * @param propertyDescription property description to override.\r\n * @param overrideName property description name to override.\r\n * @param overrideDisplay property description display name to override.\r\n */\r\n private makeOverridenProperty(propertyDescription: PropertyDescription, overrideName?: string, overrideDisplay?: string): PropertyDescription {\r\n const { name, displayLabel, ...property } = { ...propertyDescription };\r\n const newName = overrideName ?? name;\r\n const newDisplayLabel = overrideDisplay ?? displayLabel;\r\n\r\n return { ...property, name: newName, displayLabel: newDisplayLabel };\r\n }\r\n\r\n /**\r\n * Gets derived property record that has it's property description field overriden\r\n */\r\n private makeDerivedRecord(record: PropertyRecord, overridenPropertyDescription: PropertyDescription) {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const { value, property, ...others } = record;\r\n const newRecord = new PropertyRecord(value, overridenPropertyDescription);\r\n\r\n return Object.assign(newRecord, others);\r\n }\r\n\r\n public getSelf(): IMutableCategorizedPropertyItem {\r\n return this;\r\n }\r\n\r\n public override get parentCategorySelectionKey() {\r\n return super.parentCategorySelectionKey!;\r\n }\r\n\r\n public override get parentSelectionKey() {\r\n return super.parentSelectionKey!;\r\n }\r\n\r\n /**\r\n * Unique selection key made of parent selectionKey and this property name.\r\n */\r\n public get selectionKey() {\r\n return this._selectionKey;\r\n }\r\n\r\n public get label() {\r\n return this._derivedRecord.property.displayLabel;\r\n }\r\n\r\n /**\r\n * Record with overriden property description.\r\n */\r\n public get derivedRecord() {\r\n return this._derivedRecord;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableFlatGridItem.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":";;;;;;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,iCAAkC;AAClC,sDAA8B;AAC9B,0DAAiG;AAGjG;;;;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AEG;IACK,iBAAiB,CAAC,MAAsB,EAAE,4BAAiD;QACjG,6DAA6D;QAC7D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,+BAAc,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,0BAA0B;QAC5C,OAAO,KAAK,CAAC,0BAA2B,CAAC;IAC3C,CAAC;IAED,IAAoB,kBAAkB;QACpC,OAAO,KAAK,CAAC,kBAAmB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AA1GD,gEA0GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyGrid\r\n */\r\nimport { immerable } from \"immer\";\r\nimport shortid from \"shortid\";\r\nimport { PropertyDescription, PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\r\nimport { PropertyCategory } from \"../../PropertyDataProvider\";\r\n\r\n/**\r\n * Types of FlatGridItems for differentiating what property FlatGridItem is wrapping.\r\n * Category for PropertyCategory\r\n * (Primitive, Array, Struct) for PropertyRecord with valueFormats: (Primitive, Array, Struct)\r\n * @beta\r\n */\r\nexport enum FlatGridItemType {\r\n Category,\r\n Primitive,\r\n Array,\r\n Struct,\r\n}\r\n\r\n/**\r\n * Type which extracts FlatGridItemTypes relevant for working with CategorizedProperties\r\n * @beta\r\n */\r\nexport type CategorizedPropertyTypes = FlatGridItemType.Array | FlatGridItemType.Primitive | FlatGridItemType.Struct;\r\n\r\n/**\r\n * Base mutable data structure defining common methods and properties for both CategorizedProperties and GridCategoryItems\r\n * @beta\r\n */\r\nexport interface IMutableFlatPropertyGridItem {\r\n readonly type: FlatGridItemType;\r\n readonly key: string;\r\n readonly selectionKey: string;\r\n readonly parentSelectionKey: string | undefined;\r\n readonly parentCategorySelectionKey: string | undefined;\r\n readonly depth: number;\r\n readonly label: string;\r\n lastInNumberOfCategories: number;\r\n isLastInRootCategory: boolean;\r\n isExpanded: boolean;\r\n getDescendantsAndSelf(): IMutableFlatGridItem[];\r\n getVisibleDescendantsAndSelf(): IMutableFlatGridItem[];\r\n getChildren(): IMutableFlatGridItem[];\r\n getLastVisibleDescendantOrSelf(): IMutableFlatGridItem;\r\n}\r\n\r\n/**\r\n * Base class for all FlatPropertyGrid items\r\n * @beta\r\n */\r\nexport abstract class MutableFlatPropertyGridItem implements IMutableFlatPropertyGridItem {\r\n public [immerable] = true;\r\n\r\n public readonly key: string = shortid.generate();\r\n protected _isExpanded: boolean = false;\r\n protected _lastInNumberOfCategories: number = 0;\r\n protected _isLastInRootCategory: boolean = false;\r\n\r\n public constructor(private _depth: number, private _parentSelectionKey: string | undefined, private _parentCategorySelectionKey: string | undefined) {\r\n if (this._depth < 0)\r\n throw new Error(\"Depth cannot be negative\");\r\n }\r\n\r\n public abstract type: FlatGridItemType;\r\n public abstract label: string;\r\n public abstract selectionKey: string;\r\n\r\n public get depth() {\r\n return this._depth;\r\n }\r\n\r\n public get parentSelectionKey() {\r\n return this._parentSelectionKey;\r\n }\r\n\r\n public get parentCategorySelectionKey() {\r\n return this._parentCategorySelectionKey;\r\n }\r\n\r\n public get isExpanded() {\r\n return this._isExpanded;\r\n }\r\n\r\n public set isExpanded(value: boolean) {\r\n this._isExpanded = value;\r\n }\r\n\r\n public abstract getChildren(): IMutableFlatGridItem[];\r\n public abstract getSelf(): IMutableFlatGridItem;\r\n\r\n protected getDescendants() {\r\n const descendants: IMutableFlatGridItem[] = [];\r\n this.getChildren().forEach((child) => descendants.push(...child.getDescendantsAndSelf()));\r\n\r\n return descendants;\r\n }\r\n\r\n /**\r\n * Gets a flat list of all FlatGridItems beneath this flat grid item including itself in depth first visiting order.\r\n */\r\n public getDescendantsAndSelf(): IMutableFlatGridItem[] {\r\n return [this.getSelf(), ...this.getDescendants()];\r\n }\r\n\r\n /**\r\n * Gets a flat list of visible FlatGridItems beneath this flat grid item.\r\n */\r\n public getVisibleDescendants(): IMutableFlatGridItem[] {\r\n const descendants: IMutableFlatGridItem[] = [];\r\n if (this.isExpanded)\r\n this.getChildren().forEach((child) => descendants.push(...child.getVisibleDescendantsAndSelf()));\r\n return descendants;\r\n }\r\n\r\n /**\r\n * Gets a flat list of visible FlatGridItems beneath this flat grid item and itself in depth first visiting order.\r\n */\r\n public getVisibleDescendantsAndSelf(): IMutableFlatGridItem[] {\r\n return [this.getSelf(), ...this.getVisibleDescendants()];\r\n }\r\n\r\n /**\r\n * @returns self if item is not expanded, last visible descendant of this item otherwise.\r\n */\r\n public getLastVisibleDescendantOrSelf(): IMutableFlatGridItem {\r\n if (!this.isExpanded)\r\n return this.getSelf();\r\n\r\n const children = this.getChildren();\r\n if (children.length < 1)\r\n return this.getSelf();\r\n\r\n return children[children.length - 1].getLastVisibleDescendantOrSelf();\r\n }\r\n\r\n /**\r\n * Sets lastInNumberOfCategories value and sends it down to this items last child\r\n * @internal\r\n */\r\n public get lastInNumberOfCategories(): number {\r\n if (this.isExpanded && this.getChildren().length > 0)\r\n return 0;\r\n\r\n return this._lastInNumberOfCategories;\r\n }\r\n\r\n public set lastInNumberOfCategories(value: number) {\r\n this._lastInNumberOfCategories = value;\r\n const children = this.getChildren();\r\n if (children.length < 1)\r\n return;\r\n\r\n children[children.length - 1].lastInNumberOfCategories = value;\r\n }\r\n\r\n /**\r\n * Gets and sets isLastInRootCategory value and sends it down to this items last child\r\n * @internal\r\n */\r\n public get isLastInRootCategory(): boolean {\r\n if (this.isExpanded && this.getChildren().length > 0)\r\n return false;\r\n\r\n return this._isLastInRootCategory;\r\n }\r\n\r\n public set isLastInRootCategory(value: boolean) {\r\n this._isLastInRootCategory = value;\r\n const children = this.getChildren();\r\n if (children.length < 1)\r\n return;\r\n\r\n children[children.length - 1].isLastInRootCategory = value;\r\n }\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties to be held by Mutable GridCategoryItems\r\n * @beta\r\n */\r\nexport interface IMutableGridCategoryItem extends IMutableFlatPropertyGridItem {\r\n type: FlatGridItemType.Category;\r\n name: string;\r\n derivedCategory: PropertyCategory;\r\n isRootCategory: boolean;\r\n\r\n /**\r\n * @deprecated Use [[getChildren]] and filter categories yourself. Do not use this method to mutate the grid model, as this may lead to unexpected outcomes.\r\n */\r\n getChildCategories(): IMutableGridCategoryItem[];\r\n /**\r\n * @deprecated Use [[getDescendantsAndSelf]] and filter categories yourself. Do not use this method to mutate the grid model, as this may lead to unexpected outcomes.\r\n */\r\n getDescendantCategoriesAndSelf(): IMutableGridCategoryItem[];\r\n}\r\n\r\n/**\r\n * Data structure which describes methods and properties to be held by Mutable CategorizedPropertyItems\r\n * @beta\r\n */\r\nexport interface IMutableCategorizedPropertyItem extends IMutableFlatPropertyGridItem {\r\n readonly type: CategorizedPropertyTypes;\r\n readonly derivedRecord: PropertyRecord;\r\n readonly parentCategorySelectionKey: string;\r\n readonly parentSelectionKey: string;\r\n\r\n getChildren(): IMutableCategorizedPropertyItem[];\r\n}\r\n\r\n/**\r\n * Type which describes mutable GridCategoryItem or CategorizedProperty\r\n * @beta\r\n */\r\nexport type IMutableFlatGridItem = IMutableCategorizedPropertyItem | IMutableGridCategoryItem;\r\n\r\n/**\r\n * Base class for all Mutable CategorizedProperties\r\n * @beta\r\n */\r\nexport abstract class MutableCategorizedProperty extends MutableFlatPropertyGridItem implements Partial<IMutableCategorizedPropertyItem> {\r\n private _derivedRecord: PropertyRecord;\r\n private _selectionKey: string;\r\n\r\n public constructor(\r\n type: CategorizedPropertyTypes,\r\n record: PropertyRecord,\r\n parentSelectionKey: string,\r\n parentCategorySelectionKey: string,\r\n depth: number,\r\n overrideName?: string,\r\n overrideDisplayLabel?: string,\r\n ) {\r\n super(depth, parentSelectionKey, parentCategorySelectionKey);\r\n\r\n const recordType = this.valueTypeToFlatGridType(record.value.valueFormat);\r\n if (recordType !== type) {\r\n const expectedTypeStr = FlatGridItemType[type];\r\n const actualTypeStr = FlatGridItemType[recordType];\r\n throw Error(`Record with incorrect value format passed to property: expected ${expectedTypeStr}, got ${actualTypeStr}`);\r\n }\r\n\r\n const overridenProperty = this.makeOverridenProperty(record.property, overrideName, overrideDisplayLabel);\r\n this._derivedRecord = this.makeDerivedRecord(record, overridenProperty);\r\n\r\n this._selectionKey = `${this.parentSelectionKey}_${this.derivedRecord.property.name}`;\r\n this._isExpanded = !!record.autoExpand;\r\n }\r\n\r\n public abstract override type: CategorizedPropertyTypes;\r\n public abstract override getChildren(): IMutableCategorizedPropertyItem[];\r\n\r\n /**\r\n * Maps PropertyRecord valueFormat to FlatGridItemType\r\n * @param valueType valueFormat to map\r\n * @returns mapped FlatGridItemType\r\n */\r\n private valueTypeToFlatGridType(valueType: PropertyValueFormat) {\r\n switch (valueType) {\r\n case PropertyValueFormat.Primitive:\r\n return FlatGridItemType.Primitive;\r\n case PropertyValueFormat.Array:\r\n return FlatGridItemType.Array;\r\n case PropertyValueFormat.Struct:\r\n return FlatGridItemType.Struct;\r\n /* istanbul ignore next */\r\n default:\r\n const unhandledType: never = valueType;\r\n throw Error(`Property Value Format not handled: ${unhandledType}`);\r\n }\r\n }\r\n\r\n /**\r\n * Make new property description with overriden fields.\r\n * @param propertyDescription property description to override.\r\n * @param overrideName property description name to override.\r\n * @param overrideDisplay property description display name to override.\r\n */\r\n private makeOverridenProperty(propertyDescription: PropertyDescription, overrideName?: string, overrideDisplay?: string): PropertyDescription {\r\n const { name, displayLabel, ...property } = { ...propertyDescription };\r\n const newName = overrideName ?? name;\r\n const newDisplayLabel = overrideDisplay ?? displayLabel;\r\n\r\n return { ...property, name: newName, displayLabel: newDisplayLabel };\r\n }\r\n\r\n /**\r\n * Gets derived property record that has it's property description field overriden\r\n */\r\n private makeDerivedRecord(record: PropertyRecord, overridenPropertyDescription: PropertyDescription) {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const { value, property, ...others } = record;\r\n const newRecord = new PropertyRecord(value, overridenPropertyDescription);\r\n\r\n return Object.assign(newRecord, others);\r\n }\r\n\r\n public getSelf(): IMutableCategorizedPropertyItem {\r\n return this;\r\n }\r\n\r\n public override get parentCategorySelectionKey() {\r\n return super.parentCategorySelectionKey!;\r\n }\r\n\r\n public override get parentSelectionKey() {\r\n return super.parentSelectionKey!;\r\n }\r\n\r\n /**\r\n * Unique selection key made of parent selectionKey and this property name.\r\n */\r\n public get selectionKey() {\r\n return this._selectionKey;\r\n }\r\n\r\n public get label() {\r\n return this._derivedRecord.property.displayLabel;\r\n }\r\n\r\n /**\r\n * Record with overriden property description.\r\n */\r\n public get derivedRecord() {\r\n return this._derivedRecord;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableGridCategory.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableGridCategory.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACtI,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,2BAA4B,YAAW,wBAAwB;IACtG,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAmB;gBAGlC,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,mBAAmB,EAChC,eAAe,EAAE,uBAAuB,EACxC,kBAAkB,CAAC,EAAE,MAAM,EAC3B,KAAK,GAAE,MAAU;IA0BnB;;OAEG;IACH,IAAW,cAAc,YAExB;IAED,IAAW,YAAY,WAEtB;IAED,IAAW,IAAI,IAAI,gBAAgB,CAAC,QAAQ,CAE3C;IAED,IAAW,IAAI,WAEd;IAED,IAAW,KAAK,WAEf;IAED,IAAW,eAAe,IAAI,gBAAgB,CAE7C;IAEM,OAAO;IAIP,WAAW,IAAI,oBAAoB,EAAE;IAIrC,kBAAkB;IAIzB;;OAEG;IACI,8BAA8B,IAAI,wBAAwB,EAAE;IAOnE;;;;;OAKG;IACH,IAAoB,wBAAwB,IAAI,MAAM,CAKrD;IAED,IAAoB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAEzD;CACF"}
1
+ {"version":3,"file":"MutableGridCategory.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableGridCategory.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACtI,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,2BAA4B,YAAW,wBAAwB;IACtG,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAmB;gBAGlC,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,mBAAmB,EAChC,eAAe,EAAE,uBAAuB,EACxC,kBAAkB,CAAC,EAAE,MAAM,EAC3B,KAAK,GAAE,MAAU;IA0BnB;;OAEG;IACH,IAAW,cAAc,YAExB;IAED,IAAW,YAAY,WAEtB;IAED,IAAW,IAAI,IAAI,gBAAgB,CAAC,QAAQ,CAE3C;IAED,IAAW,IAAI,WAEd;IAED,IAAW,KAAK,WAEf;IAED,IAAW,eAAe,IAAI,gBAAgB,CAE7C;IAEM,OAAO;IAIP,WAAW,IAAI,oBAAoB,EAAE;IAIrC,kBAAkB;IAIzB;;OAEG;IACI,8BAA8B,IAAI,wBAAwB,EAAE;IAQnE;;;;;OAKG;IACH,IAAoB,wBAAwB,IAAI,MAAM,CAKrD;IAED,IAAoB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAEzD;CACF"}
@@ -65,6 +65,7 @@ class MutableGridCategory extends MutableFlatGridItem_1.MutableFlatPropertyGridI
65
65
  */
66
66
  getDescendantCategoriesAndSelf() {
67
67
  const descendants = [];
68
+ // eslint-disable-next-line deprecation/deprecation
68
69
  this._childCategories.forEach((value) => descendants.push(...value.getDescendantCategoriesAndSelf()));
69
70
  return [this, ...descendants];
70
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MutableGridCategory.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableGridCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,+DAAsI;AAWtI;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AO,IAAI,CAAC,yBAAyB,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,IAAoB,wBAAwB,CAAC,KAAa;QACxD,KAAK,CAAC,wBAAwB,GAAG,KAAK,GAAG,CAAC,CAAC;IAC7C,CAAC;CACF;AAtGD,kDAsGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module PropertyGrid\r\n */\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { PropertyCategory } from \"../../PropertyDataProvider\";\r\nimport { FlatGridItemType, IMutableFlatGridItem, IMutableGridCategoryItem, MutableFlatPropertyGridItem } from \"./MutableFlatGridItem\";\r\nimport { IMutableGridItemFactory } from \"./MutableGridItemFactory\";\r\n\r\n/**\r\n * Category name to PropertyRecord[] key pair interface used to describe which records belong to which category.\r\n * @beta\r\n */\r\nexport interface CategoryRecordsDict {\r\n [categoryName: string]: PropertyRecord[];\r\n}\r\n\r\n/**\r\n * Mutable wrapper object for PropertyCategory which provides methods for working with and managing category and record children hierarchies\r\n * @beta\r\n */\r\nexport class MutableGridCategory extends MutableFlatPropertyGridItem implements IMutableGridCategoryItem {\r\n private _children: IMutableFlatGridItem[];\r\n private _childCategories: IMutableGridCategoryItem[];\r\n private _selectionKey: string;\r\n private _category: PropertyCategory;\r\n\r\n constructor(\r\n category: PropertyCategory,\r\n recordsDict: CategoryRecordsDict,\r\n gridItemFactory: IMutableGridItemFactory,\r\n parentSelectionKey?: string,\r\n depth: number = 0,\r\n ) {\r\n super(depth, parentSelectionKey, parentSelectionKey);\r\n this._category = { name: category.name, label: category.label, expand: category.expand };\r\n\r\n if (parentSelectionKey !== undefined)\r\n this._selectionKey = `${parentSelectionKey}_${category.name}`;\r\n else\r\n this._selectionKey = category.name;\r\n\r\n this._isExpanded = category.expand;\r\n\r\n // Even though categories are nested and have their own depth, categorized properties depth is counted starting with the parent category.\r\n const categoryRecords = recordsDict[category.name] ?? [];\r\n this._children = categoryRecords.map((value) => gridItemFactory.createCategorizedProperty(value, this.selectionKey, this.selectionKey, 0));\r\n\r\n const childCategories = category.childCategories ?? [];\r\n this._childCategories = childCategories.map((childCategory) => gridItemFactory.createGridCategory(childCategory, recordsDict, this.selectionKey, this.depth + 1));\r\n\r\n this._children.push(...this._childCategories);\r\n\r\n // Assign lastInNumberOfCategories and isLastInRootCategory for entire children hierarchy\r\n this.lastInNumberOfCategories = 0;\r\n this.isLastInRootCategory = this.isRootCategory;\r\n }\r\n\r\n /**\r\n * Category is considered to be root category if its depth is 0\r\n */\r\n public get isRootCategory() {\r\n return this.depth === 0;\r\n }\r\n\r\n public get selectionKey() {\r\n return this._selectionKey;\r\n }\r\n\r\n public get type(): FlatGridItemType.Category {\r\n return FlatGridItemType.Category;\r\n }\r\n\r\n public get name() {\r\n return this._category.name;\r\n }\r\n\r\n public get label() {\r\n return this._category.label;\r\n }\r\n\r\n public get derivedCategory(): PropertyCategory {\r\n return { ...this._category, expand: this.isExpanded };\r\n }\r\n\r\n public getSelf() {\r\n return this;\r\n }\r\n\r\n public getChildren(): IMutableFlatGridItem[] {\r\n return this._children;\r\n }\r\n\r\n public getChildCategories() {\r\n return this._childCategories;\r\n }\r\n\r\n /**\r\n * Gets a flat list of all categories beneath this category and itself in depth first visiting order.\r\n */\r\n public getDescendantCategoriesAndSelf(): IMutableGridCategoryItem[] {\r\n const descendants: IMutableGridCategoryItem[] = [];\r\n this._childCategories.forEach((value) => descendants.push(...value.getDescendantCategoriesAndSelf()));\r\n\r\n return [this, ...descendants];\r\n }\r\n\r\n /**\r\n * Gets and Sets lastInNumberOfCategories.\r\n * Setter increments set value by one to account self as category.\r\n * New value is sent down to this items last child\r\n * @internal\r\n */\r\n public override get lastInNumberOfCategories(): number {\r\n if (this.isExpanded && this.getChildren().length > 0)\r\n return 0;\r\n\r\n return this._lastInNumberOfCategories - 1;\r\n }\r\n\r\n public override set lastInNumberOfCategories(value: number) {\r\n super.lastInNumberOfCategories = value + 1;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableGridCategory.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableGridCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,+DAAsI;AAWtI;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,iDAA2B;IAMlE,YACE,QAA0B,EAC1B,WAAgC,EAChC,eAAwC,EACxC,kBAA2B,EAC3B,QAAgB,CAAC;;QAEjB,KAAK,CAAC,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEzF,IAAI,kBAAkB,KAAK,SAAS;YAClC,IAAI,CAAC,aAAa,GAAG,GAAG,kBAAkB,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;;YAE9D,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC;QAErC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;QAEnC,yIAAyI;QACzI,MAAM,eAAe,GAAG,MAAA,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,yBAAyB,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;QAE3I,MAAM,eAAe,GAAG,MAAA,QAAQ,CAAC,eAAe,mCAAI,EAAE,CAAC;QACvD,IAAI,CAAC,gBAAgB,GAAG,eAAe,CA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AK,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC;QAEtG,OAAO,CAAC,IAAI,EAAE,GAAG,WAAW,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,IAAoB,wBAAwB;QAC1C,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,GAAG,CAAC;YAClD,OAAO,CAAC,CAAC;QAEX,OAAO,IAAI,CAAC,yBAAyB,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,IAAoB,wBAAwB,CAAC,KAAa;QACxD,KAAK,CAAC,wBAAwB,GAAG,KAAK,GAAG,CAAC,CAAC;IAC7C,CAAC;CACF;AAvGD,kDAuGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module PropertyGrid\r\n */\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { PropertyCategory } from \"../../PropertyDataProvider\";\r\nimport { FlatGridItemType, IMutableFlatGridItem, IMutableGridCategoryItem, MutableFlatPropertyGridItem } from \"./MutableFlatGridItem\";\r\nimport { IMutableGridItemFactory } from \"./MutableGridItemFactory\";\r\n\r\n/**\r\n * Category name to PropertyRecord[] key pair interface used to describe which records belong to which category.\r\n * @beta\r\n */\r\nexport interface CategoryRecordsDict {\r\n [categoryName: string]: PropertyRecord[];\r\n}\r\n\r\n/**\r\n * Mutable wrapper object for PropertyCategory which provides methods for working with and managing category and record children hierarchies\r\n * @beta\r\n */\r\nexport class MutableGridCategory extends MutableFlatPropertyGridItem implements IMutableGridCategoryItem {\r\n private _children: IMutableFlatGridItem[];\r\n private _childCategories: IMutableGridCategoryItem[];\r\n private _selectionKey: string;\r\n private _category: PropertyCategory;\r\n\r\n constructor(\r\n category: PropertyCategory,\r\n recordsDict: CategoryRecordsDict,\r\n gridItemFactory: IMutableGridItemFactory,\r\n parentSelectionKey?: string,\r\n depth: number = 0,\r\n ) {\r\n super(depth, parentSelectionKey, parentSelectionKey);\r\n this._category = { name: category.name, label: category.label, expand: category.expand };\r\n\r\n if (parentSelectionKey !== undefined)\r\n this._selectionKey = `${parentSelectionKey}_${category.name}`;\r\n else\r\n this._selectionKey = category.name;\r\n\r\n this._isExpanded = category.expand;\r\n\r\n // Even though categories are nested and have their own depth, categorized properties depth is counted starting with the parent category.\r\n const categoryRecords = recordsDict[category.name] ?? [];\r\n this._children = categoryRecords.map((value) => gridItemFactory.createCategorizedProperty(value, this.selectionKey, this.selectionKey, 0));\r\n\r\n const childCategories = category.childCategories ?? [];\r\n this._childCategories = childCategories.map((childCategory) => gridItemFactory.createGridCategory(childCategory, recordsDict, this.selectionKey, this.depth + 1));\r\n\r\n this._children.push(...this._childCategories);\r\n\r\n // Assign lastInNumberOfCategories and isLastInRootCategory for entire children hierarchy\r\n this.lastInNumberOfCategories = 0;\r\n this.isLastInRootCategory = this.isRootCategory;\r\n }\r\n\r\n /**\r\n * Category is considered to be root category if its depth is 0\r\n */\r\n public get isRootCategory() {\r\n return this.depth === 0;\r\n }\r\n\r\n public get selectionKey() {\r\n return this._selectionKey;\r\n }\r\n\r\n public get type(): FlatGridItemType.Category {\r\n return FlatGridItemType.Category;\r\n }\r\n\r\n public get name() {\r\n return this._category.name;\r\n }\r\n\r\n public get label() {\r\n return this._category.label;\r\n }\r\n\r\n public get derivedCategory(): PropertyCategory {\r\n return { ...this._category, expand: this.isExpanded };\r\n }\r\n\r\n public getSelf() {\r\n return this;\r\n }\r\n\r\n public getChildren(): IMutableFlatGridItem[] {\r\n return this._children;\r\n }\r\n\r\n public getChildCategories() {\r\n return this._childCategories;\r\n }\r\n\r\n /**\r\n * Gets a flat list of all categories beneath this category and itself in depth first visiting order.\r\n */\r\n public getDescendantCategoriesAndSelf(): IMutableGridCategoryItem[] {\r\n const descendants: IMutableGridCategoryItem[] = [];\r\n // eslint-disable-next-line deprecation/deprecation\r\n this._childCategories.forEach((value) => descendants.push(...value.getDescendantCategoriesAndSelf()));\r\n\r\n return [this, ...descendants];\r\n }\r\n\r\n /**\r\n * Gets and Sets lastInNumberOfCategories.\r\n * Setter increments set value by one to account self as category.\r\n * New value is sent down to this items last child\r\n * @internal\r\n */\r\n public override get lastInNumberOfCategories(): number {\r\n if (this.isExpanded && this.getChildren().length > 0)\r\n return 0;\r\n\r\n return this._lastInNumberOfCategories - 1;\r\n }\r\n\r\n public override set lastInNumberOfCategories(value: number) {\r\n super.lastInNumberOfCategories = value + 1;\r\n }\r\n}\r\n"]}
@@ -24,6 +24,12 @@ export interface ToolbarButtonItemProps extends CommonProps {
24
24
  badge?: React.ReactNode;
25
25
  /** If true add a gap before button. Default to false. */
26
26
  addGroupSeparator?: boolean;
27
+ /** value added to DOM element as a data attribute to hold name of items provider. If specified in `FrontstageProvider` then this will be undefined */
28
+ providerId?: string;
29
+ /** value added to DOM element as a data attribute, shows 0 is undefined */
30
+ itemPriority?: number;
31
+ /** value added to DOM element as a data attribute */
32
+ groupPriority?: number;
27
33
  }
28
34
  /** Toolbar item component. Used in [[Toolbar]] component.
29
35
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Item.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,mBAAmB;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,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ACxB;AAED;;GAEG;AAEH,eAAO,MAAM,iBAAiB,6DAgC1B,CAAC"}
@@ -39,7 +39,7 @@ const React = __importStar(require("react"));
39
39
  // eslint-disable-next-line react/display-name
40
40
  exports.ToolbarButtonItem = React.memo((props) => {
41
41
  const className = (0, classnames_1.default)("components-toolbar-button-item", props.isActive && "components-active", props.isDisabled && "components-disabled", props.className);
42
- return (React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "tool-button", disabled: props.isDisabled, onClick: props.onClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: props.title },
42
+ return (React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "action-tool-button", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-providerid": props.providerId, disabled: props.isDisabled, onClick: props.onClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: props.title },
43
43
  React.createElement("div", { className: "components-icon" }, props.icon),
44
44
  props.badge &&
45
45
  React.createElement("div", { className: "components-badge" }, props.badge)));
@@ -1 +1 @@
1
- {"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Item.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uBAAqB;AACrB,4DAAoC;AACpC,6CAA+B;AAyB/B;;GAEG;AACH,8CAA8C;AACjC,QAAA,iBAAiB,GAAG,KAAK,CAAC,IAAI,CACzC,CAAC,KAA6B,EAAE,EAAE;IAChC,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,gCAAgC,EAChC,KAAK,CAAC,QAAQ,IAAI,mBAAmB,EACrC,KAAK,CAAC,UAAU,IAAI,qBAAqB,EACzC,KAAK,CAAC,SAAS,CAAC,CAAC;IAEnB,OAAO,CACL,gDACgB,KAAK,CAAC,MAAM,oBACX,aAAa,EAC5B,QAAQ,EAAE,KAAK,CAAC,UAAU,EAC1B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAElB,6BAAK,SAAS,EAAC,iBAAiB,IAC7B,KAAK,CAAC,IAAI,CACP;QACL,KAAK,CAAC,KAAK;YACV,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,KAAK,CACR,CAED,CACV,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./Item.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\n\r\n/** Properties of [[ToolbarButtonItem]] component.\r\n * @public\r\n */\r\nexport interface ToolbarButtonItemProps extends CommonProps {\r\n /** button icon. */\r\n icon?: React.ReactNode;\r\n /** Describes if item is active. */\r\n isActive?: boolean;\r\n /** Describes if the item is disabled. */\r\n isDisabled?: boolean;\r\n /** Function called when the item is clicked. */\r\n onClick?: () => void;\r\n /** Function called when a key is pressed. */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n /** Title for the item. */\r\n title: string;\r\n /** A badge to draw. */\r\n badge?: React.ReactNode;\r\n /** If true add a gap before button. Default to false. */\r\n addGroupSeparator?: boolean;\r\n}\r\n\r\n/** Toolbar item component. Used in [[Toolbar]] component.\r\n * @public\r\n */\r\n// eslint-disable-next-line react/display-name\r\nexport const ToolbarButtonItem = React.memo<React.FC<ToolbarButtonItemProps>>(\r\n (props: ToolbarButtonItemProps) => {\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n props.isActive && \"components-active\",\r\n props.isDisabled && \"components-disabled\",\r\n props.className);\r\n\r\n return (\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"tool-button\"\r\n disabled={props.isDisabled} // this is needed to prevent focusing/keyboard access to disabled buttons\r\n onClick={props.onClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n {props.icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {props.badge}\r\n </div>\r\n }\r\n </button>\r\n );\r\n });\r\n"]}
1
+ {"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Item.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uBAAqB;AACrB,4DAAoC;AACpC,6CAA+B;AA+B/B;;GAEG;AACH,8CAA8C;AACjC,QAAA,iBAAiB,GAAG,KAAK,CAAC,IAAI,CACzC,CAAC,KAA6B,EAAE,EAAE;IAChC,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,gCAAgC,EAChC,KAAK,CAAC,QAAQ,IAAI,mBAAmB,EACrC,KAAK,CAAC,UAAU,IAAI,qBAAqB,EACzC,KAAK,CAAC,SAAS,CAAC,CAAC;IAEnB,OAAO,CACL,gDACgB,KAAK,CAAC,MAAM,oBACX,oBAAoB,8BACT,KAAK,CAAC,aAAa,wBACzB,KAAK,CAAC,YAAY,0BAChB,KAAK,CAAC,UAAU,EACtC,QAAQ,EAAE,KAAK,CAAC,UAAU,EAC1B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAElB,6BAAK,SAAS,EAAC,iBAAiB,IAC7B,KAAK,CAAC,IAAI,CACP;QACL,KAAK,CAAC,KAAK;YACV,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,KAAK,CACR,CAED,CACV,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport \"./Item.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\n\r\n/** Properties of [[ToolbarButtonItem]] component.\r\n * @public\r\n */\r\nexport interface ToolbarButtonItemProps extends CommonProps {\r\n /** button icon. */\r\n icon?: React.ReactNode;\r\n /** Describes if item is active. */\r\n isActive?: boolean;\r\n /** Describes if the item is disabled. */\r\n isDisabled?: boolean;\r\n /** Function called when the item is clicked. */\r\n onClick?: () => void;\r\n /** Function called when a key is pressed. */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n /** Title for the item. */\r\n title: string;\r\n /** A badge to draw. */\r\n badge?: React.ReactNode;\r\n /** If true add a gap before button. Default to false. */\r\n addGroupSeparator?: boolean;\r\n /** value added to DOM element as a data attribute to hold name of items provider. If specified in `FrontstageProvider` then this will be undefined */\r\n providerId?: string;\r\n /** value added to DOM element as a data attribute, shows 0 is undefined */\r\n itemPriority?: number;\r\n /** value added to DOM element as a data attribute */\r\n groupPriority?: number;\r\n}\r\n\r\n/** Toolbar item component. Used in [[Toolbar]] component.\r\n * @public\r\n */\r\n// eslint-disable-next-line react/display-name\r\nexport const ToolbarButtonItem = React.memo<React.FC<ToolbarButtonItemProps>>(\r\n (props: ToolbarButtonItemProps) => {\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n props.isActive && \"components-active\",\r\n props.isDisabled && \"components-disabled\",\r\n props.className);\r\n\r\n return (\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"action-tool-button\"\r\n data-item-group-priority={props.groupPriority}\r\n data-item-priority={props.itemPriority}\r\n data-item-providerid={props.providerId}\r\n disabled={props.isDisabled} // this is needed to prevent focusing/keyboard access to disabled buttons\r\n onClick={props.onClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n {props.icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {props.badge}\r\n </div>\r\n }\r\n </button>\r\n );\r\n });\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW,EAAE,eAAe;IAC9E,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eA0CtE;AAED,gBAAgB;AAChB,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAWxF"}
1
+ {"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW,EAAE,eAAe;IAC9E,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eA+CtE;AAED,gBAAgB;AAChB,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CAWxF"}
@@ -45,13 +45,15 @@ function ToolbarOverflowButton(props) {
45
45
  const { onResize, useHeight } = (0, ToolbarWithOverflow_1.useToolItemEntryContext)();
46
46
  const [targetRef, target] = (0, core_react_1.useRefState)();
47
47
  const ref = (0, ItemWrapper_1.useResizeObserverSingleDimension)(onResize, useHeight);
48
+ const isHidden = (0, ToolbarWithOverflow_1.useToolbarPopupAutoHideContext)();
49
+ const popupClassName = (0, classnames_1.default)("components-toolbar-overflow_popup", isHidden && "nz-hidden");
48
50
  const className = (0, classnames_1.default)("components-toolbar-item-container", "components-toolbar-overflow-button", props.className);
49
51
  const buttonClassName = (0, classnames_1.default)("components-toolbar-button-item", "components-ellipsis-icon");
50
52
  return (React.createElement("div", { className: className, ref: targetRef },
51
53
  React.createElement("button", { ref: ref, onClick: props.onClick, className: buttonClassName, style: props.style, title: props.title },
52
54
  React.createElement("div", { className: "components-icon" },
53
55
  React.createElement("div", { className: "components-ellipsis" }))),
54
- React.createElement(core_react_1.Popup, { className: "components-toolbar-overflow_popup", offset: 0, showShadow: false, isOpen: props.open, onClose: props.onClose, position: toToolbarOverflowRelativePosition(props.expandsTo), target: target }, props.panelNode)));
56
+ React.createElement(core_react_1.Popup, { className: popupClassName, offset: 0, showShadow: false, isOpen: props.open, onClose: props.onClose, position: toToolbarOverflowRelativePosition(props.expandsTo), target: target }, props.panelNode)));
55
57
  }
56
58
  exports.ToolbarOverflowButton = ToolbarOverflowButton;
57
59
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"Overflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAyB;AACzB,4DAAoC;AACpC,6CAA+B;AAC/B,kDAAqF;AACrF,+DAAgE;AAChE,+CAAiE;AACjE,qDAAkD;AAClD,0DAAyD;AAoBzD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAA,6CAAuB,GAAE,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,IAAA,wBAAW,GAAkB,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAA,8CAAgC,EAAoB,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrF,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,mCAAmC,EACnC,oCAAoC,EACpC,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,MAAM,eAAe,GAAG,IAAA,oBAAU,EAChC,gCAAgC,EAChC,0BAA0B,CAC3B,CAAC;IACF,OAAO,CACL,6BACE,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,SAAS;QAEd,gCACE,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK;YAElB,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CACnC,CACC;QACT,oBAAC,kBAAK,IACJ,SAAS,EAAC,mCAAmC,EAC7C,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,KAAK,EACjB,MAAM,EAAE,KAAK,CAAC,IAAI,EAClB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,iCAAiC,CAAC,KAAK,CAAC,SAAS,CAAC,EAC5D,MAAM,EAAE,MAAM,IAEb,KAAK,CAAC,SAAS,CACV,CACJ,CACP,CAAC;AACJ,CAAC;AA1CD,sDA0CC;AAED,gBAAgB;AAChB,SAAgB,iCAAiC,CAAC,SAAoB;IACpE,QAAQ,SAAS,EAAE;QACjB,KAAK,qBAAS,CAAC,MAAM;YACnB,OAAO,iCAAgB,CAAC,MAAM,CAAC;QACjC,KAAK,qBAAS,CAAC,IAAI;YACjB,OAAO,iCAAgB,CAAC,IAAI,CAAC;QAC/B,KAAK,qBAAS,CAAC,KAAK;YAClB,OAAO,iCAAgB,CAAC,KAAK,CAAC;QAChC,KAAK,qBAAS,CAAC,GAAG;YAChB,OAAO,iCAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,CAAC;AAXD,8EAWC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ToolSettings\r\n */\r\n\r\nimport \"./Overflow.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps, NoChildrenProps, Popup, useRefState } from \"@itwin/core-react\";\r\nimport { useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { Direction } from \"./utilities/Direction\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\n\r\n/** Properties of [[ToolbarOverflowButton]] component.\r\n * @internal\r\n */\r\nexport interface ToolbarOverflowButtonProps extends CommonProps, NoChildrenProps {\r\n /** Function called when button is clicked. */\r\n onClick?: () => void;\r\n /** Function called when panel is closed. */\r\n onClose?: () => void;\r\n /** Describes if the panel is open. */\r\n open?: boolean;\r\n /** Panel expand direction. */\r\n expandsTo: Direction;\r\n /** Panel element containing the overflown buttons */\r\n panelNode?: React.ReactNode;\r\n /** Title for the item. */\r\n title?: string;\r\n}\r\n\r\n/** Button to toggle display of overflown tools.\r\n * @internal\r\n */\r\nexport function ToolbarOverflowButton(props: ToolbarOverflowButtonProps) {\r\n const { onResize, useHeight } = useToolItemEntryContext();\r\n const [targetRef, target] = useRefState<HTMLDivElement>();\r\n const ref = useResizeObserverSingleDimension<HTMLButtonElement>(onResize, useHeight);\r\n const className = classnames(\r\n \"components-toolbar-item-container\",\r\n \"components-toolbar-overflow-button\",\r\n props.className,\r\n );\r\n const buttonClassName = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-ellipsis-icon\",\r\n );\r\n return (\r\n <div\r\n className={className}\r\n ref={targetRef}\r\n >\r\n <button\r\n ref={ref}\r\n onClick={props.onClick}\r\n className={buttonClassName}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n <div className=\"components-ellipsis\" />\r\n </div>\r\n </button>\r\n <Popup\r\n className=\"components-toolbar-overflow_popup\"\r\n offset={0}\r\n showShadow={false}\r\n isOpen={props.open}\r\n onClose={props.onClose}\r\n position={toToolbarOverflowRelativePosition(props.expandsTo)}\r\n target={target}\r\n >\r\n {props.panelNode}\r\n </Popup>\r\n </div>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarOverflowRelativePosition(expandsTo: Direction): RelativePosition {\r\n switch (expandsTo) {\r\n case Direction.Bottom:\r\n return RelativePosition.Bottom;\r\n case Direction.Left:\r\n return RelativePosition.Left;\r\n case Direction.Right:\r\n return RelativePosition.Right;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Overflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/Overflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAyB;AACzB,4DAAoC;AACpC,6CAA+B;AAC/B,kDAAqF;AACrF,+DAAgG;AAChG,+CAAiE;AACjE,qDAAkD;AAClD,0DAAyD;AAoBzD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAA,6CAAuB,GAAE,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,IAAA,wBAAW,GAAkB,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAA,8CAAgC,EAAoB,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrF,MAAM,QAAQ,GAAG,IAAA,oDAA8B,GAAE,CAAC;IAClD,MAAM,cAAc,GAAG,IAAA,oBAAU,EAC/B,mCAAmC,EACnC,QAAQ,IAAI,WAAW,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,mCAAmC,EACnC,oCAAoC,EACpC,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,MAAM,eAAe,GAAG,IAAA,oBAAU,EAChC,gCAAgC,EAChC,0BAA0B,CAC3B,CAAC;IACF,OAAO,CACL,6BACE,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,SAAS;QAEd,gCACE,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK;YAElB,6BAAK,SAAS,EAAC,iBAAiB;gBAC9B,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CACnC,CACC;QACT,oBAAC,kBAAK,IACJ,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,KAAK,EACjB,MAAM,EAAE,KAAK,CAAC,IAAI,EAClB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,iCAAiC,CAAC,KAAK,CAAC,SAAS,CAAC,EAC5D,MAAM,EAAE,MAAM,IAEb,KAAK,CAAC,SAAS,CACV,CACJ,CACP,CAAC;AACJ,CAAC;AA/CD,sDA+CC;AAED,gBAAgB;AAChB,SAAgB,iCAAiC,CAAC,SAAoB;IACpE,QAAQ,SAAS,EAAE;QACjB,KAAK,qBAAS,CAAC,MAAM;YACnB,OAAO,iCAAgB,CAAC,MAAM,CAAC;QACjC,KAAK,qBAAS,CAAC,IAAI;YACjB,OAAO,iCAAgB,CAAC,IAAI,CAAC;QAC/B,KAAK,qBAAS,CAAC,KAAK;YAClB,OAAO,iCAAgB,CAAC,KAAK,CAAC;QAChC,KAAK,qBAAS,CAAC,GAAG;YAChB,OAAO,iCAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,CAAC;AAXD,8EAWC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ToolSettings\r\n */\r\n\r\nimport \"./Overflow.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps, NoChildrenProps, Popup, useRefState } from \"@itwin/core-react\";\r\nimport { useToolbarPopupAutoHideContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { Direction } from \"./utilities/Direction\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\n\r\n/** Properties of [[ToolbarOverflowButton]] component.\r\n * @internal\r\n */\r\nexport interface ToolbarOverflowButtonProps extends CommonProps, NoChildrenProps {\r\n /** Function called when button is clicked. */\r\n onClick?: () => void;\r\n /** Function called when panel is closed. */\r\n onClose?: () => void;\r\n /** Describes if the panel is open. */\r\n open?: boolean;\r\n /** Panel expand direction. */\r\n expandsTo: Direction;\r\n /** Panel element containing the overflown buttons */\r\n panelNode?: React.ReactNode;\r\n /** Title for the item. */\r\n title?: string;\r\n}\r\n\r\n/** Button to toggle display of overflown tools.\r\n * @internal\r\n */\r\nexport function ToolbarOverflowButton(props: ToolbarOverflowButtonProps) {\r\n const { onResize, useHeight } = useToolItemEntryContext();\r\n const [targetRef, target] = useRefState<HTMLDivElement>();\r\n const ref = useResizeObserverSingleDimension<HTMLButtonElement>(onResize, useHeight);\r\n const isHidden = useToolbarPopupAutoHideContext();\r\n const popupClassName = classnames(\r\n \"components-toolbar-overflow_popup\",\r\n isHidden && \"nz-hidden\");\r\n\r\n const className = classnames(\r\n \"components-toolbar-item-container\",\r\n \"components-toolbar-overflow-button\",\r\n props.className,\r\n );\r\n const buttonClassName = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-ellipsis-icon\",\r\n );\r\n return (\r\n <div\r\n className={className}\r\n ref={targetRef}\r\n >\r\n <button\r\n ref={ref}\r\n onClick={props.onClick}\r\n className={buttonClassName}\r\n style={props.style}\r\n title={props.title}\r\n >\r\n <div className=\"components-icon\">\r\n <div className=\"components-ellipsis\" />\r\n </div>\r\n </button>\r\n <Popup\r\n className={popupClassName}\r\n offset={0}\r\n showShadow={false}\r\n isOpen={props.open}\r\n onClose={props.onClose}\r\n position={toToolbarOverflowRelativePosition(props.expandsTo)}\r\n target={target}\r\n >\r\n {props.panelNode}\r\n </Popup>\r\n </div>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarOverflowRelativePosition(expandsTo: Direction): RelativePosition {\r\n switch (expandsTo) {\r\n case Direction.Bottom:\r\n return RelativePosition.Bottom;\r\n case Direction.Left:\r\n return RelativePosition.Left;\r\n case Direction.Right:\r\n return RelativePosition.Right;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
@@ -46,4 +46,11 @@
46
46
  background: none;
47
47
 
48
48
  @include uicore-z-index(toolbar-panels);
49
+
50
+ transition: visibility 0.5s ease, opacity 0.5s ease;
51
+
52
+ &.nz-hidden {
53
+ opacity: 0;
54
+ visibility: hidden;
55
+ }
49
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PopupItem.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAIhD,cAAc;AACd,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;IAChC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,YAAY,KAAK,IAAI,CAAC;CAC/D;AAED;;;GAGG;AAEH,eAAO,MAAM,mBAAmB,yCAK9B,CAAC;AAEH;;;GAGG;AACH,wBAAgB,sBAAsB,6BAErC;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,sBAAsB;IAC5D,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CA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,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAyE9C;AAED,gBAAgB;AAChB,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAYxD"}
@@ -88,7 +88,7 @@ function PopupItem(props) {
88
88
  return (React.createElement(exports.ToolbarPopupContext.Provider, { value: {
89
89
  closePanel: () => processPanelOpenClose(false),
90
90
  } },
91
- React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "tool-button", ref: targetRef, disabled: props.isDisabled, onClick: onButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: props.title },
91
+ React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "tool-button-popup", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-providerid": props.providerId, ref: targetRef, disabled: props.isDisabled, onClick: onButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: props.title },
92
92
  React.createElement("div", { className: "components-icon" }, props.icon),
93
93
  props.badge &&
94
94
  React.createElement("div", { className: "components-badge" }, props.badge),
@@ -98,7 +98,9 @@ function PopupItem(props) {
98
98
  exports.PopupItem = PopupItem;
99
99
  /** @internal */
100
100
  function PopupItemPopup(props) {
101
- return React.createElement(core_react_1.Popup, { className: "components-toolbar-popupItem_popupItemPopup", offset: 0, showShadow: false, ...props });
101
+ const isHidden = (0, ToolbarWithOverflow_1.useToolbarPopupAutoHideContext)();
102
+ const className = (0, classnames_1.default)("components-toolbar-popupItem_popupItemPopup", isHidden && "nz-hidden");
103
+ return React.createElement(core_react_1.Popup, { className: className, offset: 0, showShadow: false, ...props });
102
104
  }
103
105
  exports.PopupItemPopup = PopupItemPopup;
104
106
  //# sourceMappingURL=PopupItem.js.map