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,105 +1,90 @@
|
|
|
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 _lodash = _interopRequireWildcard(require("lodash"));
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _FormChipCellView = _interopRequireDefault(require("./FormChipCellView"));
|
|
17
|
-
|
|
18
12
|
var _common = require("../../utils/common.util");
|
|
19
|
-
|
|
20
13
|
var _generateChipsList = require("../../utils/generateChipsList.util");
|
|
21
|
-
|
|
22
14
|
var _validation = require("../../utils/validation.util");
|
|
23
|
-
|
|
24
15
|
var _formChipCell = require("./formChipCell.util");
|
|
25
|
-
|
|
26
16
|
var _types = require("../../types");
|
|
27
|
-
|
|
28
17
|
var _constants = require("../../constants");
|
|
29
|
-
|
|
30
18
|
require("./formChipCell.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 FormChipCell = function FormChipCell(_ref) {
|
|
59
50
|
var chipOptions = _ref.chipOptions,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
51
|
+
delimiter = _ref.delimiter,
|
|
52
|
+
formState = _ref.formState,
|
|
53
|
+
initialValues = _ref.initialValues,
|
|
54
|
+
isEditable = _ref.isEditable,
|
|
55
|
+
label = _ref.label,
|
|
56
|
+
name = _ref.name,
|
|
57
|
+
onClick = _ref.onClick,
|
|
58
|
+
shortChips = _ref.shortChips,
|
|
59
|
+
validationRules = _ref.validationRules,
|
|
60
|
+
validator = _ref.validator,
|
|
61
|
+
visibleChipsMaxLength = _ref.visibleChipsMaxLength;
|
|
72
62
|
var _useState = (0, _react.useState)({}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
+
chipsSizes = _useState2[0],
|
|
65
|
+
setChipsSizes = _useState2[1];
|
|
77
66
|
var _useState3 = (0, _react.useState)(false),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
|
+
showHiddenChips = _useState4[0],
|
|
69
|
+
setShowHiddenChips = _useState4[1];
|
|
82
70
|
var _useState5 = (0, _react.useState)({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
71
|
+
chipIndex: null,
|
|
72
|
+
isEdit: false,
|
|
73
|
+
isKeyFocused: false,
|
|
74
|
+
isValueFocused: false,
|
|
75
|
+
isNewChip: false
|
|
76
|
+
}),
|
|
77
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
78
|
+
editConfig = _useState6[0],
|
|
79
|
+
setEditConfig = _useState6[1];
|
|
93
80
|
var _useState7 = (0, _react.useState)(false),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
82
|
+
showChips = _useState8[0],
|
|
83
|
+
setShowChips = _useState8[1];
|
|
98
84
|
var _useState9 = (0, _react.useState)(8),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
86
|
+
visibleChipsCount = _useState10[0],
|
|
87
|
+
setVisibleChipsCount = _useState10[1];
|
|
103
88
|
var chipsCellRef = (0, _react.useRef)();
|
|
104
89
|
var chipsWrapperRef = (0, _react.useRef)();
|
|
105
90
|
var handleShowElements = (0, _react.useCallback)(function () {
|
|
@@ -118,7 +103,6 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
118
103
|
var handleResize = (0, _react.useCallback)(function () {
|
|
119
104
|
if (!isEditable && !(0, _common.isEveryObjectValueEmpty)(chipsSizes)) {
|
|
120
105
|
var _chipsCellRef$current;
|
|
121
|
-
|
|
122
106
|
var parentSize = (_chipsCellRef$current = chipsCellRef.current) === null || _chipsCellRef$current === void 0 ? void 0 : _chipsCellRef$current.getBoundingClientRect().width;
|
|
123
107
|
var maxLength = 0;
|
|
124
108
|
var chipIndex = 0;
|
|
@@ -129,11 +113,9 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
129
113
|
return false;
|
|
130
114
|
} else {
|
|
131
115
|
maxLength += chipSize;
|
|
132
|
-
|
|
133
116
|
if (index === Object.values(chipsSizes).length - 1) {
|
|
134
117
|
chipIndex = 8;
|
|
135
118
|
}
|
|
136
|
-
|
|
137
119
|
return true;
|
|
138
120
|
}
|
|
139
121
|
});
|
|
@@ -170,7 +152,6 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
170
152
|
if ((0, _common.areArraysEqual)((0, _lodash.get)(initialValues, name), currentChipsList, ['id'])) {
|
|
171
153
|
(0, _lodash.set)(formState.initialValues, name, currentChipsList);
|
|
172
154
|
}
|
|
173
|
-
|
|
174
155
|
formState.form.mutators.setFieldState(name, {
|
|
175
156
|
modified: true
|
|
176
157
|
});
|
|
@@ -187,11 +168,9 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
187
168
|
delimiter: delimiter
|
|
188
169
|
});
|
|
189
170
|
}
|
|
190
|
-
|
|
191
171
|
if (showHiddenChips) {
|
|
192
172
|
setShowHiddenChips(false);
|
|
193
173
|
}
|
|
194
|
-
|
|
195
174
|
setEditConfig({
|
|
196
175
|
chipIndex: fields.value.length,
|
|
197
176
|
isEdit: true,
|
|
@@ -210,15 +189,13 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
210
189
|
}, [checkChipsList, formState, name]);
|
|
211
190
|
var handleEditChip = (0, _react.useCallback)(function (event, fields, nameEvent) {
|
|
212
191
|
var _fields$value$editCon = fields.value[editConfig.chipIndex],
|
|
213
|
-
|
|
214
|
-
|
|
192
|
+
key = _fields$value$editCon.key,
|
|
193
|
+
value = _fields$value$editCon.value;
|
|
215
194
|
var isChipNotEmpty = !!(key !== null && key !== void 0 && key.trim() && value !== null && value !== void 0 && value.trim());
|
|
216
|
-
|
|
217
195
|
if (nameEvent === _constants.CLICK) {
|
|
218
196
|
if (!isChipNotEmpty) {
|
|
219
197
|
handleRemoveChip(event, fields, editConfig.chipIndex);
|
|
220
198
|
}
|
|
221
|
-
|
|
222
199
|
setEditConfig({
|
|
223
200
|
chipIndex: null,
|
|
224
201
|
isEdit: false,
|
|
@@ -230,7 +207,6 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
230
207
|
if (!isChipNotEmpty) {
|
|
231
208
|
handleRemoveChip(event, fields, editConfig.chipIndex);
|
|
232
209
|
}
|
|
233
|
-
|
|
234
210
|
setEditConfig(function (prevState) {
|
|
235
211
|
var lastChipSelected = prevState.chipIndex + 1 > fields.value.length - 1;
|
|
236
212
|
return {
|
|
@@ -245,7 +221,6 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
245
221
|
if (!isChipNotEmpty) {
|
|
246
222
|
handleRemoveChip(event, fields, editConfig.chipIndex);
|
|
247
223
|
}
|
|
248
|
-
|
|
249
224
|
setEditConfig(function (prevState) {
|
|
250
225
|
var isPrevChipIndexExists = prevState.chipIndex - 1 < 0;
|
|
251
226
|
return {
|
|
@@ -257,7 +232,6 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
257
232
|
};
|
|
258
233
|
});
|
|
259
234
|
}
|
|
260
|
-
|
|
261
235
|
checkChipsList((0, _lodash.get)(formState.values, name));
|
|
262
236
|
event && event.preventDefault();
|
|
263
237
|
}, [editConfig.chipIndex, handleRemoveChip, checkChipsList, formState.values, name]);
|
|
@@ -273,10 +247,8 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
273
247
|
});
|
|
274
248
|
});
|
|
275
249
|
}
|
|
276
|
-
|
|
277
250
|
onClick && onClick();
|
|
278
251
|
}, [isEditable, onClick]);
|
|
279
|
-
|
|
280
252
|
var validateFields = function validateFields(fieldsArray) {
|
|
281
253
|
var uniquenessValidator = function uniquenessValidator(newValue, idx) {
|
|
282
254
|
return !fieldsArray.some(function (_ref2, index) {
|
|
@@ -284,17 +256,14 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
284
256
|
return newValue === key && index !== idx;
|
|
285
257
|
});
|
|
286
258
|
};
|
|
287
|
-
|
|
288
259
|
var errorData = [];
|
|
289
260
|
if (!fieldsArray) return [];
|
|
290
|
-
|
|
291
261
|
if (!(0, _lodash.isEmpty)(validationRules)) {
|
|
292
262
|
errorData = fieldsArray.map(function (chip) {
|
|
293
263
|
var _validateChip = validateChip(chip),
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
264
|
+
_validateChip2 = _slicedToArray(_validateChip, 2),
|
|
265
|
+
keyValidation = _validateChip2[0],
|
|
266
|
+
valueValidation = _validateChip2[1];
|
|
298
267
|
if (keyValidation && valueValidation) return {
|
|
299
268
|
key: keyValidation,
|
|
300
269
|
value: valueValidation
|
|
@@ -307,12 +276,11 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
307
276
|
};
|
|
308
277
|
return null;
|
|
309
278
|
});
|
|
310
|
-
}
|
|
311
|
-
|
|
279
|
+
}
|
|
312
280
|
|
|
281
|
+
// uniqueness
|
|
313
282
|
fieldsArray.forEach(function (chip, index) {
|
|
314
283
|
var isUnique = uniquenessValidator(chip.key, index);
|
|
315
|
-
|
|
316
284
|
if (!isUnique) {
|
|
317
285
|
if ((0, _lodash.get)(errorData, [index, 'key'], false)) {
|
|
318
286
|
errorData.at(index).key.push(_formChipCell.uniquenessError);
|
|
@@ -321,32 +289,26 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
321
289
|
}
|
|
322
290
|
}
|
|
323
291
|
});
|
|
324
|
-
|
|
325
292
|
if (!errorData && validator) {
|
|
326
293
|
errorData = validator(fieldsArray);
|
|
327
294
|
}
|
|
328
|
-
|
|
329
295
|
if (errorData.every(function (label) {
|
|
330
296
|
return (0, _lodash.isNil)(label);
|
|
331
297
|
})) {
|
|
332
298
|
return [];
|
|
333
299
|
}
|
|
334
|
-
|
|
335
300
|
return errorData;
|
|
336
301
|
};
|
|
337
|
-
|
|
338
302
|
var validateChip = function validateChip(_ref3) {
|
|
339
303
|
var key = _ref3.key,
|
|
340
|
-
|
|
341
|
-
|
|
304
|
+
value = _ref3.value;
|
|
342
305
|
var validateField = function validateField(value, field) {
|
|
343
306
|
var _checkPatternsValidit = (0, _validation.checkPatternsValidity)(validationRules[field].filter(function (rule) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
307
|
+
return rule.pattern;
|
|
308
|
+
}), value),
|
|
309
|
+
_checkPatternsValidit2 = _slicedToArray(_checkPatternsValidit, 2),
|
|
310
|
+
newRules = _checkPatternsValidit2[0],
|
|
311
|
+
isValidField = _checkPatternsValidit2[1];
|
|
350
312
|
if (isValidField) return null;
|
|
351
313
|
var invalidRules = newRules.filter(function (rule) {
|
|
352
314
|
return !rule.isValid;
|
|
@@ -358,10 +320,8 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
358
320
|
};
|
|
359
321
|
});
|
|
360
322
|
};
|
|
361
|
-
|
|
362
323
|
return [validateField(key, 'key'), validateField(value, 'value')];
|
|
363
324
|
};
|
|
364
|
-
|
|
365
325
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
366
326
|
className: "chips",
|
|
367
327
|
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -395,7 +355,6 @@ var FormChipCell = function FormChipCell(_ref) {
|
|
|
395
355
|
})]
|
|
396
356
|
});
|
|
397
357
|
};
|
|
398
|
-
|
|
399
358
|
FormChipCell.defaultProps = {
|
|
400
359
|
chipOptions: {
|
|
401
360
|
background: 'purple',
|
|
@@ -428,7 +387,5 @@ FormChipCell.propTypes = {
|
|
|
428
387
|
validator: _propTypes.default.func,
|
|
429
388
|
visibleChipsMaxLength: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
|
|
430
389
|
};
|
|
431
|
-
|
|
432
390
|
var _default = /*#__PURE__*/_react.default.memo(FormChipCell);
|
|
433
|
-
|
|
434
391
|
exports.default = _default;
|
|
@@ -4,37 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
15
|
-
|
|
16
11
|
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
12
|
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
19
|
-
|
|
20
13
|
var _FormChip = _interopRequireDefault(require("./FormChip/FormChip"));
|
|
21
|
-
|
|
22
14
|
var _TextTooltipTemplate = _interopRequireDefault(require("../TooltipTemplate/TextTooltipTemplate"));
|
|
23
|
-
|
|
24
15
|
var _HiddenChipsBlock = _interopRequireDefault(require("../../elements/HiddenChipsBlock/HiddenChipsBlock"));
|
|
25
|
-
|
|
26
16
|
var _types = require("../../types");
|
|
27
|
-
|
|
28
17
|
var _formChipCell = require("./formChipCell.util");
|
|
29
|
-
|
|
30
18
|
var _common = require("../../utils/common.util");
|
|
31
|
-
|
|
32
19
|
var _add = require("../../images/add.svg");
|
|
33
|
-
|
|
34
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
|
-
|
|
36
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
-
|
|
38
22
|
/*
|
|
39
23
|
Copyright 2022 Iguazio Systems Ltd.
|
|
40
24
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -51,26 +35,27 @@ illegal under applicable law, and the grant of the foregoing license
|
|
|
51
35
|
under the Apache 2.0 license is conditioned upon your compliance with
|
|
52
36
|
such restriction.
|
|
53
37
|
*/
|
|
38
|
+
|
|
54
39
|
var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _ref2) {
|
|
55
40
|
var chipOptions = _ref.chipOptions,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
41
|
+
chips = _ref.chips,
|
|
42
|
+
editConfig = _ref.editConfig,
|
|
43
|
+
handleAddNewChip = _ref.handleAddNewChip,
|
|
44
|
+
_handleEditChip = _ref.handleEditChip,
|
|
45
|
+
_handleRemoveChip = _ref.handleRemoveChip,
|
|
46
|
+
handleShowElements = _ref.handleShowElements,
|
|
47
|
+
handleToEditMode = _ref.handleToEditMode,
|
|
48
|
+
isEditable = _ref.isEditable,
|
|
49
|
+
name = _ref.name,
|
|
50
|
+
setChipsSizes = _ref.setChipsSizes,
|
|
51
|
+
setEditConfig = _ref.setEditConfig,
|
|
52
|
+
shortChips = _ref.shortChips,
|
|
53
|
+
showChips = _ref.showChips,
|
|
54
|
+
showHiddenChips = _ref.showHiddenChips,
|
|
55
|
+
validateFields = _ref.validateFields,
|
|
56
|
+
validationRules = _ref.validationRules;
|
|
72
57
|
var chipsCellRef = _ref2.chipsCellRef,
|
|
73
|
-
|
|
58
|
+
chipsWrapperRef = _ref2.chipsWrapperRef;
|
|
74
59
|
var buttonAddClassNames = (0, _classnames.default)('button-add', chipOptions.background && "button-add-background_".concat(chipOptions.background), chipOptions.borderColor && "button-add-border_".concat(chipOptions.borderColor), chipOptions.font && "button-add-font_".concat(chipOptions.font), chipOptions.density && "button-add-density_".concat(chipOptions.density));
|
|
75
60
|
var wrapperClassNames = (0, _classnames.default)('chips-wrapper', isEditable && 'fixed-max-width');
|
|
76
61
|
var chipClassNames = (0, _classnames.default)('chip', 'chip__content', isEditable && 'data-ellipsis', shortChips && 'chip_short', chips.hiddenChips && 'chip_hidden', chipOptions.density && "chip-density_".concat(chipOptions.density), chipOptions.borderRadius && "chip-border_".concat(chipOptions.borderRadius), chipOptions.background && "chip-background_".concat(chipOptions.background), chipOptions.borderColor && "chip-border_".concat(chipOptions.borderColor), chipOptions.font && "chip-font_".concat(chipOptions.font), isEditable && 'editable', (showChips || isEditable) && 'chip_visible');
|
|
@@ -79,14 +64,12 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
|
|
|
79
64
|
validate: validateFields,
|
|
80
65
|
children: function children(_ref3) {
|
|
81
66
|
var fields = _ref3.fields,
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
meta = _ref3.meta;
|
|
84
68
|
if (!(0, _lodash.isEmpty)(validationRules) && validationRules.key.every(function (rule) {
|
|
85
69
|
return rule.name !== _formChipCell.uniquenessError.name;
|
|
86
70
|
})) {
|
|
87
71
|
validationRules.key.push(_formChipCell.uniquenessError);
|
|
88
72
|
}
|
|
89
|
-
|
|
90
73
|
return (isEditable || !(0, _common.isEveryObjectValueEmpty)(fields)) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
91
74
|
className: "chips-cell",
|
|
92
75
|
ref: chipsCellRef,
|
|
@@ -159,7 +142,6 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
|
|
|
159
142
|
}
|
|
160
143
|
});
|
|
161
144
|
});
|
|
162
|
-
|
|
163
145
|
FormChipCellView.defaultProps = {
|
|
164
146
|
chipOptions: {
|
|
165
147
|
background: 'purple',
|