@corp-products/ui-components 4.2.9 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Button } from 'primeng/button';
2
2
  import * as i0 from '@angular/core';
3
- import { TemplateRef, OnInit, EventEmitter, PipeTransform, OnDestroy, AfterViewInit, SimpleChanges, Type, EnvironmentInjector, ApplicationRef, ViewContainerRef, OnChanges, ElementRef, Renderer2 } from '@angular/core';
3
+ import { TemplateRef, OnInit, EventEmitter, PipeTransform, OnDestroy, AfterViewInit, OnChanges, SimpleChanges, Type, EnvironmentInjector, ApplicationRef, ViewContainerRef, ElementRef, Renderer2 } from '@angular/core';
4
4
  import { Params, Router, ActivatedRoute } from '@angular/router';
5
5
  import { DynamicDialogRef, DialogService, DynamicDialogConfig } from 'primeng/dynamicdialog';
6
6
  import { FormGroup, FormControl, ValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';
7
- import { AutoCompleteSelectEvent, AutoCompleteCompleteEvent } from 'primeng/autocomplete';
8
7
  import * as rxjs from 'rxjs';
9
8
  import { Subject, Observable } from 'rxjs';
9
+ import { AutoCompleteSelectEvent, AutoCompleteCompleteEvent } from 'primeng/autocomplete';
10
10
  import { SelectButtonChangeEvent } from 'primeng/selectbutton';
11
11
  import { SelectChangeEvent } from 'primeng/select';
12
12
  import { MenuItem } from 'primeng/api';
@@ -345,6 +345,104 @@ declare class SwitchComponent {
345
345
  static ɵcmp: i0.ɵɵComponentDeclaration<SwitchComponent, "stc-switch", never, { "label": { "alias": "label"; "required": false; }; "key": { "alias": "key"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; }, { "onChange": "onChange"; }, never, never, true, never>;
346
346
  }
347
347
 
348
+ interface FileUploadResponse {
349
+ documentId: string;
350
+ [key: string]: any;
351
+ }
352
+ interface FileUploadState {
353
+ isUploading: boolean;
354
+ documentId: string | null;
355
+ hasFile: boolean;
356
+ }
357
+ interface AttachmentFile {
358
+ id: string;
359
+ fileName: string;
360
+ size: number;
361
+ mimeType: string;
362
+ createdDate?: string;
363
+ createdBy?: UserProfileData;
364
+ createdByDepartment?: Department;
365
+ }
366
+ interface UploadProgress {
367
+ fileId: string;
368
+ fileName: string;
369
+ progress: number;
370
+ status: UploadStatus;
371
+ error?: string;
372
+ response?: AttachmentFile;
373
+ }
374
+ interface Department {
375
+ id: string;
376
+ nameAr: string;
377
+ nameEn: string;
378
+ }
379
+ interface FileItem extends AttachmentFile {
380
+ progress?: number;
381
+ status?: UploadStatus;
382
+ error?: string;
383
+ file?: File;
384
+ isNew?: boolean;
385
+ }
386
+ interface DownloadRequest {
387
+ attachmentIds: string[];
388
+ }
389
+ interface FileTypeConfig {
390
+ icon: string;
391
+ iconPathCount: number;
392
+ colorClass?: string;
393
+ }
394
+ interface PdfPreviewState {
395
+ visible: boolean;
396
+ blob: Blob | null;
397
+ fileName: string;
398
+ }
399
+ interface Attachment {
400
+ id?: string;
401
+ nameFile: string;
402
+ size: number;
403
+ url?: string | ArrayBuffer | null;
404
+ file?: File;
405
+ isCanceled?: boolean;
406
+ uploadStatus?: UploadStatus;
407
+ status?: AttachmentStatusDisplay;
408
+ serverResponse?: unknown;
409
+ errorMessage?: string;
410
+ }
411
+ interface AttachmentStatusDisplay {
412
+ icon: string;
413
+ label: string;
414
+ labelClass?: string;
415
+ percentage?: number;
416
+ success?: boolean;
417
+ }
418
+ declare enum UploadStatus {
419
+ PENDING = "pending",
420
+ SUCCESS = "success",
421
+ UPLOADING = "uploading",
422
+ FAILED = "failed"
423
+ }
424
+ interface UserProfileData {
425
+ contact: Contact;
426
+ position: Position;
427
+ email: string;
428
+ profileImage: string;
429
+ nameEn: string;
430
+ nameAr: string;
431
+ }
432
+ interface Contact {
433
+ mobile: string;
434
+ work: string;
435
+ }
436
+ interface Position {
437
+ code: string;
438
+ name: string;
439
+ }
440
+
441
+ interface FileUploadConfig {
442
+ uploadFn: (file: File) => Observable<FileUploadResponse>;
443
+ acceptedTypes?: string;
444
+ maxFileSize?: number;
445
+ }
348
446
  type InputType = 'text' | 'textarea' | 'number';
349
447
  type InputContentType = 'text' | 'email' | 'number';
350
448
  interface Dropdown<T = unknown> {
@@ -400,6 +498,7 @@ interface InputsMapData {
400
498
  minLengthToSearch?: number;
401
499
  delay?: number;
402
500
  allowedDomains?: string[] | undefined;
501
+ fileUpload?: FileUploadConfig;
403
502
  }
404
503
  interface InputsMap {
405
504
  [key: string]: InputsMapData;
@@ -411,6 +510,7 @@ interface DynamicFormData {
411
510
  title?: string;
412
511
  isReadOnlyForm?: boolean;
413
512
  formValidationErrorsKeys?: string[];
513
+ fileUpload?: FileUploadConfig;
414
514
  }
415
515
  interface DateRangeInterface {
416
516
  min?: Date | null;
@@ -445,12 +545,18 @@ declare class ConfirmationDialogComponent extends DynamicDialogRef implements On
445
545
  private readonly _subscription;
446
546
  dialogFormData: DynamicFormData;
447
547
  uploadedFile: any;
548
+ documentId: string | null;
549
+ uploadState: FileUploadState;
550
+ get hasFileUpload(): boolean;
551
+ hasFileUploadField(): boolean;
552
+ get isConfirmDisabled(): boolean;
448
553
  ngOnDestroy(): void;
449
554
  ngOnInit(): void;
450
555
  submit(): void;
451
556
  close(): void;
452
557
  onPopFilesUploaded(file: any): void;
453
- onFileDeleted(file: any): void;
558
+ onFileDeleted(): void;
559
+ onUploadStateChange(state: FileUploadState): void;
454
560
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationDialogComponent, never>;
455
561
  static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationDialogComponent, "app-confirm-dialog", never, {}, {}, never, never, true, never>;
456
562
  }
@@ -476,7 +582,7 @@ declare class AppAccordionComponent {
476
582
  static ɵcmp: i0.ɵɵComponentDeclaration<AppAccordionComponent, "app-accordion", never, { "iconName": { "alias": "iconName"; "required": false; }; "iconClass": { "alias": "iconClass"; "required": false; }; "iconPathCount": { "alias": "iconPathCount"; "required": false; }; "title": { "alias": "title"; "required": true; }; "contentBorderTop": { "alias": "contentBorderTop"; "required": false; }; "accordionPanelBorder": { "alias": "accordionPanelBorder"; "required": false; }; }, {}, never, ["*"], true, never>;
477
583
  }
478
584
 
479
- declare class DynamicFormComponent implements OnInit {
585
+ declare class DynamicFormComponent implements OnInit, OnChanges {
480
586
  dynamicFormData: DynamicFormData;
481
587
  selectButtonChange: EventEmitter<{
482
588
  name: string;
@@ -507,19 +613,26 @@ declare class DynamicFormComponent implements OnInit {
507
613
  fileId: string;
508
614
  isNew: boolean;
509
615
  }>;
616
+ uploadStateChange: EventEmitter<FileUploadState>;
510
617
  inputsNames: string[];
511
618
  formGroup: FormGroup;
512
619
  inputsMap: InputsMap;
620
+ standaloneFileControl: FormControl<string | null>;
513
621
  readonly fieldType: typeof FormFieldTypeEnum;
514
622
  getFormControl: typeof FormUtils.getFormControl;
623
+ get fileUploadConfig(): FileUploadConfig | undefined;
515
624
  ngOnInit(): void;
516
625
  ngOnChanges(changes: SimpleChanges): void;
517
626
  private updateFormState;
518
- getAcceptedTypes(): string;
627
+ getAcceptedTypes(fileUpload?: FileUploadConfig): string;
628
+ getMaxFileSize(fileUpload?: FileUploadConfig): number;
629
+ getFileUploadConfig(inputName: string): FileUploadConfig | undefined;
630
+ hasUploadFileField(): boolean;
519
631
  onFilesUploaded(file: any): void;
520
632
  onFileDeleted(file: any): void;
633
+ onUploadStateChange(state: FileUploadState): void;
521
634
  static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFormComponent, never>;
522
- static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "app-dynamic-form", never, { "dynamicFormData": { "alias": "dynamicFormData"; "required": true; }; }, { "selectButtonChange": "selectButtonChange"; "selectChange": "selectChange"; "selectClicked": "selectClicked"; "switchChange": "switchChange"; "autoCompleteSearch": "autoCompleteSearch"; "autoCompleteSelect": "autoCompleteSelect"; "popUpFilesUploaded": "popUpFilesUploaded"; "fileDeleted": "fileDeleted"; }, never, never, true, never>;
635
+ static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "app-dynamic-form", never, { "dynamicFormData": { "alias": "dynamicFormData"; "required": true; }; }, { "selectButtonChange": "selectButtonChange"; "selectChange": "selectChange"; "selectClicked": "selectClicked"; "switchChange": "switchChange"; "autoCompleteSearch": "autoCompleteSearch"; "autoCompleteSelect": "autoCompleteSelect"; "popUpFilesUploaded": "popUpFilesUploaded"; "fileDeleted": "fileDeleted"; "uploadStateChange": "uploadStateChange"; }, never, never, true, never>;
523
636
  }
524
637
 
525
638
  declare class UserAutocompleteCardComponent {
@@ -649,6 +762,7 @@ interface ConfirmationDialogData {
649
762
  hint?: string;
650
763
  inputForm?: any;
651
764
  breakpoints?: any;
765
+ fileUpload?: FileUploadConfig;
652
766
  }
653
767
 
654
768
  declare class ConfirmationDialogService {
@@ -721,6 +835,7 @@ declare class DualCalendarComponent implements OnInit, OnChanges, OnDestroy {
721
835
  hijriModel: NgbDateStruct;
722
836
  currentLang: i0.WritableSignal<"ar" | "en">;
723
837
  disabledDays: number[];
838
+ disabledDates: Date[];
724
839
  gregorianUTC: EventEmitter<string>;
725
840
  onClose: EventEmitter<boolean>;
726
841
  gregorianUTCValue: string;
@@ -747,7 +862,7 @@ declare class DualCalendarComponent implements OnInit, OnChanges, OnDestroy {
747
862
  formatHijri(h: NgbDate): string;
748
863
  ngOnDestroy(): void;
749
864
  static ɵfac: i0.ɵɵFactoryDeclaration<DualCalendarComponent, never>;
750
- static ɵcmp: i0.ɵɵComponentDeclaration<DualCalendarComponent, "app-dual-calendar", never, { "control": { "alias": "control"; "required": false; }; "label": { "alias": "label"; "required": false; }; "name": { "alias": "name"; "required": false; }; "withTime": { "alias": "withTime"; "required": false; }; "isDatePickerShow": { "alias": "isDatePickerShow"; "required": false; }; "currentLang": { "alias": "currentLang"; "required": false; }; "disabledDays": { "alias": "disabledDays"; "required": false; }; "isShown": { "alias": "isShown"; "required": false; }; "appedToBody": { "alias": "appedToBody"; "required": false; }; }, { "gregorianUTC": "gregorianUTC"; "onClose": "onClose"; }, never, never, true, never>;
865
+ static ɵcmp: i0.ɵɵComponentDeclaration<DualCalendarComponent, "app-dual-calendar", never, { "control": { "alias": "control"; "required": false; }; "label": { "alias": "label"; "required": false; }; "name": { "alias": "name"; "required": false; }; "withTime": { "alias": "withTime"; "required": false; }; "isDatePickerShow": { "alias": "isDatePickerShow"; "required": false; }; "currentLang": { "alias": "currentLang"; "required": false; }; "disabledDays": { "alias": "disabledDays"; "required": false; }; "disabledDates": { "alias": "disabledDates"; "required": false; }; "isShown": { "alias": "isShown"; "required": false; }; "appedToBody": { "alias": "appedToBody"; "required": false; }; }, { "gregorianUTC": "gregorianUTC"; "onClose": "onClose"; }, never, never, true, never>;
751
866
  }
752
867
 
753
868
  declare const WEEKDAYS: {
@@ -794,89 +909,5 @@ declare class AlertDialogService {
794
909
  declare const dateRangeValidator: (fromKey: string, toKey: string) => ValidatorFn;
795
910
  declare const notFutureDateValidator: (dateKey: string) => ValidatorFn;
796
911
 
797
- interface AttachmentFile {
798
- id: string;
799
- fileName: string;
800
- size: number;
801
- mimeType: string;
802
- createdDate?: string;
803
- createdBy?: UserProfileData;
804
- createdByDepartment?: Department;
805
- }
806
- interface UploadProgress {
807
- fileId: string;
808
- fileName: string;
809
- progress: number;
810
- status: UploadStatus;
811
- error?: string;
812
- response?: AttachmentFile;
813
- }
814
- interface Department {
815
- id: string;
816
- nameAr: string;
817
- nameEn: string;
818
- }
819
- interface FileItem extends AttachmentFile {
820
- progress?: number;
821
- status?: UploadStatus;
822
- error?: string;
823
- file?: File;
824
- isNew?: boolean;
825
- }
826
- interface DownloadRequest {
827
- attachmentIds: string[];
828
- }
829
- interface FileTypeConfig {
830
- icon: string;
831
- iconPathCount: number;
832
- colorClass?: string;
833
- }
834
- interface PdfPreviewState {
835
- visible: boolean;
836
- blob: Blob | null;
837
- fileName: string;
838
- }
839
- interface Attachment {
840
- id?: string;
841
- nameFile: string;
842
- size: number;
843
- url?: string | ArrayBuffer | null;
844
- file?: File;
845
- isCanceled?: boolean;
846
- uploadStatus?: UploadStatus;
847
- status?: AttachmentStatusDisplay;
848
- serverResponse?: unknown;
849
- errorMessage?: string;
850
- }
851
- interface AttachmentStatusDisplay {
852
- icon: string;
853
- label: string;
854
- labelClass?: string;
855
- percentage?: number;
856
- success?: boolean;
857
- }
858
- declare enum UploadStatus {
859
- PENDING = "pending",
860
- SUCCESS = "success",
861
- UPLOADING = "uploading",
862
- FAILED = "failed"
863
- }
864
- interface UserProfileData {
865
- contact: Contact;
866
- position: Position;
867
- email: string;
868
- profileImage: string;
869
- nameEn: string;
870
- nameAr: string;
871
- }
872
- interface Contact {
873
- mobile: string;
874
- work: string;
875
- }
876
- interface Position {
877
- code: string;
878
- name: string;
879
- }
880
-
881
912
  export { AlertDialogComponent, AlertDialogService, AppAccordionComponent, AppBreadcrumbComponent, AppButtonComponent, AppDropdownMenuComponent, AppTabsComponent, AutoCompleteComponent, BasicErrorKeysEnum, BottomSheetComponent, ConfirmationDialogComponent, ConfirmationDialogService, DatePickerComponent, DualCalendarComponent, DynamicFormComponent, DynamicSidebarService, DynamicSidebarV2Service, ErrorsWithValuesKeysEnum, FormFieldTypeEnum, FormUtils, FormValidationService, IcoMoonIconComponent, InputComponent, MONTHS_GREGORIAN, MONTHS_HIJRI, ReadMoreComponent, SelectButtonComponent, SelectComponent, SideBarComponent, SidebarConfigDefaults, SwitchComponent, UploadStatus, UserAutocompleteCardComponent, UserInfoComponent, ValidationErrorsPipe, WEEKDAYS, dateRangeValidator, emailStcValidator, getGregorianMonthName, getHijriMonthName, getWeekdayName, maxRepeatedCharsValidator, notFutureDateValidator, numbersOnlyValidator, saudiPhoneValidator };
882
- export type { AlertDialogData, AppButtonIconPos, AppButtonSeverity, AppButtonSize, AppButtonVariant, AppTabs, Attachment, AttachmentFile, AttachmentStatusDisplay, BreadCrumbExtraData, BreadCrumbPosition, BreadcrumbItem, ConfirmationDialogData, Contact, DateRangeInterface, Department, DownloadRequest, Dropdown, DropdownMenuItem, DropdownTextColor, DynamicFormData, DynamicSidebarV2Actions, DynamicSidebarV2Config, FileItem, FileTypeConfig, InputContentType, InputType, InputsMap, InputsMapData, LabelValue, OptionTemplateConfig, PdfPreviewState, Position, RoutedTab, SidebarActionConfig, SidebarActionV2Config, SidebarConfig, SidebarV2Actions, TemplateTab, UploadProgress, UserProfileData };
913
+ export type { AlertDialogData, AppButtonIconPos, AppButtonSeverity, AppButtonSize, AppButtonVariant, AppTabs, Attachment, AttachmentFile, AttachmentStatusDisplay, BreadCrumbExtraData, BreadCrumbPosition, BreadcrumbItem, ConfirmationDialogData, Contact, DateRangeInterface, Department, DownloadRequest, Dropdown, DropdownMenuItem, DropdownTextColor, DynamicFormData, DynamicSidebarV2Actions, DynamicSidebarV2Config, FileItem, FileTypeConfig, FileUploadConfig, FileUploadResponse, FileUploadState, InputContentType, InputType, InputsMap, InputsMapData, LabelValue, OptionTemplateConfig, PdfPreviewState, Position, RoutedTab, SidebarActionConfig, SidebarActionV2Config, SidebarConfig, SidebarV2Actions, TemplateTab, UploadProgress, UserProfileData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corp-products/ui-components",
3
- "version": "4.2.9",
3
+ "version": "4.3.1",
4
4
  "author": "shireen Omar",
5
5
  "description": "shared UI components across our apps",
6
6
  "peerDependencies": {