tenjin-ui-kit 0.2.135 → 0.2.136
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/.dockerignore +6 -0
- package/.storybook/main.js +16 -0
- package/.storybook/preview.js +11 -0
- package/Dockerfile +17 -0
- package/Jenkinsfile +66 -0
- package/{components → dist/components}/InputWithChip/index.js +4 -12
- package/{components → dist/components}/breadCrumbs/index.js +3 -1
- package/dist/components/button/index.js +131 -0
- package/dist/components/error/index.js +56 -0
- package/dist/components/layout/sidebar/GroupedIconMenu.js +227 -0
- package/{components → dist/components}/layout/sidebar/index.js +2 -0
- package/{components → dist/components}/layout/sidebar/style.js +17 -9
- package/dist/components/optionMenu/index.js +112 -0
- package/dist/components/reactSelect/index.js +212 -0
- package/dist/components/reactSelect/style.js +163 -0
- package/dist/components/select/SimpleSelect.js +123 -0
- package/dist/components/simpleSelect/index.js +122 -0
- package/dist/components/table/ReactTable.js +116 -0
- package/dist/components/table/SimpleTable.js +57 -0
- package/{index.js → dist/index.js} +49 -0
- package/package.json +3 -2
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/public/tenjinLogo.png +0 -0
- package/components/button/index.js +0 -71
- /package/{common → dist/common}/hooks/apiHooks.js +0 -0
- /package/{common → dist/common}/hooks/newApiHook.js +0 -0
- /package/{common → dist/common}/utils/security/index.js +0 -0
- /package/{common → dist/common}/utils/security/securityConfig.js +0 -0
- /package/{components → dist/components}/Canvas.js +0 -0
- /package/{components → dist/components}/DragBox/index.js +0 -0
- /package/{components → dist/components}/RightContext/index.css +0 -0
- /package/{components → dist/components}/RightContext/index.js +0 -0
- /package/{components → dist/components}/WorkFlow.js +0 -0
- /package/{components → dist/components}/WorkFlowBuilder.js +0 -0
- /package/{components → dist/components}/alert/Style.js +0 -0
- /package/{components → dist/components}/alert/index.js +0 -0
- /package/{components → dist/components}/attachment/index.js +0 -0
- /package/{components → dist/components}/authenticationProvider/AuthError.js +0 -0
- /package/{components → dist/components}/authenticationProvider/AuthLoader.js +0 -0
- /package/{components → dist/components}/authenticationProvider/index.js +0 -0
- /package/{components → dist/components}/avatar/index.js +0 -0
- /package/{components → dist/components}/avatar/styles.js +0 -0
- /package/{components → dist/components}/breadCrumbs/style.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/index.js +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/style.css +0 -0
- /package/{components → dist/components}/checkBox/index.js +0 -0
- /package/{components → dist/components}/divider/index.js +0 -0
- /package/{components → dist/components}/editableField/index.js +0 -0
- /package/{components → dist/components}/errorBoundary/Error.jpg +0 -0
- /package/{components → dist/components}/errorBoundary/index.js +0 -0
- /package/{components → dist/components}/fileUploader/index.js +0 -0
- /package/{components → dist/components}/fileUploader/style.js +0 -0
- /package/{components → dist/components}/iconButton/index.js +0 -0
- /package/{components → dist/components}/iconButton/style.js +0 -0
- /package/{components → dist/components}/input/index.js +0 -0
- /package/{components → dist/components}/layout/index.js +0 -0
- /package/{components → dist/components}/layout/main/index.js +0 -0
- /package/{components → dist/components}/layout/main/style.js +0 -0
- /package/{components → dist/components}/layout/pageContent/index.js +0 -0
- /package/{components → dist/components}/layout/sidebar/FlatMenu.js +0 -0
- /package/{components → dist/components}/layout/sidebar/GroupedMenu.js +0 -0
- /package/{components → dist/components}/layout/sidebar/ProjectMenu.js +0 -0
- /package/{components → dist/components}/layout/topBar/ProjectTopbar.js +0 -0
- /package/{components → dist/components}/layout/topBar/UserAvatar.js +0 -0
- /package/{components → dist/components}/layout/topBar/index.js +0 -0
- /package/{components → dist/components}/loader/index.js +0 -0
- /package/{components → dist/components}/menu/index.js +0 -0
- /package/{components → dist/components}/modal/Modal.js +0 -0
- /package/{components → dist/components}/modal/index.js +0 -0
- /package/{components → dist/components}/modal/style.js +0 -0
- /package/{components → dist/components}/pagination/index.js +0 -0
- /package/{components → dist/components}/pagination/style.js +0 -0
- /package/{components → dist/components}/paper/index.js +0 -0
- /package/{components → dist/components}/paper/style.js +0 -0
- /package/{components → dist/components}/richTextEditor/index.js +0 -0
- /package/{components → dist/components}/richTextEditor/style.js +0 -0
- /package/{components → dist/components}/select/index.js +0 -0
- /package/{components → dist/components}/switch/index.js +0 -0
- /package/{components → dist/components}/switch/style.js +0 -0
- /package/{components → dist/components}/switch/switch.js +0 -0
- /package/{components → dist/components}/table/index.js +0 -0
- /package/{components → dist/components}/text/index.js +0 -0
- /package/{components → dist/components}/timeStamp/index.js +0 -0
- /package/{components → dist/components}/timeStamp/style.js +0 -0
- /package/{components → dist/components}/topBar/index.js +0 -0
- /package/{components → dist/components}/tree/index.js +0 -0
- /package/{components → dist/components}/tree/style.js +0 -0
- /package/{components → dist/components}/valuePicker/ValueSelector.js +0 -0
- /package/{components → dist/components}/valuePicker/index.js +0 -0
- /package/{components → dist/components}/wrapperLayout/layout/index.js +0 -0
- /package/{components → dist/components}/wrapperLayout/layout/style.js +0 -0
- /package/{components → dist/components}/wrapperLayout/main/index.js +0 -0
- /package/{components → dist/components}/wrapperLayout/main/pageContainer/index.js +0 -0
- /package/{components → dist/components}/wrapperLayout/main/sideBar/index.js +0 -0
- /package/{components → dist/components}/wrapperLayout/main/sideBar/style.js +0 -0
- /package/{components → dist/components}/wrapperLayout/topBar/UserAvatar.js +0 -0
- /package/{components → dist/components}/wrapperLayout/topBar/avatar.js +0 -0
- /package/{components → dist/components}/wrapperLayout/topBar/index.js +0 -0
- /package/{components → dist/components}/wrapperLayout/topBar/menuIcon.js +0 -0
- /package/{components → dist/components}/wrapperLayout/topBar/style.js +0 -0
- /package/{http → dist/http}/index.js +0 -0
- /package/{templates → dist/templates}/listPage/index.js +0 -0
- /package/{themes → dist/themes}/default.js +0 -0
- /package/{themes → dist/themes}/defaultSmall.js +0 -0
- /package/{themes → dist/themes}/responsiveTheme.js +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
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 = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _fi = require("react-icons/fi");
|
|
11
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
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."); }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
var ITEM_HEIGHT = 500;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param {{
|
|
26
|
+
* options: Array<{
|
|
27
|
+
* name: String | Number,
|
|
28
|
+
* displayName: String,
|
|
29
|
+
* onClick: (name: String | Number, optionId: String | Number) => void,
|
|
30
|
+
* visibility?: boolean,
|
|
31
|
+
* divider?: boolean
|
|
32
|
+
* }>,
|
|
33
|
+
* optionId?: String | Number,
|
|
34
|
+
* }} props
|
|
35
|
+
* @description
|
|
36
|
+
* options: provide this object in an array for options
|
|
37
|
+
* {
|
|
38
|
+
* name, displayName , onClick, visibility, divider
|
|
39
|
+
* }
|
|
40
|
+
* name: name for Menuoption it will act like ID
|
|
41
|
+
* displayname: To display name
|
|
42
|
+
* onClick: Accepts a callbac function, this function will provide name in parameter
|
|
43
|
+
* visibility: (optional) if set to false, the option will be disabled
|
|
44
|
+
* divider: (optional) if set to true, a divider line will be displayed after the MenuItem
|
|
45
|
+
*
|
|
46
|
+
* optionId: Provide an option ID to get it as 2nd parameter of callback function
|
|
47
|
+
* @returns An option component
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
var OptionMenu = function OptionMenu(_ref) {
|
|
51
|
+
var options = _ref.options,
|
|
52
|
+
_ref$optionId = _ref.optionId,
|
|
53
|
+
optionId = _ref$optionId === void 0 ? null : _ref$optionId;
|
|
54
|
+
var _React$useState = _react.default.useState(null),
|
|
55
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
56
|
+
anchorEl = _React$useState2[0],
|
|
57
|
+
setAnchorEl = _React$useState2[1];
|
|
58
|
+
var open = Boolean(anchorEl);
|
|
59
|
+
var handleClick = function handleClick(event) {
|
|
60
|
+
setAnchorEl(event.currentTarget);
|
|
61
|
+
};
|
|
62
|
+
var handleClose = function handleClose() {
|
|
63
|
+
setAnchorEl(null);
|
|
64
|
+
};
|
|
65
|
+
var handleMenuItemClick = function handleMenuItemClick(callback) {
|
|
66
|
+
handleClose();
|
|
67
|
+
callback();
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, null, /*#__PURE__*/_react.default.createElement(_material.IconButton, {
|
|
70
|
+
"aria-label": "more",
|
|
71
|
+
"aria-controls": "long-menu",
|
|
72
|
+
"aria-haspopup": "true",
|
|
73
|
+
onClick: handleClick
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement(_fi.FiMoreHorizontal, {
|
|
75
|
+
color: "#44409A"
|
|
76
|
+
})), /*#__PURE__*/_react.default.createElement(_material.Menu, {
|
|
77
|
+
id: "long-menu",
|
|
78
|
+
anchorEl: anchorEl,
|
|
79
|
+
keepMounted: true,
|
|
80
|
+
open: open,
|
|
81
|
+
onClose: handleClose,
|
|
82
|
+
PaperProps: {
|
|
83
|
+
style: {
|
|
84
|
+
maxHeight: ITEM_HEIGHT * 4.5,
|
|
85
|
+
width: "27ch"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, options === null || options === void 0 ? void 0 : options.map(function (option, index) {
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
key: option.name
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
92
|
+
disabled: option.visibility === false,
|
|
93
|
+
onClick: function onClick() {
|
|
94
|
+
handleMenuItemClick(function () {
|
|
95
|
+
return option === null || option === void 0 ? void 0 : option.onClick(option.name, optionId);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
99
|
+
container: true,
|
|
100
|
+
alignItems: "center"
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, option.icon && /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
102
|
+
mr: 1
|
|
103
|
+
}, option.icon)), /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
104
|
+
style: {
|
|
105
|
+
display: "flex",
|
|
106
|
+
flexWrap: "wrap"
|
|
107
|
+
}
|
|
108
|
+
}, option === null || option === void 0 ? void 0 : option.displayName))), option.divider && index < options.length - 1 && /*#__PURE__*/_react.default.createElement(_material.Divider, null));
|
|
109
|
+
}))));
|
|
110
|
+
};
|
|
111
|
+
var _default = OptionMenu;
|
|
112
|
+
exports.default = _default;
|
|
@@ -0,0 +1,212 @@
|
|
|
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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _reactSelect = _interopRequireWildcard(require("react-select"));
|
|
11
|
+
var _material = require("@mui/material");
|
|
12
|
+
var _KeyboardArrowDown = _interopRequireDefault(require("@mui/icons-material/KeyboardArrowDown"));
|
|
13
|
+
var _style = require("./style");
|
|
14
|
+
var _excluded = ["getStyles", "Icon", "isDisabled", "isFocused", "isSelected", "children", "innerProps", "isCheckBox"],
|
|
15
|
+
_excluded2 = ["options", "value", "label", "defaultValue", "isMulti", "isDisabled", "placeholder", "className", "isRequired", "simulateNativeSelect", "onChange", "theme", "error", "helperText", "isBlueTheme", "isLoading", "isCheckBox"];
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
+
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); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
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."); }
|
|
27
|
+
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); }
|
|
28
|
+
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; }
|
|
29
|
+
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; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
var DropdownIndicator = function DropdownIndicator(props) {
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.DropdownIndicator, props, /*#__PURE__*/_react.default.createElement(_KeyboardArrowDown.default, null));
|
|
35
|
+
};
|
|
36
|
+
var InputOption = function InputOption(_ref) {
|
|
37
|
+
var getStyles = _ref.getStyles,
|
|
38
|
+
Icon = _ref.Icon,
|
|
39
|
+
isDisabled = _ref.isDisabled,
|
|
40
|
+
isFocused = _ref.isFocused,
|
|
41
|
+
isSelected = _ref.isSelected,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
innerProps = _ref.innerProps,
|
|
44
|
+
isCheckBox = _ref.isCheckBox,
|
|
45
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
var _React$useState = _react.default.useState(false),
|
|
47
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
48
|
+
isActive = _React$useState2[0],
|
|
49
|
+
setIsActive = _React$useState2[1];
|
|
50
|
+
var onMouseDown = function onMouseDown() {
|
|
51
|
+
return setIsActive(true);
|
|
52
|
+
};
|
|
53
|
+
var onMouseUp = function onMouseUp() {
|
|
54
|
+
return setIsActive(false);
|
|
55
|
+
};
|
|
56
|
+
var onMouseLeave = function onMouseLeave() {
|
|
57
|
+
return setIsActive(false);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// styles
|
|
61
|
+
var bg = "transparent";
|
|
62
|
+
if (isFocused) bg = "#eee";
|
|
63
|
+
if (isActive) bg = "#B2D4FF";
|
|
64
|
+
var style = {
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
backgroundColor: bg,
|
|
67
|
+
color: "inherit",
|
|
68
|
+
display: "flex "
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// prop assignment
|
|
72
|
+
var props = _objectSpread(_objectSpread({}, innerProps), {}, {
|
|
73
|
+
onMouseDown: onMouseDown,
|
|
74
|
+
onMouseUp: onMouseUp,
|
|
75
|
+
onMouseLeave: onMouseLeave,
|
|
76
|
+
style: style
|
|
77
|
+
});
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.Option, _extends({}, rest, {
|
|
79
|
+
isDisabled: isDisabled,
|
|
80
|
+
isFocused: isFocused,
|
|
81
|
+
isSelected: isSelected,
|
|
82
|
+
getStyles: getStyles,
|
|
83
|
+
innerProps: props
|
|
84
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
85
|
+
type: "checkbox",
|
|
86
|
+
checked: isSelected
|
|
87
|
+
}), children);
|
|
88
|
+
};
|
|
89
|
+
var ReactSelect = function ReactSelect(_ref2) {
|
|
90
|
+
var options = _ref2.options,
|
|
91
|
+
value = _ref2.value,
|
|
92
|
+
label = _ref2.label,
|
|
93
|
+
defaultValue = _ref2.defaultValue,
|
|
94
|
+
isMulti = _ref2.isMulti,
|
|
95
|
+
isDisabled = _ref2.isDisabled,
|
|
96
|
+
placeholder = _ref2.placeholder,
|
|
97
|
+
className = _ref2.className,
|
|
98
|
+
isRequired = _ref2.isRequired,
|
|
99
|
+
simulateNativeSelect = _ref2.simulateNativeSelect,
|
|
100
|
+
onChange = _ref2.onChange,
|
|
101
|
+
theme = _ref2.theme,
|
|
102
|
+
error = _ref2.error,
|
|
103
|
+
helperText = _ref2.helperText,
|
|
104
|
+
isBlueTheme = _ref2.isBlueTheme,
|
|
105
|
+
isLoading = _ref2.isLoading,
|
|
106
|
+
isCheckBox = _ref2.isCheckBox,
|
|
107
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
108
|
+
var classes = (0, _style.useStyles)({
|
|
109
|
+
colorTheme: isBlueTheme
|
|
110
|
+
});
|
|
111
|
+
var handleSelectChange = function handleSelectChange(value) {
|
|
112
|
+
if (simulateNativeSelect) {
|
|
113
|
+
onChange(value.value);
|
|
114
|
+
} else {
|
|
115
|
+
onChange(value);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var handleChange = function handleChange(options) {
|
|
119
|
+
if (Array.isArray(options)) {
|
|
120
|
+
setSelectedOptions(options.map(function (opt) {
|
|
121
|
+
return opt.value;
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var _React$useState3 = _react.default.useState([]),
|
|
126
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
127
|
+
selectedOptions = _React$useState4[0],
|
|
128
|
+
setSelectedOptions = _React$useState4[1];
|
|
129
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
130
|
+
style: {
|
|
131
|
+
width: "100%"
|
|
132
|
+
}
|
|
133
|
+
}, label && /*#__PURE__*/_react.default.createElement("div", null, label, isRequired && /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
134
|
+
component: "span",
|
|
135
|
+
color: "error"
|
|
136
|
+
}, "*")), isMulti ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({
|
|
137
|
+
isMulti: true,
|
|
138
|
+
options: options,
|
|
139
|
+
defaultValue: defaultValue && defaultValue.length > 0 ? defaultValue : "",
|
|
140
|
+
styles: (0, _style.getCustomStyles)({
|
|
141
|
+
colorTheme: isBlueTheme,
|
|
142
|
+
error: error
|
|
143
|
+
}),
|
|
144
|
+
isDisabled: isDisabled,
|
|
145
|
+
placeholder: placeholder,
|
|
146
|
+
components: isCheckBox ? {
|
|
147
|
+
DropdownIndicator: DropdownIndicator,
|
|
148
|
+
Option: InputOption
|
|
149
|
+
} : {
|
|
150
|
+
DropdownIndicator: DropdownIndicator
|
|
151
|
+
},
|
|
152
|
+
isLoading: isLoading
|
|
153
|
+
/////isCheckBox
|
|
154
|
+
,
|
|
155
|
+
closeMenuOnSelect: !isCheckBox ? true : false,
|
|
156
|
+
hideSelectedOptions: !isCheckBox ? true : false,
|
|
157
|
+
onChange: function onChange(options) {
|
|
158
|
+
return isCheckBox && handleChange(options);
|
|
159
|
+
}
|
|
160
|
+
}, rest))) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({
|
|
161
|
+
options: options,
|
|
162
|
+
styles: (0, _style.getCustomStyles)({
|
|
163
|
+
colorTheme: isBlueTheme,
|
|
164
|
+
error: error
|
|
165
|
+
}),
|
|
166
|
+
onChange: handleSelectChange,
|
|
167
|
+
defaultValue: options.filter(function (option) {
|
|
168
|
+
return option.value === defaultValue;
|
|
169
|
+
}),
|
|
170
|
+
value: options.filter(function (option) {
|
|
171
|
+
return option.value === value;
|
|
172
|
+
}),
|
|
173
|
+
isMulti: isMulti,
|
|
174
|
+
isDisabled: isDisabled,
|
|
175
|
+
placeholder: placeholder,
|
|
176
|
+
components: {
|
|
177
|
+
DropdownIndicator: DropdownIndicator
|
|
178
|
+
},
|
|
179
|
+
isLoading: isLoading
|
|
180
|
+
}, rest))), helperText && /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
181
|
+
style: {
|
|
182
|
+
color: "#be1515"
|
|
183
|
+
}
|
|
184
|
+
}, helperText)));
|
|
185
|
+
};
|
|
186
|
+
ReactSelect.propTypes = {
|
|
187
|
+
value: _propTypes.default.string,
|
|
188
|
+
className: _propTypes.default.string,
|
|
189
|
+
label: _propTypes.default.string,
|
|
190
|
+
defaultValue: _propTypes.default.instanceOf(Object),
|
|
191
|
+
isMulti: _propTypes.default.bool,
|
|
192
|
+
isDisabled: _propTypes.default.bool,
|
|
193
|
+
options: _propTypes.default.instanceOf(Array),
|
|
194
|
+
placeholder: _propTypes.default.string,
|
|
195
|
+
isRequired: _propTypes.default.bool,
|
|
196
|
+
simulateNativeSelect: _propTypes.default.bool,
|
|
197
|
+
onChange: _propTypes.default.func
|
|
198
|
+
};
|
|
199
|
+
ReactSelect.defaultProps = {
|
|
200
|
+
value: {},
|
|
201
|
+
label: "",
|
|
202
|
+
className: "",
|
|
203
|
+
defaultValue: {},
|
|
204
|
+
isMulti: false,
|
|
205
|
+
isDisabled: false,
|
|
206
|
+
options: [],
|
|
207
|
+
placeholder: "",
|
|
208
|
+
isRequired: false,
|
|
209
|
+
simulateNativeSelect: true
|
|
210
|
+
};
|
|
211
|
+
var _default = ReactSelect;
|
|
212
|
+
exports.default = _default;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStyles = exports.getCustomStyles = void 0;
|
|
7
|
+
var _styles = require("@mui/styles");
|
|
8
|
+
var _responsiveTheme = _interopRequireDefault(require("../../themes/responsiveTheme"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
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); }
|
|
16
|
+
var useStyles = (0, _styles.makeStyles)(function () {
|
|
17
|
+
return {
|
|
18
|
+
inputLabel: function inputLabel(_ref) {
|
|
19
|
+
var colorTheme = _ref.colorTheme;
|
|
20
|
+
return {
|
|
21
|
+
color: colorTheme ? _responsiveTheme.default.palette.text.main : _responsiveTheme.default.palette.text.main,
|
|
22
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
23
|
+
fontWeight: 500,
|
|
24
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
25
|
+
display: "flex",
|
|
26
|
+
marginBottom: "12px"
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
star: {
|
|
30
|
+
lineHeight: "unset",
|
|
31
|
+
marginLeft: "4px"
|
|
32
|
+
},
|
|
33
|
+
helperText: {
|
|
34
|
+
color: "#f44336",
|
|
35
|
+
fontSize: "8.5px"
|
|
36
|
+
},
|
|
37
|
+
blueTheme: {
|
|
38
|
+
// width: "100%",
|
|
39
|
+
height: "200px",
|
|
40
|
+
backgroundColor: "#3D3981",
|
|
41
|
+
borderRadius: "7px",
|
|
42
|
+
padding: "16px",
|
|
43
|
+
width: "50%"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
exports.useStyles = useStyles;
|
|
48
|
+
var getCustomStyles = function getCustomStyles(_ref2) {
|
|
49
|
+
var colorTheme = _ref2.colorTheme,
|
|
50
|
+
error = _ref2.error;
|
|
51
|
+
return {
|
|
52
|
+
option: function option(provided) {
|
|
53
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
54
|
+
color: colorTheme ? "#f4f7fc" : _responsiveTheme.default.palette.text.main,
|
|
55
|
+
fontSize: "10px",
|
|
56
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
57
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.white.main,
|
|
58
|
+
opacity: "100%",
|
|
59
|
+
"&:hover": {
|
|
60
|
+
backgroundColor: _responsiveTheme.default.palette.secondary_grey.main,
|
|
61
|
+
color: _responsiveTheme.default.palette.primary.main
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
control: function control(provided) {
|
|
66
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
67
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.primary.white,
|
|
68
|
+
boxShadow: "none",
|
|
69
|
+
fontSize: "10px",
|
|
70
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
71
|
+
// marginTop: theme.spacing(1.25),
|
|
72
|
+
height: "2.4rem !important",
|
|
73
|
+
border: error ? "1px solid #be1515" : colorTheme ? "none" : "1px solid #CFD7DF",
|
|
74
|
+
"&:hover": {
|
|
75
|
+
border: error ? "1px solid #be1515" : colorTheme ? "none" : "1px solid #CFD7DF"
|
|
76
|
+
}
|
|
77
|
+
// minHeight: "31.83px !important",
|
|
78
|
+
//border: "1px solid #adbac9",
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
placeholder: function placeholder(provided) {
|
|
83
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
84
|
+
color: colorTheme ? _responsiveTheme.default.palette.white.main : _responsiveTheme.default.palette.grey_dark.main,
|
|
85
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
86
|
+
fontWeight: 400,
|
|
87
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
88
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
indicatorSeparator: function indicatorSeparator(provided) {
|
|
92
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
93
|
+
background: "none"
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
input: function input(provided) {
|
|
97
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
98
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
|
|
99
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
menu: function menu(provided) {
|
|
103
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
104
|
+
padding: 0,
|
|
105
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.white.main,
|
|
106
|
+
zIndex: 9999
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
menuPortal: function menuPortal(provided) {
|
|
110
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
111
|
+
zIndex: 9999
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
dropdownIndicator: function dropdownIndicator(provided) {
|
|
115
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
116
|
+
color: colorTheme ? "#f4f7fc" : _responsiveTheme.default.palette.text.main,
|
|
117
|
+
opacity: 1,
|
|
118
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
singleValue: function singleValue(provided) {
|
|
122
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
123
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
|
|
124
|
+
// fontWeight: 500,
|
|
125
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
126
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
valueContainer: function valueContainer(provided) {
|
|
130
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
131
|
+
// padding: 0,
|
|
132
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.primary.tenjinLightBlack
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
clearIndicator: function clearIndicator(provided) {
|
|
136
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
137
|
+
color: colorTheme ? "#f4f7fc" : "#adb0bb"
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
multiValue: function multiValue(provided) {
|
|
141
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
142
|
+
backgroundColor: _responsiveTheme.default.palette.primary.tenjinMLight,
|
|
143
|
+
border: "1px solid #DAE0FF",
|
|
144
|
+
marginTop: "-0.15rem"
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
multiValueLabel: function multiValueLabel(provided) {
|
|
148
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
149
|
+
color: _responsiveTheme.default.palette.text.main,
|
|
150
|
+
fontWeight: 400,
|
|
151
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
152
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
multiValueRemove: function multiValueRemove(provided) {
|
|
156
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
157
|
+
color: _responsiveTheme.default.palette.primary.tenjinFBlue,
|
|
158
|
+
cursor: "pointer"
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
exports.getCustomStyles = getCustomStyles;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactFinalForm = require("react-final-form");
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
11
|
+
var _excluded = ["options", "errorMessage", "error", "fullWidth", "isDisabled", "label", "isRequired", "helperText"];
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
// import { Form } from "react-final-form";
|
|
17
|
+
// import { Input } from "tenjin-ui-kit";
|
|
18
|
+
|
|
19
|
+
var SimpleSelect = function SimpleSelect(_ref) {
|
|
20
|
+
var options = _ref.options,
|
|
21
|
+
errorMessage = _ref.errorMessage,
|
|
22
|
+
error = _ref.error,
|
|
23
|
+
fullWidth = _ref.fullWidth,
|
|
24
|
+
isDisabled = _ref.isDisabled,
|
|
25
|
+
label = _ref.label,
|
|
26
|
+
isRequired = _ref.isRequired,
|
|
27
|
+
helperText = _ref.helperText,
|
|
28
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
console.log(errorMessage, error, "error");
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControl, {
|
|
31
|
+
sx: {
|
|
32
|
+
m: 1,
|
|
33
|
+
minWidth: 120
|
|
34
|
+
},
|
|
35
|
+
fullWidth: fullWidth,
|
|
36
|
+
disabled: isDisabled,
|
|
37
|
+
error: error,
|
|
38
|
+
style: {
|
|
39
|
+
margin: "0rem !important"
|
|
40
|
+
}
|
|
41
|
+
}, label && /*#__PURE__*/_react.default.createElement(_material.FormLabel, {
|
|
42
|
+
htmlFor: "my-input",
|
|
43
|
+
sx: {
|
|
44
|
+
fontSize: "0.8rem",
|
|
45
|
+
fontWeight: 500,
|
|
46
|
+
paddingBottom: "0.2rem"
|
|
47
|
+
}
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, label, isRequired ? /*#__PURE__*/_react.default.createElement("span", {
|
|
49
|
+
style: {
|
|
50
|
+
color: "red"
|
|
51
|
+
}
|
|
52
|
+
}, " * ") : "")), /*#__PURE__*/_react.default.createElement(_material.Select, _extends({}, rest, {
|
|
53
|
+
fullWidth: true
|
|
54
|
+
}), options.map(function (option) {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
56
|
+
key: option.value,
|
|
57
|
+
value: option.value
|
|
58
|
+
}, option.label);
|
|
59
|
+
})), error && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, errorMessage), helperText && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, helperText)));
|
|
60
|
+
};
|
|
61
|
+
var _default = SimpleSelect; // const options = [
|
|
62
|
+
// { value: "option1", label: "Option 1" },
|
|
63
|
+
// { value: "option2", label: "Option 2" },
|
|
64
|
+
// // ... other options
|
|
65
|
+
// ];
|
|
66
|
+
// export const MyForm = () => {
|
|
67
|
+
// const validateForm = (values, mandatoryFields) => {
|
|
68
|
+
// let errors = {};
|
|
69
|
+
// if (mandatoryFields) {
|
|
70
|
+
// mandatoryFields.forEach((field) => {
|
|
71
|
+
// if (!values[field]) errors[field] = "Required";
|
|
72
|
+
// });
|
|
73
|
+
// }
|
|
74
|
+
// return errors;
|
|
75
|
+
// };
|
|
76
|
+
// const validate = (values) => {
|
|
77
|
+
// const errors = validateForm(values, ["text", "select"]);
|
|
78
|
+
// return errors;
|
|
79
|
+
// };
|
|
80
|
+
// const Submit = (values) => {
|
|
81
|
+
// console.log(values, "values");
|
|
82
|
+
// };
|
|
83
|
+
// return (
|
|
84
|
+
// <Form onSubmit={Submit} validate={validate}>
|
|
85
|
+
// {({ handleSubmit }) => (
|
|
86
|
+
// <form onSubmit={handleSubmit}>
|
|
87
|
+
// {/* Other form fields */}
|
|
88
|
+
// <Field
|
|
89
|
+
// name="text"
|
|
90
|
+
// render={({ input, meta }) => (
|
|
91
|
+
// <Input
|
|
92
|
+
// autoFocus="autofocus"
|
|
93
|
+
// isRequired
|
|
94
|
+
// {...input}
|
|
95
|
+
// // isDisabled={props.type === 'edit' && true}
|
|
96
|
+
// size="normal"
|
|
97
|
+
// placeholder="Test Cycle Name"
|
|
98
|
+
// fullWidth
|
|
99
|
+
// label="Name"
|
|
100
|
+
// error={meta.touched && meta.error ? true : false}
|
|
101
|
+
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
102
|
+
// />
|
|
103
|
+
// )}
|
|
104
|
+
// />
|
|
105
|
+
// <Field
|
|
106
|
+
// name="select"
|
|
107
|
+
// render={({ input, meta }) => (
|
|
108
|
+
// <MUISelectField
|
|
109
|
+
// {...input}
|
|
110
|
+
// // isDisabled={props.type === 'edit' && true}
|
|
111
|
+
// options={options}
|
|
112
|
+
// error={meta.touched && meta.error}
|
|
113
|
+
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
114
|
+
// />
|
|
115
|
+
// )}
|
|
116
|
+
// />
|
|
117
|
+
// <button type="submit">Submit</button>
|
|
118
|
+
// </form>
|
|
119
|
+
// )}
|
|
120
|
+
// </Form>
|
|
121
|
+
// );
|
|
122
|
+
// };
|
|
123
|
+
exports.default = _default;
|