@react-aria/dnd 3.8.1 → 3.9.1
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/ListDropTargetDelegate.main.js +3 -1
- package/dist/ListDropTargetDelegate.main.js.map +1 -1
- package/dist/ListDropTargetDelegate.mjs +3 -1
- package/dist/ListDropTargetDelegate.module.js +3 -1
- package/dist/ListDropTargetDelegate.module.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useClipboard.main.js +6 -2
- package/dist/useClipboard.main.js.map +1 -1
- package/dist/useClipboard.mjs +6 -2
- package/dist/useClipboard.module.js +6 -2
- package/dist/useClipboard.module.js.map +1 -1
- package/package.json +9 -9
- package/src/ListDropTargetDelegate.ts +2 -1
- package/src/useClipboard.ts +3 -3
|
@@ -27,6 +27,7 @@ class $2268795bbb597ecb$export$fbd65d14c79e28cc {
|
|
|
27
27
|
return this.getFlowEnd(rect) - this.getFlowStart(rect);
|
|
28
28
|
}
|
|
29
29
|
getDropTargetFromPoint(x, y, isValidDropTarget) {
|
|
30
|
+
var _this_ref_current;
|
|
30
31
|
if (this.collection[Symbol.iterator]().next().done || !this.ref.current) return {
|
|
31
32
|
type: 'root'
|
|
32
33
|
};
|
|
@@ -39,7 +40,8 @@ class $2268795bbb597ecb$export$fbd65d14c79e28cc {
|
|
|
39
40
|
let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';
|
|
40
41
|
let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';
|
|
41
42
|
let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;
|
|
42
|
-
let
|
|
43
|
+
let collection = (_this_ref_current = this.ref.current) === null || _this_ref_current === void 0 ? void 0 : _this_ref_current.dataset.collection;
|
|
44
|
+
let elements = this.ref.current.querySelectorAll(collection ? `[data-collection="${CSS.escape(collection)}"]` : '[data-key]');
|
|
43
45
|
let elementMap = new Map();
|
|
44
46
|
for (let item of elements)if (item instanceof HTMLElement && item.dataset.key != null) elementMap.set(item.dataset.key, item);
|
|
45
47
|
// TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,EAAE;QAClC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,eAAe,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC;IACvF;IAEQ,WAAW,IAAa,EAAE;QAChC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,eAAe,CAAC;IACnF;IAEQ,YAAY,IAAa,EAAE;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,CAAC,YAAY,CAAC;IACnD;IAEA,uBAAuB,CAAS,EAAE,CAAS,EAAE,iBAAkD,EAAc;QAC3G,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EACrE,OAAO;YAAC,MAAM;QAAM;QAGtB,IAAI,OAA4B,IAAI,CAAC,GAAG,CAAC,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QAAS,CAAA,UAAU,IAAI,CAAC,eAAe,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAK,GACnI,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,UAAU;QACtC;QAGF,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IAzIA,YAAY,UAAmC,EAAE,GAAkC,EAAE,OAAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAoIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,EAAE;QAClC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,eAAe,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC;IACvF;IAEQ,WAAW,IAAa,EAAE;QAChC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,eAAe,CAAC;IACnF;IAEQ,YAAY,IAAa,EAAE;QACjC,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AY,CAAC,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ;oBAC7D,IAAI,QAAQ,OAAO,kBAAkB;wBAAC,GAAG,MAAM;wBAAE,cAAc;oBAAQ,IACrE,OAAO,YAAY,GAAG,YAAY,UAAU;yBACvC,IAAI,QAAQ,OAAO,kBAAkB;wBAAC,GAAG,MAAM;wBAAE,cAAc;oBAAO,IAC3E,OAAO,YAAY,GAAG,YAAY,WAAW;gBAEjD;gBAEA,OAAO;YACT;QACF;QAEA,IAAI,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,MAAM,GAAG,GAAG;QACjD,IAAI,UAAU,WAAW,GAAG,CAAC,OAAO,KAAK,GAAG;QAC5C,OAAO,oBAAA,8BAAA,QAAS,qBAAqB;QAErC,IAAI,QAAS,CAAA,UAAU,IAAI,CAAC,eAAe,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAK,GACnI,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,UAAU;QACtC;QAGF,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IA1IA,YAAY,UAAmC,EAAE,GAAkC,EAAE,OAAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAqIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let collection = this.ref.current?.dataset.collection;\n let elements = this.ref.current.querySelectorAll(collection ? `[data-collection=\"${CSS.escape(collection)}\"]` : '[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.main.js.map"}
|
|
@@ -21,6 +21,7 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
21
21
|
return this.getFlowEnd(rect) - this.getFlowStart(rect);
|
|
22
22
|
}
|
|
23
23
|
getDropTargetFromPoint(x, y, isValidDropTarget) {
|
|
24
|
+
var _this_ref_current;
|
|
24
25
|
if (this.collection[Symbol.iterator]().next().done || !this.ref.current) return {
|
|
25
26
|
type: 'root'
|
|
26
27
|
};
|
|
@@ -33,7 +34,8 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
33
34
|
let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';
|
|
34
35
|
let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';
|
|
35
36
|
let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;
|
|
36
|
-
let
|
|
37
|
+
let collection = (_this_ref_current = this.ref.current) === null || _this_ref_current === void 0 ? void 0 : _this_ref_current.dataset.collection;
|
|
38
|
+
let elements = this.ref.current.querySelectorAll(collection ? `[data-collection="${CSS.escape(collection)}"]` : '[data-key]');
|
|
37
39
|
let elementMap = new Map();
|
|
38
40
|
for (let item of elements)if (item instanceof HTMLElement && item.dataset.key != null) elementMap.set(item.dataset.key, item);
|
|
39
41
|
// TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader
|
|
@@ -21,6 +21,7 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
21
21
|
return this.getFlowEnd(rect) - this.getFlowStart(rect);
|
|
22
22
|
}
|
|
23
23
|
getDropTargetFromPoint(x, y, isValidDropTarget) {
|
|
24
|
+
var _this_ref_current;
|
|
24
25
|
if (this.collection[Symbol.iterator]().next().done || !this.ref.current) return {
|
|
25
26
|
type: 'root'
|
|
26
27
|
};
|
|
@@ -33,7 +34,8 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
33
34
|
let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';
|
|
34
35
|
let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';
|
|
35
36
|
let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;
|
|
36
|
-
let
|
|
37
|
+
let collection = (_this_ref_current = this.ref.current) === null || _this_ref_current === void 0 ? void 0 : _this_ref_current.dataset.collection;
|
|
38
|
+
let elements = this.ref.current.querySelectorAll(collection ? `[data-collection="${CSS.escape(collection)}"]` : '[data-key]');
|
|
37
39
|
let elementMap = new Map();
|
|
38
40
|
for (let item of elements)if (item instanceof HTMLElement && item.dataset.key != null) elementMap.set(item.dataset.key, item);
|
|
39
41
|
// TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,EAAE;QAClC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,eAAe,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC;IACvF;IAEQ,WAAW,IAAa,EAAE;QAChC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,eAAe,CAAC;IACnF;IAEQ,YAAY,IAAa,EAAE;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,CAAC,YAAY,CAAC;IACnD;IAEA,uBAAuB,CAAS,EAAE,CAAS,EAAE,iBAAkD,EAAc;QAC3G,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,GAAG,I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,MAAM,MAAM,GAAG,GAAG;QACjD,IAAI,UAAU,WAAW,GAAG,CAAC,OAAO,KAAK,GAAG;QAC5C,OAAO,oBAAA,8BAAA,QAAS,qBAAqB;QAErC,IAAI,QAAS,CAAA,UAAU,IAAI,CAAC,eAAe,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAK,GACnI,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,UAAU;QACtC;QAGF,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IAzIA,YAAY,UAAmC,EAAE,GAAkC,EAAE,OAAuC,CAAE;QAC5H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AAoIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.module.js.map"}
|
|
1
|
+
{"mappings":"AA8BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,EAAE;QAClC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,eAAe,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC;IACvF;IAEQ,WAAW,IAAa,EAAE;QAChC,O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AAS,SAAS,KAAI;IACzC;AAqIF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Direction, DropTarget, DropTargetDelegate, Node, Orientation, RefObject} from '@react-types/shared';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Iterable<Node<unknown>>;\n private ref: RefObject<HTMLElement | null>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Iterable<Node<unknown>>, ref: RefObject<HTMLElement | null>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection[Symbol.iterator]().next().done || !this.ref.current) {\n return {type: 'root'};\n }\n\n let rect: DOMRect | undefined = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let collection = this.ref.current?.dataset.collection;\n let elements = this.ref.current.querySelectorAll(collection ? `[data-collection=\"${CSS.escape(collection)}\"]` : '[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement && item.dataset.key != null) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n // TODO: assume that only item type items are valid drop targets. This is to prevent a crash when dragging over the loader\n // row since it doesn't have a data-key set on it. Will eventually need to handle the case with drag and drop and loaders located between rows aka tree.\n // Can see https://github.com/adobe/react-spectrum/pull/4210/files#diff-21e555e0c597a28215e36137f5be076a65a1e1456c92cd0fdd60f866929aae2a for additional logic\n // that may need to happen then\n let items = [...this.collection].filter(item => item.type === 'item');\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n if (!element) {\n break;\n }\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element?.getBoundingClientRect();\n\n if (rect && (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -181,7 +181,9 @@ export interface DragPreviewProps {
|
|
|
181
181
|
export const DragPreview: React.ForwardRefExoticComponent<DragPreviewProps & React.RefAttributes<DragPreviewRenderer | null>>;
|
|
182
182
|
export interface ClipboardProps {
|
|
183
183
|
/** A function that returns the items to copy. */
|
|
184
|
-
getItems?: (
|
|
184
|
+
getItems?: (details: {
|
|
185
|
+
action: 'cut' | 'copy';
|
|
186
|
+
}) => DragItem[];
|
|
185
187
|
/** Handler that is called when the user triggers a copy interaction. */
|
|
186
188
|
onCopy?: () => void;
|
|
187
189
|
/** Handler that is called when the user triggers a cut interaction. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;ACuBA,OAAO,MAAM,kCAA8B,CAAC;AA0S5C,sDAAsD;AACtD,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,6CAA6C;AAC7C,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,kDAAkD;AAClD,oCAAoC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,iBAAiB,CAErF;AC1OD,eAAe;AACf,qCAAqC,OAAO,CAE3C;AGlFD;IACE,uCAAuC;IACvC,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACxC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,aAAa,CAAC;IAC5F,yFAAyF;IACzF,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;IAC1H,uEAAuE;IACvE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,gFAAgF;IAChF,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,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UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;IACE,+DAA+D;IAC/D,cAAc,EAAE,aAAa,CAAA;CAC9B;AA6BD;;;GAGG;AACH,6BAA6B,OAAO,EAAE,cAAc,GAAG,eAAe,CAmFrE;ACpJD;IACE;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAWD,mCAAoC,YAAW,kBAAkB;gBAOnD,UAAU,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,6BAA6B;IAoC5H,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU;CAuG7G;AC3JD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/constants.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/utils.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragManager.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useAutoScroll.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useVirtualDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDropIndicator.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrag.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragPreview.tsx","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useClipboard.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/ListDropTargetDelegate.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/index.ts","packages/@react-aria/dnd/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {DroppableCollectionOptions, DroppableCollectionResult} from './useDroppableCollection';\nexport type {DroppableItemOptions, DroppableItemResult} from './useDroppableItem';\nexport type {DropIndicatorProps, DropIndicatorAria} from './useDropIndicator';\nexport type {DraggableItemProps, DraggableItemResult} from './useDraggableItem';\nexport type {DraggableCollectionOptions} from './useDraggableCollection';\nexport type {DragPreviewProps} from './DragPreview';\nexport type {DragOptions, DragResult} from './useDrag';\nexport type {DropOptions, DropResult} from './useDrop';\nexport type {ClipboardProps, ClipboardResult} from './useClipboard';\nexport type {\n DirectoryDropItem,\n DragEndEvent,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DragTypes,\n DropEnterEvent,\n DropEvent,\n DropExitEvent,\n DropItem,\n DropMoveEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n\nexport {DIRECTORY_DRAG_TYPE} from './utils';\nexport {useDrag} from './useDrag';\nexport {useDrop} from './useDrop';\nexport {useDroppableCollection} from './useDroppableCollection';\nexport {useDroppableItem} from './useDroppableItem';\nexport {useDropIndicator} from './useDropIndicator';\nexport {useDraggableItem} from './useDraggableItem';\nexport {useDraggableCollection} from './useDraggableCollection';\nexport {useClipboard} from './useClipboard';\nexport {DragPreview} from './DragPreview';\nexport {ListDropTargetDelegate} from './ListDropTargetDelegate';\nexport {isVirtualDragging} from './DragManager';\nexport {isDirectoryDropItem, isFileDropItem, isTextDropItem} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -64,7 +64,9 @@ function $74f3dedaa4d234b4$export$2314ca2a3e892862(options) {
|
|
|
64
64
|
e.preventDefault();
|
|
65
65
|
if (e.clipboardData) {
|
|
66
66
|
var _options_onCopy;
|
|
67
|
-
(0, $4620ae0dc40f0031$exports.writeToDataTransfer)(e.clipboardData, options.getItems(
|
|
67
|
+
(0, $4620ae0dc40f0031$exports.writeToDataTransfer)(e.clipboardData, options.getItems({
|
|
68
|
+
action: 'copy'
|
|
69
|
+
}));
|
|
68
70
|
(_options_onCopy = options.onCopy) === null || _options_onCopy === void 0 ? void 0 : _options_onCopy.call(options);
|
|
69
71
|
}
|
|
70
72
|
});
|
|
@@ -75,7 +77,9 @@ function $74f3dedaa4d234b4$export$2314ca2a3e892862(options) {
|
|
|
75
77
|
if (!isFocusedRef.current || !options.onCut || !options.getItems) return;
|
|
76
78
|
e.preventDefault();
|
|
77
79
|
if (e.clipboardData) {
|
|
78
|
-
(0, $4620ae0dc40f0031$exports.writeToDataTransfer)(e.clipboardData, options.getItems(
|
|
80
|
+
(0, $4620ae0dc40f0031$exports.writeToDataTransfer)(e.clipboardData, options.getItems({
|
|
81
|
+
action: 'cut'
|
|
82
|
+
}));
|
|
79
83
|
options.onCut();
|
|
80
84
|
}
|
|
81
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA0BD,MAAM,qCAAe,IAAI;AACzB,SAAS,6CAAuB,KAAK,EAAE,EAAE;IACvC,IAAI,YAAY,mCAAa,GAAG,CAAC;IACjC,IAAI,CAAC,WAAW;QACd,IAAI,WAAW,IAAI;QACnB,IAAI,WAAW,CAAC;YACd,KAAK,IAAI,WAAW,SAClB,QAAQ;QAEZ;QAEA,YAAY;sBAAC;sBAAU;QAAQ;QAC/B,mCAAa,GAAG,CAAC,OAAO;QAExB,SAAS,gBAAgB,CAAC,OAAO;IACnC;IAEA,UAAU,QAAQ,CAAC,GAAG,CAAC;IACvB,OAAO;QACL,UAAU,QAAQ,CAAC,MAAM,CAAC;QAC1B,IAAI,UAAU,QAAQ,CAAC,IAAI,KAAK,GAAG;YACjC,SAAS,mBAAmB,CAAC,OAAO,UAAU,QAAQ;YACtD,mCAAa,MAAM,CAAC;QACtB;IACF;AACF;AAMO,SAAS,0CAAa,OAAuB;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,eA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Aa,OAAO,IAAI,CAAC,QAAQ,OAAO,EAC3C;QAGF,EAAE,cAAc;QAChB,IAAI,EAAE,aAAa,EAAE;YACnB,IAAI,QAAQ,CAAA,GAAA,8CAAmB,EAAE,EAAE,aAAa;YAChD,QAAQ,OAAO,CAAC;QAClB;IACF;IAEA,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,YACF;QAEF,OAAO,CAAA,GAAA,2BAAI,EACT,6CAAuB,cAAc,eACrC,6CAAuB,QAAQ,SAC/B,6CAAuB,aAAa,cACpC,6CAAuB,OAAO,QAC9B,6CAAuB,eAAe,gBACtC,6CAAuB,SAAS;IAEpC,GAAG;QAAC;QAAY;QAAc;QAAQ;QAAa;QAAO;QAAe;KAAQ;IAEjF,OAAO;QACL,gBAAgB;IAClB;AACF","sources":["packages/@react-aria/dnd/src/useClipboard.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {chain, useEffectEvent} from '@react-aria/utils';\nimport {DOMAttributes, DragItem, DropItem} from '@react-types/shared';\nimport {readFromDataTransfer, writeToDataTransfer} from './utils';\nimport {useEffect, useRef} from 'react';\nimport {useFocus} from '@react-aria/interactions';\n\nexport interface ClipboardProps {\n /** A function that returns the items to copy. */\n getItems?: (details: {action: 'cut' | 'copy'}) => DragItem[],\n /** Handler that is called when the user triggers a copy interaction. */\n onCopy?: () => void,\n /** Handler that is called when the user triggers a cut interaction. */\n onCut?: () => void,\n /** Handler that is called when the user triggers a paste interaction. */\n onPaste?: (items: DropItem[]) => void,\n /** Whether the clipboard is disabled. */\n isDisabled?: boolean\n}\n\nexport interface ClipboardResult {\n /** Props for the element that will handle clipboard events. */\n clipboardProps: DOMAttributes\n}\n\nconst globalEvents = new Map();\nfunction addGlobalEventListener(event, fn) {\n let eventData = globalEvents.get(event);\n if (!eventData) {\n let handlers = new Set<(e: Event) => void>();\n let listener = (e) => {\n for (let handler of handlers) {\n handler(e);\n }\n };\n\n eventData = {listener, handlers};\n globalEvents.set(event, eventData);\n\n document.addEventListener(event, listener);\n }\n\n eventData.handlers.add(fn);\n return () => {\n eventData.handlers.delete(fn);\n if (eventData.handlers.size === 0) {\n document.removeEventListener(event, eventData.listener);\n globalEvents.delete(event);\n }\n };\n}\n\n/**\n * Handles clipboard interactions for a focusable element. Supports items of multiple\n * data types, and integrates with the operating system native clipboard.\n */\nexport function useClipboard(options: ClipboardProps): ClipboardResult {\n let {isDisabled} = options;\n let isFocusedRef = useRef(false);\n let {focusProps} = useFocus({\n onFocusChange: (isFocused) => {\n isFocusedRef.current = isFocused;\n }\n });\n\n let onBeforeCopy = useEffectEvent((e: ClipboardEvent) => {\n // Enable the \"Copy\" menu item in Safari if this element is focused and copying is supported.\n if (isFocusedRef.current && options.getItems) {\n e.preventDefault();\n }\n });\n\n let onCopy = useEffectEvent((e: ClipboardEvent) => {\n if (!isFocusedRef.current || !options.getItems) {\n return;\n }\n\n e.preventDefault();\n if (e.clipboardData) {\n writeToDataTransfer(e.clipboardData, options.getItems({action: 'copy'}));\n options.onCopy?.();\n }\n });\n\n let onBeforeCut = useEffectEvent((e: ClipboardEvent) => {\n if (isFocusedRef.current && options.onCut && options.getItems) {\n e.preventDefault();\n }\n });\n\n let onCut = useEffectEvent((e: ClipboardEvent) => {\n if (!isFocusedRef.current || !options.onCut || !options.getItems) {\n return;\n }\n\n e.preventDefault();\n if (e.clipboardData) {\n writeToDataTransfer(e.clipboardData, options.getItems({action: 'cut'}));\n options.onCut();\n }\n });\n\n let onBeforePaste = useEffectEvent((e: ClipboardEvent) => {\n // Unfortunately, e.clipboardData.types is not available in this event so we always\n // have to enable the Paste menu item even if the type of data is unsupported.\n if (isFocusedRef.current && options.onPaste) {\n e.preventDefault();\n }\n });\n\n let onPaste = useEffectEvent((e: ClipboardEvent) => {\n if (!isFocusedRef.current || !options.onPaste) {\n return;\n }\n\n e.preventDefault();\n if (e.clipboardData) {\n let items = readFromDataTransfer(e.clipboardData);\n options.onPaste(items);\n }\n });\n\n useEffect(() => {\n if (isDisabled) {\n return;\n }\n return chain(\n addGlobalEventListener('beforecopy', onBeforeCopy),\n addGlobalEventListener('copy', onCopy),\n addGlobalEventListener('beforecut', onBeforeCut),\n addGlobalEventListener('cut', onCut),\n addGlobalEventListener('beforepaste', onBeforePaste),\n addGlobalEventListener('paste', onPaste)\n );\n }, [isDisabled, onBeforeCopy, onCopy, onBeforeCut, onCut, onBeforePaste, onPaste]);\n\n return {\n clipboardProps: focusProps\n };\n}\n"],"names":[],"version":3,"file":"useClipboard.main.js.map"}
|
package/dist/useClipboard.mjs
CHANGED
|
@@ -58,7 +58,9 @@ function $9fcc7f0d70d084ee$export$2314ca2a3e892862(options) {
|
|
|
58
58
|
e.preventDefault();
|
|
59
59
|
if (e.clipboardData) {
|
|
60
60
|
var _options_onCopy;
|
|
61
|
-
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems(
|
|
61
|
+
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems({
|
|
62
|
+
action: 'copy'
|
|
63
|
+
}));
|
|
62
64
|
(_options_onCopy = options.onCopy) === null || _options_onCopy === void 0 ? void 0 : _options_onCopy.call(options);
|
|
63
65
|
}
|
|
64
66
|
});
|
|
@@ -69,7 +71,9 @@ function $9fcc7f0d70d084ee$export$2314ca2a3e892862(options) {
|
|
|
69
71
|
if (!isFocusedRef.current || !options.onCut || !options.getItems) return;
|
|
70
72
|
e.preventDefault();
|
|
71
73
|
if (e.clipboardData) {
|
|
72
|
-
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems(
|
|
74
|
+
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems({
|
|
75
|
+
action: 'cut'
|
|
76
|
+
}));
|
|
73
77
|
options.onCut();
|
|
74
78
|
}
|
|
75
79
|
});
|
|
@@ -58,7 +58,9 @@ function $9fcc7f0d70d084ee$export$2314ca2a3e892862(options) {
|
|
|
58
58
|
e.preventDefault();
|
|
59
59
|
if (e.clipboardData) {
|
|
60
60
|
var _options_onCopy;
|
|
61
|
-
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems(
|
|
61
|
+
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems({
|
|
62
|
+
action: 'copy'
|
|
63
|
+
}));
|
|
62
64
|
(_options_onCopy = options.onCopy) === null || _options_onCopy === void 0 ? void 0 : _options_onCopy.call(options);
|
|
63
65
|
}
|
|
64
66
|
});
|
|
@@ -69,7 +71,9 @@ function $9fcc7f0d70d084ee$export$2314ca2a3e892862(options) {
|
|
|
69
71
|
if (!isFocusedRef.current || !options.onCut || !options.getItems) return;
|
|
70
72
|
e.preventDefault();
|
|
71
73
|
if (e.clipboardData) {
|
|
72
|
-
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems(
|
|
74
|
+
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems({
|
|
75
|
+
action: 'cut'
|
|
76
|
+
}));
|
|
73
77
|
options.onCut();
|
|
74
78
|
}
|
|
75
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AA0BD,MAAM,qCAAe,IAAI;AACzB,SAAS,6CAAuB,KAAK,EAAE,EAAE;IACvC,IAAI,YAAY,mCAAa,GAAG,CAAC;IACjC,IAAI,CAAC,WAAW;QACd,IAAI,WAAW,IAAI;QACnB,IAAI,WAAW,CAAC;YACd,KAAK,IAAI,WAAW,SAClB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Q,QAAQ,EAC9D;QAGF,EAAE,cAAc;QAChB,IAAI,EAAE,aAAa,EAAE;YACnB,CAAA,GAAA,yCAAkB,EAAE,EAAE,aAAa,EAAE,QAAQ,QAAQ,CAAC;gBAAC,QAAQ;YAAK;YACpE,QAAQ,KAAK;QACf;IACF;IAEA,IAAI,gBAAgB,CAAA,GAAA,qBAAa,EAAE,CAAC;QAClC,mFAAmF;QACnF,8EAA8E;QAC9E,IAAI,aAAa,OAAO,IAAI,QAAQ,OAAO,EACzC,EAAE,cAAc;IAEpB;IAEA,IAAI,UAAU,CAAA,GAAA,qBAAa,EAAE,CAAC;QAC5B,IAAI,CAAC,aAAa,OAAO,IAAI,CAAC,QAAQ,OAAO,EAC3C;QAGF,EAAE,cAAc;QAChB,IAAI,EAAE,aAAa,EAAE;YACnB,IAAI,QAAQ,CAAA,GAAA,yCAAmB,EAAE,EAAE,aAAa;YAChD,QAAQ,OAAO,CAAC;QAClB;IACF;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,YACF;QAEF,OAAO,CAAA,GAAA,YAAI,EACT,6CAAuB,cAAc,eACrC,6CAAuB,QAAQ,SAC/B,6CAAuB,aAAa,cACpC,6CAAuB,OAAO,QAC9B,6CAAuB,eAAe,gBACtC,6CAAuB,SAAS;IAEpC,GAAG;QAAC;QAAY;QAAc;QAAQ;QAAa;QAAO;QAAe;KAAQ;IAEjF,OAAO;QACL,gBAAgB;IAClB;AACF","sources":["packages/@react-aria/dnd/src/useClipboard.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {chain, useEffectEvent} from '@react-aria/utils';\nimport {DOMAttributes, DragItem, DropItem} from '@react-types/shared';\nimport {readFromDataTransfer, writeToDataTransfer} from './utils';\nimport {useEffect, useRef} from 'react';\nimport {useFocus} from '@react-aria/interactions';\n\nexport interface ClipboardProps {\n /** A function that returns the items to copy. */\n getItems?: (details: {action: 'cut' | 'copy'}) => DragItem[],\n /** Handler that is called when the user triggers a copy interaction. */\n onCopy?: () => void,\n /** Handler that is called when the user triggers a cut interaction. */\n onCut?: () => void,\n /** Handler that is called when the user triggers a paste interaction. */\n onPaste?: (items: DropItem[]) => void,\n /** Whether the clipboard is disabled. */\n isDisabled?: boolean\n}\n\nexport interface ClipboardResult {\n /** Props for the element that will handle clipboard events. */\n clipboardProps: DOMAttributes\n}\n\nconst globalEvents = new Map();\nfunction addGlobalEventListener(event, fn) {\n let eventData = globalEvents.get(event);\n if (!eventData) {\n let handlers = new Set<(e: Event) => void>();\n let listener = (e) => {\n for (let handler of handlers) {\n handler(e);\n }\n };\n\n eventData = {listener, handlers};\n globalEvents.set(event, eventData);\n\n document.addEventListener(event, listener);\n }\n\n eventData.handlers.add(fn);\n return () => {\n eventData.handlers.delete(fn);\n if (eventData.handlers.size === 0) {\n document.removeEventListener(event, eventData.listener);\n globalEvents.delete(event);\n }\n };\n}\n\n/**\n * Handles clipboard interactions for a focusable element. Supports items of multiple\n * data types, and integrates with the operating system native clipboard.\n */\nexport function useClipboard(options: ClipboardProps): ClipboardResult {\n let {isDisabled} = options;\n let isFocusedRef = useRef(false);\n let {focusProps} = useFocus({\n onFocusChange: (isFocused) => {\n isFocusedRef.current = isFocused;\n }\n });\n\n let onBeforeCopy = useEffectEvent((e: ClipboardEvent) => {\n // Enable the \"Copy\" menu item in Safari if this element is focused and copying is supported.\n if (isFocusedRef.current && options.getItems) {\n e.preventDefault();\n }\n });\n\n let onCopy = useEffectEvent((e: ClipboardEvent) => {\n if (!isFocusedRef.current || !options.getItems) {\n return;\n }\n\n e.preventDefault();\n if (e.clipboardData) {\n writeToDataTransfer(e.clipboardData, options.getItems({action: 'copy'}));\n options.onCopy?.();\n }\n });\n\n let onBeforeCut = useEffectEvent((e: ClipboardEvent) => {\n if (isFocusedRef.current && options.onCut && options.getItems) {\n e.preventDefault();\n }\n });\n\n let onCut = useEffectEvent((e: ClipboardEvent) => {\n if (!isFocusedRef.current || !options.onCut || !options.getItems) {\n return;\n }\n\n e.preventDefault();\n if (e.clipboardData) {\n writeToDataTransfer(e.clipboardData, options.getItems({action: 'cut'}));\n options.onCut();\n }\n });\n\n let onBeforePaste = useEffectEvent((e: ClipboardEvent) => {\n // Unfortunately, e.clipboardData.types is not available in this event so we always\n // have to enable the Paste menu item even if the type of data is unsupported.\n if (isFocusedRef.current && options.onPaste) {\n e.preventDefault();\n }\n });\n\n let onPaste = useEffectEvent((e: ClipboardEvent) => {\n if (!isFocusedRef.current || !options.onPaste) {\n return;\n }\n\n e.preventDefault();\n if (e.clipboardData) {\n let items = readFromDataTransfer(e.clipboardData);\n options.onPaste(items);\n }\n });\n\n useEffect(() => {\n if (isDisabled) {\n return;\n }\n return chain(\n addGlobalEventListener('beforecopy', onBeforeCopy),\n addGlobalEventListener('copy', onCopy),\n addGlobalEventListener('beforecut', onBeforeCut),\n addGlobalEventListener('cut', onCut),\n addGlobalEventListener('beforepaste', onBeforePaste),\n addGlobalEventListener('paste', onPaste)\n );\n }, [isDisabled, onBeforeCopy, onCopy, onBeforeCut, onCut, onBeforePaste, onPaste]);\n\n return {\n clipboardProps: focusProps\n };\n}\n"],"names":[],"version":3,"file":"useClipboard.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/dnd",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@internationalized/string": "^3.2.5",
|
|
26
|
-
"@react-aria/i18n": "^3.12.
|
|
27
|
-
"@react-aria/interactions": "^3.
|
|
26
|
+
"@react-aria/i18n": "^3.12.7",
|
|
27
|
+
"@react-aria/interactions": "^3.24.1",
|
|
28
28
|
"@react-aria/live-announcer": "^3.4.1",
|
|
29
|
-
"@react-aria/overlays": "^3.
|
|
30
|
-
"@react-aria/utils": "^3.
|
|
31
|
-
"@react-stately/dnd": "^3.5.
|
|
32
|
-
"@react-types/button": "^3.
|
|
33
|
-
"@react-types/shared": "^3.
|
|
29
|
+
"@react-aria/overlays": "^3.26.1",
|
|
30
|
+
"@react-aria/utils": "^3.28.1",
|
|
31
|
+
"@react-stately/dnd": "^3.5.2",
|
|
32
|
+
"@react-types/button": "^3.11.0",
|
|
33
|
+
"@react-types/shared": "^3.28.0",
|
|
34
34
|
"@swc/helpers": "^0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9c4ebbc0c1972cc880febc29de995ca58caa3ba4"
|
|
44
44
|
}
|
|
@@ -87,7 +87,8 @@ export class ListDropTargetDelegate implements DropTargetDelegate {
|
|
|
87
87
|
let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';
|
|
88
88
|
let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;
|
|
89
89
|
|
|
90
|
-
let
|
|
90
|
+
let collection = this.ref.current?.dataset.collection;
|
|
91
|
+
let elements = this.ref.current.querySelectorAll(collection ? `[data-collection="${CSS.escape(collection)}"]` : '[data-key]');
|
|
91
92
|
let elementMap = new Map<string, HTMLElement>();
|
|
92
93
|
for (let item of elements) {
|
|
93
94
|
if (item instanceof HTMLElement && item.dataset.key != null) {
|
package/src/useClipboard.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {useFocus} from '@react-aria/interactions';
|
|
|
18
18
|
|
|
19
19
|
export interface ClipboardProps {
|
|
20
20
|
/** A function that returns the items to copy. */
|
|
21
|
-
getItems?: () => DragItem[],
|
|
21
|
+
getItems?: (details: {action: 'cut' | 'copy'}) => DragItem[],
|
|
22
22
|
/** Handler that is called when the user triggers a copy interaction. */
|
|
23
23
|
onCopy?: () => void,
|
|
24
24
|
/** Handler that is called when the user triggers a cut interaction. */
|
|
@@ -88,7 +88,7 @@ export function useClipboard(options: ClipboardProps): ClipboardResult {
|
|
|
88
88
|
|
|
89
89
|
e.preventDefault();
|
|
90
90
|
if (e.clipboardData) {
|
|
91
|
-
writeToDataTransfer(e.clipboardData, options.getItems());
|
|
91
|
+
writeToDataTransfer(e.clipboardData, options.getItems({action: 'copy'}));
|
|
92
92
|
options.onCopy?.();
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -106,7 +106,7 @@ export function useClipboard(options: ClipboardProps): ClipboardResult {
|
|
|
106
106
|
|
|
107
107
|
e.preventDefault();
|
|
108
108
|
if (e.clipboardData) {
|
|
109
|
-
writeToDataTransfer(e.clipboardData, options.getItems());
|
|
109
|
+
writeToDataTransfer(e.clipboardData, options.getItems({action: 'cut'}));
|
|
110
110
|
options.onCut();
|
|
111
111
|
}
|
|
112
112
|
});
|