nxt-pick-datetime 14.0.0 → 16.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +34 -202
  2. package/assets/picker.scss +131 -126
  3. package/esm2020/lib/class/date-time-adapter.class.mjs +5 -20
  4. package/esm2020/lib/class/date-time-format.class.mjs +3 -3
  5. package/esm2020/lib/class/date-time.class.mjs +37 -103
  6. package/esm2020/lib/class/dialog-config.class.mjs +14 -23
  7. package/esm2020/lib/class/dialog-ref.class.mjs +11 -13
  8. package/esm2020/lib/date-time/calendar/calendar.component.mjs +97 -96
  9. package/esm2020/lib/date-time/calendar-body/calendar-body.component.mjs +40 -34
  10. package/esm2020/lib/date-time/calendar-month-view/calendar-month-view.component.mjs +92 -101
  11. package/esm2020/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.mjs +85 -86
  12. package/esm2020/lib/date-time/calendar-year-view/calendar-year-view.component.mjs +80 -87
  13. package/esm2020/lib/date-time/date-time-inline/date-time-inline.component.mjs +95 -84
  14. package/esm2020/lib/date-time/date-time-picker/date-time-picker.component.mjs +221 -209
  15. package/esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.animations.mjs +3 -2
  16. package/esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.component.mjs +125 -126
  17. package/esm2020/lib/date-time/date-time-picker-input.directive.mjs +215 -221
  18. package/esm2020/lib/date-time/date-time-picker-intl.service.mjs +13 -13
  19. package/esm2020/lib/date-time/date-time-picker-trigger.directive.mjs +21 -19
  20. package/esm2020/lib/date-time/date-time.module.mjs +79 -68
  21. package/esm2020/lib/date-time/number-fixed-len.pipe.mjs +10 -13
  22. package/esm2020/lib/date-time/timer/timer.component.mjs +70 -63
  23. package/esm2020/lib/date-time/timer-box/timer-box.component.mjs +24 -17
  24. package/esm2020/lib/dialog/dialog-container/dialog-container.component.mjs +55 -50
  25. package/esm2020/lib/dialog/dialog.module.mjs +27 -16
  26. package/esm2020/lib/dialog/dialog.service.mjs +66 -54
  27. package/esm2020/lib/utils/object.mjs +5 -3
  28. package/esm2020/moment-adapter/date-time-adapter.class.mjs +26 -21
  29. package/esm2020/moment-adapter/date-time-format.class.mjs +5 -2
  30. package/esm2020/moment-adapter/moment-adapter.module.mjs +19 -23
  31. package/esm2020/moment-adapter/nxt-pick-datetime-moment-adapter.mjs +1 -1
  32. package/esm2020/moment-adapter/public-api.mjs +3 -2
  33. package/esm2020/native-adapter/date-time-adapter.class.mjs +41 -19
  34. package/esm2020/native-adapter/date-time-format.class.mjs +5 -2
  35. package/esm2020/native-adapter/native-adapter.module.mjs +23 -21
  36. package/esm2020/native-adapter/nxt-pick-datetime-native-adapter.mjs +1 -1
  37. package/esm2020/native-adapter/public-api.mjs +2 -2
  38. package/esm2020/nxt-pick-datetime.mjs +1 -1
  39. package/esm2020/public-api.mjs +14 -14
  40. package/fesm2015/nxt-pick-datetime-moment-adapter.mjs +44 -40
  41. package/fesm2015/nxt-pick-datetime-moment-adapter.mjs.map +1 -1
  42. package/fesm2015/nxt-pick-datetime-native-adapter.mjs +65 -38
  43. package/fesm2015/nxt-pick-datetime-native-adapter.mjs.map +1 -1
  44. package/fesm2015/nxt-pick-datetime.mjs +1492 -1447
  45. package/fesm2015/nxt-pick-datetime.mjs.map +1 -1
  46. package/fesm2020/nxt-pick-datetime-moment-adapter.mjs +44 -40
  47. package/fesm2020/nxt-pick-datetime-moment-adapter.mjs.map +1 -1
  48. package/fesm2020/nxt-pick-datetime-native-adapter.mjs +65 -38
  49. package/fesm2020/nxt-pick-datetime-native-adapter.mjs.map +1 -1
  50. package/fesm2020/nxt-pick-datetime.mjs +1422 -1437
  51. package/fesm2020/nxt-pick-datetime.mjs.map +1 -1
  52. package/lib/class/date-time-adapter.class.d.ts +31 -41
  53. package/lib/class/date-time-format.class.d.ts +3 -3
  54. package/lib/class/date-time.class.d.ts +39 -51
  55. package/lib/class/dialog-config.class.d.ts +27 -27
  56. package/lib/class/dialog-ref.class.d.ts +21 -22
  57. package/lib/date-time/calendar/calendar.component.d.ts +66 -60
  58. package/lib/date-time/calendar-body/calendar-body.component.d.ts +22 -20
  59. package/lib/date-time/calendar-month-view/calendar-month-view.component.d.ts +57 -56
  60. package/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.d.ts +58 -52
  61. package/lib/date-time/calendar-year-view/calendar-year-view.component.d.ts +51 -48
  62. package/lib/date-time/date-time-inline/date-time-inline.component.d.ts +69 -53
  63. package/lib/date-time/date-time-picker/date-time-picker.component.d.ts +106 -91
  64. package/lib/date-time/date-time-picker-container/date-time-picker-container.animations.d.ts +2 -1
  65. package/lib/date-time/date-time-picker-container/date-time-picker-container.component.d.ts +54 -47
  66. package/lib/date-time/date-time-picker-input.directive.d.ts +93 -78
  67. package/lib/date-time/date-time-picker-intl.service.d.ts +11 -11
  68. package/lib/date-time/date-time-picker-trigger.directive.d.ts +10 -9
  69. package/lib/date-time/date-time.module.d.ts +4 -4
  70. package/lib/date-time/number-fixed-len.pipe.d.ts +2 -1
  71. package/lib/date-time/timer/timer.component.d.ts +32 -30
  72. package/lib/date-time/timer-box/timer-box.component.d.ts +13 -11
  73. package/lib/dialog/dialog-container/dialog-container.component.d.ts +40 -27
  74. package/lib/dialog/dialog.module.d.ts +5 -4
  75. package/lib/dialog/dialog.service.d.ts +42 -35
  76. package/lib/utils/object.d.ts +2 -0
  77. package/moment-adapter/date-time-adapter.class.d.ts +13 -13
  78. package/moment-adapter/date-time-format.class.d.ts +5 -2
  79. package/moment-adapter/moment-adapter.module.d.ts +0 -5
  80. package/moment-adapter/public-api.d.ts +2 -1
  81. package/native-adapter/date-time-adapter.class.d.ts +7 -7
  82. package/native-adapter/date-time-format.class.d.ts +5 -2
  83. package/native-adapter/native-adapter.module.d.ts +0 -5
  84. package/native-adapter/public-api.d.ts +1 -1
  85. package/package.json +13 -11
  86. package/public-api.d.ts +14 -13
package/README.md CHANGED
@@ -1,221 +1,53 @@
1
- Angular Date Time Picker
2
- ========================
1
+ # Angular date & time picker
3
2
 
4
- [![npm](https://img.shields.io/npm/v/nxt-pick-datetime.svg?maxAge=2592000?style=flat-square)](https://www.npmjs.com/package/nxt-pick-datetime)
3
+ [![GitHub license](https://img.shields.io/github/license/Liquid-JS/nxt-components.svg)](https://github.com/Liquid-JS/nxt-components/blob/master/LICENSE)
5
4
  [![npm](https://img.shields.io/npm/dm/nxt-pick-datetime.svg)](https://www.npmjs.com/package/nxt-pick-datetime)
5
+ [![scope](https://img.shields.io/npm/v/nxt-pick-datetime.svg)](https://www.npmjs.com/package/nxt-pick-datetime)
6
6
 
7
- **Angular date time picker - Angular reusable UI component**
8
- **This package supports Angular 9**
7
+ Simple responsive Angular date and time picker.
9
8
 
10
- Breaking Changes
11
- -------
12
- - The picker has been updated for Angular 9+ apps.
9
+ ## Quick links
13
10
 
14
- Description
15
- -------
16
- Simple Angular date time picker. Online doc is [here](https://daniel-projects.firebaseapp.com/owlng/date-time-picker), Online demo(StackBlitz) is [here](https://stackblitz.com/github/DanielYKPan/owl-examples/tree/date-time-picker).
17
- This picker is responsive design, so feel free to try it in your desktops, tablets and mobile devices.
11
+ - [Demo](https://liquid-js.github.io/nxt-components/demo/pick-datetime)
12
+ - [Getting started](https://liquid-js.github.io/nxt-components/demo/pick-datetime/getting-started)
13
+ - [Accessibility](https://liquid-js.github.io/nxt-components/demo/pick-datetime/accessibility)
14
+ - [Validation](https://liquid-js.github.io/nxt-components/demo/pick-datetime/validation)
15
+ - [Custom date adapter](https://liquid-js.github.io/nxt-components/demo/pick-datetime/custom-adapter)
16
+ - [API docs](https://liquid-js.github.io/nxt-components/docs/nxt-pick-datetime)
18
17
 
19
- How to Use
20
- -------
18
+ ### Installing
21
19
 
22
- 1. Install with [npm](https://www.npmjs.com): `npm install nxt-pick-datetime --save`
23
- 2. Add styles.
24
-
25
- If you are using Angular CLI, you can add this to `angular.json` :
26
-
27
-
28
-
29
- ``` js
30
- "styles": [
31
- ...,
32
- "dist/nxt-pick-datetime/assets/picker.scss"
33
- ]
20
+ ```sh
21
+ npm install --save nxt-pick-datetime
22
+ npm install --save moment # if you want to use MomentDateTimeModule
34
23
  ```
35
24
 
36
- 3. Add __OwlDateTimeModule__ and __OwlNativeDateTimeModule__ to your __@NgModule__ like example below
25
+ ### Import main module and DateTime adapter provider
37
26
 
38
-
27
+ The date & time picker was built to be date implementation agnostic. It comes with two modules providing date adapter implementation, or you can provide your own adapter by implementing `DateTimeAdapter` (see [documentation](https://liquid-js.github.io/nxt-components/demo/pick-datetime/custom-adapter)).
39
28
 
40
- ``` typescript
41
- import { NgModule } from '@angular/core';
42
- import { BrowserModule } from '@angular/platform-browser';
43
- import { MyTestApp } from './my-test-app';
29
+ - `NativeDateTimeModule` - support for native JavaScript Date object
30
+ - `MomentDateTimeModule` - support for MomentJs
44
31
 
45
- import { OwlDateTimeModule } from 'nxt-pick-datetime';
46
- import { OwlNativeDateTimeModule } from 'nxt-pick-datetime/native-adapter';
47
-
48
- @NgModule({
49
- imports: [
50
- BrowserModule,
51
- OwlDateTimeModule,
52
- OwlNativeDateTimeModule,
53
- ],
54
- declarations: [ MyTestApp ],
55
- bootstrap: [ MyTestApp ]
56
- })
57
- export class MyTestAppModule {}
58
- ```
59
-
60
- 4. Connecting a picker to an input and a trigger.
61
-
62
-
63
-
64
- ``` html
65
- <input [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1" placeholder="Date Time">
66
- <owl-date-time #dt1></owl-date-time>
67
- ```
68
-
69
-
70
-
71
- ``` html
72
- <input [owlDateTime]="dt2" placeholder="Date Time">
73
- <span [owlDateTimeTrigger]="dt2"><i class="fa fa-calendar"></i></span>
74
- <owl-date-time #dt2></owl-date-time>
75
- ```
76
-
77
- The examples above are quite basic. The picker has much more features,
78
- and you could learn more about those from [demo page](https://danielykpan.github.io/date-time-picker/).
79
-
80
-
81
-
82
- Animation
83
- -------
84
- This picker uses angular animations to improve the user experience,
85
- therefore you need to install `@angular/animations` and import `BrowserAnimationsModule` to your application.
86
-
87
- ```
88
- npm install @angular/animations --save
89
- ```
90
-
91
- ``` typescript
92
- import {BrowserModule} from '@angular/platform-browser';
93
- import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
32
+ ```ts
33
+ import { DateTimeModule } from 'nxt-pick-datetime'
34
+ import { NativeDateTimeModule } from 'nxt-pick-datetime/native-adapter'
94
35
 
95
36
  @NgModule({
37
+ ...
96
38
  imports: [
97
- BrowserModule,
98
- BrowserAnimationsModule,
99
- //...
100
- ],
101
- //...
39
+ ...
40
+ DateTimeModule,
41
+ NativeDateTimeModule
42
+ ]
102
43
  })
103
- export class YourAppModule { }
104
44
  ```
105
45
 
106
- If you prefer to disable animation effect, use `NoopAnimationsModule` instead.
107
-
108
- Choose a date implementation
109
- -------
110
- The date-time picker was built to be date implementation agnostic.
111
- Developers need to make sure to provide the appropriate pieces for the picker to work with their chosen implementation.
112
- There are two pre-made modules, users need to import one of them or build your own one (learn more about this from [here](https://danielykpan.github.io/date-time-picker/#locale-formats)).
113
-
114
- * `OwlNativeDateTimeModule` - support for native JavaScript Date object
115
- * `OwlMomentDateTimeModule` - support for MomentJs
116
-
117
- Properties for `owl-date-time`
118
- -------
119
- |Name|Type|Required|Default|Description|
120
- |:--- |:--- |:--- |:--- |:--- |
121
- | `pickerType` | `both` , `calendar` , `timer` |Optional| `both` | Set the type of the dateTime picker. `both` : show both calendar and timer, `calendar` : only show calendar, `timer` : only show timer.|
122
- | `pickerMode` | `popup` , `dialog` |Optional| `popup` | The style the picker would open as.|
123
- | `startView` | `month` , `year` , `multi-year` |Optional| `month` | The view that the calendar should start in.|
124
- | `startAt` | T/null |Optional| `null` | The moment to open the picker to initially.|
125
- | `firstDayOfWeek` |number|Optional| `0` | Set the first day of week. Valid value is from 0 to 6.0: Sunday ~ 6: Saturday|
126
- | `showSecondsTimer` |boolean|Optional| `false` | When specify it to true, it would show a timer to configure the second's value |
127
- | `hideOtherMonths` |boolean|Optional| `false` | Whether to hide dates in other months at the start or end of the current month |
128
- | `hour12Timer` |boolean|Optional| `false` | When specify it to true, the timer would be in hour12 format mode|
129
- | `stepHour` |number|Optional| `1` | Hours to change per step.|
130
- | `stepMinute` |number|Optional| `1` | Minutes to change per step.|
131
- | `stepSecond` |number|Optional| `1` | Seconds to change per step.|
132
- | `scrollStrategy` |ScrollStrategy|Optional| `BlockScrollStrategy` | Define the scroll strategy when the picker is open. Learn more this from https://material.angular.io/cdk/overlay/overview#scroll-strategies.|
133
- | `disabled` |boolean|Optional| `false` |When specify to true, it would disable the picker.|
134
- | `backdropClass` |string/string[]|Optional| `null` |Custom class for the picker backdrop.|
135
- | `panelClass` |string/string[]|Optional| `null` |Custom class for the picker overlay panel.|
136
-
137
- Events for `owl-date-time`
138
- -------
139
- |Events|Parameter|Description|
140
- |:--- |:--- |:--- |
141
- | `afterPickerOpen` |null|Callback to invoke when the picker is opened|
142
- | `afterPickerClosed` |null|Callback to invoke when the picker is closed.|
143
- | `yearSelected` |T|Callback to invoke when the year is selected. This doesn't imply a change on the selected date.|
144
- | `monthSelected` |T|Callback to invoke when the month is selected. This doesn't imply a change on the selected date.|
145
-
146
- Properties for `input[owlDateTime]`
147
- -------
148
- |Name|Type|Required|Default|Description|
149
- |:--- |:--- |:--- |:--- |:--- |
150
- | `owlDateTime` | `OwlDateTimeComponent<T>` |Require| `null` | The date time picker that this input is associated with.|
151
- | `owlDateTimeFilter` | `( date: T)=>boolean ` |Optional| `null` |A function to filter date time.|
152
- | `disabled` |boolean|Optional| `false` |When specify to true, it would disable the picker's input.|
153
- | `min` | `<T>` |Optional| `null` | The minimum valid date time.|
154
- | `max` | `<T>` |Optional| `null` | The maximum valid date time.|
155
- | `selectMode` | `single` , `range` , `rangeFrom` , `rangeTo` |Optional| `single` | Specify the picker's select mode. `single` : a single value allowed, `range` : allow users to select a range of date-time, `rangeFrom` : the input would only show the 'from' value and the picker could only selects 'from' value, `rangeTo` : the input would only show the 'to' value and the picker could only selects 'to' value.|
156
- | `rangeSeparator` |string|Optional| `~` | The character to separate the 'from' and 'to' in input value in range selectMode.|
157
-
158
- Events for `input[owlDateTime]`
159
- -------
160
- |Events|Parameter|Description|
161
- |:--- |:--- |:--- |
162
- | `dateTimeChange` |source: OwlDateTimeInput, value: input value, input: the input element|Callback to invoke when `change` event is fired on this `<input [owlDateTime]>` |
163
- | `dateTimeInput` |source: OwlDateTimeInput, value: input value, input: the input element|Callback to invoke when an `input` event is fired on this `<input [owlDateTime]>` .|
164
-
165
- Properties for `[owlDateTimeTrigger]`
166
- -------
167
- |Name|Type|Required|Default|Description|
168
- |:--- |:--- |:--- |:--- |:--- |
169
- | `owlDateTimeTrigger` | `OwlDateTimeComponent<T>` |Require| `null` | The date time picker that this trigger is associated with.|
170
- | `disabled` |boolean|Optional| `false` |When specify to true, it would disable the trigger.|
171
-
172
- Properties for `[owlDateTimeTrigger]`
173
- -------
174
- |Name|Type|Required|Default|Description|
175
- |:--- |:--- |:--- |:--- |:--- |
176
- | `owlDateTimeTrigger` | `OwlDateTimeComponent<T>` |Require| `null` | The date time picker that this trigger is associated with.|
177
- | `disabled` |boolean|Optional| `false` |When specify to true, it would disable the trigger.|
178
-
179
- Properties for `owl-date-time-inline`
180
- -------
181
- |Name|Type|Required|Default|Description|
182
- |:--- |:--- |:--- |:--- |:--- |
183
- | `pickerType` | `both` , `calendar` , `timer` |Optional| `both` | Set the type of the dateTime picker. `both` : show both calendar and timer, `calendar` : only show calendar, `timer` : only show timer.|
184
- | `startView` | `month` , `year` , `multi-year` |Optional| `month` | The view that the calendar should start in.|
185
- | `startAt` | T/null |Optional| `null` | The moment to open the picker to initially.|
186
- | `firstDayOfWeek` |number|Optional| `0` | Set the first day of week. Valid value is from 0 to 6.0: Sunday ~ 6: Saturday|
187
- | `showSecondsTimer` |boolean|Optional| `false` | When specify it to true, it would show a timer to configure the second's value |
188
- | `hideOtherMonths` |boolean|Optional| `false` | Whether to hide dates in other months at the start or end of the current month |
189
- | `hour12Timer` |boolean|Optional| `false` | When specify it to true, the timer would be in hour12 format mode|
190
- | `stepHour` |number|Optional| `1` | Hours to change per step.|
191
- | `stepMinute` |number|Optional| `1` | Minutes to change per step.|
192
- | `stepSecond` |number|Optional| `1` | Seconds to change per step.|
193
- | `disabled` |boolean|Optional| `false` |When specify to true, it would disable the picker.|
194
- | `owlDateTimeFilter` | `( date: T)=>boolean ` |Optional| `null` |A function to filter date time.|
195
- | `min` | `<T>` |Optional| `null` | The minimum valid date time.|
196
- | `max` | `<T>` |Optional| `null` | The maximum valid date time.|
197
- | `selectMode` | `single` , `range` , `rangeFrom` , `rangeTo` |Optional| `single` | Specify the picker's select mode. `single` : a single value allowed, `range` : allow users to select a range of date-time, `rangeFrom` : the input would only show the 'from' value and the picker could only selects 'from' value, `rangeTo` : the input would only show the 'to' value and the picker could only selects 'to' value.|
198
-
199
- Localization and DateTime Format
200
- -------
201
- Localization for different languages and formats is defined by `OWL_DATE_TIME_LOCALE` and `OWL_DATE_TIME_FORMATS` . You could learn more about this from [here](https://danielykpan.github.io/date-time-picker#locale-formats).
202
-
203
- Dependencies
204
- -------
205
- none
206
-
207
- Demo
208
- -------
209
-
210
- * Online doc is [here](https://daniel-projects.firebaseapp.com/owlng/date-time-picker)
211
- * Online demo(StackBlitz) is [here](https://stackblitz.com/github/DanielYKPan/owl-examples/tree/date-time-picker)
212
-
213
- License
214
- -------
215
-
216
- * License: MIT
217
-
218
- Author
219
- -------
220
- **Daniel YK Pan**
46
+ ### Use it in a template
221
47
 
48
+ ```html
49
+ <input [nxtDateTime]="picker"
50
+ [nxtDateTimeTrigger]="picker"
51
+ placeholder="Date and time">
52
+ <nxt-date-time #picker></nxt-date-time>
53
+ ```