@smartsoft001/crud-shell-angular 2.93.0 → 2.95.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.
@@ -290,39 +290,31 @@ const getCrudError = (entity) => createSelector(getCrudState(entity), (state) =>
290
290
  class CrudFacade {
291
291
  store;
292
292
  config;
293
+ loaded;
294
+ loading;
295
+ selected;
296
+ multiSelected;
297
+ list;
298
+ filter;
299
+ totalCount;
300
+ links;
301
+ error;
293
302
  constructor(store, config) {
294
303
  this.store = store;
295
304
  this.config = config;
296
305
  if (NgrxStoreService.store) {
297
306
  this.store = NgrxStoreService.store;
298
307
  }
299
- }
300
- get loaded() {
301
- return toSignal(this.store.pipe(select$1(getCrudLoaded(this.config.entity))));
302
- }
303
- get loading() {
304
- return toSignal(this.store.pipe(select$1(getCrudLoaded(this.config.entity)), map((l) => !l)));
305
- }
306
- get selected() {
307
- return toSignal(this.store.pipe(select$1(getCrudSelected(this.config.entity))));
308
- }
309
- get multiSelected() {
310
- return toSignal(this.store.pipe(select$1(getCrudMultiSelected(this.config.entity))));
311
- }
312
- get list() {
313
- return toSignal(this.store.pipe(select$1(getCrudList(this.config.entity))));
314
- }
315
- get filter() {
316
- return toSignal(this.store.pipe(select$1(getCrudFilter(this.config.entity))));
317
- }
318
- get totalCount() {
319
- return toSignal(this.store.pipe(select$1(getCrudTotalCount(this.config.entity))));
320
- }
321
- get links() {
322
- return toSignal(this.store.pipe(select$1(getCrudLinks(this.config.entity))));
323
- }
324
- get error() {
325
- return toSignal(this.store.pipe(select$1(getCrudError(this.config.entity))));
308
+ // Initialize all signals in the constructor (injection context)
309
+ this.loaded = toSignal(this.store.pipe(select$1(getCrudLoaded(this.config.entity))));
310
+ this.loading = toSignal(this.store.pipe(select$1(getCrudLoaded(this.config.entity)), map((l) => !l)));
311
+ this.selected = toSignal(this.store.pipe(select$1(getCrudSelected(this.config.entity))));
312
+ this.multiSelected = toSignal(this.store.pipe(select$1(getCrudMultiSelected(this.config.entity))));
313
+ this.list = toSignal(this.store.pipe(select$1(getCrudList(this.config.entity))));
314
+ this.filter = toSignal(this.store.pipe(select$1(getCrudFilter(this.config.entity))));
315
+ this.totalCount = toSignal(this.store.pipe(select$1(getCrudTotalCount(this.config.entity))));
316
+ this.links = toSignal(this.store.pipe(select$1(getCrudLinks(this.config.entity))));
317
+ this.error = toSignal(this.store.pipe(select$1(getCrudError(this.config.entity))));
326
318
  }
327
319
  create(item) {
328
320
  this.store.dispatch(create(this.config.entity, item));
@@ -1434,8 +1426,8 @@ class GroupComponent extends BaseComponent$1 {
1434
1426
  styleService = inject(StyleService);
1435
1427
  elementRef = inject(ElementRef);
1436
1428
  groupService = inject((CrudListGroupService));
1437
- groups = input(...(ngDevMode ? [undefined, { debugName: "groups" }] : []));
1438
- listOptions = input(...(ngDevMode ? [undefined, { debugName: "listOptions" }] : []));
1429
+ groups = input(null, ...(ngDevMode ? [{ debugName: "groups" }] : []));
1430
+ listOptions = input(null, ...(ngDevMode ? [{ debugName: "listOptions" }] : []));
1439
1431
  change(val, item, force = false) {
1440
1432
  const groups = this.groups();
1441
1433
  if (groups) {
@@ -2704,7 +2696,7 @@ class ListStandardComponent extends CrudListPageBaseComponent {
2704
2696
  @if (groups && !isSearch()) {
2705
2697
  <smart-crud-group
2706
2698
  [groups]="groups"
2707
- [listOptions]="listOptions()"
2699
+ [listOptions]="listOptions() || null"
2708
2700
  ></smart-crud-group>
2709
2701
  }
2710
2702
  `, 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"] }] });
@@ -2725,7 +2717,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
2725
2717
  @if (groups && !isSearch()) {
2726
2718
  <smart-crud-group
2727
2719
  [groups]="groups"
2728
- [listOptions]="listOptions()"
2720
+ [listOptions]="listOptions() || null"
2729
2721
  ></smart-crud-group>
2730
2722
  }
2731
2723
  `,
@@ -2783,17 +2775,13 @@ class ListComponent extends CreateDynamicComponent('crud-list-page') {
2783
2775
  config = inject((CrudFullConfig));
2784
2776
  searchService = inject(CrudSearchService);
2785
2777
  _cleanMultiSelected$ = new Subject();
2786
- pageOptions;
2787
- listOptions;
2788
- links;
2778
+ pageOptions = signal(null, ...(ngDevMode ? [{ debugName: "pageOptions" }] : []));
2779
+ listOptions = signal(null, ...(ngDevMode ? [{ debugName: "listOptions" }] : []));
2780
+ links = this.facade.links;
2789
2781
  filter = this.facade.filter;
2790
2782
  topTpl = viewChild('topTpl', ...(ngDevMode ? [{ debugName: "topTpl" }] : []));
2791
2783
  contentTpl = viewChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
2792
2784
  dynamicContents = viewChildren(DynamicContentDirective, ...(ngDevMode ? [{ debugName: "dynamicContents" }] : []));
2793
- constructor() {
2794
- super();
2795
- this.links = this.facade.links();
2796
- }
2797
2785
  refreshProperties() {
2798
2786
  this.baseComponentRef.setInput('listOptions', this.listOptions());
2799
2787
  }
@@ -2851,7 +2839,7 @@ class ListComponent extends CreateDynamicComponent('crud-list-page') {
2851
2839
  }
2852
2840
  this.facade.read(newFilter);
2853
2841
  const endButtons = this.getEndButtons();
2854
- this.pageOptions = computed(() => ({
2842
+ this.pageOptions.set({
2855
2843
  title: this.config.title || '',
2856
2844
  search: this.config.search
2857
2845
  ? {
@@ -2867,7 +2855,7 @@ class ListComponent extends CreateDynamicComponent('crud-list-page') {
2867
2855
  }
2868
2856
  : undefined,
2869
2857
  endButtons: endButtons,
2870
- }), ...(ngDevMode ? [{ debugName: "pageOptions" }] : []));
2858
+ });
2871
2859
  const compiledComponents = await this.dynamicComponentLoader.getComponentsWithFactories({
2872
2860
  components: [
2873
2861
  ...(this.config.details &&
@@ -2975,7 +2963,7 @@ class ListComponent extends CreateDynamicComponent('crud-list-page') {
2975
2963
  getFilter: () => {
2976
2964
  return this.filter() || {};
2977
2965
  },
2978
- getLinks: () => this.links,
2966
+ getLinks: () => this.links(),
2979
2967
  },
2980
2968
  }),
2981
2969
  sort: this.config.sort,
@@ -3020,7 +3008,7 @@ class ListComponent extends CreateDynamicComponent('crud-list-page') {
3020
3008
  setTimeout(async () => {
3021
3009
  this.listOptions.update((val) => ({
3022
3010
  ...val,
3023
- select: val.select === 'multi' ? undefined : 'multi',
3011
+ select: val?.select === 'multi' ? undefined : 'multi',
3024
3012
  }));
3025
3013
  if (this.menuService.openedEnd)
3026
3014
  await this.menuService.closeEnd();
@@ -3083,13 +3071,13 @@ class ListComponent extends CreateDynamicComponent('crud-list-page') {
3083
3071
  }
3084
3072
  });
3085
3073
  }
3086
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3074
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3087
3075
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", 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: `
3088
- @if (filter()) {
3076
+ @if (filter() && pageOptions()) {
3089
3077
  <smart-page [options]="pageOptions()">
3090
3078
  <div #topTpl></div>
3091
3079
 
3092
- @if (template() === 'default') {
3080
+ @if (template() === 'default' && listOptions()) {
3093
3081
  <smart-crud-list-standard-page [listOptions]="listOptions()">
3094
3082
  <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
3095
3083
  </smart-crud-list-standard-page>
@@ -3108,11 +3096,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
3108
3096
  selector: 'smart-crud-list-page',
3109
3097
  imports: [PageComponent, ListStandardComponent, NgTemplateOutlet],
3110
3098
  template: `
3111
- @if (filter()) {
3099
+ @if (filter() && pageOptions()) {
3112
3100
  <smart-page [options]="pageOptions()">
3113
3101
  <div #topTpl></div>
3114
3102
 
3115
- @if (template() === 'default') {
3103
+ @if (template() === 'default' && listOptions()) {
3116
3104
  <smart-crud-list-standard-page [listOptions]="listOptions()">
3117
3105
  <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
3118
3106
  </smart-crud-list-standard-page>
@@ -3125,7 +3113,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
3125
3113
  }
3126
3114
  `,
3127
3115
  }]
3128
- }], ctorParameters: () => [] });
3116
+ }] });
3129
3117
 
3130
3118
  const PAGES = [
3131
3119
  ItemComponent,