@devtron-labs/devtron-fe-common-lib 1.2.4-beta-12 → 1.2.4-beta-13

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.
Files changed (43) hide show
  1. package/dist/{@code-editor-CQmGGn4U.js → @code-editor-D8U5cRhb.js} +4783 -4736
  2. package/dist/{@common-rjsf-D7fgYUGe.js → @common-rjsf-D5hvtwIi.js} +1 -1
  3. package/dist/Common/CIPipeline.Types.d.ts +26 -1
  4. package/dist/Common/Common.service.d.ts +7 -1
  5. package/dist/Common/Constants.d.ts +2 -1
  6. package/dist/Common/CustomTagSelector/ResizableTagTextArea.d.ts +1 -1
  7. package/dist/Common/CustomTagSelector/Types.d.ts +2 -14
  8. package/dist/Common/Helper.d.ts +2 -2
  9. package/dist/Common/RJSF/Form.d.ts +1 -1
  10. package/dist/Common/Types.d.ts +14 -21
  11. package/dist/Pages/Applications/DevtronApps/Details/CDPipeline/index.d.ts +1 -0
  12. package/dist/Pages/Applications/DevtronApps/Details/CDPipeline/services.d.ts +7 -0
  13. package/dist/Pages/Applications/DevtronApps/Details/CIPipeline/components/SystemVariableIcon.d.ts +1 -0
  14. package/dist/Pages/Applications/DevtronApps/Details/CIPipeline/components/index.d.ts +1 -0
  15. package/dist/Pages/Applications/DevtronApps/Details/CIPipeline/constants.d.ts +3 -0
  16. package/dist/Pages/Applications/DevtronApps/Details/CIPipeline/index.d.ts +3 -0
  17. package/dist/Pages/Applications/DevtronApps/Details/CIPipeline/services.d.ts +11 -0
  18. package/dist/Pages/Applications/DevtronApps/Details/index.d.ts +1 -0
  19. package/dist/Shared/Components/DynamicDataTable/DynamicDataTable.d.ts +1 -1
  20. package/dist/Shared/Components/DynamicDataTable/DynamicDataTableHeader.d.ts +1 -1
  21. package/dist/Shared/Components/DynamicDataTable/DynamicDataTableRow.d.ts +1 -1
  22. package/dist/Shared/Components/DynamicDataTable/constants.d.ts +2 -0
  23. package/dist/Shared/Components/DynamicDataTable/types.d.ts +27 -30
  24. package/dist/Shared/Components/DynamicDataTable/utils.d.ts +3 -3
  25. package/dist/Shared/Components/FileUpload/FileUpload.d.ts +2 -0
  26. package/dist/Shared/Components/FileUpload/index.d.ts +2 -0
  27. package/dist/Shared/Components/FileUpload/types.d.ts +7 -0
  28. package/dist/Shared/Components/KeyValueTable/KeyValueTable.types.d.ts +1 -1
  29. package/dist/Shared/Components/SelectPicker/type.d.ts +4 -5
  30. package/dist/Shared/Components/SelectTextArea/SelectTextArea.d.ts +1 -1
  31. package/dist/Shared/Components/SelectTextArea/types.d.ts +1 -1
  32. package/dist/Shared/Components/index.d.ts +1 -1
  33. package/dist/Shared/types.d.ts +32 -19
  34. package/dist/assets/@code-editor.css +1 -1
  35. package/dist/assets/ic-cloud-upload.18066e05.svg +1 -0
  36. package/dist/assets/ic-var-initial.afdaa854.svg +1 -0
  37. package/dist/index.js +507 -503
  38. package/package.json +1 -1
  39. package/dist/Shared/Components/TagsKeyValueTable/TagsContainer.d.ts +0 -3
  40. package/dist/Shared/Components/TagsKeyValueTable/constants.d.ts +0 -4
  41. package/dist/Shared/Components/TagsKeyValueTable/index.d.ts +0 -3
  42. package/dist/Shared/Components/TagsKeyValueTable/types.d.ts +0 -9
  43. package/dist/Shared/Components/TagsKeyValueTable/utils.d.ts +0 -3
@@ -2,7 +2,7 @@ import { j as n, J as A } from "./@vendor-RU8AW1bK.js";
2
2
  import E, { forwardRef as $ } from "react";
3
3
  import L, { getDefaultRegistry as k } from "@rjsf/core";
4
4
  import D from "@rjsf/validator-ajv8";
5
- import { T as y, c as H, a as J, d as w } from "./@code-editor-CQmGGn4U.js";
5
+ import { T as y, c as H, a as J, d as w } from "./@code-editor-D8U5cRhb.js";
6
6
  import M, { components as O } from "react-select";
7
7
  import { getUiOptions as B, getTemplate as I, getSubmitButtonOptions as U, ADDITIONAL_PROPERTY_FLAG as P, errorId as W, englishStringTranslator as V, TranslatableString as q, titleId as K, canExpand as Y, deepEquals as z } from "@rjsf/utils";
8
8
  import { ReactComponent as G } from "./assets/ic-chevron-down.fc70d7a7.svg";
@@ -70,11 +70,30 @@ export declare enum RefVariableStageType {
70
70
  PRE_CI = "PRE_CI",
71
71
  POST_CI = "POST_CI"
72
72
  }
73
+ export interface FilePropertyType {
74
+ allowedExtensions: string[];
75
+ maxUploadSize: number;
76
+ }
77
+ export interface ConstraintType {
78
+ fileProperty: FilePropertyType;
79
+ }
80
+ export interface ValueConstraintType {
81
+ choices?: string[];
82
+ blockCustomValue?: boolean;
83
+ constraint?: ConstraintType;
84
+ }
85
+ export declare enum VariableTypeFormat {
86
+ STRING = "STRING",
87
+ NUMBER = "NUMBER",
88
+ BOOL = "BOOL",
89
+ DATE = "DATE",
90
+ FILE = "FILE"
91
+ }
73
92
  export interface VariableType {
74
93
  id: number;
75
94
  name: string;
76
95
  value: string;
77
- format: string;
96
+ format: VariableTypeFormat;
78
97
  description: string;
79
98
  defaultValue: string;
80
99
  allowEmptyValue: boolean;
@@ -83,6 +102,12 @@ export interface VariableType {
83
102
  refVariableName: string;
84
103
  refVariableStage?: RefVariableStageType;
85
104
  variableStepIndexInPlugin?: number;
105
+ fileMountDir: string;
106
+ fileReferenceId?: number;
107
+ valueConstraintId?: number;
108
+ valueConstraint?: ValueConstraintType;
109
+ isRuntimeArg: boolean;
110
+ refVariableUsed: boolean;
86
111
  }
87
112
  interface CommandArgsMap {
88
113
  command: string;
@@ -1,5 +1,6 @@
1
+ import { MutableRefObject } from 'react';
1
2
  import { RuntimeParamsAPIResponseType, RuntimeParamsListItemType } from '../Shared/types';
2
- import { TeamList, ResponseType, DeploymentNodeType, CDMaterialServiceEnum, CDMaterialServiceQueryParams, CDMaterialResponseType, CDMaterialFilterQuery, EnvironmentListHelmResponse } from './Types';
3
+ import { TeamList, ResponseType, DeploymentNodeType, CDMaterialServiceEnum, CDMaterialServiceQueryParams, CDMaterialResponseType, CDMaterialFilterQuery, EnvironmentListHelmResponse, GlobalVariableOptionType } from './Types';
3
4
  import { ApiResourceType } from '../Pages';
4
5
  export declare const getTeamListMin: () => Promise<TeamList>;
5
6
  interface UserRole extends ResponseType {
@@ -34,4 +35,9 @@ export declare function getWebhookEventsForEventId(eventId: string | number): Pr
34
35
  * @returns URL to the branch in the Git repository
35
36
  */
36
37
  export declare const getGitBranchUrl: (gitUrl: string, branchName: string) => string | null;
38
+ export declare const getGlobalVariables: ({ appId, isCD, abortControllerRef, }: {
39
+ appId: number;
40
+ isCD?: boolean;
41
+ abortControllerRef?: MutableRefObject<AbortController>;
42
+ }) => Promise<GlobalVariableOptionType[]>;
37
43
  export {};
@@ -12,7 +12,6 @@ export declare const DOCUMENTATION: {
12
12
  GLOBAL_CONFIG_BUILD_INFRA: string;
13
13
  };
14
14
  export declare const PATTERNS: {
15
- STRING: RegExp;
16
15
  KUBERNETES_KEY_PREFIX: RegExp;
17
16
  KUBERNETES_KEY_NAME: RegExp;
18
17
  START_END_ALPHANUMERIC: RegExp;
@@ -95,6 +94,8 @@ export declare const ROUTES: {
95
94
  USER_LIST_MIN: string;
96
95
  CONFIG_DATA: string;
97
96
  K8S_RESOURCE_LIST: string;
97
+ FILE_UPLOAD: string;
98
+ PLUGIN_GLOBAL_VARIABLES: string;
98
99
  };
99
100
  export declare enum KEY_VALUE {
100
101
  KEY = "key",
@@ -1,2 +1,2 @@
1
1
  import { ResizableTagTextAreaProps } from './Types';
2
- export declare const ResizableTagTextArea: ({ value, minHeight, maxHeight, dataTestId, onBlur, onFocus, refVar, dependentRef, className, disableOnBlurResizeToMinHeight, ...resProps }: ResizableTagTextAreaProps) => JSX.Element;
2
+ export declare const ResizableTagTextArea: ({ value, minHeight, maxHeight, onBlur, onFocus, refVar, dependentRef, dependentRefs, className, disableOnBlurResizeToMinHeight, id, ...restProps }: ResizableTagTextAreaProps) => JSX.Element;
@@ -5,16 +5,6 @@ export interface SuggestedTagOptionType extends OptionType {
5
5
  description: string;
6
6
  propagate: boolean;
7
7
  }
8
- export declare enum DeploymentPolicy {
9
- ALLOW = "allow",
10
- BLOCK = "block",
11
- BLOCK_PROD = "block-prod",
12
- BLOCK_NON_PROD = "block-non-prod"
13
- }
14
- export interface VariableValueConstraintTypes {
15
- choices?: string[];
16
- blockCustomValue?: boolean;
17
- }
18
8
  export interface TagType {
19
9
  id?: number;
20
10
  key: string;
@@ -26,8 +16,6 @@ export interface TagType {
26
16
  isInvalidValue?: boolean;
27
17
  isSuggested?: boolean;
28
18
  isPropagateDisabled?: boolean;
29
- deploymentPolicy?: DeploymentPolicy;
30
- valueConstraint?: VariableValueConstraintTypes;
31
19
  }
32
20
  export interface TagErrorType {
33
21
  isValid: boolean;
@@ -70,7 +58,7 @@ export interface ResizableTagTextAreaProps extends Omit<DetailedHTMLProps<Textar
70
58
  maxHeight?: number;
71
59
  value: string;
72
60
  refVar?: MutableRefObject<HTMLTextAreaElement>;
73
- dependentRef?: MutableRefObject<HTMLTextAreaElement> | Record<string | number, MutableRefObject<HTMLTextAreaElement>>;
74
- dataTestId?: string;
61
+ dependentRef?: MutableRefObject<HTMLTextAreaElement>;
62
+ dependentRefs?: Record<string | number, MutableRefObject<HTMLTextAreaElement>>;
75
63
  disableOnBlurResizeToMinHeight?: boolean;
76
64
  }
@@ -1,6 +1,6 @@
1
1
  import { default as React, SyntheticEvent } from 'react';
2
2
  import { JSONPathOptions } from 'jsonpath-plus';
3
- import { AsyncOptions, DeploymentNodeType, UseSearchString } from './Types';
3
+ import { AsyncOptions, UseSearchString } from './Types';
4
4
  import { scrollableInterface } from '../Shared';
5
5
  export declare function showError(serverError: any, showToastOnUnknownError?: boolean, hideAccessError?: boolean): void;
6
6
  interface ConditionalWrapper<T> {
@@ -133,5 +133,5 @@ export declare const getSanitizedIframe: (iframeString: string) => string;
133
133
  * This method adds default attributes to iframe - title, loading ="lazy", width="100%", height="100%"
134
134
  */
135
135
  export declare const getIframeWithDefaultAttributes: (iframeString: string, defaultName?: string) => string;
136
- export declare const getStageTitle: (stageType: DeploymentNodeType) => string;
136
+ export declare const getGoLangFormattedDateWithTimezone: (dateFormat: string) => string;
137
137
  export {};
@@ -1,3 +1,3 @@
1
1
  import { default as RJSF } from '@rjsf/core';
2
2
  import { FormProps } from './types';
3
- export declare const RJSFForm: import('react').ForwardRefExoticComponent<Pick<FormProps, "name" | "children" | "className" | "disabled" | "id" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "onError" | "target" | "action" | "tagName" | "autoComplete" | "method" | "noValidate" | "readonly" | "schema" | "uiSchema" | "formContext" | "formData" | "idPrefix" | "idSeparator" | "fields" | "templates" | "widgets" | "translateString" | "acceptcharset" | "acceptCharset" | "enctype" | "customValidate" | "extraErrors" | "extraErrorsBlockSubmit" | "noHtml5Validate" | "liveValidate" | "liveOmit" | "omitExtraData" | "showErrorList" | "transformErrors" | "focusOnFirstError" | "experimental_defaultFormStateBehavior" | "_internalFormWrapper"> & import('react').RefAttributes<RJSF<unknown, import('json-schema').JSONSchema7, import('@rjsf/utils').GenericObjectType>>>;
3
+ export declare const RJSFForm: import('react').ForwardRefExoticComponent<Pick<FormProps, "name" | "id" | "children" | "className" | "disabled" | "onFocus" | "onBlur" | "onChange" | "onSubmit" | "onError" | "target" | "action" | "tagName" | "autoComplete" | "method" | "noValidate" | "readonly" | "schema" | "uiSchema" | "formContext" | "formData" | "idPrefix" | "idSeparator" | "fields" | "templates" | "widgets" | "translateString" | "acceptcharset" | "acceptCharset" | "enctype" | "customValidate" | "extraErrors" | "extraErrorsBlockSubmit" | "noHtml5Validate" | "liveValidate" | "liveOmit" | "omitExtraData" | "showErrorList" | "transformErrors" | "focusOnFirstError" | "experimental_defaultFormStateBehavior" | "_internalFormWrapper"> & import('react').RefAttributes<RJSF<unknown, import('json-schema').JSONSchema7, import('@rjsf/utils').GenericObjectType>>>;
@@ -3,8 +3,8 @@ import { TippyProps } from '@tippyjs/react';
3
3
  import { Placement } from 'tippy.js';
4
4
  import { UserGroupDTO } from '../Pages/GlobalConfigurations';
5
5
  import { ImageComment, ReleaseTag } from './ImageTags.Types';
6
- import { MandatoryPluginBaseStateType, PolicyBlockInfo, RegistryType, RuntimeParamsListItemType, Severity } from '../Shared';
7
- import { ACTION_STATE, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.';
6
+ import { MandatoryPluginBaseStateType, RegistryType, RuntimePluginVariables, Severity } from '../Shared';
7
+ import { ACTION_STATE, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, SortingOrder, TaskErrorObj, VariableTypeFormat } from '.';
8
8
  /**
9
9
  * Generic response type object with support for overriding the result type
10
10
  *
@@ -94,6 +94,7 @@ export interface TippyCustomizedProps extends Pick<TippyProps, 'appendTo'> {
94
94
  documentationLink?: string;
95
95
  documentationLinkText?: string;
96
96
  children: React.ReactElement<any>;
97
+ disableClose?: boolean;
97
98
  }
98
99
  export interface InfoIconTippyProps extends Pick<TippyCustomizedProps, 'heading' | 'infoText' | 'iconClass' | 'documentationLink' | 'documentationLinkText' | 'additionalContent' | 'placement' | 'Icon' | 'headingInfo'> {
99
100
  dataTestid?: string;
@@ -432,10 +433,6 @@ export interface CDMaterialType {
432
433
  * Would currently only be received in case of release
433
434
  */
434
435
  appWorkflowId: number;
435
- /**
436
- * Denotes trigger blocking due to mandatory tags, (might be used for plugins and other features in future)
437
- */
438
- deploymentBlockedState?: PolicyBlockInfo;
439
436
  }
440
437
  export declare enum CDMaterialServiceEnum {
441
438
  ROLLBACK = "rollback",
@@ -472,14 +469,6 @@ export interface DownstreamNodesEnvironmentsType {
472
469
  environmentId: number;
473
470
  environmentName: string;
474
471
  }
475
- export declare enum TriggerBlockType {
476
- MANDATORY_TAG = "mandatory-tags",
477
- MANDATORY_PLUGIN = "mandatory-plugins"
478
- }
479
- export interface TriggerBlockedInfo {
480
- blockedBy: TriggerBlockType;
481
- blockedReason?: string;
482
- }
483
472
  export interface CommonNodeAttr extends Pick<MandatoryPluginBaseStateType, 'isTriggerBlocked' | 'pluginBlockState'> {
484
473
  connectingCiPipelineId?: number;
485
474
  parents: string | number[] | string[];
@@ -542,7 +531,6 @@ export interface CommonNodeAttr extends Pick<MandatoryPluginBaseStateType, 'isTr
542
531
  downstreamEnvironments?: DownstreamNodesEnvironmentsType[];
543
532
  cipipelineId?: number;
544
533
  isDeploymentBlocked?: boolean;
545
- triggerBlockedInfo?: TriggerBlockedInfo;
546
534
  }
547
535
  export declare enum DeploymentAppTypes {
548
536
  HELM = "helm",
@@ -605,8 +593,7 @@ export interface CDMaterialsMetaInfo {
605
593
  * This is the ID of user that has request the material
606
594
  */
607
595
  requestedUserId: number;
608
- runtimeParams: RuntimeParamsListItemType[];
609
- deploymentBlockedState?: PolicyBlockInfo;
596
+ runtimeParams: RuntimePluginVariables[];
610
597
  }
611
598
  export interface ImagePromotionMaterialInfo {
612
599
  isApprovalPendingForPromotion: boolean;
@@ -689,7 +676,6 @@ export interface CDStage {
689
676
  name: string;
690
677
  triggerType: 'AUTOMATIC' | 'MANUAL';
691
678
  config: string;
692
- triggerBlockedInfo?: TriggerBlockedInfo;
693
679
  }
694
680
  export interface CDStageConfigMapSecretNames {
695
681
  configMaps: any[];
@@ -701,7 +687,6 @@ export interface PrePostDeployStageType extends MandatoryPluginBaseStateType {
701
687
  triggerType: string;
702
688
  name: string;
703
689
  status: string;
704
- triggerBlockedInfo?: TriggerBlockedInfo;
705
690
  }
706
691
  export interface CdPipeline {
707
692
  id: number;
@@ -735,8 +720,6 @@ export interface CdPipeline {
735
720
  isProdEnv?: boolean;
736
721
  isGitOpsRepoNotConfigured?: boolean;
737
722
  isDeploymentBlocked?: boolean;
738
- isTriggerBlocked?: boolean;
739
- triggerBlockedInfo?: TriggerBlockedInfo;
740
723
  }
741
724
  export interface ExternalCiConfig {
742
725
  id: number;
@@ -889,4 +872,14 @@ export interface WidgetEventDetails {
889
872
  age: string;
890
873
  lastSeen: string;
891
874
  }
875
+ export interface GlobalVariableDTO {
876
+ name: string;
877
+ format: VariableTypeFormat;
878
+ description: string;
879
+ stageType: 'cd' | 'post-cd' | 'ci';
880
+ }
881
+ export type GlobalVariableOptionType = Omit<GlobalVariableDTO, 'name'> & {
882
+ label: string;
883
+ value: string;
884
+ };
892
885
  export {};
@@ -1 +1,2 @@
1
1
  export * from './types';
2
+ export * from './services';
@@ -0,0 +1,7 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { UploadFileDTO, UploadFileProps } from '../../../../../Shared/types';
3
+ export declare const uploadCDPipelineFile: ({ file, appId, envId, allowedExtensions, maxUploadSize, abortControllerRef, }: UploadFileProps & {
4
+ appId: number;
5
+ envId: number;
6
+ abortControllerRef?: MutableRefObject<AbortController>;
7
+ }) => Promise<UploadFileDTO>;
@@ -0,0 +1 @@
1
+ export declare const SystemVariableIcon: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './SystemVariableIcon';
@@ -0,0 +1,3 @@
1
+ import { SelectPickerOptionType } from '../../../../../Shared/Components';
2
+ export declare const IO_VARIABLES_VALUE_COLUMN_BOOL_OPTIONS: SelectPickerOptionType<string>[];
3
+ export declare const IO_VARIABLES_VALUE_COLUMN_DATE_OPTIONS: SelectPickerOptionType<string>[];
@@ -0,0 +1,3 @@
1
+ export * from './services';
2
+ export * from './constants';
3
+ export * from './components';
@@ -0,0 +1,11 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { UploadFileDTO } from '../../../../../Shared/types';
3
+ export declare const uploadCIPipelineFile: ({ file, appId, ciPipelineId, envId, allowedExtensions, maxUploadSize, abortControllerRef, }: {
4
+ file: File[];
5
+ appId: number;
6
+ ciPipelineId: number;
7
+ envId?: number;
8
+ allowedExtensions?: string[];
9
+ maxUploadSize?: number;
10
+ abortControllerRef?: MutableRefObject<AbortController>;
11
+ }) => Promise<UploadFileDTO>;
@@ -1,2 +1,3 @@
1
1
  export * from './AppConfigurations';
2
2
  export * from './CDPipeline';
3
+ export * from './CIPipeline';
@@ -1,2 +1,2 @@
1
1
  import { DynamicDataTableProps } from './types';
2
- export declare const DynamicDataTable: <K extends string>({ headers, ...props }: DynamicDataTableProps<K>) => JSX.Element;
2
+ export declare const DynamicDataTable: <K extends string, CustomStateType = Record<string, unknown>>({ headers, ...props }: DynamicDataTableProps<K, CustomStateType>) => JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { DynamicDataTableHeaderProps } from './types';
2
- export declare const DynamicDataTableHeader: <K extends string>({ headers, rows, sortingConfig, onRowAdd, readOnly, isAdditionNotAllowed, isDeletionNotAllowed, headerComponent, actionButtonConfig, }: DynamicDataTableHeaderProps<K>) => JSX.Element;
2
+ export declare const DynamicDataTableHeader: <K extends string, CustomStateType = Record<string, unknown>>({ headers, rows, sortingConfig, onRowAdd, readOnly, isAdditionNotAllowed, isDeletionNotAllowed, headerComponent, actionButtonConfig, }: DynamicDataTableHeaderProps<K, CustomStateType>) => JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { DynamicDataTableRowProps } from './types';
2
- export declare const DynamicDataTableRow: <K extends string>({ rows, headers, maskValue, readOnly, isAdditionNotAllowed, isDeletionNotAllowed, validationSchema, showError, actionButtonConfig, onRowEdit, onRowDelete, leadingCellIcon, trailingCellIcon, buttonCellWrapComponent, }: DynamicDataTableRowProps<K>) => JSX.Element;
2
+ export declare const DynamicDataTableRow: <K extends string, CustomStateType = Record<string, unknown>>({ rows, headers, readOnly, isDeletionNotAllowed, validationSchema, showError, actionButtonConfig, onRowEdit, onRowDelete, leadingCellIcon, trailingCellIcon, buttonCellWrapComponent, }: DynamicDataTableRowProps<K, CustomStateType>) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare const ACTION_BUTTON_DEFAULT_WIDTH = "33px";
2
+ export declare const DELETE_BUTTON_WIDTH = "33px";
@@ -1,9 +1,10 @@
1
1
  import { DetailedHTMLProps, ReactElement, ReactNode } from 'react';
2
- import { SortingOrder } from '../../../Common/Constants';
3
2
  import { ResizableTagTextAreaProps } from '../../../Common/CustomTagSelector';
4
- import { InfoIconTippyProps } from '../../../Common/Types';
3
+ import { UseStateFiltersReturnType } from '../../../Common/Hooks';
4
+ import { TooltipProps } from '@Common/Tooltip/types';
5
5
  import { SelectPickerOptionType, SelectPickerProps } from '../SelectPicker';
6
6
  import { SelectTextAreaProps } from '../SelectTextArea';
7
+ import { FileUploadProps } from '../FileUpload';
7
8
  /**
8
9
  * Interface representing header for a dynamic data table.
9
10
  * @template K - A string representing the key type.
@@ -19,17 +20,16 @@ export type DynamicDataTableHeaderType<K extends string> = {
19
20
  isSortable?: boolean;
20
21
  /** An optional boolean to control the visibility of the column. */
21
22
  isHidden?: boolean;
22
- /** An optional boolean to show the column */
23
- renderHelpTextForHeader?: () => ReactNode;
24
23
  };
25
24
  export declare enum DynamicDataTableRowDataType {
26
25
  TEXT = "text",
27
26
  DROPDOWN = "dropdown",
28
27
  SELECT_TEXT = "select-text",
29
- BUTTON = "button"
28
+ BUTTON = "button",
29
+ FILE_UPLOAD = "file-upload"
30
30
  }
31
31
  export type DynamicDataTableCellPropsMap = {
32
- [DynamicDataTableRowDataType.TEXT]: Omit<ResizableTagTextAreaProps, 'className' | 'minHeight' | 'maxHeight' | 'value' | 'onChange' | 'disabled' | 'disableOnBlurResizeToMinHeight' | 'refVar' | 'dependentRef'>;
32
+ [DynamicDataTableRowDataType.TEXT]: Omit<ResizableTagTextAreaProps, 'id' | 'className' | 'minHeight' | 'maxHeight' | 'value' | 'onChange' | 'disabled' | 'disableOnBlurResizeToMinHeight' | 'refVar' | 'dependentRef'>;
33
33
  [DynamicDataTableRowDataType.DROPDOWN]: Omit<SelectPickerProps<string, false>, 'inputId' | 'value' | 'onChange' | 'fullWidth' | 'isDisabled'>;
34
34
  [DynamicDataTableRowDataType.SELECT_TEXT]: Omit<SelectTextAreaProps, 'value' | 'onChange' | 'inputId' | 'isDisabled' | 'dependentRef' | 'refVar' | 'textAreaProps'> & {
35
35
  textAreaProps?: Omit<SelectTextAreaProps['textAreaProps'], 'className' | 'disableOnBlurResizeToMinHeight' | 'minHeight' | 'maxHeight'>;
@@ -38,6 +38,7 @@ export type DynamicDataTableCellPropsMap = {
38
38
  icon?: ReactNode;
39
39
  text: string;
40
40
  };
41
+ [DynamicDataTableRowDataType.FILE_UPLOAD]: Omit<FileUploadProps, 'className' | 'fileName' | 'onUpload' | 'multiple'>;
41
42
  };
42
43
  type DynamicDataTableCellData<T extends keyof DynamicDataTableCellPropsMap = keyof DynamicDataTableCellPropsMap> = T extends keyof DynamicDataTableCellPropsMap ? {
43
44
  type: T;
@@ -54,23 +55,24 @@ export type DynamicDataTableRowType<K extends string, CustomStateType = Record<s
54
55
  disabled?: boolean;
55
56
  /** An optional boolean indicating if an asterisk should be shown. */
56
57
  required?: boolean;
58
+ /** An optional tooltip to show when hovering over cell. */
59
+ tooltip?: Partial<Pick<TooltipProps, 'content' | 'className'>>;
57
60
  } & DynamicDataTableCellData;
58
61
  };
59
62
  id: string | number;
60
63
  /** */
61
64
  customState?: CustomStateType;
65
+ /** An optional boolean indicating if row deletion is disabled. */
66
+ disableDelete?: boolean;
62
67
  };
63
- type DynamicDataTableMask<K extends string> = {
64
- [key in K]?: boolean;
65
- };
66
- type DynamicDataTableCellIcon<K extends string> = {
67
- [key in K]?: (row: DynamicDataTableRowType<K>) => ReactNode;
68
+ type DynamicDataTableCellIcon<K extends string, CustomStateType = Record<string, unknown>> = {
69
+ [key in K]?: (row: DynamicDataTableRowType<K, CustomStateType>) => ReactNode;
68
70
  };
69
71
  /**
70
72
  * Interface representing the properties for the dynamic data table component.
71
73
  * @template K - A string representing the key type.
72
74
  */
73
- export type DynamicDataTableProps<K extends string> = {
75
+ export type DynamicDataTableProps<K extends string, CustomStateType = Record<string, unknown>> = {
74
76
  /**
75
77
  * An array containing the headers for the data table. \
76
78
  * Each header defines a column with its label, key, width, and optional settings.
@@ -79,21 +81,15 @@ export type DynamicDataTableProps<K extends string> = {
79
81
  /**
80
82
  * An array of rows where each row contains data corresponding to the table headers.
81
83
  */
82
- rows: DynamicDataTableRowType<K>[];
84
+ rows: DynamicDataTableRowType<K, CustomStateType>[];
83
85
  /** Optional configuration for sorting the table. */
84
- sortingConfig?: {
85
- sortBy: K;
86
- sortOrder: SortingOrder;
87
- handleSorting: () => void;
88
- };
89
- /** An optional mask to hide the values of the cell. */
90
- maskValue?: DynamicDataTableMask<K>;
86
+ sortingConfig?: Pick<UseStateFiltersReturnType<K>, 'sortBy' | 'sortOrder' | 'handleSorting'>;
91
87
  /** Optional configuration for displaying an icon in the leading position of a cell. */
92
- leadingCellIcon?: DynamicDataTableCellIcon<K>;
88
+ leadingCellIcon?: DynamicDataTableCellIcon<K, CustomStateType>;
93
89
  /** Optional configuration for displaying an icon in the trailing position of a cell. */
94
- trailingCellIcon?: DynamicDataTableCellIcon<K>;
90
+ trailingCellIcon?: DynamicDataTableCellIcon<K, CustomStateType>;
95
91
  /** An optional function to render a custom wrapper component for the type `DynamicDataTableRowDataType.BUTTON`. */
96
- buttonCellWrapComponent?: (row: DynamicDataTableRowType<K>) => ReactElement;
92
+ buttonCellWrapComponent?: (row: DynamicDataTableRowType<K, CustomStateType>) => ReactElement;
97
93
  /** An optional React node for a custom header component. */
98
94
  headerComponent?: ReactNode;
99
95
  /** When true, data addition field will not be shown. */
@@ -111,14 +107,15 @@ export type DynamicDataTableProps<K extends string> = {
111
107
  * @param value - The value of the cell.
112
108
  * @param extraData - Additional data, such as a selected value for dropdowns.
113
109
  */
114
- onRowEdit: (row: DynamicDataTableRowType<K>, headerKey: K, value: string, extraData: {
110
+ onRowEdit: (row: DynamicDataTableRowType<K, CustomStateType>, headerKey: K, value: string, extraData: {
111
+ files?: File[];
115
112
  selectedValue?: SelectPickerOptionType<string>;
116
113
  }) => void;
117
114
  /**
118
115
  * Function to handle row deletions.
119
116
  * @param row - The row that was deleted.
120
117
  */
121
- onRowDelete: (row: DynamicDataTableRowType<K>) => void;
118
+ onRowDelete: (row: DynamicDataTableRowType<K, CustomStateType>) => void;
122
119
  /** Optional configuration for rendering a custom action button in a row. */
123
120
  actionButtonConfig?: {
124
121
  /**
@@ -126,14 +123,14 @@ export type DynamicDataTableProps<K extends string> = {
126
123
  * @param row - The current row being rendered.
127
124
  * @returns A React node representing the action button.
128
125
  */
129
- renderer: (row: DynamicDataTableRowType<K>) => ReactNode;
126
+ renderer: (row: DynamicDataTableRowType<K, CustomStateType>) => ReactNode;
130
127
  /**
131
128
  * This represents under which header key the action button will be rendered.
132
129
  */
133
130
  key: K;
134
131
  /**
135
132
  * The width of the action button.
136
- * @default '32px'
133
+ * @default '33px'
137
134
  */
138
135
  width?: string;
139
136
  /**
@@ -153,13 +150,13 @@ export type DynamicDataTableProps<K extends string> = {
153
150
  * @param row - The row containing the cell.
154
151
  * @returns An object with a boolean indicating validity and an array of error messages.
155
152
  */
156
- validationSchema?: (value: string, key: K, row: DynamicDataTableRowType<K>) => {
153
+ validationSchema?: (value: string, key: K, row: DynamicDataTableRowType<K, CustomStateType>) => {
157
154
  isValid: boolean;
158
155
  errorMessages: string[];
159
156
  };
160
157
  };
161
- export interface DynamicDataTableHeaderProps<K extends string> extends Pick<DynamicDataTableProps<K>, 'headers' | 'rows' | 'headerComponent' | 'sortingConfig' | 'onRowAdd' | 'readOnly' | 'isAdditionNotAllowed' | 'isDeletionNotAllowed' | 'actionButtonConfig'>, Pick<InfoIconTippyProps, 'heading' | 'additionalContent'> {
158
+ export interface DynamicDataTableHeaderProps<K extends string, CustomStateType = Record<string, unknown>> extends Pick<DynamicDataTableProps<K, CustomStateType>, 'headers' | 'rows' | 'headerComponent' | 'sortingConfig' | 'onRowAdd' | 'readOnly' | 'isAdditionNotAllowed' | 'isDeletionNotAllowed' | 'actionButtonConfig'> {
162
159
  }
163
- export interface DynamicDataTableRowProps<K extends string> extends Pick<DynamicDataTableProps<K>, 'rows' | 'headers' | 'maskValue' | 'isAdditionNotAllowed' | 'isDeletionNotAllowed' | 'readOnly' | 'onRowEdit' | 'onRowDelete' | 'actionButtonConfig' | 'showError' | 'validationSchema' | 'leadingCellIcon' | 'trailingCellIcon' | 'buttonCellWrapComponent'> {
160
+ export interface DynamicDataTableRowProps<K extends string, CustomStateType = Record<string, unknown>> extends Pick<DynamicDataTableProps<K, CustomStateType>, 'rows' | 'headers' | 'isAdditionNotAllowed' | 'isDeletionNotAllowed' | 'readOnly' | 'onRowEdit' | 'onRowDelete' | 'actionButtonConfig' | 'showError' | 'validationSchema' | 'leadingCellIcon' | 'trailingCellIcon' | 'buttonCellWrapComponent'> {
164
161
  }
165
162
  export {};
@@ -1,5 +1,5 @@
1
1
  import { DynamicDataTableHeaderType, DynamicDataTableProps, DynamicDataTableRowDataType } from './types';
2
- export declare const getActionButtonPosition: <K extends string>({ headers, actionButtonConfig, }: Pick<DynamicDataTableProps<K>, "headers" | "actionButtonConfig">) => number;
3
- export declare const getHeaderGridTemplateColumn: <K extends string>(headers: DynamicDataTableHeaderType<K>[], actionButtonConfig: DynamicDataTableProps<K>["actionButtonConfig"], noDeleteBtn: boolean) => string;
4
- export declare const getRowGridTemplateColumn: <K extends string>(headers: DynamicDataTableHeaderType<K>[], actionButtonConfig: DynamicDataTableProps<K>["actionButtonConfig"], noDeleteBtn: boolean) => string;
2
+ export declare const getActionButtonPosition: <K extends string, CustomStateType = Record<string, unknown>>({ headers, actionButtonConfig, }: Pick<DynamicDataTableProps<K, CustomStateType>, "headers" | "actionButtonConfig">) => number;
3
+ export declare const getHeaderGridTemplateColumn: <K extends string, CustomStateType = Record<string, unknown>>(headers: DynamicDataTableHeaderType<K>[], actionButtonConfig: DynamicDataTableProps<K, CustomStateType>["actionButtonConfig"], noDeleteBtn: boolean) => string;
4
+ export declare const getRowGridTemplateColumn: <K extends string, CustomStateType = Record<string, unknown>>(headers: DynamicDataTableHeaderType<K>[], actionButtonConfig: DynamicDataTableProps<K, CustomStateType>["actionButtonConfig"], noDeleteBtn: boolean) => string;
5
5
  export declare const rowTypeHasInputField: (type: DynamicDataTableRowDataType) => boolean;
@@ -0,0 +1,2 @@
1
+ import { FileUploadProps } from './types';
2
+ export declare const FileUpload: ({ label, fileName, multiple, fileTypes, onUpload }: FileUploadProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './FileUpload';
2
+ export * from './types';
@@ -0,0 +1,7 @@
1
+ export interface FileUploadProps {
2
+ fileName: string;
3
+ onUpload: (files: File[]) => void;
4
+ multiple?: boolean;
5
+ label?: string;
6
+ fileTypes?: string[];
7
+ }
@@ -18,7 +18,7 @@ export interface KeyValueHeader<K extends string> {
18
18
  */
19
19
  export type KeyValueRow<K extends string> = {
20
20
  data: {
21
- [key in K]: Pick<ResizableTagTextAreaProps, 'value' | 'dataTestId' | 'disabled' | 'tabIndex'> & {
21
+ [key in K]: Pick<ResizableTagTextAreaProps, 'value' | 'disabled' | 'tabIndex'> & {
22
22
  /** An optional boolean indicating if an asterisk should be shown. */
23
23
  required?: boolean;
24
24
  };
@@ -24,10 +24,6 @@ export interface SelectPickerOptionType<OptionValue = string | number> extends O
24
24
  tooltipProps?: Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate' | 'shortcutKeyCombo'> | (Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate' | 'content'> & Required<Pick<TooltipProps, 'shortcutKeyCombo'>>);
25
25
  }
26
26
  type SelectProps<OptionValue, IsMulti extends boolean> = ReactSelectProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>;
27
- export declare enum SelectPickerVariantType {
28
- DEFAULT = "default",
29
- BORDER_LESS = "border-less"
30
- }
31
27
  declare module 'react-select/base' {
32
28
  interface Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
33
29
  /**
@@ -59,9 +55,12 @@ declare module 'react-select/base' {
59
55
  * @default 'true'
60
56
  */
61
57
  showSelectedOptionIcon?: boolean;
62
- variant?: SelectPickerVariantType;
63
58
  }
64
59
  }
60
+ export declare enum SelectPickerVariantType {
61
+ DEFAULT = "default",
62
+ BORDER_LESS = "border-less"
63
+ }
65
64
  export type SelectPickerProps<OptionValue = number | string, IsMulti extends boolean = false> = Pick<SelectProps<OptionValue, IsMulti>, 'name' | 'classNamePrefix' | 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder' | 'menuPosition' | 'getOptionLabel' | 'getOptionValue' | 'isOptionSelected' | 'menuIsOpen' | 'onMenuOpen' | 'onMenuClose' | 'autoFocus' | 'onBlur' | 'onKeyDown' | 'formatOptionLabel' | 'onInputChange' | 'inputValue'> & Partial<Pick<SelectProps<OptionValue, IsMulti>, 'renderMenuListFooter' | 'shouldRenderCustomOptions' | 'renderCustomOptions' | 'icon' | 'showSelectedOptionIcon'>> & Required<Pick<SelectProps<OptionValue, IsMulti>, 'inputId'>> & Partial<Pick<CreatableProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>, 'onCreateOption'>> & {
66
65
  /**
67
66
  * Error message for the select
@@ -1,2 +1,2 @@
1
1
  import { SelectTextAreaProps } from './types';
2
- export declare const SelectTextArea: ({ value, Icon, onChange, options, inputId, placeholder, refVar, dependentRef, disabled, selectPickerProps, textAreaProps, }: SelectTextAreaProps) => JSX.Element;
2
+ export declare const SelectTextArea: ({ value, Icon, onChange, options, inputId, placeholder, refVar, dependentRefs, disabled, selectPickerProps, textAreaProps, }: SelectTextAreaProps) => JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ResizableTagTextAreaProps } from '../../../Common/CustomTagSelector';
3
3
  import { SelectPickerOptionType, SelectPickerProps } from '../SelectPicker';
4
- export type SelectTextAreaProps = Pick<SelectPickerProps<string, false>, 'inputId' | 'options'> & Pick<ResizableTagTextAreaProps, 'refVar' | 'dependentRef'> & {
4
+ export type SelectTextAreaProps = Pick<SelectPickerProps<string, false>, 'inputId' | 'options'> & Pick<ResizableTagTextAreaProps, 'refVar' | 'dependentRefs'> & {
5
5
  value: string;
6
6
  Icon?: ReactElement;
7
7
  onChange?: (selectedValue: SelectPickerOptionType<string>) => void;
@@ -44,4 +44,4 @@ export * from './InvalidYAMLTippy';
44
44
  export * from './ConfirmationModal';
45
45
  export * from './DiffViewer';
46
46
  export * from './DynamicDataTable';
47
- export * from './TagsKeyValueTable';
47
+ export * from './FileUpload';