@linzjs/step-ag-grid 6.0.0 → 6.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "6.0.0",
5
+ "version": "6.1.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -131,20 +131,19 @@ export const ControlledMenuFr = (
131
131
  let inputEls: HTMLElement[] = [];
132
132
  inputElsIterator.forEach((el) => inputEls.push(el));
133
133
  inputEls = inputEls.filter((el) => !(el as any).disabled);
134
-
135
134
  if (inputEls.length === 0) return;
136
135
  const firstInputEl = inputEls[0];
137
136
  const lastInputEl = inputEls[inputEls.length - 1];
138
137
  if (activeElement !== firstInputEl && activeElement !== lastInputEl) return;
139
138
 
140
- const suppressAutoSaveEvents = activeElement.getAttribute("data-suppressAutoSaveEvents");
139
+ const isTextArea = activeElement.nodeName === "TEXTAREA";
140
+ const suppressEnterAutoSave = activeElement.getAttribute("data-disableEnterAutoSave") || isTextArea;
141
141
  const invokeSave = (reason: string) => {
142
- if (!saveButtonRef?.current || suppressAutoSaveEvents) return;
142
+ if (!saveButtonRef?.current) return;
143
143
  saveButtonRef.current?.setAttribute("data-reason", reason);
144
144
  saveButtonRef?.current?.click();
145
145
  };
146
146
 
147
- const isTextArea = activeElement.nodeName === "TEXTAREA";
148
147
  switch (activeElement.nodeName) {
149
148
  case "TEXTAREA":
150
149
  case "INPUT": {
@@ -160,7 +159,7 @@ export const ControlledMenuFr = (
160
159
  invokeSave(ev.shiftKey ? CloseReason.TAB_BACKWARD : CloseReason.TAB_FORWARD);
161
160
  }
162
161
  }
163
- if (ev.key === "Enter" && !isTextArea) {
162
+ if (ev.key === "Enter" && !suppressEnterAutoSave) {
164
163
  ev.preventDefault();
165
164
  ev.stopPropagation();
166
165
  if (isDown) {
@@ -181,7 +180,7 @@ export const ControlledMenuFr = (
181
180
  lastTabDownEl.current == activeElement && invokeSave(CloseReason.TAB_FORWARD);
182
181
  }
183
182
  }
184
- if (ev.key === "Enter" && !isTextArea) {
183
+ if (ev.key === "Enter" && !suppressEnterAutoSave) {
185
184
  ev.preventDefault();
186
185
  ev.stopPropagation();
187
186
  if (isDown) {
@@ -98,9 +98,13 @@ export const FormTest = (props: CellEditorCommon): JSX.Element => {
98
98
  <LuiTextInput label={"Number"} value={numba} onChange={(e) => setNumba(e.target.value)} />
99
99
  </div>
100
100
  <div style={{ marginTop: 25 }}>
101
- <LuiButton style={{ height: 48 }} onClick={() => setShowModal(true)}>
102
- Show Modal
103
- </LuiButton>
101
+ <input
102
+ data-disableEnterAutoSave
103
+ type="button"
104
+ style={{ height: 48 }}
105
+ onClick={() => setShowModal(true)}
106
+ value="Show Modal"
107
+ />
104
108
  </div>
105
109
  </div>
106
110
  <FormError error={invalid()} />