@scheels-softdev/kendoreact-generics 2.1.18 → 2.1.19

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 (2) hide show
  1. package/GenericDropdown.js +13 -3
  2. package/package.json +1 -1
@@ -58,6 +58,18 @@ idField, title, showClearButton, }) {
58
58
  return Object.assign(Object.assign({}, x), { textValue: getTextValue(x, textFields.map((x) => x.toString()), separator) });
59
59
  }));
60
60
  }, [data, textFields, separator]);
61
+ const findByIndex = (id, idKey, data) => {
62
+ console.log(id, data, idField);
63
+ const item = data.find((item) => id === item[idKey || "id"]);
64
+ console.log(item);
65
+ return item;
66
+ };
67
+ const findByValue = (item, data) => {
68
+ console.log(item, data);
69
+ const returnVal = data.find((x) => JSON.stringify(Object.assign(Object.assign({}, x), selectedData)) === JSON.stringify(Object.assign({}, x)));
70
+ console.log(returnVal);
71
+ return returnVal;
72
+ };
61
73
  return (_jsx("div", Object.assign({ "data-testid": "dropdown" }, { children: _jsx(ComboBox, { style: { width: "100%" }, label: title, disabled: disabled, data: state.subsetData, textField: "textValue", virtual: {
62
74
  // enable virtualization for large datasets
63
75
  total: state.total,
@@ -65,7 +77,5 @@ idField, title, showClearButton, }) {
65
77
  skip: state.skip,
66
78
  }, suggest: true, onPageChange: pageChange, filterable: true, onFilterChange: onFilterChange, popupSettings: {
67
79
  height: "210px",
68
- }, onChange: (e) => changeEvent(e), onBlur: (e) => e.nativeEvent.preventDefault(), clearButton: showClearButton, value: dataList.find((item) => selectedId === item[idField || "id"]) ||
69
- dataList.find((x) => JSON.stringify(Object.assign(Object.assign({}, x), selectedData)) === JSON.stringify(Object.assign({}, x))) ||
70
- null }) })));
80
+ }, onChange: (e) => changeEvent(e), onBlur: (e) => e.nativeEvent.preventDefault(), clearButton: showClearButton, value: findByIndex(selectedId, idField, dataList) || findByValue(selectedData, dataList) || null }) })));
71
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheels-softdev/kendoreact-generics",
3
- "version": "2.1.18",
3
+ "version": "2.1.19",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",