gis-common 1.1.6 → 1.1.7
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/resource.min.js +40 -201
- package/package.json +1 -1
package/dist/resource.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(
|
|
3
|
+
module.exports = factory();
|
|
4
4
|
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define("Gis", [
|
|
5
|
+
define("Gis", [], factory);
|
|
6
6
|
else if(typeof exports === 'object')
|
|
7
|
-
exports["Gis"] = factory(
|
|
7
|
+
exports["Gis"] = factory();
|
|
8
8
|
else
|
|
9
|
-
root["Gis"] = factory(
|
|
10
|
-
})(window, function(
|
|
9
|
+
root["Gis"] = factory();
|
|
10
|
+
})(window, function() {
|
|
11
11
|
return /******/ (function(modules) { // webpackBootstrap
|
|
12
12
|
/******/ // The module cache
|
|
13
13
|
/******/ var installedModules = {};
|
|
@@ -91,17 +91,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
91
91
|
/******/
|
|
92
92
|
/******/
|
|
93
93
|
/******/ // Load entry module and return exports
|
|
94
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
94
|
+
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
|
95
95
|
/******/ })
|
|
96
96
|
/************************************************************************/
|
|
97
97
|
/******/ ([
|
|
98
98
|
/* 0 */
|
|
99
|
-
/***/ (function(module, exports) {
|
|
100
|
-
|
|
101
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
|
|
102
|
-
|
|
103
|
-
/***/ }),
|
|
104
|
-
/* 1 */
|
|
105
99
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
106
100
|
|
|
107
101
|
"use strict";
|
|
@@ -132,7 +126,6 @@ __webpack_require__.d(__webpack_exports__, "CanvasDrawer", function() { return /
|
|
|
132
126
|
__webpack_require__.d(__webpack_exports__, "ElQuery", function() { return /* reexport */ core_ElQuery; });
|
|
133
127
|
__webpack_require__.d(__webpack_exports__, "EventDispatcher", function() { return /* reexport */ core_EventDispatcher; });
|
|
134
128
|
__webpack_require__.d(__webpack_exports__, "HashMap", function() { return /* reexport */ core_HashMap; });
|
|
135
|
-
__webpack_require__.d(__webpack_exports__, "MqttClient", function() { return /* reexport */ core_MqttClient; });
|
|
136
129
|
__webpack_require__.d(__webpack_exports__, "WebSocketClient", function() { return /* reexport */ core_WebSocketClient; });
|
|
137
130
|
__webpack_require__.d(__webpack_exports__, "WebStorage", function() { return /* reexport */ core_WebStorage; });
|
|
138
131
|
|
|
@@ -925,17 +918,17 @@ Array.prototype.clear = function () {
|
|
|
925
918
|
// CONCATENATED MODULE: ./src/utils/DateUtils.js
|
|
926
919
|
Date.prototype.format = function (fmt) {
|
|
927
920
|
var o = {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
921
|
+
'M+': this.getMonth() + 1, // 月份
|
|
922
|
+
'd+': this.getDate(), // 日
|
|
923
|
+
'h+': this.getHours(), // 小时
|
|
924
|
+
'm+': this.getMinutes(), // 分
|
|
925
|
+
's+': this.getSeconds(), // 秒
|
|
926
|
+
'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
|
|
934
927
|
S: this.getMilliseconds() // 毫秒
|
|
935
928
|
};
|
|
936
|
-
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() +
|
|
929
|
+
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
|
|
937
930
|
for (var k in o) {
|
|
938
|
-
if (new RegExp(
|
|
931
|
+
if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
|
|
939
932
|
}
|
|
940
933
|
return fmt;
|
|
941
934
|
};
|
|
@@ -948,28 +941,28 @@ Date.prototype.format = function (fmt) {
|
|
|
948
941
|
Date.prototype.addDate = function (interval, number) {
|
|
949
942
|
var date = new Date(this);
|
|
950
943
|
switch (interval) {
|
|
951
|
-
case
|
|
944
|
+
case 'y':
|
|
952
945
|
date.setFullYear(this.getFullYear() + number);
|
|
953
946
|
break;
|
|
954
|
-
case
|
|
947
|
+
case 'q':
|
|
955
948
|
date.setMonth(this.getMonth() + number * 3);
|
|
956
949
|
break;
|
|
957
|
-
case
|
|
950
|
+
case 'M':
|
|
958
951
|
date.setMonth(this.getMonth() + number);
|
|
959
952
|
break;
|
|
960
|
-
case
|
|
953
|
+
case 'w':
|
|
961
954
|
date.setDate(this.getDate() + number * 7);
|
|
962
955
|
break;
|
|
963
|
-
case
|
|
956
|
+
case 'd':
|
|
964
957
|
date.setDate(this.getDate() + number);
|
|
965
958
|
break;
|
|
966
|
-
case
|
|
959
|
+
case 'h':
|
|
967
960
|
date.setHours(this.getHours() + number);
|
|
968
961
|
break;
|
|
969
|
-
case
|
|
962
|
+
case 'm':
|
|
970
963
|
date.setMinutes(this.getMinutes() + number);
|
|
971
964
|
break;
|
|
972
|
-
case
|
|
965
|
+
case 's':
|
|
973
966
|
date.setSeconds(this.getSeconds() + number);
|
|
974
967
|
break;
|
|
975
968
|
default:
|
|
@@ -979,11 +972,14 @@ Date.prototype.addDate = function (interval, number) {
|
|
|
979
972
|
return date;
|
|
980
973
|
};
|
|
981
974
|
/* harmony default export */ var DateUtils = ({
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
975
|
+
lastMonthDate: new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1),
|
|
976
|
+
thisMonthDate: new Date(new Date().getFullYear(), new Date().getMonth(), 1),
|
|
977
|
+
nextMonthDate: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1),
|
|
978
|
+
lastDayDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 1),
|
|
979
|
+
thisDayDate: new Date(new Date().setHours(0, 0, 0, 0)),
|
|
980
|
+
nextDayDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1),
|
|
985
981
|
parseDate: function parseDate(str) {
|
|
986
|
-
if (typeof str ==
|
|
982
|
+
if (typeof str == 'string') {
|
|
987
983
|
var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
|
|
988
984
|
if (results && results.length > 3) return new Date(parseInt(results[1]), parseInt(results[2]) - 1, parseInt(results[3]));
|
|
989
985
|
results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);
|
|
@@ -1012,21 +1008,21 @@ Date.prototype.addDate = function (interval, number) {
|
|
|
1012
1008
|
var minutes = Math.floor(leave2 / (60 * 1000));
|
|
1013
1009
|
var leave3 = leave2 % (60 * 1000);
|
|
1014
1010
|
var seconds = Math.round(leave3 / 1000);
|
|
1015
|
-
var intervalDes =
|
|
1011
|
+
var intervalDes = '';
|
|
1016
1012
|
if (days > 0) {
|
|
1017
|
-
intervalDes += days +
|
|
1013
|
+
intervalDes += days + '天';
|
|
1018
1014
|
}
|
|
1019
1015
|
if (hours > 0) {
|
|
1020
|
-
intervalDes += hours +
|
|
1016
|
+
intervalDes += hours + '时';
|
|
1021
1017
|
}
|
|
1022
1018
|
if (minutes > 0) {
|
|
1023
|
-
intervalDes += minutes +
|
|
1019
|
+
intervalDes += minutes + '分';
|
|
1024
1020
|
}
|
|
1025
1021
|
if (seconds > 0) {
|
|
1026
|
-
intervalDes += seconds +
|
|
1022
|
+
intervalDes += seconds + '秒';
|
|
1027
1023
|
}
|
|
1028
1024
|
if (days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
|
|
1029
|
-
intervalDes =
|
|
1025
|
+
intervalDes = '少于1秒';
|
|
1030
1026
|
}
|
|
1031
1027
|
return intervalDes;
|
|
1032
1028
|
},
|
|
@@ -2125,184 +2121,27 @@ var HashMap = function () {
|
|
|
2125
2121
|
}();
|
|
2126
2122
|
|
|
2127
2123
|
/* harmony default export */ var core_HashMap = (HashMap);
|
|
2128
|
-
// EXTERNAL MODULE: external "mqtt"
|
|
2129
|
-
var external_mqtt_ = __webpack_require__(0);
|
|
2130
|
-
|
|
2131
|
-
// CONCATENATED MODULE: ./src/core/MqttClient.js
|
|
2132
|
-
var MqttClient_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2133
|
-
|
|
2134
|
-
function MqttClient_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2135
|
-
|
|
2136
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
2137
|
-
|
|
2138
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
var MqttClient_MqttClient = function (_EventDispatcher) {
|
|
2147
|
-
_inherits(MqttClient, _EventDispatcher);
|
|
2148
|
-
|
|
2149
|
-
/**
|
|
2150
|
-
* Creates an instance of MqttClient.
|
|
2151
|
-
* @param {*} config mqtt实例参数
|
|
2152
|
-
*/
|
|
2153
|
-
function MqttClient() {
|
|
2154
|
-
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2155
|
-
|
|
2156
|
-
MqttClient_classCallCheck(this, MqttClient);
|
|
2157
|
-
|
|
2158
|
-
var _this = _possibleConstructorReturn(this, (MqttClient.__proto__ || Object.getPrototypeOf(MqttClient)).call(this));
|
|
2159
|
-
|
|
2160
|
-
_this.context = CommUtils.extend(MqttClient.defaultContext, config);
|
|
2161
|
-
_this.options = {
|
|
2162
|
-
connectTimeout: _this.context.MQTT_TIMEOUTM,
|
|
2163
|
-
clientId: CommUtils.generateGuid(),
|
|
2164
|
-
username: _this.context.MQTT_USERNAME,
|
|
2165
|
-
password: _this.context.MQTT_PASSWORD,
|
|
2166
|
-
clean: true
|
|
2167
|
-
};
|
|
2168
|
-
_this.client = Object(external_mqtt_["connect"])(_this.context.MQTT_SERVICE, _this.options);
|
|
2169
|
-
_this._onConnect();
|
|
2170
|
-
_this._onMessage();
|
|
2171
|
-
MqttClient.instance = _this;
|
|
2172
|
-
return _this;
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
|
-
MqttClient_createClass(MqttClient, [{
|
|
2176
|
-
key: "_onConnect",
|
|
2177
|
-
value: function _onConnect() {
|
|
2178
|
-
var _this2 = this;
|
|
2179
|
-
|
|
2180
|
-
this.client.on("connect", function () {
|
|
2181
|
-
console.log("链接mqtt成功==>" + _this2.context.MQTT_SERVICE);
|
|
2182
|
-
_this2.dispatchEvent({ type: EventTypeConstant.MQTT_CONNECT, message: _this2 });
|
|
2183
|
-
});
|
|
2184
|
-
this.client.on("error", function (err) {
|
|
2185
|
-
console.log("链接mqtt报错", err);
|
|
2186
|
-
_this2.dispatchEvent({ type: EventTypeConstant.MQTT_ERROR, message: _this2 });
|
|
2187
|
-
_this2.client.end();
|
|
2188
|
-
_this2.client.reconnect();
|
|
2189
|
-
});
|
|
2190
|
-
}
|
|
2191
|
-
}, {
|
|
2192
|
-
key: "_onMessage",
|
|
2193
|
-
value: function _onMessage() {
|
|
2194
|
-
var _this3 = this;
|
|
2195
|
-
|
|
2196
|
-
this.client.on("message", function (topic, message) {
|
|
2197
|
-
var dataString = message;
|
|
2198
|
-
var data = "";
|
|
2199
|
-
if (message instanceof Uint8Array) {
|
|
2200
|
-
dataString = message.toString();
|
|
2201
|
-
}
|
|
2202
|
-
try {
|
|
2203
|
-
data = JSON.parse(dataString);
|
|
2204
|
-
} catch (error) {
|
|
2205
|
-
throw new Error(ErrorTypeConstant.JSON_PARSE_ERROR);
|
|
2206
|
-
}
|
|
2207
|
-
_this3.dispatchEvent({
|
|
2208
|
-
type: EventTypeConstant.MQTT_MESSAGE,
|
|
2209
|
-
message: { topic: topic, data: data }
|
|
2210
|
-
});
|
|
2211
|
-
});
|
|
2212
|
-
}
|
|
2213
|
-
}, {
|
|
2214
|
-
key: "sendMsg",
|
|
2215
|
-
value: function sendMsg(topic, msg) {
|
|
2216
|
-
if (!this.client.connected) {
|
|
2217
|
-
console.error("客户端未连接");
|
|
2218
|
-
return;
|
|
2219
|
-
}
|
|
2220
|
-
this.client.publish(topic, msg, { qos: 1, retain: true });
|
|
2221
|
-
}
|
|
2222
|
-
}, {
|
|
2223
|
-
key: "subscribe",
|
|
2224
|
-
value: function subscribe(topic) {
|
|
2225
|
-
this.client.subscribe(topic, { qos: 1 }, function (error, res) {
|
|
2226
|
-
if (error instanceof Error || res.length === 0) {
|
|
2227
|
-
console.error("\u8BA2\u9605\u5931\u8D25==>" + topic, error);
|
|
2228
|
-
} else {
|
|
2229
|
-
console.log("\u8BA2\u9605\u6210\u529F==>" + topic);
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
return this;
|
|
2233
|
-
}
|
|
2234
|
-
}, {
|
|
2235
|
-
key: "unsubscribe",
|
|
2236
|
-
value: function unsubscribe(topic) {
|
|
2237
|
-
this.client.unsubscribe(topic, { qos: 1 }, function (error, res) {
|
|
2238
|
-
if (error instanceof Error || res.length === 0) {
|
|
2239
|
-
console.error("\u53D6\u6D88\u8BA2\u9605\u5931\u8D25==>" + topic, error);
|
|
2240
|
-
} else {
|
|
2241
|
-
console.log("\u53D6\u6D88\u8BA2\u9605\u6210\u529F==>" + topic);
|
|
2242
|
-
}
|
|
2243
|
-
});
|
|
2244
|
-
return this;
|
|
2245
|
-
}
|
|
2246
|
-
}, {
|
|
2247
|
-
key: "unconnect",
|
|
2248
|
-
value: function unconnect() {
|
|
2249
|
-
this.client.end();
|
|
2250
|
-
this.client = null;
|
|
2251
|
-
this.dispatchEvent({ type: EventTypeConstant.MQTT_CLOSE, message: null });
|
|
2252
|
-
console.log("断开mqtt成功==>" + this.context.MQTT_SERVICE);
|
|
2253
|
-
}
|
|
2254
|
-
/**
|
|
2255
|
-
* @description 获取并冻结mqtt实例
|
|
2256
|
-
* @static
|
|
2257
|
-
* @param {*} [config={}]
|
|
2258
|
-
* @returns {MqttClient}
|
|
2259
|
-
*/
|
|
2260
|
-
|
|
2261
|
-
}], [{
|
|
2262
|
-
key: "getInstance",
|
|
2263
|
-
value: function getInstance() {
|
|
2264
|
-
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2265
|
-
|
|
2266
|
-
if (MqttClient.instance) {
|
|
2267
|
-
return Object.freeze(MqttClient.instance);
|
|
2268
|
-
} else {
|
|
2269
|
-
return Object.freeze(new MqttClient(config));
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
}]);
|
|
2273
|
-
|
|
2274
|
-
return MqttClient;
|
|
2275
|
-
}(core_EventDispatcher);
|
|
2276
|
-
|
|
2277
|
-
/* harmony default export */ var core_MqttClient = (MqttClient_MqttClient);
|
|
2278
|
-
|
|
2279
|
-
MqttClient_MqttClient.defaultContext = {
|
|
2280
|
-
MQTT_TIMEOUTM: 20000,
|
|
2281
|
-
MQTT_USERNAME: "iRVMS-WEB",
|
|
2282
|
-
MQTT_PASSWORD: "novasky888",
|
|
2283
|
-
MQTT_SERVICE: "ws://" + window.document.domain + ":20007/mqtt"
|
|
2284
|
-
};
|
|
2285
2124
|
// CONCATENATED MODULE: ./src/core/WebSocketClient.js
|
|
2286
2125
|
var WebSocketClient_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2287
2126
|
|
|
2288
2127
|
function WebSocketClient_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2289
2128
|
|
|
2290
|
-
function
|
|
2129
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
2291
2130
|
|
|
2292
|
-
function
|
|
2131
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
2293
2132
|
|
|
2294
2133
|
|
|
2295
2134
|
|
|
2296
2135
|
|
|
2297
2136
|
var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
2298
|
-
|
|
2137
|
+
_inherits(WebSocketClient, _EventDispatcher);
|
|
2299
2138
|
|
|
2300
2139
|
function WebSocketClient() {
|
|
2301
2140
|
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'ws://127.0.0.1:10088';
|
|
2302
2141
|
|
|
2303
2142
|
WebSocketClient_classCallCheck(this, WebSocketClient);
|
|
2304
2143
|
|
|
2305
|
-
var _this =
|
|
2144
|
+
var _this = _possibleConstructorReturn(this, (WebSocketClient.__proto__ || Object.getPrototypeOf(WebSocketClient)).call(this));
|
|
2306
2145
|
|
|
2307
2146
|
_this.maxCheckTimes = 10;
|
|
2308
2147
|
_this.url = url;
|
|
@@ -2539,7 +2378,7 @@ var WebStorage_WebStorage = function () {
|
|
|
2539
2378
|
|
|
2540
2379
|
|
|
2541
2380
|
|
|
2542
|
-
// vite不支持?
|
|
2381
|
+
// export { default as MqttClient } from './core/MqttClient' // vite不支持?
|
|
2543
2382
|
|
|
2544
2383
|
|
|
2545
2384
|
|