@devtron-labs/devtron-fe-common-lib 1.10.1-beta-1 → 1.10.1-beta-2

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 (25) hide show
  1. package/dist/{@code-editor-BK2IgrtU.js → @code-editor-CPKQ3C33.js} +6510 -6467
  2. package/dist/{@common-rjsf-h6_nZqkx.js → @common-rjsf-B71oS2-A.js} +1 -1
  3. package/dist/Common/Hooks/UseRegisterShortcut/types.d.ts +1 -0
  4. package/dist/Common/Hooks/UseRegisterShortcut/utils.d.ts +1 -1
  5. package/dist/Common/Hooks/useUrlFilters/types.d.ts +3 -3
  6. package/dist/Common/Hooks/useUrlFilters/useUrlFilters.d.ts +1 -1
  7. package/dist/Common/Hooks/useUrlFilters/utils.d.ts +1 -0
  8. package/dist/Shared/Components/Button/index.d.ts +1 -0
  9. package/dist/Shared/Components/Button/types.d.ts +2 -0
  10. package/dist/Shared/Components/Button/useTriggerAutoClickTimestamp.d.ts +6 -0
  11. package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +6 -7
  12. package/dist/Shared/Components/SelectPicker/common.d.ts +0 -1
  13. package/dist/Shared/Components/SelectPicker/type.d.ts +25 -4
  14. package/dist/Shared/Components/Table/InternalTable.d.ts +2 -2
  15. package/dist/Shared/Components/Table/constants.d.ts +5 -0
  16. package/dist/Shared/Components/Table/index.d.ts +1 -0
  17. package/dist/Shared/Components/Table/types.d.ts +25 -33
  18. package/dist/Shared/Components/Table/useTableWithKeyboardShortcuts.d.ts +2 -2
  19. package/dist/Shared/Components/Table/utils.d.ts +4 -5
  20. package/dist/assets/@code-editor.css +1 -1
  21. package/dist/index.js +444 -442
  22. package/package.json +1 -1
  23. package/dist/Shared/Components/Table/UseResizableTableConfigWrapper.d.ts +0 -3
  24. package/dist/Shared/Components/Table/UseStateFilterWrapper.d.ts +0 -3
  25. package/dist/Shared/Components/Table/UseUrlFilterWrapper.d.ts +0 -3
@@ -1,7 +1,7 @@
1
1
  import { j as n, aq as y, as as k, ar as W } from "./@vendor-DXbFZ041.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-BK2IgrtU.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-CPKQ3C33.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";
@@ -8,6 +8,7 @@ export declare const KEYBOARD_KEYS_MAP: {
8
8
  readonly R: "R";
9
9
  readonly K: "K";
10
10
  readonly X: "X";
11
+ readonly A: "A";
11
12
  readonly Escape: "Esc";
12
13
  readonly Enter: "↩";
13
14
  readonly ArrowLeft: "←";
@@ -1,6 +1,6 @@
1
1
  import { ShortcutType } from './types';
2
2
  export declare const preprocessKeys: (keys: ShortcutType["keys"]) => {
3
- keys: ("Escape" | "Control" | "Alt" | "F" | "E" | "R" | "K" | "X" | "Home" | "End" | "." | "Space" | "Shift" | "Meta" | "Enter" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "ArrowDown" | "PageUp" | "PageDown" | "Backspace" | "Delete")[];
3
+ keys: ("Escape" | "Control" | "Alt" | "F" | "E" | "R" | "K" | "X" | "A" | "Home" | "End" | "." | "Space" | "Shift" | "Meta" | "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,5 +1,5 @@
1
1
  import { SortingOrder } from '../../Constants';
2
- export interface UseUrlFiltersProps<T, K> {
2
+ export interface UseUrlFiltersProps<T, K extends {}> {
3
3
  /**
4
4
  * The key on which the sorting should be applied
5
5
  */
@@ -19,8 +19,8 @@ export interface UseUrlFiltersProps<T, K> {
19
19
  */
20
20
  redirectionMethod?: 'replace' | 'push';
21
21
  }
22
- export type UpdateSearchParamsOptionsType<T, K = unknown> = Partial<Pick<UseUrlFiltersProps<T, K>, 'redirectionMethod'>>;
23
- export type UseUrlFiltersReturnType<T, K = unknown> = K & {
22
+ export type UpdateSearchParamsOptionsType<T, K = {}> = Partial<Pick<UseUrlFiltersProps<T, K>, 'redirectionMethod'>>;
23
+ export type UseUrlFiltersReturnType<T, K = {}> = K & {
24
24
  /**
25
25
  * Currently applied page size
26
26
  */
@@ -16,5 +16,5 @@ import { UseUrlFiltersProps, UseUrlFiltersReturnType } from './types';
16
16
  * ```
17
17
  *
18
18
  */
19
- declare const useUrlFilters: <T = string, K = unknown>({ initialSortKey, parseSearchParams, localStorageKey, redirectionMethod, }?: UseUrlFiltersProps<T, K>) => UseUrlFiltersReturnType<T, K>;
19
+ declare const useUrlFilters: <T = string, K = {}>({ initialSortKey, parseSearchParams, localStorageKey, redirectionMethod, }?: UseUrlFiltersProps<T, K>) => UseUrlFiltersReturnType<T, K>;
20
20
  export default useUrlFilters;
@@ -1 +1,2 @@
1
1
  export declare const setItemInLocalStorageIfKeyExists: (localStorageKey: string, value: string) => void;
2
+ export declare const areAnyAdditionalFiltersApplied: (parsedParams: Record<string | number, any>) => boolean;
@@ -1,2 +1,3 @@
1
1
  export { default as Button } from './Button.component';
2
+ export { default as useTriggerAutoClickTimestamp } from './useTriggerAutoClickTimestamp';
2
3
  export * from './types';
@@ -88,6 +88,8 @@ export type ButtonProps<ComponentType extends ButtonComponentType = ButtonCompon
88
88
  isOpacityHoverChild?: boolean;
89
89
  /**
90
90
  * If provided, the button is clicked automatically after the pre-defined time
91
+ *
92
+ * Use from useTriggerAutoClickTimestamp hook
91
93
  */
92
94
  triggerAutoClickTimestamp?: number | null;
93
95
  } & ({
@@ -0,0 +1,6 @@
1
+ declare const useTriggerAutoClickTimestamp: () => {
2
+ triggerAutoClickTimestamp: number;
3
+ setTriggerAutoClickTimestampToNow: () => void;
4
+ resetTriggerAutoClickTimestamp: () => void;
5
+ };
6
+ export default useTriggerAutoClickTimestamp;
@@ -37,16 +37,15 @@ import { SelectPickerProps } from './type';
37
37
  * <SelectPicker ... helperText="Help information" />
38
38
  * ```
39
39
  *
40
- * @example Menu list footer
40
+ * @example Menu list footer config
41
41
  * The footer is sticky by default
42
42
  * ```tsx
43
43
  * <SelectPicker
44
44
  * ...
45
- * renderMenuListFooter={() => (
46
- * <div className="px-8 py-6 dc__border-top bg__secondary cn-6">
47
- * <div>Foot note</div>
48
- * </div>
49
- * )}
45
+ * menuListFooterConfig={{
46
+ * type: 'text',
47
+ * value: 'Info text',
48
+ * }}
50
49
  * />
51
50
  * ```
52
51
  *
@@ -134,5 +133,5 @@ import { SelectPickerProps } from './type';
134
133
  * />
135
134
  * ```
136
135
  */
137
- declare const SelectPicker: <OptionValue, IsMulti extends boolean>({ error, icon, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, optionListError, reloadOptionList, menuPosition, variant, disableDescriptionEllipsis, multiSelectProps, isMulti, name, classNamePrefix, shouldRenderCustomOptions, isSearchable, selectRef, shouldMenuAlignRight, fullWidth, customSelectedOptionsCount, renderMenuListFooter, isCreatable, onCreateOption, closeMenuOnSelect, shouldShowNoOptionsMessage, shouldRenderTextArea, onKeyDown, shouldHideMenu, warningText, layout, ariaLabel, borderConfig, borderRadiusConfig, labelTippyCustomizedConfig, labelTooltipConfig, ...props }: SelectPickerProps<OptionValue, IsMulti>) => JSX.Element;
136
+ declare const SelectPicker: <OptionValue, IsMulti extends boolean>({ error, icon, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, optionListError, reloadOptionList, menuPosition, variant, disableDescriptionEllipsis, multiSelectProps, isMulti, name, classNamePrefix, shouldRenderCustomOptions, isSearchable, selectRef: refFromConsumer, shouldMenuAlignRight, fullWidth, customSelectedOptionsCount, menuListFooterConfig, isCreatable, onCreateOption, closeMenuOnSelect, shouldShowNoOptionsMessage, shouldRenderTextArea, onKeyDown, shouldHideMenu, warningText, layout, ariaLabel, borderConfig, borderRadiusConfig, labelTippyCustomizedConfig, labelTooltipConfig, ...props }: SelectPickerProps<OptionValue, IsMulti>) => JSX.Element;
138
137
  export default SelectPicker;
@@ -5,7 +5,6 @@ export declare const SelectPickerClearIndicator: <OptionValue>(props: ClearIndic
5
5
  export declare const SelectPickerControl: <OptionValue>(props: ControlProps<SelectPickerOptionType<OptionValue>>) => JSX.Element;
6
6
  export declare const SelectPickerInput: <OptionValue>(props: InputProps<SelectPickerOptionType<OptionValue>>) => JSX.Element;
7
7
  export declare const SelectPickerValueContainer: <OptionValue, IsMulti extends boolean>({ showSelectedOptionsCount, customSelectedOptionsCount, ...props }: ValueContainerProps<SelectPickerOptionType<OptionValue>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "showSelectedOptionsCount" | "customSelectedOptionsCount">) => JSX.Element;
8
- export declare const SelectPickerLoadingIndicator: () => JSX.Element;
9
8
  export declare const SelectPickerOption: <OptionValue, IsMulti extends boolean>({ disableDescriptionEllipsis, ...props }: OptionProps<SelectPickerOptionType<OptionValue>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "disableDescriptionEllipsis">) => JSX.Element;
10
9
  export declare const SelectPickerMenuList: <OptionValue>(props: MenuListProps<SelectPickerOptionType<OptionValue>>) => JSX.Element;
11
10
  export declare const SelectPickerMultiValueLabel: <OptionValue, IsMulti extends boolean>({ getIsOptionValid, ...props }: MultiValueProps<SelectPickerOptionType<OptionValue>, true> & Pick<SelectPickerProps<OptionValue, IsMulti>["multiSelectProps"], "getIsOptionValid">) => JSX.Element;
@@ -7,6 +7,7 @@ import { CreatableProps } from 'react-select/creatable';
7
7
  import { TooltipProps } from '@Common/Tooltip/types';
8
8
  import { ResizableTagTextAreaProps } from '../../../Common/CustomTagSelector';
9
9
  import { FormFieldWrapperProps } from '../FormFieldWrapper/types';
10
+ import { ButtonComponentType, ButtonProps, ButtonVariantType } from '../Button';
10
11
  export interface SelectPickerOptionType<OptionValue = string | number> extends OptionType<OptionValue, ReactNode> {
11
12
  /**
12
13
  * Description to be displayed for the option
@@ -26,16 +27,30 @@ export interface SelectPickerOptionType<OptionValue = string | number> extends O
26
27
  tooltipProps?: Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate' | 'shortcutKeyCombo'> | (Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate' | 'content'> & Required<Pick<TooltipProps, 'shortcutKeyCombo'>>);
27
28
  }
28
29
  type SelectProps<OptionValue, IsMulti extends boolean> = ReactSelectProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>;
30
+ type MenuListFooterConfigType = {
31
+ type: 'text';
32
+ /**
33
+ * String is preferred for text type
34
+ */
35
+ value: ReactNode;
36
+ buttonProps?: never;
37
+ } | {
38
+ type: 'button';
39
+ value?: never;
40
+ buttonProps: {
41
+ variant: ButtonVariantType.primary | ButtonVariantType.borderLess;
42
+ } & Omit<ButtonProps<ButtonComponentType>, 'size' | 'fullWidth' | 'icon' | 'endIcon' | 'variant' | 'style'>;
43
+ };
29
44
  declare module 'react-select/base' {
30
45
  interface Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
31
46
  /**
32
- * Render function for the footer at the bottom of menu list. It is sticky by default
47
+ * Config for the footer at the bottom of menu list. It is sticky by default
33
48
  */
34
- renderMenuListFooter?: () => ReactNode;
49
+ menuListFooterConfig?: MenuListFooterConfigType;
35
50
  /**
36
51
  * If true, custom options are rendered in the menuList component of react select
37
52
  *
38
- * Note: renderCustomOptions is required to be passed; renderMenuListFooter is also not called
53
+ * Note: renderCustomOptions is required to be passed; menuListFooterConfig is also not used
39
54
  *
40
55
  * @default false
41
56
  */
@@ -80,7 +95,13 @@ export declare enum SelectPickerVariantType {
80
95
  DEFAULT = "default",
81
96
  BORDER_LESS = "border-less"
82
97
  }
83
- 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' | 'filterOption' | 'noOptionsMessage'> & Partial<Pick<SelectProps<OptionValue, IsMulti>, 'renderMenuListFooter' | 'shouldRenderCustomOptions' | 'renderCustomOptions' | 'icon' | 'showSelectedOptionIcon' | 'renderOptionsFooter' | 'shouldRenderTextArea'>> & Required<Pick<SelectProps<OptionValue, IsMulti>, 'inputId'>> & Partial<Pick<CreatableProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>, 'onCreateOption' | 'formatCreateLabel' | 'menuPortalTarget'>> & Omit<FormFieldWrapperProps, 'children'> & {
98
+ 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' | 'filterOption' | 'noOptionsMessage'> & Partial<Pick<SelectProps<OptionValue, IsMulti>, 'shouldRenderCustomOptions' | 'renderCustomOptions' | 'icon' | 'showSelectedOptionIcon' | 'renderOptionsFooter' | 'shouldRenderTextArea'>> & Required<Pick<SelectProps<OptionValue, IsMulti>, 'inputId'>> & Partial<Pick<CreatableProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>, 'onCreateOption' | 'formatCreateLabel' | 'menuPortalTarget'>> & Omit<FormFieldWrapperProps, 'children'> & {
99
+ /**
100
+ * Config for the footer at the bottom of menu list. It is sticky by default
101
+ *
102
+ * Note: Re-declaring here since dynamic typing doesn't work with module augmentation
103
+ */
104
+ menuListFooterConfig?: MenuListFooterConfigType;
84
105
  /**
85
106
  * Custom selected options count for use cases like filters
86
107
  */
@@ -1,3 +1,3 @@
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;
1
+ import { InternalTableProps } from './types';
2
+ declare const InternalTable: ({ filtersVariant, filterData, rows, getRows, columns, ViewWrapper, resizableConfig, emptyStateConfig, additionalProps, areColumnsConfigurable, filter, setVisibleColumns, visibleColumns, stylesConfig, loading, bulkSelectionConfig, bulkSelectionReturnValue, handleClearBulkSelection, handleToggleBulkSelectionOnRow, paginationVariant, RowActionsOnHoverComponent, }: InternalTableProps) => JSX.Element;
3
3
  export default InternalTable;
@@ -3,3 +3,8 @@ export declare const LOCAL_STORAGE_EXISTS: boolean;
3
3
  export declare const LOCAL_STORAGE_KEY_FOR_VISIBLE_COLUMNS = "generic-table-configurable-columns";
4
4
  export declare const BULK_ACTION_GUTTER_LABEL = "bulk-action-gutter";
5
5
  export declare const EVENT_TARGET: EventTarget;
6
+ export declare const DRAG_SELECTOR_IDENTIFIER = "table-drag-selector";
7
+ export declare const TABLE_ID_MAP: {
8
+ readonly STORYBOOK: "storybook-table";
9
+ };
10
+ export declare const SHIMMER_DUMMY_ARRAY: number[];
@@ -1,3 +1,4 @@
1
1
  export { default as Table } from './Table.component';
2
2
  export { FiltersTypeEnum, PaginationEnum, SignalEnum as TableSignalEnum } from './types';
3
3
  export type { ViewWrapperProps as TableViewWrapperProps, Column as TableColumnType, TableProps, CellComponentProps as TableCellComponentProps, } from './types';
4
+ export { TABLE_ID_MAP } from './constants';
@@ -1,8 +1,9 @@
1
- import { Dispatch, FunctionComponent, ReactElement, SetStateAction } from 'react';
1
+ import { Dispatch, FunctionComponent, PropsWithChildren, SetStateAction } from 'react';
2
2
  import { SortableTableHeaderCellProps, useResizableTableConfig } from '../../../Common/SortableTableHeaderCell';
3
3
  import { UseStateFiltersProps, UseStateFiltersReturnType, UseUrlFiltersProps } from '../../../Common/Hooks';
4
4
  import { GenericEmptyStateType } from '../../../Common/index';
5
5
  import { GenericFilterEmptyStateProps } from '@Common/EmptyState/types';
6
+ import { TABLE_ID_MAP } from './constants';
6
7
  import { useBulkSelection, UseBulkSelectionProps } from '../BulkSelection';
7
8
  export interface UseFiltersReturnType extends UseStateFiltersReturnType<string> {
8
9
  }
@@ -11,9 +12,6 @@ export declare enum SignalEnum {
11
12
  DELETE_PRESSED = "delete-pressed",
12
13
  ESCAPE_PRESSED = "escape-pressed",
13
14
  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
15
  ROW_CLICKED = "row-clicked"
18
16
  }
19
17
  export interface SignalsType<T extends string = SignalEnum> extends Pick<EventTarget, 'addEventListener' | 'removeEventListener'> {
@@ -48,7 +46,7 @@ type BaseColumnType = {
48
46
  interface AdditionalProps {
49
47
  [key: string]: unknown;
50
48
  }
51
- type RowType = {
49
+ export type RowType = {
52
50
  id: string;
53
51
  data: Record<string, unknown>;
54
52
  };
@@ -97,8 +95,11 @@ export interface ConfigurableColumnsType {
97
95
  interface GetRowsProps extends Pick<UseFiltersReturnType, 'offset' | 'pageSize' | 'searchKey' | 'sortBy' | 'sortOrder'> {
98
96
  }
99
97
  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;
98
+ export type ViewWrapperProps = PropsWithChildren<Pick<UseFiltersReturnType, 'offset' | 'handleSearch' | 'searchKey' | 'sortBy' | 'sortOrder' | 'clearFilters'> & AdditionalProps & Partial<ConfigurableColumnsType> & {
99
+ areRowsLoading: boolean;
100
+ }>;
101
+ export type InternalTableProps = Required<Pick<ConfigurableColumnsType, 'visibleColumns' | 'setVisibleColumns'>> & {
102
+ id: (typeof TABLE_ID_MAP)[keyof typeof TABLE_ID_MAP];
102
103
  loading?: boolean;
103
104
  paginationVariant: PaginationEnum;
104
105
  /**
@@ -116,15 +117,15 @@ export type InternalTableProps = Record<'filterData', UseFiltersReturnType> & Re
116
117
  clearFilters: () => void;
117
118
  };
118
119
  };
120
+ filterData: UseFiltersReturnType | null;
121
+ resizableConfig: ReturnType<typeof useResizableTableConfig> | null;
119
122
  /**
120
123
  * Enable this to let users choose which columns to display.
121
124
  * Example: Resource Browser > Node Listing
122
125
  *
123
126
  * Using the provided id for this table, we will store the user's preference in localStorage
124
127
  */
125
- configurableColumns?: boolean;
126
- visibleRowsNumberRef: React.MutableRefObject<number>;
127
- activeRowIndex: number;
128
+ areColumnsConfigurable?: boolean;
128
129
  additionalProps?: AdditionalProps;
129
130
  /** Control the look of the table using this prop */
130
131
  stylesConfig?: {
@@ -134,13 +135,12 @@ export type InternalTableProps = Record<'filterData', UseFiltersReturnType> & Re
134
135
  * Use this component to display additional content at the end of a row when it is hovered over.
135
136
  */
136
137
  RowActionsOnHoverComponent?: FunctionComponent<{
137
- row: RowsType[number];
138
+ row: RowType;
138
139
  }>;
139
140
  bulkSelectionReturnValue: ReturnType<typeof useBulkSelection> | null;
140
141
  handleClearBulkSelection: () => void;
141
- handleToggleBulkSelectionOnRow: (row: RowsType[number]) => void;
142
- bulkSelectedRowIdsRef: React.MutableRefObject<string[]>;
143
- activeRowRef: React.MutableRefObject<RowsType[number] | null>;
142
+ handleToggleBulkSelectionOnRow: (row: RowType) => void;
143
+ ViewWrapper?: FunctionComponent<ViewWrapperProps>;
144
144
  } & ({
145
145
  /**
146
146
  * Direct rows data for frontend-only datasets like resource browser.
@@ -166,37 +166,29 @@ export type InternalTableProps = Record<'filterData', UseFiltersReturnType> & Re
166
166
  *
167
167
  * If filter is only being used for sorting, then send `noop` in this prop
168
168
  */
169
- filter: (row: RowsType[number], filterData: UseFiltersReturnType) => boolean;
169
+ filter: (row: RowType, filterData: UseFiltersReturnType) => boolean;
170
170
  } | {
171
171
  filtersVariant: FiltersTypeEnum.STATE;
172
172
  additionalFilterProps?: AdditionalFilterPropsType<FiltersTypeEnum.STATE>;
173
- filter: (row: RowsType[number], filterData: UseFiltersReturnType) => boolean;
173
+ filter: (row: RowType, filterData: UseFiltersReturnType) => boolean;
174
174
  } | {
175
175
  filtersVariant: FiltersTypeEnum.NONE;
176
176
  additionalFilterProps?: never;
177
177
  filter?: never;
178
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
- }
179
+ export type UseResizableTableConfigWrapperProps = Omit<InternalTableProps, 'resizableConfig'>;
180
+ export type TableWithBulkSelectionProps = Omit<UseResizableTableConfigWrapperProps, 'bulkSelectionReturnValue' | 'handleClearBulkSelection' | 'handleToggleBulkSelectionOnRow'>;
181
+ export type VisibleColumnsWrapperProps = Omit<TableWithBulkSelectionProps, 'visibleColumns' | 'setVisibleColumns'>;
182
+ export type FilterWrapperProps = Omit<VisibleColumnsWrapperProps, 'filterData'>;
183
+ export type TableProps = Pick<FilterWrapperProps, 'additionalFilterProps' | 'bulkSelectionConfig' | 'areColumnsConfigurable' | 'emptyStateConfig' | 'filtersVariant' | 'filter' | 'additionalProps' | 'columns' | 'getRows' | 'rows' | 'paginationVariant' | 'stylesConfig' | 'id' | 'RowActionsOnHoverComponent' | 'loading' | 'ViewWrapper'>;
196
184
  export interface BulkSelectionActionWidgetProps extends Pick<BulkSelectionConfigType, 'BulkActionsComponent'> {
197
185
  count: number;
198
186
  handleClearBulkSelection: () => void;
199
187
  parentRef: React.RefObject<HTMLDivElement>;
200
188
  }
201
189
  export type ConfigurableColumnsConfigType = Record<string, ConfigurableColumnsType['visibleColumns']>;
190
+ export interface GetFilteringPromiseProps {
191
+ searchSortTimeoutRef: React.MutableRefObject<number>;
192
+ callback: () => Promise<RowsType> | RowsType;
193
+ }
202
194
  export {};
@@ -1,5 +1,5 @@
1
- import { InternalTablePropsWithWrappers, RowsType } from './types';
2
- declare const useTableWithKeyboardShortcuts: ({ bulkSelectionConfig, handleToggleBulkSelectionOnRow, bulkSelectionReturnValue, }: Pick<InternalTablePropsWithWrappers, "bulkSelectionConfig" | "bulkSelectionReturnValue" | "handleToggleBulkSelectionOnRow">, visibleRows: RowsType) => {
1
+ import { InternalTableProps, RowsType } from './types';
2
+ declare const useTableWithKeyboardShortcuts: ({ bulkSelectionConfig, handleToggleBulkSelectionOnRow, bulkSelectionReturnValue, }: Pick<InternalTableProps, "bulkSelectionConfig" | "bulkSelectionReturnValue" | "handleToggleBulkSelectionOnRow">, visibleRows: RowsType) => {
3
3
  activeRowIndex: number;
4
4
  setActiveRowIndex: import('react').Dispatch<import('react').SetStateAction<number>>;
5
5
  };
@@ -1,7 +1,6 @@
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>;
1
+ import { Column, ConfigurableColumnsType, GetFilteringPromiseProps, RowsType, TableProps, UseFiltersReturnType } from './types';
2
+ export declare const searchAndSortRows: (rows: TableProps["rows"], filter: TableProps["filter"], filterData: UseFiltersReturnType, comparator?: Column["comparator"]) => RowsType;
5
3
  export declare const getVisibleColumnsFromLocalStorage: ({ allColumns, id, }: Pick<ConfigurableColumnsType, "allColumns"> & Pick<TableProps, "id">) => Column[];
6
4
  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[];
5
+ export declare const getVisibleColumns: ({ areColumnsConfigurable, columns, id, }: Pick<TableProps, "areColumnsConfigurable" | "columns" | "id">) => Column[];
6
+ export declare const getFilteringPromise: ({ searchSortTimeoutRef, callback }: GetFilteringPromiseProps) => Promise<RowsType>;