@dhutaryan/ngx-mat-timepicker 0.0.2 → 12.0.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.
- package/README.md +120 -116
- package/_index.scss +1 -1
- package/_timepicker-theme.scss +148 -109
- package/bundles/dhutaryan-ngx-mat-timepicker.umd.js +2914 -2383
- package/bundles/dhutaryan-ngx-mat-timepicker.umd.js.map +1 -1
- package/dhutaryan-ngx-mat-timepicker.d.ts +5 -5
- package/esm2015/dhutaryan-ngx-mat-timepicker.js +4 -4
- package/esm2015/lib/adapter/index.js +26 -26
- package/esm2015/lib/adapter/native-date-time-adapter.js +130 -130
- package/esm2015/lib/adapter/time-adapter.js +79 -62
- package/esm2015/lib/clock-dials.js +64 -61
- package/esm2015/lib/hours-clock-dial.js +221 -159
- package/esm2015/lib/minutes-clock-dial.js +157 -124
- package/esm2015/lib/time-face-base.js +224 -75
- package/esm2015/lib/time-input-base.js +86 -0
- package/esm2015/lib/time-inputs.js +140 -142
- package/esm2015/lib/time-period.js +69 -55
- package/esm2015/lib/time-selection-model.js +76 -76
- package/esm2015/lib/timepicker-actions-default.js +3 -3
- package/esm2015/lib/timepicker-actions.js +139 -125
- package/esm2015/lib/timepicker-animations.js +22 -22
- package/esm2015/lib/timepicker-base.js +362 -335
- package/esm2015/lib/timepicker-content-layout.js +23 -23
- package/esm2015/lib/timepicker-content.js +100 -104
- package/esm2015/lib/timepicker-input-base.js +223 -203
- package/esm2015/lib/timepicker-input.js +126 -92
- package/esm2015/lib/timepicker-intl.js +21 -21
- package/esm2015/lib/timepicker-scroll-strategy.js +15 -15
- package/esm2015/lib/timepicker-toggle.js +71 -71
- package/esm2015/lib/timepicker.js +32 -26
- package/esm2015/lib/timepicker.module.js +151 -147
- package/esm2015/public-api.js +20 -20
- package/fesm2015/dhutaryan-ngx-mat-timepicker.js +2369 -1911
- package/fesm2015/dhutaryan-ngx-mat-timepicker.js.map +1 -1
- package/lib/adapter/index.d.ts +9 -9
- package/lib/adapter/native-date-time-adapter.d.ts +43 -43
- package/lib/adapter/time-adapter.d.ts +129 -120
- package/lib/clock-dials.d.ts +23 -23
- package/lib/hours-clock-dial.d.ts +61 -41
- package/lib/minutes-clock-dial.d.ts +38 -27
- package/lib/time-face-base.d.ts +61 -30
- package/lib/time-input-base.d.ts +30 -0
- package/lib/time-inputs.d.ts +32 -39
- package/lib/time-period.d.ts +21 -19
- package/lib/time-selection-model.d.ts +62 -62
- package/lib/timepicker-actions-default.d.ts +3 -3
- package/lib/timepicker-actions.d.ts +50 -41
- package/lib/timepicker-animations.d.ts +6 -6
- package/lib/timepicker-base.d.ts +147 -121
- package/lib/timepicker-content-layout.d.ts +7 -7
- package/lib/timepicker-content.d.ts +50 -50
- package/lib/timepicker-input-base.d.ts +102 -94
- package/lib/timepicker-input.d.ts +45 -33
- package/lib/timepicker-intl.d.ts +13 -13
- package/lib/timepicker-scroll-strategy.d.ts +12 -12
- package/lib/timepicker-toggle.d.ts +26 -26
- package/lib/timepicker.d.ts +6 -6
- package/lib/timepicker.module.d.ts +28 -28
- package/package.json +8 -1
- package/public-api.d.ts +16 -16
package/README.md
CHANGED
|
@@ -1,116 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@dhutaryan/ngx-mat-timepicker)
|
|
4
|
+
[](https://www.codefactor.io/repository/github/dgutoryan/ngx-mat-timepicker)
|
|
5
|
+
[](https://github.com/dgutoryan/ngx-timepicker/blob/master/LICENSE)
|
|
6
|
+
|
|
7
|
+
The timepicker module using Angular material.
|
|
8
|
+
|
|
9
|
+
### Versions
|
|
10
|
+
|
|
11
|
+
| mat-timepicker | Angular |
|
|
12
|
+
| -------------- | ------------------- |
|
|
13
|
+
| 12.x.x | >=12.0.0 && <15.0.0 |
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
You have to install the Angular Material and set it up. [Learn more about the setup](https://material.angular.io/guide/getting-started).
|
|
18
|
+
|
|
19
|
+
Install the library:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ npm install --save @dhutaryan/ngx-mat-timepicker
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
or
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
$ yarn add @dhutaryan/ngx-mat-timepicker
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Getting started
|
|
32
|
+
|
|
33
|
+
Import `MatTimepickerModule` to your project.
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
|
|
37
|
+
|
|
38
|
+
@NgModule({
|
|
39
|
+
imports: [
|
|
40
|
+
// ...
|
|
41
|
+
MatTimepickerModule,
|
|
42
|
+
// ...
|
|
43
|
+
],
|
|
44
|
+
})
|
|
45
|
+
export class MyModule {}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Adapter
|
|
49
|
+
|
|
50
|
+
Add a timepicker adapter.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { MatNativeDateTimeModule, MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
|
|
54
|
+
|
|
55
|
+
@NgModule({
|
|
56
|
+
imports: [
|
|
57
|
+
// ...
|
|
58
|
+
MatTimepickerModule,
|
|
59
|
+
MatNativeDateTimeModule,
|
|
60
|
+
// ...
|
|
61
|
+
],
|
|
62
|
+
})
|
|
63
|
+
export class MyModule {}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
or create your own
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { MatTimepickerModule } from "@dhutaryan/ngx-mat-timepicker";
|
|
70
|
+
|
|
71
|
+
@NgModule({
|
|
72
|
+
imports: [
|
|
73
|
+
// ...
|
|
74
|
+
MatTimepickerModule,
|
|
75
|
+
// ...
|
|
76
|
+
],
|
|
77
|
+
providers: [{ provide: TimeAdapter, useClass: MyTimeAdapter }],
|
|
78
|
+
})
|
|
79
|
+
export class MyModule {}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Theming
|
|
83
|
+
|
|
84
|
+
Then you have to define a theme. [More details about theming](https://material.angular.io/guide/theming).
|
|
85
|
+
|
|
86
|
+
```scss
|
|
87
|
+
@use "@dhutaryan/ngx-mat-timepicker" as mat-timepicker;
|
|
88
|
+
|
|
89
|
+
@include mat-timepicker.timepicker-theme($theme);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Usage
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<mat-form-field>
|
|
96
|
+
<input type="text" matInput [matTimepicker]="timepicker" />
|
|
97
|
+
<mat-timepicker-toggle matSuffix [for]="timepicker"></mat-timepicker-toggle>
|
|
98
|
+
<mat-timepicker #timepicker></mat-timepicker>
|
|
99
|
+
</mat-form-field>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Locale
|
|
103
|
+
|
|
104
|
+
Default locale is `en-US`. You can set your locale as:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { MAT_TIME_LOCALE } from "@dhutaryan/ngx-mat-timepicker";
|
|
108
|
+
|
|
109
|
+
@NgModule({
|
|
110
|
+
imports: [
|
|
111
|
+
// ...
|
|
112
|
+
],
|
|
113
|
+
providers: [{ provide: MAT_TIME_LOCALE, useValue: "en-GB" }],
|
|
114
|
+
})
|
|
115
|
+
export class MyModule {}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|
package/_index.scss
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@forward "./timepicker-theme" as timepicker-* show timepicker-theme;
|
|
1
|
+
@forward "./timepicker-theme" as timepicker-* show timepicker-theme;
|
package/_timepicker-theme.scss
CHANGED
|
@@ -1,109 +1,148 @@
|
|
|
1
|
-
@use "sass:color";
|
|
2
|
-
@use "sass:map";
|
|
3
|
-
@use "@angular/material" as mat;
|
|
4
|
-
|
|
5
|
-
$timepicker-content-title-font-size: 10px !default;
|
|
6
|
-
$input-font-size: 2rem !default;
|
|
7
|
-
$inputs-separator-font-size: 3rem !default;
|
|
8
|
-
$inputs-separator-line-height: 1.25rem;
|
|
9
|
-
$primary-opacity: 0.15;
|
|
10
|
-
|
|
11
|
-
@mixin
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.mat-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
background:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.mat-clock-dial
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
1
|
+
@use "sass:color";
|
|
2
|
+
@use "sass:map";
|
|
3
|
+
@use "@angular/material" as mat;
|
|
4
|
+
|
|
5
|
+
$timepicker-content-title-font-size: 10px !default;
|
|
6
|
+
$input-font-size: 2rem !default;
|
|
7
|
+
$inputs-separator-font-size: 3rem !default;
|
|
8
|
+
$inputs-separator-line-height: 1.25rem;
|
|
9
|
+
$primary-opacity: 0.15;
|
|
10
|
+
|
|
11
|
+
@mixin _color($palette) {
|
|
12
|
+
.mat-time-period-item-active,
|
|
13
|
+
.mat-clock-dial-value.mat-clock-dial-value-active {
|
|
14
|
+
color: mat.get-color-from-palette($palette);
|
|
15
|
+
background-color: mat.get-color-from-palette($palette, $primary-opacity);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.mat-clock-dial::before {
|
|
19
|
+
background-color: mat.get-color-from-palette($palette);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.mat-clock-dial-hand {
|
|
23
|
+
background-color: mat.get-color-from-palette($palette);
|
|
24
|
+
|
|
25
|
+
&::before {
|
|
26
|
+
background-color: mat.get-color-from-palette($palette);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.mat-clock-dial-hand.mat-clock-dial-hand-disabled {
|
|
31
|
+
&::before {
|
|
32
|
+
background-color: color.adjust(
|
|
33
|
+
mat.get-color-from-palette($palette),
|
|
34
|
+
$alpha: -0.6
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[mat-mini-fab].mat-clock-dial-cell.mat-button-disabled {
|
|
40
|
+
background-color: color.adjust(
|
|
41
|
+
mat.get-color-from-palette($palette),
|
|
42
|
+
$alpha: -0.6
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@mixin color($config-or-theme) {
|
|
48
|
+
$config: mat.get-color-config($config-or-theme);
|
|
49
|
+
$is-dark-theme: map.get($config, is-dark);
|
|
50
|
+
$primary: map.get($config, primary);
|
|
51
|
+
$accent: map.get($config, accent);
|
|
52
|
+
$warn: map.get($config, warn);
|
|
53
|
+
$foreground: map.get($config, foreground);
|
|
54
|
+
$background: map.get($config, background);
|
|
55
|
+
|
|
56
|
+
@include _color(map.get($config, primary));
|
|
57
|
+
|
|
58
|
+
.mat-timepicker-content {
|
|
59
|
+
@include mat.elevation(4);
|
|
60
|
+
background-color: mat.get-color-from-palette($background, card);
|
|
61
|
+
color: mat.get-color-from-palette($foreground, text);
|
|
62
|
+
|
|
63
|
+
&.mat-accent {
|
|
64
|
+
@include _color(map.get($config, accent));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.mat-warn {
|
|
68
|
+
@include _color(map.get($config, warn));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.mat-timepicker-content-layout-title {
|
|
73
|
+
color: mat.get-color-from-palette($foreground, secondary-text);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.mat-time-toggle-mode-button svg {
|
|
77
|
+
fill: mat.get-color-from-palette($foreground, secondary-text);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.mat-time-period {
|
|
81
|
+
border-color: mat.get-color-from-palette($foreground, divider);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.mat-time-period-item-disabled {
|
|
85
|
+
color: mat.get-color-from-palette($foreground, disabled-button);
|
|
86
|
+
background-color: mat.get-color-from-palette($background, disabled-button);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.mat-clock-dial-value,
|
|
90
|
+
.mat-clock-dial {
|
|
91
|
+
background-color: mat.get-color-from-palette($background, background);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.mat-clock-dial-hand.mat-clock-dial-hand-disabled {
|
|
95
|
+
background-color: transparent;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[mat-mini-fab]:not(.mat-primary):not(.mat-accent):not(.mat-warn) {
|
|
99
|
+
background: transparent;
|
|
100
|
+
|
|
101
|
+
&:hover {
|
|
102
|
+
background-color: mat.get-color-from-palette($background, hover);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@mixin typography($config-or-theme) {
|
|
108
|
+
$config: mat.get-typography-config($config-or-theme);
|
|
109
|
+
|
|
110
|
+
h6.mat-timepicker-content-layout-title {
|
|
111
|
+
font: {
|
|
112
|
+
size: $timepicker-content-title-font-size;
|
|
113
|
+
weight: mat.font-weight($config, body-2);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.mat-time-inputs-field {
|
|
118
|
+
input.mat-input-element {
|
|
119
|
+
font-size: $input-font-size;
|
|
120
|
+
line-height: normal;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.mat-timepicker-content-layout-separator {
|
|
125
|
+
font-size: $inputs-separator-font-size;
|
|
126
|
+
line-height: $inputs-separator-line-height;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.mat-clock-dial-value {
|
|
130
|
+
font-size: $input-font-size;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@mixin theme($theme-or-color-config) {
|
|
135
|
+
$color: mat.get-color-config($theme-or-color-config);
|
|
136
|
+
$typography: mat.get-typography-config($theme-or-color-config);
|
|
137
|
+
|
|
138
|
+
@if $color != null {
|
|
139
|
+
@include color($color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@if $typography != null {
|
|
143
|
+
@include typography($typography);
|
|
144
|
+
} @else {
|
|
145
|
+
$typography: mat.define-typography-config();
|
|
146
|
+
@include typography($typography);
|
|
147
|
+
}
|
|
148
|
+
}
|