@oinone/kunlun-vue-widget 6.4.9 → 7.2.0
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/dist/oinone-kunlun-vue-widget.esm.js +1 -16
- package/dist/types/index.d.ts +1 -1
- package/dist/types/src/basic/AsyncVueWidget.d.ts +7 -7
- package/dist/types/src/basic/VueFragment.vue.d.ts +2 -2
- package/dist/types/src/basic/VueWidget.d.ts +339 -331
- package/dist/types/src/basic/Widget.d.ts +260 -257
- package/dist/types/src/basic/index.d.ts +3 -3
- package/dist/types/src/data/ActiveRecordsWidget.d.ts +271 -261
- package/dist/types/src/data/PathWidget.d.ts +34 -34
- package/dist/types/src/data/index.d.ts +2 -2
- package/dist/types/src/dsl/DslDefinitionWidget.d.ts +66 -68
- package/dist/types/src/dsl/DslNodeWidget.d.ts +42 -42
- package/dist/types/src/dsl/DslRenderWidget.d.ts +47 -44
- package/dist/types/src/dsl/index.d.ts +3 -3
- package/dist/types/src/feature/index.d.ts +1 -1
- package/dist/types/src/feature/invisible-supported.d.ts +11 -11
- package/dist/types/src/hooks/all-mounted.d.ts +20 -20
- package/dist/types/src/hooks/index.d.ts +1 -1
- package/dist/types/src/index.d.ts +10 -10
- package/dist/types/src/state/context.d.ts +41 -41
- package/dist/types/src/state/global.d.ts +3 -4
- package/dist/types/src/state/index.d.ts +3 -3
- package/dist/types/src/state/method/action.d.ts +18 -18
- package/dist/types/src/state/method/field.d.ts +3 -3
- package/dist/types/src/state/method/index.d.ts +2 -2
- package/dist/types/src/state/typing.d.ts +112 -105
- package/dist/types/src/state/use-state.d.ts +15 -16
- package/dist/types/src/state/view.d.ts +5 -5
- package/dist/types/src/token/index.d.ts +2 -2
- package/dist/types/src/typing/WidgetTagContext.d.ts +39 -39
- package/dist/types/src/typing/WidgetTagProps.d.ts +23 -23
- package/dist/types/src/typing/index.d.ts +3 -3
- package/dist/types/src/typing/typing.d.ts +7 -7
- package/dist/types/src/util/dsl-render.d.ts +106 -106
- package/dist/types/src/util/index.d.ts +4 -4
- package/dist/types/src/util/install.d.ts +4 -4
- package/dist/types/src/util/render.d.ts +7 -7
- package/dist/types/src/util/widget-manager.d.ts +4 -4
- package/dist/types/src/view/index.d.ts +161 -161
- package/package.json +29 -18
- package/src/basic/AsyncVueWidget.ts +2 -2
- package/src/basic/VueWidget.ts +67 -31
- package/src/basic/Widget.ts +11 -9
- package/src/basic/__tests__/Widget.spec.ts +82 -0
- package/src/data/ActiveRecordsWidget.ts +51 -21
- package/src/data/PathWidget.ts +1 -1
- package/src/dsl/DslDefinitionWidget.ts +10 -33
- package/src/dsl/DslNodeWidget.ts +3 -3
- package/src/dsl/DslRenderWidget.ts +32 -3
- package/src/feature/__tests__/invisible-supported.spec.ts +31 -0
- package/src/hooks/__tests__/all-mounted.spec.ts +41 -0
- package/src/hooks/all-mounted.ts +1 -1
- package/src/shim-translate.d.ts +5 -2
- package/src/state/__tests__/state.spec.ts +114 -0
- package/src/state/context.ts +6 -2
- package/src/state/global.ts +16 -5
- package/src/state/method/action.ts +7 -2
- package/src/state/method/field.ts +1 -1
- package/src/state/typing.ts +10 -0
- package/src/state/use-state.ts +2 -2
- package/src/state/view.ts +3 -3
- package/src/token/index.ts +1 -1
- package/src/typing/WidgetTagContext.ts +3 -3
- package/src/typing/WidgetTagProps.ts +2 -2
- package/src/util/__tests__/dsl-render.spec.ts +112 -0
- package/src/util/__tests__/render.spec.ts +69 -0
- package/src/util/__tests__/widget-manager.spec.ts +27 -0
- package/src/util/dsl-render.ts +6 -7
- package/src/util/install.ts +1 -1
- package/src/util/render.ts +3 -7
- package/src/view/index.ts +15 -8
- package/rollup.config.js +0 -22
|
@@ -1,257 +1,260 @@
|
|
|
1
|
-
import { IWidget, WidgetConstructor, WidgetProps } from '@oinone/kunlun-engine';
|
|
2
|
-
import { BehaviorSubject, Subject, Subscription } from '@oinone/kunlun-state';
|
|
3
|
-
import { InnerWidgetType } from '../typing/typing';
|
|
4
|
-
|
|
5
|
-
interface BaseWidgetSubjection<T> {
|
|
6
|
-
subscribe: (func: (data: T) => void) => Subscription;
|
|
7
|
-
subject: BehaviorSubject<T> | Subject<T>;
|
|
8
|
-
}
|
|
9
|
-
export interface WidgetSubjection<T> extends BaseWidgetSubjection<T> {
|
|
10
|
-
subject: Subject<T>;
|
|
11
|
-
}
|
|
12
|
-
export interface WidgetBehaviorSubjection<T> extends BaseWidgetSubjection<T> {
|
|
13
|
-
subject: BehaviorSubject<T>;
|
|
14
|
-
}
|
|
15
|
-
export
|
|
16
|
-
path: string;
|
|
17
|
-
handler: (newVal: T, oldVal: T) => void;
|
|
18
|
-
options?: {
|
|
19
|
-
deep?: boolean;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export
|
|
23
|
-
export declare abstract class Widget<Props extends WidgetProps = WidgetProps, R = unknown> implements IWidget<Props> {
|
|
24
|
-
private static widgetCount;
|
|
25
|
-
private static createHandle;
|
|
26
|
-
private static widgetMap;
|
|
27
|
-
private static attributeMap;
|
|
28
|
-
private static protoChainsCache;
|
|
29
|
-
private static watchMap;
|
|
30
|
-
private static nameContextMap;
|
|
31
|
-
private subscriptionMap;
|
|
32
|
-
private $$props?;
|
|
33
|
-
private $$subNames?;
|
|
34
|
-
private static Attribute;
|
|
35
|
-
/**
|
|
36
|
-
* 添加事件监听
|
|
37
|
-
*
|
|
38
|
-
* @param {string} path 监听的路径
|
|
39
|
-
* @param {deep?:boolean;immediate?:boolean} options?
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
*
|
|
43
|
-
* @Widget.Watch('formData.name', {deep: true, immediate: true})
|
|
44
|
-
* private watchName(name: string) {
|
|
45
|
-
* ... todo
|
|
46
|
-
* }
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
protected static Watch(path: string, options?: {
|
|
50
|
-
deep?: boolean;
|
|
51
|
-
immediate?: boolean;
|
|
52
|
-
}): <T extends Widget
|
|
53
|
-
private static Sub;
|
|
54
|
-
/**
|
|
55
|
-
* 可以用来处理不同widget之间的通讯,当被订阅的时候,会将默认值发送出去
|
|
56
|
-
*
|
|
57
|
-
* @param {Symbol} name 唯一标示
|
|
58
|
-
* @param {unknown} value? 默认值
|
|
59
|
-
* @param {scope?: WidgetTypeKey} option? 作用域检查,如果设置了该值,那么发布的时候会携带发布者的widget实例,订阅的时候会检查发布者的widget实例是否和订阅者在同一个作用域下,如果是,那么才会触发订阅函数
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
*
|
|
63
|
-
* const identifier = Symbol('example-sub')
|
|
64
|
-
*
|
|
65
|
-
* * field.ts * // 文件
|
|
66
|
-
*
|
|
67
|
-
* @Widget.BehaviorSubContext(identifier, {value: '这是默认值'})
|
|
68
|
-
* private exampleSub!:WidgetBehaviorSubjection<{value: string}>
|
|
69
|
-
*
|
|
70
|
-
* onValueChange() {
|
|
71
|
-
* this.exampleSub.subject.next({value: '这是新的值'})
|
|
72
|
-
* }
|
|
73
|
-
*
|
|
74
|
-
* * other-field.ts * // 文件
|
|
75
|
-
* @Widget.BehaviorSubContext(identifier, {value: '这是默认值'})
|
|
76
|
-
* private exampleSub!:WidgetBehaviorSubjection<{value: string}>
|
|
77
|
-
*
|
|
78
|
-
* mounted() {
|
|
79
|
-
* this.exampleSub.subscribe((value) => {
|
|
80
|
-
* ...todo
|
|
81
|
-
* })
|
|
82
|
-
* }
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
protected static BehaviorSubContext(name: Symbol, value?: unknown, option?: {
|
|
86
|
-
scope?: WidgetTypeKey;
|
|
87
|
-
}): <K extends Widget
|
|
88
|
-
/**
|
|
89
|
-
* 与 `BehaviorSubContext` 一样,区别在于第一次不会发射默认值
|
|
90
|
-
*
|
|
91
|
-
* @param {Symbol} name 唯一标示
|
|
92
|
-
* @param {unknown} value? 默认值
|
|
93
|
-
* @param {scope?: WidgetTypeKey} option? 作用域检查,如果设置了该值,那么发布订阅只会在同一个作用域下的widget之间进行
|
|
94
|
-
*/
|
|
95
|
-
protected static SubContext(name: Symbol, value?: unknown, option?: {
|
|
96
|
-
scope?: WidgetTypeKey;
|
|
97
|
-
}): <K extends Widget
|
|
98
|
-
/**
|
|
99
|
-
* 将数据绑定为响应式,并且组件中可以获取该值
|
|
100
|
-
*/
|
|
101
|
-
protected static Reactive(params?: {
|
|
102
|
-
displayName?: string;
|
|
103
|
-
render?: boolean;
|
|
104
|
-
}): <T extends Widget
|
|
105
|
-
/**
|
|
106
|
-
* 将方法绑定为能够被组件获取的方法
|
|
107
|
-
*/
|
|
108
|
-
protected static Method(displayName?: string): <T extends Widget
|
|
109
|
-
static select<T extends Widget = Widget>(handle: string): T | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* 获取上级注入的依赖,与 Provide 一起使用
|
|
112
|
-
*
|
|
113
|
-
* @param {string|Symbol} injectName? 被注入的name,如果不传递,那么取target中的name
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
*
|
|
117
|
-
* * children.ts * // 文件
|
|
118
|
-
*
|
|
119
|
-
* @Widget.Inject('InjectName')
|
|
120
|
-
* private rootData!:
|
|
121
|
-
*
|
|
122
|
-
* 如果要将该值变为响应式,如果加上Reactive
|
|
123
|
-
*
|
|
124
|
-
* @Widget.Reactive()
|
|
125
|
-
* @Widget.Inject('InjectName')
|
|
126
|
-
* private rootData!:;
|
|
127
|
-
*/
|
|
128
|
-
protected static Inject(injectName?: string | Symbol): <T extends Widget
|
|
129
|
-
/**
|
|
130
|
-
* 获取下级注入的依赖,与 Inject 一起使用
|
|
131
|
-
*
|
|
132
|
-
* @param {string|Symbol} provideName? 被注入的name,如果不传递,那么取target中的name
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
*
|
|
136
|
-
* * parent.ts * // 文件
|
|
137
|
-
*
|
|
138
|
-
* @Widget.Provide('ProvideName')
|
|
139
|
-
* private rootData!:
|
|
140
|
-
*
|
|
141
|
-
* 如果要将该值变为响应式,如果加上Reactive
|
|
142
|
-
*
|
|
143
|
-
* @Widget.Reactive()
|
|
144
|
-
* @Widget.Provide('ProvideName')
|
|
145
|
-
* private rootData!:;
|
|
146
|
-
*/
|
|
147
|
-
protected static Provide(provideName?: string | Symbol): <T extends Widget
|
|
148
|
-
private parent;
|
|
149
|
-
protected $$innerWidgetType: InnerWidgetType | null | undefined;
|
|
150
|
-
protected childrenInstance: Widget[];
|
|
151
|
-
protected children: Widget[];
|
|
152
|
-
protected childrenWidget: Widget[];
|
|
153
|
-
private readonly handle;
|
|
154
|
-
config: Props;
|
|
155
|
-
private name;
|
|
156
|
-
private initialized;
|
|
157
|
-
private self;
|
|
158
|
-
constructor(handle?: string);
|
|
159
|
-
protected getSelf(): Widget<WidgetProps, unknown> | null;
|
|
160
|
-
getOperator(): this;
|
|
161
|
-
initialize(config?: Props): Widget;
|
|
162
|
-
/**
|
|
163
|
-
* 启动订阅
|
|
164
|
-
*/
|
|
165
|
-
private startSubscription;
|
|
166
|
-
/**
|
|
167
|
-
* 包装发布者事件
|
|
168
|
-
* 如果启动了作用域检查,那么发布的时候会携带发布者的widget实例
|
|
169
|
-
**/
|
|
170
|
-
private wrapSubjectWithScope;
|
|
171
|
-
/**
|
|
172
|
-
* 创建发布订阅对象
|
|
173
|
-
*/
|
|
174
|
-
private createWidgetSubjection;
|
|
175
|
-
private isSameScopeWidget;
|
|
176
|
-
/**
|
|
177
|
-
* 销毁widget
|
|
178
|
-
*
|
|
179
|
-
* 内部会根据handle匹配到对应的widget,然后进行销毁,如果children中出现了相同的handle,那么会销毁第一个
|
|
180
|
-
*/
|
|
181
|
-
dispose(force?: boolean): void;
|
|
182
|
-
/**
|
|
183
|
-
* 创建一个widget
|
|
184
|
-
*
|
|
185
|
-
* @param {Widget} constructor 对应的widget
|
|
186
|
-
* @param {string} name? 插槽
|
|
187
|
-
* @param {IViewProps} config? widget中initialize方法接收的参数
|
|
188
|
-
*
|
|
189
|
-
*/
|
|
190
|
-
createWidget<T extends Widget>(constructor: WidgetConstructor<T['config'], T>, name?: string, config?: T['config'], specifiedIndex?: number): T;
|
|
191
|
-
getHandle(): HANDLE;
|
|
192
|
-
/**
|
|
193
|
-
* 删除指定的widget
|
|
194
|
-
*/
|
|
195
|
-
deleteWidget(name: string): boolean;
|
|
196
|
-
moveChildWidget(endIndex: number, startIndex: number): void;
|
|
197
|
-
insertWidget(widget: Widget, index: number): void;
|
|
198
|
-
deleteWidgetByIndex(index: number, handle?: string): boolean;
|
|
199
|
-
getConfig(key: string): unknown;
|
|
200
|
-
getAllConfig(): Props;
|
|
201
|
-
getSibling(): Widget<WidgetProps, unknown>[] | null;
|
|
202
|
-
/**
|
|
203
|
-
* 返回当前元素在其父元素的子元素节点中的前一个元素节点,如果该元素已经是第一个元素节点,则返回 null
|
|
204
|
-
*/
|
|
205
|
-
previousWidgetSibling(): Widget<WidgetProps, unknown> | null;
|
|
206
|
-
/**
|
|
207
|
-
* 返回当前元素在其父元素的子元素节点中的后一个元素节点,如果该元素已经是最后一个元素节点,则返回 null
|
|
208
|
-
*/
|
|
209
|
-
nextWidgetSibling(): Widget<WidgetProps, unknown> | null;
|
|
210
|
-
/**
|
|
211
|
-
* 获取父元素
|
|
212
|
-
*/
|
|
213
|
-
getParentWidget(): Widget | null;
|
|
214
|
-
private getParentWidgetByType;
|
|
215
|
-
/**
|
|
216
|
-
* 获取子元素
|
|
217
|
-
*/
|
|
218
|
-
getChildrenWidget(): Widget<WidgetProps, unknown>[];
|
|
219
|
-
/**
|
|
220
|
-
* @inner
|
|
221
|
-
*
|
|
222
|
-
*/
|
|
223
|
-
getParent(): Widget | null;
|
|
224
|
-
getName(): string;
|
|
225
|
-
getWidgetType(): string;
|
|
226
|
-
static getProtoChains<T extends Function>(obj: T): Function[];
|
|
227
|
-
private currentAttributeMapCache;
|
|
228
|
-
/**
|
|
229
|
-
* 获取所有的属性
|
|
230
|
-
*/
|
|
231
|
-
getAttributes(): Map<string, string>;
|
|
232
|
-
/**
|
|
233
|
-
* 获取所有的监听事件
|
|
234
|
-
*/
|
|
235
|
-
getWatchers(): watcher<unknown>[];
|
|
236
|
-
/**
|
|
237
|
-
* @deprecated 使用 getChildrenWidget()
|
|
238
|
-
*
|
|
239
|
-
* 获取所有的children
|
|
240
|
-
*/
|
|
241
|
-
getChildren(): Widget[];
|
|
242
|
-
/**
|
|
243
|
-
* @inner
|
|
244
|
-
*
|
|
245
|
-
*/
|
|
246
|
-
getChildrenInstance(): Widget[];
|
|
247
|
-
protected addChildrenInstance(widget: Widget): void;
|
|
248
|
-
protected getShared(injectName: string | Symbol): {
|
|
249
|
-
host?: Widget;
|
|
250
|
-
value?: unknown;
|
|
251
|
-
};
|
|
252
|
-
private releaseInjection;
|
|
253
|
-
getComputeHandler(name: string):
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
1
|
+
import type { IWidget, WidgetConstructor, WidgetProps } from '@oinone/kunlun-engine';
|
|
2
|
+
import { BehaviorSubject, Subject, Subscription } from '@oinone/kunlun-state';
|
|
3
|
+
import { InnerWidgetType } from '../typing/typing';
|
|
4
|
+
type WidgetTypeKey = keyof typeof InnerWidgetType;
|
|
5
|
+
interface BaseWidgetSubjection<T> {
|
|
6
|
+
subscribe: (func: (data: T) => void) => Subscription;
|
|
7
|
+
subject: BehaviorSubject<T> | Subject<T>;
|
|
8
|
+
}
|
|
9
|
+
export interface WidgetSubjection<T> extends BaseWidgetSubjection<T> {
|
|
10
|
+
subject: Subject<T>;
|
|
11
|
+
}
|
|
12
|
+
export interface WidgetBehaviorSubjection<T> extends BaseWidgetSubjection<T> {
|
|
13
|
+
subject: BehaviorSubject<T>;
|
|
14
|
+
}
|
|
15
|
+
export type watcher<T> = {
|
|
16
|
+
path: string;
|
|
17
|
+
handler: (newVal: T, oldVal: T) => void;
|
|
18
|
+
options?: {
|
|
19
|
+
deep?: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type HANDLE = string;
|
|
23
|
+
export declare abstract class Widget<Props extends WidgetProps = WidgetProps, R = unknown> implements IWidget<Props> {
|
|
24
|
+
private static widgetCount;
|
|
25
|
+
private static createHandle;
|
|
26
|
+
private static widgetMap;
|
|
27
|
+
private static attributeMap;
|
|
28
|
+
private static protoChainsCache;
|
|
29
|
+
private static watchMap;
|
|
30
|
+
private static nameContextMap;
|
|
31
|
+
private subscriptionMap;
|
|
32
|
+
private $$props?;
|
|
33
|
+
private $$subNames?;
|
|
34
|
+
private static Attribute;
|
|
35
|
+
/**
|
|
36
|
+
* 添加事件监听
|
|
37
|
+
*
|
|
38
|
+
* @param {string} path 监听的路径
|
|
39
|
+
* @param {deep?:boolean;immediate?:boolean} options?
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
*
|
|
43
|
+
* @Widget.Watch('formData.name', {deep: true, immediate: true})
|
|
44
|
+
* private watchName(name: string) {
|
|
45
|
+
* ... todo
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
protected static Watch(path: string, options?: {
|
|
50
|
+
deep?: boolean;
|
|
51
|
+
immediate?: boolean;
|
|
52
|
+
}): <T extends Widget, K>(target: T, nativeName: string, descriptor: TypedPropertyDescriptor<(newValue: K, oldValue?: K) => void> | TypedPropertyDescriptor<(newValue: K, oldValue?: K) => Promise<void>> | TypedPropertyDescriptor<(newValue?: K, oldValue?: K) => void> | TypedPropertyDescriptor<(newValue?: K, oldValue?: K) => Promise<void>>) => void;
|
|
53
|
+
private static Sub;
|
|
54
|
+
/**
|
|
55
|
+
* 可以用来处理不同widget之间的通讯,当被订阅的时候,会将默认值发送出去
|
|
56
|
+
*
|
|
57
|
+
* @param {Symbol} name 唯一标示
|
|
58
|
+
* @param {unknown} value? 默认值
|
|
59
|
+
* @param {scope?: WidgetTypeKey} option? 作用域检查,如果设置了该值,那么发布的时候会携带发布者的widget实例,订阅的时候会检查发布者的widget实例是否和订阅者在同一个作用域下,如果是,那么才会触发订阅函数
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
*
|
|
63
|
+
* const identifier = Symbol('example-sub')
|
|
64
|
+
*
|
|
65
|
+
* * field.ts * // 文件
|
|
66
|
+
*
|
|
67
|
+
* @Widget.BehaviorSubContext(identifier, {value: '这是默认值'})
|
|
68
|
+
* private exampleSub!:WidgetBehaviorSubjection<{value: string}>
|
|
69
|
+
*
|
|
70
|
+
* onValueChange() {
|
|
71
|
+
* this.exampleSub.subject.next({value: '这是新的值'})
|
|
72
|
+
* }
|
|
73
|
+
*
|
|
74
|
+
* * other-field.ts * // 文件
|
|
75
|
+
* @Widget.BehaviorSubContext(identifier, {value: '这是默认值'})
|
|
76
|
+
* private exampleSub!:WidgetBehaviorSubjection<{value: string}>
|
|
77
|
+
*
|
|
78
|
+
* mounted() {
|
|
79
|
+
* this.exampleSub.subscribe((value) => {
|
|
80
|
+
* ...todo
|
|
81
|
+
* })
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
protected static BehaviorSubContext(name: Symbol, value?: unknown, option?: {
|
|
86
|
+
scope?: WidgetTypeKey;
|
|
87
|
+
}): <K extends Widget>(target: K, paramName: string) => void;
|
|
88
|
+
/**
|
|
89
|
+
* 与 `BehaviorSubContext` 一样,区别在于第一次不会发射默认值
|
|
90
|
+
*
|
|
91
|
+
* @param {Symbol} name 唯一标示
|
|
92
|
+
* @param {unknown} value? 默认值
|
|
93
|
+
* @param {scope?: WidgetTypeKey} option? 作用域检查,如果设置了该值,那么发布订阅只会在同一个作用域下的widget之间进行
|
|
94
|
+
*/
|
|
95
|
+
protected static SubContext(name: Symbol, value?: unknown, option?: {
|
|
96
|
+
scope?: WidgetTypeKey;
|
|
97
|
+
}): <K extends Widget>(target: K, paramName: string) => void;
|
|
98
|
+
/**
|
|
99
|
+
* 将数据绑定为响应式,并且组件中可以获取该值
|
|
100
|
+
*/
|
|
101
|
+
protected static Reactive(params?: {
|
|
102
|
+
displayName?: string;
|
|
103
|
+
render?: boolean;
|
|
104
|
+
}): <T extends Widget, K>(target: T, nativeName: string, description?: TypedPropertyDescriptor<K>) => void;
|
|
105
|
+
/**
|
|
106
|
+
* 将方法绑定为能够被组件获取的方法
|
|
107
|
+
*/
|
|
108
|
+
protected static Method(displayName?: string): <T extends Widget, K>(target: T, nativeName: string, description?: TypedPropertyDescriptor<K>) => void;
|
|
109
|
+
static select<T extends Widget = Widget>(handle: string): T | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* 获取上级注入的依赖,与 Provide 一起使用
|
|
112
|
+
*
|
|
113
|
+
* @param {string|Symbol} injectName? 被注入的name,如果不传递,那么取target中的name
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
*
|
|
117
|
+
* * children.ts * // 文件
|
|
118
|
+
*
|
|
119
|
+
* @Widget.Inject('InjectName')
|
|
120
|
+
* private rootData!:
|
|
121
|
+
*
|
|
122
|
+
* 如果要将该值变为响应式,如果加上Reactive
|
|
123
|
+
*
|
|
124
|
+
* @Widget.Reactive()
|
|
125
|
+
* @Widget.Inject('InjectName')
|
|
126
|
+
* private rootData!:;
|
|
127
|
+
*/
|
|
128
|
+
protected static Inject(injectName?: string | Symbol): <T extends Widget>(target: T, name: string) => void;
|
|
129
|
+
/**
|
|
130
|
+
* 获取下级注入的依赖,与 Inject 一起使用
|
|
131
|
+
*
|
|
132
|
+
* @param {string|Symbol} provideName? 被注入的name,如果不传递,那么取target中的name
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
*
|
|
136
|
+
* * parent.ts * // 文件
|
|
137
|
+
*
|
|
138
|
+
* @Widget.Provide('ProvideName')
|
|
139
|
+
* private rootData!:
|
|
140
|
+
*
|
|
141
|
+
* 如果要将该值变为响应式,如果加上Reactive
|
|
142
|
+
*
|
|
143
|
+
* @Widget.Reactive()
|
|
144
|
+
* @Widget.Provide('ProvideName')
|
|
145
|
+
* private rootData!:;
|
|
146
|
+
*/
|
|
147
|
+
protected static Provide(provideName?: string | Symbol): <T extends Widget>(target: T, name: string) => void;
|
|
148
|
+
private parent;
|
|
149
|
+
protected $$innerWidgetType: InnerWidgetType | null | undefined;
|
|
150
|
+
protected childrenInstance: Widget[];
|
|
151
|
+
protected children: Widget[];
|
|
152
|
+
protected childrenWidget: Widget[];
|
|
153
|
+
private readonly handle;
|
|
154
|
+
config: Props;
|
|
155
|
+
private name;
|
|
156
|
+
private initialized;
|
|
157
|
+
private self;
|
|
158
|
+
constructor(handle?: string);
|
|
159
|
+
protected getSelf(): Widget<WidgetProps, unknown> | null;
|
|
160
|
+
getOperator(): this;
|
|
161
|
+
initialize(config?: Props): Widget;
|
|
162
|
+
/**
|
|
163
|
+
* 启动订阅
|
|
164
|
+
*/
|
|
165
|
+
private startSubscription;
|
|
166
|
+
/**
|
|
167
|
+
* 包装发布者事件
|
|
168
|
+
* 如果启动了作用域检查,那么发布的时候会携带发布者的widget实例
|
|
169
|
+
**/
|
|
170
|
+
private wrapSubjectWithScope;
|
|
171
|
+
/**
|
|
172
|
+
* 创建发布订阅对象
|
|
173
|
+
*/
|
|
174
|
+
private createWidgetSubjection;
|
|
175
|
+
private isSameScopeWidget;
|
|
176
|
+
/**
|
|
177
|
+
* 销毁widget
|
|
178
|
+
*
|
|
179
|
+
* 内部会根据handle匹配到对应的widget,然后进行销毁,如果children中出现了相同的handle,那么会销毁第一个
|
|
180
|
+
*/
|
|
181
|
+
dispose(force?: boolean): void;
|
|
182
|
+
/**
|
|
183
|
+
* 创建一个widget
|
|
184
|
+
*
|
|
185
|
+
* @param {Widget} constructor 对应的widget
|
|
186
|
+
* @param {string} name? 插槽
|
|
187
|
+
* @param {IViewProps} config? widget中initialize方法接收的参数
|
|
188
|
+
*
|
|
189
|
+
*/
|
|
190
|
+
createWidget<T extends Widget>(constructor: WidgetConstructor<T['config'], T>, name?: string, config?: T['config'], specifiedIndex?: number): T;
|
|
191
|
+
getHandle(): HANDLE;
|
|
192
|
+
/**
|
|
193
|
+
* 删除指定的widget
|
|
194
|
+
*/
|
|
195
|
+
deleteWidget(name: string): boolean;
|
|
196
|
+
moveChildWidget(endIndex: number, startIndex: number): void;
|
|
197
|
+
insertWidget(widget: Widget, index: number): void;
|
|
198
|
+
deleteWidgetByIndex(index: number, handle?: string): boolean;
|
|
199
|
+
getConfig(key: string): unknown;
|
|
200
|
+
getAllConfig(): Props;
|
|
201
|
+
getSibling(): Widget<WidgetProps, unknown>[] | null;
|
|
202
|
+
/**
|
|
203
|
+
* 返回当前元素在其父元素的子元素节点中的前一个元素节点,如果该元素已经是第一个元素节点,则返回 null
|
|
204
|
+
*/
|
|
205
|
+
previousWidgetSibling(): Widget<WidgetProps, unknown> | null;
|
|
206
|
+
/**
|
|
207
|
+
* 返回当前元素在其父元素的子元素节点中的后一个元素节点,如果该元素已经是最后一个元素节点,则返回 null
|
|
208
|
+
*/
|
|
209
|
+
nextWidgetSibling(): Widget<WidgetProps, unknown> | null;
|
|
210
|
+
/**
|
|
211
|
+
* 获取父元素
|
|
212
|
+
*/
|
|
213
|
+
getParentWidget(): Widget | null;
|
|
214
|
+
private getParentWidgetByType;
|
|
215
|
+
/**
|
|
216
|
+
* 获取子元素
|
|
217
|
+
*/
|
|
218
|
+
getChildrenWidget(): Widget<WidgetProps, unknown>[];
|
|
219
|
+
/**
|
|
220
|
+
* @inner
|
|
221
|
+
*
|
|
222
|
+
*/
|
|
223
|
+
getParent(): Widget | null;
|
|
224
|
+
getName(): string;
|
|
225
|
+
getWidgetType(): string;
|
|
226
|
+
static getProtoChains<T extends Function>(obj: T): Function[];
|
|
227
|
+
private currentAttributeMapCache;
|
|
228
|
+
/**
|
|
229
|
+
* 获取所有的属性
|
|
230
|
+
*/
|
|
231
|
+
getAttributes(): Map<string, string>;
|
|
232
|
+
/**
|
|
233
|
+
* 获取所有的监听事件
|
|
234
|
+
*/
|
|
235
|
+
getWatchers(): watcher<unknown>[];
|
|
236
|
+
/**
|
|
237
|
+
* @deprecated 使用 getChildrenWidget()
|
|
238
|
+
*
|
|
239
|
+
* 获取所有的children
|
|
240
|
+
*/
|
|
241
|
+
getChildren(): Widget[];
|
|
242
|
+
/**
|
|
243
|
+
* @inner
|
|
244
|
+
*
|
|
245
|
+
*/
|
|
246
|
+
getChildrenInstance(): Widget[];
|
|
247
|
+
protected addChildrenInstance(widget: Widget): void;
|
|
248
|
+
protected getShared(injectName: string | Symbol): {
|
|
249
|
+
host?: Widget;
|
|
250
|
+
value?: unknown;
|
|
251
|
+
};
|
|
252
|
+
private releaseInjection;
|
|
253
|
+
getComputeHandler(name: string): {
|
|
254
|
+
get: Function;
|
|
255
|
+
set: Function;
|
|
256
|
+
};
|
|
257
|
+
protected getProps(): string[];
|
|
258
|
+
abstract render(...args: any[]): R;
|
|
259
|
+
}
|
|
260
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './Widget';
|
|
2
|
-
export * from './VueWidget';
|
|
3
|
-
export * from './AsyncVueWidget';
|
|
1
|
+
export * from './Widget';
|
|
2
|
+
export * from './VueWidget';
|
|
3
|
+
export * from './AsyncVueWidget';
|