@elite.framework/ng.ui.core 1.0.62 → 1.0.64
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/fesm2022/elite.framework-ng.ui.core-custom-switch.mjs +2 -0
- package/fesm2022/elite.framework-ng.ui.core-custom-switch.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-formly-ui-all.mjs +8 -2
- package/fesm2022/elite.framework-ng.ui.core-formly-ui-all.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-generic-button.mjs +29 -31
- package/fesm2022/elite.framework-ng.ui.core-generic-button.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-generic-crud-table.mjs +124 -8
- package/fesm2022/elite.framework-ng.ui.core-generic-crud-table.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-generic-dialog.mjs +31 -7
- package/fesm2022/elite.framework-ng.ui.core-generic-dialog.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-generic-selector.mjs +1 -1
- package/fesm2022/elite.framework-ng.ui.core-generic-selector.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-generic-table.mjs +9 -4
- package/fesm2022/elite.framework-ng.ui.core-generic-table.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-generic-view.mjs +398 -0
- package/fesm2022/elite.framework-ng.ui.core-generic-view.mjs.map +1 -0
- package/fesm2022/elite.framework-ng.ui.core-label-type.mjs +44 -1
- package/fesm2022/elite.framework-ng.ui.core-label-type.mjs.map +1 -1
- package/fesm2022/elite.framework-ng.ui.core-wrappers.mjs +44 -1
- package/fesm2022/elite.framework-ng.ui.core-wrappers.mjs.map +1 -1
- package/generic-crud-table/index.d.ts +13 -2
- package/generic-dialog/index.d.ts +2 -2
- package/generic-table/index.d.ts +4 -1
- package/generic-view/README.md +3 -0
- package/generic-view/index.d.ts +96 -0
- package/label-type/index.d.ts +9 -1
- package/package.json +30 -26
- package/wrappers/index.d.ts +6 -1
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import * as i7 from 'primeng/tooltip';
|
|
2
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, EventEmitter, Input, ViewChild, Output, Component, NgModule } from '@angular/core';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { Location, CommonModule } from '@angular/common';
|
|
7
|
+
import * as i2 from 'primeng/toolbar';
|
|
8
|
+
import { ToolbarModule } from 'primeng/toolbar';
|
|
9
|
+
import * as i4 from 'primeng/button';
|
|
10
|
+
import { ButtonModule } from 'primeng/button';
|
|
11
|
+
import { FormlyForm } from '@ngx-formly/core';
|
|
12
|
+
import * as i6 from '@angular/forms';
|
|
13
|
+
import { UntypedFormGroup, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
14
|
+
import * as i5 from 'primeng/tabs';
|
|
15
|
+
import { TabsModule } from 'primeng/tabs';
|
|
16
|
+
import * as i9 from '@ngx-translate/core';
|
|
17
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
18
|
+
import { BreadcrumbComponent } from '@elite.framework/ng.ui.core/breadcrumb';
|
|
19
|
+
import { BaseService, SwalService } from '@elite.framework/ng.core/services';
|
|
20
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
21
|
+
import * as i8 from 'primeng/progressspinner';
|
|
22
|
+
import { ProgressSpinnerModule } from 'primeng/progressspinner';
|
|
23
|
+
import { GenericDialogComponent } from '@elite.framework/ng.ui.core/generic-dialog';
|
|
24
|
+
import { GenericButton } from '@elite.framework/ng.ui.core/generic-button';
|
|
25
|
+
import * as i3 from 'primeng/api';
|
|
26
|
+
|
|
27
|
+
class GenericViewComponent {
|
|
28
|
+
route = inject(ActivatedRoute);
|
|
29
|
+
router = inject(Router);
|
|
30
|
+
form = new UntypedFormGroup({});
|
|
31
|
+
title = '';
|
|
32
|
+
actions = [];
|
|
33
|
+
createEditActions = [];
|
|
34
|
+
actions_ = [];
|
|
35
|
+
tabs = [];
|
|
36
|
+
viewMode = true;
|
|
37
|
+
breadcrumb;
|
|
38
|
+
service = inject(BaseService);
|
|
39
|
+
formFields = [];
|
|
40
|
+
apiName = '';
|
|
41
|
+
idField = 'id';
|
|
42
|
+
standaloneMode = false;
|
|
43
|
+
isViewMode = true; // وضع المشاهدة فقط
|
|
44
|
+
isCreateMode = false; // وضع الاضافة فقط
|
|
45
|
+
isEditMode = false; // وضع التعديل
|
|
46
|
+
model = {};
|
|
47
|
+
displayMode = 'drawer';
|
|
48
|
+
mode = 'full';
|
|
49
|
+
action = new EventEmitter();
|
|
50
|
+
afterDelete = new EventEmitter();
|
|
51
|
+
dialog;
|
|
52
|
+
inlineForm;
|
|
53
|
+
tabs_ = [];
|
|
54
|
+
model_ = {};
|
|
55
|
+
currentId;
|
|
56
|
+
list = [];
|
|
57
|
+
totalRecords = 0;
|
|
58
|
+
loading = false;
|
|
59
|
+
// pagination state
|
|
60
|
+
pageSize = 10;
|
|
61
|
+
pageIndex = 0;
|
|
62
|
+
sort = '';
|
|
63
|
+
currentFilters = {};
|
|
64
|
+
pageFilters = {};
|
|
65
|
+
searchGlobal = '';
|
|
66
|
+
swalService = inject(SwalService);
|
|
67
|
+
_location = inject(Location);
|
|
68
|
+
ngOnInit() {
|
|
69
|
+
this.loading = true;
|
|
70
|
+
if (this.apiName) {
|
|
71
|
+
this.service.apiName = this.apiName;
|
|
72
|
+
}
|
|
73
|
+
this.actions_ = this.actions.filter(c => c.name != 'view');
|
|
74
|
+
this.route.paramMap.subscribe(params => {
|
|
75
|
+
const id = params.get(this.idField);
|
|
76
|
+
if (id) {
|
|
77
|
+
this.currentId = id;
|
|
78
|
+
if (this.standaloneMode) {
|
|
79
|
+
this.loadList();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.refresh();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
refresh() {
|
|
86
|
+
// detect mode based on route
|
|
87
|
+
const url = this.router.url.toLowerCase();
|
|
88
|
+
this.isViewMode = url.includes('/view');
|
|
89
|
+
this.isEditMode = url.includes('/edit');
|
|
90
|
+
this.isCreateMode = url.includes('/create') || url.endsWith('/new') || url.endsWith('/add');
|
|
91
|
+
this.tabs_ = [];
|
|
92
|
+
for (let i = 0; i < this.tabs.length; i++) {
|
|
93
|
+
const t = this.tabs[i];
|
|
94
|
+
this.tabs_.push({
|
|
95
|
+
...t,
|
|
96
|
+
fields: [
|
|
97
|
+
{
|
|
98
|
+
props: { label: '' },
|
|
99
|
+
fieldGroupClassName: 'grid grid-cols-1 md:grid-cols-2 gap-3',
|
|
100
|
+
fieldGroup: this.isCreateMode || this.isEditMode
|
|
101
|
+
? this.getCreateEditFields(i == 0 ? this.formFields : t.fields)
|
|
102
|
+
: this.getViewFields(i == 0 ? this.formFields : t.fields),
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
this.loading = false;
|
|
108
|
+
}
|
|
109
|
+
// as form
|
|
110
|
+
getCreateEditFields(fields = []) {
|
|
111
|
+
return fields.map(f => ({
|
|
112
|
+
...f,
|
|
113
|
+
props: { ...f.props, readonly: this.viewMode, disabled: this.viewMode },
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
getViewFields(fields = []) {
|
|
117
|
+
const flatten = (fields) => fields.flatMap(field => {
|
|
118
|
+
if (field.fieldGroup?.length)
|
|
119
|
+
return flatten(field.fieldGroup);
|
|
120
|
+
if (!field.props
|
|
121
|
+
|| field.props['view']?.hidden
|
|
122
|
+
// || field.props['table']?.hidden
|
|
123
|
+
)
|
|
124
|
+
return [];
|
|
125
|
+
const type = field.props['view']?.type || field.props['table']?.type || 'custom-label-type';
|
|
126
|
+
return [{
|
|
127
|
+
type,
|
|
128
|
+
key: field['key'],
|
|
129
|
+
readonly: this.viewMode,
|
|
130
|
+
disabled: this.viewMode,
|
|
131
|
+
wrappers: field.wrappers ?? ['field-wrapper'],
|
|
132
|
+
props: {
|
|
133
|
+
...field.props,
|
|
134
|
+
...(field.props['view']?.props || field.props['table']?.props),
|
|
135
|
+
},
|
|
136
|
+
expressions: field.props['view']?.expressions || field.props['view']?.expressions,
|
|
137
|
+
}];
|
|
138
|
+
});
|
|
139
|
+
return flatten(fields);
|
|
140
|
+
}
|
|
141
|
+
// Use a map to store form groups for each row and column
|
|
142
|
+
cellForms = new Map();
|
|
143
|
+
getForm(rowIndex) {
|
|
144
|
+
const key = `${rowIndex}_`;
|
|
145
|
+
let form = this.cellForms.get(key);
|
|
146
|
+
if (!form) {
|
|
147
|
+
form = new FormGroup({});
|
|
148
|
+
this.cellForms.set(key, form);
|
|
149
|
+
}
|
|
150
|
+
return form;
|
|
151
|
+
}
|
|
152
|
+
async handleCreateEditAction(btn) {
|
|
153
|
+
try {
|
|
154
|
+
if (btn.action) {
|
|
155
|
+
// Execute the provided action
|
|
156
|
+
await btn.action(null); // You can pass row or context here
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// Fallback to emitting event
|
|
160
|
+
if (btn.actionName == 'cancel') {
|
|
161
|
+
this.back();
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.action.emit({
|
|
165
|
+
name: btn.actionName ?? 'cancel',
|
|
166
|
+
row: null, // provide row if available
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
console.error('Button action error', err);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
onAction(act, model) {
|
|
176
|
+
if (act.action) {
|
|
177
|
+
act.action(model);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
// this.action.emit({ name: act.name, row:model });
|
|
181
|
+
this.emitAction({ name: act.name, row: model });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
emitAction(event) {
|
|
185
|
+
switch (event.name) {
|
|
186
|
+
case 'edit':
|
|
187
|
+
this.dialog.openForm("edit", event.row);
|
|
188
|
+
break;
|
|
189
|
+
case 'delete':
|
|
190
|
+
this.onDelete(event.row);
|
|
191
|
+
break;
|
|
192
|
+
default:
|
|
193
|
+
this.action.emit(event);
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
onDelete(item) {
|
|
198
|
+
const id = item[this.idField];
|
|
199
|
+
this.swalService.confirm('تأكيد الحذف', 'هل تريد حذف هذا السجل فعلاً؟', 'نعم، احذف', 'إلغاء').then((result) => {
|
|
200
|
+
if (result.isConfirmed) {
|
|
201
|
+
this.service.delete(id).subscribe({
|
|
202
|
+
next: () => {
|
|
203
|
+
this.swalService.success('تم الحذف بنجاح');
|
|
204
|
+
this.back();
|
|
205
|
+
},
|
|
206
|
+
error: (err) => {
|
|
207
|
+
this.loading = false;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
afterSave(event) {
|
|
214
|
+
this.model = event.response;
|
|
215
|
+
// set the id from backend response
|
|
216
|
+
this.currentId = event.response[this.idField];
|
|
217
|
+
if (this.isCreateMode) {
|
|
218
|
+
this.goToMode('view');
|
|
219
|
+
}
|
|
220
|
+
else if (this.isEditMode) {
|
|
221
|
+
this.goToMode('view');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
goToMode(mode) {
|
|
225
|
+
const tree = this.router.parseUrl(this.router.url);
|
|
226
|
+
const segments = tree.root.children['primary']?.segments.map(s => s.path) ?? [];
|
|
227
|
+
let newSegments;
|
|
228
|
+
if (mode === 'create') {
|
|
229
|
+
// always navigate to "add"
|
|
230
|
+
newSegments = [
|
|
231
|
+
...segments.filter(s => !['view', 'edit', 'add'].includes(s)),
|
|
232
|
+
'add',
|
|
233
|
+
];
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
// if in "add" mode, replace it with the new id
|
|
237
|
+
if (segments.includes('add')) {
|
|
238
|
+
newSegments = [
|
|
239
|
+
...segments.filter(s => s !== 'add'),
|
|
240
|
+
String(this.currentId),
|
|
241
|
+
mode,
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const idIndex = segments.findIndex(s => s === String(this.currentId));
|
|
246
|
+
if (idIndex === -1) {
|
|
247
|
+
newSegments = [...segments, String(this.currentId), mode];
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
newSegments = segments.slice(0, idIndex + 1);
|
|
251
|
+
newSegments.push(mode);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
this.router.navigate(newSegments);
|
|
256
|
+
this.refresh();
|
|
257
|
+
}
|
|
258
|
+
backToList() {
|
|
259
|
+
this.router.navigate(['../']);
|
|
260
|
+
}
|
|
261
|
+
back() {
|
|
262
|
+
// this.router.navigate(['..']);
|
|
263
|
+
this._location.back();
|
|
264
|
+
}
|
|
265
|
+
loadList() {
|
|
266
|
+
this.loading = true;
|
|
267
|
+
const filters = {
|
|
268
|
+
maxResultCount: this.pageSize,
|
|
269
|
+
skipCount: this.pageIndex * this.pageSize,
|
|
270
|
+
sorting: this.sort,
|
|
271
|
+
...this.currentFilters,
|
|
272
|
+
...this.pageFilters,
|
|
273
|
+
...(this.searchGlobal ? { filter: this.searchGlobal } : {}),
|
|
274
|
+
};
|
|
275
|
+
this.service.getList(filters).subscribe({
|
|
276
|
+
next: (res) => {
|
|
277
|
+
this.list = res.items;
|
|
278
|
+
this.totalRecords = res.totalCount;
|
|
279
|
+
this.loading = false;
|
|
280
|
+
// set model_ to current id item
|
|
281
|
+
const found = this.list.find(x => x[this.idField] == this.currentId);
|
|
282
|
+
if (found) {
|
|
283
|
+
this.model_ = found;
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
error: err => {
|
|
287
|
+
console.error('Error loading list', err);
|
|
288
|
+
this.loading = false;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
next() {
|
|
293
|
+
if (!this.currentId)
|
|
294
|
+
return;
|
|
295
|
+
// increment currentId numerically
|
|
296
|
+
// const newId = Number(this.currentId) + 1;
|
|
297
|
+
// this.currentId = newId;
|
|
298
|
+
// use goToMode to navigate and keep mode
|
|
299
|
+
const currentMode = this.isEditMode ? 'edit' : 'view';
|
|
300
|
+
// this.goToMode(currentMode);
|
|
301
|
+
}
|
|
302
|
+
previous() {
|
|
303
|
+
if (!this.currentId)
|
|
304
|
+
return;
|
|
305
|
+
// decrement currentId numerically
|
|
306
|
+
// const newId = Number(this.currentId) - 1;
|
|
307
|
+
// if (newId <= 0) return;
|
|
308
|
+
// this.currentId = newId;
|
|
309
|
+
// use goToMode to navigate and keep mode
|
|
310
|
+
const currentMode = this.isEditMode ? 'edit' : 'view';
|
|
311
|
+
// this.goToMode(currentMode);
|
|
312
|
+
}
|
|
313
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: GenericViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
314
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.8", type: GenericViewComponent, isStandalone: true, selector: "app-detail-view", inputs: { title: "title", actions: "actions", createEditActions: "createEditActions", tabs: "tabs", viewMode: "viewMode", breadcrumb: "breadcrumb", service: "service", formFields: "formFields", apiName: "apiName", idField: "idField", standaloneMode: "standaloneMode", isViewMode: "isViewMode", isCreateMode: "isCreateMode", isEditMode: "isEditMode", model: "model", displayMode: "displayMode", mode: "mode", loading: "loading" }, outputs: { action: "action", afterDelete: "afterDelete" }, viewQueries: [{ propertyName: "dialog", first: true, predicate: ["dialog"], descendants: true }, { propertyName: "inlineForm", first: true, predicate: ["inlineForm"], descendants: true }], ngImport: i0, template: "\r\n@if (mode === 'detail') {\r\n<div class=\"w-full flex flex-col gap-3\">\r\n <!-- overlay -->\r\n <div *ngIf=\"loading\"\r\n class=\"absolute inset-0 bg-white/70 flex items-center justify-center z-50\">\r\n <p-progress-spinner/>\r\n </div>\r\n\r\n <!-- actual content -->\r\n <!-- Toolbar -->\r\n <p-toolbar style=\"background: transparent;border: 0px;box-shadow: none;\" class=\"bg-transparent shadow-none border-none rounded-md px-3\">\r\n <ng-template pTemplate=\"left\">\r\n <!-- <span class=\"font-semibold text-lg xs:hidden block\">{{ title }}</span> -->\r\n <app-breadcrumb class=\"xs:block\" [breadcrumb]=\"breadcrumb\"></app-breadcrumb> <!-- xs:block hidden -->\r\n </ng-template>\r\n <ng-template pTemplate=\"right\">\r\n <div class=\"flex gap-2\">\r\n\r\n <button\r\n pButton pRipple\r\n icon=\"pi pi-chevron-right\"\r\n class=\"p-button-text p-button-sm fd-btn\"\r\n pTooltip=\"\u0627\u0644\u062A\u0627\u0644\u064A\"\r\n (click)=\"next()\"\r\n ></button>\r\n <button\r\n pButton pRipple\r\n icon=\"pi pi-chevron-left\"\r\n class=\"p-button-text p-button-sm fd-btn\"\r\n pTooltip=\"\u0627\u0644\u0633\u0627\u0628\u0642\"\r\n (click)=\"previous()\"\r\n ></button>\r\n </div>\r\n </ng-template>\r\n </p-toolbar>\r\n <p-toolbar class=\"bg-white shadow rounded-md px-3\">\r\n\r\n <ng-template pTemplate=\"left\">\r\n @if (isViewMode) {\r\n <div class=\"flex gap-1\">\r\n @for (action of actions_; track $index) {\r\n <button\r\n pButton pRipple\r\n [icon]=\"action.icon ?? ''\"\r\n [label]=\"(action.label ?? '') | translate\"\r\n class=\"fd-btn\"\r\n (click)=\"onAction(action,model)\"\r\n ></button>\r\n }\r\n </div>\r\n }\r\n </ng-template>\r\n <ng-template pTemplate=\"right\">\r\n @if (isEditMode || isCreateMode) {\r\n <div class=\"flex gap-1\">\r\n @for (btn of createEditActions; track $index) {\r\n @if (!btn.visible || (btn.visible && btn.visible === true)) {\r\n @if (btn.type == 'submit' && inlineForm) {\r\n <lib-generic-button\r\n [type]=\"'submit'\"\r\n [loading]=\"inlineForm.loading\"\r\n [disabled]=\"inlineForm.loading || form.invalid\"\r\n [icon]=\"btn.icon\"\r\n [label]=\"btn.label | translate\"\r\n [variant]=\"btn.variant\"\r\n [severity]=\"btn.severity\"\r\n [size]=\"btn.size\"\r\n [model]=\"btn.splitActions\"\r\n [permission]=\"btn.permission\"\r\n (clicked)=\"inlineForm.onSubmit()\"\r\n ></lib-generic-button>\r\n }\r\n @else{\r\n <lib-generic-button\r\n [icon]=\"btn.icon\"\r\n [label]=\"btn.label | translate\"\r\n [variant]=\"btn.variant\"\r\n [severity]=\"btn.severity\"\r\n [size]=\"btn.size\"\r\n [model]=\"btn.splitActions\"\r\n [permission]=\"btn.permission\"\r\n (clicked)=\"handleCreateEditAction(btn)\"\r\n ></lib-generic-button>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n </ng-template>\r\n\r\n </p-toolbar>\r\n\r\n <!-- Tabs -->\r\n <p-tabs value=\"0\">\r\n <p-tablist>\r\n @for (tab of tabs_; track $index) {\r\n <p-tab value=\"{{$index}}\">\r\n <i [class]=\"tab.icon\"></i>\r\n <span class=\"mr-1 ml-1\">{{ tab.header }}</span>\r\n </p-tab>\r\n }\r\n </p-tablist>\r\n <p-tabpanels>\r\n @for (tab of tabs_; track $index) {\r\n <p-tabpanel value=\"{{$index}}\">\r\n\r\n <!-- Formly fields -->\r\n <!-- p-4 grid grid-cols-1 md:grid-cols-2 gap-4 -->\r\n <div class=\"border border-surface p-4\">\r\n @if (tab.fields.length && $index == 0) {\r\n\r\n <form *ngIf=\"form\" [formGroup]=\"form\">\r\n @if (tab.fields.length && $index == 0 ) {\r\n @if (isEditMode || isCreateMode) {\r\n <app-generic-dialog\r\n #inlineForm\r\n [form]=\"form\"\r\n [model]=\"model\"\r\n [formFields]=\"formFields ?? []\"\r\n [apiName]=\"apiName\"\r\n [idField]=\"idField ??'id'\"\r\n [displayMode]=\"'inline'\"\r\n [mode]=\"'form-only'\"\r\n [forceState]=\"isCreateMode ? 'create':'edit'\"\r\n (afterSave)=\"afterSave($event)\"\r\n >\r\n </app-generic-dialog>\r\n}\r\n@else if(isViewMode){\r\n <formly-form\r\n [form]=\"form\"\r\n [fields]=\"tab.fields\"\r\n [model]=\"model\"\r\n ></formly-form>\r\n}\r\n}\r\n </form>\r\n\r\n }\r\n @if (tab.fields.length && $index > 0) {\r\n\r\n\r\n <formly-form\r\n [form]=\"getForm($index)\"\r\n [fields]=\"tab.fields\"\r\n [model]=\"tab.model || model\"\r\n ></formly-form>\r\n\r\n }\r\n\r\n <!-- Custom template -->\r\n @if (tab.content) {\r\n <ng-container *ngTemplateOutlet=\"tab.content\"></ng-container>\r\n }\r\n </div>\r\n </p-tabpanel>\r\n }\r\n </p-tabpanels>\r\n </p-tabs>\r\n</div>\r\n\r\n<!-- [model]=\"model\" -->\r\n <app-generic-dialog\r\n #dialog\r\n [formFields]=\"formFields ?? []\"\r\n [apiName]=\"apiName\"\r\n [idField]=\"idField ??'id'\"\r\n [displayMode]=\"displayMode ?? 'dialog'\"\r\n (afterSave)=\"afterSave($event)\"\r\n >\r\n </app-generic-dialog>\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ToolbarModule }, { kind: "component", type: i2.Toolbar, selector: "p-toolbar", inputs: ["styleClass", "ariaLabelledBy"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i5.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i5.TabPanels, selector: "p-tabpanels" }, { kind: "component", type: i5.TabPanel, selector: "p-tabpanel", inputs: ["value"], outputs: ["valueChange"] }, { kind: "component", type: i5.TabList, selector: "p-tablist" }, { kind: "component", type: i5.Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "component", type: FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: BreadcrumbComponent, selector: "app-breadcrumb", inputs: ["breadcrumb"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i7.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo"] }, { kind: "component", type: GenericDialogComponent, selector: "app-generic-dialog", inputs: ["form", "service", "formFields", "model", "apiName", "idField", "dialogMaxWidth", "displayMode", "mode", "forceState", "drawerVisible", "dialogVisible", "isViewMode", "isEditMode", "useConfirmOnSave", "loading", "errorMsg", "errorMessage", "beforeSaveTransform", "hideTable", "autoShowForm"], outputs: ["action", "afterSave", "afterDelete", "beforeSave", "beforeDelete", "formCancel", "formInit", "dataLoaded", "selectionChange", "error", "visibleChange"] }, { kind: "component", type: GenericButton, selector: "lib-generic-button", inputs: ["model", "type", "icon", "label", "variant", "severity", "size", "iconPosition", "disabled", "loading", "ariaLabel", "extraClasses", "permission"], outputs: ["clicked", "itemClick"] }, { kind: "ngmodule", type: ProgressSpinnerModule }, { kind: "component", type: i8.ProgressSpinner, selector: "p-progressSpinner, p-progress-spinner, p-progressspinner", inputs: ["styleClass", "strokeWidth", "fill", "animationDuration", "ariaLabel"] }, { kind: "pipe", type: i9.TranslatePipe, name: "translate" }] });
|
|
315
|
+
}
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: GenericViewComponent, decorators: [{
|
|
317
|
+
type: Component,
|
|
318
|
+
args: [{ selector: 'app-detail-view', standalone: true, imports: [
|
|
319
|
+
CommonModule,
|
|
320
|
+
ToolbarModule,
|
|
321
|
+
ButtonModule,
|
|
322
|
+
TabsModule,
|
|
323
|
+
FormlyForm,
|
|
324
|
+
FormsModule,
|
|
325
|
+
ReactiveFormsModule,
|
|
326
|
+
TranslateModule,
|
|
327
|
+
BreadcrumbComponent,
|
|
328
|
+
TooltipModule,
|
|
329
|
+
GenericDialogComponent,
|
|
330
|
+
GenericButton,
|
|
331
|
+
ProgressSpinnerModule
|
|
332
|
+
], template: "\r\n@if (mode === 'detail') {\r\n<div class=\"w-full flex flex-col gap-3\">\r\n <!-- overlay -->\r\n <div *ngIf=\"loading\"\r\n class=\"absolute inset-0 bg-white/70 flex items-center justify-center z-50\">\r\n <p-progress-spinner/>\r\n </div>\r\n\r\n <!-- actual content -->\r\n <!-- Toolbar -->\r\n <p-toolbar style=\"background: transparent;border: 0px;box-shadow: none;\" class=\"bg-transparent shadow-none border-none rounded-md px-3\">\r\n <ng-template pTemplate=\"left\">\r\n <!-- <span class=\"font-semibold text-lg xs:hidden block\">{{ title }}</span> -->\r\n <app-breadcrumb class=\"xs:block\" [breadcrumb]=\"breadcrumb\"></app-breadcrumb> <!-- xs:block hidden -->\r\n </ng-template>\r\n <ng-template pTemplate=\"right\">\r\n <div class=\"flex gap-2\">\r\n\r\n <button\r\n pButton pRipple\r\n icon=\"pi pi-chevron-right\"\r\n class=\"p-button-text p-button-sm fd-btn\"\r\n pTooltip=\"\u0627\u0644\u062A\u0627\u0644\u064A\"\r\n (click)=\"next()\"\r\n ></button>\r\n <button\r\n pButton pRipple\r\n icon=\"pi pi-chevron-left\"\r\n class=\"p-button-text p-button-sm fd-btn\"\r\n pTooltip=\"\u0627\u0644\u0633\u0627\u0628\u0642\"\r\n (click)=\"previous()\"\r\n ></button>\r\n </div>\r\n </ng-template>\r\n </p-toolbar>\r\n <p-toolbar class=\"bg-white shadow rounded-md px-3\">\r\n\r\n <ng-template pTemplate=\"left\">\r\n @if (isViewMode) {\r\n <div class=\"flex gap-1\">\r\n @for (action of actions_; track $index) {\r\n <button\r\n pButton pRipple\r\n [icon]=\"action.icon ?? ''\"\r\n [label]=\"(action.label ?? '') | translate\"\r\n class=\"fd-btn\"\r\n (click)=\"onAction(action,model)\"\r\n ></button>\r\n }\r\n </div>\r\n }\r\n </ng-template>\r\n <ng-template pTemplate=\"right\">\r\n @if (isEditMode || isCreateMode) {\r\n <div class=\"flex gap-1\">\r\n @for (btn of createEditActions; track $index) {\r\n @if (!btn.visible || (btn.visible && btn.visible === true)) {\r\n @if (btn.type == 'submit' && inlineForm) {\r\n <lib-generic-button\r\n [type]=\"'submit'\"\r\n [loading]=\"inlineForm.loading\"\r\n [disabled]=\"inlineForm.loading || form.invalid\"\r\n [icon]=\"btn.icon\"\r\n [label]=\"btn.label | translate\"\r\n [variant]=\"btn.variant\"\r\n [severity]=\"btn.severity\"\r\n [size]=\"btn.size\"\r\n [model]=\"btn.splitActions\"\r\n [permission]=\"btn.permission\"\r\n (clicked)=\"inlineForm.onSubmit()\"\r\n ></lib-generic-button>\r\n }\r\n @else{\r\n <lib-generic-button\r\n [icon]=\"btn.icon\"\r\n [label]=\"btn.label | translate\"\r\n [variant]=\"btn.variant\"\r\n [severity]=\"btn.severity\"\r\n [size]=\"btn.size\"\r\n [model]=\"btn.splitActions\"\r\n [permission]=\"btn.permission\"\r\n (clicked)=\"handleCreateEditAction(btn)\"\r\n ></lib-generic-button>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n </ng-template>\r\n\r\n </p-toolbar>\r\n\r\n <!-- Tabs -->\r\n <p-tabs value=\"0\">\r\n <p-tablist>\r\n @for (tab of tabs_; track $index) {\r\n <p-tab value=\"{{$index}}\">\r\n <i [class]=\"tab.icon\"></i>\r\n <span class=\"mr-1 ml-1\">{{ tab.header }}</span>\r\n </p-tab>\r\n }\r\n </p-tablist>\r\n <p-tabpanels>\r\n @for (tab of tabs_; track $index) {\r\n <p-tabpanel value=\"{{$index}}\">\r\n\r\n <!-- Formly fields -->\r\n <!-- p-4 grid grid-cols-1 md:grid-cols-2 gap-4 -->\r\n <div class=\"border border-surface p-4\">\r\n @if (tab.fields.length && $index == 0) {\r\n\r\n <form *ngIf=\"form\" [formGroup]=\"form\">\r\n @if (tab.fields.length && $index == 0 ) {\r\n @if (isEditMode || isCreateMode) {\r\n <app-generic-dialog\r\n #inlineForm\r\n [form]=\"form\"\r\n [model]=\"model\"\r\n [formFields]=\"formFields ?? []\"\r\n [apiName]=\"apiName\"\r\n [idField]=\"idField ??'id'\"\r\n [displayMode]=\"'inline'\"\r\n [mode]=\"'form-only'\"\r\n [forceState]=\"isCreateMode ? 'create':'edit'\"\r\n (afterSave)=\"afterSave($event)\"\r\n >\r\n </app-generic-dialog>\r\n}\r\n@else if(isViewMode){\r\n <formly-form\r\n [form]=\"form\"\r\n [fields]=\"tab.fields\"\r\n [model]=\"model\"\r\n ></formly-form>\r\n}\r\n}\r\n </form>\r\n\r\n }\r\n @if (tab.fields.length && $index > 0) {\r\n\r\n\r\n <formly-form\r\n [form]=\"getForm($index)\"\r\n [fields]=\"tab.fields\"\r\n [model]=\"tab.model || model\"\r\n ></formly-form>\r\n\r\n }\r\n\r\n <!-- Custom template -->\r\n @if (tab.content) {\r\n <ng-container *ngTemplateOutlet=\"tab.content\"></ng-container>\r\n }\r\n </div>\r\n </p-tabpanel>\r\n }\r\n </p-tabpanels>\r\n </p-tabs>\r\n</div>\r\n\r\n<!-- [model]=\"model\" -->\r\n <app-generic-dialog\r\n #dialog\r\n [formFields]=\"formFields ?? []\"\r\n [apiName]=\"apiName\"\r\n [idField]=\"idField ??'id'\"\r\n [displayMode]=\"displayMode ?? 'dialog'\"\r\n (afterSave)=\"afterSave($event)\"\r\n >\r\n </app-generic-dialog>\r\n}\r\n" }]
|
|
333
|
+
}], propDecorators: { title: [{
|
|
334
|
+
type: Input
|
|
335
|
+
}], actions: [{
|
|
336
|
+
type: Input
|
|
337
|
+
}], createEditActions: [{
|
|
338
|
+
type: Input
|
|
339
|
+
}], tabs: [{
|
|
340
|
+
type: Input
|
|
341
|
+
}], viewMode: [{
|
|
342
|
+
type: Input
|
|
343
|
+
}], breadcrumb: [{
|
|
344
|
+
type: Input
|
|
345
|
+
}], service: [{
|
|
346
|
+
type: Input
|
|
347
|
+
}], formFields: [{
|
|
348
|
+
type: Input
|
|
349
|
+
}], apiName: [{
|
|
350
|
+
type: Input
|
|
351
|
+
}], idField: [{
|
|
352
|
+
type: Input
|
|
353
|
+
}], standaloneMode: [{
|
|
354
|
+
type: Input
|
|
355
|
+
}], isViewMode: [{
|
|
356
|
+
type: Input
|
|
357
|
+
}], isCreateMode: [{
|
|
358
|
+
type: Input
|
|
359
|
+
}], isEditMode: [{
|
|
360
|
+
type: Input
|
|
361
|
+
}], model: [{
|
|
362
|
+
type: Input
|
|
363
|
+
}], displayMode: [{
|
|
364
|
+
type: Input
|
|
365
|
+
}], mode: [{
|
|
366
|
+
type: Input
|
|
367
|
+
}], action: [{
|
|
368
|
+
type: Output
|
|
369
|
+
}], afterDelete: [{
|
|
370
|
+
type: Output
|
|
371
|
+
}], dialog: [{
|
|
372
|
+
type: ViewChild,
|
|
373
|
+
args: ['dialog']
|
|
374
|
+
}], inlineForm: [{
|
|
375
|
+
type: ViewChild,
|
|
376
|
+
args: ['inlineForm']
|
|
377
|
+
}], loading: [{
|
|
378
|
+
type: Input
|
|
379
|
+
}] } });
|
|
380
|
+
|
|
381
|
+
class GenericViewModule {
|
|
382
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: GenericViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
383
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.8", ngImport: i0, type: GenericViewModule, imports: [CommonModule] });
|
|
384
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: GenericViewModule, imports: [CommonModule] });
|
|
385
|
+
}
|
|
386
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: GenericViewModule, decorators: [{
|
|
387
|
+
type: NgModule,
|
|
388
|
+
args: [{
|
|
389
|
+
imports: [CommonModule],
|
|
390
|
+
}]
|
|
391
|
+
}] });
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Generated bundle index. Do not edit.
|
|
395
|
+
*/
|
|
396
|
+
|
|
397
|
+
export { GenericViewComponent, GenericViewModule };
|
|
398
|
+
//# sourceMappingURL=elite.framework-ng.ui.core-generic-view.mjs.map
|