@itwin/appui-react 3.0.0-dev.151 → 3.0.0-dev.155
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/lib/cjs/appui-react/content/ContentLayout.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.js +2 -2
- package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/cjs/appui-react/content/split-pane/Pane.d.ts +21 -0
- package/lib/cjs/appui-react/content/split-pane/Pane.d.ts.map +1 -0
- package/lib/cjs/appui-react/content/split-pane/Pane.js +43 -0
- package/lib/cjs/appui-react/content/split-pane/Pane.js.map +1 -0
- package/lib/cjs/appui-react/content/split-pane/Resizer.d.ts +23 -0
- package/lib/cjs/appui-react/content/split-pane/Resizer.d.ts.map +1 -0
- package/lib/cjs/appui-react/content/split-pane/Resizer.js +39 -0
- package/lib/cjs/appui-react/content/split-pane/Resizer.js.map +1 -0
- package/lib/cjs/appui-react/content/split-pane/SplitPane.d.ts +70 -0
- package/lib/cjs/appui-react/content/split-pane/SplitPane.d.ts.map +1 -0
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js +243 -0
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js.map +1 -0
- package/lib/cjs/appui-react/frontstage/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/Frontstage.js +2 -0
- package/lib/cjs/appui-react/frontstage/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/Indicator.d.ts +15 -14
- package/lib/cjs/appui-react/statusfields/Indicator.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/Indicator.js +23 -21
- package/lib/cjs/appui-react/statusfields/Indicator.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/Indicator.scss +21 -7
- package/lib/cjs/appui-react/statusfields/MessageCenter.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/MessageCenter.js +2 -1
- package/lib/cjs/appui-react/statusfields/MessageCenter.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/SnapMode.d.ts +2 -10
- package/lib/cjs/appui-react/statusfields/SnapMode.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/SnapMode.js +4 -35
- package/lib/cjs/appui-react/statusfields/SnapMode.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/ViewAttributes.d.ts +0 -6
- package/lib/cjs/appui-react/statusfields/ViewAttributes.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/ViewAttributes.js +1 -25
- package/lib/cjs/appui-react/statusfields/ViewAttributes.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.scss +8 -3
- package/lib/cjs/appui-react/utils/UiShowHideManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/utils/UiShowHideManager.js +2 -2
- package/lib/cjs/appui-react/utils/UiShowHideManager.js.map +1 -1
- package/lib/cjs/appui-react.d.ts +1 -0
- package/lib/cjs/appui-react.d.ts.map +1 -1
- package/lib/cjs/appui-react.js +1 -0
- package/lib/cjs/appui-react.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.js +1 -1
- package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/esm/appui-react/content/split-pane/Pane.d.ts +21 -0
- package/lib/esm/appui-react/content/split-pane/Pane.d.ts.map +1 -0
- package/lib/esm/appui-react/content/split-pane/Pane.js +39 -0
- package/lib/esm/appui-react/content/split-pane/Pane.js.map +1 -0
- package/lib/esm/appui-react/content/split-pane/Resizer.d.ts +23 -0
- package/lib/esm/appui-react/content/split-pane/Resizer.d.ts.map +1 -0
- package/lib/esm/appui-react/content/split-pane/Resizer.js +35 -0
- package/lib/esm/appui-react/content/split-pane/Resizer.js.map +1 -0
- package/lib/esm/appui-react/content/split-pane/SplitPane.d.ts +70 -0
- package/lib/esm/appui-react/content/split-pane/SplitPane.d.ts.map +1 -0
- package/lib/esm/appui-react/content/split-pane/SplitPane.js +239 -0
- package/lib/esm/appui-react/content/split-pane/SplitPane.js.map +1 -0
- package/lib/esm/appui-react/frontstage/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/Frontstage.js +2 -0
- package/lib/esm/appui-react/frontstage/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/statusfields/Indicator.d.ts +15 -14
- package/lib/esm/appui-react/statusfields/Indicator.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/Indicator.js +23 -21
- package/lib/esm/appui-react/statusfields/Indicator.js.map +1 -1
- package/lib/esm/appui-react/statusfields/Indicator.scss +21 -7
- package/lib/esm/appui-react/statusfields/MessageCenter.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/MessageCenter.js +2 -1
- package/lib/esm/appui-react/statusfields/MessageCenter.js.map +1 -1
- package/lib/esm/appui-react/statusfields/SnapMode.d.ts +2 -10
- package/lib/esm/appui-react/statusfields/SnapMode.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/SnapMode.js +5 -36
- package/lib/esm/appui-react/statusfields/SnapMode.js.map +1 -1
- package/lib/esm/appui-react/statusfields/ViewAttributes.d.ts +0 -6
- package/lib/esm/appui-react/statusfields/ViewAttributes.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/ViewAttributes.js +2 -26
- package/lib/esm/appui-react/statusfields/ViewAttributes.js.map +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.scss +8 -3
- package/lib/esm/appui-react/utils/UiShowHideManager.d.ts.map +1 -1
- package/lib/esm/appui-react/utils/UiShowHideManager.js +2 -2
- package/lib/esm/appui-react/utils/UiShowHideManager.js.map +1 -1
- package/lib/esm/appui-react.d.ts +1 -0
- package/lib/esm/appui-react.d.ts.map +1 -1
- package/lib/esm/appui-react.js +1 -0
- package/lib/esm/appui-react.js.map +1 -1
- package/package.json +35 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLayout.js","sourceRoot":"","sources":["../../../../src/appui-react/content/ContentLayout.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,8BAA8B;AAE9B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAuH,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrK,OAAO,EAAiC,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAazF;GACG;AACH,MAAM,cAAe,SAAQ,KAAK,CAAC,SAAmD;IAKpF,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAwBP,qBAAgB,GAAG,CAAC,MAAwC,EAAE,EAAE;YACtE,0BAA0B;YAE1B,kBAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,CAAC,CAAC;QAUM,gCAA2B,GAAG,CAAC,IAAmC,EAAE,EAAE;YAC5E,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,aAAa,CAAC;YAC3D,IAAI,I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ACrE,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAC,cAAc,IAE9E,IAAI,CAAC,KAAK,CAAC,gBAAgB,CACxB,CACP,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CASF","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 ContentView\r\n */\r\n\r\n// cSpell:ignore contentlayout\r\n\r\nimport \"./ContentLayout.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport SplitPane from \"react-split-pane\";\r\nimport { CommonProps, Orientation } from \"@itwin/core-react\";\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { UiShowHideManager } from \"../utils/UiShowHideManager\";\r\nimport { ContentGroup } from \"./ContentGroup\";\r\nimport { ContentLayoutProps, LayoutFragmentProps, LayoutHorizontalSplitProps, LayoutSplitPropsBase, LayoutVerticalSplitProps, UiEvent } from \"@itwin/appui-abstract\";\r\nimport { ActiveContentChangedEventArgs, ContentViewManager } from \"./ContentViewManager\";\r\n\r\n/** Properties for [[ContentWrapper]] */\r\ninterface ContentWrapperProps extends CommonProps {\r\n content: React.ReactNode;\r\n}\r\n\r\n/** State for [[ContentWrapper]] */\r\ninterface ContentWrapperState {\r\n content: React.ReactNode;\r\n isActive: boolean;\r\n}\r\n\r\n/** ContentWrapper React component.\r\n */\r\nclass ContentWrapper extends React.Component<ContentWrapperProps, ContentWrapperState> {\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<ContentWrapperState>;\r\n\r\n constructor(props: ContentWrapperProps) {\r\n super(props);\r\n\r\n this.state = {\r\n content: this.props.content,\r\n isActive: this.props.content === ContentViewManager.getActiveContent(),\r\n };\r\n }\r\n\r\n public override render(): React.ReactNode {\r\n const overlayClassName = classnames(\r\n \"uifw-contentlayout-overlay-div\",\r\n this.state.isActive ? \"uifw-contentlayout-overlay-active\" : \"uifw-contentlayout-overlay-inactive\",\r\n );\r\n\r\n return (\r\n <div className={classnames(\"uifw-contentlayout-wrapper\", this.props.className)} style={this.props.style}\r\n onMouseDown={this._handleMouseDown} onMouseMove={UiShowHideManager.handleContentMouseMove} role=\"presentation\"\r\n >\r\n {this.state.content}\r\n <div className={overlayClassName} />\r\n </div>\r\n );\r\n }\r\n\r\n private _handleMouseDown = (_event: React.MouseEvent<HTMLDivElement>) => {\r\n // event.preventDefault();\r\n\r\n ContentViewManager.setActiveContent(this.state.content);\r\n };\r\n\r\n public override componentDidMount() {\r\n ContentViewManager.onActiveContentChangedEvent.addListener(this._handleActiveContentChanged);\r\n }\r\n\r\n public override componentWillUnmount() {\r\n ContentViewManager.onActiveContentChangedEvent.removeListener(this._handleActiveContentChanged);\r\n }\r\n\r\n private _handleActiveContentChanged = (args: ActiveContentChangedEventArgs) => {\r\n const isActive = this.state.content === args.activeContent;\r\n if (this.state.isActive !== isActive) {\r\n this.setState({ isActive });\r\n }\r\n };\r\n\r\n // istanbul ignore next\r\n public override componentDidUpdate(prevProps: ContentWrapperProps, _prevState: ContentWrapperState) {\r\n if (this.props.content !== prevProps.content) {\r\n this.setState((_, props) => ({ content: props.content, isActive: props.content === ContentViewManager.getActiveContent() }));\r\n }\r\n }\r\n\r\n}\r\n\r\n/** Properties for the [[SplitContainer]] component */\r\ninterface SplitContainerProps extends CommonProps {\r\n contentA: React.ReactNode;\r\n contentB: React.ReactNode;\r\n orientation: Orientation;\r\n percentage: number;\r\n resizable: boolean;\r\n minSizeTopLeft: number;\r\n minSizeBottomRight: number;\r\n splitterStateId?: string;\r\n onSplitterChange?: (size: number, percentage: number) => void;\r\n}\r\n\r\n/** Split Container class.\r\n */\r\nclass SplitContainer extends React.Component<SplitContainerProps> {\r\n private _containerDiv: HTMLDivElement | null = null;\r\n\r\n constructor(props: SplitContainerProps) {\r\n super(props);\r\n }\r\n\r\n private _onSplitterChange = (size: number): void => {\r\n let percentage = 0;\r\n\r\n // istanbul ignore else\r\n if (this._containerDiv && size > 0) {\r\n if (this.props.orientation === Orientation.Horizontal) {\r\n const height = this._containerDiv.getBoundingClientRect().height;\r\n // istanbul ignore if\r\n if (height > 0)\r\n percentage = size / height;\r\n } else {\r\n const width = this._containerDiv.getBoundingClientRect().width;\r\n // istanbul ignore if\r\n if (width > 0)\r\n percentage = size / width;\r\n }\r\n\r\n // istanbul ignore else\r\n if (this.props.onSplitterChange)\r\n this.props.onSplitterChange(size, percentage);\r\n }\r\n };\r\n\r\n public override render(): React.ReactNode {\r\n const orientation = (this.props.orientation === Orientation.Horizontal) ? \"horizontal\" : \"vertical\";\r\n const defaultSize = `${(this.props.percentage * 100).toString()}%`;\r\n const minSizeTopLeft = this.props.minSizeTopLeft;\r\n const minSizeBottomRight = -(this.props.minSizeBottomRight);\r\n\r\n return (\r\n <div ref={(e) => { this._containerDiv = e; }}\r\n className={classnames(\"uifw-contentlayout-full-size\", this.props.className)}\r\n style={this.props.style}\r\n >\r\n <SplitPane split={orientation}\r\n minSize={minSizeTopLeft} maxSize={minSizeBottomRight} defaultSize={defaultSize}\r\n onChange={this._onSplitterChange} allowResize={this.props.resizable}\r\n >\r\n {this.props.contentA}\r\n {this.props.contentB}\r\n </SplitPane>\r\n </div >\r\n );\r\n }\r\n}\r\n\r\n/** Properties for [[SingleContentContainer]] component\r\n */\r\ninterface SingleContentProps extends CommonProps {\r\n content: React.ReactNode;\r\n}\r\n\r\n/** Single Content Container class.\r\n */\r\nclass SingleContentContainer extends React.Component<SingleContentProps> {\r\n\r\n public override render(): React.ReactNode {\r\n\r\n return (\r\n <div className={classnames(\"uifw-contentlayout-full-size\", this.props.className)} style={this.props.style} data-testid=\"single-content-container\"\r\n onMouseMove={UiShowHideManager.handleContentMouseMove}\r\n >\r\n {this.props.content}\r\n </div>\r\n );\r\n }\r\n}\r\n\r\n/** Common interface for HorizontalSplit and VerticalSplit\r\n */\r\ninterface LayoutSplit {\r\n createContentContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode;\r\n isLocked: boolean;\r\n}\r\n\r\n/** Minimum split size */\r\nconst MIN_SPLIT_SIZE = 6;\r\n\r\n/** Base Split class.\r\n */\r\nclass BaseSplit {\r\n public defaultPercentage: number;\r\n public stateId: string = \"\";\r\n public isLocked: boolean = false;\r\n\r\n constructor(props: LayoutSplitPropsBase) {\r\n this.defaultPercentage = props.percentage;\r\n\r\n // istanbul ignore else\r\n if (props.id)\r\n this.stateId = props.id;\r\n\r\n // istanbul ignore else\r\n if (props.lock)\r\n this.isLocked = props.lock;\r\n }\r\n}\r\n\r\n/** Horizontal Split class.\r\n */\r\nclass HorizontalSplit extends BaseSplit implements LayoutSplit {\r\n private _topIndex: number = -1;\r\n private _bottomIndex: number = -1;\r\n private _topSplit?: LayoutSplit;\r\n private _bottomSplit?: LayoutSplit;\r\n private _props: LayoutHorizontalSplitProps;\r\n private _minSizeTop: number = MIN_SPLIT_SIZE;\r\n private _minSizeBottom: number = MIN_SPLIT_SIZE;\r\n\r\n constructor(props: LayoutHorizontalSplitProps) {\r\n super(props);\r\n\r\n this._props = props;\r\n\r\n if (typeof props.top === \"number\") {\r\n this._topIndex = props.top;\r\n } else {\r\n this._topSplit = ContentLayoutDef.createSplit(props.top);\r\n }\r\n\r\n if (typeof props.bottom === \"number\") {\r\n this._bottomIndex = props.bottom;\r\n } else {\r\n this._bottomSplit = ContentLayoutDef.createSplit(props.bottom);\r\n }\r\n\r\n if (props.minSizeTop)\r\n this._minSizeTop = Math.max(props.minSizeTop, MIN_SPLIT_SIZE);\r\n\r\n if (props.minSizeBottom)\r\n this._minSizeBottom = Math.max(props.minSizeBottom, MIN_SPLIT_SIZE);\r\n }\r\n\r\n private _handleSplitterChange = (_size: number, percentage: number): void => {\r\n this._props.percentage = percentage;\r\n };\r\n\r\n public createContentContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode {\r\n if (this.isLocked)\r\n resizable = false;\r\n\r\n const topContent = (!this._topSplit) ?\r\n <ContentWrapper content={contentNodes[this._topIndex]} /> :\r\n this._topSplit.createContentContainer(contentNodes, resizable);\r\n const bottomContent = (!this._bottomSplit) ?\r\n <ContentWrapper content={contentNodes[this._bottomIndex]} /> :\r\n this._bottomSplit.createContentContainer(contentNodes, resizable);\r\n\r\n return (\r\n <SplitContainer\r\n contentA={topContent}\r\n contentB={bottomContent}\r\n orientation={Orientation.Horizontal}\r\n percentage={this.defaultPercentage}\r\n resizable={resizable}\r\n minSizeTopLeft={this._minSizeTop}\r\n minSizeBottomRight={this._minSizeBottom}\r\n splitterStateId={this.stateId}\r\n onSplitterChange={this._handleSplitterChange}\r\n />\r\n );\r\n }\r\n}\r\n\r\n/** Vertical Split class.\r\n */\r\nclass VerticalSplit extends BaseSplit implements LayoutSplit {\r\n private _leftIndex: number = -1;\r\n private _rightIndex: number = -1;\r\n private _leftSplit?: LayoutSplit;\r\n private _rightSplit?: LayoutSplit;\r\n private _props: LayoutVerticalSplitProps;\r\n private _minSizeLeft: number = MIN_SPLIT_SIZE;\r\n private _minSizeRight: number = MIN_SPLIT_SIZE;\r\n\r\n constructor(props: LayoutVerticalSplitProps) {\r\n super(props);\r\n\r\n this._props = props;\r\n\r\n if (typeof props.left === \"number\") {\r\n this._leftIndex = props.left;\r\n } else {\r\n this._leftSplit = ContentLayoutDef.createSplit(props.left);\r\n }\r\n\r\n if (typeof props.right === \"number\") {\r\n this._rightIndex = props.right;\r\n } else {\r\n this._rightSplit = ContentLayoutDef.createSplit(props.right);\r\n }\r\n\r\n if (props.minSizeLeft)\r\n this._minSizeLeft = Math.max(props.minSizeLeft, MIN_SPLIT_SIZE);\r\n\r\n if (props.minSizeRight)\r\n this._minSizeRight = Math.max(props.minSizeRight, MIN_SPLIT_SIZE);\r\n }\r\n\r\n private _handleSplitterChange = (_size: number, percentage: number): void => {\r\n this._props.percentage = percentage;\r\n };\r\n\r\n public createContentContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode {\r\n if (this.isLocked)\r\n resizable = false;\r\n\r\n const leftContent = (!this._leftSplit) ?\r\n <ContentWrapper content={contentNodes[this._leftIndex]} /> :\r\n this._leftSplit.createContentContainer(contentNodes, resizable);\r\n const rightContent = (!this._rightSplit) ?\r\n <ContentWrapper content={contentNodes[this._rightIndex]} /> :\r\n this._rightSplit.createContentContainer(contentNodes, resizable);\r\n\r\n return (\r\n <SplitContainer\r\n contentA={leftContent}\r\n contentB={rightContent}\r\n orientation={Orientation.Vertical}\r\n percentage={this.defaultPercentage}\r\n resizable={resizable}\r\n minSizeTopLeft={this._minSizeLeft}\r\n minSizeBottomRight={this._minSizeRight}\r\n splitterStateId={this.stateId}\r\n onSplitterChange={this._handleSplitterChange}\r\n />\r\n );\r\n }\r\n}\r\n\r\n/** Content Layout Definition class.\r\n * @public\r\n */\r\nexport class ContentLayoutDef {\r\n private _layoutProps: ContentLayoutProps;\r\n private _rootSplit?: LayoutSplit;\r\n\r\n /** ID for this Content Layout */\r\n public id: string = \"\";\r\n /** Description of the layout. */\r\n public description: string = \"\";\r\n constructor(layoutProps: ContentLayoutProps) {\r\n this._layoutProps = layoutProps;\r\n this.id = layoutProps.id;\r\n if (layoutProps.description !== undefined)\r\n this.description = layoutProps.description;\r\n }\r\n\r\n public get rootSplit(): LayoutSplit | undefined { return this._rootSplit; }\r\n\r\n /** Creates [[ContentLayoutProps]] for JSON purposes\r\n * @public\r\n */\r\n public toJSON(): ContentLayoutProps { return this._layoutProps; }\r\n\r\n /** Fill a layout container with React nodes for each content view\r\n */\r\n public fillLayoutContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode | undefined {\r\n this._rootSplit = ContentLayoutDef.createSplit(this._layoutProps);\r\n\r\n if (this.rootSplit) {\r\n return this.rootSplit.createContentContainer(contentNodes, resizable);\r\n }\r\n\r\n if (contentNodes.length > 0)\r\n return <SingleContentContainer content={contentNodes[0]} />;\r\n\r\n return undefined;\r\n }\r\n\r\n /** Gets the indexes of content views used in this Content Layout\r\n */\r\n public getUsedContentIndexes(): number[] {\r\n let allContentIndexes: number[] = [];\r\n\r\n if (!this._layoutProps.horizontalSplit && !this._layoutProps.verticalSplit)\r\n allContentIndexes.push(0);\r\n else {\r\n allContentIndexes = allContentIndexes.concat(this.getHorizontalSplitContentIndexes(this._layoutProps.horizontalSplit));\r\n allContentIndexes = allContentIndexes.concat(this.getVerticalSplitContentIndexes(this._layoutProps.verticalSplit));\r\n }\r\n\r\n const uniqueContentIndexes = [...new Set(allContentIndexes)];\r\n\r\n return uniqueContentIndexes;\r\n }\r\n\r\n private getHorizontalSplitContentIndexes(splitProps?: LayoutHorizontalSplitProps): number[] {\r\n let contentIndexes: number[] = [];\r\n\r\n if (!splitProps)\r\n return contentIndexes;\r\n\r\n if (typeof splitProps.top === \"number\")\r\n contentIndexes.push(splitProps.top);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.top.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.top.verticalSplit));\r\n }\r\n\r\n if (typeof splitProps.bottom === \"number\")\r\n contentIndexes.push(splitProps.bottom);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.bottom.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.bottom.verticalSplit));\r\n }\r\n\r\n return contentIndexes;\r\n }\r\n\r\n private getVerticalSplitContentIndexes(splitProps?: LayoutVerticalSplitProps): number[] {\r\n let contentIndexes: number[] = [];\r\n\r\n if (!splitProps)\r\n return contentIndexes;\r\n\r\n if (typeof splitProps.left === \"number\")\r\n contentIndexes.push(splitProps.left);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.left.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.left.verticalSplit));\r\n }\r\n\r\n if (typeof splitProps.right === \"number\")\r\n contentIndexes.push(splitProps.right);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.right.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.right.verticalSplit));\r\n }\r\n\r\n return contentIndexes;\r\n }\r\n\r\n /** @internal */\r\n public static createSplit(fragmentDef: LayoutFragmentProps): LayoutSplit | undefined {\r\n if (fragmentDef.horizontalSplit) {\r\n return new HorizontalSplit(fragmentDef.horizontalSplit);\r\n } else if (fragmentDef.verticalSplit) {\r\n return new VerticalSplit(fragmentDef.verticalSplit);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n}\r\n\r\n/** Content Layout Activated Event Args class.\r\n * @public\r\n */\r\nexport interface ContentLayoutActivatedEventArgs {\r\n contentLayout: ContentLayoutDef;\r\n contentGroup: ContentGroup;\r\n}\r\n\r\n/** Content Layout Activated Event class.\r\n * @public\r\n */\r\nexport class ContentLayoutActivatedEvent extends UiEvent<ContentLayoutActivatedEventArgs> { }\r\n\r\n/** State for the [[ContentLayout]].\r\n */\r\ninterface ContentLayoutState {\r\n contentLayoutDef: ContentLayoutDef;\r\n contentContainer?: React.ReactNode;\r\n contentGroupId?: string;\r\n}\r\n\r\n/** Properties for the [[ContentLayout]] React component.\r\n * @public\r\n */\r\nexport interface ContentLayoutComponentProps extends CommonProps {\r\n contentLayout: ContentLayoutDef;\r\n contentGroup: ContentGroup;\r\n isInFooterMode: boolean;\r\n}\r\n\r\n/** Content Layout React component.\r\n * @public\r\n */\r\nexport class ContentLayout extends React.Component<ContentLayoutComponentProps, ContentLayoutState> {\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<ContentLayoutState>;\r\n\r\n constructor(props: ContentLayoutComponentProps) {\r\n super(props);\r\n\r\n const contentLayoutDef = this.props.contentLayout;\r\n const contentGroup = this.props.contentGroup;\r\n\r\n const contentNodes = contentGroup.getContentNodes();\r\n const contentContainer = contentLayoutDef.fillLayoutContainer(contentNodes, true);\r\n\r\n this.state = {\r\n contentLayoutDef: this.props.contentLayout,\r\n contentContainer,\r\n contentGroupId: this.props.contentGroup.groupId,\r\n };\r\n }\r\n\r\n public override componentDidMount() {\r\n FrontstageManager.onContentLayoutActivatedEvent.addListener(this._handleContentLayoutActivated);\r\n }\r\n\r\n public override componentWillUnmount() {\r\n FrontstageManager.onContentLayoutActivatedEvent.removeListener(this._handleContentLayoutActivated);\r\n }\r\n\r\n private _handleContentLayoutActivated = (args: ContentLayoutActivatedEventArgs) => {\r\n const contentLayoutDef = args.contentLayout;\r\n const contentGroup = args.contentGroup;\r\n\r\n const contentNodes = contentGroup.getContentNodes();\r\n const contentContainer = contentLayoutDef.fillLayoutContainer(contentNodes, true);\r\n\r\n this.setState({\r\n contentLayoutDef: args.contentLayout,\r\n contentContainer,\r\n contentGroupId: contentGroup.groupId,\r\n });\r\n };\r\n\r\n public override render(): React.ReactNode {\r\n if (this.state.contentContainer) {\r\n return (\r\n <div id=\"uifw-contentlayout-div\" className={this.props.className} style={this.props.style}\r\n key={`${this.state.contentGroupId}-${this.state.contentLayoutDef.id}`}\r\n onMouseDown={this._onMouseDown} onMouseUp={this._onMouseUp} role=\"presentation\"\r\n >\r\n {this.state.contentContainer}\r\n </div>\r\n );\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private _onMouseDown = (_event: React.MouseEvent<HTMLDivElement>) => {\r\n ContentViewManager.setMouseDown(true);\r\n };\r\n\r\n private _onMouseUp = (_event: React.MouseEvent<HTMLDivElement>) => {\r\n ContentViewManager.setMouseDown(false);\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ContentLayout.js","sourceRoot":"","sources":["../../../../src/appui-react/content/ContentLayout.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,8BAA8B;AAE9B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC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GAAG,gBAAgB,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAElF,IAAI,CAAC,KAAK,GAAG;YACX,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa;YAC1C,gBAAgB;YAChB,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO;SAChD,CAAC;IACJ,CAAC;IAEe,iBAAiB;QAC/B,iBAAiB,CAAC,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAClG,CAAC;IAEe,oBAAoB;QAClC,iBAAiB,CAAC,6BAA6B,CAAC,cAAc,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IACrG,CAAC;IAgBe,MAAM;QACpB,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;YAC/B,OAAO,CACL,6BAAK,EAAE,EAAC,wBAAwB,EAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvF,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,EAAE,EACrE,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAC,cAAc,IAE9E,IAAI,CAAC,KAAK,CAAC,gBAAgB,CACxB,CACP,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CASF","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 ContentView\r\n */\r\n\r\n// cSpell:ignore contentlayout\r\n\r\nimport \"./ContentLayout.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { SplitPane } from \"./split-pane/SplitPane\";\r\nimport { CommonProps, Orientation } from \"@itwin/core-react\";\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { UiShowHideManager } from \"../utils/UiShowHideManager\";\r\nimport { ContentGroup } from \"./ContentGroup\";\r\nimport { ContentLayoutProps, LayoutFragmentProps, LayoutHorizontalSplitProps, LayoutSplitPropsBase, LayoutVerticalSplitProps, UiEvent } from \"@itwin/appui-abstract\";\r\nimport { ActiveContentChangedEventArgs, ContentViewManager } from \"./ContentViewManager\";\r\n\r\n/** Properties for [[ContentWrapper]] */\r\ninterface ContentWrapperProps extends CommonProps {\r\n content: React.ReactNode;\r\n}\r\n\r\n/** State for [[ContentWrapper]] */\r\ninterface ContentWrapperState {\r\n content: React.ReactNode;\r\n isActive: boolean;\r\n}\r\n\r\n/** ContentWrapper React component.\r\n */\r\nclass ContentWrapper extends React.Component<ContentWrapperProps, ContentWrapperState> {\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<ContentWrapperState>;\r\n\r\n constructor(props: ContentWrapperProps) {\r\n super(props);\r\n\r\n this.state = {\r\n content: this.props.content,\r\n isActive: this.props.content === ContentViewManager.getActiveContent(),\r\n };\r\n }\r\n\r\n public override render(): React.ReactNode {\r\n const overlayClassName = classnames(\r\n \"uifw-contentlayout-overlay-div\",\r\n this.state.isActive ? \"uifw-contentlayout-overlay-active\" : \"uifw-contentlayout-overlay-inactive\",\r\n );\r\n\r\n return (\r\n <div className={classnames(\"uifw-contentlayout-wrapper\", this.props.className)} style={this.props.style}\r\n onMouseDown={this._handleMouseDown} onMouseMove={UiShowHideManager.handleContentMouseMove} role=\"presentation\"\r\n >\r\n {this.state.content}\r\n <div className={overlayClassName} />\r\n </div>\r\n );\r\n }\r\n\r\n private _handleMouseDown = (_event: React.MouseEvent<HTMLDivElement>) => {\r\n // event.preventDefault();\r\n\r\n ContentViewManager.setActiveContent(this.state.content);\r\n };\r\n\r\n public override componentDidMount() {\r\n ContentViewManager.onActiveContentChangedEvent.addListener(this._handleActiveContentChanged);\r\n }\r\n\r\n public override componentWillUnmount() {\r\n ContentViewManager.onActiveContentChangedEvent.removeListener(this._handleActiveContentChanged);\r\n }\r\n\r\n private _handleActiveContentChanged = (args: ActiveContentChangedEventArgs) => {\r\n const isActive = this.state.content === args.activeContent;\r\n if (this.state.isActive !== isActive) {\r\n this.setState({ isActive });\r\n }\r\n };\r\n\r\n // istanbul ignore next\r\n public override componentDidUpdate(prevProps: ContentWrapperProps, _prevState: ContentWrapperState) {\r\n if (this.props.content !== prevProps.content) {\r\n this.setState((_, props) => ({ content: props.content, isActive: props.content === ContentViewManager.getActiveContent() }));\r\n }\r\n }\r\n}\r\n\r\n/** Properties for the [[SplitContainer]] component */\r\ninterface SplitContainerProps extends CommonProps {\r\n contentA: React.ReactNode;\r\n contentB: React.ReactNode;\r\n orientation: Orientation;\r\n percentage: number;\r\n resizable: boolean;\r\n minSizeTopLeft: number;\r\n minSizeBottomRight: number;\r\n splitterStateId?: string;\r\n onSplitterChange?: (size: number, percentage: number) => void;\r\n}\r\n\r\n/** Split Container class.\r\n */\r\nclass SplitContainer extends React.Component<SplitContainerProps> {\r\n private _containerDiv: HTMLDivElement | null = null;\r\n\r\n constructor(props: SplitContainerProps) {\r\n super(props);\r\n }\r\n\r\n private _onSplitterChange = (size: number): void => {\r\n let percentage = 0;\r\n\r\n // istanbul ignore else\r\n if (this._containerDiv && size > 0) {\r\n if (this.props.orientation === Orientation.Horizontal) {\r\n const height = this._containerDiv.getBoundingClientRect().height;\r\n // istanbul ignore if\r\n if (height > 0)\r\n percentage = size / height;\r\n } else {\r\n const width = this._containerDiv.getBoundingClientRect().width;\r\n // istanbul ignore if\r\n if (width > 0)\r\n percentage = size / width;\r\n }\r\n\r\n // istanbul ignore else\r\n if (this.props.onSplitterChange)\r\n this.props.onSplitterChange(size, percentage);\r\n }\r\n };\r\n\r\n public override render(): React.ReactNode {\r\n const orientation = (this.props.orientation === Orientation.Horizontal) ? \"horizontal\" : \"vertical\";\r\n const defaultSize = `${(this.props.percentage * 100).toString()}%`;\r\n const minSizeTopLeft = this.props.minSizeTopLeft;\r\n const minSizeBottomRight = -(this.props.minSizeBottomRight);\r\n\r\n return (\r\n <div ref={(e) => { this._containerDiv = e; }}\r\n className={classnames(\"uifw-contentlayout-full-size\", this.props.className)}\r\n style={this.props.style}\r\n >\r\n <SplitPane split={orientation}\r\n minSize={minSizeTopLeft} maxSize={minSizeBottomRight} defaultSize={defaultSize}\r\n onChange={this._onSplitterChange} allowResize={this.props.resizable}\r\n >\r\n {this.props.contentA}\r\n {this.props.contentB}\r\n </SplitPane>\r\n </div >\r\n );\r\n }\r\n}\r\n\r\n/** Properties for [[SingleContentContainer]] component\r\n */\r\ninterface SingleContentProps extends CommonProps {\r\n content: React.ReactNode;\r\n}\r\n\r\n/** Single Content Container class.\r\n */\r\nclass SingleContentContainer extends React.Component<SingleContentProps> {\r\n\r\n public override render(): React.ReactNode {\r\n\r\n return (\r\n <div className={classnames(\"uifw-contentlayout-full-size\", this.props.className)} style={this.props.style} data-testid=\"single-content-container\"\r\n onMouseMove={UiShowHideManager.handleContentMouseMove}\r\n >\r\n {this.props.content}\r\n </div>\r\n );\r\n }\r\n}\r\n\r\n/** Common interface for HorizontalSplit and VerticalSplit\r\n */\r\ninterface LayoutSplit {\r\n createContentContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode;\r\n isLocked: boolean;\r\n}\r\n\r\n/** Minimum split size */\r\nconst MIN_SPLIT_SIZE = 6;\r\n\r\n/** Base Split class.\r\n */\r\nclass BaseSplit {\r\n public defaultPercentage: number;\r\n public stateId: string = \"\";\r\n public isLocked: boolean = false;\r\n\r\n constructor(props: LayoutSplitPropsBase) {\r\n this.defaultPercentage = props.percentage;\r\n\r\n // istanbul ignore else\r\n if (props.id)\r\n this.stateId = props.id;\r\n\r\n // istanbul ignore else\r\n if (props.lock)\r\n this.isLocked = props.lock;\r\n }\r\n}\r\n\r\n/** Horizontal Split class.\r\n */\r\nclass HorizontalSplit extends BaseSplit implements LayoutSplit {\r\n private _topIndex: number = -1;\r\n private _bottomIndex: number = -1;\r\n private _topSplit?: LayoutSplit;\r\n private _bottomSplit?: LayoutSplit;\r\n private _props: LayoutHorizontalSplitProps;\r\n private _minSizeTop: number = MIN_SPLIT_SIZE;\r\n private _minSizeBottom: number = MIN_SPLIT_SIZE;\r\n\r\n constructor(props: LayoutHorizontalSplitProps) {\r\n super(props);\r\n\r\n this._props = props;\r\n\r\n if (typeof props.top === \"number\") {\r\n this._topIndex = props.top;\r\n } else {\r\n this._topSplit = ContentLayoutDef.createSplit(props.top);\r\n }\r\n\r\n if (typeof props.bottom === \"number\") {\r\n this._bottomIndex = props.bottom;\r\n } else {\r\n this._bottomSplit = ContentLayoutDef.createSplit(props.bottom);\r\n }\r\n\r\n if (props.minSizeTop)\r\n this._minSizeTop = Math.max(props.minSizeTop, MIN_SPLIT_SIZE);\r\n\r\n if (props.minSizeBottom)\r\n this._minSizeBottom = Math.max(props.minSizeBottom, MIN_SPLIT_SIZE);\r\n }\r\n\r\n private _handleSplitterChange = (_size: number, percentage: number): void => {\r\n this._props.percentage = percentage;\r\n };\r\n\r\n public createContentContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode {\r\n if (this.isLocked)\r\n resizable = false;\r\n\r\n const topContent = (!this._topSplit) ?\r\n <ContentWrapper content={contentNodes[this._topIndex]} /> :\r\n this._topSplit.createContentContainer(contentNodes, resizable);\r\n const bottomContent = (!this._bottomSplit) ?\r\n <ContentWrapper content={contentNodes[this._bottomIndex]} /> :\r\n this._bottomSplit.createContentContainer(contentNodes, resizable);\r\n\r\n return (\r\n <SplitContainer\r\n contentA={topContent}\r\n contentB={bottomContent}\r\n orientation={Orientation.Horizontal}\r\n percentage={this.defaultPercentage}\r\n resizable={resizable}\r\n minSizeTopLeft={this._minSizeTop}\r\n minSizeBottomRight={this._minSizeBottom}\r\n splitterStateId={this.stateId}\r\n onSplitterChange={this._handleSplitterChange}\r\n />\r\n );\r\n }\r\n}\r\n\r\n/** Vertical Split class.\r\n */\r\nclass VerticalSplit extends BaseSplit implements LayoutSplit {\r\n private _leftIndex: number = -1;\r\n private _rightIndex: number = -1;\r\n private _leftSplit?: LayoutSplit;\r\n private _rightSplit?: LayoutSplit;\r\n private _props: LayoutVerticalSplitProps;\r\n private _minSizeLeft: number = MIN_SPLIT_SIZE;\r\n private _minSizeRight: number = MIN_SPLIT_SIZE;\r\n\r\n constructor(props: LayoutVerticalSplitProps) {\r\n super(props);\r\n\r\n this._props = props;\r\n\r\n if (typeof props.left === \"number\") {\r\n this._leftIndex = props.left;\r\n } else {\r\n this._leftSplit = ContentLayoutDef.createSplit(props.left);\r\n }\r\n\r\n if (typeof props.right === \"number\") {\r\n this._rightIndex = props.right;\r\n } else {\r\n this._rightSplit = ContentLayoutDef.createSplit(props.right);\r\n }\r\n\r\n if (props.minSizeLeft)\r\n this._minSizeLeft = Math.max(props.minSizeLeft, MIN_SPLIT_SIZE);\r\n\r\n if (props.minSizeRight)\r\n this._minSizeRight = Math.max(props.minSizeRight, MIN_SPLIT_SIZE);\r\n }\r\n\r\n private _handleSplitterChange = (_size: number, percentage: number): void => {\r\n this._props.percentage = percentage;\r\n };\r\n\r\n public createContentContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode {\r\n if (this.isLocked)\r\n resizable = false;\r\n\r\n const leftContent = (!this._leftSplit) ?\r\n <ContentWrapper content={contentNodes[this._leftIndex]} /> :\r\n this._leftSplit.createContentContainer(contentNodes, resizable);\r\n const rightContent = (!this._rightSplit) ?\r\n <ContentWrapper content={contentNodes[this._rightIndex]} /> :\r\n this._rightSplit.createContentContainer(contentNodes, resizable);\r\n\r\n return (\r\n <SplitContainer\r\n contentA={leftContent}\r\n contentB={rightContent}\r\n orientation={Orientation.Vertical}\r\n percentage={this.defaultPercentage}\r\n resizable={resizable}\r\n minSizeTopLeft={this._minSizeLeft}\r\n minSizeBottomRight={this._minSizeRight}\r\n splitterStateId={this.stateId}\r\n onSplitterChange={this._handleSplitterChange}\r\n />\r\n );\r\n }\r\n}\r\n\r\n/** Content Layout Definition class.\r\n * @public\r\n */\r\nexport class ContentLayoutDef {\r\n private _layoutProps: ContentLayoutProps;\r\n private _rootSplit?: LayoutSplit;\r\n\r\n /** ID for this Content Layout */\r\n public id: string = \"\";\r\n /** Description of the layout. */\r\n public description: string = \"\";\r\n constructor(layoutProps: ContentLayoutProps) {\r\n this._layoutProps = layoutProps;\r\n this.id = layoutProps.id;\r\n if (layoutProps.description !== undefined)\r\n this.description = layoutProps.description;\r\n }\r\n\r\n public get rootSplit(): LayoutSplit | undefined { return this._rootSplit; }\r\n\r\n /** Creates [[ContentLayoutProps]] for JSON purposes\r\n * @public\r\n */\r\n public toJSON(): ContentLayoutProps { return this._layoutProps; }\r\n\r\n /** Fill a layout container with React nodes for each content view\r\n */\r\n public fillLayoutContainer(contentNodes: React.ReactNode[], resizable: boolean): React.ReactNode | undefined {\r\n this._rootSplit = ContentLayoutDef.createSplit(this._layoutProps);\r\n\r\n if (this.rootSplit) {\r\n return this.rootSplit.createContentContainer(contentNodes, resizable);\r\n }\r\n\r\n if (contentNodes.length > 0)\r\n return <SingleContentContainer content={contentNodes[0]} />;\r\n\r\n return undefined;\r\n }\r\n\r\n /** Gets the indexes of content views used in this Content Layout\r\n */\r\n public getUsedContentIndexes(): number[] {\r\n let allContentIndexes: number[] = [];\r\n\r\n if (!this._layoutProps.horizontalSplit && !this._layoutProps.verticalSplit)\r\n allContentIndexes.push(0);\r\n else {\r\n allContentIndexes = allContentIndexes.concat(this.getHorizontalSplitContentIndexes(this._layoutProps.horizontalSplit));\r\n allContentIndexes = allContentIndexes.concat(this.getVerticalSplitContentIndexes(this._layoutProps.verticalSplit));\r\n }\r\n\r\n const uniqueContentIndexes = [...new Set(allContentIndexes)];\r\n\r\n return uniqueContentIndexes;\r\n }\r\n\r\n private getHorizontalSplitContentIndexes(splitProps?: LayoutHorizontalSplitProps): number[] {\r\n let contentIndexes: number[] = [];\r\n\r\n if (!splitProps)\r\n return contentIndexes;\r\n\r\n if (typeof splitProps.top === \"number\")\r\n contentIndexes.push(splitProps.top);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.top.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.top.verticalSplit));\r\n }\r\n\r\n if (typeof splitProps.bottom === \"number\")\r\n contentIndexes.push(splitProps.bottom);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.bottom.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.bottom.verticalSplit));\r\n }\r\n\r\n return contentIndexes;\r\n }\r\n\r\n private getVerticalSplitContentIndexes(splitProps?: LayoutVerticalSplitProps): number[] {\r\n let contentIndexes: number[] = [];\r\n\r\n if (!splitProps)\r\n return contentIndexes;\r\n\r\n if (typeof splitProps.left === \"number\")\r\n contentIndexes.push(splitProps.left);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.left.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.left.verticalSplit));\r\n }\r\n\r\n if (typeof splitProps.right === \"number\")\r\n contentIndexes.push(splitProps.right);\r\n else {\r\n contentIndexes = contentIndexes.concat(this.getHorizontalSplitContentIndexes(splitProps.right.horizontalSplit));\r\n contentIndexes = contentIndexes.concat(this.getVerticalSplitContentIndexes(splitProps.right.verticalSplit));\r\n }\r\n\r\n return contentIndexes;\r\n }\r\n\r\n /** @internal */\r\n public static createSplit(fragmentDef: LayoutFragmentProps): LayoutSplit | undefined {\r\n if (fragmentDef.horizontalSplit) {\r\n return new HorizontalSplit(fragmentDef.horizontalSplit);\r\n } else if (fragmentDef.verticalSplit) {\r\n return new VerticalSplit(fragmentDef.verticalSplit);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n}\r\n\r\n/** Content Layout Activated Event Args class.\r\n * @public\r\n */\r\nexport interface ContentLayoutActivatedEventArgs {\r\n contentLayout: ContentLayoutDef;\r\n contentGroup: ContentGroup;\r\n}\r\n\r\n/** Content Layout Activated Event class.\r\n * @public\r\n */\r\nexport class ContentLayoutActivatedEvent extends UiEvent<ContentLayoutActivatedEventArgs> { }\r\n\r\n/** State for the [[ContentLayout]].\r\n */\r\ninterface ContentLayoutState {\r\n contentLayoutDef: ContentLayoutDef;\r\n contentContainer?: React.ReactNode;\r\n contentGroupId?: string;\r\n}\r\n\r\n/** Properties for the [[ContentLayout]] React component.\r\n * @public\r\n */\r\nexport interface ContentLayoutComponentProps extends CommonProps {\r\n contentLayout: ContentLayoutDef;\r\n contentGroup: ContentGroup;\r\n isInFooterMode: boolean;\r\n}\r\n\r\n/** Content Layout React component.\r\n * @public\r\n */\r\nexport class ContentLayout extends React.Component<ContentLayoutComponentProps, ContentLayoutState> {\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<ContentLayoutState>;\r\n\r\n constructor(props: ContentLayoutComponentProps) {\r\n super(props);\r\n\r\n const contentLayoutDef = this.props.contentLayout;\r\n const contentGroup = this.props.contentGroup;\r\n\r\n const contentNodes = contentGroup.getContentNodes();\r\n const contentContainer = contentLayoutDef.fillLayoutContainer(contentNodes, true);\r\n\r\n this.state = {\r\n contentLayoutDef: this.props.contentLayout,\r\n contentContainer,\r\n contentGroupId: this.props.contentGroup.groupId,\r\n };\r\n }\r\n\r\n public override componentDidMount() {\r\n FrontstageManager.onContentLayoutActivatedEvent.addListener(this._handleContentLayoutActivated);\r\n }\r\n\r\n public override componentWillUnmount() {\r\n FrontstageManager.onContentLayoutActivatedEvent.removeListener(this._handleContentLayoutActivated);\r\n }\r\n\r\n private _handleContentLayoutActivated = (args: ContentLayoutActivatedEventArgs) => {\r\n const contentLayoutDef = args.contentLayout;\r\n const contentGroup = args.contentGroup;\r\n\r\n const contentNodes = contentGroup.getContentNodes();\r\n const contentContainer = contentLayoutDef.fillLayoutContainer(contentNodes, true);\r\n\r\n this.setState({\r\n contentLayoutDef: args.contentLayout,\r\n contentContainer,\r\n contentGroupId: contentGroup.groupId,\r\n });\r\n };\r\n\r\n public override render(): React.ReactNode {\r\n if (this.state.contentContainer) {\r\n return (\r\n <div id=\"uifw-contentlayout-div\" className={this.props.className} style={this.props.style}\r\n key={`${this.state.contentGroupId}-${this.state.contentLayoutDef.id}`}\r\n onMouseDown={this._onMouseDown} onMouseUp={this._onMouseUp} role=\"presentation\"\r\n >\r\n {this.state.contentContainer}\r\n </div>\r\n );\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private _onMouseDown = (_event: React.MouseEvent<HTMLDivElement>) => {\r\n ContentViewManager.setMouseDown(true);\r\n };\r\n\r\n private _onMouseUp = (_event: React.MouseEvent<HTMLDivElement>) => {\r\n ContentViewManager.setMouseDown(false);\r\n };\r\n}\r\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module ContentView
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
/** Based on react-split-pane package. See https://github.com/tomkp/react-split-pane/blob/master/LICENSE */
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface PaneProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
size?: string | number;
|
|
12
|
+
split?: "vertical" | "horizontal";
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
eleRef: React.RefObject<HTMLDivElement>;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function Pane(props: PaneProps): JSX.Element;
|
|
21
|
+
//# sourceMappingURL=Pane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pane.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/content/split-pane/Pane.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,2GAA2G;AAE3G;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,eAwCpC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module ContentView
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import classnames from "classnames";
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export function Pane(props) {
|
|
14
|
+
const { children, className, split, style, size, eleRef, } = props;
|
|
15
|
+
const paneClasses = React.useMemo(() => classnames("Pane", split, className), [split, className]);
|
|
16
|
+
const paneStyle = React.useMemo(() => {
|
|
17
|
+
const baseStyle = {
|
|
18
|
+
flex: 1,
|
|
19
|
+
position: "relative",
|
|
20
|
+
outline: "none",
|
|
21
|
+
};
|
|
22
|
+
if (size !== undefined) {
|
|
23
|
+
if (split === "vertical") {
|
|
24
|
+
baseStyle.width = size;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
baseStyle.height = size;
|
|
28
|
+
baseStyle.display = "flex";
|
|
29
|
+
}
|
|
30
|
+
baseStyle.flex = "none";
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...style,
|
|
34
|
+
...baseStyle,
|
|
35
|
+
};
|
|
36
|
+
}, [size, split, style]);
|
|
37
|
+
return (React.createElement("div", { ref: eleRef, className: paneClasses, style: paneStyle }, children));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=Pane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pane.js","sourceRoot":"","sources":["../../../../../src/appui-react/content/split-pane/Pane.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAgBpC;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,KAAK,EACL,IAAI,EACJ,MAAM,GACP,GAAG,KAAK,CAAC;IAEV,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAElG,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACnC,MAAM,SAAS,GAAiC;YAC9C,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,UAAU;YACpB,OAAO,EAAE,MAAM;SAChB,CAAC;QAEF,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,IAAI,KAAK,KAAK,UAAU,EAAE;gBACxB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC;aACxB;iBAAM;gBACL,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC;gBACxB,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;aAC5B;YACD,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC;SACzB;QAED,OAAO;YACL,GAAG,KAAK;YACR,GAAG,SAAS;SACU,CAAC;IAC3B,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,6BAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,IACvD,QAAQ,CACL,CACP,CAAC;AACJ,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 ContentView\r\n */\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\n\r\n/** Based on react-split-pane package. See https://github.com/tomkp/react-split-pane/blob/master/LICENSE */\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface PaneProps {\r\n className?: string;\r\n size?: string | number;\r\n split?: \"vertical\" | \"horizontal\";\r\n style?: React.CSSProperties;\r\n eleRef: React.RefObject<HTMLDivElement>;\r\n children?: React.ReactNode;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function Pane(props: PaneProps) {\r\n const {\r\n children,\r\n className,\r\n split,\r\n style,\r\n size,\r\n eleRef,\r\n } = props;\r\n\r\n const paneClasses = React.useMemo(() => classnames(\"Pane\", split, className), [split, className]);\r\n\r\n const paneStyle = React.useMemo(() => {\r\n const baseStyle: Partial<React.CSSProperties> = {\r\n flex: 1,\r\n position: \"relative\",\r\n outline: \"none\",\r\n };\r\n\r\n if (size !== undefined) {\r\n if (split === \"vertical\") {\r\n baseStyle.width = size;\r\n } else {\r\n baseStyle.height = size;\r\n baseStyle.display = \"flex\";\r\n }\r\n baseStyle.flex = \"none\";\r\n }\r\n\r\n return {\r\n ...style,\r\n ...baseStyle,\r\n } as React.CSSProperties;\r\n }, [size, split, style]);\r\n\r\n return (\r\n <div ref={eleRef} className={paneClasses} style={paneStyle}>\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module ContentView
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
/** Based on react-split-pane package. See https://github.com/tomkp/react-split-pane/blob/master/LICENSE */
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface ResizerProps {
|
|
10
|
+
split?: "vertical" | "horizontal";
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
className: string;
|
|
13
|
+
onMouseDown: (event: MouseEvent) => void;
|
|
14
|
+
onTouchEnd: () => void;
|
|
15
|
+
onTouchStart: (event: TouchEvent) => void;
|
|
16
|
+
onClick?: (event: MouseEvent) => void;
|
|
17
|
+
onDoubleClick?: (event: MouseEvent) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function Resizer(props: ResizerProps): JSX.Element;
|
|
23
|
+
//# sourceMappingURL=Resizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resizer.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/content/split-pane/Resizer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,2GAA2G;AAE3G;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,eA2C1C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module ContentView
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import classnames from "classnames";
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export function Resizer(props) {
|
|
14
|
+
const { className, onClick, onDoubleClick, onMouseDown, onTouchEnd, onTouchStart, split, style, } = props;
|
|
15
|
+
const resizerClasses = React.useMemo(() => classnames(split, className), [split, className]);
|
|
16
|
+
return (React.createElement("span", { role: "presentation", className: resizerClasses, style: style, onMouseDown: (event) => onMouseDown(event.nativeEvent), onTouchStart: (event) => {
|
|
17
|
+
onTouchStart(event.nativeEvent);
|
|
18
|
+
}, onTouchEnd: (event) => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
onTouchEnd();
|
|
21
|
+
}, onClick: (event) => {
|
|
22
|
+
// istanbul ignore else
|
|
23
|
+
if (onClick) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
onClick(event.nativeEvent);
|
|
26
|
+
}
|
|
27
|
+
}, onDoubleClick: (event) => {
|
|
28
|
+
// istanbul ignore else
|
|
29
|
+
if (onDoubleClick) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
onDoubleClick(event.nativeEvent);
|
|
32
|
+
}
|
|
33
|
+
} }));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=Resizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resizer.js","sourceRoot":"","sources":["../../../../../src/appui-react/content/split-pane/Resizer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAkBpC;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,KAAmB;IACzC,MAAM,EACJ,SAAS,EACT,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,GACN,GAAG,KAAK,CAAC;IAEV,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAE7F,OAAO,CACL,8BACE,IAAI,EAAC,cAAc,EACnB,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,EACtD,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YACtB,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAClC,CAAC,EACD,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,UAAU,EAAE,CAAC;QACf,CAAC,EACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,uBAAuB;YACvB,IAAI,OAAO,EAAE;gBACX,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;aAC5B;QACH,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YACvB,uBAAuB;YACvB,IAAI,aAAa,EAAE;gBACjB,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;aAClC;QACH,CAAC,GACD,CACH,CAAC;AACJ,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 ContentView\r\n */\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\n\r\n/** Based on react-split-pane package. See https://github.com/tomkp/react-split-pane/blob/master/LICENSE */\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface ResizerProps {\r\n split?: \"vertical\" | \"horizontal\";\r\n style?: React.CSSProperties;\r\n className: string;\r\n onMouseDown: (event: MouseEvent) => void;\r\n onTouchEnd: () => void;\r\n onTouchStart: (event: TouchEvent) => void;\r\n onClick?: (event: MouseEvent) => void;\r\n onDoubleClick?: (event: MouseEvent) => void;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function Resizer(props: ResizerProps) {\r\n const {\r\n className,\r\n onClick,\r\n onDoubleClick,\r\n onMouseDown,\r\n onTouchEnd,\r\n onTouchStart,\r\n split,\r\n style,\r\n } = props;\r\n\r\n const resizerClasses = React.useMemo(() => classnames(split, className), [split, className]);\r\n\r\n return (\r\n <span\r\n role=\"presentation\"\r\n className={resizerClasses}\r\n style={style}\r\n onMouseDown={(event) => onMouseDown(event.nativeEvent)}\r\n onTouchStart={(event) => {\r\n onTouchStart(event.nativeEvent);\r\n }}\r\n onTouchEnd={(event) => {\r\n event.preventDefault();\r\n onTouchEnd();\r\n }}\r\n onClick={(event) => {\r\n // istanbul ignore else\r\n if (onClick) {\r\n event.preventDefault();\r\n onClick(event.nativeEvent);\r\n }\r\n }}\r\n onDoubleClick={(event) => {\r\n // istanbul ignore else\r\n if (onDoubleClick) {\r\n event.preventDefault();\r\n onDoubleClick(event.nativeEvent);\r\n }\r\n }}\r\n />\r\n );\r\n}\r\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module ContentView
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Props for [[SplitPane]] component
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface SplitPaneProps {
|
|
10
|
+
/** Pass false to disable resizing */
|
|
11
|
+
allowResize?: boolean;
|
|
12
|
+
/** The array of two react nodes, one for each pane. */
|
|
13
|
+
children: React.ReactNode[];
|
|
14
|
+
/** Determines which pane maintains its size when browser window is resized.*/
|
|
15
|
+
primary?: "first" | "second";
|
|
16
|
+
minSize?: string | number;
|
|
17
|
+
/** You can limit the maximal size of the 'fixed' pane using the maxSize parameter with a positive value
|
|
18
|
+
* (measured in pixels but state just a number). If you wrap the SplitPane into a container component
|
|
19
|
+
* (yes you can, just remember the container has to have the relative or absolute positioning), then you'll need to limit
|
|
20
|
+
* the movement of the splitter (resizer) at the end of the SplitPane (otherwise it can be dragged outside the SplitPane
|
|
21
|
+
* and you don't catch it never more). For this purpose use the maxSize parameter with value 0. When dragged the splitter/resizer
|
|
22
|
+
* will stop at the border of the SplitPane component and think this you'll be able to pick it again and drag it back then.
|
|
23
|
+
* And more: if you set the maxSize to negative value (e.g. -200), then the splitter stops 200px before the border
|
|
24
|
+
* (in other words it sets the minimal size of the 'resizable' pane in this case). This can be useful also in the
|
|
25
|
+
* full-screen case of use. */
|
|
26
|
+
maxSize?: string | number;
|
|
27
|
+
/** Default initial size of primary pane */
|
|
28
|
+
defaultSize?: string | number;
|
|
29
|
+
/** Size of primary pane */
|
|
30
|
+
size?: string | number;
|
|
31
|
+
/** You can use the step prop to only allow resizing in fixed increments. */
|
|
32
|
+
step?: number;
|
|
33
|
+
split?: "vertical" | "horizontal";
|
|
34
|
+
/** This callback is invoked when a drag start. */
|
|
35
|
+
onDragStarted?: () => void;
|
|
36
|
+
/** This callback is invoked when a drag ends. */
|
|
37
|
+
onDragFinished?: (newSize: number) => void;
|
|
38
|
+
/** Callback is invoked with the current drag during a drag event.*/
|
|
39
|
+
onChange?: (newSize: number) => void;
|
|
40
|
+
/** Callback is invoked if user clicks on Resizer. */
|
|
41
|
+
onResizerClick?: (event: MouseEvent) => void;
|
|
42
|
+
/** Callback is invoked if user double clicks on Resizer. */
|
|
43
|
+
onResizerDoubleClick?: (event: MouseEvent) => void;
|
|
44
|
+
/** Styling to be applied to the main container */
|
|
45
|
+
style?: React.CSSProperties;
|
|
46
|
+
/** Styling to be applied to both panes */
|
|
47
|
+
paneStyle?: React.CSSProperties;
|
|
48
|
+
/** Styling to be applied to the first pane, with precedence over paneStyle */
|
|
49
|
+
pane1Style?: React.CSSProperties;
|
|
50
|
+
/** Styling to be applied to the second pane, with precedence over paneStyle */
|
|
51
|
+
pane2Style?: React.CSSProperties;
|
|
52
|
+
/** Styling to be applied to the resizer bar */
|
|
53
|
+
resizerStyle?: React.CSSProperties;
|
|
54
|
+
/** Class name to be added to the SplitPane div */
|
|
55
|
+
className?: string;
|
|
56
|
+
/** Class name to be added to each Pane's div */
|
|
57
|
+
paneClassName?: string;
|
|
58
|
+
/** Class name to be added to Pane1's div */
|
|
59
|
+
pane1ClassName?: string;
|
|
60
|
+
/** Class name to be added to Pane2's div */
|
|
61
|
+
pane2ClassName?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Local TypeScript implementation of `SplitPane` from `react-split-pane` package since that
|
|
65
|
+
* package is not regularly maintained.
|
|
66
|
+
* See https://github.com/tomkp/react-split-pane/blob/master/LICENSE.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export declare function SplitPane(props: SplitPaneProps): JSX.Element;
|
|
70
|
+
//# sourceMappingURL=SplitPane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplitPane.d.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,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,+EAA+E;IAC/E,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,+CAA+C;IAC/C,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAsCD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAmP9C"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module ContentView
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import classnames from "classnames";
|
|
10
|
+
import { Pane } from "./Pane";
|
|
11
|
+
import { Resizer } from "./Resizer";
|
|
12
|
+
function unFocus(ownerDoc) {
|
|
13
|
+
var _a;
|
|
14
|
+
// istanbul ignore next
|
|
15
|
+
if (!ownerDoc)
|
|
16
|
+
return;
|
|
17
|
+
const docSelection = ownerDoc.getSelection();
|
|
18
|
+
// istanbul ignore else
|
|
19
|
+
if (docSelection) {
|
|
20
|
+
docSelection.empty();
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// istanbul ignore next
|
|
24
|
+
try {
|
|
25
|
+
const winSelection = (_a = ownerDoc.defaultView) === null || _a === void 0 ? void 0 : _a.getSelection();
|
|
26
|
+
winSelection === null || winSelection === void 0 ? void 0 : winSelection.removeAllRanges();
|
|
27
|
+
}
|
|
28
|
+
catch (_e) { }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function getDefaultSize(defaultSize, minSize, maxSize, draggedSize) {
|
|
32
|
+
// istanbul ignore next
|
|
33
|
+
if (typeof draggedSize === "number") {
|
|
34
|
+
const min = typeof minSize === "number" ? minSize : 0;
|
|
35
|
+
const max = typeof maxSize === "number" && maxSize >= 0 ? maxSize : Infinity;
|
|
36
|
+
return Math.max(min, Math.min(max, draggedSize));
|
|
37
|
+
}
|
|
38
|
+
if (defaultSize !== undefined) {
|
|
39
|
+
return defaultSize;
|
|
40
|
+
}
|
|
41
|
+
return minSize;
|
|
42
|
+
}
|
|
43
|
+
function removeNullChildren(children) {
|
|
44
|
+
return React.Children.toArray(children).filter((c) => c);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Local TypeScript implementation of `SplitPane` from `react-split-pane` package since that
|
|
48
|
+
* package is not regularly maintained.
|
|
49
|
+
* See https://github.com/tomkp/react-split-pane/blob/master/LICENSE.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export function SplitPane(props) {
|
|
53
|
+
const { style, size, defaultSize, maxSize, children, paneStyle, pane1Style, pane2Style, className, paneClassName, pane1ClassName, pane2ClassName, onDragStarted, onDragFinished, step, onChange, onResizerClick, onResizerDoubleClick, } = props;
|
|
54
|
+
// honor same defaults as react-split-pane
|
|
55
|
+
const allowResize = React.useMemo(() => undefined !== props.allowResize ? props.allowResize : true, [props.allowResize]);
|
|
56
|
+
const minSize = React.useMemo(() => undefined !== props.minSize ? props.minSize : 50, [props.minSize]);
|
|
57
|
+
const primary = React.useMemo(() => undefined !== props.primary ? props.primary : "first", [props.primary]);
|
|
58
|
+
const split = React.useMemo(() => undefined !== props.split ? props.split : "vertical", [props.split]);
|
|
59
|
+
const initialSize = size !== undefined ? size : getDefaultSize(defaultSize, minSize, maxSize);
|
|
60
|
+
const [position, setPosition] = React.useState(0);
|
|
61
|
+
const [draggedSize, setDraggedSize] = React.useState();
|
|
62
|
+
const [active, setActive] = React.useState(false);
|
|
63
|
+
const [pane1Size, setPane1Size] = React.useState(() => primary === "first" ? initialSize : undefined);
|
|
64
|
+
const [pane2Size, setPane2Size] = React.useState(() => primary === "second" ? initialSize : undefined);
|
|
65
|
+
const splitPane = React.useRef(null);
|
|
66
|
+
const pane1 = React.useRef(null);
|
|
67
|
+
const pane2 = React.useRef(null);
|
|
68
|
+
const notNullChildren = React.useMemo(() => removeNullChildren(children), [children]);
|
|
69
|
+
React.useEffect(() => {
|
|
70
|
+
primary === "first" ? setPane1Size(initialSize) : setPane2Size(initialSize);
|
|
71
|
+
primary === "first" ? setPane2Size(undefined) : setPane1Size(undefined);
|
|
72
|
+
}, [initialSize, primary]);
|
|
73
|
+
const splitPaneStyle = React.useMemo(() => {
|
|
74
|
+
const directionSpecificParts = (split === "vertical") ? {
|
|
75
|
+
flexDirection: "row",
|
|
76
|
+
left: 0,
|
|
77
|
+
right: 0,
|
|
78
|
+
} : {
|
|
79
|
+
bottom: 0,
|
|
80
|
+
flexDirection: "column",
|
|
81
|
+
minHeight: "100%",
|
|
82
|
+
top: 0,
|
|
83
|
+
width: "100%",
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
display: "flex",
|
|
87
|
+
flex: 1,
|
|
88
|
+
height: "100%",
|
|
89
|
+
position: "absolute",
|
|
90
|
+
outline: "none",
|
|
91
|
+
overflow: "hidden",
|
|
92
|
+
MozUserSelect: "text",
|
|
93
|
+
WebkitUserSelect: "text",
|
|
94
|
+
msUserSelect: "text",
|
|
95
|
+
userSelect: "text",
|
|
96
|
+
...style,
|
|
97
|
+
...directionSpecificParts,
|
|
98
|
+
};
|
|
99
|
+
}, [split, style]);
|
|
100
|
+
const pane1DivStyle = { ...paneStyle, ...pane1Style };
|
|
101
|
+
const pane2DivStyle = { ...paneStyle, ...pane2Style };
|
|
102
|
+
const resizerStyle = React.useMemo(() => { var _a; return (_a = props.resizerStyle) !== null && _a !== void 0 ? _a : {}; }, [props.resizerStyle]);
|
|
103
|
+
const resizerClasses = React.useMemo(() => classnames("Resizer", !allowResize && "disabled"), [allowResize]);
|
|
104
|
+
const splitPaneClasses = React.useMemo(() => classnames("SplitPane", className, split, !allowResize && "disabled"), [className, split, allowResize]);
|
|
105
|
+
const pane1Classes = React.useMemo(() => classnames("Pane1", paneClassName, pane1ClassName), [paneClassName, pane1ClassName]);
|
|
106
|
+
const pane2Classes = React.useMemo(() => classnames("Pane2", paneClassName, pane2ClassName), [paneClassName, pane2ClassName]);
|
|
107
|
+
const initializeDrag = React.useCallback((x, y) => {
|
|
108
|
+
var _a;
|
|
109
|
+
// istanbul ignore next
|
|
110
|
+
unFocus((_a = splitPane.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
|
|
111
|
+
const newPosition = split === "vertical" ? x : y;
|
|
112
|
+
onDragStarted && onDragStarted();
|
|
113
|
+
setActive(true);
|
|
114
|
+
setPosition(newPosition);
|
|
115
|
+
}, [onDragStarted, split]);
|
|
116
|
+
const onTouchStart = React.useCallback((event) => {
|
|
117
|
+
// istanbul ignore else
|
|
118
|
+
if (allowResize) {
|
|
119
|
+
initializeDrag(event.touches[0].clientX, event.touches[0].clientY);
|
|
120
|
+
}
|
|
121
|
+
}, [allowResize, initializeDrag]);
|
|
122
|
+
const processMove = React.useCallback((x, y) => {
|
|
123
|
+
var _a, _b, _c, _d, _f, _g, _h;
|
|
124
|
+
// istanbul ignore next
|
|
125
|
+
unFocus((_a = splitPane.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
|
|
126
|
+
const isPrimaryFirst = primary === "first";
|
|
127
|
+
const ref = isPrimaryFirst ? pane1.current : pane2.current;
|
|
128
|
+
const ref2 = isPrimaryFirst ? pane2.current : pane1.current;
|
|
129
|
+
const splitPaneDiv = splitPane.current;
|
|
130
|
+
// istanbul ignore else
|
|
131
|
+
if (ref && ref2 && splitPaneDiv) {
|
|
132
|
+
const node = ref;
|
|
133
|
+
const node2 = ref2;
|
|
134
|
+
// istanbul ignore else
|
|
135
|
+
if (node.getBoundingClientRect) {
|
|
136
|
+
const width = node.getBoundingClientRect().width;
|
|
137
|
+
const height = node.getBoundingClientRect().height;
|
|
138
|
+
// istanbul ignore next
|
|
139
|
+
const current = split === "vertical" ? x : y;
|
|
140
|
+
// istanbul ignore next
|
|
141
|
+
const oldSize = split === "vertical" ? width : height;
|
|
142
|
+
let positionDelta = position - current;
|
|
143
|
+
if (step) {
|
|
144
|
+
// istanbul ignore next
|
|
145
|
+
if (Math.abs(positionDelta) < step) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Integer division
|
|
149
|
+
// eslint-disable-next-line no-bitwise
|
|
150
|
+
positionDelta = ~~(positionDelta / step) * step;
|
|
151
|
+
}
|
|
152
|
+
let sizeDelta = isPrimaryFirst ? positionDelta : -positionDelta;
|
|
153
|
+
// istanbul ignore next
|
|
154
|
+
const pane1Order = parseInt((_d = (_c = (_b = node.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) === null || _c === void 0 ? void 0 : _c.getComputedStyle(node).order) !== null && _d !== void 0 ? _d : "0", 10);
|
|
155
|
+
// istanbul ignore next
|
|
156
|
+
const pane2Order = parseInt((_h = (_g = (_f = node2.ownerDocument) === null || _f === void 0 ? void 0 : _f.defaultView) === null || _g === void 0 ? void 0 : _g.getComputedStyle(node2).order) !== null && _h !== void 0 ? _h : "0", 10);
|
|
157
|
+
// istanbul ignore next
|
|
158
|
+
if (pane1Order > pane2Order) {
|
|
159
|
+
sizeDelta = -sizeDelta;
|
|
160
|
+
}
|
|
161
|
+
let newMaxSize = maxSize;
|
|
162
|
+
// istanbul ignore next
|
|
163
|
+
if (typeof maxSize === "number" && maxSize !== undefined && maxSize <= 0) {
|
|
164
|
+
if (split === "vertical") {
|
|
165
|
+
newMaxSize = splitPaneDiv.getBoundingClientRect().width + maxSize;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
newMaxSize = splitPaneDiv.getBoundingClientRect().height + maxSize;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
let newSize = oldSize - sizeDelta;
|
|
172
|
+
const newPosition = position - positionDelta;
|
|
173
|
+
// istanbul ignore next
|
|
174
|
+
if (typeof minSize === "number" && newSize < minSize) {
|
|
175
|
+
newSize = minSize;
|
|
176
|
+
}
|
|
177
|
+
else if (typeof newMaxSize === "number" && newMaxSize !== undefined && newSize > newMaxSize) {
|
|
178
|
+
newSize = newMaxSize;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
setPosition(newPosition);
|
|
182
|
+
}
|
|
183
|
+
onChange && onChange(newSize);
|
|
184
|
+
setDraggedSize(newSize);
|
|
185
|
+
isPrimaryFirst ? setPane1Size(newSize) : setPane2Size(newSize);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}, [maxSize, minSize, onChange, position, primary, split, step]);
|
|
189
|
+
const onTouchMove = React.useCallback((event) => {
|
|
190
|
+
// istanbul ignore next
|
|
191
|
+
if (!allowResize || !active)
|
|
192
|
+
return;
|
|
193
|
+
processMove(event.touches[0].clientX, event.touches[0].clientY);
|
|
194
|
+
}, [active, allowResize, processMove]);
|
|
195
|
+
const onMouseMove = React.useCallback((event) => {
|
|
196
|
+
if (!allowResize || !active)
|
|
197
|
+
return;
|
|
198
|
+
processMove(event.clientX, event.clientY);
|
|
199
|
+
}, [active, allowResize, processMove]);
|
|
200
|
+
const onMouseDown = React.useCallback((event) => {
|
|
201
|
+
// istanbul ignore else
|
|
202
|
+
if (allowResize) {
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
initializeDrag(event.clientX, event.clientY);
|
|
205
|
+
}
|
|
206
|
+
}, [allowResize, initializeDrag]);
|
|
207
|
+
const processResizeFinished = React.useCallback(() => {
|
|
208
|
+
// istanbul ignore else
|
|
209
|
+
if (undefined !== draggedSize && allowResize && active) {
|
|
210
|
+
onDragFinished && onDragFinished(draggedSize);
|
|
211
|
+
}
|
|
212
|
+
setActive(false);
|
|
213
|
+
}, [draggedSize, allowResize, active, onDragFinished]);
|
|
214
|
+
const onMouseUp = React.useCallback((event) => {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
processResizeFinished();
|
|
217
|
+
}, [processResizeFinished]);
|
|
218
|
+
React.useEffect(() => {
|
|
219
|
+
var _a;
|
|
220
|
+
// istanbul ignore next
|
|
221
|
+
const ownerDoc = (_a = splitPane.current) === null || _a === void 0 ? void 0 : _a.ownerDocument;
|
|
222
|
+
// istanbul ignore next
|
|
223
|
+
if (!ownerDoc)
|
|
224
|
+
return;
|
|
225
|
+
ownerDoc.addEventListener("mouseup", onMouseUp);
|
|
226
|
+
ownerDoc.addEventListener("mousemove", onMouseMove);
|
|
227
|
+
ownerDoc.addEventListener("touchmove", onTouchMove);
|
|
228
|
+
return () => {
|
|
229
|
+
ownerDoc.removeEventListener("mouseup", onMouseUp);
|
|
230
|
+
ownerDoc.removeEventListener("mousemove", onMouseMove);
|
|
231
|
+
ownerDoc.removeEventListener("touchmove", onTouchMove);
|
|
232
|
+
};
|
|
233
|
+
}, [onMouseMove, onMouseUp, onTouchMove]);
|
|
234
|
+
return (React.createElement("div", { className: splitPaneClasses, ref: splitPane, style: splitPaneStyle },
|
|
235
|
+
React.createElement(Pane, { className: pane1Classes, key: "pane1", eleRef: pane1, size: pane1Size, split: split, style: pane1DivStyle }, notNullChildren[0]),
|
|
236
|
+
React.createElement(Resizer, { className: resizerClasses, onClick: onResizerClick, onDoubleClick: onResizerDoubleClick, onMouseDown: onMouseDown, onTouchStart: onTouchStart, onTouchEnd: processResizeFinished, key: "resizer", split: split, style: resizerStyle }),
|
|
237
|
+
React.createElement(Pane, { className: pane2Classes, key: "pane2", eleRef: pane2, size: pane2Size, split: split, style: pane2DivStyle }, notNullChildren[1])));
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=SplitPane.js.map
|