@colijnit/catalog 12.1.29 → 12.1.31
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/colijnit-catalog.umd.js +86 -50
- package/bundles/colijnit-catalog.umd.js.map +1 -1
- package/colijnit-catalog.metadata.json +1 -1
- package/esm2015/lib/catalog-version.js +3 -3
- package/esm2015/lib/component/catalog-filter/catalog-filter.component.js +66 -6
- package/esm2015/lib/model/catalog-filter-viewmodel.js +4 -0
- package/esm2015/lib/service/catalog-connector-adapter.service.js +2 -2
- package/esm2015/lib/service/catalog-connector.service.js +2 -2
- package/esm2015/lib/service/catalog-filter.service.js +26 -12
- package/esm2015/lib/service/catalog-search.service.js +3 -3
- package/esm2015/lib/service/catalog.service.js +6 -6
- package/fesm2015/colijnit-catalog.js +97 -45
- package/fesm2015/colijnit-catalog.js.map +1 -1
- package/lib/component/catalog-filter/catalog-filter.component.d.ts +8 -3
- package/lib/model/catalog-filter-viewmodel.d.ts +4 -0
- package/lib/service/catalog-filter.service.d.ts +4 -2
- package/lib/service/catalog-search.service.d.ts +2 -2
- package/lib/service/catalog.service.d.ts +1 -1
- package/package.json +3 -18
- package/esm2015/lib/model/filter-item.viewmodel.js +0 -10
- package/esm2015/lib/model/filter-viewmodel.js +0 -12
- package/lib/model/filter-item.viewmodel.d.ts +0 -9
- package/lib/model/filter-viewmodel.d.ts +0 -8
|
@@ -7,18 +7,18 @@ import { StringUtils } from '@colijnit/ioneconnector/build/utils/string-utils';
|
|
|
7
7
|
import { ArticleCategory } from '@colijnit/articleapi/build/model/article-category';
|
|
8
8
|
import { CatalogDefinition } from '@colijnit/articleapi/build/model/catalog-definition.bo';
|
|
9
9
|
import { ExternalSource } from '@colijnit/articleapi/build/model/external-source.bo';
|
|
10
|
-
import { BusinessObjectFactory } from '@colijnit/ioneconnector/build/factory/business-object-factory';
|
|
11
10
|
import { Articles } from '@colijnit/articleapi/build/articles';
|
|
12
11
|
import { ArticleExtended } from '@colijnit/articleapi/build/model/article-extended.bo';
|
|
13
12
|
import { ArticleSearchFilterSelections } from '@colijnit/articleapi/build/model/article-search-filter-selections';
|
|
14
13
|
import { ArticleSearchFilterMaxAndMinPrice } from '@colijnit/articleapi/build/model/article-search-filter-max-and-min-price';
|
|
15
14
|
import { ArticlePrice } from '@colijnit/articleapi/build/model/article-price';
|
|
16
15
|
import { GetArticlePriceRequest } from '@colijnit/articleapi/build/model/get-article-price-request';
|
|
16
|
+
import { BusinessObjectFactory } from '@colijnit/ioneconnector/build/service/business-object-factory';
|
|
17
17
|
import { ObjectUtils } from '@colijnit/ioneconnector/build/utils/object-utils';
|
|
18
18
|
import { FileUtils } from '@colijnit/ioneconnector/build/utils/file-utils';
|
|
19
|
+
import { FilterViewmodel, InputTextModule, FilterItemModule, InputDatePickerModule, IconCollapseHandleModule, ImageModule, IconModule as IconModule$1, OverlayModule, InputSearchModule, PaginationBarModule } from '@colijnit/corecomponents_v12';
|
|
19
20
|
import { ArticleExtendedRequest } from '@colijnit/articleapi/build/model/article-extended-request';
|
|
20
21
|
import { PagingParameters } from '@colijnit/ioneconnector/build/model/paging-parameters';
|
|
21
|
-
import { InputTextModule, FilterItemModule, InputDatePickerModule, IconCollapseHandleModule, ImageModule, IconModule as IconModule$1, OverlayModule, InputSearchModule, PaginationBarModule } from '@colijnit/corecomponents_v12';
|
|
22
22
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
23
23
|
import { SliderComponent, IconModule, PriceDisplayPipeModule, ButtonModule, ImageModule as ImageModule$1 } from '@colijnit/corecomponents';
|
|
24
24
|
import * as i1 from '@angular/platform-browser';
|
|
@@ -29,8 +29,8 @@ class Version {
|
|
|
29
29
|
constructor() {
|
|
30
30
|
this.name = "@colijnit/catalog";
|
|
31
31
|
this.description = "iOne Catalog module based on Angular 12";
|
|
32
|
-
this.symVer = "12.1.
|
|
33
|
-
this.publishDate = "22-
|
|
32
|
+
this.symVer = "12.1.31";
|
|
33
|
+
this.publishDate = "22-6-2023 16:01:31";
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -1339,25 +1339,7 @@ CatalogImageService.ctorParameters = () => [
|
|
|
1339
1339
|
{ type: CatalogConnectorService }
|
|
1340
1340
|
];
|
|
1341
1341
|
|
|
1342
|
-
class
|
|
1343
|
-
constructor(code, description, count, filter) {
|
|
1344
|
-
this.checked = false;
|
|
1345
|
-
this.code = code;
|
|
1346
|
-
this.description = description;
|
|
1347
|
-
this.count = count;
|
|
1348
|
-
this.filter = filter;
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
class FilterViewmodel {
|
|
1353
|
-
constructor(filter) {
|
|
1354
|
-
this.expanded = false;
|
|
1355
|
-
this.filterItems = [];
|
|
1356
|
-
this.filterName = filter.filterName;
|
|
1357
|
-
filter.selectionDTOS.forEach((s) => {
|
|
1358
|
-
this.filterItems.push(new FilterItemViewmodel(s.code, s.description, s.count, filter));
|
|
1359
|
-
});
|
|
1360
|
-
}
|
|
1342
|
+
class CatalogFilterViewmodel extends FilterViewmodel {
|
|
1361
1343
|
}
|
|
1362
1344
|
|
|
1363
1345
|
class CatalogFilterService {
|
|
@@ -1388,43 +1370,43 @@ class CatalogFilterService {
|
|
|
1388
1370
|
const filterProms = [];
|
|
1389
1371
|
filterProms.push(this._iOneController.getCatalogFilter(filters).then((filter) => {
|
|
1390
1372
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1391
|
-
newFilters.push(
|
|
1373
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Catalog'));
|
|
1392
1374
|
}
|
|
1393
1375
|
}), this._iOneController.getArticleGroupsFilter(filters).then((filter) => {
|
|
1394
1376
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1395
|
-
newFilters.push(
|
|
1377
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Product group'));
|
|
1396
1378
|
}
|
|
1397
1379
|
}), this._iOneController.getAtmosphereFilter(filters).then((filter) => {
|
|
1398
1380
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1399
|
-
newFilters.push(
|
|
1381
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Atmosphere'));
|
|
1400
1382
|
}
|
|
1401
1383
|
}), this._iOneController.getColorFilter(filters).then((filter) => {
|
|
1402
1384
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1403
|
-
newFilters.push(
|
|
1385
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Colour'));
|
|
1404
1386
|
}
|
|
1405
1387
|
}), this._iOneController.getConceptFilter(filters).then((filter) => {
|
|
1406
1388
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1407
|
-
newFilters.push(
|
|
1389
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Concept'));
|
|
1408
1390
|
}
|
|
1409
1391
|
}), this._iOneController.getDesignFilter(filters).then((filter) => {
|
|
1410
1392
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1411
|
-
newFilters.push(
|
|
1393
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Design'));
|
|
1412
1394
|
}
|
|
1413
1395
|
}), this._iOneController.getMainArticleFilter(filters).then((filter) => {
|
|
1414
1396
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1415
|
-
newFilters.push(
|
|
1397
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Main article'));
|
|
1416
1398
|
}
|
|
1417
1399
|
}), this._iOneController.getMaterialFilter(filters).then((filter) => {
|
|
1418
1400
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1419
|
-
newFilters.push(
|
|
1401
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Material'));
|
|
1420
1402
|
}
|
|
1421
1403
|
}), this._iOneController.getTagsFilter(filters).then((filter) => {
|
|
1422
1404
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1423
|
-
newFilters.push(
|
|
1405
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Tag'));
|
|
1424
1406
|
}
|
|
1425
1407
|
}), this._iOneController.getTurnoverGroupFilter(filters).then((filter) => {
|
|
1426
1408
|
if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
|
|
1427
|
-
newFilters.push(
|
|
1409
|
+
newFilters.push(this.createNewFiltersAndCopySelections(filter, 'Turnover group'));
|
|
1428
1410
|
}
|
|
1429
1411
|
}));
|
|
1430
1412
|
Promise.all(filterProms).then(() => {
|
|
@@ -1432,6 +1414,20 @@ class CatalogFilterService {
|
|
|
1432
1414
|
this.filters = newFilters;
|
|
1433
1415
|
});
|
|
1434
1416
|
}
|
|
1417
|
+
createNewFiltersAndCopySelections(filter, key) {
|
|
1418
|
+
let newModel = new CatalogFilterViewmodel(filter.selectionDTOS, { text: 'description', value: 'code' });
|
|
1419
|
+
newModel.filterName = filter.filterName;
|
|
1420
|
+
let oldModel = this.filters.find(element => element.filterName === key);
|
|
1421
|
+
if (oldModel) {
|
|
1422
|
+
for (const oldFilter of oldModel.filterItems) {
|
|
1423
|
+
let newFilter = newModel.filterItems.find(element => element.code === oldFilter.code);
|
|
1424
|
+
if (newFilter) {
|
|
1425
|
+
newFilter.checked = oldFilter.checked;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
return newModel;
|
|
1430
|
+
}
|
|
1435
1431
|
getFilterItemMap(key) {
|
|
1436
1432
|
return this.filterItemMap.get(key);
|
|
1437
1433
|
}
|
|
@@ -1506,13 +1502,13 @@ class CatalogSearchService {
|
|
|
1506
1502
|
ngOnDestroy() {
|
|
1507
1503
|
this._subs.forEach(s => s.unsubscribe());
|
|
1508
1504
|
}
|
|
1509
|
-
filterOnCollection(collection) {
|
|
1505
|
+
filterOnCollection(filterName, collection) {
|
|
1510
1506
|
if (!collection || collection.length === 0) {
|
|
1511
1507
|
return;
|
|
1512
1508
|
}
|
|
1513
1509
|
let cleared = false;
|
|
1514
1510
|
let filterRange = [];
|
|
1515
|
-
const searchFilterProp = this._filterService.getFilterItemMap(
|
|
1511
|
+
const searchFilterProp = this._filterService.getFilterItemMap(filterName);
|
|
1516
1512
|
if (searchFilterProp) {
|
|
1517
1513
|
collection.forEach((viewModel) => {
|
|
1518
1514
|
if (!cleared) {
|
|
@@ -1629,9 +1625,9 @@ class CatalogService {
|
|
|
1629
1625
|
this._controllerInitialized = true;
|
|
1630
1626
|
// this.ensureDataListsLoaded();
|
|
1631
1627
|
this.articlesPerPage = this._settingsService.settings.options.maxItemsPerPage;
|
|
1632
|
-
if (this._settingsService.settings.options.searchOnStart) {
|
|
1633
|
-
|
|
1634
|
-
}
|
|
1628
|
+
// if (this._settingsService.settings.options.searchOnStart) {
|
|
1629
|
+
// this._catalogSearchService.searchArticles();
|
|
1630
|
+
// }
|
|
1635
1631
|
}
|
|
1636
1632
|
})), this.optionsService.parametersSet.subscribe((set) => {
|
|
1637
1633
|
if (set) {
|
|
@@ -1699,10 +1695,10 @@ class CatalogService {
|
|
|
1699
1695
|
ngOnDestroy() {
|
|
1700
1696
|
this._subs.forEach(s => s.unsubscribe());
|
|
1701
1697
|
}
|
|
1702
|
-
init(settings) {
|
|
1698
|
+
init(settings, forceReload = false) {
|
|
1703
1699
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1704
1700
|
yield this.settingsService.initializeSettings(settings);
|
|
1705
|
-
yield this.connector.initConnector(this.settingsService.settings);
|
|
1701
|
+
yield this.connector.initConnector(this.settingsService.settings, forceReload);
|
|
1706
1702
|
});
|
|
1707
1703
|
}
|
|
1708
1704
|
getCategories() {
|
|
@@ -1928,18 +1924,26 @@ IconCacheService.ctorParameters = () => [
|
|
|
1928
1924
|
];
|
|
1929
1925
|
|
|
1930
1926
|
class CatalogFilterComponent {
|
|
1931
|
-
constructor(catalogSearchService, filterService, iconCache, optionsService, changeDetector) {
|
|
1927
|
+
constructor(catalogSearchService, filterService, iconCache, optionsService, changeDetector, _catalogConnectorService) {
|
|
1932
1928
|
this.catalogSearchService = catalogSearchService;
|
|
1933
1929
|
this.filterService = filterService;
|
|
1934
1930
|
this.iconCache = iconCache;
|
|
1935
1931
|
this.optionsService = optionsService;
|
|
1936
1932
|
this.changeDetector = changeDetector;
|
|
1933
|
+
this._catalogConnectorService = _catalogConnectorService;
|
|
1937
1934
|
this.icons = IconEnum;
|
|
1938
1935
|
this.showResetFilter = true;
|
|
1939
1936
|
this.collapsed = false;
|
|
1940
1937
|
this._subs = [];
|
|
1941
1938
|
this._min = 0;
|
|
1942
1939
|
this._max = 100000;
|
|
1940
|
+
this.loadArticles = (numberFilter) => __awaiter(this, void 0, void 0, function* () {
|
|
1941
|
+
const request = new ArticleExtendedRequest();
|
|
1942
|
+
request.articleNumber = numberFilter;
|
|
1943
|
+
return this._catalogConnectorService.getArticlesForCatalog(request).then((articleResult) => {
|
|
1944
|
+
return new FilterViewmodel(articleResult.articles, { text: 'articleNumber', value: 'articleNumber' }).filterItems;
|
|
1945
|
+
});
|
|
1946
|
+
});
|
|
1943
1947
|
// this._subs = [
|
|
1944
1948
|
// this.catalog.onPrepareFilters.subscribe(() => {
|
|
1945
1949
|
// this.setupFilters();
|
|
@@ -2006,8 +2010,18 @@ class CatalogFilterComponent {
|
|
|
2006
2010
|
this.catalogSearchService.searchRequest.rangePrice = `${trueLowerBound} - ${trueUpperBound}`;
|
|
2007
2011
|
this.catalogSearchService.searchArticles();
|
|
2008
2012
|
}
|
|
2009
|
-
handleCollectionChange(collection) {
|
|
2010
|
-
this.catalogSearchService.filterOnCollection(collection);
|
|
2013
|
+
handleCollectionChange(filterName, collection) {
|
|
2014
|
+
this.catalogSearchService.filterOnCollection(filterName, collection);
|
|
2015
|
+
}
|
|
2016
|
+
handleCollectionChangeForSingleSelect(collection, modelName) {
|
|
2017
|
+
this.catalogSearchService.searchRequest[modelName] = this._getFilterRequestForSingleSelect(collection);
|
|
2018
|
+
this.catalogSearchService.searchArticles();
|
|
2019
|
+
}
|
|
2020
|
+
_getFilterRequestForSingleSelect(collection) {
|
|
2021
|
+
let filterRequest = '';
|
|
2022
|
+
const selectedItem = collection === null || collection === void 0 ? void 0 : collection.find(item => item.checked);
|
|
2023
|
+
filterRequest = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.code.toString();
|
|
2024
|
+
return filterRequest;
|
|
2011
2025
|
}
|
|
2012
2026
|
detectChanges() {
|
|
2013
2027
|
if (!this._destroyed) {
|
|
@@ -2070,6 +2084,43 @@ CatalogFilterComponent.decorators = [
|
|
|
2070
2084
|
></co-input-date>
|
|
2071
2085
|
</co-filter-item>
|
|
2072
2086
|
</div>
|
|
2087
|
+
<div class="filter-item-wrapper">
|
|
2088
|
+
<co-filter-item [placeholder]="'DESCRIPTION_ARTICLE' | localize"
|
|
2089
|
+
[expanded]="true"
|
|
2090
|
+
[customContent]="true"
|
|
2091
|
+
>
|
|
2092
|
+
<co-input-text [placeholder]="'DESCRIPTION' | localize" [(model)]="catalogSearchService.searchRequest.description"
|
|
2093
|
+
noValidation></co-input-text>
|
|
2094
|
+
</co-filter-item>
|
|
2095
|
+
</div>
|
|
2096
|
+
<div class="filter-item-wrapper">
|
|
2097
|
+
<co-filter-item [placeholder]="'SALES_DESCRIPTION' | localize"
|
|
2098
|
+
[expanded]="true"
|
|
2099
|
+
[customContent]="true"
|
|
2100
|
+
>
|
|
2101
|
+
<co-input-text [placeholder]="'DESCRIPTION' | localize" [(model)]="catalogSearchService.searchRequest.salesDescription"
|
|
2102
|
+
noValidation></co-input-text>
|
|
2103
|
+
</co-filter-item>
|
|
2104
|
+
</div>
|
|
2105
|
+
<div class="filter-item-wrapper">
|
|
2106
|
+
<co-filter-item [placeholder]="'NAME' | localize"
|
|
2107
|
+
[expanded]="true"
|
|
2108
|
+
[customContent]="true"
|
|
2109
|
+
>
|
|
2110
|
+
<co-input-text [placeholder]="'NAME' | localize" [(model)]="catalogSearchService.searchRequest.name"
|
|
2111
|
+
noValidation></co-input-text>
|
|
2112
|
+
</co-filter-item>
|
|
2113
|
+
</div>
|
|
2114
|
+
<div class="filter-item-wrapper">
|
|
2115
|
+
<co-filter-item
|
|
2116
|
+
[placeholder]="'ARTICLE_NR'| localize"
|
|
2117
|
+
[searchPlaceholder]="'NUMBER' | localize"
|
|
2118
|
+
[singleSelect]="true"
|
|
2119
|
+
[minSearchCharsToLoadCollection]="3"
|
|
2120
|
+
[collectionLoadFn]="loadArticles"
|
|
2121
|
+
(collectionChange)="handleCollectionChangeForSingleSelect($event, 'articleNumber')">
|
|
2122
|
+
</co-filter-item>
|
|
2123
|
+
</div>
|
|
2073
2124
|
<div class="filter-item-wrapper" *ngFor="let filter of filterService.filters">
|
|
2074
2125
|
<co-filter-item
|
|
2075
2126
|
[placeholder]="filter.filterName"
|
|
@@ -2079,7 +2130,7 @@ CatalogFilterComponent.decorators = [
|
|
|
2079
2130
|
[searchPlaceholder]="'Zoeken...'"
|
|
2080
2131
|
[expanded]=true
|
|
2081
2132
|
[initialLimit]=5
|
|
2082
|
-
(collectionChange)="handleCollectionChange($event)"
|
|
2133
|
+
(collectionChange)="handleCollectionChange(filter.filterName, $event)"
|
|
2083
2134
|
></co-filter-item>
|
|
2084
2135
|
</div>
|
|
2085
2136
|
</div>
|
|
@@ -2100,7 +2151,8 @@ CatalogFilterComponent.ctorParameters = () => [
|
|
|
2100
2151
|
{ type: CatalogFilterService },
|
|
2101
2152
|
{ type: IconCacheService },
|
|
2102
2153
|
{ type: CatalogOptionsService },
|
|
2103
|
-
{ type: ChangeDetectorRef }
|
|
2154
|
+
{ type: ChangeDetectorRef },
|
|
2155
|
+
{ type: CatalogConnectorService }
|
|
2104
2156
|
];
|
|
2105
2157
|
CatalogFilterComponent.propDecorators = {
|
|
2106
2158
|
priceSlider: [{ type: ViewChild, args: [SliderComponent, { static: true },] }],
|