ngx-kit 6.0.1 → 6.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 +11 -11
- package/box-shadow/README.md +10 -10
- package/color-picker/README.md +20 -23
- package/data-table/README.md +34 -41
- package/date-picker/README.md +21 -26
- package/dialog/README.md +31 -33
- package/drawer-menu/README.md +51 -50
- package/dropzone/README.md +395 -32
- 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 +2 -2
- package/fesm2022/ngx-kit-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-data-table.mjs +68 -26
- package/fesm2022/ngx-kit-data-table.mjs.map +1 -1
- package/fesm2022/ngx-kit-dropzone.mjs +274 -29
- package/fesm2022/ngx-kit-dropzone.mjs.map +1 -1
- package/fesm2022/ngx-kit-form-field.mjs +129 -64
- 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 +2 -2
- package/fesm2022/ngx-kit-gradient-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-image-editor.mjs +33 -10
- package/fesm2022/ngx-kit-image-editor.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +5 -0
- package/fesm2022/ngx-kit-message.mjs.map +1 -1
- package/fesm2022/ngx-kit-time-picker.mjs +17 -4
- package/fesm2022/ngx-kit-time-picker.mjs.map +1 -1
- package/gallery/README.md +29 -29
- package/gradient-picker/README.md +16 -16
- package/image-editor/README.md +19 -19
- package/menu/README.md +27 -27
- package/message/README.md +34 -34
- package/notify/README.md +25 -23
- package/package.json +1 -1
- package/shared/README.md +32 -32
- package/time-picker/README.md +95 -0
- package/types/ngx-kit-data-table.d.ts +25 -5
- package/types/ngx-kit-dropzone.d.ts +129 -18
- package/types/ngx-kit-form-field.d.ts +65 -27
- package/types/ngx-kit-image-editor.d.ts +23 -3
- package/types/ngx-kit-time-picker.d.ts +19 -14
package/angle-selector/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# ngx-kit/angle-selector
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install ngx-kit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage
|
|
12
12
|
|
|
13
13
|
```html
|
|
14
14
|
<ngx-input-angle [(ngModel)]="angle"></ngx-input-angle>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Or on a plain input:
|
|
18
18
|
|
|
19
19
|
```html
|
|
20
20
|
<input type="number" [ngxInputAngle]="angle" (change)="angle = $event" />
|
|
@@ -22,13 +22,13 @@ npm install ngx-kit
|
|
|
22
22
|
|
|
23
23
|
## API
|
|
24
24
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
| `theme`
|
|
28
|
-
| `change`
|
|
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
29
|
|
|
30
|
-
|
|
30
|
+
The value is always a number between `0` and `360`.
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Dark mode and RTL
|
|
33
33
|
|
|
34
|
-
|
|
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
1
|
# ngx-kit/box-shadow
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install ngx-kit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage
|
|
12
12
|
|
|
13
13
|
```html
|
|
14
14
|
<ngx-box-shadow [(ngModel)]="shadowCss"></ngx-box-shadow>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Or on a plain input:
|
|
18
18
|
|
|
19
19
|
```html
|
|
20
20
|
<input type="text" [ngxInputBoxShadow]="shadowCss" (change)="shadowCss = $event" />
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The output is a valid CSS string like `0px 4px 12px 0px rgba(0,0,0,0.25)`.
|
|
24
24
|
|
|
25
25
|
## API
|
|
26
26
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
| `setInputBackground`
|
|
27
|
+
| Input | Type | Default | Description |
|
|
28
|
+
| --- | --- | --- | --- |
|
|
29
|
+
| `setInputBackground` *(directive)* | `boolean` | `true` | Shows the shadow color as the input's background |
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Dark mode and RTL
|
|
32
32
|
|
|
33
|
-
|
|
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,25 +1,22 @@
|
|
|
1
1
|
# ngx-kit/color-picker
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install ngx-kit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage as a component
|
|
12
12
|
|
|
13
13
|
```html
|
|
14
|
-
<ngx-input-color
|
|
15
|
-
[(ngModel)]="color"
|
|
16
|
-
[outputType]="'HEX'"
|
|
17
|
-
[defaultInspector]="ColorInspector.Picker"></ngx-input-color>
|
|
14
|
+
<ngx-input-color [(ngModel)]="color" [outputType]="'HEX'" [defaultInspector]="ColorInspector.Picker"></ngx-input-color>
|
|
18
15
|
```
|
|
19
16
|
|
|
20
|
-
`NgxInputColorComponent`
|
|
17
|
+
`NgxInputColorComponent` is a full `ControlValueAccessor`, so it works with `ngModel`, `formControl`, and `formControlName`.
|
|
21
18
|
|
|
22
|
-
##
|
|
19
|
+
## Usage as a directive (on a plain input)
|
|
23
20
|
|
|
24
21
|
```html
|
|
25
22
|
<input type="text" [ngxInputColor]="color" (change)="color = $event" [outputType]="'RGB'" />
|
|
@@ -29,24 +26,24 @@ npm install ngx-kit
|
|
|
29
26
|
|
|
30
27
|
### `<ngx-input-color>` / `[ngxInputColor]`
|
|
31
28
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
| `theme`
|
|
35
|
-
| `simpleMode`
|
|
36
|
-
| `outputType`
|
|
37
|
-
| `defaultInspector`
|
|
38
|
-
| `useAlphaChannel`
|
|
39
|
-
| `setInputBackgroundColor`
|
|
40
|
-
| `change`
|
|
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 |
|
|
41
38
|
|
|
42
|
-
###
|
|
39
|
+
### Input/output formats
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
The value can be any of: `#rrggbb`, `#rrggbbaa` (including 3- and 4-character shorthand with alpha), `rgb()`/`rgba()`, `hsl()`/`hsla()`.
|
|
45
42
|
|
|
46
43
|
## EyeDropper
|
|
47
44
|
|
|
48
|
-
|
|
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.
|
|
49
46
|
|
|
50
|
-
##
|
|
47
|
+
## Dark mode and RTL
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
Supported automatically.
|
package/data-table/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# ngx-kit/data-table
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install ngx-kit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Registering renderers (optional, but recommended)
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
// app.config.ts
|
|
@@ -25,7 +25,7 @@ export const appConfig: ApplicationConfig = {
|
|
|
25
25
|
};
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Type-safe column definitions
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
31
|
interface Tenant {
|
|
@@ -37,15 +37,15 @@ interface Tenant {
|
|
|
37
37
|
const renderers = defineRenderers({ avatar: AvatarCellRenderer, boolean: BooleanCellRenderer });
|
|
38
38
|
|
|
39
39
|
const fields = defineFields<Tenant, typeof renderers>(renderers, [
|
|
40
|
-
{ column: 'avatarUrl', title: '
|
|
41
|
-
{ column: 'name', title: '
|
|
42
|
-
{ column: 'isActive', title: '
|
|
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
43
|
]);
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
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
47
|
|
|
48
|
-
##
|
|
48
|
+
## Usage in a template
|
|
49
49
|
|
|
50
50
|
```html
|
|
51
51
|
<ngx-table
|
|
@@ -53,18 +53,14 @@ const fields = defineFields<Tenant, typeof renderers>(renderers, [
|
|
|
53
53
|
[data]="tenants"
|
|
54
54
|
[totalRecords]="tenants.length"
|
|
55
55
|
[pageSize]="20"
|
|
56
|
-
(sortChange)="onSortChange($event)"
|
|
56
|
+
(sortChange)="onSortChange($event)"
|
|
57
|
+
></ngx-table>
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
###
|
|
60
|
+
### Lazy mode (server-side pagination/sorting)
|
|
60
61
|
|
|
61
62
|
```html
|
|
62
|
-
<ngx-table
|
|
63
|
-
[fields]="fields"
|
|
64
|
-
[data]="page"
|
|
65
|
-
[totalRecords]="total"
|
|
66
|
-
[lazy]="true"
|
|
67
|
-
(lazyLoad)="fetchPage($event)"></ngx-table>
|
|
63
|
+
<ngx-table [fields]="fields" [data]="page" [totalRecords]="total" [lazy]="true" (lazyLoad)="fetchPage($event)"></ngx-table>
|
|
68
64
|
```
|
|
69
65
|
|
|
70
66
|
```ts
|
|
@@ -76,45 +72,42 @@ fetchPage(ev: LazyLoadEvent<Tenant>) {
|
|
|
76
72
|
|
|
77
73
|
## API
|
|
78
74
|
|
|
79
|
-
###
|
|
75
|
+
### `<ngx-table>` inputs
|
|
80
76
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
| `fields`
|
|
84
|
-
| `data`
|
|
85
|
-
| `totalRecords`
|
|
86
|
-
| `pageSize`
|
|
87
|
-
| `lazy`
|
|
88
|
-
| `loading`
|
|
89
|
-
| `showRecordNumber` | `boolean`
|
|
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 |
|
|
90
86
|
|
|
91
|
-
###
|
|
87
|
+
### Outputs
|
|
92
88
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
| `sortChange`
|
|
96
|
-
| `lazyLoad`
|
|
97
|
-
| `columnResize` | `{ field: string; width: number }` |
|
|
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 |
|
|
98
94
|
|
|
99
|
-
###
|
|
95
|
+
### Defining a custom renderer
|
|
100
96
|
|
|
101
97
|
```ts
|
|
102
98
|
@Component({
|
|
103
99
|
standalone: true,
|
|
104
100
|
selector: 'app-avatar-cell',
|
|
105
|
-
template:
|
|
106
|
-
<img [src]="value()" />
|
|
107
|
-
<span *ngIf="showName()">{{ row().name }}</span>
|
|
108
|
-
`,
|
|
101
|
+
template: `<img [src]="value()" /><span *ngIf="showName()">{{ row().name }}</span>`,
|
|
109
102
|
})
|
|
110
103
|
export class AvatarCellRenderer implements CellRendererComponent<string, Tenant> {
|
|
111
104
|
value = input.required<string>();
|
|
112
105
|
row = input.required<Tenant>();
|
|
113
106
|
field = input.required<TableFieldBase<Tenant>>();
|
|
114
|
-
showName = input(false); //
|
|
107
|
+
showName = input(false); // automatically usable in rendererInputs for this column
|
|
115
108
|
}
|
|
116
109
|
```
|
|
117
110
|
|
|
118
|
-
##
|
|
111
|
+
## Dark mode and RTL
|
|
119
112
|
|
|
120
|
-
|
|
113
|
+
Supported automatically.
|
package/date-picker/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# ngx-kit/date-picker
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install ngx-kit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Setup
|
|
12
12
|
|
|
13
|
-
|
|
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
14
|
|
|
15
15
|
```ts
|
|
16
16
|
// app.config.ts
|
|
@@ -21,15 +21,10 @@ export const appConfig: ApplicationConfig = {
|
|
|
21
21
|
};
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Usage
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
|
-
<input
|
|
28
|
-
type="text"
|
|
29
|
-
[ngxInputDatePicker]="date"
|
|
30
|
-
(change)="date = $event"
|
|
31
|
-
[locale]="'fa'"
|
|
32
|
-
[displayFormat]="'yyyy/MM/dd'" />
|
|
27
|
+
<input type="text" [ngxInputDatePicker]="date" (change)="date = $event" [locale]="'fa'" [displayFormat]="'yyyy/MM/dd'" />
|
|
33
28
|
```
|
|
34
29
|
|
|
35
30
|
```html
|
|
@@ -40,35 +35,35 @@ export const appConfig: ApplicationConfig = {
|
|
|
40
35
|
|
|
41
36
|
### `[ngxInputDatePicker]`
|
|
42
37
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
| `locale`
|
|
46
|
-
| `theme`
|
|
47
|
-
| `displayFormat`
|
|
48
|
-
| `min` / `max`
|
|
49
|
-
| `config`
|
|
50
|
-
| `change`
|
|
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) |
|
|
51
46
|
|
|
52
47
|
### `getLocals()`
|
|
53
48
|
|
|
54
|
-
|
|
49
|
+
Returns the list of currently registered locales (e.g. to populate a language `<select>`):
|
|
55
50
|
|
|
56
51
|
```ts
|
|
57
52
|
availableLocals = getLocals(); // ['en', 'fa', 'hi', 'zh']
|
|
58
53
|
```
|
|
59
54
|
|
|
60
|
-
###
|
|
55
|
+
### Adding a custom calendar
|
|
61
56
|
|
|
62
57
|
```ts
|
|
63
58
|
provideDateAdapters({ locale: 'ja', useClass: MyJapaneseAdapter });
|
|
64
59
|
```
|
|
65
60
|
|
|
66
|
-
`MyJapaneseAdapter`
|
|
61
|
+
`MyJapaneseAdapter` must implement the `IDateAdapter` interface.
|
|
67
62
|
|
|
68
|
-
##
|
|
63
|
+
## Performance note
|
|
69
64
|
|
|
70
|
-
|
|
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.
|
|
71
66
|
|
|
72
|
-
##
|
|
67
|
+
## Dark mode and RTL
|
|
73
68
|
|
|
74
|
-
|
|
69
|
+
Supported automatically (the Jalali/Hijri calendars are naturally RTL too).
|
package/dialog/README.md
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
# ngx-kit/dialog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Modal/dialog built on the browser's native `<dialog>` — no manual overlay, no third-party library.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## نصب
|
|
5
|
+
## Install
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
8
|
npm install ngx-kit
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Setup
|
|
14
12
|
|
|
15
13
|
```ts
|
|
16
14
|
// app.config.ts
|
|
@@ -22,9 +20,9 @@ export const appConfig: ApplicationConfig = {
|
|
|
22
20
|
};
|
|
23
21
|
```
|
|
24
22
|
|
|
25
|
-
##
|
|
23
|
+
## Opening a dialog
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
With the static API (no manual service injection needed):
|
|
28
26
|
|
|
29
27
|
```ts
|
|
30
28
|
import { Dialog } from 'ngx-kit/dialog';
|
|
@@ -33,19 +31,19 @@ const ref = Dialog.open(MyDialogComponent, {
|
|
|
33
31
|
data: { userId: 42 },
|
|
34
32
|
width: '480px',
|
|
35
33
|
allowCloseOnOutsideClick: true,
|
|
36
|
-
header: { enable: true, title: '
|
|
34
|
+
header: { enable: true, title: 'Edit user', showCloseButton: true },
|
|
37
35
|
});
|
|
38
36
|
|
|
39
|
-
ref.afterClosed.subscribe((result) => console.log('
|
|
37
|
+
ref.afterClosed.subscribe((result) => console.log('Result:', result));
|
|
40
38
|
```
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
Inside the dialog's component:
|
|
43
41
|
|
|
44
42
|
```ts
|
|
45
43
|
@Component({ ... })
|
|
46
44
|
export class MyDialogComponent {
|
|
47
45
|
private ref = inject(NgxDialogRef);
|
|
48
|
-
data = inject(NGX_DIALOG_DATA); //
|
|
46
|
+
data = inject(NGX_DIALOG_DATA); // the data passed via config.data
|
|
49
47
|
|
|
50
48
|
save() {
|
|
51
49
|
this.ref.close({ saved: true });
|
|
@@ -53,13 +51,13 @@ export class MyDialogComponent {
|
|
|
53
51
|
}
|
|
54
52
|
```
|
|
55
53
|
|
|
56
|
-
###
|
|
54
|
+
### Layout directives inside a dialog
|
|
57
55
|
|
|
58
56
|
```html
|
|
59
|
-
<div *ngxDialogHeader
|
|
60
|
-
<div *ngxDialogBody
|
|
57
|
+
<div *ngxDialogHeader>Custom title</div>
|
|
58
|
+
<div *ngxDialogBody>Main content</div>
|
|
61
59
|
<div *ngxDialogFooter>
|
|
62
|
-
<button (click)="save()"
|
|
60
|
+
<button (click)="save()">Save</button>
|
|
63
61
|
</div>
|
|
64
62
|
```
|
|
65
63
|
|
|
@@ -67,28 +65,28 @@ export class MyDialogComponent {
|
|
|
67
65
|
|
|
68
66
|
### `Dialog.open<T>(component, config?)`
|
|
69
67
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| `data`
|
|
73
|
-
| `allowCloseOnOutsideClick`
|
|
74
|
-
| `containerClass`
|
|
75
|
-
| `header.enable` / `header.title` / `header.showCloseButton` |
|
|
76
|
-
| `footer.enable`
|
|
77
|
-
| `width` / `minWidth` / `maxWidth`
|
|
78
|
-
| `height` / `minHeight` / `maxHeight`
|
|
79
|
-
| `injector`
|
|
68
|
+
| `config` field | Type | Default | Description |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| `data` | `T` | `{}` | Data passed to the component inside the dialog |
|
|
71
|
+
| `allowCloseOnOutsideClick` | `boolean` | `false` | Close when clicking the backdrop |
|
|
72
|
+
| `containerClass` | `string` | `'ngx-kit'` | Extra class on the container |
|
|
73
|
+
| `header.enable` / `header.title` / `header.showCloseButton` | | | Default header settings |
|
|
74
|
+
| `footer.enable` | `boolean` | | Show the default footer |
|
|
75
|
+
| `width` / `minWidth` / `maxWidth` | `string` | | Horizontal sizing |
|
|
76
|
+
| `height` / `minHeight` / `maxHeight` | `string` | | Vertical sizing |
|
|
77
|
+
| `injector` | `Injector` | | Custom injector for the inner component |
|
|
80
78
|
|
|
81
79
|
### `NgxDialogRef`
|
|
82
80
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
| `close(result?)`
|
|
86
|
-
| `afterClosed: Observable<any>` |
|
|
81
|
+
| Member | Description |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `close(result?)` | Closes the dialog, optionally passing back a result |
|
|
84
|
+
| `afterClosed: Observable<any>` | Emits `result` after the dialog closes |
|
|
87
85
|
|
|
88
|
-
##
|
|
86
|
+
## SSR note
|
|
89
87
|
|
|
90
|
-
`Dialog.open(...)`
|
|
88
|
+
`Dialog.open(...)` is a static/global API that's perfectly safe for a typical browser app. If you're using Angular SSR, this static instance is shared across concurrent server requests — instead of the static API, inject `NgxOverlayService` directly (which is per-injector/per-request safe).
|
|
91
89
|
|
|
92
|
-
##
|
|
90
|
+
## Dark mode and RTL
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
Supported automatically (`light-dark()` + CSS logical properties).
|