@linzjs/step-ag-grid 27.0.0 → 27.2.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/GridCell.d.ts +0 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +12 -10
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +1 -1
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +0 -1
- package/dist/src/contexts/GridContext.d.ts +1 -1
- package/dist/step-ag-grid.cjs +27 -22
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +27 -23
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +5 -3
- package/src/components/GridCell.tsx +0 -1
- package/src/components/gridForm/GridFormDropDown.tsx +27 -26
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +4 -4
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +2 -4
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +1 -4
- package/src/components/gridRender/GridRenderGenericCell.tsx +0 -1
- package/src/contexts/GridContext.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +10 -1
- package/src/react-menu3/components/ControlledMenu.tsx +0 -1
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +21 -18
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -2159,7 +2159,7 @@ const ControlledMenuFr = ({ 'aria-label': ariaLabel, className, containerProps,
|
|
|
2159
2159
|
block: menuContainerClass,
|
|
2160
2160
|
modifiers,
|
|
2161
2161
|
className,
|
|
2162
|
-
}), style: { ...containerProps?.style, position: 'relative' }, ref: containerRef, children: state && (jsx(SettingsContext.Provider, { value: settings, children: jsx(ItemSettingsContext.Provider, { value: itemSettings, children: jsx(EventHandlersContext.Provider, { value: eventHandlers, children: jsx(MenuList, { ...restProps, ariaLabel: ariaLabel || 'Menu', externalRef: externalRef, containerRef: containerRef, onClose: onClose
|
|
2162
|
+
}), style: { ...containerProps?.style, position: 'relative' }, ref: containerRef, children: state && (jsx(SettingsContext.Provider, { value: settings, children: jsx(ItemSettingsContext.Provider, { value: itemSettings, children: jsx(EventHandlersContext.Provider, { value: eventHandlers, children: jsx(MenuList, { ...restProps, ariaLabel: ariaLabel || 'Menu', externalRef: externalRef, containerRef: containerRef, onClose: onClose }) }) }) })) }));
|
|
2163
2163
|
if (portal === true && anchorRef?.current != null) {
|
|
2164
2164
|
if (hasParentClass('react-menu-inline-test', anchorRef.current)) {
|
|
2165
2165
|
portal = false;
|
|
@@ -2937,14 +2937,15 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
2937
2937
|
};
|
|
2938
2938
|
});
|
|
2939
2939
|
}, [params.columnDefs, params.loading, params.readOnly, params.defaultColDef?.editable]);
|
|
2940
|
+
const hasExternallySelectedItems = !!params.setExternalSelectedItems;
|
|
2940
2941
|
/**
|
|
2941
2942
|
* When grid is ready set the apis to the grid context and sync selected items to grid.
|
|
2942
2943
|
*/
|
|
2943
2944
|
const onGridReady = useCallback((event) => {
|
|
2944
|
-
setApis(event.api, dataTestId);
|
|
2945
|
+
setApis(event.api, hasExternallySelectedItems, dataTestId);
|
|
2945
2946
|
event.api.showNoRowsOverlay();
|
|
2946
2947
|
synchroniseExternallySelectedItemsToGrid();
|
|
2947
|
-
}, [dataTestId, setApis, synchroniseExternallySelectedItemsToGrid]);
|
|
2948
|
+
}, [dataTestId, hasExternallySelectedItems, setApis, synchroniseExternallySelectedItemsToGrid]);
|
|
2948
2949
|
/**
|
|
2949
2950
|
* When the grid is being initialized the data may be empty.
|
|
2950
2951
|
* This will resize columns when we have at least one row.
|
|
@@ -2997,7 +2998,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
2997
2998
|
* Handle single click edits
|
|
2998
2999
|
*/
|
|
2999
3000
|
const onCellClicked = useCallback((event) => {
|
|
3000
|
-
if (event.colDef
|
|
3001
|
+
if (event.colDef.singleClickEdit ?? singleClickEdit) {
|
|
3001
3002
|
void startCellEditing({ rowId: event.data.id, colId: event.column.getColId() });
|
|
3002
3003
|
}
|
|
3003
3004
|
}, [singleClickEdit, startCellEditing]);
|
|
@@ -3944,6 +3945,12 @@ const useGridPopoverHook = (props) => {
|
|
|
3944
3945
|
};
|
|
3945
3946
|
};
|
|
3946
3947
|
|
|
3948
|
+
const primitiveToSelectOption = (value) => {
|
|
3949
|
+
return {
|
|
3950
|
+
value: value,
|
|
3951
|
+
label: value ? String(value) : '',
|
|
3952
|
+
};
|
|
3953
|
+
};
|
|
3947
3954
|
const MenuSeparatorString = '_____MENU_SEPARATOR_____';
|
|
3948
3955
|
const MenuSeparator = Object.freeze({ value: MenuSeparatorString });
|
|
3949
3956
|
const MenuHeaderString = '_____MENU_HEADER_____';
|
|
@@ -3992,14 +3999,7 @@ const GridFormDropDown = (props) => {
|
|
|
3992
3999
|
optionsConf = await optionsConf(selectedRows, filter);
|
|
3993
4000
|
}
|
|
3994
4001
|
if (optionsConf !== undefined) {
|
|
3995
|
-
|
|
3996
|
-
? {
|
|
3997
|
-
value: item,
|
|
3998
|
-
label: item,
|
|
3999
|
-
disabled: false,
|
|
4000
|
-
}
|
|
4001
|
-
: item);
|
|
4002
|
-
setOptions(optionsList);
|
|
4002
|
+
setOptions(optionsConf);
|
|
4003
4003
|
}
|
|
4004
4004
|
})();
|
|
4005
4005
|
}, [filter, options, props, selectedRows]);
|
|
@@ -4096,7 +4096,7 @@ const GridFormDropDown = (props) => {
|
|
|
4096
4096
|
}
|
|
4097
4097
|
}, onClick: (e) => {
|
|
4098
4098
|
e.keepOpen = !!item.subComponent;
|
|
4099
|
-
}, children: [item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`), item.subComponent ? '...' : ''] }, `${fieldToString(field)}-${index}`), item.subComponent && selectedItem === item && (jsx(FocusableItem, { className: 'LuiDeprecatedForms', children: () => (jsx(GridSubComponentContext.Provider, { value: {
|
|
4099
|
+
}, children: [item.label ?? (item.value == null ? `<${String(item.value)}>` : `${String(item.value)}`), item.subComponent ? '...' : ''] }, `${fieldToString(field)}-${index}`), item.subComponent && selectedItem === item && (jsx(FocusableItem, { className: 'LuiDeprecatedForms', children: () => (jsx(GridSubComponentContext.Provider, { value: {
|
|
4100
4100
|
context: { options },
|
|
4101
4101
|
data,
|
|
4102
4102
|
value: subSelectedValue,
|
|
@@ -4986,11 +4986,9 @@ const GridPopoverMenu = (colDef, custom) => GridCell({
|
|
|
4986
4986
|
exportable: false,
|
|
4987
4987
|
cellStyle: { flex: 1, justifyContent: 'center' },
|
|
4988
4988
|
cellRenderer: GridRenderPopoutMenuCell,
|
|
4989
|
+
// Menus open on single click, this parameter is picked up in Grid.tsx
|
|
4990
|
+
singleClickEdit: true,
|
|
4989
4991
|
...colDef,
|
|
4990
|
-
cellRendererParams: {
|
|
4991
|
-
// Menus open on single click, this parameter is picked up in Grid.tsx
|
|
4992
|
-
singleClickEdit: true,
|
|
4993
|
-
},
|
|
4994
4992
|
}, {
|
|
4995
4993
|
editor: GridFormPopoverMenu,
|
|
4996
4994
|
preventAutoEdit: true,
|
|
@@ -5000,10 +4998,7 @@ const GridPopoverMenu = (colDef, custom) => GridCell({
|
|
|
5000
4998
|
const GridPopoverMessage = (colDef, props) => GridCell({
|
|
5001
4999
|
resizable: true,
|
|
5002
5000
|
...colDef,
|
|
5003
|
-
|
|
5004
|
-
singleClickEdit: true,
|
|
5005
|
-
...colDef.cellRendererParams,
|
|
5006
|
-
},
|
|
5001
|
+
singleClickEdit: true,
|
|
5007
5002
|
}, {
|
|
5008
5003
|
editor: GridFormMessage,
|
|
5009
5004
|
...props,
|
|
@@ -5033,6 +5028,7 @@ const GridContextProvider = (props) => {
|
|
|
5033
5028
|
const [quickFilter, _setQuickFilter] = useState('');
|
|
5034
5029
|
const [invisibleColumnIds, _setInvisibleColumnIds] = useState();
|
|
5035
5030
|
const testId = useRef();
|
|
5031
|
+
const hasExternallySelectedItemsRef = useRef(false);
|
|
5036
5032
|
const idsBeforeUpdate = useRef([]);
|
|
5037
5033
|
const prePopupFocusedCell = useRef();
|
|
5038
5034
|
const [externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync] = useState(false);
|
|
@@ -5096,7 +5092,8 @@ const GridContextProvider = (props) => {
|
|
|
5096
5092
|
/**
|
|
5097
5093
|
* Set the grid api when the grid is ready.
|
|
5098
5094
|
*/
|
|
5099
|
-
const setApis = useCallback((gridApi, dataTestId) => {
|
|
5095
|
+
const setApis = useCallback((gridApi, hasExternallySelectedItems, dataTestId) => {
|
|
5096
|
+
hasExternallySelectedItemsRef.current = hasExternallySelectedItems;
|
|
5100
5097
|
testId.current = dataTestId;
|
|
5101
5098
|
setGridApi(gridApi);
|
|
5102
5099
|
gridApi?.setGridOption('quickFilterText', quickFilter);
|
|
@@ -5350,10 +5347,17 @@ const GridContextProvider = (props) => {
|
|
|
5350
5347
|
externallySelectedItemsAreInSyncRef.current = externallySelectedItemsAreInSync;
|
|
5351
5348
|
}, [externallySelectedItemsAreInSync]);
|
|
5352
5349
|
const waitForExternallySelectedItemsToBeInSync = useCallback(async () => {
|
|
5350
|
+
if (!hasExternallySelectedItemsRef.current) {
|
|
5351
|
+
externallySelectedItemsAreInSyncRef.current = true;
|
|
5352
|
+
return;
|
|
5353
|
+
}
|
|
5353
5354
|
// Wait for up to 5 seconds
|
|
5354
5355
|
for (let i = 0; i < 5000 / 200 && !externallySelectedItemsAreInSyncRef.current; i++) {
|
|
5355
5356
|
await wait(200);
|
|
5356
5357
|
}
|
|
5358
|
+
if (!externallySelectedItemsAreInSyncRef.current) {
|
|
5359
|
+
console.error('externallySelectedItems did not sync with ag-grid selection');
|
|
5360
|
+
}
|
|
5357
5361
|
}, []);
|
|
5358
5362
|
const startCellEditing = useCallback(async ({ rowId, colId }) => {
|
|
5359
5363
|
if (!gridApi)
|
|
@@ -5794,5 +5798,5 @@ const useDeferredPromise = () => {
|
|
|
5794
5798
|
};
|
|
5795
5799
|
};
|
|
5796
5800
|
|
|
5797
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridButton, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridEditBoolean, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridNoRowsOverlayFr, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, 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, TextInputValidator, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, convertDDToDMS, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, textMatch, useDeferredPromise, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
5801
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridButton, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridEditBoolean, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridNoRowsOverlayFr, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, 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, TextInputValidator, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, convertDDToDMS, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, primitiveToSelectOption, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, textMatch, useDeferredPromise, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
5798
5802
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|