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

@ -2586,6 +2586,10 @@ var List = /** @class */ (function (_super) {
Property, Property,
__metadata$b("design:type", Boolean) __metadata$b("design:type", Boolean)
], List.prototype, "canDrag", void 0); ], List.prototype, "canDrag", void 0);
__decorate$b([
Property,
__metadata$b("design:type", Function)
], List.prototype, "itemCanDrag", void 0);
__decorate$b([ __decorate$b([
Property, Property,
__metadata$b("design:type", Function) __metadata$b("design:type", Function)
@ -3268,6 +3272,10 @@ var FlowLayout = /** @class */ (function (_super) {
Property, Property,
__metadata$7("design:type", Boolean) __metadata$7("design:type", Boolean)
], FlowLayout.prototype, "canDrag", void 0); ], FlowLayout.prototype, "canDrag", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Function)
], FlowLayout.prototype, "itemCanDrag", void 0);
__decorate$7([ __decorate$7([
Property, Property,
__metadata$7("design:type", Function) __metadata$7("design:type", Function)
@ -4010,6 +4018,10 @@ var HorizontalList = /** @class */ (function (_super) {
Property, Property,
__metadata("design:type", Boolean) __metadata("design:type", Boolean)
], HorizontalList.prototype, "canDrag", void 0); ], HorizontalList.prototype, "canDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], HorizontalList.prototype, "itemCanDrag", void 0);
__decorate([ __decorate([
Property, Property,
__metadata("design:type", Function) __metadata("design:type", Function)

View File

@ -1972,6 +1972,10 @@ __decorate$b([
Property, Property,
__metadata$b("design:type", Boolean) __metadata$b("design:type", Boolean)
], List.prototype, "canDrag", void 0); ], List.prototype, "canDrag", void 0);
__decorate$b([
Property,
__metadata$b("design:type", Function)
], List.prototype, "itemCanDrag", void 0);
__decorate$b([ __decorate$b([
Property, Property,
__metadata$b("design:type", Function) __metadata$b("design:type", Function)
@ -2505,6 +2509,10 @@ __decorate$7([
Property, Property,
__metadata$7("design:type", Boolean) __metadata$7("design:type", Boolean)
], FlowLayout.prototype, "canDrag", void 0); ], FlowLayout.prototype, "canDrag", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Function)
], FlowLayout.prototype, "itemCanDrag", void 0);
__decorate$7([ __decorate$7([
Property, Property,
__metadata$7("design:type", Function) __metadata$7("design:type", Function)
@ -3071,6 +3079,10 @@ __decorate([
Property, Property,
__metadata("design:type", Boolean) __metadata("design:type", Boolean)
], HorizontalList.prototype, "canDrag", void 0); ], HorizontalList.prototype, "canDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], HorizontalList.prototype, "itemCanDrag", void 0);
__decorate([ __decorate([
Property, Property,
__metadata("design:type", Function) __metadata("design:type", Function)

View File

@ -3502,6 +3502,10 @@ __decorate$b([
Property, Property,
__metadata$b("design:type", Boolean) __metadata$b("design:type", Boolean)
], List.prototype, "canDrag", void 0); ], List.prototype, "canDrag", void 0);
__decorate$b([
Property,
__metadata$b("design:type", Function)
], List.prototype, "itemCanDrag", void 0);
__decorate$b([ __decorate$b([
Property, Property,
__metadata$b("design:type", Function) __metadata$b("design:type", Function)
@ -4035,6 +4039,10 @@ __decorate$7([
Property, Property,
__metadata$7("design:type", Boolean) __metadata$7("design:type", Boolean)
], FlowLayout.prototype, "canDrag", void 0); ], FlowLayout.prototype, "canDrag", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Function)
], FlowLayout.prototype, "itemCanDrag", void 0);
__decorate$7([ __decorate$7([
Property, Property,
__metadata$7("design:type", Function) __metadata$7("design:type", Function)
@ -4601,6 +4609,10 @@ __decorate([
Property, Property,
__metadata("design:type", Boolean) __metadata("design:type", Boolean)
], HorizontalList.prototype, "canDrag", void 0); ], HorizontalList.prototype, "canDrag", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], HorizontalList.prototype, "itemCanDrag", void 0);
__decorate([ __decorate([
Property, Property,
__metadata("design:type", Function) __metadata("design:type", Function)

33
doric-js/index.d.ts vendored
View File

@ -1029,7 +1029,16 @@ declare module "doric" {
*/ */
bounces?: boolean; bounces?: boolean;
canDrag?: 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; onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void; onDragged?: (from: number, to: number) => void;
scrollToItem(context: BridgeContext, index: number, config?: { scrollToItem(context: BridgeContext, index: number, config?: {
@ -1191,7 +1200,16 @@ declare module "doric" {
*/ */
bounces?: boolean; bounces?: boolean;
canDrag?: 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; onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void; onDragged?: (from: number, to: number) => void;
/** /**
@ -1454,7 +1472,16 @@ declare module "doric" {
*/ */
bounces?: boolean; bounces?: boolean;
canDrag?: 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; onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void; onDragged?: (from: number, to: number) => void;
scrollToItem(context: BridgeContext, index: number, config?: { scrollToItem(context: BridgeContext, index: number, config?: {

View File

@ -38,7 +38,16 @@ export declare class FlowLayout extends Superview {
*/ */
bounces?: boolean; bounces?: boolean;
canDrag?: 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; onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void; onDragged?: (from: number, to: number) => void;
/** /**

View File

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

View File

@ -31,7 +31,16 @@ export declare class HorizontalList extends Superview {
*/ */
bounces?: boolean; bounces?: boolean;
canDrag?: 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; onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void; onDragged?: (from: number, to: number) => void;
scrollToItem(context: BridgeContext, index: number, config?: { scrollToItem(context: BridgeContext, index: number, config?: {

View File

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

View File

@ -37,7 +37,16 @@ export declare class List extends Superview {
*/ */
bounces?: boolean; bounces?: boolean;
canDrag?: 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; onDragging?: (from: number, to: number) => void;
onDragged?: (from: number, to: number) => void; onDragged?: (from: number, to: number) => void;
scrollToItem(context: BridgeContext, index: number, config?: { scrollToItem(context: BridgeContext, index: number, config?: {

View File

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

View File

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

View File

@ -84,8 +84,19 @@ export class HorizontalList extends Superview {
@Property @Property
canDrag?: boolean canDrag?: boolean
/**
* @param from
* @returns Returns the item of index which can dragged or not.
*/
@Property @Property
beforeDragging?: (from: number) => void itemCanDrag?: (from: number) => boolean
/**
* @param from
* @returns Returns an array of index which can not be swap during dragging.
*/
@Property
beforeDragging?: (from: number) => (Array<number> | void)
@Property @Property
onDragging?: (from: number, to: number) => void onDragging?: (from: number, to: number) => void

View File

@ -84,8 +84,19 @@ export class List extends Superview {
@Property @Property
canDrag?: boolean canDrag?: boolean
/**
* @param from
* @returns Returns the item of index which can dragged or not.
*/
@Property @Property
beforeDragging?: (from: number) => void itemCanDrag?: (from: number) => boolean
/**
* @param from
* @returns Returns an array of index which can not be swap during dragging.
*/
@Property
beforeDragging?: (from: number) => (Array<number> | void)
@Property @Property
onDragging?: (from: number, to: number) => void onDragging?: (from: number, to: number) => void