Skip to content

Commit c3db84b

Browse files
author
Wayne Van Son
committed
[dist] create new build
1 parent 6c1d5e5 commit c3db84b

File tree

10 files changed

+416
-342
lines changed

10 files changed

+416
-342
lines changed

dist/index.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
export { ReactSortable } from "./react-sortable";
22
export * from "./types";
3-
export { MultiDrag, Swap, DOMRect, Direction, GroupOptions, MoveEvent, Options, PullResult, PutResult, SortableEvent, SortableOptions, Utils } from "sortablejs";
4-
import SortableGlobal from "sortablejs";
5-
export declare const Sortable: typeof SortableGlobal;
3+
export { default as Sortable, MultiDrag, Swap, DOMRect, Direction, GroupOptions, MoveEvent, Options, PullResult, PutResult, SortableEvent, SortableOptions, Utils } from "sortablejs";
64
//# sourceMappingURL=index.d.ts.map

dist/index.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.es.js

Lines changed: 183 additions & 150 deletions
Large diffs are not rendered by default.

dist/index.js

Lines changed: 185 additions & 152 deletions
Large diffs are not rendered by default.

dist/react-sortable.d.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import { Component, ReactElement } from "react";
22
import Sortable, { Options, SortableEvent } from "sortablejs";
33
import { AllMethodsExceptMove, HandledMethodNames, ItemInterface, ReactSortableProps } from "./types";
4-
/**
5-
* React is built for synchornizing data with the browser.
6-
*
7-
* Data should be an object.
8-
*/
94
export declare class ReactSortable<T extends ItemInterface> extends Component<ReactSortableProps<T>> {
10-
private ref;
115
static defaultProps: Partial<ReactSortableProps<any>>;
6+
private ref;
127
constructor(props: ReactSortableProps<T>);
138
componentDidMount(): void;
149
render(): ReactElement<import("react").RefAttributes<any>, string | ((props: any) => ReactElement<any, string | any | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>;
@@ -23,30 +18,23 @@ export declare class ReactSortable<T extends ItemInterface> extends Component<Re
2318
prepareOnHandlerProp(evtName: Exclude<AllMethodsExceptMove, HandledMethodNames>): (evt: Sortable.SortableEvent) => void;
2419
/** Calls the `props.on[Handler]` function */
2520
callOnHandlerProp(evt: SortableEvent, evtName: AllMethodsExceptMove): void;
26-
/** Called when an element is dropped into the list from another list */
27-
onAdd(evt: SortableEvent): void;
28-
/** Called when an element is removed from the list into another list */
29-
onRemove(evt: SortableEvent): void;
30-
/** Called when sorting is changed within the same list */
21+
onAdd(evt: MultiDragEvent): void;
22+
onRemove(evt: MultiDragEvent): void;
3123
onUpdate(evt: MultiDragEvent): void;
32-
/** Called when the dragging starts */
3324
onStart(evt: SortableEvent): void;
34-
/** Called when the dragging ends */
3525
onEnd(evt: SortableEvent): void;
36-
/** Called when the `onSpill` plugin is activated */
26+
onChoose(evt: SortableEvent): void;
27+
onUnchoose(evt: SortableEvent): void;
3728
onSpill(evt: SortableEvent): void;
38-
/** Called when a clone is made. It replaces an element in with a function */
39-
onClone(evt: SortableEvent): void;
40-
/** @todo */
41-
onSelect(evt: SortableEvent): void;
42-
/** @todo */
43-
onDeselect(evt: SortableEvent): void;
29+
onSelect(evt: MultiDragEvent): void;
30+
onDeselect(evt: MultiDragEvent): void;
4431
}
4532
interface MultiIndices {
4633
multiDragElement: HTMLElement;
4734
index: number;
4835
}
49-
interface MultiDragEvent extends SortableEvent {
36+
export interface MultiDragEvent extends SortableEvent {
37+
clones: HTMLElement[];
5038
oldIndicies: MultiIndices[];
5139
newIndicies: MultiIndices[];
5240
swapItem: HTMLElement | null;

dist/react-sortable.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types.d.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import Sortable, { SortableEvent, Options, MoveEvent } from "sortablejs";
2-
import { ForwardRefExoticComponent, RefAttributes, ReactHTML, CSSProperties } from "react";
1+
import { CSSProperties, ForwardRefExoticComponent, ReactHTML, RefAttributes } from "react";
2+
import Sortable, { MoveEvent, Options, SortableEvent } from "sortablejs";
33
import { ReactSortable } from "./react-sortable";
44
export interface ItemInterface {
5+
/** The unique id associated with your item. It's recommended this is the same as the key prop for your list item. */
56
id: string | number;
7+
/** When true, the item is selected using MultiDrag */
68
selected?: boolean;
9+
/** When true, the item is deemed "chosen", which basically just a mousedown event. */
710
chosen?: boolean;
11+
/** When true, it will not be possible to pick this item up in the list. */
812
filtered?: boolean;
913
[property: string]: any;
1014
}
11-
export interface ReactSortableProps<T> extends ReactSortableOptions {
15+
export interface ReactSortableProps<T> extends ReactSortableOptions, Omit<Options, AllMethodNames> {
1216
/**
1317
* The list of items to use.
1418
*/
@@ -26,13 +30,6 @@ export interface ReactSortableProps<T> extends ReactSortableOptions {
2630
* forwardRef<HTMLElement, YOURPROPS>((props, ref) => <button {...props} ref={ref} />)
2731
*/
2832
tag?: ForwardRefExoticComponent<RefAttributes<any>> | keyof ReactHTML;
29-
style?: CSSProperties;
30-
className?: string;
31-
id?: string;
32-
/**
33-
* Parse the plugins you'd like to use in Sortable.
34-
*/
35-
plugins?: Sortable.Plugin | Array<Sortable.Plugin>;
3633
/**
3734
* If this is provided, the function will replace the clone in place.
3835
*
@@ -41,6 +38,9 @@ export interface ReactSortableProps<T> extends ReactSortableOptions {
4138
* and the new clone will be placed in `A`
4239
*/
4340
clone?: (currentItem: T, evt: SortableEvent) => T;
41+
style?: CSSProperties;
42+
className?: string;
43+
id?: string;
4444
}
4545
/**
4646
* Holds the react component as a reference so we can access it's store.
@@ -54,7 +54,7 @@ export interface Store {
5454
* Change the `on[...]` methods in Sortable.Options,
5555
* so that they all have an extra arg that is `store: Store`
5656
*/
57-
export declare type ReactSortableOptions = Omit<Options, AllMethodNames> & Partial<Record<AllMethodsExceptMove, (evt: SortableEvent, sortable: Sortable | null, store: Store) => void>> & {
57+
export declare type ReactSortableOptions = Partial<Record<AllMethodsExceptMove, (evt: SortableEvent, sortable: Sortable | null, store: Store) => void>> & {
5858
/**
5959
* The default sortable behaviour has been changed.
6060
*
@@ -67,7 +67,7 @@ export declare type ReactSortableOptions = Omit<Options, AllMethodNames> & Parti
6767
/** All method names starting with `on` in `Sortable.Options` */
6868
export declare type AllMethodNames = "onAdd" | "onChange" | "onChoose" | "onClone" | "onEnd" | "onFilter" | "onMove" | "onRemove" | "onSort" | "onSpill" | "onStart" | "onUnchoose" | "onUpdate" | "onSelect" | "onDeselect";
6969
/** Method names that fire in `this`, when this is react-sortable */
70-
export declare type HandledMethodNames = "onAdd" | "onRemove" | "onUpdate" | "onStart" | "onEnd" | "onSpill" | "onSelect" | "onDeselect" | "onClone";
70+
export declare type HandledMethodNames = "onAdd" | "onRemove" | "onUpdate" | "onStart" | "onEnd" | "onSpill" | "onSelect" | "onDeselect" | "onChoose" | "onUnchoose";
7171
export declare type UnHandledMethodNames = Exclude<AllMethodsExceptMove, HandledMethodNames | "onMove">;
7272
/**
7373
* Same as `SortableMethodKeys` type but with out the string `onMove`.

dist/types.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/util.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { PropsWithChildren } from "react";
22
import { Options } from "sortablejs";
3+
import { ItemInterface } from "../dist";
4+
import { MultiDragEvent } from "./react-sortable";
35
import { AllMethodNames, ReactSortableProps } from "./types";
46
/**
57
* Removes the `node` from the DOM
@@ -13,6 +15,26 @@ export declare function removeNode(node: HTMLElement): void;
1315
* @param index index of the parent to place the new child in.
1416
*/
1517
export declare function insertNodeAt(parent: HTMLElement, newChild: HTMLElement, index: number): void;
18+
/** removes stuff from the dom in a nice order */
19+
export declare function handleDOMChanges<T extends ItemInterface>(customs: Normalized<T>[]): void;
20+
export declare function removeNodes<T extends ItemInterface>(customs: Normalized<T>[]): void;
21+
export declare function insertNodes<T extends ItemInterface>(customs: Normalized<T>[]): void;
22+
export declare function createCustoms<T extends ItemInterface>(evt: MultiDragEvent, list: T[]): Normalized<T>[];
23+
/** moves items form old index to new index without breaking anything ideally. */
24+
export declare function handleStateChanges<T extends ItemInterface>(normalized: Normalized<T>[], list: T[]): T[];
25+
export declare function handleStateRemove<T extends ItemInterface>(normalized: Normalized<T>[], list: T[]): T[];
26+
export declare function handleStateAdd<T extends ItemInterface>(normalized: Normalized<T>[], list: T[]): T[];
27+
export declare function getMode(evt: MultiDragEvent): "multidrag" | "swap" | "normal";
28+
export declare function createNormalized<T extends ItemInterface>(inputs: Input[], list: T[]): Normalized<T>[];
29+
export interface Input {
30+
parentElement: HTMLElement;
31+
element: HTMLElement;
32+
oldIndex: number;
33+
newIndex: number;
34+
}
35+
export interface Normalized<T> extends Input {
36+
item: T;
37+
}
1638
/**
1739
* Removes the following group of properties from `props`,
1840
* leaving only `Sortable.Options` without any `on` methods.

dist/util.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)