@linzjs/step-ag-grid 6.0.0 → 6.1.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/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/step-ag-grid.esm.js +17 -16
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +14 -10
- package/src/react-menu3/components/ControlledMenu.tsx +5 -6
- package/src/stories/grid/FormTest.tsx +7 -3
package/dist/index.js
CHANGED
|
@@ -1395,15 +1395,15 @@ var ControlledMenuFr = function (_a, externalRef) {
|
|
|
1395
1395
|
var lastInputEl = inputEls[inputEls.length - 1];
|
|
1396
1396
|
if (activeElement !== firstInputEl && activeElement !== lastInputEl)
|
|
1397
1397
|
return;
|
|
1398
|
-
var
|
|
1398
|
+
var isTextArea = activeElement.nodeName === "TEXTAREA";
|
|
1399
|
+
var suppressEnterAutoSave = activeElement.getAttribute("data-disableEnterAutoSave") || isTextArea;
|
|
1399
1400
|
var invokeSave = function (reason) {
|
|
1400
1401
|
var _a, _b;
|
|
1401
|
-
if (!(saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current)
|
|
1402
|
+
if (!(saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current))
|
|
1402
1403
|
return;
|
|
1403
1404
|
(_a = saveButtonRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-reason", reason);
|
|
1404
1405
|
(_b = saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current) === null || _b === void 0 ? void 0 : _b.click();
|
|
1405
1406
|
};
|
|
1406
|
-
var isTextArea = activeElement.nodeName === "TEXTAREA";
|
|
1407
1407
|
switch (activeElement.nodeName) {
|
|
1408
1408
|
case "TEXTAREA":
|
|
1409
1409
|
case "INPUT": {
|
|
@@ -1420,7 +1420,7 @@ var ControlledMenuFr = function (_a, externalRef) {
|
|
|
1420
1420
|
invokeSave(ev.shiftKey ? CloseReason.TAB_BACKWARD : CloseReason.TAB_FORWARD);
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
|
-
if (ev.key === "Enter" && !
|
|
1423
|
+
if (ev.key === "Enter" && !suppressEnterAutoSave) {
|
|
1424
1424
|
ev.preventDefault();
|
|
1425
1425
|
ev.stopPropagation();
|
|
1426
1426
|
if (isDown) {
|
|
@@ -1443,7 +1443,7 @@ var ControlledMenuFr = function (_a, externalRef) {
|
|
|
1443
1443
|
lastTabDownEl.current == activeElement && invokeSave(CloseReason.TAB_FORWARD);
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
|
-
if (ev.key === "Enter" && !
|
|
1446
|
+
if (ev.key === "Enter" && !suppressEnterAutoSave) {
|
|
1447
1447
|
ev.preventDefault();
|
|
1448
1448
|
ev.stopPropagation();
|
|
1449
1449
|
if (isDown) {
|
|
@@ -3096,14 +3096,16 @@ var GridFormDropDown = function (props) {
|
|
|
3096
3096
|
var optionsInitialising = react.useRef(false);
|
|
3097
3097
|
var _d = react.useState(null), options = _d[0], setOptions = _d[1];
|
|
3098
3098
|
var subComponentIsValid = react.useRef(false);
|
|
3099
|
-
var
|
|
3099
|
+
var subComponentInitialValue = react.useRef(null);
|
|
3100
|
+
var _e = react.useState(null), subSelectedValue = _e[0], setSubSelectedValue = _e[1];
|
|
3100
3101
|
var _f = react.useState(null), selectedSubComponent = _f[0], setSelectedSubComponent = _f[1];
|
|
3101
3102
|
var selectItemHandler = react.useCallback(function (value, subComponentValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3102
3103
|
var hasChanged;
|
|
3103
3104
|
return __generator(this, function (_a) {
|
|
3104
3105
|
switch (_a.label) {
|
|
3105
3106
|
case 0:
|
|
3106
|
-
hasChanged = selectedRows.some(function (row) { return row[field] !== value; })
|
|
3107
|
+
hasChanged = selectedRows.some(function (row) { return row[field] !== value; }) ||
|
|
3108
|
+
(subComponentValue !== undefined && subComponentInitialValue.current !== JSON.stringify(subComponentValue));
|
|
3107
3109
|
if (!hasChanged) return [3 /*break*/, 3];
|
|
3108
3110
|
if (!props.onSelectedItem) return [3 /*break*/, 2];
|
|
3109
3111
|
return [4 /*yield*/, props.onSelectedItem({ selectedRows: selectedRows, value: value, subComponentValue: subComponentValue })];
|
|
@@ -3279,15 +3281,10 @@ var GridFormDropDown = function (props) {
|
|
|
3279
3281
|
var _a;
|
|
3280
3282
|
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.jsxs(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function (e) {
|
|
3281
3283
|
if (item.subComponent) {
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
}
|
|
3287
|
-
else {
|
|
3288
|
-
// toggle selection on
|
|
3289
|
-
setSelectedSubComponent(item);
|
|
3290
|
-
}
|
|
3284
|
+
// toggle selection
|
|
3285
|
+
setSelectedSubComponent(selectedSubComponent === item ? null : item);
|
|
3286
|
+
subComponentIsValid.current = true;
|
|
3287
|
+
subComponentInitialValue.current = null;
|
|
3291
3288
|
e.keepOpen = true;
|
|
3292
3289
|
}
|
|
3293
3290
|
else {
|
|
@@ -3302,6 +3299,10 @@ var GridFormDropDown = function (props) {
|
|
|
3302
3299
|
value: subSelectedValue,
|
|
3303
3300
|
setValue: function (value) {
|
|
3304
3301
|
setSubSelectedValue(value);
|
|
3302
|
+
if (subComponentInitialValue.current === null) {
|
|
3303
|
+
// copy the default value of the sub-component so we can change detect on save
|
|
3304
|
+
subComponentInitialValue.current = JSON.stringify(value);
|
|
3305
|
+
}
|
|
3305
3306
|
},
|
|
3306
3307
|
setValid: function (valid) {
|
|
3307
3308
|
subComponentIsValid.current = valid;
|