@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/package.json
CHANGED
|
@@ -120,6 +120,11 @@ export const defaultValueFormatter = ({ value }: ValueFormatterParams) => {
|
|
|
120
120
|
: JSON.stringify(value);
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
+
// ag-grid doesn't understand the custom editor, when it stops editing it thinks
|
|
124
|
+
// that _it_ was editing and overwrites the user updated data
|
|
125
|
+
// _but_, it only does this if the initial value of the cell was null!?
|
|
126
|
+
const blockValueSetter = () => true;
|
|
127
|
+
|
|
123
128
|
/*
|
|
124
129
|
* All cells should use this.
|
|
125
130
|
*/
|
|
@@ -132,12 +137,10 @@ export const GridCell = <TData extends GridBaseRow, TValue = any, Props extends
|
|
|
132
137
|
editorParams?: Props;
|
|
133
138
|
},
|
|
134
139
|
): ColDefT<TData, TValue> => {
|
|
135
|
-
// props.field = ;
|
|
136
140
|
// Generate a default filter value getter which uses the formatted value plus
|
|
137
141
|
// the editable value if it's a string and different from the formatted value.
|
|
138
142
|
// This is so that e.g. bearings can be searched for by DMS or raw number.
|
|
139
143
|
const valueFormatter = props.valueFormatter ?? defaultValueFormatter;
|
|
140
|
-
// FIXME
|
|
141
144
|
const filterValueGetter = props.filterValueGetter ?? generateFilterGetter(valueFormatter as any);
|
|
142
145
|
const exportable = props.exportable;
|
|
143
146
|
// Can't leave this here ag-grid will complain
|
|
@@ -149,6 +152,7 @@ export const GridCell = <TData extends GridBaseRow, TValue = any, Props extends
|
|
|
149
152
|
headerTooltip: props.headerName,
|
|
150
153
|
sortable: true,
|
|
151
154
|
resizable: true,
|
|
155
|
+
valueSetter: custom?.editor ? blockValueSetter : undefined,
|
|
152
156
|
editable: props.editable ?? false,
|
|
153
157
|
...(custom?.editor && {
|
|
154
158
|
cellClassRules: GridCellMultiSelectClassRules,
|
|
@@ -29,11 +29,15 @@ export const GridFormTextInput = <TData extends GridBaseRow>(props: GridFormText
|
|
|
29
29
|
|
|
30
30
|
const save = useCallback(
|
|
31
31
|
async (selectedRows: TData[]): Promise<boolean> => {
|
|
32
|
-
if (invalid())
|
|
32
|
+
if (invalid()) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
33
35
|
|
|
34
36
|
const trimmedValue = value.trim();
|
|
35
37
|
// No change, so don't save
|
|
36
|
-
if (initValue === trimmedValue)
|
|
38
|
+
if (initValue === trimmedValue) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
37
41
|
|
|
38
42
|
if (props.onSave) {
|
|
39
43
|
return await props.onSave({ selectedRows, value: trimmedValue });
|
|
@@ -127,7 +127,7 @@ const GridPopoutContextMenuTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props
|
|
|
127
127
|
sizeColumns={'auto'}
|
|
128
128
|
onBulkEditingComplete={() => {
|
|
129
129
|
/* eslint-disable-next-line no-console */
|
|
130
|
-
console.log('onBulkEditingComplete');
|
|
130
|
+
console.log('onBulkEditingComplete()');
|
|
131
131
|
}}
|
|
132
132
|
contextMenu={ContextMenu}
|
|
133
133
|
/>
|
|
@@ -219,7 +219,7 @@ const GridPopoutEditGenericTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props
|
|
|
219
219
|
sizeColumns={'auto'}
|
|
220
220
|
onBulkEditingComplete={() => {
|
|
221
221
|
/* eslint-disable-next-line no-console */
|
|
222
|
-
console.log('
|
|
222
|
+
console.log('onBulkEditingComplete()');
|
|
223
223
|
}}
|
|
224
224
|
/>
|
|
225
225
|
<ActionButton icon={'ic_add'} name={'Add new row'} inProgressName={'Adding...'} onClick={addRowAction} />
|