@smartsoft001/angular 2.89.0 → 2.90.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.
@@ -19,13 +19,13 @@ import { toSignal, toObservable } from '@angular/core/rxjs-interop';
19
19
  import { __decorate, __metadata } from 'tslib';
20
20
  import { Memoize } from 'lodash-decorators';
21
21
  import { getModelFieldOptions, SYMBOL_MODEL, SYMBOL_FIELD, getModelFieldsWithOptions, FieldType, getModelOptions } from '@smartsoft001/models';
22
- import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet, AsyncPipe, NgComponentOutlet, NgClass, Location, CommonModule, NgOptimizedImage } from '@angular/common';
22
+ import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet, AsyncPipe, NgComponentOutlet, NgClass, Location, NgOptimizedImage, CommonModule } from '@angular/common';
23
23
  import 'reflect-metadata';
24
24
  import * as _ from 'lodash';
25
25
  import { ColorPickerDirective } from 'ngx-color-picker';
26
26
  import { DynamicIoDirective, DynamicComponent, DynamicModule } from 'ng-dynamic-component';
27
27
  import { Editor, NgxEditorMenuComponent, NgxEditorComponent } from 'ngx-editor';
28
- import { CdkTableModule, CdkTable, CdkHeaderCell, CdkCell, CdkHeaderRow, CdkRow } from '@angular/cdk/table';
28
+ import { CdkTable, CdkHeaderCell, CdkCell, CdkHeaderRow, CdkRow, CdkTableModule } from '@angular/cdk/table';
29
29
  import * as i1$2 from 'ng-lazyload-image';
30
30
  import { LazyLoadImageModule } from 'ng-lazyload-image';
31
31
  import { DragDropModule } from '@angular/cdk/drag-drop';
@@ -6123,564 +6123,188 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
6123
6123
  `, changeDetection: ChangeDetectionStrategy.OnPush, imports: [TranslatePipe], styles: [":host{width:100%}\n"] }]
6124
6124
  }] });
6125
6125
 
6126
- class DetailsPage {
6127
- modalService = inject(ModalService);
6128
- styleService = inject(StyleService);
6129
- elementRef = inject(ElementRef);
6130
- // navParams: NavParams, //TODO: to be injected
6131
- pageOptions = signal({
6132
- title: 'details',
6133
- hideMenuButton: true,
6134
- }, ...(ngDevMode ? [{ debugName: "pageOptions" }] : []));
6135
- detailsOptions;
6126
+ class ListBaseComponent {
6127
+ static smartType = 'list';
6128
+ _fields;
6129
+ provider;
6130
+ authService = inject(AuthService);
6131
+ router = inject(Router);
6132
+ alertService = inject(AlertService);
6133
+ cd = inject(ChangeDetectorRef);
6134
+ translateService = inject(TranslateService);
6135
+ detailsComponent;
6136
+ selectMode;
6137
+ detailsComponentProps;
6138
+ select;
6139
+ unselect;
6140
+ itemHandler = null;
6141
+ removeHandler = null;
6142
+ checkRemoveHandler;
6143
+ detailsButtonOptions;
6144
+ removed = new Set();
6145
+ keys;
6146
+ cellPipe = null;
6147
+ loadPrevPage = null;
6148
+ loadNextPage = null;
6149
+ list;
6150
+ loading;
6151
+ page;
6152
+ totalPages;
6153
+ FieldType = FieldType;
6154
+ PaginationMode = PaginationMode;
6155
+ type;
6156
+ sort;
6157
+ options = input.required(...(ngDevMode ? [{ debugName: "options" }] : []));
6158
+ contentTpl = viewChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
6136
6159
  constructor() {
6137
- this.detailsOptions = /*navParams.get('value')*/ {};
6138
- this.initTitle();
6139
- this.initButtons();
6140
- }
6141
- ngOnInit() {
6142
- this.styleService.init(this.elementRef);
6143
- }
6144
- initTitle() {
6145
- this.pageOptions.update((options) => {
6146
- if (this.detailsOptions.title) {
6147
- return {
6148
- ...options,
6149
- title: this.detailsOptions.title,
6160
+ effect(() => {
6161
+ const options = this.options();
6162
+ this._fields = options.fields ?? [];
6163
+ this.provider = options.provider;
6164
+ this.sort = options.sort ?? {};
6165
+ this.cellPipe = options.cellPipe ?? null;
6166
+ this.selectMode = options.select;
6167
+ this.type = options.type;
6168
+ this.initKeys();
6169
+ this.initList(options);
6170
+ this.initLoading();
6171
+ const removeHandler = options.remove;
6172
+ if (options.remove) {
6173
+ if (removeHandler?.provider?.check) {
6174
+ this.checkRemoveHandler = removeHandler.provider.check;
6175
+ }
6176
+ this.removeHandler = async (obj) => {
6177
+ await this.alertService.show({
6178
+ header: this.translateService.instant('OBJECT.confirmDelete'),
6179
+ buttons: [
6180
+ {
6181
+ text: this.translateService.instant('cancel'),
6182
+ role: 'cancel',
6183
+ },
6184
+ {
6185
+ text: this.translateService.instant('confirm'),
6186
+ handler: () => {
6187
+ removeHandler?.provider?.invoke?.(obj.id);
6188
+ },
6189
+ },
6190
+ ],
6191
+ backdropDismiss: false,
6192
+ });
6150
6193
  };
6151
6194
  }
6152
- return options;
6153
- });
6154
- }
6155
- initButtons() {
6156
- const buttons = [];
6157
- if (this.detailsOptions.removeHandler) {
6158
- buttons.push({
6159
- handler: () => {
6160
- computed(() => {
6161
- const item = this.detailsOptions.item();
6162
- this.detailsOptions?.removeHandler?.(item);
6163
- this.modalService.dismiss();
6195
+ if (options.item) {
6196
+ const itemOptions = options.item.options;
6197
+ if (!itemOptions)
6198
+ throw Error('Must set edit options');
6199
+ this.itemHandler = (id) => {
6200
+ if (itemOptions?.routingPrefix) {
6201
+ setTimeout(async () => {
6202
+ await this.router.navigate([
6203
+ itemOptions.routingPrefix.replace('//', '/'),
6204
+ id,
6205
+ ]);
6206
+ this.cd.detectChanges();
6207
+ });
6208
+ }
6209
+ else if (itemOptions?.select)
6210
+ itemOptions.select(id);
6211
+ };
6212
+ }
6213
+ const details = options.details;
6214
+ if (options.details) {
6215
+ if (!details?.provider)
6216
+ throw Error('Must set details provider');
6217
+ if (!details?.component)
6218
+ throw Error('Must set details component');
6219
+ this.detailsComponent = details.component;
6220
+ this.detailsComponentProps = {
6221
+ item: details?.provider.item,
6222
+ type: options.type,
6223
+ loading: details?.provider.loading,
6224
+ itemHandler: this.itemHandler ?? null,
6225
+ removeHandler: this.removeHandler,
6226
+ componentFactories: details?.componentFactories,
6227
+ };
6228
+ this.select = details?.provider.getData;
6229
+ this.unselect = details?.provider.clearData;
6230
+ }
6231
+ if (options.pagination) {
6232
+ this.loadNextPage = async (event = null) => {
6233
+ await options?.pagination?.loadNextPage?.();
6234
+ if (event)
6235
+ event.target.complete();
6236
+ setTimeout(() => {
6237
+ window.scrollTo(0, 0);
6164
6238
  });
6165
- },
6166
- icon: 'trash',
6167
- });
6168
- }
6169
- if (this.detailsOptions.itemHandler) {
6170
- buttons.push({
6171
- handler: () => {
6172
- computed(() => {
6173
- const item = this.detailsOptions.item();
6174
- this.detailsOptions?.removeHandler?.(item);
6175
- this.modalService.dismiss();
6239
+ };
6240
+ this.loadPrevPage = async (event = null) => {
6241
+ await options?.pagination?.loadPrevPage?.();
6242
+ if (event)
6243
+ event.target.complete();
6244
+ setTimeout(() => {
6245
+ window.scrollTo(0, 10000);
6176
6246
  });
6177
- },
6178
- icon: 'arrow-forward-outline',
6179
- });
6180
- }
6181
- this.pageOptions.update((options) => ({ ...options, endButtons: buttons }));
6247
+ };
6248
+ this.page = options.pagination.page;
6249
+ this.totalPages = options.pagination.totalPages;
6250
+ }
6251
+ this.afterInitOptions();
6252
+ });
6253
+ this.detailsButtonOptions = {
6254
+ loading: this.loading,
6255
+ click: () => {
6256
+ this.unselect();
6257
+ },
6258
+ };
6182
6259
  }
6183
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: DetailsPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
6184
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.0", type: DetailsPage, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<smart-page [options]=\"pageOptions()\">\n <smart-details #smartDetails [options]=\"detailsOptions\"></smart-details>\n</smart-page>\n", styles: [":host{width:100%}\n"], dependencies: [{ kind: "component", type: PageComponent, selector: "smart-page", inputs: ["options"] }, { kind: "component", type: DetailsComponent, selector: "smart-details", inputs: ["options"] }] });
6260
+ initKeys(data = null) {
6261
+ const result = [];
6262
+ this._fields
6263
+ .filter((field) => {
6264
+ if (field.options.list &&
6265
+ field.options.list.permissions) {
6266
+ return this.authService.expectPermissions(field.options.list?.permissions ?? null);
6267
+ }
6268
+ return true;
6269
+ })
6270
+ .forEach((field) => {
6271
+ if (field.options.list.dynamic) {
6272
+ if (!data?.length)
6273
+ return;
6274
+ data[0][field.key]
6275
+ .map((_, index) => `__array.${field.key}.${index}.${field.options.list?.dynamic
6276
+ ?.headerKey ?? ''}.${field.options.list?.dynamic?.rowKey ??
6277
+ ''}`)
6278
+ .forEach((item) => result.push(item));
6279
+ return;
6280
+ }
6281
+ result.push(field.key);
6282
+ });
6283
+ if (!this.keys || this.keys.length !== result.length)
6284
+ this.keys = result;
6285
+ }
6286
+ //The parameter is used in the inherited classes
6287
+ initList(val) {
6288
+ this.list = computed(() => {
6289
+ const list = this.provider.list();
6290
+ if (!list)
6291
+ return list;
6292
+ const result = list.filter((item) => !this.removed.has(item.id));
6293
+ this.initKeys(list);
6294
+ return result;
6295
+ }, ...(ngDevMode ? [{ debugName: "list" }] : []));
6296
+ }
6297
+ initLoading() {
6298
+ this.loading = this.provider.loading;
6299
+ }
6300
+ afterInitOptions() {
6301
+ // No base functionality
6302
+ }
6303
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
6304
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.1.0", type: ListBaseComponent, isStandalone: true, inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }], ngImport: i0 });
6185
6305
  }
6186
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: DetailsPage, decorators: [{
6187
- type: Component,
6188
- args: [{ imports: [PageComponent, DetailsComponent], template: "<smart-page [options]=\"pageOptions()\">\n <smart-details #smartDetails [options]=\"detailsOptions\"></smart-details>\n</smart-page>\n", styles: [":host{width:100%}\n"] }]
6189
- }], ctorParameters: () => [] });
6190
-
6191
- const ACCORDION_COMPONENTS = [
6192
- AccordionComponent,
6193
- AccordionHeaderComponent,
6194
- AccordionBodyComponent,
6195
- ];
6196
- const BUTTON_COMPONENTS = [ButtonComponent, ButtonStandardComponent];
6197
- const CARD_COMPONENTS = [CardComponent];
6198
- const DETAILS_COMPONENTS = [DetailsComponent, DetailsStandardComponent];
6199
- const DETAIL_COMPONENTS = [
6200
- DetailComponent,
6201
- DetailTextComponent,
6202
- DetailFlagComponent,
6203
- DetailEnumComponent,
6204
- DetailEmailComponent,
6205
- DetailAddressComponent,
6206
- DetailObjectComponent,
6207
- DetailColorComponent,
6208
- DetailLogoComponent,
6209
- DetailArrayComponent,
6210
- DetailPdfComponent,
6211
- DetailVideoComponent,
6212
- DetailAttachmentComponent,
6213
- DetailDateRangeComponent,
6214
- DetailImageComponent,
6215
- DetailPhoneNumberPlComponent,
6216
- ];
6217
- const FORM_COMPONENTS = [
6218
- FormStandardComponent,
6219
- FormComponent,
6220
- ];
6221
- const INPUT_COMPONENTS = [
6222
- InputComponent,
6223
- InputIntComponent,
6224
- InputErrorComponent,
6225
- InputTextComponent,
6226
- InputPasswordComponent,
6227
- InputFlagComponent,
6228
- InputEnumComponent,
6229
- InputEmailComponent,
6230
- InputCurrencyComponent,
6231
- InputDateComponent,
6232
- InputDateWithEditComponent,
6233
- InputFileComponent,
6234
- InputRadioComponent,
6235
- InputNipComponent,
6236
- InputStringsComponent,
6237
- InputLongTextComponent,
6238
- InputAddressComponent,
6239
- InputObjectComponent,
6240
- InputColorComponent,
6241
- InputLogoComponent,
6242
- InputCheckComponent,
6243
- InputIntsComponent,
6244
- InputPhoneNumberComponent,
6245
- InputPhoneNumberPlComponent,
6246
- InputPeselComponent,
6247
- InputArrayComponent,
6248
- InputPdfComponent,
6249
- InputVideoComponent,
6250
- InputAttachmentComponent,
6251
- InputDateRangeComponent,
6252
- InputImageComponent,
6253
- InputFloatComponent,
6254
- ];
6255
- const LIST_COMPONENTS = [
6256
- ListComponent,
6257
- ListMobileComponent,
6258
- ListDesktopComponent,
6259
- ListMasonryGridComponent,
6260
- ];
6261
- const LOADER_COMPONENTS = [LoaderComponent];
6262
- const PAGE_COMPONENTS = [PageStandardComponent, PageComponent];
6263
- const INFO_COMPONENTS = [InfoComponent, InfoModalComponent];
6264
- const DATE_RANGE_COMPONENTS = [
6265
- DateRangeComponent,
6266
- DateRangeModalComponent,
6267
- ];
6268
- const DATE_EDIT_COMPONENTS = [DateEditComponent];
6269
- const DYNAMIC_COMPONENTS = [DynamicComponent];
6270
- const COMPONENTS$1 = [
6271
- ...FORM_COMPONENTS,
6272
- ...INPUT_COMPONENTS,
6273
- ...PAGE_COMPONENTS,
6274
- ...ACCORDION_COMPONENTS,
6275
- ...DATE_RANGE_COMPONENTS,
6276
- ...DATE_EDIT_COMPONENTS,
6277
- ...BUTTON_COMPONENTS,
6278
- ...CARD_COMPONENTS,
6279
- ...LIST_COMPONENTS,
6280
- ...LOADER_COMPONENTS,
6281
- ...DETAIL_COMPONENTS,
6282
- ...DETAILS_COMPONENTS,
6283
- ...DYNAMIC_COMPONENTS,
6284
- ...INFO_COMPONENTS,
6285
- ExportComponent,
6286
- ImportComponent,
6287
- PasswordStrengthComponent,
6288
- ];
6289
- const IMPORTS = [
6290
- CommonModule,
6291
- ReactiveFormsModule,
6292
- FormsModule,
6293
- TranslateModule,
6294
- RouterModule,
6295
- SharedPipesModule,
6296
- SharedDirectivesModule,
6297
- HttpClientModule,
6298
- LazyLoadImageModule,
6299
- DragDropModule,
6300
- CdkTableModule,
6301
- DynamicModule,
6302
- ];
6303
- class SharedComponentsModule {
6304
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6305
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, imports: [CommonModule,
6306
- ReactiveFormsModule,
6307
- FormsModule,
6308
- TranslateModule,
6309
- RouterModule,
6310
- SharedPipesModule,
6311
- SharedDirectivesModule,
6312
- HttpClientModule,
6313
- LazyLoadImageModule,
6314
- DragDropModule,
6315
- CdkTableModule,
6316
- DynamicModule, FormStandardComponent,
6317
- FormComponent, InputComponent,
6318
- InputIntComponent,
6319
- InputErrorComponent,
6320
- InputTextComponent,
6321
- InputPasswordComponent,
6322
- InputFlagComponent,
6323
- InputEnumComponent,
6324
- InputEmailComponent,
6325
- InputCurrencyComponent,
6326
- InputDateComponent,
6327
- InputDateWithEditComponent,
6328
- InputFileComponent,
6329
- InputRadioComponent,
6330
- InputNipComponent,
6331
- InputStringsComponent,
6332
- InputLongTextComponent,
6333
- InputAddressComponent,
6334
- InputObjectComponent,
6335
- InputColorComponent,
6336
- InputLogoComponent,
6337
- InputCheckComponent,
6338
- InputIntsComponent,
6339
- InputPhoneNumberComponent,
6340
- InputPhoneNumberPlComponent,
6341
- InputPeselComponent,
6342
- InputArrayComponent,
6343
- InputPdfComponent,
6344
- InputVideoComponent,
6345
- InputAttachmentComponent,
6346
- InputDateRangeComponent,
6347
- InputImageComponent,
6348
- InputFloatComponent, PageStandardComponent, PageComponent, AccordionComponent,
6349
- AccordionHeaderComponent,
6350
- AccordionBodyComponent, DateRangeComponent,
6351
- DateRangeModalComponent, DateEditComponent, ButtonComponent, ButtonStandardComponent, CardComponent, ListComponent,
6352
- ListMobileComponent,
6353
- ListDesktopComponent,
6354
- ListMasonryGridComponent, LoaderComponent, DetailComponent,
6355
- DetailTextComponent,
6356
- DetailFlagComponent,
6357
- DetailEnumComponent,
6358
- DetailEmailComponent,
6359
- DetailAddressComponent,
6360
- DetailObjectComponent,
6361
- DetailColorComponent,
6362
- DetailLogoComponent,
6363
- DetailArrayComponent,
6364
- DetailPdfComponent,
6365
- DetailVideoComponent,
6366
- DetailAttachmentComponent,
6367
- DetailDateRangeComponent,
6368
- DetailImageComponent,
6369
- DetailPhoneNumberPlComponent, DetailsComponent, DetailsStandardComponent, DynamicComponent, InfoComponent, InfoModalComponent, ExportComponent,
6370
- ImportComponent,
6371
- PasswordStrengthComponent], exports: [FormStandardComponent,
6372
- FormComponent, InputComponent,
6373
- InputIntComponent,
6374
- InputErrorComponent,
6375
- InputTextComponent,
6376
- InputPasswordComponent,
6377
- InputFlagComponent,
6378
- InputEnumComponent,
6379
- InputEmailComponent,
6380
- InputCurrencyComponent,
6381
- InputDateComponent,
6382
- InputDateWithEditComponent,
6383
- InputFileComponent,
6384
- InputRadioComponent,
6385
- InputNipComponent,
6386
- InputStringsComponent,
6387
- InputLongTextComponent,
6388
- InputAddressComponent,
6389
- InputObjectComponent,
6390
- InputColorComponent,
6391
- InputLogoComponent,
6392
- InputCheckComponent,
6393
- InputIntsComponent,
6394
- InputPhoneNumberComponent,
6395
- InputPhoneNumberPlComponent,
6396
- InputPeselComponent,
6397
- InputArrayComponent,
6398
- InputPdfComponent,
6399
- InputVideoComponent,
6400
- InputAttachmentComponent,
6401
- InputDateRangeComponent,
6402
- InputImageComponent,
6403
- InputFloatComponent, PageStandardComponent, PageComponent, AccordionComponent,
6404
- AccordionHeaderComponent,
6405
- AccordionBodyComponent, DateRangeComponent,
6406
- DateRangeModalComponent, DateEditComponent, ButtonComponent, ButtonStandardComponent, CardComponent, ListComponent,
6407
- ListMobileComponent,
6408
- ListDesktopComponent,
6409
- ListMasonryGridComponent, LoaderComponent, DetailComponent,
6410
- DetailTextComponent,
6411
- DetailFlagComponent,
6412
- DetailEnumComponent,
6413
- DetailEmailComponent,
6414
- DetailAddressComponent,
6415
- DetailObjectComponent,
6416
- DetailColorComponent,
6417
- DetailLogoComponent,
6418
- DetailArrayComponent,
6419
- DetailPdfComponent,
6420
- DetailVideoComponent,
6421
- DetailAttachmentComponent,
6422
- DetailDateRangeComponent,
6423
- DetailImageComponent,
6424
- DetailPhoneNumberPlComponent, DetailsComponent, DetailsStandardComponent, DynamicComponent, InfoComponent, InfoModalComponent, ExportComponent,
6425
- ImportComponent,
6426
- PasswordStrengthComponent] });
6427
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, providers: [
6428
- {
6429
- provide: FORM_COMPONENT_TOKEN,
6430
- useValue: FormComponent,
6431
- },
6432
- {
6433
- provide: DETAILS_COMPONENT_TOKEN,
6434
- useValue: DetailsComponent,
6435
- },
6436
- ], imports: [IMPORTS, FormStandardComponent,
6437
- FormComponent, InputComponent,
6438
- InputIntComponent,
6439
- InputTextComponent,
6440
- InputPasswordComponent,
6441
- InputFlagComponent,
6442
- InputEmailComponent,
6443
- InputCurrencyComponent,
6444
- InputDateComponent,
6445
- InputDateWithEditComponent,
6446
- InputRadioComponent,
6447
- InputNipComponent,
6448
- InputStringsComponent,
6449
- InputLongTextComponent,
6450
- InputAddressComponent,
6451
- InputCheckComponent,
6452
- InputIntsComponent,
6453
- InputPhoneNumberComponent,
6454
- InputPhoneNumberPlComponent,
6455
- InputPeselComponent,
6456
- InputFloatComponent, PageStandardComponent, PageComponent, DateEditComponent, ListComponent,
6457
- ListMobileComponent,
6458
- ListDesktopComponent, DynamicComponent] });
6459
- }
6460
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, decorators: [{
6461
- type: NgModule,
6462
- args: [{
6463
- declarations: [],
6464
- exports: [...COMPONENTS$1],
6465
- providers: [
6466
- {
6467
- provide: FORM_COMPONENT_TOKEN,
6468
- useValue: FormComponent,
6469
- },
6470
- {
6471
- provide: DETAILS_COMPONENT_TOKEN,
6472
- useValue: DetailsComponent,
6473
- },
6474
- ],
6475
- imports: [...IMPORTS, ...COMPONENTS$1],
6476
- }]
6477
- }] });
6478
-
6479
- const COMPONENTS = [DetailsPage];
6480
- class SharedPagesModule {
6481
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6482
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, imports: [SharedServicesModule,
6483
- SharedComponentsModule,
6484
- SharedDirectivesModule, DetailsPage], exports: [DetailsPage] });
6485
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, imports: [SharedServicesModule,
6486
- SharedComponentsModule,
6487
- SharedDirectivesModule,
6488
- COMPONENTS] });
6489
- }
6490
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, decorators: [{
6491
- type: NgModule,
6492
- args: [{
6493
- imports: [
6494
- SharedServicesModule,
6495
- SharedComponentsModule,
6496
- SharedDirectivesModule,
6497
- COMPONENTS,
6498
- ],
6499
- declarations: [],
6500
- exports: [...COMPONENTS],
6501
- }]
6502
- }] });
6503
-
6504
- class ListBaseComponent {
6505
- static smartType = 'list';
6506
- _fields;
6507
- provider;
6508
- authService = inject(AuthService);
6509
- router = inject(Router);
6510
- alertService = inject(AlertService);
6511
- cd = inject(ChangeDetectorRef);
6512
- translateService = inject(TranslateService);
6513
- detailsComponent;
6514
- selectMode;
6515
- detailsComponentProps;
6516
- select;
6517
- unselect;
6518
- itemHandler = null;
6519
- removeHandler = null;
6520
- checkRemoveHandler;
6521
- detailsButtonOptions;
6522
- removed = new Set();
6523
- keys;
6524
- cellPipe = null;
6525
- loadPrevPage = null;
6526
- loadNextPage = null;
6527
- list;
6528
- loading;
6529
- page;
6530
- totalPages;
6531
- FieldType = FieldType;
6532
- PaginationMode = PaginationMode;
6533
- type;
6534
- sort;
6535
- options = input.required(...(ngDevMode ? [{ debugName: "options" }] : []));
6536
- contentTpl = viewChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
6537
- constructor() {
6538
- effect(() => {
6539
- const options = this.options();
6540
- this._fields = options.fields ?? [];
6541
- this.provider = options.provider;
6542
- this.sort = options.sort ?? {};
6543
- this.cellPipe = options.cellPipe ?? null;
6544
- this.selectMode = options.select;
6545
- this.type = options.type;
6546
- this.initKeys();
6547
- this.initList(options);
6548
- this.initLoading();
6549
- const removeHandler = options.remove;
6550
- if (options.remove) {
6551
- if (removeHandler?.provider?.check) {
6552
- this.checkRemoveHandler = removeHandler.provider.check;
6553
- }
6554
- this.removeHandler = async (obj) => {
6555
- await this.alertService.show({
6556
- header: this.translateService.instant('OBJECT.confirmDelete'),
6557
- buttons: [
6558
- {
6559
- text: this.translateService.instant('cancel'),
6560
- role: 'cancel',
6561
- },
6562
- {
6563
- text: this.translateService.instant('confirm'),
6564
- handler: () => {
6565
- removeHandler?.provider?.invoke?.(obj.id);
6566
- },
6567
- },
6568
- ],
6569
- backdropDismiss: false,
6570
- });
6571
- };
6572
- }
6573
- if (options.item) {
6574
- const itemOptions = options.item.options;
6575
- if (!itemOptions)
6576
- throw Error('Must set edit options');
6577
- this.itemHandler = (id) => {
6578
- if (itemOptions?.routingPrefix) {
6579
- setTimeout(async () => {
6580
- await this.router.navigate([
6581
- itemOptions.routingPrefix.replace('//', '/'),
6582
- id,
6583
- ]);
6584
- this.cd.detectChanges();
6585
- });
6586
- }
6587
- else if (itemOptions?.select)
6588
- itemOptions.select(id);
6589
- };
6590
- }
6591
- const details = options.details;
6592
- if (options.details) {
6593
- if (!details?.provider)
6594
- throw Error('Must set details provider');
6595
- this.detailsComponent = DetailsPage;
6596
- this.detailsComponentProps = {
6597
- item: details?.provider.item,
6598
- type: options.type,
6599
- loading: details?.provider.loading,
6600
- itemHandler: this.itemHandler ?? null,
6601
- removeHandler: this.removeHandler,
6602
- componentFactories: details?.componentFactories,
6603
- };
6604
- this.select = details?.provider.getData;
6605
- this.unselect = details?.provider.clearData;
6606
- }
6607
- if (options.pagination) {
6608
- this.loadNextPage = async (event = null) => {
6609
- await options?.pagination?.loadNextPage?.();
6610
- if (event)
6611
- event.target.complete();
6612
- setTimeout(() => {
6613
- window.scrollTo(0, 0);
6614
- });
6615
- };
6616
- this.loadPrevPage = async (event = null) => {
6617
- await options?.pagination?.loadPrevPage?.();
6618
- if (event)
6619
- event.target.complete();
6620
- setTimeout(() => {
6621
- window.scrollTo(0, 10000);
6622
- });
6623
- };
6624
- this.page = options.pagination.page;
6625
- this.totalPages = options.pagination.totalPages;
6626
- }
6627
- this.afterInitOptions();
6628
- });
6629
- this.detailsButtonOptions = {
6630
- loading: this.loading,
6631
- click: () => {
6632
- this.unselect();
6633
- },
6634
- };
6635
- }
6636
- initKeys(data = null) {
6637
- const result = [];
6638
- this._fields
6639
- .filter((field) => {
6640
- if (field.options.list &&
6641
- field.options.list.permissions) {
6642
- return this.authService.expectPermissions(field.options.list?.permissions ?? null);
6643
- }
6644
- return true;
6645
- })
6646
- .forEach((field) => {
6647
- if (field.options.list.dynamic) {
6648
- if (!data?.length)
6649
- return;
6650
- data[0][field.key]
6651
- .map((_, index) => `__array.${field.key}.${index}.${field.options.list?.dynamic
6652
- ?.headerKey ?? ''}.${field.options.list?.dynamic?.rowKey ??
6653
- ''}`)
6654
- .forEach((item) => result.push(item));
6655
- return;
6656
- }
6657
- result.push(field.key);
6658
- });
6659
- if (!this.keys || this.keys.length !== result.length)
6660
- this.keys = result;
6661
- }
6662
- //The parameter is used in the inherited classes
6663
- initList(val) {
6664
- this.list = computed(() => {
6665
- const list = this.provider.list();
6666
- if (!list)
6667
- return list;
6668
- const result = list.filter((item) => !this.removed.has(item.id));
6669
- this.initKeys(list);
6670
- return result;
6671
- }, ...(ngDevMode ? [{ debugName: "list" }] : []));
6672
- }
6673
- initLoading() {
6674
- this.loading = this.provider.loading;
6675
- }
6676
- afterInitOptions() {
6677
- // No base functionality
6678
- }
6679
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
6680
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.1.0", type: ListBaseComponent, isStandalone: true, inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }], ngImport: i0 });
6681
- }
6682
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListBaseComponent, decorators: [{
6683
- type: Directive
6306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListBaseComponent, decorators: [{
6307
+ type: Directive
6684
6308
  }], ctorParameters: () => [] });
6685
6309
 
6686
6310
  class ListDesktopComponent extends ListBaseComponent {
@@ -6752,154 +6376,532 @@ class ListDesktopComponent extends ListBaseComponent {
6752
6376
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListDesktopComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6753
6377
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: ListDesktopComponent, isStandalone: true, selector: "smart-list-desktop", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #topTpl></div>\n\n<!--<ion-content>-->\n<div class=\"w-full overflow-y-auto\">\n <table\n cdk-table\n [dataSource]=\"list() ?? []\"\n [trackBy]=\"myTrackById\"\n class=\"w-full overflow-y-auto\"\n >\n @for (key of desktopKeys; track key) {\n @let last = $last;\n <ng-container class=\"col-sm text-left\">\n <div>\n @switch (key) {\n @case ('selectMulti') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef></th>\n <td cdk-cell>\n @let list = desktopList();\n @if (list) {\n <!-- <ion-checkbox-->\n <!-- style=\"margin-right: 15px\"-->\n <!-- (ionChange)=\"-->\n <!-- onChangeMultiselect(-->\n <!-- $event.detail.checked,-->\n <!-- element,-->\n <!-- list-->\n <!-- )-->\n <!-- \"-->\n <!-- ></ion-checkbox>-->\n }\n </td>\n }\n @case ('removeAction') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef>\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n @if (!checkRemoveHandler || checkRemoveHandler(element)) {\n <!-- <ion-button (click)=\"removeHandler?.(element)\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"trash\"></ion-icon>-->\n <!-- </ion-button>-->\n }\n </td>\n }\n @case ('detailsAction') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef>\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n <!-- <ion-button-->\n <!-- (click)=\"detailsButtonOptions.click()\"-->\n <!-- [smartDetails]=\"{-->\n <!-- component: detailsComponent,-->\n <!-- params: detailsComponentProps,-->\n <!-- mode: 'bottom',-->\n <!-- }\"-->\n <!-- (smartDetailsShowed)=\"select(element.id)\"-->\n <!-- >-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"ellipsis-vertical-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n </td>\n }\n @case ('itemAction') {\n <th cdk-header-cell class=\"w-5\">\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n <!-- <ion-button (click)=\"itemHandler?.(element.id)\">-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"arrow-forward-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n </td>\n }\n @default {\n <th cdk-header-cell>\n {{ (list() | smartListHeader: key : type)() }}\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <ng-container *matCellDef=\"let element\">\n @let cell = element | smartListCell: key : cellPipe : type;\n @if (cell) {\n <td\n cdk-cell\n [attr.smart-item-key]=\"key\"\n [style.width.px]=\"cell.type === FieldType.image ? 60 : null\"\n [style.textAlign]=\"\n cell.type === FieldType.image ? 'center' : null\n \"\n >\n @if (cell.type === FieldType.image) {\n <img\n height=\"50\"\n [lazyLoad]=\"cell.value | smartFileUrl\"\n alt=\"\"\n src=\"\"\n />\n } @else {\n <div\n class=\"min-h-8 pt-1.5\"\n [innerHTML]=\"cell.value\"\n ></div>\n }\n </td>\n } @else {\n <td cdk-cell></td>\n }\n </ng-container>\n }\n }\n </div>\n\n <ng-template #pagination>\n @if (last && loadNextPage && totalPages()) {\n <div style=\"float: right\">\n <!-- <ion-chip>-->\n {{ 'page' | translate }}:\n <b>{{ page() }}/{{ totalPages() }}</b>\n <!-- </ion-chip>-->\n </div>\n }\n </ng-template>\n </ng-container>\n }\n\n <tr cdk-header-row *matHeaderRowDef=\"desktopKeys ?? []; sticky: true\"></tr>\n <tr cdk-row *matRowDef=\"let row; columns: desktopKeys ?? []\"></tr>\n </table>\n</div>\n\n@if (\n loadNextPage &&\n Object.keys(list() ?? [])?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage($event)\">-->\n <!-- <ion-infinite-scroll-content-->\n <!-- loadingSpinner=\"circles\"-->\n <!-- ></ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n<!--</ion-content>-->\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n", styles: ["table .mat-row,table .mat-header-row{background:#fff;min-width:1200px}.wrapper{height:100%}.mat-row,.mat-header-row{min-width:1200px}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: LazyLoadImageModule }, { kind: "directive", type: i1$2.LazyLoadImageDirective, selector: "[lazyLoad]", inputs: ["lazyLoad", "defaultImage", "errorImage", "scrollTarget", "customObservable", "offset", "useSrcset", "decode", "debug"], outputs: ["onStateChange"] }, { kind: "component", type: PagingComponent, selector: "smart-paging", inputs: ["page", "totalPages"], outputs: ["nextPage", "prevPage"] }, { kind: "component", type: CdkTable, selector: "cdk-table, table[cdk-table]", inputs: ["trackBy", "dataSource", "multiTemplateDataRows", "fixedLayout"], outputs: ["contentChanged"], exportAs: ["cdkTable"] }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }, { kind: "component", type: CdkHeaderRow, selector: "cdk-header-row, tr[cdk-header-row]" }, { kind: "component", type: CdkRow, selector: "cdk-row, tr[cdk-row]" }, { kind: "pipe", type: ListHeaderPipe, name: "smartListHeader" }, { kind: "pipe", type: ListCellPipe, name: "smartListCell" }, { kind: "pipe", type: FileUrlPipe, name: "smartFileUrl" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
6754
6378
  }
6755
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListDesktopComponent, decorators: [{
6379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListDesktopComponent, decorators: [{
6380
+ type: Component,
6381
+ args: [{ selector: 'smart-list-desktop', imports: [
6382
+ NgTemplateOutlet,
6383
+ ListHeaderPipe,
6384
+ ListCellPipe,
6385
+ LazyLoadImageModule,
6386
+ FileUrlPipe,
6387
+ TranslatePipe,
6388
+ PagingComponent,
6389
+ CdkTable,
6390
+ CdkHeaderCell,
6391
+ CdkCell,
6392
+ CdkHeaderRow,
6393
+ CdkRow,
6394
+ ], template: "<div #topTpl></div>\n\n<!--<ion-content>-->\n<div class=\"w-full overflow-y-auto\">\n <table\n cdk-table\n [dataSource]=\"list() ?? []\"\n [trackBy]=\"myTrackById\"\n class=\"w-full overflow-y-auto\"\n >\n @for (key of desktopKeys; track key) {\n @let last = $last;\n <ng-container class=\"col-sm text-left\">\n <div>\n @switch (key) {\n @case ('selectMulti') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef></th>\n <td cdk-cell>\n @let list = desktopList();\n @if (list) {\n <!-- <ion-checkbox-->\n <!-- style=\"margin-right: 15px\"-->\n <!-- (ionChange)=\"-->\n <!-- onChangeMultiselect(-->\n <!-- $event.detail.checked,-->\n <!-- element,-->\n <!-- list-->\n <!-- )-->\n <!-- \"-->\n <!-- ></ion-checkbox>-->\n }\n </td>\n }\n @case ('removeAction') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef>\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n @if (!checkRemoveHandler || checkRemoveHandler(element)) {\n <!-- <ion-button (click)=\"removeHandler?.(element)\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"trash\"></ion-icon>-->\n <!-- </ion-button>-->\n }\n </td>\n }\n @case ('detailsAction') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef>\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n <!-- <ion-button-->\n <!-- (click)=\"detailsButtonOptions.click()\"-->\n <!-- [smartDetails]=\"{-->\n <!-- component: detailsComponent,-->\n <!-- params: detailsComponentProps,-->\n <!-- mode: 'bottom',-->\n <!-- }\"-->\n <!-- (smartDetailsShowed)=\"select(element.id)\"-->\n <!-- >-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"ellipsis-vertical-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n </td>\n }\n @case ('itemAction') {\n <th cdk-header-cell class=\"w-5\">\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n <!-- <ion-button (click)=\"itemHandler?.(element.id)\">-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"arrow-forward-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n </td>\n }\n @default {\n <th cdk-header-cell>\n {{ (list() | smartListHeader: key : type)() }}\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <ng-container *matCellDef=\"let element\">\n @let cell = element | smartListCell: key : cellPipe : type;\n @if (cell) {\n <td\n cdk-cell\n [attr.smart-item-key]=\"key\"\n [style.width.px]=\"cell.type === FieldType.image ? 60 : null\"\n [style.textAlign]=\"\n cell.type === FieldType.image ? 'center' : null\n \"\n >\n @if (cell.type === FieldType.image) {\n <img\n height=\"50\"\n [lazyLoad]=\"cell.value | smartFileUrl\"\n alt=\"\"\n src=\"\"\n />\n } @else {\n <div\n class=\"min-h-8 pt-1.5\"\n [innerHTML]=\"cell.value\"\n ></div>\n }\n </td>\n } @else {\n <td cdk-cell></td>\n }\n </ng-container>\n }\n }\n </div>\n\n <ng-template #pagination>\n @if (last && loadNextPage && totalPages()) {\n <div style=\"float: right\">\n <!-- <ion-chip>-->\n {{ 'page' | translate }}:\n <b>{{ page() }}/{{ totalPages() }}</b>\n <!-- </ion-chip>-->\n </div>\n }\n </ng-template>\n </ng-container>\n }\n\n <tr cdk-header-row *matHeaderRowDef=\"desktopKeys ?? []; sticky: true\"></tr>\n <tr cdk-row *matRowDef=\"let row; columns: desktopKeys ?? []\"></tr>\n </table>\n</div>\n\n@if (\n loadNextPage &&\n Object.keys(list() ?? [])?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage($event)\">-->\n <!-- <ion-infinite-scroll-content-->\n <!-- loadingSpinner=\"circles\"-->\n <!-- ></ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n<!--</ion-content>-->\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n", styles: ["table .mat-row,table .mat-header-row{background:#fff;min-width:1200px}.wrapper{height:100%}.mat-row,.mat-header-row{min-width:1200px}\n"] }]
6395
+ }] });
6396
+
6397
+ class ListMasonryGridComponent extends ListBaseComponent {
6398
+ componentFactories = null;
6399
+ listWithImages;
6400
+ topTpl = viewChild('topTpl', ...(ngDevMode ? [{ debugName: "topTpl" }] : []));
6401
+ ngAfterViewInit() {
6402
+ this.generateDynamicComponents();
6403
+ }
6404
+ afterInitOptions() {
6405
+ const fieldOptions = getModelFieldsWithOptions(new this.type());
6406
+ const imageFieldOptions = fieldOptions.find((item) => item.options.type === FieldType.image);
6407
+ this.listWithImages = computed(() => {
6408
+ const list = this.list();
6409
+ if (!list)
6410
+ return null;
6411
+ return list.map((item) => {
6412
+ return {
6413
+ data: item,
6414
+ image: item[imageFieldOptions?.key ?? ''],
6415
+ };
6416
+ });
6417
+ }, ...(ngDevMode ? [{ debugName: "listWithImages" }] : []));
6418
+ }
6419
+ initList(val) {
6420
+ super.initList(val);
6421
+ this.componentFactories = val?.componentFactories ?? null;
6422
+ this.generateDynamicComponents();
6423
+ }
6424
+ generateDynamicComponents() {
6425
+ if (!this.componentFactories)
6426
+ return;
6427
+ if (this.componentFactories.top && this.topTpl()) {
6428
+ if (!this.topTpl()?.get(0)) {
6429
+ this.topTpl()?.createComponent(this.componentFactories.top);
6430
+ }
6431
+ }
6432
+ }
6433
+ Object = Object;
6434
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMasonryGridComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6435
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: ListMasonryGridComponent, isStandalone: true, selector: "smart-list-masonry-grid", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #topTpl></div>\n\n<div class=\"ion-padding\">\n <div class=\"gap-3\">\n @for (item of listWithImages(); track item) {\n <!-- <ion-card class=\"w-full my-2.5 break-inside-avoid border border-gray-100\" (click)=\"unselect?.()\">-->\n @if (item.image) {\n <img [ngSrc]=\"item.image | smartFileUrl\" alt=\"\" fill />\n }\n\n <!-- <ion-card-content class=\"overflow-hidden after:block after:w-full after:bg-gradient-to-r after:from-transparent after:to-white after:absolute after:bottom-0\">-->\n @for (key of keys; track key) {\n @let cell = item.data | smartListCell: key : cellPipe : type;\n @if (cell && cell.value != item.image) {\n @if ($index < 2) {\n <h3\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-800\"\n [innerHTML]=\"cell.value\"\n ></h3>\n } @else {\n <p\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-500\"\n [innerHTML]=\"cell.value\"\n ></p>\n }\n }\n }\n <!-- </ion-card-content>-->\n\n <!-- <ion-row>-->\n @if (removeHandler) {\n <!-- <ion-col size=\"auto\">-->\n @if (!checkRemoveHandler || checkRemoveHandler(item.data)) {\n <!-- <ion-button (click)=\"removeHandler?.(item.data)\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"trash\"></ion-icon>-->\n <!-- </ion-button>-->\n }\n <!-- </ion-col>-->\n }\n <!-- <ion-col></ion-col>-->\n @if (itemHandler) {\n <!-- <ion-col size=\"auto\">-->\n <!-- <ion-button (click)=\"itemHandler?.(item.data.id)\">-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"arrow-forward-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-col>-->\n }\n <!-- </ion-row>-->\n <!-- </ion-card>-->\n }\n </div>\n</div>\n\n@if (\n loadNextPage &&\n Object.keys(list() ?? [])?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content loadingSpinner=\"circles\">-->\n <!-- </ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n", dependencies: [{ kind: "component", type: PagingComponent, selector: "smart-paging", inputs: ["page", "totalPages"], outputs: ["nextPage", "prevPage"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "pipe", type: FileUrlPipe, name: "smartFileUrl" }, { kind: "pipe", type: ListCellPipe, name: "smartListCell" }] });
6436
+ }
6437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMasonryGridComponent, decorators: [{
6438
+ type: Component,
6439
+ args: [{ selector: 'smart-list-masonry-grid', imports: [PagingComponent, FileUrlPipe, NgOptimizedImage, ListCellPipe], template: "<div #topTpl></div>\n\n<div class=\"ion-padding\">\n <div class=\"gap-3\">\n @for (item of listWithImages(); track item) {\n <!-- <ion-card class=\"w-full my-2.5 break-inside-avoid border border-gray-100\" (click)=\"unselect?.()\">-->\n @if (item.image) {\n <img [ngSrc]=\"item.image | smartFileUrl\" alt=\"\" fill />\n }\n\n <!-- <ion-card-content class=\"overflow-hidden after:block after:w-full after:bg-gradient-to-r after:from-transparent after:to-white after:absolute after:bottom-0\">-->\n @for (key of keys; track key) {\n @let cell = item.data | smartListCell: key : cellPipe : type;\n @if (cell && cell.value != item.image) {\n @if ($index < 2) {\n <h3\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-800\"\n [innerHTML]=\"cell.value\"\n ></h3>\n } @else {\n <p\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-500\"\n [innerHTML]=\"cell.value\"\n ></p>\n }\n }\n }\n <!-- </ion-card-content>-->\n\n <!-- <ion-row>-->\n @if (removeHandler) {\n <!-- <ion-col size=\"auto\">-->\n @if (!checkRemoveHandler || checkRemoveHandler(item.data)) {\n <!-- <ion-button (click)=\"removeHandler?.(item.data)\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"trash\"></ion-icon>-->\n <!-- </ion-button>-->\n }\n <!-- </ion-col>-->\n }\n <!-- <ion-col></ion-col>-->\n @if (itemHandler) {\n <!-- <ion-col size=\"auto\">-->\n <!-- <ion-button (click)=\"itemHandler?.(item.data.id)\">-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"arrow-forward-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-col>-->\n }\n <!-- </ion-row>-->\n <!-- </ion-card>-->\n }\n </div>\n</div>\n\n@if (\n loadNextPage &&\n Object.keys(list() ?? [])?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content loadingSpinner=\"circles\">-->\n <!-- </ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n" }]
6440
+ }] });
6441
+
6442
+ class ListMobileComponent extends ListBaseComponent {
6443
+ listMobile = this.list;
6444
+ componentFactories = null;
6445
+ topTpl = viewChild('topTpl', ...(ngDevMode ? [{ debugName: "topTpl" }] : []));
6446
+ initList(val) {
6447
+ super.initList(val);
6448
+ this.componentFactories = val.componentFactories ?? null;
6449
+ this.generateDynamicComponents();
6450
+ }
6451
+ ngAfterViewInit() {
6452
+ this.generateDynamicComponents();
6453
+ }
6454
+ generateDynamicComponents() {
6455
+ if (!this.componentFactories)
6456
+ return;
6457
+ if (this.componentFactories.top && this.topTpl()) {
6458
+ if (!this.topTpl()?.get(0)) {
6459
+ this.topTpl()?.createComponent(this.componentFactories.top);
6460
+ }
6461
+ }
6462
+ }
6463
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMobileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6464
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: ListMobileComponent, isStandalone: true, selector: "smart-list-mobile", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #topTpl></div>\n\n@let list = listMobile();\n@if (list) {\n <!-- <ion-list>-->\n @for (item of list; track item.id) {\n <!-- <ion-item-sliding>-->\n @if (removeHandler && (!checkRemoveHandler || checkRemoveHandler(item))) {\n <!-- <ion-item-options side=\"start\" (ionSwipe)=\"removeHandler?.(item)\">-->\n <!-- <ion-item-option-->\n <!-- color=\"danger\"-->\n <!-- expandable-->\n <!-- (click)=\"removeHandler?.(item)\"-->\n <!-- >-->\n {{ 'delete' | translate }}\n <!-- </ion-item-option>-->\n <!-- </ion-item-options>-->\n }\n\n <!-- <ion-item class=\"pl-5\" (click)=\"itemHandler ? itemHandler(item.id) : unselect()\">-->\n <!-- <ion-label>-->\n @for (key of keys; track key) {\n @let cell = item | smartListCell: key : cellPipe : type;\n @if (cell) {\n @if (cell.type === FieldType.image) {\n <img\n [attr.smart-item-key]=\"key\"\n height=\"100\"\n [lazyLoad]=\"cell.value | smartFileUrl\"\n alt=\"\"\n src=\"\"\n />\n } @else if ($first) {\n <h2 [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></h2>\n } @else {\n <p [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></p>\n }\n }\n }\n <!-- </ion-label>-->\n <!-- </ion-item>-->\n <!-- </ion-item-sliding>-->\n }\n <!-- </ion-list>-->\n}\n\n@if (\n loadNextPage &&\n list?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content-->\n <!-- loadingSpinner=\"circles\"-->\n <!-- ></ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n", dependencies: [{ kind: "ngmodule", type: LazyLoadImageModule }, { kind: "directive", type: i1$2.LazyLoadImageDirective, selector: "[lazyLoad]", inputs: ["lazyLoad", "defaultImage", "errorImage", "scrollTarget", "customObservable", "offset", "useSrcset", "decode", "debug"], outputs: ["onStateChange"] }, { kind: "component", type: PagingComponent, selector: "smart-paging", inputs: ["page", "totalPages"], outputs: ["nextPage", "prevPage"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "pipe", type: FileUrlPipe, name: "smartFileUrl" }, { kind: "pipe", type: ListCellPipe, name: "smartListCell" }] });
6465
+ }
6466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMobileComponent, decorators: [{
6467
+ type: Component,
6468
+ args: [{ selector: 'smart-list-mobile', imports: [
6469
+ TranslatePipe,
6470
+ FileUrlPipe,
6471
+ LazyLoadImageModule,
6472
+ PagingComponent,
6473
+ ListCellPipe,
6474
+ ], template: "<div #topTpl></div>\n\n@let list = listMobile();\n@if (list) {\n <!-- <ion-list>-->\n @for (item of list; track item.id) {\n <!-- <ion-item-sliding>-->\n @if (removeHandler && (!checkRemoveHandler || checkRemoveHandler(item))) {\n <!-- <ion-item-options side=\"start\" (ionSwipe)=\"removeHandler?.(item)\">-->\n <!-- <ion-item-option-->\n <!-- color=\"danger\"-->\n <!-- expandable-->\n <!-- (click)=\"removeHandler?.(item)\"-->\n <!-- >-->\n {{ 'delete' | translate }}\n <!-- </ion-item-option>-->\n <!-- </ion-item-options>-->\n }\n\n <!-- <ion-item class=\"pl-5\" (click)=\"itemHandler ? itemHandler(item.id) : unselect()\">-->\n <!-- <ion-label>-->\n @for (key of keys; track key) {\n @let cell = item | smartListCell: key : cellPipe : type;\n @if (cell) {\n @if (cell.type === FieldType.image) {\n <img\n [attr.smart-item-key]=\"key\"\n height=\"100\"\n [lazyLoad]=\"cell.value | smartFileUrl\"\n alt=\"\"\n src=\"\"\n />\n } @else if ($first) {\n <h2 [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></h2>\n } @else {\n <p [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></p>\n }\n }\n }\n <!-- </ion-label>-->\n <!-- </ion-item>-->\n <!-- </ion-item-sliding>-->\n }\n <!-- </ion-list>-->\n}\n\n@if (\n loadNextPage &&\n list?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content-->\n <!-- loadingSpinner=\"circles\"-->\n <!-- ></ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n" }]
6475
+ }] });
6476
+
6477
+ class ListComponent extends CreateDynamicComponent('list') {
6478
+ _options;
6479
+ hardwareService = inject(HardwareService);
6480
+ mode = signal(ListMode.desktop, ...(ngDevMode ? [{ debugName: "mode" }] : []));
6481
+ ListMode = ListMode;
6482
+ options = input.required(...(ngDevMode ? [{ debugName: "options" }] : []));
6483
+ get internalOptions() {
6484
+ return this._options();
6485
+ }
6486
+ contentTpl = viewChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
6487
+ dynamicContents = viewChildren(DynamicContentDirective, ...(ngDevMode ? [{ debugName: "dynamicContents" }] : []));
6488
+ constructor() {
6489
+ super();
6490
+ effect(() => {
6491
+ this._options.set(this.options());
6492
+ this.initFields();
6493
+ this.initModel();
6494
+ this.refreshDynamicInstance();
6495
+ });
6496
+ }
6497
+ refreshProperties() {
6498
+ this.baseComponentRef.setInput('options', this._options());
6499
+ }
6500
+ initFields() {
6501
+ this._options.update((options) => {
6502
+ return {
6503
+ ...options,
6504
+ fields: _.sortBy(getModelFieldsWithOptions(new (this._options().type)()).filter((item) => item?.options?.list), (item) => (item?.options?.list).order),
6505
+ };
6506
+ });
6507
+ }
6508
+ initModel() {
6509
+ this.mode = computed(() => this._options()?.mode ??
6510
+ (this.hardwareService.isMobile ? ListMode.mobile : ListMode.desktop), ...(ngDevMode ? [{ debugName: "mode" }] : []));
6511
+ }
6512
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6513
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: ListComponent, isStandalone: true, selector: "smart-list", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (template() === 'default') {\n @switch (mode()) {\n @case (ListMode.desktop) {\n <smart-list-desktop [options]=\"internalOptions\"></smart-list-desktop>\n }\n @case (ListMode.mobile) {\n <smart-list-mobile [options]=\"internalOptions\"></smart-list-mobile>\n }\n @case (ListMode.masonryGrid) {\n <smart-list-masonry-grid\n [options]=\"internalOptions\"\n ></smart-list-masonry-grid>\n }\n }\n\n <!-- <ion-row>-->\n <!-- <ion-col></ion-col>-->\n <!-- <ion-col size=\"auto\">-->\n @let loading = internalOptions?.provider?.loading();\n <smart-loader [show]=\"loading ?? false\"></smart-loader>\n @if (!loading && !internalOptions.provider.list()?.length) {\n <h2>\n <br />\n {{ 'noResults' | translate }}\n </h2>\n }\n <!-- </ion-col>-->\n <!-- <ion-col></ion-col>-->\n <!-- </ion-row>-->\n\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n}\n\n<ng-template #contentTpl>\n <ng-content></ng-content>\n</ng-template>\n<div class=\"dynamic-content\"></div>\n", dependencies: [{ kind: "component", type: ListDesktopComponent, selector: "smart-list-desktop" }, { kind: "component", type: ListMobileComponent, selector: "smart-list-mobile" }, { kind: "component", type: ListMasonryGridComponent, selector: "smart-list-masonry-grid" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LoaderComponent, selector: "smart-loader", inputs: ["show", "height"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
6514
+ }
6515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListComponent, decorators: [{
6756
6516
  type: Component,
6757
- args: [{ selector: 'smart-list-desktop', imports: [
6758
- NgTemplateOutlet,
6759
- ListHeaderPipe,
6760
- ListCellPipe,
6761
- LazyLoadImageModule,
6762
- FileUrlPipe,
6517
+ args: [{ selector: 'smart-list', encapsulation: ViewEncapsulation.None, imports: [
6518
+ ListDesktopComponent,
6519
+ ListMobileComponent,
6520
+ ListMasonryGridComponent,
6763
6521
  TranslatePipe,
6764
- PagingComponent,
6765
- CdkTable,
6766
- CdkHeaderCell,
6767
- CdkCell,
6768
- CdkHeaderRow,
6769
- CdkRow,
6770
- ], template: "<div #topTpl></div>\n\n<!--<ion-content>-->\n<div class=\"w-full overflow-y-auto\">\n <table\n cdk-table\n [dataSource]=\"list() ?? []\"\n [trackBy]=\"myTrackById\"\n class=\"w-full overflow-y-auto\"\n >\n @for (key of desktopKeys; track key) {\n @let last = $last;\n <ng-container class=\"col-sm text-left\">\n <div>\n @switch (key) {\n @case ('selectMulti') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef></th>\n <td cdk-cell>\n @let list = desktopList();\n @if (list) {\n <!-- <ion-checkbox-->\n <!-- style=\"margin-right: 15px\"-->\n <!-- (ionChange)=\"-->\n <!-- onChangeMultiselect(-->\n <!-- $event.detail.checked,-->\n <!-- element,-->\n <!-- list-->\n <!-- )-->\n <!-- \"-->\n <!-- ></ion-checkbox>-->\n }\n </td>\n }\n @case ('removeAction') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef>\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n @if (!checkRemoveHandler || checkRemoveHandler(element)) {\n <!-- <ion-button (click)=\"removeHandler?.(element)\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"trash\"></ion-icon>-->\n <!-- </ion-button>-->\n }\n </td>\n }\n @case ('detailsAction') {\n <th cdk-header-cell class=\"w-5\" *matHeaderCellDef>\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n <!-- <ion-button-->\n <!-- (click)=\"detailsButtonOptions.click()\"-->\n <!-- [smartDetails]=\"{-->\n <!-- component: detailsComponent,-->\n <!-- params: detailsComponentProps,-->\n <!-- mode: 'bottom',-->\n <!-- }\"-->\n <!-- (smartDetailsShowed)=\"select(element.id)\"-->\n <!-- >-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"ellipsis-vertical-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n </td>\n }\n @case ('itemAction') {\n <th cdk-header-cell class=\"w-5\">\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <td cdk-cell *matCellDef=\"let element\">\n <!-- <ion-button (click)=\"itemHandler?.(element.id)\">-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"arrow-forward-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n </td>\n }\n @default {\n <th cdk-header-cell>\n {{ (list() | smartListHeader: key : type)() }}\n <ng-container *ngTemplateOutlet=\"pagination\"></ng-container>\n </th>\n <ng-container *matCellDef=\"let element\">\n @let cell = element | smartListCell: key : cellPipe : type;\n @if (cell) {\n <td\n cdk-cell\n [attr.smart-item-key]=\"key\"\n [style.width.px]=\"cell.type === FieldType.image ? 60 : null\"\n [style.textAlign]=\"\n cell.type === FieldType.image ? 'center' : null\n \"\n >\n @if (cell.type === FieldType.image) {\n <img\n height=\"50\"\n [lazyLoad]=\"cell.value | smartFileUrl\"\n alt=\"\"\n src=\"\"\n />\n } @else {\n <div\n class=\"min-h-8 pt-1.5\"\n [innerHTML]=\"cell.value\"\n ></div>\n }\n </td>\n } @else {\n <td cdk-cell></td>\n }\n </ng-container>\n }\n }\n </div>\n\n <ng-template #pagination>\n @if (last && loadNextPage && totalPages()) {\n <div style=\"float: right\">\n <!-- <ion-chip>-->\n {{ 'page' | translate }}:\n <b>{{ page() }}/{{ totalPages() }}</b>\n <!-- </ion-chip>-->\n </div>\n }\n </ng-template>\n </ng-container>\n }\n\n <tr cdk-header-row *matHeaderRowDef=\"desktopKeys ?? []; sticky: true\"></tr>\n <tr cdk-row *matRowDef=\"let row; columns: desktopKeys ?? []\"></tr>\n </table>\n</div>\n\n@if (\n loadNextPage &&\n Object.keys(list() ?? [])?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage($event)\">-->\n <!-- <ion-infinite-scroll-content-->\n <!-- loadingSpinner=\"circles\"-->\n <!-- ></ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n<!--</ion-content>-->\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n", styles: ["table .mat-row,table .mat-header-row{background:#fff;min-width:1200px}.wrapper{height:100%}.mat-row,.mat-header-row{min-width:1200px}\n"] }]
6771
- }] });
6522
+ NgTemplateOutlet,
6523
+ LoaderComponent,
6524
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (template() === 'default') {\n @switch (mode()) {\n @case (ListMode.desktop) {\n <smart-list-desktop [options]=\"internalOptions\"></smart-list-desktop>\n }\n @case (ListMode.mobile) {\n <smart-list-mobile [options]=\"internalOptions\"></smart-list-mobile>\n }\n @case (ListMode.masonryGrid) {\n <smart-list-masonry-grid\n [options]=\"internalOptions\"\n ></smart-list-masonry-grid>\n }\n }\n\n <!-- <ion-row>-->\n <!-- <ion-col></ion-col>-->\n <!-- <ion-col size=\"auto\">-->\n @let loading = internalOptions?.provider?.loading();\n <smart-loader [show]=\"loading ?? false\"></smart-loader>\n @if (!loading && !internalOptions.provider.list()?.length) {\n <h2>\n <br />\n {{ 'noResults' | translate }}\n </h2>\n }\n <!-- </ion-col>-->\n <!-- <ion-col></ion-col>-->\n <!-- </ion-row>-->\n\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n}\n\n<ng-template #contentTpl>\n <ng-content></ng-content>\n</ng-template>\n<div class=\"dynamic-content\"></div>\n" }]
6525
+ }], ctorParameters: () => [] });
6772
6526
 
6773
- class ListMasonryGridComponent extends ListBaseComponent {
6774
- componentFactories = null;
6775
- listWithImages;
6776
- topTpl = viewChild('topTpl', ...(ngDevMode ? [{ debugName: "topTpl" }] : []));
6777
- ngAfterViewInit() {
6778
- this.generateDynamicComponents();
6527
+ class DetailsPage {
6528
+ modalService = inject(ModalService);
6529
+ styleService = inject(StyleService);
6530
+ elementRef = inject(ElementRef);
6531
+ // navParams: NavParams, //TODO: to be injected
6532
+ pageOptions = signal({
6533
+ title: 'details',
6534
+ hideMenuButton: true,
6535
+ }, ...(ngDevMode ? [{ debugName: "pageOptions" }] : []));
6536
+ detailsOptions;
6537
+ constructor() {
6538
+ this.detailsOptions = /*navParams.get('value')*/ {};
6539
+ this.initTitle();
6540
+ this.initButtons();
6779
6541
  }
6780
- afterInitOptions() {
6781
- const fieldOptions = getModelFieldsWithOptions(new this.type());
6782
- const imageFieldOptions = fieldOptions.find((item) => item.options.type === FieldType.image);
6783
- this.listWithImages = computed(() => {
6784
- const list = this.list();
6785
- if (!list)
6786
- return null;
6787
- return list.map((item) => {
6542
+ ngOnInit() {
6543
+ this.styleService.init(this.elementRef);
6544
+ }
6545
+ initTitle() {
6546
+ this.pageOptions.update((options) => {
6547
+ if (this.detailsOptions.title) {
6788
6548
  return {
6789
- data: item,
6790
- image: item[imageFieldOptions?.key ?? ''],
6549
+ ...options,
6550
+ title: this.detailsOptions.title,
6791
6551
  };
6792
- });
6793
- }, ...(ngDevMode ? [{ debugName: "listWithImages" }] : []));
6794
- }
6795
- initList(val) {
6796
- super.initList(val);
6797
- this.componentFactories = val?.componentFactories ?? null;
6798
- this.generateDynamicComponents();
6799
- }
6800
- generateDynamicComponents() {
6801
- if (!this.componentFactories)
6802
- return;
6803
- if (this.componentFactories.top && this.topTpl()) {
6804
- if (!this.topTpl()?.get(0)) {
6805
- this.topTpl()?.createComponent(this.componentFactories.top);
6806
6552
  }
6553
+ return options;
6554
+ });
6555
+ }
6556
+ initButtons() {
6557
+ const buttons = [];
6558
+ if (this.detailsOptions.removeHandler) {
6559
+ buttons.push({
6560
+ handler: () => {
6561
+ computed(() => {
6562
+ const item = this.detailsOptions.item();
6563
+ this.detailsOptions?.removeHandler?.(item);
6564
+ this.modalService.dismiss();
6565
+ });
6566
+ },
6567
+ icon: 'trash',
6568
+ });
6807
6569
  }
6570
+ if (this.detailsOptions.itemHandler) {
6571
+ buttons.push({
6572
+ handler: () => {
6573
+ computed(() => {
6574
+ const item = this.detailsOptions.item();
6575
+ this.detailsOptions?.removeHandler?.(item);
6576
+ this.modalService.dismiss();
6577
+ });
6578
+ },
6579
+ icon: 'arrow-forward-outline',
6580
+ });
6581
+ }
6582
+ this.pageOptions.update((options) => ({ ...options, endButtons: buttons }));
6808
6583
  }
6809
- Object = Object;
6810
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMasonryGridComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6811
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: ListMasonryGridComponent, isStandalone: true, selector: "smart-list-masonry-grid", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #topTpl></div>\n\n<div class=\"ion-padding\">\n <div class=\"gap-3\">\n @for (item of listWithImages(); track item) {\n <!-- <ion-card class=\"w-full my-2.5 break-inside-avoid border border-gray-100\" (click)=\"unselect?.()\">-->\n @if (item.image) {\n <img [ngSrc]=\"item.image | smartFileUrl\" alt=\"\" fill />\n }\n\n <!-- <ion-card-content class=\"overflow-hidden after:block after:w-full after:bg-gradient-to-r after:from-transparent after:to-white after:absolute after:bottom-0\">-->\n @for (key of keys; track key) {\n @let cell = item.data | smartListCell: key : cellPipe : type;\n @if (cell && cell.value != item.image) {\n @if ($index < 2) {\n <h3\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-800\"\n [innerHTML]=\"cell.value\"\n ></h3>\n } @else {\n <p\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-500\"\n [innerHTML]=\"cell.value\"\n ></p>\n }\n }\n }\n <!-- </ion-card-content>-->\n\n <!-- <ion-row>-->\n @if (removeHandler) {\n <!-- <ion-col size=\"auto\">-->\n @if (!checkRemoveHandler || checkRemoveHandler(item.data)) {\n <!-- <ion-button (click)=\"removeHandler?.(item.data)\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"trash\"></ion-icon>-->\n <!-- </ion-button>-->\n }\n <!-- </ion-col>-->\n }\n <!-- <ion-col></ion-col>-->\n @if (itemHandler) {\n <!-- <ion-col size=\"auto\">-->\n <!-- <ion-button (click)=\"itemHandler?.(item.data.id)\">-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"arrow-forward-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-col>-->\n }\n <!-- </ion-row>-->\n <!-- </ion-card>-->\n }\n </div>\n</div>\n\n@if (\n loadNextPage &&\n Object.keys(list() ?? [])?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content loadingSpinner=\"circles\">-->\n <!-- </ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n", dependencies: [{ kind: "component", type: PagingComponent, selector: "smart-paging", inputs: ["page", "totalPages"], outputs: ["nextPage", "prevPage"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "pipe", type: FileUrlPipe, name: "smartFileUrl" }, { kind: "pipe", type: ListCellPipe, name: "smartListCell" }] });
6584
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: DetailsPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
6585
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.0", type: DetailsPage, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<smart-page [options]=\"pageOptions()\">\n <smart-details #smartDetails [options]=\"detailsOptions\"></smart-details>\n</smart-page>\n", styles: [":host{width:100%}\n"], dependencies: [{ kind: "component", type: PageComponent, selector: "smart-page", inputs: ["options"] }, { kind: "component", type: DetailsComponent, selector: "smart-details", inputs: ["options"] }] });
6586
+ }
6587
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: DetailsPage, decorators: [{
6588
+ type: Component,
6589
+ args: [{ imports: [PageComponent, DetailsComponent], template: "<smart-page [options]=\"pageOptions()\">\n <smart-details #smartDetails [options]=\"detailsOptions\"></smart-details>\n</smart-page>\n", styles: [":host{width:100%}\n"] }]
6590
+ }], ctorParameters: () => [] });
6591
+
6592
+ const ACCORDION_COMPONENTS = [
6593
+ AccordionComponent,
6594
+ AccordionHeaderComponent,
6595
+ AccordionBodyComponent,
6596
+ ];
6597
+ const BUTTON_COMPONENTS = [ButtonComponent, ButtonStandardComponent];
6598
+ const CARD_COMPONENTS = [CardComponent];
6599
+ const DETAILS_COMPONENTS = [DetailsComponent, DetailsStandardComponent];
6600
+ const DETAIL_COMPONENTS = [
6601
+ DetailComponent,
6602
+ DetailTextComponent,
6603
+ DetailFlagComponent,
6604
+ DetailEnumComponent,
6605
+ DetailEmailComponent,
6606
+ DetailAddressComponent,
6607
+ DetailObjectComponent,
6608
+ DetailColorComponent,
6609
+ DetailLogoComponent,
6610
+ DetailArrayComponent,
6611
+ DetailPdfComponent,
6612
+ DetailVideoComponent,
6613
+ DetailAttachmentComponent,
6614
+ DetailDateRangeComponent,
6615
+ DetailImageComponent,
6616
+ DetailPhoneNumberPlComponent,
6617
+ ];
6618
+ const FORM_COMPONENTS = [
6619
+ FormStandardComponent,
6620
+ FormComponent,
6621
+ ];
6622
+ const INPUT_COMPONENTS = [
6623
+ InputComponent,
6624
+ InputIntComponent,
6625
+ InputErrorComponent,
6626
+ InputTextComponent,
6627
+ InputPasswordComponent,
6628
+ InputFlagComponent,
6629
+ InputEnumComponent,
6630
+ InputEmailComponent,
6631
+ InputCurrencyComponent,
6632
+ InputDateComponent,
6633
+ InputDateWithEditComponent,
6634
+ InputFileComponent,
6635
+ InputRadioComponent,
6636
+ InputNipComponent,
6637
+ InputStringsComponent,
6638
+ InputLongTextComponent,
6639
+ InputAddressComponent,
6640
+ InputObjectComponent,
6641
+ InputColorComponent,
6642
+ InputLogoComponent,
6643
+ InputCheckComponent,
6644
+ InputIntsComponent,
6645
+ InputPhoneNumberComponent,
6646
+ InputPhoneNumberPlComponent,
6647
+ InputPeselComponent,
6648
+ InputArrayComponent,
6649
+ InputPdfComponent,
6650
+ InputVideoComponent,
6651
+ InputAttachmentComponent,
6652
+ InputDateRangeComponent,
6653
+ InputImageComponent,
6654
+ InputFloatComponent,
6655
+ ];
6656
+ const LIST_COMPONENTS = [
6657
+ ListComponent,
6658
+ ListMobileComponent,
6659
+ ListDesktopComponent,
6660
+ ListMasonryGridComponent,
6661
+ ];
6662
+ const LOADER_COMPONENTS = [LoaderComponent];
6663
+ const PAGE_COMPONENTS = [PageStandardComponent, PageComponent];
6664
+ const INFO_COMPONENTS = [InfoComponent, InfoModalComponent];
6665
+ const DATE_RANGE_COMPONENTS = [
6666
+ DateRangeComponent,
6667
+ DateRangeModalComponent,
6668
+ ];
6669
+ const DATE_EDIT_COMPONENTS = [DateEditComponent];
6670
+ const DYNAMIC_COMPONENTS = [DynamicComponent];
6671
+ const COMPONENTS$1 = [
6672
+ ...FORM_COMPONENTS,
6673
+ ...INPUT_COMPONENTS,
6674
+ ...PAGE_COMPONENTS,
6675
+ ...ACCORDION_COMPONENTS,
6676
+ ...DATE_RANGE_COMPONENTS,
6677
+ ...DATE_EDIT_COMPONENTS,
6678
+ ...BUTTON_COMPONENTS,
6679
+ ...CARD_COMPONENTS,
6680
+ ...LIST_COMPONENTS,
6681
+ ...LOADER_COMPONENTS,
6682
+ ...DETAIL_COMPONENTS,
6683
+ ...DETAILS_COMPONENTS,
6684
+ ...DYNAMIC_COMPONENTS,
6685
+ ...INFO_COMPONENTS,
6686
+ ExportComponent,
6687
+ ImportComponent,
6688
+ PasswordStrengthComponent,
6689
+ ];
6690
+ const IMPORTS = [
6691
+ CommonModule,
6692
+ ReactiveFormsModule,
6693
+ FormsModule,
6694
+ TranslateModule,
6695
+ RouterModule,
6696
+ SharedPipesModule,
6697
+ SharedDirectivesModule,
6698
+ HttpClientModule,
6699
+ LazyLoadImageModule,
6700
+ DragDropModule,
6701
+ CdkTableModule,
6702
+ DynamicModule,
6703
+ ];
6704
+ class SharedComponentsModule {
6705
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6706
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, imports: [CommonModule,
6707
+ ReactiveFormsModule,
6708
+ FormsModule,
6709
+ TranslateModule,
6710
+ RouterModule,
6711
+ SharedPipesModule,
6712
+ SharedDirectivesModule,
6713
+ HttpClientModule,
6714
+ LazyLoadImageModule,
6715
+ DragDropModule,
6716
+ CdkTableModule,
6717
+ DynamicModule, FormStandardComponent,
6718
+ FormComponent, InputComponent,
6719
+ InputIntComponent,
6720
+ InputErrorComponent,
6721
+ InputTextComponent,
6722
+ InputPasswordComponent,
6723
+ InputFlagComponent,
6724
+ InputEnumComponent,
6725
+ InputEmailComponent,
6726
+ InputCurrencyComponent,
6727
+ InputDateComponent,
6728
+ InputDateWithEditComponent,
6729
+ InputFileComponent,
6730
+ InputRadioComponent,
6731
+ InputNipComponent,
6732
+ InputStringsComponent,
6733
+ InputLongTextComponent,
6734
+ InputAddressComponent,
6735
+ InputObjectComponent,
6736
+ InputColorComponent,
6737
+ InputLogoComponent,
6738
+ InputCheckComponent,
6739
+ InputIntsComponent,
6740
+ InputPhoneNumberComponent,
6741
+ InputPhoneNumberPlComponent,
6742
+ InputPeselComponent,
6743
+ InputArrayComponent,
6744
+ InputPdfComponent,
6745
+ InputVideoComponent,
6746
+ InputAttachmentComponent,
6747
+ InputDateRangeComponent,
6748
+ InputImageComponent,
6749
+ InputFloatComponent, PageStandardComponent, PageComponent, AccordionComponent,
6750
+ AccordionHeaderComponent,
6751
+ AccordionBodyComponent, DateRangeComponent,
6752
+ DateRangeModalComponent, DateEditComponent, ButtonComponent, ButtonStandardComponent, CardComponent, ListComponent,
6753
+ ListMobileComponent,
6754
+ ListDesktopComponent,
6755
+ ListMasonryGridComponent, LoaderComponent, DetailComponent,
6756
+ DetailTextComponent,
6757
+ DetailFlagComponent,
6758
+ DetailEnumComponent,
6759
+ DetailEmailComponent,
6760
+ DetailAddressComponent,
6761
+ DetailObjectComponent,
6762
+ DetailColorComponent,
6763
+ DetailLogoComponent,
6764
+ DetailArrayComponent,
6765
+ DetailPdfComponent,
6766
+ DetailVideoComponent,
6767
+ DetailAttachmentComponent,
6768
+ DetailDateRangeComponent,
6769
+ DetailImageComponent,
6770
+ DetailPhoneNumberPlComponent, DetailsComponent, DetailsStandardComponent, DynamicComponent, InfoComponent, InfoModalComponent, ExportComponent,
6771
+ ImportComponent,
6772
+ PasswordStrengthComponent], exports: [FormStandardComponent,
6773
+ FormComponent, InputComponent,
6774
+ InputIntComponent,
6775
+ InputErrorComponent,
6776
+ InputTextComponent,
6777
+ InputPasswordComponent,
6778
+ InputFlagComponent,
6779
+ InputEnumComponent,
6780
+ InputEmailComponent,
6781
+ InputCurrencyComponent,
6782
+ InputDateComponent,
6783
+ InputDateWithEditComponent,
6784
+ InputFileComponent,
6785
+ InputRadioComponent,
6786
+ InputNipComponent,
6787
+ InputStringsComponent,
6788
+ InputLongTextComponent,
6789
+ InputAddressComponent,
6790
+ InputObjectComponent,
6791
+ InputColorComponent,
6792
+ InputLogoComponent,
6793
+ InputCheckComponent,
6794
+ InputIntsComponent,
6795
+ InputPhoneNumberComponent,
6796
+ InputPhoneNumberPlComponent,
6797
+ InputPeselComponent,
6798
+ InputArrayComponent,
6799
+ InputPdfComponent,
6800
+ InputVideoComponent,
6801
+ InputAttachmentComponent,
6802
+ InputDateRangeComponent,
6803
+ InputImageComponent,
6804
+ InputFloatComponent, PageStandardComponent, PageComponent, AccordionComponent,
6805
+ AccordionHeaderComponent,
6806
+ AccordionBodyComponent, DateRangeComponent,
6807
+ DateRangeModalComponent, DateEditComponent, ButtonComponent, ButtonStandardComponent, CardComponent, ListComponent,
6808
+ ListMobileComponent,
6809
+ ListDesktopComponent,
6810
+ ListMasonryGridComponent, LoaderComponent, DetailComponent,
6811
+ DetailTextComponent,
6812
+ DetailFlagComponent,
6813
+ DetailEnumComponent,
6814
+ DetailEmailComponent,
6815
+ DetailAddressComponent,
6816
+ DetailObjectComponent,
6817
+ DetailColorComponent,
6818
+ DetailLogoComponent,
6819
+ DetailArrayComponent,
6820
+ DetailPdfComponent,
6821
+ DetailVideoComponent,
6822
+ DetailAttachmentComponent,
6823
+ DetailDateRangeComponent,
6824
+ DetailImageComponent,
6825
+ DetailPhoneNumberPlComponent, DetailsComponent, DetailsStandardComponent, DynamicComponent, InfoComponent, InfoModalComponent, ExportComponent,
6826
+ ImportComponent,
6827
+ PasswordStrengthComponent] });
6828
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, providers: [
6829
+ {
6830
+ provide: FORM_COMPONENT_TOKEN,
6831
+ useValue: FormComponent,
6832
+ },
6833
+ {
6834
+ provide: DETAILS_COMPONENT_TOKEN,
6835
+ useValue: DetailsComponent,
6836
+ },
6837
+ ], imports: [IMPORTS, FormStandardComponent,
6838
+ FormComponent, InputComponent,
6839
+ InputIntComponent,
6840
+ InputTextComponent,
6841
+ InputPasswordComponent,
6842
+ InputFlagComponent,
6843
+ InputEmailComponent,
6844
+ InputCurrencyComponent,
6845
+ InputDateComponent,
6846
+ InputDateWithEditComponent,
6847
+ InputRadioComponent,
6848
+ InputNipComponent,
6849
+ InputStringsComponent,
6850
+ InputLongTextComponent,
6851
+ InputAddressComponent,
6852
+ InputCheckComponent,
6853
+ InputIntsComponent,
6854
+ InputPhoneNumberComponent,
6855
+ InputPhoneNumberPlComponent,
6856
+ InputPeselComponent,
6857
+ InputFloatComponent, PageStandardComponent, PageComponent, DateEditComponent, ListComponent,
6858
+ ListMobileComponent,
6859
+ ListDesktopComponent, DynamicComponent] });
6812
6860
  }
6813
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMasonryGridComponent, decorators: [{
6814
- type: Component,
6815
- args: [{ selector: 'smart-list-masonry-grid', imports: [PagingComponent, FileUrlPipe, NgOptimizedImage, ListCellPipe], template: "<div #topTpl></div>\n\n<div class=\"ion-padding\">\n <div class=\"gap-3\">\n @for (item of listWithImages(); track item) {\n <!-- <ion-card class=\"w-full my-2.5 break-inside-avoid border border-gray-100\" (click)=\"unselect?.()\">-->\n @if (item.image) {\n <img [ngSrc]=\"item.image | smartFileUrl\" alt=\"\" fill />\n }\n\n <!-- <ion-card-content class=\"overflow-hidden after:block after:w-full after:bg-gradient-to-r after:from-transparent after:to-white after:absolute after:bottom-0\">-->\n @for (key of keys; track key) {\n @let cell = item.data | smartListCell: key : cellPipe : type;\n @if (cell && cell.value != item.image) {\n @if ($index < 2) {\n <h3\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-800\"\n [innerHTML]=\"cell.value\"\n ></h3>\n } @else {\n <p\n [attr.smart-item-key]=\"key\"\n class=\"text-gray-500\"\n [innerHTML]=\"cell.value\"\n ></p>\n }\n }\n }\n <!-- </ion-card-content>-->\n\n <!-- <ion-row>-->\n @if (removeHandler) {\n <!-- <ion-col size=\"auto\">-->\n @if (!checkRemoveHandler || checkRemoveHandler(item.data)) {\n <!-- <ion-button (click)=\"removeHandler?.(item.data)\">-->\n <!-- <ion-icon slot=\"icon-only\" name=\"trash\"></ion-icon>-->\n <!-- </ion-button>-->\n }\n <!-- </ion-col>-->\n }\n <!-- <ion-col></ion-col>-->\n @if (itemHandler) {\n <!-- <ion-col size=\"auto\">-->\n <!-- <ion-button (click)=\"itemHandler?.(item.data.id)\">-->\n <!-- <ion-icon-->\n <!-- slot=\"icon-only\"-->\n <!-- name=\"arrow-forward-outline\"-->\n <!-- ></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-col>-->\n }\n <!-- </ion-row>-->\n <!-- </ion-card>-->\n }\n </div>\n</div>\n\n@if (\n loadNextPage &&\n Object.keys(list() ?? [])?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content loadingSpinner=\"circles\">-->\n <!-- </ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n" }]
6861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedComponentsModule, decorators: [{
6862
+ type: NgModule,
6863
+ args: [{
6864
+ declarations: [],
6865
+ exports: [...COMPONENTS$1],
6866
+ providers: [
6867
+ {
6868
+ provide: FORM_COMPONENT_TOKEN,
6869
+ useValue: FormComponent,
6870
+ },
6871
+ {
6872
+ provide: DETAILS_COMPONENT_TOKEN,
6873
+ useValue: DetailsComponent,
6874
+ },
6875
+ ],
6876
+ imports: [...IMPORTS, ...COMPONENTS$1],
6877
+ }]
6816
6878
  }] });
6817
6879
 
6818
- class ListMobileComponent extends ListBaseComponent {
6819
- listMobile = this.list;
6820
- componentFactories = null;
6821
- topTpl = viewChild('topTpl', ...(ngDevMode ? [{ debugName: "topTpl" }] : []));
6822
- initList(val) {
6823
- super.initList(val);
6824
- this.componentFactories = val.componentFactories ?? null;
6825
- this.generateDynamicComponents();
6826
- }
6827
- ngAfterViewInit() {
6828
- this.generateDynamicComponents();
6829
- }
6830
- generateDynamicComponents() {
6831
- if (!this.componentFactories)
6832
- return;
6833
- if (this.componentFactories.top && this.topTpl()) {
6834
- if (!this.topTpl()?.get(0)) {
6835
- this.topTpl()?.createComponent(this.componentFactories.top);
6836
- }
6837
- }
6838
- }
6839
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMobileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6840
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: ListMobileComponent, isStandalone: true, selector: "smart-list-mobile", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #topTpl></div>\n\n@let list = listMobile();\n@if (list) {\n <!-- <ion-list>-->\n @for (item of list; track item.id) {\n <!-- <ion-item-sliding>-->\n @if (removeHandler && (!checkRemoveHandler || checkRemoveHandler(item))) {\n <!-- <ion-item-options side=\"start\" (ionSwipe)=\"removeHandler?.(item)\">-->\n <!-- <ion-item-option-->\n <!-- color=\"danger\"-->\n <!-- expandable-->\n <!-- (click)=\"removeHandler?.(item)\"-->\n <!-- >-->\n {{ 'delete' | translate }}\n <!-- </ion-item-option>-->\n <!-- </ion-item-options>-->\n }\n\n <!-- <ion-item class=\"pl-5\" (click)=\"itemHandler ? itemHandler(item.id) : unselect()\">-->\n <!-- <ion-label>-->\n @for (key of keys; track key) {\n @let cell = item | smartListCell: key : cellPipe : type;\n @if (cell) {\n @if (cell.type === FieldType.image) {\n <img\n [attr.smart-item-key]=\"key\"\n height=\"100\"\n [lazyLoad]=\"cell.value | smartFileUrl\"\n alt=\"\"\n src=\"\"\n />\n } @else if ($first) {\n <h2 [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></h2>\n } @else {\n <p [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></p>\n }\n }\n }\n <!-- </ion-label>-->\n <!-- </ion-item>-->\n <!-- </ion-item-sliding>-->\n }\n <!-- </ion-list>-->\n}\n\n@if (\n loadNextPage &&\n list?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content-->\n <!-- loadingSpinner=\"circles\"-->\n <!-- ></ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n", dependencies: [{ kind: "ngmodule", type: LazyLoadImageModule }, { kind: "directive", type: i1$2.LazyLoadImageDirective, selector: "[lazyLoad]", inputs: ["lazyLoad", "defaultImage", "errorImage", "scrollTarget", "customObservable", "offset", "useSrcset", "decode", "debug"], outputs: ["onStateChange"] }, { kind: "component", type: PagingComponent, selector: "smart-paging", inputs: ["page", "totalPages"], outputs: ["nextPage", "prevPage"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "pipe", type: FileUrlPipe, name: "smartFileUrl" }, { kind: "pipe", type: ListCellPipe, name: "smartListCell" }] });
6880
+ const COMPONENTS = [DetailsPage];
6881
+ class SharedPagesModule {
6882
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6883
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, imports: [SharedServicesModule,
6884
+ SharedComponentsModule,
6885
+ SharedDirectivesModule, DetailsPage], exports: [DetailsPage] });
6886
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, imports: [SharedServicesModule,
6887
+ SharedComponentsModule,
6888
+ SharedDirectivesModule,
6889
+ COMPONENTS] });
6841
6890
  }
6842
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListMobileComponent, decorators: [{
6843
- type: Component,
6844
- args: [{ selector: 'smart-list-mobile', imports: [
6845
- TranslatePipe,
6846
- FileUrlPipe,
6847
- LazyLoadImageModule,
6848
- PagingComponent,
6849
- ListCellPipe,
6850
- ], template: "<div #topTpl></div>\n\n@let list = listMobile();\n@if (list) {\n <!-- <ion-list>-->\n @for (item of list; track item.id) {\n <!-- <ion-item-sliding>-->\n @if (removeHandler && (!checkRemoveHandler || checkRemoveHandler(item))) {\n <!-- <ion-item-options side=\"start\" (ionSwipe)=\"removeHandler?.(item)\">-->\n <!-- <ion-item-option-->\n <!-- color=\"danger\"-->\n <!-- expandable-->\n <!-- (click)=\"removeHandler?.(item)\"-->\n <!-- >-->\n {{ 'delete' | translate }}\n <!-- </ion-item-option>-->\n <!-- </ion-item-options>-->\n }\n\n <!-- <ion-item class=\"pl-5\" (click)=\"itemHandler ? itemHandler(item.id) : unselect()\">-->\n <!-- <ion-label>-->\n @for (key of keys; track key) {\n @let cell = item | smartListCell: key : cellPipe : type;\n @if (cell) {\n @if (cell.type === FieldType.image) {\n <img\n [attr.smart-item-key]=\"key\"\n height=\"100\"\n [lazyLoad]=\"cell.value | smartFileUrl\"\n alt=\"\"\n src=\"\"\n />\n } @else if ($first) {\n <h2 [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></h2>\n } @else {\n <p [attr.smart-item-key]=\"key\" [innerHTML]=\"cell.value\"></p>\n }\n }\n }\n <!-- </ion-label>-->\n <!-- </ion-item>-->\n <!-- </ion-item-sliding>-->\n }\n <!-- </ion-list>-->\n}\n\n@if (\n loadNextPage &&\n list?.length &&\n options().pagination?.mode !== PaginationMode.singlePage\n) {\n <!-- <ion-infinite-scroll threshold=\"100px\" (ionInfinite)=\"loadNextPage?.($event)\">-->\n <!-- <ion-infinite-scroll-content-->\n <!-- loadingSpinner=\"circles\"-->\n <!-- ></ion-infinite-scroll-content>-->\n <!-- </ion-infinite-scroll>-->\n}\n\n@if (options()?.pagination?.mode === PaginationMode.singlePage) {\n <smart-paging\n [page]=\"page()\"\n [totalPages]=\"totalPages()\"\n (prevPage)=\"loadPrevPage?.()\"\n (nextPage)=\"loadNextPage?.()\"\n ></smart-paging>\n}\n" }]
6891
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: SharedPagesModule, decorators: [{
6892
+ type: NgModule,
6893
+ args: [{
6894
+ imports: [
6895
+ SharedServicesModule,
6896
+ SharedComponentsModule,
6897
+ SharedDirectivesModule,
6898
+ COMPONENTS,
6899
+ ],
6900
+ declarations: [],
6901
+ exports: [...COMPONENTS],
6902
+ }]
6851
6903
  }] });
6852
6904
 
6853
- class ListComponent extends CreateDynamicComponent('list') {
6854
- _options;
6855
- hardwareService = inject(HardwareService);
6856
- mode = signal(ListMode.desktop, ...(ngDevMode ? [{ debugName: "mode" }] : []));
6857
- ListMode = ListMode;
6858
- options = input.required(...(ngDevMode ? [{ debugName: "options" }] : []));
6859
- get internalOptions() {
6860
- return this._options();
6861
- }
6862
- contentTpl = viewChild('contentTpl', ...(ngDevMode ? [{ debugName: "contentTpl" }] : []));
6863
- dynamicContents = viewChildren(DynamicContentDirective, ...(ngDevMode ? [{ debugName: "dynamicContents" }] : []));
6864
- constructor() {
6865
- super();
6866
- effect(() => {
6867
- this._options.set(this.options());
6868
- this.initFields();
6869
- this.initModel();
6870
- this.refreshDynamicInstance();
6871
- });
6872
- }
6873
- refreshProperties() {
6874
- this.baseComponentRef.setInput('options', this._options());
6875
- }
6876
- initFields() {
6877
- this._options.update((options) => {
6878
- return {
6879
- ...options,
6880
- fields: _.sortBy(getModelFieldsWithOptions(new (this._options().type)()).filter((item) => item?.options?.list), (item) => (item?.options?.list).order),
6881
- };
6882
- });
6883
- }
6884
- initModel() {
6885
- this.mode = computed(() => this._options()?.mode ??
6886
- (this.hardwareService.isMobile ? ListMode.mobile : ListMode.desktop), ...(ngDevMode ? [{ debugName: "mode" }] : []));
6887
- }
6888
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6889
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.0", type: ListComponent, isStandalone: true, selector: "smart-list", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, isSignal: true }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (template() === 'default') {\n @switch (mode()) {\n @case (ListMode.desktop) {\n <smart-list-desktop [options]=\"internalOptions\"></smart-list-desktop>\n }\n @case (ListMode.mobile) {\n <smart-list-mobile [options]=\"internalOptions\"></smart-list-mobile>\n }\n @case (ListMode.masonryGrid) {\n <smart-list-masonry-grid\n [options]=\"internalOptions\"\n ></smart-list-masonry-grid>\n }\n }\n\n <!-- <ion-row>-->\n <!-- <ion-col></ion-col>-->\n <!-- <ion-col size=\"auto\">-->\n @let loading = internalOptions?.provider?.loading();\n <smart-loader [show]=\"loading ?? false\"></smart-loader>\n @if (!loading && !internalOptions.provider.list()?.length) {\n <h2>\n <br />\n {{ 'noResults' | translate }}\n </h2>\n }\n <!-- </ion-col>-->\n <!-- <ion-col></ion-col>-->\n <!-- </ion-row>-->\n\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n}\n\n<ng-template #contentTpl>\n <ng-content></ng-content>\n</ng-template>\n<div class=\"dynamic-content\"></div>\n", dependencies: [{ kind: "component", type: ListDesktopComponent, selector: "smart-list-desktop" }, { kind: "component", type: ListMobileComponent, selector: "smart-list-mobile" }, { kind: "component", type: ListMasonryGridComponent, selector: "smart-list-masonry-grid" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LoaderComponent, selector: "smart-loader", inputs: ["show", "height"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
6890
- }
6891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ListComponent, decorators: [{
6892
- type: Component,
6893
- args: [{ selector: 'smart-list', encapsulation: ViewEncapsulation.None, imports: [
6894
- ListDesktopComponent,
6895
- ListMobileComponent,
6896
- ListMasonryGridComponent,
6897
- TranslatePipe,
6898
- NgTemplateOutlet,
6899
- LoaderComponent,
6900
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (template() === 'default') {\n @switch (mode()) {\n @case (ListMode.desktop) {\n <smart-list-desktop [options]=\"internalOptions\"></smart-list-desktop>\n }\n @case (ListMode.mobile) {\n <smart-list-mobile [options]=\"internalOptions\"></smart-list-mobile>\n }\n @case (ListMode.masonryGrid) {\n <smart-list-masonry-grid\n [options]=\"internalOptions\"\n ></smart-list-masonry-grid>\n }\n }\n\n <!-- <ion-row>-->\n <!-- <ion-col></ion-col>-->\n <!-- <ion-col size=\"auto\">-->\n @let loading = internalOptions?.provider?.loading();\n <smart-loader [show]=\"loading ?? false\"></smart-loader>\n @if (!loading && !internalOptions.provider.list()?.length) {\n <h2>\n <br />\n {{ 'noResults' | translate }}\n </h2>\n }\n <!-- </ion-col>-->\n <!-- <ion-col></ion-col>-->\n <!-- </ion-row>-->\n\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n}\n\n<ng-template #contentTpl>\n <ng-content></ng-content>\n</ng-template>\n<div class=\"dynamic-content\"></div>\n" }]
6901
- }], ctorParameters: () => [] });
6902
-
6903
6905
  function setDefaultTranslationsAndLang(service) {
6904
6906
  const map = {
6905
6907
  pl: TRANSLATE_DATA_PL,