@etsoo/materialui 1.1.11 → 1.1.13

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.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare const DnDItemStyle: (index: number, isDragging: boolean, theme: T
17
17
  /**
18
18
  * DnD list forward ref
19
19
  */
20
- export interface DnDListRef<D extends object, K extends DataTypes.Keys<D>> {
20
+ export interface DnDListRef<D extends object> {
21
21
  /**
22
22
  * Add item
23
23
  * @param item New item
@@ -39,10 +39,6 @@ export interface DnDListRef<D extends object, K extends DataTypes.Keys<D>> {
39
39
  * @param index Index
40
40
  */
41
41
  editItem(newItem: D, index: number): boolean;
42
- /**
43
- * Get deleted ids
44
- */
45
- getDeletedIds(): D[K][];
46
42
  /**
47
43
  * Get all items
48
44
  */
@@ -75,7 +71,7 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
75
71
  /**
76
72
  * Methods ref
77
73
  */
78
- mRef?: React.Ref<DnDListRef<D, K>>;
74
+ mRef?: React.Ref<DnDListRef<D>>;
79
75
  /**
80
76
  * Data change handler
81
77
  */
package/lib/DnDList.js CHANGED
@@ -57,7 +57,6 @@ export function DnDList(props) {
57
57
  // States
58
58
  const [items, setItems] = React.useState([]);
59
59
  const [activeId, setActiveId] = React.useState();
60
- const deletedIds = React.useRef([]);
61
60
  const doFormChange = (newItems) => {
62
61
  if (onFormChange)
63
62
  onFormChange(newItems !== null && newItems !== void 0 ? newItems : items);
@@ -142,18 +141,10 @@ export function DnDList(props) {
142
141
  // Clone
143
142
  const newItems = [...items];
144
143
  // Remove the item
145
- const deleted = newItems.splice(index, 1);
146
- deleted.forEach((d) => {
147
- const id = d[keyField];
148
- if (!deletedIds.current.includes(id))
149
- deletedIds.current.push(id);
150
- });
144
+ newItems.splice(index, 1);
151
145
  // Update the state
152
146
  changeItems(newItems);
153
147
  },
154
- getDeletedIds() {
155
- return deletedIds.current;
156
- },
157
148
  getItems() {
158
149
  return items;
159
150
  }
@@ -175,7 +166,6 @@ export function DnDList(props) {
175
166
  };
176
167
  React.useEffect(() => {
177
168
  setItems(props.items);
178
- deletedIds.current = [];
179
169
  }, [props.items]);
180
170
  const children = (React.createElement(DndContext, { onDragStart: handleDragStart, onDragEnd: handleDragEnd },
181
171
  React.createElement(SortableContext, { items: items, strategy: verticalListSortingStrategy }, items.map((item, index) => {
@@ -93,7 +93,7 @@ export function OptionGroup(props) {
93
93
  // Layout
94
94
  return (React.createElement(React.Fragment, null,
95
95
  React.createElement(FormControl, { component: "fieldset", fullWidth: fullWidth, ...rest },
96
- label && (React.createElement(InputLabel, { required: required, variant: variant, shrink: true }, label)),
96
+ label && variant !== "outlined" && (React.createElement(InputLabel, { required: required, variant: variant, shrink: true }, label)),
97
97
  React.createElement(Box, { paddingLeft: 2, paddingY: "7px" }, group),
98
98
  variant === "outlined" && (React.createElement(NotchedOutline, { label: label && required ? label + " *" : label, notched: true, style: {
99
99
  position: "absolute",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -55,10 +55,10 @@
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.5",
58
+ "@mui/material": "^5.11.6",
59
59
  "@types/pica": "^9.0.1",
60
60
  "@types/pulltorefreshjs": "^0.1.5",
61
- "@types/react": "^18.0.26",
61
+ "@types/react": "^18.0.27",
62
62
  "@types/react-avatar-editor": "^13.0.0",
63
63
  "@types/react-dom": "^18.0.10",
64
64
  "@types/react-input-mask": "^3.0.2",
@@ -70,7 +70,7 @@
70
70
  "react-dom": "^18.2.0",
71
71
  "react-draggable": "^4.4.5",
72
72
  "react-imask": "^6.4.3",
73
- "react-router-dom": "^6.6.2",
73
+ "react-router-dom": "^6.7.0",
74
74
  "react-window": "^1.8.8"
75
75
  },
76
76
  "devDependencies": {
@@ -80,14 +80,14 @@
80
80
  "@babel/preset-env": "^7.20.2",
81
81
  "@babel/preset-react": "^7.18.6",
82
82
  "@babel/preset-typescript": "^7.18.6",
83
- "@babel/runtime-corejs3": "^7.20.7",
83
+ "@babel/runtime-corejs3": "^7.20.13",
84
84
  "@testing-library/jest-dom": "^5.16.5",
85
85
  "@testing-library/react": "^13.4.0",
86
- "@types/jest": "^29.2.5",
87
- "@typescript-eslint/eslint-plugin": "^5.48.2",
88
- "@typescript-eslint/parser": "^5.48.2",
89
- "jest": "^29.3.1",
90
- "jest-environment-jsdom": "^29.3.1",
86
+ "@types/jest": "^29.4.0",
87
+ "@typescript-eslint/eslint-plugin": "^5.49.0",
88
+ "@typescript-eslint/parser": "^5.49.0",
89
+ "jest": "^29.4.0",
90
+ "jest-environment-jsdom": "^29.4.0",
91
91
  "typescript": "^4.9.4"
92
92
  }
93
93
  }
package/src/DnDList.tsx CHANGED
@@ -79,7 +79,7 @@ export const DnDItemStyle = (
79
79
  /**
80
80
  * DnD list forward ref
81
81
  */
82
- export interface DnDListRef<D extends object, K extends DataTypes.Keys<D>> {
82
+ export interface DnDListRef<D extends object> {
83
83
  /**
84
84
  * Add item
85
85
  * @param item New item
@@ -105,11 +105,6 @@ export interface DnDListRef<D extends object, K extends DataTypes.Keys<D>> {
105
105
  */
106
106
  editItem(newItem: D, index: number): boolean;
107
107
 
108
- /**
109
- * Get deleted ids
110
- */
111
- getDeletedIds(): D[K][];
112
-
113
108
  /**
114
109
  * Get all items
115
110
  */
@@ -153,7 +148,7 @@ export interface DnDListPros<D extends object, K extends DataTypes.Keys<D>> {
153
148
  /**
154
149
  * Methods ref
155
150
  */
156
- mRef?: React.Ref<DnDListRef<D, K>>;
151
+ mRef?: React.Ref<DnDListRef<D>>;
157
152
 
158
153
  /**
159
154
  * Data change handler
@@ -205,7 +200,6 @@ export function DnDList<
205
200
  // States
206
201
  const [items, setItems] = React.useState<D[]>([]);
207
202
  const [activeId, setActiveId] = React.useState<UniqueIdentifier>();
208
- const deletedIds = React.useRef<D[K][]>([]);
209
203
 
210
204
  const doFormChange = (newItems?: D[]) => {
211
205
  if (onFormChange) onFormChange(newItems ?? items);
@@ -322,20 +316,12 @@ export function DnDList<
322
316
  const newItems = [...items];
323
317
 
324
318
  // Remove the item
325
- const deleted = newItems.splice(index, 1);
326
- deleted.forEach((d) => {
327
- const id = d[keyField];
328
- if (!deletedIds.current.includes(id)) deletedIds.current.push(id);
329
- });
319
+ newItems.splice(index, 1);
330
320
 
331
321
  // Update the state
332
322
  changeItems(newItems);
333
323
  },
334
324
 
335
- getDeletedIds() {
336
- return deletedIds.current;
337
- },
338
-
339
325
  getItems() {
340
326
  return items;
341
327
  }
@@ -369,7 +355,6 @@ export function DnDList<
369
355
 
370
356
  React.useEffect(() => {
371
357
  setItems(props.items);
372
- deletedIds.current = [];
373
358
  }, [props.items]);
374
359
 
375
360
  const children = (
@@ -277,7 +277,7 @@ export function OptionGroup<
277
277
  return (
278
278
  <React.Fragment>
279
279
  <FormControl component="fieldset" fullWidth={fullWidth} {...rest}>
280
- {label && (
280
+ {label && variant !== "outlined" && (
281
281
  <InputLabel required={required} variant={variant} shrink>
282
282
  {label}
283
283
  </InputLabel>