nhanh-pure-function 3.0.5 → 3.0.6-beta.1
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/LICENSE +21 -21
- package/README.md +18 -18
- package/dist/Canvas/LayerGroup/index.d.ts +30 -0
- package/dist/Canvas/LayerGroup/layer.d.ts +44 -0
- package/dist/Canvas/OverlayGroup/arc.d.ts +97 -0
- package/dist/Canvas/OverlayGroup/arcTo.d.ts +50 -0
- package/dist/Canvas/OverlayGroup/bezierCurve.d.ts +1 -0
- package/dist/Canvas/OverlayGroup/custom.d.ts +24 -0
- package/dist/Canvas/OverlayGroup/ellipse.d.ts +1 -0
- package/dist/Canvas/OverlayGroup/index.d.ts +31 -0
- package/dist/Canvas/OverlayGroup/line.d.ts +31 -0
- package/dist/Canvas/OverlayGroup/point.d.ts +40 -0
- package/dist/Canvas/OverlayGroup/polygon.d.ts +46 -0
- package/dist/Canvas/OverlayGroup/public/geometricBoundary.d.ts +70 -0
- package/dist/Canvas/OverlayGroup/public/overlay.d.ts +174 -0
- package/dist/Canvas/OverlayGroup/text.d.ts +27 -0
- package/dist/Canvas/core/axis.d.ts +42 -0
- package/dist/Canvas/core/basedata.d.ts +177 -0
- package/dist/Canvas/core/draw.d.ts +34 -0
- package/dist/Canvas/core/event.d.ts +77 -0
- package/dist/Canvas/core/quikmethod.d.ts +104 -0
- package/dist/Canvas/core/style.d.ts +22 -0
- package/dist/Canvas/index.d.ts +58 -0
- package/dist/Canvas/index.types.d.ts +14 -0
- package/dist/Canvas/public/basedata.d.ts +64 -0
- package/dist/Canvas/public/eventController.d.ts +111 -0
- package/dist/Canvas/public/eventControllerBasedata.d.ts +62 -0
- package/dist/Canvas/public/tools.d.ts +6 -0
- package/dist/Element/index.d.ts +17 -0
- package/dist/Utility/index.d.ts +12 -28
- package/dist/Utility/type.d.ts +10 -0
- package/dist/Valid/index.d.ts +2 -8
- package/dist/index.cjs.js +9 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +5427 -795
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { default as QuickMethod } from './core/quikmethod';
|
|
2
|
+
import { default as LayerGroup } from './LayerGroup';
|
|
3
|
+
import { default as OverlayGroup, OverlayType } from './OverlayGroup';
|
|
4
|
+
import { default as Layer } from './LayerGroup/layer';
|
|
5
|
+
import { default as Point } from './OverlayGroup/point';
|
|
6
|
+
import { default as Text } from './OverlayGroup/text';
|
|
7
|
+
import { default as Line } from './OverlayGroup/line';
|
|
8
|
+
import { default as Polygon } from './OverlayGroup/polygon';
|
|
9
|
+
import { default as Custom } from './OverlayGroup/custom';
|
|
10
|
+
import { default as Arc } from './OverlayGroup/arc';
|
|
11
|
+
import { default as ArcTo } from './OverlayGroup/arcTo';
|
|
12
|
+
export type * from './index.types';
|
|
13
|
+
type ConstructorOption = ConstructorParameters<typeof QuickMethod>[0] & {
|
|
14
|
+
/** 轴线显示属性 */
|
|
15
|
+
axisShow?: Parameters<_Canvas["toggleAxis"]>[0];
|
|
16
|
+
};
|
|
17
|
+
/** 你好啊你好的画布工具 */
|
|
18
|
+
export declare class _Canvas extends QuickMethod {
|
|
19
|
+
/** 图层群组 */
|
|
20
|
+
static LayerGroup: typeof LayerGroup;
|
|
21
|
+
/** 图层 */
|
|
22
|
+
static Layer: typeof Layer;
|
|
23
|
+
/** 覆盖物群组 */
|
|
24
|
+
static OverlayGroup: typeof OverlayGroup;
|
|
25
|
+
/** 文字 */
|
|
26
|
+
static Text: typeof Text;
|
|
27
|
+
/** 点位 */
|
|
28
|
+
static Point: typeof Point;
|
|
29
|
+
/** 线段 */
|
|
30
|
+
static Line: typeof Line;
|
|
31
|
+
/** 多边形 */
|
|
32
|
+
static Polygon: typeof Polygon;
|
|
33
|
+
/** 自定义绘制 */
|
|
34
|
+
static Custom: typeof Custom;
|
|
35
|
+
/** 圆弧 */
|
|
36
|
+
static Arc: typeof Arc;
|
|
37
|
+
/** 圆角 */
|
|
38
|
+
static ArcTo: typeof ArcTo;
|
|
39
|
+
constructor(option: ConstructorOption);
|
|
40
|
+
private initLayerGroups;
|
|
41
|
+
/** 获取图层群组 集合 */
|
|
42
|
+
gteLayerGroups(key?: string): LayerGroup | undefined;
|
|
43
|
+
/** 设置图层群组 */
|
|
44
|
+
setLayerGroup(layerGroup: LayerGroup): void;
|
|
45
|
+
/** 移除图层群组 */
|
|
46
|
+
removeLayerGroup(layerGroup: LayerGroup): void;
|
|
47
|
+
/** 添加图层 */
|
|
48
|
+
addLayer(layers: DeepArray<Layer>): void;
|
|
49
|
+
/** 移除图层 */
|
|
50
|
+
removeLayer(layers: DeepArray<Layer>): void;
|
|
51
|
+
/** 添加覆盖物 */
|
|
52
|
+
addOverlay(overlays: DeepArray<OverlayType>): void;
|
|
53
|
+
/** 移除覆盖物 */
|
|
54
|
+
removeOverlay(overlays: DeepArray<OverlayType>): void;
|
|
55
|
+
/** 销毁 */
|
|
56
|
+
destroy(): void;
|
|
57
|
+
}
|
|
58
|
+
export default _Canvas;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as LayerGroup } from './LayerGroup';
|
|
2
|
+
import { default as OverlayGroup, OverlayType } from './OverlayGroup';
|
|
3
|
+
import { default as Layer } from './LayerGroup/layer';
|
|
4
|
+
import { default as Point } from './OverlayGroup/point';
|
|
5
|
+
import { default as Text } from './OverlayGroup/text';
|
|
6
|
+
import { default as Line } from './OverlayGroup/line';
|
|
7
|
+
import { default as Polygon } from './OverlayGroup/polygon';
|
|
8
|
+
import { default as Axis } from './core/axis';
|
|
9
|
+
import { default as Custom } from './OverlayGroup/custom';
|
|
10
|
+
import { default as Arc } from './OverlayGroup/arc';
|
|
11
|
+
import { default as ArcTo } from './OverlayGroup/arcTo';
|
|
12
|
+
import { EventHandler } from './public/eventController';
|
|
13
|
+
import { default as Overlay } from './OverlayGroup/public/overlay';
|
|
14
|
+
export type { LayerGroup, OverlayGroup, Layer, OverlayType, Overlay, Point, Text, Line, Polygon, Axis, Custom, Arc, ArcTo, EventHandler, };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { default as _Canvas } from '..';
|
|
2
|
+
declare abstract class Base<T extends Base<T>> {
|
|
3
|
+
/** 父级 */
|
|
4
|
+
parent?: T;
|
|
5
|
+
/** 名称 */
|
|
6
|
+
name: string;
|
|
7
|
+
/** 自定义扩展数据 */
|
|
8
|
+
extData?: any;
|
|
9
|
+
/** 主画布 */
|
|
10
|
+
mainCanvas?: _Canvas;
|
|
11
|
+
private _isRecalculate;
|
|
12
|
+
/** 是否需要重新计算坐标 */
|
|
13
|
+
get isRecalculate(): boolean;
|
|
14
|
+
set isRecalculate(isRecalculate: boolean);
|
|
15
|
+
/** 是否是同一个主画布 */
|
|
16
|
+
equalsMainCanvas(mainCanvas?: _Canvas): boolean;
|
|
17
|
+
/** 设置主画布 */
|
|
18
|
+
setMainCanvas(mainCanvas?: _Canvas): void;
|
|
19
|
+
/** 通知重新加载 */
|
|
20
|
+
notifyReload?: (needForceExecute?: boolean) => void;
|
|
21
|
+
/** 设置通知重新加载 */
|
|
22
|
+
abstract setNotifyReload(notifyReload?: () => void): void;
|
|
23
|
+
}
|
|
24
|
+
declare abstract class Show<T extends Show<T>> extends Base<T> {
|
|
25
|
+
private _isVisible;
|
|
26
|
+
/** 是否显示 */
|
|
27
|
+
get isVisible(): boolean;
|
|
28
|
+
set isVisible(isVisible: boolean);
|
|
29
|
+
/** 是否继承父级透明度 */
|
|
30
|
+
protected inheritOpacity: boolean;
|
|
31
|
+
private _opacity;
|
|
32
|
+
/** 透明度 */
|
|
33
|
+
get opacity(): number | undefined;
|
|
34
|
+
set opacity(opacity: number | undefined);
|
|
35
|
+
private _scaleRange?;
|
|
36
|
+
/** 显示范围 缩放比例 */
|
|
37
|
+
get scaleRange(): [number, number] | undefined;
|
|
38
|
+
set scaleRange(scaleRange: [number, number] | undefined);
|
|
39
|
+
/** 是否需要渲染 */
|
|
40
|
+
shouldRender(): boolean;
|
|
41
|
+
}
|
|
42
|
+
interface BaseDataOptions {
|
|
43
|
+
/** 父级 */
|
|
44
|
+
parent?: BaseData<any>;
|
|
45
|
+
/** 名称 */
|
|
46
|
+
name?: string;
|
|
47
|
+
/** 自定义扩展数据 */
|
|
48
|
+
extData?: any;
|
|
49
|
+
/** 主画布 */
|
|
50
|
+
mainCanvas?: _Canvas;
|
|
51
|
+
/** 通知重新加载 */
|
|
52
|
+
notifyReload?: (needForceExecute?: boolean) => void;
|
|
53
|
+
/** 是否显示 */
|
|
54
|
+
isVisible?: boolean;
|
|
55
|
+
/** 透明度 */
|
|
56
|
+
opacity?: number;
|
|
57
|
+
/** 显示范围 缩放比例 */
|
|
58
|
+
scaleRange?: [number, number];
|
|
59
|
+
}
|
|
60
|
+
/** 基础数据 公共 */
|
|
61
|
+
export default abstract class BaseData<T extends BaseData<T>> extends Show<T> {
|
|
62
|
+
constructor(options: BaseDataOptions);
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { default as EventControllerBasedata } from './eventControllerBasedata';
|
|
2
|
+
declare class _CanvasEvent<T = undefined> {
|
|
3
|
+
readonly data: T;
|
|
4
|
+
private propagationStopped;
|
|
5
|
+
constructor(data: T);
|
|
6
|
+
stopPropagation(): void;
|
|
7
|
+
get canPropagate(): boolean;
|
|
8
|
+
}
|
|
9
|
+
type State = {
|
|
10
|
+
state: boolean;
|
|
11
|
+
oldState: boolean;
|
|
12
|
+
};
|
|
13
|
+
type EventMap = {
|
|
14
|
+
wheel: number;
|
|
15
|
+
down: State;
|
|
16
|
+
contextmenu: State;
|
|
17
|
+
click: State;
|
|
18
|
+
doubleClick: State;
|
|
19
|
+
hover: State;
|
|
20
|
+
dragg: {
|
|
21
|
+
offsetX: number;
|
|
22
|
+
offsetY: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type EventHandler<T extends keyof EventMap> = (event: _CanvasEvent<EventMap[T]>, mouseEvent?: MouseEvent) => void;
|
|
26
|
+
export default abstract class EventController extends EventControllerBasedata<EventController> {
|
|
27
|
+
/** 事件管理器 */
|
|
28
|
+
private readonly listeners;
|
|
29
|
+
/** 添加事件监听器 */
|
|
30
|
+
addEventListener<T extends keyof EventMap>(type: T, handler: EventHandler<T>): void;
|
|
31
|
+
/** 移除事件监听器 */
|
|
32
|
+
removeEventListener<T extends keyof EventMap>(type: T, handler: EventHandler<T>): void;
|
|
33
|
+
/** 共享事件状态集合 控制器 */
|
|
34
|
+
private sharedControllers;
|
|
35
|
+
/** 注册指定类型的共享事件状态集合 */
|
|
36
|
+
registerControllers(type: keyof EventMap, controllers: EventController[]): void;
|
|
37
|
+
/** 检查指定类型下是否存在特定控制器 */
|
|
38
|
+
hasController(type: keyof EventMap, controller: EventController): boolean | undefined;
|
|
39
|
+
private trigger;
|
|
40
|
+
private updateStates;
|
|
41
|
+
private _eventDate;
|
|
42
|
+
private _clearEventDate;
|
|
43
|
+
private checkEventDate;
|
|
44
|
+
private _isHover;
|
|
45
|
+
/** 是否触发悬停 */
|
|
46
|
+
get isHover(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 接收悬停状态变更通知(由外部事件处理器判断后调用)
|
|
49
|
+
* @param state - 当前悬停状态(true:进入元素 / false:离开元素)
|
|
50
|
+
* @param [event] - 可选的关联鼠标事件对象
|
|
51
|
+
*/
|
|
52
|
+
notifyHover: (state: boolean, event?: MouseEvent) => false | void;
|
|
53
|
+
private _isDown;
|
|
54
|
+
/** 是否触发按下 */
|
|
55
|
+
get isDown(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 接收鼠标按下状态变更通知(由外部事件处理器判断后调用)
|
|
58
|
+
* @param state - 当前按下状态(true:按下开始 / false:按下结束)
|
|
59
|
+
* @param [event] - 可选的关联鼠标事件对象
|
|
60
|
+
*/
|
|
61
|
+
notifyDown: (state: boolean, event?: MouseEvent) => false | void;
|
|
62
|
+
private _isContextmenu;
|
|
63
|
+
/** 是否触发右击 */
|
|
64
|
+
get isContextmenu(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 接收右键菜单触发通知(由外部事件处理器判断后调用)
|
|
67
|
+
* @param state - 右键触发状态(true: 右键开始 / false: 右键结束)
|
|
68
|
+
* @param [event] - 可选的关联鼠标事件对象
|
|
69
|
+
*/
|
|
70
|
+
notifyContextmenu: (state: boolean, event?: MouseEvent) => false | void;
|
|
71
|
+
private _isClick;
|
|
72
|
+
/** 是否触发点击 */
|
|
73
|
+
get isClick(): boolean;
|
|
74
|
+
/** 点击时间 */
|
|
75
|
+
private clickTimestamp;
|
|
76
|
+
/** 双击判定,两次点击之间的间隔(毫秒) */
|
|
77
|
+
doubleClickInterval: number;
|
|
78
|
+
/**
|
|
79
|
+
* 接收单击动作通知(由外部事件处理器判断点击动作后调用)
|
|
80
|
+
* @param state - 点击状态(true: 单击开始 / false: 单击结束)
|
|
81
|
+
* @param [event] - 可选的关联鼠标事件对象
|
|
82
|
+
*/
|
|
83
|
+
notifyClick: (state: boolean, event?: MouseEvent) => void;
|
|
84
|
+
private _isDblClick;
|
|
85
|
+
/** 是否触发双击 */
|
|
86
|
+
get isDblClick(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 接收双击动作通知(由外部事件处理器判断双击动作后调用)
|
|
89
|
+
* @param state - 双击状态(true: 双击开始 / false: 双击结束)
|
|
90
|
+
* @param [event] - 可选的关联鼠标事件对象
|
|
91
|
+
*/
|
|
92
|
+
notifyDoubleClick: (state: boolean, event?: MouseEvent) => false | void;
|
|
93
|
+
/**
|
|
94
|
+
* 接收拖拽位置更新通知(由外部事件处理器判断拖拽动作后调用)
|
|
95
|
+
* @param position - 当前拖拽位置坐标
|
|
96
|
+
* @param position.offsetX - 相对于元素X轴的偏移量
|
|
97
|
+
* @param position.offsetY - 相对于元素Y轴的偏移量
|
|
98
|
+
* @param [event] - 可选的关联鼠标事件对象
|
|
99
|
+
*/
|
|
100
|
+
notifyDragg: (position: {
|
|
101
|
+
offsetX: number;
|
|
102
|
+
offsetY: number;
|
|
103
|
+
}, event?: MouseEvent) => false | void;
|
|
104
|
+
/**
|
|
105
|
+
* 接收滚轮滚动通知(由外部事件处理器判断滚轮动作后调用)
|
|
106
|
+
* @param step - 滚轮滚动步长(正数:向上滚动 / 负数:向下滚动)
|
|
107
|
+
* @param [event] - 可选的关联滚轮事件对象
|
|
108
|
+
*/
|
|
109
|
+
notifyWheel: (step: number, event?: WheelEvent) => false | void;
|
|
110
|
+
}
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as BaseData } from './basedata';
|
|
2
|
+
type EventControllerOptions<T extends EventControllerBasedata<T>> = ConstructorParameters<typeof BaseData<EventControllerBasedata<T>>>[0] & {
|
|
3
|
+
/** 是否可以触发交互事件 */
|
|
4
|
+
isInteractive?: boolean;
|
|
5
|
+
/** 是否可以触发悬停事件 */
|
|
6
|
+
isHoverable?: boolean;
|
|
7
|
+
/** 是否可以触发按下事件 */
|
|
8
|
+
isDownable?: boolean;
|
|
9
|
+
/** 是否可以触发右击事件 */
|
|
10
|
+
isContextmenuable?: boolean;
|
|
11
|
+
/** 是否可以触发点击事件 */
|
|
12
|
+
isClickable?: boolean;
|
|
13
|
+
/** 是否可以触发双击事件 */
|
|
14
|
+
isDoubleClickable?: boolean;
|
|
15
|
+
/** 是否可以触发拖动事件 */
|
|
16
|
+
isDraggable?: boolean;
|
|
17
|
+
/** 是否可以触发滚轮滚动事件 */
|
|
18
|
+
isWheelable?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export default abstract class EventControllerBasedata<T extends EventControllerBasedata<T>> extends BaseData<T> {
|
|
21
|
+
private _isInteractive;
|
|
22
|
+
/** 是否可以触发交互事件 */
|
|
23
|
+
get isInteractive(): boolean;
|
|
24
|
+
set isInteractive(value: boolean);
|
|
25
|
+
private _isHoverable;
|
|
26
|
+
/** 是否可以触发悬停事件 */
|
|
27
|
+
get isHoverable(): boolean;
|
|
28
|
+
set isHoverable(value: boolean);
|
|
29
|
+
private _isDownable;
|
|
30
|
+
/** 是否可以触发按下事件 */
|
|
31
|
+
get isDownable(): boolean;
|
|
32
|
+
set isDownable(value: boolean);
|
|
33
|
+
private _isContextmenuable;
|
|
34
|
+
/** 是否可以触发右击事件 */
|
|
35
|
+
get isContextmenuable(): boolean;
|
|
36
|
+
set isContextmenuable(value: boolean);
|
|
37
|
+
private _isClickable;
|
|
38
|
+
/** 是否可以触发点击事件 */
|
|
39
|
+
get isClickable(): boolean;
|
|
40
|
+
set isClickable(value: boolean);
|
|
41
|
+
private _isDoubleClickable;
|
|
42
|
+
/** 是否可以触发双击事件 */
|
|
43
|
+
get isDoubleClickable(): boolean;
|
|
44
|
+
set isDoubleClickable(value: boolean);
|
|
45
|
+
private _isDraggable;
|
|
46
|
+
/** 是否可以触发拖动事件 */
|
|
47
|
+
get isDraggable(): boolean;
|
|
48
|
+
set isDraggable(value: boolean);
|
|
49
|
+
private _isWheelable;
|
|
50
|
+
/** 是否可以触发滚轮滚动事件 */
|
|
51
|
+
get isWheelable(): boolean;
|
|
52
|
+
set isWheelable(value: boolean);
|
|
53
|
+
/**
|
|
54
|
+
* 通用属性获取方法
|
|
55
|
+
* @param parentProp 父级属性名
|
|
56
|
+
* @param ownValue 当前实例的属性值
|
|
57
|
+
* @param checkInteractive 是否检查交互状态(isInteractive 属性专用)
|
|
58
|
+
*/
|
|
59
|
+
private getPropValue;
|
|
60
|
+
constructor(options: EventControllerOptions<T>);
|
|
61
|
+
}
|
|
62
|
+
export {};
|
package/dist/Element/index.d.ts
CHANGED
|
@@ -89,3 +89,20 @@ export declare function _Element_CalculateCanvasSize(aspectRatio: number, target
|
|
|
89
89
|
* @returns 一个Promise对象,包含加载的图片对象及其宽高比
|
|
90
90
|
*/
|
|
91
91
|
export declare function _Element_LoadImage(src: string, timeout?: number): Promise<[HTMLImageElement, number]>;
|
|
92
|
+
/**
|
|
93
|
+
* 检查指定dom内所有图片的加载状态并返回结果
|
|
94
|
+
* @param id - 图片ID
|
|
95
|
+
* @returns - 图片加载状态信息
|
|
96
|
+
*/
|
|
97
|
+
export declare function _Element_CheckImagesLoaded(id: string): Promise<{
|
|
98
|
+
/** 是否全部加载完成 */
|
|
99
|
+
allLoaded: boolean;
|
|
100
|
+
/** 成功加载的图片数量 */
|
|
101
|
+
loaded: number;
|
|
102
|
+
/** 加载失败的图片数量 */
|
|
103
|
+
failed: number;
|
|
104
|
+
/** 总图片数量 */
|
|
105
|
+
total: number;
|
|
106
|
+
/** 加载失败的图片列表 */
|
|
107
|
+
errors: HTMLImageElement[];
|
|
108
|
+
}>;
|
package/dist/Utility/index.d.ts
CHANGED
|
@@ -40,37 +40,21 @@ export declare function _Utility_Debounce<T extends (...args: any[]) => void>(fn
|
|
|
40
40
|
*/
|
|
41
41
|
export declare function _Utility_Throttle<T extends (...args: any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @param {Object} model - 要初始化的模型对象
|
|
48
|
-
* @param {string} path - 属性路径,使用英文句点分隔
|
|
49
|
-
* @param {any} initValue - 初始值
|
|
50
|
-
* @returns {any} 路径的最后一个属性对应的值或 initValue
|
|
51
|
-
*/
|
|
52
|
-
export declare function _Utility_InitTargetByPath(model: any, path: string, initValue?: any): any;
|
|
53
|
-
/**
|
|
54
|
-
* 根据路径获取目标对象
|
|
55
|
-
* 该函数用于在给定的模型中,通过路径字符串来获取深层嵌套的目标对象如果路径中的某一部分不存在,则会创建一个新的对象(除非已经是路径的最后一部分)
|
|
56
|
-
*
|
|
57
|
-
* @param {Object} model - 包含要查询的数据的模型对象
|
|
58
|
-
* @param {string} path - 用点分隔的路径字符串,表示要访问的对象属性路径
|
|
59
|
-
* @returns {Object|undefined} - 返回目标对象,如果路径不存在则返回undefined
|
|
43
|
+
* 根据路径从对象中获取目标值
|
|
44
|
+
* @param rootObject - 根对象
|
|
45
|
+
* @param path - 访问路径,支持点号和数组索引语法(如 "a1.b2[0].c3")
|
|
46
|
+
* @returns 目标值,如果路径无效则返回根对象
|
|
60
47
|
*/
|
|
61
|
-
export declare function _Utility_GetTargetByPath(
|
|
48
|
+
export declare function _Utility_GetTargetByPath(rootObject: any, path: string): any;
|
|
62
49
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
69
|
-
* @param {string} path - 点分隔的字符串路径,指示如何到达目标属性
|
|
70
|
-
* @param {*} value - 要设置的新值
|
|
71
|
-
* @returns {*} - 返回更新后的模型对象中的值
|
|
50
|
+
* 根据路径设置对象中的目标值
|
|
51
|
+
* @param rootObject - 根对象
|
|
52
|
+
* @param path - 访问路径,支持点号和数组索引语法(如 "a1.b2[0].c3")
|
|
53
|
+
* @param value - 要设置的值
|
|
54
|
+
* @param skipIfExists - 如果为true,当目标位置已有值时跳过设置
|
|
55
|
+
* @returns 设置后的根对象
|
|
72
56
|
*/
|
|
73
|
-
export declare function _Utility_SetTargetByPath(
|
|
57
|
+
export declare function _Utility_SetTargetByPath(rootObject: any, path: string, value: any, skipIfExists?: boolean): any;
|
|
74
58
|
/**
|
|
75
59
|
* 旋转列表函数
|
|
76
60
|
*
|
package/dist/Utility/type.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const PATH_SEGMENT_REGEX: RegExp;
|
|
2
|
+
export declare const ARRAY_PATH_REGEX: RegExp;
|
|
3
|
+
export declare const ARRAY_PART_REGEX: RegExp;
|
|
4
|
+
export declare const INDEX_EXTRACT_REGEX: RegExp;
|
|
5
|
+
/**
|
|
6
|
+
* 解析路径字符串为路径段数组
|
|
7
|
+
* @param path - 需要解析的路径字符串
|
|
8
|
+
* @returns 路径段数组,如果路径为空则返回空数组
|
|
9
|
+
*/
|
|
10
|
+
export declare function _parsePathSegments(path: string): string[];
|
package/dist/Valid/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { FileType } from '../Constant';
|
|
2
2
|
import { DataType, Point } from './type';
|
|
3
|
-
/**
|
|
4
|
-
* 是正常对象吗
|
|
5
|
-
* @param {} value
|
|
6
|
-
* @returns boolean
|
|
7
|
-
*/
|
|
8
|
-
export declare function _Valid_IsObject(value: any): boolean;
|
|
9
3
|
/**
|
|
10
4
|
* 检查单个一维数组参数是否合法(元素为有限数字)
|
|
11
5
|
* @param arr - 待检查的数组
|
|
@@ -97,7 +91,7 @@ export declare class _Valid_FileTypeChecker {
|
|
|
97
91
|
static parseAddresses(url: string): {
|
|
98
92
|
url: string;
|
|
99
93
|
name: string;
|
|
100
|
-
type: "audio" | "code" | "script" | "video" | "image" | "ppt" | "word" | "excel" | "pdf" | "
|
|
94
|
+
type: "audio" | "code" | "script" | "video" | "text" | "image" | "ppt" | "word" | "excel" | "pdf" | "archive" | "font" | "database" | "markup" | "configuration" | "logs" | "unknown";
|
|
101
95
|
}[];
|
|
102
96
|
/**
|
|
103
97
|
* 检查 MIME 类型是否与指定的模式匹配
|
|
@@ -127,5 +121,5 @@ export declare class _Valid_FileTypeChecker {
|
|
|
127
121
|
* @param {string} url - 文件的URL
|
|
128
122
|
* @returns {string} - 如果URL与任何已知类型匹配,则返回文件类型,否则返回"unknown"
|
|
129
123
|
*/
|
|
130
|
-
static _detectFileType(url: string): "audio" | "code" | "script" | "video" | "image" | "ppt" | "word" | "excel" | "pdf" | "
|
|
124
|
+
static _detectFileType(url: string): "audio" | "code" | "script" | "video" | "text" | "image" | "ppt" | "word" | "excel" | "pdf" | "archive" | "font" | "database" | "markup" | "configuration" | "logs" | "unknown";
|
|
131
125
|
}
|