@den4ik92/ng2-smart-table 19.1.6 → 19.2.1
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/fesm2022/den4ik92-ng2-smart-table.mjs +797 -1412
- package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
- package/lib/components/cell/cell-edit-mode/build-in-editor.component.d.ts +8 -0
- package/lib/components/cell/cell-edit-mode/custom-edit.component.d.ts +3 -3
- package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +2 -2
- package/lib/components/cell/cell-editors/base-editor.component.d.ts +13 -0
- package/lib/components/cell/cell-editors/checkbox-editor.component.d.ts +2 -2
- package/lib/components/cell/cell-editors/input-editor.component.d.ts +2 -3
- package/lib/components/cell/cell-editors/select-editor.component.d.ts +2 -3
- package/lib/components/cell/cell-editors/textarea-editor.component.d.ts +2 -3
- package/lib/components/filter/build-in-filter.component.d.ts +12 -0
- package/lib/components/filter/custom-filter.component.d.ts +14 -6
- package/lib/components/filter/filter-types/base-filter.component.d.ts +31 -0
- package/lib/components/filter/filter-types/checkbox-filter.component.d.ts +7 -6
- package/lib/components/filter/filter-types/input-filter.component.d.ts +2 -8
- package/lib/components/filter/filter-types/select-filter.component.d.ts +2 -7
- package/lib/components/filter/filter.component.d.ts +12 -7
- package/lib/components/pager/pager.component.d.ts +17 -32
- package/lib/components/table-columns-editor/column-editor.directive.d.ts +4 -4
- package/lib/components/table-columns-editor/table-columns-editor.component.d.ts +3 -3
- package/lib/components/tbody/cells/custom.component.d.ts +5 -5
- package/lib/components/tbody/cells/edit-delete.component.d.ts +5 -5
- package/lib/components/tbody/tbody.component.d.ts +4 -6
- package/lib/components/thead/cells/actions-title.component.d.ts +1 -1
- package/lib/components/thead/cells/actions.component.d.ts +2 -2
- package/lib/components/thead/cells/add-button.component.d.ts +3 -3
- package/lib/components/thead/cells/column-title.component.d.ts +4 -5
- package/lib/components/thead/cells/title/title.component.d.ts +11 -15
- package/lib/components/thead/rows/thead-filters-row.component.d.ts +5 -8
- package/lib/components/thead/rows/thead-form-row.component.d.ts +3 -3
- package/lib/components/thead/rows/thead-titles-row.component.d.ts +5 -8
- package/lib/components/thead/thead.component.d.ts +6 -8
- package/lib/lib/data-set/cell.d.ts +1 -1
- package/lib/lib/data-set/column.d.ts +6 -12
- package/lib/lib/data-set/data-set.d.ts +8 -7
- package/lib/lib/data-set/row.d.ts +5 -5
- package/lib/lib/data-source/data-source.d.ts +25 -28
- package/lib/lib/data-source/local/local.data-source.d.ts +8 -45
- package/lib/lib/data-source/local/local.filter.d.ts +2 -4
- package/lib/lib/data-source/local/local.pager.d.ts +1 -3
- package/lib/lib/data-source/server/server.data-source.d.ts +25 -0
- package/lib/lib/grid.d.ts +7 -15
- package/lib/lib/interfaces/smart-table.models.d.ts +41 -26
- package/lib/ng2-smart-table.component.d.ts +6 -7
- package/package.json +1 -1
- package/public-api.d.ts +12 -11
- package/lib/components/cell/cell-edit-mode/default-edit.component.d.ts +0 -9
- package/lib/components/cell/cell-edit-mode/edit-cell-default.d.ts +0 -8
- package/lib/components/cell/cell-editors/default-editor.d.ts +0 -13
- package/lib/components/filter/default-filter.component.d.ts +0 -6
- package/lib/components/filter/filter-default.d.ts +0 -13
- package/lib/components/filter/filter-types/default-filter.d.ts +0 -27
|
@@ -1,53 +1,65 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, Component, output,
|
|
2
|
+
import { input, Component, output, signal, effect, computed, inject, ElementRef, Directive, ViewContainerRef, ViewChild, ChangeDetectionStrategy, Input, ChangeDetectorRef, DestroyRef } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { distinctUntilChanged, debounceTime, takeUntil, switchMap, map } from 'rxjs/operators';
|
|
3
6
|
import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
|
|
4
7
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
8
|
import { Subject } from 'rxjs';
|
|
6
|
-
import { takeUntil, debounceTime, distinctUntilChanged, skip } from 'rxjs/operators';
|
|
7
9
|
import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
|
|
8
|
-
import * as i1 from '@angular/forms';
|
|
9
|
-
import { FormsModule, UntypedFormControl, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
10
10
|
import { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';
|
|
11
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
11
12
|
|
|
12
|
-
class
|
|
13
|
+
class BaseEditorComponent {
|
|
13
14
|
constructor() {
|
|
14
15
|
this.cell = input.required();
|
|
15
|
-
this.inputClass = input(
|
|
16
|
+
this.inputClass = input('');
|
|
16
17
|
}
|
|
17
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
18
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type:
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
19
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: BaseEditorComponent, isStandalone: true, selector: "ng2-editor-base-component", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true }); }
|
|
19
20
|
}
|
|
20
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseEditorComponent, decorators: [{
|
|
21
22
|
type: Component,
|
|
22
|
-
args: [{ template:
|
|
23
|
+
args: [{ template: '', selector: 'ng2-editor-base-component' }]
|
|
23
24
|
}] });
|
|
24
25
|
|
|
25
|
-
class
|
|
26
|
+
class BaseFilterComponent {
|
|
26
27
|
constructor() {
|
|
27
28
|
this.delay = 300;
|
|
28
|
-
this.query = '';
|
|
29
|
+
this.query = input('');
|
|
29
30
|
this.inputClass = input('');
|
|
30
31
|
this.source = input.required();
|
|
31
32
|
this.column = input.required();
|
|
32
33
|
this.filter = output();
|
|
34
|
+
this.inputControl = new UntypedFormControl();
|
|
33
35
|
}
|
|
34
36
|
ngOnDestroy() {
|
|
35
37
|
if (this.changesSubscription) {
|
|
36
38
|
this.changesSubscription.unsubscribe();
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
this.
|
|
41
|
+
ngOnInit() {
|
|
42
|
+
this.changesSubscription = this.inputControl.valueChanges
|
|
43
|
+
.pipe(distinctUntilChanged(), debounceTime(this.delay))
|
|
44
|
+
.subscribe((value) => {
|
|
45
|
+
this.setFilter(value);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
ngOnChanges({ query }) {
|
|
49
|
+
if (query) {
|
|
50
|
+
this.inputControl.setValue(query.currentValue, { emitEvent: false });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
setFilter(query) {
|
|
54
|
+
this.filter.emit(query);
|
|
41
55
|
}
|
|
42
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
43
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type:
|
|
56
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
57
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: BaseFilterComponent, isStandalone: true, selector: "ng2-base-filter-component", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
|
|
44
58
|
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseFilterComponent, decorators: [{
|
|
46
60
|
type: Component,
|
|
47
|
-
args: [{ template: '', selector: 'ng2-
|
|
48
|
-
}]
|
|
49
|
-
type: Input
|
|
50
|
-
}] } });
|
|
61
|
+
args: [{ template: '', selector: 'ng2-base-filter-component' }]
|
|
62
|
+
}] });
|
|
51
63
|
|
|
52
64
|
/**
|
|
53
65
|
* Extending object that entered in first argument.
|
|
@@ -166,7 +178,7 @@ function getLocalStorage(key) {
|
|
|
166
178
|
|
|
167
179
|
class TableColumnsEditorComponent {
|
|
168
180
|
constructor() {
|
|
169
|
-
this.infoText =
|
|
181
|
+
this.infoText = 'You can drag and drop columns as you wish and also disable unnecessary ones.';
|
|
170
182
|
this.grid = input();
|
|
171
183
|
this.close = input.required();
|
|
172
184
|
this.currentState = [];
|
|
@@ -200,7 +212,7 @@ class TableColumnsEditorComponent {
|
|
|
200
212
|
}
|
|
201
213
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TableColumnsEditorComponent, decorators: [{
|
|
202
214
|
type: Component,
|
|
203
|
-
args: [{ selector:
|
|
215
|
+
args: [{ selector: 'ng2-table-columns-editor', imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], template: "<div class=\"sort-card\">\n <div class=\"sort-card-header\">\n <h6>Table columns setup</h6>\n </div>\n <div class=\"sort-card-body\">\n <div\n class=\"list\"\n cdkDropList\n [cdkDropListData]=\"currentState\"\n (cdkDropListDropped)=\"drop($event)\"\n >\n @for (column of currentState; track column.key + i; let i = $index) {\n\n <div\n cdkDrag\n [cdkDragLockAxis]=\"'y'\"\n [cdkDragStartDelay]=\"300\"\n [cdkDragDisabled]=\"column.moveDisabled\"\n class=\"drag-row\"\n #dragRow\n [style.--drag-row-height]=\"50\"\n >\n <div class=\"drag-placeholder\" *cdkDragPlaceholder></div>\n <div class=\"index-cell\">\n {{ i + 1 }}\n </div>\n <label class=\"sort-column-checkbox-wrap\" [for]=\"'sort-column-checkbox-' + i\">\n <span></span>\n <input\n [disabled]=\"column.moveDisabled\"\n [id]=\"'sort-column-checkbox-' + i\"\n title=\"Active state. If checked the column will be displayed\"\n type=\"checkbox\"\n class=\"sort-column-checkbox-input\"\n [checked]=\"!column.hide\"\n (change)=\"setVisibility(i)\"\n />\n <span></span>\n </label>\n {{ column.title }}\n </div>\n }\n </div>\n </div>\n @if (stateHasChanged()) {\n <div class=\"sort-card-footer\">\n <button class=\"reset-button\" (click)=\"resetChanges()\">reset</button>\n <button class=\"update-button\" (click)=\"setAndUpdate()\">Update</button>\n </div>\n }\n</div>\n", styles: [".list{overflow:auto;display:flex;flex-direction:column;gap:.3rem;max-height:100%}.drag-row{border:solid 1px var(--drag-row-border-color, #ccc);border-radius:.3rem;display:flex;align-items:center;box-sizing:border-box;cursor:grab;background:var(--drag-row-background, #ffffff);box-shadow:0 0 6px 1px #ebebeb33}.drag-row.cdk-drag-disabled{filter:opacity(.5);cursor:not-allowed}.drag-row .index-cell{min-width:2.2rem;border-right:1px solid var(--drag-row-border-color, #ccc)}.drag-row>div{padding:.3rem}.drag-row .sort-column-checkbox-wrap{margin:0 .5rem}.cdk-drag-preview{box-sizing:border-box;border-radius:.3rem;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list.cdk-drop-list-dragging .drag-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-placeholder{background:var(--drag-placeholder-background, #ccc);border:dotted 3px #999;min-height:var(--drag-row-heightpx, 2.5rem);transition:transform .25s cubic-bezier(0,0,.2,1)}.overlay-card nb-card-body{padding:.25rem;max-height:100%}.sort-card{box-shadow:0 0 6px 1px #0003;min-width:18rem;padding:.25rem;max-height:80dvh;background:var(--sort-card-background, #ffffff);border-radius:.5rem}.sort-card .sort-card-header{display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid var(--sort-card-header-divider-color, #edf1f7)}.sort-card .sort-card-header h6{margin:0}.sort-card .sort-card-body{padding:.5rem 0}.sort-card .sort-card-footer{border-top:1px solid var(--sort-card-header-divider-color, #edf1f7);display:flex;align-items:center;justify-content:end;gap:1rem;padding:1rem}.sort-card .sort-card-footer .update-button,.sort-card .sort-card-footer .reset-button{border-radius:.3rem;padding:.4rem 1rem;border:none;color:#fff;font-size:.875rem;font-weight:700;text-transform:uppercase}.sort-card .sort-card-footer .update-button{background-color:#36f}.sort-card .sort-card-footer .update-button:hover{background-color:#598bff}.sort-card .sort-card-footer .reset-button{background-color:#ff3d71}.sort-card .sort-card-footer .reset-button:hover{background-color:#ff708d}\n"] }]
|
|
204
216
|
}], ctorParameters: () => [] });
|
|
205
217
|
|
|
206
218
|
class SmartTableColumnEditorDirective {
|
|
@@ -222,9 +234,12 @@ class SmartTableColumnEditorDirective {
|
|
|
222
234
|
this.overlayRef = this.overlay.create(this.getOverlayConfig());
|
|
223
235
|
const componentPortal = new ComponentPortal(TableColumnsEditorComponent);
|
|
224
236
|
const dropdownRef = this.overlayRef.attach(componentPortal);
|
|
225
|
-
dropdownRef.setInput(
|
|
226
|
-
dropdownRef.setInput(
|
|
227
|
-
this.overlayRef
|
|
237
|
+
dropdownRef.setInput('grid', this.grid());
|
|
238
|
+
dropdownRef.setInput('close', this.hide.bind(this));
|
|
239
|
+
this.overlayRef
|
|
240
|
+
?.backdropClick()
|
|
241
|
+
.pipe(takeUntil(this.destroy$))
|
|
242
|
+
.subscribe(() => this.hide());
|
|
228
243
|
}
|
|
229
244
|
hide() {
|
|
230
245
|
this.overlayRef?.detach();
|
|
@@ -241,46 +256,46 @@ class SmartTableColumnEditorDirective {
|
|
|
241
256
|
.withPush(false)
|
|
242
257
|
.withPositions([
|
|
243
258
|
{
|
|
244
|
-
originX:
|
|
245
|
-
originY:
|
|
246
|
-
overlayX:
|
|
247
|
-
overlayY:
|
|
259
|
+
originX: 'center',
|
|
260
|
+
originY: 'bottom',
|
|
261
|
+
overlayX: 'end',
|
|
262
|
+
overlayY: 'top',
|
|
248
263
|
},
|
|
249
264
|
{
|
|
250
|
-
originX:
|
|
251
|
-
originY:
|
|
252
|
-
overlayX:
|
|
253
|
-
overlayY:
|
|
265
|
+
originX: 'center',
|
|
266
|
+
originY: 'bottom',
|
|
267
|
+
overlayX: 'center',
|
|
268
|
+
overlayY: 'top',
|
|
254
269
|
},
|
|
255
270
|
{
|
|
256
|
-
originX:
|
|
257
|
-
originY:
|
|
258
|
-
overlayX:
|
|
259
|
-
overlayY:
|
|
271
|
+
originX: 'center',
|
|
272
|
+
originY: 'bottom',
|
|
273
|
+
overlayX: 'start',
|
|
274
|
+
overlayY: 'top',
|
|
260
275
|
},
|
|
261
276
|
{
|
|
262
|
-
originX:
|
|
263
|
-
originY:
|
|
264
|
-
overlayX:
|
|
265
|
-
overlayY:
|
|
277
|
+
originX: 'center',
|
|
278
|
+
originY: 'top',
|
|
279
|
+
overlayX: 'start',
|
|
280
|
+
overlayY: 'bottom',
|
|
266
281
|
},
|
|
267
282
|
{
|
|
268
|
-
originX:
|
|
269
|
-
originY:
|
|
270
|
-
overlayX:
|
|
271
|
-
overlayY:
|
|
283
|
+
originX: 'center',
|
|
284
|
+
originY: 'top',
|
|
285
|
+
overlayX: 'center',
|
|
286
|
+
overlayY: 'bottom',
|
|
272
287
|
},
|
|
273
288
|
{
|
|
274
|
-
originX:
|
|
275
|
-
originY:
|
|
276
|
-
overlayX:
|
|
277
|
-
overlayY:
|
|
289
|
+
originX: 'center',
|
|
290
|
+
originY: 'top',
|
|
291
|
+
overlayX: 'start',
|
|
292
|
+
overlayY: 'bottom',
|
|
278
293
|
},
|
|
279
294
|
]);
|
|
280
295
|
return new OverlayConfig({
|
|
281
296
|
positionStrategy: positionStrategy,
|
|
282
297
|
hasBackdrop: true,
|
|
283
|
-
backdropClass:
|
|
298
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
284
299
|
});
|
|
285
300
|
}
|
|
286
301
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
@@ -289,9 +304,9 @@ class SmartTableColumnEditorDirective {
|
|
|
289
304
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, decorators: [{
|
|
290
305
|
type: Directive,
|
|
291
306
|
args: [{
|
|
292
|
-
selector:
|
|
307
|
+
selector: '[ng2SmartTableColumnEditor]',
|
|
293
308
|
host: {
|
|
294
|
-
|
|
309
|
+
'(click)': 'buttclicked()',
|
|
295
310
|
},
|
|
296
311
|
}]
|
|
297
312
|
}] });
|
|
@@ -316,7 +331,7 @@ class Cell {
|
|
|
316
331
|
return this.row;
|
|
317
332
|
}
|
|
318
333
|
getValue() {
|
|
319
|
-
const prepare = this.column.
|
|
334
|
+
const prepare = this.column.valuePrepareFunction || this.prepareValue;
|
|
320
335
|
return prepare.call(null, this.value, this.row.getData(), this);
|
|
321
336
|
}
|
|
322
337
|
getNotPrepareValue() {
|
|
@@ -356,36 +371,8 @@ class Column {
|
|
|
356
371
|
this.isAddable = true;
|
|
357
372
|
this.isFilterable = false;
|
|
358
373
|
this.sortDirection = 'asc';
|
|
359
|
-
this.defaultSortDirection = false;
|
|
360
374
|
this.editor = false;
|
|
361
375
|
this.filter = false;
|
|
362
|
-
this.process(this.settings);
|
|
363
|
-
}
|
|
364
|
-
getCompareFunction() {
|
|
365
|
-
return this.compareFunction;
|
|
366
|
-
}
|
|
367
|
-
getValuePrepareFunction() {
|
|
368
|
-
return this.valuePrepareFunction;
|
|
369
|
-
}
|
|
370
|
-
getFilterFunction() {
|
|
371
|
-
return this.filterFunction;
|
|
372
|
-
}
|
|
373
|
-
getConfig() {
|
|
374
|
-
if (this.editor && (this.editor.type === 'checkbox' || this.editor.type === 'custom' || this.editor.type === 'list')) {
|
|
375
|
-
return this.editor?.config;
|
|
376
|
-
}
|
|
377
|
-
return false;
|
|
378
|
-
}
|
|
379
|
-
getFilterType() {
|
|
380
|
-
return this.filter && this.filter.type;
|
|
381
|
-
}
|
|
382
|
-
getFilterConfig() {
|
|
383
|
-
if (this.filter && (this.filter.type === 'checkbox' || this.filter.type === 'custom' || this.filter.type === 'list')) {
|
|
384
|
-
return this.filter?.config;
|
|
385
|
-
}
|
|
386
|
-
return false;
|
|
387
|
-
}
|
|
388
|
-
process(settings) {
|
|
389
376
|
this.title = settings.title;
|
|
390
377
|
this.class = settings.class || '';
|
|
391
378
|
this.width = settings.width || '';
|
|
@@ -401,17 +388,28 @@ class Column {
|
|
|
401
388
|
this.renderComponent = settings.renderComponent;
|
|
402
389
|
}
|
|
403
390
|
this.isFilterable = typeof settings.filter === 'undefined' ? true : !!settings['filter'];
|
|
404
|
-
this.
|
|
405
|
-
this.
|
|
406
|
-
this.
|
|
407
|
-
this.
|
|
408
|
-
this.sortDirection = this.prepareSortDirection();
|
|
391
|
+
this.isSortable = settings.sort ?? true;
|
|
392
|
+
this.isEditable = settings.editable ?? true;
|
|
393
|
+
this.isAddable = settings.addable ?? false;
|
|
394
|
+
this.sortDirection = settings.sortDirection || 'asc';
|
|
409
395
|
this.compareFunction = settings.compareFunction;
|
|
410
396
|
this.valuePrepareFunction = settings.valuePrepareFunction;
|
|
411
397
|
this.filterFunction = settings.filterFunction;
|
|
412
398
|
}
|
|
413
|
-
|
|
414
|
-
|
|
399
|
+
getEditorConfig() {
|
|
400
|
+
if (this.editor) {
|
|
401
|
+
return this.editor?.config;
|
|
402
|
+
}
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
getFilterType() {
|
|
406
|
+
return this.filter && this.filter.type;
|
|
407
|
+
}
|
|
408
|
+
getFilterConfig() {
|
|
409
|
+
if (this.filter) {
|
|
410
|
+
return this.filter?.config;
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
415
413
|
}
|
|
416
414
|
}
|
|
417
415
|
|
|
@@ -423,21 +421,19 @@ class Row {
|
|
|
423
421
|
this.pending = signal(false);
|
|
424
422
|
this.isSelected = signal(false);
|
|
425
423
|
this.isInEditing = signal(false);
|
|
426
|
-
this.cells = [];
|
|
424
|
+
this.cells = signal([]);
|
|
425
|
+
this.visibleCells = computed(() => this.cells().filter((cell) => !cell.getColumn().hide));
|
|
427
426
|
this.process();
|
|
428
427
|
}
|
|
429
428
|
getCell(column) {
|
|
430
|
-
return this.cells.find(el => el.getColumn() === column);
|
|
431
|
-
}
|
|
432
|
-
getCells() {
|
|
433
|
-
return this.cells;
|
|
429
|
+
return this.cells().find((el) => el.getColumn() === column);
|
|
434
430
|
}
|
|
435
431
|
getData() {
|
|
436
432
|
return this.data;
|
|
437
433
|
}
|
|
438
434
|
getNewData() {
|
|
439
435
|
const values = Object.assign({}, this.data);
|
|
440
|
-
this.
|
|
436
|
+
this.cells().forEach((cell) => (values[cell.getColumn().id] = cell.newValue));
|
|
441
437
|
return values;
|
|
442
438
|
}
|
|
443
439
|
setData(data) {
|
|
@@ -445,15 +441,15 @@ class Row {
|
|
|
445
441
|
this.process();
|
|
446
442
|
}
|
|
447
443
|
process() {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
});
|
|
444
|
+
const cells = this._dataSet
|
|
445
|
+
.getColumns()
|
|
446
|
+
.map((column) => this.createCell(column));
|
|
447
|
+
this.cells.set(cells);
|
|
453
448
|
}
|
|
454
449
|
createCell(column) {
|
|
455
|
-
const
|
|
456
|
-
|
|
450
|
+
const value = typeof this.data[column.id] === "undefined"
|
|
451
|
+
? ""
|
|
452
|
+
: this.data[column.id];
|
|
457
453
|
return new Cell(value, this, column, this._dataSet);
|
|
458
454
|
}
|
|
459
455
|
}
|
|
@@ -470,117 +466,161 @@ var SmartTableOnChangedEventName;
|
|
|
470
466
|
SmartTableOnChangedEventName["add"] = "add";
|
|
471
467
|
SmartTableOnChangedEventName["remove"] = "remove";
|
|
472
468
|
SmartTableOnChangedEventName["append"] = "append";
|
|
469
|
+
SmartTableOnChangedEventName["appendMany"] = "appendMany";
|
|
473
470
|
SmartTableOnChangedEventName["prepend"] = "prepend";
|
|
474
471
|
SmartTableOnChangedEventName["refresh"] = "refresh";
|
|
472
|
+
SmartTableOnChangedEventName["columnRefresh"] = "columnRefresh";
|
|
475
473
|
})(SmartTableOnChangedEventName || (SmartTableOnChangedEventName = {}));
|
|
476
474
|
|
|
477
475
|
class DataSource {
|
|
478
476
|
constructor() {
|
|
479
477
|
this.onChangedSource = new Subject();
|
|
480
|
-
this.
|
|
481
|
-
this.
|
|
482
|
-
this.
|
|
478
|
+
this.sortConf = { field: '', direction: 'asc' };
|
|
479
|
+
this.filters = [];
|
|
480
|
+
this.pagingConf = signal({
|
|
481
|
+
page: 1,
|
|
482
|
+
perPage: 100,
|
|
483
|
+
total: 0,
|
|
484
|
+
display: false,
|
|
485
|
+
perPageSelect: [],
|
|
486
|
+
});
|
|
487
|
+
this.data = [];
|
|
483
488
|
}
|
|
484
489
|
refresh() {
|
|
485
|
-
this.emitOnChanged(SmartTableOnChangedEventName.refresh);
|
|
490
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.refresh });
|
|
486
491
|
}
|
|
487
|
-
|
|
488
|
-
this.emitOnChanged(SmartTableOnChangedEventName.
|
|
489
|
-
return Promise.resolve(true);
|
|
492
|
+
columnRefresh() {
|
|
493
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.columnRefresh });
|
|
490
494
|
}
|
|
491
495
|
onChanged() {
|
|
492
496
|
return this.onChangedSource.asObservable();
|
|
493
497
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
onUpdated() {
|
|
498
|
-
return this.onUpdatedSource.asObservable();
|
|
499
|
-
}
|
|
500
|
-
onRemoved() {
|
|
501
|
-
return this.onRemovedSource.asObservable();
|
|
502
|
-
}
|
|
503
|
-
prependEmit(element) {
|
|
504
|
-
this.emitOnAdded(element);
|
|
505
|
-
this.emitOnChanged(SmartTableOnChangedEventName.prepend);
|
|
498
|
+
prepend(element) {
|
|
499
|
+
this.data.unshift(element);
|
|
500
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.prepend, newItems: [element] });
|
|
506
501
|
return Promise.resolve(true);
|
|
507
502
|
}
|
|
508
|
-
|
|
509
|
-
this.
|
|
510
|
-
this.emitOnChanged(SmartTableOnChangedEventName.
|
|
503
|
+
appendMany(elements) {
|
|
504
|
+
this.data = [...this.data, ...elements];
|
|
505
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.appendMany, newItems: elements }, this.data);
|
|
511
506
|
return Promise.resolve(true);
|
|
512
507
|
}
|
|
513
|
-
|
|
514
|
-
this.
|
|
515
|
-
this.emitOnChanged(SmartTableOnChangedEventName.
|
|
508
|
+
append(element) {
|
|
509
|
+
this.data.push(element);
|
|
510
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.append, newItems: [element] });
|
|
516
511
|
return Promise.resolve(true);
|
|
517
512
|
}
|
|
518
|
-
|
|
519
|
-
this.
|
|
520
|
-
this.emitOnChanged(SmartTableOnChangedEventName.
|
|
513
|
+
add(element) {
|
|
514
|
+
this.data.push(element);
|
|
515
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.add, newItems: [element] });
|
|
521
516
|
return Promise.resolve(true);
|
|
522
517
|
}
|
|
523
|
-
|
|
524
|
-
this.
|
|
525
|
-
this.emitOnChanged(SmartTableOnChangedEventName.
|
|
518
|
+
remove(element) {
|
|
519
|
+
this.data = this.data.filter((el) => el !== element);
|
|
520
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.remove, item: element }, this.data);
|
|
526
521
|
return Promise.resolve(true);
|
|
527
522
|
}
|
|
528
|
-
|
|
529
|
-
this.emitOnChanged(SmartTableOnChangedEventName.
|
|
523
|
+
update(oldItem, newItem) {
|
|
524
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.update, oldItem, newItem });
|
|
530
525
|
return Promise.resolve(true);
|
|
531
526
|
}
|
|
532
|
-
|
|
533
|
-
this.
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
this.emitOnChanged(SmartTableOnChangedEventName.filter);
|
|
537
|
-
}
|
|
538
|
-
addFilterEmit() {
|
|
539
|
-
this.emitOnChanged(SmartTableOnChangedEventName.filter);
|
|
540
|
-
}
|
|
541
|
-
setPagingEmit() {
|
|
542
|
-
this.emitOnChanged(SmartTableOnChangedEventName.paging);
|
|
527
|
+
empty() {
|
|
528
|
+
this.data = [];
|
|
529
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.empty });
|
|
530
|
+
return Promise.resolve(true);
|
|
543
531
|
}
|
|
544
|
-
|
|
545
|
-
this.
|
|
532
|
+
setSort(conf, doEmit = true) {
|
|
533
|
+
this.sortConf = conf;
|
|
534
|
+
this.pagingConf.update((old) => ({ ...old, page: 1 }));
|
|
535
|
+
if (doEmit) {
|
|
536
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.sort });
|
|
537
|
+
}
|
|
546
538
|
}
|
|
547
|
-
|
|
548
|
-
|
|
539
|
+
addFilter(newFilter, doEmit = true) {
|
|
540
|
+
if (!newFilter.field) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
const foundIndex = this.filters.findIndex((filter) => filter.field === newFilter.field);
|
|
544
|
+
if (foundIndex === -1) {
|
|
545
|
+
if (newFilter.search) {
|
|
546
|
+
this.filters.push(newFilter);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
if (newFilter.search) {
|
|
551
|
+
this.filters[foundIndex].search = newFilter.search;
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
this.filters.splice(foundIndex, 1);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
this.pagingConf.update((old) => ({ ...old, page: 1 }));
|
|
558
|
+
if (doEmit) {
|
|
559
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.filter });
|
|
560
|
+
}
|
|
549
561
|
}
|
|
550
|
-
|
|
551
|
-
this.
|
|
562
|
+
setFilters(newFilters, doEmit = true) {
|
|
563
|
+
this.filters = [...newFilters];
|
|
564
|
+
this.pagingConf.update((old) => ({ ...old, page: 1 }));
|
|
565
|
+
if (doEmit) {
|
|
566
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.filter });
|
|
567
|
+
}
|
|
552
568
|
}
|
|
553
|
-
|
|
554
|
-
this.
|
|
569
|
+
setPaging(page = 1, perPage, doEmit = true) {
|
|
570
|
+
this.pagingConf.update((old) => ({ ...old, page: page, perPage: perPage }));
|
|
571
|
+
if (doEmit) {
|
|
572
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.paging });
|
|
573
|
+
}
|
|
555
574
|
}
|
|
556
|
-
|
|
557
|
-
this.
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
575
|
+
setPage(page, doEmit = true) {
|
|
576
|
+
this.pagingConf.update((old) => ({ ...old, page: page }));
|
|
577
|
+
if (doEmit) {
|
|
578
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.page });
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
emitOnChanged(eventData, newElements) {
|
|
582
|
+
const actionData = () => {
|
|
583
|
+
const elements = newElements || this.data;
|
|
584
|
+
const emitData = {
|
|
585
|
+
...eventData,
|
|
586
|
+
elements,
|
|
587
|
+
paging: this.pagingConf(),
|
|
588
|
+
filters: this.getFilters(),
|
|
589
|
+
sort: this.getSort(),
|
|
590
|
+
};
|
|
591
|
+
if (eventData.action === SmartTableOnChangedEventName.remove) {
|
|
592
|
+
return {
|
|
593
|
+
...emitData,
|
|
594
|
+
elements: elements.filter((el) => el !== eventData.item),
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
return emitData;
|
|
598
|
+
};
|
|
599
|
+
this.onChangedSource.next(actionData());
|
|
564
600
|
}
|
|
565
601
|
}
|
|
566
602
|
|
|
567
603
|
function filterValues(value, search) {
|
|
568
604
|
return value.toString().toLowerCase().includes(search.toString().toLowerCase());
|
|
569
605
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
606
|
+
function isElementSatisfied(element, filters) {
|
|
607
|
+
return filters.every((filter) => {
|
|
608
|
+
if (!filter.search?.length) {
|
|
609
|
+
return true;
|
|
610
|
+
}
|
|
611
|
+
const filterFunction = filter.filter || filterValues;
|
|
612
|
+
try {
|
|
613
|
+
const value = element[filter.field];
|
|
614
|
+
return filterFunction(value, filter.search);
|
|
615
|
+
}
|
|
616
|
+
catch {
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
});
|
|
578
620
|
}
|
|
579
621
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
return data.slice(perPage * (page - 1), perPage * page);
|
|
583
|
-
}
|
|
622
|
+
function paginateList(data, page, perPage) {
|
|
623
|
+
return [...data].slice(perPage * (page - 1), perPage * page);
|
|
584
624
|
}
|
|
585
625
|
|
|
586
626
|
function compareValues(direction, a, b) {
|
|
@@ -605,66 +645,26 @@ class LocalSorter {
|
|
|
605
645
|
class LocalDataSource extends DataSource {
|
|
606
646
|
constructor(data = []) {
|
|
607
647
|
super();
|
|
608
|
-
this.
|
|
609
|
-
this.
|
|
610
|
-
this.sortConf = [];
|
|
611
|
-
this.filterConf = {
|
|
612
|
-
filters: [],
|
|
613
|
-
andOperator: true,
|
|
614
|
-
};
|
|
615
|
-
this.pagingConf = false;
|
|
648
|
+
this.filteredAndSorted = signal([]);
|
|
649
|
+
this.count = computed(() => this.filteredAndSorted().length);
|
|
616
650
|
this.data = data;
|
|
617
651
|
}
|
|
618
652
|
load(data) {
|
|
619
653
|
this.data = data;
|
|
620
|
-
|
|
654
|
+
this.emitOnChanged({ action: SmartTableOnChangedEventName.load });
|
|
655
|
+
return Promise.resolve(true);
|
|
621
656
|
}
|
|
622
657
|
prepend(element) {
|
|
623
658
|
this.reset(true);
|
|
624
|
-
|
|
625
|
-
return super.prependEmit(element);
|
|
659
|
+
return super.prepend(element);
|
|
626
660
|
}
|
|
627
661
|
appendMany(elements) {
|
|
628
662
|
this.reset(true);
|
|
629
|
-
|
|
630
|
-
return super.loadEmit();
|
|
663
|
+
return super.appendMany(elements);
|
|
631
664
|
}
|
|
632
665
|
append(element) {
|
|
633
666
|
this.reset(true);
|
|
634
|
-
|
|
635
|
-
return super.appendEmit(element);
|
|
636
|
-
}
|
|
637
|
-
add(element) {
|
|
638
|
-
this.data.push(element);
|
|
639
|
-
return super.addEmit(element);
|
|
640
|
-
}
|
|
641
|
-
remove(element) {
|
|
642
|
-
this.data = this.data.filter(el => el !== element);
|
|
643
|
-
return super.removeEmit(element);
|
|
644
|
-
}
|
|
645
|
-
update(element, values) {
|
|
646
|
-
return new Promise((resolve, reject) => {
|
|
647
|
-
this.find(element).then((found) => {
|
|
648
|
-
found = deepExtend(found, values);
|
|
649
|
-
super.updateEmit(found).then(resolve).catch(reject);
|
|
650
|
-
}).catch(reject);
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
find(element) {
|
|
654
|
-
const found = this.data.find(el => el === element);
|
|
655
|
-
if (found) {
|
|
656
|
-
return Promise.resolve(found);
|
|
657
|
-
}
|
|
658
|
-
return Promise.reject(new Error('Element was not found in the dataset'));
|
|
659
|
-
}
|
|
660
|
-
getElements() {
|
|
661
|
-
const data = this.data.slice(0);
|
|
662
|
-
return Promise.resolve(this.prepareData(data));
|
|
663
|
-
}
|
|
664
|
-
getFilteredAndSorted() {
|
|
665
|
-
const data = this.data.slice(0);
|
|
666
|
-
this.prepareData(data);
|
|
667
|
-
return Promise.resolve(this.filteredAndSorted);
|
|
667
|
+
return super.append(element);
|
|
668
668
|
}
|
|
669
669
|
getAll() {
|
|
670
670
|
const data = this.data.slice(0);
|
|
@@ -672,552 +672,183 @@ class LocalDataSource extends DataSource {
|
|
|
672
672
|
}
|
|
673
673
|
reset(silent = false) {
|
|
674
674
|
if (silent) {
|
|
675
|
-
this.
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
};
|
|
679
|
-
this.sortConf = [];
|
|
680
|
-
if (this.pagingConf) {
|
|
681
|
-
this.pagingConf.page = 1;
|
|
682
|
-
}
|
|
675
|
+
this.filters = [];
|
|
676
|
+
this.sortConf = { field: '', direction: 'asc' };
|
|
677
|
+
this.pagingConf.update((old) => ({ ...old, page: 1 }));
|
|
683
678
|
}
|
|
684
679
|
else {
|
|
685
|
-
this.
|
|
686
|
-
this.setSort(
|
|
687
|
-
if (this.pagingConf) {
|
|
680
|
+
this.setFilters([], false);
|
|
681
|
+
this.setSort({ field: '', direction: 'asc' }, false);
|
|
682
|
+
if (this.pagingConf().display) {
|
|
688
683
|
this.setPage(1);
|
|
689
684
|
}
|
|
690
685
|
}
|
|
691
686
|
}
|
|
692
|
-
|
|
693
|
-
this.
|
|
694
|
-
return super.emptyEmit();
|
|
695
|
-
}
|
|
696
|
-
count() {
|
|
697
|
-
return this.filteredAndSorted.length;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
*
|
|
701
|
-
* Array of conf objects
|
|
702
|
-
* [
|
|
703
|
-
* {field: string, direction: asc|desc|null, compare: Function|null},
|
|
704
|
-
* ]
|
|
705
|
-
* @param conf
|
|
706
|
-
* @param doEmit
|
|
707
|
-
* @returns {LocalDataSource}
|
|
708
|
-
*/
|
|
709
|
-
setSort(conf, doEmit = true) {
|
|
710
|
-
if (conf !== null) {
|
|
711
|
-
conf.forEach((fieldConf) => {
|
|
712
|
-
if (!fieldConf.field || typeof fieldConf.direction === 'undefined') {
|
|
713
|
-
throw new Error('Sort configuration object is not valid');
|
|
714
|
-
}
|
|
715
|
-
});
|
|
716
|
-
this.sortConf = conf;
|
|
717
|
-
}
|
|
718
|
-
if (doEmit) {
|
|
719
|
-
super.setSortEmit();
|
|
720
|
-
}
|
|
721
|
-
return this;
|
|
722
|
-
}
|
|
723
|
-
/**
|
|
724
|
-
*
|
|
725
|
-
* Array of conf objects
|
|
726
|
-
* [
|
|
727
|
-
* {field: string, search: string, filter: Function|null},
|
|
728
|
-
* ]
|
|
729
|
-
* @param conf
|
|
730
|
-
* @param andOperator
|
|
731
|
-
* @param doEmit
|
|
732
|
-
* @returns {LocalDataSource}
|
|
733
|
-
*/
|
|
734
|
-
setFilter(conf, andOperator = true, doEmit = true) {
|
|
735
|
-
if (conf && conf.length > 0) {
|
|
736
|
-
conf.forEach((fieldConf) => {
|
|
737
|
-
this.addFilter(fieldConf, andOperator, false);
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
this.filterConf = {
|
|
742
|
-
filters: [],
|
|
743
|
-
andOperator: true,
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
this.filterConf.andOperator = andOperator;
|
|
747
|
-
if (this.pagingConf) {
|
|
748
|
-
this.pagingConf.page = 1;
|
|
749
|
-
}
|
|
750
|
-
if (doEmit) {
|
|
751
|
-
super.setFilterEmit();
|
|
752
|
-
}
|
|
753
|
-
return this;
|
|
687
|
+
getSort() {
|
|
688
|
+
return this.sortConf;
|
|
754
689
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
throw new Error('Filter configuration object is not valid');
|
|
758
|
-
}
|
|
759
|
-
let found = false;
|
|
760
|
-
this.filterConf.filters.forEach((currentFieldConf, index) => {
|
|
761
|
-
if (currentFieldConf.field === fieldConf.field) {
|
|
762
|
-
this.filterConf.filters[index] = fieldConf;
|
|
763
|
-
found = true;
|
|
764
|
-
}
|
|
765
|
-
});
|
|
766
|
-
if (!found) {
|
|
767
|
-
this.filterConf.filters.push(fieldConf);
|
|
768
|
-
}
|
|
769
|
-
this.filterConf.andOperator = andOperator;
|
|
770
|
-
if (doEmit) {
|
|
771
|
-
super.addFilterEmit();
|
|
772
|
-
}
|
|
773
|
-
return this;
|
|
690
|
+
getFilters() {
|
|
691
|
+
return this.filters;
|
|
774
692
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
693
|
+
emitOnChanged(event) {
|
|
694
|
+
let renderData = this.filteredAndSorted();
|
|
695
|
+
const action = event.action;
|
|
696
|
+
if (['filter', 'refresh', 'load'].includes(action)) {
|
|
697
|
+
renderData = this.filter(this.data.slice(0));
|
|
698
|
+
this.filteredAndSorted.set(this.sort(renderData));
|
|
699
|
+
renderData = this.filteredAndSorted();
|
|
779
700
|
}
|
|
780
|
-
|
|
781
|
-
this.
|
|
782
|
-
|
|
783
|
-
};
|
|
784
|
-
}
|
|
785
|
-
if (doEmit) {
|
|
786
|
-
super.setPagingEmit();
|
|
701
|
+
if (['sort', 'filter', 'refresh', 'load'].includes(action)) {
|
|
702
|
+
this.filteredAndSorted.update((list) => this.sort(list));
|
|
703
|
+
renderData = this.filteredAndSorted();
|
|
787
704
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
if (!this.pagingConf) {
|
|
792
|
-
return;
|
|
705
|
+
if (this.pagingConf().display &&
|
|
706
|
+
['page', 'paging', 'refresh', 'load', 'sort', 'filter'].includes(action)) {
|
|
707
|
+
renderData = this.paginate(this.filteredAndSorted());
|
|
793
708
|
}
|
|
794
|
-
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
}
|
|
798
|
-
return;
|
|
799
|
-
}
|
|
800
|
-
getSort() {
|
|
801
|
-
return this.sortConf;
|
|
802
|
-
}
|
|
803
|
-
getFilter() {
|
|
804
|
-
return this.filterConf;
|
|
805
|
-
}
|
|
806
|
-
getPaging() {
|
|
807
|
-
return this.pagingConf;
|
|
808
|
-
}
|
|
809
|
-
prepareData(data) {
|
|
810
|
-
data = this.filter(data);
|
|
811
|
-
data = this.sort(data);
|
|
812
|
-
this.filteredAndSorted = data.slice(0);
|
|
813
|
-
if (this.pagingConf) {
|
|
814
|
-
return this.paginate(data);
|
|
709
|
+
super.emitOnChanged(event, renderData);
|
|
710
|
+
if (this.pagingConf().display && this.isPageOutOfBounce()) {
|
|
711
|
+
this.setPage(this.pagingConf().page - 1);
|
|
815
712
|
}
|
|
816
|
-
else
|
|
817
|
-
return data;
|
|
818
713
|
}
|
|
819
714
|
sort(data) {
|
|
820
715
|
if (this.sortConf) {
|
|
821
|
-
this.sortConf.
|
|
822
|
-
data = LocalSorter
|
|
823
|
-
.sort(data, fieldConf.field, fieldConf.direction, fieldConf.compare);
|
|
824
|
-
});
|
|
716
|
+
data = LocalSorter.sort(data, this.sortConf.field, this.sortConf.direction, this.sortConf.compare);
|
|
825
717
|
}
|
|
826
718
|
return data;
|
|
827
719
|
}
|
|
828
|
-
// TODO: refactor?
|
|
829
720
|
filter(data) {
|
|
830
|
-
if (this.
|
|
831
|
-
|
|
832
|
-
this.
|
|
833
|
-
|
|
834
|
-
data = LocalFilter
|
|
835
|
-
.filter(data, fieldConf.field, fieldConf.search, fieldConf.filter);
|
|
836
|
-
}
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
else {
|
|
840
|
-
let mergedData = [];
|
|
841
|
-
this.filterConf.filters.forEach((fieldConf) => {
|
|
842
|
-
if (fieldConf.search?.length > 0) {
|
|
843
|
-
mergedData = mergedData.concat(LocalFilter
|
|
844
|
-
.filter(data, fieldConf.field, fieldConf.search, fieldConf.filter));
|
|
845
|
-
}
|
|
846
|
-
});
|
|
847
|
-
// remove non unique items
|
|
848
|
-
data = mergedData.filter((elem, pos, arr) => {
|
|
849
|
-
return arr.indexOf(elem) === pos;
|
|
850
|
-
});
|
|
851
|
-
}
|
|
721
|
+
if (this.filters.length > 0) {
|
|
722
|
+
return data.filter((item) => {
|
|
723
|
+
return isElementSatisfied(item, this.filters);
|
|
724
|
+
});
|
|
852
725
|
}
|
|
853
726
|
return data;
|
|
854
727
|
}
|
|
855
728
|
paginate(data) {
|
|
856
|
-
if (this.pagingConf
|
|
857
|
-
|
|
729
|
+
if (this.pagingConf().display) {
|
|
730
|
+
return paginateList(data, this.pagingConf().page, this.pagingConf().perPage);
|
|
858
731
|
}
|
|
859
732
|
return data;
|
|
860
733
|
}
|
|
734
|
+
isPageOutOfBounce() {
|
|
735
|
+
const { page, perPage } = this.pagingConf();
|
|
736
|
+
return page * perPage >= this.count() + perPage && page > 1;
|
|
737
|
+
}
|
|
861
738
|
}
|
|
862
739
|
|
|
863
|
-
class
|
|
864
|
-
constructor() {
|
|
865
|
-
|
|
866
|
-
this.
|
|
867
|
-
this.
|
|
868
|
-
this.
|
|
869
|
-
this.
|
|
870
|
-
this.
|
|
871
|
-
this.perPage = 0;
|
|
740
|
+
class ServerDataSource extends DataSource {
|
|
741
|
+
constructor(paramPrepareFunction, requestFunction, initPagingConf) {
|
|
742
|
+
super();
|
|
743
|
+
this.initPagingConf = initPagingConf;
|
|
744
|
+
this.count = computed(() => this.pagingConf().total);
|
|
745
|
+
this.pagingConf.update((old) => ({ ...old, ...this.initPagingConf }));
|
|
746
|
+
this.paramPrepareFunction = paramPrepareFunction;
|
|
747
|
+
this.requestFunction = requestFunction;
|
|
872
748
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
if (!changes["source"].firstChange && this.dataChangedSub) {
|
|
876
|
-
this.dataChangedSub.unsubscribe();
|
|
877
|
-
}
|
|
878
|
-
this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
|
|
879
|
-
const paging = this.source.getPaging();
|
|
880
|
-
if (paging) {
|
|
881
|
-
this.page = paging.page;
|
|
882
|
-
this.perPage = paging.perPage;
|
|
883
|
-
}
|
|
884
|
-
this.currentPerPage = this.perPage;
|
|
885
|
-
this.count = this.source.count();
|
|
886
|
-
if (this.isPageOutOfBounce()) {
|
|
887
|
-
this.source.setPage(--this.page);
|
|
888
|
-
}
|
|
889
|
-
this.processPageChange(dataChanges);
|
|
890
|
-
this.initPages();
|
|
891
|
-
});
|
|
892
|
-
}
|
|
749
|
+
getAll() {
|
|
750
|
+
return Promise.resolve(this.data);
|
|
893
751
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (
|
|
902
|
-
|
|
752
|
+
getSort() {
|
|
753
|
+
return this.sortConf;
|
|
754
|
+
}
|
|
755
|
+
getFilters() {
|
|
756
|
+
return this.filters;
|
|
757
|
+
}
|
|
758
|
+
emitOnChanged(eventData, newElements) {
|
|
759
|
+
if ([
|
|
760
|
+
SmartTableOnChangedEventName.filter,
|
|
761
|
+
SmartTableOnChangedEventName.sort,
|
|
762
|
+
SmartTableOnChangedEventName.page,
|
|
763
|
+
SmartTableOnChangedEventName.paging,
|
|
764
|
+
SmartTableOnChangedEventName.refresh,
|
|
765
|
+
].includes(eventData.action)) {
|
|
766
|
+
this.paramPrepareFunction({
|
|
767
|
+
sort: this.sortConf,
|
|
768
|
+
filters: this.filters,
|
|
769
|
+
page: this.pagingConf().page,
|
|
770
|
+
limit: this.pagingConf().perPage,
|
|
771
|
+
})
|
|
772
|
+
.pipe(switchMap((params) => this.requestFunction(params)))
|
|
773
|
+
.subscribe((res) => {
|
|
774
|
+
this.data = res.data;
|
|
775
|
+
this.pagingConf.update((old) => ({ ...old, total: res.total }));
|
|
776
|
+
super.emitOnChanged(eventData, res.data);
|
|
777
|
+
});
|
|
903
778
|
}
|
|
904
|
-
|
|
905
|
-
|
|
779
|
+
else {
|
|
780
|
+
super.emitOnChanged(eventData, newElements);
|
|
906
781
|
}
|
|
907
782
|
}
|
|
908
|
-
|
|
909
|
-
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
class PagerComponent {
|
|
786
|
+
constructor() {
|
|
787
|
+
this.source = input.required();
|
|
788
|
+
this.pagingConf = computed(() => this.source().pagingConf());
|
|
789
|
+
this.currentPerPage = computed(() => this.pagingConf().perPage);
|
|
790
|
+
this.currentPage = computed(() => this.pagingConf().page);
|
|
791
|
+
this.count = computed(() => this.source().count());
|
|
792
|
+
this.shouldShow = computed(() => this.pagingConf().display && this.count() > this.currentPerPage());
|
|
793
|
+
this.lastPage = computed(() => Math.ceil(this.count() / this.currentPerPage()));
|
|
794
|
+
this.pages = computed(() => this.getPages(this.currentPage(), this.lastPage()));
|
|
910
795
|
}
|
|
911
796
|
paginate(page) {
|
|
912
|
-
this.source.setPage(page);
|
|
913
|
-
this.page = page;
|
|
914
|
-
this.changePage.emit({ page });
|
|
915
|
-
return false;
|
|
797
|
+
this.source().setPage(page);
|
|
916
798
|
}
|
|
917
799
|
next() {
|
|
918
|
-
|
|
800
|
+
this.paginate(this.currentPage() + 1);
|
|
919
801
|
}
|
|
920
802
|
prev() {
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
getPage() {
|
|
924
|
-
return this.page;
|
|
925
|
-
}
|
|
926
|
-
getPages() {
|
|
927
|
-
return this.pages;
|
|
803
|
+
this.paginate(this.currentPage() - 1);
|
|
928
804
|
}
|
|
929
|
-
|
|
930
|
-
return
|
|
805
|
+
isString(value) {
|
|
806
|
+
return typeof value === 'string';
|
|
931
807
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
showPagesCount = pagesCount < showPagesCount ? pagesCount : showPagesCount;
|
|
939
|
-
this.pages = [];
|
|
940
|
-
if (this.shouldShow()) {
|
|
941
|
-
let middleOne = Math.ceil(showPagesCount / 2);
|
|
942
|
-
middleOne = this.page >= middleOne ? this.page : middleOne;
|
|
943
|
-
let lastOne = middleOne + Math.floor(showPagesCount / 2);
|
|
944
|
-
lastOne = lastOne >= pagesCount ? pagesCount : lastOne;
|
|
945
|
-
const firstOne = lastOne - showPagesCount + 1;
|
|
946
|
-
for (let i = firstOne; i <= lastOne; i++) {
|
|
947
|
-
this.pages.push(i);
|
|
808
|
+
getPages(current, last) {
|
|
809
|
+
const delta = 2, left = current - delta, right = current + delta + 1, range = [], rangeWithDots = [];
|
|
810
|
+
let l;
|
|
811
|
+
for (let i = 1; i <= last; i++) {
|
|
812
|
+
if (i == 1 || i == last || (i >= left && i < right)) {
|
|
813
|
+
range.push(i);
|
|
948
814
|
}
|
|
949
815
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
816
|
+
for (const i of range) {
|
|
817
|
+
if (l) {
|
|
818
|
+
if (i - l === 2) {
|
|
819
|
+
rangeWithDots.push(l + 1);
|
|
820
|
+
}
|
|
821
|
+
else if (i - l !== 1) {
|
|
822
|
+
rangeWithDots.push('...');
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
rangeWithDots.push(i);
|
|
826
|
+
l = i;
|
|
955
827
|
}
|
|
956
|
-
|
|
957
|
-
this.initPages();
|
|
828
|
+
return rangeWithDots;
|
|
958
829
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
<nav class="ng2-smart-pagination-nav">
|
|
963
|
-
<ul class="ng2-smart-pagination pagination">
|
|
964
|
-
<li
|
|
965
|
-
class="ng2-smart-page-item page-item"
|
|
966
|
-
[class.disabled]="getPage() === 1"
|
|
967
|
-
>
|
|
968
|
-
<a
|
|
969
|
-
class="ng2-smart-page-link page-link"
|
|
970
|
-
href="#"
|
|
971
|
-
(click)="getPage() === 1 ? false : paginate(1)"
|
|
972
|
-
aria-label="First"
|
|
973
|
-
>
|
|
974
|
-
<span aria-hidden="true">«</span>
|
|
975
|
-
<span class="sr-only">First</span>
|
|
976
|
-
</a>
|
|
977
|
-
</li>
|
|
978
|
-
<li
|
|
979
|
-
class="ng2-smart-page-item page-item"
|
|
980
|
-
[class.disabled]="getPage() === 1"
|
|
981
|
-
>
|
|
982
|
-
<a
|
|
983
|
-
class="ng2-smart-page-link page-link page-link-prev"
|
|
984
|
-
href="#"
|
|
985
|
-
(click)="getPage() === 1 ? false : prev()"
|
|
986
|
-
aria-label="Prev"
|
|
987
|
-
>
|
|
988
|
-
<span aria-hidden="true"><</span>
|
|
989
|
-
<span class="sr-only">Prev</span>
|
|
990
|
-
</a>
|
|
991
|
-
</li>
|
|
992
|
-
@for (page of getPages(); track page) {
|
|
993
|
-
<li
|
|
994
|
-
class="ng2-smart-page-item page-item"
|
|
995
|
-
[class.active]="getPage() === page"
|
|
996
|
-
>
|
|
997
|
-
@if (getPage() === page) {
|
|
998
|
-
<span class="ng2-smart-page-link page-link"
|
|
999
|
-
>{{ page }} <span class="sr-only">(current)</span></span
|
|
1000
|
-
>
|
|
1001
|
-
} @if (getPage() !== page) {
|
|
1002
|
-
<a
|
|
1003
|
-
class="ng2-smart-page-link page-link"
|
|
1004
|
-
href="#"
|
|
1005
|
-
(click)="paginate(page)"
|
|
1006
|
-
>{{ page }}</a
|
|
1007
|
-
>
|
|
1008
|
-
}
|
|
1009
|
-
</li>
|
|
1010
|
-
}
|
|
1011
|
-
<li
|
|
1012
|
-
class="ng2-smart-page-item page-item"
|
|
1013
|
-
[class.disabled]="getPage() === getLast()"
|
|
1014
|
-
>
|
|
1015
|
-
<a
|
|
1016
|
-
class="ng2-smart-page-link page-link page-link-next"
|
|
1017
|
-
href="#"
|
|
1018
|
-
(click)="getPage() === getLast() ? false : next()"
|
|
1019
|
-
aria-label="Next"
|
|
1020
|
-
>
|
|
1021
|
-
<span aria-hidden="true">></span>
|
|
1022
|
-
<span class="sr-only">Next</span>
|
|
1023
|
-
</a>
|
|
1024
|
-
</li>
|
|
1025
|
-
<li
|
|
1026
|
-
class="ng2-smart-page-item page-item"
|
|
1027
|
-
[class.disabled]="getPage() === getLast()"
|
|
1028
|
-
>
|
|
1029
|
-
<a
|
|
1030
|
-
class="ng2-smart-page-link page-link"
|
|
1031
|
-
href="#"
|
|
1032
|
-
(click)="getPage() === getLast() ? false : paginate(getLast())"
|
|
1033
|
-
aria-label="Last"
|
|
1034
|
-
>
|
|
1035
|
-
<span aria-hidden="true">»</span>
|
|
1036
|
-
<span class="sr-only">Last</span>
|
|
1037
|
-
</a>
|
|
1038
|
-
</li>
|
|
1039
|
-
</ul>
|
|
1040
|
-
</nav>
|
|
1041
|
-
} @if (perPageSelect && perPageSelect.length > 0) {
|
|
1042
|
-
<nav class="ng2-smart-pagination-per-page">
|
|
1043
|
-
<label for="per-page"> Per Page: </label>
|
|
1044
|
-
<select
|
|
1045
|
-
(change)="onChangePerPage()"
|
|
1046
|
-
[(ngModel)]="currentPerPage"
|
|
1047
|
-
id="per-page"
|
|
1048
|
-
>
|
|
1049
|
-
@for (item of perPageSelect; track $index) {
|
|
1050
|
-
<option [value]="item">{{ item }}</option>
|
|
830
|
+
onChangePerPage(target) {
|
|
831
|
+
if (!target.value) {
|
|
832
|
+
return;
|
|
1051
833
|
}
|
|
1052
|
-
|
|
1053
|
-
</nav>
|
|
834
|
+
this.source().setPaging(1, +target.value);
|
|
1054
835
|
}
|
|
1055
|
-
|
|
836
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
837
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: PagerComponent, isStandalone: true, selector: "ng2-smart-table-pager", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (shouldShow()) {\n<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">«</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\"><</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">></span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">»</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n\n}\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\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])[formControlName],select:not([multiple])[formControl],select:not([multiple])[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"] }] }); }
|
|
1056
838
|
}
|
|
1057
839
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, decorators: [{
|
|
1058
840
|
type: Component,
|
|
1059
|
-
args: [{ selector:
|
|
1060
|
-
@if (shouldShow()) {
|
|
1061
|
-
<nav class="ng2-smart-pagination-nav">
|
|
1062
|
-
<ul class="ng2-smart-pagination pagination">
|
|
1063
|
-
<li
|
|
1064
|
-
class="ng2-smart-page-item page-item"
|
|
1065
|
-
[class.disabled]="getPage() === 1"
|
|
1066
|
-
>
|
|
1067
|
-
<a
|
|
1068
|
-
class="ng2-smart-page-link page-link"
|
|
1069
|
-
href="#"
|
|
1070
|
-
(click)="getPage() === 1 ? false : paginate(1)"
|
|
1071
|
-
aria-label="First"
|
|
1072
|
-
>
|
|
1073
|
-
<span aria-hidden="true">«</span>
|
|
1074
|
-
<span class="sr-only">First</span>
|
|
1075
|
-
</a>
|
|
1076
|
-
</li>
|
|
1077
|
-
<li
|
|
1078
|
-
class="ng2-smart-page-item page-item"
|
|
1079
|
-
[class.disabled]="getPage() === 1"
|
|
1080
|
-
>
|
|
1081
|
-
<a
|
|
1082
|
-
class="ng2-smart-page-link page-link page-link-prev"
|
|
1083
|
-
href="#"
|
|
1084
|
-
(click)="getPage() === 1 ? false : prev()"
|
|
1085
|
-
aria-label="Prev"
|
|
1086
|
-
>
|
|
1087
|
-
<span aria-hidden="true"><</span>
|
|
1088
|
-
<span class="sr-only">Prev</span>
|
|
1089
|
-
</a>
|
|
1090
|
-
</li>
|
|
1091
|
-
@for (page of getPages(); track page) {
|
|
1092
|
-
<li
|
|
1093
|
-
class="ng2-smart-page-item page-item"
|
|
1094
|
-
[class.active]="getPage() === page"
|
|
1095
|
-
>
|
|
1096
|
-
@if (getPage() === page) {
|
|
1097
|
-
<span class="ng2-smart-page-link page-link"
|
|
1098
|
-
>{{ page }} <span class="sr-only">(current)</span></span
|
|
1099
|
-
>
|
|
1100
|
-
} @if (getPage() !== page) {
|
|
1101
|
-
<a
|
|
1102
|
-
class="ng2-smart-page-link page-link"
|
|
1103
|
-
href="#"
|
|
1104
|
-
(click)="paginate(page)"
|
|
1105
|
-
>{{ page }}</a
|
|
1106
|
-
>
|
|
1107
|
-
}
|
|
1108
|
-
</li>
|
|
1109
|
-
}
|
|
1110
|
-
<li
|
|
1111
|
-
class="ng2-smart-page-item page-item"
|
|
1112
|
-
[class.disabled]="getPage() === getLast()"
|
|
1113
|
-
>
|
|
1114
|
-
<a
|
|
1115
|
-
class="ng2-smart-page-link page-link page-link-next"
|
|
1116
|
-
href="#"
|
|
1117
|
-
(click)="getPage() === getLast() ? false : next()"
|
|
1118
|
-
aria-label="Next"
|
|
1119
|
-
>
|
|
1120
|
-
<span aria-hidden="true">></span>
|
|
1121
|
-
<span class="sr-only">Next</span>
|
|
1122
|
-
</a>
|
|
1123
|
-
</li>
|
|
1124
|
-
<li
|
|
1125
|
-
class="ng2-smart-page-item page-item"
|
|
1126
|
-
[class.disabled]="getPage() === getLast()"
|
|
1127
|
-
>
|
|
1128
|
-
<a
|
|
1129
|
-
class="ng2-smart-page-link page-link"
|
|
1130
|
-
href="#"
|
|
1131
|
-
(click)="getPage() === getLast() ? false : paginate(getLast())"
|
|
1132
|
-
aria-label="Last"
|
|
1133
|
-
>
|
|
1134
|
-
<span aria-hidden="true">»</span>
|
|
1135
|
-
<span class="sr-only">Last</span>
|
|
1136
|
-
</a>
|
|
1137
|
-
</li>
|
|
1138
|
-
</ul>
|
|
1139
|
-
</nav>
|
|
1140
|
-
} @if (perPageSelect && perPageSelect.length > 0) {
|
|
1141
|
-
<nav class="ng2-smart-pagination-per-page">
|
|
1142
|
-
<label for="per-page"> Per Page: </label>
|
|
1143
|
-
<select
|
|
1144
|
-
(change)="onChangePerPage()"
|
|
1145
|
-
[(ngModel)]="currentPerPage"
|
|
1146
|
-
id="per-page"
|
|
1147
|
-
>
|
|
1148
|
-
@for (item of perPageSelect; track $index) {
|
|
1149
|
-
<option [value]="item">{{ item }}</option>
|
|
1150
|
-
}
|
|
1151
|
-
</select>
|
|
1152
|
-
</nav>
|
|
1153
|
-
}
|
|
1154
|
-
`, standalone: true, imports: [FormsModule], styles: [".ng2-smart-pagination{display:inline-flex;font-size:.875em;padding:0}.ng2-smart-pagination .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}:host{display:flex;justify-content:space-between}:host select{margin:1rem 0 1rem 1rem}:host label{margin:1rem 0 1rem 1rem;line-height:2.5rem}\n"] }]
|
|
1155
|
-
}], propDecorators: { source: [{
|
|
1156
|
-
type: Input
|
|
1157
|
-
}], perPageSelect: [{
|
|
1158
|
-
type: Input
|
|
1159
|
-
}] } });
|
|
1160
|
-
|
|
1161
|
-
class EditCellDefaultComponent {
|
|
1162
|
-
constructor() {
|
|
1163
|
-
this.cell = input.required();
|
|
1164
|
-
this.inputClass = input('');
|
|
1165
|
-
}
|
|
1166
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefaultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1167
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: EditCellDefaultComponent, isStandalone: true, selector: "ng2-edit-cell-default-base-component", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true }); }
|
|
1168
|
-
}
|
|
1169
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefaultComponent, decorators: [{
|
|
1170
|
-
type: Component,
|
|
1171
|
-
args: [{ template: '', selector: 'ng2-edit-cell-default-base-component' }]
|
|
841
|
+
args: [{ selector: 'ng2-smart-table-pager', standalone: true, imports: [FormsModule], template: "@if (shouldShow()) {\n<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">«</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\"><</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">></span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">»</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n\n}\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\n"] }]
|
|
1172
842
|
}] });
|
|
1173
843
|
|
|
1174
|
-
class
|
|
1175
|
-
ngOnChanges(changes) {
|
|
1176
|
-
const editor = this.cell().getColumn().editor;
|
|
1177
|
-
if (this.customComponent) {
|
|
1178
|
-
if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
|
|
1179
|
-
const onChanges = this.customComponent.instance.ngOnChanges;
|
|
1180
|
-
onChanges(changes);
|
|
1181
|
-
}
|
|
1182
|
-
return;
|
|
1183
|
-
}
|
|
1184
|
-
if (this.cell() &&
|
|
1185
|
-
!this.customComponent &&
|
|
1186
|
-
editor &&
|
|
1187
|
-
editor.type == "custom") {
|
|
1188
|
-
this.customComponent = this.dynamicTarget?.createComponent(editor.component);
|
|
1189
|
-
this.customComponent?.setInput('cell', this.cell());
|
|
1190
|
-
this.customComponent?.setInput('inputClass', this.inputClass());
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
ngOnDestroy() {
|
|
1194
|
-
if (this.customComponent) {
|
|
1195
|
-
this.customComponent.destroy();
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1199
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomEditComponent, isStandalone: true, selector: "ng2-table-cell-custom-editor", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ` <ng-template #dynamicTarget></ng-template> `, isInline: true }); }
|
|
1200
|
-
}
|
|
1201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, decorators: [{
|
|
1202
|
-
type: Component,
|
|
1203
|
-
args: [{
|
|
1204
|
-
selector: "ng2-table-cell-custom-editor",
|
|
1205
|
-
template: ` <ng-template #dynamicTarget></ng-template> `,
|
|
1206
|
-
standalone: true,
|
|
1207
|
-
}]
|
|
1208
|
-
}], propDecorators: { dynamicTarget: [{
|
|
1209
|
-
type: ViewChild,
|
|
1210
|
-
args: ["dynamicTarget", { read: ViewContainerRef, static: true }]
|
|
1211
|
-
}] } });
|
|
1212
|
-
|
|
1213
|
-
class CheckboxEditorComponent extends DefaultEditor {
|
|
844
|
+
class CheckboxEditorComponent extends BaseEditorComponent {
|
|
1214
845
|
constructor() {
|
|
1215
846
|
super();
|
|
1216
847
|
this.trueVal = computed(() => {
|
|
1217
|
-
return this.cell().getColumn().
|
|
848
|
+
return this.cell().getColumn().getEditorConfig()?.true || true;
|
|
1218
849
|
});
|
|
1219
850
|
this.falseVal = computed(() => {
|
|
1220
|
-
return this.cell().getColumn().
|
|
851
|
+
return this.cell().getColumn().getEditorConfig()?.false || false;
|
|
1221
852
|
});
|
|
1222
853
|
}
|
|
1223
854
|
onChange(event) {
|
|
@@ -1232,15 +863,12 @@ class CheckboxEditorComponent extends DefaultEditor {
|
|
|
1232
863
|
[name]="cell().getId()"
|
|
1233
864
|
[disabled]="!cell().isEditable()"
|
|
1234
865
|
(change)="onChange($event)"
|
|
1235
|
-
[checked]="
|
|
1236
|
-
cell().getValue() === trueVal()
|
|
1237
|
-
"
|
|
1238
|
-
/>
|
|
866
|
+
[checked]="cell().getValue() === trueVal()" />
|
|
1239
867
|
`, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }); }
|
|
1240
868
|
}
|
|
1241
869
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
|
|
1242
870
|
type: Component,
|
|
1243
|
-
args: [{ selector:
|
|
871
|
+
args: [{ selector: 'ng2-checkbox-editor', template: `
|
|
1244
872
|
<input
|
|
1245
873
|
[class]="inputClass()"
|
|
1246
874
|
type="checkbox"
|
|
@@ -1248,18 +876,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
1248
876
|
[name]="cell().getId()"
|
|
1249
877
|
[disabled]="!cell().isEditable()"
|
|
1250
878
|
(change)="onChange($event)"
|
|
1251
|
-
[checked]="
|
|
1252
|
-
cell().getValue() === trueVal()
|
|
1253
|
-
"
|
|
1254
|
-
/>
|
|
879
|
+
[checked]="cell().getValue() === trueVal()" />
|
|
1255
880
|
`, standalone: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
1256
881
|
}], ctorParameters: () => [] });
|
|
1257
882
|
|
|
1258
|
-
class InputEditorComponent extends
|
|
1259
|
-
|
|
1260
|
-
super();
|
|
1261
|
-
}
|
|
1262
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
883
|
+
class InputEditorComponent extends BaseEditorComponent {
|
|
884
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1263
885
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputEditorComponent, isStandalone: true, selector: "ng2-input-editor", usesInheritance: true, ngImport: i0, template: `
|
|
1264
886
|
<input
|
|
1265
887
|
[class]="inputClass()"
|
|
@@ -1267,42 +889,33 @@ class InputEditorComponent extends DefaultEditor {
|
|
|
1267
889
|
[(ngModel)]="cell().newValue"
|
|
1268
890
|
[name]="cell().getId()"
|
|
1269
891
|
[placeholder]="cell().getTitle()"
|
|
1270
|
-
[disabled]="!cell().isEditable()"
|
|
1271
|
-
/>
|
|
892
|
+
[disabled]="!cell().isEditable()" />
|
|
1272
893
|
`, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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"] }] }); }
|
|
1273
894
|
}
|
|
1274
895
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, decorators: [{
|
|
1275
896
|
type: Component,
|
|
1276
|
-
args: [{ selector:
|
|
897
|
+
args: [{ selector: 'ng2-input-editor', template: `
|
|
1277
898
|
<input
|
|
1278
899
|
[class]="inputClass()"
|
|
1279
900
|
class="form-control"
|
|
1280
901
|
[(ngModel)]="cell().newValue"
|
|
1281
902
|
[name]="cell().getId()"
|
|
1282
903
|
[placeholder]="cell().getTitle()"
|
|
1283
|
-
[disabled]="!cell().isEditable()"
|
|
1284
|
-
/>
|
|
904
|
+
[disabled]="!cell().isEditable()" />
|
|
1285
905
|
`, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
1286
|
-
}]
|
|
906
|
+
}] });
|
|
1287
907
|
|
|
1288
|
-
class SelectEditorComponent extends
|
|
1289
|
-
|
|
1290
|
-
super();
|
|
1291
|
-
}
|
|
1292
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
908
|
+
class SelectEditorComponent extends BaseEditorComponent {
|
|
909
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1293
910
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectEditorComponent, isStandalone: true, selector: "ng2-select-editor", usesInheritance: true, ngImport: i0, template: `
|
|
1294
911
|
<select
|
|
1295
912
|
[class]="inputClass()"
|
|
1296
913
|
class="form-control"
|
|
1297
914
|
[(ngModel)]="cell().newValue"
|
|
1298
915
|
[name]="cell().getId()"
|
|
1299
|
-
[disabled]="!cell().isEditable()"
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
<option
|
|
1303
|
-
[value]="option.value"
|
|
1304
|
-
[selected]="option.value === cell().getValue()"
|
|
1305
|
-
>
|
|
916
|
+
[disabled]="!cell().isEditable()">
|
|
917
|
+
@for (option of cell().getColumn().getEditorConfig()?.list; track $index) {
|
|
918
|
+
<option [value]="option.value" [selected]="option.value === cell().getValue()">
|
|
1306
919
|
{{ option.title }}
|
|
1307
920
|
</option>
|
|
1308
921
|
}
|
|
@@ -1312,20 +925,16 @@ class SelectEditorComponent extends DefaultEditor {
|
|
|
1312
925
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, decorators: [{
|
|
1313
926
|
type: Component,
|
|
1314
927
|
args: [{
|
|
1315
|
-
selector:
|
|
928
|
+
selector: 'ng2-select-editor',
|
|
1316
929
|
template: `
|
|
1317
930
|
<select
|
|
1318
931
|
[class]="inputClass()"
|
|
1319
932
|
class="form-control"
|
|
1320
933
|
[(ngModel)]="cell().newValue"
|
|
1321
934
|
[name]="cell().getId()"
|
|
1322
|
-
[disabled]="!cell().isEditable()"
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
<option
|
|
1326
|
-
[value]="option.value"
|
|
1327
|
-
[selected]="option.value === cell().getValue()"
|
|
1328
|
-
>
|
|
935
|
+
[disabled]="!cell().isEditable()">
|
|
936
|
+
@for (option of cell().getColumn().getEditorConfig()?.list; track $index) {
|
|
937
|
+
<option [value]="option.value" [selected]="option.value === cell().getValue()">
|
|
1329
938
|
{{ option.title }}
|
|
1330
939
|
</option>
|
|
1331
940
|
}
|
|
@@ -1334,13 +943,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
1334
943
|
standalone: true,
|
|
1335
944
|
imports: [FormsModule],
|
|
1336
945
|
}]
|
|
1337
|
-
}]
|
|
946
|
+
}] });
|
|
1338
947
|
|
|
1339
|
-
class TextareaEditorComponent extends
|
|
1340
|
-
|
|
1341
|
-
super();
|
|
1342
|
-
}
|
|
1343
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
948
|
+
class TextareaEditorComponent extends BaseEditorComponent {
|
|
949
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1344
950
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: TextareaEditorComponent, isStandalone: true, selector: "ng2-textarea-editor", usesInheritance: true, ngImport: i0, template: `
|
|
1345
951
|
<textarea
|
|
1346
952
|
[class]="inputClass()"
|
|
@@ -1348,98 +954,117 @@ class TextareaEditorComponent extends DefaultEditor {
|
|
|
1348
954
|
[(ngModel)]="cell().newValue"
|
|
1349
955
|
[name]="cell().getId()"
|
|
1350
956
|
[disabled]="!cell().isEditable()"
|
|
1351
|
-
[placeholder]="cell().getTitle()"
|
|
1352
|
-
>
|
|
957
|
+
[placeholder]="cell().getTitle()">
|
|
1353
958
|
</textarea>
|
|
1354
959
|
`, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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"] }] }); }
|
|
1355
960
|
}
|
|
1356
961
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, decorators: [{
|
|
1357
962
|
type: Component,
|
|
1358
|
-
args: [{ selector:
|
|
963
|
+
args: [{ selector: 'ng2-textarea-editor', template: `
|
|
1359
964
|
<textarea
|
|
1360
965
|
[class]="inputClass()"
|
|
1361
966
|
class="form-control"
|
|
1362
967
|
[(ngModel)]="cell().newValue"
|
|
1363
968
|
[name]="cell().getId()"
|
|
1364
969
|
[disabled]="!cell().isEditable()"
|
|
1365
|
-
[placeholder]="cell().getTitle()"
|
|
1366
|
-
>
|
|
970
|
+
[placeholder]="cell().getTitle()">
|
|
1367
971
|
</textarea>
|
|
1368
972
|
`, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
1369
|
-
}]
|
|
973
|
+
}] });
|
|
1370
974
|
|
|
1371
|
-
class
|
|
975
|
+
class BuildInEditorComponent extends BaseEditorComponent {
|
|
1372
976
|
constructor() {
|
|
1373
|
-
super();
|
|
977
|
+
super(...arguments);
|
|
978
|
+
this.editorType = computed(() => {
|
|
979
|
+
const editor = this.cell().getColumn().editor;
|
|
980
|
+
if (editor) {
|
|
981
|
+
return editor.type || 'text';
|
|
982
|
+
}
|
|
983
|
+
return 'text';
|
|
984
|
+
});
|
|
1374
985
|
}
|
|
1375
|
-
|
|
986
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
987
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: BuildInEditorComponent, isStandalone: true, selector: "ng2-table-cell-build-in-editor", usesInheritance: true, ngImport: i0, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (editorType()) {\n @case ('list') {\n <ng2-select-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-select-editor>\n }\n @case ('textarea') {\n <ng2-textarea-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-textarea-editor>\n }\n @case ('checkbox') {\n <ng2-checkbox-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-checkbox-editor>\n }\n @default {\n <ng2-input-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-input-editor>\n }\n}\n</div>", dependencies: [{ kind: "component", type: SelectEditorComponent, selector: "ng2-select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "ng2-textarea-editor" }, { kind: "component", type: CheckboxEditorComponent, selector: "ng2-checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "ng2-input-editor" }] }); }
|
|
988
|
+
}
|
|
989
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInEditorComponent, decorators: [{
|
|
990
|
+
type: Component,
|
|
991
|
+
args: [{ selector: 'ng2-table-cell-build-in-editor', imports: [SelectEditorComponent, TextareaEditorComponent, CheckboxEditorComponent, InputEditorComponent], standalone: true, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (editorType()) {\n @case ('list') {\n <ng2-select-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-select-editor>\n }\n @case ('textarea') {\n <ng2-textarea-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-textarea-editor>\n }\n @case ('checkbox') {\n <ng2-checkbox-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-checkbox-editor>\n }\n @default {\n <ng2-input-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-input-editor>\n }\n}\n</div>" }]
|
|
992
|
+
}] });
|
|
993
|
+
|
|
994
|
+
class CustomEditComponent extends BaseEditorComponent {
|
|
995
|
+
ngOnChanges(changes) {
|
|
1376
996
|
const editor = this.cell().getColumn().editor;
|
|
1377
|
-
if (
|
|
1378
|
-
|
|
997
|
+
if (this.customComponent) {
|
|
998
|
+
if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
|
|
999
|
+
const onChanges = this.customComponent.instance.ngOnChanges;
|
|
1000
|
+
onChanges(changes);
|
|
1001
|
+
}
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
if (this.cell() && !this.customComponent && editor && editor.type == 'custom') {
|
|
1005
|
+
this.customComponent = this.dynamicTarget?.createComponent(editor.component);
|
|
1006
|
+
this.customComponent?.setInput('cell', this.cell());
|
|
1007
|
+
this.customComponent?.setInput('inputClass', this.inputClass());
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
ngOnDestroy() {
|
|
1011
|
+
if (this.customComponent) {
|
|
1012
|
+
this.customComponent.destroy();
|
|
1379
1013
|
}
|
|
1380
|
-
return "text";
|
|
1381
1014
|
}
|
|
1382
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1383
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1015
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1016
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomEditComponent, isStandalone: true, selector: "ng2-table-cell-custom-editor", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ` <ng-template #dynamicTarget></ng-template> `, isInline: true }); }
|
|
1384
1017
|
}
|
|
1385
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1018
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, decorators: [{
|
|
1386
1019
|
type: Component,
|
|
1387
|
-
args: [{
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1020
|
+
args: [{
|
|
1021
|
+
selector: 'ng2-table-cell-custom-editor',
|
|
1022
|
+
template: ` <ng-template #dynamicTarget></ng-template> `,
|
|
1023
|
+
standalone: true,
|
|
1024
|
+
}]
|
|
1025
|
+
}], propDecorators: { dynamicTarget: [{
|
|
1026
|
+
type: ViewChild,
|
|
1027
|
+
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
1028
|
+
}] } });
|
|
1394
1029
|
|
|
1395
1030
|
class EditCellComponent {
|
|
1396
1031
|
constructor() {
|
|
1397
1032
|
this.cell = input.required();
|
|
1398
|
-
this.inputClass = input(
|
|
1033
|
+
this.inputClass = input('');
|
|
1399
1034
|
}
|
|
1400
1035
|
getEditorType() {
|
|
1401
1036
|
const editor = this.cell().getColumn().editor;
|
|
1402
1037
|
if (editor) {
|
|
1403
1038
|
return editor.type;
|
|
1404
1039
|
}
|
|
1405
|
-
return
|
|
1040
|
+
return 'text';
|
|
1406
1041
|
}
|
|
1407
1042
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1408
1043
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: EditCellComponent, isStandalone: true, selector: "ng2-table-cell-edit-mode", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1409
1044
|
<div>
|
|
1410
1045
|
@switch (getEditorType()) { @case ('custom') {
|
|
1411
|
-
<ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()">
|
|
1412
|
-
</ng2-table-cell-custom-editor>
|
|
1046
|
+
<ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-custom-editor>
|
|
1413
1047
|
} @default {
|
|
1414
|
-
<ng2-table-cell-
|
|
1415
|
-
[cell]="cell()"
|
|
1416
|
-
[inputClass]="inputClass()"
|
|
1417
|
-
>
|
|
1418
|
-
</ng2-table-cell-default-editor>
|
|
1048
|
+
<ng2-table-cell-build-in-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-build-in-editor>
|
|
1419
1049
|
} }
|
|
1420
1050
|
</div>
|
|
1421
|
-
`, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "ng2-table-cell-custom-editor" }, { kind: "component", type:
|
|
1051
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "ng2-table-cell-custom-editor" }, { kind: "component", type: BuildInEditorComponent, selector: "ng2-table-cell-build-in-editor" }] }); }
|
|
1422
1052
|
}
|
|
1423
1053
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, decorators: [{
|
|
1424
1054
|
type: Component,
|
|
1425
1055
|
args: [{
|
|
1426
|
-
selector:
|
|
1056
|
+
selector: 'ng2-table-cell-edit-mode',
|
|
1427
1057
|
template: `
|
|
1428
1058
|
<div>
|
|
1429
1059
|
@switch (getEditorType()) { @case ('custom') {
|
|
1430
|
-
<ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()">
|
|
1431
|
-
</ng2-table-cell-custom-editor>
|
|
1060
|
+
<ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-custom-editor>
|
|
1432
1061
|
} @default {
|
|
1433
|
-
<ng2-table-cell-
|
|
1434
|
-
[cell]="cell()"
|
|
1435
|
-
[inputClass]="inputClass()"
|
|
1436
|
-
>
|
|
1437
|
-
</ng2-table-cell-default-editor>
|
|
1062
|
+
<ng2-table-cell-build-in-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-build-in-editor>
|
|
1438
1063
|
} }
|
|
1439
1064
|
</div>
|
|
1440
1065
|
`,
|
|
1441
1066
|
standalone: true,
|
|
1442
|
-
imports: [CustomEditComponent,
|
|
1067
|
+
imports: [CustomEditComponent, BuildInEditorComponent],
|
|
1443
1068
|
}]
|
|
1444
1069
|
}] });
|
|
1445
1070
|
|
|
@@ -1745,41 +1370,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
1745
1370
|
class DataSet {
|
|
1746
1371
|
constructor(data = [], columnSettings) {
|
|
1747
1372
|
this.columnSettings = columnSettings;
|
|
1748
|
-
this.data = [];
|
|
1749
|
-
this.columns = [];
|
|
1750
|
-
this.rows = [];
|
|
1373
|
+
this.data = signal([]);
|
|
1374
|
+
this.columns = signal([]);
|
|
1375
|
+
this.rows = signal([]);
|
|
1751
1376
|
this.selectedRows = new Set();
|
|
1377
|
+
this.getColumns = computed(() => this.columns());
|
|
1378
|
+
this.getVisibleColumns = computed(() => this.columns().filter((column) => !column.hide));
|
|
1379
|
+
this.getRows = computed(() => {
|
|
1380
|
+
return this.rows();
|
|
1381
|
+
});
|
|
1382
|
+
this.isAllSelected = computed(() => this.rows().every((row) => row.isSelected()));
|
|
1752
1383
|
this.createColumns(columnSettings);
|
|
1753
1384
|
this.setData(data);
|
|
1754
1385
|
this.createNewRow();
|
|
1755
1386
|
}
|
|
1756
1387
|
setData(data) {
|
|
1757
|
-
this.data
|
|
1388
|
+
this.data.set(data);
|
|
1758
1389
|
this.createRows();
|
|
1759
1390
|
}
|
|
1760
|
-
getColumns() {
|
|
1761
|
-
return this.columns;
|
|
1762
|
-
}
|
|
1763
|
-
getRows() {
|
|
1764
|
-
return this.rows;
|
|
1765
|
-
}
|
|
1766
1391
|
getFirstRow() {
|
|
1767
|
-
return this.rows[0];
|
|
1392
|
+
return this.rows()[0];
|
|
1768
1393
|
}
|
|
1769
1394
|
getLastRow() {
|
|
1770
|
-
return this.rows[this.rows.length - 1];
|
|
1395
|
+
return this.rows()[this.rows().length - 1];
|
|
1771
1396
|
}
|
|
1772
1397
|
findRowByData(data) {
|
|
1773
|
-
return this.rows.find((row) => row.getData() === data);
|
|
1398
|
+
return this.rows().find((row) => row.getData() === data);
|
|
1774
1399
|
}
|
|
1775
1400
|
setSelectAll(state) {
|
|
1776
|
-
this.rows.forEach((row) => {
|
|
1401
|
+
this.rows().forEach((row) => {
|
|
1777
1402
|
row.isSelected.set(state);
|
|
1778
1403
|
this.storeSelectedRow(row);
|
|
1779
1404
|
});
|
|
1780
1405
|
}
|
|
1781
1406
|
deselectAll() {
|
|
1782
|
-
this.rows.forEach((row) => {
|
|
1407
|
+
this.rows().forEach((row) => {
|
|
1783
1408
|
row.isSelected.set(false);
|
|
1784
1409
|
});
|
|
1785
1410
|
// we need to clear selectedRow field because no one row selected
|
|
@@ -1807,24 +1432,20 @@ class DataSet {
|
|
|
1807
1432
|
* @private
|
|
1808
1433
|
*/
|
|
1809
1434
|
createColumns(columnsParams) {
|
|
1810
|
-
columnsParams.
|
|
1811
|
-
|
|
1812
|
-
});
|
|
1435
|
+
const columns = columnsParams.map((params) => new Column(params.key, params, this));
|
|
1436
|
+
this.columns.set(columns);
|
|
1813
1437
|
}
|
|
1814
1438
|
/**
|
|
1815
1439
|
* Create rows based on current data prepared in data source
|
|
1816
1440
|
* @private
|
|
1817
1441
|
*/
|
|
1818
1442
|
createRows() {
|
|
1819
|
-
|
|
1820
|
-
this.data.forEach((el, index) => {
|
|
1443
|
+
const rows = this.data().map((el, index) => {
|
|
1821
1444
|
const row = new Row(index, el, this);
|
|
1822
1445
|
row.isSelected.set(this.selectedRows.has(row.getData()));
|
|
1823
|
-
|
|
1446
|
+
return row;
|
|
1824
1447
|
});
|
|
1825
|
-
|
|
1826
|
-
get isAllSelected() {
|
|
1827
|
-
return this.rows.every((row) => row.isSelected());
|
|
1448
|
+
this.rows.set(rows);
|
|
1828
1449
|
}
|
|
1829
1450
|
storeSelectedRow(row) {
|
|
1830
1451
|
if (row.isSelected()) {
|
|
@@ -1839,12 +1460,10 @@ class DataSet {
|
|
|
1839
1460
|
class Grid {
|
|
1840
1461
|
constructor(source, settings) {
|
|
1841
1462
|
this.createFormShown = false;
|
|
1842
|
-
this.onSelectRowSource = new Subject();
|
|
1843
|
-
this.onDeselectRowSource = new Subject();
|
|
1844
1463
|
this.currentColumnsSortState = [];
|
|
1845
1464
|
this.settings = signal({});
|
|
1846
1465
|
this.isMultiSelectVisible = computed(() => {
|
|
1847
|
-
return this.settings().selectMode ===
|
|
1466
|
+
return this.settings().selectMode === 'multi';
|
|
1848
1467
|
});
|
|
1849
1468
|
this.isActionsVisible = computed(() => {
|
|
1850
1469
|
const actions = this.settings().actions;
|
|
@@ -1858,8 +1477,8 @@ class Grid {
|
|
|
1858
1477
|
this.actionIsOnRight = computed(() => {
|
|
1859
1478
|
return this.settings().actionsPosition === 'right';
|
|
1860
1479
|
});
|
|
1480
|
+
this.setSource(source, settings);
|
|
1861
1481
|
this.setSettings(settings);
|
|
1862
|
-
this.setSource(source);
|
|
1863
1482
|
}
|
|
1864
1483
|
setColumnsSortedEmitter(emitter) {
|
|
1865
1484
|
this.columnsSortedEmitter = emitter;
|
|
@@ -1877,7 +1496,7 @@ class Grid {
|
|
|
1877
1496
|
}
|
|
1878
1497
|
setSettings(settings) {
|
|
1879
1498
|
this.updateSettingsAndDataSet(settings);
|
|
1880
|
-
if (
|
|
1499
|
+
if (settings.columnSort) {
|
|
1881
1500
|
this.setColumnsSortState(settings.columns);
|
|
1882
1501
|
}
|
|
1883
1502
|
}
|
|
@@ -1887,24 +1506,12 @@ class Grid {
|
|
|
1887
1506
|
getSetting(name, defaultValue) {
|
|
1888
1507
|
return getDeepFromObject(this.settings(), name, defaultValue);
|
|
1889
1508
|
}
|
|
1890
|
-
getColumns() {
|
|
1891
|
-
return this.dataSet.getColumns();
|
|
1892
|
-
}
|
|
1893
|
-
getRows() {
|
|
1894
|
-
return this.dataSet.getRows();
|
|
1895
|
-
}
|
|
1896
1509
|
selectRow(row, state) {
|
|
1897
1510
|
this.dataSet.selectRow(row, state);
|
|
1898
1511
|
}
|
|
1899
1512
|
multipleSelectRow(row) {
|
|
1900
1513
|
this.dataSet.multipleSelectRow(row);
|
|
1901
1514
|
}
|
|
1902
|
-
onSelectRow() {
|
|
1903
|
-
return this.onSelectRowSource.asObservable();
|
|
1904
|
-
}
|
|
1905
|
-
onDeselectRow() {
|
|
1906
|
-
return this.onDeselectRowSource.asObservable();
|
|
1907
|
-
}
|
|
1908
1515
|
edit(row) {
|
|
1909
1516
|
row.isInEditing.set(true);
|
|
1910
1517
|
}
|
|
@@ -1923,7 +1530,7 @@ class Grid {
|
|
|
1923
1530
|
.catch((err) => {
|
|
1924
1531
|
row.pending.set(false);
|
|
1925
1532
|
});
|
|
1926
|
-
if (this.getSetting(
|
|
1533
|
+
if (this.getSetting('add.confirmCreate', false)) {
|
|
1927
1534
|
confirmEmitter.emit({
|
|
1928
1535
|
newData: row.getNewData(),
|
|
1929
1536
|
source: this.source,
|
|
@@ -1950,7 +1557,7 @@ class Grid {
|
|
|
1950
1557
|
row.pending.set(false);
|
|
1951
1558
|
row.isInEditing.set(false);
|
|
1952
1559
|
});
|
|
1953
|
-
if (this.getSetting(
|
|
1560
|
+
if (this.getSetting('edit.confirmSave', false)) {
|
|
1954
1561
|
confirmEmitter.emit({
|
|
1955
1562
|
data: row.getData(),
|
|
1956
1563
|
newData: row.getNewData(),
|
|
@@ -1975,7 +1582,7 @@ class Grid {
|
|
|
1975
1582
|
row.pending.set(false);
|
|
1976
1583
|
// doing nothing
|
|
1977
1584
|
});
|
|
1978
|
-
if (this.getSetting(
|
|
1585
|
+
if (this.getSetting('delete.confirmDelete', true)) {
|
|
1979
1586
|
confirmEmitter.emit({
|
|
1980
1587
|
data: row.getData(),
|
|
1981
1588
|
source: this.source,
|
|
@@ -1990,39 +1597,49 @@ class Grid {
|
|
|
1990
1597
|
this.dataSet.selectRow(row, false);
|
|
1991
1598
|
}
|
|
1992
1599
|
}
|
|
1993
|
-
processDataChange(
|
|
1994
|
-
if (action ===
|
|
1600
|
+
processDataChange(event) {
|
|
1601
|
+
if (event.action === 'load') {
|
|
1995
1602
|
this.dataSet.deselectAll();
|
|
1996
1603
|
}
|
|
1997
|
-
if (action !==
|
|
1998
|
-
this.dataSet.setData(elements);
|
|
1604
|
+
if (event.action !== 'update') {
|
|
1605
|
+
this.dataSet.setData(event.elements);
|
|
1606
|
+
}
|
|
1607
|
+
else {
|
|
1608
|
+
const changedRow = this.dataSet.findRowByData(event.oldItem);
|
|
1609
|
+
if (changedRow) {
|
|
1610
|
+
changedRow.setData(event.newItem || event.oldItem);
|
|
1611
|
+
}
|
|
1999
1612
|
}
|
|
2000
1613
|
}
|
|
2001
|
-
prepareSource(source) {
|
|
1614
|
+
prepareSource(source, initialSort, initialPaging) {
|
|
2002
1615
|
const preparedSource = source || new LocalDataSource();
|
|
2003
|
-
const initialSort = this.getInitialSort();
|
|
2004
1616
|
if (initialSort) {
|
|
2005
|
-
preparedSource.setSort(
|
|
1617
|
+
preparedSource.setSort(initialSort, false);
|
|
2006
1618
|
}
|
|
2007
|
-
if (
|
|
2008
|
-
preparedSource.
|
|
1619
|
+
if (initialPaging && initialPaging?.display) {
|
|
1620
|
+
preparedSource.pagingConf.update((old) => ({
|
|
1621
|
+
...old,
|
|
1622
|
+
...initialPaging,
|
|
1623
|
+
}));
|
|
2009
1624
|
}
|
|
2010
|
-
preparedSource.refresh();
|
|
2011
1625
|
return preparedSource;
|
|
2012
1626
|
}
|
|
2013
|
-
getInitialSort() {
|
|
2014
|
-
|
|
1627
|
+
getInitialSort(columns) {
|
|
1628
|
+
if (!columns || !columns.length) {
|
|
1629
|
+
return false;
|
|
1630
|
+
}
|
|
1631
|
+
const defaultSortColumn = columns?.find((column) => column.sortDirection);
|
|
2015
1632
|
if (!defaultSortColumn) {
|
|
2016
1633
|
return false;
|
|
2017
1634
|
}
|
|
2018
1635
|
return {
|
|
2019
|
-
field: defaultSortColumn.
|
|
2020
|
-
direction: defaultSortColumn.
|
|
2021
|
-
compare: defaultSortColumn.
|
|
1636
|
+
field: defaultSortColumn.key,
|
|
1637
|
+
direction: defaultSortColumn.sortDirection || 'asc',
|
|
1638
|
+
compare: defaultSortColumn.compareFunction,
|
|
2022
1639
|
};
|
|
2023
1640
|
}
|
|
2024
1641
|
getSelectedRowsData() {
|
|
2025
|
-
return this.dataSet.
|
|
1642
|
+
return this.dataSet.getSelectedRowsData();
|
|
2026
1643
|
}
|
|
2027
1644
|
selectAllRows(status) {
|
|
2028
1645
|
this.dataSet.setSelectAll(status);
|
|
@@ -2033,27 +1650,28 @@ class Grid {
|
|
|
2033
1650
|
getLastRow() {
|
|
2034
1651
|
return this.dataSet.getLastRow();
|
|
2035
1652
|
}
|
|
2036
|
-
updateSettingsAndDataSet(settings) {
|
|
1653
|
+
updateSettingsAndDataSet(settings, emittedEvent = 'refresh') {
|
|
2037
1654
|
this.settings.set(settings);
|
|
2038
1655
|
this.dataSet = new DataSet([], settings.columns);
|
|
2039
1656
|
if (this.source) {
|
|
2040
|
-
|
|
1657
|
+
console.log('updateSettingsAndDataSet', emittedEvent);
|
|
1658
|
+
this.source.pagingConf.update((old) => ({
|
|
1659
|
+
...old,
|
|
1660
|
+
display: this.getSetting('pager.display'),
|
|
1661
|
+
}));
|
|
1662
|
+
if (emittedEvent === 'columnRefresh') {
|
|
1663
|
+
this.source.columnRefresh();
|
|
1664
|
+
}
|
|
1665
|
+
else {
|
|
1666
|
+
this.source.refresh();
|
|
1667
|
+
}
|
|
2041
1668
|
}
|
|
2042
1669
|
}
|
|
2043
|
-
setSource(source) {
|
|
2044
|
-
|
|
1670
|
+
setSource(source, settings) {
|
|
1671
|
+
const initialSort = this.getInitialSort(settings?.columns);
|
|
1672
|
+
this.source = this.prepareSource(source, initialSort, settings?.pager || false);
|
|
2045
1673
|
this.detach();
|
|
2046
|
-
this.sourceOnChangedSubscription = this.source
|
|
2047
|
-
.onChanged()
|
|
2048
|
-
.subscribe((changes) => this.processDataChange(changes));
|
|
2049
|
-
this.sourceOnUpdatedSubscription = this.source
|
|
2050
|
-
.onUpdated()
|
|
2051
|
-
.subscribe((data) => {
|
|
2052
|
-
const changedRow = this.dataSet.findRowByData(data);
|
|
2053
|
-
if (changedRow) {
|
|
2054
|
-
changedRow.setData(data);
|
|
2055
|
-
}
|
|
2056
|
-
});
|
|
1674
|
+
this.sourceOnChangedSubscription = this.source.onChanged().subscribe((changes) => this.processDataChange(changes));
|
|
2057
1675
|
}
|
|
2058
1676
|
// ------------------------------- column sort
|
|
2059
1677
|
async getSortedTableColumns(newState, columns) {
|
|
@@ -2071,7 +1689,7 @@ class Grid {
|
|
|
2071
1689
|
this.updateSettingsAndDataSet({
|
|
2072
1690
|
...this.settings(),
|
|
2073
1691
|
columns: await this.getSortedTableColumns(this.currentColumnsSortState, this.settings()?.columns),
|
|
2074
|
-
});
|
|
1692
|
+
}, 'columnRefresh');
|
|
2075
1693
|
if (this.columnStateStorageKey) {
|
|
2076
1694
|
setLocalStorage(this.columnStateStorageKey, this.currentColumnsSortState);
|
|
2077
1695
|
}
|
|
@@ -2135,7 +1753,7 @@ class TbodyCustomComponent {
|
|
|
2135
1753
|
});
|
|
2136
1754
|
}
|
|
2137
1755
|
customActions() {
|
|
2138
|
-
return this.grid.getSetting(
|
|
1756
|
+
return this.grid.getSetting('actions.custom');
|
|
2139
1757
|
}
|
|
2140
1758
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCustomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2141
1759
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TbodyCustomComponent, isStandalone: true, selector: "ng2-st-tbody-custom", inputs: { grid: "grid", row: "row", source: "source" }, outputs: { custom: "custom" }, ngImport: i0, template: `
|
|
@@ -2145,17 +1763,14 @@ class TbodyCustomComponent {
|
|
|
2145
1763
|
href="#"
|
|
2146
1764
|
class="ng2-smart-action ng2-smart-action-custom-custom"
|
|
2147
1765
|
[innerHTML]="action.title"
|
|
2148
|
-
(click)="
|
|
2149
|
-
$event.stopPropagation(); $event.preventDefault(); onCustom(action)
|
|
2150
|
-
"
|
|
2151
|
-
></a>
|
|
1766
|
+
(click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"></a>
|
|
2152
1767
|
}
|
|
2153
1768
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2154
1769
|
}
|
|
2155
1770
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCustomComponent, decorators: [{
|
|
2156
1771
|
type: Component,
|
|
2157
1772
|
args: [{
|
|
2158
|
-
selector:
|
|
1773
|
+
selector: 'ng2-st-tbody-custom',
|
|
2159
1774
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2160
1775
|
template: `
|
|
2161
1776
|
@for (action of customActions(); track $index) {
|
|
@@ -2164,10 +1779,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2164
1779
|
href="#"
|
|
2165
1780
|
class="ng2-smart-action ng2-smart-action-custom-custom"
|
|
2166
1781
|
[innerHTML]="action.title"
|
|
2167
|
-
(click)="
|
|
2168
|
-
$event.stopPropagation(); $event.preventDefault(); onCustom(action)
|
|
2169
|
-
"
|
|
2170
|
-
></a>
|
|
1782
|
+
(click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"></a>
|
|
2171
1783
|
}
|
|
2172
1784
|
`,
|
|
2173
1785
|
standalone: true,
|
|
@@ -2192,8 +1804,8 @@ class TbodyEditDeleteComponent {
|
|
|
2192
1804
|
this.isActionEdit = false;
|
|
2193
1805
|
this.isActionDelete = false;
|
|
2194
1806
|
this.isExternalMode = false;
|
|
2195
|
-
this.editRowButtonContent =
|
|
2196
|
-
this.deleteRowButtonContent =
|
|
1807
|
+
this.editRowButtonContent = 'Edit';
|
|
1808
|
+
this.deleteRowButtonContent = 'Delete';
|
|
2197
1809
|
effect(() => {
|
|
2198
1810
|
const settings = this.grid().settings();
|
|
2199
1811
|
const actions = settings.actions;
|
|
@@ -2202,12 +1814,8 @@ class TbodyEditDeleteComponent {
|
|
|
2202
1814
|
this.isActionEdit = !!actions.edit;
|
|
2203
1815
|
}
|
|
2204
1816
|
this.isExternalMode = settings.mode === 'external';
|
|
2205
|
-
this.editRowButtonContent = settings.edit
|
|
2206
|
-
|
|
2207
|
-
: "Edit";
|
|
2208
|
-
this.deleteRowButtonContent = settings.delete
|
|
2209
|
-
? settings.delete.deleteButtonContent || "Delete"
|
|
2210
|
-
: "Delete";
|
|
1817
|
+
this.editRowButtonContent = settings.edit ? settings.edit.editButtonContent || 'Edit' : 'Edit';
|
|
1818
|
+
this.deleteRowButtonContent = settings.delete ? settings.delete.deleteButtonContent || 'Delete' : 'Delete';
|
|
2211
1819
|
this.cdr.detectChanges();
|
|
2212
1820
|
});
|
|
2213
1821
|
}
|
|
@@ -2243,16 +1851,14 @@ class TbodyEditDeleteComponent {
|
|
|
2243
1851
|
[id]="'row-' + row().index + '_action-edit-button'"
|
|
2244
1852
|
class="ng2-smart-action ng2-smart-action-edit-edit"
|
|
2245
1853
|
[innerHTML]="editRowButtonContent"
|
|
2246
|
-
(click)="onEdit($event)"
|
|
2247
|
-
></a>
|
|
1854
|
+
(click)="onEdit($event)"></a>
|
|
2248
1855
|
} @if (isActionDelete) {
|
|
2249
1856
|
<a
|
|
2250
1857
|
href="#"
|
|
2251
1858
|
[id]="'row-' + row().index + '_action-delete-button'"
|
|
2252
1859
|
class="ng2-smart-action ng2-smart-action-delete-delete"
|
|
2253
1860
|
[innerHTML]="deleteRowButtonContent"
|
|
2254
|
-
(click)="onDelete($event)"
|
|
2255
|
-
></a>
|
|
1861
|
+
(click)="onDelete($event)"></a>
|
|
2256
1862
|
} } @else {
|
|
2257
1863
|
<div style="display: flex;">
|
|
2258
1864
|
@if (isActionEdit) {
|
|
@@ -2268,12 +1874,10 @@ class TbodyEditDeleteComponent {
|
|
|
2268
1874
|
y="0px"
|
|
2269
1875
|
viewBox="0 0 100 100"
|
|
2270
1876
|
enable-background="new 0 0 0 0"
|
|
2271
|
-
xml:space="preserve"
|
|
2272
|
-
>
|
|
1877
|
+
xml:space="preserve">
|
|
2273
1878
|
<path
|
|
2274
1879
|
fill="#e9e9e9"
|
|
2275
|
-
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
|
|
2276
|
-
>
|
|
1880
|
+
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
|
|
2277
1881
|
<animateTransform
|
|
2278
1882
|
attributeName="transform"
|
|
2279
1883
|
attributeType="XML"
|
|
@@ -2281,8 +1885,7 @@ class TbodyEditDeleteComponent {
|
|
|
2281
1885
|
dur="1s"
|
|
2282
1886
|
from="0 50 50"
|
|
2283
1887
|
to="360 50 50"
|
|
2284
|
-
repeatCount="indefinite"
|
|
2285
|
-
/>
|
|
1888
|
+
repeatCount="indefinite" />
|
|
2286
1889
|
</path>
|
|
2287
1890
|
</svg>
|
|
2288
1891
|
} @if (isActionDelete) {
|
|
@@ -2298,12 +1901,10 @@ class TbodyEditDeleteComponent {
|
|
|
2298
1901
|
y="0px"
|
|
2299
1902
|
viewBox="0 0 100 100"
|
|
2300
1903
|
enable-background="new 0 0 0 0"
|
|
2301
|
-
xml:space="preserve"
|
|
2302
|
-
>
|
|
1904
|
+
xml:space="preserve">
|
|
2303
1905
|
<path
|
|
2304
1906
|
fill="#e9e9e9"
|
|
2305
|
-
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
|
|
2306
|
-
>
|
|
1907
|
+
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
|
|
2307
1908
|
<animateTransform
|
|
2308
1909
|
attributeName="transform"
|
|
2309
1910
|
attributeType="XML"
|
|
@@ -2311,8 +1912,7 @@ class TbodyEditDeleteComponent {
|
|
|
2311
1912
|
dur="1s"
|
|
2312
1913
|
from="0 50 50"
|
|
2313
1914
|
to="360 50 50"
|
|
2314
|
-
repeatCount="indefinite"
|
|
2315
|
-
/>
|
|
1915
|
+
repeatCount="indefinite" />
|
|
2316
1916
|
</path>
|
|
2317
1917
|
</svg>
|
|
2318
1918
|
}
|
|
@@ -2323,7 +1923,7 @@ class TbodyEditDeleteComponent {
|
|
|
2323
1923
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyEditDeleteComponent, decorators: [{
|
|
2324
1924
|
type: Component,
|
|
2325
1925
|
args: [{
|
|
2326
|
-
selector:
|
|
1926
|
+
selector: 'ng2-st-tbody-edit-delete',
|
|
2327
1927
|
template: `
|
|
2328
1928
|
@if (!row().pending()) { @if (isActionEdit) {
|
|
2329
1929
|
<a
|
|
@@ -2331,16 +1931,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2331
1931
|
[id]="'row-' + row().index + '_action-edit-button'"
|
|
2332
1932
|
class="ng2-smart-action ng2-smart-action-edit-edit"
|
|
2333
1933
|
[innerHTML]="editRowButtonContent"
|
|
2334
|
-
(click)="onEdit($event)"
|
|
2335
|
-
></a>
|
|
1934
|
+
(click)="onEdit($event)"></a>
|
|
2336
1935
|
} @if (isActionDelete) {
|
|
2337
1936
|
<a
|
|
2338
1937
|
href="#"
|
|
2339
1938
|
[id]="'row-' + row().index + '_action-delete-button'"
|
|
2340
1939
|
class="ng2-smart-action ng2-smart-action-delete-delete"
|
|
2341
1940
|
[innerHTML]="deleteRowButtonContent"
|
|
2342
|
-
(click)="onDelete($event)"
|
|
2343
|
-
></a>
|
|
1941
|
+
(click)="onDelete($event)"></a>
|
|
2344
1942
|
} } @else {
|
|
2345
1943
|
<div style="display: flex;">
|
|
2346
1944
|
@if (isActionEdit) {
|
|
@@ -2356,12 +1954,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2356
1954
|
y="0px"
|
|
2357
1955
|
viewBox="0 0 100 100"
|
|
2358
1956
|
enable-background="new 0 0 0 0"
|
|
2359
|
-
xml:space="preserve"
|
|
2360
|
-
>
|
|
1957
|
+
xml:space="preserve">
|
|
2361
1958
|
<path
|
|
2362
1959
|
fill="#e9e9e9"
|
|
2363
|
-
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
|
|
2364
|
-
>
|
|
1960
|
+
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
|
|
2365
1961
|
<animateTransform
|
|
2366
1962
|
attributeName="transform"
|
|
2367
1963
|
attributeType="XML"
|
|
@@ -2369,8 +1965,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2369
1965
|
dur="1s"
|
|
2370
1966
|
from="0 50 50"
|
|
2371
1967
|
to="360 50 50"
|
|
2372
|
-
repeatCount="indefinite"
|
|
2373
|
-
/>
|
|
1968
|
+
repeatCount="indefinite" />
|
|
2374
1969
|
</path>
|
|
2375
1970
|
</svg>
|
|
2376
1971
|
} @if (isActionDelete) {
|
|
@@ -2386,12 +1981,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2386
1981
|
y="0px"
|
|
2387
1982
|
viewBox="0 0 100 100"
|
|
2388
1983
|
enable-background="new 0 0 0 0"
|
|
2389
|
-
xml:space="preserve"
|
|
2390
|
-
>
|
|
1984
|
+
xml:space="preserve">
|
|
2391
1985
|
<path
|
|
2392
1986
|
fill="#e9e9e9"
|
|
2393
|
-
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
|
|
2394
|
-
>
|
|
1987
|
+
d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
|
|
2395
1988
|
<animateTransform
|
|
2396
1989
|
attributeName="transform"
|
|
2397
1990
|
attributeType="XML"
|
|
@@ -2399,8 +1992,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2399
1992
|
dur="1s"
|
|
2400
1993
|
from="0 50 50"
|
|
2401
1994
|
to="360 50 50"
|
|
2402
|
-
repeatCount="indefinite"
|
|
2403
|
-
/>
|
|
1995
|
+
repeatCount="indefinite" />
|
|
2404
1996
|
</path>
|
|
2405
1997
|
</svg>
|
|
2406
1998
|
}
|
|
@@ -2419,7 +2011,7 @@ class Ng2SmartTableTbodyComponent {
|
|
|
2419
2011
|
this.deleteConfirm = input.required();
|
|
2420
2012
|
this.createConfirm = input.required();
|
|
2421
2013
|
this.editConfirm = input.required();
|
|
2422
|
-
this.rowClassFunction = input(() =>
|
|
2014
|
+
this.rowClassFunction = input(() => '');
|
|
2423
2015
|
this.save = output();
|
|
2424
2016
|
this.edit = output();
|
|
2425
2017
|
this.editCancel = output();
|
|
@@ -2437,154 +2029,80 @@ class Ng2SmartTableTbodyComponent {
|
|
|
2437
2029
|
return editOptions.inputClass || '';
|
|
2438
2030
|
});
|
|
2439
2031
|
this.noDataMessage = computed(() => {
|
|
2440
|
-
return this.grid().settings().noDataMessage ||
|
|
2032
|
+
return this.grid().settings().noDataMessage || 'No data found';
|
|
2441
2033
|
});
|
|
2442
2034
|
}
|
|
2443
|
-
getVisibleCells(cells) {
|
|
2444
|
-
return (cells || []).filter((cell) => !cell.getColumn().hide);
|
|
2445
|
-
}
|
|
2446
2035
|
trackByIdOrIndex(index, item) {
|
|
2447
2036
|
return item?.id || index;
|
|
2448
2037
|
}
|
|
2449
2038
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2450
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTbodyComponent, isStandalone: true, selector: "[ng2-st-tbody]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, deleteConfirm: { classPropertyName: "deleteConfirm", publicName: "deleteConfirm", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: true, isRequired: true, transformFunction: null }, editConfirm: { classPropertyName: "editConfirm", publicName: "editConfirm", isSignal: true, isRequired: true, transformFunction: null }, rowClassFunction: { classPropertyName: "rowClassFunction", publicName: "rowClassFunction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { save: "save", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", multipleSelectRow: "multipleSelectRow" }, ngImport: i0, template: "@for (row of grid().getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected()\"
|
|
2039
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTbodyComponent, isStandalone: true, selector: "[ng2-st-tbody]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, deleteConfirm: { classPropertyName: "deleteConfirm", publicName: "deleteConfirm", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: true, isRequired: true, transformFunction: null }, editConfirm: { classPropertyName: "editConfirm", publicName: "editConfirm", isSignal: true, isRequired: true, transformFunction: null }, rowClassFunction: { classPropertyName: "rowClassFunction", publicName: "rowClassFunction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { save: "save", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", multipleSelectRow: "multipleSelectRow" }, ngImport: i0, template: "@for (row of grid().dataSet.getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected()\">\n @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\">\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected()\" />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of row.visibleCells(); track cell.getId() + $index) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell [cell]=\"cell\" [inputClass]=\"editInputClass()\" [isInEditing]=\"row.isInEditing()\">\n </ng2-smart-table-cell>\n </td>\n } @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n</tr>\n\n<ng-template #actions>\n @if (row.isInEditing()) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm()\"\n [editCancel]=\"editCancel\"></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing() && grid().isActionsVisible() ) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid()\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source()\"></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid()\"\n [deleteConfirm]=\"deleteConfirm()\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n [row]=\"row\"\n [source]=\"source()\">\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</ng-template>\n} @empty {\n<tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { 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"] }, { kind: "component", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: ["grid", "row", "source"], outputs: ["custom"] }, { kind: "component", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: ["grid", "row", "source", "deleteConfirm"], outputs: ["edit", "delete"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "row", "editConfirm", "editCancel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["cell", "inputClass", "isInEditing"] }] }); }
|
|
2451
2040
|
}
|
|
2452
2041
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
|
|
2453
2042
|
type: Component,
|
|
2454
|
-
args: [{ selector:
|
|
2043
|
+
args: [{ selector: '[ng2-st-tbody]', standalone: true, imports: [
|
|
2455
2044
|
FormsModule,
|
|
2456
2045
|
TbodyCustomComponent,
|
|
2457
2046
|
TbodyEditDeleteComponent,
|
|
2458
2047
|
TbodyCreateCancelComponent,
|
|
2459
2048
|
NgTemplateOutlet,
|
|
2460
2049
|
CellComponent,
|
|
2461
|
-
], template: "@for (row of grid().getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected()\"
|
|
2050
|
+
], template: "@for (row of grid().dataSet.getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected()\">\n @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\">\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected()\" />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of row.visibleCells(); track cell.getId() + $index) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell [cell]=\"cell\" [inputClass]=\"editInputClass()\" [isInEditing]=\"row.isInEditing()\">\n </ng2-smart-table-cell>\n </td>\n } @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n</tr>\n\n<ng-template #actions>\n @if (row.isInEditing()) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm()\"\n [editCancel]=\"editCancel\"></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing() && grid().isActionsVisible() ) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid()\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source()\"></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid()\"\n [deleteConfirm]=\"deleteConfirm()\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n [row]=\"row\"\n [source]=\"source()\">\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</ng-template>\n} @empty {\n<tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"] }]
|
|
2462
2051
|
}] });
|
|
2463
2052
|
|
|
2464
|
-
class
|
|
2465
|
-
constructor() {
|
|
2466
|
-
this.column = input.required();
|
|
2467
|
-
this.source = input.required();
|
|
2468
|
-
this.inputClass = input('');
|
|
2469
|
-
this.query = '';
|
|
2470
|
-
this.filter = output();
|
|
2471
|
-
}
|
|
2472
|
-
onFilter(query) {
|
|
2473
|
-
this.source().addFilter({
|
|
2474
|
-
field: this.column().id,
|
|
2475
|
-
search: query,
|
|
2476
|
-
filter: this.column().getFilterFunction(),
|
|
2477
|
-
});
|
|
2478
|
-
}
|
|
2479
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2480
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: FilterDefault, isStandalone: true, selector: "ng2-filter-default-component", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
|
|
2481
|
-
}
|
|
2482
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterDefault, decorators: [{
|
|
2483
|
-
type: Component,
|
|
2484
|
-
args: [{ template: '', selector: 'ng2-filter-default-component' }]
|
|
2485
|
-
}], propDecorators: { query: [{
|
|
2486
|
-
type: Input
|
|
2487
|
-
}] } });
|
|
2488
|
-
|
|
2489
|
-
class CustomFilterComponent extends FilterDefault {
|
|
2490
|
-
ngOnChanges(changes) {
|
|
2491
|
-
if (this.customComponent) {
|
|
2492
|
-
if (this.customComponent?.instance &&
|
|
2493
|
-
"ngOnChanges" in this.customComponent.instance) {
|
|
2494
|
-
const onChanges = this.customComponent.instance.ngOnChanges;
|
|
2495
|
-
onChanges(changes);
|
|
2496
|
-
}
|
|
2497
|
-
return;
|
|
2498
|
-
}
|
|
2499
|
-
const columnFilter = this.column().filter;
|
|
2500
|
-
if (columnFilter && columnFilter.type === "custom") {
|
|
2501
|
-
this.customComponent = this.dynamicTarget?.createComponent(columnFilter?.component);
|
|
2502
|
-
// set @Inputs and @Outputs of custom component
|
|
2503
|
-
this.customComponent?.setInput("query", this.query);
|
|
2504
|
-
this.customComponent?.setInput("column", this.column());
|
|
2505
|
-
this.customComponent?.setInput("source", this.source());
|
|
2506
|
-
this.customComponent?.setInput("inputClass", this.inputClass());
|
|
2507
|
-
this.customComponent?.instance.filter.subscribe((event) => this.onFilter(event));
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
ngOnDestroy() {
|
|
2511
|
-
if (this.customComponent) {
|
|
2512
|
-
this.customComponent.destroy();
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2516
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomFilterComponent, isStandalone: true, selector: "ng2-custom-table-filter", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<ng-template #dynamicTarget></ng-template>`, isInline: true }); }
|
|
2517
|
-
}
|
|
2518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, decorators: [{
|
|
2519
|
-
type: Component,
|
|
2520
|
-
args: [{
|
|
2521
|
-
selector: "ng2-custom-table-filter",
|
|
2522
|
-
template: `<ng-template #dynamicTarget></ng-template>`,
|
|
2523
|
-
standalone: true,
|
|
2524
|
-
}]
|
|
2525
|
-
}], propDecorators: { dynamicTarget: [{
|
|
2526
|
-
type: ViewChild,
|
|
2527
|
-
args: ["dynamicTarget", { read: ViewContainerRef, static: true }]
|
|
2528
|
-
}] } });
|
|
2529
|
-
|
|
2530
|
-
class CheckboxFilterComponent extends DefaultFilter {
|
|
2053
|
+
class CheckboxFilterComponent extends BaseFilterComponent {
|
|
2531
2054
|
constructor() {
|
|
2532
2055
|
super();
|
|
2533
2056
|
this.filterActive = false;
|
|
2534
|
-
this.
|
|
2057
|
+
this.trueVal = true;
|
|
2058
|
+
this.falseVal = false;
|
|
2535
2059
|
}
|
|
2536
2060
|
ngOnInit() {
|
|
2061
|
+
const filterConfig = this.column().getFilterConfig();
|
|
2062
|
+
try {
|
|
2063
|
+
const { true: trueVal, false: falseVal } = filterConfig;
|
|
2064
|
+
this.trueVal = trueVal ?? true;
|
|
2065
|
+
this.falseVal = falseVal ?? false;
|
|
2066
|
+
}
|
|
2067
|
+
catch {
|
|
2068
|
+
// do nothing
|
|
2069
|
+
}
|
|
2537
2070
|
this.changesSubscription = this.inputControl.valueChanges
|
|
2538
|
-
.pipe(debounceTime(this.delay))
|
|
2071
|
+
.pipe(distinctUntilChanged(), debounceTime(this.delay))
|
|
2539
2072
|
.subscribe((checked) => {
|
|
2540
2073
|
this.filterActive = true;
|
|
2541
|
-
const
|
|
2542
|
-
|
|
2543
|
-
true;
|
|
2544
|
-
const falseVal = (this.column().getFilterConfig() &&
|
|
2545
|
-
this.column().getFilterConfig().false) ||
|
|
2546
|
-
false;
|
|
2547
|
-
this.query = checked ? trueVal : falseVal;
|
|
2548
|
-
this.setFilter();
|
|
2074
|
+
const value = checked ? this.trueVal : this.falseVal;
|
|
2075
|
+
this.setFilter(value);
|
|
2549
2076
|
});
|
|
2550
2077
|
}
|
|
2078
|
+
ngOnChanges({ query }) {
|
|
2079
|
+
if (query) {
|
|
2080
|
+
this.inputControl.setValue(query.currentValue === this.trueVal, { emitEvent: false });
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2551
2083
|
resetFilter(event) {
|
|
2552
2084
|
event.preventDefault();
|
|
2553
|
-
|
|
2085
|
+
event.stopPropagation();
|
|
2554
2086
|
this.inputControl.setValue(false, { emitEvent: false });
|
|
2555
2087
|
this.filterActive = false;
|
|
2556
|
-
this.setFilter();
|
|
2088
|
+
this.setFilter(null);
|
|
2557
2089
|
}
|
|
2558
2090
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2559
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: CheckboxFilterComponent, isStandalone: true, selector: "ng2-checkbox-filter", usesInheritance: true, ngImport: i0, template: `
|
|
2560
|
-
<input
|
|
2561
|
-
type="checkbox"
|
|
2562
|
-
[formControl]="inputControl"
|
|
2563
|
-
[class]="inputClass()"
|
|
2564
|
-
class="form-control"
|
|
2565
|
-
/>
|
|
2091
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: CheckboxFilterComponent, isStandalone: true, selector: "ng2-checkbox-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
|
|
2092
|
+
<input type="checkbox" [formControl]="inputControl" [class]="inputClass()" class="form-control" />
|
|
2566
2093
|
@if (filterActive) {
|
|
2567
|
-
<a href="#" (click)="resetFilter($event)">{{
|
|
2568
|
-
column().getFilterConfig()?.resetText || "reset"
|
|
2569
|
-
}}</a>
|
|
2094
|
+
<a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
|
|
2570
2095
|
}
|
|
2571
2096
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
2572
2097
|
}
|
|
2573
2098
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxFilterComponent, decorators: [{
|
|
2574
2099
|
type: Component,
|
|
2575
2100
|
args: [{
|
|
2576
|
-
selector:
|
|
2101
|
+
selector: 'ng2-checkbox-filter',
|
|
2577
2102
|
template: `
|
|
2578
|
-
<input
|
|
2579
|
-
type="checkbox"
|
|
2580
|
-
[formControl]="inputControl"
|
|
2581
|
-
[class]="inputClass()"
|
|
2582
|
-
class="form-control"
|
|
2583
|
-
/>
|
|
2103
|
+
<input type="checkbox" [formControl]="inputControl" [class]="inputClass()" class="form-control" />
|
|
2584
2104
|
@if (filterActive) {
|
|
2585
|
-
<a href="#" (click)="resetFilter($event)">{{
|
|
2586
|
-
column().getFilterConfig()?.resetText || "reset"
|
|
2587
|
-
}}</a>
|
|
2105
|
+
<a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
|
|
2588
2106
|
}
|
|
2589
2107
|
`,
|
|
2590
2108
|
standalone: true,
|
|
@@ -2592,264 +2110,269 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2592
2110
|
}]
|
|
2593
2111
|
}], ctorParameters: () => [] });
|
|
2594
2112
|
|
|
2595
|
-
class InputFilterComponent extends
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
this.inputControl = new UntypedFormControl();
|
|
2599
|
-
}
|
|
2600
|
-
ngOnInit() {
|
|
2601
|
-
if (this.query) {
|
|
2602
|
-
this.inputControl.setValue(this.query);
|
|
2603
|
-
}
|
|
2604
|
-
this.inputControl.valueChanges
|
|
2605
|
-
.pipe(distinctUntilChanged(), debounceTime(this.delay))
|
|
2606
|
-
.subscribe((value) => {
|
|
2607
|
-
this.query = this.inputControl.value;
|
|
2608
|
-
this.setFilter();
|
|
2609
|
-
});
|
|
2610
|
-
}
|
|
2611
|
-
ngOnChanges(changes) {
|
|
2612
|
-
if (changes?.["query"]) {
|
|
2613
|
-
this.inputControl.setValue(this.query);
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2617
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputFilterComponent, isStandalone: true, selector: "ng2-input-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
|
|
2113
|
+
class InputFilterComponent extends BaseFilterComponent {
|
|
2114
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2115
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputFilterComponent, isStandalone: true, selector: "ng2-input-filter", usesInheritance: true, ngImport: i0, template: `
|
|
2618
2116
|
<input
|
|
2619
2117
|
[class]="inputClass()"
|
|
2620
2118
|
[formControl]="inputControl"
|
|
2621
2119
|
class="form-control"
|
|
2622
2120
|
type="text"
|
|
2623
|
-
placeholder="{{ column().title }}"
|
|
2624
|
-
/>
|
|
2121
|
+
placeholder="{{ column().title }}" />
|
|
2625
2122
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
2626
2123
|
}
|
|
2627
2124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, decorators: [{
|
|
2628
2125
|
type: Component,
|
|
2629
2126
|
args: [{
|
|
2630
|
-
selector:
|
|
2127
|
+
selector: 'ng2-input-filter',
|
|
2631
2128
|
template: `
|
|
2632
2129
|
<input
|
|
2633
2130
|
[class]="inputClass()"
|
|
2634
2131
|
[formControl]="inputControl"
|
|
2635
2132
|
class="form-control"
|
|
2636
2133
|
type="text"
|
|
2637
|
-
placeholder="{{ column().title }}"
|
|
2638
|
-
/>
|
|
2134
|
+
placeholder="{{ column().title }}" />
|
|
2639
2135
|
`,
|
|
2640
2136
|
standalone: true,
|
|
2641
2137
|
imports: [FormsModule, ReactiveFormsModule],
|
|
2642
2138
|
}]
|
|
2643
|
-
}]
|
|
2644
|
-
|
|
2645
|
-
class SelectFilterComponent extends DefaultFilter {
|
|
2646
|
-
constructor() {
|
|
2647
|
-
super();
|
|
2648
|
-
}
|
|
2649
|
-
ngOnInit() {
|
|
2650
|
-
if (this.inputControl.valueChanges) {
|
|
2651
|
-
this.inputControl.valueChanges
|
|
2652
|
-
.pipe(skip(1), distinctUntilChanged(), debounceTime(this.delay))
|
|
2653
|
-
.subscribe((value) => this.setFilter());
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2657
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectFilterComponent, isStandalone: true, selector: "ng2-select-filter", viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true, read: NgControl, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
2658
|
-
<select [class]="inputClass()"
|
|
2659
|
-
class="form-control"
|
|
2660
|
-
#inputControl
|
|
2661
|
-
[(ngModel)]="query">
|
|
2139
|
+
}] });
|
|
2662
2140
|
|
|
2141
|
+
class SelectFilterComponent extends BaseFilterComponent {
|
|
2142
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2143
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectFilterComponent, isStandalone: true, selector: "ng2-select-filter", usesInheritance: true, ngImport: i0, template: `
|
|
2144
|
+
<select [class]="inputClass()" class="form-control" [formControl]="inputControl">
|
|
2663
2145
|
<option value="">{{ column().getFilterConfig().selectText }}</option>
|
|
2664
2146
|
@for (option of column().getFilterConfig().list; track $index) {
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2147
|
+
<option [value]="option.value">
|
|
2148
|
+
{{ option.title }}
|
|
2149
|
+
</option>
|
|
2668
2150
|
}
|
|
2669
2151
|
</select>
|
|
2670
|
-
|
|
2152
|
+
`, isInline: true, 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])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
2671
2153
|
}
|
|
2672
2154
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, decorators: [{
|
|
2673
2155
|
type: Component,
|
|
2674
2156
|
args: [{
|
|
2675
2157
|
selector: 'ng2-select-filter',
|
|
2676
2158
|
template: `
|
|
2677
|
-
<select [class]="inputClass()"
|
|
2678
|
-
class="form-control"
|
|
2679
|
-
#inputControl
|
|
2680
|
-
[(ngModel)]="query">
|
|
2681
|
-
|
|
2159
|
+
<select [class]="inputClass()" class="form-control" [formControl]="inputControl">
|
|
2682
2160
|
<option value="">{{ column().getFilterConfig().selectText }}</option>
|
|
2683
2161
|
@for (option of column().getFilterConfig().list; track $index) {
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2162
|
+
<option [value]="option.value">
|
|
2163
|
+
{{ option.title }}
|
|
2164
|
+
</option>
|
|
2687
2165
|
}
|
|
2688
2166
|
</select>
|
|
2689
|
-
|
|
2167
|
+
`,
|
|
2690
2168
|
standalone: true,
|
|
2691
|
-
imports: [FormsModule]
|
|
2169
|
+
imports: [FormsModule, ReactiveFormsModule],
|
|
2692
2170
|
}]
|
|
2693
|
-
}]
|
|
2694
|
-
type: ViewChild,
|
|
2695
|
-
args: ['inputControl', { read: NgControl, static: true }]
|
|
2696
|
-
}] } });
|
|
2171
|
+
}] });
|
|
2697
2172
|
|
|
2698
|
-
class
|
|
2699
|
-
|
|
2700
|
-
|
|
2173
|
+
class BuildInFilterComponent {
|
|
2174
|
+
constructor() {
|
|
2175
|
+
this.query = input('');
|
|
2176
|
+
this.inputClass = input('');
|
|
2177
|
+
this.source = input.required();
|
|
2178
|
+
this.column = input.required();
|
|
2179
|
+
this.filter = output();
|
|
2180
|
+
}
|
|
2181
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2182
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: BuildInFilterComponent, isStandalone: true, selector: "ng2-build-in-table-filter", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, ngImport: i0, template: `
|
|
2701
2183
|
@switch (column().getFilterType()) { @case ('list') {
|
|
2702
2184
|
<ng2-select-filter
|
|
2703
|
-
[query]="query"
|
|
2185
|
+
[query]="query()"
|
|
2704
2186
|
[class]="inputClass()"
|
|
2705
2187
|
[source]="source()"
|
|
2706
2188
|
[column]="column()"
|
|
2707
|
-
(filter)="
|
|
2708
|
-
>
|
|
2189
|
+
(filter)="filter.emit($event)">
|
|
2709
2190
|
</ng2-select-filter>
|
|
2710
2191
|
} @case ('checkbox') {
|
|
2711
2192
|
<ng2-checkbox-filter
|
|
2712
|
-
[query]="query"
|
|
2193
|
+
[query]="query()"
|
|
2713
2194
|
[source]="source()"
|
|
2714
2195
|
[class]="inputClass()"
|
|
2715
2196
|
[column]="column()"
|
|
2716
|
-
(filter)="
|
|
2717
|
-
>
|
|
2197
|
+
(filter)="filter.emit($event)">
|
|
2718
2198
|
</ng2-checkbox-filter>
|
|
2719
2199
|
} @default {
|
|
2720
2200
|
<ng2-input-filter
|
|
2721
|
-
[query]="query"
|
|
2201
|
+
[query]="query()"
|
|
2722
2202
|
[source]="source()"
|
|
2723
2203
|
[class]="inputClass()"
|
|
2724
2204
|
[column]="column()"
|
|
2725
|
-
(filter)="
|
|
2726
|
-
>
|
|
2205
|
+
(filter)="filter.emit($event)">
|
|
2727
2206
|
</ng2-input-filter>
|
|
2728
2207
|
} }
|
|
2729
2208
|
`, isInline: true, dependencies: [{ kind: "component", type: SelectFilterComponent, selector: "ng2-select-filter" }, { kind: "component", type: CheckboxFilterComponent, selector: "ng2-checkbox-filter" }, { kind: "component", type: InputFilterComponent, selector: "ng2-input-filter" }] }); }
|
|
2730
2209
|
}
|
|
2731
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
2210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInFilterComponent, decorators: [{
|
|
2732
2211
|
type: Component,
|
|
2733
2212
|
args: [{
|
|
2734
|
-
selector:
|
|
2213
|
+
selector: 'ng2-build-in-table-filter',
|
|
2735
2214
|
template: `
|
|
2736
2215
|
@switch (column().getFilterType()) { @case ('list') {
|
|
2737
2216
|
<ng2-select-filter
|
|
2738
|
-
[query]="query"
|
|
2217
|
+
[query]="query()"
|
|
2739
2218
|
[class]="inputClass()"
|
|
2740
2219
|
[source]="source()"
|
|
2741
2220
|
[column]="column()"
|
|
2742
|
-
(filter)="
|
|
2743
|
-
>
|
|
2221
|
+
(filter)="filter.emit($event)">
|
|
2744
2222
|
</ng2-select-filter>
|
|
2745
2223
|
} @case ('checkbox') {
|
|
2746
2224
|
<ng2-checkbox-filter
|
|
2747
|
-
[query]="query"
|
|
2225
|
+
[query]="query()"
|
|
2748
2226
|
[source]="source()"
|
|
2749
2227
|
[class]="inputClass()"
|
|
2750
2228
|
[column]="column()"
|
|
2751
|
-
(filter)="
|
|
2752
|
-
>
|
|
2229
|
+
(filter)="filter.emit($event)">
|
|
2753
2230
|
</ng2-checkbox-filter>
|
|
2754
2231
|
} @default {
|
|
2755
2232
|
<ng2-input-filter
|
|
2756
|
-
[query]="query"
|
|
2233
|
+
[query]="query()"
|
|
2757
2234
|
[source]="source()"
|
|
2758
2235
|
[class]="inputClass()"
|
|
2759
2236
|
[column]="column()"
|
|
2760
|
-
(filter)="
|
|
2761
|
-
>
|
|
2237
|
+
(filter)="filter.emit($event)">
|
|
2762
2238
|
</ng2-input-filter>
|
|
2763
2239
|
} }
|
|
2764
2240
|
`,
|
|
2765
2241
|
standalone: true,
|
|
2766
|
-
imports: [
|
|
2767
|
-
SelectFilterComponent,
|
|
2768
|
-
CheckboxFilterComponent,
|
|
2769
|
-
InputFilterComponent,
|
|
2770
|
-
],
|
|
2242
|
+
imports: [SelectFilterComponent, CheckboxFilterComponent, InputFilterComponent],
|
|
2771
2243
|
}]
|
|
2772
2244
|
}] });
|
|
2773
2245
|
|
|
2774
|
-
class
|
|
2246
|
+
class CustomFilterComponent {
|
|
2247
|
+
constructor() {
|
|
2248
|
+
this.query = input('');
|
|
2249
|
+
this.inputClass = input('');
|
|
2250
|
+
this.source = input.required();
|
|
2251
|
+
this.column = input.required();
|
|
2252
|
+
this.filter = output();
|
|
2253
|
+
}
|
|
2775
2254
|
ngOnChanges(changes) {
|
|
2776
|
-
if (
|
|
2777
|
-
if (
|
|
2778
|
-
this.
|
|
2255
|
+
if (this.customComponent) {
|
|
2256
|
+
if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
|
|
2257
|
+
const onChanges = this.customComponent.instance.ngOnChanges;
|
|
2258
|
+
onChanges(changes);
|
|
2779
2259
|
}
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
const columnFilter = this.column().filter;
|
|
2263
|
+
if (columnFilter && columnFilter.type === 'custom') {
|
|
2264
|
+
this.customComponent = this.dynamicTarget?.createComponent(columnFilter?.component);
|
|
2265
|
+
// set @Inputs and @Outputs of custom component
|
|
2266
|
+
this.customComponent?.setInput('query', this.query());
|
|
2267
|
+
this.customComponent?.setInput('column', this.column());
|
|
2268
|
+
this.customComponent?.setInput('source', this.source());
|
|
2269
|
+
this.customComponent?.setInput('inputClass', this.inputClass());
|
|
2270
|
+
this.filterSubscription = this.customComponent?.instance.filter.subscribe((event) => this.filter.emit(event));
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
ngOnDestroy() {
|
|
2274
|
+
if (this.customComponent) {
|
|
2275
|
+
this.customComponent.destroy();
|
|
2276
|
+
}
|
|
2277
|
+
if (this.filterSubscription) {
|
|
2278
|
+
this.filterSubscription.unsubscribe();
|
|
2795
2279
|
}
|
|
2796
2280
|
}
|
|
2797
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
2798
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2281
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2282
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CustomFilterComponent, isStandalone: true, selector: "ng2-custom-table-filter", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: `<ng-template #dynamicTarget></ng-template>`, isInline: true }); }
|
|
2283
|
+
}
|
|
2284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, decorators: [{
|
|
2285
|
+
type: Component,
|
|
2286
|
+
args: [{
|
|
2287
|
+
selector: 'ng2-custom-table-filter',
|
|
2288
|
+
template: `<ng-template #dynamicTarget></ng-template>`,
|
|
2289
|
+
standalone: true,
|
|
2290
|
+
}]
|
|
2291
|
+
}], propDecorators: { dynamicTarget: [{
|
|
2292
|
+
type: ViewChild,
|
|
2293
|
+
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
2294
|
+
}] } });
|
|
2295
|
+
|
|
2296
|
+
class FilterComponent {
|
|
2297
|
+
constructor() {
|
|
2298
|
+
this.query = signal('');
|
|
2299
|
+
this.column = input.required();
|
|
2300
|
+
this.source = input.required();
|
|
2301
|
+
this.inputClass = input('');
|
|
2302
|
+
this.destroyRef = inject(DestroyRef);
|
|
2303
|
+
}
|
|
2304
|
+
ngOnInit() {
|
|
2305
|
+
this.source()
|
|
2306
|
+
.onChanged()
|
|
2307
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2308
|
+
.subscribe(({ filters }) => {
|
|
2309
|
+
if (!filters.length) {
|
|
2310
|
+
return;
|
|
2810
2311
|
}
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
[column]="column()"
|
|
2815
|
-
[source]="source()"
|
|
2816
|
-
[inputClass]="inputClass()"
|
|
2817
|
-
(filter)="onFilter($event)">
|
|
2818
|
-
</ng2-default-table-filter>
|
|
2312
|
+
const columnFilter = filters.find((filter) => filter.field === this.column().id);
|
|
2313
|
+
if (!columnFilter) {
|
|
2314
|
+
return;
|
|
2819
2315
|
}
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2316
|
+
this.query.set(columnFilter.search);
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
onFilter(query) {
|
|
2320
|
+
this.source().addFilter({
|
|
2321
|
+
field: this.column().id,
|
|
2322
|
+
search: query,
|
|
2323
|
+
filter: this.column().filterFunction,
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2327
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: FilterComponent, isStandalone: true, selector: "ng2-smart-table-filter", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
2328
|
+
@if (column().isFilterable) {
|
|
2329
|
+
<div class="ng2-smart-filter">
|
|
2330
|
+
@switch (column().getFilterType()) { @case ('custom') {
|
|
2331
|
+
<ng2-custom-table-filter
|
|
2332
|
+
[query]="query()"
|
|
2333
|
+
[column]="column()"
|
|
2334
|
+
[source]="source()"
|
|
2335
|
+
[inputClass]="inputClass()"
|
|
2336
|
+
(filter)="onFilter($event)">
|
|
2337
|
+
</ng2-custom-table-filter>
|
|
2338
|
+
} @default {
|
|
2339
|
+
<ng2-build-in-table-filter
|
|
2340
|
+
[query]="query()"
|
|
2341
|
+
[column]="column()"
|
|
2342
|
+
[source]="source()"
|
|
2343
|
+
[inputClass]="inputClass()"
|
|
2344
|
+
(filter)="onFilter($event)">
|
|
2345
|
+
</ng2-build-in-table-filter>
|
|
2346
|
+
} }
|
|
2347
|
+
</div>
|
|
2348
|
+
}
|
|
2349
|
+
`, isInline: true, styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"], dependencies: [{ kind: "component", type: CustomFilterComponent, selector: "ng2-custom-table-filter", inputs: ["query", "inputClass", "source", "column"], outputs: ["filter"] }, { kind: "component", type: BuildInFilterComponent, selector: "ng2-build-in-table-filter", inputs: ["query", "inputClass", "source", "column"], outputs: ["filter"] }] }); }
|
|
2824
2350
|
}
|
|
2825
2351
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, decorators: [{
|
|
2826
2352
|
type: Component,
|
|
2827
2353
|
args: [{ selector: 'ng2-smart-table-filter', template: `
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
</div>
|
|
2851
|
-
}
|
|
2852
|
-
`, standalone: true, imports: [CustomFilterComponent, DefaultFilterComponent], styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"] }]
|
|
2354
|
+
@if (column().isFilterable) {
|
|
2355
|
+
<div class="ng2-smart-filter">
|
|
2356
|
+
@switch (column().getFilterType()) { @case ('custom') {
|
|
2357
|
+
<ng2-custom-table-filter
|
|
2358
|
+
[query]="query()"
|
|
2359
|
+
[column]="column()"
|
|
2360
|
+
[source]="source()"
|
|
2361
|
+
[inputClass]="inputClass()"
|
|
2362
|
+
(filter)="onFilter($event)">
|
|
2363
|
+
</ng2-custom-table-filter>
|
|
2364
|
+
} @default {
|
|
2365
|
+
<ng2-build-in-table-filter
|
|
2366
|
+
[query]="query()"
|
|
2367
|
+
[column]="column()"
|
|
2368
|
+
[source]="source()"
|
|
2369
|
+
[inputClass]="inputClass()"
|
|
2370
|
+
(filter)="onFilter($event)">
|
|
2371
|
+
</ng2-build-in-table-filter>
|
|
2372
|
+
} }
|
|
2373
|
+
</div>
|
|
2374
|
+
}
|
|
2375
|
+
`, standalone: true, imports: [CustomFilterComponent, BuildInFilterComponent], styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"] }]
|
|
2853
2376
|
}] });
|
|
2854
2377
|
|
|
2855
2378
|
class AddButtonComponent {
|
|
@@ -2867,15 +2390,15 @@ class AddButtonComponent {
|
|
|
2867
2390
|
this.addNewButtonContent = computed(() => {
|
|
2868
2391
|
const addParams = this.grid().settings()?.add;
|
|
2869
2392
|
if (!addParams) {
|
|
2870
|
-
return
|
|
2393
|
+
return 'Add New';
|
|
2871
2394
|
}
|
|
2872
|
-
return addParams?.addButtonContent ||
|
|
2395
|
+
return addParams?.addButtonContent || 'Add New';
|
|
2873
2396
|
});
|
|
2874
2397
|
}
|
|
2875
2398
|
onAdd(event) {
|
|
2876
2399
|
event.preventDefault();
|
|
2877
2400
|
event.stopPropagation();
|
|
2878
|
-
if (this.grid().getSetting(
|
|
2401
|
+
if (this.grid().getSetting('mode') === 'external') {
|
|
2879
2402
|
this.create.emit({
|
|
2880
2403
|
source: this.source(),
|
|
2881
2404
|
});
|
|
@@ -2891,27 +2414,25 @@ class AddButtonComponent {
|
|
|
2891
2414
|
href="#"
|
|
2892
2415
|
class="ng2-smart-action ng2-smart-action-add-add"
|
|
2893
2416
|
[innerHTML]="addNewButtonContent()"
|
|
2894
|
-
(click)="onAdd($event)"
|
|
2895
|
-
></a>
|
|
2417
|
+
(click)="onAdd($event)"></a>
|
|
2896
2418
|
}
|
|
2897
2419
|
`, isInline: true }); }
|
|
2898
2420
|
}
|
|
2899
2421
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddButtonComponent, decorators: [{
|
|
2900
2422
|
type: Component,
|
|
2901
2423
|
args: [{
|
|
2902
|
-
selector:
|
|
2424
|
+
selector: '[ng2-st-add-button]',
|
|
2903
2425
|
template: `
|
|
2904
2426
|
@if (isActionAdd()) {
|
|
2905
2427
|
<a
|
|
2906
2428
|
href="#"
|
|
2907
2429
|
class="ng2-smart-action ng2-smart-action-add-add"
|
|
2908
2430
|
[innerHTML]="addNewButtonContent()"
|
|
2909
|
-
(click)="onAdd($event)"
|
|
2910
|
-
></a>
|
|
2431
|
+
(click)="onAdd($event)"></a>
|
|
2911
2432
|
}
|
|
2912
2433
|
`,
|
|
2913
2434
|
host: {
|
|
2914
|
-
class:
|
|
2435
|
+
class: 'ng2-smart-actions-title ng2-smart-actions-title-add',
|
|
2915
2436
|
},
|
|
2916
2437
|
standalone: true,
|
|
2917
2438
|
}]
|
|
@@ -2922,80 +2443,46 @@ class TheadFiltersRowComponent {
|
|
|
2922
2443
|
this.grid = input.required();
|
|
2923
2444
|
this.source = input.required();
|
|
2924
2445
|
this.create = output();
|
|
2925
|
-
this.filter = output();
|
|
2926
2446
|
this.filterInputClass = computed(() => {
|
|
2927
2447
|
const filterOptions = this.grid().settings()?.filter;
|
|
2928
2448
|
if (!filterOptions) {
|
|
2929
|
-
return
|
|
2449
|
+
return '';
|
|
2930
2450
|
}
|
|
2931
|
-
return filterOptions.inputClass ||
|
|
2451
|
+
return filterOptions.inputClass || '';
|
|
2932
2452
|
});
|
|
2933
2453
|
}
|
|
2934
|
-
getVisibleColumns() {
|
|
2935
|
-
return (this.grid().getColumns() || []).filter((column) => !column.hide);
|
|
2936
|
-
}
|
|
2937
2454
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2938
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFiltersRowComponent, isStandalone: true, selector: "[ng2-st-thead-filters-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create"
|
|
2455
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFiltersRowComponent, isStandalone: true, selector: "[ng2-st-thead-filters-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create" }, ngImport: i0, template: `
|
|
2939
2456
|
@if (grid().isMultiSelectVisible()) {
|
|
2940
2457
|
<th></th>
|
|
2941
2458
|
} @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
|
|
2942
|
-
<th
|
|
2943
|
-
|
|
2944
|
-
[source]="source()"
|
|
2945
|
-
[grid]="grid()"
|
|
2946
|
-
(create)="create.emit($event)"
|
|
2947
|
-
></th>
|
|
2948
|
-
} @for (column of getVisibleColumns(); track column.id + $index) {
|
|
2459
|
+
<th ng2-st-add-button [source]="source()" [grid]="grid()" (create)="create.emit($event)"></th>
|
|
2460
|
+
} @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
|
|
2949
2461
|
<th class="ng2-smart-th {{ column.id }}">
|
|
2950
|
-
<ng2-smart-table-filter
|
|
2951
|
-
[source]="source()"
|
|
2952
|
-
[column]="column"
|
|
2953
|
-
[inputClass]="filterInputClass()"
|
|
2954
|
-
(filter)="filter.emit($event)"
|
|
2955
|
-
>
|
|
2462
|
+
<ng2-smart-table-filter [source]="source()" [column]="column" [inputClass]="filterInputClass()">
|
|
2956
2463
|
</ng2-smart-table-filter>
|
|
2957
2464
|
</th>
|
|
2958
2465
|
} @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
|
|
2959
|
-
<th
|
|
2960
|
-
ng2-st-add-button
|
|
2961
|
-
[grid]="grid()"
|
|
2962
|
-
[source]="source()"
|
|
2963
|
-
(create)="create.emit($event)"
|
|
2964
|
-
></th>
|
|
2466
|
+
<th ng2-st-add-button [grid]="grid()" [source]="source()" (create)="create.emit($event)"></th>
|
|
2965
2467
|
}
|
|
2966
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid", "source"], outputs: ["create"] }, { kind: "component", type: FilterComponent, selector: "ng2-smart-table-filter" }] }); }
|
|
2468
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid", "source"], outputs: ["create"] }, { kind: "component", type: FilterComponent, selector: "ng2-smart-table-filter", inputs: ["column", "source", "inputClass"] }] }); }
|
|
2967
2469
|
}
|
|
2968
2470
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, decorators: [{
|
|
2969
2471
|
type: Component,
|
|
2970
2472
|
args: [{
|
|
2971
|
-
selector:
|
|
2473
|
+
selector: '[ng2-st-thead-filters-row]',
|
|
2972
2474
|
template: `
|
|
2973
2475
|
@if (grid().isMultiSelectVisible()) {
|
|
2974
2476
|
<th></th>
|
|
2975
2477
|
} @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
|
|
2976
|
-
<th
|
|
2977
|
-
|
|
2978
|
-
[source]="source()"
|
|
2979
|
-
[grid]="grid()"
|
|
2980
|
-
(create)="create.emit($event)"
|
|
2981
|
-
></th>
|
|
2982
|
-
} @for (column of getVisibleColumns(); track column.id + $index) {
|
|
2478
|
+
<th ng2-st-add-button [source]="source()" [grid]="grid()" (create)="create.emit($event)"></th>
|
|
2479
|
+
} @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
|
|
2983
2480
|
<th class="ng2-smart-th {{ column.id }}">
|
|
2984
|
-
<ng2-smart-table-filter
|
|
2985
|
-
[source]="source()"
|
|
2986
|
-
[column]="column"
|
|
2987
|
-
[inputClass]="filterInputClass()"
|
|
2988
|
-
(filter)="filter.emit($event)"
|
|
2989
|
-
>
|
|
2481
|
+
<ng2-smart-table-filter [source]="source()" [column]="column" [inputClass]="filterInputClass()">
|
|
2990
2482
|
</ng2-smart-table-filter>
|
|
2991
2483
|
</th>
|
|
2992
2484
|
} @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
|
|
2993
|
-
<th
|
|
2994
|
-
ng2-st-add-button
|
|
2995
|
-
[grid]="grid()"
|
|
2996
|
-
[source]="source()"
|
|
2997
|
-
(create)="create.emit($event)"
|
|
2998
|
-
></th>
|
|
2485
|
+
<th ng2-st-add-button [grid]="grid()" [source]="source()" (create)="create.emit($event)"></th>
|
|
2999
2486
|
}
|
|
3000
2487
|
`,
|
|
3001
2488
|
standalone: true,
|
|
@@ -3067,9 +2554,9 @@ class TheadFormRowComponent {
|
|
|
3067
2554
|
this.addInputClass = computed(() => {
|
|
3068
2555
|
const addOptions = this.grid().settings()?.add;
|
|
3069
2556
|
if (!addOptions) {
|
|
3070
|
-
return
|
|
2557
|
+
return '';
|
|
3071
2558
|
}
|
|
3072
|
-
return addOptions.inputClass ||
|
|
2559
|
+
return addOptions.inputClass || '';
|
|
3073
2560
|
});
|
|
3074
2561
|
}
|
|
3075
2562
|
onCreate(event) {
|
|
@@ -3077,7 +2564,7 @@ class TheadFormRowComponent {
|
|
|
3077
2564
|
this.grid().create(this.grid().getNewRow(), this.createConfirm);
|
|
3078
2565
|
}
|
|
3079
2566
|
getVisibleCells() {
|
|
3080
|
-
return (this.grid().getNewRow().
|
|
2567
|
+
return (this.grid().getNewRow().cells() || []).filter((cell) => !cell.getColumn().hide);
|
|
3081
2568
|
}
|
|
3082
2569
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFormRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3083
2570
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFormRowComponent, isStandalone: true, selector: "[ng2-st-thead-form-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { create: "create" }, ngImport: i0, template: `
|
|
@@ -3085,26 +2572,19 @@ class TheadFormRowComponent {
|
|
|
3085
2572
|
<td></td>
|
|
3086
2573
|
} @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
|
|
3087
2574
|
<td class="ng2-smart-actions">
|
|
3088
|
-
<ng2-st-actions
|
|
3089
|
-
[grid]="grid()"
|
|
3090
|
-
(create)="onCreate($event)"
|
|
3091
|
-
></ng2-st-actions>
|
|
2575
|
+
<ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
|
|
3092
2576
|
</td>
|
|
3093
2577
|
} @for (cell of getVisibleCells(); track cell.getId()+ $index) {
|
|
3094
2578
|
<td>
|
|
3095
2579
|
<ng2-smart-table-cell
|
|
3096
2580
|
[cell]="cell"
|
|
3097
2581
|
[inputClass]="addInputClass()"
|
|
3098
|
-
[isInEditing]="grid().getNewRow().isInEditing()"
|
|
3099
|
-
>
|
|
2582
|
+
[isInEditing]="grid().getNewRow().isInEditing()">
|
|
3100
2583
|
</ng2-smart-table-cell>
|
|
3101
2584
|
</td>
|
|
3102
2585
|
} @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
|
|
3103
2586
|
<td class="ng2-smart-actions">
|
|
3104
|
-
<ng2-st-actions
|
|
3105
|
-
[grid]="grid()"
|
|
3106
|
-
(create)="onCreate($event)"
|
|
3107
|
-
></ng2-st-actions>
|
|
2587
|
+
<ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
|
|
3108
2588
|
</td>
|
|
3109
2589
|
}
|
|
3110
2590
|
`, isInline: true, dependencies: [{ kind: "component", type: ActionsComponent, selector: "ng2-st-actions", inputs: ["grid"], outputs: ["create"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["cell", "inputClass", "isInEditing"] }] }); }
|
|
@@ -3112,32 +2592,25 @@ class TheadFormRowComponent {
|
|
|
3112
2592
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFormRowComponent, decorators: [{
|
|
3113
2593
|
type: Component,
|
|
3114
2594
|
args: [{
|
|
3115
|
-
selector:
|
|
2595
|
+
selector: '[ng2-st-thead-form-row]',
|
|
3116
2596
|
template: `
|
|
3117
2597
|
@if (grid().isMultiSelectVisible()) {
|
|
3118
2598
|
<td></td>
|
|
3119
2599
|
} @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
|
|
3120
2600
|
<td class="ng2-smart-actions">
|
|
3121
|
-
<ng2-st-actions
|
|
3122
|
-
[grid]="grid()"
|
|
3123
|
-
(create)="onCreate($event)"
|
|
3124
|
-
></ng2-st-actions>
|
|
2601
|
+
<ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
|
|
3125
2602
|
</td>
|
|
3126
2603
|
} @for (cell of getVisibleCells(); track cell.getId()+ $index) {
|
|
3127
2604
|
<td>
|
|
3128
2605
|
<ng2-smart-table-cell
|
|
3129
2606
|
[cell]="cell"
|
|
3130
2607
|
[inputClass]="addInputClass()"
|
|
3131
|
-
[isInEditing]="grid().getNewRow().isInEditing()"
|
|
3132
|
-
>
|
|
2608
|
+
[isInEditing]="grid().getNewRow().isInEditing()">
|
|
3133
2609
|
</ng2-smart-table-cell>
|
|
3134
2610
|
</td>
|
|
3135
2611
|
} @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
|
|
3136
2612
|
<td class="ng2-smart-actions">
|
|
3137
|
-
<ng2-st-actions
|
|
3138
|
-
[grid]="grid()"
|
|
3139
|
-
(create)="onCreate($event)"
|
|
3140
|
-
></ng2-st-actions>
|
|
2613
|
+
<ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
|
|
3141
2614
|
</td>
|
|
3142
2615
|
}
|
|
3143
2616
|
`,
|
|
@@ -3180,7 +2653,7 @@ class CheckboxSelectAllComponent {
|
|
|
3180
2653
|
}
|
|
3181
2654
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3182
2655
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CheckboxSelectAllComponent, isStandalone: true, selector: "[ng2-st-checkbox-select-all]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
3183
|
-
<input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected" />
|
|
2656
|
+
<input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" />
|
|
3184
2657
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { 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"] }] }); }
|
|
3185
2658
|
}
|
|
3186
2659
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, decorators: [{
|
|
@@ -3188,7 +2661,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
3188
2661
|
args: [{
|
|
3189
2662
|
selector: "[ng2-st-checkbox-select-all]",
|
|
3190
2663
|
template: `
|
|
3191
|
-
<input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected" />
|
|
2664
|
+
<input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" />
|
|
3192
2665
|
`,
|
|
3193
2666
|
standalone: true,
|
|
3194
2667
|
imports: [FormsModule],
|
|
@@ -3197,117 +2670,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
3197
2670
|
|
|
3198
2671
|
class TitleComponent {
|
|
3199
2672
|
constructor() {
|
|
3200
|
-
this.currentDirection = "";
|
|
3201
2673
|
this.source = input.required();
|
|
3202
2674
|
this.column = input.required();
|
|
3203
|
-
this.
|
|
3204
|
-
this.
|
|
2675
|
+
this.destroyRef = inject(DestroyRef);
|
|
2676
|
+
this.currentSortDirection = signal('');
|
|
3205
2677
|
}
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
2678
|
+
ngOnInit() {
|
|
2679
|
+
this.source()
|
|
2680
|
+
.onChanged()
|
|
2681
|
+
.pipe(map(({ sort }) => {
|
|
2682
|
+
if (sort.field === this.column().id) {
|
|
2683
|
+
return sort.direction;
|
|
3210
2684
|
}
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
else {
|
|
3217
|
-
this.currentDirection = "";
|
|
3218
|
-
}
|
|
3219
|
-
});
|
|
3220
|
-
}
|
|
3221
|
-
}
|
|
3222
|
-
ngOnDestroy() {
|
|
3223
|
-
if (this.dataChangedSub) {
|
|
3224
|
-
this.dataChangedSub?.unsubscribe();
|
|
3225
|
-
}
|
|
2685
|
+
else {
|
|
2686
|
+
return '';
|
|
2687
|
+
}
|
|
2688
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
2689
|
+
.subscribe(this.currentSortDirection.set);
|
|
3226
2690
|
}
|
|
3227
2691
|
_sort(event) {
|
|
3228
2692
|
event.preventDefault();
|
|
3229
|
-
this.
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
compare: this.column().getCompareFunction(),
|
|
3235
|
-
},
|
|
3236
|
-
]);
|
|
3237
|
-
this.sort.emit(null);
|
|
3238
|
-
}
|
|
3239
|
-
changeSortDirection() {
|
|
3240
|
-
if (this.currentDirection) {
|
|
3241
|
-
const newDirection = this.currentDirection === "asc" ? "desc" : "asc";
|
|
3242
|
-
this.currentDirection = newDirection;
|
|
3243
|
-
}
|
|
3244
|
-
else {
|
|
3245
|
-
this.currentDirection = this.column().sortDirection;
|
|
3246
|
-
}
|
|
3247
|
-
return this.currentDirection;
|
|
2693
|
+
this.source().setSort({
|
|
2694
|
+
field: this.column().id,
|
|
2695
|
+
direction: this.currentSortDirection() === 'desc' ? 'asc' : 'desc',
|
|
2696
|
+
compare: this.column().compareFunction,
|
|
2697
|
+
});
|
|
3248
2698
|
}
|
|
3249
2699
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3250
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TitleComponent, isStandalone: true, selector: "ng2-smart-table-title", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } },
|
|
2700
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TitleComponent, isStandalone: true, selector: "ng2-smart-table-title", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
3251
2701
|
@if (column().isSortable) {
|
|
3252
|
-
<a
|
|
3253
|
-
href="#"
|
|
3254
|
-
(click)="_sort($event)"
|
|
3255
|
-
class="ng2-smart-sort-link sort"
|
|
3256
|
-
[class]="currentDirection"
|
|
3257
|
-
>
|
|
2702
|
+
<a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort" [class]="currentSortDirection()">
|
|
3258
2703
|
{{ column().title }}
|
|
3259
2704
|
</a>
|
|
3260
2705
|
} @else {
|
|
3261
2706
|
<span class="ng2-smart-sort">{{ column().title }}</span>
|
|
3262
2707
|
}
|
|
3263
|
-
`, isInline: true, styles: ["a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{-webkit-transform:rotate(-180deg);transform:rotate(-180deg);margin-bottom:-2px}\n"] }); }
|
|
2708
|
+
`, isInline: true, styles: ["a.sort{white-space:nowrap}a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{-webkit-transform:rotate(-180deg);transform:rotate(-180deg);margin-bottom:-2px}\n"] }); }
|
|
3264
2709
|
}
|
|
3265
2710
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TitleComponent, decorators: [{
|
|
3266
2711
|
type: Component,
|
|
3267
|
-
args: [{ selector:
|
|
2712
|
+
args: [{ selector: 'ng2-smart-table-title', template: `
|
|
3268
2713
|
@if (column().isSortable) {
|
|
3269
|
-
<a
|
|
3270
|
-
href="#"
|
|
3271
|
-
(click)="_sort($event)"
|
|
3272
|
-
class="ng2-smart-sort-link sort"
|
|
3273
|
-
[class]="currentDirection"
|
|
3274
|
-
>
|
|
2714
|
+
<a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort" [class]="currentSortDirection()">
|
|
3275
2715
|
{{ column().title }}
|
|
3276
2716
|
</a>
|
|
3277
2717
|
} @else {
|
|
3278
2718
|
<span class="ng2-smart-sort">{{ column().title }}</span>
|
|
3279
2719
|
}
|
|
3280
|
-
`, standalone: true, styles: ["a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{-webkit-transform:rotate(-180deg);transform:rotate(-180deg);margin-bottom:-2px}\n"] }]
|
|
2720
|
+
`, standalone: true, styles: ["a.sort{white-space:nowrap}a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{-webkit-transform:rotate(-180deg);transform:rotate(-180deg);margin-bottom:-2px}\n"] }]
|
|
3281
2721
|
}] });
|
|
3282
2722
|
|
|
3283
2723
|
class ColumnTitleComponent {
|
|
3284
2724
|
constructor() {
|
|
3285
2725
|
this.source = input.required();
|
|
3286
2726
|
this.column = input.required();
|
|
3287
|
-
this.sort = output();
|
|
3288
2727
|
}
|
|
3289
2728
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3290
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: ColumnTitleComponent, isStandalone: true, selector: "ng2-st-column-title", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } },
|
|
2729
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: ColumnTitleComponent, isStandalone: true, selector: "ng2-st-column-title", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
3291
2730
|
<div class="ng2-smart-title">
|
|
3292
|
-
<ng2-smart-table-title
|
|
3293
|
-
[source]="source()"
|
|
3294
|
-
[column]="column()"
|
|
3295
|
-
(sort)="sort.emit($event)"
|
|
3296
|
-
></ng2-smart-table-title>
|
|
2731
|
+
<ng2-smart-table-title [source]="source()" [column]="column()"></ng2-smart-table-title>
|
|
3297
2732
|
</div>
|
|
3298
|
-
`, isInline: true, dependencies: [{ kind: "component", type: TitleComponent, selector: "ng2-smart-table-title", inputs: ["source", "column"]
|
|
2733
|
+
`, isInline: true, dependencies: [{ kind: "component", type: TitleComponent, selector: "ng2-smart-table-title", inputs: ["source", "column"] }] }); }
|
|
3299
2734
|
}
|
|
3300
2735
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, decorators: [{
|
|
3301
2736
|
type: Component,
|
|
3302
2737
|
args: [{
|
|
3303
|
-
selector:
|
|
2738
|
+
selector: 'ng2-st-column-title',
|
|
3304
2739
|
template: `
|
|
3305
2740
|
<div class="ng2-smart-title">
|
|
3306
|
-
<ng2-smart-table-title
|
|
3307
|
-
[source]="source()"
|
|
3308
|
-
[column]="column()"
|
|
3309
|
-
(sort)="sort.emit($event)"
|
|
3310
|
-
></ng2-smart-table-title>
|
|
2741
|
+
<ng2-smart-table-title [source]="source()" [column]="column()"></ng2-smart-table-title>
|
|
3311
2742
|
</div>
|
|
3312
2743
|
`,
|
|
3313
2744
|
standalone: true,
|
|
@@ -3319,76 +2750,44 @@ class TheadTitlesRowComponent {
|
|
|
3319
2750
|
constructor() {
|
|
3320
2751
|
this.grid = input.required();
|
|
3321
2752
|
this.source = input.required();
|
|
3322
|
-
this.sort = output();
|
|
3323
2753
|
this.selectAllRows = output();
|
|
3324
2754
|
}
|
|
3325
|
-
getVisibleColumns() {
|
|
3326
|
-
return (this.grid().getColumns() || []).filter((column) => !column.hide);
|
|
3327
|
-
}
|
|
3328
2755
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3329
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadTitlesRowComponent, isStandalone: true, selector: "[ng2-st-thead-titles-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: {
|
|
2756
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadTitlesRowComponent, isStandalone: true, selector: "[ng2-st-thead-titles-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selectAllRows: "selectAllRows" }, ngImport: i0, template: `
|
|
3330
2757
|
@if (grid().isMultiSelectVisible()) {
|
|
3331
|
-
<th
|
|
3332
|
-
ng2-st-checkbox-select-all
|
|
3333
|
-
[grid]="grid()"
|
|
3334
|
-
(click)="selectAllRows.emit($event)"
|
|
3335
|
-
></th>
|
|
2758
|
+
<th ng2-st-checkbox-select-all [grid]="grid()" (click)="selectAllRows.emit()"></th>
|
|
3336
2759
|
} @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
|
|
3337
2760
|
|
|
3338
2761
|
<th ng2-st-actions-title [grid]="grid()"></th>
|
|
3339
|
-
} @for (column of getVisibleColumns(); track column.id + $index) {
|
|
3340
|
-
<th
|
|
3341
|
-
|
|
3342
|
-
[class]="column.class"
|
|
3343
|
-
[style.width]="column.width"
|
|
3344
|
-
>
|
|
3345
|
-
<ng2-st-column-title
|
|
3346
|
-
[source]="source()"
|
|
3347
|
-
[column]="column"
|
|
3348
|
-
(sort)="sort.emit($event)"
|
|
3349
|
-
></ng2-st-column-title>
|
|
2762
|
+
} @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
|
|
2763
|
+
<th class="ng2-smart-th {{ column.id }}" [class]="column.class" [style.width]="column.width">
|
|
2764
|
+
<ng2-st-column-title [source]="source()" [column]="column"></ng2-st-column-title>
|
|
3350
2765
|
</th>
|
|
3351
2766
|
} @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
|
|
3352
2767
|
<th ng2-st-actions-title [grid]="grid()"></th>
|
|
3353
2768
|
}
|
|
3354
|
-
`, isInline: true, dependencies: [{ kind: "component", type: CheckboxSelectAllComponent, selector: "[ng2-st-checkbox-select-all]", inputs: ["grid"] }, { kind: "component", type: ActionsTitleComponent, selector: "[ng2-st-actions-title]", inputs: ["grid"] }, { kind: "component", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: ["source", "column"]
|
|
2769
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CheckboxSelectAllComponent, selector: "[ng2-st-checkbox-select-all]", inputs: ["grid"] }, { kind: "component", type: ActionsTitleComponent, selector: "[ng2-st-actions-title]", inputs: ["grid"] }, { kind: "component", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: ["source", "column"] }] }); }
|
|
3355
2770
|
}
|
|
3356
2771
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, decorators: [{
|
|
3357
2772
|
type: Component,
|
|
3358
2773
|
args: [{
|
|
3359
|
-
selector:
|
|
2774
|
+
selector: '[ng2-st-thead-titles-row]',
|
|
3360
2775
|
template: `
|
|
3361
2776
|
@if (grid().isMultiSelectVisible()) {
|
|
3362
|
-
<th
|
|
3363
|
-
ng2-st-checkbox-select-all
|
|
3364
|
-
[grid]="grid()"
|
|
3365
|
-
(click)="selectAllRows.emit($event)"
|
|
3366
|
-
></th>
|
|
2777
|
+
<th ng2-st-checkbox-select-all [grid]="grid()" (click)="selectAllRows.emit()"></th>
|
|
3367
2778
|
} @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
|
|
3368
2779
|
|
|
3369
2780
|
<th ng2-st-actions-title [grid]="grid()"></th>
|
|
3370
|
-
} @for (column of getVisibleColumns(); track column.id + $index) {
|
|
3371
|
-
<th
|
|
3372
|
-
|
|
3373
|
-
[class]="column.class"
|
|
3374
|
-
[style.width]="column.width"
|
|
3375
|
-
>
|
|
3376
|
-
<ng2-st-column-title
|
|
3377
|
-
[source]="source()"
|
|
3378
|
-
[column]="column"
|
|
3379
|
-
(sort)="sort.emit($event)"
|
|
3380
|
-
></ng2-st-column-title>
|
|
2781
|
+
} @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
|
|
2782
|
+
<th class="ng2-smart-th {{ column.id }}" [class]="column.class" [style.width]="column.width">
|
|
2783
|
+
<ng2-st-column-title [source]="source()" [column]="column"></ng2-st-column-title>
|
|
3381
2784
|
</th>
|
|
3382
2785
|
} @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
|
|
3383
2786
|
<th ng2-st-actions-title [grid]="grid()"></th>
|
|
3384
2787
|
}
|
|
3385
2788
|
`,
|
|
3386
2789
|
standalone: true,
|
|
3387
|
-
imports: [
|
|
3388
|
-
CheckboxSelectAllComponent,
|
|
3389
|
-
ActionsTitleComponent,
|
|
3390
|
-
ColumnTitleComponent,
|
|
3391
|
-
],
|
|
2790
|
+
imports: [CheckboxSelectAllComponent, ActionsTitleComponent, ColumnTitleComponent],
|
|
3392
2791
|
}]
|
|
3393
2792
|
}] });
|
|
3394
2793
|
|
|
@@ -3396,10 +2795,8 @@ class Ng2SmartTableTheadComponent {
|
|
|
3396
2795
|
constructor() {
|
|
3397
2796
|
this.grid = input.required();
|
|
3398
2797
|
this.source = input.required();
|
|
3399
|
-
this.sort = output();
|
|
3400
2798
|
this.selectAllRows = output();
|
|
3401
2799
|
this.create = output();
|
|
3402
|
-
this.filter = output();
|
|
3403
2800
|
this.isHideHeader = computed(() => {
|
|
3404
2801
|
return this.grid().settings()?.hideHeader || false;
|
|
3405
2802
|
});
|
|
@@ -3408,15 +2805,11 @@ class Ng2SmartTableTheadComponent {
|
|
|
3408
2805
|
});
|
|
3409
2806
|
}
|
|
3410
2807
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3411
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTheadComponent, isStandalone: true, selector: "[ng2-st-thead]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: false, isRequired: false, transformFunction: null } }, outputs: {
|
|
2808
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTheadComponent, isStandalone: true, selector: "[ng2-st-thead]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { selectAllRows: "selectAllRows", create: "create" }, ngImport: i0, template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (selectAllRows)=\"selectAllRows.emit()\">\n </tr>\n}\n\n@if (!isHideSubHeader()) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (create)=\"create.emit($event)\">\n </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n", dependencies: [{ kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["selectAllRows"] }, { kind: "component", type: TheadFiltersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "createConfirm"], outputs: ["create"] }] }); }
|
|
3412
2809
|
}
|
|
3413
2810
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
|
|
3414
2811
|
type: Component,
|
|
3415
|
-
args: [{ selector:
|
|
3416
|
-
TheadTitlesRowComponent,
|
|
3417
|
-
TheadFiltersRowComponent,
|
|
3418
|
-
TheadFormRowComponent,
|
|
3419
|
-
], template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n </tr>\n}\n\n@if (!isHideSubHeader()) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n" }]
|
|
2812
|
+
args: [{ selector: '[ng2-st-thead]', standalone: true, imports: [TheadTitlesRowComponent, TheadFiltersRowComponent, TheadFormRowComponent], template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (selectAllRows)=\"selectAllRows.emit()\">\n </tr>\n}\n\n@if (!isHideSubHeader()) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (create)=\"create.emit($event)\">\n </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n" }]
|
|
3420
2813
|
}], propDecorators: { createConfirm: [{
|
|
3421
2814
|
type: Input
|
|
3422
2815
|
}] } });
|
|
@@ -3437,21 +2830,17 @@ class Ng2SmartTableComponent {
|
|
|
3437
2830
|
this.editConfirm = output();
|
|
3438
2831
|
this.createConfirm = output();
|
|
3439
2832
|
this.tableClass = computed(() => {
|
|
3440
|
-
return this.settings().attr?.class ||
|
|
2833
|
+
return this.settings().attr?.class || '';
|
|
3441
2834
|
});
|
|
3442
2835
|
this.tableId = computed(() => {
|
|
3443
2836
|
return this.settings().attr?.id || getRandomId();
|
|
3444
2837
|
});
|
|
3445
|
-
this.perPageSelect = computed(() => {
|
|
3446
|
-
const { pager } = this.settings();
|
|
3447
|
-
return pager ? pager.perPageSelect || [] : [];
|
|
3448
|
-
});
|
|
3449
2838
|
this.isPagerDisplay = computed(() => {
|
|
3450
2839
|
const { pager } = this.settings();
|
|
3451
2840
|
return pager ? pager.display : false;
|
|
3452
2841
|
});
|
|
3453
2842
|
this.rowClassFunction = computed(() => {
|
|
3454
|
-
return this.settings().rowClassFunction || (() =>
|
|
2843
|
+
return this.settings().rowClassFunction || (() => '');
|
|
3455
2844
|
});
|
|
3456
2845
|
}
|
|
3457
2846
|
ngOnChanges({ settings }) {
|
|
@@ -3472,7 +2861,7 @@ class Ng2SmartTableComponent {
|
|
|
3472
2861
|
this.emitUserSelectRow(row);
|
|
3473
2862
|
}
|
|
3474
2863
|
onSelectAllRows() {
|
|
3475
|
-
this.grid.selectAllRows(!this.grid.dataSet.isAllSelected);
|
|
2864
|
+
this.grid.selectAllRows(!this.grid.dataSet.isAllSelected());
|
|
3476
2865
|
this.emitUserSelectRow(null);
|
|
3477
2866
|
}
|
|
3478
2867
|
onSelectRow(row, state) {
|
|
@@ -3497,20 +2886,16 @@ class Ng2SmartTableComponent {
|
|
|
3497
2886
|
});
|
|
3498
2887
|
}
|
|
3499
2888
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3500
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableComponent, isStandalone: true, selector: "ng2-smart-table", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { multiRowSelect: "multiRowSelect", rowClicked: "rowClicked", columnsSorted: "columnsSorted", delete: "delete", edit: "edit", editCancel: "editCancel", create: "create", custom: "custom", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", createConfirm: "createConfirm" }, usesOnChanges: true, ngImport: i0, template: "<table [id]=\"tableId()\" [class]=\"tableClass()\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source()\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\"\n ></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source()\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [createConfirm]=\"createConfirm\"\n [rowClassFunction]=\"rowClassFunction()\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n ></tbody>\n</table>\n\n@if (isPagerDisplay()) {\n<ng2-smart-table-pager [source]=\"source()\"
|
|
2889
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableComponent, isStandalone: true, selector: "ng2-smart-table", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { multiRowSelect: "multiRowSelect", rowClicked: "rowClicked", columnsSorted: "columnsSorted", delete: "delete", edit: "edit", editCancel: "editCancel", create: "create", custom: "custom", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", createConfirm: "createConfirm" }, usesOnChanges: true, ngImport: i0, template: "<table [id]=\"tableId()\" [class]=\"tableClass()\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source()\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\"\n ></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source()\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [createConfirm]=\"createConfirm\"\n [rowClassFunction]=\"rowClassFunction()\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n ></tbody>\n</table>\n\n@if (isPagerDisplay()) {\n<ng2-smart-table-pager [source]=\"source()\">\n</ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"], dependencies: [{ kind: "component", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: ["grid", "source", "createConfirm"], outputs: ["selectAllRows", "create"] }, { kind: "component", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: ["grid", "source", "deleteConfirm", "createConfirm", "editConfirm", "rowClassFunction"], outputs: ["save", "edit", "editCancel", "delete", "custom", "edited", "userSelectRow", "userClickedRow", "multipleSelectRow"] }, { kind: "component", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: ["source"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3501
2890
|
}
|
|
3502
2891
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, decorators: [{
|
|
3503
2892
|
type: Component,
|
|
3504
|
-
args: [{ selector:
|
|
3505
|
-
Ng2SmartTableTheadComponent,
|
|
3506
|
-
Ng2SmartTableTbodyComponent,
|
|
3507
|
-
PagerComponent,
|
|
3508
|
-
], template: "<table [id]=\"tableId()\" [class]=\"tableClass()\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source()\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\"\n ></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source()\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [createConfirm]=\"createConfirm\"\n [rowClassFunction]=\"rowClassFunction()\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n ></tbody>\n</table>\n\n@if (isPagerDisplay()) {\n<ng2-smart-table-pager [source]=\"source()\" [perPageSelect]=\"perPageSelect()\">\n</ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"] }]
|
|
2893
|
+
args: [{ selector: 'ng2-smart-table', standalone: true, imports: [Ng2SmartTableTheadComponent, Ng2SmartTableTbodyComponent, PagerComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<table [id]=\"tableId()\" [class]=\"tableClass()\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source()\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\"\n ></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source()\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [createConfirm]=\"createConfirm\"\n [rowClassFunction]=\"rowClassFunction()\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n ></tbody>\n</table>\n\n@if (isPagerDisplay()) {\n<ng2-smart-table-pager [source]=\"source()\">\n</ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"] }]
|
|
3509
2894
|
}] });
|
|
3510
2895
|
|
|
3511
2896
|
/**
|
|
3512
2897
|
* Generated bundle index. Do not edit.
|
|
3513
2898
|
*/
|
|
3514
2899
|
|
|
3515
|
-
export {
|
|
2900
|
+
export { BaseEditorComponent, BaseFilterComponent, Cell, Column, DataSource, Deferred, LocalDataSource, Ng2SmartTableComponent, Row, ServerDataSource, SmartTableColumnEditorDirective, SmartTableOnChangedEventName };
|
|
3516
2901
|
//# sourceMappingURL=den4ik92-ng2-smart-table.mjs.map
|