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,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,83 @@
|
|
|
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 _rte = require("@mantine/rte");
|
|
10
|
+
var _excluded = ["controls", "readOnly"];
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
var RichTextEditorTest = function RichTextEditorTest(_ref) {
|
|
21
|
+
var _ref$controls = _ref.controls,
|
|
22
|
+
controls = _ref$controls === void 0 ? {} : _ref$controls,
|
|
23
|
+
_ref$readOnly = _ref.readOnly,
|
|
24
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
// By default everything is enabled
|
|
27
|
+
var defaultControls = {
|
|
28
|
+
bold: true,
|
|
29
|
+
italic: true,
|
|
30
|
+
underline: true,
|
|
31
|
+
link: true,
|
|
32
|
+
image: true,
|
|
33
|
+
unorderedList: true,
|
|
34
|
+
orderedList: true,
|
|
35
|
+
h1: true,
|
|
36
|
+
h2: true,
|
|
37
|
+
h3: true,
|
|
38
|
+
alignLeft: true,
|
|
39
|
+
alignCenter: true,
|
|
40
|
+
alignRight: true
|
|
41
|
+
};
|
|
42
|
+
var editorControls = (0, _react.useMemo)(function () {
|
|
43
|
+
if (readOnly) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
var finalControls = _objectSpread(_objectSpread({}, defaultControls), controls);
|
|
47
|
+
return [["bold", "italic", "underline"].filter(function (c) {
|
|
48
|
+
return finalControls[c];
|
|
49
|
+
}), ["link", "image"].filter(function (c) {
|
|
50
|
+
return finalControls[c];
|
|
51
|
+
}), ["unorderedList", "orderedList"].filter(function (c) {
|
|
52
|
+
return finalControls[c];
|
|
53
|
+
}), ["h1", "h2", "h3"].filter(function (c) {
|
|
54
|
+
return finalControls[c];
|
|
55
|
+
}), ["alignLeft", "alignCenter", "alignRight"].filter(function (c) {
|
|
56
|
+
return finalControls[c];
|
|
57
|
+
})].filter(function (group) {
|
|
58
|
+
return group.length > 0;
|
|
59
|
+
});
|
|
60
|
+
}, [controls, readOnly]);
|
|
61
|
+
var mentions = (0, _react.useMemo)(function () {
|
|
62
|
+
return {
|
|
63
|
+
allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
|
|
64
|
+
mentionDenotationChars: ["@"],
|
|
65
|
+
source: function source(searchTerm, renderList, mentionChar) {
|
|
66
|
+
var list = mentionChar === "@" ? props.data : "";
|
|
67
|
+
var includesSearchTerm = list.filter(function (item) {
|
|
68
|
+
return item.value.toLowerCase().includes(searchTerm && searchTerm.toLowerCase());
|
|
69
|
+
});
|
|
70
|
+
renderList(includesSearchTerm);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}, [props.data]);
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_rte.RichTextEditor, {
|
|
75
|
+
controls: editorControls,
|
|
76
|
+
value: props.value,
|
|
77
|
+
onChange: props.onChange,
|
|
78
|
+
mentions: props.mentions && mentions,
|
|
79
|
+
readOnly: readOnly
|
|
80
|
+
}));
|
|
81
|
+
};
|
|
82
|
+
var _default = RichTextEditorTest;
|
|
83
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,183 @@
|
|
|
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 _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
10
|
+
var _fa = require("react-icons/fa");
|
|
11
|
+
var _reactDom = require("react-dom");
|
|
12
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
13
|
+
var _excluded = ["options", "onChange", "value", "defaultValue", "fullWidth"];
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
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."); }
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
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; } }
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
26
|
+
var GroupedSelect = function GroupedSelect(_ref) {
|
|
27
|
+
var _options$find, _Object$entries;
|
|
28
|
+
var options = _ref.options,
|
|
29
|
+
onChange = _ref.onChange,
|
|
30
|
+
propValue = _ref.value,
|
|
31
|
+
defaultValue = _ref.defaultValue,
|
|
32
|
+
fullWidth = _ref.fullWidth,
|
|
33
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
var triggerRef = React.useRef(null);
|
|
35
|
+
var _React$useState = React.useState(""),
|
|
36
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
|
+
searchTerm = _React$useState2[0],
|
|
38
|
+
setSearchTerm = _React$useState2[1];
|
|
39
|
+
var _React$useState3 = React.useState(false),
|
|
40
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
41
|
+
isDropdownOpen = _React$useState4[0],
|
|
42
|
+
setIsDropdownOpen = _React$useState4[1];
|
|
43
|
+
var _React$useState5 = React.useState(propValue || defaultValue),
|
|
44
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
45
|
+
value = _React$useState6[0],
|
|
46
|
+
setValue = _React$useState6[1];
|
|
47
|
+
var _React$useState7 = React.useState(null),
|
|
48
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
49
|
+
hoveredOption = _React$useState8[0],
|
|
50
|
+
setHoveredOption = _React$useState8[1];
|
|
51
|
+
var groupOptionsByPageTitle = function groupOptionsByPageTitle(options) {
|
|
52
|
+
var grouped = {};
|
|
53
|
+
options.forEach(function (option) {
|
|
54
|
+
var _grouped$option$pageT;
|
|
55
|
+
if (!grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) {
|
|
56
|
+
grouped[option === null || option === void 0 ? void 0 : option.pageTitle] = [];
|
|
57
|
+
}
|
|
58
|
+
(_grouped$option$pageT = grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) === null || _grouped$option$pageT === void 0 ? void 0 : _grouped$option$pageT.push(option);
|
|
59
|
+
});
|
|
60
|
+
return grouped;
|
|
61
|
+
};
|
|
62
|
+
var handleSearchChange = function handleSearchChange(event) {
|
|
63
|
+
setSearchTerm(event.target.value);
|
|
64
|
+
};
|
|
65
|
+
var filteredOptions = options.filter(function (option) {
|
|
66
|
+
var _option$label, _option$pageTitle;
|
|
67
|
+
return (option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.includes(searchTerm)) || (option === null || option === void 0 ? void 0 : (_option$pageTitle = option.pageTitle) === null || _option$pageTitle === void 0 ? void 0 : _option$pageTitle.includes(searchTerm));
|
|
68
|
+
});
|
|
69
|
+
var groupedOptions = groupOptionsByPageTitle(filteredOptions);
|
|
70
|
+
var toggleDropdown = function toggleDropdown() {
|
|
71
|
+
setIsDropdownOpen(function (prev) {
|
|
72
|
+
return !prev;
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
var handleOptionClick = function handleOptionClick(selectedValue) {
|
|
76
|
+
setValue(selectedValue);
|
|
77
|
+
setIsDropdownOpen(false);
|
|
78
|
+
onChange({
|
|
79
|
+
target: {
|
|
80
|
+
value: selectedValue
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
var handleCloseDropdown = function handleCloseDropdown() {
|
|
85
|
+
setIsDropdownOpen(false);
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/React.createElement(_FormControl.default, _extends({
|
|
88
|
+
sx: {
|
|
89
|
+
width: fullWidth ? "100%" : 200
|
|
90
|
+
}
|
|
91
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
style: {
|
|
93
|
+
position: "relative",
|
|
94
|
+
width: "100%"
|
|
95
|
+
},
|
|
96
|
+
ref: triggerRef
|
|
97
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
onClick: toggleDropdown,
|
|
99
|
+
style: {
|
|
100
|
+
padding: "8px 10px",
|
|
101
|
+
border: "1px solid #ccc",
|
|
102
|
+
borderRadius: "4px",
|
|
103
|
+
cursor: "pointer",
|
|
104
|
+
display: "flex",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
justifyContent: "space-between"
|
|
107
|
+
}
|
|
108
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
style: {
|
|
110
|
+
flexGrow: 1
|
|
111
|
+
}
|
|
112
|
+
}, value ? options === null || options === void 0 ? void 0 : (_options$find = options.find(function (opt) {
|
|
113
|
+
return (opt === null || opt === void 0 ? void 0 : opt.id) === value;
|
|
114
|
+
})) === null || _options$find === void 0 ? void 0 : _options$find.label : "Select Option"), /*#__PURE__*/React.createElement("div", null, isDropdownOpen ? /*#__PURE__*/React.createElement(_fa.FaCaretUp, null) : /*#__PURE__*/React.createElement(_fa.FaCaretDown, null)))), isDropdownOpen && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
style: {
|
|
116
|
+
position: "absolute",
|
|
117
|
+
top: "".concat(triggerRef.current.getBoundingClientRect().bottom + 8, "px"),
|
|
118
|
+
left: "".concat(triggerRef.current.getBoundingClientRect().left, "px"),
|
|
119
|
+
width: "".concat(triggerRef.current.offsetWidth, "px"),
|
|
120
|
+
backgroundColor: "#fff",
|
|
121
|
+
border: "1px solid #ccc",
|
|
122
|
+
borderRadius: "4px",
|
|
123
|
+
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
|
|
124
|
+
maxHeight: "200px",
|
|
125
|
+
overflowY: "auto",
|
|
126
|
+
zIndex: 2000
|
|
127
|
+
}
|
|
128
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
style: {
|
|
130
|
+
padding: "10px"
|
|
131
|
+
}
|
|
132
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
133
|
+
type: "text",
|
|
134
|
+
placeholder: "Search...",
|
|
135
|
+
value: searchTerm,
|
|
136
|
+
onChange: handleSearchChange,
|
|
137
|
+
style: {
|
|
138
|
+
paddingLeft: "2.5rem",
|
|
139
|
+
background: 'white url("https://static.thenounproject.com/png/101791-200.png") no-repeat left',
|
|
140
|
+
backgroundPosition: "0.875rem center",
|
|
141
|
+
backgroundSize: "1.125rem",
|
|
142
|
+
height: "2.188rem",
|
|
143
|
+
margin: 0,
|
|
144
|
+
width: "100%",
|
|
145
|
+
border: "1px solid #949494",
|
|
146
|
+
borderRadius: "4px"
|
|
147
|
+
}
|
|
148
|
+
}), (_Object$entries = Object.entries(groupedOptions)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(function (_ref2) {
|
|
149
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
150
|
+
pageTitle = _ref3[0],
|
|
151
|
+
options = _ref3[1];
|
|
152
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
key: pageTitle
|
|
154
|
+
}, /*#__PURE__*/React.createElement(_text.default, {
|
|
155
|
+
style: {
|
|
156
|
+
padding: "5px 10px"
|
|
157
|
+
// backgroundColor: "#f5f5f5",
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
semibold: true
|
|
161
|
+
}, pageTitle !== null && pageTitle !== void 0 ? pageTitle : "N/A"), options.map(function (option) {
|
|
162
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
key: option === null || option === void 0 ? void 0 : option.id,
|
|
164
|
+
onClick: function onClick() {
|
|
165
|
+
return handleOptionClick(option.id);
|
|
166
|
+
},
|
|
167
|
+
onMouseEnter: function onMouseEnter() {
|
|
168
|
+
return setHoveredOption(option.id);
|
|
169
|
+
},
|
|
170
|
+
onMouseLeave: function onMouseLeave() {
|
|
171
|
+
return setHoveredOption(null);
|
|
172
|
+
},
|
|
173
|
+
style: {
|
|
174
|
+
padding: "8px 24px",
|
|
175
|
+
cursor: "pointer",
|
|
176
|
+
backgroundColor: value === (option === null || option === void 0 ? void 0 : option.id) ? "#f0f0f7" : hoveredOption === (option === null || option === void 0 ? void 0 : option.id) ? "#f5f5f5" : "transparent"
|
|
177
|
+
}
|
|
178
|
+
}, option.label);
|
|
179
|
+
}));
|
|
180
|
+
}))), document.body));
|
|
181
|
+
};
|
|
182
|
+
var _default = GroupedSelect;
|
|
183
|
+
exports.default = _default;
|