@mpxjs/core 2.8.14 → 2.8.18
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/@types/index.d.ts +24 -20
- package/package.json +3 -3
- package/src/core/mergeOptions.js +0 -3
- package/src/core/transferOptions.js +2 -1
package/@types/index.d.ts
CHANGED
|
@@ -69,10 +69,6 @@ interface WatchField {
|
|
|
69
69
|
[key: string]: WatchHandler | WatchOptWithHandler
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
interface ObserversDefs {
|
|
73
|
-
[expression: string]: (...fields: any[]) => any
|
|
74
|
-
}
|
|
75
|
-
|
|
76
72
|
type GetDataType<T> = T extends () => any ? ReturnType<T> : T
|
|
77
73
|
|
|
78
74
|
type PropValueType<Def> = Def extends {
|
|
@@ -119,34 +115,19 @@ interface Context {
|
|
|
119
115
|
createIntersectionObserver: WechatMiniprogram.Component.InstanceMethods<Record<string, any>>['createIntersectionObserver']
|
|
120
116
|
}
|
|
121
117
|
|
|
122
|
-
interface ComponentOpt<D, P, C, M, Mi extends Array<any>, S extends Record<any, any>> extends Partial<WechatMiniprogram.Component.Lifetimes>
|
|
118
|
+
interface ComponentOpt<D, P, C, M, Mi extends Array<any>, S extends Record<any, any>> extends Partial<WechatMiniprogram.Component.Lifetimes & WechatMiniprogram.Component.OtherOption>{
|
|
123
119
|
data?: D
|
|
124
120
|
properties?: P
|
|
125
121
|
computed?: C
|
|
126
122
|
methods?: M
|
|
127
123
|
mixins?: Mi
|
|
128
124
|
watch?: WatchField
|
|
129
|
-
observers?: ObserversDefs
|
|
130
|
-
options?: Partial<{
|
|
131
|
-
addGlobalClass: boolean
|
|
132
|
-
multipleSlots: boolean
|
|
133
|
-
styleIsolation: string
|
|
134
|
-
}>
|
|
135
|
-
|
|
136
125
|
setup?: (props: GetPropsType<P & UnboxMixinsField<Mi, 'properties'>>, context: Context) => S
|
|
137
126
|
|
|
138
127
|
pageShow?: () => void
|
|
139
128
|
|
|
140
129
|
pageHide?: () => void
|
|
141
130
|
|
|
142
|
-
externalClasses?: string[]
|
|
143
|
-
|
|
144
|
-
lifetimes?: Partial<WechatMiniprogram.Component.Lifetimes>
|
|
145
|
-
|
|
146
|
-
pageLifetimes?: Partial<WechatMiniprogram.Component.PageLifetimes>
|
|
147
|
-
|
|
148
|
-
relations?: { [key: string]: WechatMiniprogram.Component.RelationOption }
|
|
149
|
-
|
|
150
131
|
[index: string]: any
|
|
151
132
|
}
|
|
152
133
|
|
|
@@ -621,6 +602,28 @@ export function useI18n<Options extends {
|
|
|
621
602
|
options?: Options
|
|
622
603
|
): UseI18n
|
|
623
604
|
|
|
605
|
+
// `<script setup>`
|
|
606
|
+
type NotUndefined<T> = T extends undefined ? never : T
|
|
607
|
+
|
|
608
|
+
type InferDefaults<T> = {
|
|
609
|
+
[K in keyof T]?: InferDefault<T, NotUndefined<T[K]>>
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
type InferDefault<P, T> = T extends
|
|
613
|
+
| null
|
|
614
|
+
| number
|
|
615
|
+
| string
|
|
616
|
+
| boolean
|
|
617
|
+
| symbol
|
|
618
|
+
| Array<any>
|
|
619
|
+
| Object
|
|
620
|
+
? T | ((props: P) => T)
|
|
621
|
+
: (props: P) => T
|
|
622
|
+
|
|
623
|
+
type PropsWithDefaults<Base, Defaults> = Base & {
|
|
624
|
+
[K in keyof Defaults]: K extends keyof Base ? NotUndefined<Base[K]> : never
|
|
625
|
+
}
|
|
626
|
+
|
|
624
627
|
// inner lifecycle
|
|
625
628
|
export const BEFORECREATE: string
|
|
626
629
|
export const CREATED: string
|
|
@@ -640,4 +643,5 @@ declare global {
|
|
|
640
643
|
const defineOptions: <D extends Data = {}, P extends Properties = {}, C = {}, M extends Methods = {}, Mi extends Array<any> = [], S extends AnyObject = {}, O extends AnyObject = {}> (opt: ThisTypedComponentOpt<D, P, C, M, Mi, S, O>) => void
|
|
641
644
|
const defineExpose: <E extends AnyObject = AnyObject>(exposed?: E) => void
|
|
642
645
|
const useContext: () => Context
|
|
646
|
+
const withDefaults: <Props, Defaults extends InferDefaults<Props>>(props: Props, defaults: Defaults) => PropsWithDefaults<Props, Defaults>
|
|
643
647
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.18",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"main": "src/index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mpxjs/utils": "^2.8.
|
|
22
|
+
"@mpxjs/utils": "^2.8.15",
|
|
23
23
|
"lodash": "^4.1.1",
|
|
24
24
|
"miniprogram-api-typings": "^3.0.2"
|
|
25
25
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/didi/mpx/issues"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "fd022afc8f403756de44c9eaab105a5a689e9b07"
|
|
51
51
|
}
|
package/src/core/mergeOptions.js
CHANGED
|
@@ -24,7 +24,8 @@ export default function transferOptions (options, type, needConvert = true) {
|
|
|
24
24
|
}
|
|
25
25
|
if (currentInject && currentInject.pageEvents) {
|
|
26
26
|
options.mixins = options.mixins || []
|
|
27
|
-
|
|
27
|
+
// 驱动层视作用户本地逻辑,作为最后的mixin来执行
|
|
28
|
+
options.mixins.push(currentInject.pageEvents)
|
|
28
29
|
}
|
|
29
30
|
// 转换mode
|
|
30
31
|
options.mpxConvertMode = options.mpxConvertMode || getConvertMode(global.currentSrcMode)
|