ngx-kit 6.1.0 → 6.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/README.md +3 -3
- package/angle-selector/README.md +34 -34
- package/box-shadow/README.md +33 -33
- package/color-picker/README.md +49 -49
- package/data-table/README.md +113 -113
- package/date-picker/README.md +69 -69
- package/dialog/README.md +92 -92
- package/drawer-menu/README.md +110 -62
- package/dropzone/README.md +422 -422
- package/fesm2022/ngx-kit-angle-selector.mjs +2 -2
- package/fesm2022/ngx-kit-angle-selector.mjs.map +1 -1
- package/fesm2022/ngx-kit-box-shadow.mjs +2 -2
- package/fesm2022/ngx-kit-box-shadow.mjs.map +1 -1
- package/fesm2022/ngx-kit-color-picker.mjs +4 -4
- package/fesm2022/ngx-kit-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-data-table.mjs +2 -2
- package/fesm2022/ngx-kit-data-table.mjs.map +1 -1
- package/fesm2022/ngx-kit-date-picker.mjs +1324 -200
- package/fesm2022/ngx-kit-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-dialog.mjs +2 -2
- package/fesm2022/ngx-kit-dialog.mjs.map +1 -1
- package/fesm2022/ngx-kit-drawer-menu.mjs +302 -140
- package/fesm2022/ngx-kit-drawer-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-dropzone.mjs +2 -2
- 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-gradient-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-image-editor.mjs +75 -11
- package/fesm2022/ngx-kit-image-editor.mjs.map +1 -1
- package/fesm2022/ngx-kit-menu.mjs +8 -8
- package/fesm2022/ngx-kit-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +2 -2
- package/fesm2022/ngx-kit-message.mjs.map +1 -1
- package/fesm2022/ngx-kit-notify.mjs.map +1 -1
- package/fesm2022/ngx-kit-shared.mjs +2 -2
- package/fesm2022/ngx-kit-shared.mjs.map +1 -1
- package/fesm2022/ngx-kit-time-picker.mjs +2 -2
- package/fesm2022/ngx-kit-time-picker.mjs.map +1 -1
- package/gallery/README.md +71 -71
- package/gradient-picker/README.md +41 -41
- package/menu/README.md +85 -85
- package/message/README.md +70 -70
- package/notify/README.md +58 -58
- package/package.json +1 -1
- package/shared/README.md +117 -117
- package/time-picker/README.md +95 -95
- package/types/ngx-kit-date-picker.d.ts +303 -36
- package/types/ngx-kit-drawer-menu.d.ts +97 -86
- package/types/ngx-kit-dropzone.d.ts +5 -5
- package/types/ngx-kit-image-editor.d.ts +29 -4
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# NgxInput
|
|
2
|
-
|
|
3
|
-
## Comming Soon...
|
|
1
|
+
# NgxInput
|
|
2
|
+
|
|
3
|
+
## Comming Soon...
|
package/angle-selector/README.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# ngx-kit/angle-selector
|
|
2
|
-
|
|
3
|
-
An angle picker (0 to 360 degrees) with a draggable circular handle — for setting a gradient's direction, a shadow's rotation, or any other angular value.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<ngx-input-angle [(ngModel)]="angle"></ngx-input-angle>
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Or on a plain input:
|
|
18
|
-
|
|
19
|
-
```html
|
|
20
|
-
<input type="number" [ngxInputAngle]="angle" (change)="angle = $event" />
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## API
|
|
24
|
-
|
|
25
|
-
| Input | Type | Default | Description |
|
|
26
|
-
| --- | --- | --- | --- |
|
|
27
|
-
| `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | Component theme |
|
|
28
|
-
| `change` *(directive)* | `EventEmitter<number>` | | The new angle (in degrees) |
|
|
29
|
-
|
|
30
|
-
The value is always a number between `0` and `360`.
|
|
31
|
-
|
|
32
|
-
## Dark mode and RTL
|
|
33
|
-
|
|
34
|
-
Supported automatically. The handle is implemented with RxJS (`switchMap` + `takeUntil` + `takeUntilDestroyed`), so drag listeners are only ever active during an actual drag.
|
|
1
|
+
# ngx-kit/angle-selector
|
|
2
|
+
|
|
3
|
+
An angle picker (0 to 360 degrees) with a draggable circular handle — for setting a gradient's direction, a shadow's rotation, or any other angular value.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<ngx-input-angle [(ngModel)]="angle"></ngx-input-angle>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or on a plain input:
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<input type="number" [ngxInputAngle]="angle" (change)="angle = $event" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
| Input | Type | Default | Description |
|
|
26
|
+
| --- | --- | --- | --- |
|
|
27
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | Component theme |
|
|
28
|
+
| `change` *(directive)* | `EventEmitter<number>` | | The new angle (in degrees) |
|
|
29
|
+
|
|
30
|
+
The value is always a number between `0` and `360`.
|
|
31
|
+
|
|
32
|
+
## Dark mode and RTL
|
|
33
|
+
|
|
34
|
+
Supported automatically. The handle is implemented with RxJS (`switchMap` + `takeUntil` + `takeUntilDestroyed`), so drag listeners are only ever active during an actual drag.
|
package/box-shadow/README.md
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# ngx-kit/box-shadow
|
|
2
|
-
|
|
3
|
-
A visual `box-shadow` builder: drag the shadow's offset on a 2D pad with mouse/touch, plus controls for blur, spread, and color.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<ngx-box-shadow [(ngModel)]="shadowCss"></ngx-box-shadow>
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Or on a plain input:
|
|
18
|
-
|
|
19
|
-
```html
|
|
20
|
-
<input type="text" [ngxInputBoxShadow]="shadowCss" (change)="shadowCss = $event" />
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
The output is a valid CSS string like `0px 4px 12px 0px rgba(0,0,0,0.25)`.
|
|
24
|
-
|
|
25
|
-
## API
|
|
26
|
-
|
|
27
|
-
| Input | Type | Default | Description |
|
|
28
|
-
| --- | --- | --- | --- |
|
|
29
|
-
| `setInputBackground` *(directive)* | `boolean` | `true` | Shows the shadow color as the input's background |
|
|
30
|
-
|
|
31
|
-
## Dark mode and RTL
|
|
32
|
-
|
|
33
|
-
Supported automatically. The shadow-offset pad is implemented with Pointer Capture (no global `document` listener needed), so it works smoothly on mobile too.
|
|
1
|
+
# ngx-kit/box-shadow
|
|
2
|
+
|
|
3
|
+
A visual `box-shadow` builder: drag the shadow's offset on a 2D pad with mouse/touch, plus controls for blur, spread, and color.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<ngx-box-shadow [(ngModel)]="shadowCss"></ngx-box-shadow>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or on a plain input:
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<input type="text" [ngxInputBoxShadow]="shadowCss" (change)="shadowCss = $event" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The output is a valid CSS string like `0px 4px 12px 0px rgba(0,0,0,0.25)`.
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
| Input | Type | Default | Description |
|
|
28
|
+
| --- | --- | --- | --- |
|
|
29
|
+
| `setInputBackground` *(directive)* | `boolean` | `true` | Shows the shadow color as the input's background |
|
|
30
|
+
|
|
31
|
+
## Dark mode and RTL
|
|
32
|
+
|
|
33
|
+
Supported automatically. The shadow-offset pad is implemented with Pointer Capture (no global `document` listener needed), so it works smoothly on mobile too.
|
package/color-picker/README.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
# ngx-kit/color-picker
|
|
2
|
-
|
|
3
|
-
A complete color picker: a visual picker (saturation/hue), RGB/HSL/CMYK/HEX inputs, an alpha channel, and support for the browser's EyeDropper API to pick a color from anywhere on the screen.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage as a component
|
|
12
|
-
|
|
13
|
-
```html
|
|
14
|
-
<ngx-input-color [(ngModel)]="color" [outputType]="'HEX'" [defaultInspector]="ColorInspector.Picker"></ngx-input-color>
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
`NgxInputColorComponent` is a full `ControlValueAccessor`, so it works with `ngModel`, `formControl`, and `formControlName`.
|
|
18
|
-
|
|
19
|
-
## Usage as a directive (on a plain input)
|
|
20
|
-
|
|
21
|
-
```html
|
|
22
|
-
<input type="text" [ngxInputColor]="color" (change)="color = $event" [outputType]="'RGB'" />
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## API
|
|
26
|
-
|
|
27
|
-
### `<ngx-input-color>` / `[ngxInputColor]`
|
|
28
|
-
|
|
29
|
-
| Input | Type | Default | Description |
|
|
30
|
-
| --- | --- | --- | --- |
|
|
31
|
-
| `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | `'auto'` follows the browser's `prefers-color-scheme` |
|
|
32
|
-
| `simpleMode` | `boolean` | `false` | A more compact UI |
|
|
33
|
-
| `outputType` | `'HEX' \| 'RGB' \| 'HSL' \| 'HSV' \| 'CMYK'` | `'HEX'` | Output string format |
|
|
34
|
-
| `defaultInspector` | `ColorInspector` (`Picker \| RGB \| HSL \| CMYK`) | `Picker` | Which tab is open by default |
|
|
35
|
-
| `useAlphaChannel` | `boolean` | `true` | Show/hide the alpha (transparency) channel |
|
|
36
|
-
| `setInputBackgroundColor` *(directive only)* | `boolean` | `true` | Sets the input's own background to the selected color |
|
|
37
|
-
| `change` *(output, directive only)* | `EventEmitter<string>` | | The new value whenever the color changes |
|
|
38
|
-
|
|
39
|
-
### Input/output formats
|
|
40
|
-
|
|
41
|
-
The value can be any of: `#rrggbb`, `#rrggbbaa` (including 3- and 4-character shorthand with alpha), `rgb()`/`rgba()`, `hsl()`/`hsla()`.
|
|
42
|
-
|
|
43
|
-
## EyeDropper
|
|
44
|
-
|
|
45
|
-
If the user's browser supports the [EyeDropper API](https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper) (recent Chrome/Edge), the eyedropper button is enabled automatically and the user can pick a color from anywhere on the page (even outside the browser). On browsers without support, the button stays hidden.
|
|
46
|
-
|
|
47
|
-
## Dark mode and RTL
|
|
48
|
-
|
|
49
|
-
Supported automatically.
|
|
1
|
+
# ngx-kit/color-picker
|
|
2
|
+
|
|
3
|
+
A complete color picker: a visual picker (saturation/hue), RGB/HSL/CMYK/HEX inputs, an alpha channel, and support for the browser's EyeDropper API to pick a color from anywhere on the screen.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage as a component
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<ngx-input-color [(ngModel)]="color" [outputType]="'HEX'" [defaultInspector]="ColorInspector.Picker"></ngx-input-color>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`NgxInputColorComponent` is a full `ControlValueAccessor`, so it works with `ngModel`, `formControl`, and `formControlName`.
|
|
18
|
+
|
|
19
|
+
## Usage as a directive (on a plain input)
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<input type="text" [ngxInputColor]="color" (change)="color = $event" [outputType]="'RGB'" />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
### `<ngx-input-color>` / `[ngxInputColor]`
|
|
28
|
+
|
|
29
|
+
| Input | Type | Default | Description |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | `'auto'` follows the browser's `prefers-color-scheme` |
|
|
32
|
+
| `simpleMode` | `boolean` | `false` | A more compact UI |
|
|
33
|
+
| `outputType` | `'HEX' \| 'RGB' \| 'HSL' \| 'HSV' \| 'CMYK'` | `'HEX'` | Output string format |
|
|
34
|
+
| `defaultInspector` | `ColorInspector` (`Picker \| RGB \| HSL \| CMYK`) | `Picker` | Which tab is open by default |
|
|
35
|
+
| `useAlphaChannel` | `boolean` | `true` | Show/hide the alpha (transparency) channel |
|
|
36
|
+
| `setInputBackgroundColor` *(directive only)* | `boolean` | `true` | Sets the input's own background to the selected color |
|
|
37
|
+
| `change` *(output, directive only)* | `EventEmitter<string>` | | The new value whenever the color changes |
|
|
38
|
+
|
|
39
|
+
### Input/output formats
|
|
40
|
+
|
|
41
|
+
The value can be any of: `#rrggbb`, `#rrggbbaa` (including 3- and 4-character shorthand with alpha), `rgb()`/`rgba()`, `hsl()`/`hsla()`.
|
|
42
|
+
|
|
43
|
+
## EyeDropper
|
|
44
|
+
|
|
45
|
+
If the user's browser supports the [EyeDropper API](https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper) (recent Chrome/Edge), the eyedropper button is enabled automatically and the user can pick a color from anywhere on the page (even outside the browser). On browsers without support, the button stays hidden.
|
|
46
|
+
|
|
47
|
+
## Dark mode and RTL
|
|
48
|
+
|
|
49
|
+
Supported automatically.
|
package/data-table/README.md
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
# ngx-kit/data-table
|
|
2
|
-
|
|
3
|
-
A signal-based data table with full type-safety: column and custom renderer definitions are typed so TypeScript itself catches invalid columns or a wrong `rendererInputs`. Single/multi-column sorting, pagination, lazy (server-side) mode, and column resizing via Pointer Capture.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Registering renderers (optional, but recommended)
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
// app.config.ts
|
|
15
|
-
import { provideTable, defineRenderers } from 'ngx-kit/data-table';
|
|
16
|
-
import { AvatarCellRenderer, BooleanCellRenderer } from './cell-renderers';
|
|
17
|
-
|
|
18
|
-
export const appConfig: ApplicationConfig = {
|
|
19
|
-
providers: [
|
|
20
|
-
provideTable({
|
|
21
|
-
renderers: defineRenderers({ avatar: AvatarCellRenderer, boolean: BooleanCellRenderer }),
|
|
22
|
-
column: { minWidth: 80, maxWidth: 480, defaultWidth: 160 },
|
|
23
|
-
}),
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Type-safe column definitions
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
interface Tenant {
|
|
32
|
-
avatarUrl: string;
|
|
33
|
-
name: string;
|
|
34
|
-
isActive: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const renderers = defineRenderers({ avatar: AvatarCellRenderer, boolean: BooleanCellRenderer });
|
|
38
|
-
|
|
39
|
-
const fields = defineFields<Tenant, typeof renderers>(renderers, [
|
|
40
|
-
{ column: 'avatarUrl', title: 'User', renderer: 'avatar', rendererInputs: { showName: true } }, // ✅ type-checked
|
|
41
|
-
{ column: 'name', title: 'Name', sortable: true },
|
|
42
|
-
{ column: 'isActive', title: 'Active', renderer: 'boolean', align: 'center' },
|
|
43
|
-
]);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
If `column` isn't a real field of `Tenant`, or `renderer` isn't a real key of the registry, or `rendererInputs` doesn't match that renderer's actual inputs — it's a compile error, not a runtime one.
|
|
47
|
-
|
|
48
|
-
## Usage in a template
|
|
49
|
-
|
|
50
|
-
```html
|
|
51
|
-
<ngx-table
|
|
52
|
-
[fields]="fields"
|
|
53
|
-
[data]="tenants"
|
|
54
|
-
[totalRecords]="tenants.length"
|
|
55
|
-
[pageSize]="20"
|
|
56
|
-
(sortChange)="onSortChange($event)"
|
|
57
|
-
></ngx-table>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Lazy mode (server-side pagination/sorting)
|
|
61
|
-
|
|
62
|
-
```html
|
|
63
|
-
<ngx-table [fields]="fields" [data]="page" [totalRecords]="total" [lazy]="true" (lazyLoad)="fetchPage($event)"></ngx-table>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
fetchPage(ev: LazyLoadEvent<Tenant>) {
|
|
68
|
-
// ev.pageIndex, ev.pageSize, ev.first, ev.sorts
|
|
69
|
-
this.api.getTenants(ev).subscribe((res) => { this.page = res.data; this.total = res.total; });
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## API
|
|
74
|
-
|
|
75
|
-
### `<ngx-table>` inputs
|
|
76
|
-
|
|
77
|
-
| Input | Type | Description |
|
|
78
|
-
| --- | --- | --- |
|
|
79
|
-
| `fields` | `TableField<T, R>[]` **(required)** | Column definitions (from `defineFields`) |
|
|
80
|
-
| `data` | `readonly T[]` **(required)** | Current page's data |
|
|
81
|
-
| `totalRecords` | `number` **(required)** | Total row count (for pagination) |
|
|
82
|
-
| `pageSize` | `number` | Defaults from `provideTable` |
|
|
83
|
-
| `lazy` | `boolean` | If `true`, your app manages sorting/pagination (not the table) |
|
|
84
|
-
| `loading` | `boolean` | Shows a loading state |
|
|
85
|
-
| `showRecordNumber` | `boolean` | Shows a row-number column |
|
|
86
|
-
|
|
87
|
-
### Outputs
|
|
88
|
-
|
|
89
|
-
| Output | Type | Description |
|
|
90
|
-
| --- | --- | --- |
|
|
91
|
-
| `sortChange` | `SortMeta<T>[]` | Sort change (non-lazy mode) |
|
|
92
|
-
| `lazyLoad` | `LazyLoadEvent<T>` | New page/sort (lazy mode) — includes `pageIndex`, `pageSize`, `first`, `sorts` |
|
|
93
|
-
| `columnResize` | `{ field: string; width: number }` | A column's width changed |
|
|
94
|
-
|
|
95
|
-
### Defining a custom renderer
|
|
96
|
-
|
|
97
|
-
```ts
|
|
98
|
-
@Component({
|
|
99
|
-
standalone: true,
|
|
100
|
-
selector: 'app-avatar-cell',
|
|
101
|
-
template: `<img [src]="value()" /><span *ngIf="showName()">{{ row().name }}</span>`,
|
|
102
|
-
})
|
|
103
|
-
export class AvatarCellRenderer implements CellRendererComponent<string, Tenant> {
|
|
104
|
-
value = input.required<string>();
|
|
105
|
-
row = input.required<Tenant>();
|
|
106
|
-
field = input.required<TableFieldBase<Tenant>>();
|
|
107
|
-
showName = input(false); // automatically usable in rendererInputs for this column
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Dark mode and RTL
|
|
112
|
-
|
|
113
|
-
Supported automatically.
|
|
1
|
+
# ngx-kit/data-table
|
|
2
|
+
|
|
3
|
+
A signal-based data table with full type-safety: column and custom renderer definitions are typed so TypeScript itself catches invalid columns or a wrong `rendererInputs`. Single/multi-column sorting, pagination, lazy (server-side) mode, and column resizing via Pointer Capture.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Registering renderers (optional, but recommended)
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// app.config.ts
|
|
15
|
+
import { provideTable, defineRenderers } from 'ngx-kit/data-table';
|
|
16
|
+
import { AvatarCellRenderer, BooleanCellRenderer } from './cell-renderers';
|
|
17
|
+
|
|
18
|
+
export const appConfig: ApplicationConfig = {
|
|
19
|
+
providers: [
|
|
20
|
+
provideTable({
|
|
21
|
+
renderers: defineRenderers({ avatar: AvatarCellRenderer, boolean: BooleanCellRenderer }),
|
|
22
|
+
column: { minWidth: 80, maxWidth: 480, defaultWidth: 160 },
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Type-safe column definitions
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
interface Tenant {
|
|
32
|
+
avatarUrl: string;
|
|
33
|
+
name: string;
|
|
34
|
+
isActive: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const renderers = defineRenderers({ avatar: AvatarCellRenderer, boolean: BooleanCellRenderer });
|
|
38
|
+
|
|
39
|
+
const fields = defineFields<Tenant, typeof renderers>(renderers, [
|
|
40
|
+
{ column: 'avatarUrl', title: 'User', renderer: 'avatar', rendererInputs: { showName: true } }, // ✅ type-checked
|
|
41
|
+
{ column: 'name', title: 'Name', sortable: true },
|
|
42
|
+
{ column: 'isActive', title: 'Active', renderer: 'boolean', align: 'center' },
|
|
43
|
+
]);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If `column` isn't a real field of `Tenant`, or `renderer` isn't a real key of the registry, or `rendererInputs` doesn't match that renderer's actual inputs — it's a compile error, not a runtime one.
|
|
47
|
+
|
|
48
|
+
## Usage in a template
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<ngx-table
|
|
52
|
+
[fields]="fields"
|
|
53
|
+
[data]="tenants"
|
|
54
|
+
[totalRecords]="tenants.length"
|
|
55
|
+
[pageSize]="20"
|
|
56
|
+
(sortChange)="onSortChange($event)"
|
|
57
|
+
></ngx-table>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Lazy mode (server-side pagination/sorting)
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<ngx-table [fields]="fields" [data]="page" [totalRecords]="total" [lazy]="true" (lazyLoad)="fetchPage($event)"></ngx-table>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
fetchPage(ev: LazyLoadEvent<Tenant>) {
|
|
68
|
+
// ev.pageIndex, ev.pageSize, ev.first, ev.sorts
|
|
69
|
+
this.api.getTenants(ev).subscribe((res) => { this.page = res.data; this.total = res.total; });
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## API
|
|
74
|
+
|
|
75
|
+
### `<ngx-table>` inputs
|
|
76
|
+
|
|
77
|
+
| Input | Type | Description |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| `fields` | `TableField<T, R>[]` **(required)** | Column definitions (from `defineFields`) |
|
|
80
|
+
| `data` | `readonly T[]` **(required)** | Current page's data |
|
|
81
|
+
| `totalRecords` | `number` **(required)** | Total row count (for pagination) |
|
|
82
|
+
| `pageSize` | `number` | Defaults from `provideTable` |
|
|
83
|
+
| `lazy` | `boolean` | If `true`, your app manages sorting/pagination (not the table) |
|
|
84
|
+
| `loading` | `boolean` | Shows a loading state |
|
|
85
|
+
| `showRecordNumber` | `boolean` | Shows a row-number column |
|
|
86
|
+
|
|
87
|
+
### Outputs
|
|
88
|
+
|
|
89
|
+
| Output | Type | Description |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| `sortChange` | `SortMeta<T>[]` | Sort change (non-lazy mode) |
|
|
92
|
+
| `lazyLoad` | `LazyLoadEvent<T>` | New page/sort (lazy mode) — includes `pageIndex`, `pageSize`, `first`, `sorts` |
|
|
93
|
+
| `columnResize` | `{ field: string; width: number }` | A column's width changed |
|
|
94
|
+
|
|
95
|
+
### Defining a custom renderer
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
@Component({
|
|
99
|
+
standalone: true,
|
|
100
|
+
selector: 'app-avatar-cell',
|
|
101
|
+
template: `<img [src]="value()" /><span *ngIf="showName()">{{ row().name }}</span>`,
|
|
102
|
+
})
|
|
103
|
+
export class AvatarCellRenderer implements CellRendererComponent<string, Tenant> {
|
|
104
|
+
value = input.required<string>();
|
|
105
|
+
row = input.required<Tenant>();
|
|
106
|
+
field = input.required<TableFieldBase<Tenant>>();
|
|
107
|
+
showName = input(false); // automatically usable in rendererInputs for this column
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Dark mode and RTL
|
|
112
|
+
|
|
113
|
+
Supported automatically.
|
package/date-picker/README.md
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# ngx-kit/date-picker
|
|
2
|
-
|
|
3
|
-
A date picker supporting four calendar systems: Gregorian, Jalali (Persian), Hijri (Islamic), and Chinese — built on an adapter-based architecture that also makes it possible to add other calendars. It also ships a standalone calendar component (`ngx-calendar`) usable without any inputs.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install ngx-kit
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Setup
|
|
12
|
-
|
|
13
|
-
Calendar adapters need to be provided (the default provides all four; if you only need some of them, the bundle stays smaller since each is lazily imported):
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
// app.config.ts
|
|
17
|
-
import { provideDateAdapters } from 'ngx-kit/date-picker';
|
|
18
|
-
|
|
19
|
-
export const appConfig: ApplicationConfig = {
|
|
20
|
-
providers: [provideDateAdapters()],
|
|
21
|
-
};
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
```html
|
|
27
|
-
<input type="text" [ngxInputDatePicker]="date" (change)="date = $event" [locale]="'fa'" [displayFormat]="'yyyy/MM/dd'" />
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
```html
|
|
31
|
-
<ngx-calendar [locale]="'fa'" [theme]="'auto'"></ngx-calendar>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## API
|
|
35
|
-
|
|
36
|
-
### `[ngxInputDatePicker]`
|
|
37
|
-
|
|
38
|
-
| Input | Type | Default | Description |
|
|
39
|
-
| --- | --- | --- | --- |
|
|
40
|
-
| `locale` | `string` (`'en'`, `'fa'`, `'hi'`, `'zh'`, or any custom registered locale) | `'en'` | Which calendar to use |
|
|
41
|
-
| `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | |
|
|
42
|
-
| `displayFormat` | `string` | `'yyyy/MM/dd'` | Text display format for the date |
|
|
43
|
-
| `min` / `max` | `Date` | | Allowed range |
|
|
44
|
-
| `config` | `NgxDatePickerConfig` | | Show/hide and text for the "today"/"clear" buttons, custom icon templates |
|
|
45
|
-
| `change` *(output)* | `EventEmitter<Date>` | | The selected date (always a standard JavaScript `Date`, regardless of the displayed calendar) |
|
|
46
|
-
|
|
47
|
-
### `getLocals()`
|
|
48
|
-
|
|
49
|
-
Returns the list of currently registered locales (e.g. to populate a language `<select>`):
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
availableLocals = getLocals(); // ['en', 'fa', 'hi', 'zh']
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Adding a custom calendar
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
provideDateAdapters({ locale: 'ja', useClass: MyJapaneseAdapter });
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
`MyJapaneseAdapter` must implement the `IDateAdapter` interface.
|
|
62
|
-
|
|
63
|
-
## Performance note
|
|
64
|
-
|
|
65
|
-
The Hijri and Chinese calendars (which are table/astronomical-based, unlike the formulaic Gregorian/Jalali ones) cache their computation results internally — since rendering a calendar month calls the date computation separately for every day cell, without caching this could take several hundred milliseconds for years far from today.
|
|
66
|
-
|
|
67
|
-
## Dark mode and RTL
|
|
68
|
-
|
|
69
|
-
Supported automatically (the Jalali/Hijri calendars are naturally RTL too).
|
|
1
|
+
# ngx-kit/date-picker
|
|
2
|
+
|
|
3
|
+
A date picker supporting four calendar systems: Gregorian, Jalali (Persian), Hijri (Islamic), and Chinese — built on an adapter-based architecture that also makes it possible to add other calendars. It also ships a standalone calendar component (`ngx-calendar`) usable without any inputs.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install ngx-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Calendar adapters need to be provided (the default provides all four; if you only need some of them, the bundle stays smaller since each is lazily imported):
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// app.config.ts
|
|
17
|
+
import { provideDateAdapters } from 'ngx-kit/date-picker';
|
|
18
|
+
|
|
19
|
+
export const appConfig: ApplicationConfig = {
|
|
20
|
+
providers: [provideDateAdapters()],
|
|
21
|
+
};
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<input type="text" [ngxInputDatePicker]="date" (change)="date = $event" [locale]="'fa'" [displayFormat]="'yyyy/MM/dd'" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<ngx-calendar [locale]="'fa'" [theme]="'auto'"></ngx-calendar>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
### `[ngxInputDatePicker]`
|
|
37
|
+
|
|
38
|
+
| Input | Type | Default | Description |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| `locale` | `string` (`'en'`, `'fa'`, `'hi'`, `'zh'`, or any custom registered locale) | `'en'` | Which calendar to use |
|
|
41
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | |
|
|
42
|
+
| `displayFormat` | `string` | `'yyyy/MM/dd'` | Text display format for the date |
|
|
43
|
+
| `min` / `max` | `Date` | | Allowed range |
|
|
44
|
+
| `config` | `NgxDatePickerConfig` | | Show/hide and text for the "today"/"clear" buttons, custom icon templates |
|
|
45
|
+
| `change` *(output)* | `EventEmitter<Date>` | | The selected date (always a standard JavaScript `Date`, regardless of the displayed calendar) |
|
|
46
|
+
|
|
47
|
+
### `getLocals()`
|
|
48
|
+
|
|
49
|
+
Returns the list of currently registered locales (e.g. to populate a language `<select>`):
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
availableLocals = getLocals(); // ['en', 'fa', 'hi', 'zh']
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Adding a custom calendar
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
provideDateAdapters({ locale: 'ja', useClass: MyJapaneseAdapter });
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`MyJapaneseAdapter` must implement the `IDateAdapter` interface.
|
|
62
|
+
|
|
63
|
+
## Performance note
|
|
64
|
+
|
|
65
|
+
The Hijri and Chinese calendars (which are table/astronomical-based, unlike the formulaic Gregorian/Jalali ones) cache their computation results internally — since rendering a calendar month calls the date computation separately for every day cell, without caching this could take several hundred milliseconds for years far from today.
|
|
66
|
+
|
|
67
|
+
## Dark mode and RTL
|
|
68
|
+
|
|
69
|
+
Supported automatically (the Jalali/Hijri calendars are naturally RTL too).
|