@linzjs/step-ag-grid 12.0.1 → 12.1.0

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,2 +1,3 @@
1
1
  import { GridFilterExternal } from "../contexts/GridContext";
2
- export declare const useGridFilter: (filter: GridFilterExternal) => void;
2
+ import { GridBaseRow } from "./Grid";
3
+ export declare const useGridFilter: <RowType extends GridBaseRow>(filter: GridFilterExternal<RowType> | undefined) => void;
@@ -0,0 +1,16 @@
1
+ import { ClassValue } from "clsx";
2
+ import { LuiButtonProps } from "@linzjs/lui/dist/components/LuiButton/LuiButton";
3
+ import { GridBaseRow } from "../Grid";
4
+ import { GridFilterExternal } from "../../contexts/GridContext";
5
+ interface GridFilterButtonsOption<RowType extends GridBaseRow> {
6
+ defaultSelected?: boolean;
7
+ filter?: GridFilterExternal<RowType>;
8
+ label: string;
9
+ }
10
+ export type GridFilterButtonsProps<RowType extends GridBaseRow> = {
11
+ className?: ClassValue;
12
+ luiButtonProps?: Partial<LuiButtonProps>;
13
+ options: GridFilterButtonsOption<RowType>[];
14
+ };
15
+ export declare const GridFilterButtons: <RowType extends GridBaseRow>({ className, luiButtonProps, options, }: GridFilterButtonsProps<RowType>) => JSX.Element;
16
+ export {};
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { GridApi, RowNode } from "ag-grid-community";
3
3
  import { GridBaseRow } from "../components/Grid";
4
- export type GridFilterExternal = (data: any, rowNode: RowNode) => boolean;
5
- export interface GridContextType {
4
+ export type GridFilterExternal<RowType extends GridBaseRow> = (data: RowType, rowNode: RowNode) => boolean;
5
+ export interface GridContextType<RowType extends GridBaseRow> {
6
6
  gridReady: boolean;
7
7
  setGridApi: (gridApi: GridApi | undefined) => void;
8
8
  prePopupOps: () => void;
@@ -29,9 +29,10 @@ export interface GridContextType {
29
29
  externallySelectedItemsAreInSync: boolean;
30
30
  setExternallySelectedItemsAreInSync: (inSync: boolean) => void;
31
31
  waitForExternallySelectedItemsToBeInSync: () => Promise<void>;
32
- addExternalFilter: (filter: GridFilterExternal) => void;
33
- removeExternalFilter: (filter: GridFilterExternal) => void;
32
+ addExternalFilter: (filter: GridFilterExternal<RowType>) => void;
33
+ removeExternalFilter: (filter: GridFilterExternal<RowType>) => void;
34
34
  isExternalFilterPresent: () => boolean;
35
35
  doesExternalFilterPass: (node: RowNode) => boolean;
36
36
  }
37
- export declare const GridContext: import("react").Context<GridContextType>;
37
+ export declare const GridContext: import("react").Context<GridContextType<any>>;
38
+ export declare const useGridContext: <RowType extends GridBaseRow>() => GridContextType<RowType>;
@@ -1,4 +1,5 @@
1
1
  import { ReactElement, ReactNode } from "react";
2
+ import { GridBaseRow } from "../components/Grid";
2
3
  interface GridContextProps {
3
4
  children: ReactNode;
4
5
  }
@@ -7,5 +8,5 @@ interface GridContextProps {
7
8
  * Make sure you wrap AgGrid in this.
8
9
  * Also, make sure the provider is created in a separate component, otherwise it won't be found.
9
10
  */
10
- export declare const GridContextProvider: (props: GridContextProps) => ReactElement;
11
+ export declare const GridContextProvider: <RowType extends GridBaseRow>(props: GridContextProps) => ReactElement;
11
12
  export {};
@@ -2076,7 +2076,8 @@ var GridContext = createContext({
2076
2076
  console.error("no context provider for doesExternalFilterPass");
2077
2077
  return true;
2078
2078
  }
2079
- });
2079
+ });
2080
+ var useGridContext = function () { return useContext(GridContext); };
2080
2081
 
2081
2082
  var GridUpdatingContext = createContext({
2082
2083
  checkUpdating: function () {
@@ -60414,8 +60415,10 @@ var useGridFilter = function (filter) {
60414
60415
  var _a = useContext(GridContext), addExternalFilter = _a.addExternalFilter, removeExternalFilter = _a.removeExternalFilter;
60415
60416
  useEffect(function () {
60416
60417
  var thisFilter = filter;
60417
- addExternalFilter(thisFilter);
60418
- return function () { return removeExternalFilter(thisFilter); };
60418
+ thisFilter && addExternalFilter(thisFilter);
60419
+ return function () {
60420
+ thisFilter && removeExternalFilter(thisFilter);
60421
+ };
60419
60422
  }, [addExternalFilter, filter, removeExternalFilter]);
60420
60423
  };
60421
60424
 
@@ -80679,5 +80682,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
80679
80682
  });
80680
80683
  }); };
80681
80684
 
80682
- export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
80685
+ export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGridContext, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
80683
80686
  //# sourceMappingURL=step-ag-grid.esm.js.map