tenjin-ui-kit 0.3.70 → 0.3.72-dev
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/common/hooks/apiHooks.js +155 -0
- package/common/hooks/newApiHook.js +188 -0
- package/{dist/common → common}/utils/security/index.js +2 -2
- package/{dist/common → common}/utils/security/securityConfig.js +1 -2
- package/components/Canvas.js +330 -0
- package/components/DragBox/index.js +40 -0
- package/components/InputWithChip/index.js +294 -0
- package/{dist/components → components}/RightContext/index.js +19 -28
- package/components/WorkFlow.js +42 -0
- package/components/WorkFlowBuilder.js +115 -0
- package/components/alert/Style.js +20 -0
- package/components/alert/index.js +67 -0
- package/{dist/components → components}/attachment/index.js +21 -28
- package/{dist/components → components}/authenticationProvider/AuthError.js +3 -4
- package/{dist/components → components}/authenticationProvider/AuthLoader.js +3 -4
- package/components/authenticationProvider/index.js +110 -0
- package/{dist/components → components}/avatar/index.js +13 -14
- package/components/avatar/styles.js +91 -0
- package/components/breadCrumbs/index.js +169 -0
- package/{dist/components → components}/breadCrumbs/style.js +1 -4
- package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +5 -6
- package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
- package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +4 -5
- package/{dist/components → components}/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +4 -5
- package/{dist/components → components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +5 -6
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +23 -0
- package/{dist/components → components}/browsingTestCaseLayout/index.js +25 -30
- package/components/button/index.js +133 -0
- package/{dist/components → components}/chatBotModal/index.js +36 -45
- package/components/checkBox/index.js +29 -0
- package/{dist/components → components}/combobox/index.js +51 -72
- package/components/divider/index.js +37 -0
- package/{dist/components → components}/editableField/index.js +19 -28
- package/{dist/components → components}/error/index.js +6 -12
- package/components/errorBoundary/index.js +140 -0
- package/components/fileUploader/index.js +151 -0
- package/components/fileUploader/style.js +57 -0
- package/components/filter/ValueSelector.js +333 -0
- package/{dist/components → components}/filter/index.js +26 -33
- package/{dist/components → components}/iconButton/index.js +3 -4
- package/components/input/index.js +167 -0
- package/components/layout/index.js +94 -0
- package/components/layout/main/index.js +24 -0
- package/components/layout/main/style.js +19 -0
- package/{dist/components → components}/layout/pageContent/index.js +6 -7
- package/components/layout/sidebar/FlatMenu.js +64 -0
- package/components/layout/sidebar/GroupedIconMenu.js +233 -0
- package/components/layout/sidebar/GroupedMenu.js +57 -0
- package/components/layout/sidebar/ProjectMenu.js +223 -0
- package/components/layout/sidebar/index.js +88 -0
- package/components/layout/sidebar/style.js +149 -0
- package/components/layout/topBar/ProjectTopbar.js +388 -0
- package/components/layout/topBar/UserAvatar.js +138 -0
- package/components/layout/topBar/index.js +121 -0
- package/{dist/components → components}/loader/index.js +9 -12
- package/components/menu/index.js +71 -0
- package/{dist/components → components}/modal/Modal.js +5 -6
- package/components/modal/index.js +88 -0
- package/components/modal/style.js +65 -0
- package/components/optionMenu/index.js +105 -0
- package/components/pagination/index.js +114 -0
- package/components/pagination/style.js +33 -0
- package/components/paginationUpdated/index.js +74 -0
- package/components/paper/index.js +43 -0
- package/components/paper/style.js +31 -0
- package/components/reactSelect/index.js +195 -0
- package/components/reactSelect/style.js +130 -0
- package/components/richTextEditor/index.js +64 -0
- package/components/select/GroupedSelect.js +167 -0
- package/components/select/SimpleSelect.js +184 -0
- package/{dist/components → components}/select/index.js +38 -54
- package/components/simpleSelect/index.js +53 -0
- package/{dist/components → components}/sort/index.js +19 -22
- package/{dist/components → components}/switch/index.js +10 -11
- package/components/switch/style.js +39 -0
- package/{dist/components → components}/switch/switch.js +17 -23
- package/components/table/ReactTable.js +101 -0
- package/components/table/SimpleTable.js +117 -0
- package/components/table/index.js +381 -0
- package/components/text/index.js +65 -0
- package/{dist/components → components}/timeStamp/index.js +4 -6
- package/components/timeStamp/style.js +20 -0
- package/components/topBar/index.js +169 -0
- package/{dist/components → components}/tree/index.js +29 -47
- package/components/tree/style.js +29 -0
- package/components/valuePicker/ValueSelector.js +205 -0
- package/{dist/components → components}/valuePicker/index.js +19 -26
- package/{dist/components → components}/wrapperLayout/layout/index.js +4 -5
- package/{dist/components → components}/wrapperLayout/main/index.js +4 -5
- package/{dist/components → components}/wrapperLayout/main/pageContainer/index.js +4 -5
- package/components/wrapperLayout/main/sideBar/index.js +272 -0
- package/components/wrapperLayout/main/sideBar/style.js +190 -0
- package/{dist/components → components}/wrapperLayout/topBar/UserAvatar.js +4 -5
- package/components/wrapperLayout/topBar/avatar.js +55 -0
- package/components/wrapperLayout/topBar/index.js +196 -0
- package/{dist/components → components}/wrapperLayout/topBar/menuIcon.js +4 -5
- package/components/wrapperLayout/topBar/style.js +74 -0
- package/http/index.js +133 -0
- package/{dist/index.js → index.js} +53 -55
- package/package.json +5 -3
- package/{dist/templates → templates}/listPage/index.js +36 -57
- package/{dist/themes → themes}/default.js +5 -7
- package/{dist/themes → themes}/defaultSmall.js +2 -3
- package/{dist/themes → themes}/responsiveTheme.js +6 -8
- package/.dockerignore +0 -6
- package/.storybook/main.js +0 -16
- package/.storybook/preview.js +0 -11
- package/Dockerfile +0 -17
- package/Jenkinsfile +0 -66
- package/build/asset-manifest.json +0 -16
- package/build/favicon.ico +0 -0
- package/build/index.html +0 -1
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/build/static/css/main.522396f6.css +0 -2
- package/build/static/css/main.522396f6.css.map +0 -1
- package/build/static/js/787.18cf14d0.chunk.js +0 -2
- package/build/static/js/787.18cf14d0.chunk.js.map +0 -1
- package/build/static/js/main.d71fecac.js +0 -3
- package/build/static/js/main.d71fecac.js.LICENSE.txt +0 -50
- package/build/static/js/main.d71fecac.js.map +0 -1
- package/build/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg +0 -1
- package/build/tenjinLogo.png +0 -0
- package/dist/common/hooks/apiHooks.js +0 -223
- package/dist/common/hooks/newApiHook.js +0 -270
- package/dist/components/Canvas.js +0 -254
- package/dist/components/DragBox/index.js +0 -45
- package/dist/components/InputWithChip/index.js +0 -187
- package/dist/components/WorkFlow.js +0 -47
- package/dist/components/WorkFlowBuilder.js +0 -130
- package/dist/components/alert/Style.js +0 -23
- package/dist/components/alert/index.js +0 -69
- package/dist/components/authenticationProvider/index.js +0 -166
- package/dist/components/avatar/styles.js +0 -94
- package/dist/components/breadCrumbs/index.js +0 -180
- package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +0 -26
- package/dist/components/button/index.js +0 -140
- package/dist/components/checkBox/index.js +0 -30
- package/dist/components/divider/index.js +0 -41
- package/dist/components/errorBoundary/index.js +0 -160
- package/dist/components/fileUploader/index.js +0 -156
- package/dist/components/fileUploader/style.js +0 -60
- package/dist/components/filter/ValueSelector.js +0 -405
- package/dist/components/input/index.js +0 -174
- package/dist/components/layout/index.js +0 -98
- package/dist/components/layout/main/index.js +0 -27
- package/dist/components/layout/main/style.js +0 -22
- package/dist/components/layout/sidebar/FlatMenu.js +0 -64
- package/dist/components/layout/sidebar/GroupedIconMenu.js +0 -246
- package/dist/components/layout/sidebar/GroupedMenu.js +0 -67
- package/dist/components/layout/sidebar/ProjectMenu.js +0 -230
- package/dist/components/layout/sidebar/index.js +0 -91
- package/dist/components/layout/sidebar/style.js +0 -154
- package/dist/components/layout/topBar/ProjectTopbar.js +0 -338
- package/dist/components/layout/topBar/UserAvatar.js +0 -145
- package/dist/components/layout/topBar/index.js +0 -132
- package/dist/components/menu/index.js +0 -80
- package/dist/components/modal/index.js +0 -91
- package/dist/components/modal/style.js +0 -68
- package/dist/components/optionMenu/index.js +0 -112
- package/dist/components/pagination/index.js +0 -129
- package/dist/components/pagination/style.js +0 -36
- package/dist/components/paginationUpdated/index.js +0 -75
- package/dist/components/paper/index.js +0 -44
- package/dist/components/paper/style.js +0 -34
- package/dist/components/reactSelect/index.js +0 -212
- package/dist/components/reactSelect/style.js +0 -163
- package/dist/components/richTextEditor/index.js +0 -83
- package/dist/components/select/GroupedSelect.js +0 -183
- package/dist/components/select/SimpleSelect.js +0 -212
- package/dist/components/simpleSelect/index.js +0 -56
- package/dist/components/switch/style.js +0 -42
- package/dist/components/table/ReactTable.js +0 -118
- package/dist/components/table/SimpleTable.js +0 -136
- package/dist/components/table/index.js +0 -256
- package/dist/components/text/index.js +0 -67
- package/dist/components/timeStamp/style.js +0 -23
- package/dist/components/topBar/index.js +0 -176
- package/dist/components/tree/style.js +0 -32
- package/dist/components/valuePicker/ValueSelector.js +0 -273
- package/dist/components/wrapperLayout/main/sideBar/index.js +0 -262
- package/dist/components/wrapperLayout/main/sideBar/style.js +0 -196
- package/dist/components/wrapperLayout/topBar/avatar.js +0 -57
- package/dist/components/wrapperLayout/topBar/index.js +0 -182
- package/dist/components/wrapperLayout/topBar/style.js +0 -77
- package/dist/http/index.js +0 -226
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/public/tenjinLogo.png +0 -0
- /package/{dist/assets → assets}/images/MicrosoftTeams-image (1).png +0 -0
- /package/{dist/assets → assets}/images/tenjin-4.0-logo.png +0 -0
- /package/{dist/components → components}/RightContext/index.css +0 -0
- /package/{dist/components → components}/browsingTestCaseLayout/style.css +0 -0
- /package/{dist/components → components}/errorBoundary/Error.jpg +0 -0
- /package/{dist/components → components}/iconButton/style.js +0 -0
- /package/{dist/components → components}/richTextEditor/style.js +0 -0
- /package/{dist/components → components}/wrapperLayout/layout/style.js +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Pagination;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _TablePagination = _interopRequireDefault(require("@mui/material/TablePagination"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
|
+
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."); }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
|
+
function Pagination(_ref) {
|
|
19
|
+
let page = _ref.page,
|
|
20
|
+
setPage = _ref.setPage,
|
|
21
|
+
rowsPerPage = _ref.rowsPerPage,
|
|
22
|
+
setRowsPerPage = _ref.setRowsPerPage,
|
|
23
|
+
totalPage = _ref.totalPage,
|
|
24
|
+
ofLabel = _ref.ofLabel;
|
|
25
|
+
const _React$useState = React.useState(false),
|
|
26
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
27
|
+
negativeState = _React$useState2[0],
|
|
28
|
+
setNegativeState = _React$useState2[1];
|
|
29
|
+
const handleChangePage = (event, newPage) => {
|
|
30
|
+
setPage(newPage);
|
|
31
|
+
setNegativeState(false);
|
|
32
|
+
};
|
|
33
|
+
const handleChangeRowsPerPage = event => {
|
|
34
|
+
setRowsPerPage(parseInt(event.target.value, 10));
|
|
35
|
+
setPage(0);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/React.createElement(_material.Box, {
|
|
38
|
+
display: "flex",
|
|
39
|
+
justifyContent: "flex-end",
|
|
40
|
+
alignItems: "center"
|
|
41
|
+
}, /*#__PURE__*/React.createElement(_TablePagination.default, {
|
|
42
|
+
component: "div",
|
|
43
|
+
count: totalPage,
|
|
44
|
+
page: page,
|
|
45
|
+
onPageChange: handleChangePage,
|
|
46
|
+
rowsPerPage: rowsPerPage,
|
|
47
|
+
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
48
|
+
labelDisplayedRows: _ref2 => {
|
|
49
|
+
let from = _ref2.from,
|
|
50
|
+
to = _ref2.to,
|
|
51
|
+
count = _ref2.count;
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", {
|
|
53
|
+
value: negativeState ? "" : page + 1,
|
|
54
|
+
onChange: e => {
|
|
55
|
+
if (/^\d*$/.test(e.target.value) && !(Number(e.target.value) > Math.ceil(totalPage / rowsPerPage))) {
|
|
56
|
+
if (Number(e.target.value) == 0) {
|
|
57
|
+
setNegativeState(true);
|
|
58
|
+
} else {
|
|
59
|
+
setNegativeState(false);
|
|
60
|
+
setPage(Number(e.target.value) - 1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
style: {
|
|
65
|
+
width: "40px",
|
|
66
|
+
textAlign: "center",
|
|
67
|
+
borderRadius: "6px",
|
|
68
|
+
backgroundColor: "transparent",
|
|
69
|
+
margin: "0 8px"
|
|
70
|
+
}
|
|
71
|
+
}), " ", ofLabel || "of", " ", Math.ceil(totalPage / rowsPerPage));
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _material = require("@mui/material");
|
|
8
|
+
var _loader = _interopRequireDefault(require("../loader"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _style = _interopRequireDefault(require("./style"));
|
|
13
|
+
const _excluded = ["className", "sx", "children", "loading", "fullHeight", "position"];
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
17
|
+
const Paper = _ref => {
|
|
18
|
+
let className = _ref.className,
|
|
19
|
+
sx = _ref.sx,
|
|
20
|
+
children = _ref.children,
|
|
21
|
+
loading = _ref.loading,
|
|
22
|
+
fullHeight = _ref.fullHeight,
|
|
23
|
+
position = _ref.position,
|
|
24
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
const classes = (0, _style.default)();
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_material.Paper, {
|
|
27
|
+
className: (0, _clsx.default)({
|
|
28
|
+
[classes.paper]: true,
|
|
29
|
+
[classes.fullHeight]: fullHeight,
|
|
30
|
+
[className]: true,
|
|
31
|
+
[classes[position]]: true
|
|
32
|
+
}),
|
|
33
|
+
sx: sx
|
|
34
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_loader.default, null) : children);
|
|
35
|
+
};
|
|
36
|
+
Paper.propTypes = {
|
|
37
|
+
loading: _propTypes.default.bool,
|
|
38
|
+
position: _propTypes.default.oneOf(["static", "relative", "fixed", "absolute", "sticky"])
|
|
39
|
+
};
|
|
40
|
+
Paper.defaultProps = {
|
|
41
|
+
position: "static"
|
|
42
|
+
};
|
|
43
|
+
var _default = exports.default = Paper;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _styles = require("@mui/styles");
|
|
8
|
+
var _default = exports.default = (0, _styles.makeStyles)(theme => ({
|
|
9
|
+
paper: {
|
|
10
|
+
border: "1px solid #D6D9E0",
|
|
11
|
+
boxShadow: "0px 3px 10px #667CBC1A"
|
|
12
|
+
},
|
|
13
|
+
fullHeight: {
|
|
14
|
+
height: "100%"
|
|
15
|
+
},
|
|
16
|
+
relative: {
|
|
17
|
+
position: "relative"
|
|
18
|
+
},
|
|
19
|
+
fixed: {
|
|
20
|
+
position: "fixed"
|
|
21
|
+
},
|
|
22
|
+
static: {
|
|
23
|
+
position: "static"
|
|
24
|
+
},
|
|
25
|
+
sticky: {
|
|
26
|
+
position: "sticky"
|
|
27
|
+
},
|
|
28
|
+
absolute: {
|
|
29
|
+
position: "absolute"
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
@@ -0,0 +1,195 @@
|
|
|
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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _reactSelect = _interopRequireWildcard(require("react-select"));
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _KeyboardArrowDown = _interopRequireDefault(require("@mui/icons-material/KeyboardArrowDown"));
|
|
12
|
+
var _style = require("./style");
|
|
13
|
+
const _excluded = ["getStyles", "Icon", "isDisabled", "isFocused", "isSelected", "children", "innerProps", "isCheckBox"],
|
|
14
|
+
_excluded2 = ["options", "value", "label", "defaultValue", "isMulti", "isDisabled", "placeholder", "className", "isRequired", "simulateNativeSelect", "onChange", "theme", "error", "helperText", "isBlueTheme", "isLoading", "isCheckBox"];
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
24
|
+
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."); }
|
|
25
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
26
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
27
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
28
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
29
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
30
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
31
|
+
const DropdownIndicator = props => {
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.DropdownIndicator, props, /*#__PURE__*/_react.default.createElement(_KeyboardArrowDown.default, null));
|
|
33
|
+
};
|
|
34
|
+
const InputOption = _ref => {
|
|
35
|
+
let getStyles = _ref.getStyles,
|
|
36
|
+
Icon = _ref.Icon,
|
|
37
|
+
isDisabled = _ref.isDisabled,
|
|
38
|
+
isFocused = _ref.isFocused,
|
|
39
|
+
isSelected = _ref.isSelected,
|
|
40
|
+
children = _ref.children,
|
|
41
|
+
innerProps = _ref.innerProps,
|
|
42
|
+
isCheckBox = _ref.isCheckBox,
|
|
43
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
+
const _React$useState = _react.default.useState(false),
|
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
46
|
+
isActive = _React$useState2[0],
|
|
47
|
+
setIsActive = _React$useState2[1];
|
|
48
|
+
const onMouseDown = () => setIsActive(true);
|
|
49
|
+
const onMouseUp = () => setIsActive(false);
|
|
50
|
+
const onMouseLeave = () => setIsActive(false);
|
|
51
|
+
|
|
52
|
+
// styles
|
|
53
|
+
let bg = "transparent";
|
|
54
|
+
if (isFocused) bg = "#eee";
|
|
55
|
+
if (isActive) bg = "#B2D4FF";
|
|
56
|
+
const style = {
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
backgroundColor: bg,
|
|
59
|
+
color: "inherit",
|
|
60
|
+
display: "flex "
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// prop assignment
|
|
64
|
+
const props = _objectSpread(_objectSpread({}, innerProps), {}, {
|
|
65
|
+
onMouseDown,
|
|
66
|
+
onMouseUp,
|
|
67
|
+
onMouseLeave,
|
|
68
|
+
style
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.Option, _extends({}, rest, {
|
|
71
|
+
isDisabled: isDisabled,
|
|
72
|
+
isFocused: isFocused,
|
|
73
|
+
isSelected: isSelected,
|
|
74
|
+
getStyles: getStyles,
|
|
75
|
+
innerProps: props
|
|
76
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
77
|
+
type: "checkbox",
|
|
78
|
+
checked: isSelected
|
|
79
|
+
}), children);
|
|
80
|
+
};
|
|
81
|
+
const ReactSelect = _ref2 => {
|
|
82
|
+
let options = _ref2.options,
|
|
83
|
+
value = _ref2.value,
|
|
84
|
+
label = _ref2.label,
|
|
85
|
+
defaultValue = _ref2.defaultValue,
|
|
86
|
+
isMulti = _ref2.isMulti,
|
|
87
|
+
isDisabled = _ref2.isDisabled,
|
|
88
|
+
placeholder = _ref2.placeholder,
|
|
89
|
+
className = _ref2.className,
|
|
90
|
+
isRequired = _ref2.isRequired,
|
|
91
|
+
simulateNativeSelect = _ref2.simulateNativeSelect,
|
|
92
|
+
onChange = _ref2.onChange,
|
|
93
|
+
theme = _ref2.theme,
|
|
94
|
+
error = _ref2.error,
|
|
95
|
+
helperText = _ref2.helperText,
|
|
96
|
+
isBlueTheme = _ref2.isBlueTheme,
|
|
97
|
+
isLoading = _ref2.isLoading,
|
|
98
|
+
isCheckBox = _ref2.isCheckBox,
|
|
99
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
100
|
+
const classes = (0, _style.useStyles)({
|
|
101
|
+
colorTheme: isBlueTheme
|
|
102
|
+
});
|
|
103
|
+
const handleSelectChange = value => {
|
|
104
|
+
if (simulateNativeSelect) {
|
|
105
|
+
onChange(value.value);
|
|
106
|
+
} else {
|
|
107
|
+
onChange(value);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const handleChange = options => {
|
|
111
|
+
if (Array.isArray(options)) {
|
|
112
|
+
setSelectedOptions(options.map(opt => opt.value));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const _React$useState3 = _react.default.useState([]),
|
|
116
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
117
|
+
selectedOptions = _React$useState4[0],
|
|
118
|
+
setSelectedOptions = _React$useState4[1];
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
+
style: {
|
|
121
|
+
width: "100%"
|
|
122
|
+
}
|
|
123
|
+
}, label && /*#__PURE__*/_react.default.createElement("div", null, label, isRequired && /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
124
|
+
component: "span",
|
|
125
|
+
color: "error"
|
|
126
|
+
}, "*")), isMulti ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({
|
|
127
|
+
isMulti: true,
|
|
128
|
+
options: options,
|
|
129
|
+
defaultValue: defaultValue && defaultValue.length > 0 ? defaultValue : "",
|
|
130
|
+
styles: (0, _style.getCustomStyles)({
|
|
131
|
+
colorTheme: isBlueTheme,
|
|
132
|
+
error
|
|
133
|
+
}),
|
|
134
|
+
isDisabled: isDisabled,
|
|
135
|
+
placeholder: placeholder,
|
|
136
|
+
components: isCheckBox ? {
|
|
137
|
+
DropdownIndicator,
|
|
138
|
+
Option: InputOption
|
|
139
|
+
} : {
|
|
140
|
+
DropdownIndicator
|
|
141
|
+
},
|
|
142
|
+
isLoading: isLoading
|
|
143
|
+
/////isCheckBox
|
|
144
|
+
,
|
|
145
|
+
closeMenuOnSelect: !isCheckBox ? true : false,
|
|
146
|
+
hideSelectedOptions: !isCheckBox ? true : false,
|
|
147
|
+
onChange: options => isCheckBox && handleChange(options)
|
|
148
|
+
}, rest))) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({
|
|
149
|
+
options: options,
|
|
150
|
+
styles: (0, _style.getCustomStyles)({
|
|
151
|
+
colorTheme: isBlueTheme,
|
|
152
|
+
error
|
|
153
|
+
}),
|
|
154
|
+
onChange: handleSelectChange,
|
|
155
|
+
defaultValue: options.filter(option => option.value === defaultValue),
|
|
156
|
+
value: options.filter(option => option.value === value),
|
|
157
|
+
isMulti: isMulti,
|
|
158
|
+
isDisabled: isDisabled,
|
|
159
|
+
placeholder: placeholder,
|
|
160
|
+
components: {
|
|
161
|
+
DropdownIndicator
|
|
162
|
+
},
|
|
163
|
+
isLoading: isLoading
|
|
164
|
+
}, rest))), helperText && /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
165
|
+
style: {
|
|
166
|
+
color: "#be1515"
|
|
167
|
+
}
|
|
168
|
+
}, helperText)));
|
|
169
|
+
};
|
|
170
|
+
ReactSelect.propTypes = {
|
|
171
|
+
value: _propTypes.default.string,
|
|
172
|
+
className: _propTypes.default.string,
|
|
173
|
+
label: _propTypes.default.string,
|
|
174
|
+
defaultValue: _propTypes.default.instanceOf(Object),
|
|
175
|
+
isMulti: _propTypes.default.bool,
|
|
176
|
+
isDisabled: _propTypes.default.bool,
|
|
177
|
+
options: _propTypes.default.instanceOf(Array),
|
|
178
|
+
placeholder: _propTypes.default.string,
|
|
179
|
+
isRequired: _propTypes.default.bool,
|
|
180
|
+
simulateNativeSelect: _propTypes.default.bool,
|
|
181
|
+
onChange: _propTypes.default.func
|
|
182
|
+
};
|
|
183
|
+
ReactSelect.defaultProps = {
|
|
184
|
+
value: {},
|
|
185
|
+
label: "",
|
|
186
|
+
className: "",
|
|
187
|
+
defaultValue: {},
|
|
188
|
+
isMulti: false,
|
|
189
|
+
isDisabled: false,
|
|
190
|
+
options: [],
|
|
191
|
+
placeholder: "",
|
|
192
|
+
isRequired: false,
|
|
193
|
+
simulateNativeSelect: true
|
|
194
|
+
};
|
|
195
|
+
var _default = exports.default = ReactSelect;
|
|
@@ -0,0 +1,130 @@
|
|
|
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(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
const useStyles = exports.useStyles = (0, _styles.makeStyles)(() => ({
|
|
16
|
+
inputLabel: _ref => {
|
|
17
|
+
let colorTheme = _ref.colorTheme;
|
|
18
|
+
return {
|
|
19
|
+
color: colorTheme ? _responsiveTheme.default.palette.text.main : _responsiveTheme.default.palette.text.main,
|
|
20
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
21
|
+
fontWeight: 500,
|
|
22
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
23
|
+
display: "flex",
|
|
24
|
+
marginBottom: "12px"
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
star: {
|
|
28
|
+
lineHeight: "unset",
|
|
29
|
+
marginLeft: "4px"
|
|
30
|
+
},
|
|
31
|
+
helperText: {
|
|
32
|
+
color: "#f44336",
|
|
33
|
+
fontSize: "8.5px"
|
|
34
|
+
},
|
|
35
|
+
blueTheme: {
|
|
36
|
+
// width: "100%",
|
|
37
|
+
height: "200px",
|
|
38
|
+
backgroundColor: "#3D3981",
|
|
39
|
+
borderRadius: "7px",
|
|
40
|
+
padding: "16px",
|
|
41
|
+
width: "50%"
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
const getCustomStyles = _ref2 => {
|
|
45
|
+
let colorTheme = _ref2.colorTheme,
|
|
46
|
+
error = _ref2.error;
|
|
47
|
+
return {
|
|
48
|
+
option: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
49
|
+
color: colorTheme ? "#f4f7fc" : _responsiveTheme.default.palette.text.main,
|
|
50
|
+
fontSize: "10px",
|
|
51
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
52
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.white.main,
|
|
53
|
+
opacity: "100%",
|
|
54
|
+
"&:hover": {
|
|
55
|
+
backgroundColor: _responsiveTheme.default.palette.secondary_grey.main,
|
|
56
|
+
color: _responsiveTheme.default.palette.primary.main
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
control: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
60
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.primary.white,
|
|
61
|
+
boxShadow: "none",
|
|
62
|
+
fontSize: "10px",
|
|
63
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
64
|
+
// marginTop: theme.spacing(1.25),
|
|
65
|
+
height: "2.4rem !important",
|
|
66
|
+
border: error ? "1px solid #be1515" : colorTheme ? "none" : "1px solid #CFD7DF",
|
|
67
|
+
"&:hover": {
|
|
68
|
+
border: error ? "1px solid #be1515" : colorTheme ? "none" : "1px solid #CFD7DF"
|
|
69
|
+
}
|
|
70
|
+
// minHeight: "31.83px !important",
|
|
71
|
+
//border: "1px solid #adbac9",
|
|
72
|
+
}),
|
|
73
|
+
placeholder: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
74
|
+
color: colorTheme ? _responsiveTheme.default.palette.white.main : _responsiveTheme.default.palette.grey_dark.main,
|
|
75
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
76
|
+
fontWeight: 400,
|
|
77
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
78
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
79
|
+
}),
|
|
80
|
+
indicatorSeparator: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
81
|
+
background: "none"
|
|
82
|
+
}),
|
|
83
|
+
input: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
84
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
|
|
85
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
86
|
+
}),
|
|
87
|
+
menu: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
88
|
+
padding: 0,
|
|
89
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.white.main,
|
|
90
|
+
zIndex: 9999
|
|
91
|
+
}),
|
|
92
|
+
menuPortal: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
93
|
+
zIndex: 9999
|
|
94
|
+
}),
|
|
95
|
+
dropdownIndicator: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
96
|
+
color: colorTheme ? "#f4f7fc" : _responsiveTheme.default.palette.text.main,
|
|
97
|
+
opacity: 1,
|
|
98
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
99
|
+
}),
|
|
100
|
+
singleValue: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
101
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
|
|
102
|
+
// fontWeight: 500,
|
|
103
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
104
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
105
|
+
}),
|
|
106
|
+
valueContainer: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
107
|
+
// padding: 0,
|
|
108
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.primary.tenjinLightBlack
|
|
109
|
+
}),
|
|
110
|
+
clearIndicator: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
111
|
+
color: colorTheme ? "#f4f7fc" : "#adb0bb"
|
|
112
|
+
}),
|
|
113
|
+
multiValue: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
114
|
+
backgroundColor: _responsiveTheme.default.palette.primary.tenjinMLight,
|
|
115
|
+
border: "1px solid #DAE0FF",
|
|
116
|
+
marginTop: "-0.15rem"
|
|
117
|
+
}),
|
|
118
|
+
multiValueLabel: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
119
|
+
color: _responsiveTheme.default.palette.text.main,
|
|
120
|
+
fontWeight: 400,
|
|
121
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
122
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily
|
|
123
|
+
}),
|
|
124
|
+
multiValueRemove: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
125
|
+
color: _responsiveTheme.default.palette.primary.tenjinFBlue,
|
|
126
|
+
cursor: "pointer"
|
|
127
|
+
})
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
exports.getCustomStyles = getCustomStyles;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 _rte = require("@mantine/rte");
|
|
9
|
+
const _excluded = ["controls", "readOnly"];
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
18
|
+
const RichTextEditorTest = _ref => {
|
|
19
|
+
let _ref$controls = _ref.controls,
|
|
20
|
+
controls = _ref$controls === void 0 ? {} : _ref$controls,
|
|
21
|
+
_ref$readOnly = _ref.readOnly,
|
|
22
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
23
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
// By default everything is enabled
|
|
25
|
+
const defaultControls = {
|
|
26
|
+
bold: true,
|
|
27
|
+
italic: true,
|
|
28
|
+
underline: true,
|
|
29
|
+
link: true,
|
|
30
|
+
image: true,
|
|
31
|
+
unorderedList: true,
|
|
32
|
+
orderedList: true,
|
|
33
|
+
h1: true,
|
|
34
|
+
h2: true,
|
|
35
|
+
h3: true,
|
|
36
|
+
alignLeft: true,
|
|
37
|
+
alignCenter: true,
|
|
38
|
+
alignRight: true
|
|
39
|
+
};
|
|
40
|
+
const editorControls = (0, _react.useMemo)(() => {
|
|
41
|
+
if (readOnly) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const finalControls = _objectSpread(_objectSpread({}, defaultControls), controls);
|
|
45
|
+
return [["bold", "italic", "underline"].filter(c => finalControls[c]), ["link", "image"].filter(c => finalControls[c]), ["unorderedList", "orderedList"].filter(c => finalControls[c]), ["h1", "h2", "h3"].filter(c => finalControls[c]), ["alignLeft", "alignCenter", "alignRight"].filter(c => finalControls[c])].filter(group => group.length > 0);
|
|
46
|
+
}, [controls, readOnly]);
|
|
47
|
+
const mentions = (0, _react.useMemo)(() => ({
|
|
48
|
+
allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
|
|
49
|
+
mentionDenotationChars: ["@"],
|
|
50
|
+
source: (searchTerm, renderList, mentionChar) => {
|
|
51
|
+
const list = mentionChar === "@" ? props.data : "";
|
|
52
|
+
const includesSearchTerm = list.filter(item => item.value.toLowerCase().includes(searchTerm && searchTerm.toLowerCase()));
|
|
53
|
+
renderList(includesSearchTerm);
|
|
54
|
+
}
|
|
55
|
+
}), [props.data]);
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_rte.RichTextEditor, {
|
|
57
|
+
controls: editorControls,
|
|
58
|
+
value: props.value,
|
|
59
|
+
onChange: props.onChange,
|
|
60
|
+
mentions: props.mentions && mentions,
|
|
61
|
+
readOnly: readOnly
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
var _default = exports.default = RichTextEditorTest;
|