@den4ik92/ng2-smart-table 3.0.0 → 3.0.2

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.
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter, Component, Input, Output, ViewContainerRef, ViewChild, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
+ import { Subject } from 'rxjs';
3
4
  import * as i1 from '@angular/common';
4
5
  import { CommonModule } from '@angular/common';
5
6
  import * as i2 from '@angular/forms';
6
- import { FormsModule, UntypedFormControl, NgControl, ReactiveFormsModule } from '@angular/forms';
7
- import { Subject } from 'rxjs';
7
+ import { UntypedFormControl, NgControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
8
  import { debounceTime, distinctUntilChanged, skip } from 'rxjs/operators';
9
9
 
10
10
  function prepareValue(value) { return value; }
@@ -50,135 +50,32 @@ class Cell {
50
50
  }
51
51
  }
52
52
 
53
- class Row {
54
- constructor(index, data, _dataSet) {
55
- this.index = index;
56
- this.data = data;
57
- this._dataSet = _dataSet;
58
- this.pending = false;
59
- this.isSelected = false;
60
- this.isInEditing = false;
61
- this.cells = [];
62
- this.process();
63
- }
64
- getCell(column) {
65
- return this.cells.find(el => el.getColumn() === column);
66
- }
67
- getCells() {
68
- return this.cells;
69
- }
70
- getData() {
71
- return this.data;
72
- }
73
- getIsSelected() {
74
- return this.isSelected;
75
- }
76
- getNewData() {
77
- const values = Object.assign({}, this.data);
78
- this.getCells().forEach((cell) => values[cell.getColumn().id] = cell.newValue);
79
- return values;
80
- }
81
- setData(data) {
82
- this.data = data;
83
- this.process();
84
- }
85
- process() {
86
- this.cells = [];
87
- this._dataSet.getColumns().forEach((column) => {
88
- const cell = this.createCell(column);
89
- this.cells.push(cell);
90
- });
91
- }
92
- createCell(column) {
93
- const defValue = column.settings.defaultValue ? column.settings.defaultValue : '';
94
- const value = typeof this.data[column.id] === 'undefined' ? defValue : this.data[column.id];
95
- return new Cell(value, this, column, this._dataSet);
96
- }
97
- }
98
-
99
- /**
100
- * Extending object that entered in first argument.
101
- *
102
- * Returns extended object or false if have no target object or incorrect type.
103
- *
104
- * If you wish to clone source object (without modify it), just use empty new
105
- * object as first argument, like this:
106
- * deepExtend({}, yourObj_1, [yourObj_N]);
107
- */
108
- const deepExtend = function (...objects) {
109
- if (arguments.length < 1 || typeof arguments[0] !== 'object') {
110
- return false;
111
- }
112
- if (arguments.length < 2) {
113
- return arguments[0];
114
- }
115
- const target = arguments[0];
116
- // convert arguments to array and cut off target object
117
- const args = Array.prototype.slice.call(arguments, 1);
118
- let val, src;
119
- args.forEach((obj) => {
120
- // skip argument if it is array or isn't object
121
- if (typeof obj !== 'object' || Array.isArray(obj)) {
122
- return;
123
- }
124
- Object.keys(obj).forEach(function (key) {
125
- src = target[key]; // source value
126
- val = obj[key]; // new value
127
- // recursion prevention
128
- if (val === target) {
129
- return;
130
- /**
131
- * if new value isn't object then just overwrite by new value
132
- * instead of extending.
133
- */
134
- }
135
- else if (typeof val !== 'object' || val === null) {
136
- target[key] = val;
137
- return;
138
- // just clone arrays (and recursive clone objects inside)
139
- }
140
- else if (Array.isArray(val)) {
141
- target[key] = [...val];
142
- return;
143
- // overwrite by new value if source isn't object or array
144
- }
145
- else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
146
- target[key] = deepExtend({}, val);
147
- return;
148
- // source value and new value is objects both, extending...
149
- }
150
- else {
151
- target[key] = deepExtend(src, val);
152
- return;
153
- }
154
- });
155
- });
156
- return target;
157
- };
158
- class Deferred {
53
+ class DefaultEditor {
159
54
  constructor() {
160
- this.promise = new Promise((resolve, reject) => {
161
- this.resolve = resolve;
162
- this.reject = reject;
163
- });
55
+ this.inputClass = '';
56
+ this.onStopEditing = new EventEmitter();
57
+ this.onEdited = new EventEmitter();
58
+ this.onClick = new EventEmitter();
164
59
  }
60
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
61
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DefaultEditor, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { onStopEditing: "onStopEditing", onEdited: "onEdited", onClick: "onClick" }, ngImport: i0, template: '', isInline: true }); }
165
62
  }
166
- // getDeepFromObject({result: {data: 1}}, 'result.data', 2); // returns 1
167
- function getDeepFromObject(object = {}, name, defaultValue = null) {
168
- const keys = name.split('.');
169
- // clone the object
170
- let level = deepExtend({}, object);
171
- keys.forEach((k) => {
172
- if (level && typeof level[k] !== 'undefined') {
173
- level = level[k];
174
- }
175
- });
176
- return typeof level === 'undefined' ? defaultValue : level;
177
- }
178
- function getPageForRowIndex(index, perPage) {
179
- // we need to add 1 to convert 0-based index to 1-based page number.
180
- return Math.floor(index / perPage) + 1;
181
- }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditor, decorators: [{
64
+ type: Component,
65
+ args: [{
66
+ template: '',
67
+ }]
68
+ }], propDecorators: { cell: [{
69
+ type: Input
70
+ }], inputClass: [{
71
+ type: Input
72
+ }], onStopEditing: [{
73
+ type: Output
74
+ }], onEdited: [{
75
+ type: Output
76
+ }], onClick: [{
77
+ type: Output
78
+ }] } });
182
79
 
183
80
  class Column {
184
81
  constructor(id, settings, dataSet) {
@@ -254,1941 +151,1548 @@ class Column {
254
151
  }
255
152
  }
256
153
 
257
- class DataSet {
258
- constructor(data = [], columnSettings) {
259
- this.columnSettings = columnSettings;
260
- this.data = [];
261
- this.columns = [];
262
- this.rows = [];
263
- this.selectedRows = new Set();
264
- this.createColumns(columnSettings);
265
- this.setData(data);
266
- this.createNewRow();
154
+ class DefaultFilter {
155
+ constructor() {
156
+ this.delay = 300;
157
+ this.query = '';
158
+ this.inputClass = '';
159
+ this.filter = new EventEmitter();
267
160
  }
268
- setData(data) {
161
+ ngOnDestroy() {
162
+ if (this.changesSubscription) {
163
+ this.changesSubscription.unsubscribe();
164
+ }
165
+ }
166
+ setFilter() {
167
+ this.filter.emit(this.query);
168
+ }
169
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
170
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DefaultFilter, selector: "ng-component", inputs: { query: "query", inputClass: "inputClass", column: "column" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
171
+ }
172
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilter, decorators: [{
173
+ type: Component,
174
+ args: [{
175
+ template: '',
176
+ }]
177
+ }], propDecorators: { query: [{
178
+ type: Input
179
+ }], inputClass: [{
180
+ type: Input
181
+ }], column: [{
182
+ type: Input
183
+ }], filter: [{
184
+ type: Output
185
+ }] } });
186
+
187
+ class Row {
188
+ constructor(index, data, _dataSet) {
189
+ this.index = index;
269
190
  this.data = data;
270
- this.createRows();
191
+ this._dataSet = _dataSet;
192
+ this.pending = false;
193
+ this.isSelected = false;
194
+ this.isInEditing = false;
195
+ this.cells = [];
196
+ this.process();
271
197
  }
272
- getColumns() {
273
- return this.columns;
198
+ getCell(column) {
199
+ return this.cells.find(el => el.getColumn() === column);
274
200
  }
275
- getRows() {
276
- return this.rows;
201
+ getCells() {
202
+ return this.cells;
277
203
  }
278
- getFirstRow() {
279
- return this.rows[0];
204
+ getData() {
205
+ return this.data;
280
206
  }
281
- getLastRow() {
282
- return this.rows[this.rows.length - 1];
207
+ getIsSelected() {
208
+ return this.isSelected;
283
209
  }
284
- findRowByData(data) {
285
- return this.rows.find((row) => row.getData() === data);
210
+ getNewData() {
211
+ const values = Object.assign({}, this.data);
212
+ this.getCells().forEach((cell) => values[cell.getColumn().id] = cell.newValue);
213
+ return values;
286
214
  }
287
- setSelectAll(state) {
288
- this.rows.forEach((row) => {
289
- row.isSelected = state;
290
- this.storeSelectedRow(row);
291
- });
215
+ setData(data) {
216
+ this.data = data;
217
+ this.process();
292
218
  }
293
- deselectAll() {
294
- this.rows.forEach((row) => {
295
- row.isSelected = false;
219
+ process() {
220
+ this.cells = [];
221
+ this._dataSet.getColumns().forEach((column) => {
222
+ const cell = this.createCell(column);
223
+ this.cells.push(cell);
296
224
  });
297
- // we need to clear selectedRow field because no one row selected
298
- this.selectedRows.clear();
299
- }
300
- selectRow(row, state) {
301
- row.isSelected = state;
302
- this.storeSelectedRow(row);
303
225
  }
304
- multipleSelectRow(row) {
305
- row.isSelected = !row.isSelected;
306
- this.storeSelectedRow(row);
307
- return row;
226
+ createCell(column) {
227
+ const defValue = column.settings.defaultValue ? column.settings.defaultValue : '';
228
+ const value = typeof this.data[column.id] === 'undefined' ? defValue : this.data[column.id];
229
+ return new Cell(value, this, column, this._dataSet);
308
230
  }
309
- getSelectedRowsData() {
310
- return [...this.selectedRows];
231
+ }
232
+
233
+ var SmartTableOnChangedEventName;
234
+ (function (SmartTableOnChangedEventName) {
235
+ SmartTableOnChangedEventName["load"] = "load";
236
+ SmartTableOnChangedEventName["paging"] = "paging";
237
+ SmartTableOnChangedEventName["update"] = "update";
238
+ SmartTableOnChangedEventName["page"] = "page";
239
+ SmartTableOnChangedEventName["filter"] = "filter";
240
+ SmartTableOnChangedEventName["empty"] = "empty";
241
+ SmartTableOnChangedEventName["sort"] = "sort";
242
+ SmartTableOnChangedEventName["add"] = "add";
243
+ SmartTableOnChangedEventName["remove"] = "remove";
244
+ SmartTableOnChangedEventName["append"] = "append";
245
+ SmartTableOnChangedEventName["prepend"] = "prepend";
246
+ SmartTableOnChangedEventName["refresh"] = "refresh";
247
+ })(SmartTableOnChangedEventName || (SmartTableOnChangedEventName = {}));
248
+
249
+ class DataSource {
250
+ constructor() {
251
+ this.onChangedSource = new Subject();
252
+ this.onAddedSource = new Subject();
253
+ this.onUpdatedSource = new Subject();
254
+ this.onRemovedSource = new Subject();
311
255
  }
312
- createNewRow() {
313
- this.newRow = new Row(-1, {}, this);
314
- this.newRow.isInEditing = true;
256
+ refresh() {
257
+ this.emitOnChanged(SmartTableOnChangedEventName.refresh);
315
258
  }
316
- /**
317
- * Create columns by mapping from the settings
318
- * @param settings
319
- * @private
320
- */
321
- createColumns(settings) {
322
- settings.forEach((columnSettings) => {
323
- this.columns.push(new Column(columnSettings.key, columnSettings, this));
324
- });
259
+ loadEmit() {
260
+ this.emitOnChanged(SmartTableOnChangedEventName.load);
261
+ return Promise.resolve(true);
325
262
  }
326
- /**
327
- * Create rows based on current data prepared in data source
328
- * @private
329
- */
330
- createRows() {
331
- this.rows = [];
332
- this.data.forEach((el, index) => {
333
- const row = new Row(index, el, this);
334
- row.isSelected = this.selectedRows.has(row.getData());
335
- this.rows.push(row);
336
- });
263
+ onChanged() {
264
+ return this.onChangedSource.asObservable();
337
265
  }
338
- get isAllSelected() {
339
- return this.rows.every((row) => row.isSelected);
266
+ onAdded() {
267
+ return this.onAddedSource.asObservable();
340
268
  }
341
- storeSelectedRow(row) {
342
- if (row.isSelected) {
343
- this.selectedRows.add(row.getData());
344
- }
345
- else {
346
- this.selectedRows.delete(row.getData());
347
- }
269
+ onUpdated() {
270
+ return this.onUpdatedSource.asObservable();
348
271
  }
349
- }
350
-
351
- class Grid {
352
- constructor(source, settings) {
353
- this.createFormShown = false;
354
- this.onSelectRowSource = new Subject();
355
- this.onDeselectRowSource = new Subject();
356
- this.setSettings(settings);
357
- this.setSource(source);
272
+ onRemoved() {
273
+ return this.onRemovedSource.asObservable();
358
274
  }
359
- detach() {
360
- if (this.sourceOnChangedSubscription) {
361
- this.sourceOnChangedSubscription.unsubscribe();
362
- }
363
- if (this.sourceOnUpdatedSubscription) {
364
- this.sourceOnUpdatedSubscription.unsubscribe();
365
- }
275
+ prependEmit(element) {
276
+ this.emitOnAdded(element);
277
+ this.emitOnChanged(SmartTableOnChangedEventName.prepend);
278
+ return Promise.resolve(true);
366
279
  }
367
- showActionColumn(position) {
368
- return this.isCurrentActionsPosition(position) && this.isActionsVisible();
280
+ appendEmit(element) {
281
+ this.emitOnAdded(element);
282
+ this.emitOnChanged(SmartTableOnChangedEventName.append);
283
+ return Promise.resolve(true);
369
284
  }
370
- isCurrentActionsPosition(position) {
371
- return position == this.getSetting("actions.position");
285
+ addEmit(element) {
286
+ this.emitOnAdded(element);
287
+ this.emitOnChanged(SmartTableOnChangedEventName.add);
288
+ return Promise.resolve(true);
372
289
  }
373
- isActionsVisible() {
374
- return (this.getSetting("actions.add", false) ||
375
- this.getSetting("actions.edit", false) ||
376
- this.getSetting("actions.delete", false) ||
377
- !!this.getSetting("actions.custom", [])?.length);
290
+ removeEmit(element) {
291
+ this.emitOnRemoved(element);
292
+ this.emitOnChanged(SmartTableOnChangedEventName.remove);
293
+ return Promise.resolve(true);
378
294
  }
379
- isMultiSelectVisible() {
380
- return this.getSetting("selectMode") === "multi";
295
+ updateEmit(element) {
296
+ this.emitOnUpdated(element);
297
+ this.emitOnChanged(SmartTableOnChangedEventName.update);
298
+ return Promise.resolve(true);
381
299
  }
382
- getNewRow() {
383
- return this.dataSet.newRow;
300
+ emptyEmit() {
301
+ this.emitOnChanged(SmartTableOnChangedEventName.empty);
302
+ return Promise.resolve(true);
384
303
  }
385
- setSettings(settings) {
386
- this.settings = settings;
387
- this.dataSet = new DataSet([], this.getSetting("columns"));
388
- if (this.source) {
389
- this.source.refresh();
390
- }
304
+ setSortEmit() {
305
+ this.emitOnChanged(SmartTableOnChangedEventName.sort);
391
306
  }
392
- getDataSet() {
393
- return this.dataSet;
307
+ setFilterEmit() {
308
+ this.emitOnChanged(SmartTableOnChangedEventName.filter);
394
309
  }
395
- setSource(source) {
396
- this.source = this.prepareSource(source);
397
- this.detach();
398
- this.sourceOnChangedSubscription = this.source
399
- .onChanged()
400
- .subscribe((changes) => this.processDataChange(changes));
401
- this.sourceOnUpdatedSubscription = this.source
402
- .onUpdated()
403
- .subscribe((data) => {
404
- const changedRow = this.dataSet.findRowByData(data);
405
- if (changedRow) {
406
- changedRow.setData(data);
407
- }
408
- });
310
+ addFilterEmit() {
311
+ this.emitOnChanged(SmartTableOnChangedEventName.filter);
409
312
  }
410
- getSetting(name, defaultValue) {
411
- return getDeepFromObject(this.settings, name, defaultValue);
313
+ setPagingEmit() {
314
+ this.emitOnChanged(SmartTableOnChangedEventName.paging);
412
315
  }
413
- getColumns() {
414
- return this.dataSet.getColumns();
316
+ setPageEmit() {
317
+ this.emitOnChanged(SmartTableOnChangedEventName.page);
415
318
  }
416
- getRows() {
417
- return this.dataSet.getRows();
319
+ emitOnRemoved(element) {
320
+ this.onRemovedSource.next(element);
418
321
  }
419
- selectRow(row, state) {
420
- this.dataSet.selectRow(row, state);
322
+ emitOnUpdated(element) {
323
+ this.onUpdatedSource.next(element);
421
324
  }
422
- multipleSelectRow(row) {
423
- this.dataSet.multipleSelectRow(row);
325
+ emitOnAdded(element) {
326
+ this.onAddedSource.next(element);
424
327
  }
425
- onSelectRow() {
426
- return this.onSelectRowSource.asObservable();
328
+ emitOnChanged(action) {
329
+ this.getElements().then((elements) => this.onChangedSource.next({
330
+ action: action,
331
+ elements: elements,
332
+ paging: this.getPaging(),
333
+ filter: this.getFilter(),
334
+ sort: this.getSort(),
335
+ }));
427
336
  }
428
- onDeselectRow() {
429
- return this.onDeselectRowSource.asObservable();
337
+ }
338
+
339
+ function compareValues(direction, a, b) {
340
+ if (a < b) {
341
+ return -1 * direction;
430
342
  }
431
- edit(row) {
432
- row.isInEditing = true;
343
+ if (a > b) {
344
+ return direction;
433
345
  }
434
- create(row, confirmEmitter) {
435
- row.pending = true;
436
- const deferred = new Deferred();
437
- deferred.promise
438
- .then((newData) => {
439
- row.pending = false;
440
- newData = newData ? newData : row.getNewData();
441
- this.source.prepend(newData).then(() => {
442
- this.createFormShown = false;
443
- this.dataSet.createNewRow();
444
- });
445
- })
446
- .catch((err) => {
447
- row.pending = false;
346
+ return 0;
347
+ }
348
+ class LocalSorter {
349
+ static sort(data, field, direction, customCompare) {
350
+ const dir = (direction === 'asc') ? 1 : -1;
351
+ const compare = customCompare ? customCompare : compareValues;
352
+ return data.sort((a, b) => {
353
+ return compare.call(null, dir, a[field], b[field]);
448
354
  });
449
- if (this.getSetting("add.confirmCreate")) {
450
- confirmEmitter.emit({
451
- newData: row.getNewData(),
452
- source: this.source,
453
- confirm: deferred,
454
- });
455
- }
456
- else {
457
- deferred.resolve(false);
458
- }
459
355
  }
460
- save(row, confirmEmitter) {
461
- row.pending = true;
462
- const deferred = new Deferred();
463
- deferred.promise
464
- .then((newData) => {
465
- row.pending = false;
466
- newData = newData ? newData : row.getNewData();
467
- this.source.update(row.getData(), newData).then(() => {
468
- row.isInEditing = false;
469
- });
470
- })
471
- .catch((err) => {
472
- row.pending = false;
356
+ }
357
+
358
+ function filterValues(value, search) {
359
+ return value.toString().toLowerCase().includes(search.toString().toLowerCase());
360
+ }
361
+ class LocalFilter {
362
+ static filter(data, field, search, customFilter) {
363
+ const filter = customFilter ? customFilter : filterValues;
364
+ return data.filter((el) => {
365
+ const value = typeof el[field] === 'undefined' || el[field] === null ? '' : el[field];
366
+ return filter.call(null, value, search);
473
367
  });
474
- if (this.getSetting("edit.confirmSave")) {
475
- confirmEmitter.emit({
476
- data: row.getData(),
477
- newData: row.getNewData(),
478
- source: this.source,
479
- confirm: deferred,
480
- });
481
- }
482
- else {
483
- deferred.resolve(false);
484
- }
485
- }
486
- delete(row, confirmEmitter) {
487
- row.pending = true;
488
- const deferred = new Deferred();
489
- deferred.promise
490
- .then(() => {
491
- row.pending = false;
492
- this.source.remove(row.getData());
493
- })
494
- .catch((err) => {
495
- row.pending = false;
496
- // doing nothing
497
- });
498
- if (this.getSetting("delete.confirmDelete")) {
499
- confirmEmitter.emit({
500
- data: row.getData(),
501
- source: this.source,
502
- confirm: deferred,
503
- });
504
- }
505
- else {
506
- deferred.resolve(false);
507
- }
508
- if (row.isSelected) {
509
- this.dataSet.selectRow(row, false);
510
- }
511
368
  }
512
- processDataChange(changes) {
513
- if (this.shouldProcessChange(changes)) {
514
- if (changes["action"] === "load") {
515
- this.dataSet.deselectAll();
516
- }
517
- this.dataSet.setData(changes["elements"]);
518
- }
369
+ }
370
+
371
+ class LocalPager {
372
+ static paginate(data, page, perPage) {
373
+ return data.slice(perPage * (page - 1), perPage * page);
519
374
  }
520
- shouldProcessChange(changes) {
521
- if (["filter", "sort", "page", "remove", "refresh", "load", "paging"].indexOf(changes["action"]) !== -1) {
522
- return true;
523
- }
524
- else if (["prepend", "append"].indexOf(changes["action"]) !== -1 &&
525
- !this.getSetting("pager.display")) {
526
- return true;
527
- }
375
+ }
376
+
377
+ /**
378
+ * Extending object that entered in first argument.
379
+ *
380
+ * Returns extended object or false if have no target object or incorrect type.
381
+ *
382
+ * If you wish to clone source object (without modify it), just use empty new
383
+ * object as first argument, like this:
384
+ * deepExtend({}, yourObj_1, [yourObj_N]);
385
+ */
386
+ const deepExtend = function (...objects) {
387
+ if (arguments.length < 1 || typeof arguments[0] !== 'object') {
528
388
  return false;
529
389
  }
530
- prepareSource(source) {
531
- const initialSort = this.getInitialSort();
532
- if (initialSort) {
533
- source.setSort([initialSort], false);
534
- }
535
- if (this.getSetting("pager.display") === true) {
536
- source.setPaging(1, this.getSetting("pager.perPage"), false);
390
+ if (arguments.length < 2) {
391
+ return arguments[0];
392
+ }
393
+ const target = arguments[0];
394
+ // convert arguments to array and cut off target object
395
+ const args = Array.prototype.slice.call(arguments, 1);
396
+ let val, src;
397
+ args.forEach((obj) => {
398
+ // skip argument if it is array or isn't object
399
+ if (typeof obj !== 'object' || Array.isArray(obj)) {
400
+ return;
537
401
  }
538
- source.refresh();
539
- return source;
402
+ Object.keys(obj).forEach(function (key) {
403
+ src = target[key]; // source value
404
+ val = obj[key]; // new value
405
+ // recursion prevention
406
+ if (val === target) {
407
+ return;
408
+ /**
409
+ * if new value isn't object then just overwrite by new value
410
+ * instead of extending.
411
+ */
412
+ }
413
+ else if (typeof val !== 'object' || val === null) {
414
+ target[key] = val;
415
+ return;
416
+ // just clone arrays (and recursive clone objects inside)
417
+ }
418
+ else if (Array.isArray(val)) {
419
+ target[key] = [...val];
420
+ return;
421
+ // overwrite by new value if source isn't object or array
422
+ }
423
+ else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
424
+ target[key] = deepExtend({}, val);
425
+ return;
426
+ // source value and new value is objects both, extending...
427
+ }
428
+ else {
429
+ target[key] = deepExtend(src, val);
430
+ return;
431
+ }
432
+ });
433
+ });
434
+ return target;
435
+ };
436
+ class Deferred {
437
+ constructor() {
438
+ this.promise = new Promise((resolve, reject) => {
439
+ this.resolve = resolve;
440
+ this.reject = reject;
441
+ });
540
442
  }
541
- getInitialSort() {
542
- const defaultSortColumn = this.getColumns().find((column) => column.isSortable && column.defaultSortDirection);
543
- if (!defaultSortColumn) {
544
- return false;
443
+ }
444
+ // getDeepFromObject({result: {data: 1}}, 'result.data', 2); // returns 1
445
+ function getDeepFromObject(object = {}, name, defaultValue = null) {
446
+ const keys = name.split('.');
447
+ // clone the object
448
+ let level = deepExtend({}, object);
449
+ keys.forEach((k) => {
450
+ if (level && typeof level[k] !== 'undefined') {
451
+ level = level[k];
545
452
  }
546
- return {
547
- field: defaultSortColumn.id,
548
- direction: defaultSortColumn.defaultSortDirection || "asc",
549
- compare: defaultSortColumn.getCompareFunction(),
453
+ });
454
+ return typeof level === 'undefined' ? defaultValue : level;
455
+ }
456
+ function getPageForRowIndex(index, perPage) {
457
+ // we need to add 1 to convert 0-based index to 1-based page number.
458
+ return Math.floor(index / perPage) + 1;
459
+ }
460
+
461
+ class LocalDataSource extends DataSource {
462
+ constructor(data = []) {
463
+ super();
464
+ this.data = [];
465
+ this.filteredAndSorted = [];
466
+ this.sortConf = [];
467
+ this.filterConf = {
468
+ filters: [],
469
+ andOperator: true,
550
470
  };
471
+ this.pagingConf = false;
472
+ this.data = data;
551
473
  }
552
- getSelectedRowsData() {
553
- return this.dataSet.getRows();
554
- }
555
- selectAllRows(status) {
556
- this.dataSet.setSelectAll(status);
557
- }
558
- getFirstRow() {
559
- return this.dataSet.getFirstRow();
474
+ load(data) {
475
+ this.data = data;
476
+ return super.loadEmit();
560
477
  }
561
- getLastRow() {
562
- return this.dataSet.getLastRow();
478
+ prepend(element) {
479
+ this.reset(true);
480
+ this.data.unshift(element);
481
+ return super.prependEmit(element);
563
482
  }
564
- }
565
-
566
- class EditCellDefault {
567
- constructor() {
568
- this.inputClass = '';
569
- this.edited = new EventEmitter();
483
+ appendMany(elements) {
484
+ this.reset(true);
485
+ this.data = [...this.data, ...elements];
486
+ return super.loadEmit();
570
487
  }
571
- onEdited(event) {
572
- this.edited.next(event);
573
- return false;
488
+ append(element) {
489
+ this.reset(true);
490
+ this.data.push(element);
491
+ return super.appendEmit(element);
574
492
  }
575
- onStopEditing() {
576
- this.cell.getRow().isInEditing = false;
577
- return false;
493
+ add(element) {
494
+ this.data.push(element);
495
+ return super.addEmit(element);
578
496
  }
579
- onClick(event) {
580
- event.stopPropagation();
497
+ remove(element) {
498
+ this.data = this.data.filter(el => el !== element);
499
+ return super.removeEmit(element);
581
500
  }
582
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
583
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: EditCellDefault, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: '', isInline: true }); }
584
- }
585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellDefault, decorators: [{
586
- type: Component,
587
- args: [{
588
- template: ''
589
- }]
590
- }], propDecorators: { cell: [{
591
- type: Input
592
- }], inputClass: [{
593
- type: Input
594
- }], edited: [{
595
- type: Output
596
- }] } });
597
-
598
- class CustomEditComponent extends EditCellDefault {
599
- constructor(resolver) {
600
- super();
601
- this.resolver = resolver;
501
+ update(element, values) {
502
+ return new Promise((resolve, reject) => {
503
+ this.find(element).then((found) => {
504
+ found = deepExtend(found, values);
505
+ super.updateEmit(found).then(resolve).catch(reject);
506
+ }).catch(reject);
507
+ });
602
508
  }
603
- ngOnChanges(changes) {
604
- const editor = this.cell.getColumn().editor;
605
- if (this.cell && !this.customComponent && editor && editor.type == 'custom') {
606
- const componentFactory = this.resolver.resolveComponentFactory(editor.component);
607
- this.customComponent = this.dynamicTarget.createComponent(componentFactory);
608
- // set @Inputs and @Outputs of custom component
609
- this.customComponent.instance.cell = this.cell;
610
- this.customComponent.instance.inputClass = this.inputClass;
611
- this.customComponent.instance.onStopEditing.subscribe(() => this.onStopEditing());
612
- this.customComponent.instance.onEdited.subscribe((event) => this.onEdited(event));
613
- this.customComponent.instance.onClick.subscribe((event) => this.onClick(event));
509
+ find(element) {
510
+ const found = this.data.find(el => el === element);
511
+ if (found) {
512
+ return Promise.resolve(found);
614
513
  }
514
+ return Promise.reject(new Error('Element was not found in the dataset'));
615
515
  }
616
- ngOnDestroy() {
617
- if (this.customComponent) {
618
- this.customComponent.destroy();
619
- }
516
+ getElements() {
517
+ const data = this.data.slice(0);
518
+ return Promise.resolve(this.prepareData(data));
620
519
  }
621
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomEditComponent, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component }); }
622
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CustomEditComponent, selector: "table-cell-custom-editor", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
623
- <ng-template #dynamicTarget></ng-template>
624
- `, isInline: true }); }
625
- }
626
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomEditComponent, decorators: [{
627
- type: Component,
628
- args: [{
629
- selector: 'table-cell-custom-editor',
630
- template: `
631
- <ng-template #dynamicTarget></ng-template>
632
- `,
633
- }]
634
- }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }], propDecorators: { dynamicTarget: [{
635
- type: ViewChild,
636
- args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
637
- }] } });
638
-
639
- class DefaultEditor {
640
- constructor() {
641
- this.inputClass = '';
642
- this.onStopEditing = new EventEmitter();
643
- this.onEdited = new EventEmitter();
644
- this.onClick = new EventEmitter();
645
- }
646
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
647
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DefaultEditor, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { onStopEditing: "onStopEditing", onEdited: "onEdited", onClick: "onClick" }, ngImport: i0, template: '', isInline: true }); }
648
- }
649
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditor, decorators: [{
650
- type: Component,
651
- args: [{
652
- template: '',
653
- }]
654
- }], propDecorators: { cell: [{
655
- type: Input
656
- }], inputClass: [{
657
- type: Input
658
- }], onStopEditing: [{
659
- type: Output
660
- }], onEdited: [{
661
- type: Output
662
- }], onClick: [{
663
- type: Output
664
- }] } });
665
-
666
- class CheckboxEditorComponent extends DefaultEditor {
667
- constructor() {
668
- super();
669
- }
670
- onChange(event) {
671
- const config = this.cell.getColumn().getConfig();
672
- const trueVal = (config && config?.true) || true;
673
- const falseVal = (config && config?.false) || false;
674
- this.cell.newValue = event.target.checked ? trueVal : falseVal;
675
- }
676
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
677
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CheckboxEditorComponent, selector: "checkbox-editor", usesInheritance: true, ngImport: i0, template: `
678
- <input [ngClass]="inputClass"
679
- type="checkbox"
680
- class="form-control"
681
- [name]="cell.getId()"
682
- [disabled]="!cell.isEditable()"
683
- [checked]="cell.getValue() === (cell.getColumn().getConfig()?.true || true)"
684
- (click)="onClick.emit($event)"
685
- (change)="onChange($event)">
686
- `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
687
- }
688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
689
- type: Component,
690
- args: [{ selector: 'checkbox-editor', template: `
691
- <input [ngClass]="inputClass"
692
- type="checkbox"
693
- class="form-control"
694
- [name]="cell.getId()"
695
- [disabled]="!cell.isEditable()"
696
- [checked]="cell.getValue() === (cell.getColumn().getConfig()?.true || true)"
697
- (click)="onClick.emit($event)"
698
- (change)="onChange($event)">
699
- `, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
700
- }], ctorParameters: () => [] });
701
-
702
- class InputEditorComponent extends DefaultEditor {
703
- constructor() {
704
- super();
705
- }
706
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
707
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: InputEditorComponent, selector: "input-editor", usesInheritance: true, ngImport: i0, template: `
708
- <input [ngClass]="inputClass"
709
- class="form-control"
710
- [(ngModel)]="cell.newValue"
711
- [name]="cell.getId()"
712
- [placeholder]="cell.getTitle()"
713
- [disabled]="!cell.isEditable()"
714
- (click)="onClick.emit($event)"
715
- (keydown.enter)="onEdited.emit($event)"
716
- (keydown.esc)="onStopEditing.emit()">
717
- `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
718
- }
719
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputEditorComponent, decorators: [{
720
- type: Component,
721
- args: [{ selector: 'input-editor', template: `
722
- <input [ngClass]="inputClass"
723
- class="form-control"
724
- [(ngModel)]="cell.newValue"
725
- [name]="cell.getId()"
726
- [placeholder]="cell.getTitle()"
727
- [disabled]="!cell.isEditable()"
728
- (click)="onClick.emit($event)"
729
- (keydown.enter)="onEdited.emit($event)"
730
- (keydown.esc)="onStopEditing.emit()">
731
- `, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
732
- }], ctorParameters: () => [] });
733
-
734
- class SelectEditorComponent extends DefaultEditor {
735
- constructor() {
736
- super();
737
- }
738
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
739
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: SelectEditorComponent, selector: "select-editor", usesInheritance: true, ngImport: i0, template: `
740
- <select [ngClass]="inputClass"
741
- class="form-control"
742
- [(ngModel)]="cell.newValue"
743
- [name]="cell.getId()"
744
- [disabled]="!cell.isEditable()"
745
- (click)="onClick.emit($event)"
746
- (keydown.enter)="onEdited.emit($event)"
747
- (keydown.esc)="onStopEditing.emit()">
748
-
749
- @for (option of cell.getColumn().getConfig()?.list; track option) {
750
- <option [value]="option.value"
751
- [selected]="option.value === cell.getValue()">{{ option.title }}
752
- </option>
753
- }
754
- </select>
755
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
756
- }
757
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectEditorComponent, decorators: [{
758
- type: Component,
759
- args: [{
760
- selector: 'select-editor',
761
- template: `
762
- <select [ngClass]="inputClass"
763
- class="form-control"
764
- [(ngModel)]="cell.newValue"
765
- [name]="cell.getId()"
766
- [disabled]="!cell.isEditable()"
767
- (click)="onClick.emit($event)"
768
- (keydown.enter)="onEdited.emit($event)"
769
- (keydown.esc)="onStopEditing.emit()">
770
-
771
- @for (option of cell.getColumn().getConfig()?.list; track option) {
772
- <option [value]="option.value"
773
- [selected]="option.value === cell.getValue()">{{ option.title }}
774
- </option>
775
- }
776
- </select>
777
- `,
778
- }]
779
- }], ctorParameters: () => [] });
780
-
781
- class TextareaEditorComponent extends DefaultEditor {
782
- constructor() {
783
- super();
784
- }
785
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
786
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: TextareaEditorComponent, selector: "textarea-editor", usesInheritance: true, ngImport: i0, template: `
787
- <textarea [ngClass]="inputClass"
788
- class="form-control"
789
- [(ngModel)]="cell.newValue"
790
- [name]="cell.getId()"
791
- [disabled]="!cell.isEditable()"
792
- [placeholder]="cell.getTitle()"
793
- (click)="onClick.emit($event)"
794
- (keydown.enter)="onEdited.emit($event)"
795
- (keydown.esc)="onStopEditing.emit()">
796
- </textarea>
797
- `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
798
- }
799
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaEditorComponent, decorators: [{
800
- type: Component,
801
- args: [{ selector: 'textarea-editor', template: `
802
- <textarea [ngClass]="inputClass"
803
- class="form-control"
804
- [(ngModel)]="cell.newValue"
805
- [name]="cell.getId()"
806
- [disabled]="!cell.isEditable()"
807
- [placeholder]="cell.getTitle()"
808
- (click)="onClick.emit($event)"
809
- (keydown.enter)="onEdited.emit($event)"
810
- (keydown.esc)="onStopEditing.emit()">
811
- </textarea>
812
- `, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
813
- }], ctorParameters: () => [] });
814
-
815
- class DefaultEditComponent extends EditCellDefault {
816
- constructor() {
817
- super();
818
- }
819
- getEditorType() {
820
- const editor = this.cell.getColumn().editor;
821
- if (editor) {
822
- return editor.type;
823
- }
824
- return 'text';
825
- }
826
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
827
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: DefaultEditComponent, selector: "table-cell-default-editor", usesInheritance: true, ngImport: i0, template: "<div>\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n }\n}\n</div>", dependencies: [{ kind: "component", type: CheckboxEditorComponent, selector: "checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "input-editor" }, { kind: "component", type: SelectEditorComponent, selector: "select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "textarea-editor" }] }); }
828
- }
829
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditComponent, decorators: [{
830
- type: Component,
831
- args: [{ selector: 'table-cell-default-editor', template: "<div>\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n }\n}\n</div>" }]
832
- }], ctorParameters: () => [] });
833
-
834
- class EditCellComponent {
835
- constructor() {
836
- this.inputClass = '';
837
- this.edited = new EventEmitter();
838
- }
839
- onEdited(event) {
840
- this.edited.next(event);
841
- return false;
842
- }
843
- getEditorType() {
844
- const editor = this.cell.getColumn().editor;
845
- if (editor) {
846
- return editor.type;
847
- }
848
- return 'text';
849
- }
850
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
851
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: `
852
- <div>
853
- @switch (getEditorType()) {
854
- @case ('custom') {
855
- <table-cell-custom-editor
856
- [cell]="cell"
857
- [inputClass]="inputClass"
858
- (edited)="onEdited($event)">
859
- </table-cell-custom-editor>
860
- }
861
- @default {
862
- <table-cell-default-editor
863
- [cell]="cell"
864
- [inputClass]="inputClass"
865
- (edited)="onEdited($event)">
866
- </table-cell-default-editor>
867
- }
868
- }
869
- </div>
870
- `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "table-cell-custom-editor" }, { kind: "component", type: DefaultEditComponent, selector: "table-cell-default-editor" }] }); }
871
- }
872
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellComponent, decorators: [{
873
- type: Component,
874
- args: [{
875
- selector: 'table-cell-edit-mode',
876
- template: `
877
- <div>
878
- @switch (getEditorType()) {
879
- @case ('custom') {
880
- <table-cell-custom-editor
881
- [cell]="cell"
882
- [inputClass]="inputClass"
883
- (edited)="onEdited($event)">
884
- </table-cell-custom-editor>
885
- }
886
- @default {
887
- <table-cell-default-editor
888
- [cell]="cell"
889
- [inputClass]="inputClass"
890
- (edited)="onEdited($event)">
891
- </table-cell-default-editor>
892
- }
893
- }
894
- </div>
895
- `,
896
- }]
897
- }], propDecorators: { cell: [{
898
- type: Input
899
- }], inputClass: [{
900
- type: Input
901
- }], edited: [{
902
- type: Output
903
- }] } });
904
-
905
- class CustomViewComponent {
906
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
907
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CustomViewComponent, selector: "custom-view-component", inputs: { cell: "cell" }, ngImport: i0, template: "<ng-template\n *ngComponentOutlet=\"\n cell.getColumn().renderComponent;\n inputs: { rowData: cell.getRow().getData(), value: cell.getValue() }\n \"\n></ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
908
- }
909
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomViewComponent, decorators: [{
910
- type: Component,
911
- args: [{ selector: "custom-view-component", template: "<ng-template\n *ngComponentOutlet=\"\n cell.getColumn().renderComponent;\n inputs: { rowData: cell.getRow().getData(), value: cell.getValue() }\n \"\n></ng-template>\n" }]
912
- }], propDecorators: { cell: [{
913
- type: Input
914
- }] } });
915
-
916
- class ViewCellComponent {
917
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ViewCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
918
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: { cell: "cell" }, ngImport: i0, template: `
919
- <div>
920
- @switch (cell.getColumn().type) {
921
- @case ('custom') {
922
- <custom-view-component [cell]="cell"></custom-view-component>
923
- }
924
- @case ('html') {
925
- <div [innerHTML]="cell.getValue()"></div>
926
- }
927
- @default {
928
- <div>{{ cell.getValue() }}</div>
929
- }
930
- }
931
- </div>
932
- `, isInline: true, dependencies: [{ kind: "component", type: CustomViewComponent, selector: "custom-view-component", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
933
- }
934
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ViewCellComponent, decorators: [{
935
- type: Component,
936
- args: [{
937
- selector: 'table-cell-view-mode',
938
- changeDetection: ChangeDetectionStrategy.OnPush,
939
- template: `
940
- <div>
941
- @switch (cell.getColumn().type) {
942
- @case ('custom') {
943
- <custom-view-component [cell]="cell"></custom-view-component>
944
- }
945
- @case ('html') {
946
- <div [innerHTML]="cell.getValue()"></div>
947
- }
948
- @default {
949
- <div>{{ cell.getValue() }}</div>
950
- }
951
- }
952
- </div>
953
- `,
954
- }]
955
- }], propDecorators: { cell: [{
956
- type: Input
957
- }] } });
958
-
959
- class CellComponent {
960
- constructor() {
961
- this.inputClass = '';
962
- this.mode = 'inline';
963
- this.isInEditing = false;
964
- this.edited = new EventEmitter();
520
+ getFilteredAndSorted() {
521
+ let data = this.data.slice(0);
522
+ this.prepareData(data);
523
+ return Promise.resolve(this.filteredAndSorted);
965
524
  }
966
- onEdited(event) {
967
- if (this.isNew) {
968
- this.grid.create(this.grid.getNewRow(), this.createConfirm);
525
+ getAll() {
526
+ const data = this.data.slice(0);
527
+ return Promise.resolve(data);
528
+ }
529
+ reset(silent = false) {
530
+ if (silent) {
531
+ this.filterConf = {
532
+ filters: [],
533
+ andOperator: true,
534
+ };
535
+ this.sortConf = [];
536
+ if (this.pagingConf) {
537
+ this.pagingConf.page = 1;
538
+ }
969
539
  }
970
540
  else {
971
- this.grid.save(this.row, this.editConfirm);
541
+ this.setFilter([], true, false);
542
+ this.setSort([], false);
543
+ if (this.pagingConf) {
544
+ this.setPage(1);
545
+ }
972
546
  }
973
547
  }
974
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
975
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CellComponent, selector: "ng2-smart-table-cell", inputs: { grid: "grid", row: "row", editConfirm: "editConfirm", createConfirm: "createConfirm", isNew: "isNew", cell: "cell", inputClass: "inputClass", mode: "mode", isInEditing: "isInEditing" }, outputs: { edited: "edited" }, ngImport: i0, template: `
976
- @if (!isInEditing) {
977
- <table-cell-view-mode [cell]="cell"></table-cell-view-mode>
548
+ empty() {
549
+ this.data = [];
550
+ return super.emptyEmit();
978
551
  }
979
- @if (isInEditing) {
980
- <table-cell-edit-mode [cell]="cell"
981
- [inputClass]="inputClass"
982
- (edited)="onEdited($event)">
983
- </table-cell-edit-mode>
552
+ count() {
553
+ return this.filteredAndSorted.length;
984
554
  }
985
- `, isInline: true, dependencies: [{ kind: "component", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: ["cell", "inputClass"], outputs: ["edited"] }, { kind: "component", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: ["cell"] }] }); }
986
- }
987
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellComponent, decorators: [{
988
- type: Component,
989
- args: [{
990
- selector: 'ng2-smart-table-cell',
991
- template: `
992
- @if (!isInEditing) {
993
- <table-cell-view-mode [cell]="cell"></table-cell-view-mode>
555
+ /**
556
+ *
557
+ * Array of conf objects
558
+ * [
559
+ * {field: string, direction: asc|desc|null, compare: Function|null},
560
+ * ]
561
+ * @param conf
562
+ * @param doEmit
563
+ * @returns {LocalDataSource}
564
+ */
565
+ setSort(conf, doEmit = true) {
566
+ if (conf !== null) {
567
+ conf.forEach((fieldConf) => {
568
+ if (!fieldConf.field || typeof fieldConf.direction === 'undefined') {
569
+ throw new Error('Sort configuration object is not valid');
570
+ }
571
+ });
572
+ this.sortConf = conf;
573
+ }
574
+ if (doEmit) {
575
+ super.setSortEmit();
576
+ }
577
+ return this;
994
578
  }
995
- @if (isInEditing) {
996
- <table-cell-edit-mode [cell]="cell"
997
- [inputClass]="inputClass"
998
- (edited)="onEdited($event)">
999
- </table-cell-edit-mode>
579
+ /**
580
+ *
581
+ * Array of conf objects
582
+ * [
583
+ * {field: string, search: string, filter: Function|null},
584
+ * ]
585
+ * @param conf
586
+ * @param andOperator
587
+ * @param doEmit
588
+ * @returns {LocalDataSource}
589
+ */
590
+ setFilter(conf, andOperator = true, doEmit = true) {
591
+ if (conf && conf.length > 0) {
592
+ conf.forEach((fieldConf) => {
593
+ this.addFilter(fieldConf, andOperator, false);
594
+ });
595
+ }
596
+ else {
597
+ this.filterConf = {
598
+ filters: [],
599
+ andOperator: true,
600
+ };
601
+ }
602
+ this.filterConf.andOperator = andOperator;
603
+ if (this.pagingConf) {
604
+ this.pagingConf.page = 1;
605
+ }
606
+ if (doEmit) {
607
+ super.setFilterEmit();
608
+ }
609
+ return this;
1000
610
  }
1001
- `,
1002
- }]
1003
- }], propDecorators: { grid: [{
1004
- type: Input
1005
- }], row: [{
1006
- type: Input
1007
- }], editConfirm: [{
1008
- type: Input
1009
- }], createConfirm: [{
1010
- type: Input
1011
- }], isNew: [{
1012
- type: Input
1013
- }], cell: [{
1014
- type: Input
1015
- }], inputClass: [{
1016
- type: Input
1017
- }], mode: [{
1018
- type: Input
1019
- }], isInEditing: [{
1020
- type: Input
1021
- }], edited: [{
1022
- type: Output
1023
- }] } });
1024
-
1025
- const CELL_COMPONENTS = [
1026
- CellComponent,
1027
- EditCellDefault,
1028
- DefaultEditor,
1029
- CustomEditComponent,
1030
- DefaultEditComponent,
1031
- EditCellComponent,
1032
- CheckboxEditorComponent,
1033
- InputEditorComponent,
1034
- SelectEditorComponent,
1035
- TextareaEditorComponent,
1036
- CustomViewComponent,
1037
- ViewCellComponent,
1038
- ];
1039
- class CellModule {
1040
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1041
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: CellModule, declarations: [CellComponent,
1042
- EditCellDefault,
1043
- DefaultEditor,
1044
- CustomEditComponent,
1045
- DefaultEditComponent,
1046
- EditCellComponent,
1047
- CheckboxEditorComponent,
1048
- InputEditorComponent,
1049
- SelectEditorComponent,
1050
- TextareaEditorComponent,
1051
- CustomViewComponent,
1052
- ViewCellComponent], imports: [CommonModule,
1053
- FormsModule], exports: [CellComponent,
1054
- EditCellDefault,
1055
- DefaultEditor,
1056
- CustomEditComponent,
1057
- DefaultEditComponent,
1058
- EditCellComponent,
1059
- CheckboxEditorComponent,
1060
- InputEditorComponent,
1061
- SelectEditorComponent,
1062
- TextareaEditorComponent,
1063
- CustomViewComponent,
1064
- ViewCellComponent] }); }
1065
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellModule, imports: [CommonModule,
1066
- FormsModule] }); }
1067
- }
1068
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellModule, decorators: [{
1069
- type: NgModule,
1070
- args: [{
1071
- imports: [
1072
- CommonModule,
1073
- FormsModule,
1074
- ],
1075
- declarations: [
1076
- ...CELL_COMPONENTS,
1077
- ],
1078
- exports: [
1079
- ...CELL_COMPONENTS,
1080
- ],
1081
- }]
1082
- }] });
1083
-
1084
- function compareValues(direction, a, b) {
1085
- if (a < b) {
1086
- return -1 * direction;
611
+ addFilter(fieldConf, andOperator = true, doEmit = true) {
612
+ if (!fieldConf.field || typeof fieldConf.search === 'undefined') {
613
+ throw new Error('Filter configuration object is not valid');
614
+ }
615
+ let found = false;
616
+ this.filterConf.filters.forEach((currentFieldConf, index) => {
617
+ if (currentFieldConf.field === fieldConf.field) {
618
+ this.filterConf.filters[index] = fieldConf;
619
+ found = true;
620
+ }
621
+ });
622
+ if (!found) {
623
+ this.filterConf.filters.push(fieldConf);
624
+ }
625
+ this.filterConf.andOperator = andOperator;
626
+ if (doEmit) {
627
+ super.addFilterEmit();
628
+ }
629
+ return this;
1087
630
  }
1088
- if (a > b) {
1089
- return direction;
631
+ setPaging(page = 1, perPage, doEmit = true) {
632
+ if (this.pagingConf) {
633
+ this.pagingConf.page = page;
634
+ this.pagingConf.perPage = perPage;
635
+ }
636
+ else {
637
+ this.pagingConf = {
638
+ page, perPage
639
+ };
640
+ }
641
+ if (doEmit) {
642
+ super.setPagingEmit();
643
+ }
644
+ return;
1090
645
  }
1091
- return 0;
1092
- }
1093
- class LocalSorter {
1094
- static sort(data, field, direction, customCompare) {
1095
- const dir = (direction === 'asc') ? 1 : -1;
1096
- const compare = customCompare ? customCompare : compareValues;
1097
- return data.sort((a, b) => {
1098
- return compare.call(null, dir, a[field], b[field]);
1099
- });
646
+ setPage(page, doEmit = true) {
647
+ if (!this.pagingConf) {
648
+ return;
649
+ }
650
+ this.pagingConf.page = page;
651
+ if (doEmit) {
652
+ super.setPageEmit();
653
+ }
654
+ return;
1100
655
  }
1101
- }
1102
-
1103
- function filterValues(value, search) {
1104
- return value.toString().toLowerCase().includes(search.toString().toLowerCase());
1105
- }
1106
- class LocalFilter {
1107
- static filter(data, field, search, customFilter) {
1108
- const filter = customFilter ? customFilter : filterValues;
1109
- return data.filter((el) => {
1110
- const value = typeof el[field] === 'undefined' || el[field] === null ? '' : el[field];
1111
- return filter.call(null, value, search);
1112
- });
656
+ getSort() {
657
+ return this.sortConf;
1113
658
  }
1114
- }
1115
-
1116
- class LocalPager {
1117
- static paginate(data, page, perPage) {
1118
- return data.slice(perPage * (page - 1), perPage * page);
659
+ getFilter() {
660
+ return this.filterConf;
661
+ }
662
+ getPaging() {
663
+ return this.pagingConf;
664
+ }
665
+ prepareData(data) {
666
+ data = this.filter(data);
667
+ data = this.sort(data);
668
+ this.filteredAndSorted = data.slice(0);
669
+ if (this.pagingConf) {
670
+ return this.paginate(data);
671
+ }
672
+ else
673
+ return data;
674
+ }
675
+ sort(data) {
676
+ if (this.sortConf) {
677
+ this.sortConf.forEach((fieldConf) => {
678
+ data = LocalSorter
679
+ .sort(data, fieldConf.field, fieldConf.direction, fieldConf.compare);
680
+ });
681
+ }
682
+ return data;
683
+ }
684
+ // TODO: refactor?
685
+ filter(data) {
686
+ if (this.filterConf.filters) {
687
+ if (this.filterConf.andOperator) {
688
+ this.filterConf.filters.forEach((fieldConf) => {
689
+ if (fieldConf.search?.length > 0) {
690
+ data = LocalFilter
691
+ .filter(data, fieldConf.field, fieldConf.search, fieldConf.filter);
692
+ }
693
+ });
694
+ }
695
+ else {
696
+ let mergedData = [];
697
+ this.filterConf.filters.forEach((fieldConf) => {
698
+ if (fieldConf.search?.length > 0) {
699
+ mergedData = mergedData.concat(LocalFilter
700
+ .filter(data, fieldConf.field, fieldConf.search, fieldConf.filter));
701
+ }
702
+ });
703
+ // remove non unique items
704
+ data = mergedData.filter((elem, pos, arr) => {
705
+ return arr.indexOf(elem) === pos;
706
+ });
707
+ }
708
+ }
709
+ return data;
710
+ }
711
+ paginate(data) {
712
+ if (this.pagingConf && this.pagingConf.page && this.pagingConf.perPage) {
713
+ data = LocalPager.paginate(data, this.pagingConf.page, this.pagingConf.perPage);
714
+ }
715
+ return data;
1119
716
  }
1120
717
  }
1121
718
 
1122
- var SmartTableOnChangedEventName;
1123
- (function (SmartTableOnChangedEventName) {
1124
- SmartTableOnChangedEventName["load"] = "load";
1125
- SmartTableOnChangedEventName["paging"] = "paging";
1126
- SmartTableOnChangedEventName["update"] = "update";
1127
- SmartTableOnChangedEventName["page"] = "page";
1128
- SmartTableOnChangedEventName["filter"] = "filter";
1129
- SmartTableOnChangedEventName["empty"] = "empty";
1130
- SmartTableOnChangedEventName["sort"] = "sort";
1131
- SmartTableOnChangedEventName["add"] = "add";
1132
- SmartTableOnChangedEventName["remove"] = "remove";
1133
- SmartTableOnChangedEventName["append"] = "append";
1134
- SmartTableOnChangedEventName["prepend"] = "prepend";
1135
- SmartTableOnChangedEventName["refresh"] = "refresh";
1136
- })(SmartTableOnChangedEventName || (SmartTableOnChangedEventName = {}));
1137
-
1138
- class DataSource {
1139
- constructor() {
1140
- this.onChangedSource = new Subject();
1141
- this.onAddedSource = new Subject();
1142
- this.onUpdatedSource = new Subject();
1143
- this.onRemovedSource = new Subject();
719
+ class DataSet {
720
+ constructor(data = [], columnSettings) {
721
+ this.columnSettings = columnSettings;
722
+ this.data = [];
723
+ this.columns = [];
724
+ this.rows = [];
725
+ this.selectedRows = new Set();
726
+ this.createColumns(columnSettings);
727
+ this.setData(data);
728
+ this.createNewRow();
1144
729
  }
1145
- refresh() {
1146
- this.emitOnChanged(SmartTableOnChangedEventName.refresh);
730
+ setData(data) {
731
+ this.data = data;
732
+ this.createRows();
1147
733
  }
1148
- loadEmit() {
1149
- this.emitOnChanged(SmartTableOnChangedEventName.load);
1150
- return Promise.resolve(true);
734
+ getColumns() {
735
+ return this.columns;
1151
736
  }
1152
- onChanged() {
1153
- return this.onChangedSource.asObservable();
737
+ getRows() {
738
+ return this.rows;
1154
739
  }
1155
- onAdded() {
1156
- return this.onAddedSource.asObservable();
740
+ getFirstRow() {
741
+ return this.rows[0];
1157
742
  }
1158
- onUpdated() {
1159
- return this.onUpdatedSource.asObservable();
743
+ getLastRow() {
744
+ return this.rows[this.rows.length - 1];
1160
745
  }
1161
- onRemoved() {
1162
- return this.onRemovedSource.asObservable();
746
+ findRowByData(data) {
747
+ return this.rows.find((row) => row.getData() === data);
1163
748
  }
1164
- prependEmit(element) {
1165
- this.emitOnAdded(element);
1166
- this.emitOnChanged(SmartTableOnChangedEventName.prepend);
1167
- return Promise.resolve(true);
749
+ setSelectAll(state) {
750
+ this.rows.forEach((row) => {
751
+ row.isSelected = state;
752
+ this.storeSelectedRow(row);
753
+ });
1168
754
  }
1169
- appendEmit(element) {
1170
- this.emitOnAdded(element);
1171
- this.emitOnChanged(SmartTableOnChangedEventName.append);
1172
- return Promise.resolve(true);
755
+ deselectAll() {
756
+ this.rows.forEach((row) => {
757
+ row.isSelected = false;
758
+ });
759
+ // we need to clear selectedRow field because no one row selected
760
+ this.selectedRows.clear();
1173
761
  }
1174
- addEmit(element) {
1175
- this.emitOnAdded(element);
1176
- this.emitOnChanged(SmartTableOnChangedEventName.add);
1177
- return Promise.resolve(true);
762
+ selectRow(row, state) {
763
+ row.isSelected = state;
764
+ this.storeSelectedRow(row);
1178
765
  }
1179
- removeEmit(element) {
1180
- this.emitOnRemoved(element);
1181
- this.emitOnChanged(SmartTableOnChangedEventName.remove);
1182
- return Promise.resolve(true);
766
+ multipleSelectRow(row) {
767
+ row.isSelected = !row.isSelected;
768
+ this.storeSelectedRow(row);
769
+ return row;
1183
770
  }
1184
- updateEmit(element) {
1185
- this.emitOnUpdated(element);
1186
- this.emitOnChanged(SmartTableOnChangedEventName.update);
1187
- return Promise.resolve(true);
771
+ getSelectedRowsData() {
772
+ return [...this.selectedRows];
1188
773
  }
1189
- emptyEmit() {
1190
- this.emitOnChanged(SmartTableOnChangedEventName.empty);
1191
- return Promise.resolve(true);
774
+ createNewRow() {
775
+ this.newRow = new Row(-1, {}, this);
776
+ this.newRow.isInEditing = true;
1192
777
  }
1193
- setSortEmit() {
1194
- this.emitOnChanged(SmartTableOnChangedEventName.sort);
778
+ /**
779
+ * Create columns by mapping from the settings
780
+ * @param settings
781
+ * @private
782
+ */
783
+ createColumns(settings) {
784
+ settings.forEach((columnSettings) => {
785
+ this.columns.push(new Column(columnSettings.key, columnSettings, this));
786
+ });
1195
787
  }
1196
- setFilterEmit() {
1197
- this.emitOnChanged(SmartTableOnChangedEventName.filter);
788
+ /**
789
+ * Create rows based on current data prepared in data source
790
+ * @private
791
+ */
792
+ createRows() {
793
+ this.rows = [];
794
+ this.data.forEach((el, index) => {
795
+ const row = new Row(index, el, this);
796
+ row.isSelected = this.selectedRows.has(row.getData());
797
+ this.rows.push(row);
798
+ });
1198
799
  }
1199
- addFilterEmit() {
1200
- this.emitOnChanged(SmartTableOnChangedEventName.filter);
800
+ get isAllSelected() {
801
+ return this.rows.every((row) => row.isSelected);
802
+ }
803
+ storeSelectedRow(row) {
804
+ if (row.isSelected) {
805
+ this.selectedRows.add(row.getData());
806
+ }
807
+ else {
808
+ this.selectedRows.delete(row.getData());
809
+ }
1201
810
  }
1202
- setPagingEmit() {
1203
- this.emitOnChanged(SmartTableOnChangedEventName.paging);
811
+ }
812
+
813
+ class Grid {
814
+ constructor(source, settings) {
815
+ this.createFormShown = false;
816
+ this.onSelectRowSource = new Subject();
817
+ this.onDeselectRowSource = new Subject();
818
+ this.setSettings(settings);
819
+ this.setSource(source);
1204
820
  }
1205
- setPageEmit() {
1206
- this.emitOnChanged(SmartTableOnChangedEventName.page);
821
+ detach() {
822
+ if (this.sourceOnChangedSubscription) {
823
+ this.sourceOnChangedSubscription.unsubscribe();
824
+ }
825
+ if (this.sourceOnUpdatedSubscription) {
826
+ this.sourceOnUpdatedSubscription.unsubscribe();
827
+ }
1207
828
  }
1208
- emitOnRemoved(element) {
1209
- this.onRemovedSource.next(element);
829
+ showActionColumn(position) {
830
+ return this.isCurrentActionsPosition(position) && this.isActionsVisible();
1210
831
  }
1211
- emitOnUpdated(element) {
1212
- this.onUpdatedSource.next(element);
832
+ isCurrentActionsPosition(position) {
833
+ return position == this.getSetting("actions.position");
1213
834
  }
1214
- emitOnAdded(element) {
1215
- this.onAddedSource.next(element);
835
+ isActionsVisible() {
836
+ return (this.getSetting("actions.add", false) ||
837
+ this.getSetting("actions.edit", false) ||
838
+ this.getSetting("actions.delete", false) ||
839
+ !!this.getSetting("actions.custom", [])?.length);
1216
840
  }
1217
- emitOnChanged(action) {
1218
- this.getElements().then((elements) => this.onChangedSource.next({
1219
- action: action,
1220
- elements: elements,
1221
- paging: this.getPaging(),
1222
- filter: this.getFilter(),
1223
- sort: this.getSort(),
1224
- }));
841
+ isMultiSelectVisible() {
842
+ return this.getSetting("selectMode") === "multi";
1225
843
  }
1226
- }
1227
-
1228
- class LocalDataSource extends DataSource {
1229
- constructor(data = []) {
1230
- super();
1231
- this.data = [];
1232
- this.filteredAndSorted = [];
1233
- this.sortConf = [];
1234
- this.filterConf = {
1235
- filters: [],
1236
- andOperator: true,
1237
- };
1238
- this.pagingConf = false;
1239
- this.data = data;
844
+ getNewRow() {
845
+ return this.dataSet.newRow;
1240
846
  }
1241
- load(data) {
1242
- this.data = data;
1243
- return super.loadEmit();
847
+ setSettings(settings) {
848
+ this.settings = settings;
849
+ this.dataSet = new DataSet([], this.getSetting("columns"));
850
+ if (this.source) {
851
+ this.source.refresh();
852
+ }
1244
853
  }
1245
- prepend(element) {
1246
- this.reset(true);
1247
- this.data.unshift(element);
1248
- return super.prependEmit(element);
854
+ getDataSet() {
855
+ return this.dataSet;
1249
856
  }
1250
- appendMany(elements) {
1251
- this.reset(true);
1252
- this.data = [...this.data, ...elements];
1253
- return super.loadEmit();
857
+ setSource(source) {
858
+ this.source = this.prepareSource(source);
859
+ this.detach();
860
+ this.sourceOnChangedSubscription = this.source
861
+ .onChanged()
862
+ .subscribe((changes) => this.processDataChange(changes));
863
+ this.sourceOnUpdatedSubscription = this.source
864
+ .onUpdated()
865
+ .subscribe((data) => {
866
+ const changedRow = this.dataSet.findRowByData(data);
867
+ if (changedRow) {
868
+ changedRow.setData(data);
869
+ }
870
+ });
1254
871
  }
1255
- append(element) {
1256
- this.reset(true);
1257
- this.data.push(element);
1258
- return super.appendEmit(element);
872
+ getSetting(name, defaultValue) {
873
+ return getDeepFromObject(this.settings, name, defaultValue);
1259
874
  }
1260
- add(element) {
1261
- this.data.push(element);
1262
- return super.addEmit(element);
875
+ getColumns() {
876
+ return this.dataSet.getColumns();
1263
877
  }
1264
- remove(element) {
1265
- this.data = this.data.filter(el => el !== element);
1266
- return super.removeEmit(element);
878
+ getRows() {
879
+ return this.dataSet.getRows();
1267
880
  }
1268
- update(element, values) {
1269
- return new Promise((resolve, reject) => {
1270
- this.find(element).then((found) => {
1271
- found = deepExtend(found, values);
1272
- super.updateEmit(found).then(resolve).catch(reject);
1273
- }).catch(reject);
1274
- });
881
+ selectRow(row, state) {
882
+ this.dataSet.selectRow(row, state);
1275
883
  }
1276
- find(element) {
1277
- const found = this.data.find(el => el === element);
1278
- if (found) {
1279
- return Promise.resolve(found);
1280
- }
1281
- return Promise.reject(new Error('Element was not found in the dataset'));
884
+ multipleSelectRow(row) {
885
+ this.dataSet.multipleSelectRow(row);
1282
886
  }
1283
- getElements() {
1284
- const data = this.data.slice(0);
1285
- return Promise.resolve(this.prepareData(data));
887
+ onSelectRow() {
888
+ return this.onSelectRowSource.asObservable();
1286
889
  }
1287
- getFilteredAndSorted() {
1288
- let data = this.data.slice(0);
1289
- this.prepareData(data);
1290
- return Promise.resolve(this.filteredAndSorted);
890
+ onDeselectRow() {
891
+ return this.onDeselectRowSource.asObservable();
1291
892
  }
1292
- getAll() {
1293
- const data = this.data.slice(0);
1294
- return Promise.resolve(data);
893
+ edit(row) {
894
+ row.isInEditing = true;
1295
895
  }
1296
- reset(silent = false) {
1297
- if (silent) {
1298
- this.filterConf = {
1299
- filters: [],
1300
- andOperator: true,
1301
- };
1302
- this.sortConf = [];
1303
- if (this.pagingConf) {
1304
- this.pagingConf.page = 1;
1305
- }
896
+ create(row, confirmEmitter) {
897
+ row.pending = true;
898
+ const deferred = new Deferred();
899
+ deferred.promise
900
+ .then((newData) => {
901
+ row.pending = false;
902
+ newData = newData ? newData : row.getNewData();
903
+ this.source.prepend(newData).then(() => {
904
+ this.createFormShown = false;
905
+ this.dataSet.createNewRow();
906
+ });
907
+ })
908
+ .catch((err) => {
909
+ row.pending = false;
910
+ });
911
+ if (this.getSetting("add.confirmCreate")) {
912
+ confirmEmitter.emit({
913
+ newData: row.getNewData(),
914
+ source: this.source,
915
+ confirm: deferred,
916
+ });
1306
917
  }
1307
918
  else {
1308
- this.setFilter([], true, false);
1309
- this.setSort([], false);
1310
- if (this.pagingConf) {
1311
- this.setPage(1);
1312
- }
919
+ deferred.resolve(false);
1313
920
  }
1314
921
  }
1315
- empty() {
1316
- this.data = [];
1317
- return super.emptyEmit();
1318
- }
1319
- count() {
1320
- return this.filteredAndSorted.length;
1321
- }
1322
- /**
1323
- *
1324
- * Array of conf objects
1325
- * [
1326
- * {field: string, direction: asc|desc|null, compare: Function|null},
1327
- * ]
1328
- * @param conf
1329
- * @param doEmit
1330
- * @returns {LocalDataSource}
1331
- */
1332
- setSort(conf, doEmit = true) {
1333
- if (conf !== null) {
1334
- conf.forEach((fieldConf) => {
1335
- if (!fieldConf.field || typeof fieldConf.direction === 'undefined') {
1336
- throw new Error('Sort configuration object is not valid');
1337
- }
922
+ save(row, confirmEmitter) {
923
+ row.pending = true;
924
+ const deferred = new Deferred();
925
+ deferred.promise
926
+ .then((newData) => {
927
+ row.pending = false;
928
+ newData = newData ? newData : row.getNewData();
929
+ this.source.update(row.getData(), newData).then(() => {
930
+ row.isInEditing = false;
931
+ });
932
+ })
933
+ .catch((err) => {
934
+ row.pending = false;
935
+ });
936
+ if (this.getSetting("edit.confirmSave")) {
937
+ confirmEmitter.emit({
938
+ data: row.getData(),
939
+ newData: row.getNewData(),
940
+ source: this.source,
941
+ confirm: deferred,
1338
942
  });
1339
- this.sortConf = conf;
1340
943
  }
1341
- if (doEmit) {
1342
- super.setSortEmit();
944
+ else {
945
+ deferred.resolve(false);
1343
946
  }
1344
- return this;
1345
947
  }
1346
- /**
1347
- *
1348
- * Array of conf objects
1349
- * [
1350
- * {field: string, search: string, filter: Function|null},
1351
- * ]
1352
- * @param conf
1353
- * @param andOperator
1354
- * @param doEmit
1355
- * @returns {LocalDataSource}
1356
- */
1357
- setFilter(conf, andOperator = true, doEmit = true) {
1358
- if (conf && conf.length > 0) {
1359
- conf.forEach((fieldConf) => {
1360
- this.addFilter(fieldConf, andOperator, false);
948
+ delete(row, confirmEmitter) {
949
+ row.pending = true;
950
+ const deferred = new Deferred();
951
+ deferred.promise
952
+ .then(() => {
953
+ row.pending = false;
954
+ this.source.remove(row.getData());
955
+ })
956
+ .catch((err) => {
957
+ row.pending = false;
958
+ // doing nothing
959
+ });
960
+ if (this.getSetting("delete.confirmDelete")) {
961
+ confirmEmitter.emit({
962
+ data: row.getData(),
963
+ source: this.source,
964
+ confirm: deferred,
1361
965
  });
1362
966
  }
1363
967
  else {
1364
- this.filterConf = {
1365
- filters: [],
1366
- andOperator: true,
1367
- };
1368
- }
1369
- this.filterConf.andOperator = andOperator;
1370
- if (this.pagingConf) {
1371
- this.pagingConf.page = 1;
968
+ deferred.resolve(false);
1372
969
  }
1373
- if (doEmit) {
1374
- super.setFilterEmit();
970
+ if (row.isSelected) {
971
+ this.dataSet.selectRow(row, false);
1375
972
  }
1376
- return this;
1377
973
  }
1378
- addFilter(fieldConf, andOperator = true, doEmit = true) {
1379
- if (!fieldConf.field || typeof fieldConf.search === 'undefined') {
1380
- throw new Error('Filter configuration object is not valid');
1381
- }
1382
- let found = false;
1383
- this.filterConf.filters.forEach((currentFieldConf, index) => {
1384
- if (currentFieldConf.field === fieldConf.field) {
1385
- this.filterConf.filters[index] = fieldConf;
1386
- found = true;
974
+ processDataChange(changes) {
975
+ if (this.shouldProcessChange(changes)) {
976
+ if (changes["action"] === "load") {
977
+ this.dataSet.deselectAll();
1387
978
  }
1388
- });
1389
- if (!found) {
1390
- this.filterConf.filters.push(fieldConf);
979
+ this.dataSet.setData(changes["elements"]);
1391
980
  }
1392
- this.filterConf.andOperator = andOperator;
1393
- if (doEmit) {
1394
- super.addFilterEmit();
981
+ }
982
+ shouldProcessChange(changes) {
983
+ if (["filter", "sort", "page", "remove", "refresh", "load", "paging"].indexOf(changes["action"]) !== -1) {
984
+ return true;
1395
985
  }
1396
- return this;
986
+ else if (["prepend", "append"].indexOf(changes["action"]) !== -1 &&
987
+ !this.getSetting("pager.display")) {
988
+ return true;
989
+ }
990
+ return false;
1397
991
  }
1398
- setPaging(page = 1, perPage, doEmit = true) {
1399
- if (this.pagingConf) {
1400
- this.pagingConf.page = page;
1401
- this.pagingConf.perPage = perPage;
992
+ prepareSource(source) {
993
+ const initialSort = this.getInitialSort();
994
+ if (initialSort) {
995
+ source.setSort([initialSort], false);
1402
996
  }
1403
- else {
1404
- this.pagingConf = {
1405
- page, perPage
1406
- };
997
+ if (this.getSetting("pager.display") === true) {
998
+ source.setPaging(1, this.getSetting("pager.perPage"), false);
1407
999
  }
1408
- if (doEmit) {
1409
- super.setPagingEmit();
1000
+ source.refresh();
1001
+ return source;
1002
+ }
1003
+ getInitialSort() {
1004
+ const defaultSortColumn = this.getColumns().find((column) => column.isSortable && column.defaultSortDirection);
1005
+ if (!defaultSortColumn) {
1006
+ return false;
1410
1007
  }
1411
- return;
1008
+ return {
1009
+ field: defaultSortColumn.id,
1010
+ direction: defaultSortColumn.defaultSortDirection || "asc",
1011
+ compare: defaultSortColumn.getCompareFunction(),
1012
+ };
1412
1013
  }
1413
- setPage(page, doEmit = true) {
1414
- if (!this.pagingConf) {
1415
- return;
1014
+ getSelectedRowsData() {
1015
+ return this.dataSet.getRows();
1016
+ }
1017
+ selectAllRows(status) {
1018
+ this.dataSet.setSelectAll(status);
1019
+ }
1020
+ getFirstRow() {
1021
+ return this.dataSet.getFirstRow();
1022
+ }
1023
+ getLastRow() {
1024
+ return this.dataSet.getLastRow();
1025
+ }
1026
+ }
1027
+
1028
+ class PagerComponent {
1029
+ constructor() {
1030
+ this.perPageSelect = [];
1031
+ this.changePage = new EventEmitter();
1032
+ this.currentPerPage = 0;
1033
+ this.pages = [];
1034
+ this.page = 1;
1035
+ this.count = 0;
1036
+ this.perPage = 0;
1037
+ }
1038
+ ngOnChanges(changes) {
1039
+ if (changes['source']) {
1040
+ if (!changes['source'].firstChange && this.dataChangedSub) {
1041
+ this.dataChangedSub.unsubscribe();
1042
+ }
1043
+ this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
1044
+ const paging = this.source.getPaging();
1045
+ if (paging) {
1046
+ this.page = paging.page;
1047
+ this.perPage = paging.perPage;
1048
+ }
1049
+ this.currentPerPage = this.perPage;
1050
+ this.count = this.source.count();
1051
+ if (this.isPageOutOfBounce()) {
1052
+ this.source.setPage(--this.page);
1053
+ }
1054
+ this.processPageChange(dataChanges);
1055
+ this.initPages();
1056
+ });
1416
1057
  }
1417
- this.pagingConf.page = page;
1418
- if (doEmit) {
1419
- super.setPageEmit();
1058
+ }
1059
+ /**
1060
+ * We change the page here depending on the action performed against data source
1061
+ * if a new element was added to the end of the table - then change the page to the last
1062
+ * if a new element was added to the beginning of the table - then to the first page
1063
+ * @param changes
1064
+ */
1065
+ processPageChange(changes) {
1066
+ if (changes['action'] === 'prepend') {
1067
+ this.source.setPage(1);
1068
+ }
1069
+ if (changes['action'] === 'append') {
1070
+ this.source.setPage(this.getLast());
1420
1071
  }
1421
- return;
1422
1072
  }
1423
- getSort() {
1424
- return this.sortConf;
1073
+ shouldShow() {
1074
+ return this.source.count() > this.perPage;
1425
1075
  }
1426
- getFilter() {
1427
- return this.filterConf;
1076
+ paginate(page) {
1077
+ this.source.setPage(page);
1078
+ this.page = page;
1079
+ this.changePage.emit({ page });
1080
+ return false;
1428
1081
  }
1429
- getPaging() {
1430
- return this.pagingConf;
1082
+ next() {
1083
+ return this.paginate(this.getPage() + 1);
1431
1084
  }
1432
- prepareData(data) {
1433
- data = this.filter(data);
1434
- data = this.sort(data);
1435
- this.filteredAndSorted = data.slice(0);
1436
- if (this.pagingConf) {
1437
- return this.paginate(data);
1085
+ prev() {
1086
+ return this.paginate(this.getPage() - 1);
1087
+ }
1088
+ getPage() {
1089
+ return this.page;
1090
+ }
1091
+ getPages() {
1092
+ return this.pages;
1093
+ }
1094
+ getLast() {
1095
+ return Math.ceil(this.count / this.perPage);
1096
+ }
1097
+ isPageOutOfBounce() {
1098
+ return (this.page * this.perPage) >= (this.count + this.perPage) && this.page > 1;
1099
+ }
1100
+ initPages() {
1101
+ const pagesCount = this.getLast();
1102
+ let showPagesCount = 4;
1103
+ showPagesCount = pagesCount < showPagesCount ? pagesCount : showPagesCount;
1104
+ this.pages = [];
1105
+ if (this.shouldShow()) {
1106
+ let middleOne = Math.ceil(showPagesCount / 2);
1107
+ middleOne = this.page >= middleOne ? this.page : middleOne;
1108
+ let lastOne = middleOne + Math.floor(showPagesCount / 2);
1109
+ lastOne = lastOne >= pagesCount ? pagesCount : lastOne;
1110
+ const firstOne = lastOne - showPagesCount + 1;
1111
+ for (let i = firstOne; i <= lastOne; i++) {
1112
+ this.pages.push(i);
1113
+ }
1438
1114
  }
1439
- else
1440
- return data;
1441
1115
  }
1442
- sort(data) {
1443
- if (this.sortConf) {
1444
- this.sortConf.forEach((fieldConf) => {
1445
- data = LocalSorter
1446
- .sort(data, fieldConf.field, fieldConf.direction, fieldConf.compare);
1447
- });
1116
+ onChangePerPage() {
1117
+ const paging = this.source.getPaging();
1118
+ if (paging) {
1119
+ paging.perPage = this.currentPerPage * 1;
1448
1120
  }
1449
- return data;
1121
+ this.source.refresh();
1122
+ this.initPages();
1450
1123
  }
1451
- // TODO: refactor?
1452
- filter(data) {
1453
- if (this.filterConf.filters) {
1454
- if (this.filterConf.andOperator) {
1455
- this.filterConf.filters.forEach((fieldConf) => {
1456
- if (fieldConf.search?.length > 0) {
1457
- data = LocalFilter
1458
- .filter(data, fieldConf.field, fieldConf.search, fieldConf.filter);
1459
- }
1460
- });
1461
- }
1462
- else {
1463
- let mergedData = [];
1464
- this.filterConf.filters.forEach((fieldConf) => {
1465
- if (fieldConf.search?.length > 0) {
1466
- mergedData = mergedData.concat(LocalFilter
1467
- .filter(data, fieldConf.field, fieldConf.search, fieldConf.filter));
1468
- }
1469
- });
1470
- // remove non unique items
1471
- data = mergedData.filter((elem, pos, arr) => {
1472
- return arr.indexOf(elem) === pos;
1473
- });
1124
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1125
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: { source: "source", perPageSelect: "perPageSelect" }, outputs: { changePage: "changePage" }, usesOnChanges: true, ngImport: i0, template: `
1126
+ @if (shouldShow()) {
1127
+ <nav class="ng2-smart-pagination-nav">
1128
+ <ul class="ng2-smart-pagination pagination">
1129
+ <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
1130
+ <a class="ng2-smart-page-link page-link" href="#"
1131
+ (click)="getPage() == 1 ? false : paginate(1)" aria-label="First">
1132
+ <span aria-hidden="true">&laquo;</span>
1133
+ <span class="sr-only">First</span>
1134
+ </a>
1135
+ </li>
1136
+ <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
1137
+ <a class="ng2-smart-page-link page-link page-link-prev" href="#"
1138
+ (click)="getPage() == 1 ? false : prev()" aria-label="Prev">
1139
+ <span aria-hidden="true">&lt;</span>
1140
+ <span class="sr-only">Prev</span>
1141
+ </a>
1142
+ </li>
1143
+ @for (page of getPages(); track page) {
1144
+ <li class="ng2-smart-page-item page-item"
1145
+ [ngClass]="{active: getPage() == page}">
1146
+ @if (getPage() == page) {
1147
+ <span class="ng2-smart-page-link page-link"
1148
+ >{{ page }} <span class="sr-only">(current)</span></span>
1149
+ }
1150
+ @if (getPage() != page) {
1151
+ <a class="ng2-smart-page-link page-link" href="#"
1152
+ (click)="paginate(page)">{{ page }}</a>
1153
+ }
1154
+ </li>
1474
1155
  }
1475
- }
1476
- return data;
1477
- }
1478
- paginate(data) {
1479
- if (this.pagingConf && this.pagingConf.page && this.pagingConf.perPage) {
1480
- data = LocalPager.paginate(data, this.pagingConf.page, this.pagingConf.perPage);
1481
- }
1482
- return data;
1483
- }
1484
- }
1485
-
1486
- class FilterDefault {
1487
- constructor() {
1488
- this.inputClass = '';
1489
- this.query = '';
1490
- this.filter = new EventEmitter();
1491
- }
1492
- onFilter(query) {
1493
- this.source.addFilter({
1494
- field: this.column.id,
1495
- search: query,
1496
- filter: this.column.getFilterFunction(),
1497
- });
1498
- }
1499
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1500
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FilterDefault, selector: "ng-component", inputs: { column: "column", source: "source", inputClass: "inputClass", query: "query" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
1156
+ <li class="ng2-smart-page-item page-item"
1157
+ [ngClass]="{disabled: getPage() == getLast()}">
1158
+ <a class="ng2-smart-page-link page-link page-link-next" href="#"
1159
+ (click)="getPage() == getLast() ? false : next()" aria-label="Next">
1160
+ <span aria-hidden="true">&gt;</span>
1161
+ <span class="sr-only">Next</span>
1162
+ </a>
1163
+ </li>
1164
+ <li class="ng2-smart-page-item page-item"
1165
+ [ngClass]="{disabled: getPage() == getLast()}">
1166
+ <a class="ng2-smart-page-link page-link" href="#"
1167
+ (click)="getPage() == getLast() ? false : paginate(getLast())" aria-label="Last">
1168
+ <span aria-hidden="true">&raquo;</span>
1169
+ <span class="sr-only">Last</span>
1170
+ </a>
1171
+ </li>
1172
+ </ul>
1173
+ </nav>
1174
+ }
1175
+
1176
+ @if (perPageSelect && perPageSelect.length > 0) {
1177
+ <nav class="ng2-smart-pagination-per-page">
1178
+ <label for="per-page">
1179
+ Per Page:
1180
+ </label>
1181
+ <select (change)="onChangePerPage()" [(ngModel)]="currentPerPage" id="per-page">
1182
+ @for (item of perPageSelect; track item) {
1183
+ <option [value]="item">{{ item }}</option>
1184
+ }
1185
+ </select>
1186
+ </nav>
1187
+ }
1188
+ `, isInline: true, 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"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1501
1189
  }
1502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterDefault, decorators: [{
1190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerComponent, decorators: [{
1503
1191
  type: Component,
1504
- args: [{
1505
- template: '',
1506
- }]
1507
- }], propDecorators: { column: [{
1508
- type: Input
1509
- }], source: [{
1510
- type: Input
1511
- }], inputClass: [{
1192
+ args: [{ selector: 'ng2-smart-table-pager', template: `
1193
+ @if (shouldShow()) {
1194
+ <nav class="ng2-smart-pagination-nav">
1195
+ <ul class="ng2-smart-pagination pagination">
1196
+ <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
1197
+ <a class="ng2-smart-page-link page-link" href="#"
1198
+ (click)="getPage() == 1 ? false : paginate(1)" aria-label="First">
1199
+ <span aria-hidden="true">&laquo;</span>
1200
+ <span class="sr-only">First</span>
1201
+ </a>
1202
+ </li>
1203
+ <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
1204
+ <a class="ng2-smart-page-link page-link page-link-prev" href="#"
1205
+ (click)="getPage() == 1 ? false : prev()" aria-label="Prev">
1206
+ <span aria-hidden="true">&lt;</span>
1207
+ <span class="sr-only">Prev</span>
1208
+ </a>
1209
+ </li>
1210
+ @for (page of getPages(); track page) {
1211
+ <li class="ng2-smart-page-item page-item"
1212
+ [ngClass]="{active: getPage() == page}">
1213
+ @if (getPage() == page) {
1214
+ <span class="ng2-smart-page-link page-link"
1215
+ >{{ page }} <span class="sr-only">(current)</span></span>
1216
+ }
1217
+ @if (getPage() != page) {
1218
+ <a class="ng2-smart-page-link page-link" href="#"
1219
+ (click)="paginate(page)">{{ page }}</a>
1220
+ }
1221
+ </li>
1222
+ }
1223
+ <li class="ng2-smart-page-item page-item"
1224
+ [ngClass]="{disabled: getPage() == getLast()}">
1225
+ <a class="ng2-smart-page-link page-link page-link-next" href="#"
1226
+ (click)="getPage() == getLast() ? false : next()" aria-label="Next">
1227
+ <span aria-hidden="true">&gt;</span>
1228
+ <span class="sr-only">Next</span>
1229
+ </a>
1230
+ </li>
1231
+ <li class="ng2-smart-page-item page-item"
1232
+ [ngClass]="{disabled: getPage() == getLast()}">
1233
+ <a class="ng2-smart-page-link page-link" href="#"
1234
+ (click)="getPage() == getLast() ? false : paginate(getLast())" aria-label="Last">
1235
+ <span aria-hidden="true">&raquo;</span>
1236
+ <span class="sr-only">Last</span>
1237
+ </a>
1238
+ </li>
1239
+ </ul>
1240
+ </nav>
1241
+ }
1242
+
1243
+ @if (perPageSelect && perPageSelect.length > 0) {
1244
+ <nav class="ng2-smart-pagination-per-page">
1245
+ <label for="per-page">
1246
+ Per Page:
1247
+ </label>
1248
+ <select (change)="onChangePerPage()" [(ngModel)]="currentPerPage" id="per-page">
1249
+ @for (item of perPageSelect; track item) {
1250
+ <option [value]="item">{{ item }}</option>
1251
+ }
1252
+ </select>
1253
+ </nav>
1254
+ }
1255
+ `, 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"] }]
1256
+ }], propDecorators: { source: [{
1512
1257
  type: Input
1513
- }], query: [{
1258
+ }], perPageSelect: [{
1514
1259
  type: Input
1515
- }], filter: [{
1260
+ }], changePage: [{
1516
1261
  type: Output
1517
1262
  }] } });
1518
1263
 
1519
- class DefaultFilter {
1264
+ class EditCellDefault {
1520
1265
  constructor() {
1521
- this.delay = 300;
1522
- this.query = '';
1523
1266
  this.inputClass = '';
1524
- this.filter = new EventEmitter();
1267
+ this.edited = new EventEmitter();
1525
1268
  }
1526
- ngOnDestroy() {
1527
- if (this.changesSubscription) {
1528
- this.changesSubscription.unsubscribe();
1529
- }
1269
+ onEdited(event) {
1270
+ this.edited.next(event);
1271
+ return false;
1530
1272
  }
1531
- setFilter() {
1532
- this.filter.emit(this.query);
1273
+ onStopEditing() {
1274
+ this.cell.getRow().isInEditing = false;
1275
+ return false;
1533
1276
  }
1534
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1535
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DefaultFilter, selector: "ng-component", inputs: { query: "query", inputClass: "inputClass", column: "column" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
1277
+ onClick(event) {
1278
+ event.stopPropagation();
1279
+ }
1280
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1281
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: EditCellDefault, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: '', isInline: true }); }
1536
1282
  }
1537
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilter, decorators: [{
1283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellDefault, decorators: [{
1538
1284
  type: Component,
1539
1285
  args: [{
1540
- template: '',
1286
+ template: ''
1541
1287
  }]
1542
- }], propDecorators: { query: [{
1288
+ }], propDecorators: { cell: [{
1543
1289
  type: Input
1544
1290
  }], inputClass: [{
1545
1291
  type: Input
1546
- }], column: [{
1547
- type: Input
1548
- }], filter: [{
1292
+ }], edited: [{
1549
1293
  type: Output
1550
1294
  }] } });
1551
1295
 
1552
- class CheckboxFilterComponent extends DefaultFilter {
1553
- constructor() {
1554
- super();
1555
- this.filterActive = false;
1556
- this.inputControl = new UntypedFormControl();
1557
- }
1558
- ngOnInit() {
1559
- this.changesSubscription = this.inputControl.valueChanges
1560
- .pipe(debounceTime(this.delay))
1561
- .subscribe((checked) => {
1562
- this.filterActive = true;
1563
- const trueVal = (this.column.getFilterConfig() && this.column.getFilterConfig().true) || true;
1564
- const falseVal = (this.column.getFilterConfig() && this.column.getFilterConfig().false) || false;
1565
- this.query = checked ? trueVal : falseVal;
1566
- this.setFilter();
1567
- });
1568
- }
1569
- resetFilter(event) {
1570
- event.preventDefault();
1571
- this.query = '';
1572
- this.inputControl.setValue(false, { emitEvent: false });
1573
- this.filterActive = false;
1574
- this.setFilter();
1575
- }
1576
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1577
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CheckboxFilterComponent, selector: "checkbox-filter", usesInheritance: true, ngImport: i0, template: `
1578
- <input type="checkbox" [formControl]="inputControl" [ngClass]="inputClass" class="form-control">
1579
- @if (filterActive) {
1580
- <a href="#"
1581
- (click)="resetFilter($event)">{{column.getFilterConfig()?.resetText || 'reset'}}</a>
1582
- }
1583
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
1584
- }
1585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxFilterComponent, decorators: [{
1586
- type: Component,
1587
- args: [{
1588
- selector: 'checkbox-filter',
1589
- template: `
1590
- <input type="checkbox" [formControl]="inputControl" [ngClass]="inputClass" class="form-control">
1591
- @if (filterActive) {
1592
- <a href="#"
1593
- (click)="resetFilter($event)">{{column.getFilterConfig()?.resetText || 'reset'}}</a>
1594
- }
1595
- `,
1596
- }]
1597
- }], ctorParameters: () => [] });
1598
-
1599
- class InputFilterComponent extends DefaultFilter {
1600
- constructor() {
1296
+ class CustomEditComponent extends EditCellDefault {
1297
+ constructor(resolver) {
1601
1298
  super();
1602
- this.inputControl = new UntypedFormControl();
1299
+ this.resolver = resolver;
1603
1300
  }
1604
- ngOnInit() {
1605
- if (this.query) {
1606
- this.inputControl.setValue(this.query);
1301
+ ngOnChanges(changes) {
1302
+ const editor = this.cell.getColumn().editor;
1303
+ if (this.cell && !this.customComponent && editor && editor.type == 'custom') {
1304
+ const componentFactory = this.resolver.resolveComponentFactory(editor.component);
1305
+ this.customComponent = this.dynamicTarget.createComponent(componentFactory);
1306
+ // set @Inputs and @Outputs of custom component
1307
+ this.customComponent.instance.cell = this.cell;
1308
+ this.customComponent.instance.inputClass = this.inputClass;
1309
+ this.customComponent.instance.onStopEditing.subscribe(() => this.onStopEditing());
1310
+ this.customComponent.instance.onEdited.subscribe((event) => this.onEdited(event));
1311
+ this.customComponent.instance.onClick.subscribe((event) => this.onClick(event));
1607
1312
  }
1608
- this.inputControl.valueChanges
1609
- .pipe(distinctUntilChanged(), debounceTime(this.delay))
1610
- .subscribe((value) => {
1611
- this.query = this.inputControl.value;
1612
- this.setFilter();
1613
- });
1614
1313
  }
1615
- ngOnChanges(changes) {
1616
- if (changes?.['query']) {
1617
- this.inputControl.setValue(this.query);
1314
+ ngOnDestroy() {
1315
+ if (this.customComponent) {
1316
+ this.customComponent.destroy();
1618
1317
  }
1619
1318
  }
1620
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1621
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: InputFilterComponent, selector: "input-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
1622
- <input
1623
- [ngClass]="inputClass"
1624
- [formControl]="inputControl"
1625
- class="form-control"
1626
- type="text"
1627
- placeholder="{{ column.title }}"/>
1628
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
1319
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomEditComponent, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component }); }
1320
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CustomEditComponent, selector: "table-cell-custom-editor", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
1321
+ <ng-template #dynamicTarget></ng-template>
1322
+ `, isInline: true }); }
1629
1323
  }
1630
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputFilterComponent, decorators: [{
1324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomEditComponent, decorators: [{
1631
1325
  type: Component,
1632
1326
  args: [{
1633
- selector: 'input-filter',
1327
+ selector: 'table-cell-custom-editor',
1634
1328
  template: `
1635
- <input
1636
- [ngClass]="inputClass"
1637
- [formControl]="inputControl"
1638
- class="form-control"
1639
- type="text"
1640
- placeholder="{{ column.title }}"/>
1329
+ <ng-template #dynamicTarget></ng-template>
1641
1330
  `,
1642
1331
  }]
1332
+ }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }], propDecorators: { dynamicTarget: [{
1333
+ type: ViewChild,
1334
+ args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
1335
+ }] } });
1336
+
1337
+ class CheckboxEditorComponent extends DefaultEditor {
1338
+ constructor() {
1339
+ super();
1340
+ }
1341
+ onChange(event) {
1342
+ const config = this.cell.getColumn().getConfig();
1343
+ const trueVal = (config && config?.true) || true;
1344
+ const falseVal = (config && config?.false) || false;
1345
+ this.cell.newValue = event.target.checked ? trueVal : falseVal;
1346
+ }
1347
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1348
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CheckboxEditorComponent, selector: "checkbox-editor", usesInheritance: true, ngImport: i0, template: `
1349
+ <input [ngClass]="inputClass"
1350
+ type="checkbox"
1351
+ class="form-control"
1352
+ [name]="cell.getId()"
1353
+ [disabled]="!cell.isEditable()"
1354
+ [checked]="cell.getValue() === (cell.getColumn().getConfig()?.true || true)"
1355
+ (click)="onClick.emit($event)"
1356
+ (change)="onChange($event)">
1357
+ `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
1358
+ }
1359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
1360
+ type: Component,
1361
+ args: [{ selector: 'checkbox-editor', template: `
1362
+ <input [ngClass]="inputClass"
1363
+ type="checkbox"
1364
+ class="form-control"
1365
+ [name]="cell.getId()"
1366
+ [disabled]="!cell.isEditable()"
1367
+ [checked]="cell.getValue() === (cell.getColumn().getConfig()?.true || true)"
1368
+ (click)="onClick.emit($event)"
1369
+ (change)="onChange($event)">
1370
+ `, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1643
1371
  }], ctorParameters: () => [] });
1644
1372
 
1645
- class SelectFilterComponent extends DefaultFilter {
1373
+ class InputEditorComponent extends DefaultEditor {
1646
1374
  constructor() {
1647
1375
  super();
1648
1376
  }
1649
- ngOnInit() {
1650
- if (this.inputControl.valueChanges) {
1651
- this.inputControl.valueChanges
1652
- .pipe(skip(1), distinctUntilChanged(), debounceTime(this.delay))
1653
- .subscribe((value) => this.setFilter());
1654
- }
1377
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1378
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: InputEditorComponent, selector: "input-editor", usesInheritance: true, ngImport: i0, template: `
1379
+ <input [ngClass]="inputClass"
1380
+ class="form-control"
1381
+ [(ngModel)]="cell.newValue"
1382
+ [name]="cell.getId()"
1383
+ [placeholder]="cell.getTitle()"
1384
+ [disabled]="!cell.isEditable()"
1385
+ (click)="onClick.emit($event)"
1386
+ (keydown.enter)="onEdited.emit($event)"
1387
+ (keydown.esc)="onStopEditing.emit()">
1388
+ `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1389
+ }
1390
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputEditorComponent, decorators: [{
1391
+ type: Component,
1392
+ args: [{ selector: 'input-editor', template: `
1393
+ <input [ngClass]="inputClass"
1394
+ class="form-control"
1395
+ [(ngModel)]="cell.newValue"
1396
+ [name]="cell.getId()"
1397
+ [placeholder]="cell.getTitle()"
1398
+ [disabled]="!cell.isEditable()"
1399
+ (click)="onClick.emit($event)"
1400
+ (keydown.enter)="onEdited.emit($event)"
1401
+ (keydown.esc)="onStopEditing.emit()">
1402
+ `, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1403
+ }], ctorParameters: () => [] });
1404
+
1405
+ class SelectEditorComponent extends DefaultEditor {
1406
+ constructor() {
1407
+ super();
1655
1408
  }
1656
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1657
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: SelectFilterComponent, selector: "select-filter", viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true, read: NgControl, static: true }], usesInheritance: true, ngImport: i0, template: `
1409
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1410
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: SelectEditorComponent, selector: "select-editor", usesInheritance: true, ngImport: i0, template: `
1658
1411
  <select [ngClass]="inputClass"
1659
1412
  class="form-control"
1660
- #inputControl
1661
- [(ngModel)]="query">
1413
+ [(ngModel)]="cell.newValue"
1414
+ [name]="cell.getId()"
1415
+ [disabled]="!cell.isEditable()"
1416
+ (click)="onClick.emit($event)"
1417
+ (keydown.enter)="onEdited.emit($event)"
1418
+ (keydown.esc)="onStopEditing.emit()">
1662
1419
 
1663
- <option value="">{{ column.getFilterConfig().selectText }}</option>
1664
- @for (option of column.getFilterConfig().list; track option) {
1665
- <option [value]="option.value">
1666
- {{ option.title }}
1420
+ @for (option of cell.getColumn().getConfig()?.list; track option) {
1421
+ <option [value]="option.value"
1422
+ [selected]="option.value === cell.getValue()">{{ option.title }}
1667
1423
  </option>
1668
1424
  }
1669
1425
  </select>
1670
1426
  `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1671
1427
  }
1672
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFilterComponent, decorators: [{
1428
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectEditorComponent, decorators: [{
1673
1429
  type: Component,
1674
1430
  args: [{
1675
- selector: 'select-filter',
1431
+ selector: 'select-editor',
1676
1432
  template: `
1677
1433
  <select [ngClass]="inputClass"
1678
1434
  class="form-control"
1679
- #inputControl
1680
- [(ngModel)]="query">
1435
+ [(ngModel)]="cell.newValue"
1436
+ [name]="cell.getId()"
1437
+ [disabled]="!cell.isEditable()"
1438
+ (click)="onClick.emit($event)"
1439
+ (keydown.enter)="onEdited.emit($event)"
1440
+ (keydown.esc)="onStopEditing.emit()">
1681
1441
 
1682
- <option value="">{{ column.getFilterConfig().selectText }}</option>
1683
- @for (option of column.getFilterConfig().list; track option) {
1684
- <option [value]="option.value">
1685
- {{ option.title }}
1442
+ @for (option of cell.getColumn().getConfig()?.list; track option) {
1443
+ <option [value]="option.value"
1444
+ [selected]="option.value === cell.getValue()">{{ option.title }}
1686
1445
  </option>
1687
1446
  }
1688
1447
  </select>
1689
1448
  `,
1690
1449
  }]
1691
- }], ctorParameters: () => [], propDecorators: { inputControl: [{
1692
- type: ViewChild,
1693
- args: ['inputControl', { read: NgControl, static: true }]
1694
- }] } });
1450
+ }], ctorParameters: () => [] });
1695
1451
 
1696
- class DefaultFilterComponent extends FilterDefault {
1697
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1698
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: DefaultFilterComponent, selector: "default-table-filter", usesInheritance: true, ngImport: i0, template: `
1699
- @switch (column.getFilterType()) {
1700
- @case ('list') {
1701
- <select-filter
1702
- [query]="query"
1703
- [ngClass]="inputClass"
1704
- [column]="column"
1705
- (filter)="onFilter($event)">
1706
- </select-filter>
1707
- }
1708
- @case ('checkbox') {
1709
- <checkbox-filter
1710
- [query]="query"
1711
- [ngClass]="inputClass"
1712
- [column]="column"
1713
- (filter)="onFilter($event)">
1714
- </checkbox-filter>
1715
- }
1716
- @default {
1717
- <input-filter
1718
- [query]="query"
1719
- [ngClass]="inputClass"
1720
- [column]="column"
1721
- (filter)="onFilter($event)">
1722
- </input-filter>
1723
- }
1724
- }
1725
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: CheckboxFilterComponent, selector: "checkbox-filter" }, { kind: "component", type: InputFilterComponent, selector: "input-filter" }, { kind: "component", type: SelectFilterComponent, selector: "select-filter" }] }); }
1452
+ class TextareaEditorComponent extends DefaultEditor {
1453
+ constructor() {
1454
+ super();
1455
+ }
1456
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1457
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: TextareaEditorComponent, selector: "textarea-editor", usesInheritance: true, ngImport: i0, template: `
1458
+ <textarea [ngClass]="inputClass"
1459
+ class="form-control"
1460
+ [(ngModel)]="cell.newValue"
1461
+ [name]="cell.getId()"
1462
+ [disabled]="!cell.isEditable()"
1463
+ [placeholder]="cell.getTitle()"
1464
+ (click)="onClick.emit($event)"
1465
+ (keydown.enter)="onEdited.emit($event)"
1466
+ (keydown.esc)="onStopEditing.emit()">
1467
+ </textarea>
1468
+ `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1726
1469
  }
1727
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilterComponent, decorators: [{
1470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaEditorComponent, decorators: [{
1728
1471
  type: Component,
1729
- args: [{
1730
- selector: 'default-table-filter',
1731
- template: `
1732
- @switch (column.getFilterType()) {
1733
- @case ('list') {
1734
- <select-filter
1735
- [query]="query"
1736
- [ngClass]="inputClass"
1737
- [column]="column"
1738
- (filter)="onFilter($event)">
1739
- </select-filter>
1740
- }
1741
- @case ('checkbox') {
1742
- <checkbox-filter
1743
- [query]="query"
1744
- [ngClass]="inputClass"
1745
- [column]="column"
1746
- (filter)="onFilter($event)">
1747
- </checkbox-filter>
1748
- }
1749
- @default {
1750
- <input-filter
1751
- [query]="query"
1752
- [ngClass]="inputClass"
1753
- [column]="column"
1754
- (filter)="onFilter($event)">
1755
- </input-filter>
1756
- }
1472
+ args: [{ selector: 'textarea-editor', template: `
1473
+ <textarea [ngClass]="inputClass"
1474
+ class="form-control"
1475
+ [(ngModel)]="cell.newValue"
1476
+ [name]="cell.getId()"
1477
+ [disabled]="!cell.isEditable()"
1478
+ [placeholder]="cell.getTitle()"
1479
+ (click)="onClick.emit($event)"
1480
+ (keydown.enter)="onEdited.emit($event)"
1481
+ (keydown.esc)="onStopEditing.emit()">
1482
+ </textarea>
1483
+ `, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1484
+ }], ctorParameters: () => [] });
1485
+
1486
+ class DefaultEditComponent extends EditCellDefault {
1487
+ constructor() {
1488
+ super();
1489
+ }
1490
+ getEditorType() {
1491
+ const editor = this.cell.getColumn().editor;
1492
+ if (editor) {
1493
+ return editor.type;
1494
+ }
1495
+ return 'text';
1496
+ }
1497
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1498
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: DefaultEditComponent, selector: "table-cell-default-editor", usesInheritance: true, ngImport: i0, template: "<div>\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n }\n}\n</div>", dependencies: [{ kind: "component", type: CheckboxEditorComponent, selector: "checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "input-editor" }, { kind: "component", type: SelectEditorComponent, selector: "select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "textarea-editor" }] }); }
1757
1499
  }
1758
- `,
1759
- }]
1760
- }] });
1500
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultEditComponent, decorators: [{
1501
+ type: Component,
1502
+ args: [{ selector: 'table-cell-default-editor', template: "<div>\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n }\n}\n</div>" }]
1503
+ }], ctorParameters: () => [] });
1761
1504
 
1762
- class CustomFilterComponent extends FilterDefault {
1763
- constructor(resolver) {
1764
- super();
1765
- this.resolver = resolver;
1505
+ class EditCellComponent {
1506
+ constructor() {
1507
+ this.inputClass = '';
1508
+ this.edited = new EventEmitter();
1766
1509
  }
1767
- ngOnChanges(changes) {
1768
- if (this.customComponent) {
1769
- this.customComponent.instance.ngOnChanges(changes);
1770
- return;
1771
- }
1772
- if (this.column.filter && this.column.filter.type === 'custom') {
1773
- const componentFactory = this.resolver.resolveComponentFactory(this.column.filter?.component);
1774
- this.customComponent = this.dynamicTarget.createComponent(componentFactory);
1775
- }
1776
- // set @Inputs and @Outputs of custom component
1777
- this.customComponent.instance.query = this.query;
1778
- this.customComponent.instance.column = this.column;
1779
- this.customComponent.instance.source = this.source;
1780
- this.customComponent.instance.inputClass = this.inputClass;
1781
- this.customComponent.instance.filter.subscribe((event) => this.onFilter(event));
1510
+ onEdited(event) {
1511
+ this.edited.next(event);
1512
+ return false;
1782
1513
  }
1783
- ngOnDestroy() {
1784
- if (this.customComponent) {
1785
- this.customComponent.destroy();
1514
+ getEditorType() {
1515
+ const editor = this.cell.getColumn().editor;
1516
+ if (editor) {
1517
+ return editor.type;
1786
1518
  }
1519
+ return 'text';
1787
1520
  }
1788
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomFilterComponent, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component }); }
1789
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CustomFilterComponent, selector: "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 }); }
1521
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1522
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: `
1523
+ <div>
1524
+ @switch (getEditorType()) {
1525
+ @case ('custom') {
1526
+ <table-cell-custom-editor
1527
+ [cell]="cell"
1528
+ [inputClass]="inputClass"
1529
+ (edited)="onEdited($event)">
1530
+ </table-cell-custom-editor>
1531
+ }
1532
+ @default {
1533
+ <table-cell-default-editor
1534
+ [cell]="cell"
1535
+ [inputClass]="inputClass"
1536
+ (edited)="onEdited($event)">
1537
+ </table-cell-default-editor>
1538
+ }
1539
+ }
1540
+ </div>
1541
+ `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "table-cell-custom-editor" }, { kind: "component", type: DefaultEditComponent, selector: "table-cell-default-editor" }] }); }
1790
1542
  }
1791
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomFilterComponent, decorators: [{
1543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: EditCellComponent, decorators: [{
1792
1544
  type: Component,
1793
1545
  args: [{
1794
- selector: 'custom-table-filter',
1795
- template: `<ng-template #dynamicTarget></ng-template>`,
1546
+ selector: 'table-cell-edit-mode',
1547
+ template: `
1548
+ <div>
1549
+ @switch (getEditorType()) {
1550
+ @case ('custom') {
1551
+ <table-cell-custom-editor
1552
+ [cell]="cell"
1553
+ [inputClass]="inputClass"
1554
+ (edited)="onEdited($event)">
1555
+ </table-cell-custom-editor>
1556
+ }
1557
+ @default {
1558
+ <table-cell-default-editor
1559
+ [cell]="cell"
1560
+ [inputClass]="inputClass"
1561
+ (edited)="onEdited($event)">
1562
+ </table-cell-default-editor>
1563
+ }
1564
+ }
1565
+ </div>
1566
+ `,
1796
1567
  }]
1797
- }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }], propDecorators: { dynamicTarget: [{
1798
- type: ViewChild,
1799
- args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
1568
+ }], propDecorators: { cell: [{
1569
+ type: Input
1570
+ }], inputClass: [{
1571
+ type: Input
1572
+ }], edited: [{
1573
+ type: Output
1800
1574
  }] } });
1801
1575
 
1802
- class FilterComponent extends FilterDefault {
1803
- ngOnChanges(changes) {
1804
- if (changes['source']) {
1805
- if (!changes['source'].firstChange && this.dataChangedSub) {
1806
- this.dataChangedSub.unsubscribe();
1807
- }
1808
- this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
1809
- const filterConf = this.source.getFilter();
1810
- if (filterConf && filterConf.filters && filterConf.filters.length === 0) {
1811
- this.query = '';
1812
- // add a check for existing filters an set the query if one exists for this column
1813
- // this covers instances where the filter is set by user code while maintaining existing functionality
1814
- }
1815
- else if (filterConf && filterConf.filters && filterConf.filters.length > 0) {
1816
- filterConf.filters.forEach((k, v) => {
1817
- if (k.field == this.column.id) {
1818
- this.query = k.search;
1819
- }
1820
- });
1821
- }
1822
- });
1823
- }
1824
- }
1825
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1826
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: FilterComponent, selector: "ng2-smart-table-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
1827
- @if (column.isFilterable) {
1828
- <div class="ng2-smart-filter">
1829
- @switch (column.getFilterType()) {
1830
- @case ('custom') {
1831
- <custom-table-filter
1832
- [query]="query"
1833
- [column]="column"
1834
- [source]="source"
1835
- [inputClass]="inputClass"
1836
- (filter)="onFilter($event)">
1837
- </custom-table-filter>
1838
- }
1839
- @default {
1840
- <default-table-filter
1841
- [query]="query"
1842
- [column]="column"
1843
- [source]="source"
1844
- [inputClass]="inputClass"
1845
- (filter)="onFilter($event)">
1846
- </default-table-filter>
1847
- }
1848
- }
1849
- </div>
1850
- }
1851
- `, 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: DefaultFilterComponent, selector: "default-table-filter" }, { kind: "component", type: CustomFilterComponent, selector: "custom-table-filter" }] }); }
1576
+ class CustomViewComponent {
1577
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1578
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CustomViewComponent, selector: "custom-view-component", inputs: { cell: "cell" }, ngImport: i0, template: "<ng-template\n *ngComponentOutlet=\"\n cell.getColumn().renderComponent;\n inputs: { rowData: cell.getRow().getData(), value: cell.getValue() }\n \"\n></ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
1852
1579
  }
1853
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterComponent, decorators: [{
1580
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomViewComponent, decorators: [{
1854
1581
  type: Component,
1855
- args: [{ selector: 'ng2-smart-table-filter', template: `
1856
- @if (column.isFilterable) {
1857
- <div class="ng2-smart-filter">
1858
- @switch (column.getFilterType()) {
1859
- @case ('custom') {
1860
- <custom-table-filter
1861
- [query]="query"
1862
- [column]="column"
1863
- [source]="source"
1864
- [inputClass]="inputClass"
1865
- (filter)="onFilter($event)">
1866
- </custom-table-filter>
1867
- }
1868
- @default {
1869
- <default-table-filter
1870
- [query]="query"
1871
- [column]="column"
1872
- [source]="source"
1873
- [inputClass]="inputClass"
1874
- (filter)="onFilter($event)">
1875
- </default-table-filter>
1876
- }
1877
- }
1878
- </div>
1879
- }
1880
- `, 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"] }]
1881
- }] });
1582
+ args: [{ selector: "custom-view-component", template: "<ng-template\n *ngComponentOutlet=\"\n cell.getColumn().renderComponent;\n inputs: { rowData: cell.getRow().getData(), value: cell.getValue() }\n \"\n></ng-template>\n" }]
1583
+ }], propDecorators: { cell: [{
1584
+ type: Input
1585
+ }] } });
1882
1586
 
1883
- const FILTER_COMPONENTS = [
1884
- FilterDefault,
1885
- DefaultFilter,
1886
- FilterComponent,
1887
- DefaultFilterComponent,
1888
- CustomFilterComponent,
1889
- CheckboxFilterComponent,
1890
- InputFilterComponent,
1891
- SelectFilterComponent,
1892
- ];
1893
- class FilterModule {
1894
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1895
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, declarations: [FilterDefault,
1896
- DefaultFilter,
1897
- FilterComponent,
1898
- DefaultFilterComponent,
1899
- CustomFilterComponent,
1900
- CheckboxFilterComponent,
1901
- InputFilterComponent,
1902
- SelectFilterComponent], imports: [CommonModule,
1903
- FormsModule,
1904
- ReactiveFormsModule], exports: [FilterDefault,
1905
- DefaultFilter,
1906
- FilterComponent,
1907
- DefaultFilterComponent,
1908
- CustomFilterComponent,
1909
- CheckboxFilterComponent,
1910
- InputFilterComponent,
1911
- SelectFilterComponent] }); }
1912
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, imports: [CommonModule,
1913
- FormsModule,
1914
- ReactiveFormsModule] }); }
1587
+ class ViewCellComponent {
1588
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ViewCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1589
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: { cell: "cell" }, ngImport: i0, template: `
1590
+ <div>
1591
+ @switch (cell.getColumn().type) {
1592
+ @case ('custom') {
1593
+ <custom-view-component [cell]="cell"></custom-view-component>
1594
+ }
1595
+ @case ('html') {
1596
+ <div [innerHTML]="cell.getValue()"></div>
1597
+ }
1598
+ @default {
1599
+ <div>{{ cell.getValue() }}</div>
1600
+ }
1601
+ }
1602
+ </div>
1603
+ `, isInline: true, dependencies: [{ kind: "component", type: CustomViewComponent, selector: "custom-view-component", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1915
1604
  }
1916
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, decorators: [{
1917
- type: NgModule,
1605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ViewCellComponent, decorators: [{
1606
+ type: Component,
1918
1607
  args: [{
1919
- imports: [
1920
- CommonModule,
1921
- FormsModule,
1922
- ReactiveFormsModule,
1923
- ],
1924
- declarations: [
1925
- ...FILTER_COMPONENTS,
1926
- ],
1927
- exports: [
1928
- ...FILTER_COMPONENTS,
1929
- ],
1608
+ selector: 'table-cell-view-mode',
1609
+ changeDetection: ChangeDetectionStrategy.OnPush,
1610
+ template: `
1611
+ <div>
1612
+ @switch (cell.getColumn().type) {
1613
+ @case ('custom') {
1614
+ <custom-view-component [cell]="cell"></custom-view-component>
1615
+ }
1616
+ @case ('html') {
1617
+ <div [innerHTML]="cell.getValue()"></div>
1618
+ }
1619
+ @default {
1620
+ <div>{{ cell.getValue() }}</div>
1621
+ }
1622
+ }
1623
+ </div>
1624
+ `,
1930
1625
  }]
1931
- }] });
1626
+ }], propDecorators: { cell: [{
1627
+ type: Input
1628
+ }] } });
1932
1629
 
1933
- class PagerComponent {
1630
+ class CellComponent {
1934
1631
  constructor() {
1935
- this.perPageSelect = [];
1936
- this.changePage = new EventEmitter();
1937
- this.currentPerPage = 0;
1938
- this.pages = [];
1939
- this.page = 1;
1940
- this.count = 0;
1941
- this.perPage = 0;
1942
- }
1943
- ngOnChanges(changes) {
1944
- if (changes['source']) {
1945
- if (!changes['source'].firstChange && this.dataChangedSub) {
1946
- this.dataChangedSub.unsubscribe();
1947
- }
1948
- this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
1949
- const paging = this.source.getPaging();
1950
- if (paging) {
1951
- this.page = paging.page;
1952
- this.perPage = paging.perPage;
1953
- }
1954
- this.currentPerPage = this.perPage;
1955
- this.count = this.source.count();
1956
- if (this.isPageOutOfBounce()) {
1957
- this.source.setPage(--this.page);
1958
- }
1959
- this.processPageChange(dataChanges);
1960
- this.initPages();
1961
- });
1962
- }
1632
+ this.inputClass = '';
1633
+ this.mode = 'inline';
1634
+ this.isInEditing = false;
1635
+ this.edited = new EventEmitter();
1963
1636
  }
1964
- /**
1965
- * We change the page here depending on the action performed against data source
1966
- * if a new element was added to the end of the table - then change the page to the last
1967
- * if a new element was added to the beginning of the table - then to the first page
1968
- * @param changes
1969
- */
1970
- processPageChange(changes) {
1971
- if (changes['action'] === 'prepend') {
1972
- this.source.setPage(1);
1637
+ onEdited(event) {
1638
+ if (this.isNew) {
1639
+ this.grid.create(this.grid.getNewRow(), this.createConfirm);
1973
1640
  }
1974
- if (changes['action'] === 'append') {
1975
- this.source.setPage(this.getLast());
1641
+ else {
1642
+ this.grid.save(this.row, this.editConfirm);
1976
1643
  }
1977
1644
  }
1978
- shouldShow() {
1979
- return this.source.count() > this.perPage;
1980
- }
1981
- paginate(page) {
1982
- this.source.setPage(page);
1983
- this.page = page;
1984
- this.changePage.emit({ page });
1985
- return false;
1986
- }
1987
- next() {
1988
- return this.paginate(this.getPage() + 1);
1989
- }
1990
- prev() {
1991
- return this.paginate(this.getPage() - 1);
1992
- }
1993
- getPage() {
1994
- return this.page;
1995
- }
1996
- getPages() {
1997
- return this.pages;
1998
- }
1999
- getLast() {
2000
- return Math.ceil(this.count / this.perPage);
2001
- }
2002
- isPageOutOfBounce() {
2003
- return (this.page * this.perPage) >= (this.count + this.perPage) && this.page > 1;
2004
- }
2005
- initPages() {
2006
- const pagesCount = this.getLast();
2007
- let showPagesCount = 4;
2008
- showPagesCount = pagesCount < showPagesCount ? pagesCount : showPagesCount;
2009
- this.pages = [];
2010
- if (this.shouldShow()) {
2011
- let middleOne = Math.ceil(showPagesCount / 2);
2012
- middleOne = this.page >= middleOne ? this.page : middleOne;
2013
- let lastOne = middleOne + Math.floor(showPagesCount / 2);
2014
- lastOne = lastOne >= pagesCount ? pagesCount : lastOne;
2015
- const firstOne = lastOne - showPagesCount + 1;
2016
- for (let i = firstOne; i <= lastOne; i++) {
2017
- this.pages.push(i);
2018
- }
2019
- }
1645
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1646
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CellComponent, selector: "ng2-smart-table-cell", inputs: { grid: "grid", row: "row", editConfirm: "editConfirm", createConfirm: "createConfirm", isNew: "isNew", cell: "cell", inputClass: "inputClass", mode: "mode", isInEditing: "isInEditing" }, outputs: { edited: "edited" }, ngImport: i0, template: `
1647
+ @if (!isInEditing) {
1648
+ <table-cell-view-mode [cell]="cell"></table-cell-view-mode>
2020
1649
  }
2021
- onChangePerPage() {
2022
- const paging = this.source.getPaging();
2023
- if (paging) {
2024
- paging.perPage = this.currentPerPage * 1;
2025
- }
2026
- this.source.refresh();
2027
- this.initPages();
1650
+ @if (isInEditing) {
1651
+ <table-cell-edit-mode [cell]="cell"
1652
+ [inputClass]="inputClass"
1653
+ (edited)="onEdited($event)">
1654
+ </table-cell-edit-mode>
2028
1655
  }
2029
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2030
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: { source: "source", perPageSelect: "perPageSelect" }, outputs: { changePage: "changePage" }, usesOnChanges: true, ngImport: i0, template: `
2031
- @if (shouldShow()) {
2032
- <nav class="ng2-smart-pagination-nav">
2033
- <ul class="ng2-smart-pagination pagination">
2034
- <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
2035
- <a class="ng2-smart-page-link page-link" href="#"
2036
- (click)="getPage() == 1 ? false : paginate(1)" aria-label="First">
2037
- <span aria-hidden="true">&laquo;</span>
2038
- <span class="sr-only">First</span>
2039
- </a>
2040
- </li>
2041
- <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
2042
- <a class="ng2-smart-page-link page-link page-link-prev" href="#"
2043
- (click)="getPage() == 1 ? false : prev()" aria-label="Prev">
2044
- <span aria-hidden="true">&lt;</span>
2045
- <span class="sr-only">Prev</span>
2046
- </a>
2047
- </li>
2048
- @for (page of getPages(); track page) {
2049
- <li class="ng2-smart-page-item page-item"
2050
- [ngClass]="{active: getPage() == page}">
2051
- @if (getPage() == page) {
2052
- <span class="ng2-smart-page-link page-link"
2053
- >{{ page }} <span class="sr-only">(current)</span></span>
2054
- }
2055
- @if (getPage() != page) {
2056
- <a class="ng2-smart-page-link page-link" href="#"
2057
- (click)="paginate(page)">{{ page }}</a>
2058
- }
2059
- </li>
2060
- }
2061
- <li class="ng2-smart-page-item page-item"
2062
- [ngClass]="{disabled: getPage() == getLast()}">
2063
- <a class="ng2-smart-page-link page-link page-link-next" href="#"
2064
- (click)="getPage() == getLast() ? false : next()" aria-label="Next">
2065
- <span aria-hidden="true">&gt;</span>
2066
- <span class="sr-only">Next</span>
2067
- </a>
2068
- </li>
2069
- <li class="ng2-smart-page-item page-item"
2070
- [ngClass]="{disabled: getPage() == getLast()}">
2071
- <a class="ng2-smart-page-link page-link" href="#"
2072
- (click)="getPage() == getLast() ? false : paginate(getLast())" aria-label="Last">
2073
- <span aria-hidden="true">&raquo;</span>
2074
- <span class="sr-only">Last</span>
2075
- </a>
2076
- </li>
2077
- </ul>
2078
- </nav>
2079
- }
2080
-
2081
- @if (perPageSelect && perPageSelect.length > 0) {
2082
- <nav class="ng2-smart-pagination-per-page">
2083
- <label for="per-page">
2084
- Per Page:
2085
- </label>
2086
- <select (change)="onChangePerPage()" [(ngModel)]="currentPerPage" id="per-page">
2087
- @for (item of perPageSelect; track item) {
2088
- <option [value]="item">{{ item }}</option>
2089
- }
2090
- </select>
2091
- </nav>
2092
- }
2093
- `, isInline: true, 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"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1656
+ `, isInline: true, dependencies: [{ kind: "component", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: ["cell", "inputClass"], outputs: ["edited"] }, { kind: "component", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: ["cell"] }] }); }
2094
1657
  }
2095
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerComponent, decorators: [{
1658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellComponent, decorators: [{
2096
1659
  type: Component,
2097
- args: [{ selector: 'ng2-smart-table-pager', template: `
2098
- @if (shouldShow()) {
2099
- <nav class="ng2-smart-pagination-nav">
2100
- <ul class="ng2-smart-pagination pagination">
2101
- <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
2102
- <a class="ng2-smart-page-link page-link" href="#"
2103
- (click)="getPage() == 1 ? false : paginate(1)" aria-label="First">
2104
- <span aria-hidden="true">&laquo;</span>
2105
- <span class="sr-only">First</span>
2106
- </a>
2107
- </li>
2108
- <li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
2109
- <a class="ng2-smart-page-link page-link page-link-prev" href="#"
2110
- (click)="getPage() == 1 ? false : prev()" aria-label="Prev">
2111
- <span aria-hidden="true">&lt;</span>
2112
- <span class="sr-only">Prev</span>
2113
- </a>
2114
- </li>
2115
- @for (page of getPages(); track page) {
2116
- <li class="ng2-smart-page-item page-item"
2117
- [ngClass]="{active: getPage() == page}">
2118
- @if (getPage() == page) {
2119
- <span class="ng2-smart-page-link page-link"
2120
- >{{ page }} <span class="sr-only">(current)</span></span>
2121
- }
2122
- @if (getPage() != page) {
2123
- <a class="ng2-smart-page-link page-link" href="#"
2124
- (click)="paginate(page)">{{ page }}</a>
2125
- }
2126
- </li>
2127
- }
2128
- <li class="ng2-smart-page-item page-item"
2129
- [ngClass]="{disabled: getPage() == getLast()}">
2130
- <a class="ng2-smart-page-link page-link page-link-next" href="#"
2131
- (click)="getPage() == getLast() ? false : next()" aria-label="Next">
2132
- <span aria-hidden="true">&gt;</span>
2133
- <span class="sr-only">Next</span>
2134
- </a>
2135
- </li>
2136
- <li class="ng2-smart-page-item page-item"
2137
- [ngClass]="{disabled: getPage() == getLast()}">
2138
- <a class="ng2-smart-page-link page-link" href="#"
2139
- (click)="getPage() == getLast() ? false : paginate(getLast())" aria-label="Last">
2140
- <span aria-hidden="true">&raquo;</span>
2141
- <span class="sr-only">Last</span>
2142
- </a>
2143
- </li>
2144
- </ul>
2145
- </nav>
2146
- }
2147
-
2148
- @if (perPageSelect && perPageSelect.length > 0) {
2149
- <nav class="ng2-smart-pagination-per-page">
2150
- <label for="per-page">
2151
- Per Page:
2152
- </label>
2153
- <select (change)="onChangePerPage()" [(ngModel)]="currentPerPage" id="per-page">
2154
- @for (item of perPageSelect; track item) {
2155
- <option [value]="item">{{ item }}</option>
2156
- }
2157
- </select>
2158
- </nav>
2159
- }
2160
- `, 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"] }]
2161
- }], propDecorators: { source: [{
1660
+ args: [{
1661
+ selector: 'ng2-smart-table-cell',
1662
+ template: `
1663
+ @if (!isInEditing) {
1664
+ <table-cell-view-mode [cell]="cell"></table-cell-view-mode>
1665
+ }
1666
+ @if (isInEditing) {
1667
+ <table-cell-edit-mode [cell]="cell"
1668
+ [inputClass]="inputClass"
1669
+ (edited)="onEdited($event)">
1670
+ </table-cell-edit-mode>
1671
+ }
1672
+ `,
1673
+ }]
1674
+ }], propDecorators: { grid: [{
2162
1675
  type: Input
2163
- }], perPageSelect: [{
1676
+ }], row: [{
2164
1677
  type: Input
2165
- }], changePage: [{
1678
+ }], editConfirm: [{
1679
+ type: Input
1680
+ }], createConfirm: [{
1681
+ type: Input
1682
+ }], isNew: [{
1683
+ type: Input
1684
+ }], cell: [{
1685
+ type: Input
1686
+ }], inputClass: [{
1687
+ type: Input
1688
+ }], mode: [{
1689
+ type: Input
1690
+ }], isInEditing: [{
1691
+ type: Input
1692
+ }], edited: [{
2166
1693
  type: Output
2167
1694
  }] } });
2168
1695
 
2169
- class PagerModule {
2170
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2171
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, declarations: [PagerComponent], imports: [CommonModule,
2172
- FormsModule], exports: [PagerComponent] }); }
2173
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, imports: [CommonModule,
2174
- FormsModule] }); }
2175
- }
2176
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, decorators: [{
2177
- type: NgModule,
2178
- args: [{
2179
- imports: [
2180
- CommonModule,
2181
- FormsModule,
2182
- ],
2183
- declarations: [
2184
- PagerComponent,
2185
- ],
2186
- exports: [
2187
- PagerComponent,
2188
- ],
2189
- }]
2190
- }] });
2191
-
2192
1696
  class TbodyCreateCancelComponent {
2193
1697
  constructor() {
2194
1698
  this.cancelButtonContent = "";
@@ -2616,181 +2120,507 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
2616
2120
  type: Output
2617
2121
  }] } });
2618
2122
 
2619
- class TbodyCustomComponent {
2123
+ class TbodyCustomComponent {
2124
+ constructor() {
2125
+ this.custom = new EventEmitter();
2126
+ }
2127
+ onCustom(action) {
2128
+ this.custom.emit({
2129
+ action: action.name,
2130
+ data: this.row.getData(),
2131
+ source: this.source,
2132
+ });
2133
+ }
2134
+ customActions() {
2135
+ return this.grid.getSetting("actions.custom");
2136
+ }
2137
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TbodyCustomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2138
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: { grid: "grid", row: "row", source: "source" }, outputs: { custom: "custom" }, ngImport: i0, template: `
2139
+ @for (action of customActions(); track action) {
2140
+ <a
2141
+ [id]="'row-' + row.index + '_action-' + action.name + '-button'"
2142
+ href="#"
2143
+ class="ng2-smart-action ng2-smart-action-custom-custom"
2144
+ [innerHTML]="action.title"
2145
+ (click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"
2146
+ ></a>
2147
+ }
2148
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2149
+ }
2150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TbodyCustomComponent, decorators: [{
2151
+ type: Component,
2152
+ args: [{
2153
+ selector: "ng2-st-tbody-custom",
2154
+ changeDetection: ChangeDetectionStrategy.OnPush,
2155
+ template: `
2156
+ @for (action of customActions(); track action) {
2157
+ <a
2158
+ [id]="'row-' + row.index + '_action-' + action.name + '-button'"
2159
+ href="#"
2160
+ class="ng2-smart-action ng2-smart-action-custom-custom"
2161
+ [innerHTML]="action.title"
2162
+ (click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"
2163
+ ></a>
2164
+ }
2165
+ `,
2166
+ }]
2167
+ }], propDecorators: { grid: [{
2168
+ type: Input
2169
+ }], row: [{
2170
+ type: Input
2171
+ }], source: [{
2172
+ type: Input
2173
+ }], custom: [{
2174
+ type: Output
2175
+ }] } });
2176
+
2177
+ class Ng2SmartTableTbodyComponent {
2178
+ constructor() {
2179
+ this.rowClassFunction = () => '';
2180
+ this.save = new EventEmitter();
2181
+ this.cancel = new EventEmitter();
2182
+ this.edit = new EventEmitter();
2183
+ this.editCancel = new EventEmitter();
2184
+ this.delete = new EventEmitter();
2185
+ this.custom = new EventEmitter();
2186
+ this.edited = new EventEmitter();
2187
+ this.userSelectRow = new EventEmitter();
2188
+ this.userClickedRow = new EventEmitter();
2189
+ this.editRowSelect = new EventEmitter();
2190
+ this.multipleSelectRow = new EventEmitter();
2191
+ this.isMultiSelectVisible = false;
2192
+ this.showActionColumnLeft = false;
2193
+ this.showActionColumnRight = false;
2194
+ this.mode = 'inline';
2195
+ this.editInputClass = '';
2196
+ this.isActionAdd = false;
2197
+ this.isActionEdit = false;
2198
+ this.isActionDelete = false;
2199
+ this.noDataMessage = false;
2200
+ }
2201
+ get tableColumnsCount() {
2202
+ const actionColumns = this.isActionAdd || this.isActionEdit || this.isActionDelete ? 1 : 0;
2203
+ return this.grid.getColumns().length + actionColumns;
2204
+ }
2205
+ ngOnChanges() {
2206
+ this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
2207
+ this.showActionColumnLeft = this.grid.showActionColumn('left');
2208
+ this.mode = this.grid.getSetting('mode', 'inline');
2209
+ this.editInputClass = this.grid.getSetting('edit.inputClass', '');
2210
+ this.showActionColumnRight = this.grid.showActionColumn('right');
2211
+ this.isActionAdd = this.grid.getSetting('actions.add', false);
2212
+ this.isActionEdit = this.grid.getSetting('actions.edit', false);
2213
+ this.isActionDelete = this.grid.getSetting('actions.delete', false);
2214
+ this.noDataMessage = this.grid.getSetting('noDataMessage');
2215
+ }
2216
+ getVisibleCells(cells) {
2217
+ return (cells || []).filter((cell) => !cell.getColumn().hide);
2218
+ }
2219
+ trackByIdOrIndex(index, item) {
2220
+ return item?.id || index;
2221
+ }
2222
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2223
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: { grid: "grid", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", rowClassFunction: "rowClassFunction" }, outputs: { save: "save", cancel: "cancel", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", editRowSelect: "editRowSelect", multipleSelectRow: "multipleSelectRow" }, usesOnChanges: true, ngImport: i0, template: "@if (grid.getRows().length) { @for (row of grid.getRows(); track\ntrackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [className]=\"rowClassFunction(row)\"\n [ngClass]=\"{ selected: row.isSelected }\"\n>\n @if (isMultiSelectVisible) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (!row.isInEditing && showActionColumnLeft) {\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\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n } @if (row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @for (cell of getVisibleCells(row.cells); track cell) {\n <td [ngClass]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</tr>\n} } @else {\n<tr>\n <td [attr.colspan]=\"tableColumnsCount\">\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: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["grid", "row", "editConfirm", "createConfirm", "isNew", "cell", "inputClass", "mode", "isInEditing"], outputs: ["edited"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "row", "editConfirm", "editCancel"] }, { kind: "component", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: ["grid", "row", "source", "deleteConfirm", "editConfirm"], outputs: ["edit", "delete", "editRowSelect"] }, { kind: "component", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: ["grid", "row", "source"], outputs: ["custom"] }] }); }
2224
+ }
2225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
2226
+ type: Component,
2227
+ args: [{ selector: '[ng2-st-tbody]', template: "@if (grid.getRows().length) { @for (row of grid.getRows(); track\ntrackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [className]=\"rowClassFunction(row)\"\n [ngClass]=\"{ selected: row.isSelected }\"\n>\n @if (isMultiSelectVisible) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (!row.isInEditing && showActionColumnLeft) {\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\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n } @if (row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @for (cell of getVisibleCells(row.cells); track cell) {\n <td [ngClass]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</tr>\n} } @else {\n<tr>\n <td [attr.colspan]=\"tableColumnsCount\">\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"] }]
2228
+ }], propDecorators: { grid: [{
2229
+ type: Input
2230
+ }], source: [{
2231
+ type: Input
2232
+ }], deleteConfirm: [{
2233
+ type: Input
2234
+ }], editConfirm: [{
2235
+ type: Input
2236
+ }], rowClassFunction: [{
2237
+ type: Input
2238
+ }], save: [{
2239
+ type: Output
2240
+ }], cancel: [{
2241
+ type: Output
2242
+ }], edit: [{
2243
+ type: Output
2244
+ }], editCancel: [{
2245
+ type: Output
2246
+ }], delete: [{
2247
+ type: Output
2248
+ }], custom: [{
2249
+ type: Output
2250
+ }], edited: [{
2251
+ type: Output
2252
+ }], userSelectRow: [{
2253
+ type: Output
2254
+ }], userClickedRow: [{
2255
+ type: Output
2256
+ }], editRowSelect: [{
2257
+ type: Output
2258
+ }], multipleSelectRow: [{
2259
+ type: Output
2260
+ }] } });
2261
+
2262
+ class FilterDefault {
2263
+ constructor() {
2264
+ this.inputClass = '';
2265
+ this.query = '';
2266
+ this.filter = new EventEmitter();
2267
+ }
2268
+ onFilter(query) {
2269
+ this.source.addFilter({
2270
+ field: this.column.id,
2271
+ search: query,
2272
+ filter: this.column.getFilterFunction(),
2273
+ });
2274
+ }
2275
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2276
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FilterDefault, selector: "ng-component", inputs: { column: "column", source: "source", inputClass: "inputClass", query: "query" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
2277
+ }
2278
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterDefault, decorators: [{
2279
+ type: Component,
2280
+ args: [{
2281
+ template: '',
2282
+ }]
2283
+ }], propDecorators: { column: [{
2284
+ type: Input
2285
+ }], source: [{
2286
+ type: Input
2287
+ }], inputClass: [{
2288
+ type: Input
2289
+ }], query: [{
2290
+ type: Input
2291
+ }], filter: [{
2292
+ type: Output
2293
+ }] } });
2294
+
2295
+ class CheckboxFilterComponent extends DefaultFilter {
2296
+ constructor() {
2297
+ super();
2298
+ this.filterActive = false;
2299
+ this.inputControl = new UntypedFormControl();
2300
+ }
2301
+ ngOnInit() {
2302
+ this.changesSubscription = this.inputControl.valueChanges
2303
+ .pipe(debounceTime(this.delay))
2304
+ .subscribe((checked) => {
2305
+ this.filterActive = true;
2306
+ const trueVal = (this.column.getFilterConfig() && this.column.getFilterConfig().true) || true;
2307
+ const falseVal = (this.column.getFilterConfig() && this.column.getFilterConfig().false) || false;
2308
+ this.query = checked ? trueVal : falseVal;
2309
+ this.setFilter();
2310
+ });
2311
+ }
2312
+ resetFilter(event) {
2313
+ event.preventDefault();
2314
+ this.query = '';
2315
+ this.inputControl.setValue(false, { emitEvent: false });
2316
+ this.filterActive = false;
2317
+ this.setFilter();
2318
+ }
2319
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2320
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CheckboxFilterComponent, selector: "checkbox-filter", usesInheritance: true, ngImport: i0, template: `
2321
+ <input type="checkbox" [formControl]="inputControl" [ngClass]="inputClass" class="form-control">
2322
+ @if (filterActive) {
2323
+ <a href="#"
2324
+ (click)="resetFilter($event)">{{column.getFilterConfig()?.resetText || 'reset'}}</a>
2325
+ }
2326
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
2327
+ }
2328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxFilterComponent, decorators: [{
2329
+ type: Component,
2330
+ args: [{
2331
+ selector: 'checkbox-filter',
2332
+ template: `
2333
+ <input type="checkbox" [formControl]="inputControl" [ngClass]="inputClass" class="form-control">
2334
+ @if (filterActive) {
2335
+ <a href="#"
2336
+ (click)="resetFilter($event)">{{column.getFilterConfig()?.resetText || 'reset'}}</a>
2337
+ }
2338
+ `,
2339
+ }]
2340
+ }], ctorParameters: () => [] });
2341
+
2342
+ class InputFilterComponent extends DefaultFilter {
2620
2343
  constructor() {
2621
- this.custom = new EventEmitter();
2344
+ super();
2345
+ this.inputControl = new UntypedFormControl();
2622
2346
  }
2623
- onCustom(action) {
2624
- this.custom.emit({
2625
- action: action.name,
2626
- data: this.row.getData(),
2627
- source: this.source,
2347
+ ngOnInit() {
2348
+ if (this.query) {
2349
+ this.inputControl.setValue(this.query);
2350
+ }
2351
+ this.inputControl.valueChanges
2352
+ .pipe(distinctUntilChanged(), debounceTime(this.delay))
2353
+ .subscribe((value) => {
2354
+ this.query = this.inputControl.value;
2355
+ this.setFilter();
2628
2356
  });
2629
2357
  }
2630
- customActions() {
2631
- return this.grid.getSetting("actions.custom");
2632
- }
2633
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TbodyCustomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2634
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: { grid: "grid", row: "row", source: "source" }, outputs: { custom: "custom" }, ngImport: i0, template: `
2635
- @for (action of customActions(); track action) {
2636
- <a
2637
- [id]="'row-' + row.index + '_action-' + action.name + '-button'"
2638
- href="#"
2639
- class="ng2-smart-action ng2-smart-action-custom-custom"
2640
- [innerHTML]="action.title"
2641
- (click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"
2642
- ></a>
2358
+ ngOnChanges(changes) {
2359
+ if (changes?.['query']) {
2360
+ this.inputControl.setValue(this.query);
2361
+ }
2643
2362
  }
2644
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2363
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2364
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: InputFilterComponent, selector: "input-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2365
+ <input
2366
+ [ngClass]="inputClass"
2367
+ [formControl]="inputControl"
2368
+ class="form-control"
2369
+ type="text"
2370
+ placeholder="{{ column.title }}"/>
2371
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
2645
2372
  }
2646
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TbodyCustomComponent, decorators: [{
2373
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputFilterComponent, decorators: [{
2647
2374
  type: Component,
2648
2375
  args: [{
2649
- selector: "ng2-st-tbody-custom",
2650
- changeDetection: ChangeDetectionStrategy.OnPush,
2376
+ selector: 'input-filter',
2651
2377
  template: `
2652
- @for (action of customActions(); track action) {
2653
- <a
2654
- [id]="'row-' + row.index + '_action-' + action.name + '-button'"
2655
- href="#"
2656
- class="ng2-smart-action ng2-smart-action-custom-custom"
2657
- [innerHTML]="action.title"
2658
- (click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"
2659
- ></a>
2660
- }
2661
- `,
2378
+ <input
2379
+ [ngClass]="inputClass"
2380
+ [formControl]="inputControl"
2381
+ class="form-control"
2382
+ type="text"
2383
+ placeholder="{{ column.title }}"/>
2384
+ `,
2662
2385
  }]
2663
- }], propDecorators: { grid: [{
2664
- type: Input
2665
- }], row: [{
2666
- type: Input
2667
- }], source: [{
2668
- type: Input
2669
- }], custom: [{
2670
- type: Output
2671
- }] } });
2386
+ }], ctorParameters: () => [] });
2672
2387
 
2673
- class Ng2SmartTableTbodyComponent {
2388
+ class SelectFilterComponent extends DefaultFilter {
2674
2389
  constructor() {
2675
- this.rowClassFunction = () => '';
2676
- this.save = new EventEmitter();
2677
- this.cancel = new EventEmitter();
2678
- this.edit = new EventEmitter();
2679
- this.editCancel = new EventEmitter();
2680
- this.delete = new EventEmitter();
2681
- this.custom = new EventEmitter();
2682
- this.edited = new EventEmitter();
2683
- this.userSelectRow = new EventEmitter();
2684
- this.userClickedRow = new EventEmitter();
2685
- this.editRowSelect = new EventEmitter();
2686
- this.multipleSelectRow = new EventEmitter();
2687
- this.isMultiSelectVisible = false;
2688
- this.showActionColumnLeft = false;
2689
- this.showActionColumnRight = false;
2690
- this.mode = 'inline';
2691
- this.editInputClass = '';
2692
- this.isActionAdd = false;
2693
- this.isActionEdit = false;
2694
- this.isActionDelete = false;
2695
- this.noDataMessage = false;
2390
+ super();
2696
2391
  }
2697
- get tableColumnsCount() {
2698
- const actionColumns = this.isActionAdd || this.isActionEdit || this.isActionDelete ? 1 : 0;
2699
- return this.grid.getColumns().length + actionColumns;
2392
+ ngOnInit() {
2393
+ if (this.inputControl.valueChanges) {
2394
+ this.inputControl.valueChanges
2395
+ .pipe(skip(1), distinctUntilChanged(), debounceTime(this.delay))
2396
+ .subscribe((value) => this.setFilter());
2397
+ }
2700
2398
  }
2701
- ngOnChanges() {
2702
- this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
2703
- this.showActionColumnLeft = this.grid.showActionColumn('left');
2704
- this.mode = this.grid.getSetting('mode', 'inline');
2705
- this.editInputClass = this.grid.getSetting('edit.inputClass', '');
2706
- this.showActionColumnRight = this.grid.showActionColumn('right');
2707
- this.isActionAdd = this.grid.getSetting('actions.add', false);
2708
- this.isActionEdit = this.grid.getSetting('actions.edit', false);
2709
- this.isActionDelete = this.grid.getSetting('actions.delete', false);
2710
- this.noDataMessage = this.grid.getSetting('noDataMessage');
2399
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2400
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: SelectFilterComponent, selector: "select-filter", viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true, read: NgControl, static: true }], usesInheritance: true, ngImport: i0, template: `
2401
+ <select [ngClass]="inputClass"
2402
+ class="form-control"
2403
+ #inputControl
2404
+ [(ngModel)]="query">
2405
+
2406
+ <option value="">{{ column.getFilterConfig().selectText }}</option>
2407
+ @for (option of column.getFilterConfig().list; track option) {
2408
+ <option [value]="option.value">
2409
+ {{ option.title }}
2410
+ </option>
2411
+ }
2412
+ </select>
2413
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
2414
+ }
2415
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFilterComponent, decorators: [{
2416
+ type: Component,
2417
+ args: [{
2418
+ selector: 'select-filter',
2419
+ template: `
2420
+ <select [ngClass]="inputClass"
2421
+ class="form-control"
2422
+ #inputControl
2423
+ [(ngModel)]="query">
2424
+
2425
+ <option value="">{{ column.getFilterConfig().selectText }}</option>
2426
+ @for (option of column.getFilterConfig().list; track option) {
2427
+ <option [value]="option.value">
2428
+ {{ option.title }}
2429
+ </option>
2430
+ }
2431
+ </select>
2432
+ `,
2433
+ }]
2434
+ }], ctorParameters: () => [], propDecorators: { inputControl: [{
2435
+ type: ViewChild,
2436
+ args: ['inputControl', { read: NgControl, static: true }]
2437
+ }] } });
2438
+
2439
+ class DefaultFilterComponent extends FilterDefault {
2440
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2441
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: DefaultFilterComponent, selector: "default-table-filter", usesInheritance: true, ngImport: i0, template: `
2442
+ @switch (column.getFilterType()) {
2443
+ @case ('list') {
2444
+ <select-filter
2445
+ [query]="query"
2446
+ [ngClass]="inputClass"
2447
+ [column]="column"
2448
+ (filter)="onFilter($event)">
2449
+ </select-filter>
2450
+ }
2451
+ @case ('checkbox') {
2452
+ <checkbox-filter
2453
+ [query]="query"
2454
+ [ngClass]="inputClass"
2455
+ [column]="column"
2456
+ (filter)="onFilter($event)">
2457
+ </checkbox-filter>
2458
+ }
2459
+ @default {
2460
+ <input-filter
2461
+ [query]="query"
2462
+ [ngClass]="inputClass"
2463
+ [column]="column"
2464
+ (filter)="onFilter($event)">
2465
+ </input-filter>
2466
+ }
2467
+ }
2468
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: CheckboxFilterComponent, selector: "checkbox-filter" }, { kind: "component", type: InputFilterComponent, selector: "input-filter" }, { kind: "component", type: SelectFilterComponent, selector: "select-filter" }] }); }
2469
+ }
2470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DefaultFilterComponent, decorators: [{
2471
+ type: Component,
2472
+ args: [{
2473
+ selector: 'default-table-filter',
2474
+ template: `
2475
+ @switch (column.getFilterType()) {
2476
+ @case ('list') {
2477
+ <select-filter
2478
+ [query]="query"
2479
+ [ngClass]="inputClass"
2480
+ [column]="column"
2481
+ (filter)="onFilter($event)">
2482
+ </select-filter>
2483
+ }
2484
+ @case ('checkbox') {
2485
+ <checkbox-filter
2486
+ [query]="query"
2487
+ [ngClass]="inputClass"
2488
+ [column]="column"
2489
+ (filter)="onFilter($event)">
2490
+ </checkbox-filter>
2491
+ }
2492
+ @default {
2493
+ <input-filter
2494
+ [query]="query"
2495
+ [ngClass]="inputClass"
2496
+ [column]="column"
2497
+ (filter)="onFilter($event)">
2498
+ </input-filter>
2499
+ }
2500
+ }
2501
+ `,
2502
+ }]
2503
+ }] });
2504
+
2505
+ class CustomFilterComponent extends FilterDefault {
2506
+ constructor(resolver) {
2507
+ super();
2508
+ this.resolver = resolver;
2711
2509
  }
2712
- getVisibleCells(cells) {
2713
- return (cells || []).filter((cell) => !cell.getColumn().hide);
2510
+ ngOnChanges(changes) {
2511
+ if (this.customComponent) {
2512
+ this.customComponent.instance.ngOnChanges(changes);
2513
+ return;
2514
+ }
2515
+ if (this.column.filter && this.column.filter.type === 'custom') {
2516
+ const componentFactory = this.resolver.resolveComponentFactory(this.column.filter?.component);
2517
+ this.customComponent = this.dynamicTarget.createComponent(componentFactory);
2518
+ }
2519
+ // set @Inputs and @Outputs of custom component
2520
+ this.customComponent.instance.query = this.query;
2521
+ this.customComponent.instance.column = this.column;
2522
+ this.customComponent.instance.source = this.source;
2523
+ this.customComponent.instance.inputClass = this.inputClass;
2524
+ this.customComponent.instance.filter.subscribe((event) => this.onFilter(event));
2714
2525
  }
2715
- trackByIdOrIndex(index, item) {
2716
- return item?.id || index;
2526
+ ngOnDestroy() {
2527
+ if (this.customComponent) {
2528
+ this.customComponent.destroy();
2529
+ }
2717
2530
  }
2718
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2719
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: { grid: "grid", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", rowClassFunction: "rowClassFunction" }, outputs: { save: "save", cancel: "cancel", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", editRowSelect: "editRowSelect", multipleSelectRow: "multipleSelectRow" }, usesOnChanges: true, ngImport: i0, template: "@if (grid.getRows().length) { @for (row of grid.getRows(); track\ntrackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [className]=\"rowClassFunction(row)\"\n [ngClass]=\"{ selected: row.isSelected }\"\n>\n @if (isMultiSelectVisible) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (!row.isInEditing && showActionColumnLeft) {\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\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n } @if (row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @for (cell of getVisibleCells(row.cells); track cell) {\n <td [ngClass]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</tr>\n} } @else {\n<tr>\n <td [attr.colspan]=\"tableColumnsCount\">\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: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["grid", "row", "editConfirm", "createConfirm", "isNew", "cell", "inputClass", "mode", "isInEditing"], outputs: ["edited"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "row", "editConfirm", "editCancel"] }, { kind: "component", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: ["grid", "row", "source", "deleteConfirm", "editConfirm"], outputs: ["edit", "delete", "editRowSelect"] }, { kind: "component", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: ["grid", "row", "source"], outputs: ["custom"] }] }); }
2531
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomFilterComponent, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component }); }
2532
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CustomFilterComponent, selector: "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 }); }
2720
2533
  }
2721
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
2534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CustomFilterComponent, decorators: [{
2722
2535
  type: Component,
2723
- args: [{ selector: '[ng2-st-tbody]', template: "@if (grid.getRows().length) { @for (row of grid.getRows(); track\ntrackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [className]=\"rowClassFunction(row)\"\n [ngClass]=\"{ selected: row.isSelected }\"\n>\n @if (isMultiSelectVisible) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (!row.isInEditing && showActionColumnLeft) {\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\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n } @if (row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @for (cell of getVisibleCells(row.cells); track cell) {\n <td [ngClass]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</tr>\n} } @else {\n<tr>\n <td [attr.colspan]=\"tableColumnsCount\">\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"] }]
2724
- }], propDecorators: { grid: [{
2725
- type: Input
2726
- }], source: [{
2727
- type: Input
2728
- }], deleteConfirm: [{
2729
- type: Input
2730
- }], editConfirm: [{
2731
- type: Input
2732
- }], rowClassFunction: [{
2733
- type: Input
2734
- }], save: [{
2735
- type: Output
2736
- }], cancel: [{
2737
- type: Output
2738
- }], edit: [{
2739
- type: Output
2740
- }], editCancel: [{
2741
- type: Output
2742
- }], delete: [{
2743
- type: Output
2744
- }], custom: [{
2745
- type: Output
2746
- }], edited: [{
2747
- type: Output
2748
- }], userSelectRow: [{
2749
- type: Output
2750
- }], userClickedRow: [{
2751
- type: Output
2752
- }], editRowSelect: [{
2753
- type: Output
2754
- }], multipleSelectRow: [{
2755
- type: Output
2536
+ args: [{
2537
+ selector: 'custom-table-filter',
2538
+ template: `<ng-template #dynamicTarget></ng-template>`,
2539
+ }]
2540
+ }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }], propDecorators: { dynamicTarget: [{
2541
+ type: ViewChild,
2542
+ args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
2756
2543
  }] } });
2757
2544
 
2758
- const TBODY_COMPONENTS = [
2759
- TbodyCreateCancelComponent,
2760
- TbodyEditDeleteComponent,
2761
- TbodyCustomComponent,
2762
- Ng2SmartTableTbodyComponent
2763
- ];
2764
- class TBodyModule {
2765
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2766
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, declarations: [TbodyCreateCancelComponent,
2767
- TbodyEditDeleteComponent,
2768
- TbodyCustomComponent,
2769
- Ng2SmartTableTbodyComponent], imports: [CommonModule,
2770
- FormsModule,
2771
- CellModule], exports: [TbodyCreateCancelComponent,
2772
- TbodyEditDeleteComponent,
2773
- TbodyCustomComponent,
2774
- Ng2SmartTableTbodyComponent] }); }
2775
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, imports: [CommonModule,
2776
- FormsModule,
2777
- CellModule] }); }
2545
+ class FilterComponent extends FilterDefault {
2546
+ ngOnChanges(changes) {
2547
+ if (changes['source']) {
2548
+ if (!changes['source'].firstChange && this.dataChangedSub) {
2549
+ this.dataChangedSub.unsubscribe();
2550
+ }
2551
+ this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
2552
+ const filterConf = this.source.getFilter();
2553
+ if (filterConf && filterConf.filters && filterConf.filters.length === 0) {
2554
+ this.query = '';
2555
+ // add a check for existing filters an set the query if one exists for this column
2556
+ // this covers instances where the filter is set by user code while maintaining existing functionality
2557
+ }
2558
+ else if (filterConf && filterConf.filters && filterConf.filters.length > 0) {
2559
+ filterConf.filters.forEach((k, v) => {
2560
+ if (k.field == this.column.id) {
2561
+ this.query = k.search;
2562
+ }
2563
+ });
2564
+ }
2565
+ });
2566
+ }
2567
+ }
2568
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2569
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: FilterComponent, selector: "ng2-smart-table-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2570
+ @if (column.isFilterable) {
2571
+ <div class="ng2-smart-filter">
2572
+ @switch (column.getFilterType()) {
2573
+ @case ('custom') {
2574
+ <custom-table-filter
2575
+ [query]="query"
2576
+ [column]="column"
2577
+ [source]="source"
2578
+ [inputClass]="inputClass"
2579
+ (filter)="onFilter($event)">
2580
+ </custom-table-filter>
2581
+ }
2582
+ @default {
2583
+ <default-table-filter
2584
+ [query]="query"
2585
+ [column]="column"
2586
+ [source]="source"
2587
+ [inputClass]="inputClass"
2588
+ (filter)="onFilter($event)">
2589
+ </default-table-filter>
2590
+ }
2591
+ }
2592
+ </div>
2593
+ }
2594
+ `, 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: DefaultFilterComponent, selector: "default-table-filter" }, { kind: "component", type: CustomFilterComponent, selector: "custom-table-filter" }] }); }
2778
2595
  }
2779
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, decorators: [{
2780
- type: NgModule,
2781
- args: [{
2782
- imports: [
2783
- CommonModule,
2784
- FormsModule,
2785
- CellModule,
2786
- ],
2787
- declarations: [
2788
- ...TBODY_COMPONENTS,
2789
- ],
2790
- exports: [
2791
- ...TBODY_COMPONENTS,
2792
- ],
2793
- }]
2596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterComponent, decorators: [{
2597
+ type: Component,
2598
+ args: [{ selector: 'ng2-smart-table-filter', template: `
2599
+ @if (column.isFilterable) {
2600
+ <div class="ng2-smart-filter">
2601
+ @switch (column.getFilterType()) {
2602
+ @case ('custom') {
2603
+ <custom-table-filter
2604
+ [query]="query"
2605
+ [column]="column"
2606
+ [source]="source"
2607
+ [inputClass]="inputClass"
2608
+ (filter)="onFilter($event)">
2609
+ </custom-table-filter>
2610
+ }
2611
+ @default {
2612
+ <default-table-filter
2613
+ [query]="query"
2614
+ [column]="column"
2615
+ [source]="source"
2616
+ [inputClass]="inputClass"
2617
+ (filter)="onFilter($event)">
2618
+ </default-table-filter>
2619
+ }
2620
+ }
2621
+ </div>
2622
+ }
2623
+ `, 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"] }]
2794
2624
  }] });
2795
2625
 
2796
2626
  class AddButtonComponent {
@@ -3321,92 +3151,33 @@ class Ng2SmartTableTheadComponent {
3321
3151
  this.create = new EventEmitter();
3322
3152
  this.filter = new EventEmitter();
3323
3153
  this.isHideHeader = false;
3324
- this.isHideSubHeader = false;
3325
- }
3326
- ngOnChanges() {
3327
- this.isHideHeader = this.grid.getSetting('hideHeader', false);
3328
- this.isHideSubHeader = this.grid.getSetting('hideSubHeader', false);
3329
- }
3330
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3331
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: { grid: "grid", source: "source", createConfirm: "createConfirm" }, outputs: { sort: "sort", selectAllRows: "selectAllRows", create: "create", filter: "filter" }, usesOnChanges: true, ngImport: i0, 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", dependencies: [{ kind: "component", type: TheadFitlersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create", "filter"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "row", "createConfirm"], outputs: ["create"] }, { kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["sort", "selectAllRows"] }] }); }
3332
- }
3333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
3334
- type: Component,
3335
- args: [{ selector: '[ng2-st-thead]', 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" }]
3336
- }], propDecorators: { grid: [{
3337
- type: Input
3338
- }], source: [{
3339
- type: Input
3340
- }], createConfirm: [{
3341
- type: Input
3342
- }], sort: [{
3343
- type: Output
3344
- }], selectAllRows: [{
3345
- type: Output
3346
- }], create: [{
3347
- type: Output
3348
- }], filter: [{
3349
- type: Output
3350
- }] } });
3351
-
3352
- const THEAD_COMPONENTS = [
3353
- ActionsComponent,
3354
- ActionsTitleComponent,
3355
- AddButtonComponent,
3356
- CheckboxSelectAllComponent,
3357
- ColumnTitleComponent,
3358
- TitleComponent,
3359
- TheadFitlersRowComponent,
3360
- TheadFormRowComponent,
3361
- TheadTitlesRowComponent,
3362
- Ng2SmartTableTheadComponent,
3363
- ];
3364
- class THeadModule {
3365
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3366
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, declarations: [ActionsComponent,
3367
- ActionsTitleComponent,
3368
- AddButtonComponent,
3369
- CheckboxSelectAllComponent,
3370
- ColumnTitleComponent,
3371
- TitleComponent,
3372
- TheadFitlersRowComponent,
3373
- TheadFormRowComponent,
3374
- TheadTitlesRowComponent,
3375
- Ng2SmartTableTheadComponent], imports: [CommonModule,
3376
- FormsModule,
3377
- FilterModule,
3378
- CellModule], exports: [ActionsComponent,
3379
- ActionsTitleComponent,
3380
- AddButtonComponent,
3381
- CheckboxSelectAllComponent,
3382
- ColumnTitleComponent,
3383
- TitleComponent,
3384
- TheadFitlersRowComponent,
3385
- TheadFormRowComponent,
3386
- TheadTitlesRowComponent,
3387
- Ng2SmartTableTheadComponent] }); }
3388
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, imports: [CommonModule,
3389
- FormsModule,
3390
- FilterModule,
3391
- CellModule] }); }
3392
- }
3393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, decorators: [{
3394
- type: NgModule,
3395
- args: [{
3396
- imports: [
3397
- CommonModule,
3398
- FormsModule,
3399
- FilterModule,
3400
- CellModule,
3401
- ],
3402
- declarations: [
3403
- ...THEAD_COMPONENTS,
3404
- ],
3405
- exports: [
3406
- ...THEAD_COMPONENTS,
3407
- ],
3408
- }]
3409
- }] });
3154
+ this.isHideSubHeader = false;
3155
+ }
3156
+ ngOnChanges() {
3157
+ this.isHideHeader = this.grid.getSetting('hideHeader', false);
3158
+ this.isHideSubHeader = this.grid.getSetting('hideSubHeader', false);
3159
+ }
3160
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3161
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: { grid: "grid", source: "source", createConfirm: "createConfirm" }, outputs: { sort: "sort", selectAllRows: "selectAllRows", create: "create", filter: "filter" }, usesOnChanges: true, ngImport: i0, 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", dependencies: [{ kind: "component", type: TheadFitlersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create", "filter"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "row", "createConfirm"], outputs: ["create"] }, { kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["sort", "selectAllRows"] }] }); }
3162
+ }
3163
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
3164
+ type: Component,
3165
+ args: [{ selector: '[ng2-st-thead]', 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" }]
3166
+ }], propDecorators: { grid: [{
3167
+ type: Input
3168
+ }], source: [{
3169
+ type: Input
3170
+ }], createConfirm: [{
3171
+ type: Input
3172
+ }], sort: [{
3173
+ type: Output
3174
+ }], selectAllRows: [{
3175
+ type: Output
3176
+ }], create: [{
3177
+ type: Output
3178
+ }], filter: [{
3179
+ type: Output
3180
+ }] } });
3410
3181
 
3411
3182
  class Ng2SmartTableComponent {
3412
3183
  constructor() {
@@ -3568,6 +3339,235 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3568
3339
  type: Output
3569
3340
  }] } });
3570
3341
 
3342
+ const CELL_COMPONENTS = [
3343
+ CellComponent,
3344
+ EditCellDefault,
3345
+ DefaultEditor,
3346
+ CustomEditComponent,
3347
+ DefaultEditComponent,
3348
+ EditCellComponent,
3349
+ CheckboxEditorComponent,
3350
+ InputEditorComponent,
3351
+ SelectEditorComponent,
3352
+ TextareaEditorComponent,
3353
+ CustomViewComponent,
3354
+ ViewCellComponent,
3355
+ ];
3356
+ class CellModule {
3357
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3358
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: CellModule, declarations: [CellComponent,
3359
+ EditCellDefault,
3360
+ DefaultEditor,
3361
+ CustomEditComponent,
3362
+ DefaultEditComponent,
3363
+ EditCellComponent,
3364
+ CheckboxEditorComponent,
3365
+ InputEditorComponent,
3366
+ SelectEditorComponent,
3367
+ TextareaEditorComponent,
3368
+ CustomViewComponent,
3369
+ ViewCellComponent], imports: [CommonModule,
3370
+ FormsModule], exports: [CellComponent,
3371
+ EditCellDefault,
3372
+ DefaultEditor,
3373
+ CustomEditComponent,
3374
+ DefaultEditComponent,
3375
+ EditCellComponent,
3376
+ CheckboxEditorComponent,
3377
+ InputEditorComponent,
3378
+ SelectEditorComponent,
3379
+ TextareaEditorComponent,
3380
+ CustomViewComponent,
3381
+ ViewCellComponent] }); }
3382
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellModule, imports: [CommonModule,
3383
+ FormsModule] }); }
3384
+ }
3385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CellModule, decorators: [{
3386
+ type: NgModule,
3387
+ args: [{
3388
+ imports: [
3389
+ CommonModule,
3390
+ FormsModule,
3391
+ ],
3392
+ declarations: [
3393
+ ...CELL_COMPONENTS,
3394
+ ],
3395
+ exports: [
3396
+ ...CELL_COMPONENTS,
3397
+ ],
3398
+ }]
3399
+ }] });
3400
+
3401
+ const FILTER_COMPONENTS = [
3402
+ FilterDefault,
3403
+ DefaultFilter,
3404
+ FilterComponent,
3405
+ DefaultFilterComponent,
3406
+ CustomFilterComponent,
3407
+ CheckboxFilterComponent,
3408
+ InputFilterComponent,
3409
+ SelectFilterComponent,
3410
+ ];
3411
+ class FilterModule {
3412
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3413
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, declarations: [FilterDefault,
3414
+ DefaultFilter,
3415
+ FilterComponent,
3416
+ DefaultFilterComponent,
3417
+ CustomFilterComponent,
3418
+ CheckboxFilterComponent,
3419
+ InputFilterComponent,
3420
+ SelectFilterComponent], imports: [CommonModule,
3421
+ FormsModule,
3422
+ ReactiveFormsModule], exports: [FilterDefault,
3423
+ DefaultFilter,
3424
+ FilterComponent,
3425
+ DefaultFilterComponent,
3426
+ CustomFilterComponent,
3427
+ CheckboxFilterComponent,
3428
+ InputFilterComponent,
3429
+ SelectFilterComponent] }); }
3430
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, imports: [CommonModule,
3431
+ FormsModule,
3432
+ ReactiveFormsModule] }); }
3433
+ }
3434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FilterModule, decorators: [{
3435
+ type: NgModule,
3436
+ args: [{
3437
+ imports: [
3438
+ CommonModule,
3439
+ FormsModule,
3440
+ ReactiveFormsModule,
3441
+ ],
3442
+ declarations: [
3443
+ ...FILTER_COMPONENTS,
3444
+ ],
3445
+ exports: [
3446
+ ...FILTER_COMPONENTS,
3447
+ ],
3448
+ }]
3449
+ }] });
3450
+
3451
+ class PagerModule {
3452
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3453
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, declarations: [PagerComponent], imports: [CommonModule,
3454
+ FormsModule], exports: [PagerComponent] }); }
3455
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, imports: [CommonModule,
3456
+ FormsModule] }); }
3457
+ }
3458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagerModule, decorators: [{
3459
+ type: NgModule,
3460
+ args: [{
3461
+ imports: [
3462
+ CommonModule,
3463
+ FormsModule,
3464
+ ],
3465
+ declarations: [
3466
+ PagerComponent,
3467
+ ],
3468
+ exports: [
3469
+ PagerComponent,
3470
+ ],
3471
+ }]
3472
+ }] });
3473
+
3474
+ const TBODY_COMPONENTS = [
3475
+ TbodyCreateCancelComponent,
3476
+ TbodyEditDeleteComponent,
3477
+ TbodyCustomComponent,
3478
+ Ng2SmartTableTbodyComponent
3479
+ ];
3480
+ class TBodyModule {
3481
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3482
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, declarations: [TbodyCreateCancelComponent,
3483
+ TbodyEditDeleteComponent,
3484
+ TbodyCustomComponent,
3485
+ Ng2SmartTableTbodyComponent], imports: [CommonModule,
3486
+ FormsModule,
3487
+ CellModule], exports: [TbodyCreateCancelComponent,
3488
+ TbodyEditDeleteComponent,
3489
+ TbodyCustomComponent,
3490
+ Ng2SmartTableTbodyComponent] }); }
3491
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, imports: [CommonModule,
3492
+ FormsModule,
3493
+ CellModule] }); }
3494
+ }
3495
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TBodyModule, decorators: [{
3496
+ type: NgModule,
3497
+ args: [{
3498
+ imports: [
3499
+ CommonModule,
3500
+ FormsModule,
3501
+ CellModule,
3502
+ ],
3503
+ declarations: [
3504
+ ...TBODY_COMPONENTS,
3505
+ ],
3506
+ exports: [
3507
+ ...TBODY_COMPONENTS,
3508
+ ],
3509
+ }]
3510
+ }] });
3511
+
3512
+ const THEAD_COMPONENTS = [
3513
+ ActionsComponent,
3514
+ ActionsTitleComponent,
3515
+ AddButtonComponent,
3516
+ CheckboxSelectAllComponent,
3517
+ ColumnTitleComponent,
3518
+ TitleComponent,
3519
+ TheadFitlersRowComponent,
3520
+ TheadFormRowComponent,
3521
+ TheadTitlesRowComponent,
3522
+ Ng2SmartTableTheadComponent,
3523
+ ];
3524
+ class THeadModule {
3525
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3526
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, declarations: [ActionsComponent,
3527
+ ActionsTitleComponent,
3528
+ AddButtonComponent,
3529
+ CheckboxSelectAllComponent,
3530
+ ColumnTitleComponent,
3531
+ TitleComponent,
3532
+ TheadFitlersRowComponent,
3533
+ TheadFormRowComponent,
3534
+ TheadTitlesRowComponent,
3535
+ Ng2SmartTableTheadComponent], imports: [CommonModule,
3536
+ FormsModule,
3537
+ FilterModule,
3538
+ CellModule], exports: [ActionsComponent,
3539
+ ActionsTitleComponent,
3540
+ AddButtonComponent,
3541
+ CheckboxSelectAllComponent,
3542
+ ColumnTitleComponent,
3543
+ TitleComponent,
3544
+ TheadFitlersRowComponent,
3545
+ TheadFormRowComponent,
3546
+ TheadTitlesRowComponent,
3547
+ Ng2SmartTableTheadComponent] }); }
3548
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, imports: [CommonModule,
3549
+ FormsModule,
3550
+ FilterModule,
3551
+ CellModule] }); }
3552
+ }
3553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: THeadModule, decorators: [{
3554
+ type: NgModule,
3555
+ args: [{
3556
+ imports: [
3557
+ CommonModule,
3558
+ FormsModule,
3559
+ FilterModule,
3560
+ CellModule,
3561
+ ],
3562
+ declarations: [
3563
+ ...THEAD_COMPONENTS,
3564
+ ],
3565
+ exports: [
3566
+ ...THEAD_COMPONENTS,
3567
+ ],
3568
+ }]
3569
+ }] });
3570
+
3571
3571
  class Ng2SmartTableModule {
3572
3572
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3573
3573
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: Ng2SmartTableModule, declarations: [Ng2SmartTableComponent], imports: [CommonModule,
@@ -3613,5 +3613,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3613
3613
  * Generated bundle index. Do not edit.
3614
3614
  */
3615
3615
 
3616
- export { Cell, DefaultEditor, DefaultFilter, LocalDataSource, Ng2SmartTableComponent, Ng2SmartTableModule };
3616
+ export { Cell, Column, DataSource, DefaultEditor, DefaultFilter, LocalDataSource, Ng2SmartTableComponent, Ng2SmartTableModule, Row, SmartTableOnChangedEventName };
3617
3617
  //# sourceMappingURL=den4ik92-ng2-smart-table.mjs.map