@linzjs/step-ag-grid 22.0.0 → 22.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/index.css +38 -0
- package/dist/src/components/Grid.d.ts +1 -2
- package/dist/src/components/GridCell.d.ts +1 -1
- package/dist/src/components/clickInputWhenContainingCellClicked.d.ts +6 -0
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridEditBoolean.d.ts +11 -0
- package/dist/src/components/gridPopoverEdit/index.d.ts +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/lui/TextAreaInput.d.ts +0 -1
- package/dist/step-ag-grid.cjs.js +101 -76
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +101 -77
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +32 -33
- package/src/components/Grid.tsx +18 -23
- package/src/components/GridCell.tsx +4 -2
- package/src/components/clickInputWhenContainingCellClicked.tsx +40 -0
- package/src/components/gridForm/GridFormDropDown.tsx +1 -0
- package/src/components/gridForm/GridFormMultiSelectGrid.tsx +1 -1
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +79 -0
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +8 -1
- package/src/components/gridPopoverEdit/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/src/contexts/GridContextProvider.tsx +1 -0
- package/src/lui/TextAreaInput.tsx +3 -8
- package/src/stories/grid/FormTest.tsx +1 -0
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +74 -0
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +1 -0
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +1 -0
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +1 -0
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +1 -0
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +1 -0
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +1 -0
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +1 -0
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +1 -0
- package/src/styles/Grid.scss +33 -0
- package/src/styles/GridFormDropDown.scss +5 -0
package/dist/index.css
CHANGED
|
@@ -324,6 +324,16 @@
|
|
|
324
324
|
position: static !important;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
.LabelPreferencesPanelGridCellAlignCenter .ag-wrapper {
|
|
328
|
+
margin-left: auto;
|
|
329
|
+
margin-right: auto;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.LabelPreferencesPanelGridCellAlignCenter .ag-cell-wrapper, .LabelPreferencesPanelGridCellAlignCenter .GridCell-container {
|
|
333
|
+
display: flex;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
}
|
|
336
|
+
|
|
327
337
|
.Grid-container {
|
|
328
338
|
flex: 1;
|
|
329
339
|
width: 100%;
|
|
@@ -418,6 +428,29 @@
|
|
|
418
428
|
background-color: #f9f9f9;
|
|
419
429
|
}
|
|
420
430
|
|
|
431
|
+
.GridHeaderAlignCenter .ag-header-cell-text {
|
|
432
|
+
margin-left: auto;
|
|
433
|
+
margin-right: auto;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.GridCellAlignCenter .GridCell-container {
|
|
437
|
+
display: flex;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.GridCellAlignCenter .ag-wrapper {
|
|
441
|
+
margin-left: auto;
|
|
442
|
+
margin-right: auto;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.GridCellAlignCenter .ag-cell-wrapper, .LabelPreferencesPanelGridCellAlignCenter .GridCell-container {
|
|
446
|
+
display: flex;
|
|
447
|
+
justify-content: center;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
div.ag-ltr div.ag-header-cell-resize {
|
|
451
|
+
right: -4px;
|
|
452
|
+
}
|
|
453
|
+
|
|
421
454
|
.GridCell-container {
|
|
422
455
|
overflow: hidden;
|
|
423
456
|
text-overflow: ellipsis;
|
|
@@ -455,6 +488,11 @@
|
|
|
455
488
|
justify-content: center;
|
|
456
489
|
}
|
|
457
490
|
|
|
491
|
+
.GridPopoverEditDropDown-containerAutoWidth .szh-menu {
|
|
492
|
+
width: auto;
|
|
493
|
+
max-width: 274px;
|
|
494
|
+
}
|
|
495
|
+
|
|
458
496
|
.GridFormEditBearing-input {
|
|
459
497
|
width: 320px;
|
|
460
498
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ColDef } from "ag-grid-community";
|
|
2
|
-
import { GridOptions } from "ag-grid-community";
|
|
1
|
+
import { ColDef, GridOptions } from "ag-grid-community";
|
|
3
2
|
import { ReactElement } from "react";
|
|
4
3
|
import { GridContextMenuComponent } from "./gridHook";
|
|
5
4
|
export interface GridBaseRow {
|
|
@@ -37,7 +37,7 @@ export interface ColDefT<TData extends GridBaseRow, ValueType = any> extends Col
|
|
|
37
37
|
editable?: boolean | SAEditableCallback<TData, ValueType>;
|
|
38
38
|
valueGetter?: string | SAValueGetterFunc<TData, ValueType>;
|
|
39
39
|
valueFormatter?: string | SAValueFormatterFunc<TData, ValueType>;
|
|
40
|
-
cellRenderer?: (props: SAICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined;
|
|
40
|
+
cellRenderer?: ((props: SAICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined) | string;
|
|
41
41
|
cellRendererParams?: {
|
|
42
42
|
singleClickEdit?: boolean;
|
|
43
43
|
rightHoverElement?: ReactElement;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CellClickedEvent } from "ag-grid-community";
|
|
2
|
+
/**
|
|
3
|
+
* AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox.
|
|
4
|
+
* This passes the event to the checkbox when you click anywhere in the cell.
|
|
5
|
+
*/
|
|
6
|
+
export declare const clickInputWhenContainingCellClicked: ({ data, event, colDef }: CellClickedEvent) => void;
|
|
@@ -23,7 +23,7 @@ export declare const MenuHeaderItem: (title: string) => {
|
|
|
23
23
|
};
|
|
24
24
|
export type SelectOption = null | string | FinalSelectOption;
|
|
25
25
|
export interface GridFormDropDownProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
26
|
-
className?: "GridPopoverEditDropDown-containerSmall" | "GridPopoverEditDropDown-containerMedium" | "GridPopoverEditDropDown-containerLarge" | "GridPopoverEditDropDown-containerUnlimited" | string | undefined;
|
|
26
|
+
className?: "GridPopoverEditDropDown-containerSmall" | "GridPopoverEditDropDown-containerMedium" | "GridPopoverEditDropDown-containerLarge" | "GridPopoverEditDropDown-containerUnlimited" | "GridPopoverEditDropDown-containerAutoWidth" | string | undefined;
|
|
27
27
|
filtered?: "local" | "reload";
|
|
28
28
|
filterDefaultValue?: string;
|
|
29
29
|
filterPlaceholder?: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CellEditorCommon, ColDefT } from "../GridCell";
|
|
2
|
+
import { GenericCellColDef } from "../gridRender";
|
|
3
|
+
import { GridBaseRow } from "../Grid";
|
|
4
|
+
export interface GridEditBooleanEditorProps<TData> extends CellEditorCommon {
|
|
5
|
+
onClick: (props: {
|
|
6
|
+
selectedRows: TData[];
|
|
7
|
+
selectedRowIds: (string | number)[];
|
|
8
|
+
checked: boolean;
|
|
9
|
+
}) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
export declare const GridEditBoolean: <TData extends GridBaseRow>(colDef: GenericCellColDef<TData, boolean>, editorProps: GridEditBooleanEditorProps<TData>) => ColDefT<TData>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InputHTMLAttributes, ReactElement } from "react";
|
|
2
|
-
export declare const useGenerateOrDefaultId: (idFromProps?: string) => string;
|
|
3
2
|
export interface LuiTextAreaInputProps extends InputHTMLAttributes<HTMLTextAreaElement> {
|
|
4
3
|
value: string;
|
|
5
4
|
label?: ReactElement | string;
|
package/dist/step-ag-grid.cjs.js
CHANGED
|
@@ -2335,6 +2335,44 @@ const useGridContextMenu = ({ contextMenuSelectRow, contextMenu: ContextMenu, })
|
|
|
2335
2335
|
};
|
|
2336
2336
|
};
|
|
2337
2337
|
|
|
2338
|
+
/**
|
|
2339
|
+
* AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox.
|
|
2340
|
+
* This passes the event to the checkbox when you click anywhere in the cell.
|
|
2341
|
+
*/
|
|
2342
|
+
const clickInputWhenContainingCellClicked = ({ data, event, colDef }) => {
|
|
2343
|
+
if (!data || !event)
|
|
2344
|
+
return;
|
|
2345
|
+
const element = event.target;
|
|
2346
|
+
// Already handled
|
|
2347
|
+
if (["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing"))
|
|
2348
|
+
return;
|
|
2349
|
+
const row = element.closest("[row-id]");
|
|
2350
|
+
if (!row)
|
|
2351
|
+
return;
|
|
2352
|
+
const colId = colDef.colId;
|
|
2353
|
+
if (!colId)
|
|
2354
|
+
return;
|
|
2355
|
+
const clickInput = (cnt) => {
|
|
2356
|
+
const cell = row.querySelector(`[col-id='${colId}']`);
|
|
2357
|
+
if (!cell)
|
|
2358
|
+
return;
|
|
2359
|
+
const input = cell.querySelector("input, button");
|
|
2360
|
+
if (!input) {
|
|
2361
|
+
return;
|
|
2362
|
+
}
|
|
2363
|
+
// When clicking on a cell that is not editing, the cell changes to editing and the input/button ref becomes invalid
|
|
2364
|
+
// So wait until the cell is in edit mode before sending the click
|
|
2365
|
+
if (!input.ownerDocument.contains(input)) {
|
|
2366
|
+
if (cnt !== 0) {
|
|
2367
|
+
setTimeout(() => clickInput(cnt - 1));
|
|
2368
|
+
}
|
|
2369
|
+
return;
|
|
2370
|
+
}
|
|
2371
|
+
input?.dispatchEvent(event);
|
|
2372
|
+
};
|
|
2373
|
+
setTimeout(() => clickInput(20), 10);
|
|
2374
|
+
};
|
|
2375
|
+
|
|
2338
2376
|
/**
|
|
2339
2377
|
* Wrapper for AgGrid to add commonly used functionality.
|
|
2340
2378
|
*/
|
|
@@ -2448,16 +2486,6 @@ const Grid = ({ "data-testid": dataTestId, defaultPostSort = true, rowSelection
|
|
|
2448
2486
|
selectRowsById,
|
|
2449
2487
|
getFirstRowId,
|
|
2450
2488
|
]);
|
|
2451
|
-
/**
|
|
2452
|
-
* AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox.
|
|
2453
|
-
* This passes the event to the checkbox when you click anywhere in the cell.
|
|
2454
|
-
*/
|
|
2455
|
-
const clickSelectorCheckboxWhenContainingCellClicked = React.useCallback(({ event }) => {
|
|
2456
|
-
if (!event)
|
|
2457
|
-
return;
|
|
2458
|
-
const input = event.target.querySelector("input");
|
|
2459
|
-
input?.dispatchEvent(event);
|
|
2460
|
-
}, []);
|
|
2461
2489
|
/**
|
|
2462
2490
|
* Ensure external selected items list is in sync with panel.
|
|
2463
2491
|
*/
|
|
@@ -2557,7 +2585,7 @@ const Grid = ({ "data-testid": dataTestId, defaultPostSort = true, rowSelection
|
|
|
2557
2585
|
}
|
|
2558
2586
|
return false;
|
|
2559
2587
|
},
|
|
2560
|
-
onCellClicked:
|
|
2588
|
+
onCellClicked: clickInputWhenContainingCellClicked,
|
|
2561
2589
|
},
|
|
2562
2590
|
...adjustColDefs,
|
|
2563
2591
|
]
|
|
@@ -2571,7 +2599,6 @@ const Grid = ({ "data-testid": dataTestId, defaultPostSort = true, rowSelection
|
|
|
2571
2599
|
params.defaultColDef?.editable,
|
|
2572
2600
|
selectColumnPinned,
|
|
2573
2601
|
rowSelection,
|
|
2574
|
-
clickSelectorCheckboxWhenContainingCellClicked,
|
|
2575
2602
|
]);
|
|
2576
2603
|
/**
|
|
2577
2604
|
* When grid is ready set the apis to the grid context and sync selected items to grid.
|
|
@@ -2673,11 +2700,16 @@ const Grid = ({ "data-testid": dataTestId, defaultPostSort = true, rowSelection
|
|
|
2673
2700
|
* Start editing on pressing Enter
|
|
2674
2701
|
*/
|
|
2675
2702
|
const onCellKeyPress = React.useCallback((e) => {
|
|
2676
|
-
|
|
2703
|
+
const kbe = e.event;
|
|
2704
|
+
if (kbe.key === "Enter") {
|
|
2677
2705
|
if (!invokeEditAction(e))
|
|
2678
2706
|
startCellEditing(e);
|
|
2679
2707
|
}
|
|
2680
|
-
|
|
2708
|
+
if (kbe.key === "Tab") {
|
|
2709
|
+
// eslint-disable-next-line
|
|
2710
|
+
prePopupOps();
|
|
2711
|
+
}
|
|
2712
|
+
}, [prePopupOps, startCellEditing]);
|
|
2681
2713
|
/**
|
|
2682
2714
|
* Once the grid has auto-sized we want to run fit to fit the grid in its container,
|
|
2683
2715
|
* but we don't want the non-flex auto-sized columns to "fit" size, so suppressSizeToFit is set to true.
|
|
@@ -2979,7 +3011,7 @@ const GridCell = (props, custom) => {
|
|
|
2979
3011
|
return JSON.stringify(params.value);
|
|
2980
3012
|
},
|
|
2981
3013
|
...props,
|
|
2982
|
-
cellRenderer: GridCellRenderer,
|
|
3014
|
+
cellRenderer: typeof props.cellRenderer === "string" ? props.cellRenderer : GridCellRenderer,
|
|
2983
3015
|
cellRendererParams: {
|
|
2984
3016
|
originalCellRenderer: props.cellRenderer,
|
|
2985
3017
|
...props.cellRendererParams,
|
|
@@ -4151,7 +4183,7 @@ const GridFormMultiSelectGrid = (props) => {
|
|
|
4151
4183
|
e.keepOpen = true;
|
|
4152
4184
|
toggleValue(o);
|
|
4153
4185
|
}
|
|
4154
|
-
}, children: jsxRuntime.jsx(lui.LuiCheckboxInput, { isChecked: !!o.checked
|
|
4186
|
+
}, children: jsxRuntime.jsx(lui.LuiCheckboxInput, { isChecked: !!o.checked, isIndeterminate: o.checked === "partial", value: `${o.value}`, label: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [o.warning && jsxRuntime.jsx(GridIcon, { icon: "ic_warning_outline", title: o.warning }, "$$icon$$"), jsxRuntime.jsx("span", { className: "GridMultiSelectGrid-Label", children: o.label ?? (o.value == null ? `<${o.value}>` : `${o.value}`) }, "$$label$$")] }), inputProps: {
|
|
4155
4187
|
onClick: (e) => {
|
|
4156
4188
|
// Click is handled by MenuItem onClick
|
|
4157
4189
|
e.preventDefault();
|
|
@@ -4251,65 +4283,9 @@ const GridFormPopoverMenu = (props) => {
|
|
|
4251
4283
|
}, children: jsxRuntime.jsx("div", { className: "subComponent", children: item.subComponent && jsxRuntime.jsx(item.subComponent, {}) }) })) }, `${item.label}_subcomponent`))] }, `${item.label}`))))) }) }));
|
|
4252
4284
|
};
|
|
4253
4285
|
|
|
4254
|
-
/**
|
|
4255
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
4256
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
4257
|
-
*/
|
|
4258
|
-
var byteToHex = [];
|
|
4259
|
-
for (var i = 0; i < 256; ++i) {
|
|
4260
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
4261
|
-
}
|
|
4262
|
-
function unsafeStringify(arr, offset = 0) {
|
|
4263
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
4264
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
4265
|
-
//
|
|
4266
|
-
// Note to future-self: No, you can't remove the `toLowerCase()` call.
|
|
4267
|
-
// REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
|
|
4268
|
-
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
4269
|
-
}
|
|
4270
|
-
|
|
4271
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
4272
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
4273
|
-
// generators (like Math.random()).
|
|
4274
|
-
|
|
4275
|
-
var getRandomValues;
|
|
4276
|
-
var rnds8 = new Uint8Array(16);
|
|
4277
|
-
function rng() {
|
|
4278
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
4279
|
-
if (!getRandomValues) {
|
|
4280
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
4281
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
4282
|
-
if (!getRandomValues) {
|
|
4283
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
4284
|
-
}
|
|
4285
|
-
}
|
|
4286
|
-
return getRandomValues(rnds8);
|
|
4287
|
-
}
|
|
4288
|
-
|
|
4289
|
-
var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
4290
|
-
var native = {
|
|
4291
|
-
randomUUID
|
|
4292
|
-
};
|
|
4293
|
-
|
|
4294
|
-
function v4(options, buf, offset) {
|
|
4295
|
-
if (native.randomUUID && !buf && !options) {
|
|
4296
|
-
return native.randomUUID();
|
|
4297
|
-
}
|
|
4298
|
-
options = options || {};
|
|
4299
|
-
var rnds = options.random || (options.rng || rng)();
|
|
4300
|
-
|
|
4301
|
-
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
4302
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
4303
|
-
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
4304
|
-
return unsafeStringify(rnds);
|
|
4305
|
-
}
|
|
4306
|
-
|
|
4307
|
-
const useGenerateOrDefaultId = (idFromProps) => {
|
|
4308
|
-
const [id] = React.useState(idFromProps ? idFromProps : v4());
|
|
4309
|
-
return id;
|
|
4310
|
-
};
|
|
4311
4286
|
const TextAreaInput = (props) => {
|
|
4312
|
-
const
|
|
4287
|
+
const reactId = React.useId();
|
|
4288
|
+
const id = props?.id ?? reactId;
|
|
4313
4289
|
return (jsxRuntime.jsxs("div", { className: clsx("LuiTextAreaInput Grid-popoverContainer", props.disabled ? "isDisabled" : "", props.error ? "hasError" : "", props.className), children: [jsxRuntime.jsxs("label", { htmlFor: id, children: [props.mandatory != null && jsxRuntime.jsx("span", { className: "LuiTextAreaInput-mandatory", children: "*" }), props.label != null && jsxRuntime.jsx("span", { className: "LuiTextAreaInput-label", children: props.label }), jsxRuntime.jsx("div", { className: "LuiTextAreaInput-wrapper", children: jsxRuntime.jsx("textarea", { rows: 5, ...lodashEs.omit(props, ["error", "value", "helpText", "formatted", "className", "allowTabToSave"]), id: id, value: props.value ?? "", spellCheck: true, onMouseEnter: (e) => {
|
|
4314
4290
|
if (document.activeElement != e.currentTarget) {
|
|
4315
4291
|
e.currentTarget.focus();
|
|
@@ -4459,6 +4435,52 @@ const GridFormTextInput = (props) => {
|
|
|
4459
4435
|
return popoverWrapper(jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "row" }, className: "FormTest subComponent", children: jsxRuntime.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 }) }));
|
|
4460
4436
|
};
|
|
4461
4437
|
|
|
4438
|
+
const BooleanCellRenderer = (props) => {
|
|
4439
|
+
const { onValueChange, value, api, node, column, colDef, data } = props;
|
|
4440
|
+
const inputRef = React.useRef(null);
|
|
4441
|
+
React.useEffect(() => {
|
|
4442
|
+
const checkFocus = (event) => {
|
|
4443
|
+
if (event.rowIndex === node.rowIndex && event.column === column) {
|
|
4444
|
+
inputRef.current?.focus();
|
|
4445
|
+
}
|
|
4446
|
+
};
|
|
4447
|
+
api.addEventListener("cellFocused", checkFocus);
|
|
4448
|
+
return () => {
|
|
4449
|
+
api.removeEventListener("cellFocused", checkFocus);
|
|
4450
|
+
};
|
|
4451
|
+
}, [api, column, node.rowIndex]);
|
|
4452
|
+
return (jsxRuntime.jsx("div", { className: clsx("ag-wrapper ag-input-wrapper ag-checkbox-input-wrapper", { "ag-checked": props.value }), children: jsxRuntime.jsx("input", { type: "checkbox", className: "ag-input-field-input ag-checkbox-input", disabled: !fnOrVar(colDef?.editable, props), ref: inputRef, checked: value, onChange: () => { }, onClick: (e) => {
|
|
4453
|
+
e.stopPropagation();
|
|
4454
|
+
// cell has to be in edit mode
|
|
4455
|
+
// if in non-edit mode clickInputWhenContainingCellClicked will click to put it in edit mode
|
|
4456
|
+
if (!onValueChange)
|
|
4457
|
+
return;
|
|
4458
|
+
const params = props?.colDef?.cellEditorParams;
|
|
4459
|
+
if (!params)
|
|
4460
|
+
return;
|
|
4461
|
+
const selectedRows = [data];
|
|
4462
|
+
const checked = !value;
|
|
4463
|
+
onValueChange(checked);
|
|
4464
|
+
params.onClick({ selectedRows, selectedRowIds: selectedRows.map((r) => r.id), checked }).then();
|
|
4465
|
+
} }) }));
|
|
4466
|
+
};
|
|
4467
|
+
const GridEditBoolean = (colDef, editorProps) => {
|
|
4468
|
+
return GridCell({
|
|
4469
|
+
minWidth: 64,
|
|
4470
|
+
maxWidth: 64,
|
|
4471
|
+
cellRenderer: BooleanCellRenderer,
|
|
4472
|
+
cellEditor: BooleanCellRenderer,
|
|
4473
|
+
cellEditorParams: editorProps,
|
|
4474
|
+
onCellClicked: clickInputWhenContainingCellClicked,
|
|
4475
|
+
singleClickEdit: true,
|
|
4476
|
+
resizable: false,
|
|
4477
|
+
editable: true,
|
|
4478
|
+
cellClass: "GridCellAlignCenter",
|
|
4479
|
+
headerClass: "GridHeaderAlignCenter",
|
|
4480
|
+
...colDef,
|
|
4481
|
+
});
|
|
4482
|
+
};
|
|
4483
|
+
|
|
4462
4484
|
const GridPopoutEditMultiSelect = (colDef, props) => GridCell(colDef, {
|
|
4463
4485
|
editor: GridFormMultiSelect,
|
|
4464
4486
|
...props,
|
|
@@ -4542,7 +4564,9 @@ const GridPopoverEditDropDown = (colDef, props) => GridCell(colDef, {
|
|
|
4542
4564
|
...props,
|
|
4543
4565
|
editorParams: {
|
|
4544
4566
|
...props.editorParams,
|
|
4545
|
-
className: clsx(
|
|
4567
|
+
className: clsx({
|
|
4568
|
+
"GridPopoverEditDropDown-containerLarge": !props.editorParams?.className?.includes("GridPopoverEditDropDown-container"),
|
|
4569
|
+
}, props.editorParams?.className),
|
|
4546
4570
|
},
|
|
4547
4571
|
});
|
|
4548
4572
|
|
|
@@ -5329,6 +5353,7 @@ exports.GridCellMultiSelectClassRules = GridCellMultiSelectClassRules;
|
|
|
5329
5353
|
exports.GridCellRenderer = GridCellRenderer;
|
|
5330
5354
|
exports.GridContext = GridContext;
|
|
5331
5355
|
exports.GridContextProvider = GridContextProvider;
|
|
5356
|
+
exports.GridEditBoolean = GridEditBoolean;
|
|
5332
5357
|
exports.GridFilterButtons = GridFilterButtons;
|
|
5333
5358
|
exports.GridFilterColumnsToggle = GridFilterColumnsToggle;
|
|
5334
5359
|
exports.GridFilterDownloadCsvButton = GridFilterDownloadCsvButton;
|
|
@@ -5389,6 +5414,7 @@ exports.bearingNumberParser = bearingNumberParser;
|
|
|
5389
5414
|
exports.bearingRangeValidator = bearingRangeValidator;
|
|
5390
5415
|
exports.bearingStringValidator = bearingStringValidator;
|
|
5391
5416
|
exports.bearingValueFormatter = bearingValueFormatter;
|
|
5417
|
+
exports.clickInputWhenContainingCellClicked = clickInputWhenContainingCellClicked;
|
|
5392
5418
|
exports.convertDDToDMS = convertDDToDMS;
|
|
5393
5419
|
exports.downloadCsvUseValueFormattersProcessCellCallback = downloadCsvUseValueFormattersProcessCellCallback;
|
|
5394
5420
|
exports.findParentWithClass = findParentWithClass;
|
|
@@ -5402,7 +5428,6 @@ exports.sanitiseFileName = sanitiseFileName;
|
|
|
5402
5428
|
exports.stringByteLengthIsInvalid = stringByteLengthIsInvalid;
|
|
5403
5429
|
exports.suppressCellKeyboardEvents = suppressCellKeyboardEvents;
|
|
5404
5430
|
exports.useDeferredPromise = useDeferredPromise;
|
|
5405
|
-
exports.useGenerateOrDefaultId = useGenerateOrDefaultId;
|
|
5406
5431
|
exports.useGridContext = useGridContext;
|
|
5407
5432
|
exports.useGridContextMenu = useGridContextMenu;
|
|
5408
5433
|
exports.useGridFilter = useGridFilter;
|