(
private readonly container: HTMLElement,
options: SplitViewOptions
)
| 224 | } |
| 225 | |
| 226 | constructor( |
| 227 | private readonly container: HTMLElement, |
| 228 | options: SplitViewOptions |
| 229 | ) { |
| 230 | this._orientation = options.orientation ?? Orientation.VERTICAL; |
| 231 | this.element = this.createContainer(); |
| 232 | |
| 233 | this.margin = options.margin ?? 0; |
| 234 | |
| 235 | this.proportionalLayout = |
| 236 | options.proportionalLayout === undefined |
| 237 | ? true |
| 238 | : !!options.proportionalLayout; |
| 239 | |
| 240 | this.viewContainer = this.createViewContainer(); |
| 241 | this.sashContainer = this.createSashContainer(); |
| 242 | |
| 243 | this.element.appendChild(this.sashContainer); |
| 244 | this.element.appendChild(this.viewContainer); |
| 245 | |
| 246 | this.container.appendChild(this.element); |
| 247 | |
| 248 | this.style(options.styles); |
| 249 | |
| 250 | // We have an existing set of view, add them now |
| 251 | if (options.descriptor) { |
| 252 | this._size = options.descriptor.size; |
| 253 | options.descriptor.views.forEach((viewDescriptor, index) => { |
| 254 | const sizing = |
| 255 | viewDescriptor.visible === undefined || |
| 256 | viewDescriptor.visible |
| 257 | ? viewDescriptor.size |
| 258 | : ({ |
| 259 | type: 'invisible', |
| 260 | cachedVisibleSize: viewDescriptor.size, |
| 261 | } as InvisibleSizing); |
| 262 | |
| 263 | const view = viewDescriptor.view; |
| 264 | this.addView( |
| 265 | view, |
| 266 | sizing, |
| 267 | index, |
| 268 | true |
| 269 | // true skip layout |
| 270 | ); |
| 271 | }); |
| 272 | |
| 273 | // Initialize content size and proportions for first layout |
| 274 | this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); |
| 275 | this.saveProportions(); |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | style(styles?: ISplitviewStyles): void { |
| 280 | if (styles?.separatorBorder === 'transparent') { |
nothing calls this directly
no test coverage detected