@etsoo/materialui 1.1.8 → 1.1.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/DnDList.js +12 -9
- package/package.json +4 -4
- package/src/DnDList.tsx +33 -24
package/lib/DnDList.js
CHANGED
|
@@ -167,13 +167,16 @@ export function DnDList(props) {
|
|
|
167
167
|
React.useEffect(() => {
|
|
168
168
|
setItems(props.items);
|
|
169
169
|
}, [props.items]);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
170
|
+
const children = (React.createElement(DndContext, { onDragStart: handleDragStart, onDragEnd: handleDragEnd },
|
|
171
|
+
React.createElement(SortableContext, { items: items, strategy: verticalListSortingStrategy }, items.map((item, index) => {
|
|
172
|
+
const id = item[keyField];
|
|
173
|
+
return (React.createElement(SortableItem, { id: id, key: id, style: getItemStyle(index, id === activeId), itemRenderer: (nodeRef, actionNodeRef) => itemRenderer(item, index, nodeRef, actionNodeRef) }));
|
|
174
|
+
}))));
|
|
175
|
+
if (onFormChange) {
|
|
176
|
+
return (React.createElement("div", { style: { width: "100%" }, ref: (div) => {
|
|
177
|
+
if (div)
|
|
178
|
+
setupDiv(div);
|
|
179
|
+
} }, children));
|
|
180
|
+
}
|
|
181
|
+
return children;
|
|
179
182
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@etsoo/react": "^1.6.42",
|
|
56
56
|
"@etsoo/shared": "^1.1.88",
|
|
57
57
|
"@mui/icons-material": "^5.11.0",
|
|
58
|
-
"@mui/material": "^5.11.
|
|
58
|
+
"@mui/material": "^5.11.5",
|
|
59
59
|
"@types/pica": "^9.0.1",
|
|
60
60
|
"@types/pulltorefreshjs": "^0.1.5",
|
|
61
61
|
"@types/react": "^18.0.26",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"@testing-library/jest-dom": "^5.16.5",
|
|
85
85
|
"@testing-library/react": "^13.4.0",
|
|
86
86
|
"@types/jest": "^29.2.5",
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "^5.48.
|
|
88
|
-
"@typescript-eslint/parser": "^5.48.
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
|
88
|
+
"@typescript-eslint/parser": "^5.48.2",
|
|
89
89
|
"jest": "^29.3.1",
|
|
90
90
|
"jest-environment-jsdom": "^29.3.1",
|
|
91
91
|
"typescript": "^4.9.4"
|
package/src/DnDList.tsx
CHANGED
|
@@ -357,29 +357,38 @@ export function DnDList<
|
|
|
357
357
|
setItems(props.items);
|
|
358
358
|
}, [props.items]);
|
|
359
359
|
|
|
360
|
-
|
|
361
|
-
<
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
/>
|
|
379
|
-
);
|
|
380
|
-
})}
|
|
381
|
-
</SortableContext>
|
|
382
|
-
</DndContext>
|
|
383
|
-
</div>
|
|
360
|
+
const children = (
|
|
361
|
+
<DndContext onDragStart={handleDragStart} onDragEnd={handleDragEnd}>
|
|
362
|
+
<SortableContext items={items} strategy={verticalListSortingStrategy}>
|
|
363
|
+
{items.map((item, index) => {
|
|
364
|
+
const id = item[keyField] as unknown as UniqueIdentifier;
|
|
365
|
+
return (
|
|
366
|
+
<SortableItem
|
|
367
|
+
id={id}
|
|
368
|
+
key={id}
|
|
369
|
+
style={getItemStyle!(index, id === activeId)}
|
|
370
|
+
itemRenderer={(nodeRef, actionNodeRef) =>
|
|
371
|
+
itemRenderer(item, index, nodeRef, actionNodeRef)
|
|
372
|
+
}
|
|
373
|
+
/>
|
|
374
|
+
);
|
|
375
|
+
})}
|
|
376
|
+
</SortableContext>
|
|
377
|
+
</DndContext>
|
|
384
378
|
);
|
|
379
|
+
|
|
380
|
+
if (onFormChange) {
|
|
381
|
+
return (
|
|
382
|
+
<div
|
|
383
|
+
style={{ width: "100%" }}
|
|
384
|
+
ref={(div) => {
|
|
385
|
+
if (div) setupDiv(div);
|
|
386
|
+
}}
|
|
387
|
+
>
|
|
388
|
+
{children}
|
|
389
|
+
</div>
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return children;
|
|
385
394
|
}
|