Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for inline ion-picker #24905

Closed
3 tasks done
ivent opened this issue Mar 9, 2022 · 3 comments
Closed
3 tasks done

feat: add support for inline ion-picker #24905

ivent opened this issue Mar 9, 2022 · 3 comments
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement

Comments

@ivent
Copy link

ivent commented Mar 9, 2022

Prerequisites

Describe the Feature Request

Hello, I would like a feature to enable the inclusion of the ion-picker component within the content of a page without the need to open it in a modal, I managed to implement this feature with ion-datetime but it only works with dates, years and months and I want to use ion-picker to create an ios-style select and only that with ion-picker I can create but it only opens in modal, is this feature currently possible or could it be developed?

ion-picker

I am currently using the following code in angular/ionic 6

home.page.html


<ion-content>
  <ng-container >

    <ion-button expand="block" (click)="showPickerController()">Show Picker Controller</ion-button>

    <ion-list>     
      <ng-container *ngFor="let type of ['year']">   
            <ion-item slot="header">
              <ion-label>ion-datetime</ion-label>
              <ion-text slot="end"></ion-text>
            </ion-item>
            <ion-datetime
              size="cover"
              slot="content"
              [presentation]="type"
            >
            </ion-datetime>
      </ng-container>
    </ion-list>
  </ng-container>
</ion-content>

home.page.ts


import { Component } from '@angular/core';
import { PickerController, PickerOptions } from '@ionic/angular';


@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
  
})
export class HomePage {


  constructor(private pickerCtrl: PickerController) {}

  async showPickerController() {
    let opts: PickerOptions = {
      buttons: [
        {
          text: 'Ok'
        }
      ],
      columns: [
        {
          name: 'category',
          options: [
            { text: 'Dog', value: 'dog' },
            { text: 'Cat', value: 'cat' },
            { text: 'Fish', value: 'fish' },
            { text: 'Rabbit', value: 'rabbit' },
          ]
        }
      ]
    };
    
    let picker = await this.pickerCtrl.create(opts);
    picker.present();
    picker.onDidDismiss().then(async data => {
      console.log('dismiss');
    });
  }
}

Describe the Use Case

Create an inshot-style font select

select-inshot

Describe Preferred Solution

No response

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Mar 9, 2022
@liamdebeasi liamdebeasi changed the title feat: ion-picker outside the modal and inside the inline page feat: add support for inline ion-picker Mar 9, 2022
@liamdebeasi liamdebeasi added package: core @ionic/core package type: feature request a new feature, enhancement, or improvement labels Mar 9, 2022
@ionitron-bot ionitron-bot bot removed the triage label Mar 9, 2022
@loyaj
Copy link

loyaj commented Apr 26, 2023

I also would like this feature to be implemented. In my use case, I am still displaying the picker in a (sheet) modal, but the modal also has other text and buttons. Being able to place the picker "inline" on the page (similar to the way the ion-datetime component is rendered) would be essential for this. I'm not seeing a workaround but would be happy to be pointed to one :)

Edit: I'm using Vue 3 as my framework

liamdebeasi added a commit that referenced this issue Dec 13, 2023
Issue number: resolves #24905, resolves #26840, resolves #15710

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The current picker is only displayed as an overlay which makes it
impossible to use inline with the rest of the application. Additionally,
there are several bugs and missing features. For example, it is
impossible to know when the value of the picker column has changed using
public APIs. This is valuable for updating other columns in response to
that data.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Introduces `ion-picker` as an inline wheel picker component. The
overlay picker is still available using `ion-picker-legacy`.
- The implementation of this component resolves linked bugs. It also
resolves linked features by exposing an `ionChange` event for developers
to listen for.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev-build: `7.5.8-dev.11702398696.1ab62ea9`

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Shawn Taylor <shawn@ionic.io>
Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
Co-authored-by: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com>
Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
@liamdebeasi
Copy link
Contributor

Thanks for the request. In Ionic 8 we are adding a new inline picker. The existing overlay picker will still be available for developers to use. The work required to add this was completed in #28689, so I am going to close this.

Copy link

ionitron-bot bot commented Jan 12, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement
Projects
None yet
Development

No branches or pull requests

3 participants