@sd-angular/core 1.0.1 → 1.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/bundles/sd-angular-core-grid-material.umd.js +60 -54
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/esm2015/grid-material/src/lib/grid-material.component.js +23 -22
- package/fesm2015/sd-angular-core-grid-material.js +22 -21
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/package.json +1 -1
- package/{sd-angular-core-1.0.1.tgz → sd-angular-core-1.0.2.tgz} +0 -0
|
@@ -1243,11 +1243,13 @@ class SdGridMaterial {
|
|
|
1243
1243
|
});
|
|
1244
1244
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
1245
1245
|
const { columns } = this.gridOption;
|
|
1246
|
+
const { rawColumnFilter, orderBy, orderDirection, pageSize, pageNumber } = filterInfo;
|
|
1246
1247
|
const items = localItems.filter(item => {
|
|
1247
1248
|
var _a, _b;
|
|
1248
1249
|
for (const column of columns) {
|
|
1249
|
-
const
|
|
1250
|
-
const
|
|
1250
|
+
const { field } = column;
|
|
1251
|
+
const filterValue = (rawColumnFilter[field] || '').toString().trim().toLowerCase();
|
|
1252
|
+
const columnValue = (item[field] || '').toString().trim().toLowerCase();
|
|
1251
1253
|
if (filterValue) {
|
|
1252
1254
|
if (!columnValue) {
|
|
1253
1255
|
return false;
|
|
@@ -1310,8 +1312,8 @@ class SdGridMaterial {
|
|
|
1310
1312
|
return true;
|
|
1311
1313
|
});
|
|
1312
1314
|
// Sort
|
|
1313
|
-
if (
|
|
1314
|
-
const column = columns.find(e => e.field ===
|
|
1315
|
+
if (orderBy && orderDirection) {
|
|
1316
|
+
const column = columns.find(e => e.field === orderBy);
|
|
1315
1317
|
if (column) {
|
|
1316
1318
|
const { type, field } = column;
|
|
1317
1319
|
items.sort((current, next) => {
|
|
@@ -1333,18 +1335,15 @@ class SdGridMaterial {
|
|
|
1333
1335
|
}
|
|
1334
1336
|
return 0;
|
|
1335
1337
|
});
|
|
1336
|
-
if (
|
|
1338
|
+
if (orderDirection === 'desc') {
|
|
1337
1339
|
items.reverse();
|
|
1338
1340
|
}
|
|
1339
1341
|
}
|
|
1340
1342
|
}
|
|
1341
1343
|
return {
|
|
1342
1344
|
items: items.filter((item, index) => {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
const pageSize = ((_b = __classPrivateFieldGet(this, _paginator)) === null || _b === void 0 ? void 0 : _b.pageSize) || ((_d = (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.paginate) === null || _d === void 0 ? void 0 : _d.pageSize) || 50;
|
|
1346
|
-
return index >= pageIndex * pageSize
|
|
1347
|
-
&& index < (pageIndex + 1) * pageSize;
|
|
1345
|
+
return index >= pageNumber * pageSize
|
|
1346
|
+
&& index < (pageNumber + 1) * pageSize;
|
|
1348
1347
|
}),
|
|
1349
1348
|
total: items.length
|
|
1350
1349
|
};
|
|
@@ -1361,7 +1360,7 @@ class SdGridMaterial {
|
|
|
1361
1360
|
pageSize: ((_j = __classPrivateFieldGet(this, _paginator)) === null || _j === void 0 ? void 0 : _j.pageSize) || ((_l = (_k = this.gridOption) === null || _k === void 0 ? void 0 : _k.paginate) === null || _l === void 0 ? void 0 : _l.pageSize) || 50
|
|
1362
1361
|
});
|
|
1363
1362
|
});
|
|
1364
|
-
_load$1.set(this, (filterReq) => __awaiter(this, void 0, void 0, function* () {
|
|
1363
|
+
_load$1.set(this, (filterReq, force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
1365
1364
|
this.isLoading = true;
|
|
1366
1365
|
try {
|
|
1367
1366
|
if (this.gridOption.type === 'server') {
|
|
@@ -1372,12 +1371,14 @@ class SdGridMaterial {
|
|
|
1372
1371
|
return yield result;
|
|
1373
1372
|
}
|
|
1374
1373
|
else {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1374
|
+
if (force) {
|
|
1375
|
+
const results = this.gridOption.items();
|
|
1376
|
+
if (results instanceof Promise) {
|
|
1377
|
+
this.localItems = yield results;
|
|
1378
|
+
}
|
|
1379
|
+
else {
|
|
1380
|
+
this.localItems = results;
|
|
1381
|
+
}
|
|
1381
1382
|
}
|
|
1382
1383
|
return __classPrivateFieldGet(this, _filterLocal).call(this, this.localItems, filterReq);
|
|
1383
1384
|
}
|
|
@@ -1901,7 +1902,7 @@ class SdGridMaterial {
|
|
|
1901
1902
|
__classPrivateFieldGet(this, _subscription$1).add(gridFilter.filterChange.pipe(debounceTime(200), map(() => {
|
|
1902
1903
|
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1903
1904
|
return __classPrivateFieldGet(this, _getFilter).call(this);
|
|
1904
|
-
}), switchMap(__classPrivateFieldGet(this, _load$1))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1905
|
+
}), switchMap(filterInfo => __classPrivateFieldGet(this, _load$1).call(this, filterInfo, false))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1905
1906
|
}
|
|
1906
1907
|
}
|
|
1907
1908
|
set option(option) {
|
|
@@ -1924,13 +1925,13 @@ class SdGridMaterial {
|
|
|
1924
1925
|
set paginator(paginator) {
|
|
1925
1926
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
1926
1927
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
1927
|
-
__classPrivateFieldGet(this, _subscription$1).add(paginator.page.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load$1))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1928
|
+
__classPrivateFieldGet(this, _subscription$1).add(paginator.page.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(filterInfo => __classPrivateFieldGet(this, _load$1).call(this, filterInfo, false))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1928
1929
|
}
|
|
1929
1930
|
}
|
|
1930
1931
|
set sort(sort) {
|
|
1931
1932
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
1932
1933
|
__classPrivateFieldSet(this, _sort, sort);
|
|
1933
|
-
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load$1))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1934
|
+
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(filterInfo => __classPrivateFieldGet(this, _load$1).call(this, filterInfo, false))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1934
1935
|
}
|
|
1935
1936
|
}
|
|
1936
1937
|
ngOnInit() {
|
|
@@ -1940,7 +1941,7 @@ class SdGridMaterial {
|
|
|
1940
1941
|
__classPrivateFieldGet(this, _subscription$1).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
1941
1942
|
__classPrivateFieldGet(this, _subscription$1).add(this.sdFooterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
1942
1943
|
__classPrivateFieldGet(this, _subscription$1).add(this.sdFilterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
1943
|
-
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).pipe(startWith({}), debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load$1))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1944
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).pipe(startWith({}), debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(filterInfo => __classPrivateFieldGet(this, _load$1).call(this, filterInfo, true))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1944
1945
|
this.ref.detectChanges();
|
|
1945
1946
|
}
|
|
1946
1947
|
ngOnDestroy() {
|