@ray-js/components 1.6.23 → 1.6.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Swiper/Swiper.thing.js +15 -2
- package/lib/Swiper/Swiper.wechat.js +15 -2
- package/lib/Swiper/props.d.ts +103 -5
- package/lib/types/index.d.ts +7 -0
- package/package.json +5 -5
@@ -1,4 +1,5 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
4
|
const _excluded = ["id", "style", "className", "current", "dataSource", "onAfterChange", "onChange", "renderItem", "children"];
|
4
5
|
import "core-js/modules/esnext.iterator.map.js";
|
@@ -34,10 +35,22 @@ function Swiper(props) {
|
|
34
35
|
style: inlineStyle(style),
|
35
36
|
className: clsx('ray-swiper', className),
|
36
37
|
onChange: function (event) {
|
37
|
-
onChange === null || onChange === void 0 || onChange(event)
|
38
|
+
onChange === null || onChange === void 0 || onChange(_objectSpread(_objectSpread({}, event), {}, {
|
39
|
+
// FIXME: 为什么保留原始数据?这里是为了兼容原有业务已经使用该数据的情况
|
40
|
+
type: 'change',
|
41
|
+
current: event.detail.current,
|
42
|
+
source: event.detail.source,
|
43
|
+
origin: event
|
44
|
+
}));
|
38
45
|
},
|
39
46
|
onAnimationFinish: function (event) {
|
40
|
-
onAfterChange === null || onAfterChange === void 0 || onAfterChange(event)
|
47
|
+
onAfterChange === null || onAfterChange === void 0 || onAfterChange(_objectSpread(_objectSpread({}, event), {}, {
|
48
|
+
// FIXME: 为什么保留原始数据?这里是为了兼容原有业务已经使用该数据的情况
|
49
|
+
type: 'afterChange',
|
50
|
+
current: event.detail.current,
|
51
|
+
source: event.detail.source,
|
52
|
+
origin: event
|
53
|
+
}));
|
41
54
|
},
|
42
55
|
current: internalCurrent
|
43
56
|
}, propsAlias(restProps, SwiperPropsAlias)), function () {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
4
|
const _excluded = ["id", "style", "className", "current", "dataSource", "onAfterChange", "onChange", "renderItem", "children"];
|
4
5
|
import "core-js/modules/esnext.iterator.map.js";
|
@@ -34,10 +35,22 @@ function Swiper(props) {
|
|
34
35
|
style: inlineStyle(style),
|
35
36
|
className: clsx('ray-swiper', className),
|
36
37
|
onChange: function (event) {
|
37
|
-
onChange === null || onChange === void 0 || onChange(event)
|
38
|
+
onChange === null || onChange === void 0 || onChange(_objectSpread(_objectSpread({}, event), {}, {
|
39
|
+
// FIXME: 为什么保留原始数据?这里是为了兼容原有业务已经使用该数据的情况
|
40
|
+
type: 'change',
|
41
|
+
current: event.detail.current,
|
42
|
+
source: event.detail.source,
|
43
|
+
origin: event
|
44
|
+
}));
|
38
45
|
},
|
39
46
|
onAnimationFinish: function (event) {
|
40
|
-
onAfterChange === null || onAfterChange === void 0 || onAfterChange(event)
|
47
|
+
onAfterChange === null || onAfterChange === void 0 || onAfterChange(_objectSpread(_objectSpread({}, event), {}, {
|
48
|
+
// FIXME: 为什么保留原始数据?这里是为了兼容原有业务已经使用该数据的情况
|
49
|
+
type: 'afterChange',
|
50
|
+
current: event.detail.current,
|
51
|
+
source: event.detail.source,
|
52
|
+
origin: event
|
53
|
+
}));
|
41
54
|
},
|
42
55
|
current: internalCurrent
|
43
56
|
}, propsAlias(restProps, SwiperPropsAlias)), function () {
|
package/lib/Swiper/props.d.ts
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { BaseProps } from '../types';
|
3
|
-
|
3
|
+
interface Target<T = Record<string, any>> {
|
4
|
+
offsetTop: number;
|
5
|
+
offsetLeft: number;
|
6
|
+
id: string;
|
7
|
+
dataset: T;
|
8
|
+
}
|
4
9
|
export type SwiperProps<I> = BaseProps & {
|
5
10
|
/**
|
6
11
|
* @description.en Whether to display panel points
|
@@ -58,18 +63,110 @@ export type SwiperProps<I> = BaseProps & {
|
|
58
63
|
vertical?: boolean;
|
59
64
|
/** 前边距,可用于露出前一项的一小部分 */
|
60
65
|
/** 后边距,可用于露出后一项的一小部分 */
|
61
|
-
/**
|
66
|
+
/**
|
67
|
+
* current 改变时会触发 change 事件
|
68
|
+
**/
|
62
69
|
onChange?: (event: {
|
70
|
+
type: 'change';
|
63
71
|
current: number;
|
64
72
|
source: '' | 'autoplay' | 'touch';
|
65
|
-
|
73
|
+
/**
|
74
|
+
* @description.en Original event object
|
75
|
+
* @description.zh 原始事件对象
|
76
|
+
* @example
|
77
|
+
* {
|
78
|
+
* "type": "change",
|
79
|
+
* "timeStamp": 5633,
|
80
|
+
* "currentTarget": {
|
81
|
+
* "offsetTop": 12,
|
82
|
+
* "offsetLeft": 12,
|
83
|
+
* "id": "",
|
84
|
+
* "dataset": {
|
85
|
+
* "a": "b"
|
86
|
+
* }
|
87
|
+
* },
|
88
|
+
* "target": {
|
89
|
+
* "offsetTop": 12,
|
90
|
+
* "offsetLeft": 12,
|
91
|
+
* "id": "",
|
92
|
+
* "dataset": {
|
93
|
+
* "a": "b"
|
94
|
+
* }
|
95
|
+
* },
|
96
|
+
* "detail": {
|
97
|
+
* "current": 2,
|
98
|
+
* "currentItemId": "",
|
99
|
+
* "source": "touch"
|
100
|
+
* }
|
101
|
+
* }
|
102
|
+
*/
|
103
|
+
origin?: {
|
104
|
+
type: 'change';
|
105
|
+
timeStamp: number;
|
106
|
+
currentTarget: Target;
|
107
|
+
target: Target;
|
108
|
+
detail: {
|
109
|
+
current: number;
|
110
|
+
currentItemId: string;
|
111
|
+
source: '' | 'autoplay' | 'touch';
|
112
|
+
};
|
113
|
+
};
|
66
114
|
detail: {
|
67
|
-
|
115
|
+
current: number;
|
116
|
+
source: '' | 'autoplay' | 'touch';
|
68
117
|
};
|
69
118
|
}) => void;
|
70
119
|
/** swiper-item 的位置发生改变时会触发 transition 事件,event.detail = {dx: dx, dy: dy} 2.4.3 */
|
71
120
|
/** 动画结束时会触发 onAfterChange 事件 */
|
72
|
-
onAfterChange?: (event:
|
121
|
+
onAfterChange?: (event: {
|
122
|
+
type: 'afterChange';
|
123
|
+
current: number;
|
124
|
+
source: '' | 'autoplay' | 'touch';
|
125
|
+
/**
|
126
|
+
* @description.en Original event object
|
127
|
+
* @description.zh 原始事件对象
|
128
|
+
* @example
|
129
|
+
* {
|
130
|
+
* "type": "animationfinish",
|
131
|
+
* "timeStamp": 6144,
|
132
|
+
* "currentTarget": {
|
133
|
+
* "offsetTop": 12,
|
134
|
+
* "offsetLeft": 12,
|
135
|
+
* "id": "",
|
136
|
+
* "dataset": {
|
137
|
+
* "a": "b"
|
138
|
+
* }
|
139
|
+
* },
|
140
|
+
* "target": {
|
141
|
+
* "offsetTop": 12,
|
142
|
+
* "offsetLeft": 12,
|
143
|
+
* "id": "",
|
144
|
+
* "dataset": {
|
145
|
+
* "a": "b"
|
146
|
+
* }
|
147
|
+
* },
|
148
|
+
* "detail": {
|
149
|
+
* "current": 2,
|
150
|
+
* "currentItemId": "",
|
151
|
+
* "source": "touch"
|
152
|
+
* }
|
153
|
+
* }
|
154
|
+
*/
|
155
|
+
origin?: {
|
156
|
+
type: 'animationfinish';
|
157
|
+
timeStamp: number;
|
158
|
+
currentTarget: Target;
|
159
|
+
target: Target;
|
160
|
+
detail: {
|
161
|
+
current: number;
|
162
|
+
currentItemId: string;
|
163
|
+
source: '' | 'autoplay' | 'touch';
|
164
|
+
};
|
165
|
+
};
|
166
|
+
detail: {
|
167
|
+
value: any;
|
168
|
+
};
|
169
|
+
}) => void;
|
73
170
|
/** 列表数据 */
|
74
171
|
dataSource: I[];
|
75
172
|
/** 渲染列表项目 */
|
@@ -81,3 +178,4 @@ export declare const SwiperPropsAlias: {
|
|
81
178
|
dotColor: string;
|
82
179
|
dots: string;
|
83
180
|
};
|
181
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
@@ -24,6 +24,13 @@ export interface BaseProps extends TouchEventHandler {
|
|
24
24
|
* @default undefined
|
25
25
|
*/
|
26
26
|
children?: React.ReactNode | React.ReactNode[] | string;
|
27
|
+
/**
|
28
|
+
* @description.en Mini program component slot identifier
|
29
|
+
* @description.zh 小程序组件插槽标识
|
30
|
+
* @default undefined
|
31
|
+
* @deprecated 该属性仅在小程序基础组件中使用, 不建议在 React DSL 中使用
|
32
|
+
*/
|
33
|
+
slot?: string;
|
27
34
|
}
|
28
35
|
export interface HoverableProps {
|
29
36
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/components",
|
3
|
-
"version": "1.6.
|
3
|
+
"version": "1.6.25",
|
4
4
|
"description": "Ray basic components",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -29,8 +29,8 @@
|
|
29
29
|
"dependencies": {
|
30
30
|
"@ray-core/macro": "^0.4.8",
|
31
31
|
"@ray-core/wechat": "^0.4.8",
|
32
|
-
"@ray-js/adapter": "1.6.
|
33
|
-
"@ray-js/framework-shared": "1.6.
|
32
|
+
"@ray-js/adapter": "1.6.25",
|
33
|
+
"@ray-js/framework-shared": "1.6.25",
|
34
34
|
"ahooks": "^3.8.4",
|
35
35
|
"clsx": "^1.2.1",
|
36
36
|
"core-js": "^3.39.0",
|
@@ -40,11 +40,11 @@
|
|
40
40
|
"style-to-object": "^0.3.0"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
|
-
"@ray-js/cli": "1.6.
|
43
|
+
"@ray-js/cli": "1.6.25"
|
44
44
|
},
|
45
45
|
"publishConfig": {
|
46
46
|
"access": "public",
|
47
47
|
"registry": "https://registry.npmjs.com"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "a2c08384889bbc2b1812c4a37490126c18aa1803"
|
50
50
|
}
|