@itwin/components-react 3.1.0-dev.8 → 3.2.0-dev.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.
- package/CHANGELOG.md +68 -5
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +2 -0
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +6 -0
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -0
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Item.d.ts +6 -0
- package/lib/cjs/components-react/toolbar/Item.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Item.js +1 -1
- package/lib/cjs/components-react/toolbar/Item.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.js +3 -1
- package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.scss +7 -0
- package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.js +4 -2
- package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.scss +13 -2
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +10 -0
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +18 -4
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +2 -0
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +6 -0
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -0
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/esm/components-react/toolbar/Item.d.ts +6 -0
- package/lib/esm/components-react/toolbar/Item.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Item.js +1 -1
- package/lib/esm/components-react/toolbar/Item.js.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.js +4 -2
- package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.scss +7 -0
- package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.js +5 -3
- package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.scss +13 -2
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +10 -0
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +16 -3
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/package.json +13 -13
|
@@ -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,4BAA0B;AAC1B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAA2J;AAC3J,kDAA4E;AAE5E,2CAAkE;AAClE,uDAAoD;AACpD,+DAA+H;AAC/H,6DAA0D;AAC1D,qDAAkD;AAUlD,SAAS,mBAAmB,CAAC,IAAiB;IAC5C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK,EAAE;QAClC,uBAAuB;QACvB,IAAI,qCAAoB,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;YAClD,IAAI,SAAS,CAAC,QAAQ;gBACpB,OAAO,SAAS,CAAC;SACpB;aAAM,IAAI,qCAAoB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YACxD,MAAM,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IAAI,SAAS,KAAK,2CAAqB,CAAC,GAAG;gBACzC,OAAO,iCAAgB,CAAC,WAAW,CAAC;YACtC,OAAO,iCAAgB,CAAC,UAAU,CAAC;SACpC;QACD,KAAK,qBAAS,CAAC,IAAI;YACjB,OAAO,iCAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,qBAAS,CAAC,KAAK;YAClB,OAAO,iCAAgB,CAAC,QAAQ,CAAC;QACnC,KAAK,qBAAS,CAAC,GAAG;YAChB,OAAO,iCAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,CAAC;AAfD,wEAeC","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
|
+
{"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4BAA0B;AAC1B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAA2J;AAC3J,kDAA4E;AAE5E,2CAAkE;AAClE,uDAAoD;AACpD,+DAA+H;AAC/H,6DAA0D;AAC1D,qDAAkD;AAUlD,SAAS,mBAAmB,CAAC,IAAiB;IAC5C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK,EAAE;QAClC,uBAAuB;QACvB,IAAI,qCAAoB,CAAC,cAAc,CAAC,SA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S,EAAE,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,GAAI,CAC3D,CACY,CAChC,CAAC;AACJ,CAAC;AAtGD,8CAsGC;AAED,gBAAgB;AAChB,SAAgB,8BAA8B,CAAC,SAAoB,EAAE,SAAgC;IACnG,uBAAuB;IACvB,QAAQ,SAAS,EAAE;QACjB,KAAK,qBAAS,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,SAAS,KAAK,2CAAqB,CAAC,GAAG;gBACzC,OAAO,iCAAgB,CAAC,WAAW,CAAC;YACtC,OAAO,iCAAgB,CAAC,UAAU,CAAC;SACpC;QACD,KAAK,qBAAS,CAAC,IAAI;YACjB,OAAO,iCAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,qBAAS,CAAC,KAAK;YAClB,OAAO,iCAAgB,CAAC,QAAQ,CAAC;QACnC,KAAK,qBAAS,CAAC,GAAG;YAChB,OAAO,iCAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,CAAC;AAfD,wEAeC","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,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,YAAY,EAAE,iBAAiB,EAAmD,sBAAsB,EACxG,WAAW,EAAE,kBAAkB,EAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAkB,WAAW,EAAc,eAAe,EAAW,MAAM,mBAAmB,CAAC;AAStG,OAAO,EAAE,SAAS,EAAoB,mBAAmB,EAA8B,MAAM,uBAAuB,CAAC;AAGrH;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;IAC/D,4FAA4F;IAC5F,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;kEAC8D;IAC9D,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;GAEG;AACH,oBAAY,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAEzE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,G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AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAoLlE;AAqID;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;GAEG;AAEH,eAAO,MAAM,kBAAkB,uCAAqD,CAAC;AAErF,gBAAgB;AAChB,wBAAgB,uBAAuB,2BAEtC"}
|
|
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.useToolItemEntryContext = exports.ToolbarItemContext = exports.ToolbarWithOverflow = exports.useToolbarWithOverflowDirectionContext = exports.ToolbarItemComponent = exports.ActionItem = exports.GroupPopupItem = exports.CustomItem = exports.ToolbarWithOverflowDirectionContext = exports.ToolbarPanelAlignmentHelpers = exports.ToolbarOpacitySetting = exports.ToolbarPanelAlignment = exports.getToolbarDirection = exports.isCustomToolbarItem = void 0;
|
|
32
|
+
exports.useToolItemEntryContext = exports.ToolbarItemContext = exports.ToolbarWithOverflow = exports.useToolbarWithOverflowDirectionContext = exports.ToolbarItemComponent = exports.ActionItem = exports.GroupPopupItem = exports.CustomItem = exports.ToolbarWithOverflowDirectionContext = exports.ToolbarPanelAlignmentHelpers = exports.ToolbarOpacitySetting = exports.ToolbarPanelAlignment = exports.getToolbarDirection = exports.isCustomToolbarItem = exports.useToolbarPopupAutoHideContext = exports.ToolbarPopupAutoHideContext = void 0;
|
|
33
33
|
require("./Toolbar.scss");
|
|
34
34
|
const classnames_1 = __importDefault(require("classnames"));
|
|
35
35
|
const React = __importStar(require("react"));
|
|
@@ -45,6 +45,20 @@ const PopupItemsPanel_1 = require("./PopupItemsPanel");
|
|
|
45
45
|
const PopupItemWithDrag_1 = require("./PopupItemWithDrag");
|
|
46
46
|
const Direction_1 = require("./utilities/Direction");
|
|
47
47
|
const UiComponents_1 = require("../UiComponents");
|
|
48
|
+
/**
|
|
49
|
+
* Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
53
|
+
exports.ToolbarPopupAutoHideContext = React.createContext(false);
|
|
54
|
+
/**
|
|
55
|
+
* React hook used to retrieve the ToolbarPopupAutoHideContext.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
function useToolbarPopupAutoHideContext() {
|
|
59
|
+
return React.useContext(exports.ToolbarPopupAutoHideContext);
|
|
60
|
+
}
|
|
61
|
+
exports.useToolbarPopupAutoHideContext = useToolbarPopupAutoHideContext;
|
|
48
62
|
/** CustomToolbarItem type guard.
|
|
49
63
|
* @internal
|
|
50
64
|
*/
|
|
@@ -142,9 +156,9 @@ function GroupPopupItem({ item, addGroupSeparator }) {
|
|
|
142
156
|
const badge = core_react_1.BadgeUtilities.getComponentForBadgeType(item.badgeType);
|
|
143
157
|
const panel = React.useMemo(() => React.createElement(PopupItemsPanel_1.PopupItemsPanel, { groupItem: item, activateOnPointerUp: false }), [item]);
|
|
144
158
|
if (useDragInteraction) {
|
|
145
|
-
return React.createElement(PopupItemWithDrag_1.PopupItemWithDrag, { key: item.id, itemId: item.id, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, groupItem: item, badge: badge, addGroupSeparator: addGroupSeparator });
|
|
159
|
+
return React.createElement(PopupItemWithDrag_1.PopupItemWithDrag, { key: item.id, itemId: item.id, providerId: item.providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, groupItem: item, badge: badge, addGroupSeparator: addGroupSeparator });
|
|
146
160
|
}
|
|
147
|
-
return React.createElement(PopupItem_1.PopupItem, { key: item.id, itemId: item.id, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, panel: panel, badge: badge, hideIndicator: useDragInteraction, addGroupSeparator: addGroupSeparator });
|
|
161
|
+
return React.createElement(PopupItem_1.PopupItem, { key: item.id, itemId: item.id, providerId: item.providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, panel: panel, badge: badge, hideIndicator: useDragInteraction, addGroupSeparator: addGroupSeparator });
|
|
148
162
|
}
|
|
149
163
|
exports.GroupPopupItem = GroupPopupItem;
|
|
150
164
|
/** @internal */
|
|
@@ -156,7 +170,7 @@ function ActionItem({ item, addGroupSeparator }) {
|
|
|
156
170
|
item.execute();
|
|
157
171
|
onItemExecuted(item);
|
|
158
172
|
}, [item, onItemExecuted]);
|
|
159
|
-
return React.createElement(Item_1.ToolbarButtonItem, { itemId: item.id, key: item.id, isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isActive: item.isActive, onClick: onExecute, badge: badge, addGroupSeparator: addGroupSeparator });
|
|
173
|
+
return React.createElement(Item_1.ToolbarButtonItem, { itemId: item.id, providerId: item.providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, key: item.id, isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: title, icon: core_react_1.IconHelper.getIconReactNode(item.icon, item.internalData), isActive: item.isActive, onClick: onExecute, badge: badge, addGroupSeparator: addGroupSeparator });
|
|
160
174
|
}
|
|
161
175
|
exports.ActionItem = ActionItem;
|
|
162
176
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0BAAwB;AACxB,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAsG;AACtG,iCAA2C;AAC3C,mCAAuC;AACvC,+CAA8E;AAC9E,yCAAmD;AACnD,mDAAuD;AACvD,2CAAwC;AACxC,uDAAoD;AACpD,2DAAwD;AACxD,qDAAqH;AACrH,kDAA+C;AAoB/C;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAiB;IACnD,OAAO,CAAC,CAAE,IAA0B,CAAC,QAAQ,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,CAAC,CAAC;AAC5G,CAAC;AAFD,kDAEC;AAED,gBAAgB;AACT,MAAM,mBAAmB,GAAG,CAAC,SAAoB,EAAuB,EAAE;IAC/E,MAAM,mBAAmB,GAAG,4BAAgB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC/E,OAAO,sCAA0B,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEF;;GAEG;AACH,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,mEAAK,CAAA;IACL,+DAAG,CAAA;AACL,CAAC,EAHW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAGhC;AAED;;GAEG;AACH,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,8EAA8E;IAC9E,yEAAQ,CAAA;IACR,kFAAkF;IAClF,2EAAS,CAAA;IACT,gFAAgF;IAChF,+EAAW,CAAA;AACb,CAAC,EAPW,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AAErF,gBAAgB;AAChB,SAAgB,uBAAuB;IACrC,OAAO,KAAK,CAAC,UAAU,CAAC,0BAAkB,CAAC,CAAC;AAC9C,CAAC;AAFD,0DAEC;AAED,SAAS,kBAAkB,CAAI,GAA+B;IAC5D,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,EAAE;QACzB,4CAA4C;QAC5C,IAAI,GAAG,KAAK,SAAS;YACnB,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,GAAqB,CAAC;AAC/B,CAAC;AAED,SAAS,GAAG,CAAC,IAAmC,EAAE,KAAwB;IACxE,IAAI,CAAC,IAAI;QACP,OAAO,KAAK,CAAC;IACf,uBAAuB;IACvB,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAC9B,OAAO,KAAK,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,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 \"./Toolbar.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ActionButton, CommonToolbarItem, ConditionalBooleanValue, ConditionalStringValue, CustomButtonDefinition,\r\n GroupButton, OnItemExecutedFunc, ToolbarItemUtilities,\r\n} from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, CommonProps, IconHelper, NoChildrenProps, useRefs } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItem } from \"./Item\";\r\nimport { ToolbarItems } from \"./Items\";\r\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { ToolbarOverflowButton } from \"./Overflow\";\r\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\r\nimport { PopupItem } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\r\nimport { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers } from \"./utilities/Direction\";\r\nimport { UiComponents } from \"../UiComponents\";\r\n\r\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\r\n * @public\r\n */\r\nexport interface CustomToolbarItem extends CustomButtonDefinition {\r\n /** React node that must result in providing a PopupItem @deprecated use panelContentNode */\r\n buttonNode?: React.ReactNode;\r\n /** defines the content to display in popup panel */\r\n panelContentNode?: 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 keepContentsLoaded?: boolean;\r\n}\r\n\r\n/** Describes toolbar item.\r\n * @public\r\n */\r\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem;\r\n\r\n/** CustomToolbarItem type guard.\r\n * @internal\r\n */\r\nexport function isCustomToolbarItem(item: ToolbarItem): item is CustomToolbarItem {\r\n return !!(item as CustomToolbarItem).isCustom && ((\"buttonNode\" in item) || (\"panelContentNode\" in item));\r\n}\r\n\r\n/** @internal */\r\nexport const getToolbarDirection = (expandsTo: Direction): OrthogonalDirection => {\r\n const orthogonalDirection = DirectionHelpers.getOrthogonalDirection(expandsTo);\r\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\r\n};\r\n\r\n/** Available alignment modes of [[ToolbarWithOverflow]] panels.\r\n * @public\r\n */\r\nexport enum ToolbarPanelAlignment {\r\n Start,\r\n End,\r\n}\r\n\r\n/** Enumeration of Toolbar Opacity setting.\r\n * @public\r\n */\r\nexport enum ToolbarOpacitySetting {\r\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\r\n Defaults,\r\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\r\n Proximity,\r\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\r\n Transparent,\r\n}\r\n\r\n/** Helpers for [[ToolbarPanelAlignment]].\r\n * @internal\r\n */\r\nexport class ToolbarPanelAlignmentHelpers {\r\n /** Class name of [[ToolbarPanelAlignment.Start]] */\r\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\r\n /** Class name of [[ToolbarPanelAlignment.End]] */\r\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\r\n\r\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\r\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\r\n switch (panelAlignment) {\r\n case ToolbarPanelAlignment.Start:\r\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\r\n case ToolbarPanelAlignment.End:\r\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface ToolbarOverflowContextProps {\r\n readonly expandsTo: Direction;\r\n readonly direction: OrthogonalDirection;\r\n readonly overflowExpandsTo: Direction;\r\n readonly overflowDirection: OrthogonalDirection;\r\n readonly panelAlignment: ToolbarPanelAlignment;\r\n readonly useDragInteraction: boolean;\r\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\r\n readonly openPopupCount: number;\r\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\r\n readonly overflowDisplayActive: boolean;\r\n readonly onItemExecuted: OnItemExecutedFunc;\r\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar component to provide Direction to child components.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarWithOverflowDirectionContext = React.createContext<ToolbarOverflowContextProps>({\r\n expandsTo: Direction.Bottom,\r\n direction: OrthogonalDirection.Horizontal,\r\n overflowExpandsTo: Direction.Right,\r\n overflowDirection: OrthogonalDirection.Vertical,\r\n panelAlignment: ToolbarPanelAlignment.Start,\r\n useDragInteraction: false,\r\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\r\n openPopupCount: 0,\r\n onPopupPanelOpenClose: /* istanbul ignore next */ (_isOpening: boolean) => { },\r\n overflowDisplayActive: false,\r\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\r\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\r\n});\r\n\r\n/** @internal */\r\nexport function CustomItem({ item, addGroupSeparator }: { item: CustomToolbarItem, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const icon = React.useMemo(() => (item.icon &&\r\n IconHelper.getIconReactNode(item.icon, item.internalData)) || /* istanbul ignore next */\r\n <i className=\"icon icon-placeholder\" />, [item.icon, item.internalData]);\r\n const isDisabled = React.useMemo(() => ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);\r\n const title = React.useMemo(() => /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ?? item.id, [item.id, item.label]);\r\n const badge = React.useMemo(() => BadgeUtilities.getComponentForBadgeType(item.badgeType), [item.badgeType]);\r\n\r\n if (item.panelContentNode) {\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n icon={icon}\r\n isDisabled={isDisabled}\r\n title={title}\r\n panel={item.panelContentNode}\r\n hideIndicator={useDragInteraction}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n keepContentsMounted={item.keepContentsLoaded}\r\n />;\r\n }\r\n\r\n // istanbul ignore else\r\n if (item.buttonNode)\r\n return <>{item.buttonNode}</>;\r\n\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function GroupPopupItem({ item, addGroupSeparator }: { item: GroupButton, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const panel = React.useMemo(() => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />, [item]);\r\n if (useDragInteraction) {\r\n return <PopupItemWithDrag\r\n key={item.id}\r\n itemId={item.id}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n groupItem={item}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n }\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n panel={panel}\r\n badge={badge}\r\n hideIndicator={useDragInteraction}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ActionItem({ item, addGroupSeparator }: { item: ActionButton, addGroupSeparator: boolean }) {\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\r\n const onExecute = React.useCallback(() => {\r\n item.execute();\r\n onItemExecuted(item);\r\n }, [item, onItemExecuted]);\r\n\r\n return <ToolbarButtonItem\r\n itemId={item.id}\r\n key={item.id}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isActive={item.isActive}\r\n onClick={onExecute}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ToolbarItemComponent({ item, addGroupSeparator }: { item: ToolbarItem, addGroupSeparator: boolean }) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else if (isCustomToolbarItem(item)) {\r\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(item)) {\r\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n }\r\n }\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function useToolbarWithOverflowDirectionContext() {\r\n return React.useContext(ToolbarWithOverflowDirectionContext);\r\n}\r\n\r\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\r\n return <>{p.children}</>;\r\n}\r\n\r\nfunction getItemWrapperClass(child: React.ReactNode) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child)) {\r\n if (child.props && child.props.addGroupSeparator)\r\n return \"components-toolbar-button-add-gap-before\";\r\n }\r\n return undefined;\r\n}\r\n\r\n/** Properties of [[ToolbarWithOverflow]] component.\r\n * @public\r\n */\r\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: Direction;\r\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\r\n overflowExpandsTo?: Direction;\r\n /** definitions for items of the toolbar. i.e. [[CommonToolbarItem]]. Items are expected to be already sorted by group and item. */\r\n items: CommonToolbarItem[];\r\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\r\n panelAlignment?: ToolbarPanelAlignment;\r\n /** Use Drag Interaction to open popups with nest action buttons */\r\n useDragInteraction?: boolean;\r\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\r\n toolbarOpacitySetting?: ToolbarOpacitySetting;\r\n /** Optional function to call on any item execution */\r\n onItemExecuted?: OnItemExecutedFunc;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Component that displays tool settings as a bar across the top of the content view.\r\n * @public\r\n */\r\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\r\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\r\n const useDragInteraction = !!props.useDragInteraction;\r\n const panelAlignment = props.panelAlignment ? props.panelAlignment : ToolbarPanelAlignment.Start;\r\n const useHeight = (expandsTo === Direction.Right || expandsTo === Direction.Left);\r\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\r\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\r\n const overflowTitle = React.useRef(UiComponents.translate(\"toolbar.overflow\"));\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n // use setImmediate to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\r\n setImmediate(() => {\r\n // istanbul ignore next\r\n if (!isMounted.current)\r\n return;\r\n setPopupPanelCount((prev) => {\r\n const nextCount = isOpening ? (prev + 1) : (prev - 1);\r\n // eslint-disable-next-line no-console\r\n // console.log(`new popup count = ${nextCount}`);\r\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\r\n });\r\n });\r\n }, []);\r\n\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const width = React.useRef<number | undefined>(undefined);\r\n const availableNodes = React.useMemo<React.ReactNode>(() => {\r\n return props.items.map((item, index) => {\r\n let addGroupSeparator = false;\r\n if (index > 0)\r\n addGroupSeparator = item.groupPriority !== props.items[index - 1].groupPriority;\r\n return (\r\n <ToolbarItemComponent\r\n key={item.id}\r\n item={item}\r\n addGroupSeparator={!!addGroupSeparator}\r\n />\r\n );\r\n });\r\n }, [props.items]);\r\n /* overflowItemKeys - keys of items to show in overflow panel\r\n * handleContainerResize - handler called when container <div> is resized.\r\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\r\n * handleEntryResize - handler called when determining size of each item/button. */\r\n const [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\r\n // handler called by ResizeObserver\r\n const handleResize = React.useCallback((w: number) => {\r\n width.current = w;\r\n width.current !== undefined && handleContainerResize(width.current);\r\n }, [handleContainerResize]);\r\n const resizeObserverRef = useResizeObserverSingleDimension(handleResize, useHeight);\r\n const handleClick = React.useCallback(() => {\r\n setIsOverflowPanelOpen((prev) => !prev);\r\n }, []);\r\n // istanbul ignore next - NEEDSWORK add complete tests\r\n const handleClose = React.useCallback(() => {\r\n setIsOverflowPanelOpen(false);\r\n }, []);\r\n\r\n const refs = useRefs(ref, resizeObserverRef);\r\n const availableItems = React.Children.toArray(availableNodes);\r\n const displayedItems = availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n const overflowPanelItems = overflowItemKeys ? availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (overflowItemKeys.indexOf(key) >= 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []) : [];\r\n\r\n const direction = getToolbarDirection(expandsTo);\r\n const overflowExpandsTo = undefined !== props.overflowExpandsTo ? props.overflowExpandsTo : Direction.Right;\r\n const addOverflowButton = React.useCallback((atStart: boolean) => {\r\n const overflowItems = !!atStart ? overflowPanelItems.reverse() : overflowPanelItems;\r\n return (<ToolbarItemContext.Provider\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: handleOverflowResize,\r\n }}\r\n >\r\n <ToolbarOverflowButton\r\n expandsTo={expandsTo}\r\n onClick={handleClick}\r\n onClose={handleClose}\r\n open={overflowItems.length > 0 && isOverflowPanelOpen}\r\n panelNode={\r\n <ToolbarOverflowPanel>\r\n <OverflowItemsContainer>\r\n {overflowItems.map(([key, child]) => {\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: true,\r\n useHeight,\r\n onResize: () => { },\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n </OverflowItemsContainer>\r\n </ToolbarOverflowPanel>\r\n }\r\n title={overflowTitle.current}\r\n />\r\n </ToolbarItemContext.Provider>);\r\n }, [handleClick, handleClose, handleOverflowResize, isOverflowPanelOpen, expandsTo, overflowPanelItems, useHeight]);\r\n\r\n const className = classnames(\r\n \"components-toolbar-overflow-sizer\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n props.className);\r\n\r\n const showOverflowAtStart = (direction === OrthogonalDirection.Horizontal) && (panelAlignment === ToolbarPanelAlignment.End);\r\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\r\n size of the item. */\r\n return (\r\n <ToolbarWithOverflowDirectionContext.Provider value={\r\n {\r\n expandsTo, direction, overflowExpandsTo, panelAlignment, useDragInteraction,\r\n toolbarOpacitySetting: undefined !== props.toolbarOpacitySetting ? props.toolbarOpacitySetting : ToolbarOpacitySetting.Proximity,\r\n overflowDirection: direction === OrthogonalDirection.Horizontal ? OrthogonalDirection.Vertical : OrthogonalDirection.Horizontal,\r\n openPopupCount: popupPanelCount,\r\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\r\n overflowDisplayActive: overflowPanelItems.length > 0 && isOverflowPanelOpen,\r\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => { },\r\n onKeyDown: props.onKeyDown ? props.onKeyDown : /* istanbul ignore next */ (_e: React.KeyboardEvent) => { },\r\n }\r\n }>\r\n {(availableItems.length > 0) &&\r\n <div\r\n className={className}\r\n ref={refs}\r\n style={props.style}\r\n onKeyDown={props.onKeyDown}\r\n role=\"presentation\"\r\n >\r\n <ToolbarItems\r\n className=\"components-items\"\r\n direction={direction}\r\n >\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && showOverflowAtStart && addOverflowButton(true)}\r\n {displayedItems.map(([key, child]) => {\r\n const onEntryResize = handleEntryResize(key);\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: onEntryResize,\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && !showOverflowAtStart && addOverflowButton(false)}\r\n\r\n </ToolbarItems>\r\n </div>\r\n }\r\n </ToolbarWithOverflowDirectionContext.Provider >\r\n );\r\n}\r\n\r\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\r\n * @internal\r\n */\r\nfunction getChildKey(child: React.ReactNode, index: number) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child) && child.key !== null) {\r\n return child.key.toString();\r\n }\r\n // istanbul ignore next\r\n return index.toString();\r\n}\r\n\r\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\r\n * @internal\r\n */\r\nfunction determineOverflowItems(size: number, entries: ReadonlyArray<readonly [string, number]>, overflowButtonSize: number, overflowButtonAtStart: boolean): string[] {\r\n let toolbarSize = 0;\r\n const buttonPadding = 2;\r\n if (overflowButtonAtStart && entries.length > 0) {\r\n let i = entries.length - 1;\r\n for (; i >= 0; i--) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n if (i >= 0) {\r\n let j = i + 1;\r\n for (; j < entries.length; j++) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(0, j).map((e) => e[0]);\r\n } else {\r\n return [];\r\n }\r\n } else {\r\n let i = 0;\r\n for (; i < entries.length; i++) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n let j = i;\r\n for (; j > 0; j--) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(j).map((e) => e[0]);\r\n }\r\n}\r\n\r\n/** Hook that returns a list of overflowItemKeys availableItems.\r\n * @internal\r\n */\r\nfunction useOverflow(availableItems: React.ReactNode, overflowButtonAtStart: boolean): [\r\n ReadonlyArray<string> | undefined,\r\n (size: number) => void,\r\n (size: number) => void,\r\n (key: string) => (size: number) => void,\r\n] {\r\n const [overflowItemKeys, setOverflown] = React.useState<ReadonlyArray<string>>();\r\n const itemSizes = React.useRef(new Map<string, number | undefined>());\r\n const size = React.useRef<number | undefined>(undefined);\r\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\r\n\r\n const calculateOverflow = React.useCallback(() => {\r\n const sizes = verifiedMapEntries(itemSizes.current);\r\n if (size.current === undefined ||\r\n sizes === undefined ||\r\n overflowButtonSize.current === undefined) {\r\n setOverflown(undefined);\r\n return;\r\n }\r\n\r\n // Calculate overflow.\r\n const newOverflown = determineOverflowItems(size.current, [...sizes.entries()], overflowButtonSize.current, overflowButtonAtStart);\r\n setOverflown((prevOverflown) => {\r\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\r\n });\r\n }, [overflowButtonAtStart]);\r\n\r\n React.useLayoutEffect(() => {\r\n const newEntryWidths = new Map<string, number | undefined>();\r\n const array = React.Children.toArray(availableItems);\r\n for (let i = 0; i < array.length; i++) {\r\n const child = array[i];\r\n const key = getChildKey(child, i);\r\n const lastW = itemSizes.current.get(key);\r\n newEntryWidths.set(key, lastW);\r\n }\r\n itemSizes.current = newEntryWidths;\r\n calculateOverflow();\r\n }, [availableItems, calculateOverflow]);\r\n\r\n const handleContainerResize = React.useCallback((w: number) => {\r\n const calculate = size.current !== w;\r\n size.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleOverflowResize = React.useCallback((w: number) => {\r\n const calculate = overflowButtonSize.current !== w;\r\n overflowButtonSize.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleEntryResize = React.useCallback((key: string) => (w: number) => {\r\n const oldW = itemSizes.current.get(key);\r\n if (oldW !== w) {\r\n itemSizes.current.set(key, w);\r\n calculateOverflow();\r\n }\r\n }, [calculateOverflow]);\r\n\r\n return [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize];\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\nexport interface ToolbarItemContextArgs {\r\n readonly hasOverflow: boolean;\r\n readonly useHeight: boolean;\r\n readonly onResize: (w: number) => void;\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>(null!);\r\n\r\n/** @internal */\r\nexport function useToolItemEntryContext() {\r\n return React.useContext(ToolbarItemContext);\r\n}\r\n\r\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\r\n for (const [, val] of map) {\r\n // istanbul ignore next during unit testing\r\n if (val === undefined)\r\n return undefined;\r\n }\r\n return map as Map<string, T>;\r\n}\r\n\r\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\r\n if (!prev)\r\n return false;\r\n // istanbul ignore next\r\n if (prev.length !== value.length)\r\n return false;\r\n for (let i = 0; i < prev.length; i++) {\r\n const p = prev[i];\r\n const v = value[i];\r\n // istanbul ignore next\r\n if (p !== v)\r\n return false;\r\n }\r\n return true;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0BAAwB;AACxB,4DAAoC;AACpC,6CAA+B;AAC/B,0DAG+B;AAC/B,kDAAsG;AACtG,iCAA2C;AAC3C,mCAAuC;AACvC,+CAA8E;AAC9E,yCAAmD;AACnD,mDAAuD;AACvD,2CAAwC;AACxC,uDAAoD;AACpD,2DAAwD;AACxD,qDAAqH;AACrH,kDAA+C;AAe/C;;;GAGG;AACH,gEAAgE;AACnD,QAAA,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAU,KAAK,CAAC,CAAC;AAE/E;;;GAGG;AACH,SAAgB,8BAA8B;IAC5C,OAAO,KAAK,CAAC,UAAU,CAAC,mCAA2B,CAAC,CAAC;AACvD,CAAC;AAFD,wEAEC;AAOD;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAiB;IACnD,OAAO,CAAC,CAAE,IAA0B,CAAC,QAAQ,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,CAAC,CAAC;AAC5G,CAAC;AAFD,kDAEC;AAED,gBAAgB;AACT,MAAM,mBAAmB,GAAG,CAAC,SAAoB,EAAuB,EAAE;IAC/E,MAAM,mBAAmB,GAAG,4BAAgB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC/E,OAAO,sCAA0B,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACjE,CAAC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEF;;GAEG;AACH,IAAY,qBAGX;AAHD,WAAY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C,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,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 \"./Toolbar.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport {\r\n ActionButton, CommonToolbarItem, ConditionalBooleanValue, ConditionalStringValue, CustomButtonDefinition,\r\n GroupButton, OnItemExecutedFunc, ToolbarItemUtilities,\r\n} from \"@itwin/appui-abstract\";\r\nimport { BadgeUtilities, CommonProps, IconHelper, NoChildrenProps, useRefs } from \"@itwin/core-react\";\r\nimport { ToolbarButtonItem } from \"./Item\";\r\nimport { ToolbarItems } from \"./Items\";\r\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\r\nimport { ToolbarOverflowButton } from \"./Overflow\";\r\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\r\nimport { PopupItem } from \"./PopupItem\";\r\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\r\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\r\nimport { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers } from \"./utilities/Direction\";\r\nimport { UiComponents } from \"../UiComponents\";\r\n\r\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\r\n * @public\r\n */\r\nexport interface CustomToolbarItem extends CustomButtonDefinition {\r\n /** React node that must result in providing a PopupItem @deprecated use panelContentNode */\r\n buttonNode?: React.ReactNode;\r\n /** defines the content to display in popup panel */\r\n panelContentNode?: 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 keepContentsLoaded?: boolean;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarPopupAutoHideContext = React.createContext<boolean>(false);\r\n\r\n/**\r\n * React hook used to retrieve the ToolbarPopupAutoHideContext.\r\n * @public\r\n */\r\nexport function useToolbarPopupAutoHideContext() {\r\n return React.useContext(ToolbarPopupAutoHideContext);\r\n}\r\n\r\n/** Describes toolbar item.\r\n * @public\r\n */\r\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem;\r\n\r\n/** CustomToolbarItem type guard.\r\n * @internal\r\n */\r\nexport function isCustomToolbarItem(item: ToolbarItem): item is CustomToolbarItem {\r\n return !!(item as CustomToolbarItem).isCustom && ((\"buttonNode\" in item) || (\"panelContentNode\" in item));\r\n}\r\n\r\n/** @internal */\r\nexport const getToolbarDirection = (expandsTo: Direction): OrthogonalDirection => {\r\n const orthogonalDirection = DirectionHelpers.getOrthogonalDirection(expandsTo);\r\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\r\n};\r\n\r\n/** Available alignment modes of [[ToolbarWithOverflow]] panels.\r\n * @public\r\n */\r\nexport enum ToolbarPanelAlignment {\r\n Start,\r\n End,\r\n}\r\n\r\n/** Enumeration of Toolbar Opacity setting.\r\n * @public\r\n */\r\nexport enum ToolbarOpacitySetting {\r\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\r\n Defaults,\r\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\r\n Proximity,\r\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\r\n Transparent,\r\n}\r\n\r\n/** Helpers for [[ToolbarPanelAlignment]].\r\n * @internal\r\n */\r\nexport class ToolbarPanelAlignmentHelpers {\r\n /** Class name of [[ToolbarPanelAlignment.Start]] */\r\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\r\n /** Class name of [[ToolbarPanelAlignment.End]] */\r\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\r\n\r\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\r\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\r\n switch (panelAlignment) {\r\n case ToolbarPanelAlignment.Start:\r\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\r\n case ToolbarPanelAlignment.End:\r\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface ToolbarOverflowContextProps {\r\n readonly expandsTo: Direction;\r\n readonly direction: OrthogonalDirection;\r\n readonly overflowExpandsTo: Direction;\r\n readonly overflowDirection: OrthogonalDirection;\r\n readonly panelAlignment: ToolbarPanelAlignment;\r\n readonly useDragInteraction: boolean;\r\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\r\n readonly openPopupCount: number;\r\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\r\n readonly overflowDisplayActive: boolean;\r\n readonly onItemExecuted: OnItemExecutedFunc;\r\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/**\r\n * Context used by Toolbar component to provide Direction to child components.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarWithOverflowDirectionContext = React.createContext<ToolbarOverflowContextProps>({\r\n expandsTo: Direction.Bottom,\r\n direction: OrthogonalDirection.Horizontal,\r\n overflowExpandsTo: Direction.Right,\r\n overflowDirection: OrthogonalDirection.Vertical,\r\n panelAlignment: ToolbarPanelAlignment.Start,\r\n useDragInteraction: false,\r\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\r\n openPopupCount: 0,\r\n onPopupPanelOpenClose: /* istanbul ignore next */ (_isOpening: boolean) => { },\r\n overflowDisplayActive: false,\r\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\r\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\r\n});\r\n\r\n/** @internal */\r\nexport function CustomItem({ item, addGroupSeparator }: { item: CustomToolbarItem, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const icon = React.useMemo(() => (item.icon &&\r\n IconHelper.getIconReactNode(item.icon, item.internalData)) || /* istanbul ignore next */\r\n <i className=\"icon icon-placeholder\" />, [item.icon, item.internalData]);\r\n const isDisabled = React.useMemo(() => ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);\r\n const title = React.useMemo(() => /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ?? item.id, [item.id, item.label]);\r\n const badge = React.useMemo(() => BadgeUtilities.getComponentForBadgeType(item.badgeType), [item.badgeType]);\r\n\r\n if (item.panelContentNode) {\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n icon={icon}\r\n isDisabled={isDisabled}\r\n title={title}\r\n panel={item.panelContentNode}\r\n hideIndicator={useDragInteraction}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n keepContentsMounted={item.keepContentsLoaded}\r\n />;\r\n }\r\n\r\n // istanbul ignore else\r\n if (item.buttonNode)\r\n return <>{item.buttonNode}</>;\r\n\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function GroupPopupItem({ item, addGroupSeparator }: { item: GroupButton, addGroupSeparator: boolean }) {\r\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const panel = React.useMemo(() => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />, [item]);\r\n if (useDragInteraction) {\r\n return <PopupItemWithDrag\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n groupItem={item}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n }\r\n return <PopupItem\r\n key={item.id}\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n panel={panel}\r\n badge={badge}\r\n hideIndicator={useDragInteraction}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ActionItem({ item, addGroupSeparator }: { item: ActionButton, addGroupSeparator: boolean }) {\r\n const title = ConditionalStringValue.getValue(item.label)!;\r\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\r\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\r\n const onExecute = React.useCallback(() => {\r\n item.execute();\r\n onItemExecuted(item);\r\n }, [item, onItemExecuted]);\r\n\r\n return <ToolbarButtonItem\r\n itemId={item.id}\r\n providerId={item.providerId}\r\n itemPriority={item.itemPriority}\r\n groupPriority={item.groupPriority}\r\n key={item.id}\r\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\r\n title={title}\r\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\r\n isActive={item.isActive}\r\n onClick={onExecute}\r\n badge={badge}\r\n addGroupSeparator={addGroupSeparator}\r\n />;\r\n}\r\n\r\n/** @internal */\r\nexport function ToolbarItemComponent({ item, addGroupSeparator }: { item: ToolbarItem, addGroupSeparator: boolean }) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else if (isCustomToolbarItem(item)) {\r\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n } else {\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isActionButton(item)) {\r\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\r\n }\r\n }\r\n // istanbul ignore next\r\n return null;\r\n}\r\n\r\n/** @internal */\r\nexport function useToolbarWithOverflowDirectionContext() {\r\n return React.useContext(ToolbarWithOverflowDirectionContext);\r\n}\r\n\r\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\r\n return <>{p.children}</>;\r\n}\r\n\r\nfunction getItemWrapperClass(child: React.ReactNode) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child)) {\r\n if (child.props && child.props.addGroupSeparator)\r\n return \"components-toolbar-button-add-gap-before\";\r\n }\r\n return undefined;\r\n}\r\n\r\n/** Properties of [[ToolbarWithOverflow]] component.\r\n * @public\r\n */\r\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: Direction;\r\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\r\n overflowExpandsTo?: Direction;\r\n /** definitions for items of the toolbar. i.e. [[CommonToolbarItem]]. Items are expected to be already sorted by group and item. */\r\n items: CommonToolbarItem[];\r\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\r\n panelAlignment?: ToolbarPanelAlignment;\r\n /** Use Drag Interaction to open popups with nest action buttons */\r\n useDragInteraction?: boolean;\r\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\r\n toolbarOpacitySetting?: ToolbarOpacitySetting;\r\n /** Optional function to call on any item execution */\r\n onItemExecuted?: OnItemExecutedFunc;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Component that displays tool settings as a bar across the top of the content view.\r\n * @public\r\n */\r\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\r\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\r\n const useDragInteraction = !!props.useDragInteraction;\r\n const panelAlignment = props.panelAlignment ? props.panelAlignment : ToolbarPanelAlignment.Start;\r\n const useHeight = (expandsTo === Direction.Right || expandsTo === Direction.Left);\r\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\r\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\r\n const overflowTitle = React.useRef(UiComponents.translate(\"toolbar.overflow\"));\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\r\n // use setImmediate to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\r\n setImmediate(() => {\r\n // istanbul ignore next\r\n if (!isMounted.current)\r\n return;\r\n setPopupPanelCount((prev) => {\r\n const nextCount = isOpening ? (prev + 1) : (prev - 1);\r\n // eslint-disable-next-line no-console\r\n // console.log(`new popup count = ${nextCount}`);\r\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\r\n });\r\n });\r\n }, []);\r\n\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const width = React.useRef<number | undefined>(undefined);\r\n const availableNodes = React.useMemo<React.ReactNode>(() => {\r\n return props.items.map((item, index) => {\r\n let addGroupSeparator = false;\r\n if (index > 0)\r\n addGroupSeparator = item.groupPriority !== props.items[index - 1].groupPriority;\r\n return (\r\n <ToolbarItemComponent\r\n key={item.id}\r\n item={item}\r\n addGroupSeparator={!!addGroupSeparator}\r\n />\r\n );\r\n });\r\n }, [props.items]);\r\n /* overflowItemKeys - keys of items to show in overflow panel\r\n * handleContainerResize - handler called when container <div> is resized.\r\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\r\n * handleEntryResize - handler called when determining size of each item/button. */\r\n const [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\r\n // handler called by ResizeObserver\r\n const handleResize = React.useCallback((w: number) => {\r\n width.current = w;\r\n width.current !== undefined && handleContainerResize(width.current);\r\n }, [handleContainerResize]);\r\n const resizeObserverRef = useResizeObserverSingleDimension(handleResize, useHeight);\r\n const handleClick = React.useCallback(() => {\r\n setIsOverflowPanelOpen((prev) => !prev);\r\n }, []);\r\n // istanbul ignore next - NEEDSWORK add complete tests\r\n const handleClose = React.useCallback(() => {\r\n setIsOverflowPanelOpen(false);\r\n }, []);\r\n\r\n const refs = useRefs(ref, resizeObserverRef);\r\n const availableItems = React.Children.toArray(availableNodes);\r\n const displayedItems = availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n const overflowPanelItems = overflowItemKeys ? availableItems.reduce<Array<[string, React.ReactNode]>>((acc, child, index) => {\r\n const key = getChildKey(child, index);\r\n if (overflowItemKeys.indexOf(key) >= 0) {\r\n acc.push([key, child]);\r\n }\r\n return acc;\r\n }, []) : [];\r\n\r\n const direction = getToolbarDirection(expandsTo);\r\n const overflowExpandsTo = undefined !== props.overflowExpandsTo ? props.overflowExpandsTo : Direction.Right;\r\n const addOverflowButton = React.useCallback((atStart: boolean) => {\r\n const overflowItems = !!atStart ? overflowPanelItems.reverse() : overflowPanelItems;\r\n return (<ToolbarItemContext.Provider\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: handleOverflowResize,\r\n }}\r\n >\r\n <ToolbarOverflowButton\r\n expandsTo={expandsTo}\r\n onClick={handleClick}\r\n onClose={handleClose}\r\n open={overflowItems.length > 0 && isOverflowPanelOpen}\r\n panelNode={\r\n <ToolbarOverflowPanel>\r\n <OverflowItemsContainer>\r\n {overflowItems.map(([key, child]) => {\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: true,\r\n useHeight,\r\n onResize: () => { },\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n </OverflowItemsContainer>\r\n </ToolbarOverflowPanel>\r\n }\r\n title={overflowTitle.current}\r\n />\r\n </ToolbarItemContext.Provider>);\r\n }, [handleClick, handleClose, handleOverflowResize, isOverflowPanelOpen, expandsTo, overflowPanelItems, useHeight]);\r\n\r\n const className = classnames(\r\n \"components-toolbar-overflow-sizer\",\r\n OrthogonalDirectionHelpers.getCssClassName(direction),\r\n props.className);\r\n\r\n const showOverflowAtStart = (direction === OrthogonalDirection.Horizontal) && (panelAlignment === ToolbarPanelAlignment.End);\r\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\r\n size of the item. */\r\n return (\r\n <ToolbarWithOverflowDirectionContext.Provider value={\r\n {\r\n expandsTo, direction, overflowExpandsTo, panelAlignment, useDragInteraction,\r\n toolbarOpacitySetting: undefined !== props.toolbarOpacitySetting ? props.toolbarOpacitySetting : ToolbarOpacitySetting.Proximity,\r\n overflowDirection: direction === OrthogonalDirection.Horizontal ? OrthogonalDirection.Vertical : OrthogonalDirection.Horizontal,\r\n openPopupCount: popupPanelCount,\r\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\r\n overflowDisplayActive: overflowPanelItems.length > 0 && isOverflowPanelOpen,\r\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => { },\r\n onKeyDown: props.onKeyDown ? props.onKeyDown : /* istanbul ignore next */ (_e: React.KeyboardEvent) => { },\r\n }\r\n }>\r\n {(availableItems.length > 0) &&\r\n <div\r\n className={className}\r\n ref={refs}\r\n style={props.style}\r\n onKeyDown={props.onKeyDown}\r\n role=\"presentation\"\r\n >\r\n <ToolbarItems\r\n className=\"components-items\"\r\n direction={direction}\r\n >\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && showOverflowAtStart && addOverflowButton(true)}\r\n {displayedItems.map(([key, child]) => {\r\n const onEntryResize = handleEntryResize(key);\r\n return (\r\n <ToolbarItemContext.Provider\r\n key={key}\r\n value={{\r\n hasOverflow: false,\r\n useHeight,\r\n onResize: onEntryResize,\r\n }}\r\n >\r\n {<ItemWrapper className={getItemWrapperClass(child)}>{child}</ItemWrapper>}\r\n </ToolbarItemContext.Provider>\r\n );\r\n })}\r\n {(!overflowItemKeys || overflowItemKeys.length > 0) && !showOverflowAtStart && addOverflowButton(false)}\r\n\r\n </ToolbarItems>\r\n </div>\r\n }\r\n </ToolbarWithOverflowDirectionContext.Provider >\r\n );\r\n}\r\n\r\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\r\n * @internal\r\n */\r\nfunction getChildKey(child: React.ReactNode, index: number) {\r\n // istanbul ignore else\r\n if (React.isValidElement(child) && child.key !== null) {\r\n return child.key.toString();\r\n }\r\n // istanbul ignore next\r\n return index.toString();\r\n}\r\n\r\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\r\n * @internal\r\n */\r\nfunction determineOverflowItems(size: number, entries: ReadonlyArray<readonly [string, number]>, overflowButtonSize: number, overflowButtonAtStart: boolean): string[] {\r\n let toolbarSize = 0;\r\n const buttonPadding = 2;\r\n if (overflowButtonAtStart && entries.length > 0) {\r\n let i = entries.length - 1;\r\n for (; i >= 0; i--) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n if (i >= 0) {\r\n let j = i + 1;\r\n for (; j < entries.length; j++) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(0, j).map((e) => e[0]);\r\n } else {\r\n return [];\r\n }\r\n } else {\r\n let i = 0;\r\n for (; i < entries.length; i++) {\r\n const w = entries[i][1] + buttonPadding;\r\n const newSettingsWidth = toolbarSize + w;\r\n if (newSettingsWidth > size) {\r\n toolbarSize += (overflowButtonSize + buttonPadding);\r\n break;\r\n }\r\n toolbarSize = newSettingsWidth;\r\n }\r\n let j = i;\r\n for (; j > 0; j--) {\r\n if (toolbarSize <= size)\r\n break;\r\n const w = entries[j][1] + buttonPadding;\r\n toolbarSize -= w;\r\n }\r\n\r\n return entries.slice(j).map((e) => e[0]);\r\n }\r\n}\r\n\r\n/** Hook that returns a list of overflowItemKeys availableItems.\r\n * @internal\r\n */\r\nfunction useOverflow(availableItems: React.ReactNode, overflowButtonAtStart: boolean): [\r\n ReadonlyArray<string> | undefined,\r\n (size: number) => void,\r\n (size: number) => void,\r\n (key: string) => (size: number) => void,\r\n] {\r\n const [overflowItemKeys, setOverflown] = React.useState<ReadonlyArray<string>>();\r\n const itemSizes = React.useRef(new Map<string, number | undefined>());\r\n const size = React.useRef<number | undefined>(undefined);\r\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\r\n\r\n const calculateOverflow = React.useCallback(() => {\r\n const sizes = verifiedMapEntries(itemSizes.current);\r\n if (size.current === undefined ||\r\n sizes === undefined ||\r\n overflowButtonSize.current === undefined) {\r\n setOverflown(undefined);\r\n return;\r\n }\r\n\r\n // Calculate overflow.\r\n const newOverflown = determineOverflowItems(size.current, [...sizes.entries()], overflowButtonSize.current, overflowButtonAtStart);\r\n setOverflown((prevOverflown) => {\r\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\r\n });\r\n }, [overflowButtonAtStart]);\r\n\r\n React.useLayoutEffect(() => {\r\n const newEntryWidths = new Map<string, number | undefined>();\r\n const array = React.Children.toArray(availableItems);\r\n for (let i = 0; i < array.length; i++) {\r\n const child = array[i];\r\n const key = getChildKey(child, i);\r\n const lastW = itemSizes.current.get(key);\r\n newEntryWidths.set(key, lastW);\r\n }\r\n itemSizes.current = newEntryWidths;\r\n calculateOverflow();\r\n }, [availableItems, calculateOverflow]);\r\n\r\n const handleContainerResize = React.useCallback((w: number) => {\r\n const calculate = size.current !== w;\r\n size.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleOverflowResize = React.useCallback((w: number) => {\r\n const calculate = overflowButtonSize.current !== w;\r\n overflowButtonSize.current = w;\r\n calculate && calculateOverflow();\r\n }, [calculateOverflow]);\r\n\r\n const handleEntryResize = React.useCallback((key: string) => (w: number) => {\r\n const oldW = itemSizes.current.get(key);\r\n if (oldW !== w) {\r\n itemSizes.current.set(key, w);\r\n calculateOverflow();\r\n }\r\n }, [calculateOverflow]);\r\n\r\n return [overflowItemKeys, handleContainerResize, handleOverflowResize, handleEntryResize];\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\nexport interface ToolbarItemContextArgs {\r\n readonly hasOverflow: boolean;\r\n readonly useHeight: boolean;\r\n readonly onResize: (w: number) => void;\r\n}\r\n\r\n/** Interface toolbars use to define context for its items.\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>(null!);\r\n\r\n/** @internal */\r\nexport function useToolItemEntryContext() {\r\n return React.useContext(ToolbarItemContext);\r\n}\r\n\r\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\r\n for (const [, val] of map) {\r\n // istanbul ignore next during unit testing\r\n if (val === undefined)\r\n return undefined;\r\n }\r\n return map as Map<string, T>;\r\n}\r\n\r\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\r\n if (!prev)\r\n return false;\r\n // istanbul ignore next\r\n if (prev.length !== value.length)\r\n return false;\r\n for (let i = 0; i < prev.length; i++) {\r\n const p = prev[i];\r\n const v = value[i];\r\n // istanbul ignore next\r\n if (p !== v)\r\n return false;\r\n }\r\n return true;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/toolbar/groupPanel/tool/Tool.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,kDAAkD;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iBAAiB;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,KAAK,IAAI,CAAC;IACrD,yDAAyD;IACzD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,KAAK,IAAI,CAAC;IACzD,uBAAuB;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,uBAAuB;IACvB,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC;IACjC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/toolbar/groupPanel/tool/Tool.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,kDAAkD;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iBAAiB;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,KAAK,IAAI,CAAC;IACrD,yDAAyD;IACzD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,KAAK,IAAI,CAAC;IACzD,uBAAuB;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,uBAAuB;IACvB,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC;IACjC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAqD9C"}
|
|
@@ -51,7 +51,7 @@ function GroupTool(props) {
|
|
|
51
51
|
if (!props.isDisabled && props.onPointerUp)
|
|
52
52
|
props.onPointerUp(props.item);
|
|
53
53
|
}, [props]);
|
|
54
|
-
return (React.createElement("div", { className: itemClassName, onClick: handleClick, onKeyDown: props.onKeyDown, onPointerUp: handlePointerUp, ref: ref, style: props.style, role: "button", tabIndex: 0 },
|
|
54
|
+
return (React.createElement("div", { className: itemClassName, onClick: handleClick, onKeyDown: props.onKeyDown, onPointerUp: handlePointerUp, "data-item-id": props.item.id, "data-item-type": "popup-tool-panel-item", "data-item-priority": props.item.itemPriority, "data-item-providerid": props.item.providerId, ref: ref, style: props.style, role: "button", tabIndex: 0 },
|
|
55
55
|
React.createElement("div", { className: "components-icon" },
|
|
56
56
|
props.icon,
|
|
57
57
|
props.badge &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../../../../../src/components-react/toolbar/groupPanel/tool/Tool.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uBAAqB;AACrB,4DAAoC;AACpC,6CAA+B;AAE/B,kDAA6D;AA8B7D;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAqB;IAC7C,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAA,wBAAW,EAAC,GAAG,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,IAAA,oBAAU,EAC9B,oDAAoD,EACpD,KAAK,CAAC,QAAQ,IAAI,mBAAmB,EACrC,KAAK,CAAC,SAAS,IAAI,oBAAoB,EACvC,KAAK,CAAC,UAAU,IAAI,qBAAqB,EACzC,KAAK,CAAC,WAAW,IAAI,uBAAuB,EAC5C,QAAQ,IAAI,qBAAqB,EACjC,KAAK,CAAC,SAAS,CAAC,CAAC;IAEnB,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,OAAO;YACpC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,CA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AK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC7C,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,WAAW;YACxC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,6BACE,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,WAAW,EAAE,eAAe,kBACd,KAAK,CAAC,IAAI,CAAC,EAAE,oBACZ,uBAAuB,wBAClB,KAAK,CAAC,IAAI,CAAC,YAAY,0BACrB,KAAK,CAAC,IAAI,CAAC,UAAU,EAC3C,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC;QAEX,6BAAK,SAAS,EAAC,iBAAiB;YAC7B,KAAK,CAAC,IAAI;YACV,KAAK,CAAC,KAAK;gBACV,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,KAAK,CACR,CAEJ;QACN,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,KAAK,CACR;QACL,KAAK,CAAC,QAAQ,CACX,CACP,CAAC;AACJ,CAAC;AArDD,8BAqDC","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 \"./Tool.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, useTargeted } from \"@itwin/core-react\";\r\n\r\n/** Properties of [[GroupTool]] component.\r\n * @internal\r\n */\r\nexport interface GroupToolProps extends CommonProps {\r\n /** Additional content, besides icon and label. */\r\n children?: React.ReactNode;\r\n /** Tool icon. */\r\n icon?: React.ReactNode;\r\n /** Describes if the item is active. */\r\n isActive?: boolean;\r\n /** Describes if the item is disabled. */\r\n isDisabled?: boolean;\r\n /** Describes if the item is focused. */\r\n isFocused?: boolean;\r\n /** Tool label. */\r\n label?: string;\r\n /** Function called when the item is clicked. */\r\n onClick?: (item: GroupButton | ActionButton) => void;\r\n /** Function called when pointer up event is received. */\r\n onPointerUp?: (item: GroupButton | ActionButton) => void;\r\n /** A badge to draw. */\r\n badge?: React.ReactNode;\r\n /** GroupButton item */\r\n item: GroupButton | ActionButton;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Tool entry of tool group panel. Used in [[GroupColumn]].\r\n * @internal\r\n */\r\nexport function GroupTool(props: GroupToolProps) {\r\n const ref = React.useRef<HTMLDivElement>(null);\r\n const targeted = useTargeted(ref);\r\n const itemClassName = classnames(\r\n \"components-toolbar-item-expandable-group-tool-item\",\r\n props.isActive && \"components-active\",\r\n props.isFocused && \"components-focused\",\r\n props.isDisabled && \"components-disabled\",\r\n props.onPointerUp && \"components-pointer-up\",\r\n targeted && \"components-targeted\",\r\n props.className);\r\n\r\n const handleClick = React.useCallback(() => {\r\n // istanbul ignore else\r\n if (!props.isDisabled && props.onClick)\r\n props.onClick(props.item);\r\n }, [props]);\r\n\r\n const handlePointerUp = React.useCallback(() => {\r\n // istanbul ignore else\r\n if (!props.isDisabled && props.onPointerUp)\r\n props.onPointerUp(props.item);\r\n }, [props]);\r\n\r\n return (\r\n <div\r\n className={itemClassName}\r\n onClick={handleClick}\r\n onKeyDown={props.onKeyDown}\r\n onPointerUp={handlePointerUp}\r\n data-item-id={props.item.id}\r\n data-item-type=\"popup-tool-panel-item\"\r\n data-item-priority={props.item.itemPriority}\r\n data-item-providerid={props.item.providerId}\r\n ref={ref}\r\n style={props.style}\r\n role=\"button\"\r\n tabIndex={0}\r\n >\r\n <div className=\"components-icon\">\r\n {props.icon}\r\n {props.badge &&\r\n <div className=\"components-badge\">\r\n {props.badge}\r\n </div>\r\n }\r\n </div>\r\n <div className=\"components-label\">\r\n {props.label}\r\n </div>\r\n {props.children}\r\n </div>\r\n );\r\n}\r\n"]}
|
|
@@ -32,7 +32,9 @@ export interface GridCategoryItem extends FlatGridItemBase {
|
|
|
32
32
|
readonly type: FlatGridItemType.Category;
|
|
33
33
|
readonly name: string;
|
|
34
34
|
readonly derivedCategory: PropertyCategory;
|
|
35
|
+
/** @deprecated Use [[getChildren]] and filter categories yourself. */
|
|
35
36
|
getChildCategories(): GridCategoryItem[];
|
|
37
|
+
/** @deprecated Use [[getDescendantsAndSelf]] and filter categories yourself. */
|
|
36
38
|
getDescendantCategoriesAndSelf(): GridCategoryItem[];
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatGridItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/FlatGridItem.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM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I,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
|
/**
|
package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableFlatGridItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAuB,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;GAKG;AACH,oBAAY,gBAAgB;IAC1B,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,KAAK,IAAA;IACL,MAAM,IAAA;CACP;AAED;;;GAGG;AACH,oBAAY,wBAAwB,GAAG,gBAAgB,CAAC,KAAK,GAAG,gBAAgB,CAAC,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC;AAErH;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,0BAA0B,EAAE,MAAM,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB,I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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,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,0BAA0B,EAAE,MAAM,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,OAAO,C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,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"}
|
package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map
CHANGED
|
@@ -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;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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;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,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAChD,CAAC;IAMD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAW,0BAA0B;QACnC,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC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AwB;QACrH,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,mBAAmB,EAAE,CAAC;QACvE,MAAM,OAAO,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,IAAI,CAAC;QACrC,MAAM,eAAe,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,YAAY,CAAC;QAExD,OAAO,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;IACvE,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,MAAsB,EAAE,4BAAiD;QACjG,6DAA6D;QAC7D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,0BAA0B;QAC5C,OAAO,KAAK,CAAC,0BAA2B,CAAC;IAC3C,CAAC;IAED,IAAoB,kBAAkB;QACpC,OAAO,KAAK,CAAC,kBAAmB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF","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"]}
|
package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|