@alicloud/alfa-react 1.5.7 → 1.5.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/es/createAlfaApp.js +5 -3
- package/es/version.js +1 -1
- package/lib/createAlfaApp.js +5 -3
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/types/createAlfaApp.d.ts +7 -19
- package/types/createAlfaWidget.d.ts +3 -13
- package/types/types/index.d.ts +37 -11
- package/types/version.d.ts +1 -1
package/es/createAlfaApp.js
CHANGED
|
@@ -43,14 +43,16 @@ function createAlfaApp(option) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* create memorized app in react function component,
|
|
46
|
+
* create memorized app in react function component,
|
|
47
|
+
* it will update when name or version changed as default
|
|
47
48
|
* @param option
|
|
49
|
+
* @param dep custom useMemo deps
|
|
48
50
|
* @returns
|
|
49
51
|
*/
|
|
50
|
-
export function useAlfaApp(option) {
|
|
52
|
+
export function useAlfaApp(option, deps) {
|
|
51
53
|
var App = useMemo(function () {
|
|
52
54
|
return createAlfaApp(option);
|
|
53
|
-
}, []);
|
|
55
|
+
}, deps || [option === null || option === void 0 ? void 0 : option.name, option === null || option === void 0 ? void 0 : option.version]);
|
|
54
56
|
return App;
|
|
55
57
|
}
|
|
56
58
|
export default createAlfaApp;
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.5.
|
|
1
|
+
export var version = '1.5.9';
|
package/lib/createAlfaApp.js
CHANGED
|
@@ -54,14 +54,16 @@ function createAlfaApp(option) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* create memorized app in react function component,
|
|
57
|
+
* create memorized app in react function component,
|
|
58
|
+
* it will update when name or version changed as default
|
|
58
59
|
* @param option
|
|
60
|
+
* @param dep custom useMemo deps
|
|
59
61
|
* @returns
|
|
60
62
|
*/
|
|
61
|
-
function useAlfaApp(option) {
|
|
63
|
+
function useAlfaApp(option, deps) {
|
|
62
64
|
var App = (0, _react.useMemo)(function () {
|
|
63
65
|
return createAlfaApp(option);
|
|
64
|
-
}, []);
|
|
66
|
+
}, deps || [option === null || option === void 0 ? void 0 : option.name, option === null || option === void 0 ? void 0 : option.version]);
|
|
65
67
|
return App;
|
|
66
68
|
}
|
|
67
69
|
var _default = createAlfaApp;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/alfa-react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"description": "Alfa Framework (React Version)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"classnames": "^2.2.6",
|
|
37
37
|
"crypto-js": "^4.1.1",
|
|
38
38
|
"prop-types": "^15.8.1",
|
|
39
|
-
"@alicloud/
|
|
40
|
-
"@alicloud/
|
|
39
|
+
"@alicloud/console-os-loader": "1.4.30",
|
|
40
|
+
"@alicloud/alfa-core": "1.4.32"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=16.0.0"
|
package/types/createAlfaApp.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { AlfaFactoryOption } from './types';
|
|
3
|
-
interface IProps {
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
*/
|
|
7
|
-
sandbox?: Record<string, any>;
|
|
8
|
-
/**
|
|
9
|
-
* 处理外跳链接
|
|
10
|
-
* @param url
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
handleExternalLink?: (url: string) => void;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AlfaFactoryOption, CommonProps } from './types';
|
|
3
|
+
interface IProps extends CommonProps {
|
|
14
4
|
/**
|
|
15
5
|
* 是否开启路由自动同步,需配合 basename 使用
|
|
16
6
|
*/
|
|
@@ -28,16 +18,14 @@ interface IProps {
|
|
|
28
18
|
* 子应用路由
|
|
29
19
|
*/
|
|
30
20
|
path?: string;
|
|
31
|
-
/**
|
|
32
|
-
* 根节点样式
|
|
33
|
-
*/
|
|
34
|
-
style?: React.CSSProperties;
|
|
35
21
|
}
|
|
36
22
|
declare function createAlfaApp<P = any>(option: AlfaFactoryOption): (() => null) | ((props: P & IProps) => JSX.Element);
|
|
37
23
|
/**
|
|
38
|
-
* create memorized app in react function component,
|
|
24
|
+
* create memorized app in react function component,
|
|
25
|
+
* it will update when name or version changed as default
|
|
39
26
|
* @param option
|
|
27
|
+
* @param dep custom useMemo deps
|
|
40
28
|
* @returns
|
|
41
29
|
*/
|
|
42
|
-
export declare function useAlfaApp<P = any>(option: AlfaFactoryOption): (() => null) | ((props: P & IProps) => JSX.Element);
|
|
30
|
+
export declare function useAlfaApp<P = any>(option: AlfaFactoryOption, deps: any[]): (() => null) | ((props: P & IProps) => JSX.Element);
|
|
43
31
|
export default createAlfaApp;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { AlfaFactoryOption } from './types';
|
|
3
|
-
interface IProps {
|
|
4
|
-
/**
|
|
5
|
-
* 处理外跳链接
|
|
6
|
-
* @param url
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
handleExternalLink?: (url: string) => void;
|
|
10
|
-
/**
|
|
11
|
-
* 根节点样式
|
|
12
|
-
*/
|
|
13
|
-
style?: React.CSSProperties;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AlfaFactoryOption, CommonProps } from './types';
|
|
3
|
+
interface IProps extends CommonProps {
|
|
14
4
|
}
|
|
15
5
|
declare function createAlfaWidget<P = any>(option: AlfaFactoryOption): (() => null) | ((props: P & IProps) => JSX.Element);
|
|
16
6
|
/**
|
package/types/types/index.d.ts
CHANGED
|
@@ -31,18 +31,34 @@ export interface AlfaFactoryOption extends IAppConfig {
|
|
|
31
31
|
* 开启业务配置加载
|
|
32
32
|
*/
|
|
33
33
|
dynamicConfig?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated
|
|
36
|
+
* used in cwsWidget
|
|
37
|
+
*/
|
|
34
38
|
runtimeVersion?: string;
|
|
35
|
-
fallbackRender?: (error: Error) => Element;
|
|
36
39
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
export interface CommonProps {
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated
|
|
43
|
+
*/
|
|
44
|
+
sandbox?: Record<string, any>;
|
|
45
|
+
/**
|
|
46
|
+
* 处理外跳链接
|
|
47
|
+
* @param url
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
handleExternalLink?: (url?: string) => void;
|
|
51
|
+
/**
|
|
52
|
+
* 根节点样式
|
|
53
|
+
*/
|
|
54
|
+
style?: React.CSSProperties;
|
|
55
|
+
/**
|
|
56
|
+
* render when throw error
|
|
57
|
+
*/
|
|
58
|
+
fallbackRender?: (error?: Error) => Element;
|
|
45
59
|
}
|
|
60
|
+
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
|
|
61
|
+
export type MicroApplication = ThenArg<ReturnType<typeof createMicroApp>>;
|
|
46
62
|
export interface AlfaEnvConfigDescriptor {
|
|
47
63
|
releaseUrl: string;
|
|
48
64
|
configUrl?: string;
|
|
@@ -55,6 +71,9 @@ export interface AlfaEnvConfig {
|
|
|
55
71
|
pre: AlfaEnvConfigDescriptor;
|
|
56
72
|
prod: AlfaEnvConfigDescriptor;
|
|
57
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* 兼容 cws widget 的配置
|
|
76
|
+
*/
|
|
58
77
|
export interface WidgetReleaseConfig {
|
|
59
78
|
[id: string]: {
|
|
60
79
|
[version: string]: {
|
|
@@ -62,6 +81,15 @@ export interface WidgetReleaseConfig {
|
|
|
62
81
|
};
|
|
63
82
|
};
|
|
64
83
|
}
|
|
84
|
+
type OmitKeys = 'manifest';
|
|
85
|
+
export interface WidgetFactoryOption extends Omit<AlfaFactoryOption, OmitKeys> {
|
|
86
|
+
runtimeVersion?: string;
|
|
87
|
+
alfaLoader?: boolean;
|
|
88
|
+
theme?: string;
|
|
89
|
+
central?: boolean;
|
|
90
|
+
host?: string;
|
|
91
|
+
configHost?: string;
|
|
92
|
+
}
|
|
65
93
|
export interface WidgetCWSConfig {
|
|
66
94
|
conf: {
|
|
67
95
|
[channel: string]: {
|
|
@@ -98,6 +126,4 @@ export interface WidgetRuntime {
|
|
|
98
126
|
'@ali/wind-intl/lib/withRcIntl': any;
|
|
99
127
|
'@ali/widget-utils-console': any;
|
|
100
128
|
}
|
|
101
|
-
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
|
|
102
|
-
export type MicroApplication = ThenArg<ReturnType<typeof createMicroApp>>;
|
|
103
129
|
export {};
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.5.
|
|
1
|
+
export declare const version = "1.5.9";
|