@itwin/components-react 4.2.0 → 4.3.0-dev.1

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 (97) hide show
  1. package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts +13 -0
  2. package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts.map +1 -0
  3. package/lib/cjs/components-react/common/UseElementsScrollStorage.js +49 -0
  4. package/lib/cjs/components-react/common/UseElementsScrollStorage.js.map +1 -0
  5. package/lib/cjs/components-react/datepicker/DatePicker.scss +3 -3
  6. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.scss +3 -3
  7. package/lib/cjs/components-react/datepicker/TimeField.scss +3 -3
  8. package/lib/cjs/components-react/editors/BooleanEditor.scss +3 -3
  9. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.scss +3 -3
  10. package/lib/cjs/components-react/editors/IconEditor.scss +3 -3
  11. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.scss +3 -3
  12. package/lib/cjs/components-react/editors/PopupButton.scss +3 -3
  13. package/lib/cjs/components-react/editors/ToggleEditor.scss +3 -3
  14. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +3 -3
  15. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -3
  16. package/lib/cjs/components-react/filtering/ResultSelector.scss +3 -3
  17. package/lib/cjs/components-react/iconpicker/IconPickerButton.scss +3 -3
  18. package/lib/cjs/components-react/properties/renderers/ActionButtonList.scss +3 -3
  19. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +3 -3
  20. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +3 -3
  21. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.scss +3 -3
  22. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +10 -0
  23. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  24. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +11 -1
  25. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  26. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -3
  27. package/lib/cjs/components-react/selectable-content/SelectableContent.scss +3 -3
  28. package/lib/cjs/components-react/toolbar/ItemWrapper.scss +3 -3
  29. package/lib/cjs/components-react/toolbar/Items.scss +3 -3
  30. package/lib/cjs/components-react/toolbar/Overflow.scss +3 -3
  31. package/lib/cjs/components-react/toolbar/OverflowPanel.scss +3 -3
  32. package/lib/cjs/components-react/toolbar/PopupItem.scss +3 -3
  33. package/lib/cjs/components-react/toolbar/_variables.scss +3 -3
  34. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.scss +3 -3
  35. package/lib/cjs/components-react/toolbar/groupPanel/Column.scss +3 -3
  36. package/lib/cjs/components-react/toolbar/groupPanel/Columns.scss +3 -3
  37. package/lib/cjs/components-react/toolbar/groupPanel/Panel.scss +3 -3
  38. package/lib/cjs/components-react/toolbar/groupPanel/Title.scss +3 -3
  39. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.scss +3 -3
  40. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts +10 -0
  41. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  42. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +11 -1
  43. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  44. package/lib/cjs/components-react/tree/controlled/component/NodeContent.scss +3 -3
  45. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.d.ts +2 -0
  46. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.d.ts.map +1 -1
  47. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +3 -5
  48. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  49. package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts +13 -0
  50. package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts.map +1 -0
  51. package/lib/esm/components-react/common/UseElementsScrollStorage.js +45 -0
  52. package/lib/esm/components-react/common/UseElementsScrollStorage.js.map +1 -0
  53. package/lib/esm/components-react/datepicker/DatePicker.scss +3 -3
  54. package/lib/esm/components-react/datepicker/DatePickerPopupButton.scss +3 -3
  55. package/lib/esm/components-react/datepicker/TimeField.scss +3 -3
  56. package/lib/esm/components-react/editors/BooleanEditor.scss +3 -3
  57. package/lib/esm/components-react/editors/EnumButtonGroupEditor.scss +3 -3
  58. package/lib/esm/components-react/editors/IconEditor.scss +3 -3
  59. package/lib/esm/components-react/editors/ImageCheckBoxEditor.scss +3 -3
  60. package/lib/esm/components-react/editors/PopupButton.scss +3 -3
  61. package/lib/esm/components-react/editors/ToggleEditor.scss +3 -3
  62. package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +3 -3
  63. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -3
  64. package/lib/esm/components-react/filtering/ResultSelector.scss +3 -3
  65. package/lib/esm/components-react/iconpicker/IconPickerButton.scss +3 -3
  66. package/lib/esm/components-react/properties/renderers/ActionButtonList.scss +3 -3
  67. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +3 -3
  68. package/lib/esm/components-react/properties/renderers/PropertyView.scss +3 -3
  69. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.scss +3 -3
  70. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +10 -0
  71. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  72. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +9 -0
  73. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  74. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -3
  75. package/lib/esm/components-react/selectable-content/SelectableContent.scss +3 -3
  76. package/lib/esm/components-react/toolbar/ItemWrapper.scss +3 -3
  77. package/lib/esm/components-react/toolbar/Items.scss +3 -3
  78. package/lib/esm/components-react/toolbar/Overflow.scss +3 -3
  79. package/lib/esm/components-react/toolbar/OverflowPanel.scss +3 -3
  80. package/lib/esm/components-react/toolbar/PopupItem.scss +3 -3
  81. package/lib/esm/components-react/toolbar/_variables.scss +3 -3
  82. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.scss +3 -3
  83. package/lib/esm/components-react/toolbar/groupPanel/Column.scss +3 -3
  84. package/lib/esm/components-react/toolbar/groupPanel/Columns.scss +3 -3
  85. package/lib/esm/components-react/toolbar/groupPanel/Panel.scss +3 -3
  86. package/lib/esm/components-react/toolbar/groupPanel/Title.scss +3 -3
  87. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.scss +3 -3
  88. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts +10 -0
  89. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  90. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +9 -0
  91. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  92. package/lib/esm/components-react/tree/controlled/component/NodeContent.scss +3 -3
  93. package/lib/esm/components-react/tree/controlled/internal/SparseTree.d.ts +2 -0
  94. package/lib/esm/components-react/tree/controlled/internal/SparseTree.d.ts.map +1 -1
  95. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +3 -5
  96. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  97. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "variables";
6
6
 
7
7
  .components-toolbar-overflow-panel {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/z-index";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/geometry";
7
7
  @import "variables";
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/style/index";
6
6
 
7
7
  $components-desktop-item-width: 40px;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @use "sass:math";
6
6
  @import "../../target";
7
7
  @import "variables";
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  .components-toolbar-item-expandable-group-column {
6
6
  > *:not(:last-child) {
7
7
  margin-bottom: 9px;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  .components-toolbar-item-expandable-group-columns {
6
6
  display: grid;
7
7
  grid-auto-columns: 1fr;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "variables";
6
6
 
7
7
  .components-toolbar-item-expandable-group-panel {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "variables";
6
6
 
7
7
  .components-toolbar-item-expandable-group-title {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "../../../target";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/typography";
7
7
  @import "variables";
@@ -55,4 +55,14 @@ export interface ControlledTreeProps extends CommonProps {
55
55
  * @public
56
56
  */
57
57
  export declare function ControlledTree(props: ControlledTreeProps): JSX.Element;
58
+ /**
59
+ * Returns callbacks for persisting and restoring [[ControlledTree]] layout state.
60
+ * Returned `ref` should be set on container containing ControlledTree.
61
+ * @public
62
+ */
63
+ export declare function useControlledTreeLayoutStorage<T extends Element>(): {
64
+ ref: React.Ref<T>;
65
+ persist: () => void;
66
+ restore: () => void;
67
+ };
58
68
  //# sourceMappingURL=ControlledTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledTree.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACV,SAAS,EAIV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG5E;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,oCAAoC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,iEAAiE;IACjE,UAAU,EAAE,eAAe,CAAC;IAC5B,2BAA2B;IAC3B,aAAa,EAAE,UAAU,CAAC;IAC1B,wCAAwC;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IAC/C,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC;IAChE,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC3C,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC1C,kEAAkE;IAClE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqDxD"}
1
+ {"version":3,"file":"ControlledTree.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACV,SAAS,EAIV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAI5E;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,oCAAoC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,iEAAiE;IACjE,UAAU,EAAE,eAAe,CAAC;IAC5B,2BAA2B;IAC3B,aAAa,EAAE,UAAU,CAAC;IAC1B,wCAAwC;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IAC/C,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC;IAChE,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC3C,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC1C,kEAAkE;IAClE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqDxD;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,OAAO;;;;EAE/D"}
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  return result;
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.ControlledTree = void 0;
33
+ exports.useControlledTreeLayoutStorage = exports.ControlledTree = void 0;
34
34
  const React = __importStar(require("react"));
35
35
  const core_react_1 = require("@itwin/core-react");
36
36
  const DelayedSpinner_1 = require("../../../common/DelayedSpinner");
@@ -40,6 +40,7 @@ const TreeEventDispatcher_1 = require("../TreeEventDispatcher");
40
40
  const TreeModel_1 = require("../TreeModel");
41
41
  const TreeNodeRenderer_1 = require("./TreeNodeRenderer");
42
42
  const TreeRenderer_1 = require("./TreeRenderer");
43
+ const UseElementsScrollStorage_1 = require("../../../common/UseElementsScrollStorage");
43
44
  /**
44
45
  * React tree component which rendering is fully controlled from outside.
45
46
  * @public
@@ -66,6 +67,15 @@ function ControlledTree(props) {
66
67
  return (React.createElement(Loader, { loading: loading, noData: noData, spinnerRenderer: props.spinnerRenderer, noDataRenderer: props.noDataRenderer }, props.treeRenderer ? (props.treeRenderer(treeProps)) : (React.createElement(TreeRenderer_1.TreeRenderer, { ...treeProps }))));
67
68
  }
68
69
  exports.ControlledTree = ControlledTree;
70
+ /**
71
+ * Returns callbacks for persisting and restoring [[ControlledTree]] layout state.
72
+ * Returned `ref` should be set on container containing ControlledTree.
73
+ * @public
74
+ */
75
+ function useControlledTreeLayoutStorage() {
76
+ return (0, UseElementsScrollStorage_1.useElementsScrollStorage)("ReactWindow__VariableSizeList");
77
+ }
78
+ exports.useControlledTreeLayoutStorage = useControlledTreeLayoutStorage;
69
79
  function useRootNodeLoader(visibleNodes, nodeLoader) {
70
80
  React.useEffect(() => {
71
81
  if (visibleNodes.getNumRootNodes() === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledTree.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAAiD;AACjD,mEAAgE;AAEhE,wDAAqD;AAErD,mDAAoD;AACpD,gEAA6D;AAQ7D,4CAAoE;AAGpE,yDAAsD;AAEtD,iDAA8C;AA4C9C;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,UAAU,GAAG,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F,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAe,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;IACnD,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;IAEvC,OAAO,eAAe,CAAC;AACzB,CAAC;AAUD,SAAS,MAAM,CAAC,KAAkB;IAChC,IAAI,KAAK,CAAC,OAAO,EAAE;QACjB,OAAO,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAC7B,KAAK,CAAC,eAAe,EAAE,CACxB,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,kCAAkC;YAC/C,oBAAC,+BAAc,IAAC,IAAI,EAAC,OAAO,GAAG,CAC3B,CACP,CAAC;KACH;IACD,IAAI,KAAK,CAAC,MAAM,EAAE;QAChB,OAAO,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAC5B,KAAK,CAAC,cAAc,EAAE,CACvB,CAAC,CAAC,CAAC,CACF,oBAAC,yBAAY;YACX,2BAAG,SAAS,EAAC,wCAAwC,IAClD,2BAAY,CAAC,SAAS,CAAC,gBAAgB,CAAC,CACvC,CACS,CAChB,CAAC;KACH;IAED,OAAO,KAAK,CAAC,QAAQ,CAAC;AACxB,CAAC;AAED,SAAS,aAAa,CACpB,mBAA4B;IAE5B,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,IAA8C,EAAU,EAAE;QACzD,MAAM,aAAa,GACjB,IAAA,2BAAe,EAAC,IAAI,CAAC,IAAI,mBAAmB,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW;YACtE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,uFAAuF;QACvF,OAAO,aAAa,GAAG,UAAU,CAAC;IACpC,CAAC,EACD,CAAC,mBAAmB,CAAC,CACtB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tree\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { FillCentered } from \"@itwin/core-react\";\nimport { DelayedSpinner } from \"../../../common/DelayedSpinner\";\nimport type { SelectionMode } from \"../../../common/selection/SelectionModes\";\nimport { UiComponents } from \"../../../UiComponents\";\nimport type { HighlightableTreeProps } from \"../../HighlightingEngine\";\nimport { TreeImageLoader } from \"../../ImageLoader\";\nimport { TreeEventDispatcher } from \"../TreeEventDispatcher\";\nimport type { TreeEvents } from \"../TreeEvents\";\nimport type {\n TreeModel,\n TreeModelNode,\n TreeModelNodePlaceholder,\n VisibleTreeNodes,\n} from \"../TreeModel\";\nimport { computeVisibleNodes, isTreeModelNode } from \"../TreeModel\";\nimport type { ITreeNodeLoader } from \"../TreeNodeLoader\";\nimport type { TreeNodeRendererProps } from \"./TreeNodeRenderer\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer\";\nimport type { RenderedItemsRange, TreeRendererProps } from \"./TreeRenderer\";\nimport { TreeRenderer } from \"./TreeRenderer\";\n\n/**\n * Properties for [[ControlledTree]]\n * @public\n */\nexport interface ControlledTreeProps extends CommonProps {\n /** Model of the tree to display. */\n model: TreeModel;\n /** Node loader used to load root nodes and placeholder nodes. */\n nodeLoader: ITreeNodeLoader;\n /** Tree events handler. */\n eventsHandler: TreeEvents;\n /** Mode of nodes' selection in tree. */\n selectionMode: SelectionMode;\n /**\n * Specifies whether to show node description or not. It is used in default node renderer and to determine node height.\n * If custom node renderer and node height callbacks are used it does nothing.\n */\n descriptionsEnabled?: boolean;\n /**\n * Specifies whether to show node icon or not. It is used in default node renderer.\n * If custom node renderer is used it does nothing.\n */\n iconsEnabled?: boolean;\n /**\n * Used to highlight matches when filtering tree.\n * It is passed to treeRenderer.\n */\n nodeHighlightingProps?: HighlightableTreeProps;\n /** Custom renderer to be used to render a tree. */\n treeRenderer?: (props: TreeRendererProps) => React.ReactElement;\n /** Custom renderer to be used while root nodes is loading. */\n spinnerRenderer?: () => React.ReactElement;\n /** Custom renderer to be used when there is no data to show in tree. */\n noDataRenderer?: () => React.ReactElement;\n /** Callback that is invoked when rendered items range changes. */\n onItemsRendered?: (items: RenderedItemsRange) => void;\n /** Width of the tree renderer. */\n width: number;\n /** Height of the tree renderer. */\n height: number;\n}\n\n/**\n * React tree component which rendering is fully controlled from outside.\n * @public\n */\nexport function ControlledTree(props: ControlledTreeProps) {\n const nodeHeight = useNodeHeight(!!props.descriptionsEnabled);\n const imageLoader = React.useMemo(() => new TreeImageLoader(), []);\n const nodeRenderer = React.useCallback(\n (nodeProps: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...nodeProps}\n descriptionEnabled={props.descriptionsEnabled}\n imageLoader={props.iconsEnabled ? imageLoader : undefined}\n />\n ),\n [props.descriptionsEnabled, props.iconsEnabled, imageLoader]\n );\n\n const visibleNodes = React.useMemo(\n () => computeVisibleNodes(props.model),\n [props.model]\n );\n const eventDispatcher = useEventDispatcher(\n props.nodeLoader,\n props.eventsHandler,\n props.selectionMode,\n visibleNodes\n );\n\n const treeProps: TreeRendererProps = {\n nodeRenderer,\n nodeHeight,\n visibleNodes,\n treeActions: eventDispatcher,\n nodeLoader: props.nodeLoader,\n nodeHighlightingProps: props.nodeHighlightingProps,\n onItemsRendered: props.onItemsRendered,\n width: props.width,\n height: props.height,\n };\n\n const loading = useRootNodeLoader(visibleNodes, props.nodeLoader);\n const noData = visibleNodes.getNumRootNodes() === 0;\n return (\n <Loader\n loading={loading}\n noData={noData}\n spinnerRenderer={props.spinnerRenderer}\n noDataRenderer={props.noDataRenderer}\n >\n {props.treeRenderer ? (\n props.treeRenderer(treeProps)\n ) : (\n <TreeRenderer {...treeProps} />\n )}\n </Loader>\n );\n}\n\nfunction useRootNodeLoader(\n visibleNodes: VisibleTreeNodes,\n nodeLoader: ITreeNodeLoader\n): boolean {\n React.useEffect(() => {\n if (visibleNodes.getNumRootNodes() === undefined) {\n const subscription = nodeLoader\n .loadNode(visibleNodes.getModel().getRootNode(), 0)\n .subscribe();\n return () => subscription.unsubscribe();\n }\n\n return () => {};\n }, [visibleNodes, nodeLoader]);\n\n return visibleNodes.getNumRootNodes() === undefined;\n}\n\nfunction useEventDispatcher(\n nodeLoader: ITreeNodeLoader,\n treeEvents: TreeEvents,\n selectionMode: SelectionMode,\n visibleNodes: VisibleTreeNodes\n) {\n /* istanbul ignore next */\n const getVisibleNodes = React.useCallback(() => visibleNodes, [visibleNodes]);\n const eventDispatcher = React.useMemo(\n () => new TreeEventDispatcher(treeEvents, nodeLoader, selectionMode),\n [treeEvents, nodeLoader, selectionMode]\n );\n\n React.useEffect(() => {\n eventDispatcher.setVisibleNodes(getVisibleNodes);\n }, [eventDispatcher, getVisibleNodes]);\n\n return eventDispatcher;\n}\n\ninterface LoaderProps {\n loading: boolean;\n noData: boolean;\n spinnerRenderer?: () => React.ReactElement;\n noDataRenderer?: () => React.ReactElement;\n children: React.ReactElement;\n}\n\nfunction Loader(props: LoaderProps) {\n if (props.loading) {\n return props.spinnerRenderer ? (\n props.spinnerRenderer()\n ) : (\n <div className=\"components-controlledTree-loader\">\n <DelayedSpinner size=\"large\" />\n </div>\n );\n }\n if (props.noData) {\n return props.noDataRenderer ? (\n props.noDataRenderer()\n ) : (\n <FillCentered>\n <p className=\"components-controlledTree-errorMessage\">\n {UiComponents.translate(\"general.noData\")}\n </p>\n </FillCentered>\n );\n }\n\n return props.children;\n}\n\nfunction useNodeHeight(\n descriptionsEnabled: boolean\n): (node: TreeModelNode | TreeModelNodePlaceholder) => number {\n return React.useCallback(\n (node: TreeModelNode | TreeModelNodePlaceholder): number => {\n const contentHeight =\n isTreeModelNode(node) && descriptionsEnabled && node && node.description\n ? 43\n : 24;\n const borderSize = 1;\n // Not counting node's border size twice because we want neighboring borders to overlap\n return contentHeight + borderSize;\n },\n [descriptionsEnabled]\n );\n}\n"]}
1
+ {"version":3,"file":"ControlledTree.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAAiD;AACjD,mEAAgE;AAEhE,wDAAqD;AAErD,mDAAoD;AACpD,gEAA6D;AAQ7D,4CAAoE;AAGpE,yDAAsD;AAEtD,iDAA8C;AAC9C,uFAAoF;AA4CpF;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,6BAAe,EAAE,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CACpC,CAAC,SAAgC,EAAE,EAAE,CAAC,CACpC,oBAAC,mCAAgB,OACX,SAAS,EACb,kBAAkB,EAAE,KAAK,CAAC,mBAAmB,EAC7C,WAAW,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,GACzD,CACH,EACD,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,YAAY,EAAE,WAAW,CAAC,CAC7D,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CAAC,IAAA,+BAAmB,EAAC,KAAK,CAAC,KAAK,CAAC,EACtC,CAAC,KAAK,CAAC,KAAK,CAAC,CACd,CAAC;IACF,MAAM,eAAe,GAAG,kBAAkB,CACxC,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,aAAa,EACnB,YAAY,CACb,CAAC;IAEF,MAAM,SAAS,GAAsB;QACnC,YAAY;QACZ,UAAU;QACV,YAAY;QAC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O,KAAK,CAAC,QAAQ,CAAC;AACxB,CAAC;AAED,SAAS,aAAa,CACpB,mBAA4B;IAE5B,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,IAA8C,EAAU,EAAE;QACzD,MAAM,aAAa,GACjB,IAAA,2BAAe,EAAC,IAAI,CAAC,IAAI,mBAAmB,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW;YACtE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,uFAAuF;QACvF,OAAO,aAAa,GAAG,UAAU,CAAC;IACpC,CAAC,EACD,CAAC,mBAAmB,CAAC,CACtB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tree\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { FillCentered } from \"@itwin/core-react\";\nimport { DelayedSpinner } from \"../../../common/DelayedSpinner\";\nimport type { SelectionMode } from \"../../../common/selection/SelectionModes\";\nimport { UiComponents } from \"../../../UiComponents\";\nimport type { HighlightableTreeProps } from \"../../HighlightingEngine\";\nimport { TreeImageLoader } from \"../../ImageLoader\";\nimport { TreeEventDispatcher } from \"../TreeEventDispatcher\";\nimport type { TreeEvents } from \"../TreeEvents\";\nimport type {\n TreeModel,\n TreeModelNode,\n TreeModelNodePlaceholder,\n VisibleTreeNodes,\n} from \"../TreeModel\";\nimport { computeVisibleNodes, isTreeModelNode } from \"../TreeModel\";\nimport type { ITreeNodeLoader } from \"../TreeNodeLoader\";\nimport type { TreeNodeRendererProps } from \"./TreeNodeRenderer\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer\";\nimport type { RenderedItemsRange, TreeRendererProps } from \"./TreeRenderer\";\nimport { TreeRenderer } from \"./TreeRenderer\";\nimport { useElementsScrollStorage } from \"../../../common/UseElementsScrollStorage\";\n\n/**\n * Properties for [[ControlledTree]]\n * @public\n */\nexport interface ControlledTreeProps extends CommonProps {\n /** Model of the tree to display. */\n model: TreeModel;\n /** Node loader used to load root nodes and placeholder nodes. */\n nodeLoader: ITreeNodeLoader;\n /** Tree events handler. */\n eventsHandler: TreeEvents;\n /** Mode of nodes' selection in tree. */\n selectionMode: SelectionMode;\n /**\n * Specifies whether to show node description or not. It is used in default node renderer and to determine node height.\n * If custom node renderer and node height callbacks are used it does nothing.\n */\n descriptionsEnabled?: boolean;\n /**\n * Specifies whether to show node icon or not. It is used in default node renderer.\n * If custom node renderer is used it does nothing.\n */\n iconsEnabled?: boolean;\n /**\n * Used to highlight matches when filtering tree.\n * It is passed to treeRenderer.\n */\n nodeHighlightingProps?: HighlightableTreeProps;\n /** Custom renderer to be used to render a tree. */\n treeRenderer?: (props: TreeRendererProps) => React.ReactElement;\n /** Custom renderer to be used while root nodes is loading. */\n spinnerRenderer?: () => React.ReactElement;\n /** Custom renderer to be used when there is no data to show in tree. */\n noDataRenderer?: () => React.ReactElement;\n /** Callback that is invoked when rendered items range changes. */\n onItemsRendered?: (items: RenderedItemsRange) => void;\n /** Width of the tree renderer. */\n width: number;\n /** Height of the tree renderer. */\n height: number;\n}\n\n/**\n * React tree component which rendering is fully controlled from outside.\n * @public\n */\nexport function ControlledTree(props: ControlledTreeProps) {\n const nodeHeight = useNodeHeight(!!props.descriptionsEnabled);\n const imageLoader = React.useMemo(() => new TreeImageLoader(), []);\n const nodeRenderer = React.useCallback(\n (nodeProps: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...nodeProps}\n descriptionEnabled={props.descriptionsEnabled}\n imageLoader={props.iconsEnabled ? imageLoader : undefined}\n />\n ),\n [props.descriptionsEnabled, props.iconsEnabled, imageLoader]\n );\n\n const visibleNodes = React.useMemo(\n () => computeVisibleNodes(props.model),\n [props.model]\n );\n const eventDispatcher = useEventDispatcher(\n props.nodeLoader,\n props.eventsHandler,\n props.selectionMode,\n visibleNodes\n );\n\n const treeProps: TreeRendererProps = {\n nodeRenderer,\n nodeHeight,\n visibleNodes,\n treeActions: eventDispatcher,\n nodeLoader: props.nodeLoader,\n nodeHighlightingProps: props.nodeHighlightingProps,\n onItemsRendered: props.onItemsRendered,\n width: props.width,\n height: props.height,\n };\n\n const loading = useRootNodeLoader(visibleNodes, props.nodeLoader);\n const noData = visibleNodes.getNumRootNodes() === 0;\n return (\n <Loader\n loading={loading}\n noData={noData}\n spinnerRenderer={props.spinnerRenderer}\n noDataRenderer={props.noDataRenderer}\n >\n {props.treeRenderer ? (\n props.treeRenderer(treeProps)\n ) : (\n <TreeRenderer {...treeProps} />\n )}\n </Loader>\n );\n}\n\n/**\n * Returns callbacks for persisting and restoring [[ControlledTree]] layout state.\n * Returned `ref` should be set on container containing ControlledTree.\n * @public\n */\nexport function useControlledTreeLayoutStorage<T extends Element>() {\n return useElementsScrollStorage<T>(\"ReactWindow__VariableSizeList\");\n}\n\nfunction useRootNodeLoader(\n visibleNodes: VisibleTreeNodes,\n nodeLoader: ITreeNodeLoader\n): boolean {\n React.useEffect(() => {\n if (visibleNodes.getNumRootNodes() === undefined) {\n const subscription = nodeLoader\n .loadNode(visibleNodes.getModel().getRootNode(), 0)\n .subscribe();\n return () => subscription.unsubscribe();\n }\n\n return () => {};\n }, [visibleNodes, nodeLoader]);\n\n return visibleNodes.getNumRootNodes() === undefined;\n}\n\nfunction useEventDispatcher(\n nodeLoader: ITreeNodeLoader,\n treeEvents: TreeEvents,\n selectionMode: SelectionMode,\n visibleNodes: VisibleTreeNodes\n) {\n /* istanbul ignore next */\n const getVisibleNodes = React.useCallback(() => visibleNodes, [visibleNodes]);\n const eventDispatcher = React.useMemo(\n () => new TreeEventDispatcher(treeEvents, nodeLoader, selectionMode),\n [treeEvents, nodeLoader, selectionMode]\n );\n\n React.useEffect(() => {\n eventDispatcher.setVisibleNodes(getVisibleNodes);\n }, [eventDispatcher, getVisibleNodes]);\n\n return eventDispatcher;\n}\n\ninterface LoaderProps {\n loading: boolean;\n noData: boolean;\n spinnerRenderer?: () => React.ReactElement;\n noDataRenderer?: () => React.ReactElement;\n children: React.ReactElement;\n}\n\nfunction Loader(props: LoaderProps) {\n if (props.loading) {\n return props.spinnerRenderer ? (\n props.spinnerRenderer()\n ) : (\n <div className=\"components-controlledTree-loader\">\n <DelayedSpinner size=\"large\" />\n </div>\n );\n }\n if (props.noData) {\n return props.noDataRenderer ? (\n props.noDataRenderer()\n ) : (\n <FillCentered>\n <p className=\"components-controlledTree-errorMessage\">\n {UiComponents.translate(\"general.noData\")}\n </p>\n </FillCentered>\n );\n }\n\n return props.children;\n}\n\nfunction useNodeHeight(\n descriptionsEnabled: boolean\n): (node: TreeModelNode | TreeModelNodePlaceholder) => number {\n return React.useCallback(\n (node: TreeModelNode | TreeModelNodePlaceholder): number => {\n const contentHeight =\n isTreeModelNode(node) && descriptionsEnabled && node && node.description\n ? 43\n : 24;\n const borderSize = 1;\n // Not counting node's border size twice because we want neighboring borders to overlap\n return contentHeight + borderSize;\n },\n [descriptionsEnabled]\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .components-controlledTree-node-description {
7
7
  color: var(--iui-color-text-muted);
@@ -17,6 +17,7 @@ export declare class SparseTree<T extends Node> {
17
17
  private _rootNodes;
18
18
  private _parentToChildren;
19
19
  private _idToNode;
20
+ constructor();
20
21
  getNode(nodeId: string): T | undefined;
21
22
  getChildOffset(parentId: string | undefined, childId: string): number | undefined;
22
23
  getChildren(parentId: string | undefined, createIfNotExist?: boolean): SparseArray<string> | undefined;
@@ -39,6 +40,7 @@ export declare class SparseArray<T> implements Iterable<T | undefined> {
39
40
  [immerable]: boolean;
40
41
  private _length;
41
42
  private _array;
43
+ constructor();
42
44
  /** Returns length of array including intermediate 'undefined' values */
43
45
  getLength(): number;
44
46
  /** Sets length of array. */
@@ -1 +1 @@
1
- {"version":3,"file":"SparseTree.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/internal/SparseTree.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,gBAAgB;AAChB,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,qBAAa,UAAU,CAAC,CAAC,SAAS,IAAI;IAC7B,CAAC,SAAS,CAAC,UAAQ;IAE1B,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,iBAAiB,CAA2C;IACpE,OAAO,CAAC,SAAS,CAAyB;IAEnC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAItC,cAAc,CACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS;IAOd,WAAW,CAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,gBAAgB,GAAE,OAAe,GAChC,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS;IAY3B,WAAW,CAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,CAAC,EAAE,EACb,MAAM,EAAE,MAAM;IAcT,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM;IAMlE,SAAS,CACd,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO;IA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B3D,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,MAAM,CAAC,OAAO;CAGvB"}
1
+ {"version":3,"file":"SparseTree.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/internal/SparseTree.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,gBAAgB;AAChB,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,qBAAa,UAAU,CAAC,CAAC,SAAS,IAAI;IAC7B,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE5B,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,iBAAiB,CAA2C;IACpE,OAAO,CAAC,SAAS,CAAyB;;IAMnC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAItC,cAAc,CACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS;IAOd,WAAW,CAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,gBAAgB,GAAE,OAAe,GAChC,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS;IAY3B,WAAW,CAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,CAAC,EAAE,EACb,MAAM,EAAE,MAAM;IAcT,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM;IAMlE,SAAS,CACd,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO;IA6BH,QAAQ,CACb,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,WAAW,E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
7
7
  * @module Tree
8
8
  */
9
- var _a, _b;
10
9
  Object.defineProperty(exports, "__esModule", { value: true });
11
10
  exports.SparseArray = exports.SparseTree = void 0;
12
11
  const immer_1 = require("immer");
@@ -19,10 +18,10 @@ const core_bentley_1 = require("@itwin/core-bentley");
19
18
  */
20
19
  class SparseTree {
21
20
  constructor() {
22
- this[_a] = true;
23
21
  this._rootNodes = new SparseArray();
24
22
  this._parentToChildren = {};
25
23
  this._idToNode = {};
24
+ this[immer_1.immerable] = true;
26
25
  }
27
26
  getNode(nodeId) {
28
27
  return this._idToNode[nodeId];
@@ -138,7 +137,6 @@ class SparseTree {
138
137
  }
139
138
  }
140
139
  exports.SparseTree = SparseTree;
141
- _a = immer_1.immerable;
142
140
  /**
143
141
  * Structure for sparse array value storage.
144
142
  * The main advantage of this class over the standard javascript array is that
@@ -148,9 +146,9 @@ _a = immer_1.immerable;
148
146
  */
149
147
  class SparseArray {
150
148
  constructor() {
151
- this[_b] = true;
152
149
  this._length = 0;
153
150
  this._array = [];
151
+ this[immer_1.immerable] = true;
154
152
  }
155
153
  /** Returns length of array including intermediate 'undefined' values */
156
154
  getLength() {
@@ -216,7 +214,7 @@ class SparseArray {
216
214
  return this._array[Symbol.iterator]();
217
215
  }
218
216
  /** Iterates the array with all intermediate `undefined` values */
219
- [(_b = immer_1.immerable, Symbol.iterator)]() {
217
+ [Symbol.iterator]() {
220
218
  const array = this._array;
221
219
  const length = this._length;
222
220
  return (function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"SparseTree.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/internal/SparseTree.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;AAEH,iCAAkC;AAClC,sDAAyE;AAOzE;;;;;GAKG;AACH,MAAa,UAAU;IAAvB;QACS,QAAW,GAAG,IAAI,CAAC;QAElB,eAAU,GAAG,IAAI,WAAW,EAAU,CAAC;QACvC,sBAAiB,GAAwC,EAAE,CAAC;QAC5D,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CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,CAAC;IAED,kEAAkE;IAC3D,OAjFC,iBAAS,EAiFT,MAAM,CAAC,QAAQ,EAAC;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,YAAY,GAAG,CAAC,CAAC;YACrB,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,KAAK,EAAE;gBAClC,OAAO,YAAY,GAAG,KAAK,EAAE,EAAE,YAAY,EAAE;oBAC3C,MAAM,SAAS,CAAC;iBACjB;gBAED,MAAM,KAAK,CAAC;gBACZ,EAAE,YAAY,CAAC;aAChB;YAED,OAAO,YAAY,GAAG,MAAM,EAAE,EAAE,YAAY,EAAE;gBAC5C,MAAM,SAAS,CAAC;aACjB;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;IAEO,UAAU,CAAC,KAAa;QAI9B,OAAO,IAAA,yBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;IAEO,MAAM,CAAC,OAAO,CAAI,KAAa,EAAE,KAAkB;QACzD,OAAO,IAAA,6BAAc,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;CACF;AAhHD,kCAgHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tree\n */\n\nimport { immerable } from \"immer\";\nimport { assert, compareNumbers, lowerBound } from \"@itwin/core-bentley\";\n\n/** @internal */\nexport interface Node {\n readonly id: string;\n}\n\n/**\n * Structure for sparse tree storage.\n * It uses SparseArray to store children ids for parent. This allows\n * having tree structure with some nodes missing in the tree branch.\n * @internal\n */\nexport class SparseTree<T extends Node> {\n public [immerable] = true;\n\n private _rootNodes = new SparseArray<string>();\n private _parentToChildren: Record<string, SparseArray<string>> = {};\n private _idToNode: Record<string, T> = {};\n\n public getNode(nodeId: string): T | undefined {\n return this._idToNode[nodeId];\n }\n\n public getChildOffset(\n parentId: string | undefined,\n childId: string\n ): number | undefined {\n const children = this.getChildren(parentId);\n if (!children) return undefined;\n\n return children.getIndex(childId);\n }\n\n public getChildren(\n parentId: string | undefined,\n createIfNotExist: boolean = false\n ): SparseArray<string> | undefined {\n if (parentId === undefined) {\n return this._rootNodes;\n }\n\n if (this._parentToChildren[parentId] === undefined && createIfNotExist) {\n this._parentToChildren[parentId] = new SparseArray<string>();\n }\n\n return this._parentToChildren[parentId];\n }\n\n public setChildren(\n parentId: string | undefined,\n children: T[],\n offset: number\n ) {\n const existingChildren = this.getChildren(parentId, true)!;\n children.forEach((child, index) => {\n const existingChildId = existingChildren.get(offset + index);\n if (existingChildId !== undefined) {\n this.deleteSubtree(existingChildId);\n }\n\n existingChildren.set(offset + index, child.id);\n this._idToNode[child.id] = child;\n });\n }\n\n public insertChild(parentId: string | undefined, child: T, offset: number) {\n const existingChildren = this.getChildren(parentId, true)!;\n existingChildren.insert(offset, child.id);\n this._idToNode[child.id] = child;\n }\n\n public setNodeId(\n parentId: string | undefined,\n index: number,\n newId: string\n ): boolean {\n const previousNodeId = this.getChildren(parentId)?.get(index);\n if (previousNodeId === undefined) {\n return false;\n }\n\n if (previousNodeId === newId) {\n return true;\n }\n\n if (this.getNode(newId) !== undefined) {\n return false;\n }\n\n this._idToNode[newId] = this._idToNode[previousNodeId];\n delete this._idToNode[previousNodeId];\n\n this._parentToChildren[newId] = this._parentToChildren[previousNodeId];\n delete this._parentToChildren[previousNodeId];\n\n if (parentId === undefined) {\n this._rootNodes.set(index, newId);\n } else {\n this._parentToChildren[parentId].set(index, newId);\n }\n\n return true;\n }\n\n public moveNode(\n sourceParentId: string | undefined,\n sourceNodeId: string,\n targetParentId: string | undefined,\n targetIndex: number\n ): void {\n const sourceNodeSiblings = this.getChildren(sourceParentId);\n assert(sourceNodeSiblings !== undefined);\n\n const sourceIndex = this.getChildOffset(sourceParentId, sourceNodeId);\n assert(sourceIndex !== undefined);\n\n sourceNodeSiblings.remove(sourceIndex);\n if (targetParentId === sourceParentId && targetIndex > sourceIndex) {\n targetIndex -= 1;\n }\n\n const targetNodeSiblings = this.getChildren(targetParentId, true);\n assert(targetNodeSiblings !== undefined);\n targetNodeSiblings.insert(targetIndex, sourceNodeId);\n }\n\n public setNumChildren(parentId: string | undefined, numChildren: number) {\n const children = this.getChildren(parentId, true)!;\n for (const [childId] of children.iterateValues()) {\n this.deleteSubtree(childId);\n }\n\n children.setLength(numChildren);\n }\n\n public removeChild(\n parentId: string | undefined,\n child: string | number\n ): void {\n const children = this.getChildren(parentId);\n if (children === undefined) return;\n\n if (typeof child === \"string\") {\n const childIndex = children.getIndex(child);\n if (childIndex !== undefined) {\n children.remove(childIndex);\n }\n\n this.deleteSubtree(child);\n } else {\n const childId = children.get(child);\n children.remove(child);\n if (childId !== undefined) {\n this.deleteSubtree(childId);\n }\n }\n }\n\n public deleteSubtree(\n parentId: string | undefined,\n deleteParent: boolean = true\n ) {\n const children = this.getChildren(parentId);\n if (children !== undefined) {\n for (const [childId] of children.iterateValues()) {\n this.deleteSubtree(childId);\n }\n }\n\n if (parentId === undefined) {\n this._rootNodes.setLength(0);\n return;\n }\n if (deleteParent) {\n delete this._idToNode[parentId];\n }\n delete this._parentToChildren[parentId];\n }\n}\n\n/**\n * Structure for sparse array value storage.\n * The main advantage of this class over the standard javascript array is that\n * this class does not need to check each index when iterating values that are\n * stored in the array.\n * @public\n */\nexport class SparseArray<T> implements Iterable<T | undefined> {\n public [immerable] = true;\n\n private _length = 0;\n private _array: Array<[T, number]> = [];\n\n /** Returns length of array including intermediate 'undefined' values */\n public getLength(): number {\n return this._length;\n }\n\n /** Sets length of array. */\n public setLength(length: number) {\n const { index } = this.lowerBound(length);\n this._array.length = index;\n this._length = length;\n }\n\n /** Returns index of supplied value.\n *\n * @returns index of value or undefined if value is not found.\n */\n public getIndex(lookupValue: T): number | undefined {\n for (const [value, index] of this._array) {\n if (value === lookupValue) return index;\n }\n return undefined;\n }\n\n /** Returns value at specific position.\n *\n * @returns stored value or undefined.\n */\n public get(index: number): T | undefined {\n const { index: i, equal } = this.lowerBound(index);\n return equal ? this._array[i][0] : undefined;\n }\n\n /** Sets value at specific position. Overrides any existing value. */\n public set(index: number, value: T) {\n const { index: i, equal } = this.lowerBound(index);\n this._array.splice(i, equal ? 1 : 0, [value, index]);\n this._length = Math.max(this._length, index + 1);\n }\n\n /** Inserts value at specific position. Increases array length by one. */\n public insert(index: number, value: T) {\n const { index: i } = this.lowerBound(index);\n this._array.splice(i, 0, [value, index]);\n\n for (let j = i + 1; j < this._array.length; j++) {\n this._array[j][1]++;\n }\n\n this._length = Math.max(this._length + 1, index + 1);\n }\n\n /** Removes value at specified index and reduces array length by one. */\n public remove(index: number): void {\n if (index >= this._length) {\n return;\n }\n\n const { index: i, equal } = this.lowerBound(index);\n this._array.splice(i, equal ? 1 : 0);\n\n for (let j = i; j < this._array.length; j++) {\n this._array[j][1]--;\n }\n\n this._length = Math.max(0, this._length - 1);\n }\n\n /**\n * Iterates values that are stored in the array\n * @returns `[value, index]` tuples.\n */\n public iterateValues(): IterableIterator<[T, number]> {\n return this._array[Symbol.iterator]();\n }\n\n /** Iterates the array with all intermediate `undefined` values */\n public [Symbol.iterator](): IterableIterator<T | undefined> {\n const array = this._array;\n const length = this._length;\n return (function* () {\n let currentIndex = 0;\n for (const [value, index] of array) {\n for (; currentIndex < index; ++currentIndex) {\n yield undefined;\n }\n\n yield value;\n ++currentIndex;\n }\n\n for (; currentIndex < length; ++currentIndex) {\n yield undefined;\n }\n })();\n }\n\n private lowerBound(index: number): {\n index: number;\n equal: boolean;\n } {\n return lowerBound(index, this._array, SparseArray.compare);\n }\n\n private static compare<T>(index: number, value: [T, number]): number {\n return compareNumbers(index, value[1]);\n }\n}\n"]}
1
+ {"version":3,"file":"SparseTree.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/internal/SparseTree.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAAkC;AAClC,sDAAyE;AAOzE;;;;;GAKG;AACH,MAAa,UAAU;IAOrB;QAJQ,eAAU,GAAG,IAAI,WAAW,EAAU,CAAC;QACvC,sBAAiB,GAAwC,EAAE,CAAC;QAC5D,cAAS,GAAsB,EAAE,CAAC;QAGxC,IAAI,CAAC,iBAAS,CAAC,GAAG,IAAI,CAAC;IACzB,CAAC;IAEM,OAAO,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAEM,cAAc,CACnB,QAA4B,EAC5B,OAAe;QAEf,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAEhC,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAEM,WAAW,CAChB,QAA4B,EAC5B,mBAA4B,KAAK;QAEjC,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,OAAO,IAAI,CAAC,UAAU,CAAC;SACxB;QAED,IAAI,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,gBAAgB,EAAE;YACtE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,IAAI,WAAW,EAAU,CAAC;SAC9D;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEM,WAAW,CAChB,QAA4B,EAC5B,QAAa,EACb,MAAc;QAEd,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAE,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AAC,CAAC;IACzC,CAAC;CACF;AApHD,kCAoHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tree\n */\n\nimport { immerable } from \"immer\";\nimport { assert, compareNumbers, lowerBound } from \"@itwin/core-bentley\";\n\n/** @internal */\nexport interface Node {\n readonly id: string;\n}\n\n/**\n * Structure for sparse tree storage.\n * It uses SparseArray to store children ids for parent. This allows\n * having tree structure with some nodes missing in the tree branch.\n * @internal\n */\nexport class SparseTree<T extends Node> {\n public [immerable]: boolean;\n\n private _rootNodes = new SparseArray<string>();\n private _parentToChildren: Record<string, SparseArray<string>> = {};\n private _idToNode: Record<string, T> = {};\n\n constructor() {\n this[immerable] = true;\n }\n\n public getNode(nodeId: string): T | undefined {\n return this._idToNode[nodeId];\n }\n\n public getChildOffset(\n parentId: string | undefined,\n childId: string\n ): number | undefined {\n const children = this.getChildren(parentId);\n if (!children) return undefined;\n\n return children.getIndex(childId);\n }\n\n public getChildren(\n parentId: string | undefined,\n createIfNotExist: boolean = false\n ): SparseArray<string> | undefined {\n if (parentId === undefined) {\n return this._rootNodes;\n }\n\n if (this._parentToChildren[parentId] === undefined && createIfNotExist) {\n this._parentToChildren[parentId] = new SparseArray<string>();\n }\n\n return this._parentToChildren[parentId];\n }\n\n public setChildren(\n parentId: string | undefined,\n children: T[],\n offset: number\n ) {\n const existingChildren = this.getChildren(parentId, true)!;\n children.forEach((child, index) => {\n const existingChildId = existingChildren.get(offset + index);\n if (existingChildId !== undefined) {\n this.deleteSubtree(existingChildId);\n }\n\n existingChildren.set(offset + index, child.id);\n this._idToNode[child.id] = child;\n });\n }\n\n public insertChild(parentId: string | undefined, child: T, offset: number) {\n const existingChildren = this.getChildren(parentId, true)!;\n existingChildren.insert(offset, child.id);\n this._idToNode[child.id] = child;\n }\n\n public setNodeId(\n parentId: string | undefined,\n index: number,\n newId: string\n ): boolean {\n const previousNodeId = this.getChildren(parentId)?.get(index);\n if (previousNodeId === undefined) {\n return false;\n }\n\n if (previousNodeId === newId) {\n return true;\n }\n\n if (this.getNode(newId) !== undefined) {\n return false;\n }\n\n this._idToNode[newId] = this._idToNode[previousNodeId];\n delete this._idToNode[previousNodeId];\n\n this._parentToChildren[newId] = this._parentToChildren[previousNodeId];\n delete this._parentToChildren[previousNodeId];\n\n if (parentId === undefined) {\n this._rootNodes.set(index, newId);\n } else {\n this._parentToChildren[parentId].set(index, newId);\n }\n\n return true;\n }\n\n public moveNode(\n sourceParentId: string | undefined,\n sourceNodeId: string,\n targetParentId: string | undefined,\n targetIndex: number\n ): void {\n const sourceNodeSiblings = this.getChildren(sourceParentId);\n assert(sourceNodeSiblings !== undefined);\n\n const sourceIndex = this.getChildOffset(sourceParentId, sourceNodeId);\n assert(sourceIndex !== undefined);\n\n sourceNodeSiblings.remove(sourceIndex);\n if (targetParentId === sourceParentId && targetIndex > sourceIndex) {\n targetIndex -= 1;\n }\n\n const targetNodeSiblings = this.getChildren(targetParentId, true);\n assert(targetNodeSiblings !== undefined);\n targetNodeSiblings.insert(targetIndex, sourceNodeId);\n }\n\n public setNumChildren(parentId: string | undefined, numChildren: number) {\n const children = this.getChildren(parentId, true)!;\n for (const [childId] of children.iterateValues()) {\n this.deleteSubtree(childId);\n }\n\n children.setLength(numChildren);\n }\n\n public removeChild(\n parentId: string | undefined,\n child: string | number\n ): void {\n const children = this.getChildren(parentId);\n if (children === undefined) return;\n\n if (typeof child === \"string\") {\n const childIndex = children.getIndex(child);\n if (childIndex !== undefined) {\n children.remove(childIndex);\n }\n\n this.deleteSubtree(child);\n } else {\n const childId = children.get(child);\n children.remove(child);\n if (childId !== undefined) {\n this.deleteSubtree(childId);\n }\n }\n }\n\n public deleteSubtree(\n parentId: string | undefined,\n deleteParent: boolean = true\n ) {\n const children = this.getChildren(parentId);\n if (children !== undefined) {\n for (const [childId] of children.iterateValues()) {\n this.deleteSubtree(childId);\n }\n }\n\n if (parentId === undefined) {\n this._rootNodes.setLength(0);\n return;\n }\n if (deleteParent) {\n delete this._idToNode[parentId];\n }\n delete this._parentToChildren[parentId];\n }\n}\n\n/**\n * Structure for sparse array value storage.\n * The main advantage of this class over the standard javascript array is that\n * this class does not need to check each index when iterating values that are\n * stored in the array.\n * @public\n */\nexport class SparseArray<T> implements Iterable<T | undefined> {\n public [immerable]: boolean;\n\n private _length = 0;\n private _array: Array<[T, number]> = [];\n\n constructor() {\n this[immerable] = true;\n }\n\n /** Returns length of array including intermediate 'undefined' values */\n public getLength(): number {\n return this._length;\n }\n\n /** Sets length of array. */\n public setLength(length: number) {\n const { index } = this.lowerBound(length);\n this._array.length = index;\n this._length = length;\n }\n\n /** Returns index of supplied value.\n *\n * @returns index of value or undefined if value is not found.\n */\n public getIndex(lookupValue: T): number | undefined {\n for (const [value, index] of this._array) {\n if (value === lookupValue) return index;\n }\n return undefined;\n }\n\n /** Returns value at specific position.\n *\n * @returns stored value or undefined.\n */\n public get(index: number): T | undefined {\n const { index: i, equal } = this.lowerBound(index);\n return equal ? this._array[i][0] : undefined;\n }\n\n /** Sets value at specific position. Overrides any existing value. */\n public set(index: number, value: T) {\n const { index: i, equal } = this.lowerBound(index);\n this._array.splice(i, equal ? 1 : 0, [value, index]);\n this._length = Math.max(this._length, index + 1);\n }\n\n /** Inserts value at specific position. Increases array length by one. */\n public insert(index: number, value: T) {\n const { index: i } = this.lowerBound(index);\n this._array.splice(i, 0, [value, index]);\n\n for (let j = i + 1; j < this._array.length; j++) {\n this._array[j][1]++;\n }\n\n this._length = Math.max(this._length + 1, index + 1);\n }\n\n /** Removes value at specified index and reduces array length by one. */\n public remove(index: number): void {\n if (index >= this._length) {\n return;\n }\n\n const { index: i, equal } = this.lowerBound(index);\n this._array.splice(i, equal ? 1 : 0);\n\n for (let j = i; j < this._array.length; j++) {\n this._array[j][1]--;\n }\n\n this._length = Math.max(0, this._length - 1);\n }\n\n /**\n * Iterates values that are stored in the array\n * @returns `[value, index]` tuples.\n */\n public iterateValues(): IterableIterator<[T, number]> {\n return this._array[Symbol.iterator]();\n }\n\n /** Iterates the array with all intermediate `undefined` values */\n public [Symbol.iterator](): IterableIterator<T | undefined> {\n const array = this._array;\n const length = this._length;\n return (function* () {\n let currentIndex = 0;\n for (const [value, index] of array) {\n for (; currentIndex < index; ++currentIndex) {\n yield undefined;\n }\n\n yield value;\n ++currentIndex;\n }\n\n for (; currentIndex < length; ++currentIndex) {\n yield undefined;\n }\n })();\n }\n\n private lowerBound(index: number): {\n index: number;\n equal: boolean;\n } {\n return lowerBound(index, this._array, SparseArray.compare);\n }\n\n private static compare<T>(index: number, value: [T, number]): number {\n return compareNumbers(index, value[1]);\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { Ref } from "react";
2
+ /**
3
+ * Returns callbacks for persisting and restoring elements `scrollTop` property value.
4
+ * This can be used to restore elements scroll position if it needs to be hidden and
5
+ * later shown again without unmounting React component.
6
+ * @internal
7
+ */
8
+ export declare function useElementsScrollStorage<T extends Element>(elementsClassName: string): {
9
+ ref: Ref<T>;
10
+ persist: () => void;
11
+ restore: () => void;
12
+ };
13
+ //# sourceMappingURL=UseElementsScrollStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseElementsScrollStorage.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/UseElementsScrollStorage.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,OAAO,EACxD,iBAAiB,EAAE,MAAM,GACxB;IACD,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAqCA"}
@@ -0,0 +1,45 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { useRef } from "react";
6
+ /**
7
+ * Returns callbacks for persisting and restoring elements `scrollTop` property value.
8
+ * This can be used to restore elements scroll position if it needs to be hidden and
9
+ * later shown again without unmounting React component.
10
+ * @internal
11
+ */
12
+ export function useElementsScrollStorage(elementsClassName) {
13
+ const ref = useRef(null);
14
+ const scrollTop = useRef([]);
15
+ const getElements = () => {
16
+ // istanbul ignore if
17
+ if (!ref.current) {
18
+ return [];
19
+ }
20
+ return ref.current.getElementsByClassName(elementsClassName);
21
+ };
22
+ /** Persists current `scrollTop` property value of elements. */
23
+ const persist = () => {
24
+ const elements = getElements();
25
+ const offsets = [];
26
+ for (const element of elements) {
27
+ offsets.push(element.scrollTop);
28
+ }
29
+ scrollTop.current = offsets;
30
+ };
31
+ /** Restores `scrollTop` property values back. If `persist` was not called does nothing. */
32
+ const restore = () => {
33
+ const elements = getElements();
34
+ if (elements.length !== scrollTop.current.length) {
35
+ scrollTop.current = [];
36
+ return;
37
+ }
38
+ for (let i = 0; i < scrollTop.current.length; i++) {
39
+ elements[i].scrollTop = scrollTop.current[i];
40
+ }
41
+ scrollTop.current = [];
42
+ };
43
+ return { ref, persist, restore };
44
+ }
45
+ //# sourceMappingURL=UseElementsScrollStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseElementsScrollStorage.js","sourceRoot":"","sources":["../../../../src/components-react/common/UseElementsScrollStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,iBAAyB;IAMzB,MAAM,GAAG,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,MAAM,CAAW,EAAE,CAAC,CAAC;IAEvC,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,qBAAqB;QACrB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YAChB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC/D,CAAC,CAAC;IAEF,+DAA+D;IAC/D,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACjC;QACD,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC;IAC9B,CAAC,CAAC;IAEF,2FAA2F;IAC3F,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE;YAChD,SAAS,CAAC,OAAO,GAAG,EAAE,CAAC;YACvB,OAAO;SACR;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACjD,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC9C;QACD,SAAS,CAAC,OAAO,GAAG,EAAE,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { Ref } from \"react\";\nimport { useRef } from \"react\";\n\n/**\n * Returns callbacks for persisting and restoring elements `scrollTop` property value.\n * This can be used to restore elements scroll position if it needs to be hidden and\n * later shown again without unmounting React component.\n * @internal\n */\nexport function useElementsScrollStorage<T extends Element>(\n elementsClassName: string\n): {\n ref: Ref<T>;\n persist: () => void;\n restore: () => void;\n} {\n const ref = useRef<T>(null);\n const scrollTop = useRef<number[]>([]);\n\n const getElements = () => {\n // istanbul ignore if\n if (!ref.current) {\n return [];\n }\n return ref.current.getElementsByClassName(elementsClassName);\n };\n\n /** Persists current `scrollTop` property value of elements. */\n const persist = () => {\n const elements = getElements();\n const offsets: number[] = [];\n for (const element of elements) {\n offsets.push(element.scrollTop);\n }\n scrollTop.current = offsets;\n };\n\n /** Restores `scrollTop` property values back. If `persist` was not called does nothing. */\n const restore = () => {\n const elements = getElements();\n if (elements.length !== scrollTop.current.length) {\n scrollTop.current = [];\n return;\n }\n\n for (let i = 0; i < scrollTop.current.length; i++) {\n elements[i].scrollTop = scrollTop.current[i];\n }\n scrollTop.current = [];\n };\n\n return { ref, persist, restore };\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/style/opacity";
7
7
  @import "~@itwin/core-react/lib/cjs/core-react/icons/variables";
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/index";
6
6
 
7
7
  .components-date-picker-calendar-popup-button {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/inputs/variables";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  $checkbox-size: calc(var(--iui-font-size-1) * 1.2);
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  $desktop-tool-stripe-width: 2px;
7
7
  $desktop-tool-stripe-height: 22px;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
6
6
 
7
7
  $components-color-editor-item-height: 100%;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  $image-checkbox-size: 32px;
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/icons/variables";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/inputs/variables";
7
7
  @import "~@itwin/core-react/lib/cjs/core-react/style/baseline";
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  .components-property-list--horizontal {
6
6
  .components-toggle-editor {
7
7
  margin-left: var(--iui-size-2xs); // Clear the resizer in the PropertyGrid
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .rule {
7
7
  display: grid;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .filter-builder > .rule-group {
7
7
  & > .rule-group-content {