wt-front-shared 1.0.65 → 1.0.66
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/esm2020/lib/core/+state/static-data/static-data.actions.mjs +1 -1
- package/esm2020/lib/core/+state/static-data/static-data.effects.mjs +4 -3
- package/esm2020/lib/core/+state/static-data/static-data.facade.mjs +31 -6
- package/esm2020/lib/core/+state/static-data/static-data.selectors.mjs +14 -2
- package/esm2020/lib/core/components/static-data/components/static-data-list-items/static-data-list-items.component.mjs +7 -9
- package/esm2020/lib/models/endpoints/static-data/static-data-get-list-categories/request/static-data-get-list-categories-request-config.mjs +1 -1
- package/esm2020/lib/models/endpoints/static-data/static-data-get-list-categories/request/static-data-get-list-categories-request.mjs +3 -2
- package/fesm2015/wt-front-shared.mjs +55 -17
- package/fesm2015/wt-front-shared.mjs.map +1 -1
- package/fesm2020/wt-front-shared.mjs +54 -17
- package/fesm2020/wt-front-shared.mjs.map +1 -1
- package/lib/core/+state/static-data/static-data.actions.d.ts +1 -0
- package/lib/core/+state/static-data/static-data.facade.d.ts +1 -0
- package/lib/core/+state/static-data/static-data.selectors.d.ts +2 -1
- package/lib/models/endpoints/static-data/static-data-get-list-categories/request/static-data-get-list-categories-request-config.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1197,7 +1197,8 @@ class StaticDataGetListCategoriesRequest extends GetRequest {
|
|
|
1197
1197
|
}
|
|
1198
1198
|
get url() {
|
|
1199
1199
|
const contentTypes = this.config.contentTypes;
|
|
1200
|
-
|
|
1200
|
+
const revisions = this.config.revisions;
|
|
1201
|
+
return `${this.domain}/api/static-data/list/?types=${contentTypes.join(',')}${revisions ? '&revisions=' + revisions.join(':') : ''}`;
|
|
1201
1202
|
}
|
|
1202
1203
|
get headers() {
|
|
1203
1204
|
return null;
|
|
@@ -6146,6 +6147,17 @@ const getStaticDataRevision = (contentType) => createSelector(getStaticDataState
|
|
|
6146
6147
|
}
|
|
6147
6148
|
return result;
|
|
6148
6149
|
});
|
|
6150
|
+
const getStaticDataRevisionsList = (contentTypes) => createSelector(getStaticDataState, (state) => {
|
|
6151
|
+
const preparedContentTypes = contentTypes.map(item => {
|
|
6152
|
+
const itemParameters = item.split('(');
|
|
6153
|
+
return itemParameters[0];
|
|
6154
|
+
});
|
|
6155
|
+
let result = null;
|
|
6156
|
+
if (state.list?.revisions?.list) {
|
|
6157
|
+
result = state.list?.revisions?.list.filter(item => preparedContentTypes.includes(item.slug));
|
|
6158
|
+
}
|
|
6159
|
+
return result;
|
|
6160
|
+
});
|
|
6149
6161
|
const getStaticData = (contentType, subSection, where) => createSelector(getStaticDataState, getLoaded$1(contentType, subSection), (state, isLoaded) => {
|
|
6150
6162
|
let list = isLoaded ? state.list[contentType]?.[subSection] : null;
|
|
6151
6163
|
if (where && list?.length) {
|
|
@@ -6184,7 +6196,8 @@ const staticDataQuery = {
|
|
|
6184
6196
|
getStaticDataMeta,
|
|
6185
6197
|
getStaticDataForListContentTypes,
|
|
6186
6198
|
getStaticDataRevision,
|
|
6187
|
-
getStaticDataRevisions
|
|
6199
|
+
getStaticDataRevisions,
|
|
6200
|
+
getStaticDataRevisionsList
|
|
6188
6201
|
};
|
|
6189
6202
|
|
|
6190
6203
|
class StaticDataFacade {
|
|
@@ -6208,6 +6221,9 @@ class StaticDataFacade {
|
|
|
6208
6221
|
}
|
|
6209
6222
|
getStaticDataRevision(contentType) {
|
|
6210
6223
|
return new Promise((resolve, reject) => {
|
|
6224
|
+
if (!contentType) {
|
|
6225
|
+
return resolve(null);
|
|
6226
|
+
}
|
|
6211
6227
|
this.store.pipe(select(staticDataQuery.getStaticDataRevision(contentType)))
|
|
6212
6228
|
.pipe(take(1))
|
|
6213
6229
|
.subscribe(revisionData => {
|
|
@@ -6215,6 +6231,24 @@ class StaticDataFacade {
|
|
|
6215
6231
|
});
|
|
6216
6232
|
});
|
|
6217
6233
|
}
|
|
6234
|
+
getStaticDataRevisions(contentTypes) {
|
|
6235
|
+
return new Promise((resolve, reject) => {
|
|
6236
|
+
if (!contentTypes?.length) {
|
|
6237
|
+
return resolve(null);
|
|
6238
|
+
}
|
|
6239
|
+
this.store.pipe(select(staticDataQuery.getStaticDataRevisionsList(contentTypes)))
|
|
6240
|
+
.pipe(take(1))
|
|
6241
|
+
.subscribe(revisions => {
|
|
6242
|
+
if (revisions?.length) {
|
|
6243
|
+
const revisionList = revisions.map(item => item.revision);
|
|
6244
|
+
resolve(revisionList || null);
|
|
6245
|
+
}
|
|
6246
|
+
else {
|
|
6247
|
+
resolve(null);
|
|
6248
|
+
}
|
|
6249
|
+
});
|
|
6250
|
+
});
|
|
6251
|
+
}
|
|
6218
6252
|
loadStaticData(contentType, params, subSection = 'list') {
|
|
6219
6253
|
const { where, fields, paging, sort, forPanel, search, keepState } = params;
|
|
6220
6254
|
this.getStaticDataRevision(contentType)
|
|
@@ -6306,11 +6340,15 @@ class StaticDataFacade {
|
|
|
6306
6340
|
}));
|
|
6307
6341
|
}
|
|
6308
6342
|
staticDataLoadCategories(contentTypes) {
|
|
6309
|
-
this.
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6343
|
+
this.getStaticDataRevisions(contentTypes)
|
|
6344
|
+
.then(revisions => {
|
|
6345
|
+
this.store.dispatch(StaticDataGetListCategories({
|
|
6346
|
+
payload: {
|
|
6347
|
+
contentTypes,
|
|
6348
|
+
revisions
|
|
6349
|
+
}
|
|
6350
|
+
}));
|
|
6351
|
+
});
|
|
6314
6352
|
}
|
|
6315
6353
|
}
|
|
6316
6354
|
StaticDataFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StaticDataFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -6542,9 +6580,10 @@ class StaticDataEffects extends BaseEffects {
|
|
|
6542
6580
|
.pipe(flatMap((r) => new StaticDataPatchUpdateBehavior(action, r).resolve()));
|
|
6543
6581
|
})));
|
|
6544
6582
|
this.staticDataGetListCategories$ = createEffect(() => this.actions$.pipe(ofType(StaticDataGetListCategories), switchMap$1((action) => {
|
|
6545
|
-
const { contentTypes } = action.payload;
|
|
6583
|
+
const { contentTypes, revisions } = action.payload;
|
|
6546
6584
|
const config = {
|
|
6547
|
-
contentTypes
|
|
6585
|
+
contentTypes,
|
|
6586
|
+
revisions
|
|
6548
6587
|
};
|
|
6549
6588
|
return this.staticDataService.getListCategories(config)
|
|
6550
6589
|
.pipe(flatMap((r) => new StaticDataGetListCategoriesBehavior(action, r).resolve()), catchError(error => of(StaticDataGetListCategoriesFail({
|
|
@@ -10809,12 +10848,10 @@ class StaticDataListItemsComponent {
|
|
|
10809
10848
|
this.staticSection = this.staticDataConfiguration[this.contentType];
|
|
10810
10849
|
if (this.staticSection) {
|
|
10811
10850
|
this.userRights$ = this.rightService.getUserRoleRightsForSection('static-data', this.contentType);
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
this.changeDetectorRef.markForCheck();
|
|
10817
|
-
}
|
|
10851
|
+
this.title = this.customTitle || this.staticSection?.title || '';
|
|
10852
|
+
this.loadStaticData();
|
|
10853
|
+
this.loadStaticDataMeta();
|
|
10854
|
+
this.changeDetectorRef.markForCheck();
|
|
10818
10855
|
}
|
|
10819
10856
|
else {
|
|
10820
10857
|
console.error('[ wt-front-shared ][ static-data-items ][ loadData ]', 'NOT_FOUND_STATIC_DATA_SECTION', { contentType: this.contentType });
|
|
@@ -10921,10 +10958,10 @@ class StaticDataListItemsComponent {
|
|
|
10921
10958
|
}
|
|
10922
10959
|
}
|
|
10923
10960
|
StaticDataListItemsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StaticDataListItemsComponent, deps: [{ token: i1$4.MatDialog }, { token: RightService }, { token: StaticDataFacade }, { token: i0.ChangeDetectorRef }, { token: RouterFacade }], target: i0.ɵɵFactoryTarget.Component });
|
|
10924
|
-
StaticDataListItemsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: StaticDataListItemsComponent, selector: "app-static-data-list-items", inputs: { staticDataConfiguration: "staticDataConfiguration", contentType: "contentType", customTitle: "customTitle", addTitle: "addTitle", parentSection: "parentSection", parentItemId: "parentItemId", showPanelHeader: "showPanelHeader", parentData: "parentData", parentSectionHashtag: "parentSectionHashtag", autoCompleteFields: "autoCompleteFields", filteringQuery: "filteringQuery" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }, { propertyName: "searchInput", first: true, predicate: ["search"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"(userRights$ | async) as userRights\">\n <ng-container *ngIf=\"(staticDataMeta$ | async) as staticDataObj\">\n <div class=\"page-layout simple fullwidth angular-material-elements\">\n <shared-panel-header *ngIf=\"showPanelHeader\" [title]=\"title\"></shared-panel-header>\n\n <h1>{{title}}</h1>\n <div class=\"content p-24\">\n <div *ngIf=\"staticSection.options?.search\" class=\"top-bar\">\n <div class=\"search-block\">\n \u041F\u043E\u0438\u0441\u043A: <input #search class=\"search-input\">\n <shared-button\n icon=\"search\"\n color=\"accent\"\n iconColor=\"black\"\n (click)=\"searchHandle(search.value)\"></shared-button>\n <div class=\"cancel-button\">\n <shared-button\n *ngIf=\"search.value\"\n icon=\"clear\"\n color=\"warn\"\n iconColor=\"black\"\n (click)=\"searchCancelHandle()\"></shared-button>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"staticData$ | async as staticData\">\n <div class=\"center-block p-10\">\n <app-static-data-items [items]=\"staticData\"\n [userRights]=\"userRights\"\n [staticSection]=\"staticSection\"\n [contentType]=\"contentType\"\n [queryParams]=\"queryParams\"\n (delete)=\"deleteEvent($event)\"></app-static-data-items>\n </div>\n <div *ngIf=\"staticDataObj.meta?.perPage !== -1\">\n <mat-paginator\n *ngIf=\"totalCount\"\n [length]=\"staticDataObj.meta
|
|
10961
|
+
StaticDataListItemsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: StaticDataListItemsComponent, selector: "app-static-data-list-items", inputs: { staticDataConfiguration: "staticDataConfiguration", contentType: "contentType", customTitle: "customTitle", addTitle: "addTitle", parentSection: "parentSection", parentItemId: "parentItemId", showPanelHeader: "showPanelHeader", parentData: "parentData", parentSectionHashtag: "parentSectionHashtag", autoCompleteFields: "autoCompleteFields", filteringQuery: "filteringQuery" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }, { propertyName: "searchInput", first: true, predicate: ["search"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"(userRights$ | async) as userRights\">\n <ng-container *ngIf=\"(staticDataMeta$ | async) as staticDataObj\">\n <div class=\"page-layout simple fullwidth angular-material-elements\">\n <shared-panel-header *ngIf=\"showPanelHeader\" [title]=\"title\"></shared-panel-header>\n\n <h1>{{title}}</h1>\n <div class=\"content p-24\">\n <div *ngIf=\"staticSection.options?.search\" class=\"top-bar\">\n <div class=\"search-block\">\n \u041F\u043E\u0438\u0441\u043A: <input #search class=\"search-input\">\n <shared-button\n icon=\"search\"\n color=\"accent\"\n iconColor=\"black\"\n (click)=\"searchHandle(search.value)\"></shared-button>\n <div class=\"cancel-button\">\n <shared-button\n *ngIf=\"search.value\"\n icon=\"clear\"\n color=\"warn\"\n iconColor=\"black\"\n (click)=\"searchCancelHandle()\"></shared-button>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"staticData$ | async as staticData\">\n <div class=\"center-block p-10\">\n <app-static-data-items [items]=\"staticData\"\n [userRights]=\"userRights\"\n [staticSection]=\"staticSection\"\n [contentType]=\"contentType\"\n [queryParams]=\"queryParams\"\n (delete)=\"deleteEvent($event)\"></app-static-data-items>\n </div>\n <div *ngIf=\"staticDataObj.meta?.perPage !== -1\">\n <mat-paginator\n *ngIf=\"totalCount\"\n [length]=\"staticDataObj.meta?.totalCount\"\n [pageIndex]=\"pageIndex\"\n [pageSizeOptions]=\"[10, 25, 100]\"\n (page)=\"changePage($event)\"></mat-paginator>\n </div>\n </ng-container>\n <div *ngIf=\"isLoaded && !totalCount\">\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0443\u0441\u0442</div>\n <div *ngIf=\"userRights[0]\" class=\"text-center mt-30 mb-30\">\n <shared-button\n id=\"go-to-create-form-button\"\n class=\"mr-5\"\n iconSize=\"small\"\n icon=\"add\"\n iconColor=\"white\"\n styleTheme=\"raised\"\n color=\"accent\"\n (click)=\"addHandle()\">{{ addTitle || '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C' }}\n </shared-button>\n </div>\n </div>\n <ng-container *ngIf=\"loaded$|async; let loaded;\">\n <shared-spinner *ngIf=\"!loaded\"></shared-spinner>\n </ng-container>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".top-bar{background:#c7deef;display:flex;justify-content:flex-end}.top-bar .search-block{display:flex;align-content:center;align-items:center}.top-bar .search-block .search-input{background-color:#adcde8!important;padding:11px 10px!important}.top-bar .search-block .cancel-button{width:64px;height:40px}\n"], dependencies: [{ kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6$3.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "component", type: SpinnerComponent, selector: "shared-spinner", inputs: ["overlay", "diameter", "color", "position"] }, { kind: "component", type: ButtonComponent, selector: "shared-button", inputs: ["icon", "iconColor", "iconSize", "rightIcon", "disabled", "loading", "active", "stopPropagation", "type", "color", "size", "styleTheme", "tooltip", "tooltipPosition"], outputs: ["clickButton"] }, { kind: "component", type: PanelHeaderComponent, selector: "shared-panel-header", inputs: ["title", "parentTitle", "parentUrl"] }, { kind: "component", type: StaticDataItemsComponent, selector: "app-static-data-items", inputs: ["items", "contentType", "queryParams", "userRights", "staticSection"], outputs: ["delete"] }, { kind: "pipe", type: i1$3.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10925
10962
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StaticDataListItemsComponent, decorators: [{
|
|
10926
10963
|
type: Component,
|
|
10927
|
-
args: [{ selector: 'app-static-data-list-items', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"(userRights$ | async) as userRights\">\n <ng-container *ngIf=\"(staticDataMeta$ | async) as staticDataObj\">\n <div class=\"page-layout simple fullwidth angular-material-elements\">\n <shared-panel-header *ngIf=\"showPanelHeader\" [title]=\"title\"></shared-panel-header>\n\n <h1>{{title}}</h1>\n <div class=\"content p-24\">\n <div *ngIf=\"staticSection.options?.search\" class=\"top-bar\">\n <div class=\"search-block\">\n \u041F\u043E\u0438\u0441\u043A: <input #search class=\"search-input\">\n <shared-button\n icon=\"search\"\n color=\"accent\"\n iconColor=\"black\"\n (click)=\"searchHandle(search.value)\"></shared-button>\n <div class=\"cancel-button\">\n <shared-button\n *ngIf=\"search.value\"\n icon=\"clear\"\n color=\"warn\"\n iconColor=\"black\"\n (click)=\"searchCancelHandle()\"></shared-button>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"staticData$ | async as staticData\">\n <div class=\"center-block p-10\">\n <app-static-data-items [items]=\"staticData\"\n [userRights]=\"userRights\"\n [staticSection]=\"staticSection\"\n [contentType]=\"contentType\"\n [queryParams]=\"queryParams\"\n (delete)=\"deleteEvent($event)\"></app-static-data-items>\n </div>\n <div *ngIf=\"staticDataObj.meta?.perPage !== -1\">\n <mat-paginator\n *ngIf=\"totalCount\"\n [length]=\"staticDataObj.meta
|
|
10964
|
+
args: [{ selector: 'app-static-data-list-items', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"(userRights$ | async) as userRights\">\n <ng-container *ngIf=\"(staticDataMeta$ | async) as staticDataObj\">\n <div class=\"page-layout simple fullwidth angular-material-elements\">\n <shared-panel-header *ngIf=\"showPanelHeader\" [title]=\"title\"></shared-panel-header>\n\n <h1>{{title}}</h1>\n <div class=\"content p-24\">\n <div *ngIf=\"staticSection.options?.search\" class=\"top-bar\">\n <div class=\"search-block\">\n \u041F\u043E\u0438\u0441\u043A: <input #search class=\"search-input\">\n <shared-button\n icon=\"search\"\n color=\"accent\"\n iconColor=\"black\"\n (click)=\"searchHandle(search.value)\"></shared-button>\n <div class=\"cancel-button\">\n <shared-button\n *ngIf=\"search.value\"\n icon=\"clear\"\n color=\"warn\"\n iconColor=\"black\"\n (click)=\"searchCancelHandle()\"></shared-button>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"staticData$ | async as staticData\">\n <div class=\"center-block p-10\">\n <app-static-data-items [items]=\"staticData\"\n [userRights]=\"userRights\"\n [staticSection]=\"staticSection\"\n [contentType]=\"contentType\"\n [queryParams]=\"queryParams\"\n (delete)=\"deleteEvent($event)\"></app-static-data-items>\n </div>\n <div *ngIf=\"staticDataObj.meta?.perPage !== -1\">\n <mat-paginator\n *ngIf=\"totalCount\"\n [length]=\"staticDataObj.meta?.totalCount\"\n [pageIndex]=\"pageIndex\"\n [pageSizeOptions]=\"[10, 25, 100]\"\n (page)=\"changePage($event)\"></mat-paginator>\n </div>\n </ng-container>\n <div *ngIf=\"isLoaded && !totalCount\">\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0443\u0441\u0442</div>\n <div *ngIf=\"userRights[0]\" class=\"text-center mt-30 mb-30\">\n <shared-button\n id=\"go-to-create-form-button\"\n class=\"mr-5\"\n iconSize=\"small\"\n icon=\"add\"\n iconColor=\"white\"\n styleTheme=\"raised\"\n color=\"accent\"\n (click)=\"addHandle()\">{{ addTitle || '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C' }}\n </shared-button>\n </div>\n </div>\n <ng-container *ngIf=\"loaded$|async; let loaded;\">\n <shared-spinner *ngIf=\"!loaded\"></shared-spinner>\n </ng-container>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".top-bar{background:#c7deef;display:flex;justify-content:flex-end}.top-bar .search-block{display:flex;align-content:center;align-items:center}.top-bar .search-block .search-input{background-color:#adcde8!important;padding:11px 10px!important}.top-bar .search-block .cancel-button{width:64px;height:40px}\n"] }]
|
|
10928
10965
|
}], ctorParameters: function () { return [{ type: i1$4.MatDialog }, { type: RightService }, { type: StaticDataFacade }, { type: i0.ChangeDetectorRef }, { type: RouterFacade }]; }, propDecorators: { staticDataConfiguration: [{
|
|
10929
10966
|
type: Input
|
|
10930
10967
|
}], contentType: [{
|