@devtron-labs/devtron-fe-common-lib 1.10.1-beta-1 → 1.10.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.
Files changed (27) hide show
  1. package/dist/{@code-editor-BK2IgrtU.js → @code-editor-CTJ-kyOm.js} +7184 -7705
  2. package/dist/{@common-rjsf-h6_nZqkx.js → @common-rjsf-CRG-1ZEj.js} +1 -1
  3. package/dist/Common/Hooks/UseRegisterShortcut/types.d.ts +0 -13
  4. package/dist/Common/Hooks/UseRegisterShortcut/utils.d.ts +1 -1
  5. package/dist/Common/Hooks/useStateFilters/types.d.ts +1 -1
  6. package/dist/Common/Hooks/useUrlFilters/types.d.ts +0 -1
  7. package/dist/Shared/Components/Button/index.d.ts +1 -0
  8. package/dist/Shared/Components/Button/types.d.ts +2 -0
  9. package/dist/Shared/Components/Button/useTriggerAutoClickTimestamp.d.ts +6 -0
  10. package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +6 -7
  11. package/dist/Shared/Components/SelectPicker/common.d.ts +0 -1
  12. package/dist/Shared/Components/SelectPicker/type.d.ts +25 -4
  13. package/dist/Shared/Components/index.d.ts +0 -1
  14. package/dist/assets/@code-editor.css +1 -1
  15. package/dist/index.js +578 -581
  16. package/package.json +1 -1
  17. package/dist/Shared/Components/Table/BulkSelectionActionWidget.d.ts +0 -3
  18. package/dist/Shared/Components/Table/InternalTable.d.ts +0 -3
  19. package/dist/Shared/Components/Table/Table.component.d.ts +0 -3
  20. package/dist/Shared/Components/Table/UseResizableTableConfigWrapper.d.ts +0 -3
  21. package/dist/Shared/Components/Table/UseStateFilterWrapper.d.ts +0 -3
  22. package/dist/Shared/Components/Table/UseUrlFilterWrapper.d.ts +0 -3
  23. package/dist/Shared/Components/Table/constants.d.ts +0 -5
  24. package/dist/Shared/Components/Table/index.d.ts +0 -3
  25. package/dist/Shared/Components/Table/types.d.ts +0 -202
  26. package/dist/Shared/Components/Table/useTableWithKeyboardShortcuts.d.ts +0 -6
  27. package/dist/Shared/Components/Table/utils.d.ts +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "1.10.1-beta-1",
3
+ "version": "1.10.3",
4
4
  "description": "Supporting common component library",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,3 +0,0 @@
1
- import { BulkSelectionActionWidgetProps } from './types';
2
- declare const BulkSelectionActionWidget: ({ count, handleClearBulkSelection, parentRef, BulkActionsComponent, }: BulkSelectionActionWidgetProps) => JSX.Element;
3
- export default BulkSelectionActionWidget;
@@ -1,3 +0,0 @@
1
- import { InternalTablePropsWithWrappers } from './types';
2
- declare const InternalTable: ({ filtersVariant, filterData, rows, getRows, columns, ViewWrapper, resizableConfig, emptyStateConfig, additionalProps, configurableColumns, filter, setVisibleColumns, visibleColumns, stylesConfig, loading, bulkSelectionConfig, bulkSelectionReturnValue, handleClearBulkSelection, handleToggleBulkSelectionOnRow, paginationVariant, RowActionsOnHoverComponent, }: InternalTablePropsWithWrappers) => JSX.Element;
3
- export default InternalTable;
@@ -1,3 +0,0 @@
1
- import { TableProps } from './types';
2
- declare const TableWrapper: (tableProps: TableProps) => JSX.Element;
3
- export default TableWrapper;
@@ -1,3 +0,0 @@
1
- import { UseResizableTableConfigWrapperProps } from './types';
2
- declare const UseResizableTableConfigWrapper: ({ children, columns }: UseResizableTableConfigWrapperProps) => import('react').ReactElement<import('./types').InternalTableProps, string | import('react').JSXElementConstructor<any>>;
3
- export default UseResizableTableConfigWrapper;
@@ -1,3 +0,0 @@
1
- import { FiltersTypeEnum, FilterWrapperProps } from './types';
2
- declare const UseStateFilterWrapper: ({ children, additionalFilterProps }: FilterWrapperProps<FiltersTypeEnum.STATE>) => import('react').ReactElement<import('./types').InternalTableProps, string | import('react').JSXElementConstructor<any>>;
3
- export default UseStateFilterWrapper;
@@ -1,3 +0,0 @@
1
- import { FiltersTypeEnum, FilterWrapperProps } from './types';
2
- declare const UseUrlFilterWrapper: ({ children, additionalFilterProps }: FilterWrapperProps<FiltersTypeEnum.URL>) => import('react').ReactElement<import('./types').InternalTableProps, string | import('react').JSXElementConstructor<any>>;
3
- export default UseUrlFilterWrapper;
@@ -1,5 +0,0 @@
1
- export declare const SEARCH_SORT_CHANGE_DEBOUNCE_TIME = 350; /** in ms */
2
- export declare const LOCAL_STORAGE_EXISTS: boolean;
3
- export declare const LOCAL_STORAGE_KEY_FOR_VISIBLE_COLUMNS = "generic-table-configurable-columns";
4
- export declare const BULK_ACTION_GUTTER_LABEL = "bulk-action-gutter";
5
- export declare const EVENT_TARGET: EventTarget;
@@ -1,3 +0,0 @@
1
- export { default as Table } from './Table.component';
2
- export { FiltersTypeEnum, PaginationEnum, SignalEnum as TableSignalEnum } from './types';
3
- export type { ViewWrapperProps as TableViewWrapperProps, Column as TableColumnType, TableProps, CellComponentProps as TableCellComponentProps, } from './types';
@@ -1,202 +0,0 @@
1
- import { Dispatch, FunctionComponent, ReactElement, SetStateAction } from 'react';
2
- import { SortableTableHeaderCellProps, useResizableTableConfig } from '../../../Common/SortableTableHeaderCell';
3
- import { UseStateFiltersProps, UseStateFiltersReturnType, UseUrlFiltersProps } from '../../../Common/Hooks';
4
- import { GenericEmptyStateType } from '../../../Common/index';
5
- import { GenericFilterEmptyStateProps } from '@Common/EmptyState/types';
6
- import { useBulkSelection, UseBulkSelectionProps } from '../BulkSelection';
7
- export interface UseFiltersReturnType extends UseStateFiltersReturnType<string> {
8
- }
9
- export declare enum SignalEnum {
10
- ENTER_PRESSED = "enter-pressed",
11
- DELETE_PRESSED = "delete-pressed",
12
- ESCAPE_PRESSED = "escape-pressed",
13
- OPEN_CONTEXT_MENU = "open-context-menu",
14
- /** TODO: Not yet implemented */
15
- BULK_SELECTION_CHANGED = "bulk-selection-changed",
16
- ACTIVE_ROW_CHANGED = "active-row-changed",
17
- ROW_CLICKED = "row-clicked"
18
- }
19
- export interface SignalsType<T extends string = SignalEnum> extends Pick<EventTarget, 'addEventListener' | 'removeEventListener'> {
20
- addEventListener: (type: T, callback: (event: CustomEvent) => void, options?: Parameters<EventTarget['addEventListener']>[2]) => ReturnType<EventTarget['addEventListener']>;
21
- removeEventListener: (type: T, callback: (event: CustomEvent) => void, options?: Parameters<EventTarget['removeEventListener']>[2]) => ReturnType<EventTarget['removeEventListener']>;
22
- }
23
- type SizeType = {
24
- /** This signifies this column is resizable */
25
- range: {
26
- startWidth: number;
27
- minWidth: number;
28
- maxWidth: number | 'infinite';
29
- };
30
- /** If we want a fixed width */
31
- fixed?: never;
32
- } | {
33
- range?: never;
34
- fixed: number;
35
- } | null;
36
- type BaseColumnType = {
37
- /** This is the key using which we will fetch the data of */
38
- field: string;
39
- /** This is the string that will be displayed to the user as header text */
40
- label?: string;
41
- /**
42
- * If we want resizable columns, then every column has to have a fixed height
43
- * If we specify size to be null then the size be will set to 1fr
44
- */
45
- size: SizeType;
46
- horizontallySticky?: boolean;
47
- };
48
- interface AdditionalProps {
49
- [key: string]: unknown;
50
- }
51
- type RowType = {
52
- id: string;
53
- data: Record<string, unknown>;
54
- };
55
- export type RowsType = RowType[];
56
- export interface CellComponentProps extends Pick<BaseColumnType, 'field'>, AdditionalProps {
57
- signals: SignalsType;
58
- value: unknown;
59
- row: RowType;
60
- filterData: UseFiltersReturnType;
61
- isRowActive: boolean;
62
- }
63
- export type Column = Pick<SortableTableHeaderCellProps, 'showTippyOnTruncate'> & BaseColumnType & {
64
- CellComponent?: FunctionComponent<CellComponentProps>;
65
- } & ({
66
- isSortable: true;
67
- /**
68
- * Compare two rows when sorting is triggered on this column
69
- * Values fed are from the field key in the row's data object
70
- * @returns -1 if a < b, 0 if a === b, 1 if a > b
71
- */
72
- comparator?: (a: unknown, b: unknown) => number;
73
- } | {
74
- isSortable?: false;
75
- comparator?: never;
76
- });
77
- type BulkSelectionConfigType = Pick<UseBulkSelectionProps<unknown>, 'getSelectAllDialogStatus'> & {
78
- /** Make sure to wrap it in useCallback */
79
- onBulkSelectionChanged: (selectedRows: RowsType) => void;
80
- BulkActionsComponent: FunctionComponent<{}>;
81
- };
82
- export declare enum PaginationEnum {
83
- PAGINATED = "paginated",
84
- INFINITE = "infinite",
85
- NOT_PAGINATED = "not-paginated"
86
- }
87
- export declare enum FiltersTypeEnum {
88
- STATE = "state",
89
- URL = "url",
90
- NONE = "none"
91
- }
92
- export interface ConfigurableColumnsType {
93
- allColumns: Column[];
94
- visibleColumns: Column[];
95
- setVisibleColumns: Dispatch<SetStateAction<ConfigurableColumnsType['visibleColumns']>>;
96
- }
97
- interface GetRowsProps extends Pick<UseFiltersReturnType, 'offset' | 'pageSize' | 'searchKey' | 'sortBy' | 'sortOrder'> {
98
- }
99
- type AdditionalFilterPropsType<T extends Exclude<FiltersTypeEnum, FiltersTypeEnum.NONE>> = T extends FiltersTypeEnum.URL ? Pick<UseUrlFiltersProps<string, unknown>, 'parseSearchParams' | 'localStorageKey' | 'redirectionMethod' | 'initialSortKey'> : Pick<UseStateFiltersProps<string>, 'initialSortKey'>;
100
- export type InternalTableProps = Record<'filterData', UseFiltersReturnType> & Record<'resizableConfig', ReturnType<typeof useResizableTableConfig>> & Required<Pick<ConfigurableColumnsType, 'visibleColumns' | 'setVisibleColumns'>> & {
101
- id: string;
102
- loading?: boolean;
103
- paginationVariant: PaginationEnum;
104
- /**
105
- * Memoize columns before passing as props.
106
- *
107
- * For columns from backend: initialize as empty array and set loading
108
- * to true until API call completes.
109
- */
110
- columns: Column[];
111
- /** If bulk selections are not a concern omit this prop */
112
- bulkSelectionConfig?: BulkSelectionConfigType;
113
- emptyStateConfig: {
114
- noRowsConfig: Omit<GenericEmptyStateType, 'children'>;
115
- noRowsForFilterConfig?: Pick<GenericFilterEmptyStateProps, 'title' | 'subTitle'> & {
116
- clearFilters: () => void;
117
- };
118
- };
119
- /**
120
- * Enable this to let users choose which columns to display.
121
- * Example: Resource Browser > Node Listing
122
- *
123
- * Using the provided id for this table, we will store the user's preference in localStorage
124
- */
125
- configurableColumns?: boolean;
126
- visibleRowsNumberRef: React.MutableRefObject<number>;
127
- activeRowIndex: number;
128
- additionalProps?: AdditionalProps;
129
- /** Control the look of the table using this prop */
130
- stylesConfig?: {
131
- showSeparatorBetweenRows: boolean;
132
- };
133
- /**
134
- * Use this component to display additional content at the end of a row when it is hovered over.
135
- */
136
- RowActionsOnHoverComponent?: FunctionComponent<{
137
- row: RowsType[number];
138
- }>;
139
- bulkSelectionReturnValue: ReturnType<typeof useBulkSelection> | null;
140
- handleClearBulkSelection: () => void;
141
- handleToggleBulkSelectionOnRow: (row: RowsType[number]) => void;
142
- bulkSelectedRowIdsRef: React.MutableRefObject<string[]>;
143
- activeRowRef: React.MutableRefObject<RowsType[number] | null>;
144
- } & ({
145
- /**
146
- * Direct rows data for frontend-only datasets like resource browser.
147
- */
148
- rows: RowsType;
149
- /**
150
- * Use `getRows` function instead for data that needs to be fetched from backend with pagination/sorting/filtering.
151
- */
152
- getRows?: never;
153
- } | {
154
- rows?: never;
155
- /** NOTE: Sorting on frontend is only handled if rows is provided instead of getRows */
156
- getRows: (props: GetRowsProps) => Promise<RowsType>;
157
- }) & ({
158
- filtersVariant: FiltersTypeEnum.URL;
159
- /**
160
- * props for useUrlFilters/useStateFilters hooks
161
- */
162
- additionalFilterProps?: AdditionalFilterPropsType<FiltersTypeEnum.URL>;
163
- /**
164
- * This func is used to filter the rows based on filter data.
165
- * Only applicable if filtersVariant is NOT set to NONE
166
- *
167
- * If filter is only being used for sorting, then send `noop` in this prop
168
- */
169
- filter: (row: RowsType[number], filterData: UseFiltersReturnType) => boolean;
170
- } | {
171
- filtersVariant: FiltersTypeEnum.STATE;
172
- additionalFilterProps?: AdditionalFilterPropsType<FiltersTypeEnum.STATE>;
173
- filter: (row: RowsType[number], filterData: UseFiltersReturnType) => boolean;
174
- } | {
175
- filtersVariant: FiltersTypeEnum.NONE;
176
- additionalFilterProps?: never;
177
- filter?: never;
178
- });
179
- export interface WrapperProps {
180
- children: ReactElement<InternalTableProps>;
181
- }
182
- export interface ViewWrapperProps extends Pick<UseFiltersReturnType, 'offset' | 'handleSearch' | 'searchKey' | 'sortBy' | 'sortOrder' | 'clearFilters'>, AdditionalProps, Partial<ConfigurableColumnsType>, WrapperProps {
183
- areRowsLoading: boolean;
184
- }
185
- interface WrappersType {
186
- ViewWrapper?: FunctionComponent<ViewWrapperProps>;
187
- }
188
- export type InternalTablePropsWithWrappers = InternalTableProps & WrappersType;
189
- export type TableProps = Pick<InternalTableProps, 'additionalFilterProps' | 'bulkSelectionConfig' | 'configurableColumns' | 'emptyStateConfig' | 'filtersVariant' | 'filter' | 'additionalProps' | 'columns' | 'getRows' | 'rows' | 'paginationVariant' | 'stylesConfig' | 'id' | 'RowActionsOnHoverComponent' | 'loading'> & WrappersType;
190
- export interface FilterWrapperProps<T extends Exclude<FiltersTypeEnum, FiltersTypeEnum.NONE>> extends WrapperProps {
191
- additionalFilterProps?: AdditionalFilterPropsType<T>;
192
- }
193
- export interface UseResizableTableConfigWrapperProps extends WrapperProps {
194
- columns: TableProps['columns'];
195
- }
196
- export interface BulkSelectionActionWidgetProps extends Pick<BulkSelectionConfigType, 'BulkActionsComponent'> {
197
- count: number;
198
- handleClearBulkSelection: () => void;
199
- parentRef: React.RefObject<HTMLDivElement>;
200
- }
201
- export type ConfigurableColumnsConfigType = Record<string, ConfigurableColumnsType['visibleColumns']>;
202
- export {};
@@ -1,6 +0,0 @@
1
- import { InternalTablePropsWithWrappers, RowsType } from './types';
2
- declare const useTableWithKeyboardShortcuts: ({ bulkSelectionConfig, handleToggleBulkSelectionOnRow, bulkSelectionReturnValue, }: Pick<InternalTablePropsWithWrappers, "bulkSelectionConfig" | "bulkSelectionReturnValue" | "handleToggleBulkSelectionOnRow">, visibleRows: RowsType) => {
3
- activeRowIndex: number;
4
- setActiveRowIndex: import('react').Dispatch<import('react').SetStateAction<number>>;
5
- };
6
- export default useTableWithKeyboardShortcuts;
@@ -1,7 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { Column, ConfigurableColumnsType, FiltersTypeEnum, TableProps, UseFiltersReturnType, WrapperProps } from './types';
3
- export declare const searchAndSortRows: (rows: TableProps["rows"], filter: TableProps["filter"], filterData: UseFiltersReturnType, comparator?: Column["comparator"]) => import('./types').RowsType;
4
- export declare const getFilterWrapperComponent: (filtersVariant: FiltersTypeEnum) => FunctionComponent<WrapperProps>;
5
- export declare const getVisibleColumnsFromLocalStorage: ({ allColumns, id, }: Pick<ConfigurableColumnsType, "allColumns"> & Pick<TableProps, "id">) => Column[];
6
- export declare const setVisibleColumnsToLocalStorage: ({ id, visibleColumns, }: Pick<ConfigurableColumnsType, "visibleColumns"> & Pick<TableProps, "id">) => void;
7
- export declare const getVisibleColumns: ({ configurableColumns, columns, id, }: Pick<TableProps, "configurableColumns" | "columns" | "id">) => Column[];