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.
- package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.js +1 -0
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +1 -1
- package/dist/components/FormChipCell/NewChipForm/newChipForm.scss +4 -0
- package/dist/hooks/useChipCell.hook.js +1 -0
- package/dist/hooks/useDebounce.hook.js +22 -20
- package/dist/utils/validation.util.js +2 -1
- package/package.json +1 -1
|
@@ -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 &&
|
|
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;
|
|
@@ -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 = () =>
|
|
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
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
timeout.current
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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 =
|
|
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.
|
|
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",
|