@itwin/components-react 4.11.0 → 4.12.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 +8 -1
- package/lib/cjs/components-react/UiComponents.d.ts +0 -4
- package/lib/cjs/components-react/UiComponents.d.ts.map +1 -1
- package/lib/cjs/components-react/UiComponents.js +2 -12
- package/lib/cjs/components-react/UiComponents.js.map +1 -1
- package/lib/cjs/components-react/UiComponents.json +153 -0
- package/lib/cjs/components-react/filter-builder/Operators.d.ts +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +4 -7
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -4
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +2 -3
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/cjs/components-react/useTranslation.d.ts +4 -7
- package/lib/cjs/components-react/useTranslation.d.ts.map +1 -1
- package/lib/cjs/components-react/useTranslation.js +39 -7
- package/lib/cjs/components-react/useTranslation.js.map +1 -1
- package/lib/cjs/components-react.d.ts +1 -0
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +1 -0
- package/lib/cjs/components-react.js.map +1 -1
- package/lib/esm/components-react/UiComponents.d.ts +0 -4
- package/lib/esm/components-react/UiComponents.d.ts.map +1 -1
- package/lib/esm/components-react/UiComponents.js +2 -12
- package/lib/esm/components-react/UiComponents.js.map +1 -1
- package/lib/esm/components-react/UiComponents.json +153 -0
- package/lib/esm/components-react/filter-builder/Operators.d.ts +1 -0
- package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js +1 -0
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +5 -8
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +2 -5
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js +3 -4
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/esm/components-react/useTranslation.d.ts +4 -7
- package/lib/esm/components-react/useTranslation.d.ts.map +1 -1
- package/lib/esm/components-react/useTranslation.js +14 -5
- package/lib/esm/components-react/useTranslation.js.map +1 -1
- package/lib/esm/components-react.d.ts +1 -0
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +1 -0
- package/lib/esm/components-react.js.map +1 -1
- package/package.json +4 -5
|
@@ -131,9 +131,6 @@ function PopupItemWithDrag(props) {
|
|
|
131
131
|
!appui_abstract_1.ConditionalBooleanValue.getValue(activeAction.isDisabled) &&
|
|
132
132
|
activeAction.execute();
|
|
133
133
|
}, [activeAction]);
|
|
134
|
-
const badge = activeAction
|
|
135
|
-
? core_react_1.BadgeUtilities.getComponentForBadgeType(activeAction.badgeType)
|
|
136
|
-
: props.badge;
|
|
137
134
|
const icon = activeAction
|
|
138
135
|
? core_react_1.IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData)
|
|
139
136
|
: props.icon;
|
|
@@ -158,7 +155,7 @@ function PopupItemWithDrag(props) {
|
|
|
158
155
|
} },
|
|
159
156
|
React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "action-tool-button", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-provider-id": props.providerId, ref: targetRef, onPointerDown: handlePointerDown, onClick: handleButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: title },
|
|
160
157
|
React.createElement("div", { className: "components-icon" }, icon),
|
|
161
|
-
props.badge && React.createElement("div", { className: "components-badge" }, badge),
|
|
158
|
+
props.badge && (React.createElement("div", { className: "components-badge" }, activeAction ? (React.createElement(core_react_1.Badge, { type: activeAction.badgeType })) : (props.badge))),
|
|
162
159
|
React.createElement("div", { className: "components-triangle" })),
|
|
163
160
|
React.createElement(PopupItem_1.PopupItemPopup, { isOpen: isPanelShown, onClose: handleClose, position: toToolbarPopupRelativePosition(expandsToDirection, panelAlignment), target: target },
|
|
164
161
|
React.createElement(PopupItemsPanel_1.PopupItemsPanel, { groupItem: props.groupItem, activateOnPointerUp: true }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4BAA0B;AAC1B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAK+B;AAC/B,kDAA4E;AAE5E,2CAAkE;AAClE,uDAAoD;AACpD,yEAIoC;AACpC,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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,IAAI,GACzB,CACa,CACY,CAChC,CAAC;AACJ,CAAC;AAnID,8CAmIC;AAED,gBAAgB;AAChB,SAAgB,8BAA8B,CAC5C,SAAoB,EACpB,SAAgC;IAEhC,uBAAuB;IACvB,QAAQ,SAAS,EAAE;QACjB,KAAK,qBAAS,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,SAAS,KAAK,gDAAqB,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;AAlBD,wEAkBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport \"./PopupItem.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n RelativePosition,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport { BadgeUtilities, IconHelper, useRefState } from \"@itwin/core-react\";\nimport type { ToolbarButtonItemProps } from \"./Item\";\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\nimport {\n ToolbarPanelAlignment,\n useToolbarWithOverflowDirectionContext,\n useToolItemEntryContext,\n} from \"./InternalToolbarComponent\";\nimport { useDragInteraction } from \"./useDragInteraction\";\nimport { Direction } from \"./utilities/Direction\";\n\n/** Properties of [[PopupItem]] component.\n * @public\n */\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\n /** Panel of the toolbar. */\n groupItem: GroupButton;\n}\n\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n if (childItem.isActive) return childItem;\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = tryFindActiveAction(childItem);\n if (nestedChild) return nestedChild;\n }\n }\n return undefined;\n}\n\nfunction getFirstAvailableChildActionItem(\n item: GroupButton\n): ActionButton | undefined {\n for (const childItem of item.items) {\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n } else {\n // istanbul ignore else\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = getFirstAvailableChildActionItem(childItem);\n // istanbul ignore else\n if (nestedChild) return nestedChild;\n }\n }\n }\n return undefined;\n}\n\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\n const activeItem = tryFindActiveAction(item);\n if (activeItem) return activeItem;\n\n // initially look only in root items\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n }\n }\n\n // if not found look inside groups\n return getFirstAvailableChildActionItem(item);\n}\n\n/** Expandable Group button Item\n * @public\n */\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\n const [isPanelShown, setPanelShown] = React.useState(false);\n const [activeAction, setActiveAction] = React.useState(\n getActiveAction(props.groupItem)\n );\n const {\n expandsTo,\n overflowExpandsTo,\n panelAlignment,\n onPopupPanelOpenClose,\n } = useToolbarWithOverflowDirectionContext();\n\n React.useEffect(() => {\n const newActiveAction = getActiveAction(props.groupItem);\n // istanbul ignore else\n if (newActiveAction) {\n // istanbul ignore next\n if (newActiveAction.isActive) {\n setActiveAction(newActiveAction);\n } else {\n if (activeAction && activeAction.isActive) {\n setActiveAction({ ...activeAction, isActive: false });\n }\n }\n }\n }, [props.groupItem, activeAction]);\n\n const processPanelOpenClose = React.useCallback(\n (isOpening: boolean) => {\n setPanelShown((prev) => {\n // istanbul ignore else\n if (prev !== isOpening) onPopupPanelOpenClose(isOpening);\n return isOpening;\n });\n },\n [setPanelShown, onPopupPanelOpenClose]\n );\n\n // handle open and closing popup panel\n const onOpenPanel = React.useCallback(() => {\n processPanelOpenClose(!isPanelShown);\n }, [isPanelShown, processPanelOpenClose]);\n\n // handle open and closing popup panel\n const onGroupButtonClick = React.useCallback(() => {\n // only execute action if not disabled\n activeAction &&\n !ConditionalBooleanValue.getValue(activeAction.isDisabled) &&\n activeAction.execute();\n }, [activeAction]);\n\n const badge = activeAction\n ? BadgeUtilities.getComponentForBadgeType(activeAction.badgeType)\n : props.badge;\n const icon = activeAction\n ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData)\n : props.icon;\n const title = activeAction\n ? ConditionalStringValue.getValue(activeAction.label)\n : props.title;\n const isActive = activeAction ? activeAction.isActive : props.isActive;\n const isDisabled = ConditionalBooleanValue.getValue(\n activeAction ? activeAction.isDisabled : props.isDisabled\n );\n\n const { handlePointerDown, handleButtonClick } = useDragInteraction(\n onGroupButtonClick,\n onOpenPanel\n );\n\n const className = classnames(\n \"components-toolbar-button-item\",\n \"components-toolbar-expandable-button\",\n isActive && \"components-active\",\n isDisabled && \"components-disabled-drag\",\n props.className\n );\n\n const [targetRef, target] = useRefState<HTMLButtonElement>();\n const handleClose = React.useCallback(() => {\n processPanelOpenClose(false);\n }, [processPanelOpenClose]);\n const { hasOverflow } = useToolItemEntryContext();\n const expandsToDirection = hasOverflow\n ? /* istanbul ignore next */ overflowExpandsTo\n : expandsTo;\n\n return (\n <ToolbarPopupContext.Provider\n value={{\n closePanel: /* istanbul ignore next */ () =>\n processPanelOpenClose(false),\n setSelectedItem: /* istanbul ignore next */ (\n buttonItem: ActionButton\n ) => setActiveAction(buttonItem),\n }}\n >\n <button\n data-item-id={props.itemId}\n data-item-type=\"action-tool-button\"\n data-item-group-priority={props.groupPriority}\n data-item-priority={props.itemPriority}\n data-item-provider-id={props.providerId}\n ref={targetRef}\n onPointerDown={handlePointerDown}\n onClick={handleButtonClick}\n onKeyDown={props.onKeyDown}\n className={className}\n style={props.style}\n title={title}\n >\n <div className=\"components-icon\">{icon}</div>\n {props.badge && <div className=\"components-badge\">{badge}</div>}\n <div className=\"components-triangle\" />\n </button>\n <PopupItemPopup\n isOpen={isPanelShown}\n onClose={handleClose}\n position={toToolbarPopupRelativePosition(\n expandsToDirection,\n panelAlignment\n )}\n target={target}\n >\n <PopupItemsPanel\n groupItem={props.groupItem}\n activateOnPointerUp={true}\n />\n </PopupItemPopup>\n </ToolbarPopupContext.Provider>\n );\n}\n\n/** @internal */\nexport function toToolbarPopupRelativePosition(\n expandsTo: Direction,\n alignment: ToolbarPanelAlignment\n): RelativePosition {\n // istanbul ignore next\n switch (expandsTo) {\n case Direction.Bottom: {\n if (alignment === ToolbarPanelAlignment.End)\n return RelativePosition.BottomRight;\n return RelativePosition.BottomLeft;\n }\n case Direction.Left:\n return RelativePosition.LeftTop;\n case Direction.Right:\n return RelativePosition.RightTop;\n case Direction.Top:\n return RelativePosition.Top;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4BAA0B;AAC1B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAK+B;AAC/B,kDAAmE;AAEnE,2CAAkE;AAClE,uDAAoD;AACpD,yEAIoC;AACpC,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,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,EAC1B,mBAAmB,EAAE,IAAI,GACzB,CACa,CACY,CAChC,CAAC;AACJ,CAAC;AAxID,8CAwIC;AAED,gBAAgB;AAChB,SAAgB,8BAA8B,CAC5C,SAAoB,EACpB,SAAgC;IAEhC,uBAAuB;IACvB,QAAQ,SAAS,EAAE;QACjB,KAAK,qBAAS,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,SAAS,KAAK,gDAAqB,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;AAlBD,wEAkBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport \"./PopupItem.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n RelativePosition,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport { Badge, IconHelper, useRefState } from \"@itwin/core-react\";\nimport type { ToolbarButtonItemProps } from \"./Item\";\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\nimport {\n ToolbarPanelAlignment,\n useToolbarWithOverflowDirectionContext,\n useToolItemEntryContext,\n} from \"./InternalToolbarComponent\";\nimport { useDragInteraction } from \"./useDragInteraction\";\nimport { Direction } from \"./utilities/Direction\";\n\n/** Properties of [[PopupItem]] component.\n * @public\n */\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\n /** Panel of the toolbar. */\n groupItem: GroupButton;\n}\n\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n if (childItem.isActive) return childItem;\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = tryFindActiveAction(childItem);\n if (nestedChild) return nestedChild;\n }\n }\n return undefined;\n}\n\nfunction getFirstAvailableChildActionItem(\n item: GroupButton\n): ActionButton | undefined {\n for (const childItem of item.items) {\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n } else {\n // istanbul ignore else\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = getFirstAvailableChildActionItem(childItem);\n // istanbul ignore else\n if (nestedChild) return nestedChild;\n }\n }\n }\n return undefined;\n}\n\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\n const activeItem = tryFindActiveAction(item);\n if (activeItem) return activeItem;\n\n // initially look only in root items\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n }\n }\n\n // if not found look inside groups\n return getFirstAvailableChildActionItem(item);\n}\n\n/** Expandable Group button Item\n * @public\n */\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\n const [isPanelShown, setPanelShown] = React.useState(false);\n const [activeAction, setActiveAction] = React.useState(\n getActiveAction(props.groupItem)\n );\n const {\n expandsTo,\n overflowExpandsTo,\n panelAlignment,\n onPopupPanelOpenClose,\n } = useToolbarWithOverflowDirectionContext();\n\n React.useEffect(() => {\n const newActiveAction = getActiveAction(props.groupItem);\n // istanbul ignore else\n if (newActiveAction) {\n // istanbul ignore next\n if (newActiveAction.isActive) {\n setActiveAction(newActiveAction);\n } else {\n if (activeAction && activeAction.isActive) {\n setActiveAction({ ...activeAction, isActive: false });\n }\n }\n }\n }, [props.groupItem, activeAction]);\n\n const processPanelOpenClose = React.useCallback(\n (isOpening: boolean) => {\n setPanelShown((prev) => {\n // istanbul ignore else\n if (prev !== isOpening) onPopupPanelOpenClose(isOpening);\n return isOpening;\n });\n },\n [setPanelShown, onPopupPanelOpenClose]\n );\n\n // handle open and closing popup panel\n const onOpenPanel = React.useCallback(() => {\n processPanelOpenClose(!isPanelShown);\n }, [isPanelShown, processPanelOpenClose]);\n\n // handle open and closing popup panel\n const onGroupButtonClick = React.useCallback(() => {\n // only execute action if not disabled\n activeAction &&\n !ConditionalBooleanValue.getValue(activeAction.isDisabled) &&\n activeAction.execute();\n }, [activeAction]);\n\n const icon = activeAction\n ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData)\n : props.icon;\n const title = activeAction\n ? ConditionalStringValue.getValue(activeAction.label)\n : props.title;\n const isActive = activeAction ? activeAction.isActive : props.isActive;\n const isDisabled = ConditionalBooleanValue.getValue(\n activeAction ? activeAction.isDisabled : props.isDisabled\n );\n\n const { handlePointerDown, handleButtonClick } = useDragInteraction(\n onGroupButtonClick,\n onOpenPanel\n );\n\n const className = classnames(\n \"components-toolbar-button-item\",\n \"components-toolbar-expandable-button\",\n isActive && \"components-active\",\n isDisabled && \"components-disabled-drag\",\n props.className\n );\n\n const [targetRef, target] = useRefState<HTMLButtonElement>();\n const handleClose = React.useCallback(() => {\n processPanelOpenClose(false);\n }, [processPanelOpenClose]);\n const { hasOverflow } = useToolItemEntryContext();\n const expandsToDirection = hasOverflow\n ? /* istanbul ignore next */ overflowExpandsTo\n : expandsTo;\n\n return (\n <ToolbarPopupContext.Provider\n value={{\n closePanel: /* istanbul ignore next */ () =>\n processPanelOpenClose(false),\n setSelectedItem: /* istanbul ignore next */ (\n buttonItem: ActionButton\n ) => setActiveAction(buttonItem),\n }}\n >\n <button\n data-item-id={props.itemId}\n data-item-type=\"action-tool-button\"\n data-item-group-priority={props.groupPriority}\n data-item-priority={props.itemPriority}\n data-item-provider-id={props.providerId}\n ref={targetRef}\n onPointerDown={handlePointerDown}\n onClick={handleButtonClick}\n onKeyDown={props.onKeyDown}\n className={className}\n style={props.style}\n title={title}\n >\n <div className=\"components-icon\">{icon}</div>\n {props.badge && (\n <div className=\"components-badge\">\n {activeAction ? (\n <Badge type={activeAction.badgeType} />\n ) : (\n props.badge\n )}\n </div>\n )}\n <div className=\"components-triangle\" />\n </button>\n <PopupItemPopup\n isOpen={isPanelShown}\n onClose={handleClose}\n position={toToolbarPopupRelativePosition(\n expandsToDirection,\n panelAlignment\n )}\n target={target}\n >\n <PopupItemsPanel\n groupItem={props.groupItem}\n activateOnPointerUp={true}\n />\n </PopupItemPopup>\n </ToolbarPopupContext.Provider>\n );\n}\n\n/** @internal */\nexport function toToolbarPopupRelativePosition(\n expandsTo: Direction,\n alignment: ToolbarPanelAlignment\n): RelativePosition {\n // istanbul ignore next\n switch (expandsTo) {\n case Direction.Bottom: {\n if (alignment === ToolbarPanelAlignment.End)\n return RelativePosition.BottomRight;\n return RelativePosition.BottomLeft;\n }\n case Direction.Left:\n return RelativePosition.LeftTop;\n case Direction.Right:\n return RelativePosition.RightTop;\n case Direction.Top:\n return RelativePosition.Top;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItemsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemsPanel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAwBvE,UAAU,oBAAoB;IAC5B,SAAS,EAAE,WAAW,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"PopupItemsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemsPanel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAwBvE,UAAU,oBAAoB;IAC5B,SAAS,EAAE,WAAW,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAmK1D"}
|
|
@@ -120,13 +120,12 @@ function PopupItemsPanel(props) {
|
|
|
120
120
|
}, [onKeyDown]);
|
|
121
121
|
// build n-number of columns
|
|
122
122
|
const columns = React.useMemo(() => columnToItems.map((columnItems, columnIndex) => (React.createElement(Column_1.GroupColumn, { key: columnIndex }, columnItems.map((panelItem) => {
|
|
123
|
-
const badge = core_react_1.BadgeUtilities.getComponentForBadgeType(panelItem.badgeType);
|
|
124
123
|
const icon = core_react_1.IconHelper.getIconReactNode(panelItem.icon, panelItem.internalData);
|
|
125
124
|
const label = appui_abstract_1.ConditionalStringValue.getValue(panelItem.label);
|
|
126
125
|
if (appui_abstract_1.ToolbarItemUtilities.isGroupButton(panelItem)) {
|
|
127
|
-
return (React.createElement(Expander_1.GroupToolExpander, { isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(panelItem.isDisabled), key: panelItem.id, label: label, icon: icon, badge:
|
|
126
|
+
return (React.createElement(Expander_1.GroupToolExpander, { isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(panelItem.isDisabled), key: panelItem.id, label: label, icon: icon, badge: React.createElement(core_react_1.Badge, { type: panelItem.badgeType }), item: panelItem, onClick: handleGroupItemClick }));
|
|
128
127
|
}
|
|
129
|
-
return (React.createElement(Tool_1.GroupTool, { isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(panelItem.isDisabled), isActive: !!panelItem.isActive, key: panelItem.id, label: label, icon: icon, item: panelItem, onClick: handleActionItemClick, onPointerUp: handleOnPointerUp, badge:
|
|
128
|
+
return (React.createElement(Tool_1.GroupTool, { isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(panelItem.isDisabled), isActive: !!panelItem.isActive, key: panelItem.id, label: label, icon: icon, item: panelItem, onClick: handleActionItemClick, onPointerUp: handleOnPointerUp, badge: React.createElement(core_react_1.Badge, { type: panelItem.badgeType }) }));
|
|
130
129
|
})))), [
|
|
131
130
|
columnToItems,
|
|
132
131
|
handleActionItemClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItemsPanel.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemsPanel.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAE/B,0DAI+B;AAC/B,kDAA+D;AAC/D,sDAAmD;AACnD,gDAAkD;AAClD,kDAA+C;AAC/C,8CAA2C;AAC3C,8CAA2C;AAC3C,yDAA+D;AAC/D,iDAAmD;AACnD,2CAAqD;AACrD,yEAAoF;AAEpF,SAAS,mBAAmB,CAAC,aAAqB;IAChD,IAAI,aAAa,IAAI,CAAC;QAAE,OAAO,aAAa,CAAC;IAC7C,IAAI,aAAa,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAC7D,IAAI,aAAa,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC;AAOD;;GAEG;AACH,SAAgB,eAAe,CAAC,KAA2B;IACzD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACtE,MAAM,WAAW,GAAG,KAAK,CA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/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport { BadgeUtilities, IconHelper } from \"@itwin/core-react\";\nimport { BackArrow } from \"./groupPanel/BackArrow\";\nimport { GroupColumn } from \"./groupPanel/Column\";\nimport { Columns } from \"./groupPanel/Columns\";\nimport { Panel } from \"./groupPanel/Panel\";\nimport { Title } from \"./groupPanel/Title\";\nimport { GroupToolExpander } from \"./groupPanel/tool/Expander\";\nimport { GroupTool } from \"./groupPanel/tool/Tool\";\nimport { useToolbarPopupContext } from \"./PopupItem\";\nimport { useToolbarWithOverflowDirectionContext } from \"./InternalToolbarComponent\";\n\nfunction getNumItemsInColumn(numTotalItems: number): number {\n if (numTotalItems <= 6) return numTotalItems;\n if (numTotalItems <= 24) return Math.ceil(numTotalItems / 2);\n if (numTotalItems <= 36) return Math.ceil(numTotalItems / 3);\n return Math.ceil(numTotalItems / 4);\n}\n\ninterface PopupItemsPanelProps {\n groupItem: GroupButton;\n activateOnPointerUp?: boolean;\n}\n\n/** Component that displays a list of tools in a panel.\n * @internal future\n */\nexport function PopupItemsPanel(props: PopupItemsPanelProps) {\n const [groupArray, setGroupArray] = React.useState([props.groupItem]);\n const activeGroup = React.useMemo(() => groupArray[0], [groupArray]);\n const items = React.useMemo(() => activeGroup.items, [activeGroup]);\n\n const preferredNumItemsInColumn = getNumItemsInColumn(items.length);\n\n // Divide items equally between columns.\n const numberOfColumns = Math.ceil(items.length / preferredNumItemsInColumn);\n const numItemsPerColumn = Math.ceil(items.length / numberOfColumns);\n\n const columnToItems = React.useMemo(\n () =>\n items.reduce<ReadonlyArray<ReadonlyArray<GroupButton | ActionButton>>>(\n (acc, item, index) => {\n const columnIndex = Math.floor(index / numItemsPerColumn);\n if (columnIndex >= acc.length) {\n return [...acc, [item]];\n }\n return [\n ...acc.slice(0, columnIndex),\n [...acc[columnIndex], item],\n ...acc.slice(columnIndex + 1),\n ];\n },\n []\n ),\n [items, numItemsPerColumn]\n );\n\n const handleGroupItemClick = React.useCallback(\n (item: GroupButton | ActionButton) => {\n // istanbul ignore else\n if (ToolbarItemUtilities.isGroupButton(item)) {\n // push group to front of array\n setGroupArray([item, ...groupArray]);\n }\n },\n [groupArray]\n );\n\n const handleBackArrowClick = React.useCallback(() => {\n // istanbul ignore else\n if (groupArray.length > 1) {\n setGroupArray(groupArray.slice(1));\n }\n }, [groupArray]);\n\n const { closePanel, setSelectedItem } = useToolbarPopupContext();\n const { onItemExecuted, onKeyDown } =\n useToolbarWithOverflowDirectionContext();\n\n const handleOnPointerUp = React.useCallback(\n /* istanbul ignore next */ (panelItem: GroupButton | ActionButton) => {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(panelItem)) {\n props.activateOnPointerUp &&\n setSelectedItem &&\n setSelectedItem(panelItem);\n props.activateOnPointerUp && panelItem.execute();\n onItemExecuted(panelItem);\n props.activateOnPointerUp && closePanel();\n }\n },\n [props.activateOnPointerUp, setSelectedItem, closePanel, onItemExecuted]\n );\n\n const handleActionItemClick = React.useCallback(\n (panelItem: GroupButton | ActionButton) => {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(panelItem)) {\n setSelectedItem && setSelectedItem(panelItem);\n panelItem.execute();\n onItemExecuted(panelItem);\n closePanel();\n }\n },\n [setSelectedItem, closePanel, onItemExecuted]\n );\n\n // istanbul ignore next - NEEDSWORK add complete tests\n const handleOnKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n onKeyDown(e);\n },\n [onKeyDown]\n );\n\n // build n-number of columns\n const columns = React.useMemo(\n () =>\n columnToItems.map((columnItems, columnIndex) => (\n <GroupColumn key={columnIndex}>\n {columnItems.map((panelItem) => {\n const badge = BadgeUtilities.getComponentForBadgeType(\n panelItem.badgeType\n );\n const icon = IconHelper.getIconReactNode(\n panelItem.icon,\n panelItem.internalData\n );\n const label = ConditionalStringValue.getValue(panelItem.label);\n if (ToolbarItemUtilities.isGroupButton(panelItem)) {\n return (\n <GroupToolExpander\n isDisabled={ConditionalBooleanValue.getValue(\n panelItem.isDisabled\n )}\n key={panelItem.id}\n label={label}\n icon={icon}\n badge={badge}\n item={panelItem}\n onClick={handleGroupItemClick}\n />\n );\n }\n\n return (\n <GroupTool\n isDisabled={ConditionalBooleanValue.getValue(\n panelItem.isDisabled\n )}\n isActive={!!panelItem.isActive}\n key={panelItem.id}\n label={label}\n icon={icon}\n item={panelItem}\n onClick={handleActionItemClick}\n onPointerUp={handleOnPointerUp}\n badge={badge}\n />\n );\n })}\n </GroupColumn>\n )),\n [\n columnToItems,\n handleActionItemClick,\n handleGroupItemClick,\n handleOnPointerUp,\n ]\n );\n\n // ensure we have a panel title for nested groups\n const titleString = activeGroup.panelLabel\n ? activeGroup.panelLabel\n : activeGroup.label;\n const panelTitle = React.useMemo(\n () => ConditionalStringValue.getValue(titleString),\n [titleString]\n );\n const className = classnames(\n 1 === groupArray.length && \"components-toolbar-item-expandable-group-group\",\n groupArray.length > 1 && \"components-toolbar-item-expandable-group-nested\"\n );\n\n return (\n <Panel className={className} onKeyDown={handleOnKeyDown}>\n {groupArray.length > 1 && (\n <BackArrow className=\"components-back\" onClick={handleBackArrowClick} />\n )}\n {panelTitle && <Title>{panelTitle}</Title>}\n {columns && <Columns>{columns}</Columns>}\n </Panel>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PopupItemsPanel.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemsPanel.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+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AW,CAAC,UAAU;QACxC,CAAC,CAAC,WAAW,CAAC,UAAU;QACxB,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC;IACtB,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAC9B,GAAG,EAAE,CAAC,uCAAsB,CAAC,QAAQ,CAAC,WAAW,CAAC,EAClD,CAAC,WAAW,CAAC,CACd,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,CAAC,KAAK,UAAU,CAAC,MAAM,IAAI,gDAAgD,EAC3E,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,iDAAiD,CAC3E,CAAC;IAEF,OAAO,CACL,oBAAC,aAAK,IAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe;QACpD,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,CACxB,oBAAC,qBAAS,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,oBAAoB,GAAI,CACzE;QACA,UAAU,IAAI,oBAAC,aAAK,QAAE,UAAU,CAAS;QACzC,OAAO,IAAI,oBAAC,iBAAO,QAAE,OAAO,CAAW,CAClC,CACT,CAAC;AACJ,CAAC;AAnKD,0CAmKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport { Badge, IconHelper } from \"@itwin/core-react\";\nimport { BackArrow } from \"./groupPanel/BackArrow\";\nimport { GroupColumn } from \"./groupPanel/Column\";\nimport { Columns } from \"./groupPanel/Columns\";\nimport { Panel } from \"./groupPanel/Panel\";\nimport { Title } from \"./groupPanel/Title\";\nimport { GroupToolExpander } from \"./groupPanel/tool/Expander\";\nimport { GroupTool } from \"./groupPanel/tool/Tool\";\nimport { useToolbarPopupContext } from \"./PopupItem\";\nimport { useToolbarWithOverflowDirectionContext } from \"./InternalToolbarComponent\";\n\nfunction getNumItemsInColumn(numTotalItems: number): number {\n if (numTotalItems <= 6) return numTotalItems;\n if (numTotalItems <= 24) return Math.ceil(numTotalItems / 2);\n if (numTotalItems <= 36) return Math.ceil(numTotalItems / 3);\n return Math.ceil(numTotalItems / 4);\n}\n\ninterface PopupItemsPanelProps {\n groupItem: GroupButton;\n activateOnPointerUp?: boolean;\n}\n\n/** Component that displays a list of tools in a panel.\n * @internal future\n */\nexport function PopupItemsPanel(props: PopupItemsPanelProps) {\n const [groupArray, setGroupArray] = React.useState([props.groupItem]);\n const activeGroup = React.useMemo(() => groupArray[0], [groupArray]);\n const items = React.useMemo(() => activeGroup.items, [activeGroup]);\n\n const preferredNumItemsInColumn = getNumItemsInColumn(items.length);\n\n // Divide items equally between columns.\n const numberOfColumns = Math.ceil(items.length / preferredNumItemsInColumn);\n const numItemsPerColumn = Math.ceil(items.length / numberOfColumns);\n\n const columnToItems = React.useMemo(\n () =>\n items.reduce<ReadonlyArray<ReadonlyArray<GroupButton | ActionButton>>>(\n (acc, item, index) => {\n const columnIndex = Math.floor(index / numItemsPerColumn);\n if (columnIndex >= acc.length) {\n return [...acc, [item]];\n }\n return [\n ...acc.slice(0, columnIndex),\n [...acc[columnIndex], item],\n ...acc.slice(columnIndex + 1),\n ];\n },\n []\n ),\n [items, numItemsPerColumn]\n );\n\n const handleGroupItemClick = React.useCallback(\n (item: GroupButton | ActionButton) => {\n // istanbul ignore else\n if (ToolbarItemUtilities.isGroupButton(item)) {\n // push group to front of array\n setGroupArray([item, ...groupArray]);\n }\n },\n [groupArray]\n );\n\n const handleBackArrowClick = React.useCallback(() => {\n // istanbul ignore else\n if (groupArray.length > 1) {\n setGroupArray(groupArray.slice(1));\n }\n }, [groupArray]);\n\n const { closePanel, setSelectedItem } = useToolbarPopupContext();\n const { onItemExecuted, onKeyDown } =\n useToolbarWithOverflowDirectionContext();\n\n const handleOnPointerUp = React.useCallback(\n /* istanbul ignore next */ (panelItem: GroupButton | ActionButton) => {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(panelItem)) {\n props.activateOnPointerUp &&\n setSelectedItem &&\n setSelectedItem(panelItem);\n props.activateOnPointerUp && panelItem.execute();\n onItemExecuted(panelItem);\n props.activateOnPointerUp && closePanel();\n }\n },\n [props.activateOnPointerUp, setSelectedItem, closePanel, onItemExecuted]\n );\n\n const handleActionItemClick = React.useCallback(\n (panelItem: GroupButton | ActionButton) => {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(panelItem)) {\n setSelectedItem && setSelectedItem(panelItem);\n panelItem.execute();\n onItemExecuted(panelItem);\n closePanel();\n }\n },\n [setSelectedItem, closePanel, onItemExecuted]\n );\n\n // istanbul ignore next - NEEDSWORK add complete tests\n const handleOnKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n onKeyDown(e);\n },\n [onKeyDown]\n );\n\n // build n-number of columns\n const columns = React.useMemo(\n () =>\n columnToItems.map((columnItems, columnIndex) => (\n <GroupColumn key={columnIndex}>\n {columnItems.map((panelItem) => {\n const icon = IconHelper.getIconReactNode(\n panelItem.icon,\n panelItem.internalData\n );\n const label = ConditionalStringValue.getValue(panelItem.label);\n if (ToolbarItemUtilities.isGroupButton(panelItem)) {\n return (\n <GroupToolExpander\n isDisabled={ConditionalBooleanValue.getValue(\n panelItem.isDisabled\n )}\n key={panelItem.id}\n label={label}\n icon={icon}\n badge={<Badge type={panelItem.badgeType} />}\n item={panelItem}\n onClick={handleGroupItemClick}\n />\n );\n }\n\n return (\n <GroupTool\n isDisabled={ConditionalBooleanValue.getValue(\n panelItem.isDisabled\n )}\n isActive={!!panelItem.isActive}\n key={panelItem.id}\n label={label}\n icon={icon}\n item={panelItem}\n onClick={handleActionItemClick}\n onPointerUp={handleOnPointerUp}\n badge={<Badge type={panelItem.badgeType} />}\n />\n );\n })}\n </GroupColumn>\n )),\n [\n columnToItems,\n handleActionItemClick,\n handleGroupItemClick,\n handleOnPointerUp,\n ]\n );\n\n // ensure we have a panel title for nested groups\n const titleString = activeGroup.panelLabel\n ? activeGroup.panelLabel\n : activeGroup.label;\n const panelTitle = React.useMemo(\n () => ConditionalStringValue.getValue(titleString),\n [titleString]\n );\n const className = classnames(\n 1 === groupArray.length && \"components-toolbar-item-expandable-group-group\",\n groupArray.length > 1 && \"components-toolbar-item-expandable-group-nested\"\n );\n\n return (\n <Panel className={className} onKeyDown={handleOnKeyDown}>\n {groupArray.length > 1 && (\n <BackArrow className=\"components-back\" onClick={handleBackArrowClick} />\n )}\n {panelTitle && <Title>{panelTitle}</Title>}\n {columns && <Columns>{columns}</Columns>}\n </Panel>\n );\n}\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
translate: (key: string) => string;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Returns a translation function.
|
|
1
|
+
/** Returns a translation function.
|
|
6
2
|
* @internal
|
|
7
3
|
*/
|
|
8
|
-
export declare function useTranslation():
|
|
9
|
-
|
|
4
|
+
export declare function useTranslation(): {
|
|
5
|
+
translate: (key: string) => string;
|
|
6
|
+
};
|
|
10
7
|
//# sourceMappingURL=useTranslation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../../src/components-react/useTranslation.
|
|
1
|
+
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../../src/components-react/useTranslation.tsx"],"names":[],"mappings":"AASA;;GAEG;AACH,wBAAgB,cAAc;;EAY7B"}
|
|
@@ -1,20 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useTranslation = void 0;
|
|
2
27
|
/*---------------------------------------------------------------------------------------------
|
|
3
28
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
29
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
30
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
|
|
7
|
-
|
|
31
|
+
const defaults = __importStar(require("./UiComponents.json"));
|
|
32
|
+
const React = __importStar(require("react"));
|
|
33
|
+
const core_react_1 = require("@itwin/core-react");
|
|
8
34
|
const UiComponents_1 = require("./UiComponents");
|
|
9
|
-
/**
|
|
10
|
-
* Returns a translation function.
|
|
35
|
+
/** Returns a translation function.
|
|
11
36
|
* @internal
|
|
12
37
|
*/
|
|
13
38
|
function useTranslation() {
|
|
14
|
-
const
|
|
39
|
+
const fallback = React.useCallback((key) => {
|
|
40
|
+
if (!UiComponents_1.UiComponents.initialized) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
15
43
|
return UiComponents_1.UiComponents.translate(key);
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
44
|
+
}, []);
|
|
45
|
+
return (0, core_react_1.usePackageTranslation)({
|
|
46
|
+
namespace: UiComponents_1.UiComponents.localizationNamespace,
|
|
47
|
+
fallback,
|
|
48
|
+
defaults,
|
|
49
|
+
});
|
|
18
50
|
}
|
|
19
51
|
exports.useTranslation = useTranslation;
|
|
20
52
|
//# sourceMappingURL=useTranslation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslation.js","sourceRoot":"","sources":["../../../src/components-react/useTranslation.
|
|
1
|
+
{"version":3,"file":"useTranslation.js","sourceRoot":"","sources":["../../../src/components-react/useTranslation.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,8DAAgD;AAChD,6CAA+B;AAC/B,kDAA0D;AAC1D,iDAA8C;AAE9C;;GAEG;AACH,SAAgB,cAAc;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,GAAW,EAAE,EAAE;QACjD,IAAI,CAAC,2BAAY,CAAC,WAAW,EAAE;YAC7B,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,2BAAY,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,IAAA,kCAAqB,EAAC;QAC3B,SAAS,EAAE,2BAAY,CAAC,qBAAqB;QAC7C,QAAQ;QACR,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAZD,wCAYC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as defaults from \"./UiComponents.json\";\nimport * as React from \"react\";\nimport { usePackageTranslation } from \"@itwin/core-react\";\nimport { UiComponents } from \"./UiComponents\";\n\n/** Returns a translation function.\n * @internal\n */\nexport function useTranslation() {\n const fallback = React.useCallback((key: string) => {\n if (!UiComponents.initialized) {\n return undefined;\n }\n return UiComponents.translate(key);\n }, []);\n return usePackageTranslation({\n namespace: UiComponents.localizationNamespace,\n fallback,\n defaults,\n });\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { UiComponents } from "./components-react/UiComponents";
|
|
2
|
+
export * from "./components-react/useTranslation";
|
|
2
3
|
export * from "./components-react/common/Links";
|
|
3
4
|
export * from "./components-react/common/PageOptions";
|
|
4
5
|
export * from "./components-react/common/selection/SelectionModes";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-react.d.ts","sourceRoot":"","sources":["../../src/components-react.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"components-react.d.ts","sourceRoot":"","sources":["../../src/components-react.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,cAAc,mCAAmC,CAAC;AAElD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,sDAAsD,CAAC;AACrE,cAAc,yCAAyC,CAAC;AACxD,cAAc,kDAAkD,CAAC;AACjE,cAAc,qCAAqC,CAAC;AAEpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AACvE,cAA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C;AAGxE,cAAc,iDAAiD,CAAC;AAEhE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAE5D,cAAc,qDAAqD,CAAC;AACpE,cAAc,sCAAsC,CAAC;AACrD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iCAAiC,CAAC;AAChD,cAAc,gDAAgD,CAAC;AAE/D,cAAc,0CAA0C,CAAC;AACzD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wDAAwD,CAAC;AACvE,cAAc,qDAAqD,CAAC;AACpE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oDAAoD,CAAC;AACnE,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,+DAA+D,CAAC;AAC9E,cAAc,2DAA2D,CAAC;AAC1E,cAAc,wDAAwD,CAAC;AAEvE;;;GAGG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -22,6 +22,7 @@ exports.UiComponents = void 0;
|
|
|
22
22
|
// cSpell:ignore iconpicker lineweight hocs datepicker quantityformat
|
|
23
23
|
var UiComponents_1 = require("./components-react/UiComponents");
|
|
24
24
|
Object.defineProperty(exports, "UiComponents", { enumerable: true, get: function () { return UiComponents_1.UiComponents; } });
|
|
25
|
+
__exportStar(require("./components-react/useTranslation"), exports);
|
|
25
26
|
__exportStar(require("./components-react/common/Links"), exports);
|
|
26
27
|
__exportStar(require("./components-react/common/PageOptions"), exports);
|
|
27
28
|
__exportStar(require("./components-react/common/selection/SelectionModes"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-react.js","sourceRoot":"","sources":["../../src/components-react.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;AAEhG,qEAAqE;AAErE,gEAA+D;AAAtD,4GAAA,YAAY,OAAA;AAErB,kEAAgD;AAChD,wEAAsD;AACtD,qFAAmE;AACnE,uFAAqE;AACrE,4EAA0D;AAC1D,yEAAuD;AACvD,uFAAqE;AACrE,0EAAwD;AACxD,mFAAiE;AACjE,sEAAoD;AAEpD,8EAA4D;AAC5D,qFAAmE;AACnE,qFAAmE;AACnE,sFAAoE;AACpE,kFAAgE;AAChE,yFAAuE;AACvE,gGAA8E;AAC9E,qFAAmE;AACnE,mFAAiE;AACjE,oFAAkE;AAClE,uFAAqE;AAErE,0FAAwE;AAExE,0EAAwD;AACxD,2EAAyD;AACzD,sFAAoE;AACpE,8EAA4D;AAC5D,0EAAwD;AAExD,2EAAyD;AACzD,gFAA8D;AAC9D,4EAA0D;AAC1D,6EAA2D;AAC3D,mFAAiE;AACjE,wEAAsD;AACtD,wEAAsD;AACtD,iFAA+D;AAC/D,gFAA8D;AAC9D,mFAAiE;AACjE,0EAAwD;AACxD,wEAAsD;AACtD,4EAA0D;AAC1D,0EAAwD;AAExD,yFAAuE;AACvE,mFAAiE;AAEjE,8EAA4D;AAC5D,8EAA4D;AAE5D,wEAAsD;AAEtD,4EAA0D;AAC1D,qFAAmE;AACnE,uGAAqF;AACrF,oGAAkF;AAClF,uGAAqF;AACrF,2FAAyE;AACzE,uFAAqE;AACrE,2FAAyE;AACzE,+FAA6E;AAC7E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AA8E;AAC9E,4FAA0E;AAC1E,yFAAuE;AAEvE;;;GAGG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n// cSpell:ignore iconpicker lineweight hocs datepicker quantityformat\n\nexport { UiComponents } from \"./components-react/UiComponents\";\n\nexport * from \"./components-react/common/Links\";\nexport * from \"./components-react/common/PageOptions\";\nexport * from \"./components-react/common/selection/SelectionModes\";\nexport * from \"./components-react/common/HighlightingComponentProps\";\nexport * from \"./components-react/common/HighlightedText\";\nexport * from \"./components-react/common/IImageLoader\";\nexport * from \"./components-react/common/selection/SelectionHandler\";\nexport * from \"./components-react/common/UseAsyncValue\";\nexport * from \"./components-react/common/UseDebouncedAsyncValue\";\nexport * from \"./components-react/common/DateUtils\";\n\nexport * from \"./components-react/converters/TypeConverter\";\nexport * from \"./components-react/converters/TypeConverterManager\";\nexport * from \"./components-react/converters/BooleanTypeConverter\";\nexport * from \"./components-react/converters/DateTimeTypeConverter\";\nexport * from \"./components-react/converters/EnumTypeConverter\";\nexport * from \"./components-react/converters/HexadecimalTypeConverter\";\nexport * from \"./components-react/converters/NavigationPropertyTypeConverter\";\nexport * from \"./components-react/converters/NumericTypeConverter\";\nexport * from \"./components-react/converters/PointTypeConverter\";\nexport * from \"./components-react/converters/StringTypeConverter\";\nexport * from \"./components-react/converters/CompositeTypeConverter\";\n\nexport * from \"./components-react/converters/valuetypes/ConvertedTypes\";\n\nexport * from \"./components-react/datepicker/DateField\";\nexport * from \"./components-react/datepicker/DatePicker\";\nexport * from \"./components-react/datepicker/DatePickerPopupButton\";\nexport * from \"./components-react/datepicker/IntlFormatter\";\nexport * from \"./components-react/datepicker/TimeField\";\n\nexport * from \"./components-react/editors/BooleanEditor\";\nexport * from \"./components-react/editors/CustomNumberEditor\";\nexport * from \"./components-react/editors/DateTimeEditor\";\nexport * from \"./components-react/editors/EditorContainer\";\nexport * from \"./components-react/editors/EnumButtonGroupEditor\";\nexport * from \"./components-react/editors/EnumEditor\";\nexport * from \"./components-react/editors/IconEditor\";\nexport * from \"./components-react/editors/ImageCheckBoxEditor\";\nexport * from \"./components-react/editors/NumericInputEditor\";\nexport * from \"./components-react/editors/PropertyEditorManager\";\nexport * from \"./components-react/editors/SliderEditor\";\nexport * from \"./components-react/editors/TextEditor\";\nexport * from \"./components-react/editors/TextareaEditor\";\nexport * from \"./components-react/editors/ToggleEditor\";\n\nexport * from \"./components-react/favorite/FavoritePropertiesRenderer\";\nexport * from \"./components-react/favorite/FavoritePropertyList\";\n\nexport * from \"./components-react/filtering/FilteringInput\";\nexport * from \"./components-react/filtering/ResultSelector\";\n\nexport * from \"./components-react/inputs/ParsedInput\";\n\nexport * from \"./components-react/properties/LinkHandler\";\nexport * from \"./components-react/properties/ValueRendererManager\";\nexport * from \"./components-react/properties/renderers/NonPrimitivePropertyRenderer\";\nexport * from \"./components-react/properties/renderers/PrimitivePropertyRenderer\";\nexport * from \"./components-react/properties/renderers/CustomizablePropertyRenderer\";\nexport * from \"./components-react/properties/renderers/PropertyRenderer\";\nexport * from \"./components-react/properties/renderers/PropertyView\";\nexport * from \"./components-react/properties/renderers/ActionButtonList\";\nexport * from \"./components-react/properties/renderers/ActionButtonRenderer\";\nexport * from \"./components-react/properties/renderers/value/MergedPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/MultilineTextPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/UrlPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/WithContextStyle\";\n\nexport * from \"./components-react/filter-builder/FilterBuilder\";\nexport * from \"./components-react/filter-builder/FilterBuilderRuleOperator\";\nexport * from \"./components-react/filter-builder/FilterBuilderState\";\nexport * from \"./components-react/filter-builder/FilterBuilderRuleValue\";\nexport * from \"./components-react/filter-builder/FilterBuilderRangeValue\";\nexport * from \"./components-react/filter-builder/Operators\";\nexport * from \"./components-react/filter-builder/Types\";\nexport * from \"./components-react/filter-builder/FilterBuilderLogicalOperator\";\nexport * from \"./components-react/filter-builder/FilterBuilderToolbar\";\n\nexport * from \"./components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer\";\nexport * from \"./components-react/properties/renderers/label/PrimitivePropertyLabelRenderer\";\nexport * from \"./components-react/properties/renderers/label/PropertyLabelRenderer\";\n\nexport * from \"./components-react/properties/renderers/value/PrimitivePropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/ArrayPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/StructPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/DoublePropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/NavigationPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/table/ArrayValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/table/StructValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/table/NonPrimitiveValueRenderer\";\nexport * from \"./components-react/properties/ItemStyle\";\n\nexport * from \"./components-react/propertygrid/PropertyCategoryRendererManager\";\nexport * from \"./components-react/propertygrid/PropertyDataProvider\";\nexport * from \"./components-react/propertygrid/SimplePropertyDataProvider\";\nexport * from \"./components-react/propertygrid/component/VirtualizedPropertyGrid\";\nexport * from \"./components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider\";\nexport * from \"./components-react/propertygrid/component/PropertyCategoryBlock\";\nexport * from \"./components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier\";\nexport * from \"./components-react/propertygrid/component/PropertyGridCommons\";\nexport * from \"./components-react/propertygrid/component/PropertyList\";\nexport * from \"./components-react/propertygrid/internal/flat-items/FlatGridItem\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableFlatGridItem\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableGridCategory\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableGridItemFactory\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridEventHandler\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridHooks\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridModel\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridModelChangeEvent\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridModelSource\";\nexport * from \"./components-react/propertygrid/dataproviders/FilteringDataProvider\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase\";\n\nexport * from \"./components-react/selectable-content/SelectableContent\";\n\n// TODO: toolbar/groupPanel components needs a refactor.\nexport * from \"./components-react/toolbar/groupPanel/tool/Tool\";\n\nexport * from \"./components-react/toolbar/groupPanel/Column\";\nexport * from \"./components-react/toolbar/groupPanel/Columns\";\nexport * from \"./components-react/toolbar/groupPanel/Panel\";\nexport * from \"./components-react/toolbar/groupPanel/Title\";\n\nexport * from \"./components-react/toolbar/InternalToolbarComponent\";\nexport * from \"./components-react/toolbar/PopupItem\";\nexport * from \"./components-react/toolbar/PopupItemWithDrag\";\nexport * from \"./components-react/toolbar/Toolbar\";\nexport * from \"./components-react/toolbar/ToolbarWithOverflow\";\nexport * from \"./components-react/toolbar/Item\";\nexport * from \"./components-react/toolbar/utilities/Direction\";\n\nexport * from \"./components-react/tree/TreeDataProvider\";\nexport * from \"./components-react/tree/SimpleTreeDataProvider\";\nexport * from \"./components-react/tree/HighlightingEngine\";\nexport * from \"./components-react/tree/ImageLoader\";\nexport * from \"./components-react/tree/controlled/TreeActions\";\nexport * from \"./components-react/tree/controlled/TreeEventDispatcher\";\nexport * from \"./components-react/tree/controlled/TreeEventHandler\";\nexport * from \"./components-react/tree/controlled/TreeEvents\";\nexport * from \"./components-react/tree/controlled/TreeModel\";\nexport * from \"./components-react/tree/controlled/TreeModelSource\";\nexport * from \"./components-react/tree/controlled/TreeNodeLoader\";\nexport * from \"./components-react/tree/controlled/Observable\";\nexport * from \"./components-react/tree/controlled/TreeHooks\";\nexport * from \"./components-react/tree/controlled/component/ControlledTree\";\nexport * from \"./components-react/tree/controlled/component/NodeContent\";\nexport * from \"./components-react/tree/controlled/component/TreeNodeEditor\";\nexport * from \"./components-react/tree/controlled/component/TreeNodeRenderer\";\nexport * from \"./components-react/tree/controlled/component/TreeRenderer\";\nexport * from \"./components-react/tree/controlled/internal/SparseTree\";\n\n/** @docs-package-description\n * The components-react package contains React components that are data-oriented, such as PropertyGrid, Table and Tree.\n * For more information, see [learning about components-react]($docs/learning/ui/components/index.md).\n */\n/**\n * @docs-group-description Common\n * Common classes used across various UI components.\n */\n/**\n * @docs-group-description Breadcrumb\n * Classes and components for working with a Breadcrumb.\n * As of version 3.0, the Breadcrumb is deprecated.\n */\n/**\n * @docs-group-description Date\n * Classes, interfaces, and components for showing and setting date and time.\n */\n/**\n * @docs-group-description DragDrop\n * Classes and Higher Order Components for working with the DragDrop API.\n */\n/**\n * @docs-group-description Favorite\n * Classes and components for displaying favorite properties.\n */\n/**\n * @docs-group-description Filtering\n * Classes and components for working with filtering.\n */\n/**\n * @docs-group-description Inputs\n * Input Components that format and parse input.\n */\n/**\n * @docs-group-description SelectableContent\n * Classes and components for working with SelectableContent component.\n */\n/**\n * @docs-group-description Properties\n * Classes and components for working with Properties.\n */\n/**\n * @docs-group-description PropertyEditors\n * Classes and components for working with Property Editors.\n */\n/**\n * @docs-group-description PropertyGrid\n * Classes and components for working with a PropertyGrid.\n */\n/**\n * @docs-group-description Table\n * Classes and components for working with a Table.\n */\n/**\n * @docs-group-description Toolbar\n * Functions and components that provide a Toolbar.\n */\n/**\n * @docs-group-description Tree\n * Classes and components for working with a Tree.\n */\n/**\n * @docs-group-description TypeConverters\n * Classes for working with Type Converters.\n */\n/**\n * @docs-group-description PropertyFilterBuilder\n * Classes and components for working with PropertyFilterBuilder.\n */\n"]}
|
|
1
|
+
{"version":3,"file":"components-react.js","sourceRoot":"","sources":["../../src/components-react.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;AAEhG,qEAAqE;AAErE,gEAA+D;AAAtD,4GAAA,YAAY,OAAA;AACrB,oEAAkD;AAElD,kEAAgD;AAChD,wEAAsD;AACtD,qFAAmE;AACnE,uFAAqE;AACrE,4EAA0D;AAC1D,yEAAuD;AACvD,uFAAqE;AACrE,0EAAwD;AACxD,mFAAiE;AACjE,sEAAoD;AAEpD,8EAA4D;AAC5D,qFAAmE;AACnE,qFAAmE;AACnE,sFAAoE;AACpE,kFAAgE;AAChE,yFAAuE;AACvE,gGAA8E;AAC9E,qFAAmE;AACnE,mFAAiE;AACjE,oFAAkE;AAClE,uFAAqE;AAErE,0FAAwE;AAExE,0EAAwD;AACxD,2EAAyD;AACzD,sFAAoE;AACpE,8EAA4D;AAC5D,0EAAwD;AAExD,2EAAyD;AACzD,gFAA8D;AAC9D,4EAA0D;AAC1D,6EAA2D;AAC3D,mFAAiE;AACjE,wEAAsD;AACtD,wEAAsD;AACtD,iFAA+D;AAC/D,gFAA8D;AAC9D,mFAAiE;AACjE,0EAAwD;AACxD,wEAAsD;AACtD,4EAA0D;AAC1D,0EAAwD;AAExD,yFAAuE;AACvE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AoD;AACpD,iFAA+D;AAC/D,yFAAuE;AACvE,sFAAoE;AACpE,gFAA8D;AAC9D,+EAA6D;AAC7D,qFAAmE;AACnE,oFAAkE;AAClE,gFAA8D;AAC9D,+EAA6D;AAC7D,8FAA4E;AAC5E,2FAAyE;AACzE,8FAA4E;AAC5E,gGAA8E;AAC9E,4FAA0E;AAC1E,yFAAuE;AAEvE;;;GAGG;AACH;;;GAGG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n// cSpell:ignore iconpicker lineweight hocs datepicker quantityformat\n\nexport { UiComponents } from \"./components-react/UiComponents\";\nexport * from \"./components-react/useTranslation\";\n\nexport * from \"./components-react/common/Links\";\nexport * from \"./components-react/common/PageOptions\";\nexport * from \"./components-react/common/selection/SelectionModes\";\nexport * from \"./components-react/common/HighlightingComponentProps\";\nexport * from \"./components-react/common/HighlightedText\";\nexport * from \"./components-react/common/IImageLoader\";\nexport * from \"./components-react/common/selection/SelectionHandler\";\nexport * from \"./components-react/common/UseAsyncValue\";\nexport * from \"./components-react/common/UseDebouncedAsyncValue\";\nexport * from \"./components-react/common/DateUtils\";\n\nexport * from \"./components-react/converters/TypeConverter\";\nexport * from \"./components-react/converters/TypeConverterManager\";\nexport * from \"./components-react/converters/BooleanTypeConverter\";\nexport * from \"./components-react/converters/DateTimeTypeConverter\";\nexport * from \"./components-react/converters/EnumTypeConverter\";\nexport * from \"./components-react/converters/HexadecimalTypeConverter\";\nexport * from \"./components-react/converters/NavigationPropertyTypeConverter\";\nexport * from \"./components-react/converters/NumericTypeConverter\";\nexport * from \"./components-react/converters/PointTypeConverter\";\nexport * from \"./components-react/converters/StringTypeConverter\";\nexport * from \"./components-react/converters/CompositeTypeConverter\";\n\nexport * from \"./components-react/converters/valuetypes/ConvertedTypes\";\n\nexport * from \"./components-react/datepicker/DateField\";\nexport * from \"./components-react/datepicker/DatePicker\";\nexport * from \"./components-react/datepicker/DatePickerPopupButton\";\nexport * from \"./components-react/datepicker/IntlFormatter\";\nexport * from \"./components-react/datepicker/TimeField\";\n\nexport * from \"./components-react/editors/BooleanEditor\";\nexport * from \"./components-react/editors/CustomNumberEditor\";\nexport * from \"./components-react/editors/DateTimeEditor\";\nexport * from \"./components-react/editors/EditorContainer\";\nexport * from \"./components-react/editors/EnumButtonGroupEditor\";\nexport * from \"./components-react/editors/EnumEditor\";\nexport * from \"./components-react/editors/IconEditor\";\nexport * from \"./components-react/editors/ImageCheckBoxEditor\";\nexport * from \"./components-react/editors/NumericInputEditor\";\nexport * from \"./components-react/editors/PropertyEditorManager\";\nexport * from \"./components-react/editors/SliderEditor\";\nexport * from \"./components-react/editors/TextEditor\";\nexport * from \"./components-react/editors/TextareaEditor\";\nexport * from \"./components-react/editors/ToggleEditor\";\n\nexport * from \"./components-react/favorite/FavoritePropertiesRenderer\";\nexport * from \"./components-react/favorite/FavoritePropertyList\";\n\nexport * from \"./components-react/filtering/FilteringInput\";\nexport * from \"./components-react/filtering/ResultSelector\";\n\nexport * from \"./components-react/inputs/ParsedInput\";\n\nexport * from \"./components-react/properties/LinkHandler\";\nexport * from \"./components-react/properties/ValueRendererManager\";\nexport * from \"./components-react/properties/renderers/NonPrimitivePropertyRenderer\";\nexport * from \"./components-react/properties/renderers/PrimitivePropertyRenderer\";\nexport * from \"./components-react/properties/renderers/CustomizablePropertyRenderer\";\nexport * from \"./components-react/properties/renderers/PropertyRenderer\";\nexport * from \"./components-react/properties/renderers/PropertyView\";\nexport * from \"./components-react/properties/renderers/ActionButtonList\";\nexport * from \"./components-react/properties/renderers/ActionButtonRenderer\";\nexport * from \"./components-react/properties/renderers/value/MergedPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/MultilineTextPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/UrlPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/WithContextStyle\";\n\nexport * from \"./components-react/filter-builder/FilterBuilder\";\nexport * from \"./components-react/filter-builder/FilterBuilderRuleOperator\";\nexport * from \"./components-react/filter-builder/FilterBuilderState\";\nexport * from \"./components-react/filter-builder/FilterBuilderRuleValue\";\nexport * from \"./components-react/filter-builder/FilterBuilderRangeValue\";\nexport * from \"./components-react/filter-builder/Operators\";\nexport * from \"./components-react/filter-builder/Types\";\nexport * from \"./components-react/filter-builder/FilterBuilderLogicalOperator\";\nexport * from \"./components-react/filter-builder/FilterBuilderToolbar\";\n\nexport * from \"./components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer\";\nexport * from \"./components-react/properties/renderers/label/PrimitivePropertyLabelRenderer\";\nexport * from \"./components-react/properties/renderers/label/PropertyLabelRenderer\";\n\nexport * from \"./components-react/properties/renderers/value/PrimitivePropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/ArrayPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/StructPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/DoublePropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/NavigationPropertyValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/table/ArrayValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/table/StructValueRenderer\";\nexport * from \"./components-react/properties/renderers/value/table/NonPrimitiveValueRenderer\";\nexport * from \"./components-react/properties/ItemStyle\";\n\nexport * from \"./components-react/propertygrid/PropertyCategoryRendererManager\";\nexport * from \"./components-react/propertygrid/PropertyDataProvider\";\nexport * from \"./components-react/propertygrid/SimplePropertyDataProvider\";\nexport * from \"./components-react/propertygrid/component/VirtualizedPropertyGrid\";\nexport * from \"./components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider\";\nexport * from \"./components-react/propertygrid/component/PropertyCategoryBlock\";\nexport * from \"./components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier\";\nexport * from \"./components-react/propertygrid/component/PropertyGridCommons\";\nexport * from \"./components-react/propertygrid/component/PropertyList\";\nexport * from \"./components-react/propertygrid/internal/flat-items/FlatGridItem\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableFlatGridItem\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableGridCategory\";\nexport * from \"./components-react/propertygrid/internal/flat-items/MutableGridItemFactory\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridEventHandler\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridHooks\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridModel\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridModelChangeEvent\";\nexport * from \"./components-react/propertygrid/internal/PropertyGridModelSource\";\nexport * from \"./components-react/propertygrid/dataproviders/FilteringDataProvider\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer\";\nexport * from \"./components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase\";\n\nexport * from \"./components-react/selectable-content/SelectableContent\";\n\n// TODO: toolbar/groupPanel components needs a refactor.\nexport * from \"./components-react/toolbar/groupPanel/tool/Tool\";\n\nexport * from \"./components-react/toolbar/groupPanel/Column\";\nexport * from \"./components-react/toolbar/groupPanel/Columns\";\nexport * from \"./components-react/toolbar/groupPanel/Panel\";\nexport * from \"./components-react/toolbar/groupPanel/Title\";\n\nexport * from \"./components-react/toolbar/InternalToolbarComponent\";\nexport * from \"./components-react/toolbar/PopupItem\";\nexport * from \"./components-react/toolbar/PopupItemWithDrag\";\nexport * from \"./components-react/toolbar/Toolbar\";\nexport * from \"./components-react/toolbar/ToolbarWithOverflow\";\nexport * from \"./components-react/toolbar/Item\";\nexport * from \"./components-react/toolbar/utilities/Direction\";\n\nexport * from \"./components-react/tree/TreeDataProvider\";\nexport * from \"./components-react/tree/SimpleTreeDataProvider\";\nexport * from \"./components-react/tree/HighlightingEngine\";\nexport * from \"./components-react/tree/ImageLoader\";\nexport * from \"./components-react/tree/controlled/TreeActions\";\nexport * from \"./components-react/tree/controlled/TreeEventDispatcher\";\nexport * from \"./components-react/tree/controlled/TreeEventHandler\";\nexport * from \"./components-react/tree/controlled/TreeEvents\";\nexport * from \"./components-react/tree/controlled/TreeModel\";\nexport * from \"./components-react/tree/controlled/TreeModelSource\";\nexport * from \"./components-react/tree/controlled/TreeNodeLoader\";\nexport * from \"./components-react/tree/controlled/Observable\";\nexport * from \"./components-react/tree/controlled/TreeHooks\";\nexport * from \"./components-react/tree/controlled/component/ControlledTree\";\nexport * from \"./components-react/tree/controlled/component/NodeContent\";\nexport * from \"./components-react/tree/controlled/component/TreeNodeEditor\";\nexport * from \"./components-react/tree/controlled/component/TreeNodeRenderer\";\nexport * from \"./components-react/tree/controlled/component/TreeRenderer\";\nexport * from \"./components-react/tree/controlled/internal/SparseTree\";\n\n/** @docs-package-description\n * The components-react package contains React components that are data-oriented, such as PropertyGrid, Table and Tree.\n * For more information, see [learning about components-react]($docs/learning/ui/components/index.md).\n */\n/**\n * @docs-group-description Common\n * Common classes used across various UI components.\n */\n/**\n * @docs-group-description Breadcrumb\n * Classes and components for working with a Breadcrumb.\n * As of version 3.0, the Breadcrumb is deprecated.\n */\n/**\n * @docs-group-description Date\n * Classes, interfaces, and components for showing and setting date and time.\n */\n/**\n * @docs-group-description DragDrop\n * Classes and Higher Order Components for working with the DragDrop API.\n */\n/**\n * @docs-group-description Favorite\n * Classes and components for displaying favorite properties.\n */\n/**\n * @docs-group-description Filtering\n * Classes and components for working with filtering.\n */\n/**\n * @docs-group-description Inputs\n * Input Components that format and parse input.\n */\n/**\n * @docs-group-description SelectableContent\n * Classes and components for working with SelectableContent component.\n */\n/**\n * @docs-group-description Properties\n * Classes and components for working with Properties.\n */\n/**\n * @docs-group-description PropertyEditors\n * Classes and components for working with Property Editors.\n */\n/**\n * @docs-group-description PropertyGrid\n * Classes and components for working with a PropertyGrid.\n */\n/**\n * @docs-group-description Table\n * Classes and components for working with a Table.\n */\n/**\n * @docs-group-description Toolbar\n * Functions and components that provide a Toolbar.\n */\n/**\n * @docs-group-description Tree\n * Classes and components for working with a Tree.\n */\n/**\n * @docs-group-description TypeConverters\n * Classes for working with Type Converters.\n */\n/**\n * @docs-group-description PropertyFilterBuilder\n * Classes and components for working with PropertyFilterBuilder.\n */\n"]}
|
|
@@ -18,10 +18,6 @@ export declare class UiComponents {
|
|
|
18
18
|
static terminate(): void;
|
|
19
19
|
/** Determines if UiComponents has been initialized */
|
|
20
20
|
static get initialized(): boolean;
|
|
21
|
-
/** The internationalization service created by the host application.
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
static get localization(): Localization;
|
|
25
21
|
/** The internationalization service namespace. */
|
|
26
22
|
static get localizationNamespace(): string;
|
|
27
23
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IACpC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAe;IAE5C;;;OAGG;WACiB,UAAU,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzE,0DAA0D;WAC5C,SAAS;IAWvB,sDAAsD;IACtD,WAAkB,WAAW,IAAI,OAAO,CAEvC;IAED,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAavD,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAM/C"}
|
|
@@ -9,7 +9,6 @@ import { enablePatches } from "immer";
|
|
|
9
9
|
import { Logger } from "@itwin/core-bentley";
|
|
10
10
|
import { UiCore } from "@itwin/core-react";
|
|
11
11
|
import { getObjectClassName } from "@itwin/core-react";
|
|
12
|
-
import { UiError } from "@itwin/appui-abstract";
|
|
13
12
|
/**
|
|
14
13
|
* Manages the localization service for the components-react package.
|
|
15
14
|
* @public
|
|
@@ -42,15 +41,6 @@ class UiComponents {
|
|
|
42
41
|
static get initialized() {
|
|
43
42
|
return UiComponents._initialized;
|
|
44
43
|
}
|
|
45
|
-
/** The internationalization service created by the host application.
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
static get localization() {
|
|
49
|
-
if (!UiComponents._localization)
|
|
50
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
51
|
-
throw new UiError(UiComponents.loggerCategory(this), "_localization: UiComponents.initialize has not been called. Unable to return Localization object.");
|
|
52
|
-
return UiComponents._localization;
|
|
53
|
-
}
|
|
54
44
|
/** The internationalization service namespace. */
|
|
55
45
|
static get localizationNamespace() {
|
|
56
46
|
return "UiComponents";
|
|
@@ -63,11 +53,11 @@ class UiComponents {
|
|
|
63
53
|
* @internal
|
|
64
54
|
*/
|
|
65
55
|
static translate(key) {
|
|
66
|
-
if (!UiComponents.
|
|
56
|
+
if (!UiComponents._localization) {
|
|
67
57
|
Logger.logError(UiComponents.loggerCategory(this), `translate: UiComponents.initialize has not been called. Returning blank string.`);
|
|
68
58
|
return "";
|
|
69
59
|
}
|
|
70
|
-
return UiComponents.
|
|
60
|
+
return UiComponents._localization.getLocalizedString(`${UiComponents.localizationNamespace}:${key}`);
|
|
71
61
|
}
|
|
72
62
|
/** @internal */
|
|
73
63
|
static loggerCategory(obj) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiComponents.js","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"UiComponents.js","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;GAGG;AACH,MAAa,YAAY;IAIvB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAA0B;QACvD,IAAI,YAAY,CAAC,YAAY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,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GACZ,YAAY,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA3Ec,yBAAY,GAAG,KAAK,CAAC;SADzB,YAAY","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport { enablePatches } from \"immer\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Localization } from \"@itwin/core-common\";\nimport { UiCore } from \"@itwin/core-react\";\nimport { getObjectClassName } from \"@itwin/core-react\";\n\n/**\n * Manages the localization service for the components-react package.\n * @public\n */\nexport class UiComponents {\n private static _initialized = false;\n private static _localization?: Localization;\n\n /**\n * Registers the localization service namespace for UiComponents. Also initializes UiCore.\n * @param localization The internationalization service created by the host application.\n */\n public static async initialize(localization: Localization): Promise<void> {\n if (UiComponents._initialized) {\n Logger.logInfo(\n UiComponents.loggerCategory(UiComponents),\n `UiComponents.initialize already called`\n );\n return;\n }\n\n enablePatches();\n UiComponents._localization = localization;\n await UiComponents._localization.registerNamespace(\n UiComponents.localizationNamespace\n );\n\n await UiCore.initialize(UiComponents._localization);\n UiComponents._initialized = true;\n }\n\n /** Unregisters the UiComponents localization namespace */\n public static terminate() {\n if (UiComponents._localization)\n UiComponents._localization.unregisterNamespace(\n UiComponents.localizationNamespace\n );\n UiComponents._localization = undefined;\n\n UiCore.terminate();\n UiComponents._initialized = false;\n }\n\n /** Determines if UiComponents has been initialized */\n public static get initialized(): boolean {\n return UiComponents._initialized;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"components-react\";\n }\n\n /** Calls localization.getLocalizedString with the \"UiComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiComponents._localization) {\n Logger.logError(\n UiComponents.loggerCategory(this),\n `translate: UiComponents.initialize has not been called. Returning blank string.`\n );\n return \"\";\n }\n return UiComponents._localization.getLocalizedString(\n `${UiComponents.localizationNamespace}:${key}`\n );\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category =\n UiComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
|