@devtron-labs/devtron-fe-common-lib 0.0.62-beta-2 → 0.0.62-beta-3
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/DraggableWrapper/types.d.ts +4 -1
- package/dist/Common/Hooks/useUrlFilters/index.d.ts +1 -1
- package/dist/Common/Hooks/useUrlFilters/types.d.ts +19 -1
- package/dist/Common/Hooks/useUrlFilters/useUrlFilters.d.ts +2 -14
- package/dist/Common/Types.d.ts +3 -3
- package/dist/Pages/GlobalConfigurations/Authorization/constants.d.ts +1 -1
- package/dist/Shared/Components/BulkSelection/BulkSelection.d.ts +4 -0
- package/dist/Shared/Components/BulkSelection/BulkSelectionDropdownItems.d.ts +4 -0
- package/dist/Shared/Components/BulkSelection/BulkSelectionProvider.d.ts +4 -0
- package/dist/Shared/Components/BulkSelection/constants.d.ts +9 -0
- package/dist/Shared/Components/BulkSelection/index.d.ts +4 -0
- package/dist/Shared/Components/BulkSelection/types.d.ts +56 -0
- package/dist/Shared/Components/index.d.ts +1 -0
- package/dist/Shared/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +462 -167
- package/package.json +1 -1
- package/src/Assets/Icon/ic-check-all.svg +5 -0
- package/src/Assets/Icon/ic-check-square.svg +4 -0
- package/src/Assets/Icon/ic-close.svg +9 -0
- package/src/Common/DraggableWrapper/types.ts +4 -1
- package/src/Common/Helper.tsx +7 -1
- package/src/Common/Hooks/useUrlFilters/index.ts +1 -1
- package/src/Common/Hooks/useUrlFilters/types.ts +21 -1
- package/src/Common/Hooks/useUrlFilters/useUrlFilters.ts +28 -6
- package/src/Common/Types.ts +3 -2
- package/src/Pages/GlobalConfigurations/Authorization/constants.ts +1 -1
- package/src/Shared/Components/BulkSelection/BulkSelection.tsx +77 -0
- package/src/Shared/Components/BulkSelection/BulkSelectionDropdownItems.tsx +31 -0
- package/src/Shared/Components/BulkSelection/BulkSelectionProvider.tsx +171 -0
- package/src/Shared/Components/BulkSelection/constants.tsx +13 -0
- package/src/Shared/Components/BulkSelection/index.ts +4 -0
- package/src/Shared/Components/BulkSelection/types.tsx +67 -0
- package/src/Shared/Components/index.ts +1 -0
- package/src/Shared/index.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -5,7 +5,10 @@ export declare enum DraggablePositionVariant {
|
|
|
5
5
|
}
|
|
6
6
|
export interface DraggableWrapperProps {
|
|
7
7
|
children: ReactNode;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Support for passing the direct value or calc functions as well
|
|
10
|
+
*/
|
|
11
|
+
zIndex?: number | string;
|
|
9
12
|
positionVariant?: DraggablePositionVariant;
|
|
10
13
|
/**
|
|
11
14
|
* dragSelector (class - (append with .), id, etc) will be used to identify the grabbable button that will grab the div to drag
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as useUrlFilters } from './useUrlFilters';
|
|
2
|
-
export type { UseUrlFiltersProps } from './types';
|
|
2
|
+
export type { UseUrlFiltersProps, UseUrlFiltersReturnType } from './types';
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { SortingOrder } from '../../Constants';
|
|
2
|
+
export interface UseUrlFiltersProps<T, K> {
|
|
2
3
|
/**
|
|
3
4
|
* The key on which the sorting should be applied
|
|
4
5
|
*/
|
|
5
6
|
initialSortKey?: T;
|
|
7
|
+
/**
|
|
8
|
+
* Callback function for parsing the search params
|
|
9
|
+
*/
|
|
10
|
+
parseSearchParams?: (searchParams: URLSearchParams) => K;
|
|
6
11
|
}
|
|
12
|
+
export type UseUrlFiltersReturnType<T, K = unknown> = K & {
|
|
13
|
+
pageSize: number;
|
|
14
|
+
changePage: (pageNumber: number) => void;
|
|
15
|
+
changePageSize: (pageSize: number) => void;
|
|
16
|
+
searchKey: string;
|
|
17
|
+
handleSearch: (searchKey: string) => void;
|
|
18
|
+
offset: number;
|
|
19
|
+
sortBy: T;
|
|
20
|
+
sortOrder: SortingOrder;
|
|
21
|
+
handleSorting: (sortBy: T) => void;
|
|
22
|
+
clearFilters: () => void;
|
|
23
|
+
updateSearchParams: (paramsToSerialize: K) => void;
|
|
24
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UseUrlFiltersProps } from './types';
|
|
1
|
+
import { UseUrlFiltersProps, UseUrlFiltersReturnType } from './types';
|
|
3
2
|
/**
|
|
4
3
|
* Generic hook for implementing URL based filters.
|
|
5
4
|
* eg: pagination, search, sort.
|
|
@@ -17,16 +16,5 @@ import { UseUrlFiltersProps } from './types';
|
|
|
17
16
|
* ```
|
|
18
17
|
*
|
|
19
18
|
*/
|
|
20
|
-
declare const useUrlFilters: <T = string>({ initialSortKey }?: UseUrlFiltersProps<T>) =>
|
|
21
|
-
pageSize: number;
|
|
22
|
-
changePage: (page: number) => void;
|
|
23
|
-
changePageSize: (_pageSize: number) => void;
|
|
24
|
-
searchKey: string;
|
|
25
|
-
handleSearch: (searchTerm: string) => void;
|
|
26
|
-
offset: number;
|
|
27
|
-
sortBy: T;
|
|
28
|
-
sortOrder: SortingOrder;
|
|
29
|
-
handleSorting: (_sortBy: T) => void;
|
|
30
|
-
clearFilters: () => void;
|
|
31
|
-
};
|
|
19
|
+
declare const useUrlFilters: <T = string, K = unknown>({ initialSortKey, parseSearchParams, }?: UseUrlFiltersProps<T, K>) => UseUrlFiltersReturnType<T, K>;
|
|
32
20
|
export default useUrlFilters;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -44,12 +44,13 @@ export interface Teams {
|
|
|
44
44
|
}
|
|
45
45
|
export declare enum CHECKBOX_VALUE {
|
|
46
46
|
CHECKED = "CHECKED",
|
|
47
|
-
INTERMEDIATE = "INTERMEDIATE"
|
|
47
|
+
INTERMEDIATE = "INTERMEDIATE",
|
|
48
|
+
BULK_CHECKED = "BULK_CHECKED"
|
|
48
49
|
}
|
|
49
50
|
export interface CheckboxProps {
|
|
50
51
|
onChange: (event: any) => void;
|
|
51
52
|
isChecked: boolean;
|
|
52
|
-
value: 'CHECKED' | 'INTERMEDIATE';
|
|
53
|
+
value: 'CHECKED' | 'INTERMEDIATE' | 'BULK_CHECKED';
|
|
53
54
|
disabled?: boolean;
|
|
54
55
|
tabIndex?: number;
|
|
55
56
|
rootClassName?: string;
|
|
@@ -340,7 +341,6 @@ export interface CommonNodeAttr {
|
|
|
340
341
|
};
|
|
341
342
|
appReleaseTagNames?: string[];
|
|
342
343
|
tagsEditable?: boolean;
|
|
343
|
-
isGitOpsRepoNotConfigured?: boolean;
|
|
344
344
|
deploymentAppCreated?: boolean;
|
|
345
345
|
isLast?: boolean;
|
|
346
346
|
downstreamEnvironments?: DownstreamNodesEnvironmentsType[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BulkSelectionDropdownItemsProps } from './types';
|
|
3
|
+
declare const BulkSelectionDropdownItems: <T>({ locator, label, isSelected, handleBulkSelection, icon: Icon, }: BulkSelectionDropdownItemsProps<T>) => JSX.Element;
|
|
4
|
+
export default BulkSelectionDropdownItems;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UseBulkSelectionProps, UseBulkSelectionReturnType } from './types';
|
|
3
|
+
export declare const useBulkSelection: <T>() => UseBulkSelectionReturnType<T>;
|
|
4
|
+
export declare const BulkSelectionProvider: <T>({ children, identifiers, getSelectAllDialogStatus, }: UseBulkSelectionProps<T>) => JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const BULK_DROPDOWN_TEST_ID: "bulk-selection-pop-up-menu";
|
|
2
|
+
export declare const BulkSelectionOptionsLabels: {
|
|
3
|
+
readonly SELECT_ALL_ON_PAGE: "All on this page";
|
|
4
|
+
readonly SELECT_ALL_ACROSS_PAGES: "All across pages";
|
|
5
|
+
readonly CLEAR_ALL_SELECTIONS: "Clear selection";
|
|
6
|
+
};
|
|
7
|
+
export declare const SELECT_ALL_ACROSS_PAGES_LOCATOR: "*";
|
|
8
|
+
export declare const getInvalidActionMessage: (action: string) => string;
|
|
9
|
+
export declare const BULK_SELECTION_CONTEXT_ERROR = "useBulkSelection must be used within BulkSelectionContext";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CHECKBOX_VALUE } from '../../../Common';
|
|
3
|
+
export declare enum BulkSelectionEvents {
|
|
4
|
+
CLEAR_ALL_SELECTIONS = "CLEAR_ALL_SELECTIONS",
|
|
5
|
+
CLEAR_IDENTIFIERS = "CLEAR_IDENTIFIERS",
|
|
6
|
+
SELECT_ALL_ACROSS_PAGES = "SELECT_ALL_ACROSS_PAGES",
|
|
7
|
+
SELECT_ALL_ON_PAGE = "SELECT_ALL_ON_PAGE",
|
|
8
|
+
SELECT_IDENTIFIER = "SELECT_IDENTIFIER",
|
|
9
|
+
CLEAR_IDENTIFIERS_AFTER_ACROSS_SELECTION = "CLEAR_IDENTIFIERS_AFTER_ACROSS_SELECTION",
|
|
10
|
+
CLEAR_SELECTIONS_AND_SELECT_ALL_ACROSS_PAGES = "CLEAR_SELECTIONS_AND_SELECT_ALL_ACROSS_PAGES"
|
|
11
|
+
}
|
|
12
|
+
export interface HandleBulkSelectionType<T> {
|
|
13
|
+
action: BulkSelectionEvents;
|
|
14
|
+
data?: {
|
|
15
|
+
identifierIds?: (number | string)[];
|
|
16
|
+
identifierObject?: T;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface GetBulkSelectionCheckboxValuesType {
|
|
20
|
+
isChecked: boolean;
|
|
21
|
+
checkboxValue: CHECKBOX_VALUE;
|
|
22
|
+
}
|
|
23
|
+
export interface UseBulkSelectionReturnType<T> extends GetBulkSelectionCheckboxValuesType {
|
|
24
|
+
selectedIdentifiers: T;
|
|
25
|
+
handleBulkSelection: ({ action, data }: HandleBulkSelectionType<T>) => void;
|
|
26
|
+
isBulkSelectionApplied: boolean;
|
|
27
|
+
getSelectedIdentifiersCount: () => number;
|
|
28
|
+
}
|
|
29
|
+
export interface BulkSelectionProps {
|
|
30
|
+
showPagination: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface BulkSelectionDropdownItemsType {
|
|
33
|
+
locator: BulkSelectionEvents;
|
|
34
|
+
label: string;
|
|
35
|
+
isSelected: boolean;
|
|
36
|
+
icon: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
37
|
+
}
|
|
38
|
+
export interface BulkSelectionDropdownItemsProps<T> extends BulkSelectionDropdownItemsType, Pick<UseBulkSelectionReturnType<T>, 'handleBulkSelection'> {
|
|
39
|
+
}
|
|
40
|
+
export declare enum SelectAllDialogStatus {
|
|
41
|
+
OPEN = "OPEN",
|
|
42
|
+
CLOSED = "CLOSED"
|
|
43
|
+
}
|
|
44
|
+
export type BulkSelectionIdentifiersType<T> = Record<string | number, T>;
|
|
45
|
+
export interface UseBulkSelectionProps<T> {
|
|
46
|
+
/**
|
|
47
|
+
* Response from API, assuming structure to be array of objects with key and values
|
|
48
|
+
* This will the given ids on current page
|
|
49
|
+
*/
|
|
50
|
+
identifiers: T;
|
|
51
|
+
/**
|
|
52
|
+
* Act as buffer between select all across pages and select all on page state
|
|
53
|
+
*/
|
|
54
|
+
getSelectAllDialogStatus: () => SelectAllDialogStatus;
|
|
55
|
+
children?: React.ReactNode;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BulkSelection';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Components';
|
package/dist/index.d.ts
CHANGED