refactor(): remove [main] from split-pane (#19511)

This commit is contained in:
Liam DeBeasi
2019-10-02 10:42:53 -04:00
committed by Brandy Carney
parent e665d38d23
commit ac4f254a4f
3 changed files with 8 additions and 10 deletions

View File

@@ -2457,7 +2457,7 @@ export namespace Components {
}
interface IonSplitPane {
/**
* 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.
* The content `id` of the split-pane's main content.
*/
'contentId'?: string;
/**
@@ -5706,7 +5706,7 @@ declare namespace LocalJSX {
}
interface IonSplitPane {
/**
* 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.
* The content `id` of the split-pane's main content.
*/
'contentId'?: string;
/**

View File

@@ -133,11 +133,11 @@ export const SplitPlaneExample: React.SFC<{}> = () => (
## Properties
| Property | Attribute | Description | Type | Default |
| ----------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------- |
| `contentId` | `content-id` | 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. | `string \| undefined` | `undefined` |
| `disabled` | `disabled` | If `true`, the split pane will be hidden. | `boolean` | `false` |
| `when` | `when` | When the split-pane should be shown. Can be a CSS media query expression, or a shortcut expression. Can also be a boolean expression. | `boolean \| string` | `QUERY['lg']` |
| Property | Attribute | Description | Type | Default |
| ----------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------- |
| `contentId` | `content-id` | The content `id` of the split-pane's main content. | `string \| undefined` | `undefined` |
| `disabled` | `disabled` | If `true`, the split pane will be hidden. | `boolean` | `false` |
| `when` | `when` | When the split-pane should be shown. Can be a CSS media query expression, or a shortcut expression. Can also be a boolean expression. | `boolean \| string` | `QUERY['lg']` |
## Events

View File

@@ -29,8 +29,6 @@ export class SplitPane implements ComponentInterface {
/**
* 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.
*/
@Prop() contentId?: string;
@@ -151,7 +149,7 @@ AFTER:
let foundMain = false;
for (let i = 0; i < nu; i++) {
const child = children[i] as HTMLElement;
const isMain = contentId !== undefined ? child.id === contentId : child.hasAttribute('main');
const isMain = contentId !== undefined && child.id === contentId;
if (isMain) {
if (foundMain) {
console.warn('split pane cannot have more than one main node');