@tsed/react-formio 2.1.0 → 2.1.2

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": "@tsed/react-formio",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Provide a react formio wrapper. Written in TypeScript.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",
@@ -30,8 +30,8 @@
30
30
  "tooltip.js": ">=1.3.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@tsed/tailwind": "2.1.0",
34
- "@tsed/tailwind-formio": "2.1.0"
33
+ "@tsed/tailwind": "2.1.2",
34
+ "@tsed/tailwind-formio": "2.1.2"
35
35
  },
36
36
  "repository": "https://github.com/TypedProject/tsed-formio",
37
37
  "bugs": {
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { Row } from "react-table";
2
3
 
3
4
  export function DefaultCells<Data extends object = {}>({ row }: { row: Row<Data> }) {
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  import { DndProvider } from "react-dnd";
3
3
  import { HTML5Backend } from "react-dnd-html5-backend";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import noop from "lodash/noop";
2
- import React, { PropsWithChildren, useState } from "react";
2
+ import React, { PropsWithChildren, useEffect, useState } from "react";
3
3
  import { CellProps, FilterProps, Renderer, TableOptions, useFilters, useGroupBy, usePagination, useSortBy, useTable } from "react-table";
4
4
 
5
5
  import { OnClickOperation, Operation, QueryOptions } from "../../../interfaces";
@@ -157,6 +157,11 @@ export function useCustomTable<Data extends object = {}>(props: PropsWithChildre
157
157
 
158
158
  // DND
159
159
  const [records, setRecords] = useState<Data[]>(data);
160
+
161
+ useEffect(() => {
162
+ setRecords(data);
163
+ }, [data]);
164
+
160
165
  const _onDrag = (dragIndex: number, hoverIndex: number) => {
161
166
  const newRecords = swapElements([...records], dragIndex, hoverIndex);
162
167