lyb-js 1.6.8 → 1.6.9
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/Misc/LibJsNumberStepper.d.ts +1 -7
- package/Misc/LibJsNumberStepper.js +3 -18
- package/index.js +1 -2
- package/lyb.js +3 -16
- package/package.json +1 -1
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
* @link 使用方法:https://www.npmjs.com/package/lyb-js#LibJsNumberStepper-数字步进器
|
|
3
3
|
*/
|
|
4
4
|
export declare class LibJsNumberStepper {
|
|
5
|
-
/** 当前数字索引 */
|
|
6
|
-
private _currentIndex;
|
|
7
|
-
/** 金额数 */
|
|
8
|
-
private _numsLength;
|
|
9
5
|
/** 当前按下状态 */
|
|
10
6
|
private _isDown;
|
|
11
7
|
/** 定时器ID */
|
|
@@ -18,13 +14,11 @@ export declare class LibJsNumberStepper {
|
|
|
18
14
|
* @param numsLength 数字长度
|
|
19
15
|
* @param onChange 数字变动时触发
|
|
20
16
|
*/
|
|
21
|
-
constructor(
|
|
17
|
+
constructor(onChange: (index: "add" | "sub") => void);
|
|
22
18
|
/** @description 按下
|
|
23
19
|
* @param type 操作类型 add:加 sub:减
|
|
24
20
|
*/
|
|
25
21
|
down(type: "add" | "sub"): void;
|
|
26
|
-
/** @description 更新索引 */
|
|
27
|
-
updateIndex(index: number): void;
|
|
28
22
|
/** @description 抬起 */
|
|
29
23
|
private _up;
|
|
30
24
|
/** @description 处理数字变化
|
|
@@ -6,15 +6,10 @@ export class LibJsNumberStepper {
|
|
|
6
6
|
* @param numsLength 数字长度
|
|
7
7
|
* @param onChange 数字变动时触发
|
|
8
8
|
*/
|
|
9
|
-
constructor(
|
|
10
|
-
/** 当前数字索引 */
|
|
11
|
-
this._currentIndex = 0;
|
|
12
|
-
/** 金额数 */
|
|
13
|
-
this._numsLength = 0;
|
|
9
|
+
constructor(onChange) {
|
|
14
10
|
/** 当前按下状态 */
|
|
15
11
|
this._isDown = false;
|
|
16
12
|
this._onChange = onChange;
|
|
17
|
-
this._numsLength = numsLength;
|
|
18
13
|
window.addEventListener("pointerup", () => {
|
|
19
14
|
this._isDown && this._up();
|
|
20
15
|
});
|
|
@@ -33,10 +28,6 @@ export class LibJsNumberStepper {
|
|
|
33
28
|
}
|
|
34
29
|
}, 100);
|
|
35
30
|
}
|
|
36
|
-
/** @description 更新索引 */
|
|
37
|
-
updateIndex(index) {
|
|
38
|
-
this._currentIndex = index;
|
|
39
|
-
}
|
|
40
31
|
/** @description 抬起 */
|
|
41
32
|
_up() {
|
|
42
33
|
this._isDown = false;
|
|
@@ -48,16 +39,10 @@ export class LibJsNumberStepper {
|
|
|
48
39
|
*/
|
|
49
40
|
_handleChange(type) {
|
|
50
41
|
if (type === "add") {
|
|
51
|
-
|
|
52
|
-
this._currentIndex++;
|
|
53
|
-
this._onChange(this._currentIndex);
|
|
54
|
-
}
|
|
42
|
+
this._onChange("add");
|
|
55
43
|
}
|
|
56
44
|
else if (type === "sub") {
|
|
57
|
-
|
|
58
|
-
this._currentIndex--;
|
|
59
|
-
this._onChange(this._currentIndex);
|
|
60
|
-
}
|
|
45
|
+
this._onChange("sub");
|
|
61
46
|
}
|
|
62
47
|
}
|
|
63
48
|
}
|
package/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { LibJs_1 as LibJs };
|
|
1
|
+
export * as LibJs from "./libJs";
|
package/lyb.js
CHANGED
|
@@ -3051,12 +3051,9 @@ ${log3.label}:`, log3.value];
|
|
|
3051
3051
|
* @param numsLength 数字长度
|
|
3052
3052
|
* @param onChange 数字变动时触发
|
|
3053
3053
|
*/
|
|
3054
|
-
constructor(
|
|
3055
|
-
this._currentIndex = 0;
|
|
3056
|
-
this._numsLength = 0;
|
|
3054
|
+
constructor(onChange) {
|
|
3057
3055
|
this._isDown = false;
|
|
3058
3056
|
this._onChange = onChange;
|
|
3059
|
-
this._numsLength = numsLength;
|
|
3060
3057
|
window.addEventListener("pointerup", () => {
|
|
3061
3058
|
this._isDown && this._up();
|
|
3062
3059
|
});
|
|
@@ -3075,10 +3072,6 @@ ${log3.label}:`, log3.value];
|
|
|
3075
3072
|
}
|
|
3076
3073
|
}, 100);
|
|
3077
3074
|
}
|
|
3078
|
-
/** @description 更新索引 */
|
|
3079
|
-
updateIndex(index) {
|
|
3080
|
-
this._currentIndex = index;
|
|
3081
|
-
}
|
|
3082
3075
|
/** @description 抬起 */
|
|
3083
3076
|
_up() {
|
|
3084
3077
|
this._isDown = false;
|
|
@@ -3090,15 +3083,9 @@ ${log3.label}:`, log3.value];
|
|
|
3090
3083
|
*/
|
|
3091
3084
|
_handleChange(type) {
|
|
3092
3085
|
if (type === "add") {
|
|
3093
|
-
|
|
3094
|
-
this._currentIndex++;
|
|
3095
|
-
this._onChange(this._currentIndex);
|
|
3096
|
-
}
|
|
3086
|
+
this._onChange("add");
|
|
3097
3087
|
} else if (type === "sub") {
|
|
3098
|
-
|
|
3099
|
-
this._currentIndex--;
|
|
3100
|
-
this._onChange(this._currentIndex);
|
|
3101
|
-
}
|
|
3088
|
+
this._onChange("sub");
|
|
3102
3089
|
}
|
|
3103
3090
|
}
|
|
3104
3091
|
}
|