iguazio.dashboard-react-controls 1.9.2 → 2.0.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 +7 -7
- package/dist/components/Button/Button.js +20 -26
- package/dist/components/ConfirmDialog/ConfirmDialog.js +18 -17
- package/dist/components/FormCheckBox/FormCheckBox.js +28 -32
- package/dist/components/FormChipCell/FormChip/FormChip.js +46 -50
- package/dist/components/FormChipCell/FormChipCell.js +122 -142
- package/dist/components/FormChipCell/FormChipCellView.js +44 -47
- package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.js +23 -20
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.js +129 -152
- package/dist/components/FormChipCell/NewChipInput/NewChipInput.js +24 -27
- package/dist/components/FormChipCell/formChipCell.util.js +6 -16
- package/dist/components/FormCombobox/FormCombobox.js +134 -195
- package/dist/components/FormInput/FormInput.js +134 -212
- package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.js +15 -14
- package/dist/components/FormKeyValueTable/FormKeyValueTable.js +72 -72
- package/dist/components/FormRadio/FormRadio.js +21 -25
- package/dist/components/FormSelect/FormSelect.js +98 -126
- package/dist/components/FormSelect/FormSelect.test.js +56 -60
- package/dist/components/FormTextarea/FormTextarea.js +55 -71
- package/dist/components/FormToggle/FormToggle.js +25 -29
- package/dist/components/Modal/Modal.js +17 -18
- package/dist/components/PopUpDialog/PopUpDialog.js +53 -63
- package/dist/components/RoundedIcon/RoundedIcon.js +14 -13
- package/dist/components/Tip/Tip.js +58 -64
- package/dist/components/Tip/Tip.test.js +41 -64
- package/dist/components/Tooltip/Tooltip.js +75 -89
- package/dist/components/TooltipTemplate/ProducerTooltipTemplate.js +6 -5
- package/dist/components/TooltipTemplate/TextTooltipTemplate.js +10 -10
- package/dist/components/Wizard/Wizard.js +73 -107
- package/dist/components/Wizard/WizardSteps/WizardSteps.js +19 -20
- package/dist/components/index.js +18 -18
- package/dist/constants.js +26 -44
- package/dist/elements/FormActionButton/FormActionButton.js +12 -13
- package/dist/elements/FormRowActions/FormRowActions.js +19 -22
- package/dist/elements/OptionsMenu/OptionsMenu.js +10 -8
- package/dist/elements/SelectOption/SelectOption.js +14 -13
- package/dist/elements/SelectOption/SelectOption.test.js +39 -47
- package/dist/elements/ValidationTemplate/ValidationTemplate.js +7 -6
- package/dist/elements/index.js +5 -5
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/useChipCell.hook.js +66 -85
- package/dist/hooks/useDebounce.hook.js +22 -24
- package/dist/hooks/useDetectOutsideClick.hook.js +4 -4
- package/dist/hooks/useFormTable.hook.js +99 -112
- package/dist/hooks/useHiddenChipsBlock.hook.js +40 -55
- package/dist/index.js +2 -3
- package/dist/scss/borders.scss +6 -0
- package/dist/scss/mixins.scss +32 -0
- package/dist/types.js +43 -67
- package/dist/utils/common.util.js +19 -23
- package/dist/utils/form.util.js +33 -39
- package/dist/utils/generateChipsList.util.js +7 -7
- package/dist/utils/getFirstScrollableParent.util.js +4 -10
- package/dist/utils/math.util.js +3 -3
- package/dist/utils/validation.util.js +74 -131
- package/package.json +34 -34
|
@@ -14,59 +14,62 @@ var _hooks = require("../../hooks");
|
|
|
14
14
|
var _types = require("../../types");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
17
|
+
/*
|
|
18
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
19
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
20
|
+
an addition restriction as set forth herein. You may not use this
|
|
21
|
+
file except in compliance with the License. You may obtain a copy of
|
|
22
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
23
|
+
Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
26
|
+
implied. See the License for the specific language governing
|
|
27
|
+
permissions and limitations under the License.
|
|
28
|
+
In addition, you may not use the software for any purposes that are
|
|
29
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
30
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
31
|
+
such restriction.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
const FormKeyValueTable = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
actionButtonId,
|
|
37
|
+
addNewItemLabel,
|
|
38
|
+
className,
|
|
39
|
+
defaultKey,
|
|
40
|
+
disabled,
|
|
41
|
+
exitEditModeTriggerItem,
|
|
42
|
+
fieldsPath,
|
|
43
|
+
formState,
|
|
44
|
+
isKeyRequired,
|
|
45
|
+
isValueRequired,
|
|
46
|
+
keyHeader,
|
|
47
|
+
keyLabel,
|
|
48
|
+
keyOptions,
|
|
49
|
+
keyValidationRules,
|
|
50
|
+
onExitEditModeCallback,
|
|
51
|
+
valueHeader,
|
|
52
|
+
valueLabel,
|
|
53
|
+
valueValidationRules
|
|
54
|
+
} = _ref;
|
|
55
|
+
const tableClassNames = (0, _classnames.default)('form-table form-key-value-table', className);
|
|
56
|
+
const {
|
|
57
|
+
addNewRow,
|
|
58
|
+
applyChanges,
|
|
59
|
+
bottomScrollRef,
|
|
60
|
+
deleteRow,
|
|
61
|
+
discardOrDelete,
|
|
62
|
+
editingItem,
|
|
63
|
+
enterEditMode,
|
|
64
|
+
isCurrentRowEditing
|
|
65
|
+
} = (0, _hooks.useFormTable)(formState, exitEditModeTriggerItem, onExitEditModeCallback);
|
|
66
|
+
const uniquenessValidator = (fields, newValue) => {
|
|
67
|
+
return !fields.value.some((_ref2, index) => {
|
|
68
|
+
let {
|
|
69
|
+
data: {
|
|
70
|
+
key
|
|
71
|
+
}
|
|
72
|
+
} = _ref2;
|
|
70
73
|
return newValue.trim() === key.trim() && index !== editingItem.ui.index;
|
|
71
74
|
});
|
|
72
75
|
};
|
|
@@ -86,12 +89,14 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
|
|
|
86
89
|
})]
|
|
87
90
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
88
91
|
name: fieldsPath,
|
|
89
|
-
children:
|
|
92
|
+
children: _ref3 => {
|
|
90
93
|
var _editingItem$ui;
|
|
91
|
-
|
|
94
|
+
let {
|
|
95
|
+
fields
|
|
96
|
+
} = _ref3;
|
|
92
97
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
93
|
-
children: [fields.map(
|
|
94
|
-
|
|
98
|
+
children: [fields.map((rowPath, index) => {
|
|
99
|
+
const tableRowClassNames = (0, _classnames.default)('form-table__row', isCurrentRowEditing(rowPath) && 'form-table__row_active');
|
|
95
100
|
return editingItem && index === editingItem.ui.index && !disabled ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
96
101
|
className: tableRowClassNames,
|
|
97
102
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -106,13 +111,11 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
|
|
|
106
111
|
density: "normal",
|
|
107
112
|
name: "".concat(rowPath, ".data.key"),
|
|
108
113
|
required: isKeyRequired,
|
|
109
|
-
validationRules: [
|
|
114
|
+
validationRules: [...keyValidationRules, {
|
|
110
115
|
name: 'uniqueness',
|
|
111
116
|
label: 'Name must be unique',
|
|
112
|
-
pattern:
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}])
|
|
117
|
+
pattern: newValue => uniquenessValidator(fields, newValue)
|
|
118
|
+
}]
|
|
116
119
|
})
|
|
117
120
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
118
121
|
className: "form-table__cell form-table__cell_1",
|
|
@@ -134,9 +137,7 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
|
|
|
134
137
|
})]
|
|
135
138
|
}, index) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
136
139
|
className: tableRowClassNames,
|
|
137
|
-
onClick:
|
|
138
|
-
return enterEditMode(event, fields, fieldsPath, index);
|
|
139
|
-
},
|
|
140
|
+
onClick: event => enterEditMode(event, fields, fieldsPath, index),
|
|
140
141
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
141
142
|
className: "form-table__cell form-table__cell_1",
|
|
142
143
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
@@ -165,20 +166,20 @@ var FormKeyValueTable = function FormKeyValueTable(_ref) {
|
|
|
165
166
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.FormActionButton, {
|
|
166
167
|
ref: bottomScrollRef,
|
|
167
168
|
disabled: disabled,
|
|
168
|
-
hidden: editingItem === null || editingItem === void 0
|
|
169
|
+
hidden: editingItem === null || editingItem === void 0 || (_editingItem$ui = editingItem.ui) === null || _editingItem$ui === void 0 ? void 0 : _editingItem$ui.isNew,
|
|
169
170
|
fields: fields,
|
|
170
171
|
id: actionButtonId,
|
|
171
172
|
label: addNewItemLabel,
|
|
172
|
-
onClick: function
|
|
173
|
+
onClick: function () {
|
|
173
174
|
for (var _len = arguments.length, addRowArgs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
174
175
|
addRowArgs[_key] = arguments[_key];
|
|
175
176
|
}
|
|
176
|
-
return addNewRow
|
|
177
|
+
return addNewRow(...addRowArgs, {
|
|
177
178
|
data: {
|
|
178
179
|
key: defaultKey || '',
|
|
179
180
|
value: ''
|
|
180
181
|
}
|
|
181
|
-
}
|
|
182
|
+
});
|
|
182
183
|
},
|
|
183
184
|
fieldsPath: fieldsPath
|
|
184
185
|
})]
|
|
@@ -200,7 +201,7 @@ FormKeyValueTable.defaultProps = {
|
|
|
200
201
|
keyLabel: 'Key',
|
|
201
202
|
keyOptions: null,
|
|
202
203
|
keyValidationRules: [],
|
|
203
|
-
onExitEditModeCallback:
|
|
204
|
+
onExitEditModeCallback: () => {},
|
|
204
205
|
valueHeader: 'Value',
|
|
205
206
|
valueLabel: 'Value',
|
|
206
207
|
valueValidationRules: []
|
|
@@ -228,5 +229,4 @@ FormKeyValueTable.propTypes = {
|
|
|
228
229
|
valueLabel: _propTypes.default.string,
|
|
229
230
|
valueValidationRules: _types.INPUT_VALIDATION_RULES
|
|
230
231
|
};
|
|
231
|
-
var _default = FormKeyValueTable;
|
|
232
|
-
exports.default = _default;
|
|
232
|
+
var _default = exports.default = FormKeyValueTable;
|
|
@@ -1,6 +1,5 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -11,7 +10,7 @@ var _reactFinalForm = require("react-final-form");
|
|
|
11
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
11
|
require("./FormRadio.scss");
|
|
13
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
14
|
/*
|
|
16
15
|
Copyright 2022 Iguazio Systems Ltd.
|
|
17
16
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -28,38 +27,36 @@ illegal under applicable law, and the grant of the foregoing license
|
|
|
28
27
|
under the Apache 2.0 license is conditioned upon your compliance with
|
|
29
28
|
such restriction.
|
|
30
29
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
name = _ref.name,
|
|
42
|
-
label = _ref.label,
|
|
43
|
-
readOnly = _ref.readOnly,
|
|
44
|
-
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
-
var formFieldClassNames = (0, _classnames.default)('form-field-radio', readOnly && 'form-field-radio_readonly', className);
|
|
30
|
+
|
|
31
|
+
const FormRadio = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
className,
|
|
34
|
+
name,
|
|
35
|
+
label,
|
|
36
|
+
readOnly,
|
|
37
|
+
...inputProps
|
|
38
|
+
} = _ref;
|
|
39
|
+
const formFieldClassNames = (0, _classnames.default)('form-field-radio', readOnly && 'form-field-radio_readonly', className);
|
|
46
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
47
41
|
name: name,
|
|
48
42
|
value: inputProps.value,
|
|
49
43
|
type: "radio",
|
|
50
|
-
children:
|
|
51
|
-
|
|
44
|
+
children: _ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
input
|
|
47
|
+
} = _ref2;
|
|
52
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
53
49
|
className: formFieldClassNames,
|
|
54
50
|
"data-testid": name ? "".concat(name, "-").concat(inputProps.value, "-form-radio") : 'form-field-radio',
|
|
55
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input",
|
|
51
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
56
52
|
className: (0, _classnames.default)(input.checked ? 'checked' : 'unchecked'),
|
|
57
53
|
type: "radio",
|
|
58
|
-
"data-testid": name ? "".concat(name, "-").concat(inputProps.value, "-radio") : 'form-radio'
|
|
59
|
-
|
|
54
|
+
"data-testid": name ? "".concat(name, "-").concat(inputProps.value, "-radio") : 'form-radio',
|
|
55
|
+
...input,
|
|
56
|
+
...inputProps,
|
|
60
57
|
checked: input.checked,
|
|
61
58
|
id: name + inputProps.value
|
|
62
|
-
})
|
|
59
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
63
60
|
htmlFor: name + inputProps.value,
|
|
64
61
|
children: label
|
|
65
62
|
})]
|
|
@@ -77,5 +74,4 @@ FormRadio.propTypes = {
|
|
|
77
74
|
name: _propTypes.default.string.isRequired,
|
|
78
75
|
readOnly: _propTypes.default.bool
|
|
79
76
|
};
|
|
80
|
-
var _default = /*#__PURE__*/_react.default.memo(FormRadio);
|
|
81
|
-
exports.default = _default;
|
|
77
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(FormRadio);
|