iguazio.dashboard-react-controls 0.0.39 → 1.2.0
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 +4 -11
- package/dist/components/Button/Button.js +25 -28
- package/dist/components/ConfirmDialog/ConfirmDialog.js +10 -24
- package/dist/components/FormCheckBox/FormCheckBox.js +25 -25
- package/dist/components/FormChipCell/FormChip/FormChip.js +33 -33
- package/dist/components/FormChipCell/FormChipCell.js +66 -109
- package/dist/components/FormChipCell/FormChipCellView.js +19 -37
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +58 -90
- package/dist/components/FormChipCell/NewChipInput/NewChipInput.js +24 -22
- package/dist/components/FormChipCell/formChipCell.util.js +0 -1
- package/dist/components/FormCombobox/FormCombobox.js +82 -140
- package/dist/components/FormInput/FormInput.js +110 -175
- package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.js +6 -21
- package/dist/components/FormKeyValueTable/FormKeyValueTable.js +23 -39
- package/dist/components/FormRadio/FormRadio.js +23 -22
- package/dist/components/FormSelect/FormSelect.js +56 -92
- package/dist/components/FormSelect/FormSelect.test.js +19 -35
- package/dist/components/FormTextarea/FormTextarea.js +44 -69
- package/dist/components/Modal/Modal.js +8 -21
- package/dist/components/Modal/Modal.scss +2 -2
- package/dist/components/PopUpDialog/PopUpDialog.js +28 -43
- package/dist/components/RoundedIcon/RoundedIcon.js +7 -18
- package/dist/components/RoundedIcon/roundedIcon.scss +2 -2
- package/dist/components/Tip/Tip.js +25 -40
- package/dist/components/Tip/Tip.test.js +36 -45
- package/dist/components/Tooltip/Tooltip.js +40 -64
- package/dist/components/TooltipTemplate/ProducerTooltipTemplate.js +2 -8
- package/dist/components/TooltipTemplate/TextTooltipTemplate.js +2 -12
- package/dist/components/Wizard/Wizard.js +35 -57
- package/dist/components/Wizard/Wizard.scss +1 -3
- package/dist/components/Wizard/WizardSteps/WizardSteps.js +4 -16
- package/dist/components/Wizard/WizardSteps/WizardSteps.scss +1 -0
- package/dist/components/index.js +0 -18
- package/dist/constants.js +4 -6
- package/dist/elements/FormActionButton/FormActionButton.js +6 -12
- package/dist/elements/FormRowActions/FormRowActions.js +6 -18
- package/dist/elements/HiddenChipsBlock/HiddenChipsBlock.js +37 -55
- package/dist/elements/OptionsMenu/OptionsMenu.js +4 -14
- package/dist/elements/SelectOption/SelectOption.js +6 -18
- package/dist/elements/SelectOption/SelectOption.test.js +19 -12
- package/dist/elements/SelectOption/selectOption.scss +5 -2
- package/dist/elements/ValidationTemplate/ValidationTemplate.js +2 -11
- package/dist/elements/index.js +0 -6
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useDebounce.js +1 -5
- package/dist/hooks/useDetectOutsideClick.js +4 -8
- package/dist/hooks/useFormTable.hook.js +31 -41
- package/dist/images/archive-icon.svg +3 -0
- package/dist/images/arrow.svg +1 -1
- package/dist/images/close.svg +2 -2
- package/dist/images/collapse.svg +2 -2
- package/dist/images/copy-to-clipboard-icon.svg +3 -0
- package/dist/images/deploy-icon.svg +4 -0
- package/dist/images/edit.svg +1 -1
- package/dist/images/edit_old.svg +3 -0
- package/dist/images/expand.svg +2 -2
- package/dist/images/eye-icon.svg +3 -0
- package/dist/images/link-icon.svg +5 -0
- package/dist/images/monitor-icon.svg +3 -0
- package/dist/images/refresh.svg +1 -1
- package/dist/images/tag-icon.svg +4 -0
- package/dist/images/unarchive-icon.svg +3 -0
- package/dist/images/yaml.svg +2 -3
- package/dist/images/yaml_old.svg +4 -0
- package/dist/index.js +0 -13
- package/dist/scss/borders.scss +1 -1
- package/dist/scss/colors.scss +2 -0
- package/dist/scss/common.scss +7 -3
- package/dist/scss/mixins.scss +6 -19
- package/dist/scss/shadows.scss +3 -3
- package/dist/scss/variables.scss +2 -0
- package/dist/types.js +19 -49
- package/dist/utils/common.util.js +3 -13
- package/dist/utils/form.util.js +20 -24
- package/dist/utils/generateChipsList.util.js +0 -3
- package/dist/utils/getFirstScrollableParent.util.js +0 -5
- package/dist/utils/validation.util.js +72 -94
- package/package.json +104 -104
- package/dist/images/eye.svg +0 -4
|
@@ -1,120 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
12
|
var _NewChipInput = _interopRequireDefault(require("../NewChipInput/NewChipInput"));
|
|
19
|
-
|
|
20
13
|
var _OptionsMenu = _interopRequireDefault(require("../../../elements/OptionsMenu/OptionsMenu"));
|
|
21
|
-
|
|
22
14
|
var _ValidationTemplate = _interopRequireDefault(require("../../../elements/ValidationTemplate/ValidationTemplate"));
|
|
23
|
-
|
|
24
15
|
var _types = require("../../../types");
|
|
25
|
-
|
|
26
16
|
var _constants = require("../../../constants");
|
|
27
|
-
|
|
28
17
|
var _close = require("../../../images/close.svg");
|
|
29
|
-
|
|
30
18
|
require("./newChipForm.scss");
|
|
31
|
-
|
|
32
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
-
|
|
34
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
-
|
|
36
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
-
|
|
38
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
-
|
|
40
23
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
-
|
|
42
24
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
25
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
27
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
46
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
47
|
-
|
|
48
29
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
49
|
-
|
|
50
30
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
51
|
-
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
31
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
33
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
|
|
34
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
35
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
36
|
+
an addition restriction as set forth herein. You may not use this
|
|
37
|
+
file except in compliance with the License. You may obtain a copy of
|
|
38
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
39
|
+
Unless required by applicable law or agreed to in writing, software
|
|
40
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
41
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
42
|
+
implied. See the License for the specific language governing
|
|
43
|
+
permissions and limitations under the License.
|
|
44
|
+
In addition, you may not use the software for any purposes that are
|
|
45
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
46
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
47
|
+
such restriction.
|
|
48
|
+
*/
|
|
58
49
|
var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
59
50
|
var chip = _ref.chip,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
chipIndex = _ref.chipIndex,
|
|
52
|
+
chipOptions = _ref.chipOptions,
|
|
53
|
+
className = _ref.className,
|
|
54
|
+
editConfig = _ref.editConfig,
|
|
55
|
+
handleRemoveChip = _ref.handleRemoveChip,
|
|
56
|
+
isEditable = _ref.isEditable,
|
|
57
|
+
keyName = _ref.keyName,
|
|
58
|
+
meta = _ref.meta,
|
|
59
|
+
onChange = _ref.onChange,
|
|
60
|
+
setEditConfig = _ref.setEditConfig,
|
|
61
|
+
rules = _ref.validationRules,
|
|
62
|
+
valueName = _ref.valueName;
|
|
73
63
|
var _useState = (0, _react.useState)({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
64
|
+
isKeyOnly: chip.isKeyOnly,
|
|
65
|
+
key: chip.key,
|
|
66
|
+
value: chip.value,
|
|
67
|
+
keyFieldWidth: 0,
|
|
68
|
+
valueFieldWidth: 0
|
|
69
|
+
}),
|
|
70
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
+
chipData = _useState2[0],
|
|
72
|
+
setChipData = _useState2[1];
|
|
84
73
|
var _useState3 = (0, _react.useState)('key'),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
75
|
+
selectedInput = _useState4[0],
|
|
76
|
+
setSelectedInput = _useState4[1];
|
|
89
77
|
var _useState5 = (0, _react.useState)(rules),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
79
|
+
validationRules = _useState6[0],
|
|
80
|
+
setValidationRules = _useState6[1];
|
|
94
81
|
var _useState7 = (0, _react.useState)(false),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
83
|
+
showValidationRules = _useState8[0],
|
|
84
|
+
setShowValidationRules = _useState8[1];
|
|
99
85
|
var maxWidthInput = (0, _react.useMemo)(function () {
|
|
100
86
|
var _ref$current;
|
|
101
|
-
|
|
102
87
|
return ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientWidth) - 50;
|
|
103
88
|
}, [ref]);
|
|
104
89
|
var background = chipOptions.background,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
90
|
+
borderColor = chipOptions.borderColor,
|
|
91
|
+
borderRadius = chipOptions.borderRadius,
|
|
92
|
+
density = chipOptions.density,
|
|
93
|
+
font = chipOptions.font;
|
|
109
94
|
var minWidthInput = 25;
|
|
110
95
|
var minWidthValueInput = 35;
|
|
111
|
-
|
|
112
96
|
var refInputKey = _react.default.useRef({});
|
|
113
|
-
|
|
114
97
|
var refInputValue = _react.default.useRef({});
|
|
115
|
-
|
|
116
98
|
var refInputContainer = _react.default.useRef();
|
|
117
|
-
|
|
118
99
|
var labelKeyClassName = (0, _classnames.default)(className, !editConfig.isKeyFocused && 'item_edited', !(0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', chipIndex, 'key'], [])) && !(0, _lodash.isEmpty)(chipData.key) && 'item_edited_invalid');
|
|
119
100
|
var 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');
|
|
120
101
|
var 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');
|
|
@@ -132,16 +113,13 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
132
113
|
});
|
|
133
114
|
}
|
|
134
115
|
}, [chipData.key, chipData.value, chipData.keyFieldWidth, chipData.valueFieldWidth, maxWidthInput, refInputKey, refInputValue]);
|
|
135
|
-
|
|
136
116
|
var handleScroll = function handleScroll() {
|
|
137
117
|
setShowValidationRules(false);
|
|
138
118
|
};
|
|
139
|
-
|
|
140
119
|
(0, _react.useEffect)(function () {
|
|
141
120
|
if (showValidationRules) {
|
|
142
121
|
window.addEventListener('scroll', handleScroll, true);
|
|
143
122
|
}
|
|
144
|
-
|
|
145
123
|
return function () {
|
|
146
124
|
window.removeEventListener('scroll', handleScroll, true);
|
|
147
125
|
};
|
|
@@ -158,9 +136,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
158
136
|
var outsideClick = (0, _react.useCallback)(function (event) {
|
|
159
137
|
if (editConfig.chipIndex === chipIndex) {
|
|
160
138
|
var _event$path, _event$composedPath;
|
|
161
|
-
|
|
162
139
|
var 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);
|
|
163
|
-
|
|
164
140
|
if (!elementPath.includes(refInputContainer.current)) {
|
|
165
141
|
onChange(event, _constants.CLICK);
|
|
166
142
|
window.getSelection().removeAllRanges();
|
|
@@ -179,14 +155,12 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
179
155
|
}, [outsideClick, editConfig.isEdit]);
|
|
180
156
|
var focusChip = (0, _react.useCallback)(function (event) {
|
|
181
157
|
event.stopPropagation();
|
|
182
|
-
|
|
183
158
|
if (editConfig.chipIndex === chipIndex && isEditable) {
|
|
184
159
|
if (!event.shiftKey && event.key === _constants.TAB && editConfig.isValueFocused) {
|
|
185
160
|
onChange(event, _constants.TAB);
|
|
186
161
|
} else if (event.shiftKey && event.key === _constants.TAB && editConfig.isKeyFocused) {
|
|
187
162
|
onChange(event, _constants.TAB_SHIFT);
|
|
188
163
|
}
|
|
189
|
-
|
|
190
164
|
if (event.key === _constants.BACKSPACE || event.key === _constants.DELETE) {
|
|
191
165
|
setChipData(function (prevState) {
|
|
192
166
|
return {
|
|
@@ -216,13 +190,11 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
216
190
|
});
|
|
217
191
|
});
|
|
218
192
|
}
|
|
219
|
-
|
|
220
193
|
event && event.stopPropagation();
|
|
221
194
|
}
|
|
222
195
|
}, [keyName, refInputKey, refInputValue, setEditConfig, editConfig.chipIndex, chipIndex]);
|
|
223
196
|
var handleOnChange = (0, _react.useCallback)(function (event) {
|
|
224
197
|
event.preventDefault();
|
|
225
|
-
|
|
226
198
|
if (event.target.name === keyName) {
|
|
227
199
|
var currentWidthKeyInput = refInputKey.current.scrollWidth;
|
|
228
200
|
setChipData(function (prevState) {
|
|
@@ -235,7 +207,6 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
235
207
|
var currentWidthValueInput = refInputValue.current.scrollWidth;
|
|
236
208
|
setChipData(function (prevState) {
|
|
237
209
|
var _refInputValue$curren;
|
|
238
|
-
|
|
239
210
|
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
240
211
|
value: refInputValue.current.value,
|
|
241
212
|
valueFieldWidth: ((_refInputValue$curren = refInputValue.current.value) === null || _refInputValue$curren === void 0 ? void 0 : _refInputValue$curren.length) <= 1 ? minWidthValueInput : currentWidthValueInput >= maxWidthInput ? maxWidthInput : currentWidthValueInput > minWidthValueInput ? currentWidthValueInput + 2 : minWidthValueInput
|
|
@@ -257,7 +228,6 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
257
228
|
if (meta.error) {
|
|
258
229
|
setValidationRules(function (prevState) {
|
|
259
230
|
var _prevState$selectedIn;
|
|
260
|
-
|
|
261
231
|
return _objectSpread(_objectSpread({}, prevState), {}, _defineProperty({}, selectedInput, (_prevState$selectedIn = prevState[selectedInput]) === null || _prevState$selectedIn === void 0 ? void 0 : _prevState$selectedIn.map(function (rule) {
|
|
262
232
|
return _objectSpread(_objectSpread({}, rule), {}, {
|
|
263
233
|
isValid: (0, _lodash.isEmpty)((0, _lodash.get)(meta, ['error', editConfig.chipIndex, selectedInput], [])) ? true : !meta.error[editConfig.chipIndex][selectedInput].some(function (err) {
|
|
@@ -271,12 +241,11 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
271
241
|
}, [meta, showValidationRules, selectedInput, editConfig.chipIndex]);
|
|
272
242
|
var getValidationRules = (0, _react.useCallback)(function () {
|
|
273
243
|
var _validationRules$sele;
|
|
274
|
-
|
|
275
244
|
return (_validationRules$sele = validationRules[selectedInput]) === null || _validationRules$sele === void 0 ? void 0 : _validationRules$sele.map(function (_ref2) {
|
|
276
245
|
var _ref2$isValid = _ref2.isValid,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
246
|
+
isValid = _ref2$isValid === void 0 ? false : _ref2$isValid,
|
|
247
|
+
label = _ref2.label,
|
|
248
|
+
name = _ref2.name;
|
|
280
249
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ValidationTemplate.default, {
|
|
281
250
|
valid: isValid,
|
|
282
251
|
validationMessage: label
|
|
@@ -327,7 +296,6 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
327
296
|
})]
|
|
328
297
|
});
|
|
329
298
|
});
|
|
330
|
-
|
|
331
299
|
NewChipForm.defaultProps = {
|
|
332
300
|
className: '',
|
|
333
301
|
validationRules: {}
|
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
|
-
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _reactFinalForm = require("react-final-form");
|
|
13
|
-
|
|
14
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
12
|
var _excluded = ["name", "onChange", "onFocus"];
|
|
17
|
-
|
|
13
|
+
/*
|
|
14
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
15
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
16
|
+
an addition restriction as set forth herein. You may not use this
|
|
17
|
+
file except in compliance with the License. You may obtain a copy of
|
|
18
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
19
|
+
Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
22
|
+
implied. See the License for the specific language governing
|
|
23
|
+
permissions and limitations under the License.
|
|
24
|
+
In addition, you may not use the software for any purposes that are
|
|
25
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
26
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
27
|
+
such restriction.
|
|
28
|
+
*/
|
|
18
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
-
|
|
22
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
32
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
34
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
35
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
|
-
|
|
28
36
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
|
-
|
|
30
37
|
var NewChipInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
31
38
|
var name = _ref.name,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
onChange = _ref.onChange,
|
|
40
|
+
onFocus = _ref.onFocus,
|
|
41
|
+
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
36
42
|
var _useField = (0, _reactFinalForm.useField)(name),
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
input = _useField.input;
|
|
39
44
|
var handleInputChange = function handleInputChange(event) {
|
|
40
45
|
input.onChange(event);
|
|
41
46
|
onChange(event);
|
|
42
47
|
};
|
|
43
|
-
|
|
44
48
|
var handleInputFocus = function handleInputFocus(event) {
|
|
45
49
|
input.onFocus(event);
|
|
46
50
|
onFocus(event);
|
|
47
51
|
};
|
|
48
|
-
|
|
49
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
50
53
|
name: name,
|
|
51
54
|
children: function children(_ref2) {
|
|
@@ -63,7 +66,6 @@ var NewChipInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
63
66
|
}
|
|
64
67
|
});
|
|
65
68
|
});
|
|
66
|
-
|
|
67
69
|
NewChipInput.propTypes = {
|
|
68
70
|
name: _propTypes.default.string.isRequired,
|
|
69
71
|
onChange: _propTypes.default.func.isRequired,
|