@linzjs/step-ag-grid 22.1.1 → 22.2.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/clickInputWhenContainingCellClicked.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridButton.d.ts +12 -0
- package/dist/src/components/gridPopoverEdit/index.d.ts +1 -0
- package/dist/step-ag-grid.cjs.js +44 -13
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +44 -14
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/clickInputWhenContainingCellClicked.tsx +11 -14
- package/src/components/gridPopoverEdit/GridButton.tsx +63 -0
- package/src/components/gridPopoverEdit/index.ts +1 -0
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +21 -1
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +1 -1
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -2337,9 +2337,13 @@ const useGridContextMenu = ({ contextMenuSelectRow, contextMenu: ContextMenu, })
|
|
|
2337
2337
|
* AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox.
|
|
2338
2338
|
* This passes the event to the checkbox when you click anywhere in the cell.
|
|
2339
2339
|
*/
|
|
2340
|
-
const clickInputWhenContainingCellClicked = (
|
|
2340
|
+
const clickInputWhenContainingCellClicked = (params) => {
|
|
2341
|
+
const { data, event, colDef } = params;
|
|
2341
2342
|
if (!data || !event)
|
|
2342
2343
|
return;
|
|
2344
|
+
if (fnOrVar(colDef.editable, params) === false) {
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2343
2347
|
const element = event.target;
|
|
2344
2348
|
// Already handled
|
|
2345
2349
|
if (["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing"))
|
|
@@ -2350,25 +2354,16 @@ const clickInputWhenContainingCellClicked = ({ data, event, colDef }) => {
|
|
|
2350
2354
|
const colId = colDef.colId;
|
|
2351
2355
|
if (!colId)
|
|
2352
2356
|
return;
|
|
2353
|
-
const clickInput = (
|
|
2357
|
+
const clickInput = () => {
|
|
2354
2358
|
const cell = row.querySelector(`[col-id='${colId}']`);
|
|
2355
2359
|
if (!cell)
|
|
2356
2360
|
return;
|
|
2357
2361
|
const input = cell.querySelector("input, button");
|
|
2358
|
-
if (!input)
|
|
2362
|
+
if (!input)
|
|
2359
2363
|
return;
|
|
2360
|
-
}
|
|
2361
|
-
// When clicking on a cell that is not editing, the cell changes to editing and the input/button ref becomes invalid
|
|
2362
|
-
// So wait until the cell is in edit mode before sending the click
|
|
2363
|
-
if (!input.ownerDocument.contains(input)) {
|
|
2364
|
-
if (cnt !== 0) {
|
|
2365
|
-
setTimeout(() => clickInput(cnt - 1));
|
|
2366
|
-
}
|
|
2367
|
-
return;
|
|
2368
|
-
}
|
|
2369
2364
|
input?.dispatchEvent(event);
|
|
2370
2365
|
};
|
|
2371
|
-
setTimeout(
|
|
2366
|
+
setTimeout(clickInput, 20);
|
|
2372
2367
|
};
|
|
2373
2368
|
|
|
2374
2369
|
/**
|
|
@@ -4433,6 +4428,41 @@ const GridFormTextInput = (props) => {
|
|
|
4433
4428
|
return popoverWrapper(jsx("div", { style: { display: "flex", flexDirection: "row" }, className: "FormTest subComponent", children: jsx(TextInputFormatted, { value: value, onChange: (e) => setValue(e.target.value), error: invalid(), formatted: props.units, style: { width: props.width ?? 240 }, placeholder: props.placeholder ?? "Type here", helpText: helpText }) }));
|
|
4434
4429
|
};
|
|
4435
4430
|
|
|
4431
|
+
const ButtonCellRenderer = (props) => {
|
|
4432
|
+
const { data, node, column, colDef, api } = props;
|
|
4433
|
+
const inputRef = useRef(null);
|
|
4434
|
+
useEffect(() => {
|
|
4435
|
+
const checkFocus = (event) => {
|
|
4436
|
+
if (event.rowIndex === node.rowIndex && event.column === column) {
|
|
4437
|
+
inputRef.current?.focus();
|
|
4438
|
+
}
|
|
4439
|
+
};
|
|
4440
|
+
api.addEventListener("cellFocused", checkFocus);
|
|
4441
|
+
return () => {
|
|
4442
|
+
api.removeEventListener("cellFocused", checkFocus);
|
|
4443
|
+
};
|
|
4444
|
+
}, [api, column, node.rowIndex]);
|
|
4445
|
+
return (jsx(LuiButton, { ref: inputRef, className: "lui-button-icon-only", size: "sm", level: "text", onClick: () => {
|
|
4446
|
+
const selectedRows = [data];
|
|
4447
|
+
const selectedRowIds = selectedRows.map((r) => r.id);
|
|
4448
|
+
colDef?.cellEditorParams.onClick?.({ selectedRows, selectedRowIds });
|
|
4449
|
+
}, style: { display: colDef?.cellEditorParams?.visible?.(props) !== false ? "" : "none" }, children: jsx(LuiIcon, { name: "ic_redo", alt: "revert", size: "md" }) }));
|
|
4450
|
+
};
|
|
4451
|
+
const GridButton = (colDef, editor) => {
|
|
4452
|
+
return GridCell({
|
|
4453
|
+
minWidth: 72,
|
|
4454
|
+
maxWidth: 72,
|
|
4455
|
+
resizable: false,
|
|
4456
|
+
headerClass: "GridHeaderAlignCenter",
|
|
4457
|
+
cellClass: "GridCellAlignCenter",
|
|
4458
|
+
cellRenderer: ButtonCellRenderer,
|
|
4459
|
+
cellEditorParams: {
|
|
4460
|
+
...editor,
|
|
4461
|
+
},
|
|
4462
|
+
...colDef,
|
|
4463
|
+
});
|
|
4464
|
+
};
|
|
4465
|
+
|
|
4436
4466
|
const BooleanCellRenderer = (props) => {
|
|
4437
4467
|
const { onValueChange, value, api, node, column, colDef, data } = props;
|
|
4438
4468
|
const inputRef = useRef(null);
|
|
@@ -5335,5 +5365,5 @@ const useDeferredPromise = () => {
|
|
|
5335
5365
|
};
|
|
5336
5366
|
};
|
|
5337
5367
|
|
|
5338
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, 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, GridHeaderSelect, 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, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickInputWhenContainingCellClicked, convertDDToDMS, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, useDeferredPromise, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
5368
|
+
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, GridHeaderSelect, 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, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickInputWhenContainingCellClicked, convertDDToDMS, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, useDeferredPromise, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
5339
5369
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|