Add yet-another-react-lightbox package and update .gitignore to exclude node_modules
This commit is contained in:
17
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.d.ts
generated
vendored
17
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.d.ts
generated
vendored
@@ -1,17 +0,0 @@
|
||||
import type { Action, Store } from 'redux';
|
||||
import type { Backend, DragDropActions, DragDropManager, DragDropMonitor, HandlerRegistry } from '../interfaces.js';
|
||||
import type { State } from '../reducers/index.js';
|
||||
export declare class DragDropManagerImpl implements DragDropManager {
|
||||
private store;
|
||||
private monitor;
|
||||
private backend;
|
||||
private isSetUp;
|
||||
constructor(store: Store<State>, monitor: DragDropMonitor);
|
||||
receiveBackend(backend: Backend): void;
|
||||
getMonitor(): DragDropMonitor;
|
||||
getBackend(): Backend;
|
||||
getRegistry(): HandlerRegistry;
|
||||
getActions(): DragDropActions;
|
||||
dispatch(action: Action<any>): void;
|
||||
private handleRefCountChange;
|
||||
}
|
||||
56
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js
generated
vendored
56
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js
generated
vendored
@@ -1,56 +0,0 @@
|
||||
import { createDragDropActions } from '../actions/dragDrop/index.js';
|
||||
export class DragDropManagerImpl {
|
||||
receiveBackend(backend) {
|
||||
this.backend = backend;
|
||||
}
|
||||
getMonitor() {
|
||||
return this.monitor;
|
||||
}
|
||||
getBackend() {
|
||||
return this.backend;
|
||||
}
|
||||
getRegistry() {
|
||||
return this.monitor.registry;
|
||||
}
|
||||
getActions() {
|
||||
/* eslint-disable-next-line @typescript-eslint/no-this-alias */ const manager = this;
|
||||
const { dispatch } = this.store;
|
||||
function bindActionCreator(actionCreator) {
|
||||
return (...args)=>{
|
||||
const action = actionCreator.apply(manager, args);
|
||||
if (typeof action !== 'undefined') {
|
||||
dispatch(action);
|
||||
}
|
||||
};
|
||||
}
|
||||
const actions = createDragDropActions(this);
|
||||
return Object.keys(actions).reduce((boundActions, key)=>{
|
||||
const action = actions[key];
|
||||
boundActions[key] = bindActionCreator(action);
|
||||
return boundActions;
|
||||
}, {});
|
||||
}
|
||||
dispatch(action) {
|
||||
this.store.dispatch(action);
|
||||
}
|
||||
constructor(store, monitor){
|
||||
this.isSetUp = false;
|
||||
this.handleRefCountChange = ()=>{
|
||||
const shouldSetUp = this.store.getState().refCount > 0;
|
||||
if (this.backend) {
|
||||
if (shouldSetUp && !this.isSetUp) {
|
||||
this.backend.setup();
|
||||
this.isSetUp = true;
|
||||
} else if (!shouldSetUp && this.isSetUp) {
|
||||
this.backend.teardown();
|
||||
this.isSetUp = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
this.store = store;
|
||||
this.monitor = monitor;
|
||||
store.subscribe(this.handleRefCountChange);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=DragDropManagerImpl.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/classes/DragDropManagerImpl.ts"],"sourcesContent":["import type { Action, Store } from 'redux'\n\nimport { createDragDropActions } from '../actions/dragDrop/index.js'\nimport type {\n\tActionCreator,\n\tBackend,\n\tDragDropActions,\n\tDragDropManager,\n\tDragDropMonitor,\n\tHandlerRegistry,\n} from '../interfaces.js'\nimport type { State } from '../reducers/index.js'\nimport type { DragDropMonitorImpl } from './DragDropMonitorImpl.js'\n\nexport class DragDropManagerImpl implements DragDropManager {\n\tprivate store: Store<State>\n\tprivate monitor: DragDropMonitor\n\tprivate backend: Backend | undefined\n\tprivate isSetUp = false\n\n\tpublic constructor(store: Store<State>, monitor: DragDropMonitor) {\n\t\tthis.store = store\n\t\tthis.monitor = monitor\n\t\tstore.subscribe(this.handleRefCountChange)\n\t}\n\n\tpublic receiveBackend(backend: Backend): void {\n\t\tthis.backend = backend\n\t}\n\n\tpublic getMonitor(): DragDropMonitor {\n\t\treturn this.monitor\n\t}\n\n\tpublic getBackend(): Backend {\n\t\treturn this.backend as Backend\n\t}\n\n\tpublic getRegistry(): HandlerRegistry {\n\t\treturn (this.monitor as DragDropMonitorImpl).registry\n\t}\n\n\tpublic getActions(): DragDropActions {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-this-alias */\n\t\tconst manager = this\n\t\tconst { dispatch } = this.store\n\n\t\tfunction bindActionCreator(actionCreator: ActionCreator<any>) {\n\t\t\treturn (...args: any[]) => {\n\t\t\t\tconst action = actionCreator.apply(manager, args as any)\n\t\t\t\tif (typeof action !== 'undefined') {\n\t\t\t\t\tdispatch(action)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst actions = createDragDropActions(this)\n\n\t\treturn Object.keys(actions).reduce(\n\t\t\t(boundActions: DragDropActions, key: string) => {\n\t\t\t\tconst action: ActionCreator<any> = (actions as any)[\n\t\t\t\t\tkey\n\t\t\t\t] as ActionCreator<any>\n\t\t\t\t;(boundActions as any)[key] = bindActionCreator(action)\n\t\t\t\treturn boundActions\n\t\t\t},\n\t\t\t{} as DragDropActions,\n\t\t)\n\t}\n\n\tpublic dispatch(action: Action<any>): void {\n\t\tthis.store.dispatch(action)\n\t}\n\n\tprivate handleRefCountChange = (): void => {\n\t\tconst shouldSetUp = this.store.getState().refCount > 0\n\t\tif (this.backend) {\n\t\t\tif (shouldSetUp && !this.isSetUp) {\n\t\t\t\tthis.backend.setup()\n\t\t\t\tthis.isSetUp = true\n\t\t\t} else if (!shouldSetUp && this.isSetUp) {\n\t\t\t\tthis.backend.teardown()\n\t\t\t\tthis.isSetUp = false\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["createDragDropActions","DragDropManagerImpl","receiveBackend","backend","getMonitor","monitor","getBackend","getRegistry","registry","getActions","manager","dispatch","store","bindActionCreator","actionCreator","args","action","apply","actions","Object","keys","reduce","boundActions","key","isSetUp","handleRefCountChange","shouldSetUp","getState","refCount","setup","teardown","subscribe"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,8BAA8B,CAAA;AAYpE,OAAO,MAAMC,mBAAmB;IAY/B,AAAOC,cAAc,CAACC,OAAgB,EAAQ;QAC7C,IAAI,CAACA,OAAO,GAAGA,OAAO;KACtB;IAED,AAAOC,UAAU,GAAoB;QACpC,OAAO,IAAI,CAACC,OAAO,CAAA;KACnB;IAED,AAAOC,UAAU,GAAY;QAC5B,OAAO,IAAI,CAACH,OAAO,CAAW;KAC9B;IAED,AAAOI,WAAW,GAAoB;QACrC,OAAO,AAAC,IAAI,CAACF,OAAO,CAAyBG,QAAQ,CAAA;KACrD;IAED,AAAOC,UAAU,GAAoB;QACpC,+DAA+D,CAC/D,MAAMC,OAAO,GAAG,IAAI;QACpB,MAAM,EAAEC,QAAQ,CAAA,EAAE,GAAG,IAAI,CAACC,KAAK;QAE/B,SAASC,iBAAiB,CAACC,aAAiC,EAAE;YAC7D,OAAO,CAAC,GAAGC,IAAI,AAAO,GAAK;gBAC1B,MAAMC,MAAM,GAAGF,aAAa,CAACG,KAAK,CAACP,OAAO,EAAEK,IAAI,CAAQ;gBACxD,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;oBAClCL,QAAQ,CAACK,MAAM,CAAC;iBAChB;aACD,CAAA;SACD;QAED,MAAME,OAAO,GAAGlB,qBAAqB,CAAC,IAAI,CAAC;QAE3C,OAAOmB,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACG,MAAM,CACjC,CAACC,YAA6B,EAAEC,GAAW,GAAK;YAC/C,MAAMP,MAAM,GAAuB,AAACE,OAAO,AAAQ,CAClDK,GAAG,CACH,AAAsB,AACtB;YAAA,AAACD,YAAY,AAAQ,CAACC,GAAG,CAAC,GAAGV,iBAAiB,CAACG,MAAM,CAAC;YACvD,OAAOM,YAAY,CAAA;SACnB,EACD,EAAE,CACF,CAAA;KACD;IAED,AAAOX,QAAQ,CAACK,MAAmB,EAAQ;QAC1C,IAAI,CAACJ,KAAK,CAACD,QAAQ,CAACK,MAAM,CAAC;KAC3B;IApDD,YAAmBJ,KAAmB,EAAEP,OAAwB,CAAE;QAFlE,KAAQmB,OAAO,GAAG,KAAK,AAlBxB,CAkBwB;QAwDvB,KAAQC,oBAAoB,GAAG,IAAY;YAC1C,MAAMC,WAAW,GAAG,IAAI,CAACd,KAAK,CAACe,QAAQ,EAAE,CAACC,QAAQ,GAAG,CAAC;YACtD,IAAI,IAAI,CAACzB,OAAO,EAAE;gBACjB,IAAIuB,WAAW,IAAI,CAAC,IAAI,CAACF,OAAO,EAAE;oBACjC,IAAI,CAACrB,OAAO,CAAC0B,KAAK,EAAE;oBACpB,IAAI,CAACL,OAAO,GAAG,IAAI;iBACnB,MAAM,IAAI,CAACE,WAAW,IAAI,IAAI,CAACF,OAAO,EAAE;oBACxC,IAAI,CAACrB,OAAO,CAAC2B,QAAQ,EAAE;oBACvB,IAAI,CAACN,OAAO,GAAG,KAAK;iBACpB;aACD;SACD,AArFF,CAqFE;QAhEA,IAAI,CAACZ,KAAK,GAAGA,KAAK;QAClB,IAAI,CAACP,OAAO,GAAGA,OAAO;QACtBO,KAAK,CAACmB,SAAS,CAAC,IAAI,CAACN,oBAAoB,CAAC;KAC1C;CA8DD"}
|
||||
31
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.d.ts
generated
vendored
31
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.d.ts
generated
vendored
@@ -1,31 +0,0 @@
|
||||
import type { Store } from 'redux';
|
||||
import type { DragDropMonitor, HandlerRegistry, Identifier, Listener, Unsubscribe, XYCoord } from '../interfaces.js';
|
||||
import type { State } from '../reducers/index.js';
|
||||
export declare class DragDropMonitorImpl implements DragDropMonitor {
|
||||
private store;
|
||||
readonly registry: HandlerRegistry;
|
||||
constructor(store: Store<State>, registry: HandlerRegistry);
|
||||
subscribeToStateChange(listener: Listener, options?: {
|
||||
handlerIds?: string[];
|
||||
}): Unsubscribe;
|
||||
subscribeToOffsetChange(listener: Listener): Unsubscribe;
|
||||
canDragSource(sourceId: string | undefined): boolean;
|
||||
canDropOnTarget(targetId: string | undefined): boolean;
|
||||
isDragging(): boolean;
|
||||
isDraggingSource(sourceId: string | undefined): boolean;
|
||||
isOverTarget(targetId: string | undefined, options?: {
|
||||
shallow: boolean;
|
||||
}): boolean;
|
||||
getItemType(): Identifier;
|
||||
getItem(): any;
|
||||
getSourceId(): string | null;
|
||||
getTargetIds(): string[];
|
||||
getDropResult(): any;
|
||||
didDrop(): boolean;
|
||||
isSourcePublic(): boolean;
|
||||
getInitialClientOffset(): XYCoord | null;
|
||||
getInitialSourceClientOffset(): XYCoord | null;
|
||||
getClientOffset(): XYCoord | null;
|
||||
getSourceClientOffset(): XYCoord | null;
|
||||
getDifferenceFromInitialOffset(): XYCoord | null;
|
||||
}
|
||||
152
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js
generated
vendored
152
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js
generated
vendored
@@ -1,152 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { getDifferenceFromInitialOffset, getSourceClientOffset } from '../utils/coords.js';
|
||||
import { areDirty } from '../utils/dirtiness.js';
|
||||
import { matchesType } from '../utils/matchesType.js';
|
||||
export class DragDropMonitorImpl {
|
||||
subscribeToStateChange(listener, options = {}) {
|
||||
const { handlerIds } = options;
|
||||
invariant(typeof listener === 'function', 'listener must be a function.');
|
||||
invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');
|
||||
let prevStateId = this.store.getState().stateId;
|
||||
const handleChange = ()=>{
|
||||
const state = this.store.getState();
|
||||
const currentStateId = state.stateId;
|
||||
try {
|
||||
const canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds);
|
||||
if (!canSkipListener) {
|
||||
listener();
|
||||
}
|
||||
} finally{
|
||||
prevStateId = currentStateId;
|
||||
}
|
||||
};
|
||||
return this.store.subscribe(handleChange);
|
||||
}
|
||||
subscribeToOffsetChange(listener) {
|
||||
invariant(typeof listener === 'function', 'listener must be a function.');
|
||||
let previousState = this.store.getState().dragOffset;
|
||||
const handleChange = ()=>{
|
||||
const nextState = this.store.getState().dragOffset;
|
||||
if (nextState === previousState) {
|
||||
return;
|
||||
}
|
||||
previousState = nextState;
|
||||
listener();
|
||||
};
|
||||
return this.store.subscribe(handleChange);
|
||||
}
|
||||
canDragSource(sourceId) {
|
||||
if (!sourceId) {
|
||||
return false;
|
||||
}
|
||||
const source = this.registry.getSource(sourceId);
|
||||
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
||||
if (this.isDragging()) {
|
||||
return false;
|
||||
}
|
||||
return source.canDrag(this, sourceId);
|
||||
}
|
||||
canDropOnTarget(targetId) {
|
||||
// undefined on initial render
|
||||
if (!targetId) {
|
||||
return false;
|
||||
}
|
||||
const target = this.registry.getTarget(targetId);
|
||||
invariant(target, `Expected to find a valid target. targetId=${targetId}`);
|
||||
if (!this.isDragging() || this.didDrop()) {
|
||||
return false;
|
||||
}
|
||||
const targetType = this.registry.getTargetType(targetId);
|
||||
const draggedItemType = this.getItemType();
|
||||
return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);
|
||||
}
|
||||
isDragging() {
|
||||
return Boolean(this.getItemType());
|
||||
}
|
||||
isDraggingSource(sourceId) {
|
||||
// undefined on initial render
|
||||
if (!sourceId) {
|
||||
return false;
|
||||
}
|
||||
const source = this.registry.getSource(sourceId, true);
|
||||
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
||||
if (!this.isDragging() || !this.isSourcePublic()) {
|
||||
return false;
|
||||
}
|
||||
const sourceType = this.registry.getSourceType(sourceId);
|
||||
const draggedItemType = this.getItemType();
|
||||
if (sourceType !== draggedItemType) {
|
||||
return false;
|
||||
}
|
||||
return source.isDragging(this, sourceId);
|
||||
}
|
||||
isOverTarget(targetId, options = {
|
||||
shallow: false
|
||||
}) {
|
||||
// undefined on initial render
|
||||
if (!targetId) {
|
||||
return false;
|
||||
}
|
||||
const { shallow } = options;
|
||||
if (!this.isDragging()) {
|
||||
return false;
|
||||
}
|
||||
const targetType = this.registry.getTargetType(targetId);
|
||||
const draggedItemType = this.getItemType();
|
||||
if (draggedItemType && !matchesType(targetType, draggedItemType)) {
|
||||
return false;
|
||||
}
|
||||
const targetIds = this.getTargetIds();
|
||||
if (!targetIds.length) {
|
||||
return false;
|
||||
}
|
||||
const index = targetIds.indexOf(targetId);
|
||||
if (shallow) {
|
||||
return index === targetIds.length - 1;
|
||||
} else {
|
||||
return index > -1;
|
||||
}
|
||||
}
|
||||
getItemType() {
|
||||
return this.store.getState().dragOperation.itemType;
|
||||
}
|
||||
getItem() {
|
||||
return this.store.getState().dragOperation.item;
|
||||
}
|
||||
getSourceId() {
|
||||
return this.store.getState().dragOperation.sourceId;
|
||||
}
|
||||
getTargetIds() {
|
||||
return this.store.getState().dragOperation.targetIds;
|
||||
}
|
||||
getDropResult() {
|
||||
return this.store.getState().dragOperation.dropResult;
|
||||
}
|
||||
didDrop() {
|
||||
return this.store.getState().dragOperation.didDrop;
|
||||
}
|
||||
isSourcePublic() {
|
||||
return Boolean(this.store.getState().dragOperation.isSourcePublic);
|
||||
}
|
||||
getInitialClientOffset() {
|
||||
return this.store.getState().dragOffset.initialClientOffset;
|
||||
}
|
||||
getInitialSourceClientOffset() {
|
||||
return this.store.getState().dragOffset.initialSourceClientOffset;
|
||||
}
|
||||
getClientOffset() {
|
||||
return this.store.getState().dragOffset.clientOffset;
|
||||
}
|
||||
getSourceClientOffset() {
|
||||
return getSourceClientOffset(this.store.getState().dragOffset);
|
||||
}
|
||||
getDifferenceFromInitialOffset() {
|
||||
return getDifferenceFromInitialOffset(this.store.getState().dragOffset);
|
||||
}
|
||||
constructor(store, registry){
|
||||
this.store = store;
|
||||
this.registry = registry;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=DragDropMonitorImpl.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js.map
generated
vendored
File diff suppressed because one or more lines are too long
26
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.d.ts
generated
vendored
26
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.d.ts
generated
vendored
@@ -1,26 +0,0 @@
|
||||
import type { Store } from 'redux';
|
||||
import type { DragSource, DropTarget, HandlerRegistry, Identifier, SourceType, TargetType } from '../interfaces.js';
|
||||
import type { State } from '../reducers/index.js';
|
||||
export declare class HandlerRegistryImpl implements HandlerRegistry {
|
||||
private types;
|
||||
private dragSources;
|
||||
private dropTargets;
|
||||
private pinnedSourceId;
|
||||
private pinnedSource;
|
||||
private store;
|
||||
constructor(store: Store<State>);
|
||||
addSource(type: SourceType, source: DragSource): string;
|
||||
addTarget(type: TargetType, target: DropTarget): string;
|
||||
containsHandler(handler: DragSource | DropTarget): boolean;
|
||||
getSource(sourceId: string, includePinned?: boolean): DragSource;
|
||||
getTarget(targetId: string): DropTarget;
|
||||
getSourceType(sourceId: string): Identifier;
|
||||
getTargetType(targetId: string): Identifier | Identifier[];
|
||||
isSourceId(handlerId: string): boolean;
|
||||
isTargetId(handlerId: string): boolean;
|
||||
removeSource(sourceId: string): void;
|
||||
removeTarget(targetId: string): void;
|
||||
pinSource(sourceId: string): void;
|
||||
unpinSource(): void;
|
||||
private addHandler;
|
||||
}
|
||||
129
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js
generated
vendored
129
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js
generated
vendored
@@ -1,129 +0,0 @@
|
||||
import { asap } from '@react-dnd/asap';
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { addSource, addTarget, removeSource, removeTarget } from '../actions/registry.js';
|
||||
import { validateSourceContract, validateTargetContract, validateType } from '../contracts.js';
|
||||
import { HandlerRole } from '../interfaces.js';
|
||||
import { getNextUniqueId } from '../utils/getNextUniqueId.js';
|
||||
function getNextHandlerId(role) {
|
||||
const id = getNextUniqueId().toString();
|
||||
switch(role){
|
||||
case HandlerRole.SOURCE:
|
||||
return `S${id}`;
|
||||
case HandlerRole.TARGET:
|
||||
return `T${id}`;
|
||||
default:
|
||||
throw new Error(`Unknown Handler Role: ${role}`);
|
||||
}
|
||||
}
|
||||
function parseRoleFromHandlerId(handlerId) {
|
||||
switch(handlerId[0]){
|
||||
case 'S':
|
||||
return HandlerRole.SOURCE;
|
||||
case 'T':
|
||||
return HandlerRole.TARGET;
|
||||
default:
|
||||
throw new Error(`Cannot parse handler ID: ${handlerId}`);
|
||||
}
|
||||
}
|
||||
function mapContainsValue(map, searchValue) {
|
||||
const entries = map.entries();
|
||||
let isDone = false;
|
||||
do {
|
||||
const { done , value: [, value] , } = entries.next();
|
||||
if (value === searchValue) {
|
||||
return true;
|
||||
}
|
||||
isDone = !!done;
|
||||
}while (!isDone)
|
||||
return false;
|
||||
}
|
||||
export class HandlerRegistryImpl {
|
||||
addSource(type, source) {
|
||||
validateType(type);
|
||||
validateSourceContract(source);
|
||||
const sourceId = this.addHandler(HandlerRole.SOURCE, type, source);
|
||||
this.store.dispatch(addSource(sourceId));
|
||||
return sourceId;
|
||||
}
|
||||
addTarget(type, target) {
|
||||
validateType(type, true);
|
||||
validateTargetContract(target);
|
||||
const targetId = this.addHandler(HandlerRole.TARGET, type, target);
|
||||
this.store.dispatch(addTarget(targetId));
|
||||
return targetId;
|
||||
}
|
||||
containsHandler(handler) {
|
||||
return mapContainsValue(this.dragSources, handler) || mapContainsValue(this.dropTargets, handler);
|
||||
}
|
||||
getSource(sourceId, includePinned = false) {
|
||||
invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');
|
||||
const isPinned = includePinned && sourceId === this.pinnedSourceId;
|
||||
const source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);
|
||||
return source;
|
||||
}
|
||||
getTarget(targetId) {
|
||||
invariant(this.isTargetId(targetId), 'Expected a valid target ID.');
|
||||
return this.dropTargets.get(targetId);
|
||||
}
|
||||
getSourceType(sourceId) {
|
||||
invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');
|
||||
return this.types.get(sourceId);
|
||||
}
|
||||
getTargetType(targetId) {
|
||||
invariant(this.isTargetId(targetId), 'Expected a valid target ID.');
|
||||
return this.types.get(targetId);
|
||||
}
|
||||
isSourceId(handlerId) {
|
||||
const role = parseRoleFromHandlerId(handlerId);
|
||||
return role === HandlerRole.SOURCE;
|
||||
}
|
||||
isTargetId(handlerId) {
|
||||
const role = parseRoleFromHandlerId(handlerId);
|
||||
return role === HandlerRole.TARGET;
|
||||
}
|
||||
removeSource(sourceId) {
|
||||
invariant(this.getSource(sourceId), 'Expected an existing source.');
|
||||
this.store.dispatch(removeSource(sourceId));
|
||||
asap(()=>{
|
||||
this.dragSources.delete(sourceId);
|
||||
this.types.delete(sourceId);
|
||||
});
|
||||
}
|
||||
removeTarget(targetId) {
|
||||
invariant(this.getTarget(targetId), 'Expected an existing target.');
|
||||
this.store.dispatch(removeTarget(targetId));
|
||||
this.dropTargets.delete(targetId);
|
||||
this.types.delete(targetId);
|
||||
}
|
||||
pinSource(sourceId) {
|
||||
const source = this.getSource(sourceId);
|
||||
invariant(source, 'Expected an existing source.');
|
||||
this.pinnedSourceId = sourceId;
|
||||
this.pinnedSource = source;
|
||||
}
|
||||
unpinSource() {
|
||||
invariant(this.pinnedSource, 'No source is pinned at the time.');
|
||||
this.pinnedSourceId = null;
|
||||
this.pinnedSource = null;
|
||||
}
|
||||
addHandler(role, type, handler) {
|
||||
const id = getNextHandlerId(role);
|
||||
this.types.set(id, type);
|
||||
if (role === HandlerRole.SOURCE) {
|
||||
this.dragSources.set(id, handler);
|
||||
} else if (role === HandlerRole.TARGET) {
|
||||
this.dropTargets.set(id, handler);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
constructor(store){
|
||||
this.types = new Map();
|
||||
this.dragSources = new Map();
|
||||
this.dropTargets = new Map();
|
||||
this.pinnedSourceId = null;
|
||||
this.pinnedSource = null;
|
||||
this.store = store;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=HandlerRegistryImpl.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user