tenjin-ui-kit 0.3.72-dev-1 → 0.3.73

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.
Files changed (104) hide show
  1. package/common/hooks/apiHooks.js +91 -199
  2. package/common/hooks/newApiHook.js +127 -258
  3. package/common/utils/security/index.js +2 -2
  4. package/common/utils/security/securityConfig.js +1 -2
  5. package/components/Canvas.js +172 -101
  6. package/components/DragBox/index.js +21 -31
  7. package/components/InputWithChip/index.js +178 -83
  8. package/components/RightContext/index.js +17 -41
  9. package/components/WorkFlow.js +19 -29
  10. package/components/WorkFlowBuilder.js +32 -56
  11. package/components/alert/Style.js +11 -14
  12. package/components/alert/index.js +8 -14
  13. package/components/attachment/index.js +26 -31
  14. package/components/authenticationProvider/AuthError.js +3 -4
  15. package/components/authenticationProvider/AuthLoader.js +3 -4
  16. package/components/authenticationProvider/index.js +58 -130
  17. package/components/avatar/index.js +24 -23
  18. package/components/avatar/styles.js +76 -77
  19. package/components/breadCrumbs/index.js +64 -89
  20. package/components/breadCrumbs/style.js +1 -4
  21. package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +7 -6
  22. package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
  23. package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +7 -6
  24. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +8 -7
  25. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +8 -7
  26. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +16 -19
  27. package/components/browsingTestCaseLayout/index.js +30 -46
  28. package/components/button/index.js +47 -58
  29. package/components/chatBotModal/index.js +40 -61
  30. package/components/checkBox/index.js +8 -10
  31. package/components/combobox/index.js +66 -100
  32. package/components/divider/index.js +9 -18
  33. package/components/editableField/index.js +19 -46
  34. package/components/error/index.js +6 -12
  35. package/components/errorBoundary/index.js +74 -98
  36. package/components/fileUploader/index.js +46 -58
  37. package/components/fileUploader/style.js +46 -49
  38. package/components/filter/ValueSelector.js +149 -245
  39. package/components/filter/index.js +45 -71
  40. package/components/iconButton/index.js +3 -4
  41. package/components/input/index.js +60 -74
  42. package/components/layout/index.js +36 -49
  43. package/components/layout/main/index.js +13 -14
  44. package/components/layout/main/style.js +11 -14
  45. package/components/layout/pageContent/index.js +8 -7
  46. package/components/layout/sidebar/FlatMenu.js +51 -47
  47. package/components/layout/sidebar/GroupedIconMenu.js +169 -194
  48. package/components/layout/sidebar/GroupedMenu.js +45 -50
  49. package/components/layout/sidebar/ProjectMenu.js +165 -185
  50. package/components/layout/sidebar/index.js +27 -26
  51. package/components/layout/sidebar/style.js +138 -143
  52. package/components/layout/topBar/ProjectTopbar.js +91 -208
  53. package/components/layout/topBar/UserAvatar.js +53 -69
  54. package/components/layout/topBar/index.js +23 -41
  55. package/components/loader/index.js +9 -12
  56. package/components/menu/index.js +23 -42
  57. package/components/modal/Modal.js +5 -6
  58. package/components/modal/index.js +16 -20
  59. package/components/modal/style.js +53 -56
  60. package/components/optionMenu/index.js +32 -47
  61. package/components/pagination/index.js +23 -43
  62. package/components/pagination/style.js +25 -28
  63. package/components/paginationUpdated/index.js +22 -29
  64. package/components/paper/index.js +20 -22
  65. package/components/paper/style.js +24 -27
  66. package/components/reactSelect/index.js +64 -97
  67. package/components/reactSelect/style.js +131 -151
  68. package/components/richTextEditor/index.js +24 -48
  69. package/components/select/GroupedSelect.js +96 -99
  70. package/components/select/SimpleSelect.js +61 -103
  71. package/components/select/index.js +56 -69
  72. package/components/simpleSelect/index.js +18 -22
  73. package/components/sort/index.js +23 -36
  74. package/components/switch/index.js +14 -15
  75. package/components/switch/style.js +29 -32
  76. package/components/switch/switch.js +30 -47
  77. package/components/table/ReactTable.js +59 -83
  78. package/components/table/SimpleTable.js +67 -91
  79. package/components/table/index.js +300 -206
  80. package/components/text/index.js +22 -30
  81. package/components/timeStamp/index.js +4 -9
  82. package/components/timeStamp/style.js +12 -15
  83. package/components/topBar/index.js +86 -102
  84. package/components/tree/index.js +30 -58
  85. package/components/tree/style.js +20 -23
  86. package/components/valuePicker/ValueSelector.js +78 -160
  87. package/components/valuePicker/index.js +30 -50
  88. package/components/wrapperLayout/layout/index.js +8 -7
  89. package/components/wrapperLayout/main/index.js +8 -7
  90. package/components/wrapperLayout/main/pageContainer/index.js +6 -5
  91. package/components/wrapperLayout/main/sideBar/index.js +171 -175
  92. package/components/wrapperLayout/main/sideBar/style.js +177 -183
  93. package/components/wrapperLayout/topBar/UserAvatar.js +6 -5
  94. package/components/wrapperLayout/topBar/avatar.js +15 -18
  95. package/components/wrapperLayout/topBar/index.js +115 -107
  96. package/components/wrapperLayout/topBar/menuIcon.js +6 -5
  97. package/components/wrapperLayout/topBar/style.js +63 -64
  98. package/http/index.js +92 -188
  99. package/index.js +53 -55
  100. package/package.json +3 -3
  101. package/templates/listPage/index.js +168 -196
  102. package/themes/default.js +5 -7
  103. package/themes/defaultSmall.js +2 -3
  104. package/themes/responsiveTheme.js +6 -8
@@ -6,158 +6,138 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useStyles = exports.getCustomStyles = void 0;
7
7
  var _styles = require("@mui/styles");
8
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 () {
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const useStyles = exports.useStyles = (0, _styles.makeStyles)(() => ({
11
+ inputLabel: _ref => {
12
+ let {
13
+ colorTheme
14
+ } = _ref;
15
+ return {
16
+ color: colorTheme ? _responsiveTheme.default.palette.text.main : _responsiveTheme.default.palette.text.main,
17
+ fontSize: _responsiveTheme.default.typography.fontSize,
18
+ fontWeight: 500,
19
+ fontFamily: _responsiveTheme.default.typography.fontFamily,
20
+ display: "flex",
21
+ marginBottom: "12px"
22
+ };
23
+ },
24
+ star: {
25
+ lineHeight: "unset",
26
+ marginLeft: "4px"
27
+ },
28
+ helperText: {
29
+ color: "#f44336",
30
+ fontSize: "8.5px"
31
+ },
32
+ blueTheme: {
33
+ // width: "100%",
34
+ height: "200px",
35
+ backgroundColor: "#3D3981",
36
+ borderRadius: "7px",
37
+ padding: "16px",
38
+ width: "50%"
39
+ }
40
+ }));
41
+ const getCustomStyles = _ref2 => {
42
+ let {
43
+ colorTheme,
44
+ error
45
+ } = _ref2;
17
46
  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
- }
47
+ option: provided => ({
48
+ ...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 => ({
60
+ ...provided,
61
+ backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.primary.white,
62
+ boxShadow: "none",
63
+ fontSize: "10px",
64
+ fontFamily: _responsiveTheme.default.typography.fontFamily,
65
+ // marginTop: theme.spacing(1.25),
66
+ height: "2.4rem !important",
67
+ border: error ? `1px solid #be1515` : colorTheme ? "none" : "1px solid #CFD7DF",
68
+ "&:hover": {
69
+ border: error ? `1px solid #be1515` : colorTheme ? "none" : "1px solid #CFD7DF"
70
+ }
71
+ // minHeight: "31.83px !important",
72
+ //border: "1px solid #adbac9",
73
+ }),
74
+ placeholder: provided => ({
75
+ ...provided,
76
+ color: colorTheme ? _responsiveTheme.default.palette.white.main : _responsiveTheme.default.palette.grey_dark.main,
77
+ fontFamily: _responsiveTheme.default.typography.fontFamily,
78
+ fontWeight: 400,
79
+ fontSize: _responsiveTheme.default.typography.fontSize,
80
+ padding: "0rem 0rem 0.1rem 0rem"
81
+ }),
82
+ indicatorSeparator: provided => ({
83
+ ...provided,
84
+ background: "none"
85
+ }),
86
+ input: provided => ({
87
+ ...provided,
88
+ color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
89
+ padding: "0rem 0rem 0.1rem 0rem"
90
+ }),
91
+ menu: provided => ({
92
+ ...provided,
93
+ padding: 0,
94
+ backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.white.main,
95
+ zIndex: 9999
96
+ }),
97
+ menuPortal: provided => ({
98
+ ...provided,
99
+ zIndex: 9999
100
+ }),
101
+ dropdownIndicator: provided => ({
102
+ ...provided,
103
+ color: colorTheme ? "#f4f7fc" : _responsiveTheme.default.palette.text.main,
104
+ opacity: 1,
105
+ padding: "0rem 0rem 0.1rem 0rem"
106
+ }),
107
+ singleValue: provided => ({
108
+ ...provided,
109
+ color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
110
+ // fontWeight: 500,
111
+ fontSize: _responsiveTheme.default.typography.fontSize,
112
+ padding: "0rem 0rem 0.1rem 0rem"
113
+ }),
114
+ valueContainer: provided => ({
115
+ ...provided,
116
+ // padding: 0,
117
+ color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.primary.tenjinLightBlack
118
+ }),
119
+ clearIndicator: provided => ({
120
+ ...provided,
121
+ color: colorTheme ? "#f4f7fc" : "#adb0bb"
122
+ }),
123
+ multiValue: provided => ({
124
+ ...provided,
125
+ backgroundColor: _responsiveTheme.default.palette.primary.tenjinMLight,
126
+ border: "1px solid #DAE0FF",
127
+ marginTop: "-0.15rem"
128
+ }),
129
+ multiValueLabel: provided => ({
130
+ ...provided,
131
+ color: _responsiveTheme.default.palette.text.main,
132
+ fontWeight: 400,
133
+ fontSize: _responsiveTheme.default.typography.fontSize,
134
+ fontFamily: _responsiveTheme.default.typography.fontFamily
135
+ }),
136
+ multiValueRemove: provided => ({
137
+ ...provided,
138
+ color: _responsiveTheme.default.palette.primary.tenjinFBlue,
139
+ cursor: "pointer"
140
+ })
161
141
  };
162
142
  };
163
143
  exports.getCustomStyles = getCustomStyles;
@@ -1,30 +1,20 @@
1
1
  "use strict";
2
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
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
7
  var _react = _interopRequireWildcard(require("react"));
9
8
  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);
9
+ 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); }
10
+ const RichTextEditorTest = _ref => {
11
+ let {
12
+ controls = {},
13
+ readOnly = false,
14
+ ...props
15
+ } = _ref;
26
16
  // By default everything is enabled
27
- var defaultControls = {
17
+ const defaultControls = {
28
18
  bold: true,
29
19
  italic: true,
30
20
  underline: true,
@@ -39,38 +29,25 @@ var RichTextEditorTest = function RichTextEditorTest(_ref) {
39
29
  alignCenter: true,
40
30
  alignRight: true
41
31
  };
42
- var editorControls = (0, _react.useMemo)(function () {
32
+ const editorControls = (0, _react.useMemo)(() => {
43
33
  if (readOnly) {
44
34
  return [];
45
35
  }
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
- }
36
+ const finalControls = {
37
+ ...defaultControls,
38
+ ...controls
72
39
  };
73
- }, [props.data]);
40
+ 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);
41
+ }, [controls, readOnly]);
42
+ const mentions = (0, _react.useMemo)(() => ({
43
+ allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
44
+ mentionDenotationChars: ["@"],
45
+ source: (searchTerm, renderList, mentionChar) => {
46
+ const list = mentionChar === "@" ? props.data : "";
47
+ const includesSearchTerm = list.filter(item => item.value.toLowerCase().includes(searchTerm && searchTerm.toLowerCase()));
48
+ renderList(includesSearchTerm);
49
+ }
50
+ }), [props.data]);
74
51
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_rte.RichTextEditor, {
75
52
  controls: editorControls,
76
53
  value: props.value,
@@ -79,5 +56,4 @@ var RichTextEditorTest = function RichTextEditorTest(_ref) {
79
56
  readOnly: readOnly
80
57
  }));
81
58
  };
82
- var _default = RichTextEditorTest;
83
- exports.default = _default;
59
+ var _default = exports.default = RichTextEditorTest;