@devtron-labs/devtron-fe-common-lib 1.12.0-pre-0-beta-1 → 1.12.0-pre-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.
@@ -1,7 +1,7 @@
1
1
  import { j as n, av as y, ax as k, aw as W } from "./@vendor-SjXFleuT.js";
2
2
  import V, { forwardRef as J, useMemo as P } from "react";
3
3
  import K, { getDefaultRegistry as q } from "@rjsf/core";
4
- import { T as F, j as N, c as v, b as S, a as Y, i as z, d as w, e as E, S as G } from "./@code-editor-DieGT18L.js";
4
+ import { T as F, j as N, c as v, b as S, a as Y, i as z, d as w, e as E, S as G } from "./@code-editor-zI9gkFRk.js";
5
5
  import Q, { components as D } from "react-select";
6
6
  import { ReactComponent as X } from "./assets/ic-chevron-down.fc70d7a7.svg";
7
7
  import { getUiOptions as B, getTemplate as $, getSubmitButtonOptions as Z, ADDITIONAL_PROPERTY_FLAG as L, errorId as ee, englishStringTranslator as te, TranslatableString as ne, titleId as re, canExpand as se, deepEquals as ae } from "@rjsf/utils";
@@ -1,4 +1,4 @@
1
- import { DynamicDataTableCellValidationState } from '../Shared/Components';
1
+ import { DynamicDataTableCellValidationState, KeyValueTableData } from '../Shared/Components';
2
2
  export interface MaterialType {
3
3
  name: string;
4
4
  type: string;
@@ -123,7 +123,7 @@ export interface PortMapType {
123
123
  portOnLocal: number;
124
124
  portOnContainer: number;
125
125
  }
126
- interface ConditionDetails {
126
+ export interface ConditionDetails {
127
127
  id: number;
128
128
  conditionOnVariable: string;
129
129
  conditionOperator: string;
@@ -220,10 +220,7 @@ export declare enum WORKFLOW_CACHE_CONFIG_ENUM {
220
220
  }
221
221
  export interface FormType {
222
222
  name: string;
223
- args: {
224
- key: string;
225
- value: string;
226
- }[];
223
+ args: KeyValueTableData[];
227
224
  materials: MaterialType[];
228
225
  gitHost: Githost;
229
226
  webhookEvents: WebhookEvent[];
@@ -271,22 +268,26 @@ export declare enum InputOutputVariablesHeaderKeys {
271
268
  FORMAT = "format",
272
269
  VALUE = "val"
273
270
  }
274
- export type InputOutputVariablesErrorObj = Record<InputOutputVariablesHeaderKeys, DynamicDataTableCellValidationState>;
271
+ export declare enum ConditionDataTableHeaderKeys {
272
+ VARIABLE = "variable",
273
+ OPERATOR = "operator",
274
+ VALUE = "val"
275
+ }
276
+ type InputOutputVariablesErrorObj = Record<InputOutputVariablesHeaderKeys, DynamicDataTableCellValidationState>;
277
+ type ConditionDetailsErrorObj = Record<ConditionDataTableHeaderKeys, DynamicDataTableCellValidationState>;
278
+ interface StepDetailTaskErrorObj {
279
+ inputVariables?: Record<number, InputOutputVariablesErrorObj>;
280
+ outputVariables?: Record<number, InputOutputVariablesErrorObj>;
281
+ isInputVariablesValid?: boolean;
282
+ isOutputVariablesValid?: boolean;
283
+ conditionDetails?: Record<number, ConditionDetailsErrorObj>;
284
+ isConditionDetailsValid?: boolean;
285
+ }
275
286
  export interface TaskErrorObj {
276
287
  isValid: boolean;
277
288
  name: ErrorObj;
278
- inlineStepDetail?: {
279
- inputVariables?: Record<number, InputOutputVariablesErrorObj>;
280
- outputVariables?: Record<number, InputOutputVariablesErrorObj>;
281
- isInputVariablesValid?: boolean;
282
- isOutputVariablesValid?: boolean;
283
- };
284
- pluginRefStepDetail?: {
285
- inputVariables?: Record<number, InputOutputVariablesErrorObj>;
286
- outputVariables?: Record<number, InputOutputVariablesErrorObj>;
287
- isInputVariablesValid?: boolean;
288
- isOutputVariablesValid?: boolean;
289
- };
289
+ inlineStepDetail?: StepDetailTaskErrorObj;
290
+ pluginRefStepDetail?: StepDetailTaskErrorObj;
290
291
  }
291
292
  export interface FormErrorObjectType {
292
293
  name: ErrorObj;
@@ -1,6 +1,6 @@
1
1
  import { MutableRefObject } from 'react';
2
2
  import { RuntimeParamsAPIResponseType, RuntimePluginVariables } from '../Shared/types';
3
- import { TeamList, ResponseType, DeploymentNodeType, CDMaterialServiceEnum, CDMaterialServiceQueryParams, CDMaterialResponseType, CDMaterialFilterQuery, EnvironmentListHelmResponse, UserApprovalMetadataType, GlobalVariableOptionType, UserRole, EnvAppsMetaDTO, GetAppsInfoForEnvProps } from './Types';
3
+ import { TeamList, ResponseType, DeploymentNodeType, CDMaterialServiceEnum, CDMaterialServiceQueryParams, CDMaterialResponseType, CDMaterialFilterQuery, EnvironmentListHelmResponse, UserApprovalMetadataType, GlobalVariableOptionType, UserRole } from './Types';
4
4
  import { ApiResourceType } from '../Pages';
5
5
  export declare const getTeamListMin: () => Promise<TeamList>;
6
6
  export declare const SourceTypeMap: {
@@ -35,4 +35,3 @@ export declare const getGlobalVariables: ({ appId, isCD, abortControllerRef, }:
35
35
  isCD?: boolean;
36
36
  abortControllerRef?: MutableRefObject<AbortController>;
37
37
  }) => Promise<GlobalVariableOptionType[]>;
38
- export declare const getAppsInfoForEnv: ({ envId, appIds }: GetAppsInfoForEnvProps) => Promise<EnvAppsMetaDTO>;
@@ -133,8 +133,6 @@ export declare const ROUTES: {
133
133
  readonly ENVIRONMENT_DATA: "global/environment-variables";
134
134
  readonly DASHBOARD_EVENT: "dashboard-event";
135
135
  readonly LICENSE_DATA: "license/data";
136
- readonly ENV: "env";
137
- readonly APP_METADATA: "app-metadata";
138
136
  };
139
137
  export declare enum KEY_VALUE {
140
138
  KEY = "key",
@@ -1,6 +1,6 @@
1
1
  import { ShortcutType } from './types';
2
2
  export declare const preprocessKeys: (keys: ShortcutType["keys"]) => {
3
- keys: ("Alt" | "F" | "E" | "R" | "K" | "X" | "A" | "Home" | "End" | "." | "Space" | "Control" | "Shift" | "Meta" | "Escape" | "Enter" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "ArrowDown" | "PageUp" | "PageDown" | "Backspace" | "Delete")[];
3
+ keys: ("R" | "Alt" | "F" | "E" | "K" | "X" | "A" | "Home" | "End" | "." | "Space" | "Control" | "Shift" | "Meta" | "Escape" | "Enter" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "ArrowDown" | "PageUp" | "PageDown" | "Backspace" | "Delete")[];
4
4
  id: string;
5
5
  };
6
6
  export declare const verifyCallbackStack: (stack: ShortcutType["callbackStack"]) => void;
@@ -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, "children" | "id" | "className" | "disabled" | "onChange" | "name" | "target" | "onFocus" | "onBlur" | "onSubmit" | "onError" | "autoComplete" | "action" | "method" | "tagName" | "noValidate" | "readonly" | "uiSchema" | "schema" | "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<any, import('./types').RJSFFormSchema, any>>>;
3
+ export declare const RJSFForm: import('react').ForwardRefExoticComponent<Pick<FormProps, "name" | "id" | "children" | "disabled" | "className" | "onChange" | "target" | "onFocus" | "onBlur" | "onSubmit" | "onError" | "autoComplete" | "action" | "method" | "tagName" | "noValidate" | "readonly" | "uiSchema" | "schema" | "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<any, import('./types').RJSFFormSchema, any>>>;
@@ -2,7 +2,7 @@ import { default as React, ReactNode, CSSProperties, ReactElement, MutableRefObj
2
2
  import { TippyProps } from '@tippyjs/react';
3
3
  import { UserGroupDTO } from '../Pages/GlobalConfigurations';
4
4
  import { ImageComment, ReleaseTag } from './ImageTags.Types';
5
- import { MandatoryPluginBaseStateType, RegistryType, RuntimePluginVariables, Severity, PolicyBlockInfo, TargetPlatformItemDTO, ButtonProps, ComponentLayoutType, StatusType } from '../Shared';
5
+ import { MandatoryPluginBaseStateType, RegistryType, RuntimePluginVariables, Severity, PolicyBlockInfo, TargetPlatformItemDTO, ButtonProps, ComponentLayoutType } from '../Shared';
6
6
  import { ACTION_STATE, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, RefVariableType, SortingOrder, TaskErrorObj, VariableTypeFormat } from '.';
7
7
  /**
8
8
  * Generic response type object with support for overriding the result type
@@ -949,17 +949,4 @@ export declare enum ActionTypes {
949
949
  EDIT = "edit",
950
950
  APPROVER = "approver"
951
951
  }
952
- export interface GetAppsInfoForEnvProps {
953
- envId: number;
954
- appIds?: number[];
955
- }
956
- export interface AppMeta {
957
- appId: number;
958
- appStatus: StatusType;
959
- appName: string;
960
- }
961
- export interface EnvAppsMetaDTO {
962
- appCount: number;
963
- apps: AppMeta[];
964
- }
965
952
  export {};
@@ -1,4 +1,4 @@
1
- import { CMSecretYamlData } from '../../Services';
1
+ import { KeyValueTableData } from '../KeyValueTable';
2
2
  import { ConfigMapSecretDataTypeOptionType } from './types';
3
3
  export declare const CONFIG_MAP_SECRET_YAML_PARSE_ERROR = "Please provide valid YAML";
4
4
  export declare const SECRET_TOAST_INFO: {
@@ -10,7 +10,7 @@ export declare const SECRET_TOAST_INFO: {
10
10
  BOTH_ESO_DATA_AND_DATA_FROM_UNAVAILABLE: string;
11
11
  };
12
12
  export declare const configMapDataTypeOptions: ConfigMapSecretDataTypeOptionType[];
13
- export declare const CONFIG_MAP_SECRET_DEFAULT_CURRENT_DATA: CMSecretYamlData[];
13
+ export declare const CONFIG_MAP_SECRET_DEFAULT_CURRENT_DATA: KeyValueTableData[];
14
14
  export declare const configMapSecretMountDataMap: {
15
15
  environment: {
16
16
  title: string;
@@ -1,8 +1,9 @@
1
1
  import { GroupBase, OptionsOrGroups } from 'react-select';
2
- import { CMSecretPayloadType, CMSecretYamlData, ConfigMapSecretUseFormProps, ESOSecretData, GetConfigMapSecretFormInitialValuesParamsType } from '../../Services';
2
+ import { CMSecretPayloadType, ConfigMapSecretUseFormProps, ESOSecretData, GetConfigMapSecretFormInitialValuesParamsType } from '../../Services';
3
+ import { KeyValueTableData } from '../KeyValueTable';
3
4
  import { ConfigMapSecretDataTypeOptionType, GetConfigMapSecretReadOnlyValuesParamsType } from './types';
4
5
  export declare const getSecretDataTypeOptions: (isJob: boolean, isHashiOrAWS: boolean) => ConfigMapSecretDataTypeOptionType[] | OptionsOrGroups<ConfigMapSecretDataTypeOptionType, GroupBase<ConfigMapSecretDataTypeOptionType>>;
5
- export declare const convertKeyValuePairToYAML: (currentData: CMSecretYamlData[]) => string;
6
+ export declare const convertKeyValuePairToYAML: (currentData: KeyValueTableData[]) => string;
6
7
  export declare const getConfigMapSecretFormInitialValues: ({ isJob, configMapSecretData, cmSecretStateLabel, componentType, skipValidation, fallbackMergeStrategy, }: GetConfigMapSecretFormInitialValuesParamsType) => ConfigMapSecretUseFormProps;
7
8
  export declare const getConfigMapSecretReadOnlyValues: ({ configMapSecretData, cmSecretStateLabel, componentType, isJob, fallbackMergeStrategy, displayKeys, }: GetConfigMapSecretReadOnlyValuesParamsType) => {
8
9
  configData: {
@@ -12,6 +13,6 @@ export declare const getConfigMapSecretReadOnlyValues: ({ configMapSecretData, c
12
13
  }[];
13
14
  data: string;
14
15
  };
15
- export declare const convertYAMLToKeyValuePair: (yaml: string) => CMSecretYamlData[];
16
+ export declare const convertYAMLToKeyValuePair: (yaml: string) => KeyValueTableData[];
16
17
  export declare const getESOSecretDataFromYAML: (yaml: string) => ESOSecretData;
17
18
  export declare const getConfigMapSecretPayload: ({ isSecret, external, externalType, externalSubpathValues, yaml, yamlMode, currentData, esoSecretYaml, filePermission, name, selectedType, isFilePermissionChecked, roleARN, volumeMountPath, isSubPathChecked, mergeStrategy, }: ConfigMapSecretUseFormProps) => CMSecretPayloadType;
@@ -1,2 +1,2 @@
1
1
  import { DynamicDataTableHeaderProps } from './types';
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;
2
+ export declare const DynamicDataTableHeader: <K extends string, CustomStateType = Record<string, unknown>>({ headers, rows, sortingConfig, addBtnTooltip, onRowAdd, readOnly, isAdditionNotAllowed, isDeletionNotAllowed, headerComponent, actionButtonConfig, }: DynamicDataTableHeaderProps<K, CustomStateType>) => JSX.Element;
@@ -112,6 +112,10 @@ export type DynamicDataTableProps<K extends string, CustomStateType = Record<str
112
112
  isDeletionNotAllowed?: boolean;
113
113
  /** When true, data add or update is disabled. */
114
114
  readOnly?: boolean;
115
+ /** Tooltip for add button.
116
+ * @default 'Add'
117
+ */
118
+ addBtnTooltip?: string;
115
119
  /** Function to handle the addition of a new row to the table. */
116
120
  onRowAdd: () => void;
117
121
  /**
@@ -163,7 +167,7 @@ export type DynamicDataTableProps<K extends string, CustomStateType = Record<str
163
167
  */
164
168
  focusableFieldKey?: K;
165
169
  };
166
- export interface DynamicDataTableHeaderProps<K extends string, CustomStateType = Record<string, unknown>> extends Pick<DynamicDataTableProps<K, CustomStateType>, 'headers' | 'rows' | 'headerComponent' | 'sortingConfig' | 'onRowAdd' | 'readOnly' | 'isAdditionNotAllowed' | 'isDeletionNotAllowed' | 'actionButtonConfig'> {
170
+ export interface DynamicDataTableHeaderProps<K extends string, CustomStateType = Record<string, unknown>> extends Pick<DynamicDataTableProps<K, CustomStateType>, 'headers' | 'rows' | 'headerComponent' | 'sortingConfig' | 'addBtnTooltip' | 'onRowAdd' | 'readOnly' | 'isAdditionNotAllowed' | 'isDeletionNotAllowed' | 'actionButtonConfig'> {
167
171
  }
168
172
  export interface DynamicDataTableRowProps<K extends string, CustomStateType = Record<string, unknown>> extends Pick<DynamicDataTableProps<K, CustomStateType>, 'rows' | 'headers' | 'isAdditionNotAllowed' | 'isDeletionNotAllowed' | 'readOnly' | 'onRowEdit' | 'onRowDelete' | 'actionButtonConfig' | 'cellError' | 'leadingCellIcon' | 'trailingCellIcon' | 'buttonCellWrapComponent' | 'focusableFieldKey'> {
169
173
  }
@@ -56,7 +56,6 @@ export declare const iconMap: {
56
56
  'ic-google-container-registry': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
57
57
  'ic-google': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
58
58
  'ic-grid-view': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
59
- 'ic-hand-pointing': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
60
59
  'ic-heart-green': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
61
60
  'ic-heart-red-animated': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
62
61
  'ic-heart-red': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -92,7 +91,6 @@ export declare const iconMap: {
92
91
  'ic-pencil': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
93
92
  'ic-quay': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
94
93
  'ic-quote': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
95
- 'ic-rocket-launch': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
96
94
  'ic-shield-check': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
97
95
  'ic-sliders-vertical': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
98
96
  'ic-sort-ascending': import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
@@ -1,2 +1,2 @@
1
1
  import { KeyValueTableProps } from './KeyValueTable.types';
2
- export declare const KeyValueTable: <K extends string>({ config, maskValue, isSortable, headerComponent, onChange, onDelete, placeholder, isAdditionNotAllowed, readOnly, showError, validationSchema: parentValidationSchema, errorMessages: parentErrorMessages, onError, validateDuplicateKeys, validateEmptyKeys, }: KeyValueTableProps<K>) => JSX.Element;
2
+ export declare const KeyValueTable: ({ headerLabel, rows: initialRows, placeholder, maskValue, isSortable, headerComponent, onChange, isAdditionNotAllowed, readOnly, showError, validationSchema: parentValidationSchema, onError, validateDuplicateKeys, validateEmptyKeys, }: KeyValueTableProps) => JSX.Element;
@@ -1,40 +1,7 @@
1
- import { ReactNode } from 'react';
2
- import { ResizableTagTextAreaProps } from '../../../Common';
3
- /**
4
- * Interface representing a key-value header.
5
- * @template K - A string representing the key type.
6
- */
7
- export interface KeyValueHeader<K extends string> {
8
- /** The label of the header. */
9
- label: string;
10
- /** The key associated with the header. */
11
- key: K;
12
- /** An optional class name for the header. */
13
- className?: string;
14
- }
15
- /**
16
- * Type representing a key-value row.
17
- * @template K - A string representing the key type.
18
- */
19
- export type KeyValueRow<K extends string> = {
20
- data: {
21
- [key in K]: Pick<ResizableTagTextAreaProps, 'value' | 'disabled' | 'tabIndex'> & {
22
- /** An optional boolean indicating if an asterisk should be shown. */
23
- required?: boolean;
24
- };
25
- };
26
- id: string | number;
27
- };
28
- /**
29
- * Interface representing the configuration for a key-value table.
30
- * @template K - A string representing the key type.
31
- */
32
- export interface KeyValueConfig<K extends string> {
33
- /** An array containing two key-value headers. */
34
- headers: [KeyValueHeader<K>, KeyValueHeader<K>];
35
- /** An array of key-value rows. */
36
- rows: KeyValueRow<K>[];
37
- }
1
+ import { TooltipProps } from '../../../Common/Tooltip';
2
+ import { DynamicDataTableProps } from '../DynamicDataTable';
3
+ export type KeyValueTableDataType = 'key' | 'value';
4
+ export type KeyValueTableInternalProps = DynamicDataTableProps<KeyValueTableDataType, never>;
38
5
  type ErrorUIProps = {
39
6
  /**
40
7
  * Indicates whether to show errors.
@@ -58,63 +25,93 @@ type ErrorUIProps = {
58
25
  validateDuplicateKeys?: never;
59
26
  validateEmptyKeys?: never;
60
27
  };
61
- /**
62
- * Type representing a mask for key-value pairs.
63
- * @template K - A string representing the key type.
64
- */
65
- export type KeyValueMask<K extends string> = {
28
+ export type KeyValueHeaderLabel<K extends KeyValueTableDataType = KeyValueTableDataType> = {
29
+ [key in K]: string;
30
+ };
31
+ export type KeyValueMask<K extends KeyValueTableDataType = KeyValueTableDataType> = {
66
32
  [key in K]?: boolean;
67
33
  };
68
- export type KeyValuePlaceholder<K extends string> = {
34
+ export type KeyValuePlaceholder<K extends KeyValueTableDataType = KeyValueTableDataType> = {
69
35
  [key in K]?: string;
70
36
  };
37
+ export interface KeyValueTableRowType<K extends KeyValueTableDataType = KeyValueTableDataType> {
38
+ id: string | number;
39
+ data: {
40
+ [key in K]: {
41
+ value: string;
42
+ /** An optional boolean indicating if the cell should be marked as disabled. */
43
+ disabled?: boolean;
44
+ /** An optional boolean indicating if an asterisk should be shown. */
45
+ required?: boolean;
46
+ /** An optional tooltip to show when hovering over cell. */
47
+ tooltip?: Partial<Pick<TooltipProps, 'content' | 'className'>>;
48
+ };
49
+ };
50
+ }
51
+ export interface KeyValueTableData extends Pick<KeyValueTableRowType, 'id'> {
52
+ key: string;
53
+ value: string;
54
+ }
71
55
  /**
72
- * Interface representing the properties for a key-value table component.
73
- * @template K - A string representing the key type.
56
+ * Props for the KeyValueTable component.
74
57
  */
75
- export type KeyValueTableProps<K extends string> = {
76
- /** The configuration for the key-value table. */
77
- config: KeyValueConfig<K>;
78
- /** An optional mask for the key-value pairs. */
79
- maskValue?: KeyValueMask<K>;
80
- placeholder?: KeyValuePlaceholder<K>;
81
- /** An optional boolean indicating if the table is sortable. */
82
- isSortable?: boolean;
83
- /** An optional React node for a custom header component. */
84
- headerComponent?: ReactNode;
85
- /** When true, data addition field will not be shown. */
86
- isAdditionNotAllowed?: boolean;
87
- /** When true, data add or update is disabled. */
88
- readOnly?: boolean;
58
+ export type KeyValueTableProps = Pick<DynamicDataTableProps<KeyValueTableDataType>, 'isAdditionNotAllowed' | 'readOnly' | 'headerComponent'> & {
89
59
  /**
90
- * An optional function to handle changes in the table rows.
91
- * @param rowId - The id of the row that changed.
92
- * @param headerKey - The key of the header that changed.
93
- * @param value - The value of the cell.
60
+ * The label for the table header.
94
61
  */
95
- onChange?: (rowId: string | number, headerKey: K, value: string) => void;
62
+ headerLabel: KeyValueHeaderLabel;
96
63
  /**
97
- * An optional function to handle row deletions.
98
- * @param deletedRowIndex - The index of the row that was deleted.
64
+ * The rows of the key-value table.
99
65
  */
100
- onDelete?: (deletedRowId: string | number) => void;
66
+ rows: KeyValueTableRowType[];
101
67
  /**
102
- * The function to use to validate the value of the cell.
103
- * @param value - The value to validate.
104
- * @param key - The row key of the value.
105
- * @param rowId - The id of the row.
106
- * @returns Return true if the value is valid, otherwise false
107
- * and set `showError` to `true` and provide errorMessages array to show error message.
68
+ * An optional configuration to mask values in the table.
108
69
  */
109
- validationSchema?: (value: string, key: K, rowId: string | number) => boolean;
70
+ maskValue?: KeyValueMask;
110
71
  /**
111
- * An array of error messages to be displayed in the cell error tooltip.
72
+ * An optional placeholder configuration for the table columns.
112
73
  */
113
- errorMessages?: string[];
74
+ placeholder?: KeyValuePlaceholder;
75
+ /**
76
+ * An optional boolean indicating if the `key` column is sortable.
77
+ */
78
+ isSortable?: boolean;
79
+ /**
80
+ * A callback function triggered when the table rows change.
81
+ *
82
+ * @param data - The updated table data.
83
+ */
84
+ onChange: (data: KeyValueTableData[]) => void;
85
+ /**
86
+ * A function to validate the value of a cell.
87
+ *
88
+ * @param value - The value to validate.
89
+ * @param key - The key of the header associated with the value.
90
+ * @param row - The row containing the value.
91
+ * @returns A boolean indicating whether the value is valid. If false,
92
+ * `showError` should be set to `true` and `errorMessages` should
93
+ * provide an array of error messages to display.
94
+ */
95
+ validationSchema?: (value: string, key: KeyValueTableDataType, row: KeyValueTableRowType) => {
96
+ /** Boolean indicating if the cell data is valid or not. */
97
+ isValid: boolean;
98
+ /**
99
+ * An array of error messages to display in the cell error tooltip.
100
+ */
101
+ errorMessages?: string[];
102
+ };
114
103
  /**
115
- * A callback function called when an error occurs.
116
- * @param errorState - The error state, true when any cell has error, otherwise false.
104
+ * A callback function triggered when an error occurs in the table.
105
+ *
106
+ * @param errorState - A boolean indicating the error state. True if any
107
+ * cell has an error, otherwise false.
117
108
  */
118
109
  onError?: (errorState: boolean) => void;
119
110
  } & ErrorUIProps;
111
+ export type KeyValueValidationSchemaProps = {
112
+ value: Parameters<KeyValueTableProps['validationSchema']>[0];
113
+ key: Parameters<KeyValueTableProps['validationSchema']>[1];
114
+ row: Parameters<KeyValueTableProps['validationSchema']>[2];
115
+ keysFrequency?: Record<string, number>;
116
+ } & Pick<KeyValueTableProps, 'validateDuplicateKeys' | 'validateEmptyKeys' | 'validationSchema'> & Partial<Pick<KeyValueTableInternalProps, 'rows'>>;
120
117
  export {};
@@ -1,2 +1,2 @@
1
1
  export * from './KeyValueTable.component';
2
- export * from './KeyValueTable.types';
2
+ export type { KeyValueTableData, KeyValueTableProps } from './KeyValueTable.types';
@@ -0,0 +1,13 @@
1
+ import { UseStateFiltersReturnType } from '../../../Common/Hooks';
2
+ import { KeyValueTableData, KeyValueTableDataType, KeyValueTableInternalProps, KeyValueTableProps, KeyValueValidationSchemaProps } from './KeyValueTable.types';
3
+ export declare const getModifiedDataForOnChange: (rows: KeyValueTableInternalProps["rows"]) => KeyValueTableData[];
4
+ export declare const getEmptyRow: (placeholder: KeyValueTableProps["placeholder"]) => KeyValueTableInternalProps["rows"][number];
5
+ export declare const getKeyValueTableRows: ({ rows: initialRows, placeholder, maskValue, }: Required<Pick<KeyValueTableProps, "rows" | "placeholder" | "maskValue">>) => KeyValueTableInternalProps["rows"];
6
+ export declare const getKeyValueTableSortedRows: ({ rows, sortBy, sortOrder, }: Required<Pick<UseStateFiltersReturnType<KeyValueTableDataType>, "sortBy" | "sortOrder">> & Pick<KeyValueTableInternalProps, "rows">) => import('../DynamicDataTable').DynamicDataTableRowType<KeyValueTableDataType, never>[];
7
+ export declare const getKeyValueHeaders: ({ headerLabel, isSortable, }: Pick<KeyValueTableProps, "headerLabel" | "isSortable">) => KeyValueTableInternalProps["headers"];
8
+ export declare const getKeyValueTableCellError: ({ validateDuplicateKeys, validateEmptyKeys, validationSchema: parentValidationSchema, rows, }: Pick<KeyValueValidationSchemaProps, "validateDuplicateKeys" | "validateEmptyKeys" | "validationSchema" | "rows"> & {
9
+ skipValidationIfValueIsEmpty?: boolean;
10
+ }) => {
11
+ isValid: boolean;
12
+ updatedCellError: {};
13
+ };
@@ -1,3 +1,4 @@
1
+ import { KeyValueTableData } from '../Components';
1
2
  import { TargetPlatformsDTO } from '../types';
2
3
  import { OverrideMergeStrategyType } from '../../Pages/Applications';
3
4
  import { ReleaseTag, ResponseType, UserApprovalMetadataType } from '../../Common';
@@ -185,11 +186,6 @@ export interface ConfigMapSecretDataType {
185
186
  configData: ConfigMapSecretDataConfigDatumDTO[];
186
187
  isDeletable: boolean;
187
188
  }
188
- export interface CMSecretYamlData {
189
- k: string;
190
- v: string;
191
- id: string | number;
192
- }
193
189
  export interface ConfigMapSecretUseFormProps {
194
190
  name: string;
195
191
  isSecret: boolean;
@@ -204,7 +200,7 @@ export interface ConfigMapSecretUseFormProps {
204
200
  roleARN: string;
205
201
  yamlMode: boolean;
206
202
  yaml: string;
207
- currentData: CMSecretYamlData[];
203
+ currentData: KeyValueTableData[];
208
204
  secretDataYaml: string;
209
205
  esoSecretYaml: string;
210
206
  hasCurrentDataErr: boolean;
@@ -0,0 +1,19 @@
1
+ <!--
2
+ - Copyright (c) 2024. Devtron Inc.
3
+ -
4
+ - Licensed under the Apache License, Version 2.0 (the "License");
5
+ - you may not use this file except in compliance with the License.
6
+ - You may obtain a copy of the License at
7
+ -
8
+ - http://www.apache.org/licenses/LICENSE-2.0
9
+ -
10
+ - Unless required by applicable law or agreed to in writing, software
11
+ - distributed under the License is distributed on an "AS IS" BASIS,
12
+ - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ - See the License for the specific language governing permissions and
14
+ - limitations under the License.
15
+ -->
16
+
17
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
18
+ <path d="M7.34833 14.419C6.46444 17.0707 2.92891 17.0707 2.92891 17.0707C2.92891 17.0707 2.92891 13.5351 5.58056 12.6513M9.99998 13.5351L15.3033 8.23183C17.3114 6.2237 17.2918 4.21556 17.164 3.35914C17.1444 3.22728 17.0829 3.10522 16.9886 3.01095C16.8944 2.91668 16.7723 2.85518 16.6404 2.83553C15.784 2.70775 13.7759 2.68816 11.7677 4.6963L6.46444 9.9996M9.99998 13.5351L6.46444 9.9996M9.99998 13.5351L10.6548 16.8094C10.677 16.9203 10.7289 17.0232 10.8049 17.1069C10.881 17.1907 10.9783 17.2522 11.0866 17.285C11.1949 17.3178 11.31 17.3206 11.4197 17.2931C11.5294 17.2655 11.6296 17.2088 11.7096 17.1288L14.2363 14.6021C14.2944 14.544 14.3404 14.4751 14.3718 14.3993C14.4032 14.3235 14.4194 14.2422 14.4194 14.1601V9.11572M6.46444 9.9996L3.19017 9.34474C3.07924 9.32256 2.97642 9.27068 2.89266 9.19465C2.8089 9.11861 2.74734 9.02127 2.71456 8.913C2.68178 8.80473 2.679 8.68959 2.70651 8.57986C2.73403 8.47013 2.79081 8.36993 2.8708 8.28994L5.3975 5.76324C5.45554 5.7052 5.52444 5.65917 5.60027 5.62776C5.6761 5.59635 5.75737 5.58018 5.83944 5.58018H10.8839" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
19
+ </svg>