js: update beforeDragging & add itemCanDrag

This commit is contained in:
王劲鹏
2022-08-26 14:16:12 +08:00
committed by osborn
parent 3a28941c04
commit 13c151a9e4
13 changed files with 144 additions and 9 deletions

View File

@@ -38,7 +38,16 @@ export declare class FlowLayout extends Superview {
*/
bounces?: boolean;
canDrag?: boolean;
beforeDragging?: (from: number) => void;
/**
* @param from
* @returns Returns the item of index which can dragged or not.
*/
itemCanDrag?: (from: number) => boolean;
/**
* @param from
* @returns Returns an array of index which can not be swap during dragging.
*/
beforeDragging?: (from: number) => (Array<number> | void);
onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void;
/**

View File

@@ -151,6 +151,10 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], FlowLayout.prototype, "canDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "itemCanDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)

View File

@@ -31,7 +31,16 @@ export declare class HorizontalList extends Superview {
*/
bounces?: boolean;
canDrag?: boolean;
beforeDragging?: (from: number) => void;
/**
* @param from
* @returns Returns the item of index which can dragged or not.
*/
itemCanDrag?: (from: number) => boolean;
/**
* @param from
* @returns Returns an array of index which can not be swap during dragging.
*/
beforeDragging?: (from: number) => (Array<number> | void);
onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void;
scrollToItem(context: BridgeContext, index: number, config?: {

View File

@@ -142,6 +142,10 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], HorizontalList.prototype, "canDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], HorizontalList.prototype, "itemCanDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)

View File

@@ -37,7 +37,16 @@ export declare class List extends Superview {
*/
bounces?: boolean;
canDrag?: boolean;
beforeDragging?: (from: number) => void;
/**
* @param from
* @returns Returns the item of index which can dragged or not.
*/
itemCanDrag?: (from: number) => boolean;
/**
* @param from
* @returns Returns an array of index which can not be swap during dragging.
*/
beforeDragging?: (from: number) => (Array<number> | void);
onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void;
scrollToItem(context: BridgeContext, index: number, config?: {

View File

@@ -146,6 +146,10 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], List.prototype, "canDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "itemCanDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)