@scheels-softdev/kendoreact-generics 2.4.6 → 2.4.8

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.
@@ -17,7 +17,7 @@ export function GenericDropdown({ data, selectedId, selectedData, onChange, text
17
17
  subsetData: dataList.slice(0, pageSize),
18
18
  });
19
19
  //external function variables
20
- const filteredData = useRef(dataList.slice());
20
+ let filteredData = useRef(dataList.slice());
21
21
  //function creation
22
22
  // function to handle filter changes
23
23
  const onFilterChange = (event) => {
@@ -35,12 +35,16 @@ export function GenericDropdown({ data, selectedId, selectedData, onChange, text
35
35
  };
36
36
  // function to handle page changes for virtualization
37
37
  const pageChange = (event) => {
38
+ console.log("page change data: ", event.page, filteredData.current);
38
39
  const skip = event.page.skip;
39
40
  const take = event.page.take;
40
- const newSubsetData = filteredData.current.slice(skip, skip + take);
41
+ const newSubsetData = filteredData.current.length ? filteredData.current.slice(skip, skip + take) : dataList.slice(skip, skip + take);
41
42
  setState(Object.assign(Object.assign({}, state), { subsetData: newSubsetData, skip: skip }));
42
43
  };
43
44
  //change event listeners
45
+ useEffect(() => {
46
+ dataList;
47
+ });
44
48
  useEffect(() => {
45
49
  if (data.length) {
46
50
  setDataList(data.map((x) => {
package/Utility.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export declare const getTextValue: (dataItem: any, fields: string[], separator?: string) => string;
2
+ export declare const getDropdownArray: <T>(data: T[], textFields: (keyof T)[], separator: string) => (T & {
3
+ textValue: string;
4
+ })[];
package/Utility.js CHANGED
@@ -4,3 +4,8 @@ export const getTextValue = (dataItem, fields, separator) => {
4
4
  fields.forEach((field, index) => (textValue += index > 0 ? (separator ? separator : " ") + dataItem[field] : dataItem[field]));
5
5
  return textValue;
6
6
  };
7
+ export const getDropdownArray = (data, textFields, separator) => {
8
+ return data.map((x) => {
9
+ return Object.assign(Object.assign({}, x), { textValue: getTextValue(x, textFields.map((x) => x.toString()), separator) });
10
+ });
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheels-softdev/kendoreact-generics",
3
- "version": "2.4.6",
3
+ "version": "2.4.8",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",