From 6e87b8396928bb56cd0a852cbd163273748019f1 Mon Sep 17 00:00:00 2001 From: Ilank <63646693+ilan7empest@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:44:14 +0200 Subject: [PATCH] Create a new dist version `2.2.5` (#336) Collecting: - Cleanup [React] Replace createRef across the code (#333) - Fix [Labels chip] duplicated id (#334) - Fix [Feature store, Models] Label editing action issues (#335) --- commit_message | 6 ++++-- dist/components/FormChipCell/FormChipCell.js | 9 +++++---- dist/components/FormChipCell/FormChipCellView.js | 2 +- dist/components/FormChipCell/NewChipForm/NewChipForm.js | 4 ++-- .../components/FormChipCell/NewChipInput/NewChipInput.js | 1 - dist/components/FormTextarea/FormTextarea.js | 2 +- package.json | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/commit_message b/commit_message index 0c5b30b3..b13609a7 100644 --- a/commit_message +++ b/commit_message @@ -1,6 +1,8 @@ -Create a new dist version 2.2.4 +Create a new dist version 2.2.5 Collecting: -- Impl [UI] Add retry option for workflows (#331) +- Cleanup [React] Replace createRef across the code (#333) +- Fix [Labels chip] duplicated id (#334) +- Fix [Feature store, Models] Label editing action issues (#335) diff --git a/dist/components/FormChipCell/FormChipCell.js b/dist/components/FormChipCell/FormChipCell.js index 0b2007e4..9640dc63 100644 --- a/dist/components/FormChipCell/FormChipCell.js +++ b/dist/components/FormChipCell/FormChipCell.js @@ -122,13 +122,14 @@ const FormChipCell = _ref => { }); event && event.preventDefault(); }, [editConfig.isEdit, editConfig.chipIndex, showHiddenChips, formState.form.mutators, name, delimiter, setShowHiddenChips]); - const handleRemoveChip = (0, _react.useCallback)((event, fields, chipIndex) => { + const handleRemoveChip = (0, _react.useCallback)(function (event, fields, chipIndex) { + let isOutsideClick = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; checkChipsList(_lodash.default.chain(formState).get(['values', name]).filter((_, index) => index !== chipIndex).value()); fields.remove(chipIndex); onExitEditModeCallback && onExitEditModeCallback(); - event && event.stopPropagation(); + event && !isOutsideClick && event.stopPropagation(); }, [checkChipsList, formState, name, onExitEditModeCallback]); - const handleEditChip = (0, _react.useCallback)((event, fields, nameEvent) => { + const handleEditChip = (0, _react.useCallback)((event, fields, nameEvent, isOutsideClick) => { const { key, value @@ -136,7 +137,7 @@ const FormChipCell = _ref => { const isChipNotEmpty = !!(key !== null && key !== void 0 && key.trim() && value !== null && value !== void 0 && value.trim()); if (nameEvent === _constants.CLICK) { if (!isChipNotEmpty) { - handleRemoveChip(event, fields, editConfig.chipIndex); + handleRemoveChip(event, fields, editConfig.chipIndex, isOutsideClick); } setEditConfig({ chipIndex: null, diff --git a/dist/components/FormChipCell/FormChipCellView.js b/dist/components/FormChipCell/FormChipCellView.js index 0f436d3f..f595ee4f 100644 --- a/dist/components/FormChipCell/FormChipCellView.js +++ b/dist/components/FormChipCell/FormChipCellView.js @@ -114,7 +114,7 @@ const FormChipCellView = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) => chipIndex: index, chipOptions: chipOptions, editConfig: editConfig, - handleEditChip: (event, nameEvent) => handleEditChip(event, fields, nameEvent), + handleEditChip: (event, nameEvent, isOutsideClick) => handleEditChip(event, fields, nameEvent, isOutsideClick), handleRemoveChip: (event, index) => handleRemoveChip(event, fields, index), handleToEditMode: handleToEditMode, isEditable: isEditable, diff --git a/dist/components/FormChipCell/NewChipForm/NewChipForm.js b/dist/components/FormChipCell/NewChipForm/NewChipForm.js index 39bd6bf8..7919f0af 100644 --- a/dist/components/FormChipCell/NewChipForm/NewChipForm.js +++ b/dist/components/FormChipCell/NewChipForm/NewChipForm.js @@ -128,7 +128,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => { var _event$path, _event$composedPath; const elementPath = (_event$path = event.path) !== null && _event$path !== void 0 ? _event$path : (_event$composedPath = event.composedPath) === null || _event$composedPath === void 0 ? void 0 : _event$composedPath.call(event); if (!elementPath.includes(refInputContainer.current)) { - onChange(event, _constants.CLICK); + onChange(event, _constants.CLICK, true); window.getSelection().removeAllRanges(); } else { event.stopPropagation(); @@ -206,7 +206,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => { }; }); } - }, [maxWidthInput, refInputKey, refInputValue, keyName]); + }, [keyName, minWidthInput, maxWidthInput, minWidthValueInput]); (0, _react.useLayoutEffect)(() => { if (editConfig.chipIndex === chipIndex) { setSelectedInput(editConfig.isKeyFocused ? 'key' : editConfig.isValueFocused ? 'value' : null); diff --git a/dist/components/FormChipCell/NewChipInput/NewChipInput.js b/dist/components/FormChipCell/NewChipInput/NewChipInput.js index 0661b816..a08be4ac 100644 --- a/dist/components/FormChipCell/NewChipInput/NewChipInput.js +++ b/dist/components/FormChipCell/NewChipInput/NewChipInput.js @@ -55,7 +55,6 @@ const NewChipInput = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => { "data-testid": "input", ref: ref, type: "text", - id: input.name, ...inputProps, ...input, onChange: handleInputChange, diff --git a/dist/components/FormTextarea/FormTextarea.js b/dist/components/FormTextarea/FormTextarea.js index 276494e7..89e06ec6 100644 --- a/dist/components/FormTextarea/FormTextarea.js +++ b/dist/components/FormTextarea/FormTextarea.js @@ -59,7 +59,7 @@ const FormTextarea = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => { } = (0, _reactFinalForm.useField)(name); const [isInvalid, setIsInvalid] = (0, _react.useState)(false); const [textAreaCount, setTextAreaCount] = (0, _react.useState)(input.value.length); - const textAreaRef = /*#__PURE__*/_react.default.createRef(); + const textAreaRef = (0, _react.useRef)(); const formFieldClassNames = (0, _classnames.default)('form-field-textarea', className); const labelClassNames = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled'); const textAreaClassNames = (0, _classnames.default)('form-field__wrapper', disabled && 'form-field__wrapper-disabled', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border'); diff --git a/package.json b/package.json index 84c94a9a..f7a6c277 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iguazio.dashboard-react-controls", - "version": "2.2.4", + "version": "2.2.5", "description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.", "main": "dist/index.js", "module": "dist/index.js",