@smartsoft001/crud-shell-angular 2.119.0 → 2.121.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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, ElementRef, Component, input, Directive, computed, signal, InjectionToken, Pipe, NgModule, viewChild, viewChildren, output, ChangeDetectorRef, effect, Injector } from '@angular/core';
3
- import { NgrxStoreService, BaseComponent as BaseComponent$1, PopoverService, StyleService, ButtonComponent, MenuService, FormComponent, AccordionComponent, AccordionHeaderComponent, AccordionBodyComponent, ListComponent as ListComponent$1, SharedModule, PaginationMode, DetailsComponent, AuthService, CreateDynamicComponent, DynamicComponentLoader, ToastService, DetailsService, DynamicContentDirective, PageComponent, HardwareService, ListMode, FILE_SERVICE_CONFIG } from '@smartsoft001/angular';
3
+ import { NgrxStoreService, PaginationMode, BaseComponent as BaseComponent$1, PopoverService, StyleService, ButtonComponent, MenuService, FormComponent, ListComponent as ListComponent$1, SharedModule, DetailsComponent, AuthService, CreateDynamicComponent, DynamicComponentLoader, ToastService, DetailsService, DynamicContentDirective, HardwareService, ListMode, FILE_SERVICE_CONFIG } from '@smartsoft001/angular';
4
4
  import { toSignal } from '@angular/core/rxjs-interop';
5
5
  import * as i1 from '@ngrx/store';
6
6
  import { createFeatureSelector, createSelector, select as select$1 } from '@ngrx/store';
@@ -372,6 +372,220 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
372
372
  type: Injectable
373
373
  }], ctorParameters: () => [{ type: i1.Store }, { type: CrudConfig }] });
374
374
 
375
+ const initialState = {
376
+ loaded: false,
377
+ };
378
+ const crudReducer = (state, action, entity) => {
379
+ if (!state) {
380
+ state = { ...initialState };
381
+ }
382
+ switch (action.type) {
383
+ case `[${entity}] Create`:
384
+ return {
385
+ ...state,
386
+ loaded: false,
387
+ error: null,
388
+ };
389
+ case `[${entity}] Create Success`:
390
+ return {
391
+ ...state,
392
+ loaded: true,
393
+ error: null,
394
+ };
395
+ case `[${entity}] Create Failure`:
396
+ return {
397
+ ...state,
398
+ loaded: true,
399
+ error: action.error,
400
+ };
401
+ case `[${entity}] Create Many`:
402
+ return {
403
+ ...state,
404
+ loaded: false,
405
+ error: null,
406
+ };
407
+ case `[${entity}] Create Many Success`:
408
+ return {
409
+ ...state,
410
+ loaded: true,
411
+ error: null,
412
+ };
413
+ case `[${entity}] Create Many Failure`:
414
+ return {
415
+ ...state,
416
+ loaded: true,
417
+ error: action.error,
418
+ };
419
+ case `[${entity}] Export`:
420
+ return {
421
+ ...state,
422
+ loaded: false,
423
+ };
424
+ case `[${entity}] Export Success`:
425
+ return {
426
+ ...state,
427
+ loaded: true,
428
+ };
429
+ case `[${entity}] Export Failure`:
430
+ return {
431
+ ...state,
432
+ loaded: true,
433
+ };
434
+ case `[${entity}] Read`:
435
+ return {
436
+ ...state,
437
+ loaded: false,
438
+ filter: action?.filter,
439
+ error: null,
440
+ totalCount: null,
441
+ links: null,
442
+ };
443
+ case `[${entity}] Read Success`: {
444
+ let list = [];
445
+ if (action?.filter &&
446
+ action?.filter.offset &&
447
+ state.list &&
448
+ action?.filter.paginationMode !== PaginationMode.singlePage) {
449
+ state.list.forEach((i) => {
450
+ list.push(i);
451
+ });
452
+ list = [...list, ...action.result.data];
453
+ }
454
+ else {
455
+ list = action.result.data;
456
+ }
457
+ return {
458
+ ...state,
459
+ loaded: true,
460
+ list,
461
+ totalCount: action?.result?.totalCount,
462
+ links: action.result.links,
463
+ error: null,
464
+ };
465
+ }
466
+ case `[${entity}] Clear`:
467
+ return { ...initialState };
468
+ case `[${entity}] Read Failure`:
469
+ return {
470
+ ...state,
471
+ loaded: true,
472
+ error: action.error,
473
+ };
474
+ case `[${entity}] Select`:
475
+ return {
476
+ ...state,
477
+ loaded: false,
478
+ selected: null,
479
+ error: null,
480
+ };
481
+ case `[${entity}] Select Success`:
482
+ return {
483
+ ...state,
484
+ loaded: true,
485
+ selected: action.item,
486
+ error: null,
487
+ };
488
+ case `[${entity}] Select Failure`:
489
+ return {
490
+ ...state,
491
+ loaded: true,
492
+ error: action.error,
493
+ };
494
+ case `[${entity}] MultiSelect`:
495
+ return {
496
+ ...state,
497
+ multiSelected: [...action.items],
498
+ };
499
+ case `[${entity}] Unselect`:
500
+ return {
501
+ ...state,
502
+ loaded: true,
503
+ selected: null,
504
+ error: null,
505
+ };
506
+ case `[${entity}] Update`:
507
+ return {
508
+ ...state,
509
+ loaded: false,
510
+ error: null,
511
+ };
512
+ case `[${entity}] Update Success`:
513
+ return {
514
+ ...state,
515
+ loaded: true,
516
+ error: null,
517
+ };
518
+ case `[${entity}] Update Failure`:
519
+ return {
520
+ ...state,
521
+ loaded: true,
522
+ error: action.error,
523
+ };
524
+ case `[${entity}] Update partial`:
525
+ return {
526
+ ...state,
527
+ loaded: false,
528
+ error: null,
529
+ };
530
+ case `[${entity}] Update partial Success`:
531
+ return {
532
+ ...state,
533
+ loaded: true,
534
+ error: null,
535
+ };
536
+ case `[${entity}] Update partial Failure`:
537
+ return {
538
+ ...state,
539
+ loaded: true,
540
+ error: action.error,
541
+ };
542
+ case `[${entity}] Update partial many`:
543
+ return {
544
+ ...state,
545
+ loaded: false,
546
+ error: null,
547
+ };
548
+ case `[${entity}] Update partial many Success`:
549
+ return {
550
+ ...state,
551
+ multiSelected: [],
552
+ loaded: true,
553
+ error: null,
554
+ };
555
+ case `[${entity}] Update partial many Failure`:
556
+ return {
557
+ ...state,
558
+ loaded: true,
559
+ error: action.error,
560
+ };
561
+ case `[${entity}] Delete`:
562
+ return {
563
+ ...state,
564
+ loaded: false,
565
+ error: null,
566
+ };
567
+ case `[${entity}] Delete Success`:
568
+ return {
569
+ ...state,
570
+ loaded: true,
571
+ error: null,
572
+ };
573
+ case `[${entity}] Delete Failure`:
574
+ return {
575
+ ...state,
576
+ loaded: true,
577
+ error: action.error,
578
+ };
579
+ default:
580
+ return state;
581
+ }
582
+ };
583
+ function getReducer(entity) {
584
+ return (state, action) => {
585
+ return crudReducer(state, action, entity);
586
+ };
587
+ }
588
+
375
589
  class ExportComponent extends BaseComponent$1 {
376
590
  facade = inject((CrudFacade));
377
591
  popoverService = inject(PopoverService);
@@ -400,14 +614,18 @@ class ExportComponent extends BaseComponent$1 {
400
614
  }
401
615
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ExportComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
402
616
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: ExportComponent, isStandalone: true, selector: "smart-crud-export", usesInheritance: true, ngImport: i0, template: `
403
- <div class="p-5">
404
- <p class="my-2.5 mx-0">
405
- <smart-button [options]="buttonExportCsvOptions" class="w-full block"
617
+ <div class="smart:p-5">
618
+ <p class="smart:my-2.5 smart:mx-0">
619
+ <smart-button
620
+ [options]="buttonExportCsvOptions"
621
+ class="smart:w-full smart:block"
406
622
  >CSV</smart-button
407
623
  >
408
624
  </p>
409
625
  <p>
410
- <smart-button [options]="buttonExportXlsxOptions" class="w-full block"
626
+ <smart-button
627
+ [options]="buttonExportXlsxOptions"
628
+ class="smart:w-full smart:block"
411
629
  >XLSX</smart-button
412
630
  >
413
631
  </p>
@@ -419,14 +637,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
419
637
  args: [{
420
638
  selector: 'smart-crud-export',
421
639
  template: `
422
- <div class="p-5">
423
- <p class="my-2.5 mx-0">
424
- <smart-button [options]="buttonExportCsvOptions" class="w-full block"
640
+ <div class="smart:p-5">
641
+ <p class="smart:my-2.5 smart:mx-0">
642
+ <smart-button
643
+ [options]="buttonExportCsvOptions"
644
+ class="smart:w-full smart:block"
425
645
  >CSV</smart-button
426
646
  >
427
647
  </p>
428
648
  <p>
429
- <smart-button [options]="buttonExportXlsxOptions" class="w-full block"
649
+ <smart-button
650
+ [options]="buttonExportXlsxOptions"
651
+ class="smart:w-full smart:block"
430
652
  >XLSX</smart-button
431
653
  >
432
654
  </p>
@@ -1351,7 +1573,7 @@ class MultiselectComponent {
1351
1573
  this.valid = valid;
1352
1574
  }
1353
1575
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MultiselectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1354
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MultiselectComponent, isStandalone: true, selector: "smart-crud-multiselect", ngImport: i0, template: "@let list = this.list();\n@if (list) {\n <!-- <ion-header>-->\n <!-- <ion-toolbar>-->\n <!-- <ion-buttons slot=\"end\">-->\n <!-- <ion-button (click)=\"onClose()\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <!--<ion-title>-->{{ 'selected' | translate }}: {{ list?.length\n }}<!--</ion-title>-->\n <!-- </ion-toolbar>-->\n <!-- </ion-header>-->\n\n @if (config?.list?.components?.multi) {\n <div>\n <ng-template\n [ngComponentOutlet]=\"config?.list?.components?.multi\"\n [ndcDynamicInputs]=\"{ items: list }\"\n ></ng-template>\n </div>\n }\n\n @if (showForm && item) {\n <div>\n <smart-form\n [options]=\"item | smartFormOptions: 'multiUpdate' : config.type\"\n (valuePartialChange)=\"onPartialChange($event, list)\"\n (validChange)=\"onValidChange($event)\"\n ></smart-form>\n\n <smart-button\n style=\"float: right\"\n [disabled]=\"lock || !valid\"\n [options]=\"buttonOptions\"\n >\n {{ 'change' | translate }}\n </smart-button>\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: DynamicIoDirective, selector: "[ndcDynamicInputs],[ndcDynamicOutputs]", inputs: ["ndcDynamicInputs", "ndcDynamicOutputs"], exportAs: ["ndcDynamicIo"] }, { kind: "component", type: FormComponent, selector: "smart-form", inputs: ["options"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }, { kind: "component", type: ButtonComponent, selector: "smart-button", inputs: ["options", "disabled", "class"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "pipe", type: FormOptionsPipe, name: "smartFormOptions" }] });
1576
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MultiselectComponent, isStandalone: true, selector: "smart-crud-multiselect", ngImport: i0, template: "@let list = this.list();\n@if (list) {\n <!-- <ion-header>-->\n <!-- <ion-toolbar>-->\n <!-- <ion-buttons slot=\"end\">-->\n <!-- <ion-button (click)=\"onClose()\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <!--<ion-title>-->{{ 'selected' | translate }}: {{ list?.length\n }}<!--</ion-title>-->\n <!-- </ion-toolbar>-->\n <!-- </ion-header>-->\n\n @if (config?.list?.components?.multi) {\n <div>\n <ng-template\n [ngComponentOutlet]=\"config?.list?.components?.multi\"\n [ndcDynamicInputs]=\"{ items: list }\"\n ></ng-template>\n </div>\n }\n\n @if (showForm && item) {\n <div>\n <smart-form\n [options]=\"item | smartFormOptions: 'multiUpdate' : config.type\"\n (valuePartialChange)=\"onPartialChange($event, list)\"\n (validChange)=\"onValidChange($event)\"\n ></smart-form>\n\n <smart-button\n class=\"smart:float-right\"\n [disabled]=\"lock || !valid\"\n [options]=\"buttonOptions\"\n >\n {{ 'change' | translate }}\n </smart-button>\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: DynamicIoDirective, selector: "[ndcDynamicInputs],[ndcDynamicOutputs]", inputs: ["ndcDynamicInputs", "ndcDynamicOutputs"], exportAs: ["ndcDynamicIo"] }, { kind: "component", type: FormComponent, selector: "smart-form", inputs: ["options", "class"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }, { kind: "component", type: ButtonComponent, selector: "smart-button", inputs: ["options", "disabled", "class"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "pipe", type: FormOptionsPipe, name: "smartFormOptions" }] });
1355
1577
  }
1356
1578
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MultiselectComponent, decorators: [{
1357
1579
  type: Component,
@@ -1362,7 +1584,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1362
1584
  FormOptionsPipe,
1363
1585
  FormComponent,
1364
1586
  ButtonComponent,
1365
- ], template: "@let list = this.list();\n@if (list) {\n <!-- <ion-header>-->\n <!-- <ion-toolbar>-->\n <!-- <ion-buttons slot=\"end\">-->\n <!-- <ion-button (click)=\"onClose()\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <!--<ion-title>-->{{ 'selected' | translate }}: {{ list?.length\n }}<!--</ion-title>-->\n <!-- </ion-toolbar>-->\n <!-- </ion-header>-->\n\n @if (config?.list?.components?.multi) {\n <div>\n <ng-template\n [ngComponentOutlet]=\"config?.list?.components?.multi\"\n [ndcDynamicInputs]=\"{ items: list }\"\n ></ng-template>\n </div>\n }\n\n @if (showForm && item) {\n <div>\n <smart-form\n [options]=\"item | smartFormOptions: 'multiUpdate' : config.type\"\n (valuePartialChange)=\"onPartialChange($event, list)\"\n (validChange)=\"onValidChange($event)\"\n ></smart-form>\n\n <smart-button\n style=\"float: right\"\n [disabled]=\"lock || !valid\"\n [options]=\"buttonOptions\"\n >\n {{ 'change' | translate }}\n </smart-button>\n </div>\n }\n}\n" }]
1587
+ ], template: "@let list = this.list();\n@if (list) {\n <!-- <ion-header>-->\n <!-- <ion-toolbar>-->\n <!-- <ion-buttons slot=\"end\">-->\n <!-- <ion-button (click)=\"onClose()\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <!--<ion-title>-->{{ 'selected' | translate }}: {{ list?.length\n }}<!--</ion-title>-->\n <!-- </ion-toolbar>-->\n <!-- </ion-header>-->\n\n @if (config?.list?.components?.multi) {\n <div>\n <ng-template\n [ngComponentOutlet]=\"config?.list?.components?.multi\"\n [ndcDynamicInputs]=\"{ items: list }\"\n ></ng-template>\n </div>\n }\n\n @if (showForm && item) {\n <div>\n <smart-form\n [options]=\"item | smartFormOptions: 'multiUpdate' : config.type\"\n (valuePartialChange)=\"onPartialChange($event, list)\"\n (validChange)=\"onValidChange($event)\"\n ></smart-form>\n\n <smart-button\n class=\"smart:float-right\"\n [disabled]=\"lock || !valid\"\n [options]=\"buttonOptions\"\n >\n {{ 'change' | translate }}\n </smart-button>\n </div>\n }\n}\n" }]
1366
1588
  }], ctorParameters: () => [] });
1367
1589
 
1368
1590
  class CrudListGroupService {
@@ -1451,13 +1673,14 @@ class GroupComponent extends BaseComponent$1 {
1451
1673
  }
1452
1674
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: GroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1453
1675
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: GroupComponent, isStandalone: true, selector: "smart-crud-group", inputs: { groups: { classPropertyName: "groups", publicName: "groups", isSignal: true, isRequired: false, transformFunction: null }, listOptions: { classPropertyName: "listOptions", publicName: "listOptions", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
1676
+ <!-- TODO: AccordionComponent moved to @smartsoft001-pro/angular (FRA-101)
1454
1677
  @for (item of groups(); track item.key) {
1455
1678
  <smart-accordion
1456
1679
  [show]="item.show || false"
1457
1680
  (showChange)="change($event, item)"
1458
1681
  >
1459
- <smart-accordion-header [ngClass]="{ 'font-bold': item.show }"
1460
- >{{ item.text | translate }}
1682
+ <smart-accordion-header [ngClass]="{ 'font-bold': item.show }">
1683
+ {{ item.text | translate }}
1461
1684
  </smart-accordion-header>
1462
1685
  <smart-accordion-body>
1463
1686
  @if (item.show && !item.children && listOptions()) {
@@ -1474,21 +1697,45 @@ class GroupComponent extends BaseComponent$1 {
1474
1697
  </smart-accordion-body>
1475
1698
  </smart-accordion>
1476
1699
  }
1477
- <br /><br /><br />
1478
- `, isInline: true, dependencies: [{ kind: "component", type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }, { kind: "component", type: AccordionComponent, selector: "smart-accordion", inputs: ["show"], outputs: ["showChange"] }, { kind: "component", type: AccordionHeaderComponent, selector: "smart-accordion-header" }, { kind: "component", type: AccordionBodyComponent, selector: "smart-accordion-body" }, { kind: "component", type: ListComponent$1, selector: "smart-list", inputs: ["options"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
1700
+ -->
1701
+
1702
+ <!-- TODO: remove this template after moving to @smartsoft001-pro/angular (FRA-101) -->
1703
+ @for (item of groups(); track item.key) {
1704
+ <div (click)="change(!item.show, item)">
1705
+ {{ item.text | translate }}
1706
+ </div>
1707
+ @if (item.show && !item.children && listOptions()) {
1708
+ <smart-list [options]="listOptions()!"></smart-list>
1709
+ }
1710
+ @if (item.children) {
1711
+ <div style="margin-left: 50px">
1712
+ <smart-crud-group
1713
+ [groups]="item.children"
1714
+ [listOptions]="listOptions()"
1715
+ ></smart-crud-group>
1716
+ </div>
1717
+ }
1718
+ }
1719
+ `, isInline: true, dependencies: [{ kind: "component", type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }, { kind: "component", type:
1720
+ // TODO: AccordionComponent moved to @smartsoft001-pro/angular (FRA-101)
1721
+ // AccordionComponent,
1722
+ // AccordionHeaderComponent,
1723
+ // AccordionBodyComponent,
1724
+ ListComponent$1, selector: "smart-list", inputs: ["options", "class"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
1479
1725
  }
1480
1726
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: GroupComponent, decorators: [{
1481
1727
  type: Component,
1482
1728
  args: [{
1483
1729
  selector: 'smart-crud-group',
1484
1730
  template: `
1731
+ <!-- TODO: AccordionComponent moved to @smartsoft001-pro/angular (FRA-101)
1485
1732
  @for (item of groups(); track item.key) {
1486
1733
  <smart-accordion
1487
1734
  [show]="item.show || false"
1488
1735
  (showChange)="change($event, item)"
1489
1736
  >
1490
- <smart-accordion-header [ngClass]="{ 'font-bold': item.show }"
1491
- >{{ item.text | translate }}
1737
+ <smart-accordion-header [ngClass]="{ 'font-bold': item.show }">
1738
+ {{ item.text | translate }}
1492
1739
  </smart-accordion-header>
1493
1740
  <smart-accordion-body>
1494
1741
  @if (item.show && !item.children && listOptions()) {
@@ -1505,12 +1752,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1505
1752
  </smart-accordion-body>
1506
1753
  </smart-accordion>
1507
1754
  }
1508
- <br /><br /><br />
1755
+ -->
1756
+
1757
+ <!-- TODO: remove this template after moving to @smartsoft001-pro/angular (FRA-101) -->
1758
+ @for (item of groups(); track item.key) {
1759
+ <div (click)="change(!item.show, item)">
1760
+ {{ item.text | translate }}
1761
+ </div>
1762
+ @if (item.show && !item.children && listOptions()) {
1763
+ <smart-list [options]="listOptions()!"></smart-list>
1764
+ }
1765
+ @if (item.children) {
1766
+ <div style="margin-left: 50px">
1767
+ <smart-crud-group
1768
+ [groups]="item.children"
1769
+ [listOptions]="listOptions()"
1770
+ ></smart-crud-group>
1771
+ </div>
1772
+ }
1773
+ }
1509
1774
  `,
1510
1775
  imports: [
1511
- AccordionComponent,
1512
- AccordionHeaderComponent,
1513
- AccordionBodyComponent,
1776
+ // TODO: AccordionComponent moved to @smartsoft001-pro/angular (FRA-101)
1777
+ // AccordionComponent,
1778
+ // AccordionHeaderComponent,
1779
+ // AccordionBodyComponent,
1514
1780
  ListComponent$1,
1515
1781
  NgClass,
1516
1782
  TranslatePipe,
@@ -1776,220 +2042,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1776
2042
  }]
1777
2043
  }] });
1778
2044
 
1779
- const initialState = {
1780
- loaded: false,
1781
- };
1782
- const crudReducer = (state, action, entity) => {
1783
- if (!state) {
1784
- state = { ...initialState };
1785
- }
1786
- switch (action.type) {
1787
- case `[${entity}] Create`:
1788
- return {
1789
- ...state,
1790
- loaded: false,
1791
- error: null,
1792
- };
1793
- case `[${entity}] Create Success`:
1794
- return {
1795
- ...state,
1796
- loaded: true,
1797
- error: null,
1798
- };
1799
- case `[${entity}] Create Failure`:
1800
- return {
1801
- ...state,
1802
- loaded: true,
1803
- error: action.error,
1804
- };
1805
- case `[${entity}] Create Many`:
1806
- return {
1807
- ...state,
1808
- loaded: false,
1809
- error: null,
1810
- };
1811
- case `[${entity}] Create Many Success`:
1812
- return {
1813
- ...state,
1814
- loaded: true,
1815
- error: null,
1816
- };
1817
- case `[${entity}] Create Many Failure`:
1818
- return {
1819
- ...state,
1820
- loaded: true,
1821
- error: action.error,
1822
- };
1823
- case `[${entity}] Export`:
1824
- return {
1825
- ...state,
1826
- loaded: false,
1827
- };
1828
- case `[${entity}] Export Success`:
1829
- return {
1830
- ...state,
1831
- loaded: true,
1832
- };
1833
- case `[${entity}] Export Failure`:
1834
- return {
1835
- ...state,
1836
- loaded: true,
1837
- };
1838
- case `[${entity}] Read`:
1839
- return {
1840
- ...state,
1841
- loaded: false,
1842
- filter: action?.filter,
1843
- error: null,
1844
- totalCount: null,
1845
- links: null,
1846
- };
1847
- case `[${entity}] Read Success`: {
1848
- let list = [];
1849
- if (action?.filter &&
1850
- action?.filter.offset &&
1851
- state.list &&
1852
- action?.filter.paginationMode !== PaginationMode.singlePage) {
1853
- state.list.forEach((i) => {
1854
- list.push(i);
1855
- });
1856
- list = [...list, ...action.result.data];
1857
- }
1858
- else {
1859
- list = action.result.data;
1860
- }
1861
- return {
1862
- ...state,
1863
- loaded: true,
1864
- list,
1865
- totalCount: action?.result?.totalCount,
1866
- links: action.result.links,
1867
- error: null,
1868
- };
1869
- }
1870
- case `[${entity}] Clear`:
1871
- return { ...initialState };
1872
- case `[${entity}] Read Failure`:
1873
- return {
1874
- ...state,
1875
- loaded: true,
1876
- error: action.error,
1877
- };
1878
- case `[${entity}] Select`:
1879
- return {
1880
- ...state,
1881
- loaded: false,
1882
- selected: null,
1883
- error: null,
1884
- };
1885
- case `[${entity}] Select Success`:
1886
- return {
1887
- ...state,
1888
- loaded: true,
1889
- selected: action.item,
1890
- error: null,
1891
- };
1892
- case `[${entity}] Select Failure`:
1893
- return {
1894
- ...state,
1895
- loaded: true,
1896
- error: action.error,
1897
- };
1898
- case `[${entity}] MultiSelect`:
1899
- return {
1900
- ...state,
1901
- multiSelected: [...action.items],
1902
- };
1903
- case `[${entity}] Unselect`:
1904
- return {
1905
- ...state,
1906
- loaded: true,
1907
- selected: null,
1908
- error: null,
1909
- };
1910
- case `[${entity}] Update`:
1911
- return {
1912
- ...state,
1913
- loaded: false,
1914
- error: null,
1915
- };
1916
- case `[${entity}] Update Success`:
1917
- return {
1918
- ...state,
1919
- loaded: true,
1920
- error: null,
1921
- };
1922
- case `[${entity}] Update Failure`:
1923
- return {
1924
- ...state,
1925
- loaded: true,
1926
- error: action.error,
1927
- };
1928
- case `[${entity}] Update partial`:
1929
- return {
1930
- ...state,
1931
- loaded: false,
1932
- error: null,
1933
- };
1934
- case `[${entity}] Update partial Success`:
1935
- return {
1936
- ...state,
1937
- loaded: true,
1938
- error: null,
1939
- };
1940
- case `[${entity}] Update partial Failure`:
1941
- return {
1942
- ...state,
1943
- loaded: true,
1944
- error: action.error,
1945
- };
1946
- case `[${entity}] Update partial many`:
1947
- return {
1948
- ...state,
1949
- loaded: false,
1950
- error: null,
1951
- };
1952
- case `[${entity}] Update partial many Success`:
1953
- return {
1954
- ...state,
1955
- multiSelected: [],
1956
- loaded: true,
1957
- error: null,
1958
- };
1959
- case `[${entity}] Update partial many Failure`:
1960
- return {
1961
- ...state,
1962
- loaded: true,
1963
- error: action.error,
1964
- };
1965
- case `[${entity}] Delete`:
1966
- return {
1967
- ...state,
1968
- loaded: false,
1969
- error: null,
1970
- };
1971
- case `[${entity}] Delete Success`:
1972
- return {
1973
- ...state,
1974
- loaded: true,
1975
- error: null,
1976
- };
1977
- case `[${entity}] Delete Failure`:
1978
- return {
1979
- ...state,
1980
- loaded: true,
1981
- error: action.error,
1982
- };
1983
- default:
1984
- return state;
1985
- }
1986
- };
1987
- function getReducer(entity) {
1988
- return (state, action) => {
1989
- return crudReducer(state, action, entity);
1990
- };
1991
- }
1992
-
1993
2045
  class CrudEffects {
1994
2046
  actions$;
1995
2047
  service;
@@ -2210,7 +2262,7 @@ class ItemStandardComponent extends CrudItemPageBaseComponent {
2210
2262
  </ng-template>
2211
2263
 
2212
2264
  <br /><br />
2213
- `, isInline: true, styles: [""], dependencies: [{ kind: "component", type: DetailsComponent, selector: "smart-details", inputs: ["options"] }, { kind: "component", type: FormComponent, selector: "smart-form", inputs: ["options"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: FormOptionsPipe, name: "smartFormOptions" }] });
2265
+ `, isInline: true, styles: [""], dependencies: [{ kind: "component", type: DetailsComponent, selector: "smart-details", inputs: ["options", "class"] }, { kind: "component", type: FormComponent, selector: "smart-form", inputs: ["options", "class"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: FormOptionsPipe, name: "smartFormOptions" }] });
2214
2266
  }
2215
2267
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ItemStandardComponent, decorators: [{
2216
2268
  type: Component,
@@ -2614,54 +2666,54 @@ class ItemComponent extends CreateDynamicComponent('crud-item-page') {
2614
2666
  }
2615
2667
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2616
2668
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ItemComponent, isStandalone: true, selector: "smart-crud-item-page", viewQueries: [{ propertyName: "standardComponents", predicate: ItemStandardComponent, descendants: true, isSignal: true }, { propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }, { propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, isSignal: true }, { propertyName: "bottomTpl", first: true, predicate: ["bottomTpl"], descendants: true, isSignal: true }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
2617
- <smart-page [options]="pageOptions()">
2618
- <div #topTpl class="text-xl py-2.5 separator"></div>
2619
- @if (template() === 'default') {
2620
- <smart-crud-item-standard-page
2621
- [detailsOptions]="detailsOptions()"
2622
- [mode]="mode"
2623
- [uniqueProvider]="uniqueProvider()"
2624
- (onPartialChange)="onPartialChange($event)"
2625
- (onChange)="onChange($event)"
2626
- (onValidChange)="onValidChange($event)"
2627
- >
2628
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2629
- </smart-crud-item-standard-page>
2630
- }
2631
- <ng-template #contentTpl>
2632
- <ng-content></ng-content>
2633
- </ng-template>
2634
- <div class="dynamic-content"></div>
2635
- <div #bottomTpl class="text-xl py-2.5 separator"></div>
2636
- </smart-page>
2637
- `, isInline: true, dependencies: [{ kind: "component", type: PageComponent, selector: "smart-page", inputs: ["options"] }, { kind: "component", type: ItemStandardComponent, selector: "smart-crud-item-standard-page" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2669
+ <!-- <smart-page [options]="pageOptions()">-->
2670
+ <div #topTpl class="text-xl py-2.5 separator"></div>
2671
+ @if (template() === 'default') {
2672
+ <smart-crud-item-standard-page
2673
+ [detailsOptions]="detailsOptions()"
2674
+ [mode]="mode"
2675
+ [uniqueProvider]="uniqueProvider()"
2676
+ (onPartialChange)="onPartialChange($event)"
2677
+ (onChange)="onChange($event)"
2678
+ (onValidChange)="onValidChange($event)"
2679
+ >
2680
+ <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2681
+ </smart-crud-item-standard-page>
2682
+ }
2683
+ <ng-template #contentTpl>
2684
+ <ng-content></ng-content>
2685
+ </ng-template>
2686
+ <div class="dynamic-content"></div>
2687
+ <div #bottomTpl class="text-xl py-2.5 separator"></div>
2688
+ <!-- </smart-page>-->
2689
+ `, isInline: true, dependencies: [{ kind: "component", type: /*PageComponent,*/ ItemStandardComponent, selector: "smart-crud-item-standard-page" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2638
2690
  }
2639
2691
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ItemComponent, decorators: [{
2640
2692
  type: Component,
2641
2693
  args: [{
2642
2694
  selector: 'smart-crud-item-page',
2643
- imports: [PageComponent, ItemStandardComponent, NgTemplateOutlet],
2695
+ imports: [/*PageComponent,*/ ItemStandardComponent, NgTemplateOutlet],
2644
2696
  template: `
2645
- <smart-page [options]="pageOptions()">
2646
- <div #topTpl class="text-xl py-2.5 separator"></div>
2647
- @if (template() === 'default') {
2648
- <smart-crud-item-standard-page
2649
- [detailsOptions]="detailsOptions()"
2650
- [mode]="mode"
2651
- [uniqueProvider]="uniqueProvider()"
2652
- (onPartialChange)="onPartialChange($event)"
2653
- (onChange)="onChange($event)"
2654
- (onValidChange)="onValidChange($event)"
2655
- >
2656
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2657
- </smart-crud-item-standard-page>
2658
- }
2659
- <ng-template #contentTpl>
2660
- <ng-content></ng-content>
2661
- </ng-template>
2662
- <div class="dynamic-content"></div>
2663
- <div #bottomTpl class="text-xl py-2.5 separator"></div>
2664
- </smart-page>
2697
+ <!-- <smart-page [options]="pageOptions()">-->
2698
+ <div #topTpl class="text-xl py-2.5 separator"></div>
2699
+ @if (template() === 'default') {
2700
+ <smart-crud-item-standard-page
2701
+ [detailsOptions]="detailsOptions()"
2702
+ [mode]="mode"
2703
+ [uniqueProvider]="uniqueProvider()"
2704
+ (onPartialChange)="onPartialChange($event)"
2705
+ (onChange)="onChange($event)"
2706
+ (onValidChange)="onValidChange($event)"
2707
+ >
2708
+ <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2709
+ </smart-crud-item-standard-page>
2710
+ }
2711
+ <ng-template #contentTpl>
2712
+ <ng-content></ng-content>
2713
+ </ng-template>
2714
+ <div class="dynamic-content"></div>
2715
+ <div #bottomTpl class="text-xl py-2.5 separator"></div>
2716
+ <!-- </smart-page>-->
2665
2717
  `,
2666
2718
  }]
2667
2719
  }], ctorParameters: () => [], propDecorators: { standardComponents: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => ItemStandardComponent), { isSignal: true }] }], contentTpl: [{ type: i0.ViewChild, args: ['contentTpl', { isSignal: true }] }], topTpl: [{ type: i0.ViewChild, args: ['topTpl', { isSignal: true }] }], bottomTpl: [{ type: i0.ViewChild, args: ['bottomTpl', { isSignal: true }] }], dynamicContents: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => DynamicContentDirective), { isSignal: true }] }] } });
@@ -2698,7 +2750,7 @@ class ListStandardComponent extends CrudListPageBaseComponent {
2698
2750
  [listOptions]="listOptions() || null"
2699
2751
  ></smart-crud-group>
2700
2752
  }
2701
- `, isInline: true, dependencies: [{ kind: "component", type: FiltersConfigComponent, selector: "smart-crud-filters-config" }, { kind: "component", type: ListComponent$1, selector: "smart-list", inputs: ["options"] }, { kind: "component", type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }] });
2753
+ `, isInline: true, dependencies: [{ kind: "component", type: FiltersConfigComponent, selector: "smart-crud-filters-config" }, { kind: "component", type: ListComponent$1, selector: "smart-list", inputs: ["options", "class"] }, { kind: "component", type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }] });
2702
2754
  }
2703
2755
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ListStandardComponent, decorators: [{
2704
2756
  type: Component,
@@ -3073,42 +3125,42 @@ class ListComponent extends CreateDynamicComponent('crud-list-page') {
3073
3125
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3074
3126
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ListComponent, isStandalone: true, selector: "smart-crud-list-page", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, isSignal: true }, { propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
3075
3127
  @if (filter() && pageOptions()) {
3076
- <smart-page [options]="pageOptions()">
3077
- <div #topTpl></div>
3128
+ <!-- <smart-page [options]="pageOptions()">-->
3129
+ <div #topTpl></div>
3078
3130
 
3079
- @if (template() === 'default' && listOptions()) {
3080
- <smart-crud-list-standard-page [listOptions]="listOptions()">
3081
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
3082
- </smart-crud-list-standard-page>
3083
- }
3084
- <ng-template #contentTpl>
3085
- <ng-content></ng-content>
3086
- </ng-template>
3087
- <div class="dynamic-content"></div>
3088
- </smart-page>
3131
+ @if (template() === 'default' && listOptions()) {
3132
+ <smart-crud-list-standard-page [listOptions]="listOptions()">
3133
+ <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
3134
+ </smart-crud-list-standard-page>
3135
+ }
3136
+ <ng-template #contentTpl>
3137
+ <ng-content></ng-content>
3138
+ </ng-template>
3139
+ <div class="dynamic-content"></div>
3140
+ <!-- </smart-page>-->
3089
3141
  }
3090
- `, isInline: true, dependencies: [{ kind: "component", type: PageComponent, selector: "smart-page", inputs: ["options"] }, { kind: "component", type: ListStandardComponent, selector: "smart-crud-list-standard-page" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
3142
+ `, isInline: true, dependencies: [{ kind: "component", type: ListStandardComponent, selector: "smart-crud-list-standard-page" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
3091
3143
  }
3092
3144
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ListComponent, decorators: [{
3093
3145
  type: Component,
3094
3146
  args: [{
3095
3147
  selector: 'smart-crud-list-page',
3096
- imports: [PageComponent, ListStandardComponent, NgTemplateOutlet],
3148
+ imports: [ListStandardComponent, NgTemplateOutlet],
3097
3149
  template: `
3098
3150
  @if (filter() && pageOptions()) {
3099
- <smart-page [options]="pageOptions()">
3100
- <div #topTpl></div>
3151
+ <!-- <smart-page [options]="pageOptions()">-->
3152
+ <div #topTpl></div>
3101
3153
 
3102
- @if (template() === 'default' && listOptions()) {
3103
- <smart-crud-list-standard-page [listOptions]="listOptions()">
3104
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
3105
- </smart-crud-list-standard-page>
3106
- }
3107
- <ng-template #contentTpl>
3108
- <ng-content></ng-content>
3109
- </ng-template>
3110
- <div class="dynamic-content"></div>
3111
- </smart-page>
3154
+ @if (template() === 'default' && listOptions()) {
3155
+ <smart-crud-list-standard-page [listOptions]="listOptions()">
3156
+ <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
3157
+ </smart-crud-list-standard-page>
3158
+ }
3159
+ <ng-template #contentTpl>
3160
+ <ng-content></ng-content>
3161
+ </ng-template>
3162
+ <div class="dynamic-content"></div>
3163
+ <!-- </smart-page>-->
3112
3164
  }
3113
3165
  `,
3114
3166
  }]