Skip to content

Commit 080b256

Browse files
author
ChenGuanglin
committed
2 parents 2d6312c + 34a51a4 commit 080b256

File tree

105 files changed

+131738
-117983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+131738
-117983
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 10.1.0-alpha #
2+
## 新特性
3+
14
# 10.0.1 #
25

36
## 新特性

dist/classic/iclient-classic-es6.js

Lines changed: 82 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* iclient-classic.(https://iclient.supermap.io)
44
* Copyright© 2000 - 2020 SuperMap Software Co.Ltd
55
* license: Apache-2.0
6-
* version: v10.0.1
6+
* version: v10.1.0-alpha
77
*
88
*/
99
/******/ (function(modules) { // webpackBootstrap
@@ -4706,7 +4706,10 @@ var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
47064706

47074707

47084708

4709-
const FetchRequest_fetch = window.fetch;
4709+
let FetchRequest_fetch = window.fetch;
4710+
var setFetch = function (newFetch) {
4711+
FetchRequest_fetch = newFetch;
4712+
}
47104713
/**
47114714
* @function SuperMap.setCORS
47124715
* @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
@@ -4759,12 +4762,13 @@ var FetchRequest = SuperMap.FetchRequest = {
47594762
}
47604763
},
47614764
supportDirectRequest: function (url, options) {
4762-
if(Util.isInTheSameDomain(url)){
4763-
return true;
4764-
}if(options.crossOrigin != undefined){
4765-
return options.crossOrigin;
4766-
}else{
4767-
return isCORS() || options.proxy
4765+
if (Util.isInTheSameDomain(url)) {
4766+
return true;
4767+
}
4768+
if (options.crossOrigin != undefined) {
4769+
return options.crossOrigin;
4770+
} else {
4771+
return isCORS() || options.proxy;
47684772
}
47694773
},
47704774
get: function (url, params, options) {
@@ -4785,7 +4789,6 @@ var FetchRequest = SuperMap.FetchRequest = {
47854789
} else {
47864790
return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
47874791
}
4788-
47894792
},
47904793

47914794
delete: function (url, params, options) {
@@ -4805,7 +4808,6 @@ var FetchRequest = SuperMap.FetchRequest = {
48054808
return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
48064809
}
48074810
return this._fetch(url, params, options, type);
4808-
48094811
},
48104812
post: function (url, params, options) {
48114813
options = options || {};
@@ -4818,7 +4820,6 @@ var FetchRequest = SuperMap.FetchRequest = {
48184820
return SuperMap.Util.RequestJSONPPromise.POST(config);
48194821
}
48204822
return this._fetch(this._processUrl(url, options), params, options, 'POST');
4821-
48224823
},
48234824

48244825
put: function (url, params, options) {
@@ -4831,10 +4832,8 @@ var FetchRequest = SuperMap.FetchRequest = {
48314832
data: params
48324833
};
48334834
return SuperMap.Util.RequestJSONPPromise.PUT(config);
4834-
48354835
}
48364836
return this._fetch(url, params, options, 'PUT');
4837-
48384837
},
48394838
urlIsLong: function (url) {
48404839
//当前url的字节长度。
@@ -4851,10 +4850,10 @@ var FetchRequest = SuperMap.FetchRequest = {
48514850
totalLength += 3;
48524851
}
48534852
}
4854-
return (totalLength < 2000) ? false : true;
4853+
return totalLength < 2000 ? false : true;
48554854
},
48564855
_postSimulatie: function (type, url, params, options) {
4857-
var separator = url.indexOf("?") > -1 ? "&" : "?";
4856+
var separator = url.indexOf('?') > -1 ? '&' : '?';
48584857
url += separator + '_method=' + type;
48594858
if (typeof params !== 'string') {
48604859
params = JSON.stringify(params);
@@ -4868,17 +4867,17 @@ var FetchRequest = SuperMap.FetchRequest = {
48684867
}
48694868

48704869
if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
4871-
if (url.indexOf("?") < 0) {
4872-
url += '.json'
4870+
if (url.indexOf('?') < 0) {
4871+
url += '.json';
48734872
} else {
4874-
var urlArrays = url.split("?");
4873+
var urlArrays = url.split('?');
48754874
if (urlArrays.length === 2) {
4876-
url = urlArrays[0] + ".json?" + urlArrays[1]
4875+
url = urlArrays[0] + '.json?' + urlArrays[1];
48774876
}
48784877
}
48794878
}
48804879
if (options && options.proxy) {
4881-
if (typeof options.proxy === "function") {
4880+
if (typeof options.proxy === 'function') {
48824881
url = options.proxy(url);
48834882
} else {
48844883
url = decodeURIComponent(url);
@@ -4895,70 +4894,82 @@ var FetchRequest = SuperMap.FetchRequest = {
48954894
options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
48964895
}
48974896
if (options.timeout) {
4898-
return this._timeout(options.timeout, FetchRequest_fetch(url, {
4899-
method: type,
4900-
headers: options.headers,
4901-
body: type === 'PUT' || type === 'POST' ? params : undefined,
4902-
credentials: options.withCredentials ? 'include' : 'omit',
4903-
mode: 'cors',
4904-
timeout: getRequestTimeout()
4905-
}).then(function (response) {
4906-
return response;
4907-
}));
4897+
return this._timeout(
4898+
options.timeout,
4899+
FetchRequest_fetch(url, {
4900+
method: type,
4901+
headers: options.headers,
4902+
body: type === 'PUT' || type === 'POST' ? params : undefined,
4903+
credentials: this._getWithCredentials(options),
4904+
mode: 'cors',
4905+
timeout: getRequestTimeout()
4906+
}).then(function (response) {
4907+
return response;
4908+
})
4909+
);
49084910
}
49094911
return FetchRequest_fetch(url, {
49104912
method: type,
49114913
body: type === 'PUT' || type === 'POST' ? params : undefined,
49124914
headers: options.headers,
4913-
credentials: options.withCredentials ? 'include' : 'omit',
4915+
credentials: this._getWithCredentials(options),
49144916
mode: 'cors',
49154917
timeout: getRequestTimeout()
49164918
}).then(function (response) {
49174919
return response;
49184920
});
49194921
},
49204922

4923+
_getWithCredentials: function (options) {
4924+
if (options.withCredentials === true) {
4925+
return 'include';
4926+
}
4927+
if (options.withCredentials === false) {
4928+
return 'omit';
4929+
}
4930+
return 'same-origin';
4931+
},
4932+
49214933
_fetchJsonp: function (url, options) {
49224934
options = options || {};
49234935
return fetch_jsonp_default()(url, {
4924-
method: 'GET',
4925-
timeout: options.timeout
4926-
})
4927-
.then(function (response) {
4928-
return response;
4929-
});
4936+
method: 'GET',
4937+
timeout: options.timeout
4938+
}).then(function (response) {
4939+
return response;
4940+
});
49304941
},
49314942

49324943
_timeout: function (seconds, promise) {
49334944
return new Promise(function (resolve, reject) {
49344945
setTimeout(function () {
4935-
reject(new Error("timeout"))
4936-
}, seconds)
4937-
promise.then(resolve, reject)
4938-
})
4946+
reject(new Error('timeout'));
4947+
}, seconds);
4948+
promise.then(resolve, reject);
4949+
});
49394950
},
49404951

49414952
_getParameterString: function (params) {
49424953
var paramsArray = [];
49434954
for (var key in params) {
49444955
var value = params[key];
4945-
if ((value != null) && (typeof value !== 'function')) {
4956+
if (value != null && typeof value !== 'function') {
49464957
var encodedValue;
49474958
if (Array.isArray(value) || value.toString() === '[object Object]') {
49484959
encodedValue = encodeURIComponent(JSON.stringify(value));
49494960
} else {
49504961
encodedValue = encodeURIComponent(value);
49514962
}
4952-
paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
4963+
paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
49534964
}
49544965
}
4955-
return paramsArray.join("&");
4966+
return paramsArray.join('&');
49564967
},
49574968

49584969
_isMVTRequest: function (url) {
4959-
return (url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1);
4970+
return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
49604971
}
4961-
};
4972+
}
49624973
SuperMap.Util.RequestJSONPPromise = {
49634974
limitLength: 1500,
49644975
queryKeys: [],
@@ -4968,7 +4979,7 @@ SuperMap.Util.RequestJSONPPromise = {
49684979
var me = this;
49694980
for (var key in values) {
49704981
me.queryKeys.push(key);
4971-
if (typeof values[key] !== "string") {
4982+
if (typeof values[key] !== 'string') {
49724983
values[key] = SuperMap.Util.toJSON(values[key]);
49734984
}
49744985
var tempValue = encodeURIComponent(values[key]);
@@ -4994,7 +5005,8 @@ SuperMap.Util.RequestJSONPPromise = {
49945005
keysCount = 0; //此次sectionURL中有多少个key
49955006
var length = me.queryKeys ? me.queryKeys.length : 0;
49965007
for (var i = 0; i < length; i++) {
4997-
if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) { //+2 for ("&"or"?")and"="
5008+
if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
5009+
//+2 for ("&"or"?")and"="
49985010
if (keysCount == 0) {
49995011
return false;
50005012
}
@@ -5007,22 +5019,22 @@ SuperMap.Util.RequestJSONPPromise = {
50075019
var leftValue = me.queryValues[i];
50085020
while (leftValue.length > 0) {
50095021
var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
5010-
if (sectionURL.indexOf("?") > -1) {
5011-
sectionURL += "&";
5022+
if (sectionURL.indexOf('?') > -1) {
5023+
sectionURL += '&';
50125024
} else {
5013-
sectionURL += "?";
5025+
sectionURL += '?';
50145026
}
50155027
var tempLeftValue = leftValue.substring(0, leftLength);
50165028
//避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
5017-
if (tempLeftValue.substring(leftLength - 1, leftLength) === "%") {
5029+
if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
50185030
leftLength -= 1;
50195031
tempLeftValue = leftValue.substring(0, leftLength);
5020-
} else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === "%") {
5032+
} else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
50215033
leftLength -= 2;
50225034
tempLeftValue = leftValue.substring(0, leftLength);
50235035
}
50245036

5025-
sectionURL += me.queryKeys[i] + "=" + tempLeftValue;
5037+
sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
50265038
leftValue = leftValue.substring(leftLength);
50275039
if (tempLeftValue.length > 0) {
50285040
splitQuestUrl.push(sectionURL);
@@ -5032,21 +5044,24 @@ SuperMap.Util.RequestJSONPPromise = {
50325044
}
50335045
} else {
50345046
keysCount++;
5035-
if (sectionURL.indexOf("?") > -1) {
5036-
sectionURL += "&";
5047+
if (sectionURL.indexOf('?') > -1) {
5048+
sectionURL += '&';
50375049
} else {
5038-
sectionURL += "?";
5050+
sectionURL += '?';
50395051
}
5040-
sectionURL += me.queryKeys[i] + "=" + me.queryValues[i];
5052+
sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
50415053
}
50425054
}
50435055
}
50445056
splitQuestUrl.push(sectionURL);
5045-
me.send(splitQuestUrl, "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]", config && config.proxy);
5057+
me.send(
5058+
splitQuestUrl,
5059+
'SuperMap.Util.RequestJSONPPromise.supermap_callbacks[' + uid + ']',
5060+
config && config.proxy
5061+
);
50465062
return p;
50475063
},
50485064

5049-
50505065
getUid: function () {
50515066
var uid = new Date().getTime(),
50525067
random = Math.floor(Math.random() * 1e17);
@@ -5059,22 +5074,22 @@ SuperMap.Util.RequestJSONPPromise = {
50595074
var jsonpUserID = new Date().getTime();
50605075
for (var i = 0; i < len; i++) {
50615076
var url = splitQuestUrl[i];
5062-
if (url.indexOf("?") > -1) {
5063-
url += "&";
5077+
if (url.indexOf('?') > -1) {
5078+
url += '&';
50645079
} else {
5065-
url += "?";
5080+
url += '?';
50665081
}
5067-
url += "sectionCount=" + len;
5068-
url += "&sectionIndex=" + i;
5069-
url += "&jsonpUserID=" + jsonpUserID;
5082+
url += 'sectionCount=' + len;
5083+
url += '&sectionIndex=' + i;
5084+
url += '&jsonpUserID=' + jsonpUserID;
50705085
if (proxy) {
50715086
url = decodeURIComponent(url);
50725087
url = proxy + encodeURIComponent(url);
50735088
}
50745089
fetch_jsonp_default()(url, {
50755090
jsonpCallbackFunction: callback,
50765091
timeout: 30000
5077-
})
5092+
});
50785093
}
50795094
}
50805095
},

dist/classic/iclient-classic-es6.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)