iguazio.dashboard-react-controls 2.2.19 → 2.2.21
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/components/Backdrop/Backdrop.js +1 -1
- package/dist/components/Button/Button.js +4 -6
- package/dist/components/ConfirmDialog/ConfirmDialog.js +1 -1
- package/dist/components/FormCheckBox/FormCheckBox.js +4 -5
- package/dist/components/FormChipCell/FormChip/FormChip.js +1 -1
- package/dist/components/FormChipCell/FormChip/formChip.scss +6 -0
- package/dist/components/FormChipCell/FormChipCell.js +4 -5
- package/dist/components/FormChipCell/FormChipCellView.js +16 -11
- package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.js +5 -6
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +11 -18
- package/dist/components/FormChipCell/NewChipInput/NewChipInput.js +1 -1
- package/dist/components/FormChipCell/formChipCell.util.js +1 -2
- package/dist/components/FormCombobox/FormCombobox.js +12 -13
- package/dist/components/FormInput/FormInput.js +18 -21
- package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.js +1 -1
- package/dist/components/FormKeyValueTable/FormKeyValueTable.js +5 -6
- package/dist/components/FormOnChange/FormOnChange.js +1 -1
- package/dist/components/FormRadio/FormRadio.js +3 -3
- package/dist/components/FormSelect/FormSelect.js +11 -12
- package/dist/components/FormSelect/FormSelect.test.js +6 -6
- package/dist/components/FormTextarea/FormTextarea.js +4 -5
- package/dist/components/FormToggle/FormToggle.js +4 -4
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/PopUpDialog/PopUpDialog.js +8 -10
- package/dist/components/RoundedIcon/RoundedIcon.js +1 -1
- package/dist/components/Tip/Tip.js +6 -6
- package/dist/components/Tip/Tip.test.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +9 -11
- package/dist/components/TooltipTemplate/ProducerTooltipTemplate.js +1 -1
- package/dist/components/TooltipTemplate/TextTooltipTemplate.js +1 -1
- package/dist/components/Wizard/Wizard.js +5 -5
- package/dist/components/Wizard/WizardSteps/WizardSteps.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/elements/FormActionButton/FormActionButton.js +2 -2
- package/dist/elements/FormRowActions/FormRowActions.js +5 -6
- package/dist/elements/OptionsMenu/OptionsMenu.js +2 -2
- package/dist/elements/SelectOption/SelectOption.js +4 -5
- package/dist/elements/SelectOption/SelectOption.test.js +5 -5
- package/dist/elements/ValidationTemplate/ValidationTemplate.js +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/hooks/useChipCell.hook.js +6 -10
- package/dist/hooks/useFormTable.hook.js +25 -40
- package/dist/hooks/useHiddenChipsBlock.hook.js +9 -9
- package/dist/types.js +1 -1
- package/dist/utils/generateChipsList.util.js +1 -1
- package/dist/utils/validation.util.js +6 -6
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ var _lodash = require("lodash");
|
|
|
13
13
|
var _common = require("../../utils/common.util");
|
|
14
14
|
require("./tooltip.scss");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
function _interopRequireDefault(
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
19
|
/*
|
|
@@ -60,26 +60,24 @@ const Tooltip = _ref => {
|
|
|
60
60
|
}, [hidden]);
|
|
61
61
|
const handleMouseEnter = (0, _react.useCallback)(event => {
|
|
62
62
|
if (!show) {
|
|
63
|
-
var _child$childNodes, _child$childNodes2;
|
|
64
63
|
const [child] = parentRef.current.childNodes;
|
|
65
|
-
let show = !hidden && (textShow ? true : !child ? false : child.nodeType !== Node.TEXT_NODE &&
|
|
64
|
+
let show = !hidden && (textShow ? true : !child ? false : child.nodeType !== Node.TEXT_NODE && child.childNodes?.[0]?.nodeType !== Node.TEXT_NODE || (
|
|
66
65
|
/*
|
|
67
66
|
If the child node is a text node and the text of the child node inside the container is greater than the width of the container, then show tooltip.
|
|
68
67
|
*/
|
|
69
|
-
(child.nodeType === Node.TEXT_NODE ||
|
|
68
|
+
(child.nodeType === Node.TEXT_NODE || child.childNodes?.[0]?.nodeType === Node.TEXT_NODE) && parentRef.current.scrollWidth > parentRef.current.offsetWidth));
|
|
70
69
|
setShow(show);
|
|
71
70
|
setTimeout(() => {
|
|
72
71
|
if (show) {
|
|
73
|
-
var _parentRef$current$ge, _parentRef$current, _tooltipRef$current$g, _tooltipRef$current;
|
|
74
72
|
let {
|
|
75
73
|
height,
|
|
76
74
|
top,
|
|
77
75
|
bottom
|
|
78
|
-
} =
|
|
76
|
+
} = parentRef?.current?.getBoundingClientRect() ?? {};
|
|
79
77
|
const {
|
|
80
78
|
height: tooltipHeight,
|
|
81
79
|
width: tooltipWidth
|
|
82
|
-
} =
|
|
80
|
+
} = tooltipRef.current?.getBoundingClientRect() ?? {
|
|
83
81
|
height: 0,
|
|
84
82
|
width: 0
|
|
85
83
|
};
|
|
@@ -140,7 +138,7 @@ const Tooltip = _ref => {
|
|
|
140
138
|
}, [clearStyles, style]);
|
|
141
139
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
142
140
|
children: [renderChildAsHtml ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
143
|
-
"data-testid": id ?
|
|
141
|
+
"data-testid": id ? `${id}-tooltip-wrapper` : 'tooltip-wrapper',
|
|
144
142
|
ref: parentRef,
|
|
145
143
|
className: tooltipClassNames,
|
|
146
144
|
dangerouslySetInnerHTML: {
|
|
@@ -148,19 +146,19 @@ const Tooltip = _ref => {
|
|
|
148
146
|
},
|
|
149
147
|
onClick: handleMouseLeave
|
|
150
148
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
151
|
-
"data-testid": id ?
|
|
149
|
+
"data-testid": id ? `${id}-tooltip-wrapper` : 'tooltip-wrapper',
|
|
152
150
|
ref: parentRef,
|
|
153
151
|
className: tooltipClassNames,
|
|
154
152
|
onClick: handleMouseLeave,
|
|
155
153
|
children: children
|
|
156
|
-
}), !hidden && /*#__PURE__*/(0, _reactDom.createPortal)(
|
|
154
|
+
}), !hidden && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
157
155
|
classNames: "fade",
|
|
158
156
|
in: show,
|
|
159
157
|
timeout: duration,
|
|
160
158
|
unmountOnExit: true,
|
|
161
159
|
nodeRef: tooltipRef,
|
|
162
160
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
163
|
-
"data-testid": id ?
|
|
161
|
+
"data-testid": id ? `${id}-tooltip` : 'tooltip',
|
|
164
162
|
ref: tooltipRef,
|
|
165
163
|
style: {
|
|
166
164
|
...style
|
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
require("./producerTooltipTemplate.scss");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
/*
|
|
13
13
|
Copyright 2022 Iguazio Systems Ltd.
|
|
14
14
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
require("./textTooltipTemplate.scss");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
/*
|
|
@@ -16,7 +16,7 @@ var _types = require("../../types");
|
|
|
16
16
|
var _backArrow = require("../../images/back-arrow.svg");
|
|
17
17
|
require("./Wizard.scss");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
function _interopRequireDefault(
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
22
|
/*
|
|
@@ -55,7 +55,7 @@ const Wizard = _ref => {
|
|
|
55
55
|
const [activeStepNumber, setActiveStepNumber] = (0, _react.useState)(0);
|
|
56
56
|
const [firstDisabledStepIdx, setFirstDisabledStepIdx] = (0, _react.useState)(null);
|
|
57
57
|
const visibleSteps = (0, _react.useMemo)(() => {
|
|
58
|
-
return
|
|
58
|
+
return stepsConfig?.filter(step => !step.hidden) || [];
|
|
59
59
|
}, [stepsConfig]);
|
|
60
60
|
(0, _react.useLayoutEffect)(() => {
|
|
61
61
|
const disabledStep = visibleSteps.find((step, stepIdx) => {
|
|
@@ -106,7 +106,7 @@ const Wizard = _ref => {
|
|
|
106
106
|
const getDefaultActions = stepConfig => {
|
|
107
107
|
const defaultActions = [];
|
|
108
108
|
if (activeStepNumber !== 0) {
|
|
109
|
-
defaultActions.push(
|
|
109
|
+
defaultActions.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
110
110
|
id: "wizard-btn-back",
|
|
111
111
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_backArrow.ReactComponent, {}),
|
|
112
112
|
className: "wizard-form__back-button",
|
|
@@ -117,12 +117,12 @@ const Wizard = _ref => {
|
|
|
117
117
|
variant: _constants.TERTIARY_BUTTON
|
|
118
118
|
}));
|
|
119
119
|
}
|
|
120
|
-
defaultActions.push(
|
|
120
|
+
defaultActions.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
121
121
|
id: "wizard-btn-next",
|
|
122
122
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_backArrow.ReactComponent, {}),
|
|
123
123
|
iconPosition: "right",
|
|
124
124
|
className: "wizard-form__next-button",
|
|
125
|
-
disabled:
|
|
125
|
+
disabled: stepConfig?.nextIsDisabled || isLastStep,
|
|
126
126
|
onClick: goToNextStep,
|
|
127
127
|
label: "Next",
|
|
128
128
|
type: "button",
|
|
@@ -12,7 +12,7 @@ var _Button = _interopRequireDefault(require("../../Button/Button"));
|
|
|
12
12
|
var _types = require("../../../types");
|
|
13
13
|
require("./WizardSteps.scss");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
/*
|
|
17
17
|
Copyright 2022 Iguazio Systems Ltd.
|
|
18
18
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
package/dist/components/index.js
CHANGED
|
@@ -136,4 +136,4 @@ var _TextTooltipTemplate = _interopRequireDefault(require("./TooltipTemplate/Tex
|
|
|
136
136
|
var _Tip = _interopRequireDefault(require("./Tip/Tip"));
|
|
137
137
|
var _Tooltip = _interopRequireDefault(require("./Tooltip/Tooltip"));
|
|
138
138
|
var _Wizard = _interopRequireDefault(require("./Wizard/Wizard"));
|
|
139
|
-
function _interopRequireDefault(
|
|
139
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _plus = require("../../images/plus.svg");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
/*
|
|
13
13
|
Copyright 2019 Iguazio Systems Ltd.
|
|
14
14
|
|
|
@@ -43,7 +43,7 @@ const FormActionButton = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
43
43
|
children: [!hidden && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
44
44
|
className: "form-table__row form-table__action-row no-hover",
|
|
45
45
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
46
|
-
"data-testid": id ? id :
|
|
46
|
+
"data-testid": id ? id : `${fieldsPath}-add-btn`,
|
|
47
47
|
onClick: event => onClick(event, fields, fieldsPath),
|
|
48
48
|
disabled: disabled,
|
|
49
49
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_plus.ReactComponent, {}), label]
|
|
@@ -13,7 +13,7 @@ var _edit = require("../../images/edit.svg");
|
|
|
13
13
|
var _delete = require("../../images/delete.svg");
|
|
14
14
|
var _checkmark = require("../../images/checkmark2.svg");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
function _interopRequireDefault(
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
/*
|
|
18
18
|
Copyright 2019 Iguazio Systems Ltd.
|
|
19
19
|
|
|
@@ -35,7 +35,6 @@ such restriction.
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
const FormRowActions = _ref => {
|
|
38
|
-
var _editingItem$ui, _editingItem$ui2, _editingItem$ui3, _editingItem$ui4;
|
|
39
38
|
let {
|
|
40
39
|
applyChanges,
|
|
41
40
|
deleteButtonIsHidden = false,
|
|
@@ -51,7 +50,7 @@ const FormRowActions = _ref => {
|
|
|
51
50
|
className: "form-table__cell form-table__actions-cell"
|
|
52
51
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
53
52
|
className: "form-table__cell form-table__actions-cell",
|
|
54
|
-
children: [
|
|
53
|
+
children: [editingItem?.ui?.index === index && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
55
54
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
|
|
56
55
|
id: "apply-btn",
|
|
57
56
|
onClick: event => applyChanges(event, index),
|
|
@@ -61,11 +60,11 @@ const FormRowActions = _ref => {
|
|
|
61
60
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
|
|
62
61
|
id: "delete-discard-btn",
|
|
63
62
|
onClick: event => discardOrDelete(event, fieldsPath, index),
|
|
64
|
-
tooltipText:
|
|
63
|
+
tooltipText: editingItem.ui?.isNew ? 'Delete' : 'Discard changes',
|
|
65
64
|
disabled: disabled,
|
|
66
|
-
children:
|
|
65
|
+
children: editingItem.ui?.isNew ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.ReactComponent, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_close.ReactComponent, {})
|
|
67
66
|
})]
|
|
68
|
-
}), (!editingItem ||
|
|
67
|
+
}), (!editingItem || editingItem?.ui?.index !== index) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
69
68
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
|
|
70
69
|
id: "edit-btn",
|
|
71
70
|
onClick: event => {
|
|
@@ -10,7 +10,7 @@ var _reactTransitionGroup = require("react-transition-group");
|
|
|
10
10
|
var _components = require("../../components");
|
|
11
11
|
require("./optionsMenu.scss");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
/*
|
|
15
15
|
Copyright 2022 Iguazio Systems Ltd.
|
|
16
16
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -52,7 +52,7 @@ const OptionsMenu = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
52
52
|
autoHorizontalPosition: true
|
|
53
53
|
},
|
|
54
54
|
style: {
|
|
55
|
-
minWidth:
|
|
55
|
+
minWidth: `${dropdownWidth}px`
|
|
56
56
|
},
|
|
57
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
58
58
|
className: "options-menu__body",
|
|
@@ -12,7 +12,7 @@ var _types = require("../../types");
|
|
|
12
12
|
var _checkmark = require("../../images/checkmark.svg");
|
|
13
13
|
require("./selectOption.scss");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
/*
|
|
17
17
|
Copyright 2022 Iguazio Systems Ltd.
|
|
18
18
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -31,7 +31,6 @@ such restriction.
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
const SelectOption = _ref => {
|
|
34
|
-
var _item$labelHtml;
|
|
35
34
|
let {
|
|
36
35
|
item,
|
|
37
36
|
name,
|
|
@@ -51,7 +50,7 @@ const SelectOption = _ref => {
|
|
|
51
50
|
label: item.label,
|
|
52
51
|
disabled: item.disabled || false,
|
|
53
52
|
children: item.status && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
54
|
-
className:
|
|
53
|
+
className: `state-${item.status}-job status`
|
|
55
54
|
})
|
|
56
55
|
})
|
|
57
56
|
});
|
|
@@ -74,9 +73,9 @@ const SelectOption = _ref => {
|
|
|
74
73
|
className: "select__item-icon",
|
|
75
74
|
children: item.icon
|
|
76
75
|
}), item.status && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
77
|
-
className:
|
|
76
|
+
className: `state-${item.status}-job status`
|
|
78
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
79
|
-
renderChildAsHtml:
|
|
78
|
+
renderChildAsHtml: item.labelHtml?.length > 0,
|
|
80
79
|
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
81
80
|
text: item.label
|
|
82
81
|
}),
|
|
@@ -4,7 +4,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
4
4
|
var _react2 = require("@testing-library/react");
|
|
5
5
|
var _SelectOption = _interopRequireDefault(require("./SelectOption"));
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
function _interopRequireDefault(
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
/*
|
|
9
9
|
Copyright 2022 Iguazio Systems Ltd.
|
|
10
10
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -22,7 +22,7 @@ under the Apache 2.0 license is conditioned upon your compliance with
|
|
|
22
22
|
such restriction.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const renderComponent = props => (0, _react2.render)(
|
|
25
|
+
const renderComponent = props => (0, _react2.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
26
26
|
...props
|
|
27
27
|
}));
|
|
28
28
|
jest.mock('../../images/checkbox-unchecked.svg', () => ({
|
|
@@ -52,7 +52,7 @@ describe('SelectOption component', () => {
|
|
|
52
52
|
expect(wrapper.queryByTestId('select-option')).not.toBeNull();
|
|
53
53
|
});
|
|
54
54
|
it('should display checkbox inside option if props selectType is "checkbox"', () => {
|
|
55
|
-
wrapper.rerender(
|
|
55
|
+
wrapper.rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
56
56
|
item: {
|
|
57
57
|
label: 'Test1',
|
|
58
58
|
id: 'test1'
|
|
@@ -67,7 +67,7 @@ describe('SelectOption component', () => {
|
|
|
67
67
|
});
|
|
68
68
|
it('should won\'t call onClick callback if props disable set to "true"', () => {
|
|
69
69
|
const mockCLick = jest.fn();
|
|
70
|
-
wrapper.rerender(
|
|
70
|
+
wrapper.rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
71
71
|
item: {
|
|
72
72
|
label: 'Test1',
|
|
73
73
|
id: 'test1'
|
|
@@ -84,7 +84,7 @@ describe('SelectOption component', () => {
|
|
|
84
84
|
expect(wrapper.queryByTestId('tooltip-wrapper')).not.toBeNull();
|
|
85
85
|
});
|
|
86
86
|
it('should add class "disabled" to SelectOption if props disabled set to "true"', () => {
|
|
87
|
-
wrapper.rerender(
|
|
87
|
+
wrapper.rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOption.default, {
|
|
88
88
|
item: {
|
|
89
89
|
label: 'Test1',
|
|
90
90
|
id: 'test1'
|
|
@@ -11,7 +11,7 @@ var _success_done = require("../../images/success_done.svg");
|
|
|
11
11
|
var _close = require("../../images/close.svg");
|
|
12
12
|
require("./ValidationTemplate.scss");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
/*
|
|
16
16
|
Copyright 2022 Iguazio Systems Ltd.
|
|
17
17
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
package/dist/elements/index.js
CHANGED
|
@@ -38,4 +38,4 @@ var _FormRowActions = _interopRequireDefault(require("./FormRowActions/FormRowAc
|
|
|
38
38
|
var _OptionsMenu = _interopRequireDefault(require("./OptionsMenu/OptionsMenu"));
|
|
39
39
|
var _SelectOption = _interopRequireDefault(require("./SelectOption/SelectOption"));
|
|
40
40
|
var _ValidationTemplate = _interopRequireDefault(require("./ValidationTemplate/ValidationTemplate"));
|
|
41
|
-
function _interopRequireDefault(
|
|
41
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -39,16 +39,14 @@ const useChipCell = (isEditMode, visibleChipsMaxLength) => {
|
|
|
39
39
|
const hiddenChipsCounterRef = (0, _react.useRef)();
|
|
40
40
|
const hiddenChipsPopUpRef = (0, _react.useRef)();
|
|
41
41
|
const handleShowElements = (0, _react.useCallback)(event => {
|
|
42
|
-
var _hiddenChipsCounterRe2;
|
|
43
42
|
if (!isEditMode || isEditMode && visibleChipsMaxLength) {
|
|
44
|
-
|
|
45
|
-
if ((_hiddenChipsCounterRe = hiddenChipsCounterRef.current) !== null && _hiddenChipsCounterRe !== void 0 && _hiddenChipsCounterRe.contains(event.target) && !showHiddenChips) {
|
|
43
|
+
if (hiddenChipsCounterRef.current?.contains(event.target) && !showHiddenChips) {
|
|
46
44
|
setShowHiddenChips(true);
|
|
47
45
|
} else {
|
|
48
46
|
setShowHiddenChips(false);
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
|
-
event &&
|
|
49
|
+
event && hiddenChipsCounterRef.current?.contains(event.target) && event.stopPropagation();
|
|
52
50
|
}, [isEditMode, showHiddenChips, visibleChipsMaxLength]);
|
|
53
51
|
(0, _react.useEffect)(() => {
|
|
54
52
|
if (showHiddenChips) {
|
|
@@ -57,7 +55,7 @@ const useChipCell = (isEditMode, visibleChipsMaxLength) => {
|
|
|
57
55
|
return () => window.removeEventListener('click', handleShowElements, true);
|
|
58
56
|
}, [showHiddenChips, handleShowElements]);
|
|
59
57
|
const handleScroll = (0, _react.useCallback)(event => {
|
|
60
|
-
if (event.target.parentElement !==
|
|
58
|
+
if (event.target.parentElement !== hiddenChipsPopUpRef?.current) {
|
|
61
59
|
setShowHiddenChips(false);
|
|
62
60
|
}
|
|
63
61
|
}, [hiddenChipsPopUpRef]);
|
|
@@ -68,11 +66,10 @@ const useChipCell = (isEditMode, visibleChipsMaxLength) => {
|
|
|
68
66
|
return () => window.removeEventListener('scroll', handleScroll, true);
|
|
69
67
|
}, [handleScroll, showHiddenChips]);
|
|
70
68
|
const resizeChipCell = (0, _react.useCallback)(() => {
|
|
71
|
-
if (hiddenChipsPopUpRef
|
|
72
|
-
var _hiddenChipsCounterRe3;
|
|
69
|
+
if (hiddenChipsPopUpRef?.current) {
|
|
73
70
|
const scrollableParent = (0, _getFirstScrollableParent.getFirstScrollableParent)(hiddenChipsCounterRef.current.offsetParent);
|
|
74
71
|
const scrollableParentRect = scrollableParent.getBoundingClientRect();
|
|
75
|
-
const hiddenChipsCounterRect =
|
|
72
|
+
const hiddenChipsCounterRect = hiddenChipsCounterRef.current?.getBoundingClientRect();
|
|
76
73
|
|
|
77
74
|
// Check if the hiddenChipsCounterRect is outside the boundaries of the scrollableParentRect or the window
|
|
78
75
|
if (hiddenChipsCounterRect.left < scrollableParentRect.left || hiddenChipsCounterRect.top < scrollableParentRect.top || hiddenChipsCounterRect.right > scrollableParentRect.right || hiddenChipsCounterRect.bottom > scrollableParentRect.bottom || hiddenChipsCounterRect.right > window.innerWidth || hiddenChipsCounterRect.bottom > window.innerHeight) {
|
|
@@ -80,8 +77,7 @@ const useChipCell = (isEditMode, visibleChipsMaxLength) => {
|
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
if (!isEditMode && !(0, _common.isEveryObjectValueEmpty)(chipsSizes)) {
|
|
83
|
-
|
|
84
|
-
const parentSize = (_chipsCellRef$current = chipsCellRef.current) === null || _chipsCellRef$current === void 0 ? void 0 : _chipsCellRef$current.getBoundingClientRect().width;
|
|
80
|
+
const parentSize = chipsCellRef.current?.getBoundingClientRect().width;
|
|
85
81
|
let maxLength = 0;
|
|
86
82
|
let chipIndex = 0;
|
|
87
83
|
const padding = 65;
|
|
@@ -52,9 +52,9 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
52
52
|
const bottomScrollRef = (0, _react.useRef)(null);
|
|
53
53
|
const onExitEditModeCallbackRef = (0, _react.useRef)(onExitEditModeCallback);
|
|
54
54
|
(0, _react.useLayoutEffect)(() => {
|
|
55
|
-
const tableErrors = (0, _lodash.get)(formState
|
|
56
|
-
editingItemErrorsRef.current = (0, _lodash.get)(tableErrors, editingItem
|
|
57
|
-
}, [editingItem
|
|
55
|
+
const tableErrors = (0, _lodash.get)(formState?.errors, editingItem?.ui.fieldsPath, []);
|
|
56
|
+
editingItemErrorsRef.current = (0, _lodash.get)(tableErrors, editingItem?.ui.index, null);
|
|
57
|
+
}, [editingItem?.ui.fieldsPath, editingItem?.ui.index, formState?.errors]);
|
|
58
58
|
(0, _react.useLayoutEffect)(() => {
|
|
59
59
|
formStateRef.current = formState;
|
|
60
60
|
}, [formState]);
|
|
@@ -62,41 +62,33 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
62
62
|
onExitEditModeCallbackRef.current = onExitEditModeCallback;
|
|
63
63
|
}, [onExitEditModeCallback]);
|
|
64
64
|
const exitEditMode = () => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var _editingItemRef$curre2;
|
|
68
|
-
Object.entries((_editingItemRef$curre2 = editingItemRef.current) === null || _editingItemRef$curre2 === void 0 ? void 0 : _editingItemRef$curre2.data).forEach(_ref => {
|
|
69
|
-
var _formStateRef$current, _editingItemRef$curre3, _editingItemRef$curre4;
|
|
65
|
+
if (editingItemRef.current?.data) {
|
|
66
|
+
Object.entries(editingItemRef.current?.data).forEach(_ref => {
|
|
70
67
|
let [fieldName] = _ref;
|
|
71
|
-
|
|
68
|
+
formStateRef.current?.form.mutators.setFieldState(`${editingItemRef.current?.ui.fieldsPath}[${editingItemRef.current?.ui.index}].data.${fieldName}`, {
|
|
72
69
|
modified: false
|
|
73
70
|
});
|
|
74
71
|
});
|
|
75
72
|
}
|
|
76
73
|
editingItemRef.current = null;
|
|
77
74
|
setEditingItem(null);
|
|
78
|
-
|
|
75
|
+
onExitEditModeCallbackRef?.current && onExitEditModeCallbackRef.current();
|
|
79
76
|
};
|
|
80
77
|
(0, _react.useEffect)(() => {
|
|
81
78
|
const applyOrDiscardOrDeleteInEffect = () => {
|
|
82
|
-
if (editingItemRef
|
|
79
|
+
if (editingItemRef?.current) {
|
|
83
80
|
if (!editingItemErrorsRef.current) {
|
|
84
81
|
exitEditMode();
|
|
85
82
|
} else {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if ((values === null || values === void 0 ? void 0 : values.length) > 1) {
|
|
91
|
-
var _editingItemRef$curre7, _editingItemRef$curre8;
|
|
92
|
-
formStateRef.current.form.mutators.remove((_editingItemRef$curre7 = editingItemRef.current) === null || _editingItemRef$curre7 === void 0 ? void 0 : _editingItemRef$curre7.ui.fieldsPath, (_editingItemRef$curre8 = editingItemRef.current) === null || _editingItemRef$curre8 === void 0 ? void 0 : _editingItemRef$curre8.ui.index);
|
|
83
|
+
if (editingItemRef.current?.ui?.isNew) {
|
|
84
|
+
const values = (0, _lodash.get)(formStateRef.current.values, editingItemRef.current?.ui.fieldsPath);
|
|
85
|
+
if (values?.length > 1) {
|
|
86
|
+
formStateRef.current.form.mutators.remove(editingItemRef.current?.ui.fieldsPath, editingItemRef.current?.ui.index);
|
|
93
87
|
} else {
|
|
94
|
-
|
|
95
|
-
formStateRef.current.form.change((_editingItemRef$curre9 = editingItemRef.current) === null || _editingItemRef$curre9 === void 0 ? void 0 : _editingItemRef$curre9.ui.fieldsPath, []);
|
|
88
|
+
formStateRef.current.form.change(editingItemRef.current?.ui.fieldsPath, []);
|
|
96
89
|
}
|
|
97
90
|
} else {
|
|
98
|
-
|
|
99
|
-
formStateRef.current.form.mutators.update((_editingItemRef$curre10 = editingItemRef.current) === null || _editingItemRef$curre10 === void 0 ? void 0 : _editingItemRef$curre10.ui.fieldsPath, (_editingItemRef$curre11 = editingItemRef.current) === null || _editingItemRef$curre11 === void 0 ? void 0 : _editingItemRef$curre11.ui.index, (0, _lodash.omit)(editingItemRef.current, ['ui']));
|
|
91
|
+
formStateRef.current.form.mutators.update(editingItemRef.current?.ui.fieldsPath, editingItemRef.current?.ui.index, (0, _lodash.omit)(editingItemRef.current, ['ui']));
|
|
100
92
|
}
|
|
101
93
|
exitEditMode();
|
|
102
94
|
}
|
|
@@ -110,13 +102,12 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
110
102
|
applyOrDiscardOrDelete(event);
|
|
111
103
|
formStateRef.current.form.mutators.push(fieldsPath, newItem);
|
|
112
104
|
setEditingItem(() => {
|
|
113
|
-
var _fields$value;
|
|
114
105
|
const newEditingItem = {
|
|
115
106
|
...newItem,
|
|
116
107
|
ui: {
|
|
117
108
|
isNew: true,
|
|
118
109
|
fieldsPath,
|
|
119
|
-
index:
|
|
110
|
+
index: fields.value?.length || 0
|
|
120
111
|
}
|
|
121
112
|
};
|
|
122
113
|
editingItemRef.current = newEditingItem;
|
|
@@ -127,18 +118,15 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
127
118
|
const applyChanges = (event, index) => {
|
|
128
119
|
if (editingItemRef.current) {
|
|
129
120
|
if (!editingItemErrorsRef.current) {
|
|
130
|
-
|
|
131
|
-
if ((_editingItemRef$curre12 = editingItemRef.current) !== null && _editingItemRef$curre12 !== void 0 && _editingItemRef$curre12.ui.isNew) {
|
|
121
|
+
if (editingItemRef.current?.ui.isNew) {
|
|
132
122
|
scrollIntoView();
|
|
133
123
|
}
|
|
134
124
|
exitEditMode();
|
|
135
125
|
} else {
|
|
136
|
-
var _editingItemErrorsRef;
|
|
137
126
|
// Mark all empty fields as `modified` in order to highlight the error if the field is invalid
|
|
138
|
-
Object.entries(
|
|
139
|
-
var _formStateRef$current2, _editingItemRef$curre13;
|
|
127
|
+
Object.entries(editingItemErrorsRef.current?.data).forEach(_ref2 => {
|
|
140
128
|
let [fieldName] = _ref2;
|
|
141
|
-
|
|
129
|
+
formStateRef.current?.form.mutators.setFieldState(`${editingItemRef.current?.ui.fieldsPath}[${index}].data.${fieldName}`, {
|
|
142
130
|
modified: true
|
|
143
131
|
});
|
|
144
132
|
});
|
|
@@ -150,7 +138,7 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
150
138
|
applyOrDiscardOrDelete(event);
|
|
151
139
|
}
|
|
152
140
|
const values = (0, _lodash.get)(formStateRef.current.values, fieldsPath);
|
|
153
|
-
if (
|
|
141
|
+
if (values?.length > 1) {
|
|
154
142
|
formStateRef.current.form.mutators.remove(fieldsPath, index);
|
|
155
143
|
} else {
|
|
156
144
|
formStateRef.current.form.change(fieldsPath, []);
|
|
@@ -164,8 +152,7 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
164
152
|
event && event.stopPropagation();
|
|
165
153
|
};
|
|
166
154
|
const discardOrDelete = (event, fieldsPath, index) => {
|
|
167
|
-
|
|
168
|
-
if (!editingItemRef.current || (_editingItemRef$curre14 = editingItemRef.current) !== null && _editingItemRef$curre14 !== void 0 && (_editingItemRef$curre14 = _editingItemRef$curre14.ui) !== null && _editingItemRef$curre14 !== void 0 && _editingItemRef$curre14.isNew) {
|
|
155
|
+
if (!editingItemRef.current || editingItemRef.current?.ui?.isNew) {
|
|
169
156
|
deleteRow(event, fieldsPath, index);
|
|
170
157
|
} else {
|
|
171
158
|
discardChanges(event, fieldsPath, index);
|
|
@@ -173,13 +160,11 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
173
160
|
};
|
|
174
161
|
const applyOrDiscardOrDelete = function () {
|
|
175
162
|
let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
176
|
-
if (editingItemRef
|
|
163
|
+
if (editingItemRef?.current) {
|
|
177
164
|
if (!editingItemErrorsRef.current) {
|
|
178
|
-
|
|
179
|
-
applyChanges(event, (_editingItemRef$curre15 = editingItemRef.current) === null || _editingItemRef$curre15 === void 0 ? void 0 : _editingItemRef$curre15.ui.index);
|
|
165
|
+
applyChanges(event, editingItemRef.current?.ui.index);
|
|
180
166
|
} else {
|
|
181
|
-
|
|
182
|
-
discardOrDelete(event, (_editingItemRef$curre16 = editingItemRef.current) === null || _editingItemRef$curre16 === void 0 ? void 0 : _editingItemRef$curre16.ui.fieldsPath, (_editingItemRef$curre17 = editingItemRef.current) === null || _editingItemRef$curre17 === void 0 ? void 0 : _editingItemRef$curre17.ui.index);
|
|
167
|
+
discardOrDelete(event, editingItemRef.current?.ui.fieldsPath, editingItemRef.current?.ui.index);
|
|
183
168
|
}
|
|
184
169
|
}
|
|
185
170
|
};
|
|
@@ -211,11 +196,11 @@ const useFormTable = (formState, exitEditModeTriggerItem, onExitEditModeCallback
|
|
|
211
196
|
}
|
|
212
197
|
};
|
|
213
198
|
const isCurrentRowEditing = rowPath => {
|
|
214
|
-
return
|
|
199
|
+
return editingItemRef?.current && `${editingItemRef.current.ui.fieldsPath}[${editingItemRef.current.ui.index}]` === rowPath;
|
|
215
200
|
};
|
|
216
201
|
const getTableArrayErrors = fieldsPath => {
|
|
217
202
|
if (formState.submitFailed && formState.invalid) {
|
|
218
|
-
return (0, _lodash.get)(formState,
|
|
203
|
+
return (0, _lodash.get)(formState, `errors.${fieldsPath}.${_finalForm.ARRAY_ERROR}`, []);
|
|
219
204
|
} else {
|
|
220
205
|
return [];
|
|
221
206
|
}
|
|
@@ -7,7 +7,7 @@ exports.useHiddenChipsBlock = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _common = require("../utils/common.util");
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
/*
|
|
12
12
|
Copyright 2019 Iguazio Systems Ltd.
|
|
13
13
|
|
|
@@ -35,7 +35,7 @@ const useHiddenChipsBlock = (hiddenChipsCounterRef, hiddenChipsPopUpRef) => {
|
|
|
35
35
|
const transitionEndEventName = (0, _react.useMemo)(() => (0, _common.getTransitionEndEventName)(), []);
|
|
36
36
|
const hiddenChipsBlockClassNames = (0, _classnames.default)('chip-block-hidden', isTop ? 'chip-block-hidden_top' : 'chip-block-hidden_bottom', isLeft ? 'chip-block-hidden_left' : 'chip-block-hidden_right', isVisible && 'chip-block-hidden_visible');
|
|
37
37
|
const resizePopUp = (0, _react.useCallback)(() => {
|
|
38
|
-
if (hiddenChipsPopUpRef
|
|
38
|
+
if (hiddenChipsPopUpRef?.current && hiddenChipsCounterRef?.current) {
|
|
39
39
|
const offset = 10;
|
|
40
40
|
const offsetMargin = 20;
|
|
41
41
|
const elementRect = hiddenChipsCounterRef.current.getBoundingClientRect();
|
|
@@ -59,10 +59,10 @@ const useHiddenChipsBlock = (hiddenChipsCounterRef, hiddenChipsPopUpRef) => {
|
|
|
59
59
|
// Compare elementRect.left and elementRectRight to choose the larger value as the max width
|
|
60
60
|
isLeftPosition = elementRect.left > elementRectRight;
|
|
61
61
|
const popUpMaxWidth = Math.max(elementRect.left, elementRectRight);
|
|
62
|
-
hiddenChipsPopUpRef.current.style.maxWidth =
|
|
62
|
+
hiddenChipsPopUpRef.current.style.maxWidth = `${popUpMaxWidth}px`;
|
|
63
63
|
}
|
|
64
|
-
hiddenChipsPopUpRef.current.style.right = isLeftPosition ?
|
|
65
|
-
hiddenChipsPopUpRef.current.style.left = isLeftPosition ? 'unset' :
|
|
64
|
+
hiddenChipsPopUpRef.current.style.right = isLeftPosition ? `${elementRectRight}px` : 'unset';
|
|
65
|
+
hiddenChipsPopUpRef.current.style.left = isLeftPosition ? 'unset' : `${elementRect.left}px`;
|
|
66
66
|
|
|
67
67
|
// Determine if the top position is preferred based on the element's position and available height
|
|
68
68
|
if (elementRect.top > hiddenChipsPopUpRef.current.clientHeight + offset + offsetMargin) {
|
|
@@ -73,17 +73,17 @@ const useHiddenChipsBlock = (hiddenChipsCounterRef, hiddenChipsPopUpRef) => {
|
|
|
73
73
|
// Compare elementRect.top and elementRectBottom to choose the larger value as the max height
|
|
74
74
|
isTopPosition = elementRect.top > elementRectBottom + offset;
|
|
75
75
|
const popUpMaxHeight = Math.max(elementRect.top, elementRectBottom) - offset - offsetMargin;
|
|
76
|
-
hiddenChipsPopUpRef.current.style.maxHeight =
|
|
76
|
+
hiddenChipsPopUpRef.current.style.maxHeight = `${popUpMaxHeight}px`;
|
|
77
77
|
}
|
|
78
|
-
hiddenChipsPopUpRef.current.style.bottom = isTopPosition ?
|
|
79
|
-
hiddenChipsPopUpRef.current.style.top = isTopPosition ? 'unset' :
|
|
78
|
+
hiddenChipsPopUpRef.current.style.bottom = isTopPosition ? `${elementRectBottom + elementRect.height + offset}px` : 'unset';
|
|
79
|
+
hiddenChipsPopUpRef.current.style.top = isTopPosition ? 'unset' : `${elementRect.bottom + offset}px`;
|
|
80
80
|
setIsTop(isTopPosition);
|
|
81
81
|
setIsLeft(isLeftPosition);
|
|
82
82
|
setIsVisible(true);
|
|
83
83
|
}
|
|
84
84
|
}, [hiddenChipsCounterRef, hiddenChipsPopUpRef]);
|
|
85
85
|
(0, _react.useEffect)(() => {
|
|
86
|
-
if (hiddenChipsPopUpRef
|
|
86
|
+
if (hiddenChipsPopUpRef?.current && hiddenChipsCounterRef?.current) {
|
|
87
87
|
window.addEventListener('resize', resizePopUp);
|
|
88
88
|
window.addEventListener(transitionEndEventName, resizePopUp);
|
|
89
89
|
return () => {
|
package/dist/types.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.WIZARD_STEPS_CONFIG = exports.SORT_PROPS = exports.SELECT_OPTIONS = exports.SELECT_OPTION = exports.POP_UP_CUSTOM_POSITION = exports.MODAL_SIZES = exports.INPUT_VALIDATION_RULES = exports.INPUT_LINK = exports.FORM_TABLE_EDITING_ITEM = exports.EXCLUDE_SORT_BY = exports.DEFAULT_SORT_BY = exports.CONFIRM_DIALOG_SUBMIT_BUTTON = exports.CONFIRM_DIALOG_MESSAGE = exports.CONFIRM_DIALOG_CANCEL_BUTTON = exports.COMBOBOX_VALIDATION_RULES = exports.COMBOBOX_SUGGESTION_LIST = exports.COMBOBOX_SELECT_OPTIONS = exports.CHIP_OPTIONS = exports.CHIP_INPUT_LIST = exports.CHIPS = exports.CHIP = exports.BUTTON_VARIANTS = exports.ALLOW_SORT_BY = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _constants = require("./constants");
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
/*
|
|
11
11
|
Copyright 2022 Iguazio Systems Ltd.
|
|
12
12
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -22,7 +22,7 @@ such restriction.
|
|
|
22
22
|
*/
|
|
23
23
|
const generateChipsList = (chips, maxLength) => {
|
|
24
24
|
if (chips.length > maxLength) {
|
|
25
|
-
let hiddenChipsNumber =
|
|
25
|
+
let hiddenChipsNumber = `+ ${chips.length - maxLength}`;
|
|
26
26
|
const hiddenChips = chips.slice(maxLength);
|
|
27
27
|
const visibleChips = chips.slice(0, maxLength);
|
|
28
28
|
return {
|