iguazio.dashboard-react-controls 1.2.4 → 1.3.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/FormCheckBox/FormCheckBox.js +12 -5
- package/dist/components/FormCheckBox/formCheckBox.scss +4 -0
- package/dist/components/FormRadio/FormRadio.js +8 -6
- package/dist/components/FormRadio/FormRadio.scss +5 -0
- package/dist/components/FormToggle/FormToggle.js +91 -0
- package/dist/components/FormToggle/formToggle.scss +65 -0
- package/dist/components/index.js +8 -1
- package/dist/elements/FormRowActions/FormRowActions.js +10 -0
- package/dist/scss/common.scss +9 -2
- package/dist/scss/mixins.scss +27 -9
- package/dist/utils/common.util.js +11 -2
- package/package.json +1 -1
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _reactFinalForm = require("react-final-form");
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
require("./formCheckBox.scss");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _excluded = ["children", "className", "highlightLabel", "label", "name"];
|
|
14
|
+
var _excluded = ["children", "className", "highlightLabel", "label", "name", "readOnly"];
|
|
15
15
|
/*
|
|
16
16
|
Copyright 2022 Iguazio Systems Ltd.
|
|
17
17
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -29,6 +29,8 @@ under the Apache 2.0 license is conditioned upon your compliance with
|
|
|
29
29
|
such restriction.
|
|
30
30
|
*/
|
|
31
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
+
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); }
|
|
33
|
+
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; }
|
|
32
34
|
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; }
|
|
33
35
|
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; }
|
|
34
36
|
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; }
|
|
@@ -42,9 +44,11 @@ var FormCheckBox = function FormCheckBox(_ref) {
|
|
|
42
44
|
highlightLabel = _ref.highlightLabel,
|
|
43
45
|
label = _ref.label,
|
|
44
46
|
name = _ref.name,
|
|
47
|
+
readOnly = _ref.readOnly,
|
|
45
48
|
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
var formFieldClassNames = (0, _classnames.default)('form-field-checkbox', className);
|
|
49
|
+
var formFieldClassNames = (0, _classnames.default)('form-field-checkbox', readOnly && 'form-field-checkbox_readonly', className);
|
|
47
50
|
var labelClassNames = (0, _classnames.default)(highlightLabel && 'highlighted');
|
|
51
|
+
var inputRef = (0, _react.useRef)();
|
|
48
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
49
53
|
name: name,
|
|
50
54
|
value: inputProps.value,
|
|
@@ -55,6 +59,7 @@ var FormCheckBox = function FormCheckBox(_ref) {
|
|
|
55
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
56
60
|
className: formFieldClassNames,
|
|
57
61
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
|
62
|
+
ref: inputRef,
|
|
58
63
|
className: (0, _classnames.default)(input.checked ? 'checked' : 'unchecked'),
|
|
59
64
|
type: "checkbox",
|
|
60
65
|
"data-testid": "checkbox",
|
|
@@ -73,13 +78,15 @@ var FormCheckBox = function FormCheckBox(_ref) {
|
|
|
73
78
|
FormCheckBox.defaultProps = {
|
|
74
79
|
className: '',
|
|
75
80
|
highlightLabel: false,
|
|
76
|
-
label: ''
|
|
81
|
+
label: '',
|
|
82
|
+
readOnly: false
|
|
77
83
|
};
|
|
78
84
|
FormCheckBox.propTypes = {
|
|
79
85
|
className: _propTypes.default.string,
|
|
80
86
|
highlightLabel: _propTypes.default.bool,
|
|
81
87
|
name: _propTypes.default.string.isRequired,
|
|
82
|
-
label: _propTypes.default.string
|
|
88
|
+
label: _propTypes.default.string,
|
|
89
|
+
readOnly: _propTypes.default.bool
|
|
83
90
|
};
|
|
84
91
|
var _default = /*#__PURE__*/_react.default.memo(FormCheckBox);
|
|
85
92
|
exports.default = _default;
|
|
@@ -11,7 +11,7 @@ var _reactFinalForm = require("react-final-form");
|
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
require("./FormRadio.scss");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _excluded = ["className", "name", "label"];
|
|
14
|
+
var _excluded = ["className", "name", "label", "readOnly"];
|
|
15
15
|
/*
|
|
16
16
|
Copyright 2022 Iguazio Systems Ltd.
|
|
17
17
|
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
@@ -40,8 +40,9 @@ var FormRadio = function FormRadio(_ref) {
|
|
|
40
40
|
var className = _ref.className,
|
|
41
41
|
name = _ref.name,
|
|
42
42
|
label = _ref.label,
|
|
43
|
+
readOnly = _ref.readOnly,
|
|
43
44
|
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
-
var formFieldClassNames = (0, _classnames.default)('form-field-radio', className);
|
|
45
|
+
var formFieldClassNames = (0, _classnames.default)('form-field-radio', readOnly && 'form-field-radio_readonly', className);
|
|
45
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
46
47
|
name: name,
|
|
47
48
|
value: inputProps.value,
|
|
@@ -51,9 +52,9 @@ var FormRadio = function FormRadio(_ref) {
|
|
|
51
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
52
53
|
className: formFieldClassNames,
|
|
53
54
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({}, _objectSpread(_objectSpread({}, input), inputProps)), {}, {
|
|
54
|
-
id: inputProps.value
|
|
55
|
+
id: name + inputProps.value
|
|
55
56
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
56
|
-
htmlFor: inputProps.value,
|
|
57
|
+
htmlFor: name + inputProps.value,
|
|
57
58
|
children: label
|
|
58
59
|
})]
|
|
59
60
|
});
|
|
@@ -62,12 +63,13 @@ var FormRadio = function FormRadio(_ref) {
|
|
|
62
63
|
};
|
|
63
64
|
FormRadio.defaultProps = {
|
|
64
65
|
className: '',
|
|
65
|
-
|
|
66
|
+
readOnly: false
|
|
66
67
|
};
|
|
67
68
|
FormRadio.propTypes = {
|
|
68
69
|
className: _propTypes.default.string,
|
|
70
|
+
label: _propTypes.default.string.isRequired,
|
|
69
71
|
name: _propTypes.default.string.isRequired,
|
|
70
|
-
|
|
72
|
+
readOnly: _propTypes.default.bool
|
|
71
73
|
};
|
|
72
74
|
var _default = /*#__PURE__*/_react.default.memo(FormRadio);
|
|
73
75
|
exports.default = _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _reactFinalForm = require("react-final-form");
|
|
12
|
+
require("./formToggle.scss");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
var _excluded = ["className", "label", "name", "onChange", "readOnly"];
|
|
15
|
+
/*
|
|
16
|
+
Copyright 2022 Iguazio Systems Ltd.
|
|
17
|
+
Licensed under the Apache License, Version 2.0 (the "License") with
|
|
18
|
+
an addition restriction as set forth herein. You may not use this
|
|
19
|
+
file except in compliance with the License. You may obtain a copy of
|
|
20
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
21
|
+
Unless required by applicable law or agreed to in writing, software
|
|
22
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
23
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
24
|
+
implied. See the License for the specific language governing
|
|
25
|
+
permissions and limitations under the License.
|
|
26
|
+
In addition, you may not use the software for any purposes that are
|
|
27
|
+
illegal under applicable law, and the grant of the foregoing license
|
|
28
|
+
under the Apache 2.0 license is conditioned upon your compliance with
|
|
29
|
+
such restriction.
|
|
30
|
+
*/
|
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
36
|
+
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); }
|
|
37
|
+
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; }
|
|
38
|
+
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; }
|
|
39
|
+
var FormToggle = function FormToggle(_ref) {
|
|
40
|
+
var className = _ref.className,
|
|
41
|
+
label = _ref.label,
|
|
42
|
+
name = _ref.name,
|
|
43
|
+
_onChange = _ref.onChange,
|
|
44
|
+
readOnly = _ref.readOnly,
|
|
45
|
+
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
47
|
+
name: name,
|
|
48
|
+
value: inputProps.value,
|
|
49
|
+
type: "checkbox",
|
|
50
|
+
children: function children(_ref2) {
|
|
51
|
+
var input = _ref2.input;
|
|
52
|
+
var toggleClassName = (0, _classnames.default)('form-field-toggle', className, readOnly && 'form-field-toggle_readonly', input.checked && 'form-field-toggle_checked');
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
54
|
+
className: toggleClassName,
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
|
56
|
+
"data-testid": "toggle",
|
|
57
|
+
id: name
|
|
58
|
+
}, _objectSpread(_objectSpread({}, input), inputProps)), {}, {
|
|
59
|
+
onChange: function onChange(event) {
|
|
60
|
+
_onChange && _onChange(event);
|
|
61
|
+
input.onChange(event);
|
|
62
|
+
},
|
|
63
|
+
type: "checkbox"
|
|
64
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
|
+
className: "form-field-toggle__switch",
|
|
66
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
67
|
+
className: "form-field-toggle__switch-button"
|
|
68
|
+
})
|
|
69
|
+
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
70
|
+
className: "form-field-toggle__label",
|
|
71
|
+
children: label
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
FormToggle.defaultProps = {
|
|
78
|
+
className: '',
|
|
79
|
+
label: '',
|
|
80
|
+
onChange: function onChange() {},
|
|
81
|
+
readOnly: false
|
|
82
|
+
};
|
|
83
|
+
FormToggle.propTypes = {
|
|
84
|
+
className: _propTypes.default.string,
|
|
85
|
+
label: _propTypes.default.string,
|
|
86
|
+
name: _propTypes.default.string.isRequired,
|
|
87
|
+
onChange: _propTypes.default.func,
|
|
88
|
+
readOnly: _propTypes.default.bool
|
|
89
|
+
};
|
|
90
|
+
var _default = FormToggle;
|
|
91
|
+
exports.default = _default;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@import '~igz-controls/scss/colors';
|
|
2
|
+
|
|
3
|
+
.form-field-toggle {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
font-size: 16px;
|
|
7
|
+
line-height: 24px;
|
|
8
|
+
|
|
9
|
+
&__switch {
|
|
10
|
+
height: 24px;
|
|
11
|
+
width: 48px;
|
|
12
|
+
display: flex;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background-color: $alto;
|
|
16
|
+
border-radius: 20px;
|
|
17
|
+
transition: all 0.2s ease;
|
|
18
|
+
|
|
19
|
+
&-button {
|
|
20
|
+
width: 20px;
|
|
21
|
+
height: 20px;
|
|
22
|
+
background-color: $white;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
transform: translateX(2px);
|
|
25
|
+
transition: all 0.2s ease;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__label {
|
|
30
|
+
margin-left: 10px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&_readonly {
|
|
34
|
+
opacity: 0.5;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
|
|
37
|
+
.form-field-toggle__switch {
|
|
38
|
+
cursor: default;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.form-field-toggle_checked {
|
|
42
|
+
.form-field-toggle__switch {
|
|
43
|
+
&-button {
|
|
44
|
+
opacity: 0.5;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&_checked {
|
|
51
|
+
.form-field-toggle__switch {
|
|
52
|
+
background-color: $malibu;
|
|
53
|
+
|
|
54
|
+
&-button {
|
|
55
|
+
transform: translateX(26px);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
input[type='checkbox'] {
|
|
61
|
+
display: none;
|
|
62
|
+
width: 0;
|
|
63
|
+
height: 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
package/dist/components/index.js
CHANGED
|
@@ -63,6 +63,12 @@ Object.defineProperty(exports, "FormTextarea", {
|
|
|
63
63
|
return _FormTextarea.default;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "FormToggle", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _FormToggle.default;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
66
72
|
Object.defineProperty(exports, "Modal", {
|
|
67
73
|
enumerable: true,
|
|
68
74
|
get: function get() {
|
|
@@ -109,7 +115,9 @@ var _Button = _interopRequireDefault(require("./Button/Button"));
|
|
|
109
115
|
var _ConfirmDialog = _interopRequireDefault(require("./ConfirmDialog/ConfirmDialog"));
|
|
110
116
|
var _FormCheckBox = _interopRequireDefault(require("./FormCheckBox/FormCheckBox"));
|
|
111
117
|
var _FormChipCell = _interopRequireDefault(require("./FormChipCell/FormChipCell"));
|
|
118
|
+
var _FormCombobox = _interopRequireDefault(require("./FormCombobox/FormCombobox"));
|
|
112
119
|
var _FormInput = _interopRequireDefault(require("./FormInput/FormInput"));
|
|
120
|
+
var _FormToggle = _interopRequireDefault(require("./FormToggle/FormToggle"));
|
|
113
121
|
var _FormKeyValueTable = _interopRequireDefault(require("./FormKeyValueTable/FormKeyValueTable"));
|
|
114
122
|
var _FormRadio = _interopRequireDefault(require("./FormRadio/FormRadio"));
|
|
115
123
|
var _FormSelect = _interopRequireDefault(require("./FormSelect/FormSelect"));
|
|
@@ -121,5 +129,4 @@ var _TextTooltipTemplate = _interopRequireDefault(require("./TooltipTemplate/Tex
|
|
|
121
129
|
var _Tip = _interopRequireDefault(require("./Tip/Tip"));
|
|
122
130
|
var _Tooltip = _interopRequireDefault(require("./Tooltip/Tooltip"));
|
|
123
131
|
var _Wizard = _interopRequireDefault(require("./Wizard/Wizard"));
|
|
124
|
-
var _FormCombobox = _interopRequireDefault(require("./FormCombobox/FormCombobox"));
|
|
125
132
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -37,7 +37,9 @@ such restriction.
|
|
|
37
37
|
var FormRowActions = function FormRowActions(_ref) {
|
|
38
38
|
var _editingItem$ui, _editingItem$ui2, _editingItem$ui3;
|
|
39
39
|
var applyChanges = _ref.applyChanges,
|
|
40
|
+
deleteIsDisabled = _ref.deleteIsDisabled,
|
|
40
41
|
deleteRow = _ref.deleteRow,
|
|
42
|
+
disabled = _ref.disabled,
|
|
41
43
|
discardOrDelete = _ref.discardOrDelete,
|
|
42
44
|
editingItem = _ref.editingItem,
|
|
43
45
|
fieldsPath = _ref.fieldsPath,
|
|
@@ -50,12 +52,14 @@ var FormRowActions = function FormRowActions(_ref) {
|
|
|
50
52
|
return applyChanges(event, index);
|
|
51
53
|
},
|
|
52
54
|
tooltipText: "Apply",
|
|
55
|
+
disabled: disabled,
|
|
53
56
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkmark.ReactComponent, {})
|
|
54
57
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
|
|
55
58
|
onClick: function onClick(event) {
|
|
56
59
|
return discardOrDelete(event, fieldsPath, index);
|
|
57
60
|
},
|
|
58
61
|
tooltipText: (_editingItem$ui2 = editingItem.ui) !== null && _editingItem$ui2 !== void 0 && _editingItem$ui2.isNew ? 'Delete' : 'Discard changes',
|
|
62
|
+
disabled: disabled,
|
|
59
63
|
children: (_editingItem$ui3 = editingItem.ui) !== null && _editingItem$ui3 !== void 0 && _editingItem$ui3.isNew ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.ReactComponent, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_close.ReactComponent, {})
|
|
60
64
|
})]
|
|
61
65
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -65,23 +69,29 @@ var FormRowActions = function FormRowActions(_ref) {
|
|
|
65
69
|
event.preventDefault();
|
|
66
70
|
},
|
|
67
71
|
tooltipText: "Edit",
|
|
72
|
+
disabled: disabled,
|
|
68
73
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_edit.ReactComponent, {})
|
|
69
74
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RoundedIcon, {
|
|
70
75
|
onClick: function onClick(event) {
|
|
71
76
|
deleteRow(event, fieldsPath, index);
|
|
72
77
|
},
|
|
73
78
|
tooltipText: "Delete",
|
|
79
|
+
disabled: disabled || deleteIsDisabled,
|
|
74
80
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.ReactComponent, {})
|
|
75
81
|
})]
|
|
76
82
|
})
|
|
77
83
|
});
|
|
78
84
|
};
|
|
79
85
|
FormRowActions.defaultProps = {
|
|
86
|
+
deleteIsDisabled: false,
|
|
87
|
+
disabled: false,
|
|
80
88
|
editingItem: null
|
|
81
89
|
};
|
|
82
90
|
FormRowActions.propTypes = {
|
|
83
91
|
applyChanges: _propTypes.default.func.isRequired,
|
|
92
|
+
deleteIsDisabled: _propTypes.default.bool,
|
|
84
93
|
deleteRow: _propTypes.default.func.isRequired,
|
|
94
|
+
disabled: _propTypes.default.bool,
|
|
85
95
|
discardOrDelete: _propTypes.default.func.isRequired,
|
|
86
96
|
editingItem: _types.FORM_TABLE_EDITING_ITEM,
|
|
87
97
|
fieldsPath: _propTypes.default.string.isRequired,
|
package/dist/scss/common.scss
CHANGED
|
@@ -127,6 +127,7 @@ textarea {
|
|
|
127
127
|
.form-table {
|
|
128
128
|
$tableHeaderHeight: 50px;
|
|
129
129
|
|
|
130
|
+
width: 100%;
|
|
130
131
|
max-height: 500px;
|
|
131
132
|
overflow: hidden;
|
|
132
133
|
overflow-y: auto;
|
|
@@ -152,7 +153,8 @@ textarea {
|
|
|
152
153
|
|
|
153
154
|
.form-table__cell {
|
|
154
155
|
&:not(.form-table__actions-cell) {
|
|
155
|
-
padding:
|
|
156
|
+
padding-top: 6px;
|
|
157
|
+
padding-bottom: 6px;
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
160
|
}
|
|
@@ -215,7 +217,7 @@ textarea {
|
|
|
215
217
|
display: flex;
|
|
216
218
|
overflow: hidden;
|
|
217
219
|
align-items: center;
|
|
218
|
-
padding: 3px
|
|
220
|
+
padding: 3px 10px;
|
|
219
221
|
color: $primary;
|
|
220
222
|
|
|
221
223
|
&.disabled {
|
|
@@ -223,6 +225,11 @@ textarea {
|
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
|
|
228
|
+
.form-table__cell_min {
|
|
229
|
+
flex: 0.1;
|
|
230
|
+
min-width: 30px;
|
|
231
|
+
}
|
|
232
|
+
|
|
226
233
|
.form-table__cell_1 {
|
|
227
234
|
flex: 1;
|
|
228
235
|
}
|
package/dist/scss/mixins.scss
CHANGED
|
@@ -999,9 +999,12 @@
|
|
|
999
999
|
color: $topaz;
|
|
1000
1000
|
font-size: 12px;
|
|
1001
1001
|
text-align: left;
|
|
1002
|
-
text-transform: capitalize;
|
|
1003
1002
|
background-color: transparent;
|
|
1004
1003
|
|
|
1004
|
+
&::first-letter {
|
|
1005
|
+
text-transform: uppercase;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1005
1008
|
&-mandatory {
|
|
1006
1009
|
color: $amaranth;
|
|
1007
1010
|
}
|
|
@@ -1074,6 +1077,18 @@
|
|
|
1074
1077
|
}
|
|
1075
1078
|
}
|
|
1076
1079
|
|
|
1080
|
+
@mixin radioCheckReadonly {
|
|
1081
|
+
input {
|
|
1082
|
+
pointer-events: none;
|
|
1083
|
+
opacity: 0.5;
|
|
1084
|
+
|
|
1085
|
+
~ label {
|
|
1086
|
+
pointer-events: none;
|
|
1087
|
+
opacity: 0.5;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1077
1092
|
@mixin radioCheckField {
|
|
1078
1093
|
position: relative;
|
|
1079
1094
|
background: $white;
|
|
@@ -1099,6 +1114,7 @@
|
|
|
1099
1114
|
color: $spunPearl;
|
|
1100
1115
|
border-color: currentColor;
|
|
1101
1116
|
cursor: not-allowed;
|
|
1117
|
+
pointer-events: none;
|
|
1102
1118
|
|
|
1103
1119
|
&:hover {
|
|
1104
1120
|
color: $spunPearl;
|
|
@@ -1111,11 +1127,6 @@
|
|
|
1111
1127
|
}
|
|
1112
1128
|
}
|
|
1113
1129
|
|
|
1114
|
-
&:focus:not(:disabled),
|
|
1115
|
-
&:active:not(:disabled) {
|
|
1116
|
-
animation: pulse-animation 0.5s ease-out;
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
1130
|
@keyframes pulse-animation {
|
|
1120
1131
|
20% {
|
|
1121
1132
|
box-shadow: 0 0 0 0 rgba($cornflowerBlue, 0.5);
|
|
@@ -1125,9 +1136,16 @@
|
|
|
1125
1136
|
}
|
|
1126
1137
|
}
|
|
1127
1138
|
|
|
1128
|
-
&:
|
|
1129
|
-
|
|
1130
|
-
|
|
1139
|
+
&:not(:disabled) {
|
|
1140
|
+
&:focus,
|
|
1141
|
+
&:active {
|
|
1142
|
+
animation: pulse-animation 0.5s ease-out;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
&:hover {
|
|
1146
|
+
color: $cornflowerBlue;
|
|
1147
|
+
border-color: currentColor;
|
|
1148
|
+
}
|
|
1131
1149
|
}
|
|
1132
1150
|
|
|
1133
1151
|
~ label {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.openPopUp = exports.openConfirmPopUp = exports.isEveryObjectValueEmpty = exports.getTransitionEndEventName = exports.areArraysEqual = void 0;
|
|
6
|
+
exports.openPopUp = exports.openConfirmPopUp = exports.isEveryObjectValueEmpty = exports.getTransitionEndEventName = exports.getErrorDetail = exports.areArraysEqual = void 0;
|
|
7
7
|
var _reactModalPromise = require("react-modal-promise");
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
9
|
var _components = require("../components");
|
|
@@ -60,13 +60,22 @@ var areArraysEqual = function areArraysEqual(firstArray, secondArray) {
|
|
|
60
60
|
return (0, _lodash.isEqual)((0, _lodash.omit)(a, omitBy), (0, _lodash.omit)(b, omitBy));
|
|
61
61
|
}));
|
|
62
62
|
};
|
|
63
|
+
exports.areArraysEqual = areArraysEqual;
|
|
64
|
+
var getErrorDetail = function getErrorDetail(error) {
|
|
65
|
+
var errorDetail = (0, _lodash.get)(error, 'response.data.detail', '');
|
|
66
|
+
if (typeof errorDetail === 'string') {
|
|
67
|
+
return errorDetail;
|
|
68
|
+
} else {
|
|
69
|
+
return (0, _lodash.get)(errorDetail, 'reason', '');
|
|
70
|
+
}
|
|
71
|
+
};
|
|
63
72
|
|
|
64
73
|
/**
|
|
65
74
|
* Retrieves the appropriate transition end event name based on the browser.
|
|
66
75
|
*
|
|
67
76
|
* @returns {string} The transition end event name.
|
|
68
77
|
*/
|
|
69
|
-
exports.
|
|
78
|
+
exports.getErrorDetail = getErrorDetail;
|
|
70
79
|
var getTransitionEndEventName = function getTransitionEndEventName() {
|
|
71
80
|
var transitions = {
|
|
72
81
|
transition: 'transitionend',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|