iguazio.dashboard-react-controls 2.1.5 → 2.1.6

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.
@@ -61,6 +61,7 @@ const HiddenChipsBlock = /*#__PURE__*/_react.default.forwardRef((_ref, _ref2) =>
61
61
  return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
62
62
  ref: hiddenChipsPopUpRef,
63
63
  className: hiddenChipsBlockClassNames,
64
+ onClick: event => event.stopPropagation(),
64
65
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
65
66
  className: "chip-block-hidden__scrollable-container",
66
67
  children: chips === null || chips === void 0 ? void 0 : chips.map(element => {
@@ -85,7 +85,7 @@ const NewChipForm = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
85
85
  const labelKeyClassName = (0, _classnames.default)(className, !editConfig.isKeyFocused && 'item_edited', !(0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', chipIndex, 'key'], [])) && !(0, _lodash.isEmpty)(chipData.key) && !chip.disabled && 'item_edited_invalid');
86
86
  const labelContainerClassName = (0, _classnames.default)('edit-chip-container', background && "edit-chip-container-background_".concat(background), borderColor && "edit-chip-container-border_".concat(borderColor), font && "edit-chip-container-font_".concat(font), density && "edit-chip-container-density_".concat(density), borderRadius && "edit-chip-container-border_".concat(borderRadius), (editConfig.isEdit || editConfig.isNewChip) && 'edit-chip-container_edited', chip.disabled && 'edit-chip-container_disabled edit-chip-container-font_disabled');
87
87
  const labelValueClassName = (0, _classnames.default)('input-label-value', !editConfig.isValueFocused && 'item_edited', !(0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', chipIndex, 'value'], [])) && !(0, _lodash.isEmpty)(chipData.value) && 'item_edited_invalid');
88
- const closeButtonClass = (0, _classnames.default)('item-icon-close', !chip.disabled && (editConfig.chipIndex === chipIndex || !isEditable) && 'item-icon-close_hidden');
88
+ const closeButtonClass = (0, _classnames.default)('item-icon-close', !chip.disabled && editConfig.chipIndex === chipIndex && isEditable && 'item-icon-close_invisible', !isEditable && 'item-icon-close_hidden');
89
89
  (0, _react.useLayoutEffect)(() => {
90
90
  if (!chipData.keyFieldWidth && !chipData.valueFieldWidth) {
91
91
  const currentWidthKeyInput = refInputKey.current.scrollWidth + 1;
@@ -58,6 +58,10 @@
58
58
  justify-content: center;
59
59
 
60
60
  &_hidden {
61
+ display: none;
62
+ }
63
+
64
+ &_invisible {
61
65
  visibility: hidden;
62
66
  }
63
67
 
@@ -47,6 +47,7 @@ const useChipCell = (isEditMode, visibleChipsMaxLength) => {
47
47
  setShowHiddenChips(true);
48
48
  }
49
49
  }
50
+ event && event.stopPropagation();
50
51
  }, [isEditMode, visibleChipsMaxLength]);
51
52
  (0, _react.useEffect)(() => {
52
53
  if (showHiddenChips) {
@@ -22,29 +22,31 @@ under the Apache 2.0 license is conditioned upon your compliance with
22
22
  such restriction.
23
23
  */
24
24
 
25
- const useDebounce = () => (validate, time) => {
25
+ const useDebounce = () => {
26
26
  const timeout = (0, _react.useRef)(null);
27
27
  const lastValue = (0, _react.useRef)(null);
28
28
  const lastResult = (0, _react.useRef)(null);
29
- return function (value) {
30
- return new Promise(resolve => {
31
- if (timeout.current) {
32
- timeout.current();
33
- }
34
- if (value !== lastValue.current) {
35
- const timerId = setTimeout(() => {
36
- lastValue.current = value;
37
- lastResult.current = validate(value);
29
+ return (0, _react.useCallback)((validate, time) => {
30
+ return value => {
31
+ return new Promise(resolve => {
32
+ if (timeout.current) {
33
+ timeout.current();
34
+ }
35
+ if (value !== lastValue.current) {
36
+ const timerId = setTimeout(() => {
37
+ lastValue.current = value;
38
+ lastResult.current = validate(value);
39
+ resolve(lastResult.current);
40
+ }, time);
41
+ timeout.current = () => {
42
+ clearTimeout(timerId);
43
+ resolve(true);
44
+ };
45
+ } else {
38
46
  resolve(lastResult.current);
39
- }, time);
40
- timeout.current = () => {
41
- clearTimeout(timerId);
42
- resolve(true);
43
- };
44
- } else {
45
- resolve(lastResult.current);
46
- }
47
- });
48
- };
47
+ }
48
+ });
49
+ };
50
+ }, []);
49
51
  };
50
52
  exports.useDebounce = useDebounce;
@@ -380,7 +380,8 @@ const getValidationRules = (type, additionalRules) => {
380
380
  * @returns {Object} The rule that checks if a value is not in the internal labels.
381
381
  */
382
382
  exports.getValidationRules = getValidationRules;
383
- const getInternalLabelsValidationRule = internalLabels => {
383
+ const getInternalLabelsValidationRule = function () {
384
+ let internalLabels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
384
385
  return {
385
386
  name: 'customLabels',
386
387
  label: 'System-defined labels cannot be modified.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-react-controls",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",