nhanh-pure-function 3.0.6-beta.7 → 3.0.6-beta.8
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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { default as _Canvas } from '../..';
|
|
2
2
|
import { OverlayType } from '../index';
|
|
3
3
|
import { EventHandler, default as EventController } from '../../public/eventController';
|
|
4
|
+
import { _Type_DeepPartial } from '../../..';
|
|
4
5
|
type ConstructorOption<T, V> = ConstructorParameters<typeof EventController>[0] & {
|
|
5
6
|
/** 样式 */
|
|
6
|
-
style?:
|
|
7
|
+
style?: _Type_DeepPartial<T> | string;
|
|
7
8
|
/** 层级 */
|
|
8
9
|
zIndex?: number;
|
|
9
10
|
/** 坐标轴上的点位 */
|
|
@@ -69,7 +70,7 @@ export default abstract class Overlay<T, V extends [number, number] | [number, n
|
|
|
69
70
|
value?: V;
|
|
70
71
|
dynamicPosition?: V;
|
|
71
72
|
zIndex?: number;
|
|
72
|
-
style?:
|
|
73
|
+
style?: _Type_DeepPartial<T> | string;
|
|
73
74
|
}, updateValueScope?: boolean): void;
|
|
74
75
|
/** 鼠标移入时是否重新绘制 */
|
|
75
76
|
redrawOnIsHoverChange: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as Canvas } from '..';
|
|
2
|
+
import { _Type_DeepPartial } from '../..';
|
|
2
3
|
export default class Axis {
|
|
3
4
|
/** 画布 */
|
|
4
5
|
private canvas;
|
|
@@ -18,7 +19,7 @@ export default class Axis {
|
|
|
18
19
|
constructor(canvas: Canvas);
|
|
19
20
|
private initAxisCanvas;
|
|
20
21
|
/** 开关坐标轴 */
|
|
21
|
-
toggleAxis(show?: boolean |
|
|
22
|
+
toggleAxis(show?: boolean | _Type_DeepPartial<Axis["show"]>): void;
|
|
22
23
|
drawAxisAndGrid(): HTMLCanvasElement | undefined;
|
|
23
24
|
private color;
|
|
24
25
|
/** 绘制网格 */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _Type_DeepPartial } from '../..';
|
|
1
2
|
import { default as Axis } from './axis';
|
|
2
3
|
import { default as Event } from './event';
|
|
3
4
|
import { default as OverlayGroup, OverlayType } from '../OverlayGroup';
|
|
@@ -28,7 +29,7 @@ declare class QuickMethod_Set extends QuickMethod_Get {
|
|
|
28
29
|
/** 缩小 */
|
|
29
30
|
zoomOut(): void;
|
|
30
31
|
/** 添加样式 */
|
|
31
|
-
setStyle(style:
|
|
32
|
+
setStyle(style: _Type_DeepPartial<StyleType>): void;
|
|
32
33
|
/** 设置主题 */
|
|
33
34
|
setTheme(theme: KnownStyleKeys): void;
|
|
34
35
|
/** 设置坐标轴 */
|
|
@@ -80,7 +81,7 @@ declare class QuickMethod_View extends QuickMethod_Set {
|
|
|
80
81
|
}
|
|
81
82
|
declare class QuickMethod_Toggle extends QuickMethod_View {
|
|
82
83
|
/** 开关坐标轴 */
|
|
83
|
-
toggleAxis(show?: boolean |
|
|
84
|
+
toggleAxis(show?: boolean | _Type_DeepPartial<Axis["show"]>): void;
|
|
84
85
|
/** 开关点位 */
|
|
85
86
|
togglePoint(show?: boolean): boolean;
|
|
86
87
|
/** 开关线段 */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _Type_DeepPartial } from '../..';
|
|
1
2
|
import { default as BaseData } from './basedata';
|
|
2
3
|
type ConstructorOption = ConstructorParameters<typeof BaseData>[0] & {
|
|
3
4
|
theme?: KnownStyleKeys;
|
|
@@ -15,7 +16,7 @@ export default class Style extends BaseData {
|
|
|
15
16
|
/** 清除画布 */
|
|
16
17
|
clearScreen(fillBackground?: boolean): void;
|
|
17
18
|
/** 设置样式 */
|
|
18
|
-
setStyle(style:
|
|
19
|
+
setStyle(style: _Type_DeepPartial<StyleType>): void;
|
|
19
20
|
/** 设置主题 */
|
|
20
21
|
setTheme(theme: KnownStyleKeys): void;
|
|
21
22
|
}
|
package/dist/Types/index.d.ts
CHANGED
|
@@ -27,8 +27,13 @@ export type _Type_PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T,
|
|
|
27
27
|
* 使所有层级的属性都变为可选。适用于需要部分更新对象且允许深层属性缺失的场景
|
|
28
28
|
*/
|
|
29
29
|
export type _Type_DeepPartial<T> = {
|
|
30
|
-
[P in keyof T]?: T[P] extends object ?
|
|
30
|
+
[P in keyof T]?: T[P] extends object ? _Type_DeepPartial<T[P]> : T[P];
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* @template T - 要处理的对象类型
|
|
34
|
+
* @description 创建一个对象类型,将所有属性变为可变(mutable)。
|
|
35
|
+
* 适用于需要修改对象属性的场景,但需要确保对象不会被其他地方引用
|
|
36
|
+
*/
|
|
32
37
|
export type _Type_Mutable<T> = {
|
|
33
38
|
-readonly [P in keyof T]: T[P];
|
|
34
39
|
};
|