@wertzui/ngx-restworld-client 3.1.1 → 3.2.0
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/services/restworld-client.mjs +25 -4
- package/esm2020/lib/views/restworld-list-view/restworld-list-view.component.mjs +45 -11
- package/fesm2015/wertzui-ngx-restworld-client.mjs +70 -13
- package/fesm2015/wertzui-ngx-restworld-client.mjs.map +1 -1
- package/fesm2020/wertzui-ngx-restworld-client.mjs +68 -13
- package/fesm2020/wertzui-ngx-restworld-client.mjs.map +1 -1
- package/lib/services/restworld-client.d.ts +1 -0
- package/lib/views/restworld-list-view/restworld-list-view.component.d.ts +18 -5
- package/package.json +2 -2
|
@@ -341,7 +341,9 @@ class RESTworldClient {
|
|
|
341
341
|
return __awaiter(this, void 0, void 0, function* () {
|
|
342
342
|
const link = this.getLinkFromHome(rel, LinkNames.getList, curie);
|
|
343
343
|
const uri = link.fillTemplate(parameters);
|
|
344
|
-
const
|
|
344
|
+
const defaultHeaders = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
|
|
345
|
+
const combinedHeaders = RESTworldClient.combineHeaders(headers, defaultHeaders, false);
|
|
346
|
+
const response = yield this.halClient.get(uri, PagedListResource, ProblemDetails, combinedHeaders);
|
|
345
347
|
return response;
|
|
346
348
|
});
|
|
347
349
|
}
|
|
@@ -350,7 +352,9 @@ class RESTworldClient {
|
|
|
350
352
|
const link = new Link();
|
|
351
353
|
link.href = uri;
|
|
352
354
|
const filledUri = link.fillTemplate(parameters);
|
|
353
|
-
const
|
|
355
|
+
const defaultHeaders = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
|
|
356
|
+
const combinedHeaders = RESTworldClient.combineHeaders(headers, defaultHeaders, false);
|
|
357
|
+
const response = yield this.halClient.get(filledUri, PagedListResource, ProblemDetails, combinedHeaders);
|
|
354
358
|
return response;
|
|
355
359
|
});
|
|
356
360
|
}
|
|
@@ -370,7 +374,9 @@ class RESTworldClient {
|
|
|
370
374
|
const link = this.getLinkFromHome(relOrUri, LinkNames.get, curie);
|
|
371
375
|
uri = link.fillTemplate({ id: id.toString() });
|
|
372
376
|
}
|
|
373
|
-
const
|
|
377
|
+
const defaultHeaders = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
|
|
378
|
+
const combinedHeaders = RESTworldClient.combineHeaders(headers, defaultHeaders, false);
|
|
379
|
+
const response = yield this.halClient.get(uri, Resource, ProblemDetails, combinedHeaders);
|
|
374
380
|
return response;
|
|
375
381
|
});
|
|
376
382
|
}
|
|
@@ -478,6 +484,21 @@ class RESTworldClient {
|
|
|
478
484
|
});
|
|
479
485
|
return new HttpHeaders();
|
|
480
486
|
}
|
|
487
|
+
static combineHeaders(originalHeaders, headersToAdd, overwriteExisting) {
|
|
488
|
+
if (!headersToAdd)
|
|
489
|
+
return originalHeaders;
|
|
490
|
+
if (!originalHeaders)
|
|
491
|
+
return headersToAdd;
|
|
492
|
+
let combinedHeaders = originalHeaders;
|
|
493
|
+
for (const key in headersToAdd.keys) {
|
|
494
|
+
if (!combinedHeaders.has(key) || overwriteExisting) {
|
|
495
|
+
const headerValuesToAdd = headersToAdd.getAll(key);
|
|
496
|
+
if (headerValuesToAdd)
|
|
497
|
+
combinedHeaders = combinedHeaders.set(key, headerValuesToAdd);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return combinedHeaders;
|
|
501
|
+
}
|
|
481
502
|
}
|
|
482
503
|
|
|
483
504
|
class RESTworldClientCollection {
|
|
@@ -1216,6 +1237,8 @@ var ColumnType;
|
|
|
1216
1237
|
ColumnType["numeric"] = "numeric";
|
|
1217
1238
|
ColumnType["boolean"] = "boolean";
|
|
1218
1239
|
ColumnType["date"] = "date";
|
|
1240
|
+
ColumnType["array"] = "array";
|
|
1241
|
+
ColumnType["object"] = "object";
|
|
1219
1242
|
})(ColumnType || (ColumnType = {}));
|
|
1220
1243
|
class RESTworldListViewComponent {
|
|
1221
1244
|
constructor(_clients, _confirmationService, _messageService, avatarGenerator) {
|
|
@@ -1225,8 +1248,11 @@ class RESTworldListViewComponent {
|
|
|
1225
1248
|
this.avatarGenerator = avatarGenerator;
|
|
1226
1249
|
this._columns = [];
|
|
1227
1250
|
this._editLink = '/edit';
|
|
1251
|
+
this._sortField = '';
|
|
1252
|
+
this._sortOrder = 1;
|
|
1228
1253
|
this.isLoading = false;
|
|
1229
1254
|
this._totalRecords = 0;
|
|
1255
|
+
this.load = _.debounce(this.load2, 100);
|
|
1230
1256
|
this.rowsPerPage = [10, 25, 50];
|
|
1231
1257
|
this._lastEvent = {
|
|
1232
1258
|
rows: this.rowsPerPage[0]
|
|
@@ -1244,20 +1270,34 @@ class RESTworldListViewComponent {
|
|
|
1244
1270
|
}
|
|
1245
1271
|
set apiName(value) {
|
|
1246
1272
|
this._apiName = value;
|
|
1247
|
-
|
|
1248
|
-
this.load(this._lastEvent);
|
|
1273
|
+
this.load(this._lastEvent);
|
|
1249
1274
|
}
|
|
1250
1275
|
get apiName() {
|
|
1251
1276
|
return this._apiName;
|
|
1252
1277
|
}
|
|
1253
1278
|
set rel(value) {
|
|
1254
1279
|
this._rel = value;
|
|
1255
|
-
|
|
1256
|
-
this.load(this._lastEvent);
|
|
1280
|
+
this.load(this._lastEvent);
|
|
1257
1281
|
}
|
|
1258
1282
|
get rel() {
|
|
1259
1283
|
return this._rel;
|
|
1260
1284
|
}
|
|
1285
|
+
set sortField(value) {
|
|
1286
|
+
this._sortField = value !== null && value !== void 0 ? value : '';
|
|
1287
|
+
this._lastEvent.sortField = value;
|
|
1288
|
+
this.load(this._lastEvent);
|
|
1289
|
+
}
|
|
1290
|
+
get sortField() {
|
|
1291
|
+
return this._sortField;
|
|
1292
|
+
}
|
|
1293
|
+
set sortOrder(value) {
|
|
1294
|
+
this._sortOrder = value !== null && value !== void 0 ? value : 1;
|
|
1295
|
+
this._lastEvent.sortOrder = value;
|
|
1296
|
+
this.load(this._lastEvent);
|
|
1297
|
+
}
|
|
1298
|
+
get sortOrder() {
|
|
1299
|
+
return this._sortOrder;
|
|
1300
|
+
}
|
|
1261
1301
|
get value() {
|
|
1262
1302
|
var _a, _b;
|
|
1263
1303
|
return ((_b = (_a = this.resource) === null || _a === void 0 ? void 0 : _a._embedded) === null || _b === void 0 ? void 0 : _b.items) || [];
|
|
@@ -1272,9 +1312,6 @@ class RESTworldListViewComponent {
|
|
|
1272
1312
|
set totalRecords(value) {
|
|
1273
1313
|
this._totalRecords = value || 0;
|
|
1274
1314
|
}
|
|
1275
|
-
get sortOrder() {
|
|
1276
|
-
return this._lastEvent.sortOrder || 0;
|
|
1277
|
-
}
|
|
1278
1315
|
get newHref() {
|
|
1279
1316
|
var _a, _b;
|
|
1280
1317
|
return (_b = (_a = this.resource) === null || _a === void 0 ? void 0 : _a.findLink('new')) === null || _b === void 0 ? void 0 : _b.href;
|
|
@@ -1282,12 +1319,24 @@ class RESTworldListViewComponent {
|
|
|
1282
1319
|
get dateFormat() {
|
|
1283
1320
|
return RESTworldListViewComponent._dateFormat;
|
|
1284
1321
|
}
|
|
1322
|
+
ngOnChanges(changes) {
|
|
1323
|
+
console.log("ngOnChanges " + changes);
|
|
1324
|
+
}
|
|
1325
|
+
ngOnInit() {
|
|
1326
|
+
console.log("ngOnInit");
|
|
1327
|
+
}
|
|
1328
|
+
ngAfterViewInit() {
|
|
1329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1330
|
+
console.log("ngAfterViewInit");
|
|
1331
|
+
//await this.load(this._lastEvent);
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1285
1334
|
getClient() {
|
|
1286
1335
|
if (!this.apiName)
|
|
1287
1336
|
throw new Error('Cannot get a client, because the apiName is not set.');
|
|
1288
1337
|
return this._clients.getClient(this.apiName);
|
|
1289
1338
|
}
|
|
1290
|
-
|
|
1339
|
+
load2(event) {
|
|
1291
1340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1292
1341
|
if (!this.apiName || !this.rel)
|
|
1293
1342
|
return;
|
|
@@ -1383,6 +1432,10 @@ class RESTworldListViewComponent {
|
|
|
1383
1432
|
return ColumnType.text;
|
|
1384
1433
|
if (_.isBoolean(value))
|
|
1385
1434
|
return ColumnType.boolean;
|
|
1435
|
+
if (_.isArrayLike(value))
|
|
1436
|
+
return ColumnType.array;
|
|
1437
|
+
if (_.isObjectLike(value))
|
|
1438
|
+
return ColumnType.object;
|
|
1386
1439
|
return ColumnType.text;
|
|
1387
1440
|
}
|
|
1388
1441
|
static toTitleCase(anyCase) {
|
|
@@ -1526,16 +1579,20 @@ RESTworldListViewComponent._dateFormat = new Date(3333, 10, 22)
|
|
|
1526
1579
|
.replace("3333", "y")
|
|
1527
1580
|
.replace("33", "yy");
|
|
1528
1581
|
RESTworldListViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: RESTworldListViewComponent, deps: [{ token: RESTworldClientCollection }, { token: i2$1.ConfirmationService }, { token: i2$1.MessageService }, { token: AvatarGenerator }], target: i0.ɵɵFactoryTarget.Component });
|
|
1529
|
-
RESTworldListViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: RESTworldListViewComponent, selector: "rw-list", inputs: { editLink: "editLink", apiName: "apiName", rel: "rel", rowsPerPage: "rowsPerPage" }, ngImport: i0, template: "<p-table [value]=\"value\"\r\n [lazy]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n (onLazyLoad)=\"load($event)\"\r\n responsiveLayout=\"scroll\"\r\n [paginator]=\"true\"\r\n [rows]=\"rows\"\r\n [rowsPerPageOptions]=\"rowsPerPage\"\r\n [totalRecords]=\"totalRecords\"\r\n [loading]=\"isLoading\"\r\n [showInitialSortBadge]=\"true\"\r\n [columns]=\"columns\">\r\n\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\">\r\n <div class=\"p-d-flex p-jc-between p-ai-center\">\r\n {{col.header}}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n <p-columnFilter [type]=\"col.type\" [field]=\"col.field\" display=\"menu\"></p-columnFilter>\r\n </div>\r\n </th>\r\n <th>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"mx-2\" pTooltip=\"Create new\" tooltipPosition=\"left\">\r\n <a class=\"p-button-success\" icon=\"fas fa-plus\" pButton [routerLink]=\"['/edit', apiName, newHref]\"></a>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-entity let-columns=\"columns\">\r\n <tr>\r\n
|
|
1582
|
+
RESTworldListViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: RESTworldListViewComponent, selector: "rw-list", inputs: { editLink: "editLink", apiName: "apiName", rel: "rel", sortField: "sortField", sortOrder: "sortOrder", rowsPerPage: "rowsPerPage" }, usesOnChanges: true, ngImport: i0, template: "<p-table [value]=\"value\"\r\n [lazy]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n (onLazyLoad)=\"load($event)\"\r\n responsiveLayout=\"scroll\"\r\n [paginator]=\"true\"\r\n [rows]=\"rows\"\r\n [rowsPerPageOptions]=\"rowsPerPage\"\r\n [totalRecords]=\"totalRecords\"\r\n [loading]=\"isLoading\"\r\n [showInitialSortBadge]=\"true\"\r\n [columns]=\"columns\"\r\n [sortField]=\"sortField\"\r\n [sortOrder]=\"sortOrder\">\r\n\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\">\r\n <div class=\"p-d-flex p-jc-between p-ai-center\">\r\n {{col.header}}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n <p-columnFilter [type]=\"col.type\" [field]=\"col.field\" display=\"menu\"></p-columnFilter>\r\n </div>\r\n </th>\r\n <th>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"mx-2\" pTooltip=\"Create new\" tooltipPosition=\"left\">\r\n <a class=\"p-button-success\" icon=\"fas fa-plus\" pButton [routerLink]=\"['/edit', apiName, newHref]\"></a>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-entity let-columns=\"columns\">\r\n <tr>\r\n <td [ngSwitch]=\"col.type\" *ngFor=\"let col of columns\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <p-avatar *ngIf=\"col.field === 'createdBy' || col.field === 'lastChangedBy'\" [pTooltip]=\"entity[col.field]\" tooltipPosition=\"top\" [image]=\"avatarGenerator.getImage(entity[col.field])\" [label]=\"avatarGenerator.getLabel(entity[col.field])\" [style]=\"avatarGenerator.getStyle(entity[col.field])\" shape=\"circle\"></p-avatar>\r\n <span *ngIf=\"col.field !== 'createdBy' && col.field !== 'lastChangedBy'\">{{entity[col.field]}}</span>\r\n </ng-container>\r\n <span *ngSwitchCase=\"'numeric'\" class=\"flex justify-content-end\">{{entity[col.field]}}</span>\r\n <span *ngSwitchCase=\"'boolean'\" class=\"flex justify-content-center\"><p-triStateCheckbox [(ngModel)]=\"entity[col.field]\" [readonly]=\"true\"></p-triStateCheckbox></span>\r\n <span *ngSwitchCase=\"'date'\" [pTooltip]=\"entity[col.field]\">{{entity[col.field] | date:dateFormat}}</span>\r\n <span *ngSwitchCase=\"'array'\" class=\"flex justify-content-end\"><p *ngFor=\"let arrayElement of entity[col.field]\">{{arrayElement | json}}</p></span>\r\n <span *ngSwitchCase=\"'object'\" class=\"flex justify-content-end\">{{entity[col.field] | json}}</span>\r\n </td>\r\n <td>\r\n <div class=\"flex justify-content-end\">\r\n <a pButton pTooltip=\"View/Edit\" tooltipPosition=\"left\" [routerLink]=\"[editLink, apiName, entity._links?.self[0].href]\" icon=\"fas fa-edit\"></a>\r\n <button pTooltip=\"Delete\" tooltipPosition=\"left\" pButton *ngIf=\"entity._links.delete\" (click)=\"showDeleteConfirmatioModal(entity)\" icon=\"fas fa-trash-alt\" type=\"button\" class=\"mx-2 p-button-danger\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"8\">No entries found.</td>\r\n </tr>\r\n </ng-template>\r\n\r\n</p-table>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: [".p-tooltip{max-width:-moz-fit-content;max-width:fit-content}a.p-button{text-decoration:none}\n"], components: [{ type: i4$3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollDelay", "virtualRowHeight", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "minBufferPx", "maxBufferPx", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { type: i4$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { type: i4$3.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping"] }, { type: i5$2.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "style", "styleClass"] }, { type: i9$1.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { type: i11.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i12$1.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }], directives: [{ type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { type: i7.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i4$2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i1$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i3$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "date": i3$1.DatePipe, "json": i3$1.JsonPipe } });
|
|
1530
1583
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: RESTworldListViewComponent, decorators: [{
|
|
1531
1584
|
type: Component,
|
|
1532
|
-
args: [{ selector: 'rw-list', template: "<p-table [value]=\"value\"\r\n [lazy]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n (onLazyLoad)=\"load($event)\"\r\n responsiveLayout=\"scroll\"\r\n [paginator]=\"true\"\r\n [rows]=\"rows\"\r\n [rowsPerPageOptions]=\"rowsPerPage\"\r\n [totalRecords]=\"totalRecords\"\r\n [loading]=\"isLoading\"\r\n [showInitialSortBadge]=\"true\"\r\n [columns]=\"columns\">\r\n\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\">\r\n <div class=\"p-d-flex p-jc-between p-ai-center\">\r\n {{col.header}}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n <p-columnFilter [type]=\"col.type\" [field]=\"col.field\" display=\"menu\"></p-columnFilter>\r\n </div>\r\n </th>\r\n <th>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"mx-2\" pTooltip=\"Create new\" tooltipPosition=\"left\">\r\n <a class=\"p-button-success\" icon=\"fas fa-plus\" pButton [routerLink]=\"['/edit', apiName, newHref]\"></a>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-entity let-columns=\"columns\">\r\n <tr>\r\n
|
|
1585
|
+
args: [{ selector: 'rw-list', template: "<p-table [value]=\"value\"\r\n [lazy]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n (onLazyLoad)=\"load($event)\"\r\n responsiveLayout=\"scroll\"\r\n [paginator]=\"true\"\r\n [rows]=\"rows\"\r\n [rowsPerPageOptions]=\"rowsPerPage\"\r\n [totalRecords]=\"totalRecords\"\r\n [loading]=\"isLoading\"\r\n [showInitialSortBadge]=\"true\"\r\n [columns]=\"columns\"\r\n [sortField]=\"sortField\"\r\n [sortOrder]=\"sortOrder\">\r\n\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\">\r\n <div class=\"p-d-flex p-jc-between p-ai-center\">\r\n {{col.header}}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n <p-columnFilter [type]=\"col.type\" [field]=\"col.field\" display=\"menu\"></p-columnFilter>\r\n </div>\r\n </th>\r\n <th>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"mx-2\" pTooltip=\"Create new\" tooltipPosition=\"left\">\r\n <a class=\"p-button-success\" icon=\"fas fa-plus\" pButton [routerLink]=\"['/edit', apiName, newHref]\"></a>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-entity let-columns=\"columns\">\r\n <tr>\r\n <td [ngSwitch]=\"col.type\" *ngFor=\"let col of columns\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <p-avatar *ngIf=\"col.field === 'createdBy' || col.field === 'lastChangedBy'\" [pTooltip]=\"entity[col.field]\" tooltipPosition=\"top\" [image]=\"avatarGenerator.getImage(entity[col.field])\" [label]=\"avatarGenerator.getLabel(entity[col.field])\" [style]=\"avatarGenerator.getStyle(entity[col.field])\" shape=\"circle\"></p-avatar>\r\n <span *ngIf=\"col.field !== 'createdBy' && col.field !== 'lastChangedBy'\">{{entity[col.field]}}</span>\r\n </ng-container>\r\n <span *ngSwitchCase=\"'numeric'\" class=\"flex justify-content-end\">{{entity[col.field]}}</span>\r\n <span *ngSwitchCase=\"'boolean'\" class=\"flex justify-content-center\"><p-triStateCheckbox [(ngModel)]=\"entity[col.field]\" [readonly]=\"true\"></p-triStateCheckbox></span>\r\n <span *ngSwitchCase=\"'date'\" [pTooltip]=\"entity[col.field]\">{{entity[col.field] | date:dateFormat}}</span>\r\n <span *ngSwitchCase=\"'array'\" class=\"flex justify-content-end\"><p *ngFor=\"let arrayElement of entity[col.field]\">{{arrayElement | json}}</p></span>\r\n <span *ngSwitchCase=\"'object'\" class=\"flex justify-content-end\">{{entity[col.field] | json}}</span>\r\n </td>\r\n <td>\r\n <div class=\"flex justify-content-end\">\r\n <a pButton pTooltip=\"View/Edit\" tooltipPosition=\"left\" [routerLink]=\"[editLink, apiName, entity._links?.self[0].href]\" icon=\"fas fa-edit\"></a>\r\n <button pTooltip=\"Delete\" tooltipPosition=\"left\" pButton *ngIf=\"entity._links.delete\" (click)=\"showDeleteConfirmatioModal(entity)\" icon=\"fas fa-trash-alt\" type=\"button\" class=\"mx-2 p-button-danger\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"8\">No entries found.</td>\r\n </tr>\r\n </ng-template>\r\n\r\n</p-table>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: [".p-tooltip{max-width:-moz-fit-content;max-width:fit-content}a.p-button{text-decoration:none}\n"] }]
|
|
1533
1586
|
}], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2$1.ConfirmationService }, { type: i2$1.MessageService }, { type: AvatarGenerator }]; }, propDecorators: { editLink: [{
|
|
1534
1587
|
type: Input
|
|
1535
1588
|
}], apiName: [{
|
|
1536
1589
|
type: Input
|
|
1537
1590
|
}], rel: [{
|
|
1538
1591
|
type: Input
|
|
1592
|
+
}], sortField: [{
|
|
1593
|
+
type: Input
|
|
1594
|
+
}], sortOrder: [{
|
|
1595
|
+
type: Input
|
|
1539
1596
|
}], rowsPerPage: [{
|
|
1540
1597
|
type: Input
|
|
1541
1598
|
}] } });
|