iguazio.dashboard-react-controls 2.0.8 → 2.0.9
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.
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactFinalForm = require("react-final-form");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
/*
|
|
15
|
+
Copyright 2019 Iguazio Systems Ltd.
|
|
16
|
+
|
|
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
|
+
|
|
22
|
+
Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
25
|
+
implied. See the License for the specific language governing
|
|
26
|
+
permissions and limitations under the License.
|
|
27
|
+
|
|
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 OnChangeState = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
inputValue,
|
|
37
|
+
handler
|
|
38
|
+
} = _ref;
|
|
39
|
+
const [previousValue, setPreviousValue] = (0, _react.useState)(inputValue);
|
|
40
|
+
(0, _react.useEffect)(() => {
|
|
41
|
+
if (inputValue !== previousValue) {
|
|
42
|
+
setPreviousValue(inputValue);
|
|
43
|
+
handler(inputValue, previousValue);
|
|
44
|
+
}
|
|
45
|
+
}, [handler, inputValue, previousValue]);
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
48
|
+
const FormOnChange = _ref2 => {
|
|
49
|
+
let {
|
|
50
|
+
handler,
|
|
51
|
+
name
|
|
52
|
+
} = _ref2;
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
54
|
+
name: name,
|
|
55
|
+
subscription: {
|
|
56
|
+
value: true
|
|
57
|
+
},
|
|
58
|
+
allowNull: true,
|
|
59
|
+
render: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(OnChangeState, {
|
|
60
|
+
inputValue: props.input.value,
|
|
61
|
+
handler: handler
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
FormOnChange.propTypes = {
|
|
66
|
+
handler: _propTypes.default.func.isRequired,
|
|
67
|
+
name: _propTypes.default.string.isRequired
|
|
68
|
+
};
|
|
69
|
+
var _default = exports.default = FormOnChange;
|
|
@@ -17,6 +17,7 @@ var _types = require("../../types");
|
|
|
17
17
|
var _constants = require("../../constants");
|
|
18
18
|
var _dropdown = require("../../images/dropdown.svg");
|
|
19
19
|
require("./formSelect.scss");
|
|
20
|
+
var _lodash = require("lodash");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -100,7 +101,8 @@ const FormSelect = _ref => {
|
|
|
100
101
|
if (!input.value || !input.value.length) {
|
|
101
102
|
return "Select Option".concat(multiple ? 's' : '');
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
+
const multipleValue = multiple && input.value.includes('all') && input.value.length > 1 ? options.filter(option => option.id !== 'all').filter(option => input.value.includes(option.id)).map(option => option.label).join(', ') : options.filter(option => input.value.includes(option.id)).map(option => option.label).join(', ');
|
|
105
|
+
return !multiple ? selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label : input.value.length <= 2 ? multipleValue : "".concat(input.value.length, " items selected");
|
|
104
106
|
};
|
|
105
107
|
(0, _react.useEffect)(() => {
|
|
106
108
|
setIsInvalid(meta.invalid && (meta.validating || meta.modified || meta.submitFailed && meta.touched));
|
package/dist/components/index.js
CHANGED
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "FormKeyValueTable", {
|
|
|
45
45
|
return _FormKeyValueTable.default;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "FormOnChange", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _FormOnChange.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "FormRadio", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function () {
|
|
@@ -117,11 +123,12 @@ var _FormCheckBox = _interopRequireDefault(require("./FormCheckBox/FormCheckBox"
|
|
|
117
123
|
var _FormChipCell = _interopRequireDefault(require("./FormChipCell/FormChipCell"));
|
|
118
124
|
var _FormCombobox = _interopRequireDefault(require("./FormCombobox/FormCombobox"));
|
|
119
125
|
var _FormInput = _interopRequireDefault(require("./FormInput/FormInput"));
|
|
120
|
-
var
|
|
126
|
+
var _FormOnChange = _interopRequireDefault(require("./FormOnChange/FormOnChange"));
|
|
121
127
|
var _FormKeyValueTable = _interopRequireDefault(require("./FormKeyValueTable/FormKeyValueTable"));
|
|
122
128
|
var _FormRadio = _interopRequireDefault(require("./FormRadio/FormRadio"));
|
|
123
129
|
var _FormSelect = _interopRequireDefault(require("./FormSelect/FormSelect"));
|
|
124
130
|
var _FormTextarea = _interopRequireDefault(require("./FormTextarea/FormTextarea"));
|
|
131
|
+
var _FormToggle = _interopRequireDefault(require("./FormToggle/FormToggle"));
|
|
125
132
|
var _Modal = _interopRequireDefault(require("./Modal/Modal"));
|
|
126
133
|
var _PopUpDialog = _interopRequireDefault(require("./PopUpDialog/PopUpDialog"));
|
|
127
134
|
var _RoundedIcon = _interopRequireDefault(require("./RoundedIcon/RoundedIcon"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
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",
|