From a7ed0ea491daca1d087e47bc4793500cfe743288 Mon Sep 17 00:00:00 2001
From: Eryk Mika <eryk.mika@wpdesk.eu>
Date: Mon, 24 Feb 2025 22:44:22 +0100
Subject: [PATCH] fix: flexible table fix

---
 package-lock.json                   | 121 +++++++++++++++++++++++++++-
 package.json                        |   3 +-
 src/FlexibleTable/FlexibleTable.jsx |   4 +-
 3 files changed, 125 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 13a50e2..e42dea2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,8 @@
 				"@wordpress/block-editor": "^14.13.0",
 				"@wordpress/components": "^29.4.0",
 				"@wordpress/i18n": "^5.18.0",
-				"react": "^18.3.1"
+				"react": "^18.3.1",
+				"react-beautiful-dnd": "^13.1.1"
 			}
 		},
 		"node_modules/@ariakit/core": {
@@ -892,6 +893,16 @@
 			"integrity": "sha512-9VZUA5omXBfn+hDxFjUDu1FOJTBM3LmvqfDey+Z6Aa8B8/JmF5SMj6FBrjfgJ/Q3YXOZd3qyTDfJyMZSs/wCUA==",
 			"license": "MIT"
 		},
+		"node_modules/@types/hoist-non-react-statics": {
+			"version": "3.3.6",
+			"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.6.tgz",
+			"integrity": "sha512-lPByRJUer/iN/xa4qpyL0qmL11DqNW81iU/IG1S3uvRUq4oKagz8VCxZjiWkumgt66YT3vOdDgZ0o32sGKtCEw==",
+			"license": "MIT",
+			"dependencies": {
+				"@types/react": "*",
+				"hoist-non-react-statics": "^3.3.0"
+			}
+		},
 		"node_modules/@types/mousetrap": {
 			"version": "1.6.15",
 			"resolved": "https://registry.npmjs.org/@types/mousetrap/-/mousetrap-1.6.15.tgz",
@@ -929,6 +940,27 @@
 				"@types/react": "^18.0.0"
 			}
 		},
+		"node_modules/@types/react-redux": {
+			"version": "7.1.34",
+			"resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.34.tgz",
+			"integrity": "sha512-GdFaVjEbYv4Fthm2ZLvj1VSCedV7TqE5y1kNwnjSdBOTXuRSgowux6J8TAct15T3CKBr63UMk+2CO7ilRhyrAQ==",
+			"license": "MIT",
+			"dependencies": {
+				"@types/hoist-non-react-statics": "^3.3.0",
+				"@types/react": "*",
+				"hoist-non-react-statics": "^3.3.0",
+				"redux": "^4.0.0"
+			}
+		},
+		"node_modules/@types/react-redux/node_modules/redux": {
+			"version": "4.2.1",
+			"resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz",
+			"integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==",
+			"license": "MIT",
+			"dependencies": {
+				"@babel/runtime": "^7.9.2"
+			}
+		},
 		"node_modules/@use-gesture/core": {
 			"version": "10.3.1",
 			"resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.3.1.tgz",
@@ -1946,6 +1978,15 @@
 				"node": ">=10"
 			}
 		},
+		"node_modules/css-box-model": {
+			"version": "1.2.1",
+			"resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz",
+			"integrity": "sha512-a7Vr4Q/kd/aw96bnJG332W9V9LkJO69JRcaCYDUqjp6/z0w6VcZjgAcTbgFxEPfBgdnAwlh3iwu+hLopa+flJw==",
+			"license": "MIT",
+			"dependencies": {
+				"tiny-invariant": "^1.0.6"
+			}
+		},
 		"node_modules/csstype": {
 			"version": "3.1.3",
 			"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
@@ -2382,6 +2423,12 @@
 			"integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg==",
 			"license": "MIT"
 		},
+		"node_modules/memoize-one": {
+			"version": "5.2.1",
+			"resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz",
+			"integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==",
+			"license": "MIT"
+		},
 		"node_modules/moment": {
 			"version": "2.30.1",
 			"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
@@ -2677,6 +2724,12 @@
 				"react-is": "^16.13.1"
 			}
 		},
+		"node_modules/raf-schd": {
+			"version": "4.0.3",
+			"resolved": "https://registry.npmjs.org/raf-schd/-/raf-schd-4.0.3.tgz",
+			"integrity": "sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==",
+			"license": "MIT"
+		},
 		"node_modules/re-resizable": {
 			"version": "6.11.0",
 			"resolved": "https://registry.npmjs.org/re-resizable/-/re-resizable-6.11.0.tgz",
@@ -2714,6 +2767,35 @@
 				"react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0"
 			}
 		},
+		"node_modules/react-beautiful-dnd": {
+			"version": "13.1.1",
+			"resolved": "https://registry.npmjs.org/react-beautiful-dnd/-/react-beautiful-dnd-13.1.1.tgz",
+			"integrity": "sha512-0Lvs4tq2VcrEjEgDXHjT98r+63drkKEgqyxdA7qD3mvKwga6a5SscbdLPO2IExotU1jW8L0Ksdl0Cj2AF67nPQ==",
+			"deprecated": "react-beautiful-dnd is now deprecated. Context and options: https://github.com/atlassian/react-beautiful-dnd/issues/2672",
+			"license": "Apache-2.0",
+			"dependencies": {
+				"@babel/runtime": "^7.9.2",
+				"css-box-model": "^1.2.0",
+				"memoize-one": "^5.1.1",
+				"raf-schd": "^4.0.2",
+				"react-redux": "^7.2.0",
+				"redux": "^4.0.4",
+				"use-memo-one": "^1.1.1"
+			},
+			"peerDependencies": {
+				"react": "^16.8.5 || ^17.0.0 || ^18.0.0",
+				"react-dom": "^16.8.5 || ^17.0.0 || ^18.0.0"
+			}
+		},
+		"node_modules/react-beautiful-dnd/node_modules/redux": {
+			"version": "4.2.1",
+			"resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz",
+			"integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==",
+			"license": "MIT",
+			"dependencies": {
+				"@babel/runtime": "^7.9.2"
+			}
+		},
 		"node_modules/react-colorful": {
 			"version": "5.6.1",
 			"resolved": "https://registry.npmjs.org/react-colorful/-/react-colorful-5.6.1.tgz",
@@ -2757,6 +2839,37 @@
 			"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
 			"license": "MIT"
 		},
+		"node_modules/react-redux": {
+			"version": "7.2.9",
+			"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.9.tgz",
+			"integrity": "sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ==",
+			"license": "MIT",
+			"dependencies": {
+				"@babel/runtime": "^7.15.4",
+				"@types/react-redux": "^7.1.20",
+				"hoist-non-react-statics": "^3.3.2",
+				"loose-envify": "^1.4.0",
+				"prop-types": "^15.7.2",
+				"react-is": "^17.0.2"
+			},
+			"peerDependencies": {
+				"react": "^16.8.3 || ^17 || ^18"
+			},
+			"peerDependenciesMeta": {
+				"react-dom": {
+					"optional": true
+				},
+				"react-native": {
+					"optional": true
+				}
+			}
+		},
+		"node_modules/react-redux/node_modules/react-is": {
+			"version": "17.0.2",
+			"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
+			"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
+			"license": "MIT"
+		},
 		"node_modules/react-remove-scroll": {
 			"version": "2.6.3",
 			"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.6.3.tgz",
@@ -3075,6 +3188,12 @@
 			"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
 			"license": "MIT"
 		},
+		"node_modules/tiny-invariant": {
+			"version": "1.3.3",
+			"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
+			"integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==",
+			"license": "MIT"
+		},
 		"node_modules/tslib": {
 			"version": "2.8.1",
 			"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
diff --git a/package.json b/package.json
index bb0dd5e..677b5e5 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
 		"@wordpress/block-editor": "^14.13.0",
 		"@wordpress/components": "^29.4.0",
 		"@wordpress/i18n": "^5.18.0",
-		"react": "^18.3.1"
+		"react": "^18.3.1",
+		"react-beautiful-dnd": "^13.1.1"
 	}
 }
diff --git a/src/FlexibleTable/FlexibleTable.jsx b/src/FlexibleTable/FlexibleTable.jsx
index 6b8b090..40f6937 100644
--- a/src/FlexibleTable/FlexibleTable.jsx
+++ b/src/FlexibleTable/FlexibleTable.jsx
@@ -16,7 +16,7 @@ import FontStyles from "../FontStyles/FontStyles";
 import QuatroInput from "../QuatroInput/QuatroInput";
 import BlockPlaceholders from "../BlockPlaceholders/BlockPlaceholders";
 
-export default function Edit({attributes, setAttributes, placeholders, footer, additionalOptions }) {
+function FlexibleTable({attributes, setAttributes, placeholders, footer, additionalOptions }) {
 	const {
 		headers,
 		rows,
@@ -424,3 +424,5 @@ export default function Edit({attributes, setAttributes, placeholders, footer, a
 		</>
 	);
 }
+
+export default FlexibleTable;
-- 
GitLab