@integry/sdk 4.6.96 → 4.6.98

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.6.96",
3
+ "version": "4.6.98",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -75,7 +75,23 @@ const Input = forwardRef((props: InputProps, ref) => {
75
75
  handleRemoveInputFromParent,
76
76
  } = props;
77
77
 
78
- const [values, setValues] = useState(value ? [value] : ['']); // Track array of values
78
+ let parsedValue = [''];
79
+ if (value) {
80
+ if (typeof value === 'string') {
81
+ if (isArray) {
82
+ try {
83
+ parsedValue = JSON.parse(value);
84
+ } catch (e) {
85
+ parsedValue = [value];
86
+ }
87
+ } else {
88
+ parsedValue = [value];
89
+ }
90
+ } else {
91
+ parsedValue = value;
92
+ }
93
+ }
94
+ const [values, setValues] = useState(parsedValue); // Track array of values
79
95
  const [invalidInput, setInvalidInput] = useState(false);
80
96
  const [showErrorOnFocusLoss, setShowErrorOnFocusLoss] = useState(true);
81
97
 
@@ -240,21 +240,9 @@ const ListBox = (props: ListBoxProps) => {
240
240
 
241
241
  useEffect(() => {
242
242
  if (query && isSearchable) {
243
- const filtered = fuzzysort
244
- .go(query, items, {
245
- keys: ['value'],
246
- scoreFn: (keysResult) => {
247
- const nameResult = keysResult[0];
248
- const tagsResult = keysResult[1];
249
- // assign higher score to name result
250
- const score = Math.max(
251
- nameResult ? nameResult.score + 100 : -Infinity,
252
- tagsResult ? tagsResult.score : -Infinity,
253
- );
254
- return score;
255
- },
256
- })
257
- .map((el) => el.obj);
243
+ const filtered = items.filter((item) =>
244
+ item.value.toLowerCase().includes(query.toLowerCase()),
245
+ );
258
246
  setHighlightedIndex(-1);
259
247
  setSortedFilteredItems(filtered);
260
248
  if (filtered.length === 1) setHighlightedIndex(0);
@@ -672,6 +672,16 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
672
672
  onButtonClickScript=${onButtonClickScript}
673
673
  buttonScriptRequiresAuthToken=${buttonScriptRequiresAuthToken}
674
674
  apiHandler=${props.apiHandler}
675
+ ...${isArray
676
+ ? {
677
+ value:
678
+ showTagMenu && !isEditable
679
+ ? searchValue
680
+ : tempPlaceholder
681
+ ? ''
682
+ : currentValue,
683
+ }
684
+ : {}}
675
685
  />
676
686
  <div style="display:none">
677
687
  <${Input}