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

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 +88 -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
@@ -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,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,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,qBAAqB,IAAI,YAAY,EAAE,CAAC;IACxC,4BAA4B,IAAI,YAAY,EAAE,CAAC;IAC/C,WAAW,IAAI,YAAY,EAAE,CAAC;IAC9B,8BAA8B,IAAI,YAAY,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,QAAQ,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAE3C,kBAAkB,IAAI,gBAAgB,EAAE,CAAC;I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AE,CAAC;IACxC,4BAA4B,IAAI,YAAY,EAAE,CAAC;IAC/C,WAAW,IAAI,YAAY,EAAE,CAAC;IAC9B,8BAA8B,IAAI,YAAY,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,QAAQ,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAE3C,sEAAsE;IACtE,kBAAkB,IAAI,gBAAgB,EAAE,CAAC;IACzC,gFAAgF;IAChF,8BAA8B,IAAI,gBAAgB,EAAE,CAAC;CACtD;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,EAA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AI,EAAE,wBAAwB,EAC9B,MAAM,EAAE,cAAc,EACtB,kBAAkB,EAAE,MAAM,EAC1B,0BAA0B,EAAE,MAAM,EAClC,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,oBAAoB,CAAC,EAAE,MAAM;IAkB/B,SAAyB,IAAI,EAAE,wBAAwB,CAAC;aAC/B,WAAW,IAAI,+BAA+B,EAAE;IAEzE;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAe/B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAQ7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAQlB,OAAO,IAAI,+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
+ {"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,CA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C,OAAO,CAAC,aAAa,CAAS;gBAG5B,IAAI,EAAE,wBAAwB,EAC9B,MAAM,EAAE,cAAc,EACtB,kBAAkB,EAAE,MAAM,EAC1B,0BAA0B,EAAE,MAAM,EAClC,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,oBAAoB,CAAC,EAAE,MAAM;IAkB/B,SAAyB,IAAI,EAAE,wBAAwB,CAAC;aAC/B,WAAW,IAAI,+BAA+B,EAAE;IAEzE;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAe/B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAQ7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAQlB,OAAO,IAAI,+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,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAuB,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjG;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,+DAAQ,CAAA;IACR,iEAAS,CAAA;IACT,yDAAK,CAAA;IACL,2DAAM,CAAA;AACR,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AA6BD;;;GAGG;AACH,MAAM,OAAgB,2BAA2B;IAQ/C,YAA2B,MAAc,EAAU,mBAAuC,EAAU,2BAA+C;QAAxH,WAAM,GAAN,MAAM,CAAQ;Q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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","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,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAuB,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjG;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,+DAAQ,CAAA;IACR,iEAAS,CAAA;IACT,yDAAK,CAAA;IACL,2DAAM,CAAA;AACR,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AA6BD;;;GAGG;AACH,MAAM,OAAgB,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,OAAO,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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AAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF","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"}
@@ -62,6 +62,7 @@ export class MutableGridCategory extends MutableFlatPropertyGridItem {
62
62
  */
63
63
  getDescendantCategoriesAndSelf() {
64
64
  const descendants = [];
65
+ // eslint-disable-next-line deprecation/deprecation
65
66
  this._childCategories.forEach((value) => descendants.push(...value.getDescendantCategoriesAndSelf()));
66
67
  return [this, ...descendants];
67
68
  }
@@ -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,OAAO,EAAE,gBAAgB,EAAkD,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAWtI;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,2BAA2B;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,M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AU,EAAE,CAAC;IACxD,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,8BAA8B;QACnC,MAAM,WAAW,GAA+B,EAAE,CAAC;QACnD,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,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","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,OAAO,EAAE,gBAAgB,EAAkD,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAWtI;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,2BAA2B;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,MAA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OAAO,gBAAgB,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED,IAAW,eAAe;QACxB,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;IACxD,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,8BAA8B;QACnC,MAAM,WAAW,GAA+B,EAAE,CAAC;QACnD,mDAAmD;QACnD,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,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","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,IAAI,CAAC;IACrB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IAC7C,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AAEH,eAAO,MAAM,iBAAiB,6DA6B1B,CAAC"}
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,IAAI,CAAC;IACrB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IAC7C,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sJAAsJ;IACtJ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AAEH,eAAO,MAAM,iBAAiB,6DAgC1B,CAAC"}
@@ -14,7 +14,7 @@ import * as React from "react";
14
14
  // eslint-disable-next-line react/display-name
15
15
  export const ToolbarButtonItem = React.memo((props) => {
16
16
  const className = classnames("components-toolbar-button-item", props.isActive && "components-active", props.isDisabled && "components-disabled", props.className);
17
- 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 },
17
+ 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 },
18
18
  React.createElement("div", { className: "components-icon" }, props.icon),
19
19
  props.badge &&
20
20
  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,OAAO,aAAa,CAAC;AACrB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B;;GAEG;AACH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CACzC,CAAC,KAA6B,EAAE,EAAE;IAChC,MAAM,SAAS,GAAG,UAAU,CAC1B,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,OAAO,aAAa,CAAC;AACrB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+B/B;;GAEG;AACH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI,CACzC,CAAC,KAA6B,EAAE,EAAE;IAChC,MAAM,SAAS,GAAG,UAAU,CAC1B,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,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AAO,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"}
@@ -9,7 +9,7 @@ import "./Overflow.scss";
9
9
  import classnames from "classnames";
10
10
  import * as React from "react";
11
11
  import { Popup, useRefState } from "@itwin/core-react";
12
- import { useToolItemEntryContext } from "./ToolbarWithOverflow";
12
+ import { useToolbarPopupAutoHideContext, useToolItemEntryContext } from "./ToolbarWithOverflow";
13
13
  import { useResizeObserverSingleDimension } from "./ItemWrapper";
14
14
  import { Direction } from "./utilities/Direction";
15
15
  import { RelativePosition } from "@itwin/appui-abstract";
@@ -20,13 +20,15 @@ export function ToolbarOverflowButton(props) {
20
20
  const { onResize, useHeight } = useToolItemEntryContext();
21
21
  const [targetRef, target] = useRefState();
22
22
  const ref = useResizeObserverSingleDimension(onResize, useHeight);
23
+ const isHidden = useToolbarPopupAutoHideContext();
24
+ const popupClassName = classnames("components-toolbar-overflow_popup", isHidden && "nz-hidden");
23
25
  const className = classnames("components-toolbar-item-container", "components-toolbar-overflow-button", props.className);
24
26
  const buttonClassName = classnames("components-toolbar-button-item", "components-ellipsis-icon");
25
27
  return (React.createElement("div", { className: className, ref: targetRef },
26
28
  React.createElement("button", { ref: ref, onClick: props.onClick, className: buttonClassName, style: props.style, title: props.title },
27
29
  React.createElement("div", { className: "components-icon" },
28
30
  React.createElement("div", { className: "components-ellipsis" }))),
29
- React.createElement(Popup, { className: "components-toolbar-overflow_popup", offset: 0, showShadow: false, isOpen: props.open, onClose: props.onClose, position: toToolbarOverflowRelativePosition(props.expandsTo), target: target }, props.panelNode)));
31
+ React.createElement(Popup, { className: popupClassName, offset: 0, showShadow: false, isOpen: props.open, onClose: props.onClose, position: toToolbarOverflowRelativePosition(props.expandsTo), target: target }, props.panelNode)));
30
32
  }
31
33
  /** @internal */
32
34
  export function toToolbarOverflowRelativePosition(expandsTo) {
@@ -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,OAAO,iBAAiB,CAAC;AACzB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAgC,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoBzD;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,uBAAuB,EAAE,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,WAAW,EAAkB,CAAC;IAC1D,MAAM,GAAG,GAAG,gCAAgC,CAAoB,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrF,MAAM,SAAS,GAAG,UAAU,CAC1B,mCAAmC,EACnC,oCAAoC,EACpC,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,MAAM,eAAe,GAAG,UAAU,CAChC,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,KAAK,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;AAED,gBAAgB;AAChB,MAAM,UAAU,iCAAiC,CAAC,SAAoB;IACpE,QAAQ,SAAS,EAAE;QACjB,KAAK,SAAS,CAAC,MAAM;YACnB,OAAO,gBAAgB,CAAC,MAAM,CAAC;QACjC,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,IAAI,CAAC;QAC/B,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,KAAK,CAAC;QAChC,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,gBAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,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 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,OAAO,iBAAiB,CAAC;AACzB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAgC,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoBzD;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,uBAAuB,EAAE,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,WAAW,EAAkB,CAAC;IAC1D,MAAM,GAAG,GAAG,gCAAgC,CAAoB,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrF,MAAM,QAAQ,GAAG,8BAA8B,EAAE,CAAC;IAClD,MAAM,cAAc,GAAG,UAAU,CAC/B,mCAAmC,EACnC,QAAQ,IAAI,WAAW,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,UAAU,CAC1B,mCAAmC,EACnC,oCAAoC,EACpC,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,MAAM,eAAe,GAAG,UAAU,CAChC,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,KAAK,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;AAED,gBAAgB;AAChB,MAAM,UAAU,iCAAiC,CAAC,SAAoB;IACpE,QAAQ,SAAS,EAAE;QACjB,KAAK,SAAS,CAAC,MAAM;YACnB,OAAO,gBAAgB,CAAC,MAAM,CAAC;QACjC,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,IAAI,CAAC;QAC/B,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,KAAK,CAAC;QAChC,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,gBAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,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 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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D,mBAAmB,CAAC,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"}
@@ -9,7 +9,7 @@ import "./PopupItem.scss";
9
9
  import classnames from "classnames";
10
10
  import * as React from "react";
11
11
  import { Popup, useRefState } from "@itwin/core-react";
12
- import { useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from "./ToolbarWithOverflow";
12
+ import { useToolbarPopupAutoHideContext, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from "./ToolbarWithOverflow";
13
13
  import { toToolbarPopupRelativePosition } from "./PopupItemWithDrag";
14
14
  /**
15
15
  * Context used by Toolbar items in popups to close the popup panel.
@@ -62,7 +62,7 @@ export function PopupItem(props) {
62
62
  return (React.createElement(ToolbarPopupContext.Provider, { value: {
63
63
  closePanel: () => processPanelOpenClose(false),
64
64
  } },
65
- 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 },
65
+ 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 },
66
66
  React.createElement("div", { className: "components-icon" }, props.icon),
67
67
  props.badge &&
68
68
  React.createElement("div", { className: "components-badge" }, props.badge),
@@ -71,6 +71,8 @@ export function PopupItem(props) {
71
71
  }
72
72
  /** @internal */
73
73
  export function PopupItemPopup(props) {
74
- return React.createElement(Popup, { className: "components-toolbar-popupItem_popupItemPopup", offset: 0, showShadow: false, ...props });
74
+ const isHidden = useToolbarPopupAutoHideContext();
75
+ const className = classnames("components-toolbar-popupItem_popupItemPopup", isHidden && "nz-hidden");
76
+ return React.createElement(Popup, { className: className, offset: 0, showShadow: false, ...props });
75
77
  }
76
78
  //# sourceMappingURL=PopupItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PopupItem.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAQrE;;;GAGG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAA2B;IAC/E,yCAAyC;IACzC,UAAU,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,CAAC;IAChD,yGAAyG;IACzG,eAAe,EAAE,0BAA0B,CAAE,CAAC,WAAyB,EAAE,EAAE,GAAG,CAAC;CAChF,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAC/C,CAAC;AAeD;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MA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C,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;IAEvE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACvC,OAAO,CACL,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE;YACnC,UAAU,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC;SAC/C;QACC,gDACgB,KAAK,CAAC,MAAM,oBACX,aAAa,EAC5B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,KAAK,CAAC,UAAU,EAC1B,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK;YAElB,6BAAK,SAAS,EAAC,iBAAiB,IAC7B,KAAK,CAAC,IAAI,CACP;YACL,KAAK,CAAC,KAAK;gBACV,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,KAAK,CACR;YAEP,aAAa,CAAC,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CACxF;QACT,oBAAC,cAAc,IACb,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,8BAA8B,CAAC,kBAAkB,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,IAE7C,KAAK,CACS,CACY,CAChC,CAAC;AACJ,CAAC;AAYD,gBAAgB;AAChB,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,OAAO,oBAAC,KAAK,IACX,SAAS,EAAC,6CAA6C,EACvD,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,KAAK,KACb,KAAK,GACT,CAAC;AACL,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 \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { Popup, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { toToolbarPopupRelativePosition } from \"./PopupItemWithDrag\";\r\n\r\n/** @public */\r\nexport interface ToolbarPopupContextProps {\r\n readonly closePanel: () => void;\r\n readonly setSelectedItem?: (buttonItem: ActionButton) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar items in popups to close the popup panel.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarPopupContext = React.createContext<ToolbarPopupContextProps>({\r\n /** function used to close popup panel */\r\n closePanel: /* istanbul ignore next */ () => { },\r\n /** if popup panel is a GroupButton then this is call to set the selected action item within the panel */\r\n setSelectedItem: /* istanbul ignore next */ (_buttonItem: ActionButton) => { },\r\n});\r\n\r\n/**\r\n * React hook used to retrieve the ToolbarPopupContext.\r\n * @public\r\n */\r\nexport function useToolbarPopupContext() {\r\n return React.useContext(ToolbarPopupContext);\r\n}\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemProps extends ToolbarButtonItemProps {\r\n /** Describes if expandable item triangle indicator should be hidden. */\r\n hideIndicator?: boolean;\r\n /** Panel of the toolbar. */\r\n panel?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** Popup toolbar item that displays a panel\r\n * @public\r\n */\r\nexport function PopupItem(props: PopupItemProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n const processPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n setPanelShown((prev) => {\r\n // istanbul ignore else\r\n if (prev !== isOpening)\r\n onPopupPanelOpenClose(isOpening);\r\n return isOpening;\r\n });\r\n }, [setPanelShown, onPopupPanelOpenClose]);\r\n\r\n // handle open and closing overflow panel\r\n const onButtonClick = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n // istanbul ignore next\r\n if (props.onClick)\r\n props.onClick();\r\n }, [props, isPanelShown, processPanelOpenClose]);\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n props.isDisabled && \"components-disabled\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n // istanbul ignore next\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? overflowExpandsTo : expandsTo;\r\n\r\n const { hideIndicator, panel } = props;\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: () => processPanelOpenClose(false),\r\n }}>\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"tool-button\"\r\n ref={targetRef}\r\n disabled={props.isDisabled} // this is needed to prevent focusing/keyboard access to disabled buttons\r\n onClick={onButtonClick}\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 {hideIndicator ? /* istanbul ignore next */ undefined : <div className=\"components-triangle\" />}\r\n </button>\r\n <PopupItemPopup\r\n isOpen={isPanelShown}\r\n onClose={handleClose}\r\n position={toToolbarPopupRelativePosition(expandsToDirection, panelAlignment)}\r\n target={target}\r\n keepContentsMounted={props.keepContentsMounted}\r\n >\r\n {panel}\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\ninterface PopupItemPopupProps {\r\n children?: React.ReactNode;\r\n isOpen?: boolean;\r\n onClose(): void;\r\n position: RelativePosition;\r\n target?: HTMLElement;\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function PopupItemPopup(props: PopupItemPopupProps) {\r\n return <Popup\r\n className=\"components-toolbar-popupItem_popupItemPopup\"\r\n offset={0}\r\n showShadow={false}\r\n {...props}\r\n />;\r\n}\r\n"]}
1
+ {"version":3,"file":"PopupItem.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItem.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,8BAA8B,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACxI,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAQrE;;;GAGG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAA2B;IAC/E,yCAAyC;IACzC,UAAU,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAG,CAAC;IAChD,yGAAyG;IACzG,eAAe,EAAE,0BAA0B,CAAE,CAAC,WAAyB,EAAE,EAAE,GAAG,CAAC;CAChF,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,KAAK,CAAC,UAAU,CAAC,m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AAM,QAAQ,GAAG,8BAA8B,EAAE,CAAC;IAClD,MAAM,SAAS,GAAG,UAAU,CAC1B,6CAA6C,EAC7C,QAAQ,IAAI,WAAW,CAAC,CAAC;IAE3B,OAAO,oBAAC,KAAK,IACX,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,KAAK,KACb,KAAK,GACT,CAAC;AACL,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 \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { Popup, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { useToolbarPopupAutoHideContext, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { toToolbarPopupRelativePosition } from \"./PopupItemWithDrag\";\r\n\r\n/** @public */\r\nexport interface ToolbarPopupContextProps {\r\n readonly closePanel: () => void;\r\n readonly setSelectedItem?: (buttonItem: ActionButton) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar items in popups to close the popup panel.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarPopupContext = React.createContext<ToolbarPopupContextProps>({\r\n /** function used to close popup panel */\r\n closePanel: /* istanbul ignore next */ () => { },\r\n /** if popup panel is a GroupButton then this is call to set the selected action item within the panel */\r\n setSelectedItem: /* istanbul ignore next */ (_buttonItem: ActionButton) => { },\r\n});\r\n\r\n/**\r\n * React hook used to retrieve the ToolbarPopupContext.\r\n * @public\r\n */\r\nexport function useToolbarPopupContext() {\r\n return React.useContext(ToolbarPopupContext);\r\n}\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemProps extends ToolbarButtonItemProps {\r\n /** Describes if expandable item triangle indicator should be hidden. */\r\n hideIndicator?: boolean;\r\n /** Panel of the toolbar. */\r\n panel?: React.ReactNode;\r\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\r\n * content node is unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** Popup toolbar item that displays a panel\r\n * @public\r\n */\r\nexport function PopupItem(props: PopupItemProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n const processPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n setPanelShown((prev) => {\r\n // istanbul ignore else\r\n if (prev !== isOpening)\r\n onPopupPanelOpenClose(isOpening);\r\n return isOpening;\r\n });\r\n }, [setPanelShown, onPopupPanelOpenClose]);\r\n\r\n // handle open and closing overflow panel\r\n const onButtonClick = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n // istanbul ignore next\r\n if (props.onClick)\r\n props.onClick();\r\n }, [props, isPanelShown, processPanelOpenClose]);\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n props.isDisabled && \"components-disabled\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n // istanbul ignore next\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? overflowExpandsTo : expandsTo;\r\n\r\n const { hideIndicator, panel } = props;\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: () => processPanelOpenClose(false),\r\n }}>\r\n <button\r\n data-item-id={props.itemId}\r\n data-item-type=\"tool-button-popup\"\r\n data-item-group-priority={props.groupPriority}\r\n data-item-priority={props.itemPriority}\r\n data-item-providerid={props.providerId}\r\n ref={targetRef}\r\n disabled={props.isDisabled} // this is needed to prevent focusing/keyboard access to disabled buttons\r\n onClick={onButtonClick}\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 {hideIndicator ? /* istanbul ignore next */ undefined : <div className=\"components-triangle\" />}\r\n </button>\r\n <PopupItemPopup\r\n isOpen={isPanelShown}\r\n onClose={handleClose}\r\n position={toToolbarPopupRelativePosition(expandsToDirection, panelAlignment)}\r\n target={target}\r\n keepContentsMounted={props.keepContentsMounted}\r\n >\r\n {panel}\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\ninterface PopupItemPopupProps {\r\n children?: React.ReactNode;\r\n isOpen?: boolean;\r\n onClose(): void;\r\n position: RelativePosition;\r\n target?: HTMLElement;\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport function PopupItemPopup(props: PopupItemPopupProps) {\r\n const isHidden = useToolbarPopupAutoHideContext();\r\n const className = classnames(\r\n \"components-toolbar-popupItem_popupItemPopup\",\r\n isHidden && \"nz-hidden\");\r\n\r\n return <Popup\r\n className={className}\r\n offset={0}\r\n showShadow={false}\r\n {...props}\r\n />;\r\n}\r\n"]}
@@ -29,7 +29,11 @@
29
29
  filter: $arrow-shadow;
30
30
  pointer-events: none;
31
31
 
32
- @include triangle-bottom-right($width: $triangle-width, $height: $triangle-height, $color: $buic-icon-color);
32
+ @include triangle-bottom-right(
33
+ $width: $triangle-width,
34
+ $height: $triangle-height,
35
+ $color: $buic-icon-color
36
+ );
33
37
  }
34
38
 
35
39
  &:active>.components-triangle {
@@ -73,4 +77,11 @@
73
77
  border-width: 1px;
74
78
  border-style: solid;
75
79
  border-radius: 3px;
76
- }
80
+
81
+ transition: visibility 0.5s ease, opacity 0.5s ease;
82
+
83
+ &.nz-hidden {
84
+ opacity: 0;
85
+ visibility: hidden;
86
+ }
87
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"PopupItemWithDrag.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAiE,WAAW,EAAE,gBAAgB,EAAwB,MAAM,uBAAuB,CAAC;AAE3J,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAmE,MAAM,uBAAuB,CAAC;AAE/H,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,4BAA4B;IAC5B,SAAS,EAAE,WAAW,CAAC;CACxB;AAmDD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAiG9D;AAED,gBAAgB;AAChB,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB,GAAG,gBAAgB,CAevH"}
1
+ {"version":3,"file":"PopupItemWithDrag.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAiE,WAAW,EAAE,gBAAgB,EAAwB,MAAM,uBAAuB,CAAC;AAE3J,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAmE,MAAM,uBAAuB,CAAC;AAE/H,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,4BAA4B;IAC5B,SAAS,EAAE,WAAW,CAAC;CACxB;AAmDD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAsG9D;AAED,gBAAgB;AAChB,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB,GAAG,gBAAgB,CAevH"}
@@ -117,7 +117,7 @@ export function PopupItemWithDrag(props) {
117
117
  closePanel: /* istanbul ignore next */ () => processPanelOpenClose(false),
118
118
  setSelectedItem: /* istanbul ignore next */ (buttonItem) => setActiveAction(buttonItem),
119
119
  } },
120
- React.createElement("button", { ref: targetRef, onPointerDown: handlePointerDown, onClick: handleButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: title },
120
+ 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, ref: targetRef, onPointerDown: handlePointerDown, onClick: handleButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: title },
121
121
  React.createElement("div", { className: "components-icon" }, icon),
122
122
  props.badge &&
123
123
  React.createElement("div", { className: "components-badge" }, badge),
@@ -1 +1 @@
1
- {"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAgB,uBAAuB,EAAE,sBAAsB,EAAe,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3J,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAA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ACF;YAER,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CAChC;QACT,oBAAC,cAAc,IACb,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,8BAA8B,CAAC,kBAAkB,EAAE,cAAc,CAAC,EAC5E,MAAM,EAAE,MAAM;YAEd,oBAAC,eAAe,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,GAAI,CAC3D,CACY,CAChC,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,8BAA8B,CAAC,SAAoB,EAAE,SAAgC;IACnG,uBAAuB;IACvB,QAAQ,SAAS,EAAE;QACjB,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,SAAS,KAAK,qBAAqB,CAAC,GAAG;gBACzC,OAAO,gBAAgB,CAAC,WAAW,CAAC;YACtC,OAAO,gBAAgB,CAAC,UAAU,CAAC;SACpC;QACD,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,QAAQ,CAAC;QACnC,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,gBAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,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 \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, ConditionalBooleanValue, ConditionalStringValue, GroupButton, RelativePosition, ToolbarItemUtilities } from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, IconHelper, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { ToolbarPanelAlignment, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useDragInteraction } from \"./useDragInteraction\";\r\nimport { Direction } from \"./utilities/Direction\";\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\r\n /** Panel of the toolbar. */\r\n groupItem: GroupButton;\r\n}\r\n\r\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n if (childItem.isActive)\r\n return childItem;\r\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = tryFindActiveAction(childItem);\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getFirstAvailableChildActionItem(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = getFirstAvailableChildActionItem(childItem);\r\n // istanbul ignore else\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\r\n const activeItem = tryFindActiveAction(item);\r\n if (activeItem)\r\n return activeItem;\r\n\r\n // initially look only in root items\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n }\r\n }\r\n\r\n // if not found look inside groups\r\n return getFirstAvailableChildActionItem(item);\r\n}\r\n\r\n/** Expandable Group button Item\r\n * @public\r\n */\r\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const [activeAction, setActiveAction] = React.useState(getActiveAction(props.groupItem));\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n\r\n React.useEffect(() => {\r\n const newActiveAction = getActiveAction(props.groupItem);\r\n // istanbul ignore else\r\n if (newActiveAction) {\r\n // istanbul ignore next\r\n if (newActiveAction.isActive) {\r\n setActiveAction(newActiveAction);\r\n } else {\r\n if (activeAction && activeAction.isActive) {\r\n setActiveAction({ ...activeAction, isActive: false });\r\n }\r\n }\r\n }\r\n }, [props.groupItem, activeAction]);\r\n\r\n const processPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n setPanelShown((prev) => {\r\n // istanbul ignore else\r\n if (prev !== isOpening)\r\n onPopupPanelOpenClose(isOpening);\r\n return isOpening;\r\n });\r\n }, [setPanelShown, onPopupPanelOpenClose]);\r\n\r\n // handle open and closing popup panel\r\n const onOpenPanel = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n }, [isPanelShown, processPanelOpenClose]);\r\n\r\n // handle open and closing popup panel\r\n const onGroupButtonClick = React.useCallback(() => {\r\n // only execute action if not disabled\r\n activeAction && !ConditionalBooleanValue.getValue(activeAction.isDisabled) && activeAction.execute();\r\n }, [activeAction]);\r\n\r\n const badge = activeAction ? BadgeUtilities.getComponentForBadgeType(activeAction.badgeType) : props.badge;\r\n const icon = activeAction ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData) : props.icon;\r\n const title = activeAction ? ConditionalStringValue.getValue(activeAction.label) : props.title;\r\n const isActive = activeAction ? activeAction.isActive : props.isActive;\r\n const isDisabled = ConditionalBooleanValue.getValue(activeAction ? activeAction.isDisabled : props.isDisabled);\r\n\r\n const { handlePointerDown, handleButtonClick } = useDragInteraction(onGroupButtonClick, onOpenPanel);\r\n\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n isActive && \"components-active\",\r\n isDisabled && \"components-disabled-drag\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? /* istanbul ignore next */ overflowExpandsTo : expandsTo;\r\n\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: /* istanbul ignore next */ () => processPanelOpenClose(false),\r\n setSelectedItem: /* istanbul ignore next */ (buttonItem: ActionButton) => setActiveAction(buttonItem),\r\n }\r\n }>\r\n <button\r\n ref={targetRef}\r\n onPointerDown={handlePointerDown}\r\n onClick={handleButtonClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={title}\r\n >\r\n <div className=\"components-icon\">\r\n {icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {badge}\r\n </div>\r\n }\r\n <div className=\"components-triangle\" />\r\n </button>\r\n <PopupItemPopup\r\n isOpen={isPanelShown}\r\n onClose={handleClose}\r\n position={toToolbarPopupRelativePosition(expandsToDirection, panelAlignment)}\r\n target={target}\r\n >\r\n <PopupItemsPanel groupItem={props.groupItem} activateOnPointerUp={true} />\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarPopupRelativePosition(expandsTo: Direction, alignment: ToolbarPanelAlignment): RelativePosition {\r\n // istanbul ignore next\r\n switch (expandsTo) {\r\n case Direction.Bottom: {\r\n if (alignment === ToolbarPanelAlignment.End)\r\n return RelativePosition.BottomRight;\r\n return RelativePosition.BottomLeft;\r\n }\r\n case Direction.Left:\r\n return RelativePosition.LeftTop;\r\n case Direction.Right:\r\n return RelativePosition.RightTop;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
1
+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O,gBAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,QAAQ,CAAC;QACnC,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,gBAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,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 \"./PopupItem.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, ConditionalBooleanValue, ConditionalStringValue, GroupButton, RelativePosition, ToolbarItemUtilities } from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, IconHelper, useRefState } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItemProps } from \"./Item\";\r\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { ToolbarPanelAlignment, useToolbarWithOverflowDirectionContext, useToolItemEntryContext } from \"./ToolbarWithOverflow\";\r\nimport { useDragInteraction } from \"./useDragInteraction\";\r\nimport { Direction } from \"./utilities/Direction\";\r\n\r\n/** Properties of [[PopupItem]] component.\r\n * @public\r\n */\r\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\r\n /** Panel of the toolbar. */\r\n groupItem: GroupButton;\r\n}\r\n\r\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n if (childItem.isActive)\r\n return childItem;\r\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = tryFindActiveAction(childItem);\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getFirstAvailableChildActionItem(item: GroupButton): ActionButton | undefined {\r\n for (const childItem of item.items) {\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\r\n const nestedChild = getFirstAvailableChildActionItem(childItem);\r\n // istanbul ignore else\r\n if (nestedChild)\r\n return nestedChild;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\r\n const activeItem = tryFindActiveAction(item);\r\n if (activeItem)\r\n return activeItem;\r\n\r\n // initially look only in root items\r\n for (const childItem of item.items) {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(childItem)) {\r\n return childItem;\r\n }\r\n }\r\n\r\n // if not found look inside groups\r\n return getFirstAvailableChildActionItem(item);\r\n}\r\n\r\n/** Expandable Group button Item\r\n * @public\r\n */\r\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\r\n const [isPanelShown, setPanelShown] = React.useState(false);\r\n const [activeAction, setActiveAction] = React.useState(getActiveAction(props.groupItem));\r\n const { expandsTo, overflowExpandsTo, panelAlignment, onPopupPanelOpenClose } = useToolbarWithOverflowDirectionContext();\r\n\r\n React.useEffect(() => {\r\n const newActiveAction = getActiveAction(props.groupItem);\r\n // istanbul ignore else\r\n if (newActiveAction) {\r\n // istanbul ignore next\r\n if (newActiveAction.isActive) {\r\n setActiveAction(newActiveAction);\r\n } else {\r\n if (activeAction && activeAction.isActive) {\r\n setActiveAction({ ...activeAction, isActive: false });\r\n }\r\n }\r\n }\r\n }, [props.groupItem, activeAction]);\r\n\r\n const processPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n setPanelShown((prev) => {\r\n // istanbul ignore else\r\n if (prev !== isOpening)\r\n onPopupPanelOpenClose(isOpening);\r\n return isOpening;\r\n });\r\n }, [setPanelShown, onPopupPanelOpenClose]);\r\n\r\n // handle open and closing popup panel\r\n const onOpenPanel = React.useCallback(() => {\r\n processPanelOpenClose(!isPanelShown);\r\n }, [isPanelShown, processPanelOpenClose]);\r\n\r\n // handle open and closing popup panel\r\n const onGroupButtonClick = React.useCallback(() => {\r\n // only execute action if not disabled\r\n activeAction && !ConditionalBooleanValue.getValue(activeAction.isDisabled) && activeAction.execute();\r\n }, [activeAction]);\r\n\r\n const badge = activeAction ? BadgeUtilities.getComponentForBadgeType(activeAction.badgeType) : props.badge;\r\n const icon = activeAction ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData) : props.icon;\r\n const title = activeAction ? ConditionalStringValue.getValue(activeAction.label) : props.title;\r\n const isActive = activeAction ? activeAction.isActive : props.isActive;\r\n const isDisabled = ConditionalBooleanValue.getValue(activeAction ? activeAction.isDisabled : props.isDisabled);\r\n\r\n const { handlePointerDown, handleButtonClick } = useDragInteraction(onGroupButtonClick, onOpenPanel);\r\n\r\n const className = classnames(\r\n \"components-toolbar-button-item\",\r\n \"components-toolbar-expandable-button\",\r\n isActive && \"components-active\",\r\n isDisabled && \"components-disabled-drag\",\r\n props.className);\r\n\r\n const [targetRef, target] = useRefState<HTMLButtonElement>();\r\n const handleClose = React.useCallback(() => {\r\n processPanelOpenClose(false);\r\n }, [processPanelOpenClose]);\r\n const { hasOverflow } = useToolItemEntryContext();\r\n const expandsToDirection = hasOverflow ? /* istanbul ignore next */ overflowExpandsTo : expandsTo;\r\n\r\n return (\r\n <ToolbarPopupContext.Provider value={{\r\n closePanel: /* istanbul ignore next */ () => processPanelOpenClose(false),\r\n setSelectedItem: /* istanbul ignore next */ (buttonItem: ActionButton) => setActiveAction(buttonItem),\r\n }\r\n }>\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 ref={targetRef}\r\n onPointerDown={handlePointerDown}\r\n onClick={handleButtonClick}\r\n onKeyDown={props.onKeyDown}\r\n className={className}\r\n style={props.style}\r\n title={title}\r\n >\r\n <div className=\"components-icon\">\r\n {icon}\r\n </div>\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {badge}\r\n </div>\r\n }\r\n <div className=\"components-triangle\" />\r\n </button>\r\n <PopupItemPopup\r\n isOpen={isPanelShown}\r\n onClose={handleClose}\r\n position={toToolbarPopupRelativePosition(expandsToDirection, panelAlignment)}\r\n target={target}\r\n >\r\n <PopupItemsPanel groupItem={props.groupItem} activateOnPointerUp={true} />\r\n </PopupItemPopup>\r\n </ToolbarPopupContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function toToolbarPopupRelativePosition(expandsTo: Direction, alignment: ToolbarPanelAlignment): RelativePosition {\r\n // istanbul ignore next\r\n switch (expandsTo) {\r\n case Direction.Bottom: {\r\n if (alignment === ToolbarPanelAlignment.End)\r\n return RelativePosition.BottomRight;\r\n return RelativePosition.BottomLeft;\r\n }\r\n case Direction.Left:\r\n return RelativePosition.LeftTop;\r\n case Direction.Right:\r\n return RelativePosition.RightTop;\r\n case Direction.Top:\r\n return RelativePosition.Top;\r\n }\r\n}\r\n"]}
@@ -18,6 +18,16 @@ export interface CustomToolbarItem extends CustomButtonDefinition {
18
18
  * content node is unmounted each time the popup is closed. */
19
19
  keepContentsLoaded?: boolean;
20
20
  }
21
+ /**
22
+ * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
23
+ * @public
24
+ */
25
+ export declare const ToolbarPopupAutoHideContext: React.Context<boolean>;
26
+ /**
27
+ * React hook used to retrieve the ToolbarPopupAutoHideContext.
28
+ * @public
29
+ */
30
+ export declare function useToolbarPopupAutoHideContext(): boolean;
21
31
  /** Describes toolbar item.
22
32
  * @public
23
33
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarWithOverflow.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AAExB,O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