@linzjs/step-ag-grid 7.13.0 → 7.13.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/src/components/GridCellMultiEditor.d.ts +4 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +2 -2
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +5 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/step-ag-grid.esm.js +57 -34
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/GridCellMultiEditor.tsx +5 -1
- package/src/components/gridForm/GridFormDropDown.tsx +34 -32
- package/src/components/gridRender/GridRenderGenericCell.tsx +6 -1
- package/src/index.ts +6 -0
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +1 -2
- package/dist/index.js +0 -24883
- package/dist/index.js.map +0 -1
|
@@ -9,4 +9,7 @@ export declare const Editor: <FN extends (param: any) => JSX.Element>(props: {
|
|
|
9
9
|
editor: FN;
|
|
10
10
|
editorParams: ComponentProps<FN>;
|
|
11
11
|
}) => CellEditorSelectorResult;
|
|
12
|
-
export
|
|
12
|
+
export interface RowCellEditorParams<RowType extends GridBaseRow> extends ICellEditorParams {
|
|
13
|
+
data: RowType;
|
|
14
|
+
}
|
|
15
|
+
export declare const GridCellMultiEditor: <RowType extends GridBaseRow>(props: GenericCellColDef<RowType>, cellEditorSelector: (params: RowCellEditorParams<RowType>) => CellEditorSelectorResult) => ColDefT<RowType>;
|
|
@@ -27,10 +27,10 @@ export interface GridFormPopoutDropDownProps<RowType extends GridBaseRow> extend
|
|
|
27
27
|
filtered?: "local" | "reload";
|
|
28
28
|
filterPlaceholder?: string;
|
|
29
29
|
filterHelpText?: string;
|
|
30
|
+
noOptionsMessage?: string;
|
|
30
31
|
onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<RowType>) => Promise<void>;
|
|
31
32
|
onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<RowType>) => Promise<void>;
|
|
32
|
-
options: SelectOption[] | ((selectedRows: RowType[], filter?: string) => Promise<SelectOption[]> | SelectOption[]);
|
|
33
|
-
optionsRequestCancel?: () => void;
|
|
33
|
+
options: SelectOption[] | ((selectedRows: RowType[], filter?: string) => Promise<SelectOption[] | undefined> | SelectOption[] | undefined) | undefined;
|
|
34
34
|
}
|
|
35
35
|
export declare const GridFormDropDown: <RowType extends GridBaseRow>(props: GridFormPopoutDropDownProps<RowType>) => JSX.Element;
|
|
36
36
|
export {};
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import { ICellRendererParams } from "ag-grid-community";
|
|
3
3
|
import { GridBaseRow } from "../Grid";
|
|
4
4
|
import { ColDefT } from "../GridCell";
|
|
5
|
-
import { SuppressKeyboardEventParams } from "ag-grid-community/dist/lib/entities/colDef";
|
|
5
|
+
import { EditableCallbackParams, SuppressKeyboardEventParams } from "ag-grid-community/dist/lib/entities/colDef";
|
|
6
6
|
export interface RowICellRendererParams<RowType extends GridBaseRow> extends ICellRendererParams {
|
|
7
7
|
data: RowType;
|
|
8
8
|
}
|
|
9
|
+
export interface RowEditableCallbackParams<RowType extends GridBaseRow> extends EditableCallbackParams {
|
|
10
|
+
data: RowType;
|
|
11
|
+
}
|
|
9
12
|
export interface GenericCellColDef<RowType extends GridBaseRow> extends ColDefT<RowType> {
|
|
10
13
|
cellRendererParams?: GenericCellRendererParams<RowType>;
|
|
14
|
+
editable?: boolean | ((params: RowEditableCallbackParams<RowType>) => boolean);
|
|
11
15
|
}
|
|
12
16
|
export interface GenericCellRendererParams<RowType extends GridBaseRow> {
|
|
13
17
|
singleClickEdit?: boolean;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./contexts/GridSubComponentContext";
|
|
|
10
10
|
export type { GridBaseRow } from "./components/Grid";
|
|
11
11
|
export { Grid } from "./components/Grid";
|
|
12
12
|
export * from "./components/GridCell";
|
|
13
|
+
export * from "./components/GridCellMultiEditor";
|
|
13
14
|
export { GridIcon } from "./components/GridIcon";
|
|
14
15
|
export { ComponentLoadingWrapper } from "./components/ComponentLoadingWrapper";
|
|
15
16
|
export { GridCellMultiSelectClassRules } from "./components/GridCellMultiSelectClassRules";
|
|
@@ -30,6 +31,10 @@ export { GridFormSubComponentTextInput } from "./components/gridForm/GridFormSub
|
|
|
30
31
|
export * from "./components/gridForm/GridFormDropDown";
|
|
31
32
|
export * from "./components/gridForm/GridFormMultiSelect";
|
|
32
33
|
export * from "./components/gridForm/GridFormPopoverMenu";
|
|
34
|
+
export * from "./components/gridForm/GridFormTextInput";
|
|
35
|
+
export * from "./components/gridForm/GridFormTextArea";
|
|
36
|
+
export * from "./components/gridForm/GridFormMessage";
|
|
37
|
+
export * from "./components/gridForm/GridFormEditBearing";
|
|
33
38
|
export { GridHeaderSelect } from "./components/gridHeader/GridHeaderSelect";
|
|
34
39
|
export { TextAreaInput } from "./lui/TextAreaInput";
|
|
35
40
|
export { TextInputFormatted } from "./lui/TextInputFormatted";
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -3014,6 +3014,28 @@ var GenericCellEditorComponentWrapper = function (editor) {
|
|
|
3014
3014
|
});
|
|
3015
3015
|
};
|
|
3016
3016
|
|
|
3017
|
+
var Editor = function (props) { return ({
|
|
3018
|
+
component: GenericCellEditorComponentWrapper(props.editor),
|
|
3019
|
+
params: __assign(__assign({}, props.editorParams), { multiEdit: props.multiEdit })
|
|
3020
|
+
}); };
|
|
3021
|
+
/*
|
|
3022
|
+
* All cells should use this
|
|
3023
|
+
*/
|
|
3024
|
+
var GridCellMultiEditor = function (props, cellEditorSelector) {
|
|
3025
|
+
var _a, _b;
|
|
3026
|
+
return __assign(__assign({ colId: (_a = props.colId) !== null && _a !== void 0 ? _a : props.field, field: props.field, sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true, editable: (_b = props.editable) !== null && _b !== void 0 ? _b : true, cellClassRules: GridCellMultiSelectClassRules, cellEditorSelector: cellEditorSelector, suppressKeyboardEvent: suppressCellKeyboardEvents,
|
|
3027
|
+
// Default value formatter, otherwise react freaks out on objects
|
|
3028
|
+
valueFormatter: function (params) {
|
|
3029
|
+
if (params.value == null)
|
|
3030
|
+
return "–";
|
|
3031
|
+
var types = ["number", "boolean", "string"];
|
|
3032
|
+
if (types.includes(typeof params.value))
|
|
3033
|
+
return "".concat(params.value);
|
|
3034
|
+
else
|
|
3035
|
+
return JSON.stringify(params.value);
|
|
3036
|
+
} }, props), { cellRenderer: GridCellRenderer, cellRendererParams: __assign({ originalCellRenderer: props.cellRenderer }, props.cellRendererParams) });
|
|
3037
|
+
};
|
|
3038
|
+
|
|
3017
3039
|
/**
|
|
3018
3040
|
* If loading is true this returns a loading spinner, otherwise it returns its children.
|
|
3019
3041
|
*/
|
|
@@ -3242,17 +3264,17 @@ var fieldToString = function (field) {
|
|
|
3242
3264
|
return typeof field == "symbol" ? field.toString() : "".concat(field);
|
|
3243
3265
|
};
|
|
3244
3266
|
var GridFormDropDown = function (props) {
|
|
3245
|
-
var _a
|
|
3267
|
+
var _a;
|
|
3268
|
+
var _b = useGridPopoverContext(), selectedRows = _b.selectedRows, field = _b.field, data = _b.data;
|
|
3246
3269
|
// Save triggers during async action processing which triggers another selectItem(), this ref blocks that
|
|
3247
|
-
var
|
|
3248
|
-
var
|
|
3249
|
-
var
|
|
3250
|
-
var _d = useState(null), options = _d[0], setOptions = _d[1];
|
|
3270
|
+
var _c = useState(""), filter = _c[0], setFilter = _c[1];
|
|
3271
|
+
var _d = useState(), filteredValues = _d[0], setFilteredValues = _d[1];
|
|
3272
|
+
var _e = useState(null), options = _e[0], setOptions = _e[1];
|
|
3251
3273
|
var subComponentIsValid = useRef(false);
|
|
3252
3274
|
var subComponentInitialValue = useRef(null);
|
|
3253
|
-
var
|
|
3275
|
+
var _f = useState(null), subSelectedValue = _f[0], setSubSelectedValue = _f[1];
|
|
3254
3276
|
// Note: null is assumed to be the filter
|
|
3255
|
-
var
|
|
3277
|
+
var _g = useState(null), selectedItem = _g[0], setSelectedItem = _g[1];
|
|
3256
3278
|
var selectItemHandler = useCallback(function (value, subComponentValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3257
3279
|
var hasChanged;
|
|
3258
3280
|
return __generator(this, function (_a) {
|
|
@@ -3275,11 +3297,9 @@ var GridFormDropDown = function (props) {
|
|
|
3275
3297
|
}); }, [field, props, selectedRows]);
|
|
3276
3298
|
// Load up options list if it's async function
|
|
3277
3299
|
useEffect(function () {
|
|
3278
|
-
|
|
3279
|
-
if (options || optionsInitialising.current)
|
|
3300
|
+
if (options)
|
|
3280
3301
|
return;
|
|
3281
|
-
|
|
3282
|
-
var optionsConf = (_a = props.options) !== null && _a !== void 0 ? _a : [];
|
|
3302
|
+
var optionsConf = props.options;
|
|
3283
3303
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3284
3304
|
var optionsList;
|
|
3285
3305
|
return __generator(this, function (_a) {
|
|
@@ -3291,24 +3311,26 @@ var GridFormDropDown = function (props) {
|
|
|
3291
3311
|
optionsConf = _a.sent();
|
|
3292
3312
|
_a.label = 2;
|
|
3293
3313
|
case 2:
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3314
|
+
if (optionsConf !== undefined) {
|
|
3315
|
+
optionsList = optionsConf === null || optionsConf === void 0 ? void 0 : optionsConf.map(function (item) {
|
|
3316
|
+
return item == null || typeof item == "string"
|
|
3317
|
+
? {
|
|
3318
|
+
value: item,
|
|
3319
|
+
label: item,
|
|
3320
|
+
disabled: false
|
|
3321
|
+
}
|
|
3322
|
+
: item;
|
|
3323
|
+
});
|
|
3324
|
+
if (props.filtered) {
|
|
3325
|
+
// This is needed otherwise when filter input is rendered and sets autofocus
|
|
3326
|
+
// the mouse up of the double click edit triggers the cell to cancel editing
|
|
3327
|
+
setOptions(optionsList);
|
|
3328
|
+
//delay(() => setOptions(optionsList), 100);
|
|
3329
|
+
}
|
|
3330
|
+
else {
|
|
3331
|
+
setOptions(optionsList);
|
|
3332
|
+
}
|
|
3310
3333
|
}
|
|
3311
|
-
optionsInitialising.current = false;
|
|
3312
3334
|
return [2 /*return*/];
|
|
3313
3335
|
}
|
|
3314
3336
|
});
|
|
@@ -3331,15 +3353,16 @@ var GridFormDropDown = function (props) {
|
|
|
3331
3353
|
.filter(function (r) { return r !== undefined; }));
|
|
3332
3354
|
}
|
|
3333
3355
|
}, [props.filtered, filter, options]);
|
|
3334
|
-
var researchOnFilterChange =
|
|
3335
|
-
|
|
3336
|
-
|
|
3356
|
+
var researchOnFilterChange = useMemo(function () {
|
|
3357
|
+
return dist$1(function () {
|
|
3358
|
+
setOptions(null);
|
|
3359
|
+
}, 500);
|
|
3360
|
+
}, []);
|
|
3337
3361
|
var previousFilter = useRef(filter);
|
|
3338
3362
|
// Reload filtering.
|
|
3339
3363
|
useEffect(function () {
|
|
3340
3364
|
if (previousFilter.current != filter && props.filtered == "reload") {
|
|
3341
3365
|
previousFilter.current = filter;
|
|
3342
|
-
props.optionsRequestCancel && props.optionsRequestCancel();
|
|
3343
3366
|
researchOnFilterChange().then();
|
|
3344
3367
|
}
|
|
3345
3368
|
}, [filter, props, researchOnFilterChange]);
|
|
@@ -3391,7 +3414,7 @@ var GridFormDropDown = function (props) {
|
|
|
3391
3414
|
var ref = _a.ref;
|
|
3392
3415
|
return (jsxs("div", __assign({ style: { display: "flex", flexDirection: "column", width: "100%" } }, { children: [jsx("input", { className: "LuiTextInput-input", ref: ref, type: "text", placeholder: (_b = props.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: filter, "data-allowtabtosave": true, "data-disableenterautosave": !props.onSelectFilter &&
|
|
3393
3416
|
!(filteredValues && filteredValues.length === 1 && !filteredValues[0].subComponent), onChange: function (e) { return setFilter(e.target.value); } }), props.filterHelpText && isNotEmpty(filter) && (jsx(FormError, { error: null, helpText: props.filterHelpText }))] })));
|
|
3394
|
-
} })), jsx(MenuDivider, {}, "$$divider_filter")] }))), jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxs(Fragment$1, { children: [options && (isEmpty(options) || (filteredValues && isEmpty(filteredValues))) && (jsx(MenuItem, __assign({ className: "GridPopoverEditDropDown-noOptions" }, { children: "No Options" }), "".concat(fieldToString(field), "-empty"))), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
|
|
3417
|
+
} })), jsx(MenuDivider, {}, "$$divider_filter")] }))), jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxs(Fragment$1, { children: [options && (isEmpty(options) || (filteredValues && isEmpty(filteredValues))) && (jsx(MenuItem, __assign({ className: "GridPopoverEditDropDown-noOptions" }, { children: (_a = props.noOptionsMessage) !== null && _a !== void 0 ? _a : "No Options" }), "".concat(fieldToString(field), "-empty"))), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
|
|
3395
3418
|
var _a;
|
|
3396
3419
|
return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : ((!filteredValues || filteredValues.includes(item)) && (jsxs("div", { children: [jsxs(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onFocus: function () {
|
|
3397
3420
|
setSelectedItem(item);
|
|
@@ -24772,5 +24795,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
|
|
|
24772
24795
|
});
|
|
24773
24796
|
}); };
|
|
24774
24797
|
|
|
24775
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findParentWithClass, findRow, fnOrVar, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait$2 as wait };
|
|
24798
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findParentWithClass, findRow, fnOrVar, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait$2 as wait };
|
|
24776
24799
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|