tenjin-ui-kit 0.1.0-dev.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/README.md +13 -0
- package/assets/images/MicrosoftTeams-image (1).png +0 -0
- package/assets/images/tenjin-4.0-logo.png +0 -0
- package/common/hooks/apiHooks.js +223 -0
- package/common/hooks/newApiHook.js +270 -0
- package/common/utils/security/index.js +11 -0
- package/common/utils/security/securityConfig.js +8 -0
- package/components/Canvas.js +254 -0
- package/components/DragBox/index.js +45 -0
- package/components/InputWithChip/index.js +187 -0
- package/components/RightContext/index.css +20 -0
- package/components/RightContext/index.js +86 -0
- package/components/WorkFlow.js +47 -0
- package/components/WorkFlowBuilder.js +130 -0
- package/components/alert/Style.js +23 -0
- package/components/alert/index.js +69 -0
- package/components/attachment/index.js +138 -0
- package/components/authenticationProvider/AuthError.js +24 -0
- package/components/authenticationProvider/AuthLoader.js +21 -0
- package/components/authenticationProvider/index.js +166 -0
- package/components/avatar/index.js +95 -0
- package/components/avatar/styles.js +94 -0
- package/components/breadCrumbs/index.js +172 -0
- package/components/breadCrumbs/style.js +11 -0
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +19 -0
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +15 -0
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +36 -0
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +26 -0
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +48 -0
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +26 -0
- package/components/browsingTestCaseLayout/index.js +187 -0
- package/components/browsingTestCaseLayout/style.css +82 -0
- package/components/button/index.js +131 -0
- package/components/chatBotModal/index.js +200 -0
- package/components/checkBox/index.js +30 -0
- package/components/divider/index.js +41 -0
- package/components/editableField/index.js +135 -0
- package/components/error/index.js +56 -0
- package/components/errorBoundary/Error.jpg +0 -0
- package/components/errorBoundary/index.js +160 -0
- package/components/fileUploader/index.js +156 -0
- package/components/fileUploader/style.js +60 -0
- package/components/filter/ValueSelector.js +306 -0
- package/components/filter/index.js +225 -0
- package/components/iconButton/index.js +34 -0
- package/components/iconButton/style.js +1 -0
- package/components/input/index.js +173 -0
- package/components/layout/index.js +98 -0
- package/components/layout/main/index.js +27 -0
- package/components/layout/main/style.js +22 -0
- package/components/layout/pageContent/index.js +31 -0
- package/components/layout/sidebar/FlatMenu.js +64 -0
- package/components/layout/sidebar/GroupedIconMenu.js +246 -0
- package/components/layout/sidebar/GroupedMenu.js +67 -0
- package/components/layout/sidebar/ProjectMenu.js +230 -0
- package/components/layout/sidebar/index.js +91 -0
- package/components/layout/sidebar/style.js +154 -0
- package/components/layout/topBar/ProjectTopbar.js +337 -0
- package/components/layout/topBar/UserAvatar.js +126 -0
- package/components/layout/topBar/index.js +132 -0
- package/components/loader/index.js +28 -0
- package/components/menu/index.js +80 -0
- package/components/modal/Modal.js +56 -0
- package/components/modal/index.js +91 -0
- package/components/modal/style.js +68 -0
- package/components/optionMenu/index.js +112 -0
- package/components/pagination/index.js +129 -0
- package/components/pagination/style.js +36 -0
- package/components/paginationUpdated/index.js +75 -0
- package/components/paper/index.js +44 -0
- package/components/paper/style.js +34 -0
- package/components/reactSelect/index.js +212 -0
- package/components/reactSelect/style.js +163 -0
- package/components/richTextEditor/index.js +83 -0
- package/components/richTextEditor/style.js +1 -0
- package/components/select/GroupedSelect.js +183 -0
- package/components/select/SimpleSelect.js +238 -0
- package/components/select/index.js +217 -0
- package/components/simpleSelect/index.js +122 -0
- package/components/sort/index.js +141 -0
- package/components/switch/index.js +72 -0
- package/components/switch/style.js +42 -0
- package/components/switch/switch.js +110 -0
- package/components/table/ReactTable.js +118 -0
- package/components/table/SimpleTable.js +136 -0
- package/components/table/index.js +256 -0
- package/components/text/index.js +64 -0
- package/components/timeStamp/index.js +44 -0
- package/components/timeStamp/style.js +23 -0
- package/components/topBar/index.js +176 -0
- package/components/tree/index.js +313 -0
- package/components/tree/style.js +32 -0
- package/components/valuePicker/ValueSelector.js +273 -0
- package/components/valuePicker/index.js +133 -0
- package/components/wrapperLayout/layout/index.js +30 -0
- package/components/wrapperLayout/layout/style.js +1 -0
- package/components/wrapperLayout/main/index.js +22 -0
- package/components/wrapperLayout/main/pageContainer/index.js +28 -0
- package/components/wrapperLayout/main/sideBar/index.js +262 -0
- package/components/wrapperLayout/main/sideBar/style.js +196 -0
- package/components/wrapperLayout/topBar/UserAvatar.js +17 -0
- package/components/wrapperLayout/topBar/avatar.js +57 -0
- package/components/wrapperLayout/topBar/index.js +182 -0
- package/components/wrapperLayout/topBar/menuIcon.js +14 -0
- package/components/wrapperLayout/topBar/style.js +77 -0
- package/http/index.js +226 -0
- package/index.js +354 -0
- package/package.json +119 -0
- package/templates/listPage/index.js +301 -0
- package/themes/default.js +253 -0
- package/themes/defaultSmall.js +86 -0
- package/themes/responsiveTheme.js +250 -0
|
@@ -0,0 +1,238 @@
|
|
|
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 _material = require("@mui/material");
|
|
10
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
11
|
+
var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
12
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
13
|
+
var _excluded = ["options", "errorMessage", "error", "fullWidth", "isDisabled", "label", "isRequired", "helperText", "isSearch", "isClearOption", "loading", "isSort", "placeholder"];
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
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); }
|
|
18
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
19
|
+
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); }
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
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."); }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
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; } }
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
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; }
|
|
27
|
+
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; }
|
|
28
|
+
// import { Form } from "react-final-form";
|
|
29
|
+
// import { Input } from "tenjin-ui-kit";
|
|
30
|
+
|
|
31
|
+
var SimpleSelect = function SimpleSelect(_ref) {
|
|
32
|
+
var _isSort, _isSearch, _isClearOption;
|
|
33
|
+
var options = _ref.options,
|
|
34
|
+
errorMessage = _ref.errorMessage,
|
|
35
|
+
error = _ref.error,
|
|
36
|
+
fullWidth = _ref.fullWidth,
|
|
37
|
+
isDisabled = _ref.isDisabled,
|
|
38
|
+
label = _ref.label,
|
|
39
|
+
isRequired = _ref.isRequired,
|
|
40
|
+
helperText = _ref.helperText,
|
|
41
|
+
isSearch = _ref.isSearch,
|
|
42
|
+
isClearOption = _ref.isClearOption,
|
|
43
|
+
loading = _ref.loading,
|
|
44
|
+
isSort = _ref.isSort,
|
|
45
|
+
placeholder = _ref.placeholder,
|
|
46
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
isSort = (_isSort = isSort) !== null && _isSort !== void 0 ? _isSort : true; //by default true
|
|
48
|
+
isSearch = (_isSearch = isSearch) !== null && _isSearch !== void 0 ? _isSearch : true; //by default true
|
|
49
|
+
isClearOption = (_isClearOption = isClearOption) !== null && _isClearOption !== void 0 ? _isClearOption : true; //by default true
|
|
50
|
+
|
|
51
|
+
var _useState = (0, _react.useState)(""),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
searchText = _useState2[0],
|
|
54
|
+
setSearchText = _useState2[1];
|
|
55
|
+
var _useState3 = (0, _react.useState)(false),
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
noDataAvailable = _useState4[0],
|
|
58
|
+
setNoDataAvailable = _useState4[1];
|
|
59
|
+
var validateChildren = function validateChildren(type, searchText) {
|
|
60
|
+
if (_typeof(type) !== "object") {
|
|
61
|
+
return typeof type === "string" && type.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
|
|
62
|
+
}
|
|
63
|
+
if (_typeof(type.props) === "object" && Array.isArray(type.props.children)) {
|
|
64
|
+
return type.props.children.some(function (data) {
|
|
65
|
+
return validateChildren(data, searchText);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
};
|
|
70
|
+
var containsText = function containsText(text, searchText) {
|
|
71
|
+
if (typeof text === "string" && typeof searchText === "string") {
|
|
72
|
+
return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
|
|
73
|
+
}
|
|
74
|
+
if (_typeof(text) === "object" && text.props && Array.isArray(text.props.children)) {
|
|
75
|
+
return text.props.children.some(function (data) {
|
|
76
|
+
return validateChildren(data, searchText);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
};
|
|
81
|
+
var displayedOptions = (0, _react.useMemo)(function () {
|
|
82
|
+
var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (option) {
|
|
83
|
+
return containsText(option === null || option === void 0 ? void 0 : option.label, searchText);
|
|
84
|
+
});
|
|
85
|
+
if (isSearch) {
|
|
86
|
+
setNoDataAvailable((filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) === 0);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// const sortedOptions = filteredOptions?.sort((a, b) =>
|
|
90
|
+
// a?.label?.localeCompare(b.label)
|
|
91
|
+
// );
|
|
92
|
+
var sortedOptions = filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.slice().sort(function (a, b) {
|
|
93
|
+
var labelA = typeof a.label === "string" ? a.label : findStringInChildren(a.label.props.children);
|
|
94
|
+
var labelB = typeof b.label === "string" ? b.label : findStringInChildren(b.label.props.children);
|
|
95
|
+
return labelA.localeCompare(labelB);
|
|
96
|
+
});
|
|
97
|
+
function findStringInChildren(children) {
|
|
98
|
+
var _iterator = _createForOfIteratorHelper(children),
|
|
99
|
+
_step;
|
|
100
|
+
try {
|
|
101
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
102
|
+
var child = _step.value;
|
|
103
|
+
if (typeof child === "string") {
|
|
104
|
+
return child;
|
|
105
|
+
} else if (child.props && typeof child.props.children === "string") {
|
|
106
|
+
return child.props.children;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (err) {
|
|
110
|
+
_iterator.e(err);
|
|
111
|
+
} finally {
|
|
112
|
+
_iterator.f();
|
|
113
|
+
}
|
|
114
|
+
return "";
|
|
115
|
+
}
|
|
116
|
+
return (isSort ? sortedOptions : filteredOptions).map(function (option) {
|
|
117
|
+
return {
|
|
118
|
+
label: option === null || option === void 0 ? void 0 : option.label,
|
|
119
|
+
value: option === null || option === void 0 ? void 0 : option.value
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
}, [options, searchText, isSearch]);
|
|
123
|
+
var recommendedOptions = isSearch ? displayedOptions : options;
|
|
124
|
+
var typingTimer;
|
|
125
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
126
|
+
clearTimeout(typingTimer);
|
|
127
|
+
if (e.key !== "Escape") {
|
|
128
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") {
|
|
129
|
+
e.stopPropagation();
|
|
130
|
+
}
|
|
131
|
+
typingTimer = setTimeout(function () {
|
|
132
|
+
clearTimeout(typingTimer);
|
|
133
|
+
}, 500);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControl, {
|
|
137
|
+
sx: {
|
|
138
|
+
minWidth: 120
|
|
139
|
+
},
|
|
140
|
+
fullWidth: fullWidth,
|
|
141
|
+
disabled: isDisabled,
|
|
142
|
+
error: error,
|
|
143
|
+
style: {
|
|
144
|
+
margin: "0rem !important"
|
|
145
|
+
}
|
|
146
|
+
}, label && /*#__PURE__*/_react.default.createElement(_material.FormLabel, {
|
|
147
|
+
htmlFor: "my-input",
|
|
148
|
+
sx: {
|
|
149
|
+
fontSize: "0.8rem",
|
|
150
|
+
fontWeight: 500,
|
|
151
|
+
paddingBottom: "0.2rem"
|
|
152
|
+
}
|
|
153
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, label, isRequired ? /*#__PURE__*/_react.default.createElement("span", {
|
|
154
|
+
style: {
|
|
155
|
+
color: "red"
|
|
156
|
+
}
|
|
157
|
+
}, " * ") : "")), /*#__PURE__*/_react.default.createElement(_material.Select, _extends({}, rest, {
|
|
158
|
+
// displayEmpty // To display the placeholder
|
|
159
|
+
// renderValue={(selected) => {
|
|
160
|
+
// if (!selected) {
|
|
161
|
+
// return <span style={{ color: "#acacac" }}>{placeholder || "Select an option"}</span>;
|
|
162
|
+
// }
|
|
163
|
+
// const selectedOption = options?.find((option) => option?.value === selected);
|
|
164
|
+
// return selectedOption?.label;
|
|
165
|
+
// }}
|
|
166
|
+
fullWidth: true,
|
|
167
|
+
onClose: function onClose() {
|
|
168
|
+
return setSearchText("");
|
|
169
|
+
},
|
|
170
|
+
MenuProps: {
|
|
171
|
+
PaperProps: {
|
|
172
|
+
style: {
|
|
173
|
+
maxHeight: "12.5rem"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}), isSearch && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
178
|
+
id: "search-box",
|
|
179
|
+
type: "text",
|
|
180
|
+
autoFocus: true,
|
|
181
|
+
style: {
|
|
182
|
+
paddingLeft: "2.5rem",
|
|
183
|
+
background: 'white url("https://static.thenounproject.com/png/101791-200.png") no-repeat left',
|
|
184
|
+
backgroundPosition: "0.875rem center",
|
|
185
|
+
backgroundSize: "1.125rem",
|
|
186
|
+
position: "sticky",
|
|
187
|
+
top: 0,
|
|
188
|
+
zIndex: 9999,
|
|
189
|
+
backgroundColor: "white !important",
|
|
190
|
+
height: "2.188rem",
|
|
191
|
+
margin: 0,
|
|
192
|
+
width: "100%",
|
|
193
|
+
border: "1px solid #949494",
|
|
194
|
+
borderRadius: "4px"
|
|
195
|
+
// paddingLeft: "2.5rem",
|
|
196
|
+
// background:
|
|
197
|
+
// "white url('https://static.thenounproject.com/png/101791-200.png') no-repeat left center",
|
|
198
|
+
// backgroundSize: "1.125rem",
|
|
199
|
+
// position: "sticky",
|
|
200
|
+
// top: 0,
|
|
201
|
+
// zIndex: 9999,
|
|
202
|
+
// height: "2.188rem",
|
|
203
|
+
// margin: 0,
|
|
204
|
+
// width: "100%",
|
|
205
|
+
// border: "1px solid #949494",
|
|
206
|
+
// borderRadius: "4px",
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
placeholder: "Type to search...",
|
|
210
|
+
onChange: function onChange(e) {
|
|
211
|
+
return setSearchText(e.target.value);
|
|
212
|
+
},
|
|
213
|
+
onKeyDown: handleKeyDown
|
|
214
|
+
})), isClearOption && !loading && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
215
|
+
value: ""
|
|
216
|
+
}, /*#__PURE__*/_react.default.createElement("em", {
|
|
217
|
+
style: {
|
|
218
|
+
color: "#888"
|
|
219
|
+
}
|
|
220
|
+
}, "Clear the option")), loading ? /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
221
|
+
variant: "span",
|
|
222
|
+
color: "secondary",
|
|
223
|
+
sx: {
|
|
224
|
+
fontStyle: "italic",
|
|
225
|
+
display: "flex",
|
|
226
|
+
padding: "0.5rem 0rem 0rem 1rem"
|
|
227
|
+
}
|
|
228
|
+
}, "Fetching Options...") : noDataAvailable ? /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
229
|
+
disabled: true
|
|
230
|
+
}, "No Data Available") : recommendedOptions === null || recommendedOptions === void 0 ? void 0 : recommendedOptions.map(function (option) {
|
|
231
|
+
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
232
|
+
key: option.value,
|
|
233
|
+
value: option.value
|
|
234
|
+
}, option.label);
|
|
235
|
+
})), error && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, errorMessage), helperText && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, helperText)));
|
|
236
|
+
};
|
|
237
|
+
var _default = SimpleSelect;
|
|
238
|
+
exports.default = _default;
|
|
@@ -0,0 +1,217 @@
|
|
|
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 _CheckBoxOutlineBlank = _interopRequireDefault(require("@mui/icons-material/CheckBoxOutlineBlank"));
|
|
11
|
+
var _CheckBox = _interopRequireDefault(require("@mui/icons-material/CheckBox"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _responsiveTheme = _interopRequireDefault(require("../../themes/responsiveTheme"));
|
|
14
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
15
|
+
var _excluded = ["options", "isMulti", "checkBox", "defaultValue", "value", "onChange", "placeholder", "label", "fullWidth", "error", "helperText", "blueTheme", "isRequired", "isDisabled"];
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
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 _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; }
|
|
21
|
+
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; }
|
|
22
|
+
var ReactSelect = function ReactSelect(props) {
|
|
23
|
+
var options = props.options,
|
|
24
|
+
isMulti = props.isMulti,
|
|
25
|
+
checkBox = props.checkBox,
|
|
26
|
+
defaultValue = props.defaultValue,
|
|
27
|
+
value = props.value,
|
|
28
|
+
onChange = props.onChange,
|
|
29
|
+
placeholder = props.placeholder,
|
|
30
|
+
label = props.label,
|
|
31
|
+
fullWidth = props.fullWidth,
|
|
32
|
+
error = props.error,
|
|
33
|
+
helperText = props.helperText,
|
|
34
|
+
blueTheme = props.blueTheme,
|
|
35
|
+
isRequired = props.isRequired,
|
|
36
|
+
isDisabled = props.isDisabled,
|
|
37
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
38
|
+
var icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.default, {
|
|
39
|
+
fontSize: "small"
|
|
40
|
+
});
|
|
41
|
+
var checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
42
|
+
fontSize: "small"
|
|
43
|
+
});
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControl, {
|
|
45
|
+
fullWidth: true
|
|
46
|
+
}, label && /*#__PURE__*/_react.default.createElement(_material.FormLabel, {
|
|
47
|
+
htmlFor: "my-input",
|
|
48
|
+
sx: {
|
|
49
|
+
fontSize: "0.8rem",
|
|
50
|
+
fontWeight: 500,
|
|
51
|
+
paddingBottom: "0.2rem"
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, label, isRequired ? /*#__PURE__*/_react.default.createElement("span", {
|
|
54
|
+
style: {
|
|
55
|
+
color: "red"
|
|
56
|
+
}
|
|
57
|
+
}, " * ") : "")), checkBox && /*#__PURE__*/_react.default.createElement(_material.Autocomplete, _extends({}, rest, {
|
|
58
|
+
sx: {
|
|
59
|
+
"& .MuiAutocomplete-input, & .MuiInputLabel-root": {
|
|
60
|
+
fontSize: _responsiveTheme.default.typography.fontSize
|
|
61
|
+
},
|
|
62
|
+
"& .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root']": {
|
|
63
|
+
background: isDisabled && "#DDDDDD",
|
|
64
|
+
color: isDisabled && "#000000"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
filterSelectedOptions: true,
|
|
68
|
+
disabled: isDisabled,
|
|
69
|
+
multiple: isMulti,
|
|
70
|
+
options: options
|
|
71
|
+
// disableCloseOnSelect
|
|
72
|
+
,
|
|
73
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
74
|
+
return option === null || option === void 0 ? void 0 : option.label;
|
|
75
|
+
},
|
|
76
|
+
value: value,
|
|
77
|
+
onChange: onChange,
|
|
78
|
+
defaultValue: [options[1]],
|
|
79
|
+
renderOption: function renderOption(props, option, _ref) {
|
|
80
|
+
var selected = _ref.selected;
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_material.Checkbox, {
|
|
82
|
+
icon: icon,
|
|
83
|
+
checkedIcon: checkedIcon,
|
|
84
|
+
style: {
|
|
85
|
+
marginRight: 8
|
|
86
|
+
},
|
|
87
|
+
checked: selected
|
|
88
|
+
}), /*#__PURE__*/_react.default.createElement(_text.default, null, option === null || option === void 0 ? void 0 : option.label));
|
|
89
|
+
},
|
|
90
|
+
renderInput: function renderInput(params) {
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({}, params, {
|
|
92
|
+
placeholder: placeholder,
|
|
93
|
+
helperText: helperText
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
})), !checkBox && !blueTheme && /*#__PURE__*/_react.default.createElement(_material.Autocomplete, _extends({}, rest, {
|
|
97
|
+
filterSelectedOptions: true,
|
|
98
|
+
disabled: isDisabled,
|
|
99
|
+
multiple: isMulti,
|
|
100
|
+
options: options
|
|
101
|
+
// disableCloseOnSelect
|
|
102
|
+
,
|
|
103
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
104
|
+
return option.label ? option.label : "";
|
|
105
|
+
},
|
|
106
|
+
value: value,
|
|
107
|
+
defaultValue: [defaultValue],
|
|
108
|
+
onChange: onChange,
|
|
109
|
+
sx: {
|
|
110
|
+
"& .MuiAutocomplete-input, & .MuiInputLabel-root": {
|
|
111
|
+
fontSize: _responsiveTheme.default.typography.fontSize
|
|
112
|
+
},
|
|
113
|
+
"& .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root']": {
|
|
114
|
+
background: isDisabled && "#DDDDDD",
|
|
115
|
+
color: isDisabled && "#000000"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
renderInput: function renderInput(params) {
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({
|
|
120
|
+
error: error
|
|
121
|
+
}, params, {
|
|
122
|
+
variant: "outlined",
|
|
123
|
+
fullWidth: true,
|
|
124
|
+
placeholder: placeholder,
|
|
125
|
+
helperText: helperText
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
})), blueTheme && /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
129
|
+
container: true,
|
|
130
|
+
sx: {
|
|
131
|
+
height: "200px",
|
|
132
|
+
backgroundColor: "#3D3981",
|
|
133
|
+
borderRadius: "7px",
|
|
134
|
+
padding: "16px",
|
|
135
|
+
width: "50%"
|
|
136
|
+
// background: "red",
|
|
137
|
+
}
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Autocomplete, _extends({
|
|
139
|
+
sx: {
|
|
140
|
+
"& .MuiAutocomplete-input, & .MuiInputLabel-root": {
|
|
141
|
+
fontSize: _responsiveTheme.default.typography.fontSize
|
|
142
|
+
},
|
|
143
|
+
width: "100%",
|
|
144
|
+
"& .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root']": {
|
|
145
|
+
background: "#6e6ba1",
|
|
146
|
+
color: "#F4F7FC"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
PaperComponent: function PaperComponent(_ref2) {
|
|
150
|
+
var children = _ref2.children;
|
|
151
|
+
return /*#__PURE__*/_react.default.createElement(_material.Paper, {
|
|
152
|
+
style: {
|
|
153
|
+
background: "#6e6ba1",
|
|
154
|
+
color: "#F4F7FC",
|
|
155
|
+
"&:hover": {
|
|
156
|
+
background: "#fff"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, children);
|
|
160
|
+
}
|
|
161
|
+
}, rest, {
|
|
162
|
+
disabled: isDisabled,
|
|
163
|
+
options: options,
|
|
164
|
+
filterSelectedOptions: true
|
|
165
|
+
// disableCloseOnSelect
|
|
166
|
+
,
|
|
167
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
168
|
+
return option.label;
|
|
169
|
+
},
|
|
170
|
+
value: value,
|
|
171
|
+
defaultValue: [defaultValue],
|
|
172
|
+
onChange: onChange,
|
|
173
|
+
renderInput: function renderInput(params) {
|
|
174
|
+
return /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({
|
|
175
|
+
error: error
|
|
176
|
+
}, params, {
|
|
177
|
+
variant: "outlined",
|
|
178
|
+
fullWidth: true,
|
|
179
|
+
placeholder: placeholder,
|
|
180
|
+
helperText: helperText
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
// sx={{ }}
|
|
184
|
+
})))));
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
ReactSelect.propTypes = {
|
|
188
|
+
value: _propTypes.default.string,
|
|
189
|
+
className: _propTypes.default.string,
|
|
190
|
+
label: _propTypes.default.string,
|
|
191
|
+
defaultValue: _propTypes.default.instanceOf(Object),
|
|
192
|
+
isMulti: _propTypes.default.bool,
|
|
193
|
+
isDisabled: _propTypes.default.bool,
|
|
194
|
+
options: _propTypes.default.instanceOf(Array),
|
|
195
|
+
placeholder: _propTypes.default.string,
|
|
196
|
+
isRequired: _propTypes.default.bool,
|
|
197
|
+
simulateNativeSelect: _propTypes.default.bool,
|
|
198
|
+
onChange: _propTypes.default.func,
|
|
199
|
+
isSearch: _propTypes.default.bool,
|
|
200
|
+
loading: _propTypes.default.bool
|
|
201
|
+
};
|
|
202
|
+
ReactSelect.defaultProps = {
|
|
203
|
+
value: {},
|
|
204
|
+
label: "",
|
|
205
|
+
className: "",
|
|
206
|
+
defaultValue: [{}],
|
|
207
|
+
isMulti: false,
|
|
208
|
+
isDisabled: false,
|
|
209
|
+
options: [],
|
|
210
|
+
placeholder: "",
|
|
211
|
+
isRequired: false,
|
|
212
|
+
simulateNativeSelect: true,
|
|
213
|
+
isSearch: false,
|
|
214
|
+
loading: false
|
|
215
|
+
};
|
|
216
|
+
var _default = ReactSelect;
|
|
217
|
+
exports.default = _default;
|
|
@@ -0,0 +1,122 @@
|
|
|
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"];
|
|
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
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
console.log(errorMessage, error, "error");
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControl, {
|
|
30
|
+
sx: {
|
|
31
|
+
m: 1,
|
|
32
|
+
minWidth: 120
|
|
33
|
+
},
|
|
34
|
+
fullWidth: fullWidth,
|
|
35
|
+
disabled: isDisabled,
|
|
36
|
+
error: error,
|
|
37
|
+
style: {
|
|
38
|
+
margin: "0rem !important"
|
|
39
|
+
}
|
|
40
|
+
}, label && /*#__PURE__*/_react.default.createElement(_material.FormLabel, {
|
|
41
|
+
htmlFor: "my-input",
|
|
42
|
+
sx: {
|
|
43
|
+
fontSize: "0.8rem",
|
|
44
|
+
fontWeight: 500,
|
|
45
|
+
paddingBottom: "0.2rem"
|
|
46
|
+
}
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, label, isRequired ? /*#__PURE__*/_react.default.createElement("span", {
|
|
48
|
+
style: {
|
|
49
|
+
color: "red"
|
|
50
|
+
}
|
|
51
|
+
}, " * ") : "")), /*#__PURE__*/_react.default.createElement(_material.Select, _extends({}, rest, {
|
|
52
|
+
fullWidth: true
|
|
53
|
+
}), options.map(function (option) {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
55
|
+
key: option.value,
|
|
56
|
+
value: option.value
|
|
57
|
+
}, option.label);
|
|
58
|
+
})), error && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, errorMessage)));
|
|
59
|
+
};
|
|
60
|
+
var _default = SimpleSelect; // const options = [
|
|
61
|
+
// { value: "option1", label: "Option 1" },
|
|
62
|
+
// { value: "option2", label: "Option 2" },
|
|
63
|
+
// // ... other options
|
|
64
|
+
// ];
|
|
65
|
+
// export const MyForm = () => {
|
|
66
|
+
// const validateForm = (values, mandatoryFields) => {
|
|
67
|
+
// let errors = {};
|
|
68
|
+
// if (mandatoryFields) {
|
|
69
|
+
// mandatoryFields.forEach((field) => {
|
|
70
|
+
// if (!values[field]) errors[field] = "Required";
|
|
71
|
+
// });
|
|
72
|
+
// }
|
|
73
|
+
// return errors;
|
|
74
|
+
// };
|
|
75
|
+
// const validate = (values) => {
|
|
76
|
+
// const errors = validateForm(values, ["text", "select"]);
|
|
77
|
+
// return errors;
|
|
78
|
+
// };
|
|
79
|
+
// const Submit = (values) => {
|
|
80
|
+
// console.log(values, "values");
|
|
81
|
+
// };
|
|
82
|
+
// return (
|
|
83
|
+
// <Form onSubmit={Submit} validate={validate}>
|
|
84
|
+
// {({ handleSubmit }) => (
|
|
85
|
+
// <form onSubmit={handleSubmit}>
|
|
86
|
+
// {/* Other form fields */}
|
|
87
|
+
// <Field
|
|
88
|
+
// name="text"
|
|
89
|
+
// render={({ input, meta }) => (
|
|
90
|
+
// <Input
|
|
91
|
+
// autoFocus="autofocus"
|
|
92
|
+
// isRequired
|
|
93
|
+
// {...input}
|
|
94
|
+
// // isDisabled={props.type === 'edit' && true}
|
|
95
|
+
// size="normal"
|
|
96
|
+
// placeholder="Test Cycle Name"
|
|
97
|
+
// fullWidth
|
|
98
|
+
// label="Name"
|
|
99
|
+
// error={meta.touched && meta.error ? true : false}
|
|
100
|
+
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
101
|
+
// />
|
|
102
|
+
// )}
|
|
103
|
+
// />
|
|
104
|
+
// <Field
|
|
105
|
+
// name="select"
|
|
106
|
+
// render={({ input, meta }) => (
|
|
107
|
+
// <MUISelectField
|
|
108
|
+
// {...input}
|
|
109
|
+
// // isDisabled={props.type === 'edit' && true}
|
|
110
|
+
// options={options}
|
|
111
|
+
// error={meta.touched && meta.error}
|
|
112
|
+
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
113
|
+
// />
|
|
114
|
+
// )}
|
|
115
|
+
// />
|
|
116
|
+
// <button type="submit">Submit</button>
|
|
117
|
+
// </form>
|
|
118
|
+
// )}
|
|
119
|
+
// </Form>
|
|
120
|
+
// );
|
|
121
|
+
// };
|
|
122
|
+
exports.default = _default;
|