dtable-utils 5.0.18 → 5.0.20-beta.1
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 +1 -1
- package/es/archive/clause-module/search.js +1 -0
- package/es/cell-value-get/cell-value.js +0 -4
- package/es/cell-value-get/geolocation.js +41 -7
- package/es/cell-value-set/geolocation.js +135 -26
- package/es/constants/geolocation.js +17 -0
- package/es/date.js +36 -1
- package/es/view/summaries.js +1 -0
- package/lib/archive/clause-module/search.js +1 -0
- package/lib/cell-value-get/cell-value.js +0 -4
- package/lib/cell-value-get/geolocation.js +42 -6
- package/lib/cell-value-set/geolocation.js +142 -25
- package/lib/constants/geolocation.js +23 -0
- package/lib/date.js +36 -1
- package/lib/view/summaries.js +1 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ import '@babel/runtime/helpers/typeof';
|
|
|
14
14
|
import '../../date.js';
|
|
15
15
|
import '@babel/runtime/helpers/defineProperty';
|
|
16
16
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
17
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
17
18
|
|
|
18
19
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
19
20
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -131,7 +131,6 @@ var getFormulaDisplayString = function getFormulaDisplayString(cellValue, column
|
|
|
131
131
|
* @param {object} formulaRows formula results of rows. Default as "{}"
|
|
132
132
|
* @param {array} collaborators e.g. [{ email, name, ... }, ...]. Default as "[]"
|
|
133
133
|
* @param {array} departments e.g. [{ name, id }, ...]. Default as "[]"
|
|
134
|
-
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true
|
|
135
134
|
* @param {string} geolocationHyphen Used as a connector between province, city, district and detail. Default as empty string
|
|
136
135
|
* @returns formatted cell value, string|array
|
|
137
136
|
*/
|
|
@@ -144,8 +143,6 @@ var getCellValueDisplayString = function getCellValueDisplayString(row, type, ke
|
|
|
144
143
|
collaborators = _ref2$collaborators === void 0 ? [] : _ref2$collaborators,
|
|
145
144
|
_ref2$departments = _ref2.departments,
|
|
146
145
|
departments = _ref2$departments === void 0 ? [] : _ref2$departments,
|
|
147
|
-
_ref2$isBaiduMap = _ref2.isBaiduMap,
|
|
148
|
-
isBaiduMap = _ref2$isBaiduMap === void 0 ? true : _ref2$isBaiduMap,
|
|
149
146
|
_ref2$geolocationHyph = _ref2.geolocationHyphen,
|
|
150
147
|
geolocationHyphen = _ref2$geolocationHyph === void 0 ? '' : _ref2$geolocationHyph;
|
|
151
148
|
if (!row) return '';
|
|
@@ -166,7 +163,6 @@ var getCellValueDisplayString = function getCellValueDisplayString(row, type, ke
|
|
|
166
163
|
case CellType.GEOLOCATION:
|
|
167
164
|
{
|
|
168
165
|
return getGeolocationDisplayString(cellValue, data, {
|
|
169
|
-
isBaiduMap: isBaiduMap,
|
|
170
166
|
hyphen: geolocationHyphen
|
|
171
167
|
});
|
|
172
168
|
}
|
|
@@ -1,19 +1,54 @@
|
|
|
1
1
|
import { GROUP_GEOLOCATION_GRANULARITY } from '../constants/group.js';
|
|
2
2
|
import { GEOLOCATION_FORMAT } from '../constants/column.js';
|
|
3
|
-
import {
|
|
3
|
+
import { isNumber } from '../number.js';
|
|
4
|
+
import { DMS_SPLITTER_TYPE, LAT_DIRECTION_TYPE, LNG_DIRECTION_TYPE } from '../constants/geolocation.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Convert decimal to DMS
|
|
8
|
+
* @param {number} lat
|
|
9
|
+
* @param {bool} isLat Latitude: N/S, Longitude: E/W
|
|
10
|
+
* @returns { dms, direction }, object
|
|
11
|
+
*/
|
|
12
|
+
var convertToDMS = function convertToDMS(decimal) {
|
|
13
|
+
var isLat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
14
|
+
if (!isNumber(decimal) && typeof decimal !== 'string') return {};
|
|
15
|
+
var numDecimal = typeof decimal === 'string' ? Number.parseFloat(decimal) : decimal;
|
|
16
|
+
if (!isNumber(numDecimal)) return {};
|
|
17
|
+
var degrees = Math.floor(Math.abs(numDecimal));
|
|
18
|
+
var minutesDecimal = Number.parseFloat(((Math.abs(numDecimal) - degrees) * 60).toFixed(8));
|
|
19
|
+
var minutes = Math.floor(minutesDecimal);
|
|
20
|
+
var seconds = Number.parseFloat(((minutesDecimal - minutes) * 60).toFixed(8));
|
|
21
|
+
var direction = '';
|
|
22
|
+
if (isLat) {
|
|
23
|
+
direction = numDecimal >= 0 ? LAT_DIRECTION_TYPE.N : LAT_DIRECTION_TYPE.S;
|
|
24
|
+
} else {
|
|
25
|
+
direction = numDecimal >= 0 ? LNG_DIRECTION_TYPE.E : LNG_DIRECTION_TYPE.W;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
dms: "".concat(degrees).concat(DMS_SPLITTER_TYPE.DEG).concat(minutes).concat(DMS_SPLITTER_TYPE.MIN).concat(seconds).concat(DMS_SPLITTER_TYPE.SEC),
|
|
29
|
+
direction: direction
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
var getLatLngDisplayString = function getLatLngDisplayString(lat, lng) {
|
|
33
|
+
var _convertToDMS = convertToDMS(lat, true),
|
|
34
|
+
lat_dms = _convertToDMS.dms,
|
|
35
|
+
lat_direction = _convertToDMS.direction;
|
|
36
|
+
var _convertToDMS2 = convertToDMS(lng),
|
|
37
|
+
lng_dms = _convertToDMS2.dms,
|
|
38
|
+
lng_direction = _convertToDMS2.direction;
|
|
39
|
+
if (!lat_dms || !lng_dms) return '';
|
|
40
|
+
return "".concat(lat_direction).concat(lat_dms, ", ").concat(lng_direction).concat(lng_dms);
|
|
41
|
+
};
|
|
4
42
|
|
|
5
43
|
/**
|
|
6
44
|
* Get formatted geolocation
|
|
7
45
|
* @param {object} loc
|
|
8
46
|
* @param {object} formats , e.g. { geo_format, ... }
|
|
9
|
-
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true
|
|
10
47
|
* @param {string} hyphen Used as a connector between province, city, district and detail. Default as empty string
|
|
11
48
|
* @returns formatted geolocation, string
|
|
12
49
|
*/
|
|
13
50
|
var getGeolocationDisplayString = function getGeolocationDisplayString(loc, formats) {
|
|
14
51
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
15
|
-
_ref$isBaiduMap = _ref.isBaiduMap,
|
|
16
|
-
isBaiduMap = _ref$isBaiduMap === void 0 ? true : _ref$isBaiduMap,
|
|
17
52
|
_ref$hyphen = _ref.hyphen,
|
|
18
53
|
hyphen = _ref$hyphen === void 0 ? '' : _ref$hyphen;
|
|
19
54
|
if (!loc) return '';
|
|
@@ -24,8 +59,7 @@ var getGeolocationDisplayString = function getGeolocationDisplayString(loc, form
|
|
|
24
59
|
{
|
|
25
60
|
var lng = loc.lng,
|
|
26
61
|
lat = loc.lat;
|
|
27
|
-
|
|
28
|
-
return isBaiduMap ? "".concat(lng, ", ").concat(lat) : "".concat(lat, ", ").concat(lng);
|
|
62
|
+
return getLatLngDisplayString(lat, lng);
|
|
29
63
|
}
|
|
30
64
|
case GEOLOCATION_FORMAT.COUNTRY_REGION:
|
|
31
65
|
{
|
|
@@ -101,4 +135,4 @@ var getGeolocationByGranularity = function getGeolocationByGranularity(geolocati
|
|
|
101
135
|
}
|
|
102
136
|
};
|
|
103
137
|
|
|
104
|
-
export { getGeolocationByGranularity, getGeolocationDisplayString };
|
|
138
|
+
export { convertToDMS, getGeolocationByGranularity, getGeolocationDisplayString, getLatLngDisplayString };
|
|
@@ -1,39 +1,148 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import { GEOLOCATION_FORMAT } from '../constants/column.js';
|
|
3
|
+
import '../constants/filter/filter-column-options.js';
|
|
4
|
+
import '../constants/filter/filter-modifier.js';
|
|
5
|
+
import '../constants/filter/filter-predicate.js';
|
|
6
|
+
import '../constants/filter/filter-is-within.js';
|
|
7
|
+
import '../constants/formula.js';
|
|
8
|
+
import '../constants/sort.js';
|
|
9
|
+
import '../constants/group.js';
|
|
10
|
+
import { LAT_DIRECTION_TYPE, LNG_DIRECTION_TYPE, DMS_SPLITTER_TYPE } from '../constants/geolocation.js';
|
|
11
|
+
import { isNumber } from '../number.js';
|
|
12
|
+
|
|
1
13
|
var provinceReg = /.+省|.+自治区|.+特别行政区|北京市|天津市|上海市|重庆市|安徽|福建|甘肃|广东|广西|贵州|海南|河北|河南|黑龙江|湖北|湖南|吉林|江苏|江西|辽宁|内蒙古|宁夏|青海|山东|山西|陕西|四川|西藏|新疆|云南|浙江|北京|上海|天津|重庆/;
|
|
2
14
|
var cityReg = /.+自治州|[^市]+市|.+盟|.+地区|.+区划/;
|
|
3
15
|
var districtReg = /(.+市|.+县|.+旗|.+区)/;
|
|
16
|
+
var LNG_LAT_REG = /^-?([1-9]\d*\.\d+|0\.\d+|[1-9]\d*|0)$/;
|
|
17
|
+
var DMS_DEG_REG = new RegExp("(\\d+(?:\\.\\d+)?)".concat(DMS_SPLITTER_TYPE.DEG));
|
|
18
|
+
var DMS_MIN_REG = new RegExp("(\\d+(?:\\.\\d+)?)".concat(DMS_SPLITTER_TYPE.MIN));
|
|
19
|
+
var DMS_SEC_REG = new RegExp("(\\d+(?:\\.\\d+)?)".concat(DMS_SPLITTER_TYPE.SEC));
|
|
20
|
+
var parseDMS = function parseDMS(dms, direction) {
|
|
21
|
+
if (typeof dms !== 'string') {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
var degMatches = dms.match(DMS_DEG_REG);
|
|
25
|
+
var minMatches = dms.match(DMS_MIN_REG);
|
|
26
|
+
var secMatches = dms.match(DMS_SEC_REG);
|
|
27
|
+
var strDeg = degMatches && degMatches[1];
|
|
28
|
+
var strMin = minMatches && minMatches[1];
|
|
29
|
+
var strSec = secMatches && secMatches[1];
|
|
30
|
+
if (!strDeg && !strMin && !strSec) {
|
|
31
|
+
// invalid DMS
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
var deg = Number.parseFloat(strDeg);
|
|
35
|
+
var min = Number.parseFloat(strMin);
|
|
36
|
+
var sec = Number.parseFloat(strSec);
|
|
37
|
+
if (!isNumber(deg) && !isNumber(min) && !isNumber(sec)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
deg = deg || 0;
|
|
41
|
+
min = min || 0;
|
|
42
|
+
sec = sec || 0;
|
|
43
|
+
var decimal = deg + min / 60 + sec / 3600;
|
|
44
|
+
if (direction === LAT_DIRECTION_TYPE.S || direction === LNG_DIRECTION_TYPE.W) {
|
|
45
|
+
return -Math.abs(decimal);
|
|
46
|
+
}
|
|
47
|
+
return decimal;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Parse LatLng-DMS string to degree
|
|
52
|
+
* e.g. 'N30°50′50.55″, E30.50′50.55″'
|
|
53
|
+
* @param {string} strLatLng
|
|
54
|
+
* @returns { lat, lng }, object
|
|
55
|
+
*/
|
|
56
|
+
var parseLatLngDMS = function parseLatLngDMS(strLatLngDMS) {
|
|
57
|
+
if (typeof strLatLngDMS !== 'string') {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
var _strLatLngDMS$split$m = strLatLngDMS.split(',').map(function (str) {
|
|
61
|
+
return str ? str.trim() : '';
|
|
62
|
+
}),
|
|
63
|
+
_strLatLngDMS$split$m2 = _slicedToArray(_strLatLngDMS$split$m, 2),
|
|
64
|
+
strLatDMS = _strLatLngDMS$split$m2[0],
|
|
65
|
+
strLngDMS = _strLatLngDMS$split$m2[1];
|
|
66
|
+
if (!strLatDMS || !strLngDMS) {
|
|
67
|
+
// invalid LatLng DMS
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
var latDirection = strLatDMS[0];
|
|
71
|
+
var lngDirection = strLngDMS[0];
|
|
72
|
+
if (!latDirection || !lngDirection || latDirection !== LAT_DIRECTION_TYPE.N && latDirection !== LAT_DIRECTION_TYPE.S || lngDirection !== LNG_DIRECTION_TYPE.E && lngDirection !== LNG_DIRECTION_TYPE.W) {
|
|
73
|
+
// invalid lat/lng direction
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
var strLat = strLatDMS.substring(1);
|
|
77
|
+
var strLng = strLngDMS.substring(1);
|
|
78
|
+
var lat = parseDMS(strLat, latDirection);
|
|
79
|
+
var lng = parseDMS(strLng, lngDirection);
|
|
80
|
+
if (!isNumber(lat) || !isNumber(lng)) {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
lat: lat,
|
|
85
|
+
lng: lng
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Parse LatLng-DMS string to degree
|
|
91
|
+
* e.g. '30.50, 30.50'
|
|
92
|
+
* @param {string} strLatLng
|
|
93
|
+
* @returns { lat, lng }, object
|
|
94
|
+
*/
|
|
95
|
+
var parseLngLatDegree = function parseLngLatDegree(strLngLat) {
|
|
96
|
+
// match floating point numbers
|
|
97
|
+
// ^[1-9]\d*\.\d+$ --> floating point type that does not start with 0
|
|
98
|
+
// ^0\.\d+$ --> floating point type starting with 0
|
|
99
|
+
// ^[1-9]\d*$ --> non-zero integer
|
|
100
|
+
// 0
|
|
101
|
+
if (typeof strLngLat !== 'string') {
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
var _strLngLat$split$map = strLngLat.split(',').map(function (str) {
|
|
105
|
+
return str ? str.trim() : '';
|
|
106
|
+
}),
|
|
107
|
+
_strLngLat$split$map2 = _slicedToArray(_strLngLat$split$map, 2),
|
|
108
|
+
strLng = _strLngLat$split$map2[0],
|
|
109
|
+
strLat = _strLngLat$split$map2[1];
|
|
110
|
+
if (!strLng || !strLat || !strLng.match(LNG_LAT_REG) || !strLat.match(LNG_LAT_REG)) {
|
|
111
|
+
return {};
|
|
112
|
+
}
|
|
113
|
+
var numLng = Number(strLng);
|
|
114
|
+
var numLat = Number(strLat);
|
|
115
|
+
if (!isNumber(numLng) || !isNumber(numLat)) {
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
lat: numLat,
|
|
120
|
+
lng: numLng
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Parse LatLng-DMS/LngLat-Degree string to degree
|
|
126
|
+
* @param {string} strLatLng
|
|
127
|
+
* @returns { lat, lng }, object
|
|
128
|
+
*/
|
|
129
|
+
var parseLatLng = function parseLatLng(strLatLng) {
|
|
130
|
+
if (strLatLng && (strLatLng.includes(LAT_DIRECTION_TYPE.N) && strLatLng.includes(LNG_DIRECTION_TYPE.E) || strLatLng.includes(LAT_DIRECTION_TYPE.S) && strLatLng.includes(LNG_DIRECTION_TYPE.W))) {
|
|
131
|
+
return parseLatLngDMS(strLatLng);
|
|
132
|
+
}
|
|
133
|
+
return parseLngLatDegree(strLatLng);
|
|
134
|
+
};
|
|
4
135
|
var formatTextToGeolocation = function formatTextToGeolocation(value, columnData) {
|
|
5
136
|
// compatible with the old version, the old version data may be null or undefined
|
|
6
137
|
var _ref = columnData || {},
|
|
7
138
|
_ref$geo_format = _ref.geo_format,
|
|
8
|
-
geo_format = _ref$geo_format === void 0 ?
|
|
139
|
+
geo_format = _ref$geo_format === void 0 ? GEOLOCATION_FORMAT.GEOLOCATION : _ref$geo_format;
|
|
9
140
|
var cellValue = value || '';
|
|
10
141
|
if (cellValue.length < 3) {
|
|
11
142
|
return {};
|
|
12
143
|
}
|
|
13
|
-
if (geo_format ===
|
|
14
|
-
|
|
15
|
-
// ^[1-9]\d*\.\d+$ --> floating point type that does not start with 0
|
|
16
|
-
// ^0\.\d+$ --> floating point type starting with 0
|
|
17
|
-
// ^[1-9]\d*$ --> non-zero integer
|
|
18
|
-
// 0
|
|
19
|
-
var reg = /^-?([1-9]\d*\.\d+|0\.\d+|[1-9]\d*|0)$/;
|
|
20
|
-
if (cellValue.indexOf(',') < 0) return {};
|
|
21
|
-
var lng_lat = cellValue.split(',');
|
|
22
|
-
if (lng_lat.length !== 2) {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
var lng = lng_lat[0].trim();
|
|
26
|
-
var lat = lng_lat[1].trim();
|
|
27
|
-
if (!lng || !lat) {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
if (!lng.match(reg) || !lat.match(reg)) {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
lng: lng,
|
|
35
|
-
lat: lat
|
|
36
|
-
};
|
|
144
|
+
if (geo_format === GEOLOCATION_FORMAT.LNG_LAT) {
|
|
145
|
+
return parseLatLng(cellValue);
|
|
37
146
|
}
|
|
38
147
|
var matchedProvince = cellValue.match(provinceReg);
|
|
39
148
|
var province = '';
|
|
@@ -65,4 +174,4 @@ var formatTextToGeolocation = function formatTextToGeolocation(value, columnData
|
|
|
65
174
|
};
|
|
66
175
|
};
|
|
67
176
|
|
|
68
|
-
export { formatTextToGeolocation };
|
|
177
|
+
export { formatTextToGeolocation, parseDMS, parseLatLng, parseLatLngDMS, parseLngLatDegree };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var LAT_DIRECTION_TYPE = {
|
|
2
|
+
N: 'N',
|
|
3
|
+
// North
|
|
4
|
+
S: 'S' // South
|
|
5
|
+
};
|
|
6
|
+
var LNG_DIRECTION_TYPE = {
|
|
7
|
+
E: 'E',
|
|
8
|
+
// East
|
|
9
|
+
W: 'W' // West
|
|
10
|
+
};
|
|
11
|
+
var DMS_SPLITTER_TYPE = {
|
|
12
|
+
DEG: '°',
|
|
13
|
+
MIN: '′',
|
|
14
|
+
SEC: '″'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { DMS_SPLITTER_TYPE, LAT_DIRECTION_TYPE, LNG_DIRECTION_TYPE };
|
package/es/date.js
CHANGED
|
@@ -8,6 +8,22 @@ var MATCH_1_2 = /\d\d?/; // 0 - 99
|
|
|
8
8
|
var MATCH2 = /\d\d/; // 00 - 99
|
|
9
9
|
var MATCH4 = /\d{4}/; // 0000 - 9999
|
|
10
10
|
|
|
11
|
+
var DATE_REG = /[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/;
|
|
12
|
+
var DATE_WITH_TIME_REG = /[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]/;
|
|
13
|
+
var RU_DATE_REG = /^(0[1-9]|[1-2][0-9]|3[0-1])\.(0?[1-9]|1[012])\.\d{4}$/;
|
|
14
|
+
var RU_TIME_REG = /^(0[1-9]|[1-2][0-9]|3[0-1])\.(0?[1-9]|1[012])\.\d{4} (2[0-3]|[01][0-9]):[0-5][0-9]$/;
|
|
15
|
+
|
|
16
|
+
// month <=12 day <= 9
|
|
17
|
+
// month <=12 day >= 13
|
|
18
|
+
var US_DATE_REG = /^([1-9]|1[0-2])\/([1-9]|[1-2][3-9]|3[0-1])\/[0-9]{4}$/;
|
|
19
|
+
var US_TIME_REG = /^([1-9]|1[0-2])\/([1-9]|[1-2][3-9]|3[0-1])\/[0-9]{4} (2[0-3]|[01][0-9]):[0-5][0-9]$/;
|
|
20
|
+
|
|
21
|
+
// 9 < day <= 12
|
|
22
|
+
// 9 < month <= 12
|
|
23
|
+
var MID_DATE_REG = /^(1[0-2])\/(1[0-2])\/[0-9]{4}$/;
|
|
24
|
+
var MID_TIME_REG = /^(1[0-2])\/(1[0-2])\/[0-9]{4} (2[0-3]|[01][0-9]):[0-5][0-9]$/;
|
|
25
|
+
var EU_DATE_REG = /^(0[1-9]|[1-2][0-9]|3[0-1])[\/\.](0?[1-9]|1[012])[\/\.]\d{4}$/;
|
|
26
|
+
var EU_TIME_REG = /^(0[1-9]|[1-2][0-9]|3[0-1])[\/\.](0?[1-9]|1[012])[\/\.]\d{4} (2[0-3]|[01][0-9]):[0-5][0-9]$/;
|
|
11
27
|
var MATCHER_EXPRESSIONS = {
|
|
12
28
|
mm: [MATCH_1_2, DATE_UNIT.MINUTES],
|
|
13
29
|
HH: [MATCH_1_2, DATE_UNIT.HOURS],
|
|
@@ -165,13 +181,32 @@ var DateUtils = /*#__PURE__*/function () {
|
|
|
165
181
|
}, {
|
|
166
182
|
key: "parseDateWithFormat",
|
|
167
183
|
value: function parseDateWithFormat(dateString, format) {
|
|
184
|
+
var newFormat = format;
|
|
168
185
|
if (dateString.includes('T')) {
|
|
169
186
|
// ISO 8601 format with "T" separator directly using Date object
|
|
170
187
|
var dateObj = new Date(dateString);
|
|
171
188
|
return this.isValidDateObject(dateObj) ? dateObj : this.getValidDate(dateString);
|
|
172
189
|
}
|
|
190
|
+
if (dateString.match(DATE_REG) || dateString.match(DATE_WITH_TIME_REG)) {
|
|
191
|
+
newFormat = format.indexOf('HH:mm') > -1 ? "".concat(DEFAULT_DATE_FORMAT, " HH:mm") : DEFAULT_DATE_FORMAT;
|
|
192
|
+
}
|
|
193
|
+
if (dateString.match(RU_DATE_REG) || dateString.match(RU_TIME_REG)) {
|
|
194
|
+
newFormat = format.indexOf('HH:mm') > -1 ? 'DD.MM.YYYY HH:mm' : 'DD.MM.YYYY';
|
|
195
|
+
}
|
|
196
|
+
var isUSDate = dateString.match(US_DATE_REG) || dateString.match(US_TIME_REG);
|
|
197
|
+
if (isUSDate) {
|
|
198
|
+
newFormat = format.indexOf('HH:mm') > -1 ? 'M/D/YYYY HH:mm' : 'M/D/YYYY';
|
|
199
|
+
}
|
|
200
|
+
var isEUDate = dateString.match(EU_DATE_REG) || dateString.match(EU_TIME_REG);
|
|
201
|
+
var isUsOrEuDate = dateString.match(MID_DATE_REG) || dateString.match(MID_TIME_REG);
|
|
202
|
+
var isUSFormat = ['M/D/YYYY HH:mm', 'M/D/YYYY'].includes(newFormat);
|
|
203
|
+
if (isUsOrEuDate && isUSFormat) {
|
|
204
|
+
newFormat = format.indexOf('HH:mm') > -1 ? 'M/D/YYYY HH:mm' : 'M/D/YYYY';
|
|
205
|
+
} else if (isEUDate) {
|
|
206
|
+
newFormat = format.indexOf('HH:mm') > -1 ? 'DD/MM/YYYY HH:mm' : 'DD/MM/YYYY';
|
|
207
|
+
}
|
|
173
208
|
try {
|
|
174
|
-
var parser = this.makeParser(
|
|
209
|
+
var parser = this.makeParser(newFormat);
|
|
175
210
|
var _parser = parser(dateString),
|
|
176
211
|
year = _parser.year,
|
|
177
212
|
month = _parser.month,
|
package/es/view/summaries.js
CHANGED
|
@@ -15,6 +15,7 @@ import '../constants/filter/filter-is-within.js';
|
|
|
15
15
|
import '../constants/sort.js';
|
|
16
16
|
import '../constants/group.js';
|
|
17
17
|
import { isNumericColumn } from '../column/number.js';
|
|
18
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
18
19
|
import 'dayjs';
|
|
19
20
|
import { getGroupsRowIds as _getGroupsRowIds } from '../group/core.js';
|
|
20
21
|
|
|
@@ -18,6 +18,7 @@ require('@babel/runtime/helpers/typeof');
|
|
|
18
18
|
require('../../date.js');
|
|
19
19
|
require('@babel/runtime/helpers/defineProperty');
|
|
20
20
|
require('@babel/runtime/helpers/toConsumableArray');
|
|
21
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
21
22
|
|
|
22
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
24
|
|
|
@@ -139,7 +139,6 @@ var getFormulaDisplayString = function getFormulaDisplayString(cellValue, column
|
|
|
139
139
|
* @param {object} formulaRows formula results of rows. Default as "{}"
|
|
140
140
|
* @param {array} collaborators e.g. [{ email, name, ... }, ...]. Default as "[]"
|
|
141
141
|
* @param {array} departments e.g. [{ name, id }, ...]. Default as "[]"
|
|
142
|
-
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true
|
|
143
142
|
* @param {string} geolocationHyphen Used as a connector between province, city, district and detail. Default as empty string
|
|
144
143
|
* @returns formatted cell value, string|array
|
|
145
144
|
*/
|
|
@@ -152,8 +151,6 @@ var getCellValueDisplayString = function getCellValueDisplayString(row, type, ke
|
|
|
152
151
|
collaborators = _ref2$collaborators === void 0 ? [] : _ref2$collaborators,
|
|
153
152
|
_ref2$departments = _ref2.departments,
|
|
154
153
|
departments = _ref2$departments === void 0 ? [] : _ref2$departments,
|
|
155
|
-
_ref2$isBaiduMap = _ref2.isBaiduMap,
|
|
156
|
-
isBaiduMap = _ref2$isBaiduMap === void 0 ? true : _ref2$isBaiduMap,
|
|
157
154
|
_ref2$geolocationHyph = _ref2.geolocationHyphen,
|
|
158
155
|
geolocationHyphen = _ref2$geolocationHyph === void 0 ? '' : _ref2$geolocationHyph;
|
|
159
156
|
if (!row) return '';
|
|
@@ -174,7 +171,6 @@ var getCellValueDisplayString = function getCellValueDisplayString(row, type, ke
|
|
|
174
171
|
case cellType.CellType.GEOLOCATION:
|
|
175
172
|
{
|
|
176
173
|
return geolocation.getGeolocationDisplayString(cellValue, data, {
|
|
177
|
-
isBaiduMap: isBaiduMap,
|
|
178
174
|
hyphen: geolocationHyphen
|
|
179
175
|
});
|
|
180
176
|
}
|
|
@@ -4,20 +4,55 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var group = require('../constants/group.js');
|
|
6
6
|
var column = require('../constants/column.js');
|
|
7
|
-
var
|
|
7
|
+
var number = require('../number.js');
|
|
8
|
+
var geolocation = require('../constants/geolocation.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Convert decimal to DMS
|
|
12
|
+
* @param {number} lat
|
|
13
|
+
* @param {bool} isLat Latitude: N/S, Longitude: E/W
|
|
14
|
+
* @returns { dms, direction }, object
|
|
15
|
+
*/
|
|
16
|
+
var convertToDMS = function convertToDMS(decimal) {
|
|
17
|
+
var isLat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18
|
+
if (!number.isNumber(decimal) && typeof decimal !== 'string') return {};
|
|
19
|
+
var numDecimal = typeof decimal === 'string' ? Number.parseFloat(decimal) : decimal;
|
|
20
|
+
if (!number.isNumber(numDecimal)) return {};
|
|
21
|
+
var degrees = Math.floor(Math.abs(numDecimal));
|
|
22
|
+
var minutesDecimal = Number.parseFloat(((Math.abs(numDecimal) - degrees) * 60).toFixed(8));
|
|
23
|
+
var minutes = Math.floor(minutesDecimal);
|
|
24
|
+
var seconds = Number.parseFloat(((minutesDecimal - minutes) * 60).toFixed(8));
|
|
25
|
+
var direction = '';
|
|
26
|
+
if (isLat) {
|
|
27
|
+
direction = numDecimal >= 0 ? geolocation.LAT_DIRECTION_TYPE.N : geolocation.LAT_DIRECTION_TYPE.S;
|
|
28
|
+
} else {
|
|
29
|
+
direction = numDecimal >= 0 ? geolocation.LNG_DIRECTION_TYPE.E : geolocation.LNG_DIRECTION_TYPE.W;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
dms: "".concat(degrees).concat(geolocation.DMS_SPLITTER_TYPE.DEG).concat(minutes).concat(geolocation.DMS_SPLITTER_TYPE.MIN).concat(seconds).concat(geolocation.DMS_SPLITTER_TYPE.SEC),
|
|
33
|
+
direction: direction
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
var getLatLngDisplayString = function getLatLngDisplayString(lat, lng) {
|
|
37
|
+
var _convertToDMS = convertToDMS(lat, true),
|
|
38
|
+
lat_dms = _convertToDMS.dms,
|
|
39
|
+
lat_direction = _convertToDMS.direction;
|
|
40
|
+
var _convertToDMS2 = convertToDMS(lng),
|
|
41
|
+
lng_dms = _convertToDMS2.dms,
|
|
42
|
+
lng_direction = _convertToDMS2.direction;
|
|
43
|
+
if (!lat_dms || !lng_dms) return '';
|
|
44
|
+
return "".concat(lat_direction).concat(lat_dms, ", ").concat(lng_direction).concat(lng_dms);
|
|
45
|
+
};
|
|
8
46
|
|
|
9
47
|
/**
|
|
10
48
|
* Get formatted geolocation
|
|
11
49
|
* @param {object} loc
|
|
12
50
|
* @param {object} formats , e.g. { geo_format, ... }
|
|
13
|
-
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true
|
|
14
51
|
* @param {string} hyphen Used as a connector between province, city, district and detail. Default as empty string
|
|
15
52
|
* @returns formatted geolocation, string
|
|
16
53
|
*/
|
|
17
54
|
var getGeolocationDisplayString = function getGeolocationDisplayString(loc, formats) {
|
|
18
55
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
19
|
-
_ref$isBaiduMap = _ref.isBaiduMap,
|
|
20
|
-
isBaiduMap = _ref$isBaiduMap === void 0 ? true : _ref$isBaiduMap,
|
|
21
56
|
_ref$hyphen = _ref.hyphen,
|
|
22
57
|
hyphen = _ref$hyphen === void 0 ? '' : _ref$hyphen;
|
|
23
58
|
if (!loc) return '';
|
|
@@ -28,8 +63,7 @@ var getGeolocationDisplayString = function getGeolocationDisplayString(loc, form
|
|
|
28
63
|
{
|
|
29
64
|
var lng = loc.lng,
|
|
30
65
|
lat = loc.lat;
|
|
31
|
-
|
|
32
|
-
return isBaiduMap ? "".concat(lng, ", ").concat(lat) : "".concat(lat, ", ").concat(lng);
|
|
66
|
+
return getLatLngDisplayString(lat, lng);
|
|
33
67
|
}
|
|
34
68
|
case column.GEOLOCATION_FORMAT.COUNTRY_REGION:
|
|
35
69
|
{
|
|
@@ -105,5 +139,7 @@ var getGeolocationByGranularity = function getGeolocationByGranularity(geolocati
|
|
|
105
139
|
}
|
|
106
140
|
};
|
|
107
141
|
|
|
142
|
+
exports.convertToDMS = convertToDMS;
|
|
108
143
|
exports.getGeolocationByGranularity = getGeolocationByGranularity;
|
|
109
144
|
exports.getGeolocationDisplayString = getGeolocationDisplayString;
|
|
145
|
+
exports.getLatLngDisplayString = getLatLngDisplayString;
|
|
@@ -2,42 +2,155 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
6
|
+
var column = require('../constants/column.js');
|
|
7
|
+
require('../constants/filter/filter-column-options.js');
|
|
8
|
+
require('../constants/filter/filter-modifier.js');
|
|
9
|
+
require('../constants/filter/filter-predicate.js');
|
|
10
|
+
require('../constants/filter/filter-is-within.js');
|
|
11
|
+
require('../constants/formula.js');
|
|
12
|
+
require('../constants/sort.js');
|
|
13
|
+
require('../constants/group.js');
|
|
14
|
+
var geolocation = require('../constants/geolocation.js');
|
|
15
|
+
var number = require('../number.js');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
20
|
+
|
|
5
21
|
var provinceReg = /.+省|.+自治区|.+特别行政区|北京市|天津市|上海市|重庆市|安徽|福建|甘肃|广东|广西|贵州|海南|河北|河南|黑龙江|湖北|湖南|吉林|江苏|江西|辽宁|内蒙古|宁夏|青海|山东|山西|陕西|四川|西藏|新疆|云南|浙江|北京|上海|天津|重庆/;
|
|
6
22
|
var cityReg = /.+自治州|[^市]+市|.+盟|.+地区|.+区划/;
|
|
7
23
|
var districtReg = /(.+市|.+县|.+旗|.+区)/;
|
|
24
|
+
var LNG_LAT_REG = /^-?([1-9]\d*\.\d+|0\.\d+|[1-9]\d*|0)$/;
|
|
25
|
+
var DMS_DEG_REG = new RegExp("(\\d+(?:\\.\\d+)?)".concat(geolocation.DMS_SPLITTER_TYPE.DEG));
|
|
26
|
+
var DMS_MIN_REG = new RegExp("(\\d+(?:\\.\\d+)?)".concat(geolocation.DMS_SPLITTER_TYPE.MIN));
|
|
27
|
+
var DMS_SEC_REG = new RegExp("(\\d+(?:\\.\\d+)?)".concat(geolocation.DMS_SPLITTER_TYPE.SEC));
|
|
28
|
+
var parseDMS = function parseDMS(dms, direction) {
|
|
29
|
+
if (typeof dms !== 'string') {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
var degMatches = dms.match(DMS_DEG_REG);
|
|
33
|
+
var minMatches = dms.match(DMS_MIN_REG);
|
|
34
|
+
var secMatches = dms.match(DMS_SEC_REG);
|
|
35
|
+
var strDeg = degMatches && degMatches[1];
|
|
36
|
+
var strMin = minMatches && minMatches[1];
|
|
37
|
+
var strSec = secMatches && secMatches[1];
|
|
38
|
+
if (!strDeg && !strMin && !strSec) {
|
|
39
|
+
// invalid DMS
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
var deg = Number.parseFloat(strDeg);
|
|
43
|
+
var min = Number.parseFloat(strMin);
|
|
44
|
+
var sec = Number.parseFloat(strSec);
|
|
45
|
+
if (!number.isNumber(deg) && !number.isNumber(min) && !number.isNumber(sec)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
deg = deg || 0;
|
|
49
|
+
min = min || 0;
|
|
50
|
+
sec = sec || 0;
|
|
51
|
+
var decimal = deg + min / 60 + sec / 3600;
|
|
52
|
+
if (direction === geolocation.LAT_DIRECTION_TYPE.S || direction === geolocation.LNG_DIRECTION_TYPE.W) {
|
|
53
|
+
return -Math.abs(decimal);
|
|
54
|
+
}
|
|
55
|
+
return decimal;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Parse LatLng-DMS string to degree
|
|
60
|
+
* e.g. 'N30°50′50.55″, E30.50′50.55″'
|
|
61
|
+
* @param {string} strLatLng
|
|
62
|
+
* @returns { lat, lng }, object
|
|
63
|
+
*/
|
|
64
|
+
var parseLatLngDMS = function parseLatLngDMS(strLatLngDMS) {
|
|
65
|
+
if (typeof strLatLngDMS !== 'string') {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
var _strLatLngDMS$split$m = strLatLngDMS.split(',').map(function (str) {
|
|
69
|
+
return str ? str.trim() : '';
|
|
70
|
+
}),
|
|
71
|
+
_strLatLngDMS$split$m2 = _slicedToArray__default["default"](_strLatLngDMS$split$m, 2),
|
|
72
|
+
strLatDMS = _strLatLngDMS$split$m2[0],
|
|
73
|
+
strLngDMS = _strLatLngDMS$split$m2[1];
|
|
74
|
+
if (!strLatDMS || !strLngDMS) {
|
|
75
|
+
// invalid LatLng DMS
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
var latDirection = strLatDMS[0];
|
|
79
|
+
var lngDirection = strLngDMS[0];
|
|
80
|
+
if (!latDirection || !lngDirection || latDirection !== geolocation.LAT_DIRECTION_TYPE.N && latDirection !== geolocation.LAT_DIRECTION_TYPE.S || lngDirection !== geolocation.LNG_DIRECTION_TYPE.E && lngDirection !== geolocation.LNG_DIRECTION_TYPE.W) {
|
|
81
|
+
// invalid lat/lng direction
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
var strLat = strLatDMS.substring(1);
|
|
85
|
+
var strLng = strLngDMS.substring(1);
|
|
86
|
+
var lat = parseDMS(strLat, latDirection);
|
|
87
|
+
var lng = parseDMS(strLng, lngDirection);
|
|
88
|
+
if (!number.isNumber(lat) || !number.isNumber(lng)) {
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
lat: lat,
|
|
93
|
+
lng: lng
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Parse LatLng-DMS string to degree
|
|
99
|
+
* e.g. '30.50, 30.50'
|
|
100
|
+
* @param {string} strLatLng
|
|
101
|
+
* @returns { lat, lng }, object
|
|
102
|
+
*/
|
|
103
|
+
var parseLngLatDegree = function parseLngLatDegree(strLngLat) {
|
|
104
|
+
// match floating point numbers
|
|
105
|
+
// ^[1-9]\d*\.\d+$ --> floating point type that does not start with 0
|
|
106
|
+
// ^0\.\d+$ --> floating point type starting with 0
|
|
107
|
+
// ^[1-9]\d*$ --> non-zero integer
|
|
108
|
+
// 0
|
|
109
|
+
if (typeof strLngLat !== 'string') {
|
|
110
|
+
return {};
|
|
111
|
+
}
|
|
112
|
+
var _strLngLat$split$map = strLngLat.split(',').map(function (str) {
|
|
113
|
+
return str ? str.trim() : '';
|
|
114
|
+
}),
|
|
115
|
+
_strLngLat$split$map2 = _slicedToArray__default["default"](_strLngLat$split$map, 2),
|
|
116
|
+
strLng = _strLngLat$split$map2[0],
|
|
117
|
+
strLat = _strLngLat$split$map2[1];
|
|
118
|
+
if (!strLng || !strLat || !strLng.match(LNG_LAT_REG) || !strLat.match(LNG_LAT_REG)) {
|
|
119
|
+
return {};
|
|
120
|
+
}
|
|
121
|
+
var numLng = Number(strLng);
|
|
122
|
+
var numLat = Number(strLat);
|
|
123
|
+
if (!number.isNumber(numLng) || !number.isNumber(numLat)) {
|
|
124
|
+
return {};
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
lat: numLat,
|
|
128
|
+
lng: numLng
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Parse LatLng-DMS/LngLat-Degree string to degree
|
|
134
|
+
* @param {string} strLatLng
|
|
135
|
+
* @returns { lat, lng }, object
|
|
136
|
+
*/
|
|
137
|
+
var parseLatLng = function parseLatLng(strLatLng) {
|
|
138
|
+
if (strLatLng && (strLatLng.includes(geolocation.LAT_DIRECTION_TYPE.N) && strLatLng.includes(geolocation.LNG_DIRECTION_TYPE.E) || strLatLng.includes(geolocation.LAT_DIRECTION_TYPE.S) && strLatLng.includes(geolocation.LNG_DIRECTION_TYPE.W))) {
|
|
139
|
+
return parseLatLngDMS(strLatLng);
|
|
140
|
+
}
|
|
141
|
+
return parseLngLatDegree(strLatLng);
|
|
142
|
+
};
|
|
8
143
|
var formatTextToGeolocation = function formatTextToGeolocation(value, columnData) {
|
|
9
144
|
// compatible with the old version, the old version data may be null or undefined
|
|
10
145
|
var _ref = columnData || {},
|
|
11
146
|
_ref$geo_format = _ref.geo_format,
|
|
12
|
-
geo_format = _ref$geo_format === void 0 ?
|
|
147
|
+
geo_format = _ref$geo_format === void 0 ? column.GEOLOCATION_FORMAT.GEOLOCATION : _ref$geo_format;
|
|
13
148
|
var cellValue = value || '';
|
|
14
149
|
if (cellValue.length < 3) {
|
|
15
150
|
return {};
|
|
16
151
|
}
|
|
17
|
-
if (geo_format ===
|
|
18
|
-
|
|
19
|
-
// ^[1-9]\d*\.\d+$ --> floating point type that does not start with 0
|
|
20
|
-
// ^0\.\d+$ --> floating point type starting with 0
|
|
21
|
-
// ^[1-9]\d*$ --> non-zero integer
|
|
22
|
-
// 0
|
|
23
|
-
var reg = /^-?([1-9]\d*\.\d+|0\.\d+|[1-9]\d*|0)$/;
|
|
24
|
-
if (cellValue.indexOf(',') < 0) return {};
|
|
25
|
-
var lng_lat = cellValue.split(',');
|
|
26
|
-
if (lng_lat.length !== 2) {
|
|
27
|
-
return {};
|
|
28
|
-
}
|
|
29
|
-
var lng = lng_lat[0].trim();
|
|
30
|
-
var lat = lng_lat[1].trim();
|
|
31
|
-
if (!lng || !lat) {
|
|
32
|
-
return {};
|
|
33
|
-
}
|
|
34
|
-
if (!lng.match(reg) || !lat.match(reg)) {
|
|
35
|
-
return {};
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
lng: lng,
|
|
39
|
-
lat: lat
|
|
40
|
-
};
|
|
152
|
+
if (geo_format === column.GEOLOCATION_FORMAT.LNG_LAT) {
|
|
153
|
+
return parseLatLng(cellValue);
|
|
41
154
|
}
|
|
42
155
|
var matchedProvince = cellValue.match(provinceReg);
|
|
43
156
|
var province = '';
|
|
@@ -70,3 +183,7 @@ var formatTextToGeolocation = function formatTextToGeolocation(value, columnData
|
|
|
70
183
|
};
|
|
71
184
|
|
|
72
185
|
exports.formatTextToGeolocation = formatTextToGeolocation;
|
|
186
|
+
exports.parseDMS = parseDMS;
|
|
187
|
+
exports.parseLatLng = parseLatLng;
|
|
188
|
+
exports.parseLatLngDMS = parseLatLngDMS;
|
|
189
|
+
exports.parseLngLatDegree = parseLngLatDegree;
|