@devtron-labs/devtron-fe-common-lib 0.2.2-beta-9 → 0.2.2-beta-10
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/dist/Common/Api.d.ts +5 -5
- package/dist/Common/CIPipeline.Types.d.ts +1 -4
- package/dist/Common/Constants.d.ts +0 -2
- package/dist/Common/CustomInput/Types.d.ts +2 -2
- package/dist/Common/Modals/VisibleModal.d.ts +1 -1
- package/dist/Common/Modals/VisibleModal2.d.ts +1 -1
- package/dist/Common/MultiSelectCustomization.d.ts +1 -1
- package/dist/Common/Types.d.ts +2 -2
- package/dist/Shared/Components/DetectBottom/DetectBottom.component.d.ts +1 -2
- package/dist/Shared/Components/Header/types.d.ts +12 -1
- package/dist/Shared/Components/Plugin/service.d.ts +2 -4
- package/dist/Shared/Components/Plugin/types.d.ts +3 -11
- package/dist/Shared/Components/Plugin/utils.d.ts +0 -3
- package/dist/Shared/Components/SelectPicker/FilterSelectPicker.d.ts +4 -0
- package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +55 -1
- package/dist/Shared/Components/SelectPicker/common.d.ts +11 -8
- package/dist/Shared/Components/SelectPicker/index.d.ts +2 -0
- package/dist/Shared/Components/SelectPicker/type.d.ts +86 -10
- package/dist/Shared/Components/SelectPicker/utils.d.ts +13 -2
- package/dist/Shared/Components/index.d.ts +0 -1
- package/dist/Shared/constants.d.ts +0 -1
- package/dist/Shared/validations.d.ts +0 -11
- package/dist/assets/index.css +1 -1
- package/dist/{cssMode-b7a40cfa.js → cssMode-82a944e5.js} +1 -1
- package/dist/{freemarker2-ff0a7c06.js → freemarker2-281dd29e.js} +1 -1
- package/dist/{handlebars-0b7a7efd.js → handlebars-402af903.js} +1 -1
- package/dist/{html-feeb68bd.js → html-e0c917b4.js} +1 -1
- package/dist/{htmlMode-bcac9443.js → htmlMode-b3b2c4b1.js} +1 -1
- package/dist/{index-79eaedd6.js → index-182a9c8e.js} +42359 -38050
- package/dist/index.js +324 -328
- package/dist/{javascript-d16fe14e.js → javascript-cc0aa1b1.js} +1 -1
- package/dist/{jsonMode-74be8d73.js → jsonMode-04682bb0.js} +1 -1
- package/dist/{liquid-78dc826f.js → liquid-9d69388d.js} +1 -1
- package/dist/{mdx-927038f2.js → mdx-781e1f35.js} +1 -1
- package/dist/{python-1d5b3ab0.js → python-a3a10c4e.js} +1 -1
- package/dist/{razor-9f3bc729.js → razor-37366ce9.js} +1 -1
- package/dist/{tsMode-3f0ed0a8.js → tsMode-545943e6.js} +1 -1
- package/dist/{typescript-b8689929.js → typescript-6634a376.js} +1 -1
- package/dist/{xml-26b71a9d.js → xml-388afb21.js} +1 -1
- package/dist/{yaml-acff597f.js → yaml-31e8dfa8.js} +1 -1
- package/package.json +5 -5
- package/dist/Shared/Components/EditImageFormField/EditImageFormField.d.ts +0 -19
- package/dist/Shared/Components/EditImageFormField/constants.d.ts +0 -7
- package/dist/Shared/Components/EditImageFormField/index.d.ts +0 -2
- package/dist/Shared/Components/EditImageFormField/types.d.ts +0 -41
package/dist/Common/Api.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
2
|
import { ResponseType, APIOptions } from './Types';
|
|
3
3
|
|
|
4
|
-
export declare const post:
|
|
5
|
-
export declare const put:
|
|
6
|
-
export declare const patch:
|
|
7
|
-
export declare const get:
|
|
8
|
-
export declare const trash:
|
|
4
|
+
export declare const post: (url: string, data: object, options?: APIOptions, isMultipartRequest?: boolean) => Promise<ResponseType>;
|
|
5
|
+
export declare const put: (url: string, data: object, options?: APIOptions) => Promise<ResponseType>;
|
|
6
|
+
export declare const patch: (url: string, data: object, options?: APIOptions) => Promise<ResponseType>;
|
|
7
|
+
export declare const get: (url: string, options?: APIOptions) => Promise<ResponseType>;
|
|
8
|
+
export declare const trash: (url: string, data?: object, options?: APIOptions) => Promise<ResponseType>;
|
|
9
9
|
/**
|
|
10
10
|
* Aborts the previous request before triggering next request
|
|
11
11
|
*/
|
|
@@ -77,7 +77,6 @@ export interface VariableType {
|
|
|
77
77
|
format: string;
|
|
78
78
|
description: string;
|
|
79
79
|
defaultValue: string;
|
|
80
|
-
allowEmptyValue: boolean;
|
|
81
80
|
variableType: RefVariableType;
|
|
82
81
|
refVariableStepIndex: number;
|
|
83
82
|
refVariableName: string;
|
|
@@ -99,7 +98,7 @@ interface ConditionDetails {
|
|
|
99
98
|
conditionType: ConditionType;
|
|
100
99
|
conditionalValue: string;
|
|
101
100
|
}
|
|
102
|
-
|
|
101
|
+
interface InlineStepDetailType {
|
|
103
102
|
scriptType: ScriptType;
|
|
104
103
|
isMountCustomScript?: boolean;
|
|
105
104
|
script?: string;
|
|
@@ -118,8 +117,6 @@ export interface InlineStepDetailType {
|
|
|
118
117
|
inputVariables?: VariableType[];
|
|
119
118
|
outputVariables?: VariableType[];
|
|
120
119
|
conditionDetails: ConditionDetails[];
|
|
121
|
-
storeScriptAt?: string;
|
|
122
|
-
mountCodeToContainerPath?: string;
|
|
123
120
|
}
|
|
124
121
|
interface PluginRefStepDetailType {
|
|
125
122
|
id: number;
|
|
@@ -81,7 +81,6 @@ export declare const ROUTES: {
|
|
|
81
81
|
PLUGIN_GLOBAL_LIST_DETAIL_V2: string;
|
|
82
82
|
PLUGIN_GLOBAL_LIST_V2: string;
|
|
83
83
|
PLUGIN_GLOBAL_LIST_TAGS: string;
|
|
84
|
-
PLUGIN_LIST_MIN: string;
|
|
85
84
|
};
|
|
86
85
|
export declare enum KEY_VALUE {
|
|
87
86
|
KEY = "key",
|
|
@@ -271,4 +270,3 @@ export declare const DATE_TIME_FORMATS: {
|
|
|
271
270
|
DD_MMM_YYYY_HH_MM: string;
|
|
272
271
|
DD_MMM_YYYY: string;
|
|
273
272
|
};
|
|
274
|
-
export declare const SEMANTIC_VERSION_DOCUMENTATION_LINK = "https://semver.org/";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as React, HTMLInputTypeAttribute, InputHTMLAttributes
|
|
1
|
+
import { default as React, HTMLInputTypeAttribute, InputHTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
3
|
export interface CustomInputProps {
|
|
4
4
|
name: string;
|
|
@@ -17,7 +17,7 @@ export interface CustomInputProps {
|
|
|
17
17
|
autoFocus?: boolean;
|
|
18
18
|
rootClassName?: string;
|
|
19
19
|
error?: string[] | string;
|
|
20
|
-
helperText?:
|
|
20
|
+
helperText?: string;
|
|
21
21
|
handleOnBlur?: (e: any) => void;
|
|
22
22
|
readOnly?: boolean;
|
|
23
23
|
noTrim?: boolean;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -177,10 +177,10 @@ export interface RadioGroupItemProps {
|
|
|
177
177
|
export interface RadioGroupInterface {
|
|
178
178
|
name: string;
|
|
179
179
|
onChange: any;
|
|
180
|
+
className?: string;
|
|
180
181
|
initialTab: string;
|
|
182
|
+
disabled: boolean;
|
|
181
183
|
children: ReactNode;
|
|
182
|
-
disabled?: boolean;
|
|
183
|
-
className?: string;
|
|
184
184
|
}
|
|
185
185
|
export interface RadioInterface {
|
|
186
186
|
children: ReactNode;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
interface DetectBottomProps {
|
|
2
2
|
callback: () => void;
|
|
3
|
-
hasError?: boolean;
|
|
4
3
|
}
|
|
5
|
-
declare const DetectBottom: ({ callback
|
|
4
|
+
declare const DetectBottom: ({ callback }: DetectBottomProps) => JSX.Element;
|
|
6
5
|
export default DetectBottom;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ModuleStatus } from '../../types';
|
|
2
1
|
import { ResponseType, TippyCustomizedProps } from '../../../Common';
|
|
3
2
|
|
|
4
3
|
export declare enum InstallationType {
|
|
@@ -6,6 +5,18 @@ export declare enum InstallationType {
|
|
|
6
5
|
OSS_HELM = "oss_helm",
|
|
7
6
|
ENTERPRISE = "enterprise"
|
|
8
7
|
}
|
|
8
|
+
export declare enum ModuleStatus {
|
|
9
|
+
HEALTHY = "healthy",
|
|
10
|
+
NONE = "none",
|
|
11
|
+
UNKNOWN = "unknown",
|
|
12
|
+
UPGRADING = "upgrading",
|
|
13
|
+
UPGRADE_FAILED = "upgradeFailed",
|
|
14
|
+
INSTALLED = "installed",
|
|
15
|
+
INSTALLING = "installing",
|
|
16
|
+
INSTALL_FAILED = "installFailed",
|
|
17
|
+
NOT_INSTALLED = "notInstalled",
|
|
18
|
+
TIMEOUT = "timeout"
|
|
19
|
+
}
|
|
9
20
|
export interface PageHeaderType {
|
|
10
21
|
headerName?: string;
|
|
11
22
|
showTabs?: boolean;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GetPluginStoreDataReturnType, GetPluginStoreDataServiceParamsType, MinParentPluginDTO, PluginDetailServiceParamsType } from './types';
|
|
1
|
+
import { GetPluginStoreDataReturnType, GetPluginStoreDataServiceParamsType, PluginDetailServiceParamsType } from './types';
|
|
3
2
|
|
|
4
|
-
export declare const getPluginsDetail: ({ appId, parentPluginIds, pluginIds,
|
|
3
|
+
export declare const getPluginsDetail: ({ appId, parentPluginIds, pluginIds, shouldShowError, }: PluginDetailServiceParamsType) => Promise<Pick<GetPluginStoreDataReturnType, 'pluginStore'>>;
|
|
5
4
|
export declare const getPluginStoreData: ({ searchKey, selectedTags, appId, offset, signal, }: GetPluginStoreDataServiceParamsType) => Promise<GetPluginStoreDataReturnType>;
|
|
6
5
|
export declare const getAvailablePluginTags: (appId: number) => Promise<string[]>;
|
|
7
|
-
export declare const getParentPluginList: (appId?: number) => Promise<ResponseType<MinParentPluginDTO[]>>;
|
|
@@ -8,13 +8,9 @@ export declare enum PluginCreationType {
|
|
|
8
8
|
SHARED = "SHARED",
|
|
9
9
|
PRESET = "PRESET"
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
11
|
+
export interface GetPluginTagsPayloadType {
|
|
12
12
|
appId: number;
|
|
13
13
|
}
|
|
14
|
-
export interface GetPluginTagsPayloadType extends PluginAPIBaseQueryParamsType {
|
|
15
|
-
}
|
|
16
|
-
export interface GetParentPluginListPayloadType extends PluginAPIBaseQueryParamsType {
|
|
17
|
-
}
|
|
18
14
|
export interface PluginTagNamesDTO {
|
|
19
15
|
tagNames: string[];
|
|
20
16
|
}
|
|
@@ -49,9 +45,6 @@ export interface ParentPluginDTO {
|
|
|
49
45
|
type: PluginCreationType;
|
|
50
46
|
icon: string;
|
|
51
47
|
pluginVersions: PluginVersionsDTO;
|
|
52
|
-
pluginIdentifier: string;
|
|
53
|
-
}
|
|
54
|
-
export interface MinParentPluginDTO extends Pick<ParentPluginDTO, 'id' | 'name' | 'icon'> {
|
|
55
48
|
}
|
|
56
49
|
export interface PluginDetailDTO {
|
|
57
50
|
parentPlugins: ParentPluginDTO[];
|
|
@@ -65,7 +58,6 @@ export interface PluginDetailServiceParamsType {
|
|
|
65
58
|
* @default true
|
|
66
59
|
*/
|
|
67
60
|
shouldShowError?: boolean;
|
|
68
|
-
signal?: AbortSignal;
|
|
69
61
|
}
|
|
70
62
|
export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsType, 'appId'> {
|
|
71
63
|
pluginId?: PluginDetailServiceParamsType['pluginIds'];
|
|
@@ -74,11 +66,11 @@ export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsT
|
|
|
74
66
|
export interface PluginListFiltersType extends Pick<BaseFilterQueryParams<unknown>, 'searchKey'> {
|
|
75
67
|
selectedTags: string[];
|
|
76
68
|
}
|
|
77
|
-
interface ParentPluginType extends Pick<ParentPluginDTO, 'id' | 'name' | 'description' | 'type' | 'icon'
|
|
69
|
+
interface ParentPluginType extends Pick<ParentPluginDTO, 'id' | 'name' | 'description' | 'type' | 'icon'> {
|
|
78
70
|
latestVersionId: MinimalPluginVersionDataDTO['id'];
|
|
79
71
|
pluginVersions: MinimalPluginVersionDataDTO[];
|
|
80
72
|
}
|
|
81
|
-
interface DetailedPluginVersionType extends Pick<MinimalPluginVersionDataDTO, 'id' | 'description' | 'name' | 'pluginVersion'>, Pick<DetailedPluginVersionDTO, 'tags' | 'isLatest' | 'inputVariables' | 'outputVariables' | 'updatedBy' | 'docLink'>, Pick<ParentPluginType, 'icon' | 'type'
|
|
73
|
+
interface DetailedPluginVersionType extends Pick<MinimalPluginVersionDataDTO, 'id' | 'description' | 'name' | 'pluginVersion'>, Pick<DetailedPluginVersionDTO, 'tags' | 'isLatest' | 'inputVariables' | 'outputVariables' | 'updatedBy' | 'docLink'>, Pick<ParentPluginType, 'icon' | 'type'> {
|
|
82
74
|
parentPluginId: ParentPluginType['id'];
|
|
83
75
|
}
|
|
84
76
|
export interface PluginDataStoreType {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { OptionProps } from 'react-select';
|
|
2
|
-
import { OptionType } from '../../../Common/Types';
|
|
3
1
|
import { ParentPluginDTO, PluginDataStoreType } from './types';
|
|
4
2
|
|
|
5
3
|
export declare const parsePluginDetailsDTOIntoPluginStore: (pluginData: ParentPluginDTO[]) => PluginDataStoreType;
|
|
@@ -16,7 +14,6 @@ export declare const pluginTagSelectStyles: {
|
|
|
16
14
|
group: (base: any) => any;
|
|
17
15
|
groupHeading: (base: any) => any;
|
|
18
16
|
};
|
|
19
|
-
export declare const PluginTagOption: (props: OptionProps<OptionType, true>) => JSX.Element;
|
|
20
17
|
/**
|
|
21
18
|
* @description This method takes the initial plugin data store and updates the keys with the target parent plugin store and plugin version store
|
|
22
19
|
*/
|
|
@@ -80,6 +80,60 @@ import { SelectPickerProps } from './type';
|
|
|
80
80
|
* ```tsx
|
|
81
81
|
* <SelectPicker ... showSelectedOptionsCount />
|
|
82
82
|
* ```
|
|
83
|
+
* @example Multi Select
|
|
84
|
+
* ```tsx
|
|
85
|
+
* <SelectPicker ... isMulti />
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example Creatable Multi Select
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <SelectPicker
|
|
91
|
+
* ...
|
|
92
|
+
* isMulti
|
|
93
|
+
* multiSelectProps={{
|
|
94
|
+
* isCreatable: true
|
|
95
|
+
* }}
|
|
96
|
+
* />
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example Multi Select with group heading selectable
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <SelectPicker
|
|
102
|
+
* ...
|
|
103
|
+
* isMulti
|
|
104
|
+
* multiSelectProps={{
|
|
105
|
+
* isGroupHeadingSelectable: true
|
|
106
|
+
* }}
|
|
107
|
+
* />
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example Multi Select with selected option validator
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <SelectPicker
|
|
113
|
+
* ...
|
|
114
|
+
* isMulti
|
|
115
|
+
* multiSelectProps={{
|
|
116
|
+
* getIsOptionValid: (option) => boolean
|
|
117
|
+
* }}
|
|
118
|
+
* />
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @example Custom options rendering support (menuIsOpen needs to be handled by consumer)
|
|
122
|
+
* ```tsx
|
|
123
|
+
* <SelectPicker
|
|
124
|
+
* ...
|
|
125
|
+
* shouldRenderCustomOptions
|
|
126
|
+
* renderCustomOptions={() => <div />}
|
|
127
|
+
* />
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @example Align the menu at the right most end
|
|
131
|
+
* ```tsx
|
|
132
|
+
* <SelectPicker
|
|
133
|
+
* ...
|
|
134
|
+
* shouldMenuAlignRight
|
|
135
|
+
* />
|
|
136
|
+
* ```
|
|
83
137
|
*/
|
|
84
|
-
declare const SelectPicker: ({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize,
|
|
138
|
+
declare const SelectPicker: <OptionValue, IsMulti extends boolean>({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, menuPosition, variant, disableDescriptionEllipsis, multiSelectProps, isMulti, name, classNamePrefix, renderCustomOptions, shouldRenderCustomOptions, isSearchable, selectRef, shouldMenuAlignRight, fullWidth, ...props }: SelectPickerProps<OptionValue, IsMulti>) => JSX.Element;
|
|
85
139
|
export default SelectPicker;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps } from 'react-select';
|
|
2
|
-
import { SelectPickerOptionType, SelectPickerProps } from './type';
|
|
1
|
+
import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps, MultiValueRemoveProps, MultiValueProps } from 'react-select';
|
|
2
|
+
import { SelectPickerGroupHeadingProps, SelectPickerOptionType, SelectPickerProps } from './type';
|
|
3
3
|
|
|
4
|
-
export declare const SelectPickerDropdownIndicator: (props: DropdownIndicatorProps<SelectPickerOptionType
|
|
5
|
-
export declare const SelectPickerClearIndicator: (props: ClearIndicatorProps<SelectPickerOptionType
|
|
6
|
-
export declare const SelectPickerControl: ({ icon, showSelectedOptionIcon, ...props }: ControlProps<SelectPickerOptionType
|
|
7
|
-
export declare const SelectPickerValueContainer: ({ showSelectedOptionsCount, ...props }: ValueContainerProps<SelectPickerOptionType
|
|
4
|
+
export declare const SelectPickerDropdownIndicator: <OptionValue>(props: DropdownIndicatorProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>>) => JSX.Element;
|
|
5
|
+
export declare const SelectPickerClearIndicator: <OptionValue>(props: ClearIndicatorProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>>) => JSX.Element;
|
|
6
|
+
export declare const SelectPickerControl: <OptionValue, IsMulti extends boolean>({ icon, showSelectedOptionIcon, ...props }: ControlProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "icon" | "showSelectedOptionIcon">) => JSX.Element;
|
|
7
|
+
export declare const SelectPickerValueContainer: <OptionValue, IsMulti extends boolean>({ showSelectedOptionsCount, ...props }: ValueContainerProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "showSelectedOptionsCount">) => JSX.Element;
|
|
8
8
|
export declare const SelectPickerLoadingIndicator: () => JSX.Element;
|
|
9
|
-
export declare const SelectPickerOption: (props: OptionProps<SelectPickerOptionType>) => JSX.Element;
|
|
10
|
-
export declare const SelectPickerMenuList: ({ renderMenuListFooter, ...props }: MenuListProps<SelectPickerOptionType
|
|
9
|
+
export declare const SelectPickerOption: <OptionValue, IsMulti extends boolean>({ disableDescriptionEllipsis, ...props }: OptionProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "disableDescriptionEllipsis">) => JSX.Element;
|
|
10
|
+
export declare const SelectPickerMenuList: <OptionValue, IsMulti extends boolean>({ renderMenuListFooter, shouldRenderCustomOptions, renderCustomOptions, ...props }: MenuListProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "renderMenuListFooter" | "shouldRenderCustomOptions" | "renderCustomOptions">) => JSX.Element;
|
|
11
|
+
export declare const SelectPickerMultiValueLabel: <OptionValue, IsMulti extends boolean>({ getIsOptionValid, ...props }: MultiValueProps<SelectPickerOptionType<OptionValue>, true, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>["multiSelectProps"], "getIsOptionValid">) => JSX.Element;
|
|
12
|
+
export declare const SelectPickerMultiValueRemove: (props: MultiValueRemoveProps) => JSX.Element;
|
|
13
|
+
export declare const SelectPickerGroupHeading: <OptionValue>({ isGroupHeadingSelectable, ...props }: SelectPickerGroupHeadingProps<OptionValue>) => JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ServerErrors } from '../../../Common/ServerError';
|
|
2
1
|
import { OptionType } from '../../../Common/Types';
|
|
3
2
|
import { ComponentSizeType } from '../../constants';
|
|
4
|
-
import { ReactElement, ReactNode } from 'react';
|
|
5
|
-
import { Props as ReactSelectProps } from 'react-select';
|
|
3
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { GroupBase, GroupHeadingProps, Props as ReactSelectProps, SelectInstance } from 'react-select';
|
|
5
|
+
import { CreatableProps } from 'react-select/creatable';
|
|
6
6
|
|
|
7
|
-
export interface SelectPickerOptionType extends OptionType<
|
|
7
|
+
export interface SelectPickerOptionType<OptionValue = string | number> extends OptionType<OptionValue, ReactNode> {
|
|
8
8
|
/**
|
|
9
9
|
* Description to be displayed for the option
|
|
10
10
|
*/
|
|
@@ -18,8 +18,12 @@ export interface SelectPickerOptionType extends OptionType<number | string, Reac
|
|
|
18
18
|
*/
|
|
19
19
|
endIcon?: ReactElement;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
export declare enum SelectPickerVariantType {
|
|
22
|
+
DEFAULT = "default",
|
|
23
|
+
BORDER_LESS = "border-less"
|
|
24
|
+
}
|
|
25
|
+
type SelectProps<OptionValue, IsMulti extends boolean> = ReactSelectProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>;
|
|
26
|
+
export type SelectPickerProps<OptionValue = number | string, IsMulti extends boolean = false> = Pick<SelectProps<OptionValue, IsMulti>, 'name' | 'classNamePrefix' | 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'isLoading' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder' | 'menuPosition' | 'getOptionLabel' | 'getOptionValue' | 'isOptionSelected' | 'menuIsOpen' | 'onMenuOpen' | 'onMenuClose' | 'autoFocus'> & Required<Pick<SelectProps<OptionValue, IsMulti>, 'inputId'>> & {
|
|
23
27
|
/**
|
|
24
28
|
* Icon to be rendered in the control
|
|
25
29
|
*/
|
|
@@ -72,12 +76,84 @@ export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value'
|
|
|
72
76
|
*/
|
|
73
77
|
menuSize?: ComponentSizeType;
|
|
74
78
|
/**
|
|
75
|
-
*
|
|
79
|
+
* Variant of the select.
|
|
80
|
+
*
|
|
81
|
+
* @default SelectPickerVariantType.DEFAULT
|
|
82
|
+
*/
|
|
83
|
+
variant?: SelectPickerVariantType;
|
|
84
|
+
/**
|
|
85
|
+
* Disables the ellipsis on description, it will be shown in full width, wrapped if required.
|
|
86
|
+
*
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
disableDescriptionEllipsis?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Ref for the select picker
|
|
92
|
+
*/
|
|
93
|
+
selectRef?: IsMulti extends true ? MutableRefObject<SelectInstance<SelectPickerOptionType<OptionValue>, true>> : MutableRefObject<SelectInstance<SelectPickerOptionType<OptionValue>>>;
|
|
94
|
+
/**
|
|
95
|
+
* If true, the menu is aligned at the right end to prevent going outside of viewport
|
|
96
|
+
* in case of menu being larger than the control
|
|
97
|
+
*
|
|
98
|
+
* @default false
|
|
76
99
|
*/
|
|
77
|
-
|
|
100
|
+
shouldMenuAlignRight?: boolean;
|
|
78
101
|
/**
|
|
79
|
-
*
|
|
102
|
+
* If true, the select spans to the max available width
|
|
103
|
+
*
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
fullWidth?: boolean;
|
|
107
|
+
} & (IsMulti extends true ? {
|
|
108
|
+
isMulti: IsMulti | boolean;
|
|
109
|
+
multiSelectProps?: Pick<CreatableProps<SelectPickerOptionType<OptionValue>, true, GroupBase<SelectPickerOptionType<OptionValue>>>, 'onCreateOption'> & {
|
|
110
|
+
/**
|
|
111
|
+
* If true, the select picker creates the new option
|
|
112
|
+
* Only applicable for IsMulti: true
|
|
113
|
+
*
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
isCreatable?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* If true, the group heading can be selected
|
|
119
|
+
*
|
|
120
|
+
* Only applicable for IsMulti: true
|
|
121
|
+
*
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
isGroupHeadingSelectable?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Callback handler to check if the given selection is valid or not
|
|
127
|
+
*/
|
|
128
|
+
getIsOptionValid?: (option: SelectPickerOptionType<OptionValue>) => boolean;
|
|
129
|
+
};
|
|
130
|
+
} : {
|
|
131
|
+
isMulti?: never;
|
|
132
|
+
multiSelectProps?: never;
|
|
133
|
+
}) & ({
|
|
134
|
+
/**
|
|
135
|
+
* If true, custom options are rendered in the menuList component of react select
|
|
136
|
+
*
|
|
137
|
+
* Note: renderCustomOptions is required to be passed; renderMenuListFooter is also not called
|
|
138
|
+
*
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
shouldRenderCustomOptions: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Callback handler for custom options
|
|
144
|
+
*
|
|
145
|
+
* Imp Note: The menu open/close needs to handled by the consumer in this case
|
|
80
146
|
*/
|
|
81
|
-
|
|
147
|
+
renderCustomOptions: () => ReactElement;
|
|
148
|
+
} | {
|
|
149
|
+
shouldRenderCustomOptions?: never;
|
|
150
|
+
renderCustomOptions?: never;
|
|
151
|
+
});
|
|
152
|
+
export type SelectPickerGroupHeadingProps<OptionValue> = GroupHeadingProps<SelectPickerOptionType<OptionValue>> & {
|
|
153
|
+
isGroupHeadingSelectable: boolean;
|
|
154
|
+
};
|
|
155
|
+
export interface FilterSelectPickerProps extends Required<Pick<SelectPickerProps<number | string, true>, 'options' | 'isDisabled' | 'placeholder' | 'isLoading'>>, Pick<SelectPickerProps<number | string, true>, 'selectRef' | 'inputId' | 'menuPosition' | 'autoFocus' | 'shouldMenuAlignRight'> {
|
|
156
|
+
appliedFilterOptions: SelectPickerProps<number | string, true>['options'];
|
|
157
|
+
handleApplyFilter: (filtersToApply: SelectPickerOptionType<number | string>[]) => void;
|
|
82
158
|
}
|
|
83
159
|
export {};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CHECKBOX_VALUE } from '../../../Common/Types';
|
|
2
|
+
import { GroupBase, MultiValue, OptionsOrGroups, StylesConfig } from 'react-select';
|
|
2
3
|
import { SelectPickerOptionType, SelectPickerProps } from './type';
|
|
3
4
|
|
|
4
|
-
export declare const getCommonSelectStyle: ({ error, size, menuSize, }: Pick<SelectPickerProps,
|
|
5
|
+
export declare const getCommonSelectStyle: <OptionValue, IsMulti extends boolean>({ error, size, menuSize, variant, getIsOptionValid, isGroupHeadingSelectable, shouldMenuAlignRight, }: Pick<SelectPickerProps<OptionValue, IsMulti>, "error" | "size" | "shouldMenuAlignRight" | "menuSize" | "variant"> & Pick<SelectPickerProps<OptionValue, IsMulti>["multiSelectProps"], "getIsOptionValid" | "isGroupHeadingSelectable">) => StylesConfig<SelectPickerOptionType<OptionValue>, boolean, GroupBase<SelectPickerOptionType<OptionValue>>>;
|
|
6
|
+
export declare const getGroupCheckboxValue: <OptionValue>(groupHeadingOptions: readonly SelectPickerOptionType<OptionValue>[], selectedOptions: MultiValue<SelectPickerOptionType<OptionValue>>, getOptionValue: (option: SelectPickerOptionType<OptionValue>) => string) => CHECKBOX_VALUE.CHECKED | CHECKBOX_VALUE.INTERMEDIATE;
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves an option from the options list based on the provided value.
|
|
9
|
+
*
|
|
10
|
+
* @param optionsList - The list of options or groups of options.
|
|
11
|
+
* @param value - The value to compare against the options' values.
|
|
12
|
+
* @param defaultOption - The default option to return if no match is found.
|
|
13
|
+
* @returns The matched option or the default option if no match is found.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getSelectPickerOptionByValue: <OptionValue>(optionsList: OptionsOrGroups<SelectPickerOptionType<OptionValue>, GroupBase<SelectPickerOptionType<OptionValue>>>, value: string | number, defaultOption?: SelectPickerOptionType<OptionValue>) => SelectPickerOptionType<OptionValue>;
|
|
@@ -12,7 +12,6 @@ export declare const MESSAGES: {
|
|
|
12
12
|
VALID_POSITIVE_NUMBER: string;
|
|
13
13
|
VALID_POSITIVE_INTEGER: string;
|
|
14
14
|
MAX_SAFE_INTEGER: string;
|
|
15
|
-
INVALID_SEMANTIC_VERSION: string;
|
|
16
15
|
};
|
|
17
16
|
export declare const requiredField: (value: string) => ValidationResponseType;
|
|
18
17
|
export declare const validateName: (name: string) => ValidationResponseType;
|
|
@@ -29,13 +28,3 @@ export declare const validateUniqueKeys: (keys: string[]) => {
|
|
|
29
28
|
isValid: boolean;
|
|
30
29
|
message: string;
|
|
31
30
|
};
|
|
32
|
-
/**
|
|
33
|
-
* Rules for valid semantic version:
|
|
34
|
-
* 1. version.length < 128 and not empty
|
|
35
|
-
* 2. version should follow semantic versioning regex from https://semver.org/
|
|
36
|
-
*/
|
|
37
|
-
export declare const validateSemanticVersioning: (version: string) => ValidationResponseType;
|
|
38
|
-
/**
|
|
39
|
-
* A valid display name should be between 3 and 50 characters
|
|
40
|
-
*/
|
|
41
|
-
export declare const validateDisplayName: (name: string) => ValidationResponseType;
|