ngx-kit 7.0.1 → 7.1.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/data-table/README.md +120 -120
- package/date-picker/README.md +74 -74
- package/dialog/README.md +92 -92
- package/drag-resize/README.md +55 -55
- package/fesm2022/ngx-kit-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-dialog.mjs.map +1 -1
- 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 +2 -2
- package/fesm2022/ngx-kit-gallery.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-infinite-scroll.mjs +467 -0
- package/fesm2022/ngx-kit-infinite-scroll.mjs.map +1 -0
- package/fesm2022/ngx-kit-shared.mjs.map +1 -1
- package/fesm2022/ngx-kit-virtual-scroll.mjs +2 -2
- package/fesm2022/ngx-kit-virtual-scroll.mjs.map +1 -1
- package/fesm2022/ngx-kit-webflow.mjs +38 -38
- package/fesm2022/ngx-kit-webflow.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/infinite-scroll/README.md +252 -0
- package/menu/README.md +85 -85
- package/message/README.md +70 -70
- package/notify/README.md +56 -56
- package/package.json +5 -1
- package/shared/README.md +117 -117
- package/time-picker/README.md +89 -89
- package/types/ngx-kit-infinite-scroll.d.ts +86 -0
- package/virtual-scroll/README.md +199 -199
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.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Angular input components",
|
|
5
5
|
"author": "Mohammadreza Samani <mr.samani1368@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -89,6 +89,10 @@
|
|
|
89
89
|
"types": "./types/ngx-kit-image-editor.d.ts",
|
|
90
90
|
"default": "./fesm2022/ngx-kit-image-editor.mjs"
|
|
91
91
|
},
|
|
92
|
+
"./infinite-scroll": {
|
|
93
|
+
"types": "./types/ngx-kit-infinite-scroll.d.ts",
|
|
94
|
+
"default": "./fesm2022/ngx-kit-infinite-scroll.mjs"
|
|
95
|
+
},
|
|
92
96
|
"./menu": {
|
|
93
97
|
"types": "./types/ngx-kit-menu.d.ts",
|
|
94
98
|
"default": "./fesm2022/ngx-kit-menu.mjs"
|
package/shared/README.md
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
# ngx-kit/shared
|
|
2
|
-
|
|
3
|
-
Shared utilities and services that the rest of the `ngx-kit` packages are built on: overlay/dialog management, page-direction (RTL/LTR) detection, browser-preference detection, and a few reusable base components (slider, range slider, color-saturation panel).
|
|
4
|
-
|
|
5
|
-
You usually won't need this package directly — the other packages depend on it automatically. But if you're building a custom component that should stay consistent with the rest of the library (dark mode, RTL, drag performance), use these same utilities.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install ngx-kit
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Import the base styles (which enable dark mode via `color-scheme`) once, app-wide:
|
|
14
|
-
|
|
15
|
-
```scss
|
|
16
|
-
// styles.scss
|
|
17
|
-
@import 'ngx-kit/styles/all.css';
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Services
|
|
21
|
-
|
|
22
|
-
### `OverlayService`
|
|
23
|
-
|
|
24
|
-
The engine behind everything floating in the library (menus, dialogs, the color/gradient/angle picker popups). Renders an Angular component inside a native `<dialog>` (`showModal()`) and positions it relative to an anchor.
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { OverlayService } from 'ngx-kit/shared';
|
|
28
|
-
|
|
29
|
-
const overlay = inject(OverlayService);
|
|
30
|
-
const viewContainerRef = inject(ViewContainerRef);
|
|
31
|
-
|
|
32
|
-
const ref = overlay.open({
|
|
33
|
-
component: MyComponent,
|
|
34
|
-
viewContainerRef,
|
|
35
|
-
anchor: buttonElementRef.nativeElement,
|
|
36
|
-
placement: 'bottom', // 'top' | 'bottom' | 'auto'
|
|
37
|
-
alignment: 'start', // 'start' | 'center' | 'end'
|
|
38
|
-
margin: 8,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
ref.close(); // OverlayRef.close() takes no argument and has no afterClosed; for that (return value, afterClosed) use ngx-kit/dialog, which is built on top of this service
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
What's handled for you automatically:
|
|
45
|
-
|
|
46
|
-
- **Smart positioning**: if there isn't enough room below the anchor, it flips above (`placement: 'auto'`).
|
|
47
|
-
- **Click-outside dismissal**: detected via the backdrop click, not a global `document` listener.
|
|
48
|
-
- **Correct stacking**: multiple simultaneous overlays (e.g. a menu with a submenu) work correctly; Escape only closes the last (topmost) overlay.
|
|
49
|
-
- **Focus restoration**: after closing, focus returns to whatever had focus before the overlay opened (accessibility).
|
|
50
|
-
- **Automatic RTL**: alignment and placement are computed against the page's actual direction (not a fixed assumption).
|
|
51
|
-
|
|
52
|
-
### `DirectionService`
|
|
53
|
-
|
|
54
|
-
A signal (`isRtl(): boolean`) that watches the `<html>` element's `dir` attribute with a `MutationObserver` and updates reactively the moment it changes — so if your app switches languages at runtime, everything stays in sync automatically.
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
const direction = inject(DirectionService);
|
|
58
|
-
direction.isRtl(); // signal<boolean>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### `BrowserService`
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
const browser = inject(BrowserService);
|
|
65
|
-
browser.prefersDarkMode; // boolean — read once at service construction time
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Utilities
|
|
69
|
-
|
|
70
|
-
### `startDragSession(callbacks)`
|
|
71
|
-
|
|
72
|
-
Replaces the problematic `@HostListener('document:mousemove', ...)` pattern, which keeps a listener attached to `document` for the entire lifetime of the component — even when nothing is being dragged (a real performance issue on pages with many simultaneous instances). This function only adds a listener for the duration of an actual drag and removes it itself; `touchmove` is handled with `{passive: false}`, so dragging on mobile doesn't also scroll the page.
|
|
73
|
-
|
|
74
|
-
```ts
|
|
75
|
-
import { startDragSession } from 'ngx-kit/shared';
|
|
76
|
-
|
|
77
|
-
let stop: (() => void) | undefined;
|
|
78
|
-
|
|
79
|
-
function onPointerDown(ev: MouseEvent | TouchEvent) {
|
|
80
|
-
stop?.();
|
|
81
|
-
stop = startDragSession({
|
|
82
|
-
onMove: (ev) => {
|
|
83
|
-
/* update position */
|
|
84
|
-
},
|
|
85
|
-
onEnd: () => {
|
|
86
|
-
stop = undefined;
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
> If your component is `OnPush` and uses `startDragSession` (instead of `@HostListener`), make sure to call `ChangeDetectorRef.markForCheck()` inside `onMove`/`onEnd` yourself — unlike `@HostListener`, which automatically marks the view dirty, a manual `addEventListener` does not.
|
|
93
|
-
|
|
94
|
-
### `getOffsetPosition(event, element)`
|
|
95
|
-
|
|
96
|
-
Returns the pointer/touch position relative to an element's top-left corner; used to implement drag-based components (sliders, color pickers, etc.).
|
|
97
|
-
|
|
98
|
-
### `mergeConfig(base, override)`
|
|
99
|
-
|
|
100
|
-
Deep-merges two config objects (for the `provideXxx({...})` pattern used throughout the library).
|
|
101
|
-
|
|
102
|
-
## Base components
|
|
103
|
-
|
|
104
|
-
These can be used directly, but they're mostly designed as building blocks for other components (like `color-picker`, `box-shadow`):
|
|
105
|
-
|
|
106
|
-
| Component | Selector | Description |
|
|
107
|
-
| ---------------------- | ----------------------- | --------------------------------------------------------------------- |
|
|
108
|
-
| `SliderComponent` | `slider` | Single-value slider, `ControlValueAccessor`, `[min]`/`[max]`/`[step]` |
|
|
109
|
-
| `RangeSliderComponent` | `range-slider` | Range slider (two thumbs) |
|
|
110
|
-
| `SaturationComponent` | internal (color-picker) | 2D saturation/lightness picker panel |
|
|
111
|
-
|
|
112
|
-
## Dark mode and RTL
|
|
113
|
-
|
|
114
|
-
Both rely directly on `ngx-kit/shared`:
|
|
115
|
-
|
|
116
|
-
- **Dark mode**: uses the native CSS `light-dark()` function. For it to work, `color-scheme: light dark` (or `only light`/`only dark` to force it manually) must be set on `:root` — this happens automatically when you import `ngx-kit/styles/all.css`. To force a theme manually (independent of the OS's `prefers-color-scheme`), set `data-ngx-theme="dark"` or `"light"` on `<html>`/`<body>`.
|
|
117
|
-
- **RTL**: enabled via `dir="rtl"` on `<html>`; the whole library uses CSS logical properties (`inset-inline-start`, etc.), so no separate styling is needed.
|
|
1
|
+
# ngx-kit/shared
|
|
2
|
+
|
|
3
|
+
Shared utilities and services that the rest of the `ngx-kit` packages are built on: overlay/dialog management, page-direction (RTL/LTR) detection, browser-preference detection, and a few reusable base components (slider, range slider, color-saturation panel).
|
|
4
|
+
|
|
5
|
+
You usually won't need this package directly — the other packages depend on it automatically. But if you're building a custom component that should stay consistent with the rest of the library (dark mode, RTL, drag performance), use these same utilities.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install ngx-kit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Import the base styles (which enable dark mode via `color-scheme`) once, app-wide:
|
|
14
|
+
|
|
15
|
+
```scss
|
|
16
|
+
// styles.scss
|
|
17
|
+
@import 'ngx-kit/styles/all.css';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Services
|
|
21
|
+
|
|
22
|
+
### `OverlayService`
|
|
23
|
+
|
|
24
|
+
The engine behind everything floating in the library (menus, dialogs, the color/gradient/angle picker popups). Renders an Angular component inside a native `<dialog>` (`showModal()`) and positions it relative to an anchor.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { OverlayService } from 'ngx-kit/shared';
|
|
28
|
+
|
|
29
|
+
const overlay = inject(OverlayService);
|
|
30
|
+
const viewContainerRef = inject(ViewContainerRef);
|
|
31
|
+
|
|
32
|
+
const ref = overlay.open({
|
|
33
|
+
component: MyComponent,
|
|
34
|
+
viewContainerRef,
|
|
35
|
+
anchor: buttonElementRef.nativeElement,
|
|
36
|
+
placement: 'bottom', // 'top' | 'bottom' | 'auto'
|
|
37
|
+
alignment: 'start', // 'start' | 'center' | 'end'
|
|
38
|
+
margin: 8,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
ref.close(); // OverlayRef.close() takes no argument and has no afterClosed; for that (return value, afterClosed) use ngx-kit/dialog, which is built on top of this service
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
What's handled for you automatically:
|
|
45
|
+
|
|
46
|
+
- **Smart positioning**: if there isn't enough room below the anchor, it flips above (`placement: 'auto'`).
|
|
47
|
+
- **Click-outside dismissal**: detected via the backdrop click, not a global `document` listener.
|
|
48
|
+
- **Correct stacking**: multiple simultaneous overlays (e.g. a menu with a submenu) work correctly; Escape only closes the last (topmost) overlay.
|
|
49
|
+
- **Focus restoration**: after closing, focus returns to whatever had focus before the overlay opened (accessibility).
|
|
50
|
+
- **Automatic RTL**: alignment and placement are computed against the page's actual direction (not a fixed assumption).
|
|
51
|
+
|
|
52
|
+
### `DirectionService`
|
|
53
|
+
|
|
54
|
+
A signal (`isRtl(): boolean`) that watches the `<html>` element's `dir` attribute with a `MutationObserver` and updates reactively the moment it changes — so if your app switches languages at runtime, everything stays in sync automatically.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const direction = inject(DirectionService);
|
|
58
|
+
direction.isRtl(); // signal<boolean>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `BrowserService`
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const browser = inject(BrowserService);
|
|
65
|
+
browser.prefersDarkMode; // boolean — read once at service construction time
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Utilities
|
|
69
|
+
|
|
70
|
+
### `startDragSession(callbacks)`
|
|
71
|
+
|
|
72
|
+
Replaces the problematic `@HostListener('document:mousemove', ...)` pattern, which keeps a listener attached to `document` for the entire lifetime of the component — even when nothing is being dragged (a real performance issue on pages with many simultaneous instances). This function only adds a listener for the duration of an actual drag and removes it itself; `touchmove` is handled with `{passive: false}`, so dragging on mobile doesn't also scroll the page.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { startDragSession } from 'ngx-kit/shared';
|
|
76
|
+
|
|
77
|
+
let stop: (() => void) | undefined;
|
|
78
|
+
|
|
79
|
+
function onPointerDown(ev: MouseEvent | TouchEvent) {
|
|
80
|
+
stop?.();
|
|
81
|
+
stop = startDragSession({
|
|
82
|
+
onMove: (ev) => {
|
|
83
|
+
/* update position */
|
|
84
|
+
},
|
|
85
|
+
onEnd: () => {
|
|
86
|
+
stop = undefined;
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
> If your component is `OnPush` and uses `startDragSession` (instead of `@HostListener`), make sure to call `ChangeDetectorRef.markForCheck()` inside `onMove`/`onEnd` yourself — unlike `@HostListener`, which automatically marks the view dirty, a manual `addEventListener` does not.
|
|
93
|
+
|
|
94
|
+
### `getOffsetPosition(event, element)`
|
|
95
|
+
|
|
96
|
+
Returns the pointer/touch position relative to an element's top-left corner; used to implement drag-based components (sliders, color pickers, etc.).
|
|
97
|
+
|
|
98
|
+
### `mergeConfig(base, override)`
|
|
99
|
+
|
|
100
|
+
Deep-merges two config objects (for the `provideXxx({...})` pattern used throughout the library).
|
|
101
|
+
|
|
102
|
+
## Base components
|
|
103
|
+
|
|
104
|
+
These can be used directly, but they're mostly designed as building blocks for other components (like `color-picker`, `box-shadow`):
|
|
105
|
+
|
|
106
|
+
| Component | Selector | Description |
|
|
107
|
+
| ---------------------- | ----------------------- | --------------------------------------------------------------------- |
|
|
108
|
+
| `SliderComponent` | `slider` | Single-value slider, `ControlValueAccessor`, `[min]`/`[max]`/`[step]` |
|
|
109
|
+
| `RangeSliderComponent` | `range-slider` | Range slider (two thumbs) |
|
|
110
|
+
| `SaturationComponent` | internal (color-picker) | 2D saturation/lightness picker panel |
|
|
111
|
+
|
|
112
|
+
## Dark mode and RTL
|
|
113
|
+
|
|
114
|
+
Both rely directly on `ngx-kit/shared`:
|
|
115
|
+
|
|
116
|
+
- **Dark mode**: uses the native CSS `light-dark()` function. For it to work, `color-scheme: light dark` (or `only light`/`only dark` to force it manually) must be set on `:root` — this happens automatically when you import `ngx-kit/styles/all.css`. To force a theme manually (independent of the OS's `prefers-color-scheme`), set `data-ngx-theme="dark"` or `"light"` on `<html>`/`<body>`.
|
|
117
|
+
- **RTL**: enabled via `dir="rtl"` on `<html>`; the whole library uses CSS logical properties (`inset-inline-start`, etc.), so no separate styling is needed.
|
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.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { AfterViewInit } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
type NgxInfiniteScrollDirection = 'up' | 'down' | 'both';
|
|
5
|
+
interface NgxInfiniteScrollEvent {
|
|
6
|
+
direction: 'up' | 'down';
|
|
7
|
+
distance: number;
|
|
8
|
+
target: HTMLElement;
|
|
9
|
+
root: HTMLElement | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class NgxInfiniteScroll implements AfterViewInit {
|
|
13
|
+
readonly infiniteScrollDistance: _angular_core.InputSignalWithTransform<number, string | number | null | undefined>;
|
|
14
|
+
readonly infiniteScrollDisabled: _angular_core.InputSignalWithTransform<boolean, string | boolean | null | undefined>;
|
|
15
|
+
readonly infiniteScrollImmediateCheck: _angular_core.InputSignalWithTransform<boolean, string | boolean | null | undefined>;
|
|
16
|
+
readonly infiniteScrollMinInterval: _angular_core.InputSignalWithTransform<number, string | number | null | undefined>;
|
|
17
|
+
readonly infiniteScrollUpDistance: _angular_core.InputSignalWithTransform<number | null, number | null>;
|
|
18
|
+
readonly infiniteScrollDownDistance: _angular_core.InputSignalWithTransform<number | null, number | null>;
|
|
19
|
+
readonly infiniteScrollDirection: _angular_core.InputSignal<NgxInfiniteScrollDirection>;
|
|
20
|
+
readonly infiniteScrollContainer: _angular_core.InputSignal<string | HTMLElement | null>;
|
|
21
|
+
readonly infiniteScrollRoot: _angular_core.InputSignal<HTMLElement | null>;
|
|
22
|
+
readonly scrollWindow: _angular_core.InputSignalWithTransform<boolean, string | boolean | null | undefined>;
|
|
23
|
+
readonly fromRoot: _angular_core.InputSignalWithTransform<boolean, string | boolean | null | undefined>;
|
|
24
|
+
/** Preserve the visual scroll position when older content is prepended. */
|
|
25
|
+
readonly infiniteScrollMaintainScrollPosition: _angular_core.InputSignalWithTransform<boolean, string | boolean | null | undefined>;
|
|
26
|
+
/** Optional CSS scroll behavior used while compensating a prepend. */
|
|
27
|
+
readonly infiniteScrollPreserveScrollBehavior: _angular_core.InputSignal<ScrollBehavior>;
|
|
28
|
+
readonly scrolled: _angular_core.OutputEmitterRef<NgxInfiniteScrollEvent>;
|
|
29
|
+
readonly scrolledUp: _angular_core.OutputEmitterRef<NgxInfiniteScrollEvent>;
|
|
30
|
+
readonly scrolledDown: _angular_core.OutputEmitterRef<NgxInfiniteScrollEvent>;
|
|
31
|
+
readonly scrollStartReached: _angular_core.OutputEmitterRef<NgxInfiniteScrollEvent>;
|
|
32
|
+
readonly scrollEndReached: _angular_core.OutputEmitterRef<NgxInfiniteScrollEvent>;
|
|
33
|
+
private readonly hostRef;
|
|
34
|
+
private readonly zone;
|
|
35
|
+
private readonly destroyRef;
|
|
36
|
+
private readonly platformId;
|
|
37
|
+
private readonly ready;
|
|
38
|
+
private previousConfiguration?;
|
|
39
|
+
private observer?;
|
|
40
|
+
private resizeObserver?;
|
|
41
|
+
private mutationObserver?;
|
|
42
|
+
private topSentinel?;
|
|
43
|
+
private bottomSentinel?;
|
|
44
|
+
private root;
|
|
45
|
+
private lastTriggerAt;
|
|
46
|
+
private armedUp;
|
|
47
|
+
private armedDown;
|
|
48
|
+
private destroyRequested;
|
|
49
|
+
private prependFrame;
|
|
50
|
+
private prependSnapshot?;
|
|
51
|
+
constructor();
|
|
52
|
+
ngAfterViewInit(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Re-check the sentinels after application code has appended/prepended data.
|
|
55
|
+
* Usually not needed, but useful for custom rendering pipelines.
|
|
56
|
+
*/
|
|
57
|
+
check(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Explicitly finish a pending prepend operation.
|
|
60
|
+
* Useful when an application knows exactly when its async batch has rendered.
|
|
61
|
+
*/
|
|
62
|
+
completePrepend(): void;
|
|
63
|
+
private sameConfiguration;
|
|
64
|
+
private setup;
|
|
65
|
+
private trigger;
|
|
66
|
+
private allowsDirection;
|
|
67
|
+
private resolveRoot;
|
|
68
|
+
private buildRootMargin;
|
|
69
|
+
private createSentinel;
|
|
70
|
+
private scheduleCheck;
|
|
71
|
+
private checkVisibilityDirectly;
|
|
72
|
+
private distanceFor;
|
|
73
|
+
private getDocumentScroller;
|
|
74
|
+
private getScrollMetrics;
|
|
75
|
+
private capturePrependSnapshot;
|
|
76
|
+
private watchPrepend;
|
|
77
|
+
private tryCompensatePrepend;
|
|
78
|
+
private cancelPrependWatcher;
|
|
79
|
+
private destroyObserver;
|
|
80
|
+
private clearSentinels;
|
|
81
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxInfiniteScroll, never>;
|
|
82
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgxInfiniteScroll, "[infiniteScroll]", ["infiniteScroll"], { "infiniteScrollDistance": { "alias": "infiniteScrollDistance"; "required": false; "isSignal": true; }; "infiniteScrollDisabled": { "alias": "infiniteScrollDisabled"; "required": false; "isSignal": true; }; "infiniteScrollImmediateCheck": { "alias": "infiniteScrollImmediateCheck"; "required": false; "isSignal": true; }; "infiniteScrollMinInterval": { "alias": "infiniteScrollMinInterval"; "required": false; "isSignal": true; }; "infiniteScrollUpDistance": { "alias": "infiniteScrollUpDistance"; "required": false; "isSignal": true; }; "infiniteScrollDownDistance": { "alias": "infiniteScrollDownDistance"; "required": false; "isSignal": true; }; "infiniteScrollDirection": { "alias": "infiniteScrollDirection"; "required": false; "isSignal": true; }; "infiniteScrollContainer": { "alias": "infiniteScrollContainer"; "required": false; "isSignal": true; }; "infiniteScrollRoot": { "alias": "infiniteScrollRoot"; "required": false; "isSignal": true; }; "scrollWindow": { "alias": "scrollWindow"; "required": false; "isSignal": true; }; "fromRoot": { "alias": "fromRoot"; "required": false; "isSignal": true; }; "infiniteScrollMaintainScrollPosition": { "alias": "infiniteScrollMaintainScrollPosition"; "required": false; "isSignal": true; }; "infiniteScrollPreserveScrollBehavior": { "alias": "infiniteScrollPreserveScrollBehavior"; "required": false; "isSignal": true; }; }, { "scrolled": "scrolled"; "scrolledUp": "scrolledUp"; "scrolledDown": "scrolledDown"; "scrollStartReached": "scrollStartReached"; "scrollEndReached": "scrollEndReached"; }, never, never, true, never>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { NgxInfiniteScroll as InfiniteScroll, NgxInfiniteScroll };
|
|
86
|
+
export type { NgxInfiniteScrollDirection, NgxInfiniteScrollEvent };
|