fix(react): add class based APIs (#16665)

fixes #16583
This commit is contained in:
Manu MA
2018-12-11 01:08:00 +01:00
committed by GitHub
parent 64557a7bcc
commit 2933f61e8d
32 changed files with 117 additions and 67 deletions

View File

@ -33,6 +33,21 @@ export class SplitPane implements ComponentInterface {
@Prop({ context: 'isServer' }) isServer!: boolean;
@Prop({ context: 'window' }) win!: Window;
/**
* The content `id` of the split-pane's main content.
* This property can be used instead of the `[main]` attribute to select the `main`
* content of the split-pane.
*
* ```html
* <ion-split-pane content-id="my-content">
* <ion-menu></ion-menu>
* <div id="my-content">
* </ion-split-pane>
* ```
*
*/
@Prop() contentId?: string;
/**
* If `true`, the split pane will be hidden.
*/
@ -129,12 +144,13 @@ export class SplitPane implements ComponentInterface {
if (this.isServer) {
return;
}
const contentId = this.contentId;
const children = this.el.children;
const nu = this.el.childElementCount;
let foundMain = false;
for (let i = 0; i < nu; i++) {
const child = children[i] as HTMLElement;
const isMain = child.hasAttribute('main');
const isMain = contentId !== undefined ? child.id === contentId : child.hasAttribute('main');
if (isMain) {
if (foundMain) {
console.warn('split pane can not have more than one main node');