@extscreen/es-core 1.1.25 → 1.1.28
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/index.js +91 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1701,45 +1701,46 @@ var ESDisplayManager$1 = new ESDisplayManager();
|
|
1701
1701
|
class ESManager {
|
1702
1702
|
|
1703
1703
|
_esSdkVersionCode = null;
|
1704
|
+
_esSdkVersionName = null;
|
1704
1705
|
_esSdkPackageName = null;
|
1705
1706
|
_esMiniProgramPath = null;
|
1707
|
+
_esKitVersionCode = -1;
|
1708
|
+
|
1709
|
+
_esSdkInfo = null;
|
1710
|
+
|
1706
1711
|
|
1707
1712
|
init() {
|
1708
1713
|
return Promise.resolve()
|
1709
|
-
.then(() => this.
|
1710
|
-
.then(() => this.initESPackageNamePromise())
|
1711
|
-
.then(() => this.initESMiniProgramPathPromise())
|
1714
|
+
.then(() => this.initESInfoPromise())
|
1712
1715
|
}
|
1713
1716
|
|
1714
|
-
|
1715
|
-
|
1716
|
-
return ESModule$1.getESSDKVersionCode()
|
1717
|
+
initESInfoPromise() {
|
1718
|
+
return ESModule$1.getESSDKInfo()
|
1717
1719
|
.then((result) => {
|
1718
|
-
this.
|
1720
|
+
this._esSdkInfo = result;
|
1721
|
+
if (result) {
|
1722
|
+
this._esSdkVersionCode = result.versionCode;
|
1723
|
+
this._esSdkVersionName = result.versionName;
|
1724
|
+
this._esSdkPackageName = result.packageName;
|
1725
|
+
this._esMiniProgramPath = result.miniProgramPath;
|
1726
|
+
if (result.eskit_ver_code) {
|
1727
|
+
this._esKitVersionCode = result.eskit_ver_code;
|
1728
|
+
}
|
1729
|
+
}
|
1719
1730
|
return Promise.resolve();
|
1720
1731
|
}
|
1721
1732
|
);
|
1722
1733
|
}
|
1723
1734
|
|
1724
|
-
|
1725
|
-
return
|
1726
|
-
.then((result) => {
|
1727
|
-
this._esSdkPackageName = result;
|
1728
|
-
return Promise.resolve();
|
1729
|
-
}
|
1730
|
-
);
|
1735
|
+
getESSDKInfo() {
|
1736
|
+
return this._esSdkInfo;
|
1731
1737
|
}
|
1732
1738
|
|
1733
|
-
|
1734
|
-
return
|
1735
|
-
.then((result) => {
|
1736
|
-
this._esMiniProgramPath = result;
|
1737
|
-
return Promise.resolve();
|
1738
|
-
}
|
1739
|
-
);
|
1739
|
+
getESSDKVersionCode() {
|
1740
|
+
return this._esKitVersionCode;
|
1740
1741
|
}
|
1741
1742
|
|
1742
|
-
|
1743
|
+
getESVersionCode() {
|
1743
1744
|
return this._esSdkVersionCode;
|
1744
1745
|
}
|
1745
1746
|
|
@@ -1754,6 +1755,8 @@ class ESManager {
|
|
1754
1755
|
|
1755
1756
|
var ESManager$1 = new ESManager();
|
1756
1757
|
|
1758
|
+
const ES_SDK_VERSION_21 = 2.1;
|
1759
|
+
|
1757
1760
|
/**
|
1758
1761
|
*
|
1759
1762
|
*/
|
@@ -1763,42 +1766,49 @@ class ESLaunchManager {
|
|
1763
1766
|
|
1764
1767
|
_ESRouter = null;
|
1765
1768
|
_ESRouterEnabled = true;
|
1769
|
+
_ESPageRouterViewEnabled = false;
|
1766
1770
|
_launchLimit = 10;
|
1767
1771
|
|
1768
1772
|
init(router) {
|
1769
1773
|
try {
|
1770
1774
|
this._ESRouter = router;
|
1771
|
-
this.
|
1775
|
+
this._ESPageRouterViewEnabled = this.isESPageRouterViewSupported();
|
1772
1776
|
if (ESLog.isLoggable(ESLog.DEBUG)) {
|
1773
1777
|
ESLog.d('ESRouter', '#------init--------->>' + '\n' +
|
1774
|
-
'
|
1778
|
+
'_ESPageRouterViewEnabled: ' + this._ESPageRouterViewEnabled + '\n' +
|
1775
1779
|
'_ESRouter: ' + this._ESRouter
|
1776
1780
|
);
|
1777
1781
|
}
|
1778
1782
|
} catch (e) {
|
1779
1783
|
}
|
1780
1784
|
//
|
1781
|
-
|
1782
|
-
this._ESRouter.setEnabled(this._ESRouterEnabled);
|
1783
|
-
} catch (e) {
|
1784
|
-
}
|
1785
|
+
this._setESPageRouterViewSupported(this._ESPageRouterViewEnabled);
|
1785
1786
|
return Promise.resolve();
|
1786
1787
|
}
|
1787
1788
|
|
1788
|
-
|
1789
|
-
|
1789
|
+
//----------------------ESPageRouterView--------------------------
|
1790
|
+
_setESPageRouterViewSupported(enabled) {
|
1791
|
+
this._ESPageRouterViewEnabled = enabled;
|
1790
1792
|
try {
|
1791
|
-
this._ESRouter
|
1793
|
+
if (this._ESRouter) {
|
1794
|
+
this._ESRouter.setESPageRouterViewSupported(this._ESPageRouterViewEnabled);
|
1795
|
+
}
|
1792
1796
|
} catch (e) {
|
1793
1797
|
}
|
1794
1798
|
}
|
1795
1799
|
|
1800
|
+
isESPageRouterViewSupported() {
|
1801
|
+
return ESManager$1.getESSDKVersionCode() >= ES_SDK_VERSION_21;
|
1802
|
+
}
|
1803
|
+
|
1804
|
+
//---------------------------------------------------------
|
1805
|
+
|
1796
1806
|
isESRouterEnabled() {
|
1797
|
-
return this._ESRouterEnabled
|
1807
|
+
return this._ESRouterEnabled;
|
1798
1808
|
}
|
1799
1809
|
|
1800
|
-
|
1801
|
-
|
1810
|
+
setESRouterEnabled(enabled) {
|
1811
|
+
this._ESRouterEnabled = enabled;
|
1802
1812
|
}
|
1803
1813
|
|
1804
1814
|
setLaunchLimit(limit) {
|
@@ -1822,9 +1832,7 @@ class ESLaunchManager {
|
|
1822
1832
|
}
|
1823
1833
|
|
1824
1834
|
launchESPage(intent) {
|
1825
|
-
|
1826
|
-
if (this.isESRouterEnabled() && this._ESRouter
|
1827
|
-
&& this.isESRouterSupported()) {
|
1835
|
+
if (this.isESRouterEnabled() && this._ESRouter) {
|
1828
1836
|
this._ESRouter.push({
|
1829
1837
|
name: intent.url,
|
1830
1838
|
params: intent.params,
|
@@ -3157,6 +3165,13 @@ const ES_NETWORK_INFO_TYPE_ETHERNET = 9;
|
|
3157
3165
|
|
3158
3166
|
var ESApplication = {
|
3159
3167
|
mixins: [ESRouter],
|
3168
|
+
data() {
|
3169
|
+
return {
|
3170
|
+
appInitProps: {},
|
3171
|
+
appInitUrl: '',
|
3172
|
+
appInitParams: {},
|
3173
|
+
};
|
3174
|
+
},
|
3160
3175
|
mounted() {
|
3161
3176
|
this._initES();
|
3162
3177
|
},
|
@@ -3168,16 +3183,32 @@ var ESApplication = {
|
|
3168
3183
|
})
|
3169
3184
|
)
|
3170
3185
|
.then((result) => {
|
3171
|
-
this.
|
3186
|
+
this._initESAppParams();
|
3172
3187
|
},
|
3173
3188
|
error => {
|
3174
|
-
this.
|
3189
|
+
this._initESAppParams();
|
3175
3190
|
}
|
3176
3191
|
);
|
3177
3192
|
},
|
3193
|
+
_initESAppParams() {
|
3194
|
+
//
|
3195
|
+
this.appInitProps = ESApp.$options.$superProps;
|
3196
|
+
//
|
3197
|
+
this.appInitUrl = ESApp.$options.$superProps.url;
|
3198
|
+
this.appInitParams = ESApp.$options.$superProps.params;
|
3199
|
+
|
3200
|
+
if (!this.appInitUrl) {
|
3201
|
+
this.appInitUrl = this.$router.options.main;
|
3202
|
+
}
|
3203
|
+
if (!(this._isRoutePathValid(this.appInitUrl) || this._isRouteNameValid(this.appInitUrl))) {
|
3204
|
+
this.appInitUrl = this.$router.options.error;
|
3205
|
+
}
|
3206
|
+
//
|
3207
|
+
this._initESApp();
|
3208
|
+
},
|
3178
3209
|
_initESApp() {
|
3179
3210
|
if (this._isFunction(this.onESCreate)) {
|
3180
|
-
let result = this.onESCreate();
|
3211
|
+
let result = this.onESCreate(this.appInitProps);
|
3181
3212
|
if (ESLog.isLoggable(ESLog.DEBUG)) {
|
3182
3213
|
ESLog.d('ESApplication', '---------onESCreate---------->>>>', result);
|
3183
3214
|
}
|
@@ -3210,14 +3241,9 @@ var ESApplication = {
|
|
3210
3241
|
}
|
3211
3242
|
},
|
3212
3243
|
_initPage() {
|
3213
|
-
let initUrl = ESApp.$options.$superProps.url;
|
3214
|
-
let initParams = ESApp.$options.$superProps.params;
|
3215
|
-
if (!initUrl) {
|
3216
|
-
initUrl = this.$router.options.main;
|
3217
|
-
}
|
3218
3244
|
let route = {
|
3219
|
-
name:
|
3220
|
-
params:
|
3245
|
+
name: this.appInitUrl,
|
3246
|
+
params: this.appInitParams,
|
3221
3247
|
};
|
3222
3248
|
if (ESLog.isLoggable(ESLog.DEBUG)) {
|
3223
3249
|
console.log('ESApplication', '---------onESCreate---_initPage--push--->>>>', route);
|
@@ -3227,6 +3253,24 @@ var ESApplication = {
|
|
3227
3253
|
_isFunction(func) {
|
3228
3254
|
return Object.prototype.toString.call(func) === '[object Function]';
|
3229
3255
|
},
|
3256
|
+
_isRoutePathValid(path) {
|
3257
|
+
if (path !== undefined && path !== '') {
|
3258
|
+
let index = this.$router.options.routes.findIndex((item) => item.path === `/${path}`);
|
3259
|
+
if (index !== -1) {
|
3260
|
+
return true;
|
3261
|
+
}
|
3262
|
+
}
|
3263
|
+
return false;
|
3264
|
+
},
|
3265
|
+
_isRouteNameValid(name) {
|
3266
|
+
if (name !== undefined && name !== '') {
|
3267
|
+
let index = this.$router.options.routes.findIndex((item) => item.path === `${name}`);
|
3268
|
+
if (index !== -1) {
|
3269
|
+
return true;
|
3270
|
+
}
|
3271
|
+
}
|
3272
|
+
return false;
|
3273
|
+
},
|
3230
3274
|
},
|
3231
3275
|
};
|
3232
3276
|
|