@linzjs/step-ag-grid 32.0.0 → 32.1.1
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/types.d.ts +2 -0
- package/dist/step-ag-grid.cjs +19 -5
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +20 -6
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +6 -3
- package/src/components/gridForm/GridFormPopoverMenu.tsx +6 -2
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +10 -3
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +3 -0
- package/src/components/types.ts +2 -0
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +22 -0
- package/src/stories/grid/GridReadOnly.stories.tsx +69 -0
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +47 -0
|
@@ -15,6 +15,8 @@ export interface GridOnRowDragEndProps<TData extends GridBaseRow> {
|
|
|
15
15
|
}
|
|
16
16
|
export interface ColDefT<TData extends GridBaseRow, ValueType = any> extends ColDef<TData, ValueType> {
|
|
17
17
|
editable?: boolean | EditableCallback<TData, ValueType>;
|
|
18
|
+
/** When true, this column's editable state ignores the grid-level `readOnly` prop. */
|
|
19
|
+
ignoreGridReadOnly?: boolean;
|
|
18
20
|
valueGetter?: string | ValueGetterFunc<TData, ValueType>;
|
|
19
21
|
valueFormatter?: string | ValueFormatterFunc<TData, ValueType>;
|
|
20
22
|
cellRenderer?: ((props: ICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined) | string;
|
package/dist/step-ag-grid.cjs
CHANGED
|
@@ -61425,9 +61425,11 @@ maxInitialWidth,
|
|
|
61425
61425
|
}
|
|
61426
61426
|
else {
|
|
61427
61427
|
const colDefEditable = colDef.editable;
|
|
61428
|
-
const
|
|
61428
|
+
const ignoreGridReadOnly = colDef.ignoreGridReadOnly === true;
|
|
61429
|
+
const editable = combineEditables(params.loading !== true, ignoreGridReadOnly ? true : params.readOnly !== true, params.defaultColDef?.editable, colDefEditable);
|
|
61429
61430
|
return {
|
|
61430
|
-
|
|
61431
|
+
// ag-grid warns on unrecognised colDef properties, so it can't be left on the returned colDef
|
|
61432
|
+
...lodashEs.omit(colDef, 'ignoreGridReadOnly'),
|
|
61431
61433
|
editable,
|
|
61432
61434
|
cellClassRules: {
|
|
61433
61435
|
...colDef.cellClassRules,
|
|
@@ -63801,7 +63803,11 @@ const GridFormPopoverMenu = (props) => {
|
|
|
63801
63803
|
invalid: () => subComponentSelected && !subComponentIsValid.current,
|
|
63802
63804
|
save,
|
|
63803
63805
|
});
|
|
63804
|
-
|
|
63806
|
+
// isEmpty(options) alone isn't enough: options can be a non-empty array where every item is
|
|
63807
|
+
// hidden (e.g. all actions unavailable in a given mode), which must also show "No actions"
|
|
63808
|
+
// rather than rendering an empty menu body.
|
|
63809
|
+
const hasVisibleOption = options?.some((item) => !item.hidden && item.label !== __isMenuSeparator__);
|
|
63810
|
+
return popoverWrapper(jsxRuntime.jsx(ComponentLoadingWrapper, { loading: !options, className: 'GridFormPopupMenu', children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: !hasVisibleOption ? (jsxRuntime.jsx(MenuItem, { className: 'GridPopoverMenu-noOptions', disabled: true, children: "No actions" }, `GridPopoverMenu-empty`)) : (options?.map((item, index) => item.label === '__isMenuSeparator__' ? (jsxRuntime.jsx(MenuDivider, {}, `$$divider_${index}`)) : (!item.hidden && (jsxRuntime.jsxs(React13.Fragment, { children: [item.subMenu ? (jsxRuntime.jsx(SubMenu, { disabled: !!item.disabled, label: item.label, title: item.disabled && typeof item.disabled !== 'boolean' ? item.disabled : '', children: jsxRuntime.jsx(item.subMenu, {}) })) : (jsxRuntime.jsx(MenuItem, { onClick: (e) => void onMenuItemClick(e, item), disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== 'boolean' ? item.disabled : '', children: item.label })), item.subComponent && subComponentSelected === item && (jsxRuntime.jsx(FocusableItem, { className: 'LuiDeprecatedForms', children: () => (jsxRuntime.jsx(GridSubComponentContext.Provider, { value: {
|
|
63805
63811
|
context: {},
|
|
63806
63812
|
data,
|
|
63807
63813
|
value: subSelectedValue,
|
|
@@ -64052,8 +64058,13 @@ const BooleanCellRenderer = (props) => {
|
|
|
64052
64058
|
return;
|
|
64053
64059
|
}
|
|
64054
64060
|
const cell = eGridCell?.querySelector('.ag-cell-focus .grid-edit-boolean input.ag-checkbox-input:not(:disabled)');
|
|
64055
|
-
if (cell
|
|
64056
|
-
cell
|
|
64061
|
+
if (cell) {
|
|
64062
|
+
// When you redraw a cell the activeElement moves to the cell div away from input
|
|
64063
|
+
// Refocus here if the cell div is active back to the input
|
|
64064
|
+
const activeElement = cell.ownerDocument.activeElement;
|
|
64065
|
+
if (activeElement && activeElement.getAttribute('role') === 'gridcell' && activeElement !== cell) {
|
|
64066
|
+
cell.focus();
|
|
64067
|
+
}
|
|
64057
64068
|
}
|
|
64058
64069
|
});
|
|
64059
64070
|
return (jsxRuntime.jsx("div", { className: clsx('grid-edit-boolean ag-wrapper ag-input-wrapper ag-checkbox-input-wrapper', {
|
|
@@ -64170,6 +64181,9 @@ const GridPopoverMenu = (colDef, custom) => GridCell({
|
|
|
64170
64181
|
editable: colDef.editable != null ? colDef.editable : true,
|
|
64171
64182
|
exportable: false,
|
|
64172
64183
|
cellStyle: { flex: 1, justifyContent: 'center' },
|
|
64184
|
+
suppressMovable: true,
|
|
64185
|
+
lockPosition: 'right',
|
|
64186
|
+
resizable: false,
|
|
64173
64187
|
cellRenderer: GridRenderPopoutMenuCell,
|
|
64174
64188
|
// Menus open on single click, this parameter is picked up in Grid.tsx
|
|
64175
64189
|
singleClickEdit: true,
|