@ynput/ayon-frontend-shared 0.3.21 → 0.3.22
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/dist/_virtual/index.cjs14.js +1 -1
- package/dist/_virtual/index.cjs22.js +1 -1
- package/dist/_virtual/index.cjs23.js +1 -1
- package/dist/_virtual/index.cjs24.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es10.js +2 -2
- package/dist/_virtual/index.es11.js +2 -2
- package/dist/_virtual/index.es13.js +2 -2
- package/dist/_virtual/index.es14.js +5 -2
- package/dist/_virtual/index.es14.js.map +1 -1
- package/dist/_virtual/index.es22.js +3 -3
- package/dist/_virtual/index.es23.js +5 -5
- package/dist/_virtual/index.es24.js +5 -5
- package/dist/_virtual/index.es9.js +2 -5
- package/dist/_virtual/index.es9.js.map +1 -1
- package/dist/node_modules/parse-numeric-range/index.cjs.js +1 -1
- package/dist/node_modules/parse-numeric-range/index.es.js +1 -1
- package/dist/node_modules/rehype/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/node_modules/rehype/node_modules/unified/lib/index.es.js +2 -2
- package/dist/node_modules/rehype/node_modules/vfile/lib/index.cjs.js +1 -1
- package/dist/node_modules/rehype/node_modules/vfile/lib/index.es.js +1 -1
- package/dist/node_modules/rehype-parse/lib/index.cjs.js +1 -1
- package/dist/node_modules/rehype-parse/lib/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/module/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/module/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/type/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/type/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/index.cjs.js.map +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/utils/semver/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/sdk/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/sdk/dist/index.es.js +1 -1
- package/dist/shared/node_modules/react-is/index.cjs.js +1 -1
- package/dist/shared/node_modules/react-is/index.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.cjs.js.map +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.cjs.js.map +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.cjs.js.map +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.es.js +1 -1
- package/dist/shared/src/components/EnumEditor/DraggableEnumEditorItem.cjs.js +1 -1
- package/dist/shared/src/components/EnumEditor/DraggableEnumEditorItem.cjs.js.map +1 -1
- package/dist/shared/src/components/EnumEditor/DraggableEnumEditorItem.es.js +26 -24
- package/dist/shared/src/components/EnumEditor/DraggableEnumEditorItem.es.js.map +1 -1
- package/dist/shared/src/components/EnumEditor/EnumEditor.cjs.js +1 -1
- package/dist/shared/src/components/EnumEditor/EnumEditor.cjs.js.map +1 -1
- package/dist/shared/src/components/EnumEditor/EnumEditor.es.js +63 -60
- package/dist/shared/src/components/EnumEditor/EnumEditor.es.js.map +1 -1
- package/dist/shared/src/components/EnumEditor/EnumEditorItem.cjs.js +1 -1
- package/dist/shared/src/components/EnumEditor/EnumEditorItem.cjs.js.map +1 -1
- package/dist/shared/src/components/EnumEditor/EnumEditorItem.es.js +113 -92
- package/dist/shared/src/components/EnumEditor/EnumEditorItem.es.js.map +1 -1
- package/dist/shared/src/components/EnumEditor/hooks/useDraggable.cjs.js +1 -1
- package/dist/shared/src/components/EnumEditor/hooks/useDraggable.cjs.js.map +1 -1
- package/dist/shared/src/components/EnumEditor/hooks/useDraggable.es.js +36 -28
- package/dist/shared/src/components/EnumEditor/hooks/useDraggable.es.js.map +1 -1
- package/dist/types/components/EnumEditor/DraggableEnumEditorItem.d.ts +2 -1
- package/dist/types/components/EnumEditor/EnumEditor.d.ts +2 -1
- package/dist/types/components/EnumEditor/EnumEditorItem.d.ts +2 -1
- package/dist/types/components/EnumEditor/hooks/useDraggable.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,60 +1,68 @@
|
|
|
1
|
-
import { isEqual as f, uniqueId as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
creator:
|
|
5
|
-
initialData:
|
|
6
|
-
onChange:
|
|
1
|
+
import { isEqual as f, uniqueId as h } from "lodash";
|
|
2
|
+
import { useState as g, useEffect as E } from "react";
|
|
3
|
+
const y = ({
|
|
4
|
+
creator: r,
|
|
5
|
+
initialData: i,
|
|
6
|
+
onChange: p,
|
|
7
|
+
onCommit: I,
|
|
7
8
|
normalizer: o,
|
|
8
9
|
mergeIncomingData: u
|
|
9
10
|
}) => {
|
|
10
|
-
const [t,
|
|
11
|
-
|
|
11
|
+
const [t, a] = g(i), m = (e) => {
|
|
12
|
+
a(e);
|
|
12
13
|
const c = o(t), s = o(e);
|
|
13
|
-
f(c, s) ||
|
|
14
|
+
f(c, s) || p(s);
|
|
14
15
|
};
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
const c = o(e), s = o(
|
|
18
|
-
return f(c, s) ? e : u ? u(e,
|
|
16
|
+
return E(() => {
|
|
17
|
+
a((e) => {
|
|
18
|
+
const c = o(e), s = o(i);
|
|
19
|
+
return f(c, s) ? e : u ? u(e, i) : i;
|
|
19
20
|
});
|
|
20
|
-
}, [
|
|
21
|
+
}, [i, u, o]), {
|
|
21
22
|
items: t,
|
|
22
23
|
handleAddItem: (e) => {
|
|
23
|
-
|
|
24
|
+
m([...t, { ...r(), ...e, id: h() }]);
|
|
24
25
|
},
|
|
25
26
|
handleRemoveItem: (e) => () => {
|
|
26
|
-
|
|
27
|
+
m([...t.slice(0, e), ...t.slice(e + 1)]);
|
|
27
28
|
},
|
|
28
29
|
handleChangeItem: (e) => (c, s) => {
|
|
29
|
-
let
|
|
30
|
-
c.map((
|
|
30
|
+
let d = { ...t[e] };
|
|
31
|
+
c.map((n, l) => d[n] = s[l]), m([...t.slice(0, e), d, ...t.slice(e + 1)]);
|
|
32
|
+
},
|
|
33
|
+
handleCommitItem: (e) => (c, s) => {
|
|
34
|
+
if (!I) return;
|
|
35
|
+
let d = { ...t[e] };
|
|
36
|
+
c.map((l, v) => d[l] = s[v]);
|
|
37
|
+
const n = [...t.slice(0, e), d, ...t.slice(e + 1)];
|
|
38
|
+
I(o(n));
|
|
31
39
|
},
|
|
32
40
|
handleDuplicateItem: (e, c) => {
|
|
33
|
-
|
|
41
|
+
m([
|
|
34
42
|
...t.slice(0, e + 1),
|
|
35
|
-
{ ...t[e], id:
|
|
43
|
+
{ ...t[e], id: h(), ...c },
|
|
36
44
|
...t.slice(e + 1)
|
|
37
45
|
]);
|
|
38
46
|
},
|
|
39
47
|
handleDraggableEnd: (e) => {
|
|
40
48
|
if (!e.over)
|
|
41
49
|
return;
|
|
42
|
-
const c = t.find((
|
|
43
|
-
s <
|
|
50
|
+
const c = t.find((l) => l.id == e.active.id), s = t.indexOf(c), d = t.find((l) => l.id == e.over.id), n = t.indexOf(d);
|
|
51
|
+
s < n ? m([
|
|
44
52
|
...t.slice(0, s),
|
|
45
|
-
...t.slice(s + 1,
|
|
53
|
+
...t.slice(s + 1, n + 1),
|
|
46
54
|
c,
|
|
47
|
-
...t.slice(
|
|
48
|
-
]) :
|
|
49
|
-
...t.slice(0,
|
|
55
|
+
...t.slice(n + 1)
|
|
56
|
+
]) : m([
|
|
57
|
+
...t.slice(0, n),
|
|
50
58
|
c,
|
|
51
|
-
...t.slice(
|
|
59
|
+
...t.slice(n, s),
|
|
52
60
|
...t.slice(s + 1)
|
|
53
61
|
]);
|
|
54
62
|
}
|
|
55
63
|
};
|
|
56
64
|
};
|
|
57
65
|
export {
|
|
58
|
-
|
|
66
|
+
y as default
|
|
59
67
|
};
|
|
60
68
|
//# sourceMappingURL=useDraggable.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDraggable.es.js","sources":["../../../../../../src/components/EnumEditor/hooks/useDraggable.ts"],"sourcesContent":["import { DragEndEvent } from '@dnd-kit/core'\nimport { isEqual } from 'lodash'\nimport { uniqueId } from 'lodash'\nimport { useEffect, useState } from 'react'\n\nconst useDraggable = <T extends { id: string }, U>({\n creator,\n initialData,\n onChange,\n normalizer,\n mergeIncomingData,\n}: {\n creator: () => T\n initialData: T[]\n onChange: (data: U[]) => void\n normalizer: (data: T[]) => U[]\n mergeIncomingData?: (currentData: T[], incomingData: T[]) => T[]\n}) => {\n const [items, setItems] = useState<T[]>(initialData)\n\n const updateAndSync = (data: T[]) => {\n setItems(data)\n\n const currentNormalized = normalizer(items)\n const nextNormalized = normalizer(data)\n\n if (!isEqual(currentNormalized, nextNormalized)) {\n onChange(nextNormalized)\n }\n }\n\n useEffect(() => {\n setItems((currentItems) => {\n const currentNormalized = normalizer(currentItems)\n const incomingNormalized = normalizer(initialData)\n\n if (isEqual(currentNormalized, incomingNormalized)) {\n return currentItems\n }\n\n return mergeIncomingData ? mergeIncomingData(currentItems, initialData) : initialData\n })\n }, [initialData, mergeIncomingData, normalizer])\n\n const handleAddItem = (overrides: Partial<T>) => {\n updateAndSync([...items, { ...creator(), ...overrides, id: uniqueId() }])\n }\n\n const handleRemoveItem = (idx: number) => () => {\n updateAndSync([...items.slice(0, idx), ...items.slice(idx + 1)])\n }\n\n const handleChangeItem =\n (idx: number) => (attrs: (keyof T)[], values: (boolean | string | undefined)[]) => {\n let updatedItem: T = { ...items[idx] }\n //@ts-ignore\n attrs.map((attr, index) => (updatedItem[attr] = values[index]))\n updateAndSync([...items.slice(0, idx), updatedItem, ...items.slice(idx + 1)])\n }\n\n const handleDuplicateItem = (idx: number, overrides: Partial<T>) => {\n updateAndSync([\n ...items.slice(0, idx + 1),\n { ...items[idx], id: uniqueId(), ...overrides },\n ...items.slice(idx + 1),\n ])\n }\n\n const handleDraggableEnd = (event: DragEndEvent) => {\n if (!event.over) {\n return\n }\n\n const activeItem = items.find((filterItem) => filterItem.id == event.active.id)\n const activeItemIndex = items.indexOf(activeItem!)\n const overItem = items.find((item) => item.id == event.over!.id)\n const overItemIndex = items.indexOf(overItem!)\n\n if (activeItemIndex < overItemIndex) {\n updateAndSync([\n ...items.slice(0, activeItemIndex),\n ...items.slice(activeItemIndex + 1, overItemIndex + 1),\n activeItem!,\n ...items.slice(overItemIndex + 1),\n ])\n } else {\n updateAndSync([\n ...items.slice(0, overItemIndex),\n activeItem!,\n ...items.slice(overItemIndex, activeItemIndex),\n ...items.slice(activeItemIndex + 1),\n ])\n }\n }\n\n return {\n items,\n handleAddItem,\n handleRemoveItem,\n handleChangeItem,\n handleDuplicateItem,\n handleDraggableEnd,\n }\n}\n\nexport default useDraggable\n"],"names":["useDraggable","creator","initialData","onChange","normalizer","mergeIncomingData","items","setItems","useState","updateAndSync","data","currentNormalized","nextNormalized","isEqual","useEffect","currentItems","incomingNormalized","overrides","uniqueId","idx","attrs","values","updatedItem","attr","index","event","activeItem","filterItem","activeItemIndex","overItem","item","overItemIndex"],"mappings":";;AAKA,MAAMA,IAAe,CAA8B;AAAA,EACjD,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AACF,
|
|
1
|
+
{"version":3,"file":"useDraggable.es.js","sources":["../../../../../../src/components/EnumEditor/hooks/useDraggable.ts"],"sourcesContent":["import { DragEndEvent } from '@dnd-kit/core'\nimport { isEqual } from 'lodash'\nimport { uniqueId } from 'lodash'\nimport { useEffect, useState } from 'react'\n\nconst useDraggable = <T extends { id: string }, U>({\n creator,\n initialData,\n onChange,\n onCommit,\n normalizer,\n mergeIncomingData,\n}: {\n creator: () => T\n initialData: T[]\n onChange: (data: U[]) => void\n onCommit?: (data: U[]) => void\n normalizer: (data: T[]) => U[]\n mergeIncomingData?: (currentData: T[], incomingData: T[]) => T[]\n}) => {\n const [items, setItems] = useState<T[]>(initialData)\n\n const updateAndSync = (data: T[]) => {\n setItems(data)\n\n const currentNormalized = normalizer(items)\n const nextNormalized = normalizer(data)\n\n if (!isEqual(currentNormalized, nextNormalized)) {\n onChange(nextNormalized)\n }\n }\n\n useEffect(() => {\n setItems((currentItems) => {\n const currentNormalized = normalizer(currentItems)\n const incomingNormalized = normalizer(initialData)\n\n if (isEqual(currentNormalized, incomingNormalized)) {\n return currentItems\n }\n\n return mergeIncomingData ? mergeIncomingData(currentItems, initialData) : initialData\n })\n }, [initialData, mergeIncomingData, normalizer])\n\n const handleAddItem = (overrides: Partial<T>) => {\n updateAndSync([...items, { ...creator(), ...overrides, id: uniqueId() }])\n }\n\n const handleRemoveItem = (idx: number) => () => {\n updateAndSync([...items.slice(0, idx), ...items.slice(idx + 1)])\n }\n\n const handleChangeItem =\n (idx: number) => (attrs: (keyof T)[], values: (boolean | string | undefined)[]) => {\n let updatedItem: T = { ...items[idx] }\n //@ts-ignore\n attrs.map((attr, index) => (updatedItem[attr] = values[index]))\n updateAndSync([...items.slice(0, idx), updatedItem, ...items.slice(idx + 1)])\n }\n\n const handleCommitItem =\n (idx: number) => (attrs: (keyof T)[], values: (boolean | string | undefined)[]) => {\n if (!onCommit) return\n let updatedItem: T = { ...items[idx] }\n //@ts-ignore\n attrs.map((attr, index) => (updatedItem[attr] = values[index]))\n const nextItems = [...items.slice(0, idx), updatedItem, ...items.slice(idx + 1)]\n onCommit(normalizer(nextItems))\n }\n\n const handleDuplicateItem = (idx: number, overrides: Partial<T>) => {\n updateAndSync([\n ...items.slice(0, idx + 1),\n { ...items[idx], id: uniqueId(), ...overrides },\n ...items.slice(idx + 1),\n ])\n }\n\n const handleDraggableEnd = (event: DragEndEvent) => {\n if (!event.over) {\n return\n }\n\n const activeItem = items.find((filterItem) => filterItem.id == event.active.id)\n const activeItemIndex = items.indexOf(activeItem!)\n const overItem = items.find((item) => item.id == event.over!.id)\n const overItemIndex = items.indexOf(overItem!)\n\n if (activeItemIndex < overItemIndex) {\n updateAndSync([\n ...items.slice(0, activeItemIndex),\n ...items.slice(activeItemIndex + 1, overItemIndex + 1),\n activeItem!,\n ...items.slice(overItemIndex + 1),\n ])\n } else {\n updateAndSync([\n ...items.slice(0, overItemIndex),\n activeItem!,\n ...items.slice(overItemIndex, activeItemIndex),\n ...items.slice(activeItemIndex + 1),\n ])\n }\n }\n\n return {\n items,\n handleAddItem,\n handleRemoveItem,\n handleChangeItem,\n handleCommitItem,\n handleDuplicateItem,\n handleDraggableEnd,\n }\n}\n\nexport default useDraggable\n"],"names":["useDraggable","creator","initialData","onChange","onCommit","normalizer","mergeIncomingData","items","setItems","useState","updateAndSync","data","currentNormalized","nextNormalized","isEqual","useEffect","currentItems","incomingNormalized","overrides","uniqueId","idx","attrs","values","updatedItem","attr","index","nextItems","event","activeItem","filterItem","activeItemIndex","overItem","item","overItemIndex"],"mappings":";;AAKA,MAAMA,IAAe,CAA8B;AAAA,EACjD,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AACF,MAOM;AACJ,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAcP,CAAW,GAE7CQ,IAAgB,CAACC,MAAc;AACnC,IAAAH,EAASG,CAAI;AAEb,UAAMC,IAAoBP,EAAWE,CAAK,GACpCM,IAAiBR,EAAWM,CAAI;AAE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Attributes<
|
|
|
11
11
|
item: AttributeData;
|
|
12
12
|
isBeingDragged?: boolean;
|
|
13
13
|
onChange?: (attr: (keyof AttributeData)[], value: (boolean | string | undefined)[]) => void;
|
|
14
|
+
onCommit?: (attr: (keyof AttributeData)[], value: (boolean | string | undefined)[]) => void;
|
|
14
15
|
onRemove?: () => void;
|
|
15
16
|
onDuplicate?: () => void;
|
|
16
17
|
pt?: DraggableEnumEditorItemPt;
|
|
17
18
|
}
|
|
18
|
-
declare const DraggableEnumEditorItem: ({ item, isBeingDragged, onChange, onRemove, onDuplicate, pt, ...props }: DraggableEnumEditorItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const DraggableEnumEditorItem: ({ item, isBeingDragged, onChange, onCommit, onRemove, onDuplicate, pt, ...props }: DraggableEnumEditorItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export default DraggableEnumEditorItem;
|
|
@@ -23,7 +23,8 @@ export type NormalizedData = {
|
|
|
23
23
|
interface EnumEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
24
24
|
values: NormalizedData[];
|
|
25
25
|
onChange: (data: NormalizedData[]) => void;
|
|
26
|
+
onCommit?: (data: NormalizedData[]) => void;
|
|
26
27
|
pt?: EnumEditorPt;
|
|
27
28
|
}
|
|
28
|
-
export declare const EnumEditor: ({ values, onChange, pt, ...props }: EnumEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
|
+
export declare const EnumEditor: ({ values, onChange, onCommit, pt, ...props }: EnumEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
30
|
export {};
|
|
@@ -20,6 +20,7 @@ export interface EnumEditorItemPt {
|
|
|
20
20
|
export interface EnumEditorItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
21
21
|
item: AttributeData;
|
|
22
22
|
onChange?: (attr: (keyof AttributeData)[], value: (boolean | string | undefined)[]) => void;
|
|
23
|
+
onCommit?: (attr: (keyof AttributeData)[], value: (boolean | string | undefined)[]) => void;
|
|
23
24
|
onRemove?: () => void;
|
|
24
25
|
onDuplicate?: () => void;
|
|
25
26
|
showRemoveButton?: boolean;
|
|
@@ -28,5 +29,5 @@ export interface EnumEditorItemProps extends Omit<React.HTMLAttributes<HTMLDivEl
|
|
|
28
29
|
isExpanded?: boolean;
|
|
29
30
|
pt?: EnumEditorItemPt;
|
|
30
31
|
}
|
|
31
|
-
declare const EnumEditorItem: ({ item, onChange, onRemove, onDuplicate, showRemoveButton, showDuplicateButton, autoFocus, isExpanded, className, pt, ...props }: EnumEditorItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
declare const EnumEditorItem: ({ item, onChange, onCommit, onRemove, onDuplicate, showRemoveButton, showDuplicateButton, autoFocus, isExpanded, className, pt, ...props }: EnumEditorItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
33
|
export default EnumEditorItem;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DragEndEvent } from '@dnd-kit/core';
|
|
2
2
|
declare const useDraggable: <T extends {
|
|
3
3
|
id: string;
|
|
4
|
-
}, U>({ creator, initialData, onChange, normalizer, mergeIncomingData, }: {
|
|
4
|
+
}, U>({ creator, initialData, onChange, onCommit, normalizer, mergeIncomingData, }: {
|
|
5
5
|
creator: () => T;
|
|
6
6
|
initialData: T[];
|
|
7
7
|
onChange: (data: U[]) => void;
|
|
8
|
+
onCommit?: (data: U[]) => void;
|
|
8
9
|
normalizer: (data: T[]) => U[];
|
|
9
10
|
mergeIncomingData?: (currentData: T[], incomingData: T[]) => T[];
|
|
10
11
|
}) => {
|
|
@@ -12,6 +13,7 @@ declare const useDraggable: <T extends {
|
|
|
12
13
|
handleAddItem: (overrides: Partial<T>) => void;
|
|
13
14
|
handleRemoveItem: (idx: number) => () => void;
|
|
14
15
|
handleChangeItem: (idx: number) => (attrs: (keyof T)[], values: (boolean | string | undefined)[]) => void;
|
|
16
|
+
handleCommitItem: (idx: number) => (attrs: (keyof T)[], values: (boolean | string | undefined)[]) => void;
|
|
15
17
|
handleDuplicateItem: (idx: number, overrides: Partial<T>) => void;
|
|
16
18
|
handleDraggableEnd: (event: DragEndEvent) => void;
|
|
17
19
|
};
|