@linzjs/step-ag-grid 2.4.6 → 2.4.8
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.js +54 -40
- package/dist/index.js.map +1 -1
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +3 -1
- package/dist/step-ag-grid.esm.js +54 -40
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +16 -10
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +20 -3
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +1 -1
- package/src/contexts/GridUpdatingContext.tsx +2 -2
- package/src/styles/GridFormSubComponentTextInput.scss +4 -0
package/package.json
CHANGED
|
@@ -109,7 +109,11 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
|
|
|
109
109
|
|
|
110
110
|
const optionsList = optionsConf?.map((item) => {
|
|
111
111
|
if (item == null || typeof item == "string" || typeof item == "number") {
|
|
112
|
-
item = {
|
|
112
|
+
item = {
|
|
113
|
+
value: item as unknown as ValueType,
|
|
114
|
+
label: item,
|
|
115
|
+
disabled: false,
|
|
116
|
+
} as unknown as FinalSelectOption<ValueType>;
|
|
113
117
|
}
|
|
114
118
|
return item;
|
|
115
119
|
}) as any as FinalSelectOption<ValueType>[];
|
|
@@ -181,7 +185,6 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
|
|
|
181
185
|
},
|
|
182
186
|
[filteredValues, options, selectItemHandler, selectFilterHandler, stopEditing, filter, props],
|
|
183
187
|
);
|
|
184
|
-
|
|
185
188
|
const { popoverWrapper } = useGridPopoverHook({ className: props.className });
|
|
186
189
|
return popoverWrapper(
|
|
187
190
|
<>
|
|
@@ -210,14 +213,16 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
|
|
|
210
213
|
)}
|
|
211
214
|
<ComponentLoadingWrapper loading={!options} className={"GridFormDropDown-options"}>
|
|
212
215
|
<>
|
|
213
|
-
{options && options.length == filteredValues?.length &&
|
|
214
|
-
|
|
216
|
+
{options && options.length == filteredValues?.length && (
|
|
217
|
+
<MenuItem key={`${props.field}-empty`}>[Empty]</MenuItem>
|
|
218
|
+
)}
|
|
219
|
+
{options?.map((item: FinalSelectOption<ValueType | string>, index) =>
|
|
215
220
|
item.value === MenuSeparatorString ? (
|
|
216
221
|
<MenuDivider key={`$$divider_${index}`} />
|
|
217
222
|
) : item.value === MenuHeaderString ? (
|
|
218
|
-
<MenuHeader>{item.label}</MenuHeader>
|
|
223
|
+
<MenuHeader key={`$$header_${index}`}>{item.label}</MenuHeader>
|
|
219
224
|
) : filteredValues.includes(item.value) ? null : (
|
|
220
|
-
|
|
225
|
+
<div key={`menu-wrapper-${index}`}>
|
|
221
226
|
{!item.subComponent ? (
|
|
222
227
|
<MenuItem
|
|
223
228
|
key={`${props.field}-${index}`}
|
|
@@ -225,7 +230,7 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
|
|
|
225
230
|
title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
|
|
226
231
|
value={item.value}
|
|
227
232
|
onClick={() => {
|
|
228
|
-
selectItemHandler(item.value);
|
|
233
|
+
selectItemHandler(item.value as ValueType);
|
|
229
234
|
}}
|
|
230
235
|
>
|
|
231
236
|
{item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)}
|
|
@@ -255,18 +260,19 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
|
|
|
255
260
|
const subComponentItem = subComponentValues.find(
|
|
256
261
|
({ optionValue }) => optionValue === item.value,
|
|
257
262
|
);
|
|
258
|
-
if (key === "Enter" && subComponentItem) {
|
|
259
|
-
selectItemHandler(item.value, subComponentItem.subComponentValue);
|
|
263
|
+
if ((key === "Enter" || key === "Tab") && subComponentItem) {
|
|
264
|
+
selectItemHandler(item.value as ValueType, subComponentItem.subComponentValue);
|
|
260
265
|
ref.closeMenu();
|
|
261
266
|
}
|
|
262
267
|
},
|
|
268
|
+
key: `${props.field}-${index}_subcomponent_inner`,
|
|
263
269
|
},
|
|
264
270
|
ref,
|
|
265
271
|
)
|
|
266
272
|
}
|
|
267
273
|
</FocusableItem>
|
|
268
274
|
)}
|
|
269
|
-
|
|
275
|
+
</div>
|
|
270
276
|
),
|
|
271
277
|
)}
|
|
272
278
|
</>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
import { TextInputFormatted } from "../../lui/TextInputFormatted";
|
|
3
|
+
import "../../styles/GridFormSubComponentTextInput.scss";
|
|
3
4
|
|
|
4
5
|
export interface GridFormSubComponentTextInput {
|
|
5
6
|
setValue: (value: string) => void;
|
|
6
7
|
keyDown: (key: string) => void;
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
className?: string;
|
|
10
|
+
customHelpText?: string;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export const GridFormSubComponentTextInput = ({
|
|
@@ -13,12 +15,20 @@ export const GridFormSubComponentTextInput = ({
|
|
|
13
15
|
placeholder,
|
|
14
16
|
setValue,
|
|
15
17
|
className,
|
|
18
|
+
customHelpText,
|
|
16
19
|
}: GridFormSubComponentTextInput) => {
|
|
17
20
|
const placeholderText = placeholder || "Other...";
|
|
18
|
-
const
|
|
21
|
+
const helpText = customHelpText || "Press enter or tab to save";
|
|
22
|
+
|
|
23
|
+
const inputClass = className || "GridFormSubComponentTextInput-full-width-input";
|
|
19
24
|
const [inputValue, setInputValue] = useState("");
|
|
20
25
|
return (
|
|
21
|
-
|
|
26
|
+
<div
|
|
27
|
+
style={{
|
|
28
|
+
display: "flex",
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
22
32
|
<TextInputFormatted
|
|
23
33
|
className={inputClass}
|
|
24
34
|
value={inputValue}
|
|
@@ -40,6 +50,13 @@ export const GridFormSubComponentTextInput = ({
|
|
|
40
50
|
},
|
|
41
51
|
}}
|
|
42
52
|
/>
|
|
43
|
-
|
|
53
|
+
<span
|
|
54
|
+
style={{
|
|
55
|
+
fontSize: "0.75rem",
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{helpText}
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
44
61
|
);
|
|
45
62
|
};
|
|
@@ -18,7 +18,7 @@ export const GridPopoverMenu = <RowType extends GridBaseRow>(
|
|
|
18
18
|
{
|
|
19
19
|
maxWidth: 40,
|
|
20
20
|
editable: colDef.editable != null ? colDef.editable : true,
|
|
21
|
-
cellStyle: {
|
|
21
|
+
cellStyle: { justifyContent: "flex-end" },
|
|
22
22
|
cellRenderer: GridRenderPopoutMenuCell,
|
|
23
23
|
cellClass: custom?.multiEdit ? GenericMultiEditCellClass : undefined,
|
|
24
24
|
...colDef,
|
|
@@ -7,10 +7,10 @@ export type GridUpdatingContextType = {
|
|
|
7
7
|
|
|
8
8
|
export const GridUpdatingContext = createContext<GridUpdatingContextType>({
|
|
9
9
|
checkUpdating: () => {
|
|
10
|
-
console.error("Missing
|
|
10
|
+
console.error("Missing GridUpdatingContext");
|
|
11
11
|
return false;
|
|
12
12
|
},
|
|
13
13
|
modifyUpdating: async () => {
|
|
14
|
-
console.error("Missing
|
|
14
|
+
console.error("Missing GridUpdatingContext");
|
|
15
15
|
},
|
|
16
16
|
});
|