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
package/dist/scss/mixins.scss
CHANGED
|
@@ -976,6 +976,38 @@
|
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
+
@mixin statsAddBorderAndTextColor($border, $textColor) {
|
|
980
|
+
&.selected {
|
|
981
|
+
border: $border;
|
|
982
|
+
|
|
983
|
+
.stats__counter {
|
|
984
|
+
color: $textColor;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
&:hover {
|
|
989
|
+
border: $border;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
@mixin stats() {
|
|
994
|
+
&_total {
|
|
995
|
+
@include statsAddBorderAndTextColor($totalBorder, $black)
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
&_running {
|
|
999
|
+
@include statsAddBorderAndTextColor($runningBorder, $pictonBlue)
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
&_failed {
|
|
1003
|
+
@include statsAddBorderAndTextColor($failedBorder, $amaranth)
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
&_completed {
|
|
1007
|
+
@include statsAddBorderAndTextColor($completedBorder, $brightTurquoise)
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
979
1011
|
@mixin gradient($type) {
|
|
980
1012
|
@if $type == 'card' {
|
|
981
1013
|
background: linear-gradient(180deg, $brightTurquoise 4px, $white 4px);
|
package/dist/types.js
CHANGED
|
@@ -7,34 +7,30 @@ exports.WIZARD_STEPS_CONFIG = exports.SORT_PROPS = exports.SELECT_OPTIONS = expo
|
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _constants = require("./constants");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var BUTTON_VARIANTS = _propTypes.default.oneOf([_constants.DANGER_BUTTON, _constants.LABEL_BUTTON, _constants.PRIMARY_BUTTON, _constants.SECONDARY_BUTTON, _constants.TERTIARY_BUTTON]);
|
|
30
|
-
exports.BUTTON_VARIANTS = BUTTON_VARIANTS;
|
|
31
|
-
var CHIP = _propTypes.default.shape({
|
|
10
|
+
/*
|
|
11
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
12
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
13
|
+
an addition restriction as set forth herein. You may not use this
|
|
14
|
+
file except in compliance with the License. You may obtain a copy of
|
|
15
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
19
|
+
implied. See the License for the specific language governing
|
|
20
|
+
permissions and limitations under the License.
|
|
21
|
+
In addition, you may not use the software for any purposes that are
|
|
22
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
23
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
24
|
+
such restriction.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const BUTTON_VARIANTS = exports.BUTTON_VARIANTS = _propTypes.default.oneOf([_constants.DANGER_BUTTON, _constants.LABEL_BUTTON, _constants.PRIMARY_BUTTON, _constants.SECONDARY_BUTTON, _constants.TERTIARY_BUTTON]);
|
|
28
|
+
const CHIP = exports.CHIP = _propTypes.default.shape({
|
|
32
29
|
delimiter: _propTypes.default.element,
|
|
33
30
|
id: _propTypes.default.string,
|
|
34
31
|
value: _propTypes.default.string.isRequired
|
|
35
32
|
});
|
|
36
|
-
exports.
|
|
37
|
-
var CHIP_INPUT_LIST = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
33
|
+
const CHIP_INPUT_LIST = exports.CHIP_INPUT_LIST = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
38
34
|
disabled: _propTypes.default.bool,
|
|
39
35
|
icon: _propTypes.default.element,
|
|
40
36
|
id: _propTypes.default.string.isRequired,
|
|
@@ -42,8 +38,7 @@ var CHIP_INPUT_LIST = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
|
42
38
|
subLabel: _propTypes.default.string,
|
|
43
39
|
ui: _propTypes.default.shape({})
|
|
44
40
|
}));
|
|
45
|
-
exports.
|
|
46
|
-
var CHIP_OPTIONS = _propTypes.default.shape({
|
|
41
|
+
const CHIP_OPTIONS = exports.CHIP_OPTIONS = _propTypes.default.shape({
|
|
47
42
|
background: _propTypes.default.oneOf(['amethyst', 'green', 'grey', 'java', 'none', 'orange', 'purple', 'sorbus']),
|
|
48
43
|
boldValue: _propTypes.default.bool,
|
|
49
44
|
borderColor: _propTypes.default.oneOf(['transparent', 'orange', 'green', 'purple', 'grey']),
|
|
@@ -51,46 +46,37 @@ var CHIP_OPTIONS = _propTypes.default.shape({
|
|
|
51
46
|
font: _propTypes.default.oneOf(['primary', 'white', 'green', 'purple', 'orange']),
|
|
52
47
|
borderRadius: _propTypes.default.oneOf(['primary', 'secondary'])
|
|
53
48
|
});
|
|
54
|
-
exports.
|
|
55
|
-
|
|
56
|
-
exports.CHIPS = CHIPS;
|
|
57
|
-
var POP_UP_CUSTOM_POSITION = _propTypes.default.shape({
|
|
49
|
+
const CHIPS = exports.CHIPS = _propTypes.default.arrayOf(CHIP);
|
|
50
|
+
const POP_UP_CUSTOM_POSITION = exports.POP_UP_CUSTOM_POSITION = _propTypes.default.shape({
|
|
58
51
|
element: _propTypes.default.shape({}),
|
|
59
52
|
position: _propTypes.default.oneOf(['top-left', 'top-right', 'bottom-left', 'bottom-right']),
|
|
60
53
|
autoHorizontalPosition: _propTypes.default.bool,
|
|
61
54
|
autoVerticalPosition: _propTypes.default.bool
|
|
62
55
|
});
|
|
63
|
-
exports.
|
|
64
|
-
|
|
65
|
-
exports.MODAL_SIZES = MODAL_SIZES;
|
|
66
|
-
var CONFIRM_DIALOG_CANCEL_BUTTON = _propTypes.default.shape({
|
|
56
|
+
const MODAL_SIZES = exports.MODAL_SIZES = _propTypes.default.oneOf([_constants.MODAL_SM, _constants.MODAL_MD, _constants.MODAL_LG, _constants.MODAL_MIN, _constants.MODAL_MAX]);
|
|
57
|
+
const CONFIRM_DIALOG_CANCEL_BUTTON = exports.CONFIRM_DIALOG_CANCEL_BUTTON = _propTypes.default.shape({
|
|
67
58
|
handler: _propTypes.default.func,
|
|
68
59
|
label: _propTypes.default.string.isRequired,
|
|
69
60
|
variant: _propTypes.default.string.isRequired
|
|
70
61
|
});
|
|
71
|
-
exports.
|
|
72
|
-
|
|
73
|
-
exports.CONFIRM_DIALOG_MESSAGE = CONFIRM_DIALOG_MESSAGE;
|
|
74
|
-
var CONFIRM_DIALOG_SUBMIT_BUTTON = _propTypes.default.shape({
|
|
62
|
+
const CONFIRM_DIALOG_MESSAGE = exports.CONFIRM_DIALOG_MESSAGE = _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.string]);
|
|
63
|
+
const CONFIRM_DIALOG_SUBMIT_BUTTON = exports.CONFIRM_DIALOG_SUBMIT_BUTTON = _propTypes.default.shape({
|
|
75
64
|
handler: _propTypes.default.func.isRequired,
|
|
76
65
|
label: _propTypes.default.string.isRequired,
|
|
77
66
|
variant: _propTypes.default.string.isRequired
|
|
78
67
|
});
|
|
79
|
-
exports.
|
|
80
|
-
var WIZARD_STEPS_CONFIG = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
68
|
+
const WIZARD_STEPS_CONFIG = exports.WIZARD_STEPS_CONFIG = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
81
69
|
id: _propTypes.default.string.isRequired,
|
|
82
70
|
label: _propTypes.default.string.isRequired,
|
|
83
71
|
hidden: _propTypes.default.bool,
|
|
84
72
|
disabled: _propTypes.default.bool,
|
|
85
73
|
nextIsDisabled: _propTypes.default.bool
|
|
86
74
|
}));
|
|
87
|
-
exports.
|
|
88
|
-
var INPUT_LINK = _propTypes.default.shape({
|
|
75
|
+
const INPUT_LINK = exports.INPUT_LINK = _propTypes.default.shape({
|
|
89
76
|
show: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
|
|
90
77
|
url: _propTypes.default.string
|
|
91
78
|
});
|
|
92
|
-
exports.
|
|
93
|
-
var SELECT_OPTION = _propTypes.default.shape({
|
|
79
|
+
const SELECT_OPTION = exports.SELECT_OPTION = _propTypes.default.shape({
|
|
94
80
|
disabled: _propTypes.default.bool,
|
|
95
81
|
hidden: _propTypes.default.bool,
|
|
96
82
|
icon: _propTypes.default.element,
|
|
@@ -100,52 +86,42 @@ var SELECT_OPTION = _propTypes.default.shape({
|
|
|
100
86
|
status: _propTypes.default.string,
|
|
101
87
|
subLabel: _propTypes.default.string
|
|
102
88
|
});
|
|
103
|
-
exports.
|
|
104
|
-
|
|
105
|
-
exports.SELECT_OPTIONS = SELECT_OPTIONS;
|
|
106
|
-
var INPUT_VALIDATION_RULES = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
89
|
+
const SELECT_OPTIONS = exports.SELECT_OPTIONS = _propTypes.default.arrayOf(SELECT_OPTION);
|
|
90
|
+
const INPUT_VALIDATION_RULES = exports.INPUT_VALIDATION_RULES = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
107
91
|
name: _propTypes.default.string.isRequired,
|
|
108
92
|
label: _propTypes.default.string.isRequired,
|
|
109
93
|
pattern: _propTypes.default.oneOfType([_propTypes.default.instanceOf(RegExp), _propTypes.default.func]).isRequired,
|
|
110
94
|
isValid: _propTypes.default.bool
|
|
111
95
|
}));
|
|
112
|
-
exports.
|
|
113
|
-
var COMBOBOX_SUGGESTION_LIST = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
96
|
+
const COMBOBOX_SUGGESTION_LIST = exports.COMBOBOX_SUGGESTION_LIST = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
114
97
|
customDelimiter: _propTypes.default.string,
|
|
115
98
|
id: _propTypes.default.string.isRequired,
|
|
116
99
|
label: _propTypes.default.string.isRequired
|
|
117
100
|
}));
|
|
118
|
-
exports.
|
|
119
|
-
var COMBOBOX_VALIDATION_RULES = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
101
|
+
const COMBOBOX_VALIDATION_RULES = exports.COMBOBOX_VALIDATION_RULES = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
120
102
|
name: _propTypes.default.string.isRequired,
|
|
121
103
|
label: _propTypes.default.string.isRequired,
|
|
122
104
|
isValid: _propTypes.default.bool
|
|
123
105
|
}));
|
|
124
|
-
exports.
|
|
125
|
-
var COMBOBOX_SELECT_OPTIONS = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
106
|
+
const COMBOBOX_SELECT_OPTIONS = exports.COMBOBOX_SELECT_OPTIONS = _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
126
107
|
className: _propTypes.default.string,
|
|
127
108
|
id: _propTypes.default.string.isRequired,
|
|
128
109
|
label: _propTypes.default.string.isRequired
|
|
129
110
|
}));
|
|
130
|
-
exports.
|
|
131
|
-
var FORM_TABLE_EDITING_ITEM = _propTypes.default.shape(_defineProperty({
|
|
111
|
+
const FORM_TABLE_EDITING_ITEM = exports.FORM_TABLE_EDITING_ITEM = _propTypes.default.shape({
|
|
132
112
|
data: _propTypes.default.shape({}).isRequired,
|
|
133
113
|
ui: _propTypes.default.shape({
|
|
134
114
|
isNew: _propTypes.default.bool,
|
|
135
115
|
index: _propTypes.default.number.isRequired,
|
|
136
116
|
fieldsPath: _propTypes.default.string.isRequired
|
|
137
|
-
}).isRequired
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
117
|
+
}).isRequired,
|
|
118
|
+
[_propTypes.default.string]: _propTypes.default.any
|
|
119
|
+
});
|
|
120
|
+
const SORT_PROPS = exports.SORT_PROPS = _propTypes.default.shape({
|
|
141
121
|
selectedColumnName: _propTypes.default.string.isRequired,
|
|
142
122
|
getSortingIcon: _propTypes.default.func.isRequired,
|
|
143
123
|
sortTable: _propTypes.default.func.isRequired
|
|
144
124
|
});
|
|
145
|
-
exports.
|
|
146
|
-
|
|
147
|
-
exports.
|
|
148
|
-
var DEFAULT_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]);
|
|
149
|
-
exports.DEFAULT_SORT_BY = DEFAULT_SORT_BY;
|
|
150
|
-
var EXCLUDE_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string, _propTypes.default.number)]);
|
|
151
|
-
exports.EXCLUDE_SORT_BY = EXCLUDE_SORT_BY;
|
|
125
|
+
const ALLOW_SORT_BY = exports.ALLOW_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string, _propTypes.default.number)]);
|
|
126
|
+
const DEFAULT_SORT_BY = exports.DEFAULT_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]);
|
|
127
|
+
const EXCLUDE_SORT_BY = exports.EXCLUDE_SORT_BY = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string, _propTypes.default.number)]);
|
|
@@ -25,11 +25,11 @@ under the Apache 2.0 license is conditioned upon your compliance with
|
|
|
25
25
|
such restriction.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const openPopUp = (element, props) => {
|
|
29
29
|
return (0, _reactModalPromise.create)(element)(props);
|
|
30
30
|
};
|
|
31
31
|
exports.openPopUp = openPopUp;
|
|
32
|
-
|
|
32
|
+
const openConfirmPopUp = (message, confirmHandler) => {
|
|
33
33
|
return openPopUp(_components.ConfirmDialog, {
|
|
34
34
|
cancelButton: {
|
|
35
35
|
label: 'Cancel',
|
|
@@ -41,11 +41,11 @@ var openConfirmPopUp = function openConfirmPopUp(message, confirmHandler) {
|
|
|
41
41
|
handler: confirmHandler
|
|
42
42
|
},
|
|
43
43
|
header: 'Are you sure?',
|
|
44
|
-
message
|
|
44
|
+
message
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
exports.openConfirmPopUp = openConfirmPopUp;
|
|
48
|
-
|
|
48
|
+
const openDeleteConfirmPopUp = (header, message, confirmHandler) => {
|
|
49
49
|
return openPopUp(_components.ConfirmDialog, {
|
|
50
50
|
cancelButton: {
|
|
51
51
|
label: 'Cancel',
|
|
@@ -56,23 +56,19 @@ var openDeleteConfirmPopUp = function openDeleteConfirmPopUp(header, message, co
|
|
|
56
56
|
variant: _constants.DANGER_BUTTON,
|
|
57
57
|
handler: confirmHandler
|
|
58
58
|
},
|
|
59
|
-
header
|
|
60
|
-
message
|
|
59
|
+
header,
|
|
60
|
+
message
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
exports.openDeleteConfirmPopUp = openDeleteConfirmPopUp;
|
|
64
|
-
|
|
65
|
-
return Object.values(obj).every(function (item) {
|
|
66
|
-
return !item || item.length === 0;
|
|
67
|
-
});
|
|
68
|
-
};
|
|
64
|
+
const isEveryObjectValueEmpty = obj => Object.values(obj).every(item => !item || item.length === 0);
|
|
69
65
|
|
|
70
66
|
// Checks, whether two arrays of objects are equal, can omit some keys if their comparison is not necessary
|
|
71
67
|
exports.isEveryObjectValueEmpty = isEveryObjectValueEmpty;
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
const areArraysEqual = function (firstArray, secondArray) {
|
|
69
|
+
let omitBy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
74
70
|
if (firstArray.length !== secondArray.length) return false;
|
|
75
|
-
return (0, _lodash.isEmpty)((0, _lodash.differenceWith)(firstArray, secondArray,
|
|
71
|
+
return (0, _lodash.isEmpty)((0, _lodash.differenceWith)(firstArray, secondArray, (a, b) => {
|
|
76
72
|
return (0, _lodash.isEqual)((0, _lodash.omit)(a, omitBy), (0, _lodash.omit)(b, omitBy));
|
|
77
73
|
}));
|
|
78
74
|
};
|
|
@@ -84,8 +80,8 @@ var areArraysEqual = function areArraysEqual(firstArray, secondArray) {
|
|
|
84
80
|
* @returns {string} - The detailed error information.
|
|
85
81
|
*/
|
|
86
82
|
exports.areArraysEqual = areArraysEqual;
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
const getErrorDetail = error => {
|
|
84
|
+
const errorDetail = (0, _lodash.get)(error, 'response.data.detail', null);
|
|
89
85
|
if (typeof errorDetail === 'string') {
|
|
90
86
|
return errorDetail;
|
|
91
87
|
} else {
|
|
@@ -101,9 +97,9 @@ var getErrorDetail = function getErrorDetail(error) {
|
|
|
101
97
|
* @returns {string} - The error message.
|
|
102
98
|
*/
|
|
103
99
|
exports.getErrorDetail = getErrorDetail;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
const getErrorMsg = (error, defaultError) => {
|
|
101
|
+
const errorDetail = getErrorDetail(error);
|
|
102
|
+
const errorMsg = errorDetail || error.message;
|
|
107
103
|
if ((!errorMsg || errorMsg === 'Not Found' || errorMsg.startsWith('Request failed with status code')) && defaultError) {
|
|
108
104
|
return defaultError;
|
|
109
105
|
} else {
|
|
@@ -117,15 +113,15 @@ var getErrorMsg = function getErrorMsg(error, defaultError) {
|
|
|
117
113
|
* @returns {string} The transition end event name.
|
|
118
114
|
*/
|
|
119
115
|
exports.getErrorMsg = getErrorMsg;
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
const getTransitionEndEventName = () => {
|
|
117
|
+
const transitions = {
|
|
122
118
|
transition: 'transitionend',
|
|
123
119
|
OTransition: 'oTransitionEnd',
|
|
124
120
|
MozTransition: 'transitionend',
|
|
125
121
|
WebkitTransition: 'webkitTransitionEnd'
|
|
126
122
|
};
|
|
127
|
-
|
|
128
|
-
for (
|
|
123
|
+
let bodyStyle = document.body.style;
|
|
124
|
+
for (let transition in transitions) {
|
|
129
125
|
if (bodyStyle[transition] !== undefined) {
|
|
130
126
|
return transitions[transition];
|
|
131
127
|
}
|
package/dist/utils/form.util.js
CHANGED
|
@@ -5,40 +5,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.setFieldState = exports.parseObjectToKeyValue = exports.generateObjectFromKeyValue = exports.areFormValuesChanged = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var setFieldState = function setFieldState(args, state) {
|
|
30
|
-
var fieldName = args[0];
|
|
31
|
-
var states = args[1];
|
|
32
|
-
var field = state.fields[fieldName];
|
|
8
|
+
/*
|
|
9
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
11
|
+
an addition restriction as set forth herein. You may not use this
|
|
12
|
+
file except in compliance with the License. You may obtain a copy of
|
|
13
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
17
|
+
implied. See the License for the specific language governing
|
|
18
|
+
permissions and limitations under the License.
|
|
19
|
+
In addition, you may not use the software for any purposes that are
|
|
20
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
21
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
22
|
+
such restriction.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const setFieldState = (args, state) => {
|
|
26
|
+
let fieldName = args[0];
|
|
27
|
+
let states = args[1];
|
|
28
|
+
let field = state.fields[fieldName];
|
|
33
29
|
if (field) {
|
|
34
|
-
for (
|
|
30
|
+
for (let stateName in states) {
|
|
35
31
|
(0, _lodash.set)(field, stateName, states[stateName]);
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
35
|
exports.setFieldState = setFieldState;
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const areFormValuesChanged = (initialValues, values) => {
|
|
37
|
+
const replacer = (key, value) => {
|
|
42
38
|
if (value === '') {
|
|
43
39
|
return undefined;
|
|
44
40
|
}
|
|
@@ -47,24 +43,22 @@ var areFormValuesChanged = function areFormValuesChanged(initialValues, values)
|
|
|
47
43
|
return !(0, _lodash.isEqual)(JSON.stringify(initialValues, replacer), JSON.stringify(values, replacer));
|
|
48
44
|
};
|
|
49
45
|
exports.areFormValuesChanged = areFormValuesChanged;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return keyValueList.reduce(
|
|
46
|
+
const generateObjectFromKeyValue = function () {
|
|
47
|
+
let keyValueList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
48
|
+
return keyValueList.reduce((acc, keyValue) => {
|
|
53
49
|
acc[keyValue.data.key] = keyValue.data.value;
|
|
54
50
|
return acc;
|
|
55
51
|
}, {});
|
|
56
52
|
};
|
|
57
53
|
exports.generateObjectFromKeyValue = generateObjectFromKeyValue;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return Object.entries(object).map(
|
|
61
|
-
|
|
62
|
-
key = _ref2[0],
|
|
63
|
-
value = _ref2[1];
|
|
54
|
+
const parseObjectToKeyValue = function () {
|
|
55
|
+
let object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
56
|
+
return Object.entries(object).map(_ref => {
|
|
57
|
+
let [key, value] = _ref;
|
|
64
58
|
return {
|
|
65
59
|
data: {
|
|
66
|
-
key
|
|
67
|
-
value
|
|
60
|
+
key,
|
|
61
|
+
value
|
|
68
62
|
}
|
|
69
63
|
};
|
|
70
64
|
});
|
|
@@ -20,15 +20,15 @@ illegal under applicable law, and the grant of the foregoing license
|
|
|
20
20
|
under the Apache 2.0 license is conditioned upon your compliance with
|
|
21
21
|
such restriction.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
const generateChipsList = (chips, maxLength) => {
|
|
24
24
|
if (chips.length > maxLength) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
let hiddenChipsNumber = "+ ".concat(chips.length - maxLength);
|
|
26
|
+
const hiddenChips = chips.slice(maxLength);
|
|
27
|
+
const visibleChips = chips.slice(0, maxLength);
|
|
28
28
|
return {
|
|
29
|
-
visibleChips
|
|
30
|
-
hiddenChips
|
|
31
|
-
hiddenChipsNumber
|
|
29
|
+
visibleChips,
|
|
30
|
+
hiddenChips,
|
|
31
|
+
hiddenChipsNumber
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
@@ -20,7 +20,7 @@ illegal under applicable law, and the grant of the foregoing license
|
|
|
20
20
|
under the Apache 2.0 license is conditioned upon your compliance with
|
|
21
21
|
such restriction.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
const regex = /(auto|scroll|hidden)/;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Retrieves the computed style of a node for the specified CSS property.
|
|
@@ -29,9 +29,7 @@ var regex = /(auto|scroll|hidden)/;
|
|
|
29
29
|
* @param {string} prop - The CSS property to retrieve.
|
|
30
30
|
* @returns {string} The computed style value.
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
return getComputedStyle(node, null).getPropertyValue(prop);
|
|
34
|
-
};
|
|
32
|
+
const style = (node, prop) => getComputedStyle(node, null).getPropertyValue(prop);
|
|
35
33
|
|
|
36
34
|
/**
|
|
37
35
|
* Checks if the given node has a scrollable overflow.
|
|
@@ -39,9 +37,7 @@ var style = function style(node, prop) {
|
|
|
39
37
|
* @param {Node} node - The DOM node.
|
|
40
38
|
* @returns {boolean} Returns true if the node has a scrollable overflow, false otherwise.
|
|
41
39
|
*/
|
|
42
|
-
|
|
43
|
-
return regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
|
|
44
|
-
};
|
|
40
|
+
const scroll = node => regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
|
|
45
41
|
|
|
46
42
|
/**
|
|
47
43
|
* Finds the first scrollable parent node of the given node.
|
|
@@ -49,7 +45,5 @@ var scroll = function scroll(node) {
|
|
|
49
45
|
* @param {Node} node - The DOM node.
|
|
50
46
|
* @returns {Node} The first scrollable parent node.
|
|
51
47
|
*/
|
|
52
|
-
|
|
53
|
-
return !node || node === document.body ? document.body : scroll(node) ? node : getFirstScrollableParent(node.parentNode);
|
|
54
|
-
};
|
|
48
|
+
const getFirstScrollableParent = node => !node || node === document.body ? document.body : scroll(node) ? node : getFirstScrollableParent(node.parentNode);
|
|
55
49
|
exports.getFirstScrollableParent = getFirstScrollableParent;
|
package/dist/utils/math.util.js
CHANGED
|
@@ -29,9 +29,9 @@ such restriction.
|
|
|
29
29
|
* @param {string} operator - The operator to use for the operation. Supported operators are '+', and '-'.
|
|
30
30
|
* @returns {number} The result of the arithmetic operation.
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const performFloatOperation = (num1, num2, operator) => {
|
|
33
|
+
const precision = Math.max((num1.toString().split('.')[1] || '').length, (num2.toString().split('.')[1] || '').length);
|
|
34
|
+
const multiplier = Math.pow(10, precision);
|
|
35
35
|
switch (operator) {
|
|
36
36
|
case '+':
|
|
37
37
|
return (Math.round(num1 * multiplier) + Math.round(num2 * multiplier)) / multiplier;
|