@corp-products/ui-components 4.2.9 → 4.3.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.
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,17 @@ 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
+ get isConfirmDisabled(): boolean;
448
552
  ngOnDestroy(): void;
449
553
  ngOnInit(): void;
450
554
  submit(): void;
451
555
  close(): void;
452
556
  onPopFilesUploaded(file: any): void;
453
- onFileDeleted(file: any): void;
557
+ onFileDeleted(): void;
558
+ onUploadStateChange(state: FileUploadState): void;
454
559
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfirmationDialogComponent, never>;
455
560
  static ɵcmp: i0.ɵɵComponentDeclaration<ConfirmationDialogComponent, "app-confirm-dialog", never, {}, {}, never, never, true, never>;
456
561
  }
@@ -476,7 +581,7 @@ declare class AppAccordionComponent {
476
581
  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
582
  }
478
583
 
479
- declare class DynamicFormComponent implements OnInit {
584
+ declare class DynamicFormComponent implements OnInit, OnChanges {
480
585
  dynamicFormData: DynamicFormData;
481
586
  selectButtonChange: EventEmitter<{
482
587
  name: string;
@@ -507,19 +612,26 @@ declare class DynamicFormComponent implements OnInit {
507
612
  fileId: string;
508
613
  isNew: boolean;
509
614
  }>;
615
+ uploadStateChange: EventEmitter<FileUploadState>;
510
616
  inputsNames: string[];
511
617
  formGroup: FormGroup;
512
618
  inputsMap: InputsMap;
619
+ standaloneFileControl: FormControl<string | null>;
513
620
  readonly fieldType: typeof FormFieldTypeEnum;
514
621
  getFormControl: typeof FormUtils.getFormControl;
622
+ get fileUploadConfig(): FileUploadConfig | undefined;
515
623
  ngOnInit(): void;
516
624
  ngOnChanges(changes: SimpleChanges): void;
517
625
  private updateFormState;
518
- getAcceptedTypes(): string;
626
+ getAcceptedTypes(fileUpload?: FileUploadConfig): string;
627
+ getMaxFileSize(fileUpload?: FileUploadConfig): number;
628
+ getFileUploadConfig(inputName: string): FileUploadConfig | undefined;
629
+ hasUploadFileField(): boolean;
519
630
  onFilesUploaded(file: any): void;
520
631
  onFileDeleted(file: any): void;
632
+ onUploadStateChange(state: FileUploadState): void;
521
633
  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>;
634
+ 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
635
  }
524
636
 
525
637
  declare class UserAutocompleteCardComponent {
@@ -649,6 +761,7 @@ interface ConfirmationDialogData {
649
761
  hint?: string;
650
762
  inputForm?: any;
651
763
  breakpoints?: any;
764
+ fileUpload?: FileUploadConfig;
652
765
  }
653
766
 
654
767
  declare class ConfirmationDialogService {
@@ -794,89 +907,5 @@ declare class AlertDialogService {
794
907
  declare const dateRangeValidator: (fromKey: string, toKey: string) => ValidatorFn;
795
908
  declare const notFutureDateValidator: (dateKey: string) => ValidatorFn;
796
909
 
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
910
  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 };
911
+ 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.0",
4
4
  "author": "shireen Omar",
5
5
  "description": "shared UI components across our apps",
6
6
  "peerDependencies": {