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(datetime): add new calendar picker #23416

Merged
merged 25 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
21d380d
feat(datetime): add base new datetime component (#23286)
liamdebeasi May 10, 2021
991545e
feat(datetime): add header and footer (#23288)
liamdebeasi May 10, 2021
a01c107
feat(datetime): add calendar picker on ios and md (#23325)
liamdebeasi May 19, 2021
f5e1f17
sync with next
liamdebeasi May 19, 2021
73de467
feat(datetime): add time picker (#23353)
liamdebeasi May 24, 2021
955cbea
feat(datetime): add month and year picker (#23374)
liamdebeasi May 27, 2021
19040ba
feat(datetime): add presentation, and default title/button apis (#23380)
liamdebeasi May 28, 2021
13f0c4b
sync with next
liamdebeasi Jun 1, 2021
d5152d1
fix(datetime): events are now emitted, value property now respected (…
liamdebeasi Jun 1, 2021
2e23b8b
fix(datetime): all scrollable views are now correctly snapped into pl…
liamdebeasi Jun 2, 2021
1a1b7fa
fix(datetime): use fixed pixel width for IO
liamdebeasi Jun 2, 2021
53b0181
chore(datetime): remove displayFormat and displayTimezone properties …
liamdebeasi Jun 2, 2021
e99e5ee
docs(datetime): add e2e tests (#23405)
liamdebeasi Jun 2, 2021
3fde7ce
fix(datetime): keyboard navigation now accounts for max and min dates
liamdebeasi Jun 3, 2021
c6d5480
fix(datetime): generateTime now accounts for max/min values that have…
liamdebeasi Jun 3, 2021
88932ca
fix(datetime): calendar body properly forwards focus to inner day
liamdebeasi Jun 3, 2021
ca034ef
feat(datetime): implement dayValues, minuteValues, monthValues, and y…
liamdebeasi Jun 4, 2021
8d31e2b
fix(datetime): prevent IO from incorrectly firing when overlays open …
liamdebeasi Jun 4, 2021
a369d90
fix(datetime): month is no longer disabled if year or month values ar…
liamdebeasi Jun 8, 2021
0bc250e
fix(datetime): use named imports for icons for react and vue
liamdebeasi Jun 8, 2021
5bc863b
fix(datetime): process today value correctly according to timezone
liamdebeasi Jun 8, 2021
e677a1f
Merge remote-tracking branch 'origin/next' into next-datetime
liamdebeasi Jun 10, 2021
47a9573
chore(): add docs, clean up CSS code
liamdebeasi Jun 11, 2021
0b2c85f
add usage examples
liamdebeasi Jun 11, 2021
7dfc572
fix(datetime): resolve initial scroll issues
liamdebeasi Jun 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
## Version 6.x

- [Components](#components)
* [Datetime](#datetime)
* [Header](#header)
* [Modal](#modal)
* [Popover](#popover)
Expand All @@ -32,6 +33,46 @@ This is a comprehensive list of the breaking changes introduced in the major ver

### Components

#### Datetime

The `ion-datetime` component has undergone a complete rewrite and uses a new calendar style. As a result, some of the properties no longer apply and have been removed.

- `ion-datetime` now displays the calendar inline by default, allowing for more flexibility in presentation. As a result, the `placeholder` property has been removed. Additionally, the `text` and `placeholder` Shadow Parts have been removed.

- The `--padding-bottom`, `--padding-end`, `--padding-start`, `--padding-top`, and `--placeholder-color` CSS Variables have been removed since `ion-datetime` now displays inline by default.

- The `displayFormat` and `displayTimezone` properties have been removed since `ion-datetime` now displays inline with a calendar picker. To parse the UTC string provided in the payload of the `ionChange` event, we recommend using a 3rd-party date library like [date-fns](https://date-fns.org/). Here is an example of how you can take the UTC string from `ion-datetime` and format it to whatever style you prefer:

```typescript
import { format, parseISO } from 'date-fns';

/**
* This is provided in the event
* payload from the `ionChange` event.
*/
const dateFromIonDatetime = '2021-06-04T14:23:00-04:00';
const formattedString = format(parseISO(dateFromIonDatetime), 'MMM d, yyyy');

console.log(formattedString); // Jun 4, 2021
```

- The `pickerOptions` and `pickerFormat` properties have been removed since `ion-datetime` now uses a calendar style rather than a wheel picker style.

- The `monthNames`, `monthShortNames`, `dayNames`, and `dayShortNames` properties have been removed. `ion-datetime` can now automatically format these values according to your devices locale thanks to the [Intl.DateTimeFormat API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat). If you wish to force a specific locale, you can use the new `locale` property:

```html
<ion-datetime locale="fr-FR"></ion-datetime>
```

- The `open` method has been removed. To present the datetime in an overlay, you can pass it into an `ion-modal` or `ion-popover` component and call the `present` method on the overlay instance. Alternatively, you can use the `trigger` property on `ion-modal` or `ion-popover` to present the overlay on a button click:

```html
<ion-button id="open-modal">Open Datetime Modal</ion-button>
<ion-modal trigger="open-modal">
<ion-datetime></ion-datetime>
</ion-modal>
```

#### Header

When using a collapsible large title, the last toolbar in the header with `collapse="condense"` no longer has a border. This does not affect the toolbar when the large title is collapsed.
Expand Down
4 changes: 2 additions & 2 deletions angular/src/directives/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ export class IonContent {
}
export declare interface IonDatetime extends Components.IonDatetime {
}
@ProxyCmp({ inputs: ["cancelText", "dayNames", "dayShortNames", "dayValues", "disabled", "displayFormat", "displayTimezone", "doneText", "hourValues", "max", "min", "minuteValues", "mode", "monthNames", "monthShortNames", "monthValues", "name", "pickerFormat", "pickerOptions", "placeholder", "readonly", "value", "yearValues"], "methods": ["open"] })
@Component({ selector: "ion-datetime", changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>", inputs: ["cancelText", "dayNames", "dayShortNames", "dayValues", "disabled", "displayFormat", "displayTimezone", "doneText", "hourValues", "max", "min", "minuteValues", "mode", "monthNames", "monthShortNames", "monthValues", "name", "pickerFormat", "pickerOptions", "placeholder", "readonly", "value", "yearValues"] })
@ProxyCmp({ inputs: ["cancelText", "color", "dayValues", "disabled", "doneText", "hourValues", "locale", "max", "min", "minuteValues", "mode", "monthValues", "name", "presentation", "readonly", "showDefaultButtons", "showDefaultTitle", "value", "yearValues"], "methods": ["confirm", "reset", "cancel"] })
@Component({ selector: "ion-datetime", changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>", inputs: ["cancelText", "color", "dayValues", "disabled", "doneText", "hourValues", "locale", "max", "min", "minuteValues", "mode", "monthValues", "name", "presentation", "readonly", "showDefaultButtons", "showDefaultTitle", "value", "yearValues"] })
export class IonDatetime {
ionCancel!: EventEmitter<CustomEvent>;
ionChange!: EventEmitter<CustomEvent>;
Expand Down
28 changes: 11 additions & 17 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -336,40 +336,34 @@ ion-content,part,scroll

ion-datetime,shadow
ion-datetime,prop,cancelText,string,'Cancel',false,false
ion-datetime,prop,dayNames,string | string[] | undefined,undefined,false,false
ion-datetime,prop,dayShortNames,string | string[] | undefined,undefined,false,false
ion-datetime,prop,color,string | undefined,'primary',false,false
ion-datetime,prop,dayValues,number | number[] | string | undefined,undefined,false,false
ion-datetime,prop,disabled,boolean,false,false,false
ion-datetime,prop,displayFormat,string,'MMM D, YYYY',false,false
ion-datetime,prop,displayTimezone,string | undefined,undefined,false,false
ion-datetime,prop,doneText,string,'Done',false,false
ion-datetime,prop,hourValues,number | number[] | string | undefined,undefined,false,false
ion-datetime,prop,locale,string,'default',false,false
ion-datetime,prop,max,string | undefined,undefined,false,false
ion-datetime,prop,min,string | undefined,undefined,false,false
ion-datetime,prop,minuteValues,number | number[] | string | undefined,undefined,false,false
ion-datetime,prop,mode,"ios" | "md",undefined,false,false
ion-datetime,prop,monthNames,string | string[] | undefined,undefined,false,false
ion-datetime,prop,monthShortNames,string | string[] | undefined,undefined,false,false
ion-datetime,prop,monthValues,number | number[] | string | undefined,undefined,false,false
ion-datetime,prop,name,string,this.inputId,false,false
ion-datetime,prop,pickerFormat,string | undefined,undefined,false,false
ion-datetime,prop,pickerOptions,undefined | { columns?: PickerColumn[] | undefined; buttons?: PickerButton[] | undefined; cssClass?: string | string[] | undefined; showBackdrop?: boolean | undefined; backdropDismiss?: boolean | undefined; animated?: boolean | undefined; mode?: Mode | undefined; keyboardClose?: boolean | undefined; id?: string | undefined; enterAnimation?: AnimationBuilder | undefined; leaveAnimation?: AnimationBuilder | undefined; },undefined,false,false
ion-datetime,prop,placeholder,null | string | undefined,undefined,false,false
ion-datetime,prop,presentation,"date" | "date-time" | "time" | "time-date",'date-time',false,false
ion-datetime,prop,readonly,boolean,false,false,false
ion-datetime,prop,showDefaultButtons,boolean,false,false,false
ion-datetime,prop,showDefaultTitle,boolean,false,false,false
ion-datetime,prop,value,null | string | undefined,undefined,false,false
ion-datetime,prop,yearValues,number | number[] | string | undefined,undefined,false,false
ion-datetime,method,open,open() => Promise<void>
ion-datetime,method,cancel,cancel(closeOverlay?: boolean) => Promise<void>
ion-datetime,method,confirm,confirm(closeOverlay?: boolean) => Promise<void>
ion-datetime,method,reset,reset(value?: string | undefined) => Promise<void>
ion-datetime,event,ionBlur,void,true
ion-datetime,event,ionCancel,void,true
ion-datetime,event,ionChange,DatetimeChangeEventDetail,true
ion-datetime,event,ionFocus,void,true
ion-datetime,css-prop,--padding-bottom
ion-datetime,css-prop,--padding-end
ion-datetime,css-prop,--padding-start
ion-datetime,css-prop,--padding-top
ion-datetime,css-prop,--placeholder-color
ion-datetime,part,placeholder
ion-datetime,part,text
ion-datetime,css-prop,--background
ion-datetime,css-prop,--background-rgb
ion-datetime,css-prop,--title-color

ion-fab,shadow
ion-fab,prop,activated,boolean,false,false,false
Expand Down
4 changes: 2 additions & 2 deletions core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading