@etsoo/react 1.4.9 → 1.4.10

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/lib/mu/DnDList.js CHANGED
@@ -49,7 +49,9 @@ export function DnDList(props) {
49
49
  // Edit item
50
50
  const editItem = (newItem, index) => {
51
51
  // Existence check
52
- if (items.some((item) => item[labelField] === newItem[labelField])) {
52
+ const newIndex = items.findIndex((item) => item[labelField] === newItem[labelField]);
53
+ if (newIndex >= 0 && newIndex != index) {
54
+ // Label field is the same with a different item
53
55
  return false;
54
56
  }
55
57
  // Clone
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -146,7 +146,11 @@ export function DnDList<
146
146
  // Edit item
147
147
  const editItem = (newItem: D, index: number) => {
148
148
  // Existence check
149
- if (items.some((item) => item[labelField] === newItem[labelField])) {
149
+ const newIndex = items.findIndex(
150
+ (item) => item[labelField] === newItem[labelField]
151
+ );
152
+ if (newIndex >= 0 && newIndex != index) {
153
+ // Label field is the same with a different item
150
154
  return false;
151
155
  }
152
156