intelicoreact 1.4.18 → 1.4.20

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.
@@ -200,7 +200,7 @@ const TagsDropdown = _ref => {
200
200
 
201
201
  const isItemMatchesSearch = item => {
202
202
  const title = item.title || item.label;
203
- return searchValue.length ? title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") : true;
203
+ return searchValue.length ? title === null || title === void 0 ? void 0 : title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") : true;
204
204
  }; // --- GENERAL FUNCTIONS END --- //
205
205
 
206
206
 
@@ -426,23 +426,28 @@ const TagsDropdown = _ref => {
426
426
 
427
427
 
428
428
  const onOptionCreateClick = () => {
429
- const tempId = Math.random().toString(16).slice(2);
429
+ var _onOptionCreate;
430
+
430
431
  const newOption = {
431
432
  label: searchValue,
432
- value: tempId,
433
433
  style: {
434
434
  backgroundColor: randomColorForNewOption
435
435
  },
436
436
  isEditable: true,
437
437
  ref: /*#__PURE__*/(0, _react.createRef)()
438
438
  };
439
- setOptions(state => [...state, newOption]);
440
- setSearchValue("");
441
- onChangeHandler({
442
- value: tempId,
443
- label: searchValue
439
+ ((_onOptionCreate = onOptionCreate === null || onOptionCreate === void 0 ? void 0 : onOptionCreate(newOption)) !== null && _onOptionCreate !== void 0 ? _onOptionCreate : new Promise(r => r())).then(result => {
440
+ var _result$id;
441
+
442
+ const tempId = Math.random().toString(16).slice(2);
443
+ newOption.value = (_result$id = result === null || result === void 0 ? void 0 : result.id) !== null && _result$id !== void 0 ? _result$id : tempId;
444
+ setOptions(state => [...state, newOption]);
445
+ setSearchValue("");
446
+ onChangeHandler({
447
+ value: tempId,
448
+ label: searchValue
449
+ });
444
450
  });
445
- onOptionCreate === null || onOptionCreate === void 0 ? void 0 : onOptionCreate(newOption);
446
451
  };
447
452
 
448
453
  const onOptionEditClick = (e, item) => {
@@ -577,7 +582,7 @@ const TagsDropdown = _ref => {
577
582
  const hightlightSearchValue = title => {
578
583
  var _title$toLowerCase;
579
584
 
580
- const index = (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue.toLowerCase());
585
+ const index = title === null || title === void 0 ? void 0 : (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
581
586
  if (index === -1) return title;
582
587
  return /*#__PURE__*/_react.default.createElement("pre", {
583
588
  className: "inherit-styles"
@@ -691,10 +696,10 @@ const TagsDropdown = _ref => {
691
696
  let {
692
697
  label
693
698
  } = _ref9;
694
- return label.toLowerCase() !== searchValue.toLowerCase();
699
+ return (label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
695
700
  }) ? /*#__PURE__*/_react.default.createElement("div", {
696
701
  className: (0, _classnames.default)("".concat(RC, "__creatable-helper"))
697
- }, "Select an option or create one") : null, console.log(withCreateLogic, filteredOptions.length), /*#__PURE__*/_react.default.createElement("div", {
702
+ }, "Select an option or create one") : null, /*#__PURE__*/_react.default.createElement("div", {
698
703
  ref: dropdownListRef,
699
704
  className: "".concat(RC, "__list ").concat(headerContent || isMobile ? "".concat(RC, "__list--with-header") : "", " ").concat(footerContent ? "".concat(RC, "__list--with-footer") : "")
700
705
  }, filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(option => {
@@ -729,7 +734,7 @@ const TagsDropdown = _ref => {
729
734
  let {
730
735
  label
731
736
  } = _ref12;
732
- return label.toLowerCase() !== searchValue.toLowerCase();
737
+ return (label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
733
738
  }) && /*#__PURE__*/_react.default.createElement("div", {
734
739
  className: (0, _classnames.default)("".concat(RC, "__create-option")),
735
740
  onClick: onOptionCreateClick
@@ -757,7 +762,7 @@ const TagsDropdown = _ref => {
757
762
  let {
758
763
  label
759
764
  } = _ref13;
760
- return label.toLowerCase() !== searchValue.toLowerCase();
765
+ return (label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
761
766
  })) {
762
767
  onOptionCreateClick();
763
768
  }
@@ -8,8 +8,6 @@
8
8
  flex-direction: row;
9
9
 
10
10
  width: 100%;
11
- max-width: 500px;
12
-
13
11
 
14
12
  &__container {
15
13
  position: fixed;
@@ -85,6 +83,7 @@
85
83
 
86
84
  &-list-wrapper {
87
85
  padding: 8px 8px 4px;
86
+ background: #fff;
88
87
  }
89
88
 
90
89
  &--in-list {
@@ -83,18 +83,12 @@ class RESTAPI extends _ApiBase.default {
83
83
  function getCallback(item, mesageOptions) {
84
84
  const {
85
85
  getBodyAs
86
- } = item; // const finalIsGetBody = ('isGetBody' in item) ? item.isGetBody : isGetBody;
87
- // const finalIsGetBodyFirst = ('isGetBody' in item) ? item.isGetBody === 'first' : isGetBodyFirst;
88
-
89
- const finalIsGetBodyFirst = (() => {
90
- if (item.isGetBody) return item.isGetBody && item.isGetBody === "first";
91
- return isGetBodyFirst;
92
- })();
93
-
86
+ } = item;
87
+ const finalIsGetBody = typeof item.isGetBody === 'boolean' || typeof item.isGetBody === 'string' ? item.isGetBody : isGetBody;
88
+ const finalIsGetBodyFirst = finalIsGetBody === 'first';
94
89
  const checkResponseCallback = finalIsGetBodyFirst ? async (res, mesageOptions) => API_CONTEXT.getResponseBody(await API_CONTEXT.checkResponseCode(res, mesageOptions), getBodyAs) : async (res, mesageOptions) => API_CONTEXT.checkResponseCode(res, mesageOptions);
95
- const callback = item.callback ? async res => item.callback(await checkResponseCallback(res, mesageOptions)) : async res => checkResponseCallback(res, mesageOptions); // return finalIsGetBody && !finalIsGetBodyFirst
96
-
97
- return isGetBody && !isGetBodyFirst ? async res => API_CONTEXT.getResponseBody(await callback(res), getBodyAs) : callback;
90
+ const callback = item.callback ? async res => item.callback(await checkResponseCallback(res, mesageOptions)) : async res => checkResponseCallback(res, mesageOptions);
91
+ return finalIsGetBody && !finalIsGetBodyFirst ? async res => API_CONTEXT.getResponseBody(await callback(res), getBodyAs) : callback;
98
92
  }
99
93
 
100
94
  async function getRequestItem(item, idx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.4.18",
3
+ "version": "1.4.20",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [