@linzjs/step-ag-grid 7.1.1 → 7.3.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/dist/index.js +65 -41
- package/dist/index.js.map +1 -1
- package/dist/src/components/Grid.d.ts +2 -0
- package/dist/src/components/GridCellMultiSelectClassRules.d.ts +2 -0
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/utils/testQuick.d.ts +2 -2
- package/dist/src/utils/testUtil.d.ts +5 -4
- package/dist/step-ag-grid.esm.js +64 -41
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +5 -0
- package/src/components/GridCell.tsx +2 -2
- package/src/components/GridCellMultiSelectClassRules.tsx +9 -0
- package/src/components/gridForm/GridFormDropDown.tsx +2 -2
- package/src/components/gridForm/GridFormMultiSelect.tsx +8 -1
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +1 -3
- package/src/index.ts +1 -1
- package/src/stories/grid/GridPopoutEditMultiSelect.stories.tsx +2 -29
- package/src/utils/testQuick.ts +15 -14
- package/src/utils/testUtil.ts +28 -15
- package/dist/src/components/GenericCellClass.d.ts +0 -2
- package/src/components/GenericCellClass.tsx +0 -15
package/dist/index.js
CHANGED
|
@@ -2825,20 +2825,17 @@ var Grid = function (params) {
|
|
|
2825
2825
|
}, [columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.length, sizeColumnsToFit]);
|
|
2826
2826
|
return (jsxRuntime.jsxs("div", __assign({ "data-testid": params.dataTestId, className: clsx("Grid-container", "ag-theme-alpine", staleGrid && "Grid-sortIsStale") }, { children: [params.quickFilter && (jsxRuntime.jsx("div", __assign({ className: "Grid-quickFilter" }, { children: jsxRuntime.jsx("input", { "aria-label": "Search", className: "lui-margin-top-xxs lui-margin-bottom-xxs Grid-quickFilterBox", type: "text", placeholder: (_a = params.quickFilterPlaceholder) !== null && _a !== void 0 ? _a : "Search...", value: internalQuickFilter, onChange: function (event) {
|
|
2827
2827
|
setInternalQuickFilter(event.target.value);
|
|
2828
|
-
} }) }))), jsxRuntime.jsx(agGridReact.AgGridReact, { getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, onCellEditingStopped: onCellEditingStopped, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_b = params.postSortRows) !== null && _b !== void 0 ? _b : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection })] })));
|
|
2828
|
+
} }) }))), jsxRuntime.jsx(agGridReact.AgGridReact, { animateRows: params.animateRows, rowClassRules: params.rowClassRules, defaultColDef: params.defaultColDef, getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, onCellEditingStopped: onCellEditingStopped, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_b = params.postSortRows) !== null && _b !== void 0 ? _b : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection })] })));
|
|
2829
2829
|
};
|
|
2830
2830
|
|
|
2831
|
-
var
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
return
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
return rowSelected && api.getEditingCells().some(function (cell) { return cell.column.getColDef() === props.colDef; })
|
|
2840
|
-
? "ag-selected-for-edit"
|
|
2841
|
-
: "";
|
|
2831
|
+
var GridCellMultiSelectClassRules = {
|
|
2832
|
+
"ag-selected-for-edit": function (_a) {
|
|
2833
|
+
var api = _a.api, node = _a.node, colDef = _a.colDef;
|
|
2834
|
+
return api
|
|
2835
|
+
.getSelectedNodes()
|
|
2836
|
+
.map(function (row) { return row.id; })
|
|
2837
|
+
.includes(node.id) && api.getEditingCells().some(function (cell) { return cell.column.getColDef() === colDef; });
|
|
2838
|
+
}
|
|
2842
2839
|
};
|
|
2843
2840
|
|
|
2844
2841
|
function styleInject(css, ref) {
|
|
@@ -2916,7 +2913,7 @@ var GridCellRenderer = function (props) {
|
|
|
2916
2913
|
var GridCell = function (props, custom) {
|
|
2917
2914
|
var _a;
|
|
2918
2915
|
return __assign(__assign(__assign(__assign(__assign(__assign({ colId: props.field, sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true }, ((custom === null || custom === void 0 ? void 0 : custom.editor) && {
|
|
2919
|
-
|
|
2916
|
+
cellClassRules: GridCellMultiSelectClassRules,
|
|
2920
2917
|
editable: (_a = props.editable) !== null && _a !== void 0 ? _a : true,
|
|
2921
2918
|
cellEditor: GenericCellEditorComponentWrapper(custom)
|
|
2922
2919
|
})), { suppressKeyboardEvent: function (e) {
|
|
@@ -3368,7 +3365,7 @@ var GridFormDropDown = function (props) {
|
|
|
3368
3365
|
return (jsxRuntime.jsxs("div", __assign({ style: { display: "flex", flexDirection: "column", width: "100%" } }, { children: [jsxRuntime.jsx("input", { autoFocus: true, 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-disableenterautosave": true, "data-allowtabtosave": true, onChange: function (e) { return setFilter(e.target.value); }, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }), props.filterHelpText && isNotEmpty(filter) && (jsxRuntime.jsx(FormError, { error: null, helpText: props.filterHelpText }))] })));
|
|
3369
3366
|
} })), jsxRuntime.jsx(MenuDivider, {}, "$$divider_filter")] }))), jsxRuntime.jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [options && options.length == (filteredValues === null || filteredValues === void 0 ? void 0 : filteredValues.length) && (jsxRuntime.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) {
|
|
3370
3367
|
var _a;
|
|
3371
|
-
return item.value === MenuSeparatorString ? (jsxRuntime.jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsxRuntime.jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxRuntime.jsxs("div", { children: [jsxRuntime.
|
|
3368
|
+
return item.value === MenuSeparatorString ? (jsxRuntime.jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsxRuntime.jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function (e) {
|
|
3372
3369
|
if (item.subComponent) {
|
|
3373
3370
|
// toggle selection
|
|
3374
3371
|
setSelectedSubComponent(selectedSubComponent === item ? null : item);
|
|
@@ -3383,7 +3380,8 @@ var GridFormDropDown = function (props) {
|
|
|
3383
3380
|
: CloseReason.TAB_FORWARD
|
|
3384
3381
|
: CloseReason.CLICK).then();
|
|
3385
3382
|
}
|
|
3386
|
-
} }, { children:
|
|
3383
|
+
} }, { children: ((_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value))) +
|
|
3384
|
+
(item.subComponent ? "..." : "") }), "".concat(fieldToString(field), "-").concat(index)), item.subComponent && selectedSubComponent === item && (jsxRuntime.jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) { return (jsxRuntime.jsx(GridSubComponentContext.Provider, __assign({ value: {
|
|
3387
3385
|
context: { options: options },
|
|
3388
3386
|
data: data,
|
|
3389
3387
|
value: subSelectedValue,
|
|
@@ -3749,7 +3747,7 @@ var MenuRadioItem = function (props) {
|
|
|
3749
3747
|
e.keepOpen = true;
|
|
3750
3748
|
toggleValue(item);
|
|
3751
3749
|
}
|
|
3752
|
-
} }, { children: jsxRuntime.jsx(lui.LuiCheckboxInput, { isChecked: (_a = item.checked) !== null && _a !== void 0 ? _a : false, value: "".concat(item.value), label: (_b = item.label) !== null && _b !== void 0 ? _b : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), inputProps: {
|
|
3750
|
+
} }, { children: jsxRuntime.jsx(lui.LuiCheckboxInput, { isChecked: (_a = item.checked) !== null && _a !== void 0 ? _a : false, value: "".concat(item.value), label: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.warning && jsxRuntime.jsx(GridIcon, { icon: "ic_warning", title: item.warning }), (_b = item.label) !== null && _b !== void 0 ? _b : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value))] }), inputProps: {
|
|
3753
3751
|
onClick: function (e) {
|
|
3754
3752
|
// Click is handled by MenuItem onClick
|
|
3755
3753
|
e.preventDefault();
|
|
@@ -3929,7 +3927,7 @@ var GridFormPopoverMenu = function (props) {
|
|
|
3929
3927
|
* Popout burger menu
|
|
3930
3928
|
*/
|
|
3931
3929
|
var GridPopoverMenu = function (colDef, custom) {
|
|
3932
|
-
return GridCell(__assign(__assign({ maxWidth: 40, editable: colDef.editable != null ? colDef.editable : true, cellStyle: { justifyContent: "
|
|
3930
|
+
return GridCell(__assign(__assign({ maxWidth: 40, editable: colDef.editable != null ? colDef.editable : true, cellStyle: { justifyContent: "center" }, cellRenderer: GridRenderPopoutMenuCell }, colDef), { cellRendererParams: {
|
|
3933
3931
|
// Menus open on single click, this parameter is picked up in Grid.tsx
|
|
3934
3932
|
singleClickEdit: true
|
|
3935
3933
|
} }), __assign({ editor: GridFormPopoverMenu }, custom));
|
|
@@ -24259,6 +24257,12 @@ var queryAllBySelector = function (selector, container) {
|
|
|
24259
24257
|
return Array.from(container.querySelectorAll(selector));
|
|
24260
24258
|
};
|
|
24261
24259
|
var escapeSelectorParam = function (param) { return param.replace(/["\\]/g, "\\$&"); };
|
|
24260
|
+
var getMatcher = function (matcherText) {
|
|
24261
|
+
var textMatcher = typeof matcherText === "string"
|
|
24262
|
+
? function (text) { return text != null && text.toLowerCase() === matcherText.toLowerCase(); }
|
|
24263
|
+
: function (text) { return text != null && matcherText.test(text); };
|
|
24264
|
+
return function (e) { var _a, _b; return textMatcher((_a = e.innerHTML) === null || _a === void 0 ? void 0 : _a.trim()) || textMatcher((_b = e.innerText) === null || _b === void 0 ? void 0 : _b.trim()); };
|
|
24265
|
+
};
|
|
24262
24266
|
/**
|
|
24263
24267
|
* Build selector for quick operations.
|
|
24264
24268
|
*
|
|
@@ -24266,7 +24270,6 @@ var escapeSelectorParam = function (param) { return param.replace(/["\\]/g, "\\$
|
|
|
24266
24270
|
* @param container Optional container to search in.
|
|
24267
24271
|
*/
|
|
24268
24272
|
var quickSelector = function (props, container) {
|
|
24269
|
-
var _a, _b;
|
|
24270
24273
|
var selector = "";
|
|
24271
24274
|
var lastIQueryQuick = props;
|
|
24272
24275
|
for (var loop = props; loop; loop = loop.child) {
|
|
@@ -24283,16 +24286,9 @@ var quickSelector = function (props, container) {
|
|
|
24283
24286
|
throw "get/query/findQuick needs at least one defined parameter";
|
|
24284
24287
|
}
|
|
24285
24288
|
var els = queryAllBySelector(selector, container);
|
|
24286
|
-
|
|
24287
|
-
|
|
24288
|
-
els = els.filter(
|
|
24289
|
-
}
|
|
24290
|
-
var textContains = (_b = lastIQueryQuick.textContains) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
24291
|
-
if (textContains != null) {
|
|
24292
|
-
els = els.filter(function (el) {
|
|
24293
|
-
return el.innerHTML.toLowerCase().indexOf(textContains) != -1 ||
|
|
24294
|
-
el.innerText.toLowerCase().indexOf(textContains) != -1;
|
|
24295
|
-
});
|
|
24289
|
+
if (lastIQueryQuick.text != null) {
|
|
24290
|
+
var matcher = getMatcher(lastIQueryQuick.text);
|
|
24291
|
+
els = els.filter(matcher);
|
|
24296
24292
|
}
|
|
24297
24293
|
return { selector: selector, els: els };
|
|
24298
24294
|
};
|
|
@@ -24307,7 +24303,7 @@ var queryQuick = function (filter, container) {
|
|
|
24307
24303
|
var _a;
|
|
24308
24304
|
var _b = quickSelector(filter, container), els = _b.els, selector = _b.selector;
|
|
24309
24305
|
if (els.length > 1) {
|
|
24310
|
-
throw "Found multiple(".concat(els.length, ") elements by selector ").concat(selector);
|
|
24306
|
+
throw "Found multiple(".concat(els.length, ") elements by selector ").concat(selector, "\n").concat(els.map(function (el, index) { var _a; return "".concat(index, ": ").concat((_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.innerHTML, "\n\n"); }));
|
|
24311
24307
|
}
|
|
24312
24308
|
return (_a = els[0]) !== null && _a !== void 0 ? _a : null;
|
|
24313
24309
|
};
|
|
@@ -24427,6 +24423,25 @@ var findCell = function (rowId, colId, within) { return __awaiter(void 0, void 0
|
|
|
24427
24423
|
}
|
|
24428
24424
|
});
|
|
24429
24425
|
}); };
|
|
24426
|
+
var cellContains = function (rowId, colId, text, within) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24427
|
+
return __generator(this, function (_a) {
|
|
24428
|
+
switch (_a.label) {
|
|
24429
|
+
case 0: return [4 /*yield*/, waitForWrapper(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
24430
|
+
var row;
|
|
24431
|
+
return __generator(this, function (_a) {
|
|
24432
|
+
switch (_a.label) {
|
|
24433
|
+
case 0: return [4 /*yield*/, findRow(rowId, within)];
|
|
24434
|
+
case 1:
|
|
24435
|
+
row = _a.sent();
|
|
24436
|
+
return [4 /*yield*/, findQuick({ tagName: "[col-id='".concat(colId, "']"), text: text }, row)];
|
|
24437
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
24438
|
+
}
|
|
24439
|
+
});
|
|
24440
|
+
}); })];
|
|
24441
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
24442
|
+
}
|
|
24443
|
+
});
|
|
24444
|
+
}); };
|
|
24430
24445
|
var selectCell = function (rowId, colId, within) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24431
24446
|
return __generator(this, function (_a) {
|
|
24432
24447
|
switch (_a.label) {
|
|
@@ -24476,7 +24491,7 @@ var findOpenMenu = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
24476
24491
|
return [2 /*return*/, findQuick({ classes: ".szh-menu--state-open" })];
|
|
24477
24492
|
}); }); };
|
|
24478
24493
|
var queryMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24479
|
-
var openMenu, els, result;
|
|
24494
|
+
var openMenu, els, matcher, result;
|
|
24480
24495
|
return __generator(this, function (_a) {
|
|
24481
24496
|
switch (_a.label) {
|
|
24482
24497
|
case 0: return [4 /*yield*/, findOpenMenu()];
|
|
@@ -24485,22 +24500,30 @@ var queryMenuOption = function (menuOptionText) { return __awaiter(void 0, void
|
|
|
24485
24500
|
return [4 /*yield*/, getQueriesForElement(openMenu).findAllByRole("menuitem")];
|
|
24486
24501
|
case 2:
|
|
24487
24502
|
els = _a.sent();
|
|
24488
|
-
|
|
24503
|
+
matcher = getMatcher(menuOptionText);
|
|
24504
|
+
result = els.find(matcher);
|
|
24489
24505
|
return [2 /*return*/, result !== null && result !== void 0 ? result : null];
|
|
24490
24506
|
}
|
|
24491
24507
|
});
|
|
24492
24508
|
}); };
|
|
24493
24509
|
var findMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24494
|
-
var menuOption;
|
|
24495
24510
|
return __generator(this, function (_a) {
|
|
24496
24511
|
switch (_a.label) {
|
|
24497
|
-
case 0: return [4 /*yield*/,
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24512
|
+
case 0: return [4 /*yield*/, waitForWrapper(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
24513
|
+
var menuOption;
|
|
24514
|
+
return __generator(this, function (_a) {
|
|
24515
|
+
switch (_a.label) {
|
|
24516
|
+
case 0: return [4 /*yield*/, queryMenuOption(menuOptionText)];
|
|
24517
|
+
case 1:
|
|
24518
|
+
menuOption = _a.sent();
|
|
24519
|
+
if (menuOption == null) {
|
|
24520
|
+
throw Error("Unable to find menu option ".concat(menuOptionText));
|
|
24521
|
+
}
|
|
24522
|
+
return [2 /*return*/, menuOption];
|
|
24523
|
+
}
|
|
24524
|
+
});
|
|
24525
|
+
}); })];
|
|
24526
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
24504
24527
|
}
|
|
24505
24528
|
});
|
|
24506
24529
|
}); };
|
|
@@ -24612,7 +24635,7 @@ var closeMenu = function () {
|
|
|
24612
24635
|
userEvent.click(document.body);
|
|
24613
24636
|
};
|
|
24614
24637
|
var findActionButton = function (text, container) {
|
|
24615
|
-
return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay",
|
|
24638
|
+
return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", text: text } }, container);
|
|
24616
24639
|
};
|
|
24617
24640
|
var clickActionButton = function (text, container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24618
24641
|
return __generator(this, function (_a) {
|
|
@@ -24641,9 +24664,9 @@ exports.ComponentLoadingWrapper = ComponentLoadingWrapper;
|
|
|
24641
24664
|
exports.ControlledMenu = ControlledMenu;
|
|
24642
24665
|
exports.FocusableItem = FocusableItem;
|
|
24643
24666
|
exports.GenericCellEditorComponentWrapper = GenericCellEditorComponentWrapper;
|
|
24644
|
-
exports.GenericMultiEditCellClass = GenericMultiEditCellClass;
|
|
24645
24667
|
exports.Grid = Grid;
|
|
24646
24668
|
exports.GridCell = GridCell;
|
|
24669
|
+
exports.GridCellMultiSelectClassRules = GridCellMultiSelectClassRules;
|
|
24647
24670
|
exports.GridCellRenderer = GridCellRenderer;
|
|
24648
24671
|
exports.GridContext = GridContext;
|
|
24649
24672
|
exports.GridContextProvider = GridContextProvider;
|
|
@@ -24689,6 +24712,7 @@ exports.bearingCorrectionValueFormatter = bearingCorrectionValueFormatter;
|
|
|
24689
24712
|
exports.bearingNumberParser = bearingNumberParser;
|
|
24690
24713
|
exports.bearingStringValidator = bearingStringValidator;
|
|
24691
24714
|
exports.bearingValueFormatter = bearingValueFormatter;
|
|
24715
|
+
exports.cellContains = cellContains;
|
|
24692
24716
|
exports.clickActionButton = clickActionButton;
|
|
24693
24717
|
exports.clickMenuOption = clickMenuOption;
|
|
24694
24718
|
exports.clickMultiSelectOption = clickMultiSelectOption;
|