mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 01:03:03 +08:00
@ -1157,6 +1157,7 @@ ion-searchbar,prop,disabled,boolean,false,false,false
|
|||||||
ion-searchbar,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false
|
ion-searchbar,prop,enterkeyhint,"done" | "enter" | "go" | "next" | "previous" | "search" | "send" | undefined,undefined,false,false
|
||||||
ion-searchbar,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false
|
ion-searchbar,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined,undefined,false,false
|
||||||
ion-searchbar,prop,mode,"ios" | "md",undefined,false,false
|
ion-searchbar,prop,mode,"ios" | "md",undefined,false,false
|
||||||
|
ion-searchbar,prop,name,string,this.inputId,false,false
|
||||||
ion-searchbar,prop,placeholder,string,'Search',false,false
|
ion-searchbar,prop,placeholder,string,'Search',false,false
|
||||||
ion-searchbar,prop,searchIcon,string | undefined,undefined,false,false
|
ion-searchbar,prop,searchIcon,string | undefined,undefined,false,false
|
||||||
ion-searchbar,prop,showCancelButton,"always" | "focus" | "never",'never',false,false
|
ion-searchbar,prop,showCancelButton,"always" | "focus" | "never",'never',false,false
|
||||||
|
8
core/src/components.d.ts
vendored
8
core/src/components.d.ts
vendored
@ -2578,6 +2578,10 @@ export namespace Components {
|
|||||||
* The mode determines which platform styles to use.
|
* The mode determines which platform styles to use.
|
||||||
*/
|
*/
|
||||||
"mode"?: "ios" | "md";
|
"mode"?: "ios" | "md";
|
||||||
|
/**
|
||||||
|
* If used in a form, set the name of the control, which is submitted with the form data.
|
||||||
|
*/
|
||||||
|
"name": string;
|
||||||
/**
|
/**
|
||||||
* Set the input's placeholder. `placeholder` can accept either plaintext or HTML as a string. To display characters normally reserved for HTML, they must be escaped. For example `<Ionic>` would become `<Ionic>` For more information: [Security Documentation](https://ionicframework.com/docs/faq/security)
|
* Set the input's placeholder. `placeholder` can accept either plaintext or HTML as a string. To display characters normally reserved for HTML, they must be escaped. For example `<Ionic>` would become `<Ionic>` For more information: [Security Documentation](https://ionicframework.com/docs/faq/security)
|
||||||
*/
|
*/
|
||||||
@ -6625,6 +6629,10 @@ declare namespace LocalJSX {
|
|||||||
* The mode determines which platform styles to use.
|
* The mode determines which platform styles to use.
|
||||||
*/
|
*/
|
||||||
"mode"?: "ios" | "md";
|
"mode"?: "ios" | "md";
|
||||||
|
/**
|
||||||
|
* If used in a form, set the name of the control, which is submitted with the form data.
|
||||||
|
*/
|
||||||
|
"name"?: string;
|
||||||
/**
|
/**
|
||||||
* Emitted when the input loses focus.
|
* Emitted when the input loses focus.
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +27,7 @@ export class Searchbar implements ComponentInterface {
|
|||||||
private isCancelVisible = false;
|
private isCancelVisible = false;
|
||||||
private shouldAlignLeft = true;
|
private shouldAlignLeft = true;
|
||||||
private originalIonInput?: EventEmitter<SearchbarInputEventDetail>;
|
private originalIonInput?: EventEmitter<SearchbarInputEventDetail>;
|
||||||
|
private inputId = `ion-searchbar-${searchbarIds++}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value of the input when the textarea is focused.
|
* The value of the input when the textarea is focused.
|
||||||
@ -111,6 +112,11 @@ export class Searchbar implements ComponentInterface {
|
|||||||
*/
|
*/
|
||||||
@Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
@Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If used in a form, set the name of the control, which is submitted with the form data.
|
||||||
|
*/
|
||||||
|
@Prop() name: string = this.inputId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the input's placeholder.
|
* Set the input's placeholder.
|
||||||
* `placeholder` can accept either plaintext or HTML as a string.
|
* `placeholder` can accept either plaintext or HTML as a string.
|
||||||
@ -588,6 +594,7 @@ export class Searchbar implements ComponentInterface {
|
|||||||
class="searchbar-input"
|
class="searchbar-input"
|
||||||
inputMode={this.inputmode}
|
inputMode={this.inputmode}
|
||||||
enterKeyHint={this.enterkeyhint}
|
enterKeyHint={this.enterkeyhint}
|
||||||
|
name={this.name}
|
||||||
onInput={this.onInput}
|
onInput={this.onInput}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onBlur={this.onBlur}
|
onBlur={this.onBlur}
|
||||||
@ -639,3 +646,5 @@ export class Searchbar implements ComponentInterface {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let searchbarIds = 0;
|
||||||
|
@ -106,6 +106,9 @@
|
|||||||
>
|
>
|
||||||
</ion-searchbar>
|
</ion-searchbar>
|
||||||
|
|
||||||
|
<h5 class="ion-padding-start ion-padding-top">Search - Name</h5>
|
||||||
|
<ion-searchbar name="search"> </ion-searchbar>
|
||||||
|
|
||||||
<div class="ion-padding-horizontal">
|
<div class="ion-padding-horizontal">
|
||||||
<ion-button expand="block" onClick="toggleProp()">Toggle Property</ion-button>
|
<ion-button expand="block" onClick="toggleProp()">Toggle Property</ion-button>
|
||||||
</div>
|
</div>
|
||||||
|
15
core/src/components/searchbar/test/searchbar.spec.ts
Normal file
15
core/src/components/searchbar/test/searchbar.spec.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { newSpecPage } from '@stencil/core/testing';
|
||||||
|
|
||||||
|
import { Searchbar } from '../searchbar';
|
||||||
|
|
||||||
|
describe('searchbar: rendering', () => {
|
||||||
|
it('should inherit attributes', async () => {
|
||||||
|
const page = await newSpecPage({
|
||||||
|
components: [Searchbar],
|
||||||
|
html: '<ion-searchbar name="search"></ion-searchbar>',
|
||||||
|
});
|
||||||
|
|
||||||
|
const nativeEl = page.body.querySelector('ion-searchbar input');
|
||||||
|
expect(nativeEl.getAttribute('name')).toBe('search');
|
||||||
|
});
|
||||||
|
});
|
@ -1843,7 +1843,7 @@ export declare interface IonRow extends Components.IonRow {}
|
|||||||
|
|
||||||
|
|
||||||
@ProxyCmp({
|
@ProxyCmp({
|
||||||
inputs: ['animated', 'autocomplete', 'autocorrect', 'cancelButtonIcon', 'cancelButtonText', 'clearIcon', 'color', 'debounce', 'disabled', 'enterkeyhint', 'inputmode', 'mode', 'placeholder', 'searchIcon', 'showCancelButton', 'showClearButton', 'spellcheck', 'type', 'value'],
|
inputs: ['animated', 'autocomplete', 'autocorrect', 'cancelButtonIcon', 'cancelButtonText', 'clearIcon', 'color', 'debounce', 'disabled', 'enterkeyhint', 'inputmode', 'mode', 'name', 'placeholder', 'searchIcon', 'showCancelButton', 'showClearButton', 'spellcheck', 'type', 'value'],
|
||||||
methods: ['setFocus', 'getInputElement']
|
methods: ['setFocus', 'getInputElement']
|
||||||
})
|
})
|
||||||
@Component({
|
@Component({
|
||||||
@ -1851,7 +1851,7 @@ export declare interface IonRow extends Components.IonRow {}
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
template: '<ng-content></ng-content>',
|
template: '<ng-content></ng-content>',
|
||||||
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
||||||
inputs: ['animated', 'autocomplete', 'autocorrect', 'cancelButtonIcon', 'cancelButtonText', 'clearIcon', 'color', 'debounce', 'disabled', 'enterkeyhint', 'inputmode', 'mode', 'placeholder', 'searchIcon', 'showCancelButton', 'showClearButton', 'spellcheck', 'type', 'value'],
|
inputs: ['animated', 'autocomplete', 'autocorrect', 'cancelButtonIcon', 'cancelButtonText', 'clearIcon', 'color', 'debounce', 'disabled', 'enterkeyhint', 'inputmode', 'mode', 'name', 'placeholder', 'searchIcon', 'showCancelButton', 'showClearButton', 'spellcheck', 'type', 'value'],
|
||||||
})
|
})
|
||||||
export class IonSearchbar {
|
export class IonSearchbar {
|
||||||
protected el: HTMLElement;
|
protected el: HTMLElement;
|
||||||
|
@ -681,6 +681,7 @@ export const IonSearchbar = /*@__PURE__*/ defineContainer<JSX.IonSearchbar, JSX.
|
|||||||
'disabled',
|
'disabled',
|
||||||
'inputmode',
|
'inputmode',
|
||||||
'enterkeyhint',
|
'enterkeyhint',
|
||||||
|
'name',
|
||||||
'placeholder',
|
'placeholder',
|
||||||
'searchIcon',
|
'searchIcon',
|
||||||
'showCancelButton',
|
'showCancelButton',
|
||||||
|
Reference in New Issue
Block a user