@pepperi-addons/ngx-composite-lib 0.0.4 → 0.0.8
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/pepperi-addons-ngx-composite-lib-color-settings.umd.js +1 -1
- package/bundles/pepperi-addons-ngx-composite-lib-color-settings.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js +585 -0
- package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js.map +1 -0
- package/esm2015/color-settings/color-settings.component.js +2 -2
- package/esm2015/generic-list/generic-list.component.js +164 -0
- package/esm2015/generic-list/generic-list.model.js +2 -0
- package/esm2015/generic-list/generic-list.module.js +52 -0
- package/esm2015/generic-list/pepperi-addons-ngx-composite-lib-generic-list.js +5 -0
- package/esm2015/generic-list/public-api.js +7 -0
- package/fesm2015/pepperi-addons-ngx-composite-lib-color-settings.js +1 -1
- package/fesm2015/pepperi-addons-ngx-composite-lib-color-settings.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js +222 -0
- package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js.map +1 -0
- package/generic-list/generic-list.component.d.ts +45 -0
- package/generic-list/generic-list.model.d.ts +11 -0
- package/generic-list/generic-list.module.d.ts +15 -0
- package/generic-list/package.json +14 -0
- package/generic-list/pepperi-addons-ngx-composite-lib-generic-list.d.ts +5 -0
- package/generic-list/public-api.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Component, ViewChild, Input, Output, NgModule } from '@angular/core';
|
|
3
|
+
import * as i7 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { __awaiter } from 'tslib';
|
|
6
|
+
import * as i1 from '@pepperi-addons/ngx-lib';
|
|
7
|
+
import { PepRowData, PepGuid, PepNgxLibModule } from '@pepperi-addons/ngx-lib';
|
|
8
|
+
import * as i5 from '@pepperi-addons/ngx-lib/list';
|
|
9
|
+
import { PepListComponent, PepListModule } from '@pepperi-addons/ngx-lib/list';
|
|
10
|
+
import { DataViewFieldTypes } from '@pepperi-addons/papi-sdk/dist/entities/data-view';
|
|
11
|
+
import * as i2 from '@ngx-translate/core';
|
|
12
|
+
import * as i3 from '@pepperi-addons/ngx-lib/page-layout';
|
|
13
|
+
import { PepPageLayoutModule } from '@pepperi-addons/ngx-lib/page-layout';
|
|
14
|
+
import * as i4 from '@pepperi-addons/ngx-lib/top-bar';
|
|
15
|
+
import { PepTopBarModule } from '@pepperi-addons/ngx-lib/top-bar';
|
|
16
|
+
import * as i6 from '@pepperi-addons/ngx-lib/search';
|
|
17
|
+
import { PepSearchModule } from '@pepperi-addons/ngx-lib/search';
|
|
18
|
+
import { PepFormModule } from '@pepperi-addons/ngx-lib/form';
|
|
19
|
+
import { PepMenuModule } from '@pepperi-addons/ngx-lib/menu';
|
|
20
|
+
|
|
21
|
+
class GenericListComponent {
|
|
22
|
+
// PepScreenSizeType = PepScreenSizeType;
|
|
23
|
+
// screenSize: PepScreenSizeType;
|
|
24
|
+
constructor(dataConvertorService, layoutService, translate) {
|
|
25
|
+
this.dataConvertorService = dataConvertorService;
|
|
26
|
+
this.layoutService = layoutService;
|
|
27
|
+
this.translate = translate;
|
|
28
|
+
this.dataObjects = [];
|
|
29
|
+
this.searchString = '';
|
|
30
|
+
this.addPadding = false;
|
|
31
|
+
this.title = '';
|
|
32
|
+
this.inline = false;
|
|
33
|
+
this.showSearch = false;
|
|
34
|
+
this.allowSelection = true;
|
|
35
|
+
this.noDataMessage = "No data";
|
|
36
|
+
this.allowMultipleSelection = false;
|
|
37
|
+
this.fieldClick = new EventEmitter();
|
|
38
|
+
// @Output()
|
|
39
|
+
// onAddClicked = new EventEmitter<void>();
|
|
40
|
+
this.menuHandlers = {};
|
|
41
|
+
this.menuActions = [];
|
|
42
|
+
this.layoutService.onResize$.pipe().subscribe((size) => {
|
|
43
|
+
// this.screenSize = size;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
loadMenuItems() {
|
|
47
|
+
if (this.allowSelection) {
|
|
48
|
+
this.getMenuActions().then(x => this.menuActions = x);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
convertToPepRowData(object, dataView) {
|
|
52
|
+
const row = new PepRowData();
|
|
53
|
+
row.Fields = [];
|
|
54
|
+
if ((dataView === null || dataView === void 0 ? void 0 : dataView.Fields) && dataView.Columns) {
|
|
55
|
+
for (let index = 0; index < dataView.Fields.length; index++) {
|
|
56
|
+
let field = dataView.Fields[index];
|
|
57
|
+
row.Fields.push({
|
|
58
|
+
ApiName: field.FieldID,
|
|
59
|
+
Title: this.translate.instant(field.Title),
|
|
60
|
+
XAlignment: 1,
|
|
61
|
+
FormattedValue: (object[field.FieldID] || '').toString(),
|
|
62
|
+
Value: (object[field.FieldID] || '').toString(),
|
|
63
|
+
ColumnWidth: dataView.Columns[index].Width,
|
|
64
|
+
AdditionalValue: '',
|
|
65
|
+
OptionalValues: [],
|
|
66
|
+
FieldType: DataViewFieldTypes[field.Type],
|
|
67
|
+
ReadOnly: field.ReadOnly,
|
|
68
|
+
Enabled: !field.ReadOnly
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return row;
|
|
73
|
+
}
|
|
74
|
+
getMenuActions() {
|
|
75
|
+
var _a;
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const actions = yield ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.getActions(this.getMenuObjects()));
|
|
78
|
+
const res = [];
|
|
79
|
+
this.menuHandlers = {};
|
|
80
|
+
actions === null || actions === void 0 ? void 0 : actions.forEach(item => {
|
|
81
|
+
const uuid = PepGuid.newGuid();
|
|
82
|
+
this.menuHandlers[uuid] = item.handler;
|
|
83
|
+
res.push({
|
|
84
|
+
key: uuid,
|
|
85
|
+
text: item.title
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return res;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
getMenuObjects() {
|
|
92
|
+
var _a, _b, _c;
|
|
93
|
+
let uuids = (_b = (_a = this.customList) === null || _a === void 0 ? void 0 : _a.getSelectedItemsData().rows) !== null && _b !== void 0 ? _b : [];
|
|
94
|
+
if ((_c = this.customList) === null || _c === void 0 ? void 0 : _c.getIsAllSelectedForActions()) {
|
|
95
|
+
uuids = this.dataObjects.map(obj => obj.UID).filter(x => uuids.indexOf(x) != -1);
|
|
96
|
+
}
|
|
97
|
+
const objects = uuids.map(uuid => this.getObject(uuid));
|
|
98
|
+
return objects;
|
|
99
|
+
}
|
|
100
|
+
getObject(uuid) {
|
|
101
|
+
return this.dataObjects.find(obj => obj.UID === uuid);
|
|
102
|
+
}
|
|
103
|
+
ngOnInit() {
|
|
104
|
+
}
|
|
105
|
+
ngAfterViewInit() {
|
|
106
|
+
this.reload();
|
|
107
|
+
}
|
|
108
|
+
onMenuItemClicked(action) {
|
|
109
|
+
this.menuHandlers[action.source.key](this.getMenuObjects());
|
|
110
|
+
}
|
|
111
|
+
onSearchChanged(event) {
|
|
112
|
+
this.searchString = event.value;
|
|
113
|
+
this.reload();
|
|
114
|
+
}
|
|
115
|
+
reload() {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
if (this.customList && this.dataSource) {
|
|
118
|
+
this.dataObjects = yield this.dataSource.getList({
|
|
119
|
+
searchString: this.searchString
|
|
120
|
+
});
|
|
121
|
+
const dataView = yield this.dataSource.getDataView();
|
|
122
|
+
const tableData = this.dataObjects.map(x => this.convertToPepRowData(x, dataView));
|
|
123
|
+
const data = this.dataConvertorService.convertListData(tableData);
|
|
124
|
+
data.forEach((obj, i) => {
|
|
125
|
+
this.dataObjects[i].UID = obj.UID;
|
|
126
|
+
});
|
|
127
|
+
const uiControl = this.dataConvertorService.getUiControl(tableData[0]);
|
|
128
|
+
this.customList.initListData(uiControl, data.length, data);
|
|
129
|
+
this.loadMenuItems();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
selectedRowsChanged(selectedRowsCount) {
|
|
134
|
+
this.loadMenuItems();
|
|
135
|
+
}
|
|
136
|
+
onCustomizeFieldClick(fieldClickEvent) {
|
|
137
|
+
this.fieldClick.emit(fieldClickEvent);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
GenericListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: GenericListComponent, deps: [{ token: i1.PepDataConvertorService }, { token: i1.PepLayoutService }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
141
|
+
GenericListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.5", type: GenericListComponent, selector: "pep-generic-list", inputs: { dataSource: "dataSource", addPadding: "addPadding", title: "title", inline: "inline", showSearch: "showSearch", allowSelection: "allowSelection", noDataMessage: "noDataMessage", allowMultipleSelection: "allowMultipleSelection" }, outputs: { fieldClick: "fieldClick" }, viewQueries: [{ propertyName: "customList", first: true, predicate: PepListComponent, descendants: true }], ngImport: i0, template: "<div *ngIf=\"inline\" class=\"inline-container\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"listTemplate\"></ng-container>\n</div>\n\n<pep-page-layout *ngIf=\"!inline\" [addPadding]=\"addPadding\">\n <ng-container pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n\n <div pep-main-area class=\"main-area-container\">\n <ng-container *ngTemplateOutlet=\"listTemplate\"></ng-container>\n </div>\n</pep-page-layout>\n \n<ng-template #topBarTemplate>\n <pep-top-bar [title]=\"title\" [inline]=\"inline\">\n <div header-start-content>\n <ng-content select=\"[left-buttons]\"></ng-content>\n </div>\n <div header-end-content>\n <ng-content select=\"[right-buttons]\"></ng-content>\n </div>\n <pep-list-actions [sizeType]=\"inline ? 'sm' : 'md'\" [actions]=\"menuActions\" (actionClick)=\"onMenuItemClicked($event)\"></pep-list-actions>\n <pep-list-total [sizeType]=\"inline ? 'sm' : 'md'\" [totalRows]=\"customList ? customList.totalRows : -1\"></pep-list-total>\n\n <pep-search *ngIf=\"showSearch\" [sizeType]=\"inline ? 'sm' : 'md'\" (search)=\"onSearchChanged($event)\">\n </pep-search>\n </pep-top-bar>\n</ng-template>\n\n<ng-template #listTemplate>\n <pep-list viewType=\"table\" [supportSorting]=\"false\"\n [selectionTypeForActions]=\"allowMultipleSelection ? 'multi' : (allowSelection ? 'single' : 'none')\" [noDataFoundMsg]=\"noDataMessage\"\n (fieldClick)=\"onCustomizeFieldClick($event)\"\n (selectedItemsChange)=\"selectedRowsChanged($event)\">\n </pep-list>\n</ng-template>", styles: [":host{height:inherit;display:block}.main-area-container{display:grid;height:inherit}.list-container{height:100%}.inline-container{height:inherit;display:grid;grid-template-rows:auto 1fr}.inline-container.add-padding{padding-inline:var(--pep-spacing-lg, 1rem)}.inline-container ::ng-deep .pep-top-bar-container.inline{height:auto;overflow:hidden}\n"], components: [{ type: i3.PepPageLayoutComponent, selector: "pep-page-layout", inputs: ["addPadding", "showShadow"] }, { type: i4.PepTopBarComponent, selector: "pep-top-bar", inputs: ["inline", "title"], outputs: ["footerStateChange"] }, { type: i5.PepListActionsComponent, selector: "pep-list-actions", inputs: ["actions", "sizeType", "xPosition", "hidden"], outputs: ["actionClick", "stateChange", "menuClick"] }, { type: i5.PepListTotalComponent, selector: "pep-list-total", inputs: ["totalRows", "totalAmount", "isMapView", "sizeType"] }, { type: i6.PepSearchComponent, selector: "pep-search", inputs: ["triggerOn", "autoCompleteTop", "shrinkInSmallScreen", "sizeType", "autoCompleteValues", "value", "searchControl", "useAsWebComponent"], outputs: ["search", "autocompleteChange", "stateChange"] }, { type: i5.PepListComponent, selector: "pep-list", inputs: ["noDataFoundMsg", "selectionTypeForActions", "showCardSelection", "hideAllSelectionInMulti", "cardSize", "firstFieldAsLink", "supportSorting", "supportResizing", "disabled", "lockItemInnerEvents", "printMode", "isReport", "totalsRow", "pagerType", "pageSize", "pageIndex", "scrollAnimationTime", "scrollDebounceTime", "scrollThrottlingTime", "viewType", "parentScroll", "lockEvents", "useAsWebComponent"], outputs: ["itemClick", "fieldClick", "valueChange", "sortingChange", "selectedItemsChange", "selectedItemChange", "selectAllClick", "listLoad", "loadItems", "loadPage", "startIndexChange"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: GenericListComponent, decorators: [{
|
|
143
|
+
type: Component,
|
|
144
|
+
args: [{
|
|
145
|
+
selector: 'pep-generic-list',
|
|
146
|
+
templateUrl: './generic-list.component.html',
|
|
147
|
+
styleUrls: ['./generic-list.component.scss'],
|
|
148
|
+
}]
|
|
149
|
+
}], ctorParameters: function () { return [{ type: i1.PepDataConvertorService }, { type: i1.PepLayoutService }, { type: i2.TranslateService }]; }, propDecorators: { customList: [{
|
|
150
|
+
type: ViewChild,
|
|
151
|
+
args: [PepListComponent]
|
|
152
|
+
}], dataSource: [{
|
|
153
|
+
type: Input
|
|
154
|
+
}], addPadding: [{
|
|
155
|
+
type: Input
|
|
156
|
+
}], title: [{
|
|
157
|
+
type: Input
|
|
158
|
+
}], inline: [{
|
|
159
|
+
type: Input
|
|
160
|
+
}], showSearch: [{
|
|
161
|
+
type: Input
|
|
162
|
+
}], allowSelection: [{
|
|
163
|
+
type: Input
|
|
164
|
+
}], noDataMessage: [{
|
|
165
|
+
type: Input
|
|
166
|
+
}], allowMultipleSelection: [{
|
|
167
|
+
type: Input
|
|
168
|
+
}], fieldClick: [{
|
|
169
|
+
type: Output
|
|
170
|
+
}] } });
|
|
171
|
+
|
|
172
|
+
class PepGenericListModule {
|
|
173
|
+
}
|
|
174
|
+
PepGenericListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
175
|
+
PepGenericListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListModule, declarations: [GenericListComponent], imports: [CommonModule,
|
|
176
|
+
PepNgxLibModule,
|
|
177
|
+
PepListModule,
|
|
178
|
+
PepFormModule,
|
|
179
|
+
PepMenuModule,
|
|
180
|
+
PepPageLayoutModule,
|
|
181
|
+
PepTopBarModule,
|
|
182
|
+
PepSearchModule], exports: [GenericListComponent] });
|
|
183
|
+
PepGenericListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListModule, imports: [[
|
|
184
|
+
CommonModule,
|
|
185
|
+
PepNgxLibModule,
|
|
186
|
+
PepListModule,
|
|
187
|
+
PepFormModule,
|
|
188
|
+
PepMenuModule,
|
|
189
|
+
PepPageLayoutModule,
|
|
190
|
+
PepTopBarModule,
|
|
191
|
+
PepSearchModule
|
|
192
|
+
]] });
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListModule, decorators: [{
|
|
194
|
+
type: NgModule,
|
|
195
|
+
args: [{
|
|
196
|
+
declarations: [
|
|
197
|
+
GenericListComponent
|
|
198
|
+
],
|
|
199
|
+
imports: [
|
|
200
|
+
CommonModule,
|
|
201
|
+
PepNgxLibModule,
|
|
202
|
+
PepListModule,
|
|
203
|
+
PepFormModule,
|
|
204
|
+
PepMenuModule,
|
|
205
|
+
PepPageLayoutModule,
|
|
206
|
+
PepTopBarModule,
|
|
207
|
+
PepSearchModule
|
|
208
|
+
],
|
|
209
|
+
exports: [GenericListComponent],
|
|
210
|
+
}]
|
|
211
|
+
}] });
|
|
212
|
+
|
|
213
|
+
/*
|
|
214
|
+
* Public API Surface of ngx-composite-lib/generic-list
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Generated bundle index. Do not edit.
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
export { GenericListComponent, PepGenericListModule };
|
|
222
|
+
//# sourceMappingURL=pepperi-addons-ngx-composite-lib-generic-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pepperi-addons-ngx-composite-lib-generic-list.js","sources":["../../../projects/ngx-composite-lib/generic-list/generic-list.component.ts","../../../projects/ngx-composite-lib/generic-list/generic-list.component.html","../../../projects/ngx-composite-lib/generic-list/generic-list.module.ts","../../../projects/ngx-composite-lib/generic-list/public-api.ts","../../../projects/ngx-composite-lib/generic-list/pepperi-addons-ngx-composite-lib-generic-list.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n AfterViewInit,\n ViewChild,\n Input,\n Output,\n EventEmitter,\n} from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport {\n PepDataConvertorService,\n PepLayoutService,\n PepRowData,\n PepScreenSizeType,\n PepGuid,\n } from '@pepperi-addons/ngx-lib';\nimport { IPepFormFieldClickEvent } from '@pepperi-addons/ngx-lib/form';\nimport {\n PepListComponent\n} from '@pepperi-addons/ngx-lib/list';\nimport {\n PepMenuItem,\n IPepMenuItemClickEvent,\n} from '@pepperi-addons/ngx-lib/menu';\nimport { IPepSearchClickEvent } from '@pepperi-addons/ngx-lib/search';\n \nimport { GridDataViewField, DataViewFieldTypes, GridDataView } from '@pepperi-addons/papi-sdk/dist/entities/data-view';\nimport { GenericListDataSource } from './generic-list.model';\n\nimport * as tween from '@tweenjs/tween.js'\n\n@Component({\n selector: 'pep-generic-list',\n templateUrl: './generic-list.component.html',\n styleUrls: ['./generic-list.component.scss'],\n})\nexport class GenericListComponent implements OnInit, AfterViewInit {\n @ViewChild(PepListComponent) customList: PepListComponent | undefined;\n \n @Input()\n dataSource: GenericListDataSource | undefined;\n dataObjects: any[] = []\n \n searchString: string = '';\n \n @Input()\n addPadding: boolean = false;\n\n @Input()\n title: string = '';\n \n @Input()\n inline: boolean = false;\n \n @Input()\n showSearch: boolean = false;\n \n @Input()\n allowSelection: boolean = true;\n \n @Input()\n noDataMessage: string = \"No data\";\n \n @Input()\n allowMultipleSelection: boolean = false;\n \n @Output()\n fieldClick: EventEmitter<IPepFormFieldClickEvent> = new EventEmitter<IPepFormFieldClickEvent>();\n\n // @Output()\n // onAddClicked = new EventEmitter<void>();\n\n menuHandlers: { [key: string]: (obj: any) => Promise<void> } = {};\n menuActions: Array<PepMenuItem> = [];\n // PepScreenSizeType = PepScreenSizeType;\n // screenSize: PepScreenSizeType;\n \n constructor(\n private dataConvertorService: PepDataConvertorService,\n private layoutService: PepLayoutService,\n private translate: TranslateService\n ) {\n this.layoutService.onResize$.pipe().subscribe((size) => {\n // this.screenSize = size;\n });\n }\n \n private loadMenuItems(): void {\n if (this.allowSelection) {\n this.getMenuActions().then(x => this.menuActions = x);\n }\n }\n \n private convertToPepRowData(object: any, dataView: GridDataView) {\n const row = new PepRowData();\n row.Fields = [];\n\n if (dataView?.Fields && dataView.Columns) {\n for (let index = 0; index < dataView.Fields.length; index++) {\n let field = dataView.Fields[index] as GridDataViewField\n row.Fields.push({\n ApiName: field.FieldID,\n Title: this.translate.instant(field.Title),\n XAlignment: 1,\n FormattedValue: (object[field.FieldID] || '').toString(),\n Value: (object[field.FieldID] || '').toString(),\n ColumnWidth: dataView.Columns[index].Width,\n AdditionalValue: '',\n OptionalValues: [],\n FieldType: DataViewFieldTypes[field.Type],\n ReadOnly: field.ReadOnly,\n Enabled: !field.ReadOnly\n })\n }\n }\n return row;\n }\n \n private async getMenuActions(): Promise<PepMenuItem[]> {\n const actions = await this.dataSource?.getActions(this.getMenuObjects());\n const res: PepMenuItem[] = []\n this.menuHandlers = {};\n \n actions?.forEach(item => {\n const uuid = PepGuid.newGuid();\n this.menuHandlers[uuid] = item.handler;\n res.push({\n key: uuid,\n text: item.title\n })\n })\n \n return res;\n }\n \n private getMenuObjects() {\n let uuids = this.customList?.getSelectedItemsData().rows ?? [];\n if (this.customList?.getIsAllSelectedForActions()) {\n uuids = this.dataObjects.map(obj => obj.UID).filter(x => uuids.indexOf(x) != -1);\n }\n const objects = uuids.map(uuid => this.getObject(uuid))\n return objects;\n }\n \n private getObject(uuid: string) {\n return this.dataObjects.find(obj => obj.UID === uuid);\n }\n \n ngOnInit() {\n }\n \n ngAfterViewInit(): void {\n this.reload();\n }\n \n onMenuItemClicked(action: IPepMenuItemClickEvent): void {\n this.menuHandlers[action.source.key](this.getMenuObjects());\n }\n \n onSearchChanged(event: IPepSearchClickEvent) {\n this.searchString = event.value\n this.reload();\n }\n \n async reload() {\n if (this.customList && this.dataSource) {\n this.dataObjects = await this.dataSource.getList({\n searchString: this.searchString\n });\n const dataView = await this.dataSource.getDataView();\n const tableData = this.dataObjects.map(x => this.convertToPepRowData(x, dataView));\n const data = this.dataConvertorService.convertListData(tableData);\n data.forEach((obj, i) => {\n this.dataObjects[i].UID = obj.UID;\n })\n const uiControl = this.dataConvertorService.getUiControl(tableData[0]);\n this.customList.initListData(uiControl, data.length, data);\n \n this.loadMenuItems();\n }\n }\n\n selectedRowsChanged(selectedRowsCount: number) {\n this.loadMenuItems();\n }\n\n onCustomizeFieldClick(fieldClickEvent: IPepFormFieldClickEvent) {\n this.fieldClick.emit(fieldClickEvent);\n }\n \n}\n ","<div *ngIf=\"inline\" class=\"inline-container\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"listTemplate\"></ng-container>\n</div>\n\n<pep-page-layout *ngIf=\"!inline\" [addPadding]=\"addPadding\">\n <ng-container pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n\n <div pep-main-area class=\"main-area-container\">\n <ng-container *ngTemplateOutlet=\"listTemplate\"></ng-container>\n </div>\n</pep-page-layout>\n \n<ng-template #topBarTemplate>\n <pep-top-bar [title]=\"title\" [inline]=\"inline\">\n <div header-start-content>\n <ng-content select=\"[left-buttons]\"></ng-content>\n </div>\n <div header-end-content>\n <ng-content select=\"[right-buttons]\"></ng-content>\n </div>\n <pep-list-actions [sizeType]=\"inline ? 'sm' : 'md'\" [actions]=\"menuActions\" (actionClick)=\"onMenuItemClicked($event)\"></pep-list-actions>\n <pep-list-total [sizeType]=\"inline ? 'sm' : 'md'\" [totalRows]=\"customList ? customList.totalRows : -1\"></pep-list-total>\n\n <pep-search *ngIf=\"showSearch\" [sizeType]=\"inline ? 'sm' : 'md'\" (search)=\"onSearchChanged($event)\">\n </pep-search>\n </pep-top-bar>\n</ng-template>\n\n<ng-template #listTemplate>\n <pep-list viewType=\"table\" [supportSorting]=\"false\"\n [selectionTypeForActions]=\"allowMultipleSelection ? 'multi' : (allowSelection ? 'single' : 'none')\" [noDataFoundMsg]=\"noDataMessage\"\n (fieldClick)=\"onCustomizeFieldClick($event)\"\n (selectedItemsChange)=\"selectedRowsChanged($event)\">\n </pep-list>\n</ng-template>","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { GenericListComponent } from './generic-list.component';\nimport { PepNgxLibModule } from '@pepperi-addons/ngx-lib';\nimport { PepListModule } from '@pepperi-addons/ngx-lib/list';\nimport { PepFormModule } from '@pepperi-addons/ngx-lib/form';\nimport { PepMenuModule } from '@pepperi-addons/ngx-lib/menu';\nimport { PepPageLayoutModule } from '@pepperi-addons/ngx-lib/page-layout';\nimport { PepTopBarModule } from '@pepperi-addons/ngx-lib/top-bar';\nimport { PepSearchModule } from '@pepperi-addons/ngx-lib/search';\n\n@NgModule({\n declarations: [\n GenericListComponent\n ],\n imports: [\n CommonModule,\n PepNgxLibModule,\n PepListModule,\n PepFormModule,\n PepMenuModule,\n PepPageLayoutModule,\n PepTopBarModule,\n PepSearchModule\n ],\n exports: [GenericListComponent],\n})\nexport class PepGenericListModule { }\n","/*\n * Public API Surface of ngx-composite-lib/generic-list\n */\nexport * from './generic-list.module';\nexport * from './generic-list.component';\nexport * from './generic-list.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;MAqCa,oBAAoB;;;IAyC7B,YACY,oBAA6C,EAC7C,aAA+B,EAC/B,SAA2B;QAF3B,yBAAoB,GAApB,oBAAoB,CAAyB;QAC7C,kBAAa,GAAb,aAAa,CAAkB;QAC/B,cAAS,GAAT,SAAS,CAAkB;QAvCvC,gBAAW,GAAU,EAAE,CAAA;QAEvB,iBAAY,GAAW,EAAE,CAAC;QAG1B,eAAU,GAAY,KAAK,CAAC;QAG5B,UAAK,GAAW,EAAE,CAAC;QAGnB,WAAM,GAAY,KAAK,CAAC;QAGxB,eAAU,GAAY,KAAK,CAAC;QAG5B,mBAAc,GAAY,IAAI,CAAC;QAG/B,kBAAa,GAAW,SAAS,CAAC;QAGlC,2BAAsB,GAAY,KAAK,CAAC;QAGxC,eAAU,GAA0C,IAAI,YAAY,EAA2B,CAAC;;;QAKhG,iBAAY,GAAmD,EAAE,CAAC;QAClE,gBAAW,GAAuB,EAAE,CAAC;QASjC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI;;SAElD,CAAC,CAAC;KACN;IAEO,aAAa;QACjB,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;SACzD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AAe,CAAC,CAAC;KACzC;;iHAxJQ,oBAAoB;qGAApB,oBAAoB,2XAClB,gBAAgB,gDCtC/B,yzDAuCc;2FDFD,oBAAoB;kBALhC,SAAS;mBAAC;oBACP,QAAQ,EAAE,kBAAkB;oBAC5B,WAAW,EAAE,+BAA+B;oBAC5C,SAAS,EAAE,CAAC,+BAA+B,CAAC;iBAC/C;4KAEgC,UAAU;sBAAtC,SAAS;uBAAC,gBAAgB;gBAG3B,UAAU;sBADT,KAAK;gBAON,UAAU;sBADT,KAAK;gBAIN,KAAK;sBADJ,KAAK;gBAIN,MAAM;sBADL,KAAK;gBAIN,UAAU;sBADT,KAAK;gBAIN,cAAc;sBADb,KAAK;gBAIN,aAAa;sBADZ,KAAK;gBAIN,sBAAsB;sBADrB,KAAK;gBAIN,UAAU;sBADT,MAAM;;;MExCE,oBAAoB;;iHAApB,oBAAoB;kHAApB,oBAAoB,iBAdzB,oBAAoB,aAGpB,YAAY;QACZ,eAAe;QACf,aAAa;QACb,aAAa;QACb,aAAa;QACb,mBAAmB;QACnB,eAAe;QACf,eAAe,aAET,oBAAoB;kHAErB,oBAAoB,YAZpB;YACL,YAAY;YACZ,eAAe;YACf,aAAa;YACb,aAAa;YACb,aAAa;YACb,mBAAmB;YACnB,eAAe;YACf,eAAe;SAClB;2FAGQ,oBAAoB;kBAhBhC,QAAQ;mBAAC;oBACN,YAAY,EAAE;wBACV,oBAAoB;qBACvB;oBACD,OAAO,EAAE;wBACL,YAAY;wBACZ,eAAe;wBACf,aAAa;wBACb,aAAa;wBACb,aAAa;wBACb,mBAAmB;wBACnB,eAAe;wBACf,eAAe;qBAClB;oBACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;iBAClC;;;AC1BD;;;;ACAA;;;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { OnInit, AfterViewInit, EventEmitter } from '@angular/core';
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
3
|
+
import { PepDataConvertorService, PepLayoutService } from '@pepperi-addons/ngx-lib';
|
|
4
|
+
import { IPepFormFieldClickEvent } from '@pepperi-addons/ngx-lib/form';
|
|
5
|
+
import { PepListComponent } from '@pepperi-addons/ngx-lib/list';
|
|
6
|
+
import { PepMenuItem, IPepMenuItemClickEvent } from '@pepperi-addons/ngx-lib/menu';
|
|
7
|
+
import { IPepSearchClickEvent } from '@pepperi-addons/ngx-lib/search';
|
|
8
|
+
import { GenericListDataSource } from './generic-list.model';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export declare class GenericListComponent implements OnInit, AfterViewInit {
|
|
11
|
+
private dataConvertorService;
|
|
12
|
+
private layoutService;
|
|
13
|
+
private translate;
|
|
14
|
+
customList: PepListComponent | undefined;
|
|
15
|
+
dataSource: GenericListDataSource | undefined;
|
|
16
|
+
dataObjects: any[];
|
|
17
|
+
searchString: string;
|
|
18
|
+
addPadding: boolean;
|
|
19
|
+
title: string;
|
|
20
|
+
inline: boolean;
|
|
21
|
+
showSearch: boolean;
|
|
22
|
+
allowSelection: boolean;
|
|
23
|
+
noDataMessage: string;
|
|
24
|
+
allowMultipleSelection: boolean;
|
|
25
|
+
fieldClick: EventEmitter<IPepFormFieldClickEvent>;
|
|
26
|
+
menuHandlers: {
|
|
27
|
+
[key: string]: (obj: any) => Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
menuActions: Array<PepMenuItem>;
|
|
30
|
+
constructor(dataConvertorService: PepDataConvertorService, layoutService: PepLayoutService, translate: TranslateService);
|
|
31
|
+
private loadMenuItems;
|
|
32
|
+
private convertToPepRowData;
|
|
33
|
+
private getMenuActions;
|
|
34
|
+
private getMenuObjects;
|
|
35
|
+
private getObject;
|
|
36
|
+
ngOnInit(): void;
|
|
37
|
+
ngAfterViewInit(): void;
|
|
38
|
+
onMenuItemClicked(action: IPepMenuItemClickEvent): void;
|
|
39
|
+
onSearchChanged(event: IPepSearchClickEvent): void;
|
|
40
|
+
reload(): Promise<void>;
|
|
41
|
+
selectedRowsChanged(selectedRowsCount: number): void;
|
|
42
|
+
onCustomizeFieldClick(fieldClickEvent: IPepFormFieldClickEvent): void;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GenericListComponent, never>;
|
|
44
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GenericListComponent, "pep-generic-list", never, { "dataSource": "dataSource"; "addPadding": "addPadding"; "title": "title"; "inline": "inline"; "showSearch": "showSearch"; "allowSelection": "allowSelection"; "noDataMessage": "noDataMessage"; "allowMultipleSelection": "allowMultipleSelection"; }, { "fieldClick": "fieldClick"; }, never, ["[left-buttons]", "[right-buttons]"]>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GridDataView } from '@pepperi-addons/papi-sdk/dist/entities/data-view';
|
|
2
|
+
export interface GenericListDataSource {
|
|
3
|
+
getList(state: {
|
|
4
|
+
searchString: string;
|
|
5
|
+
}): Promise<any[]>;
|
|
6
|
+
getDataView(): Promise<GridDataView>;
|
|
7
|
+
getActions(objs: any[]): Promise<{
|
|
8
|
+
title: string;
|
|
9
|
+
handler: (obj: any) => Promise<void>;
|
|
10
|
+
}[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./generic-list.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@pepperi-addons/ngx-lib";
|
|
5
|
+
import * as i4 from "@pepperi-addons/ngx-lib/list";
|
|
6
|
+
import * as i5 from "@pepperi-addons/ngx-lib/form";
|
|
7
|
+
import * as i6 from "@pepperi-addons/ngx-lib/menu";
|
|
8
|
+
import * as i7 from "@pepperi-addons/ngx-lib/page-layout";
|
|
9
|
+
import * as i8 from "@pepperi-addons/ngx-lib/top-bar";
|
|
10
|
+
import * as i9 from "@pepperi-addons/ngx-lib/search";
|
|
11
|
+
export declare class PepGenericListModule {
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PepGenericListModule, never>;
|
|
13
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<PepGenericListModule, [typeof i1.GenericListComponent], [typeof i2.CommonModule, typeof i3.PepNgxLibModule, typeof i4.PepListModule, typeof i5.PepFormModule, typeof i6.PepMenuModule, typeof i7.PepPageLayoutModule, typeof i8.PepTopBarModule, typeof i9.PepSearchModule], [typeof i1.GenericListComponent]>;
|
|
14
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<PepGenericListModule>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"peerDependencies": {
|
|
3
|
+
"@pepperi-addons/ngx-lib": "^0.2.56",
|
|
4
|
+
"@tweenjs/tween.js": "^17.1.1"
|
|
5
|
+
},
|
|
6
|
+
"main": "../bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js",
|
|
7
|
+
"module": "../fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js",
|
|
8
|
+
"es2015": "../fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js",
|
|
9
|
+
"esm2015": "../esm2015/generic-list/pepperi-addons-ngx-composite-lib-generic-list.js",
|
|
10
|
+
"fesm2015": "../fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js",
|
|
11
|
+
"typings": "pepperi-addons-ngx-composite-lib-generic-list.d.ts",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"name": "@pepperi-addons/ngx-composite-lib/generic-list"
|
|
14
|
+
}
|