@linzjs/step-ag-grid 29.0.0 → 29.0.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/step-ag-grid.cjs +9 -4
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +9 -4
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridCell.tsx +6 -2
- package/src/components/gridForm/GridFormTextInput.tsx +6 -2
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +1 -1
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +1 -1
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -3375,16 +3375,18 @@ const defaultValueFormatter = ({ value }) => {
|
|
|
3375
3375
|
? String(value)
|
|
3376
3376
|
: JSON.stringify(value);
|
|
3377
3377
|
};
|
|
3378
|
+
// ag-grid doesn't understand the custom editor, when it stops editing it thinks
|
|
3379
|
+
// that _it_ was editing and overwrites the user updated data
|
|
3380
|
+
// _but_, it only does this if the initial value of the cell was null!?
|
|
3381
|
+
const blockValueSetter = () => true;
|
|
3378
3382
|
/*
|
|
3379
3383
|
* All cells should use this.
|
|
3380
3384
|
*/
|
|
3381
3385
|
const GridCell = (props, custom) => {
|
|
3382
|
-
// props.field = ;
|
|
3383
3386
|
// Generate a default filter value getter which uses the formatted value plus
|
|
3384
3387
|
// the editable value if it's a string and different from the formatted value.
|
|
3385
3388
|
// This is so that e.g. bearings can be searched for by DMS or raw number.
|
|
3386
3389
|
const valueFormatter = props.valueFormatter ?? defaultValueFormatter;
|
|
3387
|
-
// FIXME
|
|
3388
3390
|
const filterValueGetter = props.filterValueGetter ?? generateFilterGetter(valueFormatter);
|
|
3389
3391
|
const exportable = props.exportable;
|
|
3390
3392
|
// Can't leave this here ag-grid will complain
|
|
@@ -3395,6 +3397,7 @@ const GridCell = (props, custom) => {
|
|
|
3395
3397
|
headerTooltip: props.headerName,
|
|
3396
3398
|
sortable: true,
|
|
3397
3399
|
resizable: true,
|
|
3400
|
+
valueSetter: custom?.editor ? blockValueSetter : undefined,
|
|
3398
3401
|
editable: props.editable ?? false,
|
|
3399
3402
|
...(custom?.editor && {
|
|
3400
3403
|
cellClassRules: GridCellMultiSelectClassRules,
|
|
@@ -4834,12 +4837,14 @@ const GridFormTextInput = (props) => {
|
|
|
4834
4837
|
const [value, setValue] = useState(initValue);
|
|
4835
4838
|
const invalid = useCallback(() => TextInputValidator(props, value, data, {}), [data, props, value]);
|
|
4836
4839
|
const save = useCallback(async (selectedRows) => {
|
|
4837
|
-
if (invalid())
|
|
4840
|
+
if (invalid()) {
|
|
4838
4841
|
return false;
|
|
4842
|
+
}
|
|
4839
4843
|
const trimmedValue = value.trim();
|
|
4840
4844
|
// No change, so don't save
|
|
4841
|
-
if (initValue === trimmedValue)
|
|
4845
|
+
if (initValue === trimmedValue) {
|
|
4842
4846
|
return true;
|
|
4847
|
+
}
|
|
4843
4848
|
if (props.onSave) {
|
|
4844
4849
|
return await props.onSave({ selectedRows, value: trimmedValue });
|
|
4845
4850
|
}
|