@den4ik92/ng2-smart-table 3.0.1 → 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.
package/esm2022/public-api.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export { DefaultEditor } from
|
|
2
|
-
export { DefaultFilter } from
|
|
3
|
-
export { Cell } from
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
1
|
+
export { DefaultEditor } from "./lib/components/cell/cell-editors/default-editor";
|
|
2
|
+
export { DefaultFilter } from "./lib/components/filter/filter-types/default-filter";
|
|
3
|
+
export { Cell } from "./lib/lib/data-set/cell";
|
|
4
|
+
export { Column } from "./lib/lib/data-set/column";
|
|
5
|
+
export { Row } from "./lib/lib/data-set/row";
|
|
6
|
+
export { DataSource } from "./lib/lib/data-source/data-source";
|
|
7
|
+
export { LocalDataSource } from "./lib/lib/data-source/local/local.data-source";
|
|
8
|
+
export * from "./lib/lib/interfaces/smart-table.models";
|
|
9
|
+
export * from "./lib/ng2-smart-table.component";
|
|
10
|
+
export * from "./lib/ng2-smart-table.module";
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25nMi1zbWFydC10YWJsZS9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsYUFBYSxFQUVkLE1BQU0sbURBQW1ELENBQUM7QUFFM0QsT0FBTyxFQUNMLGFBQWEsRUFFZCxNQUFNLHFEQUFxRCxDQUFDO0FBQzdELE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMvQyxPQUFPLEVBQUUsTUFBTSxFQUFFLE1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xvY2FsLmRhdGEtc291cmNlXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9saWIvbGliL2ludGVyZmFjZXMvc21hcnQtdGFibGUubW9kZWxzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9saWIvbmcyLXNtYXJ0LXRhYmxlLmNvbXBvbmVudFwiO1xuZXhwb3J0ICogZnJvbSBcIi4vbGliL25nMi1zbWFydC10YWJsZS5tb2R1bGVcIjtcblxuIl19
|
|
@@ -184,41 +184,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
184
184
|
type: Output
|
|
185
185
|
}] } });
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
class Row {
|
|
188
|
+
constructor(index, data, _dataSet) {
|
|
189
|
+
this.index = index;
|
|
190
|
+
this.data = data;
|
|
191
|
+
this._dataSet = _dataSet;
|
|
192
|
+
this.pending = false;
|
|
193
|
+
this.isSelected = false;
|
|
194
|
+
this.isInEditing = false;
|
|
195
|
+
this.cells = [];
|
|
196
|
+
this.process();
|
|
190
197
|
}
|
|
191
|
-
|
|
192
|
-
return
|
|
198
|
+
getCell(column) {
|
|
199
|
+
return this.cells.find(el => el.getColumn() === column);
|
|
193
200
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
class LocalSorter {
|
|
197
|
-
static sort(data, field, direction, customCompare) {
|
|
198
|
-
const dir = (direction === 'asc') ? 1 : -1;
|
|
199
|
-
const compare = customCompare ? customCompare : compareValues;
|
|
200
|
-
return data.sort((a, b) => {
|
|
201
|
-
return compare.call(null, dir, a[field], b[field]);
|
|
202
|
-
});
|
|
201
|
+
getCells() {
|
|
202
|
+
return this.cells;
|
|
203
203
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
204
|
+
getData() {
|
|
205
|
+
return this.data;
|
|
206
|
+
}
|
|
207
|
+
getIsSelected() {
|
|
208
|
+
return this.isSelected;
|
|
209
|
+
}
|
|
210
|
+
getNewData() {
|
|
211
|
+
const values = Object.assign({}, this.data);
|
|
212
|
+
this.getCells().forEach((cell) => values[cell.getColumn().id] = cell.newValue);
|
|
213
|
+
return values;
|
|
214
|
+
}
|
|
215
|
+
setData(data) {
|
|
216
|
+
this.data = data;
|
|
217
|
+
this.process();
|
|
218
|
+
}
|
|
219
|
+
process() {
|
|
220
|
+
this.cells = [];
|
|
221
|
+
this._dataSet.getColumns().forEach((column) => {
|
|
222
|
+
const cell = this.createCell(column);
|
|
223
|
+
this.cells.push(cell);
|
|
215
224
|
});
|
|
216
225
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return data.slice(perPage * (page - 1), perPage * page);
|
|
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);
|
|
222
230
|
}
|
|
223
231
|
}
|
|
224
232
|
|
|
@@ -328,6 +336,44 @@ class DataSource {
|
|
|
328
336
|
}
|
|
329
337
|
}
|
|
330
338
|
|
|
339
|
+
function compareValues(direction, a, b) {
|
|
340
|
+
if (a < b) {
|
|
341
|
+
return -1 * direction;
|
|
342
|
+
}
|
|
343
|
+
if (a > b) {
|
|
344
|
+
return direction;
|
|
345
|
+
}
|
|
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]);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
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);
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
class LocalPager {
|
|
372
|
+
static paginate(data, page, perPage) {
|
|
373
|
+
return data.slice(perPage * (page - 1), perPage * page);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
331
377
|
/**
|
|
332
378
|
* Extending object that entered in first argument.
|
|
333
379
|
*
|
|
@@ -670,52 +716,6 @@ class LocalDataSource extends DataSource {
|
|
|
670
716
|
}
|
|
671
717
|
}
|
|
672
718
|
|
|
673
|
-
class Row {
|
|
674
|
-
constructor(index, data, _dataSet) {
|
|
675
|
-
this.index = index;
|
|
676
|
-
this.data = data;
|
|
677
|
-
this._dataSet = _dataSet;
|
|
678
|
-
this.pending = false;
|
|
679
|
-
this.isSelected = false;
|
|
680
|
-
this.isInEditing = false;
|
|
681
|
-
this.cells = [];
|
|
682
|
-
this.process();
|
|
683
|
-
}
|
|
684
|
-
getCell(column) {
|
|
685
|
-
return this.cells.find(el => el.getColumn() === column);
|
|
686
|
-
}
|
|
687
|
-
getCells() {
|
|
688
|
-
return this.cells;
|
|
689
|
-
}
|
|
690
|
-
getData() {
|
|
691
|
-
return this.data;
|
|
692
|
-
}
|
|
693
|
-
getIsSelected() {
|
|
694
|
-
return this.isSelected;
|
|
695
|
-
}
|
|
696
|
-
getNewData() {
|
|
697
|
-
const values = Object.assign({}, this.data);
|
|
698
|
-
this.getCells().forEach((cell) => values[cell.getColumn().id] = cell.newValue);
|
|
699
|
-
return values;
|
|
700
|
-
}
|
|
701
|
-
setData(data) {
|
|
702
|
-
this.data = data;
|
|
703
|
-
this.process();
|
|
704
|
-
}
|
|
705
|
-
process() {
|
|
706
|
-
this.cells = [];
|
|
707
|
-
this._dataSet.getColumns().forEach((column) => {
|
|
708
|
-
const cell = this.createCell(column);
|
|
709
|
-
this.cells.push(cell);
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
createCell(column) {
|
|
713
|
-
const defValue = column.settings.defaultValue ? column.settings.defaultValue : '';
|
|
714
|
-
const value = typeof this.data[column.id] === 'undefined' ? defValue : this.data[column.id];
|
|
715
|
-
return new Cell(value, this, column, this._dataSet);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
|
|
719
719
|
class DataSet {
|
|
720
720
|
constructor(data = [], columnSettings) {
|
|
721
721
|
this.columnSettings = columnSettings;
|
|
@@ -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, SmartTableOnChangedEventName };
|
|
3616
|
+
export { Cell, Column, DataSource, DefaultEditor, DefaultFilter, LocalDataSource, Ng2SmartTableComponent, Ng2SmartTableModule, Row, SmartTableOnChangedEventName };
|
|
3617
3617
|
//# sourceMappingURL=den4ik92-ng2-smart-table.mjs.map
|