ngx-kit 4.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/angle-selector/README.md +34 -0
- package/box-shadow/README.md +33 -0
- package/color-picker/README.md +52 -0
- package/data-table/README.md +120 -0
- package/date-picker/README.md +74 -0
- package/dialog/README.md +94 -169
- package/drawer-menu/README.md +76 -0
- package/dropzone/README.md +59 -0
- 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 +28 -27
- package/fesm2022/ngx-kit-box-shadow.mjs.map +1 -1
- package/fesm2022/ngx-kit-color-picker.mjs +173 -43
- package/fesm2022/ngx-kit-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-data-table.mjs +446 -191
- package/fesm2022/ngx-kit-data-table.mjs.map +1 -1
- package/fesm2022/ngx-kit-date-picker.mjs +120 -86
- package/fesm2022/ngx-kit-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-dialog.mjs +38 -7
- package/fesm2022/ngx-kit-dialog.mjs.map +1 -1
- package/fesm2022/ngx-kit-drawer-menu.mjs +190 -0
- package/fesm2022/ngx-kit-drawer-menu.mjs.map +1 -0
- package/fesm2022/ngx-kit-dropzone.mjs +272 -0
- package/fesm2022/ngx-kit-dropzone.mjs.map +1 -0
- package/fesm2022/ngx-kit-form-field.mjs +87 -0
- package/fesm2022/ngx-kit-form-field.mjs.map +1 -0
- package/fesm2022/ngx-kit-gallery.mjs +419 -0
- package/fesm2022/ngx-kit-gallery.mjs.map +1 -0
- package/fesm2022/ngx-kit-gradient-picker.mjs +12 -4
- package/fesm2022/ngx-kit-gradient-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-image-editor.mjs +501 -0
- package/fesm2022/ngx-kit-image-editor.mjs.map +1 -0
- package/fesm2022/ngx-kit-menu.mjs +9 -4
- package/fesm2022/ngx-kit-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +58 -24
- package/fesm2022/ngx-kit-message.mjs.map +1 -1
- package/fesm2022/ngx-kit-notify.mjs +10 -4
- package/fesm2022/ngx-kit-notify.mjs.map +1 -1
- package/fesm2022/ngx-kit-shared.mjs +184 -88
- package/fesm2022/ngx-kit-shared.mjs.map +1 -1
- package/fesm2022/ngx-kit-time-picker.mjs +562 -0
- package/fesm2022/ngx-kit-time-picker.mjs.map +1 -0
- package/fesm2022/ngx-kit.mjs.map +1 -1
- package/gallery/README.md +71 -0
- package/gradient-picker/README.md +41 -0
- package/image-editor/README.md +44 -0
- package/menu/README.md +85 -0
- package/message/README.md +70 -0
- package/notify/README.md +56 -0
- package/package.json +25 -1
- package/shared/README.md +117 -0
- package/styles/all.css +27 -0
- package/styles/image-viewer.css +12 -0
- package/types/ngx-kit-box-shadow.d.ts +1 -2
- package/types/ngx-kit-data-table.d.ts +290 -147
- package/types/ngx-kit-date-picker.d.ts +1 -1
- package/types/ngx-kit-dialog.d.ts +1 -0
- package/types/ngx-kit-drawer-menu.d.ts +101 -0
- package/types/ngx-kit-dropzone.d.ts +84 -0
- package/types/ngx-kit-form-field.d.ts +31 -0
- package/types/ngx-kit-gallery.d.ts +168 -0
- package/types/ngx-kit-image-editor.d.ts +175 -0
- package/types/ngx-kit-menu.d.ts +1 -0
- package/types/ngx-kit-message.d.ts +14 -3
- package/types/ngx-kit-notify.d.ts +2 -1
- package/types/ngx-kit-shared.d.ts +70 -15
- package/types/ngx-kit-time-picker.d.ts +150 -0
|
@@ -1,17 +1,62 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken,
|
|
3
|
-
import * as i1 from '@angular/forms';
|
|
4
|
-
import { FormsModule } from '@angular/forms';
|
|
2
|
+
import { InjectionToken, makeEnvironmentProviders, input, inject, TemplateRef, Directive, output, HostListener, model, computed, effect, ChangeDetectionStrategy, Component, signal, DestroyRef, ContentChildren } from '@angular/core';
|
|
5
3
|
import * as i1$1 from '@angular/common';
|
|
6
4
|
import { CommonModule } from '@angular/common';
|
|
7
|
-
import {
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import * as i1 from '@angular/forms';
|
|
7
|
+
import { FormsModule } from '@angular/forms';
|
|
8
|
+
import { DirectionService } from 'ngx-kit/shared';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Identity helper: یک رجیستری رندرر را با inference کامل تعریف میکند.
|
|
12
|
+
* همین آبجکت باید هم در provideTable({ renderers }) و هم در defineFields(renderers, ...)
|
|
13
|
+
* استفاده شود تا کلیدها (و ورودیهای اضافهی هر رندرر) در کل پروژه type-check شوند.
|
|
14
|
+
*/
|
|
15
|
+
function defineRenderers(registry) {
|
|
16
|
+
return registry;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Identity helper برای تعریف ستونهای یک جدول با inference و type-check کامل
|
|
20
|
+
* نسبت به هم مدل داده (T) و هم رجیستری رندررها (R).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const renderers = defineRenderers({ avatar: AvatarCellRenderer, boolean: BooleanCellRenderer });
|
|
24
|
+
*
|
|
25
|
+
* const fields = defineFields<Tenant, typeof renderers>(renderers, [
|
|
26
|
+
* { column: 'avatarUrl', title: 'کاربر', renderer: 'avatar', rendererInputs: { showName: true } }, // ✅
|
|
27
|
+
* { column: 'avatarUrl', title: 'کاربر', renderer: 'avatar', rendererInputs: { showName: 'x' } }, // ❌ باید boolean باشد
|
|
28
|
+
* { column: 'isActive', title: 'فعال', renderer: 'bool' }, // ❌ کلید رجیستری نیست
|
|
29
|
+
* { column: 'ageXYZ', title: '...' }, // ❌ فیلد Tenant نیست
|
|
30
|
+
* ]);
|
|
31
|
+
*/
|
|
32
|
+
function defineFields(_renderers, fields) {
|
|
33
|
+
return fields;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const NGX_TABLE_CONFIG_DEFAULT = {
|
|
37
|
+
showRecordNumber: true,
|
|
38
|
+
hoverable: true,
|
|
39
|
+
multiSort: true,
|
|
40
|
+
resizable: true,
|
|
41
|
+
stickyHeader: true,
|
|
42
|
+
stripedRows: true,
|
|
43
|
+
column: { minWidth: 60, maxWidth: 600, defaultWidth: 150 },
|
|
44
|
+
labels: {
|
|
45
|
+
noData: 'There is no data to display!',
|
|
46
|
+
loading: 'Loading...',
|
|
47
|
+
operation: 'Operation',
|
|
48
|
+
},
|
|
49
|
+
renderers: {},
|
|
50
|
+
formatters: {},
|
|
51
|
+
};
|
|
52
|
+
/** به هر نمونهی ngx-table تزریق میشود. با provideTable() مقداردهی کنید. */
|
|
53
|
+
const NGX_TABLE_CONFIG = new InjectionToken('ngx-table-config', {
|
|
54
|
+
factory: () => NGX_TABLE_CONFIG_DEFAULT,
|
|
11
55
|
});
|
|
56
|
+
|
|
12
57
|
const NGX_PAGINATION_CONFIG_DEFAULT = {
|
|
13
58
|
defaultPageSize: 10,
|
|
14
|
-
pageSizeOptions: [5, 10, 20, 30, 50, 100
|
|
59
|
+
pageSizeOptions: [5, 10, 20, 30, 50, 100],
|
|
15
60
|
labels: {
|
|
16
61
|
first: 'First',
|
|
17
62
|
last: 'Last',
|
|
@@ -21,10 +66,164 @@ const NGX_PAGINATION_CONFIG_DEFAULT = {
|
|
|
21
66
|
to: 'to',
|
|
22
67
|
of: 'of',
|
|
23
68
|
results: 'results',
|
|
24
|
-
perPage: 'Per Page',
|
|
25
69
|
pageSize: 'Page Size',
|
|
26
70
|
},
|
|
27
71
|
};
|
|
72
|
+
const NGX_PAGINATION_CONFIG = new InjectionToken('ngx-pagination-config', {
|
|
73
|
+
factory: () => NGX_PAGINATION_CONFIG_DEFAULT,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
function mergeTableConfig(base, override) {
|
|
77
|
+
if (!override)
|
|
78
|
+
return base;
|
|
79
|
+
return {
|
|
80
|
+
...base,
|
|
81
|
+
...override,
|
|
82
|
+
column: { ...base.column, ...override.column },
|
|
83
|
+
labels: { ...base.labels, ...override.labels },
|
|
84
|
+
renderers: { ...base.renderers, ...override.renderers },
|
|
85
|
+
formatters: { ...base.formatters, ...override.formatters },
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* کانفیگ سراسری <ngx-table>: جهت پیشفرض، حداقل/حداکثر عرض ستون، فعال بودن
|
|
90
|
+
* پیشفرض سورت چندستونه، و از همه مهمتر رجیستری رندررها.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* provideTable({
|
|
94
|
+
* renderers: defineRenderers({ avatar: AvatarCellRenderer, boolean: BooleanCellRenderer }),
|
|
95
|
+
* column: { minWidth: 80, maxWidth: 480, defaultWidth: 160 },
|
|
96
|
+
* })
|
|
97
|
+
*/
|
|
98
|
+
function provideTable(options) {
|
|
99
|
+
return makeEnvironmentProviders([
|
|
100
|
+
{ provide: NGX_TABLE_CONFIG, useValue: mergeTableConfig(NGX_TABLE_CONFIG_DEFAULT, options) },
|
|
101
|
+
]);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function mergePaginationConfig(base, override) {
|
|
105
|
+
if (!override)
|
|
106
|
+
return base;
|
|
107
|
+
return {
|
|
108
|
+
...base,
|
|
109
|
+
...override,
|
|
110
|
+
labels: { ...base.labels, ...override.labels },
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function providePagination(options) {
|
|
114
|
+
return makeEnvironmentProviders([
|
|
115
|
+
{
|
|
116
|
+
provide: NGX_PAGINATION_CONFIG,
|
|
117
|
+
useValue: mergePaginationConfig(NGX_PAGINATION_CONFIG_DEFAULT, options),
|
|
118
|
+
},
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* برای projection قالب سفارشی یک ستون بدون اینکه مجبور باشید cellTemplate را
|
|
124
|
+
* از طریق ViewChild به آبجکت ستون وصل کنید:
|
|
125
|
+
*
|
|
126
|
+
* <ngx-table [fields]="fields" [data]="rows()">
|
|
127
|
+
* <ng-template ngxTableCell="userName" let-row let-value="value">
|
|
128
|
+
* <strong>{{ value }}</strong>
|
|
129
|
+
* </ng-template>
|
|
130
|
+
* </ngx-table>
|
|
131
|
+
*
|
|
132
|
+
* مهم: چون این دایرکتیو در تمپلیت *کامپوننت مصرفکننده* (نه ngx-table) استفاده
|
|
133
|
+
* میشود، باید آن را در آرایهی imports همان کامپوننت (standalone) وارد کنید:
|
|
134
|
+
* imports: [NgxTable, TableCell]
|
|
135
|
+
*
|
|
136
|
+
* محدودیت شناختهشده: context این تمپلیت (row/value) از نوع T دقیق نیست
|
|
137
|
+
* (چون TemplateRef اینجا بهصورت پویا از ContentChildren جمعآوری میشود و
|
|
138
|
+
* اطلاعات جنریک T در آن نقطه از بین میرود). برای type-safety کامل روی
|
|
139
|
+
* row/value، از field.cellTemplate به همراه @ViewChild استفاده کنید (به README
|
|
140
|
+
* بخش «Cell Template کاملاً Type-Safe» مراجعه کنید).
|
|
141
|
+
*/
|
|
142
|
+
class TableCell {
|
|
143
|
+
column = input.required({ ...(ngDevMode ? { debugName: "column" } : /* istanbul ignore next */ {}), alias: 'ngxTableCell' });
|
|
144
|
+
templateRef = inject((TemplateRef));
|
|
145
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: TableCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
146
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.4", type: TableCell, isStandalone: true, selector: "ng-template[ngxTableCell]", inputs: { column: { classPropertyName: "column", publicName: "ngxTableCell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
147
|
+
}
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: TableCell, decorators: [{
|
|
149
|
+
type: Directive,
|
|
150
|
+
args: [{
|
|
151
|
+
selector: 'ng-template[ngxTableCell]',
|
|
152
|
+
standalone: true,
|
|
153
|
+
}]
|
|
154
|
+
}], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxTableCell", required: true }] }] } });
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* دستگیرهی درگ برای ریسایز ستون. روی لبهی «انتهای منطقی» (inline-end) قرار
|
|
158
|
+
* میگیرد، یعنی خودش زیر [dir="rtl"] جابهجا میشود؛ فقط جهت محاسبهی دلتا هم
|
|
159
|
+
* برعکس میشود تا حس درگ همیشه طبیعی باشد.
|
|
160
|
+
*
|
|
161
|
+
* مقدار نهایی توسط جدول در یک Map از عرضها ذخیره میشود (نه در استایل مستقیم
|
|
162
|
+
* ستون)، به همراه علامتگذاری «دستی ریسایز شده» — یعنی بعد از این، هیچ
|
|
163
|
+
* re-render یا تغییر دادهای این عرض را از بین نمیبرد.
|
|
164
|
+
*/
|
|
165
|
+
class ColumnResize {
|
|
166
|
+
startWidth = input.required({ ...(ngDevMode ? { debugName: "startWidth" } : /* istanbul ignore next */ {}), alias: 'ngxColumnResizeWidth' });
|
|
167
|
+
minWidth = input(40, { ...(ngDevMode ? { debugName: "minWidth" } : /* istanbul ignore next */ {}), alias: 'ngxColumnResizeMin' });
|
|
168
|
+
maxWidth = input(1000, { ...(ngDevMode ? { debugName: "maxWidth" } : /* istanbul ignore next */ {}), alias: 'ngxColumnResizeMax' });
|
|
169
|
+
direction = input('ltr', { ...(ngDevMode ? { debugName: "direction" } : /* istanbul ignore next */ {}), alias: 'ngxColumnResizeDir' });
|
|
170
|
+
resizing = output();
|
|
171
|
+
resizeEnd = output();
|
|
172
|
+
dragging = false;
|
|
173
|
+
startX = 0;
|
|
174
|
+
baseWidth = 0;
|
|
175
|
+
onPointerDown(event) {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
event.stopPropagation();
|
|
178
|
+
this.dragging = true;
|
|
179
|
+
this.startX = event.clientX;
|
|
180
|
+
this.baseWidth = this.startWidth();
|
|
181
|
+
event.target.setPointerCapture(event.pointerId);
|
|
182
|
+
}
|
|
183
|
+
onPointerMove(event) {
|
|
184
|
+
if (!this.dragging)
|
|
185
|
+
return;
|
|
186
|
+
this.resizing.emit(this.computeWidth(event.clientX));
|
|
187
|
+
}
|
|
188
|
+
onPointerUp(event) {
|
|
189
|
+
if (!this.dragging)
|
|
190
|
+
return;
|
|
191
|
+
this.dragging = false;
|
|
192
|
+
this.resizeEnd.emit(this.computeWidth(event.clientX));
|
|
193
|
+
}
|
|
194
|
+
computeWidth(clientX) {
|
|
195
|
+
const delta = clientX - this.startX;
|
|
196
|
+
const signedDelta = this.direction() === 'rtl' ? -delta : delta;
|
|
197
|
+
const raw = this.baseWidth + signedDelta;
|
|
198
|
+
return Math.min(this.maxWidth(), Math.max(this.minWidth(), raw));
|
|
199
|
+
}
|
|
200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: ColumnResize, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
201
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.4", type: ColumnResize, isStandalone: true, selector: "[ngxColumnResize]", inputs: { startWidth: { classPropertyName: "startWidth", publicName: "ngxColumnResizeWidth", isSignal: true, isRequired: true, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "ngxColumnResizeMin", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "ngxColumnResizeMax", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "ngxColumnResizeDir", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { resizing: "resizing", resizeEnd: "resizeEnd" }, host: { attributes: { "role": "separator", "aria-orientation": "vertical" }, listeners: { "pointerdown": "onPointerDown($event)", "pointermove": "onPointerMove($event)", "pointerup": "onPointerUp($event)", "pointercancel": "onPointerUp($event)" }, classAttribute: "ngx-table__resize-handle" }, ngImport: i0 });
|
|
202
|
+
}
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: ColumnResize, decorators: [{
|
|
204
|
+
type: Directive,
|
|
205
|
+
args: [{
|
|
206
|
+
selector: '[ngxColumnResize]',
|
|
207
|
+
standalone: true,
|
|
208
|
+
host: {
|
|
209
|
+
class: 'ngx-table__resize-handle',
|
|
210
|
+
role: 'separator',
|
|
211
|
+
'aria-orientation': 'vertical',
|
|
212
|
+
},
|
|
213
|
+
}]
|
|
214
|
+
}], propDecorators: { startWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxColumnResizeWidth", required: true }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxColumnResizeMin", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxColumnResizeMax", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxColumnResizeDir", required: false }] }], resizing: [{ type: i0.Output, args: ["resizing"] }], resizeEnd: [{ type: i0.Output, args: ["resizeEnd"] }], onPointerDown: [{
|
|
215
|
+
type: HostListener,
|
|
216
|
+
args: ['pointerdown', ['$event']]
|
|
217
|
+
}], onPointerMove: [{
|
|
218
|
+
type: HostListener,
|
|
219
|
+
args: ['pointermove', ['$event']]
|
|
220
|
+
}], onPointerUp: [{
|
|
221
|
+
type: HostListener,
|
|
222
|
+
args: ['pointerup', ['$event']]
|
|
223
|
+
}, {
|
|
224
|
+
type: HostListener,
|
|
225
|
+
args: ['pointercancel', ['$event']]
|
|
226
|
+
}] } });
|
|
28
227
|
|
|
29
228
|
class NgxPagination {
|
|
30
229
|
config = inject(NGX_PAGINATION_CONFIG);
|
|
@@ -43,33 +242,20 @@ class NgxPagination {
|
|
|
43
242
|
boundaryCount = input(1, /* @ts-ignore */
|
|
44
243
|
...(ngDevMode ? [{ debugName: "boundaryCount" }] : /* istanbul ignore next */ []));
|
|
45
244
|
paginate = output();
|
|
46
|
-
totalPages = computed(() =>
|
|
47
|
-
return Math.max(1, Math.ceil(this.total() / this.pageSize()));
|
|
48
|
-
}, /* @ts-ignore */
|
|
245
|
+
totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.pageSize())), /* @ts-ignore */
|
|
49
246
|
...(ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []));
|
|
50
|
-
firstItem = computed(() =>
|
|
51
|
-
if (this.total() === 0)
|
|
52
|
-
return 0;
|
|
53
|
-
return (this.page() - 1) * this.pageSize() + 1;
|
|
54
|
-
}, /* @ts-ignore */
|
|
247
|
+
firstItem = computed(() => this.total() === 0 ? 0 : (this.page() - 1) * this.pageSize() + 1, /* @ts-ignore */
|
|
55
248
|
...(ngDevMode ? [{ debugName: "firstItem" }] : /* istanbul ignore next */ []));
|
|
56
|
-
lastItem = computed(() =>
|
|
57
|
-
return Math.min(this.firstItem() + this.pageSize() - 1, this.total());
|
|
58
|
-
}, /* @ts-ignore */
|
|
249
|
+
lastItem = computed(() => Math.min(this.firstItem() + this.pageSize() - 1, this.total()), /* @ts-ignore */
|
|
59
250
|
...(ngDevMode ? [{ debugName: "lastItem" }] : /* istanbul ignore next */ []));
|
|
60
251
|
pages = computed(() => this.buildPages(this.page(), this.totalPages(), this.siblingCount(), this.boundaryCount()), /* @ts-ignore */
|
|
61
252
|
...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
|
|
62
253
|
constructor() {
|
|
254
|
+
// هر تغییری در page/pageSize را برای مصرفکننده امیت کن.
|
|
63
255
|
effect(() => {
|
|
64
|
-
|
|
65
|
-
const pageSize = +this.pageSize();
|
|
66
|
-
// this.pageChange.emit(page);
|
|
67
|
-
debugger;
|
|
68
|
-
this.paginate.emit({
|
|
69
|
-
page,
|
|
70
|
-
pageSize,
|
|
71
|
-
});
|
|
256
|
+
this.paginate.emit({ page: this.page(), pageSize: this.pageSize() });
|
|
72
257
|
});
|
|
258
|
+
// اگر بعد از کوچکشدن total، صفحهی جاری خارج از بازه افتاد، اصلاحش کن.
|
|
73
259
|
effect(() => {
|
|
74
260
|
const max = this.totalPages();
|
|
75
261
|
if (this.page() > max)
|
|
@@ -112,54 +298,40 @@ class NgxPagination {
|
|
|
112
298
|
this.page.set(this.totalPages());
|
|
113
299
|
}
|
|
114
300
|
goto(page) {
|
|
115
|
-
if (typeof page !== 'number')
|
|
301
|
+
if (typeof page !== 'number' || Number.isNaN(page))
|
|
116
302
|
return;
|
|
117
303
|
this.page.set(page);
|
|
118
304
|
}
|
|
305
|
+
onPageSizeChange(value) {
|
|
306
|
+
this.pageSize.set(Number(value));
|
|
307
|
+
this.page.set(1);
|
|
308
|
+
}
|
|
119
309
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxPagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
120
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxPagination, isStandalone: true, selector: "ngx-pagination", inputs: { total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: true, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, siblingCount: { classPropertyName: "siblingCount", publicName: "siblingCount", isSignal: true, isRequired: false, transformFunction: null }, boundaryCount: { classPropertyName: "boundaryCount", publicName: "boundaryCount", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { page: "pageChange", pageSize: "pageSizeChange", paginate: "paginate" }, ngImport: i0, template: "<nav class=\"ngx-pagination\">\
|
|
310
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxPagination, isStandalone: true, selector: "ngx-pagination", inputs: { total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: true, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, siblingCount: { classPropertyName: "siblingCount", publicName: "siblingCount", isSignal: true, isRequired: false, transformFunction: null }, boundaryCount: { classPropertyName: "boundaryCount", publicName: "boundaryCount", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { page: "pageChange", pageSize: "pageSizeChange", paginate: "paginate" }, ngImport: i0, template: "<nav class=\"ngx-pagination\">\n <div class=\"ngx-pagination__summary\">\n {{ labels().showing }}\n <span class=\"fw-semibold\">{{ firstItem() }}</span>\n {{ labels().to }}\n <span class=\"fw-semibold\">{{ lastItem() }}</span>\n {{ labels().of }}\n <span class=\"fw-semibold\">{{ total() }}</span>\n {{ labels().results }}\n </div>\n\n <div class=\"ngx-pagination__controls\">\n <ul class=\"ngx-pagination__list\">\n <li [class.disabled]=\"page() === 1\" [title]=\"labels().first\">\n <a (click)=\"first()\" class=\"icon\">\u00AB</a>\n </li>\n <li [class.disabled]=\"page() === 1\" [title]=\"labels().previous\">\n <a (click)=\"previous()\" class=\"icon\">\u2039</a>\n </li>\n\n @for (item of pages(); track $index) {\n <li class=\"ngx-pagination__page-num\" [class.active]=\"item === page()\">\n @if (item !== page() && item !== '...') {\n <a (click)=\"goto(+item)\">{{ item }}</a>\n }\n @if (item === page() || item === '...') {\n <span>{{ item }}</span>\n }\n </li>\n }\n\n <li [class.disabled]=\"page() === totalPages()\" [title]=\"labels().next\">\n <a (click)=\"next()\" class=\"icon\">\u203A</a>\n </li>\n <li [class.disabled]=\"page() === totalPages()\" [title]=\"labels().last\">\n <a (click)=\"last()\" class=\"icon\">\u00BB</a>\n </li>\n </ul>\n\n <div class=\"ngx-pagination__page-size\">\n <span>{{ labels().pageSize }}:</span>\n <select [ngModel]=\"pageSize()\" (ngModelChange)=\"onPageSizeChange($event)\">\n @for (opt of pageSizeOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === pageSize()\">{{ opt }}</option>\n }\n </select>\n </div>\n </div>\n</nav>\n", styles: [".ngx-pagination{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.75rem;padding:.625rem 1rem;font-size:.8125rem}.ngx-pagination__controls{display:flex;align-items:center;gap:1rem;flex-wrap:wrap}.ngx-pagination__list{display:flex;align-items:center;gap:.25rem;list-style:none;margin:0;padding:0}.ngx-pagination__list li{min-width:1.75rem;height:1.75rem;display:inline-flex;align-items:center;justify-content:center;border-radius:6px}.ngx-pagination__list li a,.ngx-pagination__list li span{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;cursor:pointer;border-radius:6px;-webkit-user-select:none;user-select:none}.ngx-pagination__list li a.icon,.ngx-pagination__list li span.icon{font-size:20px;font-family:Courier New,Courier,monospace}.ngx-pagination__list li.active a,.ngx-pagination__list li.active span{background:var(--ngx-table-accent, #4f46e5);color:#fff;cursor:default}.ngx-pagination__list li.disabled{opacity:.4;pointer-events:none}.ngx-pagination__list li:hover:not(.active):not(.disabled) a{background:color-mix(in srgb,var(--ngx-table-accent, #4f46e5) 12%,transparent)}.ngx-pagination__page-size{display:flex;align-items:center;gap:.5rem}.ngx-pagination__page-size select{border-radius:6px;padding:.25rem .5rem;font-size:.8125rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
121
311
|
}
|
|
122
312
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxPagination, decorators: [{
|
|
123
313
|
type: Component,
|
|
124
|
-
args: [{ selector: 'ngx-pagination', imports: [FormsModule], template: "<nav class=\"ngx-pagination\">\
|
|
314
|
+
args: [{ selector: 'ngx-pagination', standalone: true, imports: [FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nav class=\"ngx-pagination\">\n <div class=\"ngx-pagination__summary\">\n {{ labels().showing }}\n <span class=\"fw-semibold\">{{ firstItem() }}</span>\n {{ labels().to }}\n <span class=\"fw-semibold\">{{ lastItem() }}</span>\n {{ labels().of }}\n <span class=\"fw-semibold\">{{ total() }}</span>\n {{ labels().results }}\n </div>\n\n <div class=\"ngx-pagination__controls\">\n <ul class=\"ngx-pagination__list\">\n <li [class.disabled]=\"page() === 1\" [title]=\"labels().first\">\n <a (click)=\"first()\" class=\"icon\">\u00AB</a>\n </li>\n <li [class.disabled]=\"page() === 1\" [title]=\"labels().previous\">\n <a (click)=\"previous()\" class=\"icon\">\u2039</a>\n </li>\n\n @for (item of pages(); track $index) {\n <li class=\"ngx-pagination__page-num\" [class.active]=\"item === page()\">\n @if (item !== page() && item !== '...') {\n <a (click)=\"goto(+item)\">{{ item }}</a>\n }\n @if (item === page() || item === '...') {\n <span>{{ item }}</span>\n }\n </li>\n }\n\n <li [class.disabled]=\"page() === totalPages()\" [title]=\"labels().next\">\n <a (click)=\"next()\" class=\"icon\">\u203A</a>\n </li>\n <li [class.disabled]=\"page() === totalPages()\" [title]=\"labels().last\">\n <a (click)=\"last()\" class=\"icon\">\u00BB</a>\n </li>\n </ul>\n\n <div class=\"ngx-pagination__page-size\">\n <span>{{ labels().pageSize }}:</span>\n <select [ngModel]=\"pageSize()\" (ngModelChange)=\"onPageSizeChange($event)\">\n @for (opt of pageSizeOptions(); track opt) {\n <option [value]=\"opt\" [selected]=\"opt === pageSize()\">{{ opt }}</option>\n }\n </select>\n </div>\n </div>\n</nav>\n", styles: [".ngx-pagination{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.75rem;padding:.625rem 1rem;font-size:.8125rem}.ngx-pagination__controls{display:flex;align-items:center;gap:1rem;flex-wrap:wrap}.ngx-pagination__list{display:flex;align-items:center;gap:.25rem;list-style:none;margin:0;padding:0}.ngx-pagination__list li{min-width:1.75rem;height:1.75rem;display:inline-flex;align-items:center;justify-content:center;border-radius:6px}.ngx-pagination__list li a,.ngx-pagination__list li span{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;cursor:pointer;border-radius:6px;-webkit-user-select:none;user-select:none}.ngx-pagination__list li a.icon,.ngx-pagination__list li span.icon{font-size:20px;font-family:Courier New,Courier,monospace}.ngx-pagination__list li.active a,.ngx-pagination__list li.active span{background:var(--ngx-table-accent, #4f46e5);color:#fff;cursor:default}.ngx-pagination__list li.disabled{opacity:.4;pointer-events:none}.ngx-pagination__list li:hover:not(.active):not(.disabled) a{background:color-mix(in srgb,var(--ngx-table-accent, #4f46e5) 12%,transparent)}.ngx-pagination__page-size{display:flex;align-items:center;gap:.5rem}.ngx-pagination__page-size select{border-radius:6px;padding:.25rem .5rem;font-size:.8125rem}\n"] }]
|
|
125
315
|
}], ctorParameters: () => [], propDecorators: { total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: true }] }], page: [{ type: i0.Input, args: [{ isSignal: true, alias: "page", required: false }] }, { type: i0.Output, args: ["pageChange"] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }, { type: i0.Output, args: ["pageSizeChange"] }], pageSizeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeOptions", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], siblingCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblingCount", required: false }] }], boundaryCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaryCount", required: false }] }], paginate: [{ type: i0.Output, args: ["paginate"] }] } });
|
|
126
316
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const NGX_TABLE_CONFIG = new InjectionToken('NGX_TABLE_CONFIG', {
|
|
142
|
-
factory: () => NGX_TABLE_CONFIG_DEFAULT,
|
|
143
|
-
});
|
|
144
|
-
const NGX_TABLE_CONFIG_DEFAULT = {
|
|
145
|
-
showRecordNumber: true,
|
|
146
|
-
hoverable: true,
|
|
147
|
-
multiSort: true,
|
|
148
|
-
resizable: false,
|
|
149
|
-
stickyHeader: true,
|
|
150
|
-
stripedRows: true,
|
|
151
|
-
labels: {
|
|
152
|
-
noData: 'There is no data to display!',
|
|
153
|
-
loading: 'Loading...',
|
|
154
|
-
operation: 'Operation',
|
|
155
|
-
},
|
|
156
|
-
renderers: {},
|
|
157
|
-
formatters: {},
|
|
158
|
-
};
|
|
159
|
-
|
|
317
|
+
/**
|
|
318
|
+
* جدول دادهی جنریک و Type-Safe.
|
|
319
|
+
*
|
|
320
|
+
* `T` از روی چیزی که به [data] بایند میکنید استنتاج میشود؛ `field.column` در
|
|
321
|
+
* `TableField<T, R>` محدود به `keyof T` است، و اگر از defineFields(renderers, ...)
|
|
322
|
+
* استفاده کنید، `field.renderer` محدود به کلیدهای رجیستری و `rendererInputs`
|
|
323
|
+
* دقیقاً همان ورودیهای اضافهی همان renderer است.
|
|
324
|
+
*
|
|
325
|
+
* دو حالت:
|
|
326
|
+
* - کلاینتساید (پیشفرض): [data] کل آرایه است؛ سورت/صفحهبندی داخلی و روی
|
|
327
|
+
* یک computed خالص انجام میشود (بدون mutation روی آبجکتهای شما).
|
|
328
|
+
* - lazy: [lazy]="true" + [totalRecords]؛ [data] فقط صفحهی جاری است؛ به
|
|
329
|
+
* (lazyLoad) گوش بدهید.
|
|
330
|
+
*/
|
|
160
331
|
class NgxTable {
|
|
161
332
|
config = inject(NGX_TABLE_CONFIG);
|
|
162
333
|
paginationConfig = inject(NGX_PAGINATION_CONFIG);
|
|
334
|
+
// ---------------------------------------------------------------- inputs
|
|
163
335
|
fields = input.required(/* @ts-ignore */
|
|
164
336
|
...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
165
337
|
data = input.required(/* @ts-ignore */
|
|
@@ -168,8 +340,6 @@ class NgxTable {
|
|
|
168
340
|
...(ngDevMode ? [{ debugName: "totalRecords" }] : /* istanbul ignore next */ []));
|
|
169
341
|
showRecordNumber = input(this.config.showRecordNumber, /* @ts-ignore */
|
|
170
342
|
...(ngDevMode ? [{ debugName: "showRecordNumber" }] : /* istanbul ignore next */ []));
|
|
171
|
-
list = signal([], /* @ts-ignore */
|
|
172
|
-
...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
|
|
173
343
|
operations = input(/* @ts-ignore */
|
|
174
344
|
...(ngDevMode ? [undefined, { debugName: "operations" }] : /* istanbul ignore next */ []));
|
|
175
345
|
operationWidth = input(60, /* @ts-ignore */
|
|
@@ -180,105 +350,219 @@ class NgxTable {
|
|
|
180
350
|
...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
181
351
|
loading = input(false, /* @ts-ignore */
|
|
182
352
|
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
183
|
-
multiSort = input(
|
|
353
|
+
multiSort = input(undefined, /* @ts-ignore */
|
|
184
354
|
...(ngDevMode ? [{ debugName: "multiSort" }] : /* istanbul ignore next */ []));
|
|
185
355
|
lazy = input(false, /* @ts-ignore */
|
|
186
356
|
...(ngDevMode ? [{ debugName: "lazy" }] : /* istanbul ignore next */ []));
|
|
357
|
+
/** پیشفرض بر اساس ایندکس؛ برای جلوگیری از گمشدن state سطرها هنگام سورت،
|
|
358
|
+
* یک شناسهی یکتا بدهید: [trackBy]="(i, row) => row.id" */
|
|
359
|
+
trackBy = input((index) => index, /* @ts-ignore */
|
|
360
|
+
...(ngDevMode ? [{ debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
361
|
+
// --------------------------------------------------------------- outputs
|
|
187
362
|
lazyLoad = output();
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
363
|
+
sortChange = output();
|
|
364
|
+
columnResize = output();
|
|
365
|
+
// ------------------------------------------------------------ int. state
|
|
366
|
+
page = signal(1, /* @ts-ignore */
|
|
367
|
+
...(ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []));
|
|
368
|
+
pageSizeS = signal(this.paginationConfig.defaultPageSize, /* @ts-ignore */
|
|
369
|
+
...(ngDevMode ? [{ debugName: "pageSizeS" }] : /* istanbul ignore next */ []));
|
|
370
|
+
sorts = signal([], /* @ts-ignore */
|
|
371
|
+
...(ngDevMode ? [{ debugName: "sorts" }] : /* istanbul ignore next */ []));
|
|
372
|
+
widths = signal({}, /* @ts-ignore */
|
|
373
|
+
...(ngDevMode ? [{ debugName: "widths" }] : /* istanbul ignore next */ []));
|
|
374
|
+
manuallyResized = new Set();
|
|
375
|
+
rendererInputsCache = new Map();
|
|
193
376
|
cellTemplates;
|
|
194
377
|
templateMap = new Map();
|
|
195
|
-
|
|
378
|
+
resolvedMultiSort = computed(() => this.multiSort() ?? this.config.multiSort, /* @ts-ignore */
|
|
379
|
+
...(ngDevMode ? [{ debugName: "resolvedMultiSort" }] : /* istanbul ignore next */ []));
|
|
380
|
+
directionService = inject(DirectionService);
|
|
381
|
+
destroyRef = inject(DestroyRef);
|
|
382
|
+
resolvedDirection = computed(() => this.directionService.direction(), /* @ts-ignore */
|
|
383
|
+
...(ngDevMode ? [{ debugName: "resolvedDirection" }] : /* istanbul ignore next */ []));
|
|
196
384
|
constructor() {
|
|
197
385
|
effect(() => {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
386
|
+
const ps = this.pageSize();
|
|
387
|
+
if (ps)
|
|
388
|
+
this.pageSizeS.set(ps);
|
|
389
|
+
});
|
|
390
|
+
// برای هر ستونِ تازهدیدهشده یک عرض seed کن؛ ستونهایی که کاربر دستی
|
|
391
|
+
// ریسایز کرده دیگر هیچوقت دوباره نوشته نمیشوند.
|
|
392
|
+
effect(() => {
|
|
393
|
+
const cols = this.fields();
|
|
394
|
+
const current = this.widths();
|
|
395
|
+
let changed = false;
|
|
396
|
+
const next = { ...current };
|
|
397
|
+
for (const f of cols) {
|
|
398
|
+
if (!(f.column in next) && !this.manuallyResized.has(f.column)) {
|
|
399
|
+
next[f.column] = f.width ?? this.config.column.defaultWidth;
|
|
400
|
+
changed = true;
|
|
401
|
+
}
|
|
203
402
|
}
|
|
204
|
-
|
|
403
|
+
if (changed)
|
|
404
|
+
this.widths.set(next);
|
|
205
405
|
});
|
|
206
406
|
}
|
|
207
407
|
ngOnInit() {
|
|
208
408
|
if (this.lazy()) {
|
|
209
|
-
this.lazyLoad.emit({
|
|
210
|
-
first: 0,
|
|
211
|
-
pageIndex: 1,
|
|
212
|
-
pageSize: this.pageSize(),
|
|
213
|
-
sorts: [],
|
|
214
|
-
});
|
|
409
|
+
this.lazyLoad.emit({ first: 0, pageIndex: 1, pageSize: this.pageSizeS(), sorts: [] });
|
|
215
410
|
}
|
|
216
411
|
}
|
|
217
412
|
ngAfterContentInit() {
|
|
413
|
+
this.syncTemplateMap();
|
|
414
|
+
// این Observable خودش کامل نمیشه (EventEmitter سادهست، نه یه stream که
|
|
415
|
+
// روی destroy کامپوننت تموم بشه)؛ بدون takeUntilDestroyed، این subscribe
|
|
416
|
+
// برای همیشه فعال میموند و رفرنس کامپوننت رو زنده نگه میداشت.
|
|
417
|
+
this.cellTemplates.changes
|
|
418
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
419
|
+
.subscribe(() => this.syncTemplateMap());
|
|
420
|
+
}
|
|
421
|
+
syncTemplateMap() {
|
|
218
422
|
this.templateMap.clear();
|
|
219
423
|
this.cellTemplates.forEach((cell) => {
|
|
220
|
-
//
|
|
221
|
-
this.templateMap.set(cell.column
|
|
424
|
+
// نکتهی مهم: cell.column() باید فراخوانی شود (سیگنال است)، نه cell.column.name.
|
|
425
|
+
this.templateMap.set(cell.column(), cell.templateRef);
|
|
222
426
|
});
|
|
223
|
-
this.adjustScroll(this.tableContainer()?.nativeElement);
|
|
224
|
-
}
|
|
225
|
-
loadClientPage(data) {
|
|
226
|
-
const from = (this.page - 1) * this.pageSize();
|
|
227
|
-
const to = from + this.pageSize();
|
|
228
|
-
this.list.set(data.slice(from, to));
|
|
229
427
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
428
|
+
// ------------------------------------------------------------- دادهها
|
|
429
|
+
sortedData = computed(() => {
|
|
430
|
+
if (this.lazy())
|
|
431
|
+
return this.data();
|
|
432
|
+
const sorts = this.sorts();
|
|
433
|
+
if (sorts.length === 0)
|
|
434
|
+
return this.data();
|
|
435
|
+
const copy = [...this.data()];
|
|
436
|
+
copy.sort((a, b) => {
|
|
437
|
+
for (const s of sorts) {
|
|
438
|
+
const cmp = this.compare(a[s.field], b[s.field]);
|
|
439
|
+
if (cmp !== 0)
|
|
440
|
+
return s.direction === 'asc' ? cmp : -cmp;
|
|
441
|
+
}
|
|
442
|
+
return 0;
|
|
443
|
+
});
|
|
444
|
+
return copy;
|
|
445
|
+
}, /* @ts-ignore */
|
|
446
|
+
...(ngDevMode ? [{ debugName: "sortedData" }] : /* istanbul ignore next */ []));
|
|
447
|
+
totalCount = computed(() => this.lazy() ? this.totalRecords() : this.data().length, /* @ts-ignore */
|
|
448
|
+
...(ngDevMode ? [{ debugName: "totalCount" }] : /* istanbul ignore next */ []));
|
|
449
|
+
pagedData = computed(() => {
|
|
450
|
+
if (this.lazy())
|
|
451
|
+
return this.sortedData();
|
|
452
|
+
const start = (this.page() - 1) * this.pageSizeS();
|
|
453
|
+
return this.sortedData().slice(start, start + this.pageSizeS());
|
|
454
|
+
}, /* @ts-ignore */
|
|
455
|
+
...(ngDevMode ? [{ debugName: "pagedData" }] : /* istanbul ignore next */ []));
|
|
456
|
+
compare(a, b) {
|
|
457
|
+
if (a == null && b == null)
|
|
458
|
+
return 0;
|
|
459
|
+
if (a == null)
|
|
460
|
+
return -1;
|
|
461
|
+
if (b == null)
|
|
462
|
+
return 1;
|
|
463
|
+
if (typeof a === 'number' && typeof b === 'number')
|
|
464
|
+
return a - b;
|
|
465
|
+
if (typeof a === 'boolean' && typeof b === 'boolean')
|
|
466
|
+
return a === b ? 0 : a ? 1 : -1;
|
|
467
|
+
if (a instanceof Date && b instanceof Date)
|
|
468
|
+
return a.getTime() - b.getTime();
|
|
469
|
+
return String(a).localeCompare(String(b));
|
|
233
470
|
}
|
|
234
|
-
|
|
235
|
-
|
|
471
|
+
/** بدون mutation روی دادهی ورودی: شمارهی ردیف صرفاً از روی page/pageSize/rowIndex محاسبه میشود. */
|
|
472
|
+
recordNumber(rowIndex) {
|
|
473
|
+
return (this.page() - 1) * this.pageSizeS() + rowIndex + 1;
|
|
236
474
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return
|
|
475
|
+
// -------------------------------------------------------------- سورت
|
|
476
|
+
sortDirectionFor(column) {
|
|
477
|
+
return this.sorts().find((s) => s.field === column)?.direction ?? null;
|
|
240
478
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
this.page = event.page;
|
|
244
|
-
if (this.lazy()) {
|
|
245
|
-
this.lazyLoad.emit({
|
|
246
|
-
first: (event.page - 1) * event.pageSize,
|
|
247
|
-
pageIndex: event.page,
|
|
248
|
-
pageSize: event.pageSize,
|
|
249
|
-
sorts: this.sortField
|
|
250
|
-
? [
|
|
251
|
-
{
|
|
252
|
-
field: this.sortField,
|
|
253
|
-
direction: this.sortDirection,
|
|
254
|
-
},
|
|
255
|
-
]
|
|
256
|
-
: [],
|
|
257
|
-
});
|
|
479
|
+
onHeaderClick(field, event) {
|
|
480
|
+
if (!field.sortable)
|
|
258
481
|
return;
|
|
482
|
+
const column = field.column;
|
|
483
|
+
const current = this.sorts();
|
|
484
|
+
const existingIndex = current.findIndex((s) => s.field === column);
|
|
485
|
+
const isMultiGesture = this.resolvedMultiSort() && (event.shiftKey || event.ctrlKey || event.metaKey);
|
|
486
|
+
let next;
|
|
487
|
+
if (isMultiGesture) {
|
|
488
|
+
next = [...current];
|
|
489
|
+
if (existingIndex === -1) {
|
|
490
|
+
next.push({ field: column, direction: 'asc' });
|
|
491
|
+
}
|
|
492
|
+
else if (next[existingIndex].direction === 'asc') {
|
|
493
|
+
next[existingIndex] = { field: column, direction: 'desc' };
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
next.splice(existingIndex, 1);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else if (existingIndex === -1 || current.length > 1) {
|
|
500
|
+
next = [{ field: column, direction: 'asc' }];
|
|
259
501
|
}
|
|
260
|
-
|
|
502
|
+
else if (current[0].direction === 'asc') {
|
|
503
|
+
next = [{ field: column, direction: 'desc' }];
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
next = [];
|
|
507
|
+
}
|
|
508
|
+
this.sorts.set(next);
|
|
509
|
+
this.page.set(1);
|
|
510
|
+
this.sortChange.emit(next);
|
|
511
|
+
this.emitLazyIfNeeded();
|
|
261
512
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (!body || !header)
|
|
513
|
+
// ------------------------------------------------------------ صفحهبندی
|
|
514
|
+
onPaginate(event) {
|
|
515
|
+
this.page.set(event.page);
|
|
516
|
+
this.pageSizeS.set(event.pageSize);
|
|
517
|
+
this.emitLazyIfNeeded();
|
|
518
|
+
}
|
|
519
|
+
emitLazyIfNeeded() {
|
|
520
|
+
if (!this.lazy())
|
|
271
521
|
return;
|
|
272
|
-
|
|
273
|
-
|
|
522
|
+
const pageIndex = this.page();
|
|
523
|
+
const pageSize = this.pageSizeS();
|
|
524
|
+
this.lazyLoad.emit({
|
|
525
|
+
pageIndex,
|
|
526
|
+
pageSize,
|
|
527
|
+
first: (pageIndex - 1) * pageSize,
|
|
528
|
+
sorts: this.sorts(),
|
|
274
529
|
});
|
|
275
530
|
}
|
|
531
|
+
// -------------------------------------------------------------- ریسایز
|
|
532
|
+
columnWidth(column) {
|
|
533
|
+
return this.widths()[column] ?? this.config.column.defaultWidth;
|
|
534
|
+
}
|
|
535
|
+
columnMin(field) {
|
|
536
|
+
return field.minWidth ?? this.config.column.minWidth;
|
|
537
|
+
}
|
|
538
|
+
columnMax(field) {
|
|
539
|
+
return field.maxWidth ?? this.config.column.maxWidth;
|
|
540
|
+
}
|
|
541
|
+
isResizable(field) {
|
|
542
|
+
return (field.resizable ?? this.config.resizable) !== false;
|
|
543
|
+
}
|
|
544
|
+
onColumnResizing(column, width) {
|
|
545
|
+
this.widths.update((w) => ({ ...w, [column]: width }));
|
|
546
|
+
}
|
|
547
|
+
onColumnResizeEnd(column, width) {
|
|
548
|
+
this.manuallyResized.add(column);
|
|
549
|
+
this.widths.update((w) => ({ ...w, [column]: width }));
|
|
550
|
+
this.columnResize.emit({ field: column, width });
|
|
551
|
+
}
|
|
552
|
+
// --------------------------------------------------------------- سلولها
|
|
553
|
+
getTemplate(column) {
|
|
554
|
+
const fromDirective = this.templateMap.get(column);
|
|
555
|
+
if (fromDirective)
|
|
556
|
+
return fromDirective;
|
|
557
|
+
const fromFieldConfig = this.fields().find((f) => f.column === column)?.cellTemplate;
|
|
558
|
+
return fromFieldConfig ?? null;
|
|
559
|
+
}
|
|
276
560
|
getRenderer(field) {
|
|
277
|
-
|
|
278
|
-
if (!key) {
|
|
561
|
+
if (!field.renderer)
|
|
279
562
|
return null;
|
|
280
|
-
|
|
281
|
-
|
|
563
|
+
// نکته: نوع دقیق field.renderer (که به کلیدهای رجیستری محدود است) در
|
|
564
|
+
// defineFields() چک میشود؛ اینجا فقط یک lookup رانتایم ساده لازم است.
|
|
565
|
+
return this.config.renderers[field.renderer] ?? null;
|
|
282
566
|
}
|
|
283
567
|
getCellValue(row, field) {
|
|
284
568
|
return row[field.column];
|
|
@@ -289,83 +573,54 @@ class NgxTable {
|
|
|
289
573
|
return this.stringify(field.formatter(value, row, field));
|
|
290
574
|
}
|
|
291
575
|
if (typeof field.formatter === 'string') {
|
|
292
|
-
const formatter = this.config.formatters
|
|
293
|
-
if (formatter)
|
|
576
|
+
const formatter = this.config.formatters[field.formatter];
|
|
577
|
+
if (formatter)
|
|
294
578
|
return this.stringify(formatter(value, row, field));
|
|
295
|
-
}
|
|
296
579
|
}
|
|
297
580
|
return this.stringify(value);
|
|
298
581
|
}
|
|
299
582
|
stringify(value) {
|
|
300
583
|
return value == null ? '' : String(value);
|
|
301
584
|
}
|
|
585
|
+
/** ورودیهای renderer را بهازای هر (field, row) کش میکند تا هر Change
|
|
586
|
+
* Detection یک آبجکت جدید ساخته نشود؛ با WeakMap، وقتی row از حافظه خارج
|
|
587
|
+
* شود (مثلاً بعد از عوضشدن صفحه)، entry آن هم خودکار پاک میشود. */
|
|
302
588
|
getRendererInputs(row, field) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
field,
|
|
307
|
-
|
|
308
|
-
|
|
589
|
+
let fieldCache = this.rendererInputsCache.get(field);
|
|
590
|
+
if (!fieldCache) {
|
|
591
|
+
fieldCache = new WeakMap();
|
|
592
|
+
this.rendererInputsCache.set(field, fieldCache);
|
|
593
|
+
}
|
|
594
|
+
let inputs = fieldCache.get(row);
|
|
595
|
+
if (!inputs) {
|
|
596
|
+
inputs = {
|
|
597
|
+
value: this.getCellValue(row, field),
|
|
598
|
+
row,
|
|
599
|
+
field,
|
|
600
|
+
...(field.renderer ? field.rendererInputs : undefined),
|
|
601
|
+
};
|
|
602
|
+
fieldCache.set(row, inputs);
|
|
603
|
+
}
|
|
604
|
+
return inputs;
|
|
309
605
|
}
|
|
310
606
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
311
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxTable, isStandalone: true, selector: "ngx-table", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, totalRecords: { classPropertyName: "totalRecords", publicName: "totalRecords", isSignal: true, isRequired: true, transformFunction: null }, showRecordNumber: { classPropertyName: "showRecordNumber", publicName: "showRecordNumber", isSignal: true, isRequired: false, transformFunction: null }, operations: { classPropertyName: "operations", publicName: "operations", isSignal: true, isRequired: false, transformFunction: null }, operationWidth: { classPropertyName: "operationWidth", publicName: "operationWidth", isSignal: true, isRequired: false, transformFunction: null }, numWidth: { classPropertyName: "numWidth", publicName: "numWidth", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, multiSort: { classPropertyName: "multiSort", publicName: "multiSort", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { lazyLoad: "lazyLoad", sortChange: "sortChange" }, providers: [], queries: [{ propertyName: "cellTemplates", predicate: TableCellDirective }], viewQueries: [{ propertyName: "tableContainer", first: true, predicate: ["tableContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"table-responsive\" #tableContainer>\r\n <div class=\"table-mrs\">\r\n <div class=\"thead-mrs\">\r\n <div class=\"tr-mrs\">\r\n @if (operations()) {\r\n <div\r\n class=\"th-mrs operations\"\r\n [style.max-width.px]=\"operationWidth()\"\r\n [style.min-width.px]=\"operationWidth()\">\r\n {{ config.labels.operation }}\r\n </div>\r\n }\r\n @if (showRecordNumber()) {\r\n <div\r\n class=\"th-mrs operations\"\r\n [style.max-width.px]=\"numWidth()\"\r\n [style.min-width.px]=\"numWidth()\">\r\n #\r\n </div>\r\n }\r\n @for (item of fields(); track $index) {\r\n <div class=\"th-mrs\" [style.max-width.px]=\"item.width\" [style.min-width.px]=\"item.width\">\r\n {{ item.title }}\r\n <span\r\n class=\"sort-icon\"\r\n [class.active]=\"sortField == item.column\"\r\n (click)=\"onSortChange(item)\">\r\n @if (sortField == item.column && sortDirection == 'asc') {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"M368 432h-64c-8.844 0-15.1 7.156-15.1 16S295.2 464 304 464h64c8.844 0 16-7.156 16-16S376.8 432 368 432zM432 304h-128c-8.844 0-15.1 7.156-15.1 16S295.2 336 304 336h128c8.844 0 16-7.156 16-16S440.8 304 432 304zM496 176h-192c-8.844 0-15.1 7.156-15.1 16S295.2 208 304 208h192C504.8 208 512 200.8 512 192S504.8 176 496 176zM560 48h-256c-8.844 0-15.1 7.156-15.1 16S295.2 80 304 80h256C568.8 80 576 72.84 576 64S568.8 48 560 48zM224 352c-4.094 0-8.188 1.562-11.31 4.688L144 425.4V48C144 39.16 136.8 32 128 32S112 39.16 112 48v377.4l-68.69-68.69c-6.25-6.25-16.38-6.25-22.62 0s-6.25 16.38 0 22.62l96 96c6.25 6.25 16.38 6.25 22.62 0l96-96c6.25-6.25 6.25-16.38 0-22.62C232.2 353.6 228.1 352 224 352z\" />\r\n </svg>\r\n } @else if (sortField == item.column && sortDirection == 'desc') {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"M304 208h128C440.8 208 448 200.8 448 192s-7.156-16-16-16h-128c-8.844 0-15.1 7.156-15.1 16S295.2 208 304 208zM304 336h192c8.844 0 16-7.156 16-16s-7.156-16-16-16h-192c-8.844 0-15.1 7.156-15.1 16S295.2 336 304 336zM304 80h64c8.844 0 16-7.156 16-16S376.8 48 368 48h-64c-8.844 0-15.1 7.156-15.1 16S295.2 80 304 80zM560 432h-256c-8.844 0-15.1 7.156-15.1 16S295.2 464 304 464h256c8.844 0 16-7.156 16-16S568.8 432 560 432zM224 352c-4.094 0-8.188 1.562-11.31 4.688L144 425.4V48C144 39.16 136.8 32 128 32S112 39.16 112 48v377.4l-68.69-68.69c-6.25-6.25-16.38-6.25-22.62 0s-6.25 16.38 0 22.62l96 96c6.25 6.25 16.38 6.25 22.62 0l96-96c6.25-6.25 6.25-16.38 0-22.62C232.2 353.6 228.1 352 224 352z\" />\r\n </svg>\r\n } @else {\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"M224 352c-4.094 0-8.188 1.562-11.31 4.688L144 425.4V48C144 39.16 136.8 32 128 32S112 39.16 112 48v377.4l-68.69-68.69c-6.25-6.25-16.38-6.25-22.62 0s-6.25 16.38 0 22.62l96 96c6.25 6.25 16.38 6.25 22.62 0l96-96c6.25-6.25 6.25-16.38 0-22.62C232.2 353.6 228.1 352 224 352zM427.3 132.7l-96-96c-6.25-6.25-16.38-6.25-22.62 0l-96 96c-6.25 6.25-6.25 16.38 0 22.62s16.38 6.25 22.62 0L304 86.63V464c0 8.844 7.156 16 16 16s16-7.156 16-16V86.63l68.69 68.69C407.8 158.4 411.9 160 416 160s8.188-1.562 11.31-4.688C433.6 149.1 433.6 138.9 427.3 132.7z\" />\r\n </svg>\r\n }\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n <div class=\"tbody-mrs\">\r\n @if (!loading() && list().length === 0) {\r\n <div class=\"no-data\">{{ config.labels.noData }}</div>\r\n }\r\n @for (item of list(); track $index) {\r\n @let num = getRecordNumber(item);\r\n <div class=\"tr-mrs\">\r\n @if (operations()) {\r\n <div\r\n class=\"td-mrs operations\"\r\n vAlign=\"middle\"\r\n [style.max-width.px]=\"operationWidth()\"\r\n [style.min-width.px]=\"operationWidth()\">\r\n <div class=\"cel\">\r\n <span class=\"cell-title\">{{ config.labels.operation }}:</span>\r\n <ng-container\r\n [ngTemplateOutlet]=\"operations()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\r\n </div>\r\n </div>\r\n }\r\n\r\n @if (showRecordNumber()) {\r\n <div\r\n class=\"td-mrs operations\"\r\n vAlign=\"middle\"\r\n [style.max-width.px]=\"numWidth()\"\r\n [style.min-width.px]=\"numWidth()\">\r\n <div class=\"cel\">\r\n <span class=\"cell-title\"></span>\r\n {{ num }}\r\n </div>\r\n </div>\r\n }\r\n\r\n @for (f of fields(); track f.column) {\r\n @let template = getTemplate(f.column);\r\n @let renderer = getRenderer(f);\r\n\r\n <div\r\n class=\"td-mrs\"\r\n vAlign=\"middle\"\r\n [style.max-width.px]=\"f.width\"\r\n [style.min-width.px]=\"f.width\">\r\n <div class=\"cel\" [class.wrap]=\"f.wrap\">\r\n <span class=\"cell-title\">{{ f.title }}</span>\r\n @if (template) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"template\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: item,\r\n row: item,\r\n value: getCellValue(item, f),\r\n field: f,\r\n }\"></ng-container>\r\n } @else if (renderer) {\r\n <ng-container\r\n *ngComponentOutlet=\"\r\n renderer;\r\n inputs: getRendererInputs(item, f)\r\n \"></ng-container>\r\n } @else {\r\n {{ formatCellValue(item, f) }}\r\n }\r\n @if (f.prefix) {\r\n <span>{{ f.prefix }}</span>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (loading()) {\r\n <div class=\"loading-container\">\r\n <div class=\"loading\">{{ config.labels.loading }}</div>\r\n </div>\r\n }\r\n</div>\r\n\r\n<ngx-pagination\r\n [(page)]=\"page\"\r\n [pageSize]=\"pageSize()\"\r\n [total]=\"totalRecords()\"\r\n (paginate)=\"onPageChange($event)\"></ngx-pagination>\r\n", styles: [":host{--border-color: light-dark(#70707030, #2a2a3e);--header-height: 50px;--header-padding-y: 8px;--bg-color: light-dark(#eeeeee, #111118);--fg-color: light-dark(#000000, #ffffff);--header-shadow-color: light-dark(#00000024, #00000066);--header-bg: light-dark(#e5e5e5, #1a1a26)}*{box-sizing:border-box}.table-responsive{position:relative}.table-mrs{border:1px var(--border-color) solid;border-radius:32px;corner-shape:squircle;overflow:hidden;background-color:var(--bg-color);color:var(--fg-color)}.thead-mrs{background:var(--header-bg);height:var(--header-height);padding:var(--header-padding-y) 0px;box-shadow:0 0 10px 5px var(--header-shadow-color);overflow:hidden}.tbody-mrs{border-top:1px var(--border-color) solid;overflow:auto;height:calc(var(--available-content-height, 100vh) - (var(--header-height) + var(--header-padding-y) * 2));min-height:200px}.tr-mrs{display:flex;border-bottom:1px var(--border-color) solid}.tbody-mrs .tr-mrs{animation:showrow .35s cubic-bezier(.4,-.32,.4,1.24)}.tbody-mrs .tr-mrs:hover{background:#6c63ff0a}.tr-mrs:last-child{border-bottom:none}.thead-mrs .th-mrs{padding:5px 10px;flex:1;border-right:1px var(--border-color) solid;align-items:center;justify-content:space-between;display:flex;gap:5px;overflow:hidden}.thead-mrs .th-mrs:hover .sort-icon{opacity:1}.th-mrs:last-child{border:none}.td-mrs{padding:8px 10px;flex:100;overflow:hidden;margin:auto 0}.td-mrs .cel{overflow:hidden;max-width:100%}.td-mrs .cel :not(.wrap){white-space:nowrap;text-overflow:ellipsis}.cel .cell-title{display:none}.text-wrap{white-space:normal}@media(max-width:768px){.thead-mrs{display:none}.tr-mrs{flex-direction:column}.tr-mrs .td-mrs{max-width:unset!important;width:unset!important}.tr-mrs .td-mrs .cel{display:flex;align-items:center;gap:10px}.cel .cell-title{color:#6bb6f3;display:inline-block;font-weight:600}}@keyframes showrow{0%{margin-top:-100px;opacity:0}to{margin-top:0;opacity:1}}.loading-container{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.loading-container .loading{background:#3b3b3ba3;color:#fff;border:10px rgba(57,57,57,.1803921569) solid;border-radius:10px;padding:18px 25px}.no-data{display:flex;align-items:center;justify-content:center;height:100%;font-size:2rem;opacity:.5}.sort-icon{cursor:pointer;opacity:0;transition:opacity .5s;width:16px;height:16px}.sort-icon svg{width:100%;height:100%}.sort-icon.active{opacity:1}.tag{color:#fff;padding:0 10px;border-radius:5px}.tag.tag-success{background:#008e44}.tag.tag-danger{background:#bb001b}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NgxPagination, selector: "ngx-pagination", inputs: ["total", "page", "pageSize", "pageSizeOptions", "labels", "siblingCount", "boundaryCount"], outputs: ["pageChange", "pageSizeChange", "paginate"] }] });
|
|
607
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxTable, isStandalone: true, selector: "ngx-table", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, totalRecords: { classPropertyName: "totalRecords", publicName: "totalRecords", isSignal: true, isRequired: true, transformFunction: null }, showRecordNumber: { classPropertyName: "showRecordNumber", publicName: "showRecordNumber", isSignal: true, isRequired: false, transformFunction: null }, operations: { classPropertyName: "operations", publicName: "operations", isSignal: true, isRequired: false, transformFunction: null }, operationWidth: { classPropertyName: "operationWidth", publicName: "operationWidth", isSignal: true, isRequired: false, transformFunction: null }, numWidth: { classPropertyName: "numWidth", publicName: "numWidth", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, multiSort: { classPropertyName: "multiSort", publicName: "multiSort", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { lazyLoad: "lazyLoad", sortChange: "sortChange", columnResize: "columnResize" }, host: { classAttribute: "ngx-table-host" }, queries: [{ propertyName: "cellTemplates", predicate: TableCell }], ngImport: i0, template: "<div class=\"ngx-table-wrapper\" [class.ngx-table--loading]=\"loading()\">\n <div class=\"ngx-table-scroll\">\n <div\n class=\"ngx-table\"\n [class.ngx-table--striped]=\"config.stripedRows\"\n [class.ngx-table--hover]=\"config.hoverable\"\n role=\"table\">\n <div class=\"thead-mrs\" [class.thead-mrs--sticky]=\"config.stickyHeader\" role=\"rowgroup\">\n <div class=\"tr-mrs\" role=\"row\">\n @if (operations()) {\n <div\n class=\"th-mrs operations\"\n role=\"columnheader\"\n [style.flex]=\"'0 0 ' + operationWidth() + 'px'\">\n {{ config.labels.operation }}\n </div>\n }\n @if (showRecordNumber()) {\n <div\n class=\"th-mrs operations\"\n role=\"columnheader\"\n [style.flex]=\"'0 0 ' + numWidth() + 'px'\">\n #\n </div>\n }\n\n @for (f of fields(); track f.column) {\n <div\n class=\"th-mrs\"\n role=\"columnheader\"\n [class.th-mrs--sortable]=\"f.sortable\"\n [style.flex]=\"'0 0 ' + columnWidth(f.column) + 'px'\"\n [attr.aria-sort]=\"\n sortDirectionFor(f.column) === 'asc'\n ? 'ascending'\n : sortDirectionFor(f.column) === 'desc'\n ? 'descending'\n : null\n \"\n (click)=\"onHeaderClick(f, $event)\">\n <span class=\"th-mrs__title\">{{ f.title }}</span>\n\n @if (f.sortable) {\n <span class=\"sort-icon\" [class.active]=\"sortDirectionFor(f.column) !== null\">\n @if (sortDirectionFor(f.column) === 'asc') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M182.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8H96V448c0 17.7 14.3 32 32 32s32-14.3 32-32V224h64c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z\" />\n </svg>\n } @else if (sortDirectionFor(f.column) === 'desc') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M137.4 470.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8H224V64c0-17.7-14.3-32-32-32s-32 14.3-32 32V288H96c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z\" />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M137.4 41.4c12.5-12.5 32.8-12.5 45.3 0l96 96c9.2 9.2 11.9 22.9 6.9 34.9s-16.6 19.8-29.6 19.8H224v96c0 17.7-14.3 32-32 32s-32-14.3-32-32V192H96c-12.9 0-24.6-7.8-29.6-19.8s-2.3-25.7 6.9-34.9l96-96zM32 400c0-17.7 14.3-32 32-32H256c17.7 0 32 14.3 32 32s-14.3 32-32 32H64c-17.7 0-32-14.3-32-32z\"\n opacity=\".35\" />\n </svg>\n }\n </span>\n }\n\n @if (isResizable(f)) {\n <span\n ngxColumnResize\n [ngxColumnResizeWidth]=\"columnWidth(f.column)\"\n [ngxColumnResizeMin]=\"columnMin(f)\"\n [ngxColumnResizeMax]=\"columnMax(f)\"\n [ngxColumnResizeDir]=\"resolvedDirection()\"\n (resizing)=\"onColumnResizing(f.column, $event)\"\n (resizeEnd)=\"onColumnResizeEnd(f.column, $event)\"\n (click)=\"$event.stopPropagation()\"></span>\n }\n </div>\n }\n </div>\n </div>\n\n <div class=\"tbody-mrs\" role=\"rowgroup\">\n @if (!loading() && pagedData().length === 0) {\n <div class=\"no-data\">{{ config.labels.noData }}</div>\n }\n\n @for (row of pagedData(); track trackBy()($index, row); let rowIndex = $index) {\n <div class=\"tr-mrs\" role=\"row\">\n @if (operations()) {\n <div\n class=\"td-mrs operations\"\n role=\"cell\"\n [style.flex]=\"'0 0 ' + operationWidth() + 'px'\">\n <div class=\"cel\">\n <span class=\"cell-title\">{{ config.labels.operation }}:</span>\n <ng-container\n [ngTemplateOutlet]=\"operations()!\"\n [ngTemplateOutletContext]=\"{ $implicit: row }\"></ng-container>\n </div>\n </div>\n }\n\n @if (showRecordNumber()) {\n <div class=\"td-mrs operations\" role=\"cell\" [style.flex]=\"'0 0 ' + numWidth() + 'px'\">\n <div class=\"cel\">{{ recordNumber(rowIndex) }}</div>\n </div>\n }\n\n @for (f of fields(); track f.column) {\n @let template = getTemplate(f.column);\n @let renderer = getRenderer(f);\n\n <div class=\"td-mrs\" role=\"cell\" [style.flex]=\"'0 0 ' + columnWidth(f.column) + 'px'\">\n <div class=\"cel\" [class.wrap]=\"f.wrap\">\n <span class=\"cell-title\">{{ f.title }}</span>\n\n @if (template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row,\n row: row,\n value: getCellValue(row, f),\n rowIndex: rowIndex,\n field: f,\n }\"></ng-container>\n } @else if (renderer) {\n <ng-container\n *ngComponentOutlet=\"\n renderer;\n inputs: getRendererInputs(row, f)\n \"></ng-container>\n } @else {\n {{ formatCellValue(row, f) }}\n }\n\n @if (f.prefix) {\n <span>{{ f.prefix }}</span>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n </div>\n\n @if (loading()) {\n <div class=\"loading-container\">\n <div class=\"loading\">{{ config.labels.loading }}</div>\n </div>\n }\n </div>\n</div>\n\n<ngx-pagination\n [page]=\"page()\"\n [pageSize]=\"pageSizeS()\"\n [total]=\"totalCount()\"\n (paginate)=\"onPaginate($event)\"></ngx-pagination>\n", styles: [":host{--ngx-table-accent: light-dark(#4f46e5, #818cf8);--ngx-table-border: light-dark(#e5e7eb, #27272a);--ngx-table-header-bg: light-dark(#f8fafc, #18181b);--ngx-table-header-fg: light-dark(#334155, #d4d4d8);--ngx-table-row-bg: light-dark(#ffffff, #111114);--ngx-table-row-alt-bg: light-dark(#f9fafb, #17171b);--ngx-table-row-hover-bg: light-dark(#eef2ff, #1e1b4b);--ngx-table-text: light-dark(#1e293b, #e4e4e7);--ngx-table-radius: 12px;display:block;color:var(--ngx-table-text)}.ngx-table-wrapper{position:relative;border:1px solid var(--ngx-table-border);border-radius:var(--ngx-table-radius);overflow:hidden;background:var(--ngx-table-row-bg)}.ngx-table-scroll{overflow:auto;max-height:75vh}.ngx-table-scroll::-webkit-scrollbar{height:10px;width:10px}.ngx-table-scroll::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ngx-table-border) 60%,gray);border-radius:8px}.ngx-table{display:flex;flex-direction:column;min-width:100%;width:max-content}.thead-mrs{display:flex;flex-direction:column;z-index:2}.thead-mrs--sticky{position:sticky;top:0}.tr-mrs{display:flex;align-items:stretch}.th-mrs,.td-mrs{position:relative;box-sizing:border-box;overflow:hidden;border-bottom:1px solid var(--ngx-table-border);border-inline-end:1px solid var(--ngx-table-border)}.th-mrs:last-child,.td-mrs:last-child{border-inline-end:none}.th-mrs{display:flex;align-items:center;gap:.375rem;background:var(--ngx-table-header-bg);color:var(--ngx-table-header-fg);font-weight:600;font-size:.8125rem;letter-spacing:.02em;padding:.75rem 1rem;-webkit-user-select:none;user-select:none;white-space:nowrap;text-overflow:ellipsis}.th-mrs--sortable{cursor:pointer}.th-mrs--sortable:hover{color:var(--ngx-table-accent)}.th-mrs.operations{justify-content:center}.th-mrs__title{overflow:hidden;text-overflow:ellipsis}.sort-icon{width:.75rem;height:.75rem;flex:none;opacity:.4;display:inline-flex}.sort-icon svg{width:100%;height:100%}.sort-icon.active{opacity:1}.ngx-table__resize-handle,[ngxColumnResize]{position:absolute;top:0;bottom:0;inset-inline-end:-3px;width:6px;cursor:col-resize;touch-action:none;z-index:3}.ngx-table__resize-handle:hover,.ngx-table__resize-handle:active,[ngxColumnResize]:hover,[ngxColumnResize]:active{background:var(--ngx-table-accent);opacity:.5}.td-mrs{display:flex;align-items:center;padding:.75rem 1rem;font-size:.875rem}.td-mrs.operations{justify-content:center}.cel{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;gap:.25rem}.cel.wrap{white-space:normal}.cell-title{display:none;font-weight:600;color:var(--ngx-table-header-fg)}.ngx-table--striped .tbody-mrs .tr-mrs:nth-child(2n){background:var(--ngx-table-row-alt-bg)}.ngx-table--hover .tbody-mrs .tr-mrs:hover{background:var(--ngx-table-row-hover-bg)}.tr-mrs{transition:background-color .15s ease}.no-data{padding:2.5rem 1rem;text-align:center;color:#94a3b8;font-size:.875rem}.loading-container{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--ngx-table-row-bg) 75%,transparent);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px)}.loading{font-size:.875rem;color:var(--ngx-table-accent)}@media(max-width:768px){.ngx-table-scroll{overflow:visible;max-height:none}.ngx-table{width:100%}.thead-mrs{display:none}.tbody-mrs{display:flex;flex-direction:column;gap:.75rem;padding:.75rem}.tr-mrs{flex-direction:column;border:1px solid var(--ngx-table-border);border-radius:10px;overflow:hidden}.td-mrs{flex:1 1 auto!important;width:100%;border-inline-end:none;justify-content:space-between}.cel{justify-content:flex-end;white-space:normal;text-align:end}.cell-title{display:inline}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NgxPagination, selector: "ngx-pagination", inputs: ["total", "page", "pageSize", "pageSizeOptions", "labels", "siblingCount", "boundaryCount"], outputs: ["pageChange", "pageSizeChange", "paginate"] }, { kind: "directive", type: ColumnResize, selector: "[ngxColumnResize]", inputs: ["ngxColumnResizeWidth", "ngxColumnResizeMin", "ngxColumnResizeMax", "ngxColumnResizeDir"], outputs: ["resizing", "resizeEnd"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
312
608
|
}
|
|
313
609
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxTable, decorators: [{
|
|
314
610
|
type: Component,
|
|
315
|
-
args: [{ selector: 'ngx-table', imports: [CommonModule, NgxPagination
|
|
316
|
-
|
|
317
|
-
type: Output
|
|
318
|
-
|
|
611
|
+
args: [{ selector: 'ngx-table', standalone: true, imports: [CommonModule, NgxPagination, ColumnResize], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
612
|
+
class: 'ngx-table-host',
|
|
613
|
+
}, template: "<div class=\"ngx-table-wrapper\" [class.ngx-table--loading]=\"loading()\">\n <div class=\"ngx-table-scroll\">\n <div\n class=\"ngx-table\"\n [class.ngx-table--striped]=\"config.stripedRows\"\n [class.ngx-table--hover]=\"config.hoverable\"\n role=\"table\">\n <div class=\"thead-mrs\" [class.thead-mrs--sticky]=\"config.stickyHeader\" role=\"rowgroup\">\n <div class=\"tr-mrs\" role=\"row\">\n @if (operations()) {\n <div\n class=\"th-mrs operations\"\n role=\"columnheader\"\n [style.flex]=\"'0 0 ' + operationWidth() + 'px'\">\n {{ config.labels.operation }}\n </div>\n }\n @if (showRecordNumber()) {\n <div\n class=\"th-mrs operations\"\n role=\"columnheader\"\n [style.flex]=\"'0 0 ' + numWidth() + 'px'\">\n #\n </div>\n }\n\n @for (f of fields(); track f.column) {\n <div\n class=\"th-mrs\"\n role=\"columnheader\"\n [class.th-mrs--sortable]=\"f.sortable\"\n [style.flex]=\"'0 0 ' + columnWidth(f.column) + 'px'\"\n [attr.aria-sort]=\"\n sortDirectionFor(f.column) === 'asc'\n ? 'ascending'\n : sortDirectionFor(f.column) === 'desc'\n ? 'descending'\n : null\n \"\n (click)=\"onHeaderClick(f, $event)\">\n <span class=\"th-mrs__title\">{{ f.title }}</span>\n\n @if (f.sortable) {\n <span class=\"sort-icon\" [class.active]=\"sortDirectionFor(f.column) !== null\">\n @if (sortDirectionFor(f.column) === 'asc') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M182.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8H96V448c0 17.7 14.3 32 32 32s32-14.3 32-32V224h64c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z\" />\n </svg>\n } @else if (sortDirectionFor(f.column) === 'desc') {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M137.4 470.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8H224V64c0-17.7-14.3-32-32-32s-32 14.3-32 32V288H96c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z\" />\n </svg>\n } @else {\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\">\n <path\n fill=\"currentColor\"\n d=\"M137.4 41.4c12.5-12.5 32.8-12.5 45.3 0l96 96c9.2 9.2 11.9 22.9 6.9 34.9s-16.6 19.8-29.6 19.8H224v96c0 17.7-14.3 32-32 32s-32-14.3-32-32V192H96c-12.9 0-24.6-7.8-29.6-19.8s-2.3-25.7 6.9-34.9l96-96zM32 400c0-17.7 14.3-32 32-32H256c17.7 0 32 14.3 32 32s-14.3 32-32 32H64c-17.7 0-32-14.3-32-32z\"\n opacity=\".35\" />\n </svg>\n }\n </span>\n }\n\n @if (isResizable(f)) {\n <span\n ngxColumnResize\n [ngxColumnResizeWidth]=\"columnWidth(f.column)\"\n [ngxColumnResizeMin]=\"columnMin(f)\"\n [ngxColumnResizeMax]=\"columnMax(f)\"\n [ngxColumnResizeDir]=\"resolvedDirection()\"\n (resizing)=\"onColumnResizing(f.column, $event)\"\n (resizeEnd)=\"onColumnResizeEnd(f.column, $event)\"\n (click)=\"$event.stopPropagation()\"></span>\n }\n </div>\n }\n </div>\n </div>\n\n <div class=\"tbody-mrs\" role=\"rowgroup\">\n @if (!loading() && pagedData().length === 0) {\n <div class=\"no-data\">{{ config.labels.noData }}</div>\n }\n\n @for (row of pagedData(); track trackBy()($index, row); let rowIndex = $index) {\n <div class=\"tr-mrs\" role=\"row\">\n @if (operations()) {\n <div\n class=\"td-mrs operations\"\n role=\"cell\"\n [style.flex]=\"'0 0 ' + operationWidth() + 'px'\">\n <div class=\"cel\">\n <span class=\"cell-title\">{{ config.labels.operation }}:</span>\n <ng-container\n [ngTemplateOutlet]=\"operations()!\"\n [ngTemplateOutletContext]=\"{ $implicit: row }\"></ng-container>\n </div>\n </div>\n }\n\n @if (showRecordNumber()) {\n <div class=\"td-mrs operations\" role=\"cell\" [style.flex]=\"'0 0 ' + numWidth() + 'px'\">\n <div class=\"cel\">{{ recordNumber(rowIndex) }}</div>\n </div>\n }\n\n @for (f of fields(); track f.column) {\n @let template = getTemplate(f.column);\n @let renderer = getRenderer(f);\n\n <div class=\"td-mrs\" role=\"cell\" [style.flex]=\"'0 0 ' + columnWidth(f.column) + 'px'\">\n <div class=\"cel\" [class.wrap]=\"f.wrap\">\n <span class=\"cell-title\">{{ f.title }}</span>\n\n @if (template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row,\n row: row,\n value: getCellValue(row, f),\n rowIndex: rowIndex,\n field: f,\n }\"></ng-container>\n } @else if (renderer) {\n <ng-container\n *ngComponentOutlet=\"\n renderer;\n inputs: getRendererInputs(row, f)\n \"></ng-container>\n } @else {\n {{ formatCellValue(row, f) }}\n }\n\n @if (f.prefix) {\n <span>{{ f.prefix }}</span>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n </div>\n\n @if (loading()) {\n <div class=\"loading-container\">\n <div class=\"loading\">{{ config.labels.loading }}</div>\n </div>\n }\n </div>\n</div>\n\n<ngx-pagination\n [page]=\"page()\"\n [pageSize]=\"pageSizeS()\"\n [total]=\"totalCount()\"\n (paginate)=\"onPaginate($event)\"></ngx-pagination>\n", styles: [":host{--ngx-table-accent: light-dark(#4f46e5, #818cf8);--ngx-table-border: light-dark(#e5e7eb, #27272a);--ngx-table-header-bg: light-dark(#f8fafc, #18181b);--ngx-table-header-fg: light-dark(#334155, #d4d4d8);--ngx-table-row-bg: light-dark(#ffffff, #111114);--ngx-table-row-alt-bg: light-dark(#f9fafb, #17171b);--ngx-table-row-hover-bg: light-dark(#eef2ff, #1e1b4b);--ngx-table-text: light-dark(#1e293b, #e4e4e7);--ngx-table-radius: 12px;display:block;color:var(--ngx-table-text)}.ngx-table-wrapper{position:relative;border:1px solid var(--ngx-table-border);border-radius:var(--ngx-table-radius);overflow:hidden;background:var(--ngx-table-row-bg)}.ngx-table-scroll{overflow:auto;max-height:75vh}.ngx-table-scroll::-webkit-scrollbar{height:10px;width:10px}.ngx-table-scroll::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ngx-table-border) 60%,gray);border-radius:8px}.ngx-table{display:flex;flex-direction:column;min-width:100%;width:max-content}.thead-mrs{display:flex;flex-direction:column;z-index:2}.thead-mrs--sticky{position:sticky;top:0}.tr-mrs{display:flex;align-items:stretch}.th-mrs,.td-mrs{position:relative;box-sizing:border-box;overflow:hidden;border-bottom:1px solid var(--ngx-table-border);border-inline-end:1px solid var(--ngx-table-border)}.th-mrs:last-child,.td-mrs:last-child{border-inline-end:none}.th-mrs{display:flex;align-items:center;gap:.375rem;background:var(--ngx-table-header-bg);color:var(--ngx-table-header-fg);font-weight:600;font-size:.8125rem;letter-spacing:.02em;padding:.75rem 1rem;-webkit-user-select:none;user-select:none;white-space:nowrap;text-overflow:ellipsis}.th-mrs--sortable{cursor:pointer}.th-mrs--sortable:hover{color:var(--ngx-table-accent)}.th-mrs.operations{justify-content:center}.th-mrs__title{overflow:hidden;text-overflow:ellipsis}.sort-icon{width:.75rem;height:.75rem;flex:none;opacity:.4;display:inline-flex}.sort-icon svg{width:100%;height:100%}.sort-icon.active{opacity:1}.ngx-table__resize-handle,[ngxColumnResize]{position:absolute;top:0;bottom:0;inset-inline-end:-3px;width:6px;cursor:col-resize;touch-action:none;z-index:3}.ngx-table__resize-handle:hover,.ngx-table__resize-handle:active,[ngxColumnResize]:hover,[ngxColumnResize]:active{background:var(--ngx-table-accent);opacity:.5}.td-mrs{display:flex;align-items:center;padding:.75rem 1rem;font-size:.875rem}.td-mrs.operations{justify-content:center}.cel{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;gap:.25rem}.cel.wrap{white-space:normal}.cell-title{display:none;font-weight:600;color:var(--ngx-table-header-fg)}.ngx-table--striped .tbody-mrs .tr-mrs:nth-child(2n){background:var(--ngx-table-row-alt-bg)}.ngx-table--hover .tbody-mrs .tr-mrs:hover{background:var(--ngx-table-row-hover-bg)}.tr-mrs{transition:background-color .15s ease}.no-data{padding:2.5rem 1rem;text-align:center;color:#94a3b8;font-size:.875rem}.loading-container{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--ngx-table-row-bg) 75%,transparent);-webkit-backdrop-filter:blur(1px);backdrop-filter:blur(1px)}.loading{font-size:.875rem;color:var(--ngx-table-accent)}@media(max-width:768px){.ngx-table-scroll{overflow:visible;max-height:none}.ngx-table{width:100%}.thead-mrs{display:none}.tbody-mrs{display:flex;flex-direction:column;gap:.75rem;padding:.75rem}.tr-mrs{flex-direction:column;border:1px solid var(--ngx-table-border);border-radius:10px;overflow:hidden}.td-mrs{flex:1 1 auto!important;width:100%;border-inline-end:none;justify-content:space-between}.cel{justify-content:flex-end;white-space:normal;text-align:end}.cell-title{display:inline}}\n"] }]
|
|
614
|
+
}], ctorParameters: () => [], propDecorators: { fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: true }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], totalRecords: [{ type: i0.Input, args: [{ isSignal: true, alias: "totalRecords", required: true }] }], showRecordNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRecordNumber", required: false }] }], operations: [{ type: i0.Input, args: [{ isSignal: true, alias: "operations", required: false }] }], operationWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "operationWidth", required: false }] }], numWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "numWidth", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], multiSort: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiSort", required: false }] }], lazy: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazy", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], lazyLoad: [{ type: i0.Output, args: ["lazyLoad"] }], sortChange: [{ type: i0.Output, args: ["sortChange"] }], columnResize: [{ type: i0.Output, args: ["columnResize"] }], cellTemplates: [{
|
|
319
615
|
type: ContentChildren,
|
|
320
|
-
args: [
|
|
616
|
+
args: [TableCell]
|
|
321
617
|
}] } });
|
|
322
618
|
|
|
323
|
-
|
|
324
|
-
return makeEnvironmentProviders([
|
|
325
|
-
{
|
|
326
|
-
provide: NGX_PAGINATION_CONFIG,
|
|
327
|
-
useValue: mergeConfig(NGX_PAGINATION_CONFIG_DEFAULT, options),
|
|
328
|
-
},
|
|
329
|
-
]);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function provideTable(options) {
|
|
333
|
-
return makeEnvironmentProviders([
|
|
334
|
-
{
|
|
335
|
-
provide: NGX_TABLE_CONFIG,
|
|
336
|
-
useValue: mergeConfig(NGX_TABLE_CONFIG_DEFAULT, options),
|
|
337
|
-
},
|
|
338
|
-
]);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
class FieldsType {
|
|
342
|
-
title;
|
|
343
|
-
column;
|
|
344
|
-
dataType;
|
|
345
|
-
width;
|
|
346
|
-
wrap;
|
|
347
|
-
prefix;
|
|
348
|
-
/**
|
|
349
|
-
* نام renderer ثبتشده در provideTable
|
|
350
|
-
*/
|
|
351
|
-
renderer;
|
|
352
|
-
/**
|
|
353
|
-
* ورودیهای اضافه برای renderer
|
|
354
|
-
*/
|
|
355
|
-
rendererInputs;
|
|
356
|
-
/**
|
|
357
|
-
* نام formatter سراسری یا تابع اختصاصی
|
|
358
|
-
*/
|
|
359
|
-
formatter;
|
|
360
|
-
}
|
|
361
|
-
class SortEvent {
|
|
362
|
-
field = '';
|
|
363
|
-
direction = 'asc';
|
|
364
|
-
}
|
|
619
|
+
// types
|
|
365
620
|
|
|
366
621
|
/**
|
|
367
622
|
* Generated bundle index. Do not edit.
|
|
368
623
|
*/
|
|
369
624
|
|
|
370
|
-
export {
|
|
625
|
+
export { ColumnResize, NGX_PAGINATION_CONFIG, NGX_PAGINATION_CONFIG_DEFAULT, NGX_TABLE_CONFIG, NGX_TABLE_CONFIG_DEFAULT, NgxPagination, NgxTable, TableCell, defineFields, defineRenderers, providePagination, provideTable };
|
|
371
626
|
//# sourceMappingURL=ngx-kit-data-table.mjs.map
|