ngx-kit 7.2.0 → 7.3.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/angle-selector/README.md +34 -34
- package/box-shadow/README.md +33 -33
- package/color-picker/README.md +52 -52
- package/{shared → core}/README.md +117 -117
- package/data-table/README.md +120 -120
- package/date-picker/README.md +74 -74
- package/dialog/README.md +122 -92
- package/drag-resize/README.md +53 -55
- package/fesm2022/ngx-kit-angle-selector.mjs +9 -26
- package/fesm2022/ngx-kit-angle-selector.mjs.map +1 -1
- package/fesm2022/ngx-kit-box-shadow.mjs +330 -356
- package/fesm2022/ngx-kit-box-shadow.mjs.map +1 -1
- package/fesm2022/ngx-kit-color-picker.mjs +132 -272
- package/fesm2022/ngx-kit-color-picker.mjs.map +1 -1
- package/fesm2022/{ngx-kit-shared.mjs → ngx-kit-core.mjs} +845 -277
- package/fesm2022/ngx-kit-core.mjs.map +1 -0
- package/fesm2022/ngx-kit-data-table.mjs +1 -1
- package/fesm2022/ngx-kit-data-table.mjs.map +1 -1
- package/fesm2022/ngx-kit-date-picker.mjs +27 -21
- package/fesm2022/ngx-kit-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-dialog.mjs +430 -331
- package/fesm2022/ngx-kit-dialog.mjs.map +1 -1
- package/fesm2022/ngx-kit-drag-resize.mjs +126 -45
- package/fesm2022/ngx-kit-drag-resize.mjs.map +1 -1
- package/fesm2022/ngx-kit-drawer-menu.mjs +2 -2
- package/fesm2022/ngx-kit-drawer-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-dropzone.mjs.map +1 -1
- package/fesm2022/ngx-kit-form-field.mjs.map +1 -1
- package/fesm2022/ngx-kit-gallery.mjs +3 -3
- package/fesm2022/ngx-kit-gallery.mjs.map +1 -1
- package/fesm2022/ngx-kit-gradient-picker.mjs +20 -38
- package/fesm2022/ngx-kit-gradient-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-grid-layout.mjs +14 -14
- package/fesm2022/ngx-kit-grid-layout.mjs.map +1 -1
- package/fesm2022/ngx-kit-image-editor.mjs +3 -3
- package/fesm2022/ngx-kit-image-editor.mjs.map +1 -1
- package/fesm2022/ngx-kit-menu.mjs +1 -1
- package/fesm2022/ngx-kit-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +1 -1
- package/fesm2022/ngx-kit-message.mjs.map +1 -1
- package/fesm2022/ngx-kit-notify.mjs +1 -1
- package/fesm2022/ngx-kit-notify.mjs.map +1 -1
- package/fesm2022/ngx-kit-time-picker.mjs +1 -1
- package/fesm2022/ngx-kit-time-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-virtual-scroll.mjs +2 -2
- package/fesm2022/ngx-kit-virtual-scroll.mjs.map +1 -1
- package/gallery/README.md +71 -71
- package/gradient-picker/README.md +41 -41
- package/grid-layout/README.md +64 -64
- package/image-editor/README.md +44 -44
- package/menu/README.md +85 -85
- package/message/README.md +70 -70
- package/notify/README.md +56 -56
- package/package.json +5 -9
- package/time-picker/README.md +89 -89
- package/types/ngx-kit-angle-selector.d.ts +13 -16
- package/types/ngx-kit-box-shadow.d.ts +37 -95
- package/types/ngx-kit-color-picker.d.ts +61 -58
- package/types/{ngx-kit-shared.d.ts → ngx-kit-core.d.ts} +156 -34
- package/types/ngx-kit-data-table.d.ts +2 -2
- package/types/ngx-kit-date-picker.d.ts +1 -1
- package/types/ngx-kit-dialog.d.ts +208 -107
- package/types/ngx-kit-drag-resize.d.ts +33 -6
- package/types/ngx-kit-gradient-picker.d.ts +4 -7
- package/types/ngx-kit-menu.d.ts +1 -1
- package/types/ngx-kit-time-picker.d.ts +1 -1
- package/virtual-scroll/README.md +199 -199
- package/fesm2022/ngx-kit-shared.mjs.map +0 -1
- package/fesm2022/ngx-kit-webflow.mjs +0 -709
- package/fesm2022/ngx-kit-webflow.mjs.map +0 -1
- package/types/ngx-kit-webflow.d.ts +0 -286
package/message/README.md
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# ngx-kit/message
|
|
2
|
-
|
|
3
|
-
Alert/confirm dialogs (SweetAlert-style), with a static API callable from anywhere in the app.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Setup
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
// app.config.ts
|
|
15
|
-
import { provideMessage } from 'ngx-kit/message';
|
|
16
|
-
|
|
17
|
-
export const appConfig: ApplicationConfig = {
|
|
18
|
-
providers: [provideMessage({ confirmButtonText: 'OK' /* global defaults */ })],
|
|
19
|
-
};
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
import { MSG } from 'ngx-kit/message';
|
|
26
|
-
|
|
27
|
-
MSG.success('Saved!', 'Your changes were saved successfully.');
|
|
28
|
-
MSG.error('Error', 'Something went wrong.');
|
|
29
|
-
MSG.warning('Warning', 'Are you sure?');
|
|
30
|
-
MSG.info('Heads up', 'This is an informational message.');
|
|
31
|
-
MSG.question('Question', 'Continue?');
|
|
32
|
-
MSG.loading('Processing…');
|
|
33
|
-
|
|
34
|
-
// full control over options:
|
|
35
|
-
const result = MSG.show({
|
|
36
|
-
title: 'Delete this?',
|
|
37
|
-
text: 'This action cannot be undone.',
|
|
38
|
-
showCancelButton: true,
|
|
39
|
-
showDenyButton: true,
|
|
40
|
-
confirmButtonText: 'Yes, delete it',
|
|
41
|
-
});
|
|
42
|
-
result.afterClose.subscribe((r) => console.log(r));
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## API
|
|
46
|
-
|
|
47
|
-
### `MSG` (and its alias `Modal`)
|
|
48
|
-
|
|
49
|
-
| Method | Signature | Description |
|
|
50
|
-
| ----------------------------------------------------------------- | -------------------------- | ---------------- |
|
|
51
|
-
| `show(options?)` | `IMessageOptions` | Full control |
|
|
52
|
-
| `info` / `success` / `warning` / `error` / `question` / `loading` | `(title, text?, options?)` | Common shortcuts |
|
|
53
|
-
|
|
54
|
-
### `IMessageOptions` (key fields)
|
|
55
|
-
|
|
56
|
-
| Field | Type | Default | Description |
|
|
57
|
-
| ----------------------------------------------------------- | ------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
58
|
-
| `title` / `text` / `html` | `string` | | Content (`html` is not sanitized — escaping is your responsibility) |
|
|
59
|
-
| `icon` | `MessageIcon` | | Icon shown |
|
|
60
|
-
| `showConfirmButton` / `showDenyButton` / `showCancelButton` | `boolean` | `true` / `false` / `false` | |
|
|
61
|
-
| `confirmButtonText` / `denyButtonText` / `cancelButtonText` | `string` | `'OK'` / `'No'` / `'Cancel'` | |
|
|
62
|
-
| `allowOutsideClick` / `allowEscapeKey` / `allowEnterKey` | `boolean` | `true` | How the message can be dismissed |
|
|
63
|
-
| `showCloseButton` | `boolean` | `false` | The ✕ button |
|
|
64
|
-
| `useOverlay` | `boolean` | | For when it's used inside another dialog (e.g. Angular Material), raises the display layer to the top |
|
|
65
|
-
|
|
66
|
-
If several messages are open at once, Escape/Enter only affect the **last (topmost) message**, not all of them.
|
|
67
|
-
|
|
68
|
-
## Dark mode and RTL
|
|
69
|
-
|
|
70
|
-
Supported automatically.
|
|
1
|
+
# ngx-kit/message
|
|
2
|
+
|
|
3
|
+
Alert/confirm dialogs (SweetAlert-style), with a static API callable from anywhere in the app.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// app.config.ts
|
|
15
|
+
import { provideMessage } from 'ngx-kit/message';
|
|
16
|
+
|
|
17
|
+
export const appConfig: ApplicationConfig = {
|
|
18
|
+
providers: [provideMessage({ confirmButtonText: 'OK' /* global defaults */ })],
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { MSG } from 'ngx-kit/message';
|
|
26
|
+
|
|
27
|
+
MSG.success('Saved!', 'Your changes were saved successfully.');
|
|
28
|
+
MSG.error('Error', 'Something went wrong.');
|
|
29
|
+
MSG.warning('Warning', 'Are you sure?');
|
|
30
|
+
MSG.info('Heads up', 'This is an informational message.');
|
|
31
|
+
MSG.question('Question', 'Continue?');
|
|
32
|
+
MSG.loading('Processing…');
|
|
33
|
+
|
|
34
|
+
// full control over options:
|
|
35
|
+
const result = MSG.show({
|
|
36
|
+
title: 'Delete this?',
|
|
37
|
+
text: 'This action cannot be undone.',
|
|
38
|
+
showCancelButton: true,
|
|
39
|
+
showDenyButton: true,
|
|
40
|
+
confirmButtonText: 'Yes, delete it',
|
|
41
|
+
});
|
|
42
|
+
result.afterClose.subscribe((r) => console.log(r));
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API
|
|
46
|
+
|
|
47
|
+
### `MSG` (and its alias `Modal`)
|
|
48
|
+
|
|
49
|
+
| Method | Signature | Description |
|
|
50
|
+
| ----------------------------------------------------------------- | -------------------------- | ---------------- |
|
|
51
|
+
| `show(options?)` | `IMessageOptions` | Full control |
|
|
52
|
+
| `info` / `success` / `warning` / `error` / `question` / `loading` | `(title, text?, options?)` | Common shortcuts |
|
|
53
|
+
|
|
54
|
+
### `IMessageOptions` (key fields)
|
|
55
|
+
|
|
56
|
+
| Field | Type | Default | Description |
|
|
57
|
+
| ----------------------------------------------------------- | ------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| `title` / `text` / `html` | `string` | | Content (`html` is not sanitized — escaping is your responsibility) |
|
|
59
|
+
| `icon` | `MessageIcon` | | Icon shown |
|
|
60
|
+
| `showConfirmButton` / `showDenyButton` / `showCancelButton` | `boolean` | `true` / `false` / `false` | |
|
|
61
|
+
| `confirmButtonText` / `denyButtonText` / `cancelButtonText` | `string` | `'OK'` / `'No'` / `'Cancel'` | |
|
|
62
|
+
| `allowOutsideClick` / `allowEscapeKey` / `allowEnterKey` | `boolean` | `true` | How the message can be dismissed |
|
|
63
|
+
| `showCloseButton` | `boolean` | `false` | The ✕ button |
|
|
64
|
+
| `useOverlay` | `boolean` | | For when it's used inside another dialog (e.g. Angular Material), raises the display layer to the top |
|
|
65
|
+
|
|
66
|
+
If several messages are open at once, Escape/Enter only affect the **last (topmost) message**, not all of them.
|
|
67
|
+
|
|
68
|
+
## Dark mode and RTL
|
|
69
|
+
|
|
70
|
+
Supported automatically.
|
package/notify/README.md
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
# ngx-kit/notify
|
|
2
|
-
|
|
3
|
-
Corner toast notifications, with a static API, automatic queueing (once the visible count exceeds the limit), and the timer pausing on hover.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Setup
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
// app.config.ts
|
|
15
|
-
import { provideNotify } from 'ngx-kit/notify';
|
|
16
|
-
|
|
17
|
-
export const appConfig: ApplicationConfig = {
|
|
18
|
-
providers: [provideNotify({ timeout: 4000, position: 'top-center', dismissible: true })],
|
|
19
|
-
};
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
import { Notify } from 'ngx-kit/notify';
|
|
26
|
-
|
|
27
|
-
Notify.success('Saved');
|
|
28
|
-
Notify.error("We couldn't send your message", 'Try again');
|
|
29
|
-
Notify.warning('Weak connection');
|
|
30
|
-
Notify.info('A new version is available', undefined, { timeout: 8000 });
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## API
|
|
34
|
-
|
|
35
|
-
### `Notify`
|
|
36
|
-
|
|
37
|
-
| Method | Signature |
|
|
38
|
-
| --------------------------------------------- | --------------------------------------------------- |
|
|
39
|
-
| `show(type, message, description?, options?)` | `type: 'info' \| 'success' \| 'warning' \| 'error'` |
|
|
40
|
-
| `info` / `success` / `warning` / `error` | `(message, description?, options?)` |
|
|
41
|
-
|
|
42
|
-
### `NgxNotifyOptions`
|
|
43
|
-
|
|
44
|
-
| Field | Type | Default | Description |
|
|
45
|
-
| -------------- | ----------------------- | -------------- | ------------------------------------------------------------- |
|
|
46
|
-
| `timeout` | `number` (ms) | `3000` | How long it's shown before auto-dismissing |
|
|
47
|
-
| `position` | `NgxNotifyPositionType` | `'top-center'` | Corner/center to display in |
|
|
48
|
-
| `maxVisible` | `number` | `10` | Beyond this count, notifications queue instead of overlapping |
|
|
49
|
-
| `allowHtml` | `boolean` | `false` | If `true`, the message is rendered as HTML (not sanitized) |
|
|
50
|
-
| `pauseOnHover` | `boolean` | `true` | The timer pauses while the mouse hovers |
|
|
51
|
-
| `dismissible` | `boolean` | `true` | Show a close button |
|
|
52
|
-
| `closeOnTap` | `boolean` | `true` | Clicking the notification itself closes it |
|
|
53
|
-
|
|
54
|
-
## Dark mode and RTL
|
|
55
|
-
|
|
56
|
-
Supported automatically.
|
|
1
|
+
# ngx-kit/notify
|
|
2
|
+
|
|
3
|
+
Corner toast notifications, with a static API, automatic queueing (once the visible count exceeds the limit), and the timer pausing on hover.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// app.config.ts
|
|
15
|
+
import { provideNotify } from 'ngx-kit/notify';
|
|
16
|
+
|
|
17
|
+
export const appConfig: ApplicationConfig = {
|
|
18
|
+
providers: [provideNotify({ timeout: 4000, position: 'top-center', dismissible: true })],
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { Notify } from 'ngx-kit/notify';
|
|
26
|
+
|
|
27
|
+
Notify.success('Saved');
|
|
28
|
+
Notify.error("We couldn't send your message", 'Try again');
|
|
29
|
+
Notify.warning('Weak connection');
|
|
30
|
+
Notify.info('A new version is available', undefined, { timeout: 8000 });
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API
|
|
34
|
+
|
|
35
|
+
### `Notify`
|
|
36
|
+
|
|
37
|
+
| Method | Signature |
|
|
38
|
+
| --------------------------------------------- | --------------------------------------------------- |
|
|
39
|
+
| `show(type, message, description?, options?)` | `type: 'info' \| 'success' \| 'warning' \| 'error'` |
|
|
40
|
+
| `info` / `success` / `warning` / `error` | `(message, description?, options?)` |
|
|
41
|
+
|
|
42
|
+
### `NgxNotifyOptions`
|
|
43
|
+
|
|
44
|
+
| Field | Type | Default | Description |
|
|
45
|
+
| -------------- | ----------------------- | -------------- | ------------------------------------------------------------- |
|
|
46
|
+
| `timeout` | `number` (ms) | `3000` | How long it's shown before auto-dismissing |
|
|
47
|
+
| `position` | `NgxNotifyPositionType` | `'top-center'` | Corner/center to display in |
|
|
48
|
+
| `maxVisible` | `number` | `10` | Beyond this count, notifications queue instead of overlapping |
|
|
49
|
+
| `allowHtml` | `boolean` | `false` | If `true`, the message is rendered as HTML (not sanitized) |
|
|
50
|
+
| `pauseOnHover` | `boolean` | `true` | The timer pauses while the mouse hovers |
|
|
51
|
+
| `dismissible` | `boolean` | `true` | Show a close button |
|
|
52
|
+
| `closeOnTap` | `boolean` | `true` | Clicking the notification itself closes it |
|
|
53
|
+
|
|
54
|
+
## Dark mode and RTL
|
|
55
|
+
|
|
56
|
+
Supported automatically.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-kit",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Angular input components",
|
|
5
5
|
"author": "Mohammadreza Samani <mr.samani1368@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
"types": "./types/ngx-kit-color-picker.d.ts",
|
|
46
46
|
"default": "./fesm2022/ngx-kit-color-picker.mjs"
|
|
47
47
|
},
|
|
48
|
+
"./core": {
|
|
49
|
+
"types": "./types/ngx-kit-core.d.ts",
|
|
50
|
+
"default": "./fesm2022/ngx-kit-core.mjs"
|
|
51
|
+
},
|
|
48
52
|
"./data-table": {
|
|
49
53
|
"types": "./types/ngx-kit-data-table.d.ts",
|
|
50
54
|
"default": "./fesm2022/ngx-kit-data-table.mjs"
|
|
@@ -105,10 +109,6 @@
|
|
|
105
109
|
"types": "./types/ngx-kit-notify.d.ts",
|
|
106
110
|
"default": "./fesm2022/ngx-kit-notify.mjs"
|
|
107
111
|
},
|
|
108
|
-
"./shared": {
|
|
109
|
-
"types": "./types/ngx-kit-shared.d.ts",
|
|
110
|
-
"default": "./fesm2022/ngx-kit-shared.mjs"
|
|
111
|
-
},
|
|
112
112
|
"./time-picker": {
|
|
113
113
|
"types": "./types/ngx-kit-time-picker.d.ts",
|
|
114
114
|
"default": "./fesm2022/ngx-kit-time-picker.mjs"
|
|
@@ -116,10 +116,6 @@
|
|
|
116
116
|
"./virtual-scroll": {
|
|
117
117
|
"types": "./types/ngx-kit-virtual-scroll.d.ts",
|
|
118
118
|
"default": "./fesm2022/ngx-kit-virtual-scroll.mjs"
|
|
119
|
-
},
|
|
120
|
-
"./webflow": {
|
|
121
|
-
"types": "./types/ngx-kit-webflow.d.ts",
|
|
122
|
-
"default": "./fesm2022/ngx-kit-webflow.mjs"
|
|
123
119
|
}
|
|
124
120
|
},
|
|
125
121
|
"type": "module"
|
package/time-picker/README.md
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
# ngx-kit/time-picker
|
|
2
|
-
|
|
3
|
-
An analog clock time picker (MUI-style), usable either inline or as a popup attached to a text input, with 12h/24h format support and a configurable minute step.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Setup (optional)
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
// app.config.ts
|
|
15
|
-
import { provideTimePicker } from 'ngx-kit/time-picker';
|
|
16
|
-
|
|
17
|
-
export const appConfig: ApplicationConfig = {
|
|
18
|
-
providers: [
|
|
19
|
-
provideTimePicker({
|
|
20
|
-
format: '24',
|
|
21
|
-
minuteStep: 5,
|
|
22
|
-
confirmButtonText: 'Done',
|
|
23
|
-
}),
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
`provideTimePicker` only needs the fields you want to override — everything else falls back to the defaults (`confirmButtonText: 'Ok'`, `cancelButtonText: 'Cancel'`, `amText: 'AM'`, `pmText: 'PM'`, `format: '12'`, `minuteStep: 1`, `autoSwitchToMinute: true`).
|
|
29
|
-
|
|
30
|
-
## Usage — popup attached to an input
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<input type="text" formControlName="time" ngxInputTimePicker #dp="ngxInputTimePicker" />
|
|
34
|
-
<button (click)="dp.toggle()">Open</button>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
`[ngxInputTimePicker]` is a full `ControlValueAccessor` + `Validator`, so it works with `ngModel`/`formControl`/`formControlName`. The value is always a string in `HH:MM` (24h) form, e.g. `'14:35'`.
|
|
38
|
-
|
|
39
|
-
If the typed text isn't a valid time, the control gets a `{ invalid: true }` error (in addition to whatever built-in validators like `Validators.required` you add yourself):
|
|
40
|
-
|
|
41
|
-
```html
|
|
42
|
-
@if (form.get('time')?.hasError('invalid')) {
|
|
43
|
-
<div class="text-danger">Invalid time</div>
|
|
44
|
-
} @if (form.get('time')?.hasError('required')) {
|
|
45
|
-
<div class="text-danger">Time is required</div>
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Usage — inline (always visible)
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<ngx-time-picker format="24" [(value)]="time" (change)="onTimeChange($event)"></ngx-time-picker>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## API
|
|
56
|
-
|
|
57
|
-
### `[ngxInputTimePicker]`
|
|
58
|
-
|
|
59
|
-
| Input | Type | Default | Description |
|
|
60
|
-
| ------------- | -------------- | ----------- | ----------------------------------------------- |
|
|
61
|
-
| `openOnCLick` | `boolean` | `true` | Open the popup when the input itself is clicked |
|
|
62
|
-
| `format` | `'12' \| '24'` | from config | |
|
|
63
|
-
|
|
64
|
-
| Output | Type | Description |
|
|
65
|
-
| -------- | ------------------------------ | ------------------------------------- |
|
|
66
|
-
| `change` | `EventEmitter<string \| null>` | Emitted when the user confirms a time |
|
|
67
|
-
|
|
68
|
-
| Member | Description |
|
|
69
|
-
| ---------- | -------------------------------------------- |
|
|
70
|
-
| `toggle()` | Opens the popup if closed, closes it if open |
|
|
71
|
-
|
|
72
|
-
### `<ngx-time-picker>`
|
|
73
|
-
|
|
74
|
-
| Input | Type | Default | Description |
|
|
75
|
-
| ------------------------ | -------------- | ----------- | ------------------------------------------------------------ |
|
|
76
|
-
| `value` (model, two-way) | `string` | `'12:00'` | Bind with `[(value)]` |
|
|
77
|
-
| `format` | `'12' \| '24'` | from config | |
|
|
78
|
-
| `minuteStep` | `number` | from config | |
|
|
79
|
-
| `disabled` | `boolean` | `false` | |
|
|
80
|
-
| `autoSwitchToMinute` | `boolean` | from config | Switch to minute-selection mode right after picking the hour |
|
|
81
|
-
|
|
82
|
-
| Output | Type | Description |
|
|
83
|
-
| -------- | ------------------------------ | -------------------------------- |
|
|
84
|
-
| `change` | `EventEmitter<string \| null>` | Emitted when "OK" is pressed |
|
|
85
|
-
| `cancel` | `EventEmitter<void>` | Emitted when "Cancel" is pressed |
|
|
86
|
-
|
|
87
|
-
## Dark mode and RTL
|
|
88
|
-
|
|
89
|
-
Supported automatically.
|
|
1
|
+
# ngx-kit/time-picker
|
|
2
|
+
|
|
3
|
+
An analog clock time picker (MUI-style), usable either inline or as a popup attached to a text input, with 12h/24h format support and a configurable minute step.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup (optional)
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// app.config.ts
|
|
15
|
+
import { provideTimePicker } from 'ngx-kit/time-picker';
|
|
16
|
+
|
|
17
|
+
export const appConfig: ApplicationConfig = {
|
|
18
|
+
providers: [
|
|
19
|
+
provideTimePicker({
|
|
20
|
+
format: '24',
|
|
21
|
+
minuteStep: 5,
|
|
22
|
+
confirmButtonText: 'Done',
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`provideTimePicker` only needs the fields you want to override — everything else falls back to the defaults (`confirmButtonText: 'Ok'`, `cancelButtonText: 'Cancel'`, `amText: 'AM'`, `pmText: 'PM'`, `format: '12'`, `minuteStep: 1`, `autoSwitchToMinute: true`).
|
|
29
|
+
|
|
30
|
+
## Usage — popup attached to an input
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<input type="text" formControlName="time" ngxInputTimePicker #dp="ngxInputTimePicker" />
|
|
34
|
+
<button (click)="dp.toggle()">Open</button>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`[ngxInputTimePicker]` is a full `ControlValueAccessor` + `Validator`, so it works with `ngModel`/`formControl`/`formControlName`. The value is always a string in `HH:MM` (24h) form, e.g. `'14:35'`.
|
|
38
|
+
|
|
39
|
+
If the typed text isn't a valid time, the control gets a `{ invalid: true }` error (in addition to whatever built-in validators like `Validators.required` you add yourself):
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
@if (form.get('time')?.hasError('invalid')) {
|
|
43
|
+
<div class="text-danger">Invalid time</div>
|
|
44
|
+
} @if (form.get('time')?.hasError('required')) {
|
|
45
|
+
<div class="text-danger">Time is required</div>
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage — inline (always visible)
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<ngx-time-picker format="24" [(value)]="time" (change)="onTimeChange($event)"></ngx-time-picker>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## API
|
|
56
|
+
|
|
57
|
+
### `[ngxInputTimePicker]`
|
|
58
|
+
|
|
59
|
+
| Input | Type | Default | Description |
|
|
60
|
+
| ------------- | -------------- | ----------- | ----------------------------------------------- |
|
|
61
|
+
| `openOnCLick` | `boolean` | `true` | Open the popup when the input itself is clicked |
|
|
62
|
+
| `format` | `'12' \| '24'` | from config | |
|
|
63
|
+
|
|
64
|
+
| Output | Type | Description |
|
|
65
|
+
| -------- | ------------------------------ | ------------------------------------- |
|
|
66
|
+
| `change` | `EventEmitter<string \| null>` | Emitted when the user confirms a time |
|
|
67
|
+
|
|
68
|
+
| Member | Description |
|
|
69
|
+
| ---------- | -------------------------------------------- |
|
|
70
|
+
| `toggle()` | Opens the popup if closed, closes it if open |
|
|
71
|
+
|
|
72
|
+
### `<ngx-time-picker>`
|
|
73
|
+
|
|
74
|
+
| Input | Type | Default | Description |
|
|
75
|
+
| ------------------------ | -------------- | ----------- | ------------------------------------------------------------ |
|
|
76
|
+
| `value` (model, two-way) | `string` | `'12:00'` | Bind with `[(value)]` |
|
|
77
|
+
| `format` | `'12' \| '24'` | from config | |
|
|
78
|
+
| `minuteStep` | `number` | from config | |
|
|
79
|
+
| `disabled` | `boolean` | `false` | |
|
|
80
|
+
| `autoSwitchToMinute` | `boolean` | from config | Switch to minute-selection mode right after picking the hour |
|
|
81
|
+
|
|
82
|
+
| Output | Type | Description |
|
|
83
|
+
| -------- | ------------------------------ | -------------------------------- |
|
|
84
|
+
| `change` | `EventEmitter<string \| null>` | Emitted when "OK" is pressed |
|
|
85
|
+
| `cancel` | `EventEmitter<void>` | Emitted when "Cancel" is pressed |
|
|
86
|
+
|
|
87
|
+
## Dark mode and RTL
|
|
88
|
+
|
|
89
|
+
Supported automatically.
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { OnInit, AfterViewInit,
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit, AfterViewInit, EventEmitter, ElementRef, ChangeDetectorRef, OnDestroy, Renderer2, ViewContainerRef } from '@angular/core';
|
|
3
3
|
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
4
|
-
import { BrowserService, OverlayService } from 'ngx-kit/
|
|
4
|
+
import { BrowserService, OverlayService } from 'ngx-kit/core';
|
|
5
5
|
|
|
6
6
|
declare class NgxAngleSelectorComponent implements OnInit, AfterViewInit, ControlValueAccessor {
|
|
7
7
|
browserService: BrowserService;
|
|
8
|
-
|
|
9
|
-
set setTheme(val: 'light' | 'dark' | 'auto');
|
|
10
|
-
size: i0.InputSignal<number>;
|
|
8
|
+
size: _angular_core.InputSignal<number>;
|
|
11
9
|
private minAngle;
|
|
12
10
|
private maxAngle;
|
|
13
|
-
isDisabled: WritableSignal<boolean>;
|
|
11
|
+
isDisabled: _angular_core.WritableSignal<boolean>;
|
|
14
12
|
change: EventEmitter<number>;
|
|
15
13
|
private onChange;
|
|
16
14
|
private onTouched;
|
|
17
15
|
selectorContainer: ElementRef<HTMLDivElement>;
|
|
18
|
-
currentAngle: WritableSignal<number>;
|
|
19
|
-
isDragging: WritableSignal<boolean>;
|
|
16
|
+
currentAngle: _angular_core.WritableSignal<number>;
|
|
17
|
+
isDragging: _angular_core.WritableSignal<boolean>;
|
|
20
18
|
selectorRect: DOMRect | null;
|
|
21
19
|
centerX: number;
|
|
22
20
|
centerY: number;
|
|
@@ -38,8 +36,8 @@ declare class NgxAngleSelectorComponent implements OnInit, AfterViewInit, Contro
|
|
|
38
36
|
private drawTicks;
|
|
39
37
|
private calculateAngle;
|
|
40
38
|
private setupPointerEvents;
|
|
41
|
-
static ɵfac:
|
|
42
|
-
static ɵcmp:
|
|
39
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxAngleSelectorComponent, never>;
|
|
40
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgxAngleSelectorComponent, "ngx-input-angle", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "change": "change"; }, never, never, true, never>;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
declare class NgxInputAngle implements OnDestroy, ControlValueAccessor, Validator {
|
|
@@ -47,9 +45,8 @@ declare class NgxInputAngle implements OnDestroy, ControlValueAccessor, Validato
|
|
|
47
45
|
private renderer;
|
|
48
46
|
private viewContainerRef;
|
|
49
47
|
private overlayService;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
openOnCLick: i0.InputSignal<boolean>;
|
|
48
|
+
size: _angular_core.InputSignal<number>;
|
|
49
|
+
openOnCLick: _angular_core.InputSignal<boolean>;
|
|
53
50
|
change: EventEmitter<number>;
|
|
54
51
|
private value?;
|
|
55
52
|
private pickerRef?;
|
|
@@ -73,8 +70,8 @@ declare class NgxInputAngle implements OnDestroy, ControlValueAccessor, Validato
|
|
|
73
70
|
toggle(): void;
|
|
74
71
|
private destroyAnglePicker;
|
|
75
72
|
private emitChange;
|
|
76
|
-
static ɵfac:
|
|
77
|
-
static ɵdir:
|
|
73
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxInputAngle, never>;
|
|
74
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgxInputAngle, "[ngxInputAngle]", ["ngxInputAngle"], { "size": { "alias": "size"; "required": false; "isSignal": true; }; "openOnCLick": { "alias": "openOnCLick"; "required": false; "isSignal": true; }; }, { "change": "change"; }, never, never, true, never>;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
export { NgxAngleSelectorComponent, NgxInputAngle };
|