@linzjs/step-ag-grid 12.0.0 → 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.
- package/dist/src/components/GridFilter.d.ts +2 -1
- package/dist/src/components/gridFilter/GridFilterButtons.d.ts +16 -0
- package/dist/src/components/gridFilter/GridFilterQuick.d.ts +1 -0
- package/dist/src/contexts/GridContext.d.ts +6 -5
- package/dist/src/contexts/GridContextProvider.d.ts +2 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/step-ag-grid.esm.js +36 -2
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridFilter.ts +6 -3
- package/src/components/gridFilter/GridFilterButtons.tsx +52 -0
- package/src/contexts/GridContext.tsx +8 -6
- package/src/contexts/GridContextProvider.tsx +4 -4
- package/src/index.ts +5 -0
- package/src/stories/grid/GridReadOnly.stories.tsx +15 -1
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { GridFilterExternal } from "../contexts/GridContext";
|
|
2
|
-
|
|
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:
|
|
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 {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export * from "./components/gridForm/GridFormTextInput";
|
|
|
35
35
|
export * from "./components/gridForm/GridFormTextArea";
|
|
36
36
|
export * from "./components/gridForm/GridFormMessage";
|
|
37
37
|
export * from "./components/gridForm/GridFormEditBearing";
|
|
38
|
+
export { useGridFilter } from "./components/GridFilter";
|
|
39
|
+
export * from "./components/gridFilter/GridFilterQuick";
|
|
40
|
+
export * from "./components/gridFilter/GridFilters";
|
|
41
|
+
export * from "./components/GridWrapper";
|
|
38
42
|
export { GridHeaderSelect } from "./components/gridHeader/GridHeaderSelect";
|
|
39
43
|
export { TextAreaInput } from "./lui/TextAreaInput";
|
|
40
44
|
export { TextInputFormatted } from "./lui/TextInputFormatted";
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -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 () {
|
|
@@ -60410,6 +60411,39 @@ var GridFormSubComponentTextInput = function (props) {
|
|
|
60410
60411
|
return (jsx(TextInputFormatted, { value: value, error: invalid(), onChange: function (e) { return setValue(e.target.value); }, helpText: helpText, placeholder: props.placeholder, style: { width: "100%" }, allowTabToSave: true }));
|
|
60411
60412
|
};
|
|
60412
60413
|
|
|
60414
|
+
var useGridFilter = function (filter) {
|
|
60415
|
+
var _a = useContext(GridContext), addExternalFilter = _a.addExternalFilter, removeExternalFilter = _a.removeExternalFilter;
|
|
60416
|
+
useEffect(function () {
|
|
60417
|
+
var thisFilter = filter;
|
|
60418
|
+
thisFilter && addExternalFilter(thisFilter);
|
|
60419
|
+
return function () {
|
|
60420
|
+
thisFilter && removeExternalFilter(thisFilter);
|
|
60421
|
+
};
|
|
60422
|
+
}, [addExternalFilter, filter, removeExternalFilter]);
|
|
60423
|
+
};
|
|
60424
|
+
|
|
60425
|
+
var GridFilterQuick = function (_a) {
|
|
60426
|
+
var quickFilterPlaceholder = _a.quickFilterPlaceholder, defaultValue = _a.defaultValue;
|
|
60427
|
+
var setQuickFilter = useContext(GridContext).setQuickFilter;
|
|
60428
|
+
var _b = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""), quickFilterValue = _b[0], setQuickFilterValue = _b[1];
|
|
60429
|
+
useEffect(function () {
|
|
60430
|
+
setQuickFilter(quickFilterValue);
|
|
60431
|
+
}, [quickFilterValue, setQuickFilter]);
|
|
60432
|
+
return (jsx("input", { "aria-label": "Search", className: "lui-margin-top-xxs lui-margin-bottom-xxs Grid-quickFilterBox", type: "text", placeholder: quickFilterPlaceholder !== null && quickFilterPlaceholder !== void 0 ? quickFilterPlaceholder : "Search...", value: quickFilterValue, onChange: function (event) {
|
|
60433
|
+
setQuickFilterValue(event.target.value);
|
|
60434
|
+
} }));
|
|
60435
|
+
};
|
|
60436
|
+
|
|
60437
|
+
var GridFilters = function (_a) {
|
|
60438
|
+
var children = _a.children;
|
|
60439
|
+
return jsx("div", __assign$9({ className: "Grid-container-filters" }, { children: children }));
|
|
60440
|
+
};
|
|
60441
|
+
|
|
60442
|
+
var GridWrapper = function (_a) {
|
|
60443
|
+
var children = _a.children, maxHeight = _a.maxHeight;
|
|
60444
|
+
return (jsx("div", __assign$9({ className: "Grid-wrapper", style: { maxHeight: maxHeight } }, { children: children })));
|
|
60445
|
+
};
|
|
60446
|
+
|
|
60413
60447
|
var GridFormSubComponentTextArea = function (props) {
|
|
60414
60448
|
var _a;
|
|
60415
60449
|
var _b = useContext(GridSubComponentContext), value = _b.value, data = _b.data, setValue = _b.setValue, setValid = _b.setValid, context = _b.context;
|
|
@@ -80648,5 +80682,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
|
|
|
80648
80682
|
});
|
|
80649
80683
|
}); };
|
|
80650
80684
|
|
|
80651
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, 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, 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, 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 };
|
|
80652
80686
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|