Skip to content

Commit

Permalink
fix(hide-when): mode is a reserved property
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Aug 26, 2018
1 parent 86acb8c commit c446d1b
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 146 deletions.
12 changes: 6 additions & 6 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ export namespace Components {
/**
* If the current platform matches the given value, the element will hide. Accepts a comma separated list of modes to match against.
*/
'mode': Mode;
'modes': string;
/**
* If false, and two or more conditions are set, the element will hide when all are true. If true, and two or more conditions are set, the element will hide when at least one is true.
*/
Expand All @@ -1549,7 +1549,7 @@ export namespace Components {
*/
'orientation': string;
/**
* If the current platform matches the given value, the element will hide. Accepts a comma separated list of platform to match against.
* If the current platform matches the given value, the element will hide. Accepts a comma separated list of platforms to match against.
*/
'platform': string;
/**
Expand All @@ -1565,7 +1565,7 @@ export namespace Components {
/**
* If the current platform matches the given value, the element will hide. Accepts a comma separated list of modes to match against.
*/
'mode'?: Mode;
'modes'?: string;
/**
* If false, and two or more conditions are set, the element will hide when all are true. If true, and two or more conditions are set, the element will hide when at least one is true.
*/
Expand All @@ -1575,7 +1575,7 @@ export namespace Components {
*/
'orientation'?: string;
/**
* If the current platform matches the given value, the element will hide. Accepts a comma separated list of platform to match against.
* If the current platform matches the given value, the element will hide. Accepts a comma separated list of platforms to match against.
*/
'platform'?: string;
/**
Expand Down Expand Up @@ -4065,7 +4065,7 @@ export namespace Components {
/**
* If the current platform matches the given value, the element will show. Accepts a comma separated list of modes to match against.
*/
'mode': Mode;
'modes': string;
/**
* If false, and two or more conditions are set, the element will show when all are true. If true, and two or more conditions are set, the element will show when at least one is true.
*/
Expand All @@ -4091,7 +4091,7 @@ export namespace Components {
/**
* If the current platform matches the given value, the element will show. Accepts a comma separated list of modes to match against.
*/
'mode'?: Mode;
'modes'?: string;
/**
* If false, and two or more conditions are set, the element will show when all are true. If true, and two or more conditions are set, the element will show when at least one is true.
*/
Expand Down
10 changes: 5 additions & 5 deletions core/src/components/hide-when/hide-when.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Element, Listen, Prop, State } from '@stencil/core';

import { Config, Mode } from '../../interface';
import { DisplayWhen, updateTestResults } from '../../utils/show-hide-when-utils';
import { Config } from '../../interface';
import { DisplayWhen, getTestResult } from '../../utils/show-hide-when-utils';

@Component({
tag: 'ion-hide-when',
Expand All @@ -17,7 +17,7 @@ export class HideWhen implements DisplayWhen {
* If the current platform matches the given value, the element will hide.
* Accepts a comma separated list of modes to match against.
*/
@Prop() mode!: Mode;
@Prop() modes!: string;

/**
* If the current orientation matches this value, the element will hide.
Expand All @@ -37,7 +37,7 @@ export class HideWhen implements DisplayWhen {

/**
* If the current platform matches the given value, the element will hide.
* Accepts a comma separated list of platform to match against.
* Accepts a comma separated list of platforms to match against.
*/
@Prop() platform?: string;

Expand All @@ -55,7 +55,7 @@ export class HideWhen implements DisplayWhen {

@Listen('window:resize')
onResize() {
this.passesTest = updateTestResults(this);
this.passesTest = getTestResult(this);
}

hostData() {
Expand Down
51 changes: 0 additions & 51 deletions core/src/components/input/input-base.tsx

This file was deleted.

76 changes: 37 additions & 39 deletions core/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { Color, Mode, StyleEvent, TextFieldTypes, TextInputChangeEvent } from '.
import { debounceEvent, deferEvent, renderHiddenInput } from '../../utils/helpers';
import { createColorClasses, hostContext } from '../../utils/theme';

import { InputComponent } from './input-base';

@Component({
tag: 'ion-input',
styleUrls: {
Expand All @@ -14,51 +12,16 @@ import { InputComponent } from './input-base';
},
shadow: true
})
export class Input implements InputComponent {
export class Input {

private nativeInput?: HTMLInputElement;
private inputId = `ion-input-${inputIds++}`;
didBlurAfterEdit = false;
private didBlurAfterEdit = false;

@State() hasFocus = false;

@Element() el!: HTMLElement;

/**
* Emitted when a keyboard input ocurred.
*/
@Event() ionInput!: EventEmitter<KeyboardEvent>;

/**
* Emitted when the value has changed.
*/
@Event() ionChange!: EventEmitter<TextInputChangeEvent>;

/**
* Emitted when the styles change.
*/
@Event() ionStyle!: EventEmitter<StyleEvent>;

/**
* Emitted when the input loses focus.
*/
@Event() ionBlur!: EventEmitter<void>;

/**
* Emitted when the input has focus.
*/
@Event() ionFocus!: EventEmitter<void>;

/**
* Emitted when the input has been created.
*/
@Event() ionInputDidLoad!: EventEmitter<void>;

/**
* Emitted when the input has been removed.
*/
@Event() ionInputDidUnload!: EventEmitter<void>;

/**
* The color to use from your application's color palette.
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
Expand Down Expand Up @@ -226,6 +189,41 @@ export class Input implements InputComponent {
this.ionChange.emit({ value });
}

/**
* Emitted when a keyboard input ocurred.
*/
@Event() ionInput!: EventEmitter<KeyboardEvent>;

/**
* Emitted when the value has changed.
*/
@Event() ionChange!: EventEmitter<TextInputChangeEvent>;

/**
* Emitted when the styles change.
*/
@Event() ionStyle!: EventEmitter<StyleEvent>;

/**
* Emitted when the input loses focus.
*/
@Event() ionBlur!: EventEmitter<void>;

/**
* Emitted when the input has focus.
*/
@Event() ionFocus!: EventEmitter<void>;

/**
* Emitted when the input has been created.
*/
@Event() ionInputDidLoad!: EventEmitter<void>;

/**
* Emitted when the input has been removed.
*/
@Event() ionInputDidUnload!: EventEmitter<void>;

componentWillLoad() {
// By default, password inputs clear after focus when they have content
if (this.clearOnEdit === undefined && this.type === 'password') {
Expand Down
8 changes: 4 additions & 4 deletions core/src/components/show-when/show-when.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Element, Listen, Prop, State } from '@stencil/core';

import { Config, Mode } from '../../interface';
import { DisplayWhen, updateTestResults } from '../../utils/show-hide-when-utils';
import { Config } from '../../interface';
import { DisplayWhen, getTestResult } from '../../utils/show-hide-when-utils';

@Component({
tag: 'ion-show-when',
Expand All @@ -18,7 +18,7 @@ export class ShowWhen implements DisplayWhen {
* If the current platform matches the given value, the element will show.
* Accepts a comma separated list of modes to match against.
*/
@Prop() mode!: Mode;
@Prop() modes!: string;

/**
* If the current orientation matches this value, the element will show.
Expand Down Expand Up @@ -56,7 +56,7 @@ export class ShowWhen implements DisplayWhen {

@Listen('window:resize')
onResize() {
this.passesTest = updateTestResults(this);
this.passesTest = getTestResult(this);
}

hostData() {
Expand Down
62 changes: 30 additions & 32 deletions core/src/components/textarea/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Component, Element, Event, EventEmitter, Method, Prop, State, Watch } f
import { Color, Mode, StyleEvent, TextInputChangeEvent } from '../../interface';
import { debounceEvent, deferEvent, renderHiddenInput } from '../../utils/helpers';
import { createColorClasses } from '../../utils/theme';
import { TextareaComponent } from '../input/input-base';

@Component({
tag: 'ion-textarea',
Expand All @@ -13,41 +12,21 @@ import { TextareaComponent } from '../input/input-base';
},
shadow: true
})
export class Textarea implements TextareaComponent {
export class Textarea {

private nativeInput?: HTMLTextAreaElement;
private inputId = `ion-input-${textareaIds++}`;

didBlurAfterEdit = false;
private didBlurAfterEdit = false;

@Element() el!: HTMLElement;

@State() hasFocus = false;

/**
* Emitted when the input value has changed.
*/
@Event() ionChange!: EventEmitter<TextInputChangeEvent>;

/**
* Emitted when a keyboard input ocurred.
*/
@Event() ionInput!: EventEmitter<KeyboardEvent>;

/**
* Emitted when the styles change.
*/
@Event() ionStyle!: EventEmitter<StyleEvent>;

/**
* Emitted when the input loses focus.
*/
@Event() ionBlur!: EventEmitter<void>;

/**
* Emitted when the input has focus.
* The mode determines which platform styles to use.
* Possible values are: `"ios"` or `"md"`.
*/
@Event() ionFocus!: EventEmitter<void>;
@Prop() mode!: Mode;

/**
* The color to use from your application's color palette.
Expand All @@ -56,12 +35,6 @@ export class Textarea implements TextareaComponent {
*/
@Prop() color?: Color;

/**
* The mode determines which platform styles to use.
* Possible values are: `"ios"` or `"md"`.
*/
@Prop() mode!: Mode;

/**
* Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user. Defaults to `"none"`.
*/
Expand Down Expand Up @@ -164,6 +137,31 @@ export class Textarea implements TextareaComponent {
this.ionChange.emit({ value });
}

/**
* Emitted when the input value has changed.
*/
@Event() ionChange!: EventEmitter<TextInputChangeEvent>;

/**
* Emitted when a keyboard input ocurred.
*/
@Event() ionInput!: EventEmitter<KeyboardEvent>;

/**
* Emitted when the styles change.
*/
@Event() ionStyle!: EventEmitter<StyleEvent>;

/**
* Emitted when the input loses focus.
*/
@Event() ionBlur!: EventEmitter<void>;

/**
* Emitted when the input has focus.
*/
@Event() ionFocus!: EventEmitter<void>;

componentDidLoad() {
this.ionStyle = deferEvent(this.ionStyle);
this.debounceChanged();
Expand Down
Loading

0 comments on commit c446d1b

Please sign in to comment.