angular-dumb-lib 0.0.30 → 0.0.32
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/angular-dumb-lib.mjs +351 -93
- package/fesm2022/angular-dumb-lib.mjs.map +1 -1
- package/lib/components/atoms/file-selection/file-selection.component.d.ts +11 -7
- package/lib/components/atoms/selection/selection.component.d.ts +8 -15
- package/lib/components/molecules/actions/actions.component.d.ts +15 -0
- package/lib/components/molecules/paginator/paginator.component.d.ts +1 -1
- package/lib/components/pages/admin/admin.component.d.ts +47 -0
- package/lib/shared/enums/enum.d.ts +4 -5
- package/lib/shared/facades/event-abstract.facade.d.ts +8 -0
- package/lib/shared/facades/pages.facade.d.ts +31 -0
- package/lib/shared/interfaces/interface.d.ts +2 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Component, NgModule, EventEmitter, Output, Input, forwardRef,
|
|
2
|
+
import { Injectable, Component, NgModule, EventEmitter, Output, Input, forwardRef, ViewChild, ContentChild, HostListener } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
|
-
import { FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
-
import { Subject, takeUntil } from 'rxjs';
|
|
6
|
+
import { FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, FormControl, FormGroup } from '@angular/forms';
|
|
7
|
+
import { Subject, takeUntil, BehaviorSubject, of } from 'rxjs';
|
|
8
8
|
import * as i1$1 from '@angular/platform-browser';
|
|
9
9
|
import * as i2$1 from 'primeng/table';
|
|
10
10
|
import { TableModule } from 'primeng/table';
|
|
@@ -101,6 +101,11 @@ var InputType;
|
|
|
101
101
|
InputType["select"] = "select";
|
|
102
102
|
InputType["file"] = "file";
|
|
103
103
|
})(InputType || (InputType = {}));
|
|
104
|
+
var TableColumnType;
|
|
105
|
+
(function (TableColumnType) {
|
|
106
|
+
TableColumnType["text"] = "text";
|
|
107
|
+
TableColumnType["image"] = "image";
|
|
108
|
+
})(TableColumnType || (TableColumnType = {}));
|
|
104
109
|
var ContentDirection;
|
|
105
110
|
(function (ContentDirection) {
|
|
106
111
|
ContentDirection["left"] = "left";
|
|
@@ -108,12 +113,6 @@ var ContentDirection;
|
|
|
108
113
|
ContentDirection["up"] = "up";
|
|
109
114
|
ContentDirection["down"] = "down";
|
|
110
115
|
})(ContentDirection || (ContentDirection = {}));
|
|
111
|
-
var SelectionType;
|
|
112
|
-
(function (SelectionType) {
|
|
113
|
-
SelectionType["dropdown"] = "dropdown";
|
|
114
|
-
SelectionType["radio"] = "radio";
|
|
115
|
-
SelectionType["checkbox"] = "checkbox";
|
|
116
|
-
})(SelectionType || (SelectionType = {}));
|
|
117
116
|
var Size;
|
|
118
117
|
(function (Size) {
|
|
119
118
|
Size["Xbig"] = "xbig";
|
|
@@ -247,19 +246,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
247
246
|
|
|
248
247
|
class FileSelectionComponent {
|
|
249
248
|
constructor() {
|
|
250
|
-
this.
|
|
251
|
-
this.
|
|
249
|
+
this.label = '';
|
|
250
|
+
this.chooseFileLabel = 'Select Image';
|
|
251
|
+
this.imageUrl = null;
|
|
252
|
+
this.fileName = null;
|
|
253
|
+
this.valueChange = new EventEmitter();
|
|
254
|
+
this._value = null;
|
|
255
|
+
this.isDisabled = false;
|
|
252
256
|
this.onChange = () => { };
|
|
253
257
|
this.onTouched = () => { };
|
|
254
|
-
this._value = undefined;
|
|
255
258
|
}
|
|
256
259
|
get value() {
|
|
257
260
|
return this._value;
|
|
258
261
|
}
|
|
259
|
-
set value(
|
|
260
|
-
this._value =
|
|
261
|
-
this.onChange(
|
|
262
|
+
set value(val) {
|
|
263
|
+
this._value = val;
|
|
264
|
+
this.onChange(val);
|
|
262
265
|
this.onTouched();
|
|
266
|
+
this.valueChange.emit(val);
|
|
263
267
|
}
|
|
264
268
|
ngOnInit() {
|
|
265
269
|
this.config = {
|
|
@@ -269,25 +273,45 @@ class FileSelectionComponent {
|
|
|
269
273
|
}
|
|
270
274
|
onFileSelected(event) {
|
|
271
275
|
const input = event.target;
|
|
272
|
-
if (input.files
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
reader.onload = (e) => {
|
|
280
|
-
this.imageUrl = e.target.result; // Set image URL for preview
|
|
281
|
-
};
|
|
282
|
-
reader.readAsDataURL(file);
|
|
276
|
+
if (!input.files?.length)
|
|
277
|
+
return;
|
|
278
|
+
const file = input.files[0];
|
|
279
|
+
this.fileName = file.name;
|
|
280
|
+
this.value = file;
|
|
281
|
+
if (file.type.startsWith('image/')) {
|
|
282
|
+
this.previewImage(file);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
+
previewImage(file) {
|
|
286
|
+
const reader = new FileReader();
|
|
287
|
+
reader.onload = () => {
|
|
288
|
+
this.imageUrl = reader.result;
|
|
289
|
+
};
|
|
290
|
+
reader.readAsDataURL(file);
|
|
291
|
+
}
|
|
285
292
|
triggerFileInput() {
|
|
286
|
-
|
|
287
|
-
|
|
293
|
+
if (!this.isDisabled) {
|
|
294
|
+
this.fileInputRef.nativeElement.click();
|
|
295
|
+
}
|
|
288
296
|
}
|
|
289
297
|
writeValue(value) {
|
|
290
298
|
this._value = value;
|
|
299
|
+
if (value instanceof File) {
|
|
300
|
+
this.fileName = value.name;
|
|
301
|
+
const reader = new FileReader();
|
|
302
|
+
reader.onload = (e) => {
|
|
303
|
+
this.imageUrl = e.target.result;
|
|
304
|
+
};
|
|
305
|
+
reader.readAsDataURL(value);
|
|
306
|
+
}
|
|
307
|
+
else if (typeof value === 'string') {
|
|
308
|
+
this.imageUrl = value;
|
|
309
|
+
this.fileName = value.split('/').pop() || 'image.jpg';
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
this.imageUrl = null;
|
|
313
|
+
this.fileName = null;
|
|
314
|
+
}
|
|
291
315
|
}
|
|
292
316
|
registerOnChange(fn) {
|
|
293
317
|
this.onChange = fn;
|
|
@@ -296,14 +320,14 @@ class FileSelectionComponent {
|
|
|
296
320
|
this.onTouched = fn;
|
|
297
321
|
}
|
|
298
322
|
setDisabledState(isDisabled) {
|
|
299
|
-
|
|
323
|
+
this.isDisabled = isDisabled;
|
|
300
324
|
}
|
|
301
325
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FileSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
302
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: FileSelectionComponent, isStandalone: true, selector: "app-file-selection", inputs: { label: "label", chooseFileLabel: "chooseFileLabel", imageUrl: "imageUrl", fileName: "fileName" }, providers: [{
|
|
326
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: FileSelectionComponent, isStandalone: true, selector: "app-file-selection", inputs: { label: "label", chooseFileLabel: "chooseFileLabel", imageUrl: "imageUrl", fileName: "fileName" }, outputs: { valueChange: "valueChange" }, providers: [{
|
|
303
327
|
provide: NG_VALUE_ACCESSOR,
|
|
304
328
|
useExisting: forwardRef(() => FileSelectionComponent),
|
|
305
329
|
multi: true
|
|
306
|
-
}], ngImport: i0, template: "<div class=\"file-selector\">\n <label *ngIf=\"label\">{{ label }}</label>\n <input\n
|
|
330
|
+
}], viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div class=\"file-selector\">\n <label *ngIf=\"label\">{{ label }}</label>\n\n <input\n #fileInput\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileSelected($event)\"\n class=\"hidden-file-input\"\n [disabled]=\"isDisabled\"\n />\n\n <div class=\"file-selection\">\n <app-button\n [config]=\"config\"\n class=\"custom-file-button\"\n (clickEvent)=\"triggerFileInput()\"\n >\n {{ chooseFileLabel }}\n </app-button>\n\n <div *ngIf=\"fileName\" class=\"file-name\">\n {{ fileName }}\n </div>\n </div>\n\n <div *ngIf=\"imageUrl\" class=\"preview-container\">\n <img [src]=\"imageUrl\" alt=\"Selected Image\" class=\"preview-image\" />\n </div>\n</div>\n", styles: [".file-selector{display:flex;flex-direction:column;align-items:flex-start}.file-selector label{font-size:14px;color:#666;margin-bottom:8px;font-weight:700}.file-selector input[type=file]{margin-bottom:16px}.file-selector .preview-image{max-width:150px;max-height:150px;border:1px solid #ccc;margin-top:8px}.file-selector .hidden-file-input{opacity:0;position:absolute;z-index:-1}.file-selector .file-selection{display:flex;align-items:center;gap:10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "app-button", inputs: ["config"], outputs: ["clickEvent"] }] }); }
|
|
307
331
|
}
|
|
308
332
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FileSelectionComponent, decorators: [{
|
|
309
333
|
type: Component,
|
|
@@ -311,7 +335,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
311
335
|
provide: NG_VALUE_ACCESSOR,
|
|
312
336
|
useExisting: forwardRef(() => FileSelectionComponent),
|
|
313
337
|
multi: true
|
|
314
|
-
}], imports: [CommonModule, ButtonComponent], template: "<div class=\"file-selector\">\n <label *ngIf=\"label\">{{ label }}</label>\n <input\n
|
|
338
|
+
}], imports: [CommonModule, ButtonComponent], template: "<div class=\"file-selector\">\n <label *ngIf=\"label\">{{ label }}</label>\n\n <input\n #fileInput\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileSelected($event)\"\n class=\"hidden-file-input\"\n [disabled]=\"isDisabled\"\n />\n\n <div class=\"file-selection\">\n <app-button\n [config]=\"config\"\n class=\"custom-file-button\"\n (clickEvent)=\"triggerFileInput()\"\n >\n {{ chooseFileLabel }}\n </app-button>\n\n <div *ngIf=\"fileName\" class=\"file-name\">\n {{ fileName }}\n </div>\n </div>\n\n <div *ngIf=\"imageUrl\" class=\"preview-container\">\n <img [src]=\"imageUrl\" alt=\"Selected Image\" class=\"preview-image\" />\n </div>\n</div>\n", styles: [".file-selector{display:flex;flex-direction:column;align-items:flex-start}.file-selector label{font-size:14px;color:#666;margin-bottom:8px;font-weight:700}.file-selector input[type=file]{margin-bottom:16px}.file-selector .preview-image{max-width:150px;max-height:150px;border:1px solid #ccc;margin-top:8px}.file-selector .hidden-file-input{opacity:0;position:absolute;z-index:-1}.file-selector .file-selection{display:flex;align-items:center;gap:10px}\n"] }]
|
|
315
339
|
}], propDecorators: { label: [{
|
|
316
340
|
type: Input
|
|
317
341
|
}], chooseFileLabel: [{
|
|
@@ -320,6 +344,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
320
344
|
type: Input
|
|
321
345
|
}], fileName: [{
|
|
322
346
|
type: Input
|
|
347
|
+
}], valueChange: [{
|
|
348
|
+
type: Output
|
|
349
|
+
}], fileInputRef: [{
|
|
350
|
+
type: ViewChild,
|
|
351
|
+
args: ['fileInput']
|
|
323
352
|
}] } });
|
|
324
353
|
|
|
325
354
|
class InputComponent {
|
|
@@ -406,48 +435,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
406
435
|
|
|
407
436
|
class SelectionComponent {
|
|
408
437
|
constructor() {
|
|
409
|
-
this.label = '';
|
|
410
|
-
this.options = [];
|
|
411
|
-
this.
|
|
412
|
-
this.
|
|
413
|
-
this.
|
|
414
|
-
this.selectedChange = new EventEmitter(); // Event emitter for value changes
|
|
438
|
+
this.label = '';
|
|
439
|
+
this.options = [];
|
|
440
|
+
this.isMultiSelect = false;
|
|
441
|
+
this.selectedChange = new EventEmitter();
|
|
442
|
+
this._value = [];
|
|
415
443
|
this.onChange = () => { };
|
|
416
444
|
this.onTouched = () => { };
|
|
417
445
|
}
|
|
418
446
|
get value() {
|
|
419
|
-
return this.
|
|
420
|
-
}
|
|
421
|
-
set value(value) {
|
|
422
|
-
this.selectedValue = (this.isMultiSelect === false && Array.isArray(value)) ? value[0] : value;
|
|
423
|
-
this.onChange(this.selectedValue);
|
|
424
|
-
this.onTouched();
|
|
447
|
+
return this._value;
|
|
425
448
|
}
|
|
426
|
-
|
|
427
|
-
if (
|
|
428
|
-
this.
|
|
429
|
-
this.onChange(
|
|
449
|
+
set value(val) {
|
|
450
|
+
if (JSON.stringify(this._value) !== JSON.stringify(val)) {
|
|
451
|
+
this._value = val;
|
|
452
|
+
this.onChange(val);
|
|
453
|
+
this.onTouched();
|
|
454
|
+
this.selectedChange.emit(val);
|
|
430
455
|
}
|
|
431
456
|
}
|
|
432
|
-
|
|
433
|
-
this.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
const target = event.target;
|
|
437
|
-
const value = target.value;
|
|
438
|
-
if (target.checked) {
|
|
439
|
-
this.selectedValues.push(value);
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
this.selectedValues = this.selectedValues.filter(v => v !== value);
|
|
443
|
-
}
|
|
444
|
-
this.selectedChange.emit(this.selectedValues);
|
|
445
|
-
}
|
|
446
|
-
isSelected(value) {
|
|
447
|
-
return this.isMultiSelect ? this.selectedValues.includes(value) : value === this.selectedValue;
|
|
457
|
+
onDropdownChange(value) {
|
|
458
|
+
this.value = this.isMultiSelect
|
|
459
|
+
? value
|
|
460
|
+
: (Array.isArray(value) ? value[0] : value);
|
|
448
461
|
}
|
|
449
462
|
writeValue(value) {
|
|
450
|
-
this.
|
|
463
|
+
this._value = this.isMultiSelect
|
|
464
|
+
? (Array.isArray(value) ? [...value] : [])
|
|
465
|
+
: value;
|
|
451
466
|
}
|
|
452
467
|
registerOnChange(fn) {
|
|
453
468
|
this.onChange = fn;
|
|
@@ -455,35 +470,30 @@ class SelectionComponent {
|
|
|
455
470
|
registerOnTouched(fn) {
|
|
456
471
|
this.onTouched = fn;
|
|
457
472
|
}
|
|
458
|
-
setDisabledState(isDisabled) {
|
|
459
|
-
// Implement if you need to handle disabled state
|
|
460
|
-
}
|
|
461
473
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: SelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
462
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: SelectionComponent, isStandalone: true, selector: "app-selection", inputs: { label: "label", options: "options",
|
|
474
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: SelectionComponent, isStandalone: true, selector: "app-selection", inputs: { label: "label", options: "options", isMultiSelect: "isMultiSelect" }, outputs: { selectedChange: "selectedChange" }, providers: [
|
|
475
|
+
{
|
|
463
476
|
provide: NG_VALUE_ACCESSOR,
|
|
464
477
|
useExisting: forwardRef(() => SelectionComponent),
|
|
465
|
-
multi: true
|
|
466
|
-
}
|
|
478
|
+
multi: true,
|
|
479
|
+
},
|
|
480
|
+
], ngImport: i0, template: "<div class=\"dropdown\">\n <label *ngIf=\"label\">{{ label }}</label>\n <select\n [multiple]=\"isMultiSelect\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onDropdownChange($event)\">\n <option *ngFor=\"let option of options\" [value]=\"option.value\">\n {{ option.label }}\n </option>\n </select>\n</div>\n", styles: [".dropdown,.radio-group,.checkbox-group{display:flex;flex-direction:column;width:100%;min-width:150px}.dropdown label,.radio-group label,.checkbox-group label{font-size:12px;color:#666;margin-bottom:4px;font-weight:700}.dropdown select{width:100%;padding:9px 8px;font-size:12px;color:#333;background-color:#fff;border:1px solid #ccc;border-radius:4px;appearance:none;cursor:pointer;transition:border-color .3s,box-shadow .3s}.dropdown select:hover{border-color:#888}.dropdown select:focus{border-color:#03a9f4;box-shadow:0 0 5px #03a9f480;outline:none}.radio-group div,.checkbox-group div{display:flex;align-items:center;margin-bottom:8px}.radio-group input[type=radio],.checkbox-group input[type=checkbox]{margin-right:8px;cursor:pointer}.radio-group label,.checkbox-group label{font-size:12px;color:#333;cursor:pointer}.radio-group input[type=radio]:focus,.checkbox-group input[type=checkbox]:focus{outline:2px solid #03A9F4;outline-offset:2px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
467
481
|
}
|
|
468
482
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: SelectionComponent, decorators: [{
|
|
469
483
|
type: Component,
|
|
470
|
-
args: [{ selector: 'app-selection', standalone: true, providers: [
|
|
484
|
+
args: [{ selector: 'app-selection', standalone: true, imports: [CommonModule, FormsModule], providers: [
|
|
485
|
+
{
|
|
471
486
|
provide: NG_VALUE_ACCESSOR,
|
|
472
487
|
useExisting: forwardRef(() => SelectionComponent),
|
|
473
|
-
multi: true
|
|
474
|
-
}
|
|
488
|
+
multi: true,
|
|
489
|
+
},
|
|
490
|
+
], template: "<div class=\"dropdown\">\n <label *ngIf=\"label\">{{ label }}</label>\n <select\n [multiple]=\"isMultiSelect\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onDropdownChange($event)\">\n <option *ngFor=\"let option of options\" [value]=\"option.value\">\n {{ option.label }}\n </option>\n </select>\n</div>\n", styles: [".dropdown,.radio-group,.checkbox-group{display:flex;flex-direction:column;width:100%;min-width:150px}.dropdown label,.radio-group label,.checkbox-group label{font-size:12px;color:#666;margin-bottom:4px;font-weight:700}.dropdown select{width:100%;padding:9px 8px;font-size:12px;color:#333;background-color:#fff;border:1px solid #ccc;border-radius:4px;appearance:none;cursor:pointer;transition:border-color .3s,box-shadow .3s}.dropdown select:hover{border-color:#888}.dropdown select:focus{border-color:#03a9f4;box-shadow:0 0 5px #03a9f480;outline:none}.radio-group div,.checkbox-group div{display:flex;align-items:center;margin-bottom:8px}.radio-group input[type=radio],.checkbox-group input[type=checkbox]{margin-right:8px;cursor:pointer}.radio-group label,.checkbox-group label{font-size:12px;color:#333;cursor:pointer}.radio-group input[type=radio]:focus,.checkbox-group input[type=checkbox]:focus{outline:2px solid #03A9F4;outline-offset:2px}\n"] }]
|
|
475
491
|
}], propDecorators: { label: [{
|
|
476
492
|
type: Input
|
|
477
493
|
}], options: [{
|
|
478
494
|
type: Input
|
|
479
|
-
}], selectedValue: [{
|
|
480
|
-
type: Input
|
|
481
|
-
}], selectedValues: [{
|
|
482
|
-
type: Input
|
|
483
495
|
}], isMultiSelect: [{
|
|
484
496
|
type: Input
|
|
485
|
-
}], displayType: [{
|
|
486
|
-
type: Input
|
|
487
497
|
}], selectedChange: [{
|
|
488
498
|
type: Output
|
|
489
499
|
}] } });
|
|
@@ -737,14 +747,14 @@ class FormComponent {
|
|
|
737
747
|
return !!(control && control.invalid && (control.dirty || control.touched));
|
|
738
748
|
}
|
|
739
749
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
740
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: FormComponent, isStandalone: true, selector: "app-form", inputs: { formGroup: "formGroup", inputConfigs: "inputConfigs", buttonConfig: "buttonConfig", validationMessages: "validationMessages" }, outputs: { formSubmit: "formSubmit", formChange: "formChange" }, ngImport: i0, template: "<form (ngSubmit)=\"onSubmit()\" [formGroup]=\"formGroup\">\n <ng-container *ngIf=\"inputConfigs && inputConfigs.length > 0; else noInputs\">\n <ng-container *ngFor=\"let inputConfig of inputConfigs; trackBy: trackByFn\">\n\n <!-- Input Field -->\n <app-input\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.textual\"\n [formControlName]=\"inputConfig.name\"\n [config]=\"inputConfig\"\n [required]=\"inputConfig.required!\"\n [isInvalid]=\"isControlInvalid(inputConfig.name)\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-input>\n\n <!-- Selection Field -->\n <app-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.selection\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n [options]=\"inputConfig.options\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-selection>\n\n <!-- File Selection -->\n <app-file-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.file\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-file-selection>\n\n <!-- Validation Messages -->\n <div *ngIf=\"formGroup.controls[inputConfig.name]?.invalid && formGroup.controls[inputConfig.name]?.touched\" class=\"error-message\">\n <ng-container *ngIf=\"formGroup.controls[inputConfig.name]?.errors as errors\">\n <ng-container *ngFor=\"let errorKey of getErrorKeys(errors)\">\n <div *ngIf=\"validationMessages[inputConfig.name]?.[errorKey]\">\n {{ validationMessages[inputConfig.name][errorKey] }}\n </div>\n </ng-container>\n </ng-container>\n </div>\n\n </ng-container>\n </ng-container>\n\n <!-- Submit Button -->\n <app-button [config]=\"buttonConfig\"></app-button>\n</form>\n\n<!-- No Inputs Placeholder -->\n<ng-template #noInputs>\n <p>No inputs configured.</p>\n</ng-template>\n", styles: ["form{display:flex;flex-direction:column;gap:15px}label{display:block;margin-bottom:.5rem}input,textarea{width:100%;padding:.5rem;border:1px solid #ccc;border-radius:.25rem}.error-message{color:red;font-size:12px;margin-top:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InputComponent, selector: "app-input", inputs: ["config", "isInvalid"] }, { kind: "component", type: SelectionComponent, selector: "app-selection", inputs: ["label", "options", "
|
|
750
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: FormComponent, isStandalone: true, selector: "app-form", inputs: { formGroup: "formGroup", inputConfigs: "inputConfigs", buttonConfig: "buttonConfig", validationMessages: "validationMessages" }, outputs: { formSubmit: "formSubmit", formChange: "formChange" }, ngImport: i0, template: "<form (ngSubmit)=\"onSubmit()\" [formGroup]=\"formGroup\">\n <ng-container *ngIf=\"inputConfigs && inputConfigs.length > 0; else noInputs\">\n <ng-container *ngFor=\"let inputConfig of inputConfigs; trackBy: trackByFn\">\n\n <!-- Input Field -->\n <app-input\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.textual\"\n [formControlName]=\"inputConfig.name\"\n [config]=\"inputConfig\"\n [required]=\"inputConfig.required!\"\n [isInvalid]=\"isControlInvalid(inputConfig.name)\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-input>\n\n <!-- Selection Field -->\n <app-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.selection\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n [options]=\"inputConfig.options\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-selection>\n\n <!-- File Selection -->\n <app-file-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.file\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n [chooseFileLabel]=\"'Choose Image'\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-file-selection>\n\n <!-- Validation Messages -->\n <div *ngIf=\"formGroup.controls[inputConfig.name]?.invalid && formGroup.controls[inputConfig.name]?.touched\" class=\"error-message\">\n <ng-container *ngIf=\"formGroup.controls[inputConfig.name]?.errors as errors\">\n <ng-container *ngFor=\"let errorKey of getErrorKeys(errors)\">\n <div *ngIf=\"validationMessages[inputConfig.name]?.[errorKey]\">\n {{ validationMessages[inputConfig.name][errorKey] }}\n </div>\n </ng-container>\n </ng-container>\n </div>\n\n </ng-container>\n </ng-container>\n\n <!-- Submit Button -->\n <app-button [config]=\"buttonConfig\"></app-button>\n</form>\n\n<!-- No Inputs Placeholder -->\n<ng-template #noInputs>\n <p>No inputs configured.</p>\n</ng-template>\n", styles: ["form{display:flex;flex-direction:column;gap:15px}label{display:block;margin-bottom:.5rem}input,textarea{width:100%;padding:.5rem;border:1px solid #ccc;border-radius:.25rem}.error-message{color:red;font-size:12px;margin-top:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InputComponent, selector: "app-input", inputs: ["config", "isInvalid"] }, { kind: "component", type: SelectionComponent, selector: "app-selection", inputs: ["label", "options", "isMultiSelect"], outputs: ["selectedChange"] }, { kind: "component", type: FileSelectionComponent, selector: "app-file-selection", inputs: ["label", "chooseFileLabel", "imageUrl", "fileName"], outputs: ["valueChange"] }, { kind: "component", type: ButtonComponent, selector: "app-button", inputs: ["config"], outputs: ["clickEvent"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
|
|
741
751
|
}
|
|
742
752
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: FormComponent, decorators: [{
|
|
743
753
|
type: Component,
|
|
744
754
|
args: [{ selector: 'app-form', standalone: true, imports: [
|
|
745
755
|
CommonModule, InputComponent, SelectionComponent,
|
|
746
756
|
FileSelectionComponent, ButtonComponent, FormsModule, ReactiveFormsModule
|
|
747
|
-
], template: "<form (ngSubmit)=\"onSubmit()\" [formGroup]=\"formGroup\">\n <ng-container *ngIf=\"inputConfigs && inputConfigs.length > 0; else noInputs\">\n <ng-container *ngFor=\"let inputConfig of inputConfigs; trackBy: trackByFn\">\n\n <!-- Input Field -->\n <app-input\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.textual\"\n [formControlName]=\"inputConfig.name\"\n [config]=\"inputConfig\"\n [required]=\"inputConfig.required!\"\n [isInvalid]=\"isControlInvalid(inputConfig.name)\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-input>\n\n <!-- Selection Field -->\n <app-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.selection\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n [options]=\"inputConfig.options\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-selection>\n\n <!-- File Selection -->\n <app-file-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.file\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-file-selection>\n\n <!-- Validation Messages -->\n <div *ngIf=\"formGroup.controls[inputConfig.name]?.invalid && formGroup.controls[inputConfig.name]?.touched\" class=\"error-message\">\n <ng-container *ngIf=\"formGroup.controls[inputConfig.name]?.errors as errors\">\n <ng-container *ngFor=\"let errorKey of getErrorKeys(errors)\">\n <div *ngIf=\"validationMessages[inputConfig.name]?.[errorKey]\">\n {{ validationMessages[inputConfig.name][errorKey] }}\n </div>\n </ng-container>\n </ng-container>\n </div>\n\n </ng-container>\n </ng-container>\n\n <!-- Submit Button -->\n <app-button [config]=\"buttonConfig\"></app-button>\n</form>\n\n<!-- No Inputs Placeholder -->\n<ng-template #noInputs>\n <p>No inputs configured.</p>\n</ng-template>\n", styles: ["form{display:flex;flex-direction:column;gap:15px}label{display:block;margin-bottom:.5rem}input,textarea{width:100%;padding:.5rem;border:1px solid #ccc;border-radius:.25rem}.error-message{color:red;font-size:12px;margin-top:4px}\n"] }]
|
|
757
|
+
], template: "<form (ngSubmit)=\"onSubmit()\" [formGroup]=\"formGroup\">\n <ng-container *ngIf=\"inputConfigs && inputConfigs.length > 0; else noInputs\">\n <ng-container *ngFor=\"let inputConfig of inputConfigs; trackBy: trackByFn\">\n\n <!-- Input Field -->\n <app-input\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.textual\"\n [formControlName]=\"inputConfig.name\"\n [config]=\"inputConfig\"\n [required]=\"inputConfig.required!\"\n [isInvalid]=\"isControlInvalid(inputConfig.name)\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-input>\n\n <!-- Selection Field -->\n <app-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.selection\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n [options]=\"inputConfig.options\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-selection>\n\n <!-- File Selection -->\n <app-file-selection\n *ngIf=\"checkFormConfigType(inputConfig.type) === InputGroupType.file\"\n [formControlName]=\"inputConfig.name\"\n [label]=\"inputConfig.label!\"\n [chooseFileLabel]=\"'Choose Image'\"\n (valueChange)=\"onValueChange(inputConfig.name, $event)\">\n </app-file-selection>\n\n <!-- Validation Messages -->\n <div *ngIf=\"formGroup.controls[inputConfig.name]?.invalid && formGroup.controls[inputConfig.name]?.touched\" class=\"error-message\">\n <ng-container *ngIf=\"formGroup.controls[inputConfig.name]?.errors as errors\">\n <ng-container *ngFor=\"let errorKey of getErrorKeys(errors)\">\n <div *ngIf=\"validationMessages[inputConfig.name]?.[errorKey]\">\n {{ validationMessages[inputConfig.name][errorKey] }}\n </div>\n </ng-container>\n </ng-container>\n </div>\n\n </ng-container>\n </ng-container>\n\n <!-- Submit Button -->\n <app-button [config]=\"buttonConfig\"></app-button>\n</form>\n\n<!-- No Inputs Placeholder -->\n<ng-template #noInputs>\n <p>No inputs configured.</p>\n</ng-template>\n", styles: ["form{display:flex;flex-direction:column;gap:15px}label{display:block;margin-bottom:.5rem}input,textarea{width:100%;padding:.5rem;border:1px solid #ccc;border-radius:.25rem}.error-message{color:red;font-size:12px;margin-top:4px}\n"] }]
|
|
748
758
|
}], propDecorators: { formGroup: [{
|
|
749
759
|
type: Input
|
|
750
760
|
}], inputConfigs: [{
|
|
@@ -834,21 +844,21 @@ class PaginatorComponent {
|
|
|
834
844
|
this.itemsPerPageList = [
|
|
835
845
|
{
|
|
836
846
|
label: "3",
|
|
837
|
-
value:
|
|
847
|
+
value: 3
|
|
838
848
|
},
|
|
839
849
|
{
|
|
840
850
|
label: "5",
|
|
841
|
-
value:
|
|
851
|
+
value: 5
|
|
842
852
|
},
|
|
843
853
|
{
|
|
844
854
|
label: "20",
|
|
845
|
-
value:
|
|
855
|
+
value: 20
|
|
846
856
|
}
|
|
847
857
|
];
|
|
848
858
|
this.selectedPage = 1;
|
|
849
859
|
this.buttonType = ButtonType.button;
|
|
850
860
|
this.inputDirection = InputDirection.horizontal;
|
|
851
|
-
this.itemsPerPage = parseInt(this.itemsPerPageList[0].
|
|
861
|
+
this.itemsPerPage = parseInt(this.itemsPerPageList[0].value);
|
|
852
862
|
this.calculateNumberOfPage(this.totalRecords, this.itemsPerPage);
|
|
853
863
|
this.updateButtonConfigs();
|
|
854
864
|
this.emitPaging();
|
|
@@ -862,11 +872,10 @@ class PaginatorComponent {
|
|
|
862
872
|
this.updateButtonConfigs();
|
|
863
873
|
this.emitPaging();
|
|
864
874
|
}
|
|
865
|
-
onChangeNumberOfPage(
|
|
875
|
+
onChangeNumberOfPage(itemsPerPage) {
|
|
866
876
|
this.selectedPage = 1;
|
|
867
|
-
this.itemsPerPage =
|
|
868
|
-
|
|
869
|
-
this.calculateNumberOfPage(this.totalRecords, this.itemsPerPage);
|
|
877
|
+
this.itemsPerPage = itemsPerPage;
|
|
878
|
+
this.calculateNumberOfPage(this.totalRecords, itemsPerPage);
|
|
870
879
|
this.updateButtonConfigs();
|
|
871
880
|
this.emitPaging();
|
|
872
881
|
}
|
|
@@ -901,11 +910,11 @@ class PaginatorComponent {
|
|
|
901
910
|
};
|
|
902
911
|
}
|
|
903
912
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
904
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: PaginatorComponent, isStandalone: true, selector: "app-paginator", inputs: { totalRecords: "totalRecords" }, outputs: { paginator: "paginator" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"table-footer\">\n <div class=\"number-of-page\">\n <app-selection [options] = \"itemsPerPageList\"\n
|
|
913
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: PaginatorComponent, isStandalone: true, selector: "app-paginator", inputs: { totalRecords: "totalRecords" }, outputs: { paginator: "paginator" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"table-footer\">\n <div class=\"number-of-page\">\n <app-selection [options] = \"itemsPerPageList\"\n [(ngModel)]=\"itemsPerPage\"\n (selectedChange) = \"onChangeNumberOfPage($event)\">\n </app-selection>\n <app-input [config]=\"inputConfig\"></app-input>\n </div>\n <div class=\"paginator\">\n <app-button (clickEvent)=\"selectPage(selectedPage - 1)\"\n [config]=\"previousButtonConfig\"/>\n\n <!-- Page Numbers -->\n <ng-container *ngFor=\"let page of pageNumbers\">\n <app-button\n (clickEvent)=\"selectPage(page)\"\n [config]=\"getPageButtonConfig(page)\">\n </app-button>\n </ng-container>\n\n <!-- Next Button -->\n <app-button (clickEvent)=\"selectPage(selectedPage + 1)\"\n [config]=\"nextButtonConfig\"/>\n </div>\n</div>\n", styles: ["body{color:#566787;background:#f5f5f5;font-family:Varela Round,sans-serif;font-size:13px}.table-footer{display:flex;padding:10px 0}.table-footer .number-of-page{width:70%;display:flex;align-items:center;gap:20px}.table-footer .paginator{display:flex;justify-content:flex-end;width:100%}.table-footer .paginator app-button{margin:0 2px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "app-button", inputs: ["config"], outputs: ["clickEvent"] }, { kind: "component", type: SelectionComponent, selector: "app-selection", inputs: ["label", "options", "isMultiSelect"], outputs: ["selectedChange"] }, { kind: "component", type: InputComponent, selector: "app-input", inputs: ["config", "isInvalid"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
905
914
|
}
|
|
906
915
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginatorComponent, decorators: [{
|
|
907
916
|
type: Component,
|
|
908
|
-
args: [{ selector: 'app-paginator', standalone: true, imports: [CommonModule, ButtonComponent, SelectionComponent, InputComponent], template: "<div class=\"table-footer\">\n <div class=\"number-of-page\">\n <app-selection [options] = \"itemsPerPageList\"\n
|
|
917
|
+
args: [{ selector: 'app-paginator', standalone: true, imports: [CommonModule, ButtonComponent, SelectionComponent, InputComponent, FormsModule], template: "<div class=\"table-footer\">\n <div class=\"number-of-page\">\n <app-selection [options] = \"itemsPerPageList\"\n [(ngModel)]=\"itemsPerPage\"\n (selectedChange) = \"onChangeNumberOfPage($event)\">\n </app-selection>\n <app-input [config]=\"inputConfig\"></app-input>\n </div>\n <div class=\"paginator\">\n <app-button (clickEvent)=\"selectPage(selectedPage - 1)\"\n [config]=\"previousButtonConfig\"/>\n\n <!-- Page Numbers -->\n <ng-container *ngFor=\"let page of pageNumbers\">\n <app-button\n (clickEvent)=\"selectPage(page)\"\n [config]=\"getPageButtonConfig(page)\">\n </app-button>\n </ng-container>\n\n <!-- Next Button -->\n <app-button (clickEvent)=\"selectPage(selectedPage + 1)\"\n [config]=\"nextButtonConfig\"/>\n </div>\n</div>\n", styles: ["body{color:#566787;background:#f5f5f5;font-family:Varela Round,sans-serif;font-size:13px}.table-footer{display:flex;padding:10px 0}.table-footer .number-of-page{width:70%;display:flex;align-items:center;gap:20px}.table-footer .paginator{display:flex;justify-content:flex-end;width:100%}.table-footer .paginator app-button{margin:0 2px}\n"] }]
|
|
909
918
|
}], ctorParameters: () => [], propDecorators: { totalRecords: [{
|
|
910
919
|
type: Input
|
|
911
920
|
}], paginator: [{
|
|
@@ -1209,6 +1218,255 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
1209
1218
|
type: Input
|
|
1210
1219
|
}] } });
|
|
1211
1220
|
|
|
1221
|
+
class ActionsComponent {
|
|
1222
|
+
constructor() {
|
|
1223
|
+
this.actionButtons = [];
|
|
1224
|
+
this.crudActions = [CRUDType.create, CRUDType.delete, CRUDType.update];
|
|
1225
|
+
this.selectedAction = new EventEmitter();
|
|
1226
|
+
this.crudButtons = [
|
|
1227
|
+
{
|
|
1228
|
+
label: CRUDType.create,
|
|
1229
|
+
action: CRUDType.create
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
label: CRUDType.delete,
|
|
1233
|
+
action: CRUDType.delete
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
label: CRUDType.update,
|
|
1237
|
+
action: CRUDType.update
|
|
1238
|
+
},
|
|
1239
|
+
];
|
|
1240
|
+
}
|
|
1241
|
+
ngOnInit() {
|
|
1242
|
+
}
|
|
1243
|
+
clickButton(action) {
|
|
1244
|
+
this.selectedAction.emit(action);
|
|
1245
|
+
}
|
|
1246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1247
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: ActionsComponent, isStandalone: true, selector: "app-actions", inputs: { actionButtons: "actionButtons", crudActions: "crudActions" }, outputs: { selectedAction: "selectedAction" }, ngImport: i0, template: "<div class=\"actions\">\n <div class=\"actions-buttons buttons\">\n <!-- Action buttons -->\n <ng-container *ngFor=\"let button of actionButtons\">\n <app-button [config]=\"button\" (clickEvent)=\"clickButton(button.action)\">\n </app-button>\n </ng-container>\n </div>\n <div class=\"crud-buttons buttons\">\n <!-- CRUD buttons -->\n <ng-container *ngFor=\"let button of crudButtons\">\n <app-button [config]=\"button\" (clickEvent)=\"clickButton(button.action)\">\n </app-button>\n </ng-container>\n </div>\n</div>\n", styles: [".actions{display:flex;padding:10px 0}.actions .buttons{display:flex;gap:4px;width:50%}.actions .actions-buttons{justify-content:start}.actions .crud-buttons{justify-content:end}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "app-button", inputs: ["config"], outputs: ["clickEvent"] }] }); }
|
|
1248
|
+
}
|
|
1249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ActionsComponent, decorators: [{
|
|
1250
|
+
type: Component,
|
|
1251
|
+
args: [{ selector: 'app-actions', standalone: true, imports: [CommonModule, ButtonComponent], template: "<div class=\"actions\">\n <div class=\"actions-buttons buttons\">\n <!-- Action buttons -->\n <ng-container *ngFor=\"let button of actionButtons\">\n <app-button [config]=\"button\" (clickEvent)=\"clickButton(button.action)\">\n </app-button>\n </ng-container>\n </div>\n <div class=\"crud-buttons buttons\">\n <!-- CRUD buttons -->\n <ng-container *ngFor=\"let button of crudButtons\">\n <app-button [config]=\"button\" (clickEvent)=\"clickButton(button.action)\">\n </app-button>\n </ng-container>\n </div>\n</div>\n", styles: [".actions{display:flex;padding:10px 0}.actions .buttons{display:flex;gap:4px;width:50%}.actions .actions-buttons{justify-content:start}.actions .crud-buttons{justify-content:end}\n"] }]
|
|
1252
|
+
}], ctorParameters: () => [], propDecorators: { actionButtons: [{
|
|
1253
|
+
type: Input
|
|
1254
|
+
}], crudActions: [{
|
|
1255
|
+
type: Input
|
|
1256
|
+
}], selectedAction: [{
|
|
1257
|
+
type: Output
|
|
1258
|
+
}] } });
|
|
1259
|
+
|
|
1260
|
+
class EventAbstractFacade {
|
|
1261
|
+
constructor() {
|
|
1262
|
+
this._eventsDictionary = new Map();
|
|
1263
|
+
}
|
|
1264
|
+
addEventListener(name, handler) {
|
|
1265
|
+
this._eventsDictionary.set(name, handler);
|
|
1266
|
+
}
|
|
1267
|
+
dispatch(name, ...args) {
|
|
1268
|
+
const handler = this._eventsDictionary.get(name);
|
|
1269
|
+
if (isDefined(handler)) {
|
|
1270
|
+
handler(...args);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EventAbstractFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1274
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EventAbstractFacade }); }
|
|
1275
|
+
}
|
|
1276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EventAbstractFacade, decorators: [{
|
|
1277
|
+
type: Injectable
|
|
1278
|
+
}] });
|
|
1279
|
+
|
|
1280
|
+
var PageEvent;
|
|
1281
|
+
(function (PageEvent) {
|
|
1282
|
+
PageEvent["Modal"] = "Modal";
|
|
1283
|
+
PageEvent["Loading"] = "Loading";
|
|
1284
|
+
})(PageEvent || (PageEvent = {}));
|
|
1285
|
+
class PagesFacade extends EventAbstractFacade {
|
|
1286
|
+
constructor() {
|
|
1287
|
+
super(...arguments);
|
|
1288
|
+
this._isPageReady = new BehaviorSubject(false);
|
|
1289
|
+
this._params = {};
|
|
1290
|
+
this._validated = false;
|
|
1291
|
+
}
|
|
1292
|
+
get isPageReady() {
|
|
1293
|
+
return this._isPageReady.asObservable();
|
|
1294
|
+
}
|
|
1295
|
+
get params() {
|
|
1296
|
+
return this._params;
|
|
1297
|
+
}
|
|
1298
|
+
get validated() {
|
|
1299
|
+
return this._validated;
|
|
1300
|
+
}
|
|
1301
|
+
setParams(value) {
|
|
1302
|
+
this._params = value || {};
|
|
1303
|
+
}
|
|
1304
|
+
markAsReady() {
|
|
1305
|
+
this._isPageReady.next(true);
|
|
1306
|
+
}
|
|
1307
|
+
markAsLoading() {
|
|
1308
|
+
this._isPageReady.next(false);
|
|
1309
|
+
}
|
|
1310
|
+
validate(status) {
|
|
1311
|
+
this._validated = status;
|
|
1312
|
+
}
|
|
1313
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PagesFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1314
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PagesFacade }); }
|
|
1315
|
+
}
|
|
1316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PagesFacade, decorators: [{
|
|
1317
|
+
type: Injectable
|
|
1318
|
+
}] });
|
|
1319
|
+
|
|
1320
|
+
class AdminComponent {
|
|
1321
|
+
constructor(pageFacade) {
|
|
1322
|
+
this.pageFacade = pageFacade;
|
|
1323
|
+
this.selectedItems = [];
|
|
1324
|
+
this.TableColumnType = TableColumnType;
|
|
1325
|
+
this.tableContents = [];
|
|
1326
|
+
this.columns = [];
|
|
1327
|
+
this.formFields = [];
|
|
1328
|
+
this.tableName = '';
|
|
1329
|
+
this.totalRecords = 0;
|
|
1330
|
+
this.loadingState = of(false);
|
|
1331
|
+
this.actionButtons = [];
|
|
1332
|
+
this.validationMessages = {};
|
|
1333
|
+
this.paginator = new EventEmitter();
|
|
1334
|
+
this.itemAction = new EventEmitter();
|
|
1335
|
+
this.formSubmit = new EventEmitter();
|
|
1336
|
+
}
|
|
1337
|
+
ngOnInit() {
|
|
1338
|
+
this._initPageEventHandler();
|
|
1339
|
+
this._subscribeToPageReady();
|
|
1340
|
+
this._initializeForm();
|
|
1341
|
+
}
|
|
1342
|
+
changePaginator(paginator) { }
|
|
1343
|
+
toggleSelection(item, event) {
|
|
1344
|
+
const checked = event.target.checked;
|
|
1345
|
+
if (checked) {
|
|
1346
|
+
this.selectedItems.push(item);
|
|
1347
|
+
}
|
|
1348
|
+
else {
|
|
1349
|
+
this.selectedItems = this.selectedItems.filter(i => i !== item);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
isSelected(item) {
|
|
1353
|
+
return this.selectedItems.includes(item);
|
|
1354
|
+
}
|
|
1355
|
+
_initPageEventHandler() {
|
|
1356
|
+
withValuesOf(PageEvent, (pageEvent) => {
|
|
1357
|
+
this.pageFacade.addEventListener(pageEvent, (...args) => {
|
|
1358
|
+
this.modalEvent = args[0]?.details;
|
|
1359
|
+
});
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
_subscribeToPageReady() {
|
|
1363
|
+
this.pageFacade.isPageReady.subscribe(isReady => {
|
|
1364
|
+
if (isReady && this.modalEvent) {
|
|
1365
|
+
this.modalEvent.isModalVisible = false;
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
_initializeForm() {
|
|
1370
|
+
const formControls = this.formFields.reduce((controls, field) => {
|
|
1371
|
+
// Ensure validator is an array of ValidatorFn or empty
|
|
1372
|
+
const validators = Array.isArray(field.validator) ? field.validator : [];
|
|
1373
|
+
// Create form control dynamically
|
|
1374
|
+
controls[field.name] = new FormControl('', validators);
|
|
1375
|
+
return controls;
|
|
1376
|
+
}, {});
|
|
1377
|
+
// Create form group from dynamically generated controls
|
|
1378
|
+
this.formGroup = new FormGroup(formControls);
|
|
1379
|
+
}
|
|
1380
|
+
openDialog(detailAction, items) {
|
|
1381
|
+
let dialogTitle = "";
|
|
1382
|
+
let dialogTemplate = null;
|
|
1383
|
+
switch (detailAction) {
|
|
1384
|
+
case CRUDType.create:
|
|
1385
|
+
dialogTitle = "Create Post";
|
|
1386
|
+
dialogTemplate = this.itemFormTpl;
|
|
1387
|
+
break;
|
|
1388
|
+
case CRUDType.update:
|
|
1389
|
+
dialogTitle = "Edit Post";
|
|
1390
|
+
dialogTemplate = this.itemFormTpl;
|
|
1391
|
+
break;
|
|
1392
|
+
case CRUDType.delete:
|
|
1393
|
+
dialogTitle = "Delete Post";
|
|
1394
|
+
dialogTemplate = this.warningDialogTpl;
|
|
1395
|
+
break;
|
|
1396
|
+
default:
|
|
1397
|
+
dialogTitle = "Unknown Action";
|
|
1398
|
+
dialogTemplate = null;
|
|
1399
|
+
}
|
|
1400
|
+
;
|
|
1401
|
+
this.modalEvent = {
|
|
1402
|
+
isModalVisible: true,
|
|
1403
|
+
isDialog: true,
|
|
1404
|
+
title: dialogTitle,
|
|
1405
|
+
template: dialogTemplate
|
|
1406
|
+
};
|
|
1407
|
+
this.pageFacade.dispatch(PageEvent.Modal, { details: this.modalEvent });
|
|
1408
|
+
}
|
|
1409
|
+
selectedItem(action) {
|
|
1410
|
+
this.formGroup.reset();
|
|
1411
|
+
if (action === CRUDType.update && this.selectedItems?.length === 1) {
|
|
1412
|
+
const updatedValues = Object.keys(this.formGroup.controls).reduce((values, key) => {
|
|
1413
|
+
values[key] = this.selectedItems[0][key] || ''; // Assign value dynamically or default to ''
|
|
1414
|
+
return values;
|
|
1415
|
+
}, {});
|
|
1416
|
+
this.formGroup.setValue(updatedValues);
|
|
1417
|
+
this.openDialog(CRUDType.update, this.selectedItems);
|
|
1418
|
+
}
|
|
1419
|
+
else if (action === CRUDType.delete && this.selectedItems?.length > 0) {
|
|
1420
|
+
this.openDialog(CRUDType.delete, this.selectedItems);
|
|
1421
|
+
}
|
|
1422
|
+
else if (action === CRUDType.create) {
|
|
1423
|
+
this.openDialog(action);
|
|
1424
|
+
}
|
|
1425
|
+
else {
|
|
1426
|
+
this.itemAction.emit({ action: action, item: this.selectedItems });
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
saveForm(formGroup) {
|
|
1430
|
+
this.formSubmit.emit(this.formGroup.value);
|
|
1431
|
+
// Close modal
|
|
1432
|
+
this.modalEvent.isModalVisible = false;
|
|
1433
|
+
}
|
|
1434
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AdminComponent, deps: [{ token: PagesFacade }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1435
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: AdminComponent, isStandalone: true, selector: "app-admin", inputs: { tableContents: "tableContents", columns: "columns", formFields: "formFields", tableName: "tableName", totalRecords: "totalRecords", loadingState: "loadingState", actionButtons: "actionButtons", validationMessages: "validationMessages" }, outputs: { paginator: "paginator", itemAction: "itemAction", formSubmit: "formSubmit" }, providers: [PagesFacade], viewQueries: [{ propertyName: "itemFormTpl", first: true, predicate: ["itemForm"], descendants: true, static: true }, { propertyName: "warningDialogTpl", first: true, predicate: ["warningDialog"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"admin\">\n <app-table\n [columns]=\"columns\"\n [items]=\"tableContents\"\n [totalRecords]=\"totalRecords\"\n [tableName]=\"tableName\"\n [loadingState]=\"loadingState\"\n (paginator)=\"changePaginator($event)\"\n >\n <ng-template #bodyTemplate let-item=\"item\" pTemplate=\"body\">\n <tr>\n <td>\n <input type=\"checkbox\" [value]=\"item\" [checked]=\"isSelected(item)\"\n (change)=\"toggleSelection(item, $event)\">\n </td>\n <td *ngFor=\"let column of columns\">\n <ng-container *ngIf=\"column.type === TableColumnType.image; else textCell\">\n <img\n [src]=\"item[column.name]\"\n alt=\"{{ column.label }}\"\n style=\"max-width: 50px; max-height: 50px\"\n />\n </ng-container>\n <ng-template #textCell>\n {{ item[column.name] }}\n </ng-template>\n </td>\n </tr>\n </ng-template>\n </app-table>\n\n <app-actions (selectedAction)=\"selectedItem($event)\" [actionButtons]=\"actionButtons\"></app-actions>\n</div>\n\n<app-modal [modalEvent]=\"modalEvent\"></app-modal>\n\n<ng-template #itemForm>\n <app-form [formGroup]=\"formGroup\" [inputConfigs]=\"formFields\" [validationMessages]=\"validationMessages\" (formSubmit)=\"saveForm($event)\"></app-form>\n</ng-template>\n\n<ng-template #warningDialog>\n <div>Do you want to delete this?</div>\n</ng-template>\n", styles: [".admin{display:flex;flex-direction:column;height:100vh}.admin app-table{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TableComponent, selector: "app-table", inputs: ["items", "columns", "totalRecords", "tableName", "loadingState"], outputs: ["paginator"] }, { kind: "component", type: ActionsComponent, selector: "app-actions", inputs: ["actionButtons", "crudActions"], outputs: ["selectedAction"] }, { kind: "component", type: FormComponent, selector: "app-form", inputs: ["formGroup", "inputConfigs", "buttonConfig", "validationMessages"], outputs: ["formSubmit", "formChange"] }, { kind: "component", type: ModalComponent, selector: "app-modal", inputs: ["modalEvent", "size"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
|
|
1436
|
+
}
|
|
1437
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: AdminComponent, decorators: [{
|
|
1438
|
+
type: Component,
|
|
1439
|
+
args: [{ selector: 'app-admin', standalone: true, imports: [CommonModule, TableComponent, ActionsComponent, FormComponent, ModalComponent, ReactiveFormsModule], providers: [PagesFacade], template: "<div class=\"admin\">\n <app-table\n [columns]=\"columns\"\n [items]=\"tableContents\"\n [totalRecords]=\"totalRecords\"\n [tableName]=\"tableName\"\n [loadingState]=\"loadingState\"\n (paginator)=\"changePaginator($event)\"\n >\n <ng-template #bodyTemplate let-item=\"item\" pTemplate=\"body\">\n <tr>\n <td>\n <input type=\"checkbox\" [value]=\"item\" [checked]=\"isSelected(item)\"\n (change)=\"toggleSelection(item, $event)\">\n </td>\n <td *ngFor=\"let column of columns\">\n <ng-container *ngIf=\"column.type === TableColumnType.image; else textCell\">\n <img\n [src]=\"item[column.name]\"\n alt=\"{{ column.label }}\"\n style=\"max-width: 50px; max-height: 50px\"\n />\n </ng-container>\n <ng-template #textCell>\n {{ item[column.name] }}\n </ng-template>\n </td>\n </tr>\n </ng-template>\n </app-table>\n\n <app-actions (selectedAction)=\"selectedItem($event)\" [actionButtons]=\"actionButtons\"></app-actions>\n</div>\n\n<app-modal [modalEvent]=\"modalEvent\"></app-modal>\n\n<ng-template #itemForm>\n <app-form [formGroup]=\"formGroup\" [inputConfigs]=\"formFields\" [validationMessages]=\"validationMessages\" (formSubmit)=\"saveForm($event)\"></app-form>\n</ng-template>\n\n<ng-template #warningDialog>\n <div>Do you want to delete this?</div>\n</ng-template>\n", styles: [".admin{display:flex;flex-direction:column;height:100vh}.admin app-table{flex:1}\n"] }]
|
|
1440
|
+
}], ctorParameters: () => [{ type: PagesFacade }], propDecorators: { itemFormTpl: [{
|
|
1441
|
+
type: ViewChild,
|
|
1442
|
+
args: ['itemForm', { static: true }]
|
|
1443
|
+
}], warningDialogTpl: [{
|
|
1444
|
+
type: ViewChild,
|
|
1445
|
+
args: ['warningDialog', { static: true }]
|
|
1446
|
+
}], tableContents: [{
|
|
1447
|
+
type: Input
|
|
1448
|
+
}], columns: [{
|
|
1449
|
+
type: Input
|
|
1450
|
+
}], formFields: [{
|
|
1451
|
+
type: Input
|
|
1452
|
+
}], tableName: [{
|
|
1453
|
+
type: Input
|
|
1454
|
+
}], totalRecords: [{
|
|
1455
|
+
type: Input
|
|
1456
|
+
}], loadingState: [{
|
|
1457
|
+
type: Input
|
|
1458
|
+
}], actionButtons: [{
|
|
1459
|
+
type: Input
|
|
1460
|
+
}], validationMessages: [{
|
|
1461
|
+
type: Input
|
|
1462
|
+
}], paginator: [{
|
|
1463
|
+
type: Output
|
|
1464
|
+
}], itemAction: [{
|
|
1465
|
+
type: Output
|
|
1466
|
+
}], formSubmit: [{
|
|
1467
|
+
type: Output
|
|
1468
|
+
}] } });
|
|
1469
|
+
|
|
1212
1470
|
/*
|
|
1213
1471
|
* Public API Surface of angular-dumb-lib
|
|
1214
1472
|
*/
|
|
@@ -1217,5 +1475,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
1217
1475
|
* Generated bundle index. Do not edit.
|
|
1218
1476
|
*/
|
|
1219
1477
|
|
|
1220
|
-
export { AngularDumbLibComponent, AngularDumbLibModule, AngularDumbLibService, ButtonComponent, ButtonType, CRUDType, CardsComponent, ContentDesignComponent, ContentDirection, DatetimePickerComponent, DesignType, DetailComponent, FileSelectionComponent, FooterComponent, FormComponent, FormatedTextComponent, InputComponent, InputDirection, InputGroupType, InputType, LoadingComponent, LoadingType, LoginComponent, MenuComponent, MenuDirection, ModalComponent, PaginatorComponent, ScrollToTopComponent, SelectionComponent,
|
|
1478
|
+
export { AdminComponent, AngularDumbLibComponent, AngularDumbLibModule, AngularDumbLibService, ButtonComponent, ButtonType, CRUDType, CardsComponent, ContentDesignComponent, ContentDirection, DatetimePickerComponent, DesignType, DetailComponent, FileSelectionComponent, FooterComponent, FormComponent, FormatedTextComponent, InputComponent, InputDirection, InputGroupType, InputType, LoadingComponent, LoadingType, LoginComponent, MenuComponent, MenuDirection, ModalComponent, PaginatorComponent, ScrollToTopComponent, SelectionComponent, Size, SliderComponent, TableColumnType, TableComponent, TagsComponent, VersionComponent, WidgetPosition };
|
|
1221
1479
|
//# sourceMappingURL=angular-dumb-lib.mjs.map
|