first commit
This commit is contained in:
44
node_modules/vant/lib/swipe-cell/SwipeCell.d.ts
generated
vendored
Normal file
44
node_modules/vant/lib/swipe-cell/SwipeCell.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { type PropType, type ExtractPropTypes } from 'vue';
|
||||
import { Interceptor } from '../utils';
|
||||
export declare const swipeCellProps: {
|
||||
name: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: string;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
leftWidth: (NumberConstructor | StringConstructor)[];
|
||||
rightWidth: (NumberConstructor | StringConstructor)[];
|
||||
beforeClose: PropType<Interceptor>;
|
||||
stopPropagation: BooleanConstructor;
|
||||
};
|
||||
export type SwipeCellProps = ExtractPropTypes<typeof swipeCellProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
name: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: string;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
leftWidth: (NumberConstructor | StringConstructor)[];
|
||||
rightWidth: (NumberConstructor | StringConstructor)[];
|
||||
beforeClose: PropType<Interceptor>;
|
||||
stopPropagation: BooleanConstructor;
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "click" | "close")[], "open" | "click" | "close", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
name: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: string;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
leftWidth: (NumberConstructor | StringConstructor)[];
|
||||
rightWidth: (NumberConstructor | StringConstructor)[];
|
||||
beforeClose: PropType<Interceptor>;
|
||||
stopPropagation: BooleanConstructor;
|
||||
}>> & Readonly<{
|
||||
onClick?: ((...args: any[]) => any) | undefined;
|
||||
onClose?: ((...args: any[]) => any) | undefined;
|
||||
onOpen?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
name: string | number;
|
||||
disabled: boolean;
|
||||
stopPropagation: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
193
node_modules/vant/lib/swipe-cell/SwipeCell.js
generated
vendored
Normal file
193
node_modules/vant/lib/swipe-cell/SwipeCell.js
generated
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name2 in all)
|
||||
__defProp(target, name2, { get: all[name2], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
default: () => stdin_default,
|
||||
swipeCellProps: () => swipeCellProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_vue = require("vue");
|
||||
var import_utils = require("../utils");
|
||||
var import_use = require("@vant/use");
|
||||
var import_use_touch = require("../composables/use-touch");
|
||||
var import_use_expose = require("../composables/use-expose");
|
||||
const [name, bem] = (0, import_utils.createNamespace)("swipe-cell");
|
||||
const swipeCellProps = {
|
||||
name: (0, import_utils.makeNumericProp)(""),
|
||||
disabled: Boolean,
|
||||
leftWidth: import_utils.numericProp,
|
||||
rightWidth: import_utils.numericProp,
|
||||
beforeClose: Function,
|
||||
stopPropagation: Boolean
|
||||
};
|
||||
var stdin_default = (0, import_vue.defineComponent)({
|
||||
name,
|
||||
props: swipeCellProps,
|
||||
emits: ["open", "close", "click"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
let opened;
|
||||
let lockClick;
|
||||
let startOffset;
|
||||
let isInBeforeClosing;
|
||||
const root = (0, import_vue.ref)();
|
||||
const leftRef = (0, import_vue.ref)();
|
||||
const rightRef = (0, import_vue.ref)();
|
||||
const state = (0, import_vue.reactive)({
|
||||
offset: 0,
|
||||
dragging: false
|
||||
});
|
||||
const touch = (0, import_use_touch.useTouch)();
|
||||
const getWidthByRef = (ref2) => ref2.value ? (0, import_use.useRect)(ref2).width : 0;
|
||||
const leftWidth = (0, import_vue.computed)(() => (0, import_utils.isDef)(props.leftWidth) ? +props.leftWidth : getWidthByRef(leftRef));
|
||||
const rightWidth = (0, import_vue.computed)(() => (0, import_utils.isDef)(props.rightWidth) ? +props.rightWidth : getWidthByRef(rightRef));
|
||||
const open = (side) => {
|
||||
state.offset = side === "left" ? leftWidth.value : -rightWidth.value;
|
||||
if (!opened) {
|
||||
opened = true;
|
||||
emit("open", {
|
||||
name: props.name,
|
||||
position: side
|
||||
});
|
||||
}
|
||||
};
|
||||
const close = (position) => {
|
||||
state.offset = 0;
|
||||
if (opened) {
|
||||
opened = false;
|
||||
emit("close", {
|
||||
name: props.name,
|
||||
position
|
||||
});
|
||||
}
|
||||
};
|
||||
const toggle = (side) => {
|
||||
const offset = Math.abs(state.offset);
|
||||
const THRESHOLD = 0.15;
|
||||
const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
|
||||
const width = side === "left" ? leftWidth.value : rightWidth.value;
|
||||
if (width && offset > width * threshold) {
|
||||
open(side);
|
||||
} else {
|
||||
close(side);
|
||||
}
|
||||
};
|
||||
const onTouchStart = (event) => {
|
||||
if (!props.disabled) {
|
||||
startOffset = state.offset;
|
||||
touch.start(event);
|
||||
}
|
||||
};
|
||||
const onTouchMove = (event) => {
|
||||
if (props.disabled) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
deltaX
|
||||
} = touch;
|
||||
touch.move(event);
|
||||
if (touch.isHorizontal()) {
|
||||
lockClick = true;
|
||||
state.dragging = true;
|
||||
const isEdge = !opened || deltaX.value * startOffset < 0;
|
||||
if (isEdge) {
|
||||
(0, import_utils.preventDefault)(event, props.stopPropagation);
|
||||
}
|
||||
state.offset = (0, import_utils.clamp)(deltaX.value + startOffset, -rightWidth.value, leftWidth.value);
|
||||
}
|
||||
};
|
||||
const onTouchEnd = () => {
|
||||
if (state.dragging) {
|
||||
state.dragging = false;
|
||||
toggle(state.offset > 0 ? "left" : "right");
|
||||
setTimeout(() => {
|
||||
lockClick = false;
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
const onClick = (position = "outside", event) => {
|
||||
if (isInBeforeClosing) return;
|
||||
emit("click", position);
|
||||
if (opened && !lockClick) {
|
||||
isInBeforeClosing = true;
|
||||
(0, import_utils.callInterceptor)(props.beforeClose, {
|
||||
args: [{
|
||||
event,
|
||||
name: props.name,
|
||||
position
|
||||
}],
|
||||
done: () => {
|
||||
isInBeforeClosing = false;
|
||||
close(position);
|
||||
},
|
||||
canceled: () => isInBeforeClosing = false,
|
||||
error: () => isInBeforeClosing = false
|
||||
});
|
||||
}
|
||||
};
|
||||
const getClickHandler = (position) => (event) => {
|
||||
if (lockClick || opened) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
if (lockClick) {
|
||||
return;
|
||||
}
|
||||
onClick(position, event);
|
||||
};
|
||||
const renderSideContent = (side, ref2) => {
|
||||
const contentSlot = slots[side];
|
||||
if (contentSlot) {
|
||||
return (0, import_vue.createVNode)("div", {
|
||||
"ref": ref2,
|
||||
"class": bem(side),
|
||||
"onClick": getClickHandler(side)
|
||||
}, [contentSlot()]);
|
||||
}
|
||||
};
|
||||
(0, import_use_expose.useExpose)({
|
||||
open,
|
||||
close
|
||||
});
|
||||
(0, import_use.useClickAway)(root, (event) => onClick("outside", event), {
|
||||
eventName: "touchstart"
|
||||
});
|
||||
(0, import_use.useEventListener)("touchmove", onTouchMove, {
|
||||
target: root
|
||||
});
|
||||
return () => {
|
||||
var _a;
|
||||
const wrapperStyle = {
|
||||
transform: `translate3d(${state.offset}px, 0, 0)`,
|
||||
transitionDuration: state.dragging ? "0s" : ".6s"
|
||||
};
|
||||
return (0, import_vue.createVNode)("div", {
|
||||
"ref": root,
|
||||
"class": bem(),
|
||||
"onClick": getClickHandler("cell"),
|
||||
"onTouchstartPassive": onTouchStart,
|
||||
"onTouchend": onTouchEnd,
|
||||
"onTouchcancel": onTouchEnd
|
||||
}, [(0, import_vue.createVNode)("div", {
|
||||
"class": bem("wrapper"),
|
||||
"style": wrapperStyle
|
||||
}, [renderSideContent("left", leftRef), (_a = slots.default) == null ? void 0 : _a.call(slots), renderSideContent("right", rightRef)])]);
|
||||
};
|
||||
}
|
||||
});
|
||||
1
node_modules/vant/lib/swipe-cell/index.css
generated
vendored
Normal file
1
node_modules/vant/lib/swipe-cell/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.van-swipe-cell{position:relative;overflow:hidden;cursor:-webkit-grab;cursor:grab}.van-swipe-cell__wrapper{transition-timing-function:cubic-bezier(.18,.89,.32,1);transition-property:transform}.van-swipe-cell__left,.van-swipe-cell__right{position:absolute;top:0;height:100%}.van-swipe-cell__left{left:0;transform:translate3d(-100%,0,0)}.van-swipe-cell__right{right:0;transform:translate3d(100%,0,0)}
|
||||
39
node_modules/vant/lib/swipe-cell/index.d.ts
generated
vendored
Normal file
39
node_modules/vant/lib/swipe-cell/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { SwipeCellProps } from './SwipeCell';
|
||||
export declare const SwipeCell: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
name: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: string;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
leftWidth: (NumberConstructor | StringConstructor)[];
|
||||
rightWidth: (NumberConstructor | StringConstructor)[];
|
||||
beforeClose: import("vue").PropType<import("../utils").Interceptor>;
|
||||
stopPropagation: BooleanConstructor;
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "click" | "close")[], "open" | "click" | "close", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
name: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: string;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
leftWidth: (NumberConstructor | StringConstructor)[];
|
||||
rightWidth: (NumberConstructor | StringConstructor)[];
|
||||
beforeClose: import("vue").PropType<import("../utils").Interceptor>;
|
||||
stopPropagation: BooleanConstructor;
|
||||
}>> & Readonly<{
|
||||
onClick?: ((...args: any[]) => any) | undefined;
|
||||
onClose?: ((...args: any[]) => any) | undefined;
|
||||
onOpen?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
name: string | number;
|
||||
disabled: boolean;
|
||||
stopPropagation: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default SwipeCell;
|
||||
export { swipeCellProps } from './SwipeCell';
|
||||
export type { SwipeCellProps };
|
||||
export type { SwipeCellSide, SwipeCellPosition, SwipeCellInstance, } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanSwipeCell: typeof SwipeCell;
|
||||
}
|
||||
}
|
||||
39
node_modules/vant/lib/swipe-cell/index.js
generated
vendored
Normal file
39
node_modules/vant/lib/swipe-cell/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
SwipeCell: () => SwipeCell,
|
||||
default: () => stdin_default,
|
||||
swipeCellProps: () => import_SwipeCell2.swipeCellProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_utils = require("../utils");
|
||||
var import_SwipeCell = __toESM(require("./SwipeCell"));
|
||||
var import_SwipeCell2 = require("./SwipeCell");
|
||||
const SwipeCell = (0, import_utils.withInstall)(import_SwipeCell.default);
|
||||
var stdin_default = SwipeCell;
|
||||
1
node_modules/vant/lib/swipe-cell/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/lib/swipe-cell/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
2
node_modules/vant/lib/swipe-cell/style/index.js
generated
vendored
Normal file
2
node_modules/vant/lib/swipe-cell/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
require("../../style/base.css");
|
||||
require("../index.css");
|
||||
9
node_modules/vant/lib/swipe-cell/types.d.ts
generated
vendored
Normal file
9
node_modules/vant/lib/swipe-cell/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import type { SwipeCellProps } from './SwipeCell';
|
||||
export type SwipeCellSide = 'left' | 'right';
|
||||
export type SwipeCellPosition = SwipeCellSide | 'cell' | 'outside';
|
||||
export type SwipeCellExpose = {
|
||||
open: (side: SwipeCellSide) => void;
|
||||
close: (position: SwipeCellPosition) => void;
|
||||
};
|
||||
export type SwipeCellInstance = ComponentPublicInstance<SwipeCellProps, SwipeCellExpose>;
|
||||
15
node_modules/vant/lib/swipe-cell/types.js
generated
vendored
Normal file
15
node_modules/vant/lib/swipe-cell/types.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
Reference in New Issue
Block a user