@pepperi-addons/ngx-composite-lib 0.0.10-beta.4 → 0.0.10-beta.42

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.
Files changed (114) hide show
  1. package/bundles/pepperi-addons-ngx-composite-lib-color-settings.umd.js +2 -1
  2. package/bundles/pepperi-addons-ngx-composite-lib-color-settings.umd.js.map +1 -1
  3. package/bundles/pepperi-addons-ngx-composite-lib-dimx-export.umd.js +771 -0
  4. package/bundles/pepperi-addons-ngx-composite-lib-dimx-export.umd.js.map +1 -0
  5. package/bundles/pepperi-addons-ngx-composite-lib-file-status-panel.umd.js +119 -0
  6. package/bundles/pepperi-addons-ngx-composite-lib-file-status-panel.umd.js.map +1 -0
  7. package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js +493 -105
  8. package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js.map +1 -1
  9. package/bundles/pepperi-addons-ngx-composite-lib-group-buttons-settings.umd.js +4 -1
  10. package/bundles/pepperi-addons-ngx-composite-lib-group-buttons-settings.umd.js.map +1 -1
  11. package/bundles/pepperi-addons-ngx-composite-lib-shadow-settings.umd.js.map +1 -1
  12. package/bundles/pepperi-addons-ngx-composite-lib.umd.js +586 -51
  13. package/bundles/pepperi-addons-ngx-composite-lib.umd.js.map +1 -1
  14. package/color-settings/package.json +0 -3
  15. package/core/common/directives/index.d.ts +1 -0
  16. package/core/common/directives/public-api.d.ts +1 -0
  17. package/core/common/directives/reset-configuration-field.directive.d.ts +38 -0
  18. package/core/common/index.d.ts +1 -0
  19. package/core/common/public-api.d.ts +2 -0
  20. package/core/common/services/index.d.ts +1 -0
  21. package/core/common/services/public-api.d.ts +1 -0
  22. package/core/common/services/utilities.service.d.ts +6 -0
  23. package/core/index.d.ts +1 -0
  24. package/core/public-api.d.ts +1 -0
  25. package/dimx-export/dimx.component.d.ts +73 -0
  26. package/dimx-export/dimx.model.d.ts +7 -0
  27. package/dimx-export/dimx.module.d.ts +15 -0
  28. package/dimx-export/dimx.service.d.ts +20 -0
  29. package/dimx-export/package.json +16 -0
  30. package/{draggable-item/pepperi-addons-ngx-composite-lib-draggable-item.d.ts → dimx-export/pepperi-addons-ngx-composite-lib-dimx-export.d.ts} +1 -1
  31. package/dimx-export/public-api.d.ts +3 -0
  32. package/esm2015/color-settings/color-settings.component.js +9 -8
  33. package/esm2015/color-settings/color-settings.model.js +1 -1
  34. package/esm2015/core/common/directives/index.js +5 -0
  35. package/esm2015/core/common/directives/public-api.js +5 -0
  36. package/esm2015/core/common/directives/reset-configuration-field.directive.js +153 -0
  37. package/esm2015/core/common/index.js +5 -0
  38. package/esm2015/core/common/public-api.js +6 -0
  39. package/esm2015/core/common/services/index.js +5 -0
  40. package/esm2015/core/common/services/public-api.js +5 -0
  41. package/esm2015/core/common/services/utilities.service.js +19 -0
  42. package/esm2015/core/index.js +5 -0
  43. package/esm2015/core/public-api.js +5 -0
  44. package/esm2015/dimx-export/dimx.component.js +241 -0
  45. package/esm2015/dimx-export/dimx.model.js +8 -0
  46. package/esm2015/dimx-export/dimx.module.js +49 -0
  47. package/esm2015/dimx-export/dimx.service.js +50 -0
  48. package/esm2015/dimx-export/pepperi-addons-ngx-composite-lib-dimx-export.js +5 -0
  49. package/esm2015/dimx-export/public-api.js +7 -0
  50. package/esm2015/file-status-panel/file-status-panel.component.js +34 -0
  51. package/esm2015/file-status-panel/file-status-panel.model.js +8 -0
  52. package/esm2015/file-status-panel/file-status-panel.module.js +40 -0
  53. package/esm2015/file-status-panel/pepperi-addons-ngx-composite-lib-file-status-panel.js +5 -0
  54. package/esm2015/file-status-panel/public-api.js +7 -0
  55. package/esm2015/generic-list/generic-list.component.js +337 -80
  56. package/esm2015/generic-list/generic-list.model.js +1 -1
  57. package/esm2015/generic-list/generic-list.module.js +18 -6
  58. package/esm2015/generic-list/generic-list.service.js +42 -0
  59. package/esm2015/generic-list/public-api.js +2 -1
  60. package/esm2015/group-buttons-settings/group-buttons-settings.component.js +5 -2
  61. package/esm2015/ngx-composite-lib.module.js +28 -9
  62. package/esm2015/public-api.js +2 -1
  63. package/esm2015/shadow-settings/shadow-settings.model.js +1 -1
  64. package/fesm2015/pepperi-addons-ngx-composite-lib-color-settings.js +8 -7
  65. package/fesm2015/pepperi-addons-ngx-composite-lib-color-settings.js.map +1 -1
  66. package/fesm2015/pepperi-addons-ngx-composite-lib-dimx-export.js +350 -0
  67. package/fesm2015/pepperi-addons-ngx-composite-lib-dimx-export.js.map +1 -0
  68. package/fesm2015/pepperi-addons-ngx-composite-lib-file-status-panel.js +90 -0
  69. package/fesm2015/pepperi-addons-ngx-composite-lib-file-status-panel.js.map +1 -0
  70. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js +391 -85
  71. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js.map +1 -1
  72. package/fesm2015/pepperi-addons-ngx-composite-lib-group-buttons-settings.js +4 -1
  73. package/fesm2015/pepperi-addons-ngx-composite-lib-group-buttons-settings.js.map +1 -1
  74. package/fesm2015/pepperi-addons-ngx-composite-lib-shadow-settings.js.map +1 -1
  75. package/fesm2015/pepperi-addons-ngx-composite-lib.js +225 -13
  76. package/fesm2015/pepperi-addons-ngx-composite-lib.js.map +1 -1
  77. package/file-status-panel/file-status-panel.component.d.ts +14 -0
  78. package/file-status-panel/file-status-panel.model.d.ts +6 -0
  79. package/file-status-panel/file-status-panel.module.d.ts +12 -0
  80. package/file-status-panel/package.json +10 -0
  81. package/file-status-panel/pepperi-addons-ngx-composite-lib-file-status-panel.d.ts +5 -0
  82. package/file-status-panel/public-api.d.ts +3 -0
  83. package/generic-list/generic-list.component.d.ts +68 -22
  84. package/generic-list/generic-list.model.d.ts +35 -5
  85. package/generic-list/generic-list.module.d.ts +2 -1
  86. package/generic-list/generic-list.service.d.ts +13 -0
  87. package/generic-list/package.json +0 -1
  88. package/generic-list/public-api.d.ts +1 -0
  89. package/group-buttons-settings/group-buttons-settings.component.d.ts +2 -1
  90. package/group-buttons-settings/package.json +0 -3
  91. package/ngx-composite-lib.module.d.ts +6 -1
  92. package/package.json +2 -2
  93. package/public-api.d.ts +1 -0
  94. package/shadow-settings/package.json +0 -3
  95. package/src/assets/i18n/en.ngx-composite-lib.json +5 -2
  96. package/src/core/style/abstracts/functions.scss +0 -0
  97. package/src/core/style/abstracts/mixins.scss +0 -0
  98. package/src/core/style/abstracts/variables.scss +0 -0
  99. package/src/core/style/base/helpers.scss +0 -0
  100. package/src/core/style/components/general.scss +0 -0
  101. package/styling.scss +11 -0
  102. package/bundles/pepperi-addons-ngx-composite-lib-draggable-item.umd.js +0 -112
  103. package/bundles/pepperi-addons-ngx-composite-lib-draggable-item.umd.js.map +0 -1
  104. package/draggable-item/draggable-item.component.d.ts +0 -11
  105. package/draggable-item/draggable-item.module.d.ts +0 -11
  106. package/draggable-item/package.json +0 -13
  107. package/draggable-item/public-api.d.ts +0 -2
  108. package/esm2015/draggable-item/draggable-item.component.js +0 -40
  109. package/esm2015/draggable-item/draggable-item.module.js +0 -36
  110. package/esm2015/draggable-item/pepperi-addons-ngx-composite-lib-draggable-item.js +0 -5
  111. package/esm2015/draggable-item/public-api.js +0 -6
  112. package/fesm2015/pepperi-addons-ngx-composite-lib-draggable-item.js +0 -84
  113. package/fesm2015/pepperi-addons-ngx-composite-lib-draggable-item.js.map +0 -1
  114. package/styles.scss +0 -38
@@ -1,62 +1,265 @@
1
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';
2
+ import { Injectable, EventEmitter, ViewContainerRef, Component, ViewChild, Input, Output, NgModule } from '@angular/core';
3
+ import * as i9 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
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';
6
+ import * as i2 from '@pepperi-addons/ngx-lib';
7
+ import { UIControl, PepRowData, PepGuid, PepNgxLibModule } from '@pepperi-addons/ngx-lib';
8
+ import * as i6 from '@pepperi-addons/ngx-lib/list';
9
+ import { PepListComponent, DEFAULT_PAGE_SIZE, PepSelectionData, PepListModule } from '@pepperi-addons/ngx-lib/list';
10
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';
11
+ import { DataViewConverter } from '@pepperi-addons/data-views';
12
+ import { BehaviorSubject, Subscription } from 'rxjs';
13
+ import * as i3 from '@ngx-translate/core';
14
+ import * as i4 from '@pepperi-addons/ngx-lib/page-layout';
13
15
  import { PepPageLayoutModule } from '@pepperi-addons/ngx-lib/page-layout';
14
- import * as i4 from '@pepperi-addons/ngx-lib/top-bar';
16
+ import * as i5 from '@pepperi-addons/ngx-lib/top-bar';
15
17
  import { PepTopBarModule } from '@pepperi-addons/ngx-lib/top-bar';
16
- import * as i6 from '@pepperi-addons/ngx-lib/search';
18
+ import * as i7 from '@pepperi-addons/ngx-lib/search';
17
19
  import { PepSearchModule } from '@pepperi-addons/ngx-lib/search';
20
+ import * as i8 from '@pepperi-addons/ngx-lib/bread-crumbs';
21
+ import { PepBreadCrumbsModule } from '@pepperi-addons/ngx-lib/bread-crumbs';
18
22
  import { PepFormModule } from '@pepperi-addons/ngx-lib/form';
19
23
  import { PepMenuModule } from '@pepperi-addons/ngx-lib/menu';
20
24
 
25
+ //test
26
+ class PepGenericListService {
27
+ constructor() {
28
+ this._refresh$ = new BehaviorSubject(false);
29
+ this.refresh$ = this._refresh$.asObservable();
30
+ //
31
+ }
32
+ set pepList(val) {
33
+ this._pepList = val;
34
+ }
35
+ get pepList() {
36
+ return this._pepList;
37
+ }
38
+ getItemById(id) {
39
+ if (this._pepList) {
40
+ return this._pepList.getItemDataByID(id);
41
+ }
42
+ else {
43
+ return null;
44
+ }
45
+ }
46
+ getSelectedItems() {
47
+ if (this._pepList) {
48
+ return this._pepList.getSelectedItemsData();
49
+ }
50
+ else {
51
+ return null;
52
+ }
53
+ }
54
+ }
55
+ PepGenericListService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
56
+ PepGenericListService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListService, providedIn: 'root' });
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListService, decorators: [{
58
+ type: Injectable,
59
+ args: [{
60
+ providedIn: 'root'
61
+ }]
62
+ }], ctorParameters: function () { return []; } });
63
+
21
64
  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 = '';
65
+ constructor(_resolver, _genericListService, _dataConvertorService, _layoutService, _translate) {
66
+ this._resolver = _resolver;
67
+ this._genericListService = _genericListService;
68
+ this._dataConvertorService = _dataConvertorService;
69
+ this._layoutService = _layoutService;
70
+ this._translate = _translate;
71
+ this._dataSource = {
72
+ init: (params) => __awaiter(this, void 0, void 0, function* () {
73
+ return {
74
+ dataView: {
75
+ Type: 'Grid'
76
+ },
77
+ totalCount: -1,
78
+ items: []
79
+ };
80
+ })
81
+ };
82
+ this.actions = {
83
+ get: (data) => __awaiter(this, void 0, void 0, function* () {
84
+ return [];
85
+ })
86
+ };
87
+ this.uuidMapping = 'key';
30
88
  this.addPadding = false;
31
89
  this.title = '';
32
90
  this.inline = false;
33
91
  this.showSearch = false;
34
- this.allowSelection = true;
35
- this.noDataMessage = "No data";
36
- this.allowMultipleSelection = false;
92
+ this.showTopBar = false;
93
+ this.breadCrumbsItems = new Array();
37
94
  this.fieldClick = new EventEmitter();
38
- // @Output()
39
- // onAddClicked = new EventEmitter<void>();
95
+ this.valueChange = new EventEmitter();
96
+ this.breadCrumbItemClick = new EventEmitter();
97
+ this._resize$ = new Subscription();
98
+ this._dataView = {
99
+ Type: 'Grid'
100
+ };
101
+ this._tableInputs = {
102
+ supportSorting: false,
103
+ selectionType: 'single',
104
+ pager: {
105
+ type: 'scroll'
106
+ },
107
+ noDataFoundMsg: ''
108
+ };
109
+ this.totalRowCount = -1;
110
+ this.searchString = '';
111
+ this._sorting = undefined;
40
112
  this.menuHandlers = {};
41
113
  this.menuActions = [];
42
- this.layoutService.onResize$.pipe().subscribe((size) => {
43
- // this.screenSize = size;
114
+ this._resize$ = this._layoutService.onResize$.pipe().subscribe((size) => {
115
+ //
116
+ });
117
+ }
118
+ set pepListContainer(val) {
119
+ this._pepListContainer = val;
120
+ }
121
+ set dataSource(val) {
122
+ this._dataSource = val;
123
+ this.searchString = '';
124
+ this._sorting = undefined;
125
+ this.initTable();
126
+ }
127
+ set noDataFoundMsg(val) {
128
+ this._tableInputs.noDataFoundMsg = val;
129
+ }
130
+ set selectionType(val) {
131
+ this._tableInputs.selectionType = val;
132
+ }
133
+ set supportSorting(val) {
134
+ this._tableInputs.supportSorting = val;
135
+ }
136
+ set pager(val) {
137
+ this._tableInputs.pager = val;
138
+ }
139
+ set pepList(val) {
140
+ this._genericListService.pepList = val;
141
+ }
142
+ get pepList() {
143
+ return this._genericListService.pepList;
144
+ }
145
+ ngOnInit() {
146
+ //
147
+ }
148
+ initTable() {
149
+ return __awaiter(this, void 0, void 0, function* () {
150
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
151
+ var _a, _b, _c, _d, _e;
152
+ if (this._dataSource &&
153
+ this._pepListContainer) {
154
+ if (this._pepListContainer.length > 0) {
155
+ this._pepListContainer.remove();
156
+ }
157
+ const factory = this._resolver.resolveComponentFactory(PepListComponent);
158
+ const componentRef = this._pepListContainer.createComponent(factory);
159
+ this.pepList = componentRef.instance;
160
+ //merge selector inputs with callback inputs
161
+ const tableInputs = yield this.loadTableInputs();
162
+ const fromIndex = 0;
163
+ let toIndex = 0;
164
+ if (((_a = tableInputs.pager) === null || _a === void 0 ? void 0 : _a.type) === 'pages') {
165
+ toIndex = fromIndex + (((_b = tableInputs.pager) === null || _b === void 0 ? void 0 : _b.size) || DEFAULT_PAGE_SIZE) - 1;
166
+ }
167
+ else {
168
+ toIndex = 100; //TO DO - get reesult from - this.customList.getTopItems()
169
+ }
170
+ const data = yield this.loadData(fromIndex, toIndex);
171
+ this.totalRowCount = (data === null || data === void 0 ? void 0 : data.totalCount) || 0;
172
+ componentRef.instance.viewType = 'table';
173
+ componentRef.instance.supportSorting = tableInputs.supportSorting;
174
+ componentRef.instance.selectionTypeForActions = tableInputs.selectionType;
175
+ componentRef.instance.pagerType = tableInputs.pager.type;
176
+ if (tableInputs.pager.type === 'pages') {
177
+ componentRef.instance.pageSize = ((_c = tableInputs.pager) === null || _c === void 0 ? void 0 : _c.size) || DEFAULT_PAGE_SIZE;
178
+ componentRef.instance.pageIndex = ((_d = tableInputs.pager) === null || _d === void 0 ? void 0 : _d.index) || 0;
179
+ }
180
+ componentRef.instance.noDataFoundMsg = tableInputs.noDataFoundMsg;
181
+ componentRef.instance.fieldClick.subscribe(($event) => {
182
+ this.onCustomizeFieldClick($event);
183
+ });
184
+ componentRef.instance.selectedItemsChange.subscribe(($event) => {
185
+ this.onSelectedItemsChanged($event);
186
+ });
187
+ componentRef.instance.loadItems.subscribe(($event) => {
188
+ this.onLoadItems($event);
189
+ });
190
+ componentRef.instance.loadPage.subscribe(($event) => {
191
+ this.onLoadPage($event);
192
+ });
193
+ componentRef.instance.valueChange.subscribe(($event) => {
194
+ this.onValueChanged($event);
195
+ });
196
+ componentRef.instance.sortingChange.subscribe(($event) => {
197
+ this.onSortingChange($event);
198
+ });
199
+ let convertedList = [];
200
+ if (data) {
201
+ if (((_e = data === null || data === void 0 ? void 0 : data.items) === null || _e === void 0 ? void 0 : _e.length) > 0) {
202
+ convertedList = this._dataConvertorService.convertListData(data.items);
203
+ }
204
+ const uiControl = this.getUiControl(DataViewConverter.toUIControlData(data.dataView));
205
+ componentRef.instance.initListData(uiControl, data.totalCount, convertedList);
206
+ }
207
+ }
208
+ }), 0);
44
209
  });
45
210
  }
211
+ /**
212
+ * checks if the object contains property
213
+ * @param obj object
214
+ * @param prop property name
215
+ * @returns true if contains, false otherwise
216
+ */
217
+ hasProperty(obj, prop) {
218
+ return Object.prototype.hasOwnProperty.call(obj, prop);
219
+ }
220
+ /**
221
+ * loads callback inputs in case they are provided and merge with selector inputs
222
+ * @returns merged pep-list inputs
223
+ */
224
+ loadTableInputs() {
225
+ return __awaiter(this, void 0, void 0, function* () {
226
+ const tableInputs = Object.assign({}, this._tableInputs);
227
+ if (this._dataSource.inputs) {
228
+ const inputs = yield this._dataSource.inputs();
229
+ if (inputs) {
230
+ Object.entries(inputs).forEach((item) => {
231
+ if (this.hasProperty(tableInputs, item[0])) {
232
+ tableInputs[item[0]] = item[1];
233
+ }
234
+ });
235
+ }
236
+ }
237
+ return tableInputs;
238
+ });
239
+ }
240
+ getUiControl(data) {
241
+ const uiControl = new UIControl();
242
+ uiControl.ControlFields = [];
243
+ if (data === null || data === void 0 ? void 0 : data.ControlFields) {
244
+ uiControl.ControlFields = data.ControlFields.map((field) => this.convertToUiControlField(field));
245
+ }
246
+ return uiControl;
247
+ }
46
248
  loadMenuItems() {
47
- if (this.allowSelection) {
249
+ if (this._tableInputs.selectionType !== 'none') {
48
250
  this.getMenuActions().then(x => this.menuActions = x);
49
251
  }
50
252
  }
51
253
  convertToPepRowData(object, dataView) {
52
254
  const row = new PepRowData();
255
+ row.UUID = object[this.uuidMapping] || undefined;
53
256
  row.Fields = [];
54
257
  if ((dataView === null || dataView === void 0 ? void 0 : dataView.Fields) && dataView.Columns) {
55
258
  for (let index = 0; index < dataView.Fields.length; index++) {
56
- let field = dataView.Fields[index];
259
+ const field = dataView.Fields[index];
57
260
  row.Fields.push({
58
261
  ApiName: field.FieldID,
59
- Title: this.translate.instant(field.Title),
262
+ Title: this._translate.instant(field.Title),
60
263
  XAlignment: 1,
61
264
  FormattedValue: (object[field.FieldID] || '').toString(),
62
265
  Value: (object[field.FieldID] || '').toString(),
@@ -71,86 +274,169 @@ class GenericListComponent {
71
274
  }
72
275
  return row;
73
276
  }
277
+ convertToUiControlField(field) {
278
+ return {
279
+ ApiName: field.ApiName,
280
+ FieldType: field.FieldType,
281
+ Title: field.Title,
282
+ ReadOnly: field.ReadOnlyField,
283
+ ColumnWidth: field.ColumnWidth,
284
+ ColumnWidthType: 1,
285
+ Layout: {
286
+ X: field.Layout.X,
287
+ Y: field.Layout.Y,
288
+ Width: field.Layout.Width,
289
+ Height: field.Layout.Field_Height,
290
+ XAlignment: field.Layout.xAlignment,
291
+ YAlignment: field.Layout.yAlignment,
292
+ }
293
+ };
294
+ }
74
295
  getMenuActions() {
75
- var _a;
76
296
  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
297
  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
298
+ const result = this.getMenuObjects();
299
+ if (result.success) {
300
+ const actions = yield this.actions.get(result.data);
301
+ this.menuHandlers = {};
302
+ actions === null || actions === void 0 ? void 0 : actions.forEach(item => {
303
+ const uuid = PepGuid.newGuid();
304
+ this.menuHandlers[uuid] = item.handler;
305
+ res.push({
306
+ key: uuid,
307
+ text: item.title
308
+ });
86
309
  });
87
- });
310
+ }
88
311
  return res;
89
312
  });
90
313
  }
91
314
  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);
315
+ const menuObjects = {
316
+ success: false,
317
+ data: new PepSelectionData()
318
+ };
319
+ if (this.pepList) {
320
+ menuObjects.success = true;
321
+ menuObjects.data = this.pepList.getSelectedItemsData();
96
322
  }
97
- const objects = uuids.map(uuid => this.getObject(uuid));
98
- return objects;
323
+ return menuObjects;
99
324
  }
100
- getObject(uuid) {
101
- return this.dataObjects.find(obj => obj.UID === uuid);
325
+ onActionItemClicked(action) {
326
+ const result = this.getMenuObjects();
327
+ if (result.success) {
328
+ this.menuHandlers[action.source.key](result.data);
329
+ }
102
330
  }
103
- ngOnInit() {
331
+ onSearchChanged(event) {
332
+ this.searchString = event.value;
333
+ this.initTable();
104
334
  }
105
- ngAfterViewInit() {
106
- this.reload();
335
+ onSelectedItemsChanged(selectedRowsCount) {
336
+ //loading menu items after pep-list selected items are updated
337
+ setTimeout(() => {
338
+ this.loadMenuItems();
339
+ }, 0);
107
340
  }
108
- onMenuItemClicked(action) {
109
- this.menuHandlers[action.source.key](this.getMenuObjects());
341
+ onCustomizeFieldClick(fieldClickEvent) {
342
+ this.fieldClick.emit(fieldClickEvent);
110
343
  }
111
- onSearchChanged(event) {
112
- this.searchString = event.value;
113
- this.reload();
344
+ onBreadCrumbItemClick(event) {
345
+ this.breadCrumbItemClick.emit(event);
346
+ }
347
+ onValueChanged(event) {
348
+ this.valueChange.emit(event);
349
+ }
350
+ onSortingChange(event) {
351
+ this._sorting = event;
352
+ this.initTable();
114
353
  }
115
- reload() {
354
+ loadData(fromIndex, toIndex) {
355
+ var _a;
116
356
  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;
357
+ const data = yield this._dataSource.init({
358
+ searchString: this.searchString || undefined,
359
+ sorting: this._sorting || undefined,
360
+ fromIndex: fromIndex,
361
+ toIndex: toIndex
362
+ });
363
+ if (data) {
364
+ this._dataView = data.dataView;
365
+ if (((_a = data.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
366
+ data.items = data.items.map(item => this.convertToPepRowData(item, data.dataView));
367
+ }
368
+ }
369
+ return data;
370
+ });
371
+ }
372
+ updateDataList(fromIndex, toIndex, pageIndex = undefined) {
373
+ return __awaiter(this, void 0, void 0, function* () {
374
+ if (this._dataSource.update) {
375
+ const dataList = yield this._dataSource.update({
376
+ searchString: this.searchString || undefined,
377
+ sorting: this._sorting || undefined,
378
+ fromIndex: fromIndex,
379
+ toIndex: toIndex,
380
+ pageIndex: pageIndex
126
381
  });
127
- const uiControl = this.dataConvertorService.getUiControl(tableData[0]);
128
- this.customList.initListData(uiControl, data.length, data);
129
- this.loadMenuItems();
382
+ if ((dataList === null || dataList === void 0 ? void 0 : dataList.length) > 0) {
383
+ return dataList.map(item => this.convertToPepRowData(item, this._dataView));
384
+ }
385
+ else {
386
+ return [];
387
+ }
388
+ }
389
+ else {
390
+ return [];
130
391
  }
131
392
  });
132
393
  }
133
- selectedRowsChanged(selectedRowsCount) {
134
- this.loadMenuItems();
394
+ /**
395
+ * loads virtual scroll items from api
396
+ */
397
+ onLoadItems(event) {
398
+ return __awaiter(this, void 0, void 0, function* () {
399
+ const list = yield this.updateDataList(event.fromIndex, event.toIndex);
400
+ const convertedList = this._dataConvertorService.convertListData(list);
401
+ this.pepList.updateItems(convertedList, event);
402
+ });
135
403
  }
136
- onCustomizeFieldClick(fieldClickEvent) {
137
- this.fieldClick.emit(fieldClickEvent);
404
+ /**
405
+ * loads paging bulk from api
406
+ */
407
+ onLoadPage(event) {
408
+ return __awaiter(this, void 0, void 0, function* () {
409
+ const fromIndex = event.pageIndex * event.pageSize;
410
+ const toIndex = Math.min(fromIndex + event.pageSize - 1, this.totalRowCount - 1);
411
+ const list = yield this.updateDataList(fromIndex, toIndex, event.pageIndex);
412
+ const convertedList = this._dataConvertorService.convertListData(list);
413
+ this.pepList.updatePage(convertedList, event);
414
+ });
415
+ }
416
+ ngOnDestroy() {
417
+ if (this._resize$) {
418
+ this._resize$.unsubscribe();
419
+ }
138
420
  }
139
421
  }
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 <div #listContainer class=\"list-container\">\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 </div>\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"] }] });
422
+ GenericListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: GenericListComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: PepGenericListService }, { token: i2.PepDataConvertorService }, { token: i2.PepLayoutService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
423
+ GenericListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.5", type: GenericListComponent, selector: "pep-generic-list", inputs: { dataSource: "dataSource", actions: "actions", uuidMapping: "uuidMapping", addPadding: "addPadding", title: "title", inline: "inline", showSearch: "showSearch", noDataFoundMsg: "noDataFoundMsg", selectionType: "selectionType", supportSorting: "supportSorting", pager: "pager", showTopBar: "showTopBar", breadCrumbsItems: "breadCrumbsItems" }, outputs: { fieldClick: "fieldClick", valueChange: "valueChange", breadCrumbItemClick: "breadCrumbItemClick" }, viewQueries: [{ propertyName: "pepListContainer", first: true, predicate: ["pepListContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div *ngIf=\"inline\" class=\"inline-container\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div>\n <div *ngIf=\"showTopBar\" class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngIf=\"breadCrumbsItems.length > 0\">\n <ng-container *ngTemplateOutlet=\"breadCrumbsTemplate\"></ng-container>\n </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 *ngIf=\"showTopBar\" pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"breadCrumbsItems.length > 0\" pep-top-area>\n <ng-container *ngTemplateOutlet=\"breadCrumbsTemplate\"></ng-container>\n </ng-container>\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\n <pep-list-actions *ngIf=\"menuActions.length > 0\" [sizeType]=\"inline ? 'sm' : 'md'\" [actions]=\"menuActions\"\n (actionClick)=\"onActionItemClicked($event)\"></pep-list-actions>\n <pep-list-total [sizeType]=\"inline ? 'sm' : 'md'\" [totalRows]=\"totalRowCount\">\n </pep-list-total>\n\n <pep-search *ngIf=\"showSearch\" [value]=\"searchString\" [sizeType]=\"inline ? 'sm' : 'md'\"\n (search)=\"onSearchChanged($event)\">\n </pep-search>\n </pep-top-bar>\n</ng-template>\n\n<ng-template #breadCrumbsTemplate>\n <pep-bread-crumbs class=\"bread-crumbs\" [items]=\"breadCrumbsItems\" [addSpacing]=\"true\" [displayType]=\"'items'\"\n (itemClick)=\"onBreadCrumbItemClick($event)\"></pep-bread-crumbs>\n</ng-template>\n\n<ng-template #listTemplate>\n <div class=\"list-container\">\n <ng-container #pepListContainer></ng-container>\n </div>\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)}.noDataFoundMsg{height:100%;width:100%;background:rgba(26,26,26,.12);display:flex;justify-content:center;align-items:center}.bread-crumbs{padding:var(--pep-spacing-lg, 1rem) 0 var(--pep-spacing-sm, .5rem) 0}\n"], components: [{ type: i4.PepPageLayoutComponent, selector: "pep-page-layout", inputs: ["addPadding", "showShadow"] }, { type: i5.PepTopBarComponent, selector: "pep-top-bar", inputs: ["inline", "title"], outputs: ["footerStateChange"] }, { type: i6.PepListActionsComponent, selector: "pep-list-actions", inputs: ["actions", "sizeType", "xPosition", "hidden"], outputs: ["actionClick", "stateChange", "menuClick"] }, { type: i6.PepListTotalComponent, selector: "pep-list-total", inputs: ["totalRows", "totalAmount", "isMapView", "sizeType"] }, { type: i7.PepSearchComponent, selector: "pep-search", inputs: ["triggerOn", "autoCompleteTop", "sizeType", "autoCompleteValues", "shrink", "value", "searchControl", "useAsWebComponent"], outputs: ["search", "autocompleteChange", "stateChange"] }, { type: i8.PepBreadCrumbsComponent, selector: "pep-bread-crumbs", inputs: ["addSpacing", "items", "displayType"], outputs: ["itemClick"] }], directives: [{ type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
142
424
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: GenericListComponent, decorators: [{
143
425
  type: Component,
144
426
  args: [{
145
427
  selector: 'pep-generic-list',
146
428
  templateUrl: './generic-list.component.html',
147
- styleUrls: ['./generic-list.component.scss'],
429
+ styleUrls: ['./generic-list.component.scss']
148
430
  }]
149
- }], ctorParameters: function () { return [{ type: i1.PepDataConvertorService }, { type: i1.PepLayoutService }, { type: i2.TranslateService }]; }, propDecorators: { customList: [{
431
+ }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: PepGenericListService }, { type: i2.PepDataConvertorService }, { type: i2.PepLayoutService }, { type: i3.TranslateService }]; }, propDecorators: { pepListContainer: [{
150
432
  type: ViewChild,
151
- args: [PepListComponent]
433
+ args: ['pepListContainer', { read: ViewContainerRef }]
152
434
  }], dataSource: [{
153
435
  type: Input
436
+ }], actions: [{
437
+ type: Input
438
+ }], uuidMapping: [{
439
+ type: Input
154
440
  }], addPadding: [{
155
441
  type: Input
156
442
  }], title: [{
@@ -159,14 +445,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImpor
159
445
  type: Input
160
446
  }], showSearch: [{
161
447
  type: Input
162
- }], allowSelection: [{
448
+ }], noDataFoundMsg: [{
449
+ type: Input
450
+ }], selectionType: [{
451
+ type: Input
452
+ }], supportSorting: [{
453
+ type: Input
454
+ }], pager: [{
163
455
  type: Input
164
- }], noDataMessage: [{
456
+ }], showTopBar: [{
165
457
  type: Input
166
- }], allowMultipleSelection: [{
458
+ }], breadCrumbsItems: [{
167
459
  type: Input
168
460
  }], fieldClick: [{
169
461
  type: Output
462
+ }], valueChange: [{
463
+ type: Output
464
+ }], breadCrumbItemClick: [{
465
+ type: Output
170
466
  }] } });
171
467
 
172
468
  class PepGenericListModule {
@@ -179,8 +475,11 @@ PepGenericListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ve
179
475
  PepMenuModule,
180
476
  PepPageLayoutModule,
181
477
  PepTopBarModule,
182
- PepSearchModule], exports: [GenericListComponent] });
183
- PepGenericListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListModule, imports: [[
478
+ PepSearchModule,
479
+ PepBreadCrumbsModule], exports: [GenericListComponent] });
480
+ PepGenericListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListModule, providers: [
481
+ PepGenericListService
482
+ ], imports: [[
184
483
  CommonModule,
185
484
  PepNgxLibModule,
186
485
  PepListModule,
@@ -188,7 +487,8 @@ PepGenericListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
188
487
  PepMenuModule,
189
488
  PepPageLayoutModule,
190
489
  PepTopBarModule,
191
- PepSearchModule
490
+ PepSearchModule,
491
+ PepBreadCrumbsModule
192
492
  ]] });
193
493
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0, type: PepGenericListModule, decorators: [{
194
494
  type: NgModule,
@@ -204,9 +504,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImpor
204
504
  PepMenuModule,
205
505
  PepPageLayoutModule,
206
506
  PepTopBarModule,
207
- PepSearchModule
507
+ PepSearchModule,
508
+ PepBreadCrumbsModule
509
+ ],
510
+ exports: [
511
+ GenericListComponent
208
512
  ],
209
- exports: [GenericListComponent],
513
+ providers: [
514
+ PepGenericListService
515
+ ]
210
516
  }]
211
517
  }] });
212
518
 
@@ -218,5 +524,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImpor
218
524
  * Generated bundle index. Do not edit.
219
525
  */
220
526
 
221
- export { GenericListComponent, PepGenericListModule };
527
+ export { GenericListComponent, PepGenericListModule, PepGenericListService };
222
528
  //# sourceMappingURL=pepperi-addons-ngx-composite-lib-generic-list.js.map